summaryrefslogtreecommitdiffstats
path: root/video
Commit message (Collapse)AuthorAgeFilesLines
* vo_gpu_next: fix off by one in info_callbackKacper Michajłow2023-05-251-1/+1
| | | | Fixes invalid memory writes.
* vo_dmabuf_wayland: rewrite around wl_listDudemanguy2023-05-243-426/+245
| | | | | | | | | | | | | | | | | | | | | | | | | | | | vo_dmabuf_wayland worked by allocating entries to a pool and then having a lot of complex logic dealing with releasing buffers, pending entries, etc. along with some other not so nice things. Instead, we can rewrite this logic so that the wl_buffers created by the imported dmabuf is instead stored in a linked list, wl_list. We can simply append our buffers to the list when needed and destroy everything at the end. On every frame, we can check the ids of our surfaces and reuse existing buffers, so in practice there will only ever be a handful at a time. Some other small changes were made in an attempt to organize the vaapi/drmprime code a little better as well. An important change is to always enforce at least a minimum number of buffers. Certain formats would not make enough unique buffers, and this results in flickering/artifacts occuring. The old way to attempt to deal with this was to clear out all the existing buffers and remake them, but this gets complicated and also didn't always work. An easy solution to this is just create more buffers which appears to solve this problem. The actual number needed is not really based on anything solid, but 8 is a reasonable number to create for the lifetime of a file and it seems to do the trick. Additionally, seeking/loading new files can result in flicker artificts due to buffers being reused when they shouldn't. When that happens, we flip a bool so all the buffers get destroyed in draw_frame to avoid any visual glitches.
* vo_gpu_next: fix build on older libplaceboNiklas Haas2023-05-241-1/+0
| | | | | | Introduced by, of all things, a rebase... Fixes: a5da8b2c87dc3ace0038ccb5dc8f221df7f52206
* vo_gpu_next: update to new libplacebo gamut mapping APINiklas Haas2023-05-241-3/+29
| | | | | | | | 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.
* vo_gpu_next: remove --tone-mapping-crosstalkNiklas Haas2023-05-243-5/+1
| | | | Removed upstream, to be replaced by constant 0.04.
* context_drm_egl: check for non-existant drm in uninitMatthew Lindner2023-05-221-19/+24
| | | | | | | | Previously, if vo_drm_init failed at the start of drm_egl_init it caused a use-after-free in drm_egl_uninit when it tried to access the non-existant drm context. At that point vo_drm_uninit had already been called resulting in two different null pointer dereference. In this situation the DRM private context had also not been allocated.
* ra_d3d11: change how messages are ignored during texture size lookupKacper Michajłow2023-05-181-13/+9
| | | | | | | | | | | | Filtering globally D3D11_MESSAGE_ID_CREATETEXTURE2D_INVALIDDIMENSIONS is suboptimal, because can also hide other invalid usages. In the same time it is not enough, because not only this message is emitted, but also one about E_INVALIDARG. Just flush queue before and clear messages after to ignore this part of code. As a side note, I don't believe this texture size lookup is in fact useful, but since it is there and is relatively harmless, let's leave it as is.
* wayland: improve guessing when mpv is focusedDudemanguy2023-05-171-6/+16
| | | | | | | | | | The current implementation is order dependent and assumes that getting keyboard input happens before the toplevel is activated. This isn't necessarily the case and indeed mutter activates the toplevel first. Improve this by simply spinning off the check to a function and calling it in the three places where it would be needed: the toplevel configuration event, keyboard entering, and keyboard leaving. This fixes #11694.
* vo_gpu_next: allow to use ICC profile luminance valueKacper Michajłow2023-05-133-4/+16
| | | | | | Also while at it respect target-peak option when ICC profile is used. Fixes #11449
* mp_image: use the ffmpeg interlaced frame flags where availablePhilip Langdale2023-05-111-0/+14
| | | | | The old frame properties are deprecated and have been replaced by frame flags.
* player: use XDG_CACHE_HOME by defaultDudemanguy2023-05-097-10/+35
| | | | | | | | | | | | 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.
* wayland: add support for wl_surface.preferred_buffer_scaleSimon Ser2023-04-301-2/+49
| | | | | | | See [1] for the motivation. Very similar to the fractional scale, except it's in core and integer-only. [1]: https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/220
* vo_gpu_next: fixes to allow using dllimportKacper Michajłow2023-04-241-3/+3
| | | | | | | Address of variables can't be used for constant initialization in C language modes. See https://github.com/llvm/llvm-project/commit/0c43d8077e605ab78d85180f0dcaa4df1ae37607
* hwdec_drmprime: support rpi4_8 and rpi4_10 formatsEmperorPenguin182023-04-202-1/+14
| | | | | | | | | | | | HEVC hardware decode with drm wasn't working on the RPi 4. Mpv would report the image format (rpi4_8 for 8-bit and rpi4_10 for 10-bit) wasn't supported. The change to hwdec_drmprime.c identifies these two formats as NV12 because it functions exactly the same. The change to dmabuf_interop_gl.c adds support for P030 which rpi4_10 uses. These changes were tested on a Pi 4 with this fork of ffmpeg: https://github.com/jc-kynesim/rpi-ffmpeg. Signed-off-by: EmperorPenguin18 <60635017+EmperorPenguin18@users.noreply.github.com>
* wayland: correctly scale configure_boundsiczero2023-04-111-2/+2
|
* 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.
* mp_image: always add AV_FRAME_DATA_DOVI_METADATA when presentquietvoid2023-04-101-8/+2
| | | | | | | | As the Dolby Vision metadata is only supported for vo_gpu_next, the check whether to use the metadata is now handled by `mp_map_dovi_metadata_to_pl`. It doesn't hurt to keep the metadata in `mp_image`, and might be useful to library users.
* win32: follow Windows settings and update dark mode stateKacper Michajłow2023-04-041-0/+48
| | | | | | | | | | | | | | | | | Microsoft documented how to enable dark mode for title bar: https://learn.microsoft.com/windows/apps/desktop/modernize/apply-windows-themes https://learn.microsoft.com/windows/win32/api/dwmapi/ne-dwmapi-dwmwindowattribute Documentation says to set the DWMWA_USE_IMMERSIVE_DARK_MODE attribute to TRUE to honor dark mode for the window, FALSE to always use light mode. While in fact setting it to TRUE causes dark mode to be always enabled, regardless of the settings. Since it is quite unlikely that it will be fixed, just use UxTheme API to check if dark mode should be applied and while at it enable it fully. Ideally this function should only call the DwmSetWindowAttribute(), but it just doesn't work as documented. Fixes: #6901
* d3d11: retry device creation without debug, if SDK is not availableKacper Michajłow2023-04-021-1/+10
| | | | Fixes #11512
* context_angle: include eglext_angle.h explicitlyKacper Michajłow2023-03-301-0/+1
| | | | | Recent MSYS update switched to using vanilla EGL headers, which doesn't include eglext_angle.h implicitly.
* various: fix various typos in the code baseAlexander Seiler2023-03-283-11/+11
| | | | Signed-off-by: Alexander Seiler <seileralex@gmail.com>
* various: fix typosHarri Nieminen2023-03-2813-16/+16
| | | | Found by codespell
* vo_gpu_next: drop various PL_API_VER checksllyyr2023-03-262-46/+2
| | | | | We don't need these anymore now that we require PL_API_VER>=264 for building libplacebo-next
* vo_gpu_next: compatibility with libplacebo v6.265llyyr2023-03-131-1/+6
| | | | | | | | 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.
* wayland: make wayland-edge-pixels-pointer default to 16Dudemanguy2023-03-081-1/+1
| | | | | 10 is ludicrously small. How did no one on an CSD compositor complain about this?
* wayland: use correct x/y coordinates for the cursorDudemanguy2023-03-082-15/+11
| | | | | | | | | | | | | While adding fractional scale support, the coordinates for wayland changed to always include the scaling parameter. The pointer stuff actually did too. However, the check_for_resize function used the unscaled, local surface coordinates. Likely, it was neccesary at the time since wl->geometry used to report unscaled coordinates. In light of that, we can just simply use mouse_x/y instead for this function to make it work correctly with the right/bottom edges. mouse_unscaled becomes completely unneccesary, so just drop it. Some minor style changes included just because.
* wayland: fix client side resizeChristoph Heinrich2023-03-071-1/+1
| | | | | | | `xdg_toplevel_decoration` exists on SSD compositors independent of if there is a border or not, so resizing didn't work on those. Checking the border option makes more sense and also works on such compositors.
* vo_gpu_next: compatibility with PL_API_VER >= 254Niklas Haas2023-03-061-2/+12
| | | | This field was renamed/moved to a different params struct.
* vo_gpu_next: use inverse mapping functions to tag screenshotsLeo Izen2023-03-051-14/+5
| | | | | | 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.
* video/out/placebo/utils: add mappings from pl enums to mpv enumsLeo Izen2023-03-052-0/+72
| | | | | | | mp_trc_to_pl, mp_prim_to_pl, and mp_levels_to_pl have forward but not inverse mappings. This commit adds mp_trc_from_pl, mp_prim_from_pl, and mp_levels_from_pl inverse mapping functions, which just map the enums in the other direction.
* video: add missing libplacebo colorspace enumsLeo Izen2023-03-054-0/+53
| | | | | Add some missing libplacebo primaries and transfer enums to mpv's enum constant tables, and update the functions that convert between the two.
* mp_image: assert if src and dst are different in copy_attributesKacper Michajłow2023-03-051-0/+2
| | | | | It doesn't make sense to call this function on same image and the code is not safe to do so.
* mp_image: copy side data in mp_image_copy_attributesKacper Michajłow2023-03-051-0/+12
| | | | | This fixes HDR10 and HDR10+ metadata usage in vo_gpu_next when hwdec copy variant is used.
* vo: fix race condition with redraw requestsDudemanguy2023-03-021-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is a very subtle race in vo that can manifest itself on pause events. In the renderloop, render_frame, unsurprisingly, does the heavy lifting of actually queuing up and flipping the frames. This is called during normal playback. Sometimes various parts of the player can make a redraw request which will latter trigger another render of the frame later down in the loop (do_redraw). Because these requests can happen at essentially anytime, sometimes the redraw request will happen *before* do_redraw and it'll be caught in render_frame. When this happens, the existing render_frame run works perfectly fine as a redraw so it clears out the request which is sensible. Normally this is all locked of course, but there's one catch. render_frame has to unlock itself when propagating down into specific VOs/backends. That's what causes this bug. While render_frame is unlocked, other parts of the player can send redraw requests which will cause in->request_redraw to become true. The logic in the code always clears out this parameter after a successful render, but this isn't correct. When in->request_become becomes true in the middle of render_frame, there needs to be one more draw afterwards to reflect whatever actually changed (usually the OSD). Instead, this gets simply discarded. If you rapidly spam pause while rendering things to the OSD at the same time, it's possible to for the last render to be behind a frame and appear as if your osd event was ignored. Once you realize what is happening, the fix is quite simple. Just store the initial value of in->request_redraw before the unlock step. After we do the render step and unlock again, only set in->request_redraw to false if there was an initial redraw request. We just finished doing a redraw, so it is safe to clear. Otherwise, leave in->request_redraw alone. If it is initially false, then it will still be false and nothing changes. However if it updated to true in the middle of the rendering, this value is now preserved so we can go and call do_redraw later and show what that last frame was meant to be when you pause. One unfortunate thing about this design is that it is technically possible for other internal things in vo to update during that unlocked period. Hopefully, that doesn't actually happen and only redraw requests work like this. Fixes #8172 and #8350.
* test: integrate unittests with mesonDudemanguy2023-03-024-15/+21
| | | | | | | | | | | | 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.
* zimg: fix MP_CSP_PRIM_CIE_1931 mappingKacper Michajłow2023-03-021-1/+1
| | | | | MP_CSP_PRIM_CIE_1931 are RGB primaries, not ZIMG_PRIMARIES_ST428 which is XYZ.
* zimg: add ZIMG_TRANSFER_ST428 mappingKacper Michajłow2023-03-021-0/+4
|
* zimg: set correct primaries for XYZKacper Michajłow2023-03-021-1/+4
|
* sws_utils: hardcode output gamma and primaries for XYZKacper Michajłow2023-03-021-0/+10
|
* mp_image: fix XYZ gamma and primaries guessKacper Michajłow2023-03-021-12/+4
|
* vo_gpu: improve XYZ conversionKacper Michajłow2023-03-022-6/+14
| | | | Fixes #4925
* mp_image: be less agressive with clearing color informationKacper Michajłow2023-03-021-3/+8
|
* csputils: add MP_CSP_TRC_ST428 as defined in ST 428-1Kacper Michajłow2023-03-024-0/+15
|
* player: add --auto-window-resize optionDudemanguy2023-03-024-14/+23
| | | | | | | | | | | mpv's window resizing logic always automatically resized the window whenever the video resolution changed (i.e. advancing forward in a playlist). This simply introduces the option to make this behavior configurable. Every windowing backend would need to implement this behavior in their code since a reconfigure event must always be a resize. The params of the frame changed so you either have to resize the window to the new size of the params or make the params the same size as the window. This commit implements it for wayland, win32, and x11.
* ra: assert when using params with dimensionsDudemanguy2023-03-021-0/+10
| | | | | | | | | | This came up in #9828. According to the header comments, creating a 1D ra_tex requires height and depth to be set to 1. For a 2D texture, it requires depth be set to 1. There were a couple of spots in mpv's code where this wasn't being followed. Although there was no known bug from this, the rest of the code works like this so it was a good idea to go ahead and sync it up. As a followup, let's just add some simple asserts to ra.c to enforce this so it doesn't go unnoticed in the future.
* wayland: request frame callbacks on the topmost surfaceDaniel van Vugt2023-02-282-3/+5
| | | | | | | | | | | | Which is wl->video_surface for vo_dmabuf_wayland. Listening on wl->surface results in freezes if it is occluded and culled by the compositor. Which mutter does, and the wl_surface::frame spec warns about: > A server should avoid signaling the frame callbacks if the > surface is not visible in any way, e.g. the surface is off-screen, > or completely obscured by other opaque surfaces.
* wayland: deduplicate and cache detection of dmabuf-waylandDaniel van Vugt2023-02-282-4/+4
|
* wayland: use bool type for alpha framebuffer trackingRay Smith2023-02-285-5/+5
| | | | | | | | | ra_ctx_opts.want_alpha and vo_wayland_set_opaque_region's alpha argument are only used as bool but both are ints. Particularly for the function argument, passing a 0 or 1 is confusing - at first glance it looks like you're specifying an alpha value of 0 or 1. Since they're only used as bools, make them bools.
* vo_gpu: d3d11_helpers: prefer DXGI_SWAP_EFFECT_FLIP_DISCARD if possiblemsoxzw2023-02-281-2/+8
| | | | | | | Similar to libplacebo[1], DXGI_SWAP_EFFECT_FLIP_DISCARD is used instead of DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL starting with Windows 10. [1]: https://github.com/haasn/libplacebo/blob/master/src/d3d11/swapchain.c
* vf_gpu: initialize depth=1 on target 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.
* 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.
* various: fix warning -Wimplicit-const-int-float-conversionThomas Weißschuh2023-02-261-2/+2
|
* vo_gpu_next: fix warning -Wunused-functionThomas Weißschuh2023-02-261-0/+2
|
* vo_wayland: fix warning -Wvoid-pointer-to-enum-castThomas Weißschuh2023-02-261-1/+1
|
* vd_lavc: sort hwdecs without hwdevices last for autoprobingsfan52023-02-261-0/+3
| | | | | | For hwdecs without devices we can't get instant feedback during probing whether the hwdec can possibly work or not, so we definitely want to try them last. Independently this would also have solved the issue addressed by the previous commit.
* vd_lavc: prioritize mediacodec for hwdec autoprobesfan52023-02-261-0/+2
| | | | | | This fixes an issue where mpv would try mediacodec (which may not be available depending on Android version) and pick v4l2m2m next which ends up failing even though mediacodec-copy would have been available.
* video: make csp option definitions privateThomas Weißschuh2023-02-242-22/+19
|
* video: make csp equalizer params floatThomas Weißschuh2023-02-242-11/+11
| | | | | | This allows more precise adjustments. Fixes #11316
* vo_gpu: fix newline in log messagesfan52023-02-241-1/+1
|
* vo_gpu_next: fix color space hint with target peak overrideKacper Michajłow2023-02-231-1/+4
| | | | Fixes: #11339
* options: remove explicit initialization of integers to 0Christoph Heinrich2023-02-213-12/+1
|
* options: transition commands from OPT_FLAG to OPT_BOOLChristoph Heinrich2023-02-216-3/+5
|
* options: transition options from OPT_FLAG to OPT_BOOLChristoph Heinrich2023-02-2141-198/+185
| | | | | | 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.
* various: drop unused #include "config.h"Thomas Weißschuh2023-02-2032-48/+0
| | | | | | Most sources don't need config.h. The inclusion only leads to lots of unneeded recompilation if the configuration is changed.
* Vulkan: add configure check for VK_KHR_display extensionrcombs2023-02-201-0/+2
| | | | This allows building directly against ICDs that don't implement this extension.
* vo_gpu_next: add --tone-mapping-visualizeNiklas Haas2023-02-193-0/+5
|
* vo_gpu_next: parse Dolby Vision metadata for dynamic scene brightnessquietvoid