mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-23 13:20:14 +01:00
glx: Provide the __DRI_USE_INVALIDATE extension to the driver when we can
When we have DRI2 protocol at least 2.3, we get an event from the server when the back buffers get invalidated. When that's the case let the driver know that it can rely on invalidate instead of the glViewport polling.
This commit is contained in:
parent
97a6cbc6dd
commit
4258e3a2e1
1 changed files with 25 additions and 14 deletions
|
|
@ -73,6 +73,8 @@ struct __GLXDRIdisplayPrivateRec
|
||||||
int driPatch;
|
int driPatch;
|
||||||
int swapAvailable;
|
int swapAvailable;
|
||||||
int invalidateAvailable;
|
int invalidateAvailable;
|
||||||
|
|
||||||
|
const __DRIextension *loader_extensions[4];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct __GLXDRIcontextPrivateRec
|
struct __GLXDRIcontextPrivateRec
|
||||||
|
|
@ -536,17 +538,11 @@ static const __DRIdri2LoaderExtension dri2LoaderExtension_old = {
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const __DRIextension *loader_extensions[] = {
|
#ifdef __DRI_USE_INVALIDATE
|
||||||
&dri2LoaderExtension.base,
|
static const __DRIuseInvalidateExtension dri2UseInvalidate = {
|
||||||
&systemTimeExtension.base,
|
{ __DRI_USE_INVALIDATE, __DRI_USE_INVALIDATE_VERSION }
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
static const __DRIextension *loader_extensions_old[] = {
|
|
||||||
&dri2LoaderExtension_old.base,
|
|
||||||
&systemTimeExtension.base,
|
|
||||||
NULL
|
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
_X_HIDDEN void
|
_X_HIDDEN void
|
||||||
dri2InvalidateBuffers(Display *dpy, XID drawable)
|
dri2InvalidateBuffers(Display *dpy, XID drawable)
|
||||||
|
|
@ -622,13 +618,14 @@ dri2CreateScreen(__GLXscreenConfigs * psc, int screen,
|
||||||
goto handle_error;
|
goto handle_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* If the server does not support the protocol for
|
/* If the server does not support the protocol for
|
||||||
* DRI2GetBuffersWithFormat, don't supply that interface to the driver.
|
* DRI2GetBuffersWithFormat, don't supply that interface to the driver.
|
||||||
*/
|
*/
|
||||||
psc->__driScreen =
|
psc->__driScreen =
|
||||||
psc->dri2->createNewScreen(screen, psc->fd, ((pdp->driMinor < 1)
|
psc->dri2->createNewScreen(screen, psc->fd,
|
||||||
? loader_extensions_old
|
(const __DRIextension **)
|
||||||
: loader_extensions),
|
&pdp->loader_extensions[0],
|
||||||
&driver_configs, psc);
|
&driver_configs, psc);
|
||||||
|
|
||||||
if (psc->__driScreen == NULL) {
|
if (psc->__driScreen == NULL) {
|
||||||
|
|
@ -710,7 +707,7 @@ _X_HIDDEN __GLXDRIdisplay *
|
||||||
dri2CreateDisplay(Display * dpy)
|
dri2CreateDisplay(Display * dpy)
|
||||||
{
|
{
|
||||||
__GLXDRIdisplayPrivate *pdp;
|
__GLXDRIdisplayPrivate *pdp;
|
||||||
int eventBase, errorBase;
|
int eventBase, errorBase, i;
|
||||||
|
|
||||||
if (!DRI2QueryExtension(dpy, &eventBase, &errorBase))
|
if (!DRI2QueryExtension(dpy, &eventBase, &errorBase))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
@ -731,6 +728,20 @@ dri2CreateDisplay(Display * dpy)
|
||||||
pdp->base.destroyDisplay = dri2DestroyDisplay;
|
pdp->base.destroyDisplay = dri2DestroyDisplay;
|
||||||
pdp->base.createScreen = dri2CreateScreen;
|
pdp->base.createScreen = dri2CreateScreen;
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
if (pdp->driMinor < 1)
|
||||||
|
pdp->loader_extensions[i++] = &dri2LoaderExtension_old.base;
|
||||||
|
else
|
||||||
|
pdp->loader_extensions[i++] = &dri2LoaderExtension.base;
|
||||||
|
|
||||||
|
pdp->loader_extensions[i++] = &systemTimeExtension.base;
|
||||||
|
|
||||||
|
#ifdef __DRI_USE_INVALIDATE
|
||||||
|
if (pdp->invalidateAvailable)
|
||||||
|
pdp->loader_extensions[i++] = &dri2UseInvalidate.base;
|
||||||
|
pdp->loader_extensions[i++] = NULL;
|
||||||
|
#endif
|
||||||
|
|
||||||
return &pdp->base;
|
return &pdp->base;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue