mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-10 03:19:40 +00:00
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>
This commit is contained in:
parent
ad8da84062
commit
7aeefb0990
1 changed files with 20 additions and 2 deletions
|
@ -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,9 +125,11 @@ get_default_device_path (GstVaapiDisplay * display)
|
|||
continue;
|
||||
}
|
||||
|
||||
if (supports_vaapi (fd))
|
||||
priv->device_path_default = g_strdup (devpath);
|
||||
close (fd);
|
||||
udev_device_unref (device);
|
||||
if (priv->device_path_default)
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue