glx: move/add __DRIdrawable struct to __GLXDRIdrawable
this makes access simpler Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30619>
This commit is contained in:
committed by
Marge Bot
parent
476b4581d9
commit
46c3bc3365
+12
-13
@@ -58,7 +58,6 @@
|
||||
struct dri2_drawable
|
||||
{
|
||||
__GLXDRIdrawable base;
|
||||
__DRIdrawable *driDrawable;
|
||||
__DRIbuffer buffers[5];
|
||||
int bufferCount;
|
||||
int width, height;
|
||||
@@ -112,12 +111,12 @@ dri2_bind_context(struct glx_context *context, GLXDrawable draw, GLXDrawable rea
|
||||
driReleaseDrawables(context);
|
||||
|
||||
if (pdraw)
|
||||
dri_draw = pdraw->driDrawable;
|
||||
dri_draw = pdraw->base.dri_drawable;
|
||||
else if (draw != None)
|
||||
return GLXBadDrawable;
|
||||
|
||||
if (pread)
|
||||
dri_read = pread->driDrawable;
|
||||
dri_read = pread->base.dri_drawable;
|
||||
else if (read != None)
|
||||
return GLXBadDrawable;
|
||||
|
||||
@@ -256,7 +255,7 @@ dri2DestroyDrawable(__GLXDRIdrawable *base)
|
||||
struct glx_display *dpyPriv = psc->base.display;
|
||||
|
||||
__glxHashDelete(dpyPriv->dri2Hash, pdraw->base.xDrawable);
|
||||
driDestroyDrawable(pdraw->driDrawable);
|
||||
driDestroyDrawable(pdraw->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
|
||||
@@ -299,17 +298,17 @@ dri2CreateDrawable(struct glx_screen *base, XID xDrawable,
|
||||
|
||||
DRI2CreateDrawable(psc->base.dpy, xDrawable);
|
||||
/* Create a new drawable */
|
||||
pdraw->driDrawable =
|
||||
pdraw->base.dri_drawable =
|
||||
dri_create_drawable(psc->driScreen, config->driConfig, false, pdraw);
|
||||
|
||||
if (!pdraw->driDrawable) {
|
||||
if (!pdraw->base.dri_drawable) {
|
||||
DRI2DestroyDrawable(psc->base.dpy, xDrawable);
|
||||
free(pdraw);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (__glxHashInsert(dpyPriv->dri2Hash, xDrawable, pdraw)) {
|
||||
driDestroyDrawable(pdraw->driDrawable);
|
||||
driDestroyDrawable(pdraw->base.dri_drawable);
|
||||
DRI2DestroyDrawable(psc->base.dpy, xDrawable);
|
||||
free(pdraw);
|
||||
return None;
|
||||
@@ -427,7 +426,7 @@ dri2Throttle(struct dri2_screen *psc,
|
||||
{
|
||||
__DRIcontext *ctx = dri2GetCurrentContext();
|
||||
|
||||
dri_throttle(ctx, draw->driDrawable, reason);
|
||||
dri_throttle(ctx, draw->base.dri_drawable, reason);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -444,12 +443,12 @@ dri2Flush(struct dri2_screen *psc,
|
||||
enum __DRI2throttleReason throttle_reason)
|
||||
{
|
||||
if (ctx) {
|
||||
dri_flush(ctx, draw->driDrawable, flags, throttle_reason);
|
||||
dri_flush(ctx, draw->base.dri_drawable, flags, throttle_reason);
|
||||
} else {
|
||||
if (flags & __DRI2_FLUSH_CONTEXT)
|
||||
glFlush();
|
||||
|
||||
dri_flush_drawable(draw->driDrawable);
|
||||
dri_flush_drawable(draw->base.dri_drawable);
|
||||
|
||||
dri2Throttle(psc, draw, throttle_reason);
|
||||
}
|
||||
@@ -516,7 +515,7 @@ dri2_copy_drawable(struct dri2_drawable *priv, int dest, int src)
|
||||
xrect.width = priv->width;
|
||||
xrect.height = priv->height;
|
||||
|
||||
dri_flush_drawable(priv->driDrawable);
|
||||
dri_flush_drawable(priv->base.dri_drawable);
|
||||
|
||||
region = XFixesCreateRegion(psc->base.dpy, &xrect, 1);
|
||||
DRI2CopyRegion(psc->base.dpy, priv->base.xDrawable, region, dest, src);
|
||||
@@ -795,7 +794,7 @@ dri2InvalidateBuffers(Display *dpy, XID drawable)
|
||||
if (!pdraw)
|
||||
return;
|
||||
|
||||
dri_invalidate_drawable(pdp->driDrawable);
|
||||
dri_invalidate_drawable(pdp->base.dri_drawable);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -809,7 +808,7 @@ dri2_bind_tex_image(__GLXDRIdrawable *base,
|
||||
dri_set_tex_buffer2(gc->driContext,
|
||||
pdraw->base.textureTarget,
|
||||
pdraw->base.textureFormat,
|
||||
pdraw->driDrawable);
|
||||
pdraw->base.dri_drawable);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+6
-4
@@ -169,12 +169,12 @@ dri3_bind_context(struct glx_context *context, GLXDrawable draw, GLXDrawable rea
|
||||
driReleaseDrawables(context);
|
||||
|
||||
if (pdraw)
|
||||
dri_draw = pdraw->loader_drawable.dri_drawable;
|
||||
dri_draw = pdraw->base.dri_drawable;
|
||||
else if (draw != None)
|
||||
return GLXBadDrawable;
|
||||
|
||||
if (pread)
|
||||
dri_read = pread->loader_drawable.dri_drawable;
|
||||
dri_read = pread->base.dri_drawable;
|
||||
else if (read != None)
|
||||
return GLXBadDrawable;
|
||||
|
||||
@@ -371,6 +371,8 @@ dri3_create_drawable(struct glx_screen *base, XID xDrawable,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pdraw->base.dri_drawable = pdraw->loader_drawable.dri_drawable;
|
||||
|
||||
return &pdraw->base;
|
||||
}
|
||||
|
||||
@@ -639,14 +641,14 @@ dri3_bind_tex_image(__GLXDRIdrawable *base,
|
||||
struct dri3_drawable *pdraw = (struct dri3_drawable *) base;
|
||||
|
||||
if (pdraw != NULL) {
|
||||
dri_invalidate_drawable(pdraw->loader_drawable.dri_drawable);
|
||||
dri_invalidate_drawable(pdraw->base.dri_drawable);
|
||||
|
||||
XSync(gc->currentDpy, false);
|
||||
|
||||
dri_set_tex_buffer2(gc->driContext,
|
||||
pdraw->base.textureTarget,
|
||||
pdraw->base.textureFormat,
|
||||
pdraw->loader_drawable.dri_drawable);
|
||||
pdraw->base.dri_drawable);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+15
-15
@@ -443,14 +443,14 @@ drisw_bind_context(struct glx_context *context, GLXDrawable draw, GLXDrawable re
|
||||
driReleaseDrawables(context);
|
||||
|
||||
if (!driBindContext(context->driContext,
|
||||
pdraw ? pdraw->driDrawable : NULL,
|
||||
pread ? pread->driDrawable : NULL))
|
||||
pdraw ? pdraw->base.dri_drawable : NULL,
|
||||
pread ? pread->base.dri_drawable : NULL))
|
||||
return GLXBadContext;
|
||||
if (psc->kopper) {
|
||||
if (pdraw)
|
||||
dri_invalidate_drawable(pdraw->driDrawable);
|
||||
if (pread && (!pdraw || pread->driDrawable != pdraw->driDrawable))
|
||||
dri_invalidate_drawable(pread->driDrawable);
|
||||
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);
|
||||
}
|
||||
|
||||
return Success;
|
||||
@@ -485,7 +485,7 @@ drisw_bind_tex_image(__GLXDRIdrawable *base,
|
||||
dri_set_tex_buffer2(gc->driContext,
|
||||
pdraw->base.textureTarget,
|
||||
pdraw->base.textureFormat,
|
||||
pdraw->driDrawable);
|
||||
pdraw->base.dri_drawable);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -496,7 +496,7 @@ kopper_get_buffer_age(__GLXDRIdrawable *pdraw)
|
||||
{
|
||||
struct drisw_drawable *pdp = (struct drisw_drawable *) pdraw;
|
||||
|
||||
return kopperQueryBufferAge(pdp->driDrawable);
|
||||
return kopperQueryBufferAge(pdp->base.dri_drawable);
|
||||
}
|
||||
|
||||
static const struct glx_context_vtable drisw_context_vtable = {
|
||||
@@ -618,7 +618,7 @@ driswDestroyDrawable(__GLXDRIdrawable * pdraw)
|
||||
{
|
||||
struct drisw_drawable *pdp = (struct drisw_drawable *) pdraw;
|
||||
|
||||
driDestroyDrawable(pdp->driDrawable);
|
||||
driDestroyDrawable(pdp->base.dri_drawable);
|
||||
|
||||
XDestroyDrawable(pdp, pdraw->psc->dpy, pdraw->drawable);
|
||||
free(pdp);
|
||||
@@ -679,11 +679,11 @@ driswCreateDrawable(struct glx_screen *base, XID xDrawable,
|
||||
|
||||
pdp->swapInterval = dri_get_initial_swap_interval(psc->driScreen);
|
||||
/* Create a new drawable */
|
||||
pdp->driDrawable = dri_create_drawable(psc->driScreen, config->driConfig, !(type & GLX_WINDOW_BIT), pdp);
|
||||
pdp->base.dri_drawable = dri_create_drawable(psc->driScreen, config->driConfig, !(type & GLX_WINDOW_BIT), pdp);
|
||||
if (psc->kopper)
|
||||
kopperSetSwapInterval(pdp->driDrawable, pdp->swapInterval);
|
||||
kopperSetSwapInterval(pdp->base.dri_drawable, pdp->swapInterval);
|
||||
|
||||
if (!pdp->driDrawable) {
|
||||
if (!pdp->base.dri_drawable) {
|
||||
XDestroyDrawable(pdp, psc->base.dpy, xDrawable);
|
||||
free(pdp);
|
||||
return NULL;
|
||||
@@ -711,9 +711,9 @@ driswSwapBuffers(__GLXDRIdrawable * pdraw,
|
||||
}
|
||||
|
||||
if (psc->kopper)
|
||||
return kopperSwapBuffers (pdp->driDrawable, 0);
|
||||
return kopperSwapBuffers (pdp->base.dri_drawable, 0);
|
||||
|
||||
driSwapBuffers(pdp->driDrawable);
|
||||
driSwapBuffers(pdp->base.dri_drawable);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -728,7 +728,7 @@ drisw_copy_sub_buffer(__GLXDRIdrawable * pdraw,
|
||||
glFlush();
|
||||
}
|
||||
|
||||
driswCopySubBuffer(pdp->driDrawable, x, y, width, height);
|
||||
driswCopySubBuffer(pdp->base.dri_drawable, x, y, width, height);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -800,7 +800,7 @@ driswKopperSetSwapInterval(__GLXDRIdrawable *pdraw, int interval)
|
||||
if (!dri_valid_swap_interval(psc->driScreen, interval))
|
||||
return GLX_BAD_VALUE;
|
||||
|
||||
kopperSetSwapInterval(pdp->driDrawable, interval);
|
||||
kopperSetSwapInterval(pdp->base.dri_drawable, interval);
|
||||
pdp->swapInterval = interval;
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -50,7 +50,6 @@ struct drisw_drawable
|
||||
__GLXDRIdrawable base;
|
||||
|
||||
GC gc;
|
||||
__DRIdrawable *driDrawable;
|
||||
struct glx_config *config;
|
||||
XImage *ximage;
|
||||
XShmSegmentInfo shminfo;
|
||||
|
||||
@@ -128,6 +128,8 @@ struct __GLXDRIdrawableRec
|
||||
GLenum textureFormat; /* EXT_texture_from_pixmap support */
|
||||
unsigned long eventMask;
|
||||
int refcount;
|
||||
|
||||
__DRIdrawable *dri_drawable;
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user