summaryrefslogtreecommitdiff
path: root/src/gallium
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2013-07-25 13:31:26 +1000
committerIan Romanick <ian.d.romanick@intel.com>2013-08-05 15:41:14 -0700
commitc6f6b4e16186bfa90c62e0c3e780c12377861dae (patch)
treeb5322fa2ff2dd5402be96049a7f03e3fbbdb86b8 /src/gallium
parent4f5e18cb3e062223ee874af47214f34d0d8a346a (diff)
gallium/vl: add prime support
This fixes the dri2 opening to check if DRI_PRIME is set, and picks the correct drm device path to open, this along with a change to libvdpau allows vdpauinfo to work at least, Martin Peres tested with nouveau, and there seems to be a further issue with final displaying, it only works sometimes, but this patch is at least necessary to help debug further. Signed-off-by: Dave Airlie <airlied@redhat.com> Cc: mesa-stable@lists.freedesktop.org Reviewed-by: Christian König <christian.koenig@amd.com> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=67283 Tested-by: Armin K. <krejzi@email.com> (cherry picked from commit 19338157c97becac1e61cc51dc0904ddfab8e9da)
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/auxiliary/vl/vl_winsys_dri.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/gallium/auxiliary/vl/vl_winsys_dri.c b/src/gallium/auxiliary/vl/vl_winsys_dri.c
index 88e17fefb8a..7aec3fee685 100644
--- a/src/gallium/auxiliary/vl/vl_winsys_dri.c
+++ b/src/gallium/auxiliary/vl/vl_winsys_dri.c
@@ -32,8 +32,10 @@
#include <fcntl.h>
#include <X11/Xlib-xcb.h>
+#include <X11/extensions/dri2tokens.h>
#include <xcb/dri2.h>
#include <xf86drm.h>
+#include <errno.h>
#include "pipe/p_screen.h"
#include "pipe/p_context.h"
@@ -305,6 +307,7 @@ vl_screen_create(Display *display, int screen)
xcb_generic_error_t *error = NULL;
char *device_name;
int fd, device_name_length;
+ unsigned int driverType;
drm_magic_t magic;
@@ -332,7 +335,22 @@ vl_screen_create(Display *display, int screen)
s = xcb_setup_roots_iterator(xcb_get_setup(scrn->conn));
while (screen--)
xcb_screen_next(&s);
- connect_cookie = xcb_dri2_connect_unchecked(scrn->conn, s.data->root, XCB_DRI2_DRIVER_TYPE_DRI);
+ driverType = XCB_DRI2_DRIVER_TYPE_DRI;
+#ifdef DRI2DriverPrimeShift
+ {
+ char *prime = getenv("DRI_PRIME");
+ if (prime) {
+ unsigned int primeid;
+ errno = 0;
+ primeid = strtoul(prime, NULL, 0);
+ if (errno == 0)
+ driverType |=
+ ((primeid & DRI2DriverPrimeMask) << DRI2DriverPrimeShift);
+ }
+ }
+#endif
+
+ connect_cookie = xcb_dri2_connect_unchecked(scrn->conn, s.data->root, driverType);
connect = xcb_dri2_connect_reply(scrn->conn, connect_cookie, NULL);
if (connect == NULL || connect->driver_name_length + connect->device_name_length == 0)
goto free_screen;