0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 20:03:10 +02:00
Commit Graph

130 Commits

Author SHA1 Message Date
Niklas Haas
a8192eda6c vo_gpu_next: add --libplacebo-opts
To help test not-yet-exposed options, and for debugging purposes.
2023-08-19 14:12:24 +02:00
Niklas Haas
40b6afcfca vo_gpu_next: don't re-set frame_mixer
This is already set by map_scaler, just disable it if unwanted.
2023-08-19 14:12:24 +02:00
Niklas Haas
47f756d64b vo_gpu_next: move allow_delayed to move appropriate place
No need to override this so late in the general (non-screenshot) code.
2023-08-19 14:12:24 +02:00
Niklas Haas
d2082841df vo_gpu_next: switch to new pl_options system
With a backwards compatibility shim for older versions of libplacebo in
which we simply define the relevant subset of this struct ourselves and
initialize it to known-good values, to be able to continue using our
options assigning code.

It's worth pointing out that our use of scalers deviates from how
pl_options was intended to be used, as a consequence of backwards
compatibility with pre-308 versions of libplacebo. But this should work
fine in practice, since we don't care about serializing these custom
scalers correctly. Users can still override them using the built-in
pl_options scalers when loading custom scalers via --libplacebo-options.
(To be added in the next commit)
2023-08-19 14:12:24 +02:00
Niklas Haas
152a95f215 vo_gpu_next: fix leak of --icc-profile-auto on uninit
This was already correctly freed when acquiring a new profile, but never
freed on uninit. Fix by reparenting the profile onto `p`, which is what
vo_gpu also does.
2023-08-18 19:07:39 +02:00
Niklas Haas
f97584cadc vo_gpu_next: drop redundant PL_HAVE_LCMS check
This header is installed unconditionally starting with libplacebo
v4.208.0, so we are safe to remove the check.
2023-08-18 16:40:44 +02:00
Kacper Michajłow
f274ff2f2b vo_gpu_next: use pl_dispatch_info_move to avoid useless data copy
Instead copy the data on-demand when VOCTRL_PERFORMANCE_DATA is
requested.
2023-08-18 16:39:57 +02:00
Niklas Haas
442adb0553 vo_gpu_next: drop PL_API_VER compatibility paths
v6.292 implied by minimum dependency.
2023-08-18 16:39:57 +02:00
Dudemanguy
efefe3a6dc vo_gpu_next: actually fix screenshots with PAR
983e8f0100 resulted in the correct
dimensions, but it was not actually right because vo_gpu_next still had
the src and dst rects the same. This just needs to work like how vo_gpu
does where the src is the image params and the dst is desired output. So
basically, just copy that code over here. Fixes #12108 and as a bonus,
overriding the aspect ratio now results in correct screenshots
(previously didn't work at now and then with the above commit it had
correct dimensions but still incorrect output).
2023-08-08 21:28:10 -05:00
Dudemanguy
983e8f0100 vo_gpu_next: take into account PAR when taking screenshots
Using the width and height params directly doesn't actually work if PAR
is something other than 1. Instead, use mp_image_params_get_dsize and
calculate the correct dimensions which matches the vo_gpu behavior.
2023-08-07 21:09:30 -05:00
Niklas Haas
cf01646c39 vo_gpu_next: add ability to use named hook params
Closes: https://github.com/mpv-player/mpv/issues/12093
2023-08-07 19:34:44 +02:00
Niklas Haas
35a6b26b78 vo_gpu_next: increase non-interpolation queue size
1 is not enough to prevent PL_QUEUE_MORE, because the pl_queue is
designed to always know the next frame (in addition to the current).
Before haasn/libplacebo@112bb886, this was was (wrongly) silently
omitted by the pl_queue code, but that fix exposed this.

While it's technically API misuse on mpv side, due to the mpv vo code
having its own internal queueing and timing control, it shouldn't
actually make any difference in practice (and likely, the error message
showing up is the only meaningful bug here - the issue is entirely
cosmetic).

Fixes: https://github.com/mpv-player/mpv/issues/12101
2023-08-07 10:42:08 +02:00
Niklas Haas
f6de44dd6a vo_gpu_next: update for new pl_filter configuration API
Configuration of filter parameters was moved from pl_filter_function (of
which the user had to make a copy) to pl_filter_config, with the
pl_filter_function remaining immutable.

Implement this new logic in a way that can reasonably exist side-by-side
with the old configuration API. Once we drop support for PL_API_VER
below 303, we can drastically simplify this code.
2023-08-06 22:44:54 +02:00
Dudemanguy
59ac302dff vo_gpu/vo_gpu_next: fix setting an empty dscale
The manual currently says that if dscale is unset, --scale will be
applied. However, this only works at init time. If you change the dscale
filter to be empty later, vo_gpu will segfault and vo_gpu_next will
throw an error and refuse the changes. That's because when the option is
unset at runtime, the value becomes "" not NULL and the vo's never
accounted for this. Fixes #12031.
2023-08-05 14:01:02 +00:00
Niklas Haas
45e95311b8 vo_gpu_next: add --hdr-peak-percentile 2023-08-04 16:58:44 +02:00
Niklas Haas
3bf1d22879 vo_gpu_next: fix assertion on wayland
This code failed to handle the case of the swapchain submission being
skipped because the window was invisible.

