mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-20 20:20:18 +01:00
glx: inline DRI2_FLUSH
Reviewed-by: Marek Olšák <marek.olsak@amd.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30450>
This commit is contained in:
parent
326d7ae64a
commit
53fd2eca4e
6 changed files with 12 additions and 34 deletions
|
|
@ -445,14 +445,13 @@ dri2Flush(struct dri2_screen *psc,
|
||||||
unsigned flags,
|
unsigned flags,
|
||||||
enum __DRI2throttleReason throttle_reason)
|
enum __DRI2throttleReason throttle_reason)
|
||||||
{
|
{
|
||||||
if (ctx && psc->f && psc->f->base.version >= 4) {
|
if (ctx) {
|
||||||
psc->f->flush_with_flags(ctx, draw->driDrawable, flags, throttle_reason);
|
dri_flush(ctx, draw->driDrawable, flags, throttle_reason);
|
||||||
} else {
|
} else {
|
||||||
if (flags & __DRI2_FLUSH_CONTEXT)
|
if (flags & __DRI2_FLUSH_CONTEXT)
|
||||||
glFlush();
|
glFlush();
|
||||||
|
|
||||||
if (psc->f)
|
dri_flush_drawable(draw->driDrawable);
|
||||||
psc->f->flush(draw->driDrawable);
|
|
||||||
|
|
||||||
dri2Throttle(psc, draw, throttle_reason);
|
dri2Throttle(psc, draw, throttle_reason);
|
||||||
}
|
}
|
||||||
|
|
@ -519,8 +518,7 @@ dri2_copy_drawable(struct dri2_drawable *priv, int dest, int src)
|
||||||
xrect.width = priv->width;
|
xrect.width = priv->width;
|
||||||
xrect.height = priv->height;
|
xrect.height = priv->height;
|
||||||
|
|
||||||
if (psc->f)
|
dri_flush_drawable(priv->driDrawable);
|
||||||
psc->f->flush(priv->driDrawable);
|
|
||||||
|
|
||||||
region = XFixesCreateRegion(psc->base.dpy, &xrect, 1);
|
region = XFixesCreateRegion(psc->base.dpy, &xrect, 1);
|
||||||
DRI2CopyRegion(psc->base.dpy, priv->base.xDrawable, region, dest, src);
|
DRI2CopyRegion(psc->base.dpy, priv->base.xDrawable, region, dest, src);
|
||||||
|
|
@ -795,16 +793,12 @@ dri2InvalidateBuffers(Display *dpy, XID drawable)
|
||||||
{
|
{
|
||||||
__GLXDRIdrawable *pdraw =
|
__GLXDRIdrawable *pdraw =
|
||||||
dri2GetGlxDrawableFromXDrawableId(dpy, drawable);
|
dri2GetGlxDrawableFromXDrawableId(dpy, drawable);
|
||||||
struct dri2_screen *psc;
|
|
||||||
struct dri2_drawable *pdp = (struct dri2_drawable *) pdraw;
|
struct dri2_drawable *pdp = (struct dri2_drawable *) pdraw;
|
||||||
|
|
||||||
if (!pdraw)
|
if (!pdraw)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
psc = (struct dri2_screen *) pdraw->psc;
|
dri_invalidate_drawable(pdp->driDrawable);
|
||||||
|
|
||||||
if (psc->f && psc->f->base.version >= 3 && psc->f->invalidate)
|
|
||||||
psc->f->invalidate(pdp->driDrawable);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -878,7 +872,6 @@ dri2BindExtensions(struct dri2_screen *psc, struct glx_display * priv,
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct dri_extension_match exts[] = {
|
static const struct dri_extension_match exts[] = {
|
||||||
{ __DRI2_FLUSH, 1, offsetof(struct dri2_screen, f), true },
|
|
||||||
{ __DRI2_CONFIG_QUERY, 1, offsetof(struct dri2_screen, config), true },
|
{ __DRI2_CONFIG_QUERY, 1, offsetof(struct dri2_screen, config), true },
|
||||||
{ __DRI2_THROTTLE, 1, offsetof(struct dri2_screen, throttle), true },
|
{ __DRI2_THROTTLE, 1, offsetof(struct dri2_screen, throttle), true },
|
||||||
{ __DRI2_INTEROP, 1, offsetof(struct dri2_screen, interop), true },
|
{ __DRI2_INTEROP, 1, offsetof(struct dri2_screen, interop), true },
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,6 @@ struct dri2_screen {
|
||||||
__DRIscreen *driScreen;
|
__DRIscreen *driScreen;
|
||||||
__GLXDRIscreen vtable;
|
__GLXDRIscreen vtable;
|
||||||
|
|
||||||
const __DRI2flushExtension *f;
|
|
||||||
const __DRI2configQueryExtension *config;
|
const __DRI2configQueryExtension *config;
|
||||||
const __DRI2throttleExtension *throttle;
|
const __DRI2throttleExtension *throttle;
|
||||||
const __DRI2interopExtension *interop;
|
const __DRI2interopExtension *interop;
|
||||||
|
|
|
||||||
|
|
@ -160,7 +160,6 @@ dri3_destroy_context(struct glx_context *context)
|
||||||
static Bool
|
static Bool
|
||||||
dri3_bind_context(struct glx_context *context, GLXDrawable draw, GLXDrawable read)
|
dri3_bind_context(struct glx_context *context, GLXDrawable draw, GLXDrawable read)
|
||||||
{
|
{
|
||||||
struct dri3_screen *psc = (struct dri3_screen *) context->psc;
|
|
||||||
struct dri3_drawable *pdraw, *pread;
|
struct dri3_drawable *pdraw, *pread;
|
||||||
__DRIdrawable *dri_draw = NULL, *dri_read = NULL;
|
__DRIdrawable *dri_draw = NULL, *dri_read = NULL;
|
||||||
|
|
||||||
|
|
@ -183,9 +182,9 @@ dri3_bind_context(struct glx_context *context, GLXDrawable draw, GLXDrawable rea
|
||||||
return GLXBadContext;
|
return GLXBadContext;
|
||||||
|
|
||||||
if (dri_draw)
|
if (dri_draw)
|
||||||
psc->f->invalidate(dri_draw);
|
dri_invalidate_drawable(dri_draw);
|
||||||
if (dri_read && dri_read != dri_draw)
|
if (dri_read && dri_read != dri_draw)
|
||||||
psc->f->invalidate(dri_read);
|
dri_invalidate_drawable(dri_read);
|
||||||
|
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
@ -475,7 +474,7 @@ dri3_flush_front_buffer(__DRIdrawable *driDrawable, void *loaderPrivate)
|
||||||
|
|
||||||
loader_dri3_flush(draw, __DRI2_FLUSH_DRAWABLE, __DRI2_THROTTLE_FLUSHFRONT);
|
loader_dri3_flush(draw, __DRI2_FLUSH_DRAWABLE, __DRI2_THROTTLE_FLUSHFRONT);
|
||||||
|
|
||||||
psc->f->invalidate(driDrawable);
|
dri_invalidate_drawable(driDrawable);
|
||||||
loader_dri3_wait_gl(draw);
|
loader_dri3_wait_gl(draw);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -637,12 +636,9 @@ dri3_bind_tex_image(__GLXDRIdrawable *base,
|
||||||
{
|
{
|
||||||
struct glx_context *gc = __glXGetCurrentContext();
|
struct glx_context *gc = __glXGetCurrentContext();
|
||||||
struct dri3_drawable *pdraw = (struct dri3_drawable *) base;
|
struct dri3_drawable *pdraw = (struct dri3_drawable *) base;
|
||||||
struct dri3_screen *psc;
|
|
||||||
|
|
||||||
if (pdraw != NULL) {
|
if (pdraw != NULL) {
|
||||||
psc = (struct dri3_screen *) base->psc;
|
dri_invalidate_drawable(pdraw->loader_drawable.dri_drawable);
|
||||||
|
|
||||||
psc->f->invalidate(pdraw->loader_drawable.dri_drawable);
|
|
||||||
|
|
||||||
XSync(gc->currentDpy, false);
|
XSync(gc->currentDpy, false);
|
||||||
|
|
||||||
|
|
@ -702,7 +698,6 @@ dri3_bind_extensions(struct dri3_screen *psc, struct glx_display * priv,
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct dri_extension_match exts[] = {
|
static const struct dri_extension_match exts[] = {
|
||||||
{ __DRI2_FLUSH, 1, offsetof(struct dri3_screen, f), true },
|
|
||||||
{ __DRI_IMAGE, 1, offsetof(struct dri3_screen, image), true },
|
{ __DRI_IMAGE, 1, offsetof(struct dri3_screen, image), true },
|
||||||
{ __DRI2_INTEROP, 1, offsetof(struct dri3_screen, interop), true },
|
{ __DRI2_INTEROP, 1, offsetof(struct dri3_screen, interop), true },
|
||||||
{ __DRI2_CONFIG_QUERY, 1, offsetof(struct dri3_screen, config), true },
|
{ __DRI2_CONFIG_QUERY, 1, offsetof(struct dri3_screen, config), true },
|
||||||
|
|
@ -852,11 +847,6 @@ dri3_create_screen(int screen, struct glx_display * priv, bool driver_name_is_in
|
||||||
goto handle_error;
|
goto handle_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!psc->f || psc->f->base.version < 4) {
|
|
||||||
ErrorMessageF("Version 4 or later of flush extension not found\n");
|
|
||||||
goto handle_error;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (psc->fd_render_gpu != psc->fd_display_gpu && psc->image->base.version < 9) {
|
if (psc->fd_render_gpu != psc->fd_display_gpu && psc->image->base.version < 9) {
|
||||||
ErrorMessageF("Different GPU, but image extension version 9 or later not found\n");
|
ErrorMessageF("Different GPU, but image extension version 9 or later not found\n");
|
||||||
goto handle_error;
|
goto handle_error;
|
||||||
|
|
@ -867,7 +857,6 @@ dri3_create_screen(int screen, struct glx_display * priv, bool driver_name_is_in
|
||||||
goto handle_error;
|
goto handle_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
psc->loader_dri3_ext.flush = psc->f;
|
|
||||||
psc->loader_dri3_ext.image = psc->image;
|
psc->loader_dri3_ext.image = psc->image;
|
||||||
psc->loader_dri3_ext.config = psc->config;
|
psc->loader_dri3_ext.config = psc->config;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,6 @@ struct dri3_screen {
|
||||||
__DRIscreen *driScreenRenderGPU;
|
__DRIscreen *driScreenRenderGPU;
|
||||||
|
|
||||||
const __DRIimageExtension *image;
|
const __DRIimageExtension *image;
|
||||||
const __DRI2flushExtension *f;
|
|
||||||
const __DRI2configQueryExtension *config;
|
const __DRI2configQueryExtension *config;
|
||||||
const __DRI2interopExtension *interop;
|
const __DRI2interopExtension *interop;
|
||||||
const __DRIconfig **driver_configs;
|
const __DRIconfig **driver_configs;
|
||||||
|
|
|
||||||
|
|
@ -446,11 +446,11 @@ drisw_bind_context(struct glx_context *context, GLXDrawable draw, GLXDrawable re
|
||||||
pdraw ? pdraw->driDrawable : NULL,
|
pdraw ? pdraw->driDrawable : NULL,
|
||||||
pread ? pread->driDrawable : NULL))
|
pread ? pread->driDrawable : NULL))
|
||||||
return GLXBadContext;
|
return GLXBadContext;
|
||||||
if (psc->f) {
|
if (psc->kopper) {
|
||||||
if (pdraw)
|
if (pdraw)
|
||||||
psc->f->invalidate(pdraw->driDrawable);
|
dri_invalidate_drawable(pdraw->driDrawable);
|
||||||
if (pread && (!pdraw || pread->driDrawable != pdraw->driDrawable))
|
if (pread && (!pdraw || pread->driDrawable != pdraw->driDrawable))
|
||||||
psc->f->invalidate(pread->driDrawable);
|
dri_invalidate_drawable(pread->driDrawable);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Success;
|
return Success;
|
||||||
|
|
@ -795,7 +795,6 @@ driswBindExtensions(struct drisw_screen *psc, const __DRIextension **extensions)
|
||||||
|
|
||||||
/* FIXME: Figure out what other extensions can be ported here from dri2. */
|
/* FIXME: Figure out what other extensions can be ported here from dri2. */
|
||||||
static const struct dri_extension_match exts[] = {
|
static const struct dri_extension_match exts[] = {
|
||||||
{ __DRI2_FLUSH, 1, offsetof(struct drisw_screen, f), true },
|
|
||||||
{ __DRI2_CONFIG_QUERY, 1, offsetof(struct drisw_screen, config), true },
|
{ __DRI2_CONFIG_QUERY, 1, offsetof(struct drisw_screen, config), true },
|
||||||
};
|
};
|
||||||
loader_bind_extensions(psc, exts, ARRAY_SIZE(exts), extensions);
|
loader_bind_extensions(psc, exts, ARRAY_SIZE(exts), extensions);
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,6 @@ struct drisw_screen
|
||||||
|
|
||||||
__DRIscreen *driScreen;
|
__DRIscreen *driScreen;
|
||||||
__GLXDRIscreen vtable;
|
__GLXDRIscreen vtable;
|
||||||
const __DRI2flushExtension *f;
|
|
||||||
const __DRI2configQueryExtension *config;
|
const __DRI2configQueryExtension *config;
|
||||||
|
|
||||||
const __DRIconfig **driver_configs;
|
const __DRIconfig **driver_configs;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue