1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-21 10:55:51 +02:00
Commit Graph

20 Commits

Author SHA1 Message Date
Lynne
0747768728
hwcontext_vulkan: stricter semaphore number requirements
Always require one semaphore per sw_format plane. This is what
the implementation uses and relies upon throughout. This was
a leftover from an earlier revision that was never needed.
2021-12-10 17:04:22 +01:00
Wenbin Chen
83fe28221e hwcontext_vulkan: support creating DRM-tiled images and autodetecting modifiers
When vulkan image exports to drm, the tilling need to be
VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT. Now add code to create vulkan
image using this format.

Now the following command line works:

ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format \
vaapi -i input_1080p.264 -vf "hwmap=derive_device=vulkan,format=vulkan, \
scale_vulkan=1920:1080,hwmap=derive_device=vaapi,format=vaapi" -c:v h264_vaapi output.264

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
Further-modifications-by: Lynne <dev@lynne.ee>
2021-12-10 17:03:48 +01:00
Wenbin Chen
bd6ef73399 hwcontext_vulkan: add support for allocating all planes in a single allocation
VAAPI on Intel can import external frame, but the planes of the external
frames should be in the same drm object. A new option "contiguous_planes"
is added to device. This flag tells device to allocate places in one
memory. When device is derived from vaapi this flag will be enabled.
A new flag frame_flag is also added to AVVulkanFramesContext. User
can use this flag to force enable or disable this behaviour.
A new variable "offset "is added to AVVKFrame. It describe describe the
offset from the memory currently bound to the VkImage.

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
Further-modifications-by: Lynne <dev@lynne.ee>
2021-12-10 17:03:48 +01:00
Timo Rothenpieler
fedf4ff85c avutil/vulkan: load win32 external memory functions 2021-11-14 12:50:32 +01:00
Lynne
6bf9a6539e
vulkan: add support for encode and decode queues and refactor queue code
This simplifies and makes queue family picking simpler and more robust.
The requirements on the device context are relaxed. They made no sense
in the first place.

The video encode/decode extension is still in beta, at least on paper,
but I really doubt they'd change needing a separate queue family.
2021-11-12 05:23:36 +01:00
Lynne
00ef53c3ea
hwcontext_vulkan: switch to using timeline semaphores 2021-11-12 03:36:40 +01:00
Lynne
7f3878828d
hwcontext_vulkan: bump required Vulkan loader version to 1.2 2021-11-12 03:36:35 +01:00
Lynne
4a6581e968 hwcontext_vulkan: dynamically load functions
This patch allows for alternative loader implementations.
2021-04-30 00:08:37 +02:00
Lynne
3a3e8c35b6
hwcontext_vulkan: reorder structure fields and add spaces in between
We're in the middle of an ABI unstable period, so we're allowed to.
2021-04-28 18:18:05 +02:00
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