[vlc-commits] [Git][videolan/vlc][master] 3 commits: qt: wayland: commit the surface after size change in `CommitScale()`

Steve Lhomme (@robUx4) gitlab at videolan.org
Fri Sep 18 14:14:18 UTC 2026



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
aa0752ba by Fatih Uzunoglu at 2026-09-18T13:15:34+00:00
qt: wayland: commit the surface after size change in `CommitScale()`

- - - - -
f915e588 by Fatih Uzunoglu at 2026-09-18T13:15:34+00:00
qt: wayland: avoid multiple commit after surface properties change

This is an asymptomatic case, since scale change is meant to be done
(as is done) the last, but it is still unnecessary to double commit
the surface.

The other functions, `resize()` and `move()` already takes such
`commitSurface` parameter, with this patch `rescale()` is converged
with the other property change handlers.

- - - - -
e07b64d5 by Fatih Uzunoglu at 2026-09-18T13:15:34+00:00
qt: wayland: use `CommitSurface()` when committing surface

- - - - -


3 changed files:

- modules/gui/qt/maininterface/compositor_wayland.cpp
- modules/gui/qt/maininterface/compositor_wayland_module.c
- modules/gui/qt/maininterface/compositor_wayland_module.h


Changes:

=====================================
modules/gui/qt/maininterface/compositor_wayland.cpp
=====================================
@@ -246,8 +246,8 @@ void CompositorWayland::onSurfacePositionChanged(const QPointF& position)
     qreal qtDpr = m_qmlView.get()->effectiveDevicePixelRatio();
     qreal nativeDpr = dprForWindow(m_qmlView.get());
 
-    // WARNING: Commit is requested explicitly through `::commitSurface()` after size
-    //          and position changes are applied:
+    // WARNING: Commit is requested explicitly through `::commitSurface()` after size,
+    //          position, and scale changes are applied:
     m_waylandImpl->move(
         m_waylandImpl,
         (margins.left() * qtDpr + position.x() ) / nativeDpr,
@@ -261,7 +261,7 @@ void CompositorWayland::onSurfaceSizeChanged(const QSizeF& size)
     qreal nativeDpr = dprForWindow(m_qmlView.get());
 
     // WARNING: Commit is requested explicitly through `::commitSurface()` after size
-    //          and position changes are applied:
+    //          position, and scale changes are applied:
     m_waylandImpl->resize(m_waylandImpl,
                         std::ceil(size.width() / nativeDpr),
                         std::ceil(size.height() / nativeDpr),
@@ -272,7 +272,9 @@ void CompositorWayland::onSurfaceScaleChanged(qreal dpr)
 {
     assert(m_waylandImpl);
 
-    m_waylandImpl->rescale(m_waylandImpl, dpr);
+    // WARNING: Commit is requested explicitly through `::commitSurface()` after size,
+    //          position, and scale changes are applied:
+    m_waylandImpl->rescale(m_waylandImpl, dpr, false);
 }
 
 bool CompositorWayland::unloadWaylandModule()


=====================================
modules/gui/qt/maininterface/compositor_wayland_module.c
=====================================
@@ -62,6 +62,8 @@ typedef struct
     uint32_t compositor_interface_version;
 } qtwayland_priv_t;
 
+static void CommitSurface(struct qtwayland_t* obj);
+
 static void registry_global_cb(void* data, struct wl_registry* registry,
                                uint32_t id, const char* iface, uint32_t version)
 {
@@ -124,7 +126,7 @@ static bool CommitSize(struct qtwayland_t* obj, bool commitSurface)
         // to determine the device pixel ratio.
         wp_viewport_set_destination(sys->viewport, sys->width, sys->height);
         if (commitSurface)
-            wl_surface_commit(sys->video_surface);
+            CommitSurface(obj);
         return true;
     }
 #endif
@@ -148,7 +150,7 @@ static void SetScale(struct qtwayland_t* obj, double scale)
         sys->fractional_scale = true;
 }
 
-static void CommitScale(struct qtwayland_t* obj)
+static void CommitScale(struct qtwayland_t* obj, bool commitSurface)
 {
     assert(obj);
     qtwayland_priv_t* const sys = (qtwayland_priv_t*)obj->p_sys;
@@ -171,11 +173,11 @@ static void CommitScale(struct qtwayland_t* obj)
                 if (likely(sys->compositor_interface_version >= 3))
                 {
                     wl_surface_set_buffer_scale(sys->video_surface, 1);
-                    wl_surface_commit(sys->video_surface);
+                    // `CommitSize()` call below will commit the surface.
                 }
 
                 // Started using viewport, commit size so that viewport destination is set:
-                CommitSize(obj, true);
+                CommitSize(obj, commitSurface);
             }
         }
         else
