summaryrefslogtreecommitdiff
path: root/driver/xf86-video-ati/src/radeon_dri3.c
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2018-02-20 04:49:21 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2018-02-20 04:49:21 +0000
commit40a68c6fedd9258c6bf447148c3cff6bd736b68e (patch)
treef55e696a2893a6e7d7de4477ec07440f0a639816 /driver/xf86-video-ati/src/radeon_dri3.c
parent4048c5820e6ab974cea18498a5ed28f0f0e966e0 (diff)
update to xf86-video-ati 7.10.0
tested by matthieu@ and myself on a wide range of radeons
Diffstat (limited to 'driver/xf86-video-ati/src/radeon_dri3.c')
-rw-r--r--driver/xf86-video-ati/src/radeon_dri3.c41
1 files changed, 37 insertions, 4 deletions
diff --git a/driver/xf86-video-ati/src/radeon_dri3.c b/driver/xf86-video-ati/src/radeon_dri3.c
index 43a073be5..3e689ffd7 100644
--- a/driver/xf86-video-ati/src/radeon_dri3.c
+++ b/driver/xf86-video-ati/src/radeon_dri3.c
@@ -40,11 +40,10 @@
#include <errno.h>
#include <libgen.h>
-
-static int
-radeon_dri3_open(ScreenPtr screen, RRProviderPtr provider, int *out)
+static int open_master_node(ScreenPtr screen, int *out)
{
ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
+ RADEONEntPtr pRADEONEnt = RADEONEntPriv(scrn);
RADEONInfoPtr info = RADEONPTR(scrn);
drm_magic_t magic;
int fd;
@@ -78,7 +77,7 @@ radeon_dri3_open(ScreenPtr screen, RRProviderPtr provider, int *out)
}
}
- if (drmAuthMagic(info->dri2.drm_fd, magic) < 0) {
+ if (drmAuthMagic(pRADEONEnt->fd, magic) < 0) {
close(fd);
return BadMatch;
}
@@ -87,6 +86,36 @@ radeon_dri3_open(ScreenPtr screen, RRProviderPtr provider, int *out)
return Success;
}
+static int open_render_node(ScreenPtr screen, int *out)
+{
+ ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
+ RADEONEntPtr pRADEONEnt = RADEONEntPriv(scrn);
+ int fd;
+
+ fd = open(pRADEONEnt->render_node, O_RDWR | O_CLOEXEC);
+ if (fd < 0)
+ return BadAlloc;
+
+ *out = fd;
+ return Success;
+}
+
+static int
+radeon_dri3_open(ScreenPtr screen, RRProviderPtr provider, int *out)
+{
+ ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
+ RADEONEntPtr pRADEONEnt = RADEONEntPriv(scrn);
+ int ret = BadAlloc;
+
+ if (pRADEONEnt->render_node)
+ ret = open_render_node(screen, out);
+
+ if (ret != Success)
+ ret = open_master_node(screen, out);
+
+ return ret;
+}
+
#if DRI3_SCREEN_INFO_VERSION >= 1 && XORG_VERSION_CURRENT <= XORG_VERSION_NUMERIC(1,18,99,1,0)
static int
@@ -144,6 +173,7 @@ static PixmapPtr radeon_dri3_pixmap_from_fd(ScreenPtr screen,
}
screen->DestroyPixmap(pixmap);
+ return NULL;
}
}
#endif
@@ -227,6 +257,9 @@ Bool
radeon_dri3_screen_init(ScreenPtr screen)
{
ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
+ RADEONEntPtr pRADEONEnt = RADEONEntPriv(scrn);
+
+ pRADEONEnt->render_node = drmGetRenderDeviceNameFromFd(pRADEONEnt->fd);
if (!dri3_screen_init(screen, &radeon_dri3_screen_info)) {
xf86DrvMsg(scrn->scrnIndex, X_WARNING,