[vlc-commits] [Git][videolan/vlc][master] libplacebo: resize the OpenGL surface on display size changes

Steve Lhomme (@robUx4) gitlab at videolan.org
Thu Jul 30 07:14:44 UTC 2026



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
87827633 by Ahmed Sobhy at 2026-07-30T07:03:27+00:00
libplacebo: resize the OpenGL surface on display size changes

pl_swapchain_resize() reconfigures the surface on Vulkan, but on OpenGL
it only records the size of a framebuffer. The GL drawable therefore
kept its creation size and drifted out of sync with libplacebo on every
resize. Add a resize operation and call it from SetDisplaySize() so the
GL drawable follows the display size.

- - - - -


4 changed files:

- modules/video_output/libplacebo/display.c
- modules/video_output/libplacebo/instance.c
- modules/video_output/libplacebo/instance.h
- modules/video_output/libplacebo/instance_opengl.c


Changes:

=====================================
modules/video_output/libplacebo/display.c
=====================================
@@ -533,6 +533,7 @@ static int SetDisplaySize(vout_display_t *vd, unsigned width_, unsigned height_)
     if (vlc_placebo_MakeCurrent(sys->pl) != VLC_SUCCESS)
         return VLC_SUCCESS; // ignore errors
 
+    vlc_placebo_Resize(sys->pl, width_, height_);
     pl_swapchain_resize(sys->pl->swapchain, &width, &height);
     vlc_placebo_ReleaseCurrent(sys->pl);
 


=====================================
modules/video_output/libplacebo/instance.c
=====================================
@@ -147,3 +147,9 @@ void vlc_placebo_ReleaseCurrent(vlc_placebo_t *pl)
     if (pl->ops->release_current)
         pl->ops->release_current(pl);
 }
+
+void vlc_placebo_Resize(vlc_placebo_t *pl, unsigned width, unsigned height)
+{
+    if (pl->ops->resize)
+        pl->ops->resize(pl, width, height);
+}


=====================================
modules/video_output/libplacebo/instance.h
=====================================
@@ -36,6 +36,8 @@ struct vlc_placebo_operations
     // For acquiring/releasing the context on the current thread. (Optional)
     int (*make_current)(struct vlc_placebo_t *);
     void (*release_current)(struct vlc_placebo_t *);
+
+    void (*resize)(struct vlc_placebo_t *, unsigned width, unsigned height);
 };
 
 typedef struct vlc_placebo_system_t vlc_placebo_system_t;
@@ -64,4 +66,6 @@ void vlc_placebo_Release(vlc_placebo_t *);
 int vlc_placebo_MakeCurrent(vlc_placebo_t *);
 void vlc_placebo_ReleaseCurrent(vlc_placebo_t *);
 
+void vlc_placebo_Resize(vlc_placebo_t *, unsigned width, unsigned height);
+
 #endif // VLC_LIBPLACEBO_INSTANCE_H


=====================================
modules/video_output/libplacebo/instance_opengl.c
=====================================
@@ -37,6 +37,7 @@ static int InitInstance(vlc_placebo_t *pl, const vout_display_cfg_t *cfg);
 static void CloseInstance(vlc_placebo_t *pl);
 static int MakeCurrent(vlc_placebo_t *pl);
 static void ReleaseCurrent(vlc_placebo_t *pl);
+static void Resize(vlc_placebo_t *pl, unsigned width, unsigned height);
 static void SwapBuffers(void *);
 
 #define GL_TEXT N_("OpenGL extension")
@@ -86,6 +87,7 @@ static const struct vlc_placebo_operations instance_opts =
     .close = CloseInstance,
     .make_current = MakeCurrent,
     .release_current = ReleaseCurrent,
+    .resize = Resize,
 };
 
 #if PL_API_VER >= 215
@@ -181,6 +183,12 @@ static void ReleaseCurrent(vlc_placebo_t *pl)
     vlc_gl_ReleaseCurrent(sys->gl);
 }
 
+static void Resize(vlc_placebo_t *pl, unsigned width, unsigned height)
+{
+    vlc_placebo_system_t *sys = pl->sys;
+    vlc_gl_Resize(sys->gl, width, height);
+}
+
 static void SwapBuffers(void *opaque)
 {
     vlc_gl_Swap(opaque);



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/8782763314218ae42d7fe31b7a5c526b0e3899a5

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/8782763314218ae42d7fe31b7a5c526b0e3899a5
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