Commit Graph
255 Commits
Author SHA1 Message Date
Kacper Michajłow f8cbe7b6a6 vo_gpu_next: allow to disable error diffusion when changing --dither
error_diffusion was not disabled even if --dither were changed.
2025-02-14 21:13:18 +01:00
Kacper Michajłow f14660b446 Revert "vo_gpu_next: set --target-colorspace-hint to yes by default"
HDR or any color-space pass-through should be opt-in, as we cannot
control the user's compositor or display. Allowing HDR signals to be
pushed by default may lead to surprising results for some users.
Additionally, for an optimal experience, this option should be paired
with the target-peak of the display.

Make the pass-through opt-in and let the user decide if they want or
need it. By default, mpv should render a safe and consistent sRGB
output. mpv's tone mapping is generally of higher quality than any
external solution.

This reverts commit 23843b4aa5.
2025-02-08 06:15:32 +01:00
Kacper Michajłow 59d1dc43b9 various: fix typos 2025-01-04 15:59:49 +02:00
Dudemanguy 91c1b65de0 vo: change draw_frame API to a boolean
x11 and wayland VOs + backends all have logic that skips drawing frames
when the mpv isn't visible for efficiency reasons. This is implemented
in each individual VO, but it is useful for the core to be aware of this
as well. Currently, the display-sync modes on x11 do not try to be
efficient and always render anyways because there is no blocking on the
graphics API level if you skip rendering a frame (wayland works here by
accident). This means mpv would otherwise blaze through frames which is
not what anyone wants. We can instead improve this by implementing the
blocking mechanism in the core and using that when appropriate. This
commit does not implement that yet, but simply switches the draw_frame
to a boolean. Receiving false means that the VO is not drawing frames
and it should be treated as if the surface was hidden.
2024-12-28 16:51:28 +00:00
Kacper Michajłow 5730c631fd player/video: update dynamic hdr params 2024-11-24 11:32:12 +01:00
Kacper Michajłow 4908a632d3 vo_gpu_next: use display values in target-contrast=auto 2024-11-23 22:16:44 +01:00
Kacper Michajłow 2c2ac3cb36 vo_gpu_next: add target-colorspace-hint=auto 2024-11-23 22:16:44 +01:00
Kacper Michajłow 2183f771ef vo_gpu_next: fix mp_image colorspace with some hwdecs
Fixes: ef6052c01e
2024-11-23 10:48:22 +01:00
Kacper Michajłow 23262308d6 vo_gpu_next: restore initial hook param value
If the parameter is removed from the `glsl-shader-opts` list, it should
be restored to initial value.
2024-11-20 20:41:49 +01:00
Kacper Michajłow 012d317a1e vo_gpu_next: clear renderer cache on options update
This ensures that options are applied to current frame, even in paused
state.
2024-11-20 20:41:49 +01:00
Kacper Michajłow ef6052c01e vo_gpu_next: remove colospace overrides
Hacks like that has no place here, mp_image should be tagged correctly,
across the player, gpu-next is not special.
2024-11-20 20:40:05 +01:00
Dudemanguy 23843b4aa5 vo_gpu_next: set --target-colorspace-hint to yes by default
It simply does not make any sense to not signal the correct colorspace
and metadata by default.
2024-11-04 19:35:28 +00:00
Dudemanguy d5f1cd07dc vo_gpu_next: add a pass_colorspace override for drm
The libplacebo colorspace hint api makes sense for things like vulkan,
but for other APIs like drm that are capable of directly handling
colorspaces and hdr metadata it's a nuisance. Add a pass_colorspace fns
that signals to vo_gpu_next that the backend doesn't need the color
information to be manipulated and can handle the metadata itself.
2024-11-04 19:35:28 +00:00
Kacper Michajłow 42ff6f92c3 vo_gpu_next: add chroma location and HDR metadata to shader parameters 2024-11-02 21:20:20 +01:00
Niklas Haas 89e608e169 vo_gpu_next: add dynamic hook parameters
Fixes: https://github.com/haasn/libplacebo/issues/230
Fixes: https://github.com/mpv-player/mpv/issues/8206
2024-11-02 21:20:20 +01:00
der richter 3c76afa05b vo_gpu_next/vulkan: add mechanism to retrieve color depth in gpu context 2024-10-23 19:39:20 +02:00
Mohammad AlSaleh d027e02d37 vo_gpu_next: raise LUT file max size and report an error if exceeded
First of all, `lutdata` was passed to `pl_lut_parse_cube()` even if
 it was empty. This caused a bogus error message to be printed by
 the LUT parsing code in libplacebo.

 "[vo/gpu-next/libplacebo] Missing LUT size specification?"

 One of the reasons why `lutdata` can be empty is if the LUT file size
 exceeds the `max_size` limit passed to `stream_read_file()`.

 So in this commit, `lutdata` is checked first before getting passed to
 libplacebo, and a non-bogus error message is printed if it's empty.

 And secondly, the max size allowed is raised from the quite limiting
 value of 100MB to 1.5GiB. The new max matches the limit in LUT cache
 which is used to support up to 512x512x512 LUTs.