Fixes: f9dc695b58
2023-07-29 19:09:45 +02:00
Niklas Haas
f9dc695b58 vo_gpu_next: delay swapchain submit until flip_frame()
Presents frames at the correct time when DS is disabled.
2023-07-29 17:09:59 +02:00
sfan5
5236003db5 Revert "vo_gpu_next: use pl_dispatch_info_move to avoid useless data copy"
We wanted to preserve the libplacebo v5.264.0 requirement for gpu_next
for this release, since this is the what most Linux distributions are shipping.
The VLC 3 <-> libplacebo v6 situation is an additional reason distros are not
likely to ship the newest libplacebo release soon.
This reverts commit b73d96776c.
2023-07-23 15:40:41 +02:00
Niklas Haas
02595011eb vo_gpu_next: add --hdr-contrast-recovery/smoothness
New upstream feature. Disabled by default.
2023-07-18 15:22:18 +02:00
Kacper Michajłow
347fbd6fa3 vo_gpu_next: add --target-contrast option
For better control over target display levels.
2023-07-17 18:50:34 +02:00
Dudemanguy
ee69d99bd4 various: correctly ignore cache files with --no-config
--no-config should prevent loading user files of any type: configs,
cache, etc. For cache files, this case wasn't properly handled and it
was assumed they would always get something. vo_gpu's shader cache
actually already handles this, so it was left untouched. In theory,
demuxer cache should never have this issue because saving it to disk is
disabled by default (and likely that will never change), but go ahead
and change it for consistency's sake. Fixes some segfaults with
--no-config and various combinations of settings (particularly
--vo=gpu-next).
2023-07-06 13:08:23 +00:00
Kacper Michajłow
d2c28bc4df vo_gpu_next: remove synchronization from info_callback
VOCTRL is processed on VO thread.
2023-07-02 16:20:48 +02:00
Kacper Michajłow
b73d96776c vo_gpu_next: use pl_dispatch_info_move to avoid useless data copy
Instead copy the data on-demand when VOCTRL_PERFORMANCE_DATA is
requested.
2023-07-02 16:20:48 +02:00
Niklas Haas
0af81b16d8 vo_gpu_next: add --corner-rounding option
For better or worse.
2023-06-21 23:52:35 +02:00
Niklas Haas
f1600ea9cf vo_gpu_next: add missing --gamut-mapping-mode options
Adds the missing upstream values that were exposed by the new gamut
mapping API.
2023-06-21 23:52:35 +02:00
Philip Langdale
085f3e31a0 vo: hwdec: Pass the ra_ctx to hwdecs instead of just the ra
We will need the full ra_ctx to be able to look up all the state
required to initialise an ffmpeg vulkan hwcontext, so pass let's
pass the ra_ctx instead of just the ra.
2023-05-28 15:46:05 -07:00
Kacper Michajłow
959ef843d2 vo_gpu_next: fix to allow using dllimport
Address of variables can't be used for constant initialization in C
language modes.
2023-05-27 14:54:59 +02:00
Kacper Michajłow
9fd4ae9529 vo: make mp_frame_perf thread safe
It was unsafe to return pointer to memory that was freed on another
thread, just copy the string to caller owned sturcture.

Fixes crashes when displaying passes stats with gpu-next.
2023-05-25 16:25:33 +02:00
Kacper Michajłow
19c5cd92b2 vo_gpu_next: add size guard for pass->num_samples
This shouldn't happen as the array sizes are the same, but guard against
it in case libplacebo do something naughty.
2023-05-25 16:25:33 +02:00
Kacper Michajłow
3b89a58af7 vo_gpu_next: synchronize voctrl_performance_data access
info_callback is fired quite often and from different thread than any
accesses to this structure.
2023-05-25 16:25:33 +02:00
Kacper Michajłow
695b3c51d1 vo_gpu_next: fix off by one in info_callback
Fixes invalid memory writes.
2023-05-25 16:25:33 +02:00
Niklas Haas
b9a5583f17 vo_gpu_next: fix build on older libplacebo
Introduced by, of all things, a rebase...

Fixes: a5da8b2c87
2023-05-24 22:06:03 +02:00
Niklas Haas
a5da8b2c87 vo_gpu_next: update to new libplacebo gamut mapping API
This just replaces the API calls to get rid of deprecation warnings, it
doesn't yet expand the enum, nor replace them by the proper options.

