[vlc-commits] [Git][videolan/vlc][3.0.x] 5 commits: qt: don't call XClearWindow() on resize

Hugo Beauzée-Luyssen (@chouquette) gitlab at videolan.org
Fri Apr 1 15:14:19 UTC 2022



Hugo Beauzée-Luyssen pushed to branch 3.0.x at VideoLAN / VLC


Commits:
255005ae by Jeffrey Knockel at 2022-04-01T14:33:09+00:00
qt: don't call XClearWindow() on resize

This call is extraneous as the X server automatically fills any exposed
area with the window's background (in this case, black).

- - - - -
9e297a47 by Jeffrey Knockel at 2022-04-01T14:33:09+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.

(backport of commit a32bf927)

- - - - -
7cd64897 by Jeffrey Knockel at 2022-04-01T14:33:09+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.

(backport of commit 7251119a)

- - - - -
b3971b8c by Jeffrey Knockel at 2022-04-01T14:33:09+00:00
xcb/x11: set northwest bit gravity on output window

This fixes black flickering on resize.

Fixes #25716 for xcb/x11 output.

(backport of commit 58aaf06c)

- - - - -
1951b65d by Jeffrey Knockel at 2022-04-01T14:33:09+00:00
xcb/xvideo: set northwest bit gravity on output window

This fixes black flickering on resize.

Fixes #25716 for xcb/xvideo output.

- - - - -


5 changed files:

- modules/gui/qt/qt.cpp
- modules/video_output/glx.c
- modules/video_output/opengl/egl.c
- modules/video_output/xcb/x11.c
- modules/video_output/xcb/xvideo.c


Changes:

=====================================
modules/gui/qt/qt.cpp
=====================================
@@ -809,7 +809,6 @@ void WindowResized(vout_window_t *wnd, const QSize& size)
     if (QX11Info::isPlatformX11())
     {
         XResizeWindow(sys->dpy, wnd->handle.xid, size.width(), size.height());
-        XClearWindow(sys->dpy, wnd->handle.xid);
         XSync(sys->dpy, True);
     }
 #endif


=====================================
modules/video_output/glx.c
=====================================
@@ -40,6 +40,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)
@@ -201,6 +202,16 @@ static int Open (vlc_object_t *obj)
         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->makeCurrent = MakeCurrent;
@@ -263,6 +274,12 @@ static void Close (vlc_object_t *obj)
 
     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);
 }


=====================================
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;
@@ -211,8 +212,15 @@ static void Close (vlc_object_t *obj)
         eglTerminate(sys->display);
     }
 #ifdef USE_PLATFORM_X11
-    if (sys->x11 != NULL)
+    if (sys->x11 != NULL) {
+        if (sys->restore_forget_gravity) {
+            XSetWindowAttributes swa;
+            swa.bit_gravity = ForgetGravity;
+            XChangeWindowAttributes (sys->x11, gl->surface->handle.xid,
+                                     CWBitGravity, &swa);
+        }
         XCloseDisplay(sys->x11);
+    }
 #endif
 #ifdef USE_PLATFORM_WAYLAND
     if (sys->window != NULL)
@@ -261,10 +269,18 @@ static int Open (vlc_object_t *obj, 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/x11.c
=====================================
@@ -251,6 +251,7 @@ found_format:;
             XCB_CW_BACK_PIXEL |
             XCB_CW_BORDER_PIXMAP |
             XCB_CW_BORDER_PIXEL |
+            XCB_CW_BIT_GRAVITY |
             XCB_CW_EVENT_MASK |
             XCB_CW_COLORMAP;
         const uint32_t values[] = {
@@ -262,6 +263,8 @@ found_format:;
             pixmap,
             /* XCB_CW_BORDER_PIXEL */
             scr->black_pixel,
+            /* XCB_CW_BIT_GRAVITY */
+            XCB_GRAVITY_NORTH_WEST,
             /* XCB_CW_EVENT_MASK */
             XCB_EVENT_MASK_VISIBILITY_CHANGE,
             /* XCB_CW_COLORMAP */


=====================================
modules/video_output/xcb/xvideo.c
=====================================
@@ -468,6 +468,7 @@ static int Open (vlc_object_t *obj)
                 XCB_CW_BACK_PIXEL |
                 XCB_CW_BORDER_PIXMAP |
                 XCB_CW_BORDER_PIXEL |
+                XCB_CW_BIT_GRAVITY |
                 XCB_CW_EVENT_MASK |
                 XCB_CW_COLORMAP;
             const uint32_t list[] = {
@@ -479,6 +480,8 @@ static int Open (vlc_object_t *obj)
                 pixmap,
                 /* XCB_CW_BORDER_PIXEL */
                 screen->black_pixel,
+                /* XCB_CW_BIT_GRAVITY */
+                XCB_GRAVITY_NORTH_WEST,
                 /* XCB_CW_EVENT_MASK */
                 XCB_EVENT_MASK_VISIBILITY_CHANGE,
                 /* XCB_CW_COLORMAP */



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/1a1a9da7afdbb2d3ff11405fdc836161cadbbf86...1951b65df86f0cfd8e938ec1855401f1c2e1e6ec

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/1a1a9da7afdbb2d3ff11405fdc836161cadbbf86...1951b65df86f0cfd8e938ec1855401f1c2e1e6ec
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