Signed-off-by: Mohammad AlSaleh <CE.Mohammad.AlSaleh@gmail.com>
2024-10-22 18:49:21 +02:00
Kacper Michajłow 65c81c3a39 vo_gpu_next: suppress tone_mapping_param deprecation warning
It is not going anywhere soon.

Fixes: #14696
2024-10-12 01:08:36 +02:00
Dudemanguy 48963aef4b vo_gpu_next: force a reset when --image-lut is updated
Bit of an edge case since image-lut requires the frames to be remapped
again so the normal redraw when paused doesn't work. Also we use
update_options in the VOCTRL here.
2024-10-09 13:39:06 +00:00
llyyr 22a7a0af8a vo_gpu_next: allow setting antiring value for cscale
This has been possible since https://github.com/haasn/libplacebo/commit/11771cdd82cec0d2f775553611c276092fb283cf
but nobody bothered to map it to mpv until now?
2024-09-15 18:54:23 +02:00
Guido Cella dd77d0a7da vo_gpu{,_next}: convert scale options to type choice
This allows Tab completing them in the console and zsh, and using cycle
scale.

jinc is also added to --tscale=help's output, while before it was
missing because validate_scaler_opt() skipped filter windows with the
same name as a filter kernel, but the jinc kernel was skipped with
--tscale because it is polar.
2024-09-14 17:06:07 +02:00
Kacper Michajłow 5edc8973eb various: use talloc_replace 2024-09-08 17:33:27 +02:00
Dudemanguy e3682f7f2b vo_gpu_next: support --gamma-factor
There's broad agreement that this option will be undeprecated, so just
factor in the multiplier for vo_gpu_next.
2024-07-17 14:09:00 +00:00
Kacper Michajłow f17ad792c6 vo_gpu_next: check if existing cache file has correct size 2024-05-10 22:54:25 +02:00
Kacper Michajłow b647201795 osdep/dirent: add implementation for Windows SDK build 2024-05-06 22:01:17 +02:00
Kacper Michajłow 18ef834ef4 various: move unistd.h inclusion to common.h 2024-05-06 22:01:17 +02:00
Kacper Michajłow 2f8038c598 vo_gpu_next: invalidate cache object if requested by libplacebo
See: https://code.videolan.org/videolan/libplacebo/-/merge_requests/659
2024-04-18 02:25:12 +02:00
Kacper Michajłow 078da37d5c vo_gpu_next: rotate target crop
Turns out libplacebo uses unrotated target crop in relation to source.
Use dst rect from VO, instead of extracting it from pl_frame, to avoid
another unrotating operation.

Fixes: a9354b36ca
2024-04-13 23:07:16 +02:00
Kacper Michajłow a9354b36ca vo_gpu_next: set target resolution to crop value
Use rect of the actual image instead of FBO size which includes
margins.
2024-04-13 13:37:12 +02:00
Kacper Michajłow 89cc477ef1 vo_gpu_next: keep target params in priv instead of alocating it 2024-04-10 18:35:47 +02:00
llyyr f914947dda vo_gpu_next: make dither-depth=auto mean 8 bpc for non-d3d11 SDR
Fixes the issue described in https://github.com/mpv-player/mpv/issues/11862
for SDR files for non-d3d11 gpu-api. We currently don't have a smarter
way to get the real on-the-wire bpc for other APIs, so this is the best
that can be done.
2024-03-19 09:06:01 +01:00
nanahi a6f8d1d961 vo_gpu_next: fix -Wembedded-directive warning
warning: embedding a directive within macro arguments has undefined behavior
2024-03-19 08:58:18 +01:00
Kacper Michajłow cbe30f614d vo_gpu_next: don't render ASS subtitles at HDR colorspace
Upstream ASS specification says that all subtitles should be rendered
with color primaries and transfer matching their associated video. But
as expected after further discussion the decision has been made to
fallback to SDR mode in case of HDR video.

See-Also: https://github.com/libass/libass/blob/649a7c2e1fc6f4188ea1a89968560715800b883d/libass/ass_types.h#L233-L237
See-Also: libass/libass#297
See-Also: mpv-player#13381
Fixes: mpv-player#13673
2024-03-18 21:24:06 +01:00
Kacper Michajłow 7265bde26a gpu-next: add support for --dither-depth=auto
On supported APIs.
Fixes: https://github.com/mpv-player/mpv/issues/11862
2024-03-17 14:28:00 +01:00
sfan5 2893b7d0f5 vo: move target_params into responsibility of VO
The VO generic code tries to be helpful and resets this after
each reconfig. However for the simpler VOs the target params
are constant after a reconfig or even for the entire lifetime.
So it's clearly better to let the VO decide.

