summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKristian Høgsberg <[email protected]>2010-07-22 22:36:37 -0400
committerKristian Høgsberg <[email protected]>2010-07-22 22:36:37 -0400
commiteeaab2047cfce8a7445fd9f835e737682eb503ac (patch)
tree8d84c9b7d03c4239077d4e8e4e7ac5aabb18faaa
parent7b7845a076c933e096ac511b4184141ba194449a (diff)
glx: Drop screen argument to GetGLXDRIDrawable
We'll just get it from the returned drawable when we need it.
-rw-r--r--src/glx/dri2_glx.c6
-rw-r--r--src/glx/glx_pbuffer.c10
-rw-r--r--src/glx/glxclient.h2
-rw-r--r--src/glx/glxcmds.c58
4 files changed, 33 insertions, 43 deletions
diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c
index aa01203c61b..2f12387860e 100644
--- a/src/glx/dri2_glx.c
+++ b/src/glx/dri2_glx.c
@@ -397,7 +397,7 @@ static void
dri2_wait_x(__GLXcontext *gc)
{
struct dri2_drawable *priv = (struct dri2_drawable *)
- GetGLXDRIDrawable(gc->currentDpy, gc->currentDrawable, NULL);
+ GetGLXDRIDrawable(gc->currentDpy, gc->currentDrawable);
if (priv == NULL || !priv->have_fake_front)
return;
@@ -409,7 +409,7 @@ static void
dri2_wait_gl(__GLXcontext *gc)
{
struct dri2_drawable *priv = (struct dri2_drawable *)
- GetGLXDRIDrawable(gc->currentDpy, gc->currentDrawable, NULL);
+ GetGLXDRIDrawable(gc->currentDpy, gc->currentDrawable);
if (priv == NULL || !priv->have_fake_front)
return;
@@ -638,7 +638,7 @@ dri2_bind_tex_image(Display * dpy,
int buffer, const int *attrib_list)
{
GLXContext gc = __glXGetCurrentContext();
- __GLXDRIdrawable *base = GetGLXDRIDrawable(dpy, drawable, NULL);
+ __GLXDRIdrawable *base = GetGLXDRIDrawable(dpy, drawable);
__GLXdisplayPrivate *dpyPriv = __glXInitialize(dpy);
struct dri2_drawable *pdraw = (struct dri2_drawable *) base;
struct dri2_display *pdp =
diff --git a/src/glx/glx_pbuffer.c b/src/glx/glx_pbuffer.c
index 171ede4660a..02809aacfa5 100644
--- a/src/glx/glx_pbuffer.c
+++ b/src/glx/glx_pbuffer.c
@@ -95,7 +95,7 @@ ChangeDrawableAttribute(Display * dpy, GLXDrawable drawable,
return;
}
- pdraw = GetGLXDRIDrawable(dpy, drawable, NULL);
+ pdraw = GetGLXDRIDrawable(dpy, drawable);
opcode = __glXSetupForCommand(dpy);
if (!opcode)
@@ -214,14 +214,12 @@ CreateDRIDrawable(Display *dpy, const __GLcontextModes *fbconfig,
static void
DestroyDRIDrawable(Display *dpy, GLXDrawable drawable, int destroy_xdrawable)
{
- int screen;
__GLXdisplayPrivate *const priv = __glXInitialize(dpy);
- __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable, &screen);
- __GLXscreenConfigs *psc = priv->screenConfigs[screen];
+ __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable);
if (pdraw != NULL) {
if (destroy_xdrawable)
- XFreePixmap(psc->dpy, pdraw->xDrawable);
+ XFreePixmap(pdraw->psc->dpy, pdraw->xDrawable);
(*pdraw->destroyDrawable) (pdraw);
__glxHashDelete(priv->drawHash, drawable);
}
@@ -341,7 +339,7 @@ GetDrawableAttribute(Display * dpy, GLXDrawable drawable,
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
{
- __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable, NULL);
+ __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable);
if (pdraw != NULL && !pdraw->textureTarget)
pdraw->textureTarget =
diff --git a/src/glx/glxclient.h b/src/glx/glxclient.h
index 581db97a6ea..8112c01e7cc 100644
--- a/src/glx/glxclient.h
+++ b/src/glx/glxclient.h
@@ -791,7 +791,7 @@ __glxGetMscRate(__GLXDRIdrawable *glxDraw,
XExtDisplayInfo *__glXFindDisplay (Display *dpy);
extern __GLXDRIdrawable *
-GetGLXDRIDrawable(Display *dpy, GLXDrawable drawable, int *const scrn_num);
+GetGLXDRIDrawable(Display *dpy, GLXDrawable drawable);
#endif
diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c
index eef2b621ba3..8ee9a999e4a 100644
--- a/src/glx/glxcmds.c
+++ b/src/glx/glxcmds.c
@@ -126,7 +126,7 @@ GarbageCollectDRIDrawables(__GLXscreenConfigs * sc)
* the drawable is not associated with a direct-rendering context.
*/
_X_HIDDEN __GLXDRIdrawable *
-GetGLXDRIDrawable(Display * dpy, GLXDrawable drawable, int *const scrn_num)
+GetGLXDRIDrawable(Display * dpy, GLXDrawable drawable)
{
__GLXdisplayPrivate *priv = __glXInitialize(dpy);
__GLXDRIdrawable *pdraw;
@@ -134,11 +134,8 @@ GetGLXDRIDrawable(Display * dpy, GLXDrawable drawable, int *const scrn_num)
if (priv == NULL)
return NULL;
- if (__glxHashLookup(priv->drawHash, drawable, (void *) &pdraw) == 0) {
- if (scrn_num != NULL)
- *scrn_num = pdraw->psc->scr;
+ if (__glxHashLookup(priv->drawHash, drawable, (void *) &pdraw) == 0)
return pdraw;
- }
return NULL;
}
@@ -1022,7 +1019,7 @@ glXDestroyGLXPixmap(Display * dpy, GLXPixmap glxpixmap)
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
{
__GLXdisplayPrivate *const priv = __glXInitialize(dpy);
- __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, glxpixmap, NULL);
+ __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, glxpixmap);
if (pdraw != NULL) {
(*pdraw->destroyDrawable) (pdraw);
@@ -1054,7 +1051,7 @@ glXSwapBuffers(Display * dpy, GLXDrawable drawable)
#endif
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
- __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable, NULL);
+ __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable);
if (pdraw != NULL) {
glFlush();
@@ -2019,9 +2016,8 @@ __glXSwapIntervalSGI(int interval)
#ifdef GLX_DIRECT_RENDERING
if (gc->driContext && psc->driScreen && psc->driScreen->setSwapInterval) {
- __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(gc->currentDpy,
- gc->currentDrawable,
- NULL);
+ __GLXDRIdrawable *pdraw =
+ GetGLXDRIDrawable(gc->currentDpy, gc->currentDrawable);
psc->driScreen->setSwapInterval(pdraw, interval);
return 0;
}
@@ -2066,8 +2062,8 @@ __glXSwapIntervalMESA(unsigned int interval)
psc = GetGLXScreenConfigs( gc->currentDpy, gc->screen);
if (psc->driScreen && psc->driScreen->setSwapInterval) {
- __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(gc->currentDpy,
- gc->currentDrawable, NULL);
+ __GLXDRIdrawable *pdraw =
+ GetGLXDRIDrawable(gc->currentDpy, gc->currentDrawable);
return psc->driScreen->setSwapInterval(pdraw, interval);
}
}
@@ -2088,8 +2084,8 @@ __glXGetSwapIntervalMESA(void)
psc = GetGLXScreenConfigs( gc->currentDpy, gc->screen);
if (psc->driScreen && psc->driScreen->getSwapInterval) {
- __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(gc->currentDpy,
- gc->currentDrawable, NULL);
+ __GLXDRIdrawable *pdraw =
+ GetGLXDRIDrawable(gc->currentDpy, gc->currentDrawable);
return psc->driScreen->getSwapInterval(pdraw);
}
}
@@ -2123,7 +2119,7 @@ __glXGetVideoSyncSGI(unsigned int *count)
psc = GetGLXScreenConfigs(gc->currentDpy, gc->screen);
#ifdef GLX_DIRECT_RENDERING
- pdraw = GetGLXDRIDrawable(gc->currentDpy, gc->currentDrawable, NULL);
+ pdraw = GetGLXDRIDrawable(gc->currentDpy, gc->currentDrawable);
#endif
/* FIXME: Looking at the GLX_SGI_video_sync spec in the extension registry,
@@ -2165,7 +2161,7 @@ __glXWaitVideoSyncSGI(int divisor, int remainder, unsigned int *count)
psc = GetGLXScreenConfigs( gc->currentDpy, gc->screen);
#ifdef GLX_DIRECT_RENDERING
- pdraw = GetGLXDRIDrawable(gc->currentDpy, gc->currentDrawable, NULL);
+ pdraw = GetGLXDRIDrawable(gc->currentDpy, gc->currentDrawable);
#endif
#ifdef GLX_DIRECT_RENDERING
@@ -2341,7 +2337,7 @@ __glXGetSyncValuesOML(Display * dpy, GLXDrawable drawable,
int64_t * ust, int64_t * msc, int64_t * sbc)
{
__GLXdisplayPrivate * const priv = __glXInitialize(dpy);
- int i, ret;
+ int ret;
#ifdef GLX_DIRECT_RENDERING
__GLXDRIdrawable *pdraw;
#endif
@@ -2351,9 +2347,9 @@ __glXGetSyncValuesOML(Display * dpy, GLXDrawable drawable,
return False;
#ifdef GLX_DIRECT_RENDERING
- pdraw = GetGLXDRIDrawable(dpy, drawable, &i);
- psc = priv->screenConfigs[i];
- if (pdraw && psc && psc->driScreen && psc->driScreen->getDrawableMSC) {
+ pdraw = GetGLXDRIDrawable(dpy, drawable);
+ psc = pdraw ? pdraw->psc : NULL;
+ if (pdraw && psc->driScreen->getDrawableMSC) {
ret = psc->driScreen->getDrawableMSC(psc, pdraw, ust, msc, sbc);
return ret;
}
@@ -2450,7 +2446,7 @@ __glXGetMscRateOML(Display * dpy, GLXDrawable drawable,
int32_t * numerator, int32_t * denominator)
{
#if defined( GLX_DIRECT_RENDERING ) && defined( XF86VIDMODE )
- __GLXDRIdrawable *draw = GetGLXDRIDrawable(dpy, drawable, NULL);
+ __GLXDRIdrawable *draw = GetGLXDRIDrawable(dpy, drawable);
if (draw == NULL)
return False;
@@ -2471,11 +2467,10 @@ __glXSwapBuffersMscOML(Display * dpy, GLXDrawable drawable,
int64_t target_msc, int64_t divisor, int64_t remainder)
{
GLXContext gc = __glXGetCurrentContext();
- int screen;
#ifdef GLX_DIRECT_RENDERING
- __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable, &screen);
+ __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable);
+ __GLXscreenConfigs *psc = pdraw ? pdraw->psc : NULL;
#endif
- __GLXscreenConfigs *const psc = GetGLXScreenConfigs(dpy, screen);
if (!gc) /* no GLX for this */
return -1;
@@ -2514,11 +2509,10 @@ __glXWaitForMscOML(Display * dpy, GLXDrawable drawable,
int64_t remainder, int64_t * ust,
int64_t * msc, int64_t * sbc)
{
- int screen;
#ifdef GLX_DIRECT_RENDERING
- __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable, &screen);
+ __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable);
#endif
- __GLXscreenConfigs * const psc = GetGLXScreenConfigs( dpy, screen );
+ __GLXscreenConfigs *psc = pdraw ? pdraw->psc : NULL;
int ret;
@@ -2547,11 +2541,10 @@ __glXWaitForSbcOML(Display * dpy, GLXDrawable drawable,
int64_t target_sbc, int64_t * ust,
int64_t * msc, int64_t * sbc)
{
- int screen;
#ifdef GLX_DIRECT_RENDERING
- __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable, &screen);
+ __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable);
#endif
- __GLXscreenConfigs *const psc = GetGLXScreenConfigs(dpy, screen);
+ __GLXscreenConfigs *psc = pdraw ? pdraw->psc : NULL;
int ret;
/* The OML_sync_control spec says this should "generate a GLX_BAD_VALUE
@@ -2639,10 +2632,9 @@ __glXCopySubBufferMESA(Display * dpy, GLXDrawable drawable,
CARD8 opcode;
#ifdef __DRI_COPY_SUB_BUFFER
- int screen;
- __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable, &screen);
+ __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable);
if (pdraw != NULL) {
- __GLXscreenConfigs *const psc = GetGLXScreenConfigs(dpy, screen);
+ __GLXscreenConfigs *psc = pdraw->psc;
if (psc->driScreen->copySubBuffer != NULL) {
glFlush();
(*psc->driScreen->copySubBuffer) (pdraw, x, y, width, height);