The translation from tone map modes to hybrid mix parameters is taken
from the libplacebo source code.
2023-05-24 21:32:23 +02:00
Niklas Haas
dc13d47c73 vo_gpu_next: remove --tone-mapping-crosstalk
Removed upstream, to be replaced by constant 0.04.
2023-05-24 21:32:00 +02:00
Kacper Michajłow
9e716d6303 vo_gpu_next: allow to use ICC profile luminance value
Also while at it respect target-peak option when ICC profile is used.

Fixes #11449
2023-05-13 17:08:37 +02:00
Dudemanguy
4502522a7a player: use XDG_CACHE_HOME by default
This adds cache as a possible path for mpv to internally pick
(~/.cache/mpv for non-darwin unix-like systems, the usual config
directory for everyone else). For gpu shader cache and icc cache,
controlling whether or not to write such files is done with the new
--gpu-shader-cache and --icc-cache options respectively. Additionally,
--cache-on-disk no longer requires explicitly setting the --cache-dir
option. The old options, --cache-dir, --gpu-shader-cache-dir, and
--icc-cache-dir simply set an override for the directory to save cache
files. If unset, then the cache is saved in XDG_CACHE_HOME.
2023-05-09 20:37:17 +00:00
Kacper Michajłow
4fd0a39fc8 vo_gpu_next: fixes to allow using dllimport
Address of variables can't be used for constant initialization in C
language modes.

See 0c43d8077e
2023-04-24 13:16:55 +02:00
Harri Nieminen
292a5868cb various: fix typos
Found by codespell
2023-03-28 19:29:44 +00:00
llyyr
685d9cbe5b vo_gpu_next: drop various PL_API_VER checks
We don't need these anymore now that we require PL_API_VER>=264 for
building libplacebo-next
2023-03-26 20:55:58 -07:00
llyyr
3a2f8d42ab vo_gpu_next: compatibility with libplacebo v6.265
libplacebo v6.265.0 removed v4 deprecations. We already require
PL_API_VER >= 202, so we don't need to wrap
pl_tex_transfer_params.row_pitch around a conditional, which exists
since PL_API_VER >= 168. However, pl_source_frame.duration does not exist until
PL_API_VER >= 219, so we should use a conditional directive.
2023-03-13 20:09:06 +01:00
Niklas Haas
dcc9bc5dea vo_gpu_next: compatibility with PL_API_VER >= 254
This field was renamed/moved to a different params struct.
2023-03-06 21:35:10 +01:00
Leo Izen
4defd8bb27 vo_gpu_next: use inverse mapping functions to tag screenshots
Screenshots using the hardware renderer should now include color tags
that map directly from the libplacebo tags, so the if/else logic only
needs to be included once.
2023-03-05 22:37:05 -05:00
Thomas Weißschuh
8d67e891ab vo_gpu_next: fix warning -Wunused-function 2023-02-26 16:45:07 +01:00
Kacper Michajłow
84f6d7a97e vo_gpu_next: fix color space hint with target peak override
Fixes: #11339
2023-02-23 10:14:53 +01:00
Christoph Heinrich
91cc0d8cf6 options: transition options from OPT_FLAG to OPT_BOOL
c784820454 introduced a bool option type
as a replacement for the flag type, but didn't actually transition and
remove the flag type because it would have been too much mundane work.
2023-02-21 17:15:17 +00:00
Niklas Haas
9a752e8b26 vo_gpu_next: add --tone-mapping-visualize 2023-02-19 21:01:40 +01:00
quietvoid
41ad51bda2 vo_gpu_next: parse Dolby Vision metadata for dynamic scene brightness
Improves playback for Dolby Vision video files as the metadata can be
used instead of requiring `hdr-compute-peak=yes`.
2023-02-19 20:50:37 +01:00
Niklas Haas
16ef237da5 vo_gpu_next: allow native CSP screenshots
Useful for getting native screenshots of non-sRGB content, such as HDR
etc.
2023-02-13 21:53:41 +01:00
Niklas Haas
862be6c237 vo_gpu_next: tag screenshots with correct colorspace
When taking window screenshots with a colorspace override, tag them
appropriately, based on the best-known colorspace info. Note that this
is imperfect, we should ideally also attach the output ICC profile if
one exists. But this is better than nothing.

Also force 1:1 PAR in this case. In all other cases, default to sRGB.
2023-02-13 21:53:41 +01:00
Niklas Haas
5078132b28 vo_gpu_next: only apply target options in window screenshot mode
When taking an unscaled screenshot, always render to an unspecified
SDR-like space. (Subject to change) Apply output-specific options (ICC
profile, color space overrides, custom LUT) only in window screenshot
mode.

I decided to split this off from subsequent refactors because it is IMO
a bug fix deserving of its own commit.
2023-02-13 21:53:41 +01:00