This also allows the VO to use a static buffer instead.
2024-03-16 13:27:34 +01:00
Dudemanguy 38b5dcb441 vo_gpu/vo_gpu_next: fix transparency in glx
It seems that GLX requires us to explicitly set opts.want alpha before
ra_ctx_create is called. b7fd232524
rearranged the function calls in a way made this not work. Fix this by
rearranging it again so the value is set before ra_ctx is created.
2024-03-13 22:39:31 +00:00
Kacper Michajłow d9c1e9bc5c mp_image: add Dolby Vision metadata mapping
Remove side-loading metadata in vo_gpu_next.c and remove unneded
side-data duplication.
2024-03-09 05:58:52 +00:00
Kacper Michajłow 391261f757 mp_image: add mp_image_params_static_equal for finer comparision
In case of dynamic HDR metadata is present.
2024-03-09 05:58:52 +00:00
Kacper Michajłow 580bc69d0c vo_gpu_next: infer target parameters
This allows us to read them back.
2024-03-07 21:12:12 +02:00
Kacper Michajłow fc5d533a66 vo_gpu_next: add support for video-target-params 2024-03-07 21:12:12 +02:00
Kacper Michajłow 9325ebe817 vo_gpu_next: render subtitles at video colorspace 2024-03-02 15:57:02 +00:00
Dudemanguy fa0fccc2a7 vo_gpu_next: simplify pl_clear_mode enum mapping
No reason for there to be two columns and this also fixes a
-Wenum-conversion warning on clang.
2024-02-26 20:07:43 -06:00
Dudemanguy bc4003d219 vo_gpu_next: add --border-background option
Allow for setting the border background independently from the
background option.
2024-02-26 16:46:00 +00:00
Dudemanguy be198c0f0a vo_gpu_next: support --background option
Requires using the new pl_clear_mode enum in libplacebo.
2024-02-26 16:46:00 +00:00
Dudemanguy c72c47204d vo_gpu/vo_gpu_next: rework --alpha into --background option
The --alpha option currently covers two related but different concepts:
whether or not to ignore the alpha component and possibly blending it
with a background. Because of the way the option currently works, it is
impossible to have a transparent window (which requires setting
--alpha=yes) while blending it with the background at the same time. To
solve this, let's rework it so it it superseded by the background
option.

--background controls what kind of background to set for the image if
possible. It can be blended with the set background color, with tiles,
or not blended at all (the last one is still broken on X11/mesa except
for GLX, *sigh*). In this new paradigm, --alpha=no has no real purpose
because you can simply set the background to color and whatever color
you want for exactly the same effect. So the option is removed. Instead,
the hint set by windowing backends (i.e. setting
ra_ctx->opts.want_alpha) can by done with the --background option.

As an aside, the colors in vo_gpu are currently bugged due to not
pre-multiplying the alpha and it seems no one ever noticed. The next
commit fixes that. vo_gpu_next support happens latter since it requires
new things from libplacebo.

Fixes #9615.
2024-02-26 16:46:00 +00:00
Dudemanguy c774b5f517 player: rename --background to --background-color
This better represents what it actually does. --background will be used
for another, related option in the next commit.
2024-02-26 16:46:00 +00:00
Dudemanguy b7fd232524 vo_gpu/vo_gpu_next: set ctx->opts.want_alpha in specific functions
Currently this was being duplicated on init and on runtime updates
between both VOs. Since the conditions for setting this will get more
complicated in the future commits, it's better to just handle it in one
place. We could combine the vo_gpu and vo_gpu_next handling into one
single function but vo_gpu_next has an additional condition for
determining alpha that vo_gpu_does not, so we'll leave these separate
for simplicity. Also this technically fixes a memory leak where gl_opts
weren't being freed.
2024-02-26 16:46:00 +00:00
nanahi 6ecdedabe5 vo_gpu_next: fix win32 io wrap
Fixes 84015959cc
2024-02-26 09:37:24 +01:00
nanahi 84015959cc osdep/io: move I/O utility functions to misc/io_utils
The purpose of osdep/io is to provide a wrapper for POSIX I/O functions
on Windows. The last 2 functions are utility functions which don't serve
this purpose.
Move them to a separate file.
2024-02-23 21:35:57 +01:00
Dudemanguy bd5b80ba2c vo_gpu_next: fix some lut-related memory leaks 2024-02-17 18:56:20 +00:00