summaryrefslogtreecommitdiffstats
path: root/video
Commit message (Collapse)AuthorAgeFilesLines
* vo_gpu_next: tag screenshots with correct colorspaceNiklas Haas2023-02-131-0/+15
| | | | | | | | | 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.
* vo_gpu_next: only apply target options in window screenshot modeNiklas Haas2023-02-131-1/+5
| | | | | | | | | | 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.
* vo_gpu_next: be explicit about screenshot reprNiklas Haas2023-02-131-0/+1
| | | | | | Screenshots are currently always RGB. Subject to change, but needs to be communicated clearly if changed. This commit is not a functional change, it's merely for code clarity.
* vo_gpu_next: expose --tone-mapping=st2094-40 and st2094-10Niklas Haas2023-02-133-1/+9
|
* vo_gpu_next: support mapping HDR10+ dynamic metadataNiklas Haas2023-02-131-0/+19
| | | | | | | Based on the new upstream helper function `pl_map_hdr_metadata` and the existing AV_FRAME_DATA_DYNAMIC_HDR_PLUS. This allows us to use SMPTE 2094-40 dynamic HDR tonemapping in mpv, albeit with the limitation of requiring `--tone-mapping=auto` in order to pick this curve upstream.
* vf_sub: undeprecateDudemanguy2023-02-111-2/+0
| | | | | | | | | | 3a9e661e929c34d25810fa903abbd9961f73ecef officially made this video filter deprecated roughly 6 years ago. Every other video filter in that commit has actually been removed since then except for vf_sub. ffmpeg does have its own subtitles filter, but it doesn't have the same control over scale like vf_sub does. That's probably why wm4 never actually removed it. Let's stop scaring users with a warning since this filter probably won't ever get removed. Closes #9254.
* vo_dmabuf_wayland: reject hw formats not supported by compositorAaron Boxer2023-02-1110-33/+78
|
* video/image_writer: change screenshot-tag-colorspace default to yesLeo Izen2023-02-091-1/+1
| | | | | | With significant improvements to the color tagging support in various screenshot formats, e.g. cICP in FFmpeg, and JPEG XL's generally robust color support, it's safe to default this to yes.
* vo_dmabuf_wayland: add purgatory list to buffer pool to avoid memory leaksAaron Boxer2023-02-053-65/+114
|
* vo_dmabuf_wayland: ensure buffer pool is cleaned at start of uninitAaron Boxer2023-02-051-1/+1
|
* vo_dmabuf_wayland: simplify buffer pool resetAaron Boxer2023-02-051-12/+9
|
* vo_dmabuf_wayland: only resize when a new frame is about to be drawnAaron Boxer2023-02-051-4/+12
|
* image_pool: properly free framesThomas Weißschuh2023-02-031-2/+2
| | | | av_frame_unref() only frees the buffers, not the frame data itself.
* sws_utils: add check for HAVE_ZIMG to suppress warningsKacper Michajłow2023-02-021-0/+5
|
* vo_gpu_next: add check for PL_HAVE_LCMSKacper Michajłow2023-02-021-1/+1
|
* hwdec_cuda: fix enum type for semaphoreKacper Michajłow2023-02-021-4/+4
|
* vo_d3d11: do not call MAKEINTRESOURCEW twiceKacper Michajłow2023-02-021-1/+1
|
* osdep: add MP_FALLTHROUGHKacper Michajłow2023-02-023-3/+3
|
* libplacebo: fix enum type castKacper Michajłow2023-02-021-4/+4
|
* video/image_writer: avoid stripping colorspace info when writing imageLeo Izen2023-01-311-0/+1
| | | | | | | | | | | | | Writing an image either with vo_image or with a screenshot will strip the colorspace info because it allocates a new mp_image that contains the same data as the old image after calling mp_image_params_guess_csp. However, mp_image_params_guess_csp cannot always guess the appropriate colorspace, so it picks a "sane default." Since this function also changes parameters so the space always makes sense, this extra info isn't harmful and allows screenshots and vo_image outs to be properly tagged with the correct colorspace. Fixes #10988.
* hwdec/vaapi: zero-initialize VADRMPRIMESurfaceDescriptorDudemanguy2023-01-301-1/+1
| | | | | Otherwise, desc can contain garbage values and segfault trying to close file descriptors that aren't actually there. Fixes #11239.
* vo_lavc: set frame rate on encoder; fixes #11215rcombs2023-01-291-0/+11
| | | | ffmpeg was internally defaulting to 24000fps, which resulted in encoders selecting inappropriate levels and making poor ratecontrol decisions.
* wayland: add auto choice to wayland-configure-boundsDudemanguy2023-01-301-2/+12
| | | | | | | | | | | Previously, this defaulted to yes and configure-bounds from the compositor would always apply. In the case where the user explicitly set autofit or geometry, this could be confusing because configure-bounds would take precedence over it. Instead, let's add an auto choice and make that the default. If we detect that the option is on auto and that there is autofit/geometry being set, then ignore the event. This should be more intuitive since someone who bothers to explicitly set mpv's geometry would naturally expect that geometry to actually apply.
* wayland: handle runtime hidpi-window-scale changes correctlyDudemanguy2023-01-301-6/+2
| | | | | | | | | | | Semi-regression although this option never really did what the manual said until recently. In the past, this option also controlled whether or not mpv set the wayland buffer_scale to the value of the wl_output or force it 1. This had varying effects depending on the exact compositor configuration. That logic has now all been removed and this option now only controls whether or not to scale the window with the hidpi scale factor we get from the compositor. i.e. it actually does what the manual says now.
* wayland: unbreak runtime geometry/autofit changesDudemanguy2023-01-301-12/+15
| | | | | | | | Regressed from 879824a47f50f7e93f85992c92d03f37129605f4. The geometry needs to be explictly recalculated now. Change up this function a little bit also give it the ability to directly perform a resize after the fact. This is a common workflow and we'll be using it in the next commit.
* hwdec_vaapi: close file descriptors even if surface export failsAaron Boxer2023-01-281-0/+7
| | | | otherwise they can leak
* vo_dmabuf_wayland: close file handles when surface export failsAaron Boxer2023-01-281-2/+9
| | | | file handles may still be opened despite failure
* vo_dmabuf_wayland: plug leaking file descriptor from solid buffer poolAaron Boxer2023-01-281-0/+1
|
* vo_opengl/angle_dynamic: simplify symbol renaming to make it more ↵Kacper Michajłow2023-01-282-8/+5
| | | | straightforward
* x11: remove PresentNotifyMSC from egl/glx/vulkan to fix xpresent timingSultan Alsawaf2023-01-253-9/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PresentNotifyMSC turns out to be not only redundant, but also harmful with mesa-backed egl/glx/vulkan VOs because for all of them, mesa uses PresentPixmap behind the scenes when DRI3 is available, which already spawns a PresentCompleteNotify event when the buffer swap actually finishes. This is important because without using the timing information from these PresentCompleteKindPixmap events, there's no way for mpv to know exactly when a frame becomes visible on the display. By using PresentNotifyMSC in conjunction with DRI3-enabled mesa, two problems are created: 1. mpv assumes that a vblank won't elapse (i.e., it assumes the current MSC won't change) between the time when mesa enqueues the buffer swap and the time when mpv calls PresentNotifyMSC to ask xorg for a notification at the next MSC, relative to the current MSC at the time that xorg reads it for the PresentNotifyMSC call. This means that mpv could get a notification one or more vblanks later than it expects, since the intention here is for mpv to get a notification at the MSC that the buffer swap completes. 2. mpv assumes that a buffer swap always takes one vblank to complete, which isn't always true. A buffer swap (i.e., a page flip) could take longer than that depending on hardware conditions (if the GPU is running slowly or needs to exit a low-power state), scheduling delays (under heavy system or GPU load), or unfortunate timing (if the raster scan line happens to be at one of the last few rows of pixels and a vblank elapses just before the buffer swap is enqueued). This causes mpv to have a faulty assumption of when frames become visible. Since mpv already receives the PresentCompleteNotify events generated by mesa's buffer swaps under the hood, the PresentNotifyMSC usage is unneeded and just throws a wrench in mpv's vsync timing when xpresent is enabled. Simply removing the PresentNotifyMSC usage from the egl, glx, and vulkan VOs fixes the xpresent vsync timing.
* wayland: add wp-fractional-scale-v1 supportDudemanguy2023-01-245-17/+113
| | | | | | | | | | | | | This protocol is pretty important since it finally lets us solve the longstanding issue of fractional scaling in wayland (no more mpv doing rendering over the target resolution and then being scaled down). This protocol also can completely replace the buffer_scale usage that we are currently using for integer scaling so hopefully this can be removed sometime in the future. Note that vo_dmabuf_wayland is omitted from the fractional scale handling because we want the compositor to handle all the scaling for that VO. Fixes #9443.
* wayland: rewrite geometry and scaling handlingDudemanguy2023-01-246-39/+31
| | | | | | | | | This is in preparation for fractional scaling support. Basically, redo all the coordinates in wayland so that wl->geometry is equal exactly to what is being put out to the screen (no extra wl->scaling multiplication required). The wl->vdparams variable is also eliminated for simplicity. This changes mpv's behavior on wayland with hidpi scaling but that will be addressed in more detail with the next commit.
* vo_gpu: implement VO_DR_FLAG_HOST_CACHEDsfan52023-01-236-0/+30
| | | | | | | | 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_gpu_next: implement VO_DR_FLAG_HOST_CACHEDNiklas Haas2023-01-231-0/+5
| | | | For sufficiently new versions of libplacebo.
* vd_lavc: add "auto" choice for vd-lavc-drsfan52023-01-232-4/+12
| | | | | | | | | | | | --vd-lavc-dr defaulted to "yes", which caused issues on certain hardware. Instead of disabling it, add a new "auto" value and make it the default. The "auto" choice will enable DR only when we can request host-cached buffers (as signalled by the new VO_DR_FLAG_HOST_CACHED). 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-2312-29/+34
| | | | | This is a huge disgusting mess to thread through everywhere. Maybe I'm stupid for attempting to solve the problem this way.
* drm: rewrite based around vo_drm_stateDudemanguy2023-01-2110-1168/+951
| | | | | | | | | | | A longstanding pain point of the drm VOs is the relative lack of state sharing. While drm_common does provide some sharing, it's far less than other platforms like x11 or wayland. What we do here is essentially copy them by creating a new vo_drm_state struct and using it in vo_drm and context_drm_egl. Much of the functionality that was essentially duplicated in both VOs/contexts is now reduced simple functions in drm_common. The usage of the term 'kms' was also mostly eliminated since this is libdrm nowadays from a userspace perspective.
* mp_image: fix XYZ primaries defaultNiklas Haas2023-01-211-4/+4
| | | | | This was incorrectly set to BT.2020, when it should be DCI-P3 for pretty much all real-world XYZ content (which is digital cinema content).
* hwdec_cuda: drop support for PL_HANDLE_WIN32_KMTNiklas Haas2023-01-172-35/+17
| | | | | | | | | | | | | | | This handle type was only needed for backwards compatibility with windows 7. Dropping it allows us to simplify the code: there is no longer a need for runtime checks, as the handle type can now be statically assigned based on the platform. The motivating usecase here, apart from code simplification, is a desired switch to timeline semaphores, which (in the CUDA API) only supports the non-KMT win32 handles. It's worth pointing out that we need no runtime check for IsWindows8OrGreater(), because the `export_caps.sync` check will already fail on versions of windows not supporting PL_HANDLE_WIN32.
* wayland: only warn when actually missing idle inhibit supportThomas Weißschuh2023-01-161-5/+6
|
* vo: make driver list staticThomas Weißschuh2023-01-161-1/+1
|
* vo: remove trailing NULL element from driver arrayThomas Weißschuh2023-01-161-3/+2
|
* wayland: store presentation feedbacks in a poolDudemanguy2023-01-132-20/+65
| | | | | | | | | Officially, the most cursed part of the wayland code in mpv (third or fourth try now?) This time, let's allocate a pool during init (arbitrarily set to the maximum swapchain length mpv allows, 8; don't even know if this actually works in wayland). Then we add/remove feedbacks from the pool during the lifecycle of the VO, and clean it up all at the end. Hopefully, this does the trick for good this time.
* Revert "wayland: dispatch and wait for compositor events in uninit"Dudemanguy2023-01-132-22/+27
| | | | | | | | | | | This ended up being a bad idea. The problem is that it introduces ordering when destroying events (something we weren't worried about before) and Lynne pointed out a problem with the callback not also being destroyed before the surface in IRC. Just undo this and go with a different approach (next commit). P.S. the wayland_dispatch_events name change is kept though because I like that better. This reverts commit aa8ddfcdf30c4ffb38f3ec5d6663bbabf0b7b4df.
* various: replace abort() with MP_ASSERT_UNREACHABLE() where appropriatesfan52023-01-129-20/+19
| | | | | | | | 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.
* various: replace if + abort() with MP_HANDLE_OOM()sfan52023-01-129-28/+14
| | | | | MP_HANDLE_OOM also aborts but calls assert() first, which will result in an useful message if compiled in debug mode.
* {video,audio}: adjust unsafe strncpy usagessfan52023-01-121-2/+2
|
* video/x11: replace sprintf usagesfan52023-01-121-1/+1
|
* video: replace sprintf usagesfan52023-01-122-2/+2
|
* ra_d3d11: fix incorrect typesfan52023-01-121-1/+1
| | | | As it happens, `SIZE_T` and `size_t` are not the same length on 32-bit Windows
* vo_dmabuf_wayland: drop support for linux-dmabuf-v2Dudemanguy2023-01-123-35/+2
| | | | | | | | | The only real reason this was ever supported is because it was dramatically simpler than v4, so it was put in as an initial implementation. Later, v4 support was added and we left v2 for compatibility, but let's just drop it. Compositors all use v4 nowadays, and v2 is significantly limited (no modifier support for example). It's better to just remove this dead code for simplicity.
* vo_dmabuf_wayland: support panscan and panningAaron Boxer2023-01-111-1/+38
|
* vo_wlshm: properly support video panscanDudemanguy2023-01-091-0/+6
| | | | | Turns out it was already doing this under the hood the entire time. The only catch is that the vo just needed a resize.
* wayland: make vo_wayland_reconfig a boolDudemanguy2023-01-084-10/+4
| | | | | | This was already returning true/false but the type was int. Also simplify a few places in the wayland contexts where we can just return the value of this function instead of doing redundant checks.
* wayland: cleanup on vo_wayland_init errorDudemanguy2023-01-083-13/+12
| | | | | | Instead of just returning true/false, it's better to have this function cleanup itself. We can eliminate some redundant uninit calls elsewhere in the code as well.
* vo: change vo_platform_init to boolDudemanguy2023-01-088-15/+14
| | | | | | | | There's several functions that are used for initializing mpv on a certain platform (x11, wayland, etc.). These currently are all int, but they actually return 1 and 0 like a boolean. This gets a bit confusing because actual vo preinit functions return 0 and -1 instead. Just make these all bool instead and return true/false to make it clearer.
* vo_wlshm: cleanup on failureDudemanguy2023-01-081-15/+18
| | | | | If failure occurs during preinit, vo_wlshm should goto an error and cleaup itself like the other VOs.
* vo_dmabuf_wayland: goto err instead of returningDudemanguy2023-01-081-11/+11
| | | | | Returning early is clearly wrong. It should use to goto to cleanup after itself. Also renamed from error_out to err for purely comestic reasons.
* vulkan: fix build error for 32bit builds with clangChristoph Reiter2023-01-081-1/+1
| | | | | | | | | | | vk->surface is a handle and not a pointer, so assign VK_NULL_HANDLE. This fixes the following build error on 32bit Windows when using clang for example, which errors out when assigning a 32bit pointer to a 64bit integer: ../mpv-0.35.0/video/out/vulkan/utils.c:37:21: error: incompatible pointer to integer conversion assigning to 'VkSurfaceKHR' (aka 'unsigned long long') from 'void *' [-Wint-conversion] vk->surface = NULL; ^ ~~~~
* wayland: dispatch and wait for compositor events in uninitDudemanguy2023-01-032-30/+25
| | | | | | | | | | Similar to some other issues we've had with unprocessed compositor events. When quitting mpv, there's two things we should be doing: dispatching any last minute wayland events and then waiting for a compositor reply. Luckily, there's already an internal helper for this (renamed to wayland_dispatch_events for consistency) that we can use. All of the special casing of wl->feedback becomes unneccesary and we can remove this from vo_wayland_state with this method. Fixes #110022.
* wayland: initalize display_fd as -1Dudemanguy2023-01-031-3/+4
| | | | | | | | In the event of a failed wayland initalization, the display_fd is actually 0 instead of -1 which would correctly indicate it doesn't exist. Also move the fd check inside vo_wayland_dispatch_events since that function shouldn't ever do anything if we don't actually have a display fd.
* wayland: consistently employ use_presentDudemanguy2023-01-031-4/+1
| | | | | | | | | We have a use_present bool that keeps track of whether or not to use presentation time. However, the creation of the feedback listener actually wasn't checking this and was instead checking for the existence of wl->presentation. There's no point in always creating the listener and feedback if mpv isn't actually going to use it. Just change it to use_present instead.
* vo: hwdec: fix drmGetDeviceNameFromFd2() related memory leakrepojohnray2023-01-021-1/+5
| | | | | This commit fixes a minor memory leak related to drmGetDeviceNameFromFd2(). This function returns a string allocated with strdup().
* hwdec_drmprime: fix memory leakrepojohnray2023-01-021-0/+1
|
* vo_opengl: do not blindly reject all Microsoft's OpenGL implementationsKacper Michajłow2022-12-301-3/+3
| | | | | | | | | | | | | This change enables mpv to work in the WSL2 (WSLg) environment where OpenGL is implemented on top of D3D12. This reverts commit 149d98d244. Mentioned OpenGL implementation (GDI Generic) in the original change will be rejected by version check, so there is no need to handle it manually. Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
* x11: add modesetting to the xpresent whitelistSultan Alsawaf2022-12-271-1/+2
| | | | | | | | | | | | | | | | Since the modesetting driver now has TearFree support with integration into xpresent, it's important that xpresent is used with the modesetting driver to get the correct vsync timing when a frame is delayed by one vblank interval due to a pending page-flip enqueued by a different entity. The modesetting driver ensures that the xpresent extension reports the correct presentation timing when TearFree is used; mpv just needs to listen to it. Add the modesetting driver to the xpresent whitelist so mpv can get the correct presentation completion timing when modesetting TearFree is used. This is also helpful for when xpresent performs page flips directly in the modesetting driver and a natural delay in the display pipeline causes a page flip to be delayed by one vblank interval or more.
* build: add configure test for POSIX shm for the sake of vo_kittysfan52022-12-261-4/