[vlc-commits] [Git][videolan/vlc][master] 4 commits: xcb/x11: set northwest bit gravity on output window

Hugo Beauzée-Luyssen (@chouquette) gitlab at videolan.org
Mon Mar 14 17:56:42 UTC 2022



Hugo Beauzée-Luyssen pushed to branch master at VideoLAN / VLC


Commits:
58aaf06c by Jeffrey Knockel at 2022-03-14T17:39:07+00:00
xcb/x11: set northwest bit gravity on output window

This fixes black flickering on resize.

Fixes #25716 for xcb/x11 output.

- - - - -
96100d05 by Jeffrey Knockel at 2022-03-14T17:39:07+00:00
xcb/render: remove background pixel from output window

The RENDER output is blanking its background explicitly at each frame.
This fixes black flickering on resize.

Fixes #25716 for RENDER output.

- - - - -
7251119a by Jeffrey Knockel at 2022-03-14T17:39:07+00:00
egl: set northwest bit gravity on output window

If necessary, set bit gravity on Open() and restore on Close().  This
fixes black flickering on resize.

Fixes #25716 for EGL.

- - - - -
a32bf927 by Jeffrey Knockel at 2022-03-14T17:39:07+00:00
glx: set northwest bit gravity on output window

If necessary, set bit gravity on Open() and restore on Close().  This
fixes black flickering on resize.

Fixes #25716 for GLX.

- - - - -


4 changed files:

- modules/video_output/glx.c
- modules/video_output/opengl/egl.c
- modules/video_output/xcb/render.c
- modules/video_output/xcb/x11.c


Changes:

=====================================
modules/video_output/glx.c
=====================================
@@ -44,6 +44,7 @@ typedef struct vlc_gl_sys_t
     Display *display;
     GLXWindow win;
     GLXContext ctx;
+    bool restore_forget_gravity;
 } vlc_gl_sys_t;
 
 static int MakeCurrent (vlc_gl_t *gl)
@@ -120,6 +121,12 @@ static void Close(vlc_gl_t *gl)
 
     glXDestroyContext(dpy, sys->ctx);
     glXDestroyWindow(dpy, sys->win);
+    if (sys->restore_forget_gravity) {
+        XSetWindowAttributes swa;
+        swa.bit_gravity = ForgetGravity;
+        XChangeWindowAttributes (dpy, gl->surface->handle.xid, CWBitGravity,
+                                 &swa);
+    }
     XCloseDisplay(dpy);
     free(sys);
 }
@@ -212,6 +219,16 @@ static int Open(vlc_gl_t *gl, unsigned width, unsigned height)
         goto error;
     }
 
+    /* Set bit gravity if necessary */
+    if (wa.bit_gravity == ForgetGravity) {
+        XSetWindowAttributes swa;
+        swa.bit_gravity = NorthWestGravity;
+        XChangeWindowAttributes (dpy, gl->surface->handle.xid, CWBitGravity,
+                                 &swa);
+        sys->restore_forget_gravity = true;
+    } else
+        sys->restore_forget_gravity = false;
+
     /* Initialize OpenGL callbacks */
     gl->sys = sys;
     gl->make_current = MakeCurrent;


=====================================
modules/video_output/opengl/egl.c
=====================================
@@ -50,6 +50,7 @@ typedef struct vlc_gl_sys_t
     EGLContext context;
 #if defined (USE_PLATFORM_X11)
     Display *x11;
+    bool restore_forget_gravity;
 #endif
 #if defined (USE_PLATFORM_WAYLAND)
     struct wl_egl_window *window;
@@ -163,8 +164,16 @@ static void Close(vlc_gl_t *gl)
         eglTerminate(sys->display);
     }
 #ifdef USE_PLATFORM_X11
-    if (sys->x11 != NULL)
+    if (sys->x11 != NULL) {
+        if (sys->restore_forget_gravity) {
+            vout_window_t *wnd = gl->surface;
+            XSetWindowAttributes swa;
+            swa.bit_gravity = ForgetGravity;
+            XChangeWindowAttributes(sys->x11, wnd->handle.xid, CWBitGravity,
+                                    &swa);
+        }
         XCloseDisplay(sys->x11);
+    }
 #endif
 #ifdef USE_PLATFORM_WAYLAND
     if (sys->window != NULL)
@@ -222,10 +231,18 @@ static int Open(vlc_gl_t *gl, const struct gl_api *api,
     int snum;
     {
         XWindowAttributes wa;
+        XSetWindowAttributes swa;
 
+        sys->restore_forget_gravity = false;
         if (!XGetWindowAttributes(sys->x11, wnd->handle.xid, &wa))
             goto error;
         snum = XScreenNumberOfScreen(wa.screen);
+        if (wa.bit_gravity == ForgetGravity) {
+            swa.bit_gravity = NorthWestGravity;
+            XChangeWindowAttributes(sys->x11, wnd->handle.xid, CWBitGravity,
+                                    &swa);
+            sys->restore_forget_gravity = true;
+        }
     }
 # ifdef EGL_EXT_platform_x11
     if (CheckClientExt("EGL_EXT_platform_x11"))


=====================================
modules/video_output/xcb/render.c
=====================================
@@ -655,13 +655,10 @@ static int Open(vout_display_t *vd,
 
     xcb_colormap_t cmap = xcb_generate_id(conn);
     uint32_t cw_mask =
-        XCB_CW_BACK_PIXEL |
         XCB_CW_BORDER_PIXEL |
         XCB_CW_EVENT_MASK |
         XCB_CW_COLORMAP;
     const uint32_t cw_list[] = {
-        /* XCB_CW_BACK_PIXEL */
-        screen->black_pixel,
         /* XCB_CW_BORDER_PIXEL */
         screen->black_pixel,
         /* XCB_CW_EVENT_MASK */


=====================================
modules/video_output/xcb/x11.c
=====================================
@@ -307,6 +307,7 @@ static int Open (vout_display_t *vd,
     const uint32_t mask =
         XCB_CW_BACK_PIXEL |
         XCB_CW_BORDER_PIXEL |
+        XCB_CW_BIT_GRAVITY |
         XCB_CW_EVENT_MASK |
         XCB_CW_COLORMAP;
     const uint32_t values[] = {
@@ -314,6 +315,8 @@ static int Open (vout_display_t *vd,
         scr->black_pixel,
         /* XCB_CW_BORDER_PIXEL */
         scr->black_pixel,
+        /* XCB_CW_BIT_GRAVITY */
+        XCB_GRAVITY_NORTH_WEST,
         /* XCB_CW_EVENT_MASK */
         0,
         /* XCB_CW_COLORMAP */



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/8737dcd134396f065435e02e32cfbd4098da984a...a32bf927244522a888c55b23cd1c29b61bba66ef

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/8737dcd134396f065435e02e32cfbd4098da984a...a32bf927244522a888c55b23cd1c29b61bba66ef
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list