Commit Graph

459 Commits

Author SHA1 Message Date
Clinton Phillips 35ae76daad docs/comments: fix more doubled-word typos
Follow-up to #17926, addressing the four additional instances flagged
by @garoto:

- DOCS/man/options.rst: "output size size is limited" -> "output size is limited"
- DOCS/man/input.rst: "Called after after a file" -> "Called after a file"
- video/out/gpu/video.c: "target target that needs to be written" -> "target that needs to be written"
- video/out/x11_common.c: "enable DPMS only we we disabled it before" -> "enable DPMS only if we disabled it before"
  (this one wasn't a pure duplicate — the first "we" was a typo for "if"; the comment now matches the conditional on the line above)
2026-05-18 16:47:14 +02:00
NRK 7d1a598bdd vo_gpu: support parameters in RPN expressions 2026-04-20 21:52:06 +02:00
Kacper Michajłow 6788174641 video/out: use predefined pl_color_space_srgb 2026-04-17 20:16:50 +02:00
NRK c415c662d3 vo_gpu/utils: add gpu_get_auto_param()
deduplicates some code between vo_gpu and vo_gpu_next
2026-04-17 20:03:22 +02:00
NRK 3e0729eb06 vo_gpu: add support for ENUM parameters 2026-04-17 20:03:22 +02:00
NRK a0b6233318 vo_gpu: add support for DEFINE parameters 2026-04-17 20:03:22 +02:00
NRK 0d655fe665 vo_gpu: initial support for tunable parameters
does not support everything supported by gpu-next/libplacebo,
only a subset that was needed to run some user shaders.
2026-04-17 20:03:22 +02:00
NRK 91ceffce42 shader_cache: add gl_sc_uniform_{f,i}_bstr()
this enables callers that already have bstr names to avoid
unnecessary string conversions.
2026-04-17 20:03:22 +02:00
NRK c1a21bb8d9 vo_gpu: skip invalid component overwrite
can occur when a user shader sets a hook texture with more
components than supported. e.g overwriting LUMA with 3
component.

this does create a massive log spam when triggered, but that
seems consistent with the existing resize/realign error case.

Closes: https://github.com/mpv-player/mpv/issues/9863
2026-04-17 20:02:09 +02:00
NRK 1bf50fc71c user_shaders: reject nonsense COMPONENTS values
negative values in specific causes out of bound accesses.
2026-04-17 20:02:09 +02:00
Patricia Bucataru cc8f3bf9fa gpu/utils: fix null pointer arithmetic UB in mp_log_source
strchr() can return NULL when no newline is found. Computing end + 1
before the null check on end is undefined behaviour per C11 6.5.6.
Move the next assignment inside the else branch to avoid the UB.
2026-04-17 19:11:58 +02:00
NRK 702abfd587 vo_gpu: use actual (not logical) texture dimension
pass_upload_image currently stores the logical dimensions, which
in case of vulkan decoding may not match the physical one (e.g
1088 for 1080p). this mismatch results in glitches when using
polar scalers.

fix this by using the actual texture dimensions for hwdec plane
sizes.

Fixes: https://github.com/mpv-player/mpv/issues/14944
2026-04-06 18:23:54 +02:00
Kacper Michajłow 793ab6dcb0 options: target-gamut now accepts custom CIE xy primaries
Fixes: #17633
2026-03-25 02:01:03 +01:00
Kacper Michajłow ed534eb7f5 vo_gpu_next: add stereo osd support
Duplicate OSD/Subtitles for left and right eye.

Fixes: #12462
2026-03-23 23:16:32 +01:00
nanahi 1bd29b0ba2 video/out/gpu/lcms: use mp_hash_to_bstr 2026-03-23 15:03:38 +01:00
nanahi b48058e6cb video/out/gpu/shader_cache: use mp_hash_to_bstr 2026-03-23 15:03:38 +01:00
nanahi 8b2ab60ae3 video/out/gpu/shader_cache: use mp_save_to_file 2026-03-21 20:14:09 +01:00
nanahi 20b24a0dbd video/out/gpu/lcms: use mp_save_to_file 2026-03-21 20:14:09 +01:00
Kacper Michajłow fe9f917d8e vo_gpu_next: set color directly using Wayland protocol
Wayland color managment is not really flexible to be usable with Vulkan
color spaces, so set it directly.
2026-03-09 10:18:30 +01:00
Kacper Michajłow f9190e57f9 vo_gpu_next: add scRGB support
Fixes: #17076
2026-03-06 16:17:58 +01:00
Kacper Michajłow c55bdc3282 video/out/gpu: signal correctly if set_color is supported
set_color conceptually is a swapchain command, but in Wayland it's
implemented in ra_ctx, so we have one jump of indirection. Having
`set_color` defined for context_vulkan doesn't mean that all ra contexts
support it. Add a bool to mitigate this.

This could be structured differently, but should be fine.

Fixes: #17487
2026-03-02 02:04:36 +01:00
Dudemanguy 9d2da2567c video/out/gpu: add set_color ra_swapchain_fns
Anything related color management gets complex and there is a lot of
platform-specific code that gets called in relation to this. Currently,
this stuff gets called in various places in the render loop which mostly
works but it's prone to "off by 1 frame" errors and also isn't clean.
Introduce this helper to hopefully unify all this kind of stuff under
one umbrella. For integration with vo_gpu_next, this needs to be called
before flip_page and we should stop abusing target_params for this
purpose. The next couple of commits will implement this in two places.
2026-02-28 10:50:38 +01:00
Dudemanguy 7dd06a6c0b video/out/gpu: remove pass_colorspace ra_ctx_fns
This was originally added way back when specifically for drm so it can
play  nice with libplacebo for HDR. This is pretty ugly though and a bit
hacky. There's a better way to integrate this with target_csp. So drop
the pass_colorspace stuff in this commit and we'll change the
implementation in the next commit.
2026-02-28 10:50:38 +01:00
Kacper Michajłow 568522e69e vf_d3d11vpp: use ID3D11VideoContext1 interface for setting color space
This allows to use DXGI enums for color spaces, which supports PQ
transfers and so on. Old D3D11_VIDEO_PROCESSOR_COLOR_SPACE is limited
and doesn't support HDR formats.
2026-02-19 19:18:56 +01:00
Kacper Michajłow 11b2004b91 vo_gpu{,_next}: fix overriding scaling parameters for inherited kernels
If `{d,c}scale` is not specified the scaling kernel is inherited from
`scale`. This made all `{c,d}scale-*` options not work, as they were
silently ignored.

This commits inherits scale options, only if `{c,d}scale` options were
not adjusted in the config.
2026-01-23 05:18:14 +01:00
Kacper Michajłow 5d89f15e97 video/out/gpu/hwdec: load native D3D RA hwdec drivers first
There is no reason to load EGL/VAAPI first as it would fail in default gpu
context/api anyway, on Windows.
2025-12-14 13:42:22 +01:00
Kacper Michajłow 04055e5806 video/out/gpu/video: change treat-srgb-as-power22 default to auto
We want to have symmetry on the input and output. Also outputting sRGB
encoded image to gamma 2.2 display is clipping blacks. 2.2 displays are
more common and are reference sRGB display, which is what we should
target.
2025-11-04 20:51:50 +01:00
Kacper Michajłow 9b4341643f video/out/gpu/video: add --sdr-adjust-gamma 2025-10-29 15:36:15 +01:00
Kacper Michajłow 3e628c8d64 vo_gpu_next: linearize sRGB as a pure 2.2 power function
sRGB reference display is defined a 2.2 gamma device. To preserve the
look of the sRGB as mastered on such device, linearize it as such.

Note that sRGB encoding is piecewise with linear segment, which creates
mismatch to pure power 2.2 function, but this is intended to be viewed
on such display.

See:
IEC 61966-2-1-1999
https://community.acescentral.com/t/srgb-piece-wise-eotf-vs-pure-gamma/4024
https://github.com/KhronosGroup/DataFormat/issues/19
https://gitlab.freedesktop.org/pq/color-and-hdr/-/issues/12
https://github.com/dylanraga/win11hdr-srgb-to-gamma2.2-icm
2025-10-29 15:36:15 +01:00
Kacper Michajłow 233e89698e video/out/gpu/video: make the target-contrast limit higher
OLEDs report min luminance of 0.0002 nits, while we couldn't set this
with options due to limit. Set limit, so that we cannot exceed the hdr
black value used in libplacebo in worst case scenario of target peak 10
nits.
2025-10-15 22:00:19 +02:00
Kacper Michajłow b5c538a9c7 vo_gpu_next: add --hdr-reference-white 2025-10-10 06:12:35 +02:00
Kacper Michajłow 33f38423b3 vo_gpu_next: add --border-background=blur and --background-blur-radius 2025-10-06 16:27:50 +02:00
Kacper Michajłow 4338880560 various: add MP prefix for {PRINTF,SCANF}_ATTRIBUTE 2025-10-05 21:34:29 +02:00
Dudemanguy 2b74582fcb Revert "various: remove unneeded option path expansion handling"
Fixes #16573.

This reverts commit 137d5374bd.
2025-08-08 01:07:00 +00:00
nanahi 1d71523407 video/out: make ra_fns const 2025-08-05 03:10:33 +02:00
nanahi ce8032a8ca video/out/gpu/context: make context lists const 2025-08-05 03:10:33 +02:00
Dudemanguy 137d5374bd various: remove unneeded option path expansion handling
Same reasoning as the previous commits. This is now handled by the
option system so we can remove the redundancy.
2025-07-22 17:52:41 +00:00
nanahi 86e884bc4a video/out/gpu/video: fix target colorspace for redrawed frames
Fixes oversaturation when pause/redrawn with Windows HDR mode on.
2025-07-15 01:42:21 +02:00
Kacper Michajłow da538f3f29 d3d11_helpers: add caching of dxgi factory until it's current
Also cache last dxgi output, to avoid enumerating outputs, this is done
on every frame and we want to minimize impact of it.

While at it refactor and split loading libraries.
2025-07-11 21:53:58 +02:00
Kacper Michajłow 8b64a5d937 video/out/vulkan/context_win: add support for getting colorspace 2025-07-11 21:53:58 +02:00
Kacper Michajłow b352fcb90a d3d11_helpers: refactor target colorspace code
Instead of using IDXGISwapChain::GetContainingOutput create new DXGI
interface on each query. This may not be as efficient, but it solves the
issue where metadata is not updated after changing display settings.
DXGI caches parameters on swapchain creation and never updates it.

Also refactor it so it can be used from other contexts.

Note that DXGI is not D3D11, it's mixed in mpv code, may be cleaned in
the future.
2025-07-11 21:53:58 +02:00
Julian Orth 39c9d1acb4 video/out/vulkan/context_wayland: implement target_csp for wayland
This implements target_csp in terms of the preferred color description
of the video surface.
2025-07-11 21:53:58 +02:00
ourfor 7df09125f3 video/out/d3d11: add d3d11 composition mode support 2025-07-07 00:09:08 +02:00
nanahi 63defa7708 video/out/gpu/video: add options to control background tile appearance
Add options to control background tile colors and size and vo_gpu
implementation.
This allows a dark mode tile pattern.
2025-07-05 01:17:25 +02:00
Leo Izen 5870c95e89 filters: automatically flip video if displaymatrix indicates so
Currently we check AV_FRAME_DATA_DISPLAYMATRIX for its rotation factor
but not for its flip factor, which could happen with some input files.
This commit adds and autovflip filter, which is applied before the
autorotate filter to flip vertically before rotating. It also changes
the displaymatrix reading code to output to mp_image->params.vflip so
it can be autoinserted as necessary.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
2025-03-31 14:07:47 -04:00
Kacper Michajłow 4d08d4d51a vo_gpu: assume not ordered formats are reversed
This is the most common case and in practice we shouldn't use those
formats anyway.

Fixes reading image from bgra8 and bgrx8 formats for example.
2025-03-13 12:21:16 +01:00
Kacper Michajłow 1c49cfdb97 various: use mp_assert macro 2025-03-04 20:07:29 +01:00
Dudemanguy 5ae0e0ff9a opengl/context: remove remnants of the external swapchain API
With the previous commits, all usage of this is gone. We can remove it
for good.
2025-02-25 21:53:05 +00:00
Dudemanguy 8ddc5632fe vo: unify ra_gl_ctx_params and ra_vk_ctx_params into ra_ctx_params
These were separate for some reason which makes no sense and is really
annoying if you want to use something that's in the vk version and not
the gl one or vice versa. As a bonus, these now get to live right above
the ra_swapchain definition which is more convenient.
2025-02-23 18:42:16 +00:00
Kacper Michajłow d759e26fd0 libmpv: use correct header directory name
libmpv headers are installed to `mpv/`, so why are we pretending it is
`libmpv`?

Fixes documentation, libmpv meson dependency, tests.
2025-02-23 01:40:12 +01:00