summaryrefslogtreecommitdiffstats
path: root/video/out/gpu/video.c
Commit message (Collapse)AuthorAgeFilesLines
* vo_gpu: support video-target-paramsnanahi2024-03-271-0/+21
|
* vo_gpu: fix broken chroma plane for rotated semi-planar formatsnanahi2024-03-111-0/+19
| | | | | | | | | | | | | | | | | For image formats with 2 or more chroma planes such as YU12, there is a plane merging pass for these planes calling finish_pass_tex which does a format conversion. After this conversion, the cscale shader afterwards works properly. However, for image formats with only 1 chroma plane (semi-planar formats), including NV12 and P010, this merging pass is never called, which breaks the cscale shader afterwards if the video is rotated with subsampled chroma. Fix this by adding an explicit conversion pass if this situation is detected after the pre-scale hooks, so if there are shaders hooking on CHROMA (like the deband filter) and the conversion is done by pass_hook already, this conversion won't be called.
* mp_image: add mp_image_params_static_equal for finer comparisionKacper Michajłow2024-03-091-2/+2
| | | | In case of dynamic HDR metadata is present.
* various: avoid function pointer castsKacper Michajłow2024-02-281-8/+3
| | | | | | | | | | | | | The opt validator functions are casted to generic validator, which has erased type for value. Calling function by pointer of different definition is an UB. Avoid that by generating wrapper function that does proper argument type conversion and calls validator function. Type erased functions have mangled type in the name. Fixes UBSAN failures on Clang 17, which enabled fsanitize=function by default.
* vo_gpu: pre-multiply alpha when dealing with background colorsDudemanguy2024-02-261-0/+4
| | | | This was simply wrong for who knows how long.
* vo_gpu/vo_gpu_next: rework --alpha into --background optionDudemanguy2024-02-261-16/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* player: rename --background to --background-colorDudemanguy2024-02-261-5/+5
| | | | | This better represents what it actually does. --background will be used for another, related option in the next commit.
* vo_gpu: use fbo texture height for fragment coordinate calculationnanahi2024-02-241-2/+2
| | | | | | | Previous fix only worked when the video output doesn't have vertical black bars. This fixes the cases like fullscreen, video-zoom etc. Fixes: https://github.com/mpv-player/mpv/pull/13528
* vo_gpu: fix fragment coordinate calculation when ditheringnanahi2024-02-221-3/+5
| | | | | | | | | | | | When doing the dithering pass, the fragment coordinate is queried, but doesn't take the fbo texture flipped property into account. This results in different dithering patterns when toggling between fbo flipped and non-flipped state. This can be reproduced with --vo=gpu --gpu-api=opengl and easily seen with --dither-depth=1 when toggling between playing and pausing. Fix this by flipping the fragment y coordinate if the fbo is flipped when calculating dithering coordinate.
* vo_gpu: fix fragment coordinate calculation when drawing checkerboardnanahi2024-02-221-1/+3
| | | | | | | | | | | | | | When redrawing cached frames while the fbo texture is flipped, the texture after drawing to screen pass will be flipped when blitting. However, when rendering the checkerboard, the fragment coordinate doesn't take this into account, so the coordinate before flipping is used, resulting in different checkerboard location when toggling between flipped and non-flipped state. This can be reproduced with --vo=gpu and --gpu-api=opengl: the checkerboard patterns when playing and pausing are different (vertically flipped). Fix this by flipping the fragment y coordinate if the fbo is flipped when calculating checkerboard coordinate.
* player: ensure runtime updates of certain rendering optionsDudemanguy2024-02-051-0/+1
| | | | | | | | | | When adding things like brightness or gamma, the video obviously needs a redraw if paused. This happened to work in the normal case because the OSD notification triggered a redraw, but if you use no-osd the picture won't change. Fix this by adding another option flag, UPDATE_VIDEO, and simply signalling we want a redraw. This gets handled along with the normal osd redrawing check in the playloop so something like "no-osd add gamma 1" actually works.
* csputils: replace more primitives with pl_Kacper Michajłow2024-01-221-8/+8
| | | | | We can go deeper, but need to stop somewhere to not reimplement vo_gpu using libplacebo...
* csputils: replace mp_chroma_location with pl_chroma_locationKacper Michajłow2024-01-221-5/+5
|
* csputils: replace mp_alpha_type with pl_alpha_modeKacper Michajłow2024-01-221-1/+1
|
* csputils: replace mp_colorspace with pl_color_spaceKacper Michajłow2024-01-221-70/+62
|
* vo_gpu: fix ra_fbo stack-use-after-scopeDudemanguy2023-11-281-9/+6
| | | | | | | | 281b1d89994e3e3a9950d32fc451dff990c2320d introduced a stack use after scope because dest_fbo can be reassigned a new pointer and then be used by pass_draw_to_screen outside of that scope where the pointer is no longer valid. Fix this by rearranging the variables so the assignment is done in the same scope as the pass_draw_to_screen call instead.
* vo_gpu: don't pass gl_user_shader_hook by valueKacper Michajłow2023-11-281-9/+7
|
* vo_gpu: don't pass mp_pass_perf by valueKacper Michajłow2023-11-281-8/+14
|
* vo_gpu: don't pass ra_fbo by valueKacper Michajłow2023-11-281-27/+27
| | | | Make it easier on compiler, no need to alloca and copy things around.
* various: add some missing error checksKacper Michajłow2023-11-181-2/+3
|
* vo_gpu_next: add --target-gamut optionNiklas Haas2023-11-081-0/+1
| | | | Fixes: https://github.com/mpv-player/mpv/issues/12777
* vo_gpu: apply ICC profile and dithering only to window screenshotssfan52023-11-071-9/+12
|
* ALL: use pl_hdr_metadata and nuke sig_peakKacper Michajłow2023-11-051-8/+8
| | | | | | | | This commit replaces all uses of sig_peak and maps all HDR metadata. Form notable changes mixed usage of maxCLL and max_luma is resolved and not always max_luma is used which makes vo_gpu and vo_gpu_next behave the same way.
* vo_gpu: remove --scaler-lut-sizeNiklas Haas2023-09-251-8/+6
| | | | | | | Pointless bloat option, hard-coded as 256 now in libplacebo and no reason not to also hard-code in mpv. See-Also: haasn/libplacebo@64d7c5aab06766a9492d3cfffd35333792052cd9
* vo_gpu: remove --scale-cutoff etcNiklas Haas2023-09-251-9/+4
| | | | | | | Pointless bloat option, hard-coded as 1e-3 now in libplacebo and no reason not to also hard-code in mpv. See-Also: haasn/libplacebo@64d7c5aab06766a9492d3cfffd35333792052cd9
* video/out/gpu: replace mp_read_option_raw callDudemanguy2023-09-221-3/+3
|
* vo_gpu: don't override scaler options with default onesKacper Michajłow2023-09-211-2/+10
| | | | | | | There was assumption in the code that default settings are compatible with dumb mode and are only one that should be used in this case. Force bilinear if dumb mode is enabled.
* options: remove ancient option fallbacks/deprecationDudemanguy2023-09-211-13/+0
| | | | | | | | | | | | | We've got an ungodly amount of OPT_REPLACED and OPT_REMOVED sitting around in the code. This is harmless, but the vast majority of these are ancient. 26f4f18c0629998a9b91e94722d166866d8b80a3 is the last commit that touched the majority of these and of course that only changed how options were declared so all of this stuff was deprecated even before that. No use in keeping these, so just delete them all. As an aside, there was actually a cocoa_opts but it had only a single option which was replaced by something else and empty otherwise. So that entire thing was just simply removed. OPT_REPLACED/OPT_REMOVED declarations that were added in 0.35 or later were kept as is.
* vo_gpu: match libplacebo peak detection defaultsNiklas Haas2023-09-201-3/+3
| | | | | | | | | This probably makes `vo_gpu` tone mapping worse, or something, but who cares. The status quo for a while now has been to use `vo_gpu_next` if you care about HDR rendering at all. See-Also: haasn/libplacebo@ec60dd156b82753a2e2d8a399899244605f4d1bf See-Also: haasn/libplacebo@0903cbd05d7fc0391cbd99954924a39b855c8a1b
* vo_gpu: default to dscale=hermiteNiklas Haas2023-09-201-1/+1
| | | | | | | | | | This new filter is slightly sharper, and significantly faster, than mitchell. It also tends to preserve detail better. All in all, there is no reason not to use it by default, especially from a performance PoV. (In vo_gpu_next, hermite is implemented efficiently using hardware accelerated bilinear interpolation) See-Also: https://code.videolan.org/videolan/libplacebo/-/commit/75b3947b2c07803456483ec6976c037bad91b5dd
* builtin.conf: modernize internal profilesKacper Michajłow2023-09-191-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The goal is to provide simple to understand quality/performance level profiles for the users. Instead of default and gpu-hq profile. There main profiles were added: - fast: can run on any hardware - default: balanced profile between quality and performance - high-quality: out of the box high quality experience. Intended mostly for dGPU. Summary of three profiles, including default one: [fast] scale=bilinear cscale=bilinear (implicit) dscale=bilinear dither=no correct-downscaling=no linear-downscaling=no sigmoid-upscaling=no hdr-compute-peak=no [default] (implicit mpv defaults) scale=lanczos cscale=lanczos dscale=mitchell dither-depth=auto correct-downscaling=yes linear-downscaling=yes sigmoid-upscaling=yes hdr-compute-peak=yes [high-quality] (inherits default options) scale=ewa_lanczossharp cscale=ewa_lanczossharp (implicit) hdr-peak-percentile=99.995 hdr-contrast-recovery=0.30 allow-delayed-peak-detect=no deband=yes scaler-lut-size=8
* vo: change tscale to oversample by defaultKacper Michajłow2023-09-191-2/+1
| | | | Keep it sharp, let users opt-in more blurry result.
* vo: make cscale follow scale by defaultKacper Michajłow2023-09-191-1/+16
|
* vo: enable correct-downscaling, linear-downscaling, sigmoid-upscalingKacper Michajłow2023-09-191-0/+3
|
* vo_gpu: remove --scale-wblur etcNiklas Haas2023-09-161-1/+1
| | | | | | | | | | No need for this since it's entirely redundant with just changing the filter radius directly. In fact, that's the whole *point* of the filter radius - it does not modify the filter, it modifies the scaling of the window. Of course, this does not work for non-resizable kernels. But, really, who cares?
* vo_gpu: slight bump to hard-coded option size limitsNiklas Haas2023-09-161-3/+3
| | | | ewa_lanczos4sharpest, for example, overflows this buffer.
* vo_gpu: support crop in gl_video_screenshotKacper Michajłow2023-09-091-3/+13
|
* vo_gpu: remove --tone-mapping-modeNiklas Haas2023-09-011-18/+1
| | | | | | | | | `--vo=gpu-next` no longer uses this option, being replaced entirely by a luminance-based approach internally. And even for `--vo=gpu`, the values other than 'hybrid' are universally inferior in quality. In the interest of gradually reducing the amount of option bloat here, remove this mostly-pointless option.
* vo_gpu: allow --hdr-peak-decay-rate=0.0Niklas Haas2023-08-181-1/+1
| | | | | | | | | | | | | | This completely disables all smoothing. Despite what the manual claims, a decay rate of 1.0 does *not*. It's worth pointing out that this depends on the following commit to work properly in --vo=gpu-next, but I don't think working around such a minor detail is worth the trouble, considering people building nightly mpv are probably also building nightly libplacebo it should just work (tm). See-Also: https://github.com/haasn/libplacebo/commit/1c464baaf4c6228dcfac87f19db1dafc22e328c8 See-Also: https://github.com/haasn/libplacebo/commit/83af2d4ebd5086a56f7b1a2f86628ada3612ee7c
* vo_gpu/vo_gpu_next: fix setting an empty dscaleDudemanguy2023-08-051-0/+6
| | | | | | | | | 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.
* vo_gpu_next: add --hdr-peak-percentileNiklas Haas2023-08-041-0/+2
|
* vo_gpu_next: add --hdr-contrast-recovery/smoothnessNiklas Haas2023-07-181-0/+5
| | | | New upstream feature. Disabled by default.
* vo_gpu_next: add --target-contrast optionKacper Michajłow2023-07-171-0/+2
| | | | For better control over target display levels.
* vo_gpu/vo_gpu_next: enable gpu shader and icc cache by defaultDudemanguy2023-07-041-0/+1
| | | | | | | | | | | 4502522a7aee093c923e79a65e4684ea2634af30 changed the way mpv handled and saved cached files. In particular, it made a separate boolean option for actually enabling cache and left the *-dir options as purely just a path (i.e. having a dir set didn't mean you save cache). This technically regressed people's configs, so let's just turn the cache on by default. Linux users already expect random stuff in ~/.cache and well everyone else can just live with some files possibly appearing in their config directory.
* vo_gpu_next: add missing --gamut-mapping-mode optionsNiklas Haas2023-06-211-2/+7
| | | | | Adds the missing upstream values that were exposed by the new gamut mapping API.
* vo: hwdec: Pass the ra_ctx to hwdecs instead of just the raPhilip Langdale2023-05-281-4/+5
| | | | | | 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.
* vo: make mp_frame_perf thread safeKacper Michajłow2023-05-251-1/+3
| | | | | | | 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.
* vo_gpu_next: remove --tone-mapping-crosstalkNiklas Haas2023-05-241-3/+1
| | | | Removed upstream, to be replaced by constant 0.04.
* player: use XDG_CACHE_HOME by defaultDudemanguy2023-05-091-1/+3
| | | | | | | | | | | | 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.
* video/out/gpu: Fix compilation warning of out of bound accessMika Kuoppala2023-04-101-7/+9
| | | | | | Make the index into the arrays in copy_image() unsigned to make compiler trust that we dont access out of bounds.
* test: integrate unittests with mesonDudemanguy2023-03-021-15/+0
| | | | | | | | | | | | This reworks all of mpv's unit tests so they are compiled as separate executables (optional) and run via meson test. Because most of the tests are dependant on mpv's internals, existing compiled objects are leveraged to create static libs and used when necessary. As an aside, a function was moved into video/out/gpu/utils for sanity's sake (otherwise most of vo would have been needed). As a plus, meson multithreads running tests automatically and also the output no longer pollutes the source directory. There are tests that can break due to ffmpeg changes, so they require a specific minimum libavutil version to be built.
* vo_gpu: improve XYZ conversionKacper Michajłow2023-03-021-1/+8
| | | | Fixes #4925
* video: initialize depth=1 on screenshot texturesaverne2023-02-281-0/+1
| | | | | According to internal documentation, 2D textures should have d=1. This fixes the correctness of the API usage, not any bug.
* vo_gpu: fix newline in log messagesfan52023-02-241-1/+1
|
* options: transition commands from OPT_FLAG to OPT_BOOLChristoph Heinrich2023-02-211-1/+0
|
* options: transition options from OPT_FLAG to OPT_BOOLChristoph Heinrich2023-02-211-16/+17
| | | | | | c78482045444c488bb7948305d583a55d17cd236 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.
* vo_gpu_next: add --tone-mapping-visualizeNiklas Haas2023-02-191-0/+1
|
* vo_gpu_next: expose --tone-mapping=st2094-40 and st2094-10Niklas Haas2023-02-131-1/+3
|
* vo_gpu: implement VO_DR_FLAG_HOST_CACHEDsfan52023-01-231-0/+7
| | | | | | | | For OpenGL, this is based on simply comparing GL_VENDOR strings against a list of allowed vendors. Co-authored-by: Nicolas F. <ovdev@fratti.ch> Co-authored-by: Niklas Haas <git@haasn.dev>
* vo: add `int flags` to the get_image signatureNiklas Haas2023-01-231-1/+1
| | | | | This is a huge disgusting mess to thread through everywhere. Maybe I'm stupid for attempting to solve the problem this way.
* various: replace abort() with MP_ASSERT_UNREACHABLE() where appropriatesfan52023-01-121-2/+1
| | | | | | | | In debug mode the macro causes an assertion failure. In release mode it works differently and tells the compiler that it can assume the codepath will never execute. For this reason I was conversative in replacing it, e.g. in mpv-internal code that exhausts all valid values of an enum or when a condition is clear from directly preceding code.
* vo_gpu_next: add tunable shader parametersNiklas Haas2022-11-111-0/+1
| | | | | | | | | | | This is a very simple but easy way of doing it. Ideally, it would be nice if we could also add some sort of introspection about shader parameters at runtime, ideally exposing the entire list of parameters as a custom property dict. But that is a lot of effort for dubious gain. It's worth noting that, as currently implemented, re-setting `glsl-shader-opts` to a new value doesn't reset back previously mutated values to their defaults.
* vo_gpu: mark --gamma-factor and --gamma-auto with deprecation warningssfan52022-11-101-2/+4
| | | | This was forgotten in commit 2207236aaae54f32c1861c6fd77219e28139dc78.
* various: fix typosCœur2022-04-251-1/+1
|
* vo_gpu[_next]: hwdec: fix logging regression when probingPhilip Langdale2022-03-211-4/+3
| | | | | | | | | When I introduced the concept of lazy loading of hwdecs by img format, I did not propagate the probing flag correctly, leading to the new normal loading path not runnng with probing set, meaning that any errors would show up, creating unnecessary noise. This change fixes this regression.
* vo_gpu: mov