Mesa (master): glx/dri2: add dri2 prime support.

Dave Airlie airlied at kemper.freedesktop.org
Thu Aug 16 00:02:28 UTC 2012


Module: Mesa
Branch: master
Commit: 6a3ac03f2b80c80655d66b31c0218754f70156de
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=6a3ac03f2b80c80655d66b31c0218754f70156de

Author: Dave Airlie <airlied at redhat.com>
Date:   Fri Mar 12 16:09:23 2010 +1000

glx/dri2: add dri2 prime support.

This adds support for having libGL pick a different driver for prime support.

DRI_PRIME env var is set to the value retrieved from the server randr
provider calls, by the calling process. (generally DRI_PRIME=1 will be
the right answer).

Signed-off-by: Dave Airlie <airlied at redhat.com>

---

 src/glx/dri2.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/src/glx/dri2.c b/src/glx/dri2.c
index b1b5013..d6b99db 100644
--- a/src/glx/dri2.c
+++ b/src/glx/dri2.c
@@ -269,6 +269,7 @@ DRI2Connect(Display * dpy, XID window, char **driverName, char **deviceName)
    XExtDisplayInfo *info = DRI2FindDisplay(dpy);
    xDRI2ConnectReply rep;
    xDRI2ConnectReq *req;
+   char *prime;
 
    XextCheckExtension(dpy, info, dri2ExtensionName, False);
 
@@ -277,7 +278,19 @@ DRI2Connect(Display * dpy, XID window, char **driverName, char **deviceName)
    req->reqType = info->codes->major_opcode;
    req->dri2ReqType = X_DRI2Connect;
    req->window = window;
+
    req->driverType = DRI2DriverDRI;
+#ifdef DRI2DriverPrimeShift
+   prime = getenv("DRI_PRIME");
+   if (prime) {
+      uint32_t 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();




More information about the mesa-commit mailing list