gstreamer-media-SDK icon indicating copy to clipboard operation
gstreamer-media-SDK copied to clipboard

Select correct DRM dvice, when has several GPUs

Open lubagov opened this issue 6 years ago • 6 comments

Hello! I have to install on my PC NVidia P106 device. And also has second PC with NVidia GTX1050. On this both device, GST-MFX select wrong DRI device.

libva info: VA-API version 1.3.0 libva info: va_getDriverName() returns 0 
libva info: User requested driver 'iHD' 
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so 
libva info: Found init function __vaDriverInit_1_3 
DRM_IOCTL_I915_GEM_APERTURE failed: Недопустимый аргумент 
Assuming 131072kB available aperture size. 
May lead to reduced performance or incorrect rendering. 
get chip id failed: -1 [22] param: 4, val: 0 
libva error: /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so 
init failed libva info: va_openDriver() returns 1

I have solve it, this way:

--- gstreamer-media-sdk-2.1.1.orig/gst-mfx/gst-libs/mfx/gstmfxdisplay.c
+++ gstreamer-media-sdk-2.1.1/gst-mfx/gst-libs/mfx/gstmfxdisplay.c
@@ -72,6 +72,11 @@ get_display_fd (GstMfxDisplay * display)
           continue;
         }
 
+        if (strcmp (udev_device_get_driver(parent), "i915")!=0) {
+          udev_device_unref (device);
+          continue;
+        }
+
         devpath = udev_device_get_devnode (device);
         priv->display_fd = open (devpath, O_RDWR | O_CLOEXEC);
         if (priv->display_fd < 0) {

But don't think, this way is correct, because theoretically, not only the i915 could be a device driver. But it working. Is is possible to solve it? Or get right way for select? Some issue about this in libva-tools https://github.com/intel/intel-vaapi-driver/issues/293

lubagov avatar Dec 26 '18 16:12 lubagov

Perhaps a cleaner solution would be to use an environmental variable to set the path of the DRM device instead of this hack.

ishmael1985 avatar Dec 29 '18 12:12 ishmael1985

What variable i should use? LIBVA_DEVICE_NAME / LIBVA_RENDER_DEVICE_NAME some else?

lubagov avatar Dec 29 '18 13:12 lubagov

Maybe LIBVA_DEVICE_PATH could be a good name.

ishmael1985 avatar Dec 29 '18 13:12 ishmael1985

Do you mean it can be added to the code? Or is it already done?

lubagov avatar Dec 29 '18 13:12 lubagov

It's not done. Could be added to the code....

ishmael1985 avatar Dec 29 '18 14:12 ishmael1985

Any progress?

5l1v3r1 avatar Oct 16 '20 23:10 5l1v3r1