[VDPAU] [PATCH] try DRI2DriverDRI name on DRI2DriverVDPAU absence

Rinat Ibragimov ibragimovrinat at mail.ru
Mon Dec 23 13:27:37 PST 2013


Ping.

Среда, 11 декабря 2013, 1:57 +04:00 от Rinat Ibragimov <ibragimovrinat at mail.ru>:
>Hi. I'm making VDPAU driver with OpenGL/VA-API backend. Implementation is still incomplete, but
>already works for both Mplayer and Flash Player. Some time ago there was packaging attempt at
>https://bugzilla.rpmfusion.org/show_bug.cgi?id=2897 . And they confronted with difficulties of
>enabling it on target hardware -- on integrated intel chips. You know, using VDPAU_DRIVER for
>development is fine, but in package it's dangerous as it can break things on nVidia hardware,
>where native VDPAU is available. Unfortunately, intel Xorg driver is the only one that
>does not support DRI2DriverVDPAU name, therefore it's impossible to make autoloading work.
>My attempts to add support of DRI2DriverVDPAU was futile. Looks like nobody interested in that on
>their side.
>
>So I have a humble proposal to make libvdpau try DRI2DriverDRI if DRI2DriverVDPAU fails for some
>reason. That way on intel equipped machines libvdpau will try to load libvdpau_i965.so. Other
>machines with other videoadapters will not be affected.
>
>Rinat
>
>
>---
> src/mesa_dri2.c     |  5 +++--
> src/mesa_dri2.h     |  2 +-
> src/vdpau_wrapper.c | 12 +++++++++---
> 3 files changed, 13 insertions(+), 6 deletions(-)
>
>diff --git a/src/mesa_dri2.c b/src/mesa_dri2.c
>index 5f7146a..4dc1e85 100644
>--- a/src/mesa_dri2.c
>+++ b/src/mesa_dri2.c
>@@ -114,7 +114,8 @@ _vdp_DRI2QueryVersion(Display * dpy, int *major, int *minor)
> }
> 
> Bool
>-_vdp_DRI2Connect(Display * dpy, XID window, char **driverName, char **deviceName)
>+_vdp_DRI2Connect(Display * dpy, XID window, char **driverName, char **deviceName,
>+                 int driverType)
> {
>    XExtDisplayInfo *info = DRI2FindDisplay(dpy);
>    xDRI2ConnectReply rep;
>@@ -127,7 +128,7 @@ _vdp_DRI2Connect(Display * dpy, XID window, char **driverName, char **deviceName
>    req->reqType = info->codes->major_opcode;
>    req->dri2ReqType = X_DRI2Connect;
>    req->window = window;
>-   req->driverType = DRI2DriverVDPAU;
>+   req->driverType = driverType;
> #ifdef DRI2DriverPrimeShift
>    {
>       char *prime = getenv("DRI_PRIME");
>diff --git a/src/mesa_dri2.h b/src/mesa_dri2.h
>index 09bde8c..a3bedfd 100644
>--- a/src/mesa_dri2.h
>+++ b/src/mesa_dri2.h
>@@ -45,7 +45,7 @@ _vdp_DRI2QueryVersion(Display * display, int *major, int *minor);
> 
> extern Bool
> _vdp_DRI2Connect(Display * display, XID window, char **driverName,
>-                 char **deviceName);
>+                 char **deviceName, int driverType);
> 
> extern void
> _vdp_DRI2RemoveExtension(Display * display);
>diff --git a/src/vdpau_wrapper.c b/src/vdpau_wrapper.c
>index 9932937..dccf168 100644
>--- a/src/vdpau_wrapper.c
>+++ b/src/vdpau_wrapper.c
>@@ -90,9 +90,15 @@ static char * _vdp_get_driver_name_from_dri2(
>         return NULL;
>     }
> 
>-    if (!_vdp_DRI2Connect(display, root, &driver_name, &device_name)) {
>-        _vdp_DRI2RemoveExtension(display);
>-        return NULL;
>+    if (!_vdp_DRI2Connect(display, root, &driver_name, &device_name,
>+                          DRI2DriverVDPAU))
>+    {
>+        if (!_vdp_DRI2Connect(display, root, &driver_name, &device_name,
>+                              DRI2DriverDRI))
>+        {
>+            _vdp_DRI2RemoveExtension(display);
>+            return NULL;
>+        }
>     }
> 
>     XFree(device_name);
>-- 
>1.8.4.3
>
>_______________________________________________
>VDPAU mailing list
>VDPAU at lists.freedesktop.org
>http://lists.freedesktop.org/mailman/listinfo/vdpau


---
Rinat


More information about the VDPAU mailing list