Commit Graph

9 Commits

Author SHA1 Message Date
Lynne e3c7b22451
hwcontext_vulkan: correctly download and upload flipped images
We derive the destination buffer stride from the input stride,
which meant if the image was flipped with a negative stride,
we'd be FFALIGNING a negative number which ends up being huge,
thus making the Vulkan buffer allocation fail and the whole
image transfer fail.

Only found out about this as OpenGL compositors can copy an entire
image with a single call if its flipped, rather than iterate over
each line.
2020-04-21 19:00:51 +01:00
Lynne 97b526c192 hwcontext_vulkan: only use one semaphore per image
The idea was to allow separate planes to be filtered independently, however,
in hindsight, literaly nothing uses separate per-plane semaphores and it
would only work when each plane is backed by separate device memory.
2020-04-07 12:52:56 +01:00
Lynne ecc3dceff4 hwcontext_vulkan: fix imported image bitmask 2020-03-17 22:52:00 +00:00
Lynne 6353b9e4ab hwcontext_vulkan: support more than one plane per DMABUF layer
Requires the dmabuf modifiers extension.
Allows for importing of compressed images with a second plane.
2020-03-12 18:59:12 +00:00
Lynne b31959d776 hwcontext_vulkan: duplicate DMABUF objects before importing them
The specifications are very vague about who has ownership, and in this case,
Vulkan takes ownership of all DMABUF FDs passed to it, causing errors
to occur if someone gave us images for mapping which were meant to be kept.
The old behavior worked with one-way VAAPI and DMABUF imports, but was broken
with clients like wlroots' dmabuf-capture.
2020-03-12 18:16:11 +00:00
Lynne 501bd57bdb hwcontext_vulkan: initialize semaphores of DMABUF imports
There was a recent change in Intel's driver that triggered a driver-internal
error if the semaphore given to the command buffer wasn't initialized.
Given that the specifications require the semaphore to be initialized,
this is within spec. Unlike what's causing it in the first place, which is
that there are no ways to extract/import dma sync objects from DMABUFs,
so we must leave our semaphores bare.
2020-03-12 18:16:11 +00:00
Lynne 9086af2a0a hwcontext_vulkan: only convert image layout for transfers if necessary 2020-03-12 18:16:11 +00:00
Lynne 08d0a8992d hwcontext_vulkan: minor corrections for DMABUF mapping
We need to consider the amount of layers instead of the image's planes.
2020-03-12 18:16:11 +00:00
Lynne a88449ffb2 lavu: add Vulkan hwcontext code
This commit adds the necessary code to initialize and use a Vulkan device
within the hwcontext libavutil framework.
Currently direct mapping to VAAPI and DRM frames is functional, and
transfers to CUDA and native frames are supported.

Lets hope the future Vulkan video decode extension fits well within this
framework.
2020-02-04 23:19:48 +00:00