summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dri3/dri3.h6
-rw-r--r--dri3/dri3_request.c38
-rw-r--r--dri3/dri3_screen.c2
-rw-r--r--glamor/glamor_egl.c3
4 files changed, 32 insertions, 17 deletions
diff --git a/dri3/dri3.h b/dri3/dri3.h
index 7c0c33018..1c04cbd2d 100644
--- a/dri3/dri3.h
+++ b/dri3/dri3.h
@@ -32,7 +32,8 @@
#define DRI3_SCREEN_INFO_VERSION 0
-typedef int (*dri3_open_proc)(ScreenPtr screen,
+typedef int (*dri3_open_proc)(ClientPtr client,
+ ScreenPtr screen,
RRProviderPtr provider,
int *fd);
@@ -60,6 +61,9 @@ typedef struct dri3_screen_info {
extern _X_EXPORT Bool
dri3_screen_init(ScreenPtr screen, dri3_screen_info_ptr info);
+extern _X_EXPORT int
+dri3_send_open_reply(ClientPtr client, int fd);
+
#endif
#endif /* _DRI3_H_ */
diff --git a/dri3/dri3_request.c b/dri3/dri3_request.c
index 31dce83f6..fe45620c9 100644
--- a/dri3/dri3_request.c
+++ b/dri3/dri3_request.c
@@ -55,16 +55,35 @@ proc_dri3_query_version(ClientPtr client)
return Success;
}
-static int
-proc_dri3_open(ClientPtr client)
+int
+dri3_send_open_reply(ClientPtr client, int fd)
{
- REQUEST(xDRI3OpenReq);
xDRI3OpenReply rep = {
.type = X_Reply,
.nfd = 1,
.sequenceNumber = client->sequence,
.length = 0,
};
+
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ }
+
+ if (WriteFdToClient(client, fd, TRUE) < 0) {
+ close(fd);
+ return BadAlloc;
+ }
+
+ WriteToClient(client, sizeof (rep), &rep);
+
+ return Success;
+}
+
+static int
+proc_dri3_open(ClientPtr client)
+{
+ REQUEST(xDRI3OpenReq);
RRProviderPtr provider;
DrawablePtr drawable;
ScreenPtr screen;
@@ -92,17 +111,8 @@ proc_dri3_open(ClientPtr client)
if (status != Success)
return status;
- if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- }
-
- if (WriteFdToClient(client, fd, TRUE) < 0) {
- close(fd);
- return BadAlloc;
- }
-
- WriteToClient(client, sizeof (rep), &rep);
+ if (client->ignoreCount == 0)
+ return dri3_send_open_reply(client, fd);
return Success;
}
diff --git a/dri3/dri3_screen.c b/dri3/dri3_screen.c
index c88029612..bbf1d05a9 100644
--- a/dri3/dri3_screen.c
+++ b/dri3/dri3_screen.c
@@ -40,7 +40,7 @@ dri3_open(ClientPtr client, ScreenPtr screen, RRProviderPtr provider, int *fd)
if (!info || !info->open)
return BadMatch;
- rc = (*info->open) (screen, provider, fd);
+ rc = (*info->open) (client, screen, provider, fd);
if (rc != Success)
return rc;
diff --git a/glamor/glamor_egl.c b/glamor/glamor_egl.c
index 812342129..e2b6a9226 100644
--- a/glamor/glamor_egl.c
+++ b/glamor/glamor_egl.c
@@ -608,7 +608,8 @@ glamor_egl_close_screen(ScreenPtr screen)
}
static int
-glamor_dri3_open(ScreenPtr screen,
+glamor_dri3_open(ClientPtr client,
+ ScreenPtr screen,
RRProviderPtr provider,
int *fdp)
{