aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xfree86/dri2/dri2ext.c
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/hw/xfree86/dri2/dri2ext.c')
-rw-r--r--xorg-server/hw/xfree86/dri2/dri2ext.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/xorg-server/hw/xfree86/dri2/dri2ext.c b/xorg-server/hw/xfree86/dri2/dri2ext.c
index 3c06174cb..72f9a448b 100644
--- a/xorg-server/hw/xfree86/dri2/dri2ext.c
+++ b/xorg-server/hw/xfree86/dri2/dri2ext.c
@@ -34,7 +34,6 @@
#include <xorg-config.h>
#endif
-#define NEED_REPLIES
#include <X11/X.h>
#include <X11/Xproto.h>
#include <X11/extensions/dri2proto.h>
@@ -54,10 +53,10 @@ static ExtensionEntry *dri2Extension;
static RESTYPE dri2DrawableRes;
static Bool
-validDrawable(ClientPtr client, XID drawable,
+validDrawable(ClientPtr client, XID drawable, Mask access_mode,
DrawablePtr *pDrawable, int *status)
{
- *status = dixLookupDrawable(pDrawable, drawable, client, 0, DixReadAccess);
+ *status = dixLookupDrawable(pDrawable, drawable, client, 0, access_mode);
if (*status != Success) {
client->errorValue = drawable;
return FALSE;
@@ -106,7 +105,8 @@ ProcDRI2Connect(ClientPtr client)
const char *deviceName;
REQUEST_SIZE_MATCH(xDRI2ConnectReq);
- if (!validDrawable(client, stuff->window, &pDraw, &status))
+ if (!validDrawable(client, stuff->window, DixGetAttrAccess,
+ &pDraw, &status))
return status;
rep.type = X_Reply;
@@ -141,7 +141,8 @@ ProcDRI2Authenticate(ClientPtr client)
int status;
REQUEST_SIZE_MATCH(xDRI2AuthenticateReq);
- if (!validDrawable(client, stuff->window, &pDraw, &status))
+ if (!validDrawable(client, stuff->window, DixGetAttrAccess,
+ &pDraw, &status))
return status;
rep.type = X_Reply;
@@ -162,7 +163,8 @@ ProcDRI2CreateDrawable(ClientPtr client)
REQUEST_SIZE_MATCH(xDRI2CreateDrawableReq);
- if (!validDrawable(client, stuff->drawable, &pDrawable, &status))
+ if (!validDrawable(client, stuff->drawable, DixAddAccess,
+ &pDrawable, &status))
return status;
status = DRI2CreateDrawable(pDrawable);
@@ -185,7 +187,8 @@ ProcDRI2DestroyDrawable(ClientPtr client)
int status;
REQUEST_SIZE_MATCH(xDRI2DestroyDrawableReq);
- if (!validDrawable(client, stuff->drawable, &pDrawable, &status))
+ if (!validDrawable(client, stuff->drawable, DixRemoveAccess,
+ &pDrawable, &status))
return status;
FreeResourceByType(stuff->drawable, dri2DrawableRes, FALSE);
@@ -196,7 +199,7 @@ ProcDRI2DestroyDrawable(ClientPtr client)
static void
send_buffers_reply(ClientPtr client, DrawablePtr pDrawable,
- DRI2Buffer2Ptr *buffers, int count, int width, int height)
+ DRI2BufferPtr *buffers, int count, int width, int height)
{
xDRI2GetBuffersReply rep;
int skip = 0;
@@ -246,12 +249,13 @@ ProcDRI2GetBuffers(ClientPtr client)
{
REQUEST(xDRI2GetBuffersReq);
DrawablePtr pDrawable;
- DRI2Buffer2Ptr *buffers;
+ DRI2BufferPtr *buffers;
int status, width, height, count;
unsigned int *attachments;
REQUEST_FIXED_SIZE(xDRI2GetBuffersReq, stuff->count * 4);
- if (!validDrawable(client, stuff->drawable, &pDrawable, &status))
+ if (!validDrawable(client, stuff->drawable, DixReadAccess | DixWriteAccess,
+ &pDrawable, &status))
return status;
attachments = (unsigned int *) &stuff[1];
@@ -269,12 +273,13 @@ ProcDRI2GetBuffersWithFormat(ClientPtr client)
{
REQUEST(xDRI2GetBuffersReq);
DrawablePtr pDrawable;
- DRI2Buffer2Ptr *buffers;
+ DRI2BufferPtr *buffers;
int status, width, height, count;
unsigned int *attachments;
REQUEST_FIXED_SIZE(xDRI2GetBuffersReq, stuff->count * (2 * 4));
- if (!validDrawable(client, stuff->drawable, &pDrawable, &status))
+ if (!validDrawable(client, stuff->drawable, DixReadAccess | DixWriteAccess,
+ &pDrawable, &status))
return status;
attachments = (unsigned int *) &stuff[1];
@@ -297,7 +302,8 @@ ProcDRI2CopyRegion(ClientPtr client)
REQUEST_SIZE_MATCH(xDRI2CopyRegionReq);
- if (!validDrawable(client, stuff->drawable, &pDrawable, &status))
+ if (!validDrawable(client, stuff->drawable, DixWriteAccess,
+ &pDrawable, &status))
return status;
VERIFY_REGION(pRegion, stuff->region, client, DixReadAccess);