summaryrefslogtreecommitdiff
path: root/dri3
diff options
context:
space:
mode:
Diffstat (limited to 'dri3')
-rw-r--r--dri3/dri3.h14
-rw-r--r--dri3/dri3_screen.c16
2 files changed, 25 insertions, 5 deletions
diff --git a/dri3/dri3.h b/dri3/dri3.h
index 1c04cbd2d..edc7fa267 100644
--- a/dri3/dri3.h
+++ b/dri3/dri3.h
@@ -30,13 +30,17 @@
#include <X11/extensions/dri3proto.h>
#include <randrstr.h>
-#define DRI3_SCREEN_INFO_VERSION 0
+#define DRI3_SCREEN_INFO_VERSION 1
-typedef int (*dri3_open_proc)(ClientPtr client,
- ScreenPtr screen,
+typedef int (*dri3_open_proc)(ScreenPtr screen,
RRProviderPtr provider,
int *fd);
+typedef int (*dri3_open_client_proc)(ClientPtr client,
+ ScreenPtr screen,
+ RRProviderPtr provider,
+ int *fd);
+
typedef PixmapPtr (*dri3_pixmap_from_fd_proc) (ScreenPtr screen,
int fd,
CARD16 width,
@@ -56,6 +60,10 @@ typedef struct dri3_screen_info {
dri3_open_proc open;
dri3_pixmap_from_fd_proc pixmap_from_fd;
dri3_fd_from_pixmap_proc fd_from_pixmap;
+
+ /* Version 1 */
+ dri3_open_client_proc open_client;
+
} dri3_screen_info_rec, *dri3_screen_info_ptr;
extern _X_EXPORT Bool
diff --git a/dri3/dri3_screen.c b/dri3/dri3_screen.c
index bbf1d05a9..6c0c60cbf 100644
--- a/dri3/dri3_screen.c
+++ b/dri3/dri3_screen.c
@@ -30,6 +30,14 @@
#include <misyncshm.h>
#include <randrstr.h>
+static inline Bool has_open(dri3_screen_info_ptr info) {
+ if (info == NULL)
+ return FALSE;
+
+ return info->open != NULL ||
+ (info->version >= 1 && info->open_client != NULL);
+}
+
int
dri3_open(ClientPtr client, ScreenPtr screen, RRProviderPtr provider, int *fd)
{
@@ -37,10 +45,14 @@ dri3_open(ClientPtr client, ScreenPtr screen, RRProviderPtr provider, int *fd)
dri3_screen_info_ptr info = ds->info;
int rc;
- if (!info || !info->open)
+ if (!has_open(info))
return BadMatch;
- rc = (*info->open) (client, screen, provider, fd);
+ if (info->version >= 1 && info->open_client != NULL)
+ rc = (*info->open_client) (client, screen, provider, fd);
+ else
+ rc = (*info->open) (screen, provider, fd);
+
if (rc != Success)
return rc;