Line
Link Here
|
0 |
-- a/glx/glxcmds.c |
0 |
++ b/glx/glxcmds.c |
Lines 1101-1114
__glXDrawableInit(__GLXdrawable *drawable,
Link Here
|
1101 |
void |
1101 |
void |
1102 |
__glXDrawableRelease(__GLXdrawable *drawable) |
1102 |
__glXDrawableRelease(__GLXdrawable *drawable) |
1103 |
{ |
1103 |
{ |
1104 |
ScreenPtr pScreen = drawable->pDraw->pScreen; |
|
|
1105 |
|
1106 |
switch (drawable->type) { |
1107 |
case GLX_DRAWABLE_PIXMAP: |
1108 |
case GLX_DRAWABLE_PBUFFER: |
1109 |
(*pScreen->DestroyPixmap)((PixmapPtr) drawable->pDraw); |
1110 |
break; |
1111 |
} |
1112 |
} |
1104 |
} |
1113 |
|
1105 |
|
1114 |
static int |
1106 |
static int |
Lines 1117-1124
DoCreateGLXDrawable(ClientPtr client, __GLXscreen *pGlxScreen, __GLXconfig *conf
Link Here
|
1117 |
{ |
1109 |
{ |
1118 |
__GLXdrawable *pGlxDraw; |
1110 |
__GLXdrawable *pGlxDraw; |
1119 |
|
1111 |
|
1120 |
LEGAL_NEW_RESOURCE(glxDrawableId, client); |
|
|
1121 |
|
1122 |
if (pGlxScreen->pScreen != pDraw->pScreen) |
1112 |
if (pGlxScreen->pScreen != pDraw->pScreen) |
1123 |
return BadMatch; |
1113 |
return BadMatch; |
1124 |
|
1114 |
|
Lines 1135-1141
DoCreateGLXDrawable(ClientPtr client, __GLXscreen *pGlxScreen, __GLXconfig *conf
Link Here
|
1135 |
/* Add the glx drawable under the XID of the underlying X drawable |
1125 |
/* Add the glx drawable under the XID of the underlying X drawable |
1136 |
* too. That way we'll get a callback in DrawableGone and can |
1126 |
* too. That way we'll get a callback in DrawableGone and can |
1137 |
* clean up properly when the drawable is destroyed. */ |
1127 |
* clean up properly when the drawable is destroyed. */ |
1138 |
if (!AddResource(pDraw->id, __glXDrawableRes, pGlxDraw)) { |
1128 |
if (pDraw->id != glxDrawableId && |
|
|
1129 |
!AddResource(pDraw->id, __glXDrawableRes, pGlxDraw)) { |
1139 |
pGlxDraw->destroy (pGlxDraw); |
1130 |
pGlxDraw->destroy (pGlxDraw); |
1140 |
return BadAlloc; |
1131 |
return BadAlloc; |
1141 |
} |
1132 |
} |
Lines 1150-1155
DoCreateGLXPixmap(ClientPtr client, __GLXscreen *pGlxScreen, __GLXconfig *config
Link Here
|
1150 |
DrawablePtr pDraw; |
1141 |
DrawablePtr pDraw; |
1151 |
int err; |
1142 |
int err; |
1152 |
|
1143 |
|
|
|
1144 |
LEGAL_NEW_RESOURCE(glxDrawableId, client); |
1145 |
|
1153 |
err = dixLookupDrawable(&pDraw, drawableId, client, 0, DixAddAccess); |
1146 |
err = dixLookupDrawable(&pDraw, drawableId, client, 0, DixAddAccess); |
1154 |
if (err != Success) { |
1147 |
if (err != Success) { |
1155 |
client->errorValue = drawableId; |
1148 |
client->errorValue = drawableId; |
Lines 1163-1171
DoCreateGLXPixmap(ClientPtr client, __GLXscreen *pGlxScreen, __GLXconfig *config
Link Here
|
1163 |
err = DoCreateGLXDrawable(client, pGlxScreen, config, pDraw, |
1156 |
err = DoCreateGLXDrawable(client, pGlxScreen, config, pDraw, |
1164 |
glxDrawableId, GLX_DRAWABLE_PIXMAP); |
1157 |
glxDrawableId, GLX_DRAWABLE_PIXMAP); |
1165 |
|
1158 |
|
1166 |
if (err == Success) |
|
|
1167 |
((PixmapPtr) pDraw)->refcnt++; |
1168 |
|
1169 |
return err; |
1159 |
return err; |
1170 |
} |
1160 |
} |
1171 |
|
1161 |
|
Lines 1306-1311
DoCreatePbuffer(ClientPtr client, int screenNum, XID fbconfigId,
Link Here
|
1306 |
PixmapPtr pPixmap; |
1296 |
PixmapPtr pPixmap; |
1307 |
int err; |
1297 |
int err; |
1308 |
|
1298 |
|
|
|
1299 |
LEGAL_NEW_RESOURCE(glxDrawableId, client); |
1300 |
|
1309 |
if (!validGlxScreen(client, screenNum, &pGlxScreen, &err)) |
1301 |
if (!validGlxScreen(client, screenNum, &pGlxScreen, &err)) |
1310 |
return err; |
1302 |
return err; |
1311 |
if (!validGlxFBConfig(client, pGlxScreen, fbconfigId, &config, &err)) |
1303 |
if (!validGlxFBConfig(client, pGlxScreen, fbconfigId, &config, &err)) |
Lines 1316-1321
DoCreatePbuffer(ClientPtr client, int screenNum, XID fbconfigId,
Link Here
|
1316 |
width, height, config->rgbBits, 0); |
1308 |
width, height, config->rgbBits, 0); |
1317 |
__glXleaveServer(GL_FALSE); |
1309 |
__glXleaveServer(GL_FALSE); |
1318 |
|
1310 |
|
|
|
1311 |
/* Assign the pixmap the same id as the pbuffer and add it as a |
1312 |
* resource so it and the DRI2 drawable will be reclaimed when the |
1313 |
* pbuffer is destroyed. */ |
1314 |
pPixmap->drawable.id = glxDrawableId; |
1315 |
if (!AddResource(pPixmap->drawable.id, RT_PIXMAP, pPixmap)) |
1316 |
return BadAlloc; |
1317 |
|
1319 |
return DoCreateGLXDrawable(client, pGlxScreen, config, &pPixmap->drawable, |
1318 |
return DoCreateGLXDrawable(client, pGlxScreen, config, &pPixmap->drawable, |
1320 |
glxDrawableId, GLX_DRAWABLE_PBUFFER); |
1319 |
glxDrawableId, GLX_DRAWABLE_PBUFFER); |
1321 |
} |
1320 |
} |
Lines 1423-1428
int __glXDisp_CreateWindow(__GLXclientState *cl, GLbyte *pc)
Link Here
|
1423 |
DrawablePtr pDraw; |
1422 |
DrawablePtr pDraw; |
1424 |
int err; |
1423 |
int err; |
1425 |
|
1424 |
|
|
|
1425 |
LEGAL_NEW_RESOURCE(req->glxwindow, client); |
1426 |
|
1426 |
if (!validGlxScreen(client, req->screen, &pGlxScreen, &err)) |
1427 |
if (!validGlxScreen(client, req->screen, &pGlxScreen, &err)) |
1427 |
return err; |
1428 |
return err; |
1428 |
if (!validGlxFBConfig(client, pGlxScreen, req->fbconfig, &config, &err)) |
1429 |
if (!validGlxFBConfig(client, pGlxScreen, req->fbconfig, &config, &err)) |