mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-01 16:48:07 +02:00
glx: move the glFlush call one layer down
This commit is contained in:
parent
8ad9d42b33
commit
5b7e9b7360
5 changed files with 35 additions and 17 deletions
|
|
@ -534,7 +534,7 @@ dri2Throttle(struct dri2_screen *psc,
|
|||
static void
|
||||
__dri2CopySubBuffer(__GLXDRIdrawable *pdraw, int x, int y,
|
||||
int width, int height,
|
||||
enum __DRI2throttleReason reason)
|
||||
enum __DRI2throttleReason reason, Bool flush)
|
||||
{
|
||||
struct dri2_drawable *priv = (struct dri2_drawable *) pdraw;
|
||||
struct dri2_screen *psc = (struct dri2_screen *) pdraw->psc;
|
||||
|
|
@ -550,6 +550,10 @@ __dri2CopySubBuffer(__GLXDRIdrawable *pdraw, int x, int y,
|
|||
xrect.width = width;
|
||||
xrect.height = height;
|
||||
|
||||
if (flush) {
|
||||
glFlush();
|
||||
}
|
||||
|
||||
if (psc->f)
|
||||
(*psc->f->flush) (priv->driDrawable);
|
||||
|
||||
|
|
@ -571,10 +575,10 @@ __dri2CopySubBuffer(__GLXDRIdrawable *pdraw, int x, int y,
|
|||
|
||||
static void
|
||||
dri2CopySubBuffer(__GLXDRIdrawable *pdraw, int x, int y,
|
||||
int width, int height)
|
||||
int width, int height, Bool flush)
|
||||
{
|
||||
__dri2CopySubBuffer(pdraw, x, y, width, height,
|
||||
__DRI2_THROTTLE_COPYSUBBUFFER);
|
||||
__DRI2_THROTTLE_COPYSUBBUFFER, flush);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -731,7 +735,7 @@ static void show_fps(struct dri2_drawable *draw)
|
|||
|
||||
static int64_t
|
||||
dri2SwapBuffers(__GLXDRIdrawable *pdraw, int64_t target_msc, int64_t divisor,
|
||||
int64_t remainder)
|
||||
int64_t remainder, Bool flush)
|
||||
{
|
||||
struct dri2_drawable *priv = (struct dri2_drawable *) pdraw;
|
||||
struct glx_display *dpyPriv = __glXInitialize(priv->base.psc->dpy);
|
||||
|
|
@ -747,7 +751,7 @@ dri2SwapBuffers(__GLXDRIdrawable *pdraw, int64_t target_msc, int64_t divisor,
|
|||
/* Old servers can't handle swapbuffers */
|
||||
if (!pdp->swapAvailable) {
|
||||
__dri2CopySubBuffer(pdraw, 0, 0, priv->width, priv->height,
|
||||
__DRI2_THROTTLE_SWAPBUFFER);
|
||||
__DRI2_THROTTLE_SWAPBUFFER, flush);
|
||||
} else {
|
||||
xcb_connection_t *c = XGetXCBConnection(pdraw->psc->dpy);
|
||||
xcb_dri2_swap_buffers_cookie_t swap_buffers_cookie;
|
||||
|
|
@ -756,6 +760,10 @@ dri2SwapBuffers(__GLXDRIdrawable *pdraw, int64_t target_msc, int64_t divisor,
|
|||
uint32_t divisor_hi, divisor_lo;
|
||||
uint32_t remainder_hi, remainder_lo;
|
||||
|
||||
if (flush) {
|
||||
glFlush();
|
||||
}
|
||||
|
||||
if (psc->f) {
|
||||
struct glx_context *gc = __glXGetCurrentContext();
|
||||
|
||||
|
|
|
|||
|
|
@ -684,22 +684,30 @@ driCreateDrawable(struct glx_screen *base,
|
|||
|
||||
static int64_t
|
||||
driSwapBuffers(__GLXDRIdrawable * pdraw, int64_t unused1, int64_t unused2,
|
||||
int64_t unused3)
|
||||
int64_t unused3, Bool flush)
|
||||
{
|
||||
struct dri_screen *psc = (struct dri_screen *) pdraw->psc;
|
||||
struct dri_drawable *pdp = (struct dri_drawable *) pdraw;
|
||||
|
||||
if (flush) {
|
||||
glFlush();
|
||||
}
|
||||
|
||||
(*psc->core->swapBuffers) (pdp->driDrawable);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
driCopySubBuffer(__GLXDRIdrawable * pdraw,
|
||||
int x, int y, int width, int height)
|
||||
int x, int y, int width, int height, Bool flush)
|
||||
{
|
||||
struct dri_drawable *pdp = (struct dri_drawable *) pdraw;
|
||||
struct dri_screen *psc = (struct dri_screen *) pdp->base.psc;
|
||||
|
||||
if (flush) {
|
||||
glFlush();
|
||||
}
|
||||
|
||||
(*psc->driCopySubBuffer->copySubBuffer) (pdp->driDrawable,
|
||||
x, y, width, height);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -551,7 +551,8 @@ driswCreateDrawable(struct glx_screen *base, XID xDrawable,
|
|||
|
||||
static int64_t
|
||||
driswSwapBuffers(__GLXDRIdrawable * pdraw,
|
||||
int64_t target_msc, int64_t divisor, int64_t remainder)
|
||||
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;
|
||||
|
|
@ -560,6 +561,10 @@ driswSwapBuffers(__GLXDRIdrawable * pdraw,
|
|||
(void) divisor;
|
||||
(void) remainder;
|
||||
|
||||
if (flush) {
|
||||
glFlush();
|
||||
}
|
||||
|
||||
(*psc->core->swapBuffers) (pdp->driDrawable);
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -113,9 +113,9 @@ struct __GLXDRIscreenRec {
|
|||
struct glx_config *config);
|
||||
|
||||
int64_t (*swapBuffers)(__GLXDRIdrawable *pdraw, int64_t target_msc,
|
||||
int64_t divisor, int64_t remainder);
|
||||
int64_t divisor, int64_t remainder, Bool flush);
|
||||
void (*copySubBuffer)(__GLXDRIdrawable *pdraw,
|
||||
int x, int y, int width, int height);
|
||||
int x, int y, int width, int height, Bool flush);
|
||||
int (*getDrawableMSC)(struct glx_screen *psc, __GLXDRIdrawable *pdraw,
|
||||
int64_t *ust, int64_t *msc, int64_t *sbc);
|
||||
int (*waitForMSC)(__GLXDRIdrawable *pdraw, int64_t target_msc,
|
||||
|
|
|
|||
|
|
@ -781,11 +781,9 @@ glXSwapBuffers(Display * dpy, GLXDrawable drawable)
|
|||
__GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable);
|
||||
|
||||
if (pdraw != NULL) {
|
||||
if (gc && drawable == gc->currentDrawable) {
|
||||
glFlush();
|
||||
}
|
||||
Bool flush = gc && drawable == gc->currentDrawable;
|
||||
|
||||
(*pdraw->psc->driScreen->swapBuffers)(pdraw, 0, 0, 0);
|
||||
(*pdraw->psc->driScreen->swapBuffers)(pdraw, 0, 0, 0, flush);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -2171,7 +2169,7 @@ __glXSwapBuffersMscOML(Display * dpy, GLXDrawable drawable,
|
|||
#ifdef GLX_DIRECT_RENDERING
|
||||
if (psc->driScreen && psc->driScreen->swapBuffers)
|
||||
return (*psc->driScreen->swapBuffers)(pdraw, target_msc, divisor,
|
||||
remainder);
|
||||
remainder, False);
|
||||
#endif
|
||||
|
||||
return -1;
|
||||
|
|
@ -2311,8 +2309,7 @@ __glXCopySubBufferMESA(Display * dpy, GLXDrawable drawable,
|
|||
if (pdraw != NULL) {
|
||||
struct glx_screen *psc = pdraw->psc;
|
||||
if (psc->driScreen->copySubBuffer != NULL) {
|
||||
glFlush();
|
||||
(*psc->driScreen->copySubBuffer) (pdraw, x, y, width, height);
|
||||
(*psc->driScreen->copySubBuffer) (pdraw, x, y, width, height, True);
|
||||
}
|
||||
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue