[Xfce4-commits] [xfce/xfwm4] 01/01: compositor: Do not read from front buffer
noreply at xfce.org
noreply at xfce.org
Wed May 8 11:43:11 CEST 2019
This is an automated email from the git hooks/post-receive script.
o l i v i e r p u s h e d a c o m m i t t o b r a n c h m a s t e r
in repository xfce/xfwm4.
commit 8a5fc3b9070e13f9494afa6bf75197b61a373643
Author: Olivier Fourdan <fourdan at xfce.org>
Date: Wed May 8 11:02:20 2019 +0200
compositor: Do not read from front buffer
Reading from the front buffer is not advisable and gives random results
depending on the driver and/or hardware.
So instead of relying on the front buffer, re-copy the entire content to
the back buffer again just after we swapped buffers.
Also, by doing so, we don't need to accumulate damages with GLX backend.
Signed-off-by: Olivier Fourdan <fourdan at xfce.org>
Fixes: a818cc0 "compositor: Optimize GLX code path"
---
src/compositor.c | 63 +++++++++++++++++++++++++++++++++++---------------------
1 file changed, 39 insertions(+), 24 deletions(-)
diff --git a/src/compositor.c b/src/compositor.c
index f0459c8..6e5bb15 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -1561,13 +1561,20 @@ redraw_glx_rects (ScreenInfo *screen_info, XRectangle *rects, int nrects)
}
static void
+redraw_glx_screen (ScreenInfo *screen_info)
+{
+ XRectangle root_rect = { 0, 0, screen_info->width, screen_info->height};
+
+ redraw_glx_rects (screen_info, &root_rect, 1);
+}
+
+static void
redraw_glx_texture (ScreenInfo *screen_info, XserverRegion region)
{
g_return_if_fail (screen_info != NULL);
TRACE ("(re)Drawing GLX pixmap 0x%lx/texture 0x%x",
screen_info->glx_drawable, screen_info->rootTexture);
- glReadBuffer (GL_FRONT);
glDrawBuffer (GL_BACK);
glViewport(0, 0, screen_info->width, screen_info->height);
@@ -1589,8 +1596,7 @@ redraw_glx_texture (ScreenInfo *screen_info, XserverRegion region)
scale_glx_texture (screen_info, screen_info->width, screen_info->height, zoom);
glTranslated (x, y, 0.0);
-
- redraw_glx_rects (screen_info, &root_rect, 1);
+ redraw_glx_screen (screen_info);
}
else
{
@@ -1607,11 +1613,17 @@ redraw_glx_texture (ScreenInfo *screen_info, XserverRegion region)
XFree (rects);
}
- glPopMatrix();
-
glXSwapBuffers (myScreenGetXDisplay (screen_info),
screen_info->glx_window);
+ if (!screen_info->zoomed)
+ {
+ /* Once we swapped, re-copy the entire texture to the back buffer */
+ redraw_glx_screen (screen_info);
+ }
+
+ glPopMatrix();
+
disable_glx_texture (screen_info);
TRACE ("releasing bind GLX pixmap 0x%lx to texture 0x%x",
@@ -2339,40 +2351,43 @@ repair_screen (ScreenInfo *screen_info)
if (damage)
{
#ifdef HAVE_PRESENT_EXTENSION
- if (screen_info->use_present && screen_info->present_pending)
+ if (screen_info->use_present)
{
/*
* We do not paint the screen because we are waiting for
* a pending present notification, do not cancel the callback yet...
*/
- return TRUE;
- }
-#endif /* HAVE_PRESENT_EXTENSION */
+ if (screen_info->present_pending)
+ {
+ return TRUE;
+ }
- if (screen_info->prevDamage)
- {
- XFixesUnionRegion(display_info->dpy,
- screen_info->prevDamage,
- screen_info->prevDamage,
- damage);
- damage = screen_info->prevDamage;
+ if (screen_info->prevDamage)
+ {
+ XFixesUnionRegion(display_info->dpy,
+ screen_info->prevDamage,
+ screen_info->prevDamage,
+ damage);
+ damage = screen_info->prevDamage;
+ }
}
+#endif /* HAVE_PRESENT_EXTENSION */
remove_timeouts (screen_info);
paint_all (screen_info, damage, screen_info->current_buffer);
- if (screen_info->prevDamage)
- {
- XFixesDestroyRegion (display_info->dpy, screen_info->prevDamage);
- }
-
- screen_info->prevDamage = screen_info->allDamage;
- screen_info->allDamage = None;
-
#ifdef HAVE_PRESENT_EXTENSION
if (screen_info->use_present)
{
screen_info->current_buffer = (screen_info->current_buffer + 1) % 2;
+
+ if (screen_info->prevDamage)
+ {
+ XFixesDestroyRegion (display_info->dpy, screen_info->prevDamage);
+ }
+
+ screen_info->prevDamage = screen_info->allDamage;
+ screen_info->allDamage = None;
}
#endif /* HAVE_PRESENT_EXTENSION */
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list