@@ -187,7 +189,8 @@ static void CommitScale(struct qtwayland_t* obj)
             if (sys->compositor_interface_version >= 3)
             {
                 wl_surface_set_buffer_scale(sys->video_surface, sys->buffer_scale);
-                wl_surface_commit(sys->video_surface);
+                if (commitSurface)
+                    CommitSurface(obj);
             }
             else
             {
@@ -206,7 +209,8 @@ static void CommitScale(struct qtwayland_t* obj)
             if (sys->compositor_interface_version >= 3)
             {
                 wl_surface_set_buffer_scale(sys->video_surface, sys->buffer_scale);
-                wl_surface_commit(sys->video_surface);
+                if (commitSurface)
+                    CommitSurface(obj);
             }
             else
             {
@@ -240,7 +244,7 @@ static int SetupVoutWindow(qtwayland_t* obj, vlc_window_t* wnd)
     if (!sys->video_surface)
         return VLC_EGENERIC;
 
-    CommitScale(obj);
+    CommitScale(obj, true);
 
     struct wl_region* region = wl_compositor_create_region(sys->compositor);
     if (!region)
@@ -253,7 +257,7 @@ static int SetupVoutWindow(qtwayland_t* obj, vlc_window_t* wnd)
     wl_surface_set_input_region(sys->video_surface, region);
 
     wl_region_destroy(region);
-    wl_surface_commit(sys->video_surface);
+    CommitSurface(obj);
 
     //setup vout window
     wnd->type = VLC_WINDOW_TYPE_WAYLAND;
@@ -293,7 +297,7 @@ static void Enable(qtwayland_t* obj, const vlc_window_cfg_t * conf)
     sys->video_subsurface = wl_subcompositor_get_subsurface(sys->subcompositor, sys->video_surface, sys->interface_surface);
     wl_subsurface_place_below(sys->video_subsurface, sys->interface_surface);
     wl_subsurface_set_desync(sys->video_subsurface);
-    wl_surface_commit(sys->video_surface);
+    CommitSurface(obj);
 }
 
 static void Disable(qtwayland_t* obj)
@@ -303,7 +307,7 @@ static void Disable(qtwayland_t* obj)
 
     wl_subsurface_destroy(sys->video_subsurface);
     sys->video_subsurface = NULL;
-    wl_surface_commit(sys->video_surface);
+    CommitSurface(obj);
 }
 
 static void Move(struct qtwayland_t* obj, int x, int y, bool commitSurface)
@@ -313,7 +317,7 @@ static void Move(struct qtwayland_t* obj, int x, int y, bool commitSurface)
         return;
     wl_subsurface_set_position(sys->video_subsurface, x, y);
     if (commitSurface)
-        wl_surface_commit(sys->video_surface);
+        CommitSurface(obj);
 }
 
 static void Resize(struct qtwayland_t* obj, size_t width, size_t height, bool commitSurface)
@@ -342,7 +346,7 @@ static void Resize(struct qtwayland_t* obj, size_t width, size_t height, bool co
 }
 
 
-static void Rescale(struct qtwayland_t* obj, double scale)
+static void Rescale(struct qtwayland_t* obj, double scale, bool commitSurface)
 {
     assert(obj);
     qtwayland_priv_t* sys = (qtwayland_priv_t*)obj->p_sys;
@@ -363,7 +367,7 @@ static void Rescale(struct qtwayland_t* obj, double scale)
     }
 
     if (commitNecessary)
-        CommitScale(obj);
+        CommitScale(obj, commitSurface);
 }
 
 static void CommitSurface(struct qtwayland_t* obj)


=====================================
modules/gui/qt/maininterface/compositor_wayland_module.h
=====================================
@@ -39,7 +39,7 @@ typedef struct qtwayland_t
     void (*disable)(struct qtwayland_t*);
     void (*move)(struct qtwayland_t*, int x, int y, bool commitSurface);
     void (*resize)(struct qtwayland_t*, size_t width, size_t height, bool commitSurface);
-    void (*rescale)(struct qtwayland_t*, double scale);
+    void (*rescale)(struct qtwayland_t*, double scale, bool commitSurface);
 
     void (*commitSurface)(struct qtwayland_t*);
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/7865cee6b5a7ac158732383bccf1f0f65caf3582...e07b64d57f2eece069c7299349796a2b0febd879

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/7865cee6b5a7ac158732383bccf1f0f65caf3582...e07b64d57f2eece069c7299349796a2b0febd879
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help




More information about the vlc-commits mailing list