diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c index 5cb52336f6e..0496781c4c2 100644 --- a/src/glx/dri2_glx.c +++ b/src/glx/dri2_glx.c @@ -102,21 +102,21 @@ dri2_destroy_context(struct glx_context *context) static Bool dri2_bind_context(struct glx_context *context, GLXDrawable draw, GLXDrawable read) { - struct dri2_drawable *pdraw, *pread; + __GLXDRIdrawable *pdraw, *pread; __DRIdrawable *dri_draw = NULL, *dri_read = NULL; - pdraw = (struct dri2_drawable *) driFetchDrawable(context, draw); - pread = (struct dri2_drawable *) driFetchDrawable(context, read); + pdraw = driFetchDrawable(context, draw); + pread = driFetchDrawable(context, read); driReleaseDrawables(context); if (pdraw) - dri_draw = pdraw->base.dri_drawable; + dri_draw = pdraw->dri_drawable; else if (draw != None) return GLXBadDrawable; if (pread) - dri_read = pread->base.dri_drawable; + dri_read = pread->dri_drawable; else if (read != None) return GLXBadDrawable; @@ -251,11 +251,10 @@ static void dri2DestroyDrawable(__GLXDRIdrawable *base) { struct dri2_screen *psc = (struct dri2_screen *) base->psc; - struct dri2_drawable *pdraw = (struct dri2_drawable *) base; struct glx_display *dpyPriv = psc->base.display; - __glxHashDelete(dpyPriv->dri2Hash, pdraw->base.xDrawable); - driDestroyDrawable(pdraw->base.dri_drawable); + __glxHashDelete(dpyPriv->dri2Hash, base->xDrawable); + driDestroyDrawable(base->dri_drawable); /* If it's a GLX 1.3 drawables, we can destroy the DRI2 drawable * now, as the application explicitly asked to destroy the GLX @@ -264,10 +263,10 @@ dri2DestroyDrawable(__GLXDRIdrawable *base) * knowing when the application is done with it. The server will * destroy the DRI2 drawable when it destroys the X drawable or the * client exits anyway. */ - if (pdraw->base.xDrawable != pdraw->base.drawable) - DRI2DestroyDrawable(psc->base.dpy, pdraw->base.xDrawable); + if (base->xDrawable != base->drawable) + DRI2DestroyDrawable(psc->base.dpy, base->xDrawable); - free(pdraw); + free(base); } static __GLXDRIdrawable * @@ -789,12 +788,11 @@ dri2InvalidateBuffers(Display *dpy, XID drawable) { __GLXDRIdrawable *pdraw = dri2GetGlxDrawableFromXDrawableId(dpy, drawable); - struct dri2_drawable *pdp = (struct dri2_drawable *) pdraw; if (!pdraw) return; - dri_invalidate_drawable(pdp->base.dri_drawable); + dri_invalidate_drawable(pdraw->dri_drawable); } static void @@ -802,13 +800,12 @@ dri2_bind_tex_image(__GLXDRIdrawable *base, int buffer, const int *attrib_list) { struct glx_context *gc = __glXGetCurrentContext(); - struct dri2_drawable *pdraw = (struct dri2_drawable *) base; - if (pdraw != NULL) { + if (base != NULL) { dri_set_tex_buffer2(gc->driContext, - pdraw->base.textureTarget, - pdraw->base.textureFormat, - pdraw->base.dri_drawable); + base->textureTarget, + base->textureFormat, + base->dri_drawable); } } diff --git a/src/glx/dri3_glx.c b/src/glx/dri3_glx.c index feced2f7d5d..2911b66d0d6 100644 --- a/src/glx/dri3_glx.c +++ b/src/glx/dri3_glx.c @@ -160,21 +160,21 @@ dri3_destroy_context(struct glx_context *context) static Bool dri3_bind_context(struct glx_context *context, GLXDrawable draw, GLXDrawable read) { - struct dri3_drawable *pdraw, *pread; + __GLXDRIdrawable *pdraw, *pread; __DRIdrawable *dri_draw = NULL, *dri_read = NULL; - pdraw = (struct dri3_drawable *) driFetchDrawable(context, draw); - pread = (struct dri3_drawable *) driFetchDrawable(context, read); + pdraw = driFetchDrawable(context, draw); + pread = driFetchDrawable(context, read); driReleaseDrawables(context); if (pdraw) - dri_draw = pdraw->base.dri_drawable; + dri_draw = pdraw->dri_drawable; else if (draw != None) return GLXBadDrawable; if (pread) - dri_read = pread->base.dri_drawable; + dri_read = pread->dri_drawable; else if (read != None) return GLXBadDrawable; @@ -638,17 +638,16 @@ dri3_bind_tex_image(__GLXDRIdrawable *base, int buffer, const int *attrib_list) { struct glx_context *gc = __glXGetCurrentContext(); - struct dri3_drawable *pdraw = (struct dri3_drawable *) base; - if (pdraw != NULL) { - dri_invalidate_drawable(pdraw->base.dri_drawable); + if (base) { + dri_invalidate_drawable(base->dri_drawable); XSync(gc->currentDpy, false); dri_set_tex_buffer2(gc->driContext, - pdraw->base.textureTarget, - pdraw->base.textureFormat, - pdraw->base.dri_drawable); + base->textureTarget, + base->textureFormat, + base->dri_drawable); } } diff --git a/src/glx/drisw_glx.c b/src/glx/drisw_glx.c index 8e19475954e..4bb5c88eaf7 100644 --- a/src/glx/drisw_glx.c +++ b/src/glx/drisw_glx.c @@ -435,22 +435,22 @@ static int drisw_bind_context(struct glx_context *context, GLXDrawable draw, GLXDrawable read) { struct drisw_screen *psc = (struct drisw_screen *) context->psc; - struct drisw_drawable *pdraw, *pread; + __GLXDRIdrawable *pdraw, *pread; - pdraw = (struct drisw_drawable *) driFetchDrawable(context, draw); - pread = (struct drisw_drawable *) driFetchDrawable(context, read); + pdraw = driFetchDrawable(context, draw); + pread = driFetchDrawable(context, read); driReleaseDrawables(context); if (!driBindContext(context->driContext, - pdraw ? pdraw->base.dri_drawable : NULL, - pread ? pread->base.dri_drawable : NULL)) + pdraw ? pdraw->dri_drawable : NULL, + pread ? pread->dri_drawable : NULL)) return GLXBadContext; if (psc->kopper) { if (pdraw) - dri_invalidate_drawable(pdraw->base.dri_drawable); - if (pread && (!pdraw || pread->base.dri_drawable != pdraw->base.dri_drawable)) - dri_invalidate_drawable(pread->base.dri_drawable); + dri_invalidate_drawable(pdraw->dri_drawable); + if (pread && (!pdraw || pread->dri_drawable != pdraw->dri_drawable)) + dri_invalidate_drawable(pread->dri_drawable); } return Success; @@ -479,13 +479,12 @@ drisw_bind_tex_image(__GLXDRIdrawable *base, int buffer, const int *attrib_list) { struct glx_context *gc = __glXGetCurrentContext(); - struct drisw_drawable *pdraw = (struct drisw_drawable *) base; - if (pdraw != NULL) { + if (base != NULL) { dri_set_tex_buffer2(gc->driContext, - pdraw->base.textureTarget, - pdraw->base.textureFormat, - pdraw->base.dri_drawable); + base->textureTarget, + base->textureFormat, + base->dri_drawable); } } @@ -494,9 +493,7 @@ kopper_get_buffer_age(__GLXDRIdrawable *pdraw); int kopper_get_buffer_age(__GLXDRIdrawable *pdraw) { - struct drisw_drawable *pdp = (struct drisw_drawable *) pdraw; - - return kopperQueryBufferAge(pdp->base.dri_drawable); + return kopperQueryBufferAge(pdraw->dri_drawable); } static const struct glx_context_vtable drisw_context_vtable = { @@ -699,8 +696,7 @@ driswSwapBuffers(__GLXDRIdrawable * pdraw, int64_t target_msc, int64_t divisor, int64_t remainder, Bool flush) { - struct drisw_drawable *pdp = (struct drisw_drawable *) pdraw; - struct drisw_screen *psc = (struct drisw_screen *) pdp->base.psc; + struct drisw_screen *psc = (struct drisw_screen *) pdraw->psc; (void) target_msc; (void) divisor; @@ -711,9 +707,9 @@ driswSwapBuffers(__GLXDRIdrawable * pdraw, } if (psc->kopper) - return kopperSwapBuffers (pdp->base.dri_drawable, 0); + return kopperSwapBuffers(pdraw->dri_drawable, 0); - driSwapBuffers(pdp->base.dri_drawable); + driSwapBuffers(pdraw->dri_drawable); return 0; } @@ -722,13 +718,11 @@ static void drisw_copy_sub_buffer(__GLXDRIdrawable * pdraw, int x, int y, int width, int height, Bool flush) { - struct drisw_drawable *pdp = (struct drisw_drawable *) pdraw; - if (flush) { glFlush(); } - driswCopySubBuffer(pdp->base.dri_drawable, x, y, width, height); + driswCopySubBuffer(pdraw->dri_drawable, x, y, width, height); } static void