From 2dfe9d52ed6d83fd0f2cc6cc0d921701dcb8b017 Mon Sep 17 00:00:00 2001 From: Richard Grenville Date: Thu, 21 Mar 2013 13:05:56 +0800 Subject: Improvement: --glx-use-copysubbuffermesa - GLX backend: Add --glx-use-copysubbuffermesa, to use MESA_copy_sub_buffer to do partial screen update. Huge performance boost on mesa drivers for partial screen updates, but does not work for nvidia-drivers and may break VSync. Automagically overrides --glx-copy-from-front. - Add rect_is_fullscreen() to reuse code. Misc changes. --- common.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'common.h') diff --git a/common.h b/common.h index 977643b60..2f8b6e20d 100644 --- a/common.h +++ b/common.h @@ -284,6 +284,8 @@ typedef int (*f_SwapIntervalSGI) (int interval); typedef void (*f_BindTexImageEXT) (Display *display, GLXDrawable drawable, int buffer, const int *attrib_list); typedef void (*f_ReleaseTexImageEXT) (Display *display, GLXDrawable drawable, int buffer); +typedef void (*f_CopySubBuffer) (Display *dpy, GLXDrawable drawable, int x, int y, int width, int height); + /// @brief Wrapper of a GLX FBConfig. typedef struct { GLXFBConfig cfg; @@ -344,6 +346,8 @@ typedef struct { bool glx_no_stencil; /// Whether to copy unmodified regions from front buffer. bool glx_copy_from_front; + /// Whether to use glXCopySubBufferMESA() to update screen. + bool glx_use_copysubbuffermesa; /// Whether to try to detect WM windows and mark them as focused. bool mark_wmwin_focused; /// Whether to mark override-redirect windows as focused. @@ -624,6 +628,8 @@ typedef struct { f_BindTexImageEXT glXBindTexImageProc; /// Pointer to glXReleaseTexImageEXT function. f_ReleaseTexImageEXT glXReleaseTexImageProc; + /// Pointer to glXCopySubBufferMESA function. + f_CopySubBuffer glXCopySubBufferProc; /// FBConfig-s for GLX pixmap of different depths. glx_fbconfig_t *glx_fbconfigs[OPENGL_MAX_DEPTH + 1]; #ifdef CONFIG_VSYNC_OPENGL_GLSL @@ -1490,6 +1496,15 @@ free_region(session_t *ps, XserverRegion *p) { } } +/** + * Check if a rectangle includes the whole screen. + */ +static inline bool +rect_is_fullscreen(session_t *ps, int x, int y, unsigned wid, unsigned hei) { + return (x <= 0 && y <= 0 + && (x + wid) >= ps->root_width && (y + hei) >= ps->root_height); +} + /** * Determine if a window has a specific property. * @@ -1621,6 +1636,9 @@ glx_render(session_t *ps, const glx_texture_t *ptex, int x, int y, int dx, int dy, int width, int height, int z, double opacity, bool neg, XserverRegion reg_tgt); +void +glx_swap_copysubbuffermesa(session_t *ps, XserverRegion reg); + #ifdef CONFIG_VSYNC_OPENGL_GLSL GLuint glx_create_shader(GLenum shader_type, const char *shader_str); -- cgit v1.2.1