Skip to content

Commit

Permalink
add a way for the user to find gpu driver / device
Browse files Browse the repository at this point in the history
  • Loading branch information
DawidWesierski4 committed Sep 10, 2024
1 parent adcb05d commit 4f951a4
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
16 changes: 15 additions & 1 deletion ecosystem/ffmpeg_plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,21 @@ enabled gpu_direct:
```

#### Additional Notes
GPU Direct Flag: When compiling FFmpeg with the MTL_GPU_DIRECT feature enabled, ensure that your system's GPU drivers and hardware support direct GPU memory access.
**GPU Direct Flag:** When compiling FFmpeg with the MTL_GPU_DIRECT feature enabled, ensure that your system's GPU drivers and hardware support direct GPU memory access.
GPU device IDs and GPU driver IDs are printed during initialization.

**Options:**
1. `-gpu_device`
1. `-gpu_driver`

Both default to 0, but if your device doesn't initialize, adjust it using the information printed during initialization.

**Example:**
```
Drivers count: 1
Driver: 0: Device: 0: Name: Intel(R) Data Center GPU Flex 170, Type: 1, VendorID: 8086, DeviceID: 22208
```


[GPU Documentation](../../doc/gpu.md)

Expand Down
9 changes: 6 additions & 3 deletions ecosystem/ffmpeg_plugin/mtl_st20p_rx.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,12 @@ static int mtl_st20p_read_header(AVFormatContext* ctx) {
/* create context for one gpu device */
GpuContext gpu_ctx = {0};

int res = init_gpu_device(&gpu_ctx, s->gpu_driver_index, s->gpu_device_index);
if (res < 0) {
err(ctx, "%s, app gpu initialization failed %d\n", __func__, res);
/* print GPU device and driver IDs */
print_gpu_drivers_and_devices();

ret = init_gpu_device(&gpu_ctx, s->gpu_driver_index, s->gpu_device_index);
if (ret < 0) {
err(ctx, "%s, app gpu initialization failed %d\n", __func__, ret);
return -ENXIO;
}
ops_rx.gpu_context = (void*)(&gpu_ctx);
Expand Down

0 comments on commit 4f951a4

Please sign in to comment.