From a9983a8231765fb52906fe26c29910d91b86e68a Mon Sep 17 00:00:00 2001 From: Leigh Scott Date: Thu, 11 Feb 2021 21:05:37 +0000 Subject: [PATCH] Patch for new libplacebo API --- ...65cefb27d4e0d07535d368febdf77b579566.patch | 84 +++++++++++++++++++ mpv.spec | 7 +- 2 files changed, 90 insertions(+), 1 deletion(-) create mode 100644 7c4465cefb27d4e0d07535d368febdf77b579566.patch diff --git a/7c4465cefb27d4e0d07535d368febdf77b579566.patch b/7c4465cefb27d4e0d07535d368febdf77b579566.patch new file mode 100644 index 0000000..5aaaf7b --- /dev/null +++ b/7c4465cefb27d4e0d07535d368febdf77b579566.patch @@ -0,0 +1,84 @@ +From 7c4465cefb27d4e0d07535d368febdf77b579566 Mon Sep 17 00:00:00 2001 +From: Niklas Haas +Date: Thu, 3 Dec 2020 08:25:23 +0100 +Subject: [PATCH] vo_gpu: placebo: update for upstream API changes + +The concept of sample/address modes was moved from `pl_tex` to +`pl_desc_binding`. + +The `pl_tex_blit()` function also underwent an API change. +--- + video/out/placebo/ra_pl.c | 31 +++++++++++++++++++++++++++++-- + 1 file changed, 29 insertions(+), 2 deletions(-) + +diff --git a/video/out/placebo/ra_pl.c b/video/out/placebo/ra_pl.c +index f8df590511..8244acff26 100644 +--- a/video/out/placebo/ra_pl.c ++++ b/video/out/placebo/ra_pl.c +@@ -144,8 +144,14 @@ bool mppl_wrap_tex(struct ra *ra, const struct pl_tex *pltex, + .blit_dst = pltex->params.blit_dst, + .host_mutable = pltex->params.host_writable, + .downloadable = pltex->params.host_readable, ++#if PL_API_VER >= 103 ++ // These don't exist upstream, so just pick something reasonable ++ .src_linear = pltex->params.format->caps & PL_FMT_CAP_LINEAR, ++ .src_repeat = false, ++#else + .src_linear = pltex->params.sample_mode == PL_TEX_SAMPLE_LINEAR, + .src_repeat = pltex->params.address_mode == PL_TEX_ADDRESS_REPEAT, ++#endif + }, + .priv = (void *) pltex, + }; +@@ -195,10 +201,12 @@ static struct ra_tex *tex_create_pl(struct ra *ra, + .blit_dst = params->blit_dst || params->render_dst, + .host_writable = params->host_mutable, + .host_readable = params->downloadable, ++#if PL_API_VER < 103 + .sample_mode = params->src_linear ? PL_TEX_SAMPLE_LINEAR + : PL_TEX_SAMPLE_NEAREST, + .address_mode = params->src_repeat ? PL_TEX_ADDRESS_REPEAT + : PL_TEX_ADDRESS_CLAMP, ++#endif + .initial_data = params->initial_data, + }); + +@@ -399,7 +407,18 @@ static void blit_pl(struct ra *ra, struct ra_tex *dst, struct ra_tex *src, + pldst.y1 = MPMIN(MPMAX(dst_rc->y1, 0), dst->params.h); + } + ++#if PL_API_VER >= 103 ++ pl_tex_blit(get_gpu(ra), &(struct pl_tex_blit_params) { ++ .src = src->priv, ++ .dst = dst->priv, ++ .src_rc = plsrc, ++ .dst_rc = pldst, ++ .sample_mode = src->params.src_linear ? PL_TEX_SAMPLE_LINEAR ++ : PL_TEX_SAMPLE_NEAREST, ++ }); ++#else + pl_tex_blit(get_gpu(ra), dst->priv, src->priv, pldst, plsrc); ++#endif + } + + static const enum pl_var_type var_type[RA_VARTYPE_COUNT] = { +@@ -627,9 +646,17 @@ static void renderpass_run_pl(struct ra *ra, + struct pl_desc_binding bind; + switch (inp->type) { + case RA_VARTYPE_TEX: +- case RA_VARTYPE_IMG_W: +- bind.object = (* (struct ra_tex **) val->data)->priv; ++ case RA_VARTYPE_IMG_W: { ++ struct ra_tex *tex = *((struct ra_tex **) val->data); ++ bind.object = tex->priv; ++#if PL_API_VER >= 103 ++ bind.sample_mode = tex->params.src_linear ? PL_TEX_SAMPLE_LINEAR ++ : PL_TEX_SAMPLE_NEAREST; ++ bind.address_mode = tex->params.src_repeat ? PL_TEX_ADDRESS_REPEAT ++ : PL_TEX_ADDRESS_CLAMP; ++#endif + break; ++ } + case RA_VARTYPE_BUF_RO: + case RA_VARTYPE_BUF_RW: + bind.object = (* (struct ra_buf **) val->data)->priv; diff --git a/mpv.spec b/mpv.spec index 4e045ca..36dba68 100644 --- a/mpv.spec +++ b/mpv.spec @@ -1,10 +1,12 @@ +%global giturl https://github.com/mpv-player/mpv + Name: mpv Version: 0.33.0 Release: 4%{?gitrelease}%{?dist} Summary: Movie player playing most video formats and DVDs License: GPLv2+ and LGPLv2+ URL: http://mpv.io/ -Source0: https://github.com/mpv-player/mpv/archive/v%{version}/%{name}-%{version}.tar.gz +Source0: %{giturl}/archive/v%{version}/%{name}-%{version}.tar.gz # set defaults for Fedora Patch0: %{name}-config.patch @@ -13,6 +15,9 @@ Patch0: %{name}-config.patch # https://github.com/mpv-player/mpv/issues/3776 Patch1: ppc_fix.patch +# Patch for new libplacebo API +Patch2: %{giturl}/commit/7c4465cefb27d4e0d07535d368febdf77b579566.patch + BuildRequires: pkgconfig(alsa) BuildRequires: desktop-file-utils BuildRequires: gcc