summaryrefslogtreecommitdiffstats
path: root/video/out/vo_dmabuf_wayland.c
Commit message (Collapse)AuthorAgeFilesLines
* various: fix typosHarri Nieminen2023-03-281-1/+1
| | | | Found by codespell
* wayland: use bool type for alpha framebuffer trackingRay Smith2023-02-281-1/+1
| | | | | | | | | 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.
* Revert "vo_dmabuf_wayland: drop support for linux-dmabuf-v2"Dudemanguy2023-02-181-2/+2
| | | | | | | | | | | This was originally dropped because it was thought to be unneeded at the time, but at least some devices (rockchip) apparently are still on old compositors that use linux-dmabuf v2. It's not much code, and for testing purposes it's good to have around since it's hard to test drmprime otherwise. Some minor additions are here to support the newly added vaapi-format mapping in v2 of the protocol. This reverts commit a5b9d529eec8d4bb6fc858143337c3573ec8afd0.
* vo_dmabuf_wayland: reject hw formats not supported by compositorAaron Boxer2023-02-111-4/+8
|
* vo_dmabuf_wayland: add purgatory list to buffer pool to avoid memory leaksAaron Boxer2023-02-051-3/+3
|
* 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
|
* 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
|
* wayland: rewrite geometry and scaling handlingDudemanguy2023-01-241-5/+2
| | | | | | | | | 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_dmabuf_wayland: drop support for linux-dmabuf-v2Dudemanguy2023-01-121-2/+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_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.
* vo_dmabuf_wayland: use single-pixel-buffer-v1LaserEyess2022-11-201-18/+30
| | | | | | | The new single-pixel-buffer protocol is designed to optimize the case for using a solid color as an underlay wl_surface. It works the same as the wl_shm 1x1 pixel trick currently used, but it allows the compositor to make optimizations with more certainty than the wl_shm trick.
* wlbuf_pool.h: add headers for forward declarationsLaserEyess2022-11-201-1/+1
| | | | | | This was previously implicitly included by the order of headers in vo_dmabuf_wayland.c, but it is better to make it an explicit and reorder the headers properly.
* wayland: error out if essential protocol support is missingDudemanguy2022-11-151-0/+25
| | | | | | | | | | | | | | Related issue: #10868. While most protocols are in theory optional, a small amount of them are absolutely essential and nothing will work without them. We should make sure to error out in those cases and not try to actually do anything. For wayland support in general, wl_compositor support is obviously required. If there is no wl_surface, you can't do anything. Additionally, vo_wlshm quite obviously requires wl_shm so mark that one as well. vo_dmabuf_wayland needs linux_dmabuf, viewporter, wl_shm, and wl_subcompositor. In practice, these are all very standard protocols and shouldn't be missing but the linked issue above is at least one example where a compositor was stuck on an ancient version of a wayland interface.
* vo_dmabuf_wayland: improve error handling exporting VA surfaceAaron Boxer2022-11-071-23/+25
| | | | | 1. check for all error conditions when calling vaExportSurfaceHandle 2. only clean up valid descriptors
* vo_dmabuf_wayland: use special ra_ctx_create_by_nameDudemanguy2022-10-281-5/+1
| | | | | | | | | | | | | | | | | | | vo_dmabuf_wayland has its own ra and context so it can handle all the different hwdec correctly. Unfortunately, this API was pretty clearly designed with vo_gpu/vo_gpu_next in mind and has a lot of concepts that don't make sense for vo_dmabuf_wayland. We still want to bolt on a ra_ctx, but instead let's rework the ra_ctx logic a little bit. First, this introduces a hidden bool within the ra_ctx_fns that is used to hide the wldmabuf context from users as an option (unlike the other usual contexts). We also want to make sure that hidden contexts wouldn't be autoprobed in the usual ra_ctx_create, so we be sure to skip those in that function. Additionally, let's create a new ra_ctx_create_by_name function which does exactly what says. It specifically selects a context based on a passed string. This function has no probing or option logic is simplified just for what vo_dmabuf_wayland needs. The api/context validations functions are modified just a little bit to make sure hidden contexts are skipped and the documentation is updated to remove this entries. Fixes #10793.
* vo_dmabuf_wayland: load all hwdecs in preinitDudemanguy2022-10-281-1/+1
| | | | | | | | | | | vo_gpu and vo_gpu_next typically load hwdec interops on demand and vo_dmabuf_wayland naively copied this logic. This is actually wrong however since draw_frame in the VO always inherently relies on hwdec being fully loaded. This can lead to a race condition during startup which happens with --force-window=immediate. Avoid this by simply always loading all the interops. In the case of vo_dmabuf_wayland, this is not really a big deal since there's only vaapi and drmprime to load. Also fixes #10791 (the other half).
* vo_dmabuf_wayland: fix DRM builds with no VAAPIDave Craig2022-10-271-3/+7
| | | | | | Building on DRM platform without VAAPI broke because of misuse of HAVE_VAAPI with #ifdef in place of #if. Also, the hwcontext_drm.h header is not required for VAAPI builds, only DRM builds.
* wayland: bump dmabuf protocol to version 4Emmanuel Gil Peyrot2022-10-261-3/+3
| | | | | | | | | | | | | | | | | Pulled from https://github.com/mpv-player/mpv/pull/10382 The zwp_linux_dmabuf_v1 protocol version 4 provides a file descriptor containing both formats and modifiers, which makes it possible for the compositor to import the buffers onto planes using explicit modifiers. This is an extremely important efficiency improvement, as the 3D hardware can be left powered off altogether, the vaapi buffer being sent directly from the video hardware to the display controller. It could be possible to support zwp_linux_dmabuf_v1 version 3 as well, but there is no reason beyond compatibility with old stacks. I would recommend to ditch version 2 as well, as modifier-less formats aren’t very useful nowadays.
* vo_dmabuf_wayland: wayland VO displaying dmabuf buffersAaron Boxer2022-10-261-0/+361
Wayland VO that can display images from either vaapi or drm hwdec The PR adds the following changes: 1. a context_wldmabuf context with no gl dependencies 2. no-op ra_wldmabuf and dmabuf_interop_wldmabuf objects no-op because there is no need to map/unmap the drmprime buffer, and there is no need to manage any textures. Tested on both x86_64 and rk3399 AArch64