[xserver patch v5 3/5] glx: Enforce a 1:1 correspondence between GLX and X11 windows.
Ian Romanick
idr at freedesktop.org
Mon Mar 22 12:56:36 PDT 2010
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Kristian Høgsberg wrote:
> 2010/2/8 Francisco Jerez <currojerez at riseup.net>:
>> The spec says (regarding glXCreateWindow): "If there is already a
>> GLXFBConfig associated with win (as a result of a previous
>> glXCreateWindow call), then a BadAlloc error is generated.". It will
>> also come useful to implement DRI2InvalidateBuffers for the indirect
>> case.
>>
>> Signed-off-by: Francisco Jerez <currojerez at riseup.net>
I've put this version of this patch (with krh's R-b) in my GLX-fixes
tree. Are the all the rest in Kristian's dri2-invalidate tree?
> Looks good,
>
> Reviewed-by: Kristian Høgsberg <krh at bitplanet.net>
>
>> ---
>> v5: Simplification as suggested by Kristian.
>>
>> glx/glxcmds.c | 24 +++++++++++++++++++++++-
>> glx/glxserver.h | 1 +
>> 2 files changed, 24 insertions(+), 1 deletions(-)
>>
>> diff --git a/glx/glxcmds.c b/glx/glxcmds.c
>> index 77afbf4..cac30e6 100644
>> --- a/glx/glxcmds.c
>> +++ b/glx/glxcmds.c
>> @@ -51,6 +51,15 @@
>> #include "indirect_table.h"
>> #include "indirect_util.h"
>>
>> +static int glxWindowPrivateKeyIndex;
>> +static DevPrivateKey glxWindowPrivateKey = &glxWindowPrivateKeyIndex;
>> +
>> +__GLXdrawable *
>> +glxGetDrawableFromWindow(WindowPtr pWin)
>> +{
>> + return dixLookupPrivate(&pWin->devPrivates, glxWindowPrivateKey);
>> +}
>> +
>> static int
>> validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err)
>> {
>> @@ -519,6 +528,9 @@ __glXGetDrawable(__GLXcontext *glxc, GLXDrawable drawId, ClientPtr client,
>> return NULL;
>> }
>>
>> + dixSetPrivate(&((WindowPtr)pDraw)->devPrivates, glxWindowPrivateKey,
>> + pGlxDraw);
>> +
>> return pGlxDraw;
>> }
>>
>> @@ -1107,7 +1119,7 @@ __glXDrawableRelease(__GLXdrawable *drawable)
>> }
>> }
>>
>> -static int
>> +static int
>> DoCreateGLXDrawable(ClientPtr client, __GLXscreen *pGlxScreen, __GLXconfig *config,
>> DrawablePtr pDraw, XID glxDrawableId, int type)
>> {
>> @@ -1128,6 +1140,10 @@ DoCreateGLXDrawable(ClientPtr client, __GLXscreen *pGlxScreen, __GLXconfig *conf
>> return BadAlloc;
>> }
>>
>> + if (type == GLX_DRAWABLE_WINDOW)
>> + dixSetPrivate(&((WindowPtr)pDraw)->devPrivates,
>> + glxWindowPrivateKey, pGlxDraw);
>> +
>> return Success;
>> }
>>
>> @@ -1422,6 +1438,12 @@ int __glXDisp_CreateWindow(__GLXclientState *cl, GLbyte *pc)
>> return BadWindow;
>> }
>>
>> + /* Make sure there're no already associated GLX drawables. */
>> + if (glxGetDrawableFromWindow((WindowPtr)pDraw)) {
>> + client->errorValue = req->window;
>> + return BadAlloc;
>> + }
>> +
>> if (!validGlxFBConfigForWindow(client, config, pDraw, &err))
>> return err;
>>
>> diff --git a/glx/glxserver.h b/glx/glxserver.h
>> index 1daf977..3c49b5e 100644
>> --- a/glx/glxserver.h
>> +++ b/glx/glxserver.h
>> @@ -80,6 +80,7 @@ typedef struct __GLXcontext __GLXcontext;
>>
>> extern __GLXscreen *glxGetScreen(ScreenPtr pScreen);
>> extern __GLXclientState *glxGetClient(ClientPtr pClient);
>> +extern __GLXdrawable *glxGetDrawableFromWindow(WindowPtr pWin);
>>
>> /************************************************************************/
>>
>> --
>> 1.6.4.4
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAkuny3IACgkQX1gOwKyEAw8s7wCdHFT2LwWBMvANCHW3vAfCbRLv
S/4An3U/kZH+Q4OxUJD3q6YlrFiG2RW4
=g9WK
-----END PGP SIGNATURE-----
More information about the xorg-devel
mailing list