Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package libplacebo for openSUSE:Factory checked in at 2021-04-22 18:03:38 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libplacebo (Old) and /work/SRC/openSUSE:Factory/.libplacebo.new.12324 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libplacebo" Thu Apr 22 18:03:38 2021 rev:15 rq:886609 version:3.120.2 Changes: -------- --- /work/SRC/openSUSE:Factory/libplacebo/libplacebo.changes 2021-04-08 21:03:00.949955741 +0200 +++ /work/SRC/openSUSE:Factory/.libplacebo.new.12324/libplacebo.changes 2021-04-22 18:04:01.610512369 +0200 @@ -1,0 +2,30 @@ +Mon Apr 19 08:27:57 UTC 2021 - Niklas Haas <o...@haasn.xyz> + +- Update libplacebo to version 3.120.2: + +This minor release fixes a number of additional bugs related to the +thread queue, included demos, included helpers, and build system. + +Changes: +- replace the `shaderc` library checks by pkg-config checks +- `pl_dispatch` no longer grows infinitely, but prunes stale cache + entries after a certain threshold +- improve logging of GPU capabilities (including format capabilities) + +Fixes and performance improvements: +- fix a typo on an error message +- fix a use-after-free edge case in `plplay` +- filter out Infinity, NaN and other values from fps/vps estimates +- add several warnings for suspected frame queue API misuses +- fix a crash when combining pl_render_image_mix with cropped frames +- fix a crash on AV_PIX_FMT_NONE in the libav helpers +- fix the loading of overlays in the `sdlimage` demo +- fix a number of potential overflows on 32-bit platforms +- omit redundant identity matrices in pl_shader_decode_color +- fix crash in frame queue with certain out-of-order PTS sequences +- add missing link to vulkan dependency in the `video-filtering` demo +- correctly shift overlays when drawing to subsampled YCbCr planes +- add missing check for PL_GPU_CAP_CALLBACKS in `utils/{libav,dav1d}.h` +- improve handling of asynchronous texture uploads in `utils/libav.h` + +------------------------------------------------------------------- Old: ---- libplacebo-v3.120.1.tar.bz2 New: ---- libplacebo-v3.120.2.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libplacebo.spec ++++++ --- /var/tmp/diff_new_pack.XFNRjS/_old 2021-04-22 18:04:02.134513180 +0200 +++ /var/tmp/diff_new_pack.XFNRjS/_new 2021-04-22 18:04:02.138513186 +0200 @@ -18,7 +18,7 @@ %define sover 120 Name: libplacebo -Version: 3.120.1 +Version: 3.120.2 Release: 0 Summary: Library for GPU-accelerated video/image rendering primitives License: LGPL-2.1-or-later ++++++ libplacebo-v3.120.1.tar.bz2 -> libplacebo-v3.120.2.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libplacebo-v3.120.1/.gitlab-ci.yml new/libplacebo-v3.120.2/.gitlab-ci.yml --- old/libplacebo-v3.120.1/.gitlab-ci.yml 2021-04-06 08:47:44.000000000 +0200 +++ new/libplacebo-v3.120.2/.gitlab-ci.yml 2021-04-19 10:14:26.000000000 +0200 @@ -96,6 +96,7 @@ - env CC=clang meson build --buildtype debugoptimized --werror -Dtests=true + -Ddemos=true -Dbench=true -Dshaderc=enabled -Dglslang=enabled @@ -111,6 +112,7 @@ - meson build --buildtype release --werror -Dtests=true + -Ddemos=false -Dc_args='-DCI_ALLOW_SW' -Dshaderc=enabled -Dglslang=enabled @@ -126,6 +128,7 @@ - meson build --buildtype release --werror -Dtests=true + -Ddemos=false -Dshaderc=disabled -Db_coverage=true - ninja -C build @@ -154,6 +157,7 @@ script: - meson build --buildtype debugoptimized -Dtests=true + -Ddemos=false -Dshaderc=disabled -Db_sanitize=address - ninja -C build @@ -169,6 +173,7 @@ script: - env CC=clang meson build --buildtype debugoptimized -Dtests=true + -Ddemos=false -Dc_args='-DMSAN' -Dglslang=disabled -Db_sanitize=memory @@ -186,6 +191,7 @@ script: - env CC=clang meson build --buildtype debugoptimized -Dtests=true + -Ddemos=false -Dc_args='-fPIE' -Dglslang=disabled -Db_sanitize=undefined diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libplacebo-v3.120.1/demos/meson.build new/libplacebo-v3.120.2/demos/meson.build --- old/libplacebo-v3.120.1/demos/meson.build 2021-04-06 08:47:44.000000000 +0200 +++ new/libplacebo-v3.120.2/demos/meson.build 2021-04-19 10:14:26.000000000 +0200 @@ -127,7 +127,7 @@ # Headless video filtering demo if vulkan.found() executable('video-filtering', 'video-filtering.c', - dependencies: libplacebo, + dependencies: [ libplacebo, vulkan ], c_args: '-O2', ) endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libplacebo-v3.120.1/demos/plplay.c new/libplacebo-v3.120.2/demos/plplay.c --- old/libplacebo-v3.120.1/demos/plplay.c 2021-04-06 08:47:44.000000000 +0200 +++ new/libplacebo-v3.120.2/demos/plplay.c 2021-04-19 10:14:26.000000000 +0200 @@ -936,7 +936,8 @@ (p->shader_num - i) * sizeof(char *)); } - nk_label(nk, p->shader_paths[i], NK_TEXT_LEFT); + if (i < p->shader_num) + nk_label(nk, p->shader_paths[i], NK_TEXT_LEFT); } par->hooks = p->shader_hooks; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libplacebo-v3.120.1/demos/sdlimage.c new/libplacebo-v3.120.2/demos/sdlimage.c --- old/libplacebo-v3.120.1/demos/sdlimage.c 2021-04-06 08:47:44.000000000 +0200 +++ new/libplacebo-v3.120.2/demos/sdlimage.c 2021-04-19 10:14:26.000000000 +0200 @@ -214,7 +214,7 @@ SDL_FreeSurface(img); if (overlay) { - SDL_Surface *osd = IMG_Load(file); + SDL_Surface *osd = IMG_Load(overlay); if (!upload_plane(osd, &osd_tex, &osd_plane)) fprintf(stderr, "Failed uploading OSD plane.. continuing anyway\n"); SDL_FreeSurface(osd); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libplacebo-v3.120.1/meson.build new/libplacebo-v3.120.2/meson.build --- old/libplacebo-v3.120.1/meson.build 2021-04-06 08:47:44.000000000 +0200 +++ new/libplacebo-v3.120.2/meson.build 2021-04-19 10:14:26.000000000 +0200 @@ -2,7 +2,7 @@ license: 'LGPL2.1+', default_options: ['c_std=c99', 'cpp_std=c++11', 'warning_level=2'], meson_version: '>=0.51', - version: '3.120.1', + version: '3.120.2', ) # Version number diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libplacebo-v3.120.1/src/dispatch.c new/libplacebo-v3.120.2/src/dispatch.c --- old/libplacebo-v3.120.1/src/dispatch.c 2021-04-06 08:47:44.000000000 +0200 +++ new/libplacebo-v3.120.2/src/dispatch.c 2021-04-19 10:14:26.000000000 +0200 @@ -21,6 +21,11 @@ #include "dispatch.h" #include "gpu.h" +// Maximum number of passes to keep around at once. If full, passes older than +// MIN_AGE are evicted to make room. (Failing that, the cache size doubles) +#define MAX_PASSES 100 +#define MIN_AGE 10 + enum { TMP_PRELUDE, // GLSL version, global definitions, etc. TMP_MAIN, // main GLSL shader body @@ -34,6 +39,7 @@ const struct pl_gpu *gpu; uint8_t current_ident; uint8_t current_index; + int max_passes; PL_ARRAY(struct pl_shader *) shaders; // to avoid re-allocations PL_ARRAY(struct pass *) passes; // compiled passes @@ -61,6 +67,7 @@ struct pass { uint64_t signature; // as returned by pl_shader_signature const struct pl_pass *pass; + int last_index; // contains cached data and update metadata, same order as pl_shader struct pass_var *vars; @@ -98,6 +105,7 @@ struct pl_dispatch *dp = pl_zalloc_ptr(ctx, dp); dp->ctx = ctx; dp->gpu = gpu; + dp->max_passes = MAX_PASSES; return dp; } @@ -611,6 +619,40 @@ a->src_alpha == b->src_alpha && a->dst_alpha == b->dst_alpha; } +#define pass_age(pass) (dp->current_index - (pass)->last_index) + +static int cmp_pass_age(const void *ptra, const void *ptrb) +{ + const struct pass *a = *(const struct pass **) ptra; + const struct pass *b = *(const struct pass **) ptrb; + return b->last_index - a->last_index; +} + +static void garbage_collect_passes(struct pl_dispatch *dp) +{ + if (dp->passes.num <= dp->max_passes) + return; + + // Garbage collect oldest passes, starting at the middle + qsort(dp->passes.elem, dp->passes.num, sizeof(struct pass *), cmp_pass_age); + int idx = dp->passes.num / 2; + while (idx < dp->passes.num && pass_age(dp->passes.elem[idx]) < MIN_AGE) + idx++; + + for (int i = idx; i < dp->passes.num; i++) + pass_destroy(dp, dp->passes.elem[i]); + + int num_evicted = dp->passes.num - idx; + dp->passes.num = idx; + + if (num_evicted) { + PL_DEBUG(dp, "Evicted %d passes from dispatch cache, consider " + "using more dynamic shaders", num_evicted); + } else { + dp->max_passes *= 2; + } +} + static struct pass *find_pass(struct pl_dispatch *dp, struct pl_shader *sh, const struct pl_tex *target, ident_t vert_pos, const struct pl_blend_params *blend, bool load, @@ -625,11 +667,14 @@ continue; // Failed shader, no additional checks needed - if (!p->pass) + if (!p->pass) { + p->last_index = dp->current_index; return p; + } if (pl_shader_is_compute(sh)) { // no special requirements besides the signature + p->last_index = dp->current_index; return p; } else { pl_assert(target); @@ -642,8 +687,10 @@ raster_ok &= p->pass->params.vertex_type == vparams->vertex_type; raster_ok &= p->pass->params.vertex_stride == vparams->vertex_stride; } - if (raster_ok) + if (raster_ok) { + p->last_index = dp->current_index; return p; + } } } @@ -652,6 +699,7 @@ struct pass *pass = pl_alloc_ptr(dp, pass); *pass = (struct pass) { .signature = sig, + .last_index = dp->current_index, .ubo_desc = { .desc = { .name = "UBO", @@ -790,6 +838,7 @@ error: pass->ubo_desc = (struct pl_shader_desc) {0}; // contains temporary pointers pl_free(tmp); + garbage_collect_passes(dp); PL_ARRAY_APPEND(dp, dp->passes, pass); return pass; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libplacebo-v3.120.1/src/gpu.c new/libplacebo-v3.120.2/src/gpu.c --- old/libplacebo-v3.120.1/src/gpu.c 2021-04-06 08:47:44.000000000 +0200 +++ new/libplacebo-v3.120.2/src/gpu.c 2021-04-19 10:14:26.000000000 +0200 @@ -49,8 +49,8 @@ return; PL_DEBUG(gpu, "GPU texture formats:"); - PL_DEBUG(gpu, " %-10s %-6s %-6s %-4s %-4s %-13s %-13s %-10s %-10s %-6s", - "NAME", "TYPE", "CAPS", "SIZE", "COMP", "DEPTH", "HOST_BITS", + PL_DEBUG(gpu, " %-10s %-6s %-4s %-4s %-10s %-13s %-13s %-10s %-10s %-6s", + "NAME", "TYPE", "SIZE", "COMP", "CAPS", "DEPTH", "HOST_BITS", "GLSL_TYPE", "GLSL_FMT", "FOURCC"); for (int n = 0; n < gpu->num_formats; n++) { const struct pl_fmt *fmt = gpu->formats[n]; @@ -72,14 +72,26 @@ } #define IDX4(f) (f)[0], (f)[1], (f)[2], (f)[3] +#define CAP(letter, cap) (fmt->caps & (cap) ? (letter) : '-') - PL_DEBUG(gpu, " %-10s %-6s 0x%-4x %-4zu %c%c%c%c " + PL_DEBUG(gpu, " %-10s %-6s %-4zu %c%c%c%c %c%c%c%c%c%c%c%c%c%c " "{%-2d %-2d %-2d %-2d} {%-2d %-2d %-2d %-2d} %-10s %-10s %-6s", - fmt->name, types[fmt->type], (unsigned int) fmt->caps, - fmt->texel_size, IDX4(indices), IDX4(fmt->component_depth), - IDX4(fmt->host_bits), PL_DEF(fmt->glsl_type, ""), - PL_DEF(fmt->glsl_format, ""), PRINT_FOURCC(fmt->fourcc)); + fmt->name, types[fmt->type], fmt->texel_size, IDX4(indices), + CAP('S', PL_FMT_CAP_SAMPLEABLE), + CAP('s', PL_FMT_CAP_STORABLE), + CAP('L', PL_FMT_CAP_LINEAR), + CAP('R', PL_FMT_CAP_RENDERABLE), + CAP('b', PL_FMT_CAP_BLENDABLE), + CAP('B', PL_FMT_CAP_BLITTABLE), + CAP('V', PL_FMT_CAP_VERTEX), + CAP('u', PL_FMT_CAP_TEXEL_UNIFORM), + CAP('t', PL_FMT_CAP_TEXEL_STORAGE), + CAP('H', PL_FMT_CAP_HOST_READABLE), + IDX4(fmt->component_depth), IDX4(fmt->host_bits), + PL_DEF(fmt->glsl_type, ""), PL_DEF(fmt->glsl_format, ""), + PRINT_FOURCC(fmt->fourcc)); +#undef CAP #undef IDX4 for (int i = 0; i < fmt->num_modifiers; i++) { @@ -136,7 +148,19 @@ PL_INFO(gpu, "GPU information:"); PL_INFO(gpu, " GLSL version: %d%s", gpu->glsl.version, gpu->glsl.vulkan ? " (vulkan)" : gpu->glsl.gles ? " es" : ""); - PL_INFO(gpu, " Capabilities: 0x%x", (unsigned int) gpu->caps); + +#define CAP(letter, cap) ((gpu->caps & cap) ? (letter) : '-') + PL_INFO(gpu, " Capabilities: %c%c%c%c%c%c%c (0x%x)", + CAP('C', PL_GPU_CAP_COMPUTE), + CAP('P', PL_GPU_CAP_PARALLEL_COMPUTE), + CAP('V', PL_GPU_CAP_INPUT_VARIABLES), + CAP('M', PL_GPU_CAP_MAPPED_BUFFERS), + CAP('B', PL_GPU_CAP_BLITTABLE_1D_3D), + CAP('G', PL_GPU_CAP_SUBGROUPS), + CAP('c', PL_GPU_CAP_CALLBACKS), + (unsigned int) gpu->caps); +#undef CAP + PL_INFO(gpu, " Limits:"); #define LOG(fmt, field) \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libplacebo-v3.120.1/src/include/libplacebo/utils/dav1d_internal.h new/libplacebo-v3.120.2/src/include/libplacebo/utils/dav1d_internal.h --- old/libplacebo-v3.120.1/src/include/libplacebo/utils/dav1d_internal.h 2021-04-06 08:47:44.000000000 +0200 +++ new/libplacebo-v3.120.2/src/include/libplacebo/utils/dav1d_internal.h 2021-04-19 10:14:26.000000000 +0200 @@ -415,7 +415,7 @@ // Re-use pre-allocated buffers directly assert(alloc->gpu == gpu); buf = alloc->buf; - } else if (params->asynchronous) { + } else if (params->asynchronous && (gpu->caps & PL_GPU_CAP_CALLBACKS)) { ref = malloc(sizeof(*ref)); if (!ref) return false; @@ -441,8 +441,13 @@ } } - if (ref) - *pic = (Dav1dPicture) {0}; + if (params->asynchronous) { + if (ref) { + *pic = (Dav1dPicture) {0}; + } else { + dav1d_picture_unref(pic); + } + } return true; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libplacebo-v3.120.1/src/include/libplacebo/utils/libav_internal.h new/libplacebo-v3.120.2/src/include/libplacebo/utils/libav_internal.h --- old/libplacebo-v3.120.1/src/include/libplacebo/utils/libav_internal.h 2021-04-06 08:47:44.000000000 +0200 +++ new/libplacebo-v3.120.2/src/include/libplacebo/utils/libav_internal.h 2021-04-19 10:14:26.000000000 +0200 @@ -250,7 +250,8 @@ struct pl_plane_data aligned_data[4]; struct pl_bit_encoding bits; bool first; - assert(desc); + if (!desc || planes < 0) // e.g. AV_PIX_FMT_NONE + return 0; if (desc->flags & AV_PIX_FMT_FLAG_BE) { // Big endian formats are almost definitely not supported in any @@ -297,7 +298,7 @@ if (comp->plane != p) continue; - masks[c] = (1 << comp->depth) - 1; // e.g. 0xFF for depth=8 + masks[c] = (1LLU << comp->depth) - 1; // e.g. 0xFF for depth=8 masks[c] <<= comp->shift; masks[c] <<= comp->offset * 8; @@ -558,10 +559,8 @@ // Fill in the component mapping array for (int c = 0; c < desc->nb_components; c++) { - if (desc->comp[c].plane != p) - continue; - - plane->component_mapping[plane->components++] = c; + if (desc->comp[c].plane == p) + plane->component_mapping[plane->components++] = c; } // Clear the superfluous components @@ -603,10 +602,10 @@ return true; } -static void pl_avbuffer_free(void *priv) +static void pl_avframe_free(void *priv) { - AVBufferRef *buf = priv; - av_buffer_unref(&buf); + AVFrame *frame = priv; + av_frame_free(&frame); } static inline bool pl_upload_avframe(const struct pl_gpu *gpu, @@ -634,15 +633,16 @@ data[p].row_stride = frame->linesize[p]; data[p].pixels = frame->data[p]; - // Try using an asynchronous upload if possible, by taking a new ref to - // the plane data - if (frame->buf[p]) { - data[p].callback = pl_avbuffer_free; - data[p].priv = av_buffer_ref(frame->buf[p]); + if (gpu->caps & PL_GPU_CAP_CALLBACKS) { + // Use asynchronous upload if possible + data[p].callback = pl_avframe_free; + data[p].priv = av_frame_clone(frame); } - if (!pl_upload_plane(gpu, &out->planes[p], &tex[p], &data[p])) + if (!pl_upload_plane(gpu, &out->planes[p], &tex[p], &data[p])) { + pl_avframe_free(data[p].priv); return false; + } } return true; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libplacebo-v3.120.1/src/meson.build new/libplacebo-v3.120.2/src/meson.build --- old/libplacebo-v3.120.1/src/meson.build 2021-04-06 08:47:44.000000000 +0200 +++ new/libplacebo-v3.120.2/src/meson.build 2021-04-19 10:14:26.000000000 +0200 @@ -7,6 +7,7 @@ vulkan = dependency('vulkan', version: '>=1.0.42', required: get_option('vulkan')) opengl = dependency('epoxy', version: '>=1.4.0', required: get_option('opengl')) +shaderc = dependency('shaderc', version: '>=2018.0', required: get_option('shaderc')) # configuration data conf_public = configuration_data() @@ -23,27 +24,6 @@ endif endif -# work-arounds for shaderc braindeath -shaderc_names = [ - 'shaderc_shared', - 'shaderc_combined', -] - -shaderc = disabler() -foreach n : shaderc_names - if not shaderc.found() - shaderc = cc.find_library(n, required: get_option('shaderc')) - endif -endforeach - -if shaderc.found() - conf_internal.set('SHADERC_HAS_PERF', cc.has_header_symbol( - 'shaderc/shaderc.h', - 'shaderc_optimization_level_performance', - dependencies: shaderc, - )) -endif - # work-arounds for glslang braindeath glslang_combined = disabler() glslang_min_ver = '>=0.0.2763' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libplacebo-v3.120.1/src/renderer.c new/libplacebo-v3.120.2/src/renderer.c --- old/libplacebo-v3.120.1/src/renderer.c 2021-04-06 08:47:44.000000000 +0200 +++ new/libplacebo-v3.120.2/src/renderer.c 2021-04-19 10:14:26.000000000 +0200 @@ -1299,6 +1299,12 @@ sti->img.fmt = fmt; *stj = (struct plane_state) {0}; } + + if (!img_tex(pass, &sti->img)) { + PL_ERR(rr, "Failed dispatching plane merging shader, disabling FBOs!"); + memset(rr->fbofmt, 0, sizeof(rr->fbofmt)); + return false; + } } // Compute the sampling rc of each plane @@ -1384,7 +1390,7 @@ base_y = st->img.rect.y0 - scale_y * off_y; struct pl_sample_src src = { - .tex = img_tex(pass, &st->img), + .tex = st->img.tex, .components = plane->components, .address_mode = plane->address_mode, .scale = pl_color_repr_normalize(&st->img.repr), @@ -1923,6 +1929,7 @@ struct pl_transform2x2 tscale = { .mat = {{{ rrx, 0.0 }, { 0.0, rry }}}, + .c = { -sx, -sy }, }; draw_overlays(pass, plane->texture, plane->components, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libplacebo-v3.120.1/src/shaders/colorspace.c new/libplacebo-v3.120.2/src/shaders/colorspace.c --- old/libplacebo-v3.120.1/src/shaders/colorspace.c 2021-04-06 08:47:44.000000000 +0200 +++ new/libplacebo-v3.120.2/src/shaders/colorspace.c 2021-04-19 10:14:26.000000000 +0200 @@ -45,17 +45,19 @@ enum pl_color_system orig_sys = repr->sys; struct pl_transform3x3 tr = pl_color_repr_decode(repr, params); - ident_t cmat = sh_var(sh, (struct pl_shader_var) { - .var = pl_var_mat3("cmat"), - .data = PL_TRANSPOSE_3X3(tr.mat.m), - }); + if (memcmp(&tr, &pl_transform3x3_identity, sizeof(tr))) { + ident_t cmat = sh_var(sh, (struct pl_shader_var) { + .var = pl_var_mat3("cmat"), + .data = PL_TRANSPOSE_3X3(tr.mat.m), + }); - ident_t cmat_c = sh_var(sh, (struct pl_shader_var) { - .var = pl_var_vec3("cmat_c"), - .data = tr.c, - }); + ident_t cmat_c = sh_var(sh, (struct pl_shader_var) { + .var = pl_var_vec3("cmat_c"), + .data = tr.c, + }); - GLSL("color.rgb = %s * color.rgb + %s;\n", cmat, cmat_c); + GLSL("color.rgb = %s * color.rgb + %s;\n", cmat, cmat_c); + } switch (orig_sys) { case PL_COLOR_SYSTEM_BT_2020_C: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libplacebo-v3.120.1/src/spirv_shaderc.c new/libplacebo-v3.120.2/src/spirv_shaderc.c --- old/libplacebo-v3.120.1/src/spirv_shaderc.c 2021-04-06 08:47:44.000000000 +0200 +++ new/libplacebo-v3.120.2/src/spirv_shaderc.c 2021-04-19 10:14:26.000000000 +0200 @@ -48,14 +48,8 @@ if (!p->opts) goto error; -#ifdef SHADERC_HAS_PERF shaderc_compile_options_set_optimization_level(p->opts, shaderc_optimization_level_performance); -#else - shaderc_compile_options_set_optimization_level(p->opts, - shaderc_optimization_level_size); -#endif - shaderc_compile_options_set_target_env(p->opts, shaderc_target_env_vulkan, api_version); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libplacebo-v3.120.1/src/utils/frame_queue.c new/libplacebo-v3.120.2/src/utils/frame_queue.c --- old/libplacebo-v3.120.1/src/utils/frame_queue.c 2021-04-06 08:47:44.000000000 +0200 +++ new/libplacebo-v3.120.2/src/utils/frame_queue.c 2021-04-19 10:14:26.000000000 +0200 @@ -194,6 +194,24 @@ PL_TRACE(p, "Received new frame with PTS %f", src->pts); + if (p->queue.num) { + float prev_pts = p->queue.elem[p->queue.num - 1].src.pts; + float delta = src->pts - prev_pts; + if (delta < 0.0) { + PL_WARN(p, "Backwards source PTS jump %f -> %f, discarding frame...", + prev_pts, src->pts); + if (src->discard) + src->discard(src); + return; + } else if (p->fps.estimate && delta > 10.0 * p->fps.estimate) { + PL_WARN(p, "Discontinuous source PTS jump %f -> %f", prev_pts, src->pts); + } else { + update_estimate(&p->fps, delta); + } + } else if (src->pts != 0) { + PL_DEBUG(p, "First frame received with non-zero PTS %f", src->pts); + } + struct cache_entry cache = {0}; PL_ARRAY_POP(p->cache, &cache); PL_ARRAY_APPEND(p, p->queue, (struct entry) { @@ -201,26 +219,14 @@ .cache = cache, .src = *src, }); - - if (p->queue.num > 1) { - float prev_pts = p->queue.elem[p->queue.num - 2].src.pts; - float delta = src->pts - prev_pts; - if ((p->fps.estimate && delta > 10.0 * p->fps.estimate) || delta < 0.0) { - // Ignore very large discontinuities or backwards jumps in PTS - PL_TRACE(p, "Discontinuous source PTS jump %f -> %f, ignoring...", - prev_pts, src->pts); - } else { - update_estimate(&p->fps, delta); - } - } } static void report_estimates(struct pl_queue *p) { if (p->fps.total >= MIN_SAMPLES && p->vps.total >= MIN_SAMPLES) { if (p->reported_fps && p->reported_vps) { - // Only re-eport the estimates if they've changed considerably from - // the previously reported values + // Only re-report the estimates if they've changed considerably + // from the previously reported values static const float report_delta = 0.3; float delta_fps = delta(p->reported_fps, p->fps.estimate); float delta_vps = delta(p->reported_vps, p->vps.estimate); @@ -508,21 +514,33 @@ return true; } +static inline void default_estimate(struct pool *pool, float val) +{ + if (!pool->estimate && isnormal(val) && val > 0.0) + pool->estimate = val; +} + enum pl_queue_status pl_queue_update(struct pl_queue *p, struct pl_frame_mix *out_mix, const struct pl_queue_params *params) { - p->fps.estimate = PL_DEF(p->fps.estimate, params->frame_duration); - p->vps.estimate = PL_DEF(p->vps.estimate, params->vsync_duration); + default_estimate(&p->fps, params->frame_duration); + default_estimate(&p->vps, params->vsync_duration); float delta = params->pts - p->prev_pts; if (delta < 0.0) { - PL_ERR(p, "Requested PTS %f is lower than the previously rendered " - "PTS %f. This is not supported, PTS must be monotonically " - "increasing! Please use `pl_queue_reset` to reset the frame " - "queue on discontinuous PTS jumps.", params->pts, p->prev_pts); - return QUEUE_ERR; + // This is a backwards PTS jump. This is something we can handle + // semi-gracefully, but only if we haven't culled past the current + // frame yet. + if (p->queue.num && p->queue.elem[0].src.pts > params->pts) { + PL_ERR(p, "Requested PTS %f is lower than the oldest frame " + "PTS %f. This is not supported, PTS must be monotonically " + "increasing! Please use `pl_queue_reset` to reset the frame " + "queue on discontinuous PTS jumps.", + params->pts, p->queue.elem[0].src.pts); + return QUEUE_ERR; + } } else if (delta > 1.0) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libplacebo-v3.120.1/src/vulkan/context.c new/libplacebo-v3.120.2/src/vulkan/context.c --- old/libplacebo-v3.120.1/src/vulkan/context.c 2021-04-06 08:47:44.000000000 +0200 +++ new/libplacebo-v3.120.2/src/vulkan/context.c 2021-04-19 10:14:26.000000000 +0200 @@ -977,7 +977,7 @@ VkPhysicalDeviceType t = prop.properties.deviceType; bool has_uuid = memcmp(id_props.deviceUUID, nil, VK_UUID_SIZE) != 0; if (uuid_set && !has_uuid) { - PL_FATAL(vk, "params.device_uuid set but provided instanced does " + PL_FATAL(vk, "params.device_uuid set but provided instance does " "not support the extensions required to query device UUIDs!"); goto error; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libplacebo-v3.120.1/src/vulkan/malloc.c new/libplacebo-v3.120.2/src/vulkan/malloc.c --- old/libplacebo-v3.120.1/src/vulkan/malloc.c 2021-04-06 08:47:44.000000000 +0200 +++ new/libplacebo-v3.120.2/src/vulkan/malloc.c 2021-04-19 10:14:26.000000000 +0200 @@ -33,17 +33,17 @@ // Controls the minimum slab size, to reduce the frequency at which very small // slabs would need to get allocated when allocating the first few buffers. // (Default: 1 MB) -#define PL_VK_HEAP_MINIMUM_SLAB_SIZE (1 << 20) +#define PL_VK_HEAP_MINIMUM_SLAB_SIZE (1LLU << 20) // Controls the maximum slab size, to reduce the effect of unbounded slab // growth exhausting memory. If the application needs a single allocation // that's bigger than this value, it will be allocated directly from the // device. (Default: 256 MB) -#define PL_VK_HEAP_MAXIMUM_SLAB_SIZE (1 << 28) +#define PL_VK_HEAP_MAXIMUM_SLAB_SIZE (1LLU << 28) // Controls the minimum free region size, to reduce thrashing the free space // map with lots of small buffers during uninit. (Default: 1 KB) -#define PL_VK_HEAP_MINIMUM_REGION_SIZE (1 << 10) +#define PL_VK_HEAP_MINIMUM_REGION_SIZE (1LLU << 10) // Represents a region of available memory struct vk_region { @@ -182,7 +182,7 @@ continue; // The memory type must be supported by the type mask (bitfield) - if (!(type_mask & (1 << i))) + if (!(type_mask & (1LU << i))) continue; // Calculate the score as the number of optimal property flags matched