[PATCH] vdpau: add prime support at connection setup

Dave Airlie airlied at gmail.com
Wed Jul 24 20:29:28 PDT 2013


From: Dave Airlie <airlied at redhat.com>

This just ports the code from the mesa glx setup into vdpau,
this just picks the correct driver to load on the client side,

at least for gallium/vl code we need another similiar change
inside the driver code to pick the correct drm device.

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 src/mesa_dri2.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/mesa_dri2.c b/src/mesa_dri2.c
index 3bc75ef..5f7146a 100644
--- a/src/mesa_dri2.c
+++ b/src/mesa_dri2.c
@@ -128,6 +128,20 @@ _vdp_DRI2Connect(Display * dpy, XID window, char **driverName, char **deviceName
    req->dri2ReqType = X_DRI2Connect;
    req->window = window;
    req->driverType = DRI2DriverVDPAU;
+#ifdef DRI2DriverPrimeShift
+   {
+      char *prime = getenv("DRI_PRIME");
+      if (prime) {
+         unsigned int primeid;
+         errno = 0;
+         primeid = strtoul(prime, NULL, 0);
+         if (errno == 0)
+            req->driverType |=
+               ((primeid & DRI2DriverPrimeMask) << DRI2DriverPrimeShift);
+      }
+   }
+#endif
+
    if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
       UnlockDisplay(dpy);
       SyncHandle();
-- 
1.8.3.1



More information about the xorg-devel mailing list