summaryrefslogtreecommitdiff
path: root/gst-libs
diff options
context:
space:
mode:
authorVíctor Manuel Jáquez Leal <victorx.jaquez@intel.com>2016-12-06 17:33:42 +0100
committerVíctor Manuel Jáquez Leal <victorx.jaquez@intel.com>2016-12-06 17:33:42 +0100
commit7aeefb09904baf807e342b30093c38f3976e593f (patch)
treecf1363c7aeb98527e5f25ffa73da6166af905015 /gst-libs
parentad8da84062d87fb93a03c6682ab792c94034be54 (diff)
libs: drm: find render node in hybrid system
Originally the drm backend only tried to open the first render node found. But in hybrid system this first render node might not support VA-API (propietary Nvidia driver, for example). This patch tries all the available nodes until a finding one with a VA-API supported driver. https://bugzilla.gnome.org/show_bug.cgi?id=774811 Original-patch-by: Stirling Westrup <swestrup@gmail.com> and Reza Razavi <reza@userful.com>
Diffstat (limited to 'gst-libs')
-rw-r--r--gst-libs/gst/vaapi/gstvaapidisplay_drm.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/gst-libs/gst/vaapi/gstvaapidisplay_drm.c b/gst-libs/gst/vaapi/gstvaapidisplay_drm.c
index 44e4cbd8..1150f753 100644
--- a/gst-libs/gst/vaapi/gstvaapidisplay_drm.c
+++ b/gst-libs/gst/vaapi/gstvaapidisplay_drm.c
@@ -58,6 +58,22 @@ typedef enum
static DRMDeviceType g_drm_device_type;
static GMutex g_drm_device_type_lock;
+static gboolean
+supports_vaapi (int fd)
+{
+ gboolean ret;
+ VADisplay va_dpy;
+ int major, minor;
+
+ va_dpy = vaGetDisplayDRM (fd);
+ if (!va_dpy)
+ return FALSE;
+
+ ret = (vaInitialize (va_dpy, &major, &minor) == VA_STATUS_SUCCESS);
+ vaTerminate (va_dpy);
+ return ret;
+}
+
/* Get default device path. Actually, the first match in the DRM subsystem */
static const gchar *
get_default_device_path (GstVaapiDisplay * display)
@@ -109,10 +125,12 @@ get_default_device_path (GstVaapiDisplay * display)
continue;
}
- priv->device_path_default = g_strdup (devpath);
+ if (supports_vaapi (fd))
+ priv->device_path_default = g_strdup (devpath);
close (fd);
udev_device_unref (device);
- break;
+ if (priv->device_path_default)
+ break;
}
end: