[vlc-commits] [Git][videolan/vlc][master] 12 commits: ci: update debian image

Hugo Beauzée-Luyssen (@chouquette) gitlab at videolan.org
Fri Aug 12 12:07:13 UTC 2022



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


Commits:
d5e07d6b by Niklas Haas at 2022-08-12T11:23:31+00:00
ci: update debian image

Needed to pull in newer libplacebo.

- - - - -
2f65f9e7 by Niklas Haas at 2022-08-12T11:23:31+00:00
configure: bump libplacebo minimum dependency to 4.157

With libplacebo 4.192.0 being packaged by the contribs, we can increase
our minimum dependency of libplacebo to v4.x. This allows us to drop
backwards compatibility with v3.x, and thus avoid the use of APIs that
wil be removed in libplacebo v5.x.

- - - - -
60580fda by Niklas Haas at 2022-08-12T11:23:31+00:00
contrib: match libplacebo check to minimum dependency

- - - - -
3ae342c1 by Niklas Haas at 2022-08-12T11:23:31+00:00
libplacebo: port to libplacebo v4+ log API

This commit switches the vlc_placebo_CreateContext function from the old
libplacebo v3 API to the new API introduced in v4.

This API has a number of consequential changes that slightly alter the
logic besides just adapting the name:
- pl_log_create can no longer fail
- in either case, NULL is now a valid log object, so we don't need to
  check for or error out on it

- - - - -
0724339d by Niklas Haas at 2022-08-12T11:23:31+00:00
opengl: port to libplacebo v4 API

These v3.x APIs will be removed in v5.x. Fortunately, the new APIs are a
near drop-in replacement, so the change was minimal. Only the error
handling was cleaned up slightly.

- - - - -
ebe1d7ad by Niklas Haas at 2022-08-12T11:23:31+00:00
libplacebo/utils: port to libplacebo v4 API

These were renamed as part of the v4 API overhaul, and the old names
will be removed in libplacebo v5.

- - - - -
8e22c39e by Niklas Haas at 2022-08-12T11:23:31+00:00
libplacebo: port to libplacebo v4 API

These were typedef'd and/or renamed as part of the v4 API overhaul, so
stop using the deprecated v3 names (which will be removed in libplacebo
v5).

- - - - -
50af61fc by Niklas Haas at 2022-08-12T11:23:31+00:00
libplacebo: switch to new v4 overlay API

This is not exactly too exciting for us, because we currently only have
overlays consisting of a single region per picture_t. But in theory,
this new API allows us to have multiple regions (parts) pointing at the
same subpicture.

It's also a mandatory change, as the old API will be dropped in
libplacebo v5.

- - - - -
bd7e85d6 by Niklas Haas at 2022-08-12T11:23:31+00:00
libplacebo: fix overlay rendering bug

This loop was never properly incremented, leading to only the first
overlay actually being rendered.

- - - - -
8dc5b772 by Niklas Haas at 2022-08-12T11:23:31+00:00
opengl: rewrite pl_scale error handling

These functions are safe to call on NULL, so just zero-init the struct
and use a single error label. This simplifies the logic (and also fixes
a bug, since the pl_renderer was not properly cleaned up from one error
path).

- - - - -
62cb72c8 by Niklas Haas at 2022-08-12T11:23:31+00:00
libplacebo: drop old PL_API_VER guards

These #if guards can be dropped as a result of the minimum version bump.

- - - - -
9a48e2d0 by Niklas Haas at 2022-08-12T11:23:31+00:00
libplacebo: future-proof against libplacebo v6

This field was deprecated in v4 and will therefore be dropped in
libplacebo v6. Suppress the deprecation warning and future-proof by
guarding the one line that still uses it.

- - - - -


13 changed files:

- configure.ac
- contrib/src/libplacebo/rules.mak
- extras/ci/gitlab-ci.yml
- 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
- modules/video_output/libplacebo/instance_vulkan.c
- modules/video_output/libplacebo/utils.c
- modules/video_output/libplacebo/utils.h
- modules/video_output/opengl/pl_scale.c
- modules/video_output/opengl/renderer.h
- modules/video_output/opengl/sampler.c


Changes:

=====================================
configure.ac
=====================================
@@ -3088,7 +3088,7 @@ AC_ARG_ENABLE([libplacebo],
 
 have_libplacebo_glscale="no"
 AS_IF([test "$enable_libplacebo" != "no"], [
-  PKG_CHECK_MODULES([LIBPLACEBO], [libplacebo >= 2.72], [
+  PKG_CHECK_MODULES([LIBPLACEBO], [libplacebo >= 4.157], [
     AC_DEFINE([HAVE_LIBPLACEBO], [1], [Define to 1 if libplacebo is enabled.])
     AC_CHECK_HEADER([libplacebo/vulkan.h], [VLC_ADD_PLUGIN([placebo_vk])])
     AC_CHECK_HEADER([libplacebo/opengl.h], [


=====================================
contrib/src/libplacebo/rules.mak
=====================================
@@ -14,7 +14,7 @@ DEPS_libplacebo = glslang
 ifndef HAVE_WINSTORE
 PKGS += libplacebo
 endif
-ifeq ($(call need_pkg,"libplacebo >= 2.72"),)
+ifeq ($(call need_pkg,"libplacebo >= 4.157"),)
 PKGS_FOUND += libplacebo
 endif
 


=====================================
extras/ci/gitlab-ci.yml
=====================================
@@ -23,7 +23,7 @@ variables:
     VLC_WIN64_IMAGE: registry.videolan.org/vlc-debian-win64:20220505172436
     VLC_WIN_LLVM_IMAGE: registry.videolan.org/vlc-debian-llvm-mingw:20220705072259
     VLC_UWP_LLVM_IMAGE: registry.videolan.org/vlc-debian-llvm-uwp:20220713124227
-    VLC_DEBIAN_IMAGE: registry.videolan.org/vlc-debian-unstable:20210803114245
+    VLC_DEBIAN_IMAGE: registry.videolan.org/vlc-debian-unstable:20220127084320
     VLC_ANDROID_IMAGE: registry.videolan.org/vlc-debian-android:20220728132611
     VLC_SNAP_IMAGE: registry.videolan.org/vlc-ubuntu-focal:20220810081944
     VLC_RASPBIAN_IMAGE: registry.videolan.org/vlc-ubuntu-raspberry:20220505175523


=====================================
modules/video_output/libplacebo/display.c
=====================================
@@ -39,29 +39,18 @@
 #include <libplacebo/renderer.h>
 #include <libplacebo/utils/upload.h>
 #include <libplacebo/swapchain.h>
-
-#if PL_API_VER >= 113
-# include <libplacebo/shaders/lut.h>
-#endif
-
-#if PL_API_VER >= 159
-// Forward compatibility with libplacebo v4+
-#define pl_image pl_frame
-#define pl_render_target pl_frame
-#define pl_render_target_from_swapchain pl_frame_from_swapchain
-#define src_rect crop
-#define dst_rect crop
-#endif
+#include <libplacebo/shaders/lut.h>
 
 typedef struct vout_display_sys_t
 {
     vlc_placebo_t *pl;
-    const struct pl_tex *plane_tex[4];
-    struct pl_renderer *renderer;
+    pl_renderer renderer;
+    pl_tex plane_tex[4];
 
     // Pool of textures for the subpictures
     struct pl_overlay *overlays;
-    const struct pl_tex **overlay_tex;
+    struct pl_overlay_part *overlay_parts;
+    pl_tex *overlay_tex;
     int num_overlays;
 
     // Storage for rendering parameters
@@ -78,11 +67,9 @@ typedef struct vout_display_sys_t
     enum pl_chroma_location yuv_chroma_loc;
     int dither_depth;
 
-#if PL_API_VER >= 113
     struct pl_custom_lut *lut;
     char *lut_path;
     int lut_mode;
-#endif
 
     const struct pl_hook *hook;
     char *hook_path;
@@ -135,8 +122,8 @@ static int Open(vout_display_t *vd,
     if (!pl_swapchain_resize(sys->pl->swapchain, &width, &height))
         goto error;
 
-    const struct pl_gpu *gpu = sys->pl->gpu;
-    sys->renderer = pl_renderer_create(sys->pl->ctx, gpu);
+    pl_gpu gpu = sys->pl->gpu;
+    sys->renderer = pl_renderer_create(sys->pl->log, gpu);
     if (!sys->renderer)
         goto error;
 
@@ -195,7 +182,7 @@ error:
 static void Close(vout_display_t *vd)
 {
     vout_display_sys_t *sys = vd->sys;
-    const struct pl_gpu *gpu = sys->pl->gpu;
+    pl_gpu gpu = sys->pl->gpu;
 
     if (vlc_placebo_MakeCurrent(sys->pl) == VLC_SUCCESS) {
         for (int i = 0; i < 4; i++)
@@ -208,13 +195,12 @@ static void Close(vout_display_t *vd)
 
     if (sys->overlays) {
         free(sys->overlays);
+        free(sys->overlay_parts);
         free(sys->overlay_tex);
     }
 
-#if PL_API_VER >= 113
     pl_lut_free(&sys->lut);
     free(sys->lut_path);
-#endif
 
     pl_mpv_user_shader_destroy(&sys->hook);
     free(sys->hook_path);
@@ -227,7 +213,7 @@ static void PictureRender(vout_display_t *vd, picture_t *pic,
 {
     VLC_UNUSED(date);
     vout_display_sys_t *sys = vd->sys;
-    const struct pl_gpu *gpu = sys->pl->gpu;
+    pl_gpu gpu = sys->pl->gpu;
     bool failed = false;
 
     if (vlc_placebo_MakeCurrent(sys->pl) != VLC_SUCCESS)
@@ -245,11 +231,11 @@ static void PictureRender(vout_display_t *vd, picture_t *pic,
     bool need_vflip = frame.flipped;
 #endif
 
-    struct pl_image img = {
+    struct pl_frame img = {
         .num_planes = pic->i_planes,
         .color      = vlc_placebo_ColorSpace(vd->fmt),
         .repr       = vlc_placebo_ColorRepr(vd->fmt),
-        .src_rect = {
+        .crop = {
             .x0 = pic->format.i_x_offset,
             .y0 = pic->format.i_y_offset,
             .x1 = pic->format.i_x_offset + pic->format.i_visible_width,
@@ -261,7 +247,6 @@ static void PictureRender(vout_display_t *vd, picture_t *pic,
     vlc_placebo_DoviMetadata(&img, pic, &sys->dovi_metadata);
 #endif
 
-#if PL_API_VER >= 96
     struct vlc_ancillary *iccp = picture_GetAncillary(pic, VLC_ANCILLARY_ID_ICC);
     if (iccp) {
         vlc_icc_profile_t *icc = vlc_ancillary_GetData(iccp);
@@ -269,7 +254,6 @@ static void PictureRender(vout_display_t *vd, picture_t *pic,
         img.profile.len = icc->size;
         pl_icc_profile_compute_signature(&img.profile);
     }
-#endif
 
     // Upload the image data for each plane
     struct pl_plane_data data[4];
@@ -292,8 +276,8 @@ static void PictureRender(vout_display_t *vd, picture_t *pic,
                                       &plane->shift_y);
     }
 
-    struct pl_render_target target;
-    pl_render_target_from_swapchain(&target, &frame);
+    struct pl_frame target;
+    pl_frame_from_swapchain(&target, &frame);
     if (vd->cfg->icc_profile) {
         target.profile.signature = sys->target_icc_signature;
         target.profile.data = vd->cfg->icc_profile->data;
@@ -353,24 +337,18 @@ static void PictureRender(vout_display_t *vd, picture_t *pic,
     }
 #endif
 
-#if PL_API_VER >= 101
     target.crop = (struct pl_rect2df) {
         place.x, place.y, place.x + place.width, place.y + place.height,
     };
-#else
-    // Avoid using struct initializer for backwards compatibility
-    target.dst_rect.x0 = place.x;
-    target.dst_rect.y0 = place.y;
-    target.dst_rect.x1 = place.x + place.width;
-    target.dst_rect.y1 = place.y + place.height;
-#endif
 
     // Override the target colorimetry only if the user requests it
     if (sys->target.primaries)
         target.color.primaries = sys->target.primaries;
     if (sys->target.transfer) {
         target.color.transfer = sys->target.transfer;
+#if PL_API_VER < 189
         target.color.light = PL_COLOR_LIGHT_UNKNOWN; // re-infer
+#endif
     }
     if (sys->dither_depth > 0) {
         // override the sample depth without affecting the color encoding
@@ -388,8 +366,9 @@ static void PictureRender(vout_display_t *vd, picture_t *pic,
         // Grow the overlays array if needed
         if (num_regions > sys->num_overlays) {
             sys->overlays = realloc(sys->overlays, num_regions * sizeof(struct pl_overlay));
-            sys->overlay_tex = realloc(sys->overlay_tex, num_regions * sizeof(struct pl_tex *));
-            if (!sys->overlays || !sys->overlay_tex) {
+            sys->overlay_parts = realloc(sys->overlay_parts, num_regions * sizeof(struct pl_overlay_part));
+            sys->overlay_tex = realloc(sys->overlay_tex, num_regions * sizeof(pl_tex));
+            if (!sys->overlays || !sys->overlay_parts || !sys->overlay_tex) {
                 // Unlikely OOM, just do whatever
                 sys->num_overlays = 0;
                 failed = true;
@@ -403,31 +382,40 @@ static void PictureRender(vout_display_t *vd, picture_t *pic,
 
         // Upload all of the regions
         subpicture_region_t *r = subpicture->p_region;
-        for (int i = 0; i < num_regions; i++) {
+        for (int i = 0; i < num_regions; i++, r = r->p_next) {
             assert(r->p_picture->i_planes == 1);
             struct pl_plane_data subdata[4];
             if (!vlc_placebo_PlaneData(r->p_picture, subdata, NULL))
                 assert(!"Failed processing the subpicture_t into pl_plane_data!?");
 
-            struct pl_overlay *overlay = &sys->overlays[i];
+            if (!pl_upload_plane(gpu, NULL, &sys->overlay_tex[i], subdata)) {
+                msg_Err(vd, "Failed uploading subpicture region!");
+                num_regions = i; // stop here
+                break;
+            }
+
             int ysign = need_vflip ? (-1) : 1;
-            *overlay = (struct pl_overlay) {
-                .rect = {
+            sys->overlays[i] = (struct pl_overlay) {
+                .tex   = sys->overlay_tex[i],
+                .mode  = PL_OVERLAY_NORMAL,
+                .color = vlc_placebo_ColorSpace(&r->fmt),
+                .repr  = vlc_placebo_ColorRepr(&r->fmt),
+                .parts = &sys->overlay_parts[i],
+                .num_parts = 1,
+            };
+
+            sys->overlay_parts[i] = (struct pl_overlay_part) {
+                .src = {
+                    .x1 = r->fmt.i_visible_width,
+                    .y1 = r->fmt.i_visible_height,
+                },
+                .dst = {
                     .x0 = place.x + r->i_x,
                     .y0 = place.y + r->i_y * ysign,
                     .x1 = place.x + r->i_x + r->fmt.i_visible_width,
                     .y1 = place.y + (r->i_y + r->fmt.i_visible_height) * ysign,
                 },
-                .mode = PL_OVERLAY_NORMAL,
-                .color = vlc_placebo_ColorSpace(&r->fmt),
-                .repr  = vlc_placebo_ColorRepr(&r->fmt),
             };
-
-            if (!pl_upload_plane(gpu, &overlay->plane, &sys->overlay_tex[i], subdata)) {
-                msg_Err(vd, "Failed uploading subpicture region!");
-                num_regions = i; // stop here
-                break;
-            }
         }
 
         // Update the target information to reference the subpictures
@@ -444,7 +432,6 @@ static void PictureRender(vout_display_t *vd, picture_t *pic,
         pl_tex_clear(gpu, frame.fbo, (float[4]){ 0.0, 0.0, 0.0, 0.0 });
     }
 
-#if PL_API_VER >= 113
     switch (sys->lut_mode) {
     case LUT_DECODING:
         img.lut_type = PL_LUT_CONVERSION;
@@ -455,7 +442,6 @@ static void PictureRender(vout_display_t *vd, picture_t *pic,
         target.lut = sys->lut;
         break;
     }
-#endif
 
     // Dispatch the actual image rendering with the pre-configured parameters
     if (!pl_render_image(sys->renderer, &img, &target, &sys->params)) {
@@ -487,8 +473,6 @@ static void PictureDisplay(vout_display_t *vd, picture_t *pic)
 
 static void UpdateColorspaceHint(vout_display_t *vd, const video_format_t *fmt)
 {
-#if PL_API_VER >= 155
-
     vout_display_sys_t *sys = vd->sys;
     struct pl_swapchain_colors hint = {0};
 
@@ -525,11 +509,6 @@ static void UpdateColorspaceHint(vout_display_t *vd, const video_format_t *fmt)
     }
 
     pl_swapchain_colorspace_hint(sys->pl->swapchain, &hint);
-
-#else // PL_API_VER
-    VLC_UNUSED(vd);
-    VLC_UNUSED(fmt);
-#endif
 }
 
 static void UpdateIccProfile(vout_display_t *vd, const vlc_icc_profile_t *prof)
@@ -585,7 +564,6 @@ static int Control(vout_display_t *vd, int query)
     return VLC_EGENERIC;
 }
 
-#if PL_API_VER >= 113
 static void LoadCustomLUT(vout_display_sys_t *sys, const char *filepath)
 {
     if (!filepath || !*filepath) {
@@ -619,7 +597,7 @@ static void LoadCustomLUT(vout_display_sys_t *sys, const char *filepath)
     ret = fread(lut_file, length, 1, fs);
     if (ret != 1)
         goto error;
-    sys->lut = pl_lut_parse_cube(sys->pl->ctx, lut_file, length);
+    sys->lut = pl_lut_parse_cube(sys->pl->log, lut_file, length);
     if (!sys->lut)
         goto error;
 
@@ -633,7 +611,6 @@ error:
         fclose(fs);
     return;
 }
-#endif
 
 static void LoadUserShader(vout_display_sys_t *sys, const char *filepath)
 {
@@ -728,21 +705,17 @@ vlc_module_begin ()
             DEBAND_GRAIN_TEXT, DEBAND_GRAIN_LONGTEXT)
 
     set_section("Colorspace conversion", NULL)
-#if PL_API_VER >= 155
     add_integer("pl-output-hint", true, OUTPUT_HINT_TEXT, OUTPUT_HINT_LONGTEXT)
             change_integer_list(output_values, output_text)
-#endif
     add_placebo_color_map_opts("pl")
     add_integer("pl-target-prim", PL_COLOR_PRIM_UNKNOWN, PRIM_TEXT, PRIM_LONGTEXT)
             change_integer_list(prim_values, prim_text)
     add_integer("pl-target-trc", PL_COLOR_TRC_UNKNOWN, TRC_TEXT, TRC_LONGTEXT)
             change_integer_list(trc_values, trc_text)
 
-#if PL_API_VER >= 113
     add_loadfile("pl-lut-file", NULL, LUT_FILE_TEXT, LUT_FILE_LONGTEXT)
     add_integer("pl-lut-mode", LUT_DISABLED, LUT_MODE_TEXT, LUT_MODE_LONGTEXT)
             change_integer_list(lut_mode_values, lut_mode_text)
-#endif
 
     // TODO: support for ICC profiles
 
@@ -844,7 +817,6 @@ static void UpdateParams(vout_display_t *vd)
     sys->params.antiringing_strength = var_InheritFloat(vd, "pl-antiringing");
     sys->params.skip_anti_aliasing = var_InheritBool(vd, "pl-skip-aa");
     sys->params.polar_cutoff = var_InheritFloat(vd, "pl-polar-cutoff");
-    sys->params.disable_overlay_sampling = var_InheritBool(vd, "pl-overlay-direct");
     sys->params.disable_linear_scaling = var_InheritBool(vd, "pl-disable-linear");
     sys->params.disable_builtin_scalers = var_InheritBool(vd, "pl-force-general");
 
@@ -900,7 +872,6 @@ static void UpdateParams(vout_display_t *vd)
         .transfer = var_InheritInteger(vd, "pl-target-trc"),
     };
 
-#if PL_API_VER >= 113
     sys->lut_mode = var_InheritInteger(vd, "pl-lut-mode");
     char *lut_file = var_InheritString(vd, "pl-lut-file");
     LoadCustomLUT(sys, lut_file);
@@ -916,7 +887,6 @@ static void UpdateParams(vout_display_t *vd)
             break;
         }
     }
-#endif
 
     char *shader_file = var_InheritString(vd, "pl-user-shader");
     LoadUserShader(sys, shader_file);


=====================================
modules/video_output/libplacebo/instance.c
=====================================
@@ -56,7 +56,7 @@ vlc_placebo_t *vlc_placebo_Create(const vout_display_cfg_t *cfg, const char *nam
 
     pl->sys = NULL;
     pl->ops = NULL;
-    pl->ctx = vlc_placebo_CreateContext(VLC_OBJECT(pl));
+    pl->log = vlc_placebo_CreateLog(VLC_OBJECT(pl));
     pl->module = vlc_module_load(parent, "libplacebo gpu", name, false,
                                  vlc_placebo_start, pl, cfg);
 
@@ -74,7 +74,7 @@ void vlc_placebo_Release(vlc_placebo_t *pl)
     if (pl->ops)
         pl->ops->close(pl);
 
-    pl_context_destroy(&pl->ctx);
+    pl_log_destroy(&pl->log);
 
     /* TODO: use vlc_objres_clear */
     vlc_object_delete(pl);


=====================================
modules/video_output/libplacebo/instance.h
=====================================
@@ -48,9 +48,9 @@ typedef struct vlc_placebo_t
     module_t *module;
     vlc_placebo_system_t *sys;
 
-    struct pl_context *ctx;
-    const struct pl_gpu *gpu;
-    const struct pl_swapchain *swapchain;
+    pl_log log;
+    pl_gpu gpu;
+    pl_swapchain swapchain;
 
     const struct vlc_placebo_operations *ops;
 } vlc_placebo_t;


=====================================
modules/video_output/libplacebo/instance_opengl.c
=====================================
@@ -70,16 +70,14 @@ vlc_module_begin()
 #endif
 
     set_section("Context settings", NULL)
-#if PL_API_VER >= 90
     add_bool("gl-allow-sw", false, ALLOWSW_TEXT, ALLOWSW_LONGTEXT)
-#endif
     add_integer_with_range("gl-swap-depth", 0,
             0, 4, SWAP_DEPTH_TEXT, SWAP_DEPTH_LONGTEXT)
 vlc_module_end()
 
 struct vlc_placebo_system_t {
     vlc_gl_t *gl;
-    const struct pl_opengl *opengl;
+    pl_opengl opengl;
 };
 
 static const struct vlc_placebo_operations instance_opts =
@@ -107,10 +105,8 @@ static int InitInstance(vlc_placebo_t *pl, const vout_display_cfg_t *cfg)
     current = true;
 
     // Create OpenGL wrapper
-    sys->opengl = pl_opengl_create(pl->ctx, &(struct pl_opengl_params) {
-#if PL_API_VER >= 90
+    sys->opengl = pl_opengl_create(pl->log, &(struct pl_opengl_params) {
         .allow_software = var_InheritBool(pl, "gl-allow-sw"),
-#endif
         .debug = true, // this only sets up the debug report callback
     });
     vlc_gl_ReleaseCurrent (sys->gl);


=====================================
modules/video_output/libplacebo/instance_vulkan.c
=====================================
@@ -35,8 +35,8 @@
 
 struct vlc_placebo_system_t {
     vlc_vk_platform_t *platform;
-    const struct pl_vk_inst *instance;
-    const struct pl_vulkan *vulkan;
+    pl_vk_inst instance;
+    pl_vulkan vulkan;
 };
 
 static void CloseInstance(vlc_placebo_t *pl);
@@ -58,7 +58,7 @@ static int InitInstance(vlc_placebo_t *pl, const vout_display_cfg_t *cfg)
     if (!sys->platform)
         goto error;
 
-    sys->instance = pl_vk_inst_create(pl->ctx, &(struct pl_vk_inst_params) {
+    sys->instance = pl_vk_inst_create(pl->log, &(struct pl_vk_inst_params) {
         .debug = var_InheritBool(pl, "vk-debug"),
         .extensions = (const char *[]) {
             VK_KHR_SURFACE_EXTENSION_NAME,
@@ -76,7 +76,7 @@ static int InitInstance(vlc_placebo_t *pl, const vout_display_cfg_t *cfg)
 
     // Create vulkan device
     char *device_name = var_InheritString(pl, "vk-device");
-    sys->vulkan = pl_vulkan_create(pl->ctx, &(struct pl_vulkan_params) {
+    sys->vulkan = pl_vulkan_create(pl->log, &(struct pl_vulkan_params) {
         .instance = sys->instance->instance,
         .surface = surface,
         .device_name = device_name,


=====================================
modules/video_output/libplacebo/utils.c
=====================================
@@ -44,9 +44,9 @@ static void Log(void *priv, enum pl_log_level level, const char *msg)
     }
 }
 
-struct pl_context *vlc_placebo_CreateContext(vlc_object_t *obj)
+pl_log vlc_placebo_CreateLog(vlc_object_t *obj)
 {
-    return pl_context_create(PL_API_VER, &(struct pl_context_params) {
+    return pl_log_create(PL_API_VER, &(struct pl_log_params) {
         .log_level = PL_LOG_DEBUG,
         .log_cb    = Log,
         .log_priv  = obj,
@@ -327,7 +327,7 @@ int vlc_placebo_PlaneFormat(const video_format_t *fmt, struct pl_plane_data data
 }
 
 int vlc_placebo_PlaneData(const picture_t *pic, struct pl_plane_data data[4],
-                          const struct pl_buf *buf)
+                          pl_buf buf)
 {
     int planes = vlc_placebo_PlaneFormat(&pic->format, data);
     if (!planes)
@@ -350,7 +350,7 @@ int vlc_placebo_PlaneData(const picture_t *pic, struct pl_plane_data data[4],
     return planes;
 }
 
-bool vlc_placebo_FormatSupported(const struct pl_gpu *gpu, vlc_fourcc_t fcc)
+bool vlc_placebo_FormatSupported(pl_gpu gpu, vlc_fourcc_t fcc)
 {
     const struct fmt_desc *desc = FindDesc(fcc);
     if (!desc)
@@ -612,9 +612,7 @@ void vlc_placebo_ColorMapParams(vlc_object_t *obj, const char *prefix,
 #else
     case GAMUT_MODE_CLIP:   break;
     case GAMUT_MODE_WARN:   params->gamut_warning = true; break;
-# if PL_API_VER >= 80
     case GAMUT_MODE_DESAT:  params->gamut_clipping = true; break;
-# endif
 #endif
     }
 


=====================================
modules/video_output/libplacebo/utils.h
=====================================
@@ -30,8 +30,8 @@
 
 #include "../opengl/gl_scale.h"
 
-// Create a libplacebo context, hooked up to the log system; or NULL on OOM
-struct pl_context *vlc_placebo_CreateContext(vlc_object_t *);
+// Create a libplacebo log object, hooked up to the log system
+pl_log vlc_placebo_CreateLog(vlc_object_t *);
 
 // Turn a video_format_t into the equivalent libplacebo values
 struct pl_color_space vlc_placebo_ColorSpace(const video_format_t *);
@@ -50,11 +50,10 @@ int vlc_placebo_PlaneComponents(const video_format_t *, struct pl_plane[4]);
 // or 0 if the format is unsupported by the libplacebo API. If `buf` is set,
 // then all addresses of the picture_t must lie within `buf`'s mapped memory.
 int vlc_placebo_PlaneFormat(const video_format_t *, struct pl_plane_data[4]);
-int vlc_placebo_PlaneData(const picture_t *, struct pl_plane_data[4],
-                          const struct pl_buf *buf);
+int vlc_placebo_PlaneData(const picture_t *, struct pl_plane_data[4], pl_buf buf);
 
 // See if a given FourCC is physically supported by a given GPU
-bool vlc_placebo_FormatSupported(const struct pl_gpu *, vlc_fourcc_t);
+bool vlc_placebo_FormatSupported(pl_gpu, vlc_fourcc_t);
 
 // Shared helper function for updating pl_color_map_params from the options
 // generated by `add_placebo_color_map_opts`.
@@ -125,10 +124,8 @@ static const int prim_values[] = {
     PL_COLOR_PRIM_V_GAMUT,
     PL_COLOR_PRIM_S_GAMUT,
     PL_COLOR_PRIM_DISPLAY_P3,
-#if PL_API_VER >= 95
     PL_COLOR_PRIM_EBU_3213,
     PL_COLOR_PRIM_FILM_C,
-#endif
 };
 
 static const char * const prim_text[] = {
@@ -146,10 +143,8 @@ static const char * const prim_text[] = {
     "Panasonic V-Gamut (VARICAM)",
     "Sony S-Gamut",
     "Display-P3 (Digital Cinema with D65)",
-#if PL_API_VER >= 95
     "EBU Tech. 3213-E / JEDEC P22 phosphors",
     "Traditional film primaries with Illuminant C",
-#endif
 };
 
 #define TRC_TEXT "Override detected display gamma"
@@ -334,9 +329,7 @@ static const char * const tone_mode_text[] = {
 enum {
     GAMUT_MODE_CLIP,
     GAMUT_MODE_WARN,
-#if PL_API_VER >= 80
     GAMUT_MODE_DESAT,
-#endif
 #if PL_API_VER >= 190
     GAMUT_MODE_DARKEN,
 #endif
@@ -345,9 +338,7 @@ enum {
 static const int gamut_mode_values[] = {
     GAMUT_MODE_CLIP,
     GAMUT_MODE_WARN,
-#if PL_API_VER >= 80
     GAMUT_MODE_DESAT,
-#endif
 #if PL_API_VER >= 190
     GAMUT_MODE_DARKEN,
 #endif
@@ -356,9 +347,7 @@ static const int gamut_mode_values[] = {
 static const char * const gamut_mode_text[] = {
     "Hard clip",
     "Highlight invalid pixels",
-#if PL_API_VER >= 80
     "Colorimetrically desaturate",
-#endif
 #if PL_API_VER >= 190
     "Darken image",
 #endif


=====================================
modules/video_output/opengl/pl_scale.c
=====================================
@@ -268,13 +268,11 @@ Open(struct vlc_gl_filter *filter, const config_chain_t *config,
         return VLC_EGENERIC;
     }
 
-    struct sys *sys = filter->sys = malloc(sizeof(*sys));
+    struct sys *sys = filter->sys = calloc(1, sizeof(*sys));
     if (!sys)
         return VLC_EGENERIC;
 
-    sys->pl_log = vlc_placebo_CreateContext(VLC_OBJECT(filter));
-    if (!sys->pl_log)
-        goto error_free_sys;
+    sys->pl_log = vlc_placebo_CreateLog(VLC_OBJECT(filter));
 
     struct pl_opengl_params opengl_params = {
         .debug = true,
@@ -282,12 +280,12 @@ Open(struct vlc_gl_filter *filter, const config_chain_t *config,
     sys->pl_opengl = pl_opengl_create(sys->pl_log, &opengl_params);
 
     if (!sys->pl_opengl)
-        goto error_destroy_pl_log;
+        goto error;
 
     pl_gpu gpu = sys->pl_opengl->gpu;
     sys->pl_renderer = pl_renderer_create(sys->pl_log, gpu);
     if (!sys->pl_renderer)
-        goto error_destroy_pl_opengl;
+        goto error;
 
     sys->frame_in = (struct pl_frame) {
         .num_planes = glfmt->tex_count,
@@ -301,7 +299,7 @@ Open(struct vlc_gl_filter *filter, const config_chain_t *config,
     if ((unsigned) plane_count != glfmt->tex_count) {
         msg_Err(filter, "Unexpected plane count (%d) != tex count (%u)",
                         plane_count, glfmt->tex_count);
-        goto error_destroy_pl_opengl;
+        goto error;
     }
 
     sys->frame_out = (struct pl_frame) {
@@ -339,11 +337,10 @@ Open(struct vlc_gl_filter *filter, const config_chain_t *config,
 
     return VLC_SUCCESS;
 
-error_destroy_pl_opengl:
+error:
+    pl_renderer_destroy(&sys->pl_renderer);
     pl_opengl_destroy(&sys->pl_opengl);
-error_destroy_pl_log:
     pl_log_destroy(&sys->pl_log);
-error_free_sys:
     free(sys);
 
     return VLC_EGENERIC;


=====================================
modules/video_output/opengl/renderer.h
=====================================
@@ -37,10 +37,6 @@ extern "C"
 {
 #endif
 
-struct pl_context;
-struct pl_shader;
-struct pl_shader_res;
-
 #define add_opengl_submodule_renderer() \
     add_submodule() \
     add_shortcut("renderer") \


=====================================
modules/video_output/opengl/sampler.c
=====================================
@@ -57,10 +57,12 @@ struct vlc_gl_sampler_priv {
     bool yuv_color;
     GLfloat conv_matrix[4*4];
 
+#ifdef HAVE_LIBPLACEBO
     /* libplacebo context */
-    struct pl_context *pl_ctx;
-    struct pl_shader *pl_sh;
+    pl_log pl_log;
+    pl_shader pl_sh;
     const struct pl_shader_res *pl_sh_res;
+#endif
 
     /* If set, vlc_texture() exposes a single plane (without chroma
      * conversion), selected by vlc_gl_sampler_SetCurrentPlane(). */
@@ -661,7 +663,7 @@ opengl_fragment_shader_init(struct vlc_gl_sampler *sampler, bool expose_planes)
 
 #ifdef HAVE_LIBPLACEBO
     if (priv->pl_sh) {
-        struct pl_shader *sh = priv->pl_sh;
+        pl_shader sh = priv->pl_sh;
         struct pl_color_map_params color_params;
         vlc_placebo_ColorMapParams(VLC_OBJECT(priv->gl), "gl", &color_params);
 
@@ -669,12 +671,12 @@ opengl_fragment_shader_init(struct vlc_gl_sampler *sampler, bool expose_planes)
         dst_space.primaries = var_InheritInteger(priv->gl, "target-prim");
         dst_space.transfer = var_InheritInteger(priv->gl, "target-trc");
 
-        struct pl_shader_obj *tone_map_state = NULL;
+        pl_shader_obj tone_map_state = NULL;
         pl_shader_color_map(sh, &color_params,
                 vlc_placebo_ColorSpace(fmt),
                 dst_space, &tone_map_state, false);
 
-        struct pl_shader_obj *dither_state = NULL;
+        pl_shader_obj dither_state = NULL;
         int method = var_InheritInteger(priv->gl, "dither-algo");
         if (method >= 0) {
 
@@ -821,11 +823,6 @@ vlc_gl_sampler_New(struct vlc_gl_t *gl, const struct vlc_gl_api *api,
     struct vlc_gl_sampler *sampler = &priv->sampler;
     vlc_gl_LoadExtensionFunctions(gl, &priv->extension_vt);
 
-    priv->uloc.pl_vars = NULL;
-    priv->pl_ctx = NULL;
-    priv->pl_sh = NULL;
-    priv->pl_sh_res = NULL;
-
     priv->gl = gl;
     priv->api = api;
     priv->vt = &api->vt;
@@ -846,20 +843,19 @@ vlc_gl_sampler_New(struct vlc_gl_t *gl, const struct vlc_gl_api *api,
     sampler->shader.body = NULL;
 
 #ifdef HAVE_LIBPLACEBO
-    // Create the main libplacebo context
-    priv->pl_ctx = vlc_placebo_CreateContext(VLC_OBJECT(gl));
-    if (priv->pl_ctx) {
-        priv->pl_sh = pl_shader_alloc(priv->pl_ctx, &(struct pl_shader_params) {
-            .glsl = {
+    priv->uloc.pl_vars = NULL;
+    priv->pl_sh_res = NULL;
+    priv->pl_log = vlc_placebo_CreateLog(VLC_OBJECT(gl));
+    priv->pl_sh = pl_shader_alloc(priv->pl_log, &(struct pl_shader_params) {
+        .glsl = {
 #   ifdef USE_OPENGL_ES2
-                .version = 100,
-                .gles = true,
+            .version = 100,
+            .gles = true,
 #   else
-                .version = 120,
+            .version = 120,
 #   endif
-            },
-        });
-    }
+        },
+    });
 #endif
 
     int ret = opengl_fragment_shader_init(sampler, expose_planes);
@@ -879,10 +875,8 @@ vlc_gl_sampler_Delete(struct vlc_gl_sampler *sampler)
 
 #ifdef HAVE_LIBPLACEBO
     FREENULL(priv->uloc.pl_vars);
-    if (priv->pl_sh)
-        pl_shader_free(&priv->pl_sh);
-    if (priv->pl_ctx)
-        pl_context_destroy(&priv->pl_ctx);
+    pl_shader_free(&priv->pl_sh);
+    pl_log_destroy(&priv->pl_log);
 #endif
 
     free(sampler->shader.extensions);



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/a135d8b6adb2548bb955be0e5e03bb62f0958ec6...9a48e2d01a336025e9060dbb9921e5a5714cb76c

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/a135d8b6adb2548bb955be0e5e03bb62f0958ec6...9a48e2d01a336025e9060dbb9921e5a5714cb76c
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