Commit Graph

11 Commits

Author SHA1 Message Date
Jun Zhao 0c79b73164 hwcontext_vulkan: fix make checkheaders fail
make checkheaders will get error as follow:
CC	libavutil/hwcontext_vulkan.h.o
In file included from libavutil/hwcontext_vulkan.h.c:1:
./libavutil/hwcontext_vulkan.h:130:23: error: ‘AV_NUM_DATA_POINTERS’ undeclared here (not in a function)
  130 |     void *alloc_pnext[AV_NUM_DATA_POINTERS];
      |                       ^~~~~~~~~~~~~~~~~~~~
./libavutil/hwcontext_vulkan.h:199:43: warning: ‘enum AVPixelFormat’ declared inside parameter list will not be visible outside of this definition or declaration

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2020-06-04 21:26:21 +08:00
Lynne 4dcb50c58a
hwcontext_vulkan: use host mapped buffers when uploading and downloading
Speeds up both use cases by 30%.
2020-05-26 10:52:10 +01:00
Lynne 2c6366590e
hwcontext_vulkan: do not OR the user-specified usage with our default flags
Some users may need special formats that aren't available when the STORAGE
flag bit is set, which would result in allocations failing.
2020-05-23 19:07:41 +01:00
Lynne c6df64035f
hwcontext_vulkan: improve public header documentation
Some things like using ImageLists were from a really old version that
still used multiplanar images.
2020-05-23 19:07:32 +01:00
Lynne ea1a7f6064
hwcontext_vulkan: expose the enabled device features
With this, the puzzle of making libplacebo, ffmpeg and any other Vulkan
API users interoperable is complete.
Users of both libraries can initialize one another's contexts without having
to create a new one.
2020-05-23 19:07:30 +01:00
Lynne 01c7539f30
hwcontext_vulkan: expose the amount of queues for each queue family
This, along with the next patch, are the last missing pieces to being
interoperable with libplacebo.
2020-05-23 19:07:29 +01:00
Lynne 70d396c8af Revert "hwcontext_vulkan: only use one semaphore per image"
This reverts commit 97b526c192.
It broke the API, and assumed no other APIs used multiple semaphores.
This also disallowed certain optimizations to happen.

Dealing with APIs that give or expect single semaphores is easier when
we use per-image semaphores.
2020-05-11 23:48:26 +01:00
Lynne 875c1707e5
hwcontext_vulkan: create all images with concurrent sharing mode
As it turns out, we were already assuming and treating all images as if they had
concurrent access mode. This just changes the flag to CONCURRENT, which has less
restrictions than EXCLUSIVE, and fixed validation messages on machines with
multiple queues.
The validation layer didn't pick this up because the machine I was testing on
had only a single queue.
2020-05-10 23:20:49 +01:00
Lynne dccd07f66d
hwcontext_vulkan: expose enabled device and instance extensions
This solves a huge oversight - it lets users reliably use their own
AVVulkanDeviceContext. Otherwise, the extensions supplied and enabled
are not discoverable by anything outside of hwcontext_vulkan.
Also clarifies that any user-supplied VkInstance must be at least 1.1.
2020-05-10 23:20:48 +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 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