Commit graph

192 commits

Author SHA1 Message Date
Jan Schmidt
5f9897745b vkdeviceprovider: Avoid deadlock on physical device
Don't hold the object lock on the vk physical device while
constructing a GstVulkanDevice around it, as
GstVulkanDevice can make calls on the physical device that
require the object lock.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1754>
2020-11-03 04:28:00 +00:00
Matthew Waters
2d31aba78d vulkan: docs annotation updates
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1506>
2020-08-15 02:55:30 +00:00
Matthew Waters
3cf0abddbb vulkan/shaders: add explicit license headers
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1338>
2020-06-12 15:52:44 +10:00
Matthew Waters
1f44cb0519 vulkan/shaders: manually indent bin2array
Looks much nicer with some semblance of code formatting

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1338>
2020-06-12 15:52:44 +10:00
Thibault Saunier
60fba5f380 docs: Add some more plugin API types
And allow creating vulkan device object without specifying an instance
so it can be introspected.
2020-06-09 12:28:13 -04:00
Thibault Saunier
3a98a37375 docs: Update plugins cache 2020-06-09 12:28:13 -04:00
Tim-Philipp Müller
00caf46e3f vulkan: fix use of assert() with older meson versions
Follow-up to !1307

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1308>
2020-05-28 22:50:00 +01:00
Tim-Philipp Müller
b75ad03313 vulkan: don't run tests or build lib if plugin isn't actually built
The unit tests only checked for vulkan_dep.found(), which can
be true if the libs are there but glslc was not found, in which
case the plugin wouldn't be built and the unit tests would fail
because of missing vulkan plugins.

Doesn't really make much sense to build the vulkan integration lib
either if we're not going to build the vulkan plugin, so just disable
both for now if glslc is not available.

Fixes #1301

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1307>
2020-05-28 19:07:32 +01:00
Nirbheek Chauhan
387b6df948 meson: Don't use get_option('buildtype')
We should directly check the values of the `debug` and `optimization`
options instead.

`get_option('buildtype')` will return `'custom'` for most combinations
of `-Doptimization` and `-Ddebug`, but those two will always be set
correctly if only `-Dbuildtype` is set. So we should look at those
options directly.

For the two-way mapping between `buildtype` and `optimization`
+ `debug`, see this table:
https://mesonbuild.com/Builtin-options.html#build-type-options
2020-04-03 17:07:47 +05:30
Matthew Waters
d66743e482 vulkan/sink: implement GstNavigation support 2020-03-03 05:00:50 +00:00
Seungha Yang
b8ef3801bc vulkansink: Fix null pointer exception
context query might happen before creating swapper.
2020-01-03 08:45:12 +00:00
Matthew Waters
c3685bafa4 vulkanviewconvert: clear the cached uniforms on caps change
Caps changes can change the output/input layout which needs to be
reflected in the input uniforms to the shader.
2019-12-05 03:21:21 +00:00
Matthew Waters
81d1e16b6b vulkan: move fullscreenquad object to library
It's useful and extensible enough to be used by us and other elements
2019-12-04 07:20:27 +00:00
Matthew Waters
24d096597b vulkan: implement caching and reuse of a couple of vulkan resources
Includes a new GstVulkanHandlePool base class for pooling different
resources togther.  The descriptor cache object is ported to
GstVulkanHandlePool with the exact same functionality.

A new GstVulkanFenceCache is also implemented for caching fences
which is used internally by GstVulkanDevice for creating or reusing
fences.

The existing GstVulkanTrashFenceList object now caches trash objects.
2019-11-28 23:27:21 +00:00
Matthew Waters
f810147709 vulkancolorconvert: disable YUY2 conversion
It doesn't work and never seemed to
2019-11-28 23:27:21 +00:00
Matthew Waters
615022ad93 vulkan: split vkfullscreenrender into two
Part 1 is a base class (vkvideofilter) that handles instance, device,
queue retrieval and holding that has been moved to the library
Part 2 is a fullscreenrenderquad that is still in the plugin that
performs all of the previous vulkan-specific functionality.
2019-11-28 23:27:21 +00:00
Matthew Waters
756d52ef15 vulkan/upload: allocate from the correct pool
Only relevant when upstream does not use our provided pool.
2019-11-28 23:27:21 +00:00
Matthew Waters
4f3051fd2d vulkan: add a couple of missing fence unrefs 2019-11-28 23:27:21 +00:00
Matthew Waters
a3454edeb2 vulkan/colorconvert: zero out sampler create struct 2019-11-28 23:27:21 +00:00
Matthew Waters
9f4b043161 vulkan/queue: be sure to take a lock around command submission
This ensures that only one thread is submitting commands at a time as
required by the Vulkan specification.
2019-11-14 07:10:16 +00:00
Matthew Waters
c89f21388d vulkan/render: fix indent command comment typo 2019-11-14 07:10:16 +00:00
Matthew Waters
726261aa05 vulkan: NULL check destruction of vulkan resources
If the element fails to start up, any number of vulkan resources could
have not been created.
2019-11-13 22:27:59 +00:00
Matthew Waters
0c3eec57f2 vulkan: make new trash objects ref the fence
Avoids gst_vulkan_fence_ref at each call site of the trash object
creation
2019-11-13 22:27:59 +00:00
Matthew Waters
32b3387ae6 vulkan: implement proper descriptor set handling
The major functionality gain this provides is proper reference counting
for a descriptor set.  Overall this allows us to create descriptor sets
when they are needed (or reused from a cache) without violating any of
vulkan's object synchronisation requirements.

As there are a fixed number of sets available in a pool, the number of
descriptors in elements is currently hardcoded to 32.  This can be extended
in a future change to create pools on the fly if that limit is ever overrun.
2019-11-07 20:01:57 +00:00
Matthew Waters
1c89096b4f vulkan/fence: add always-signalled fence type
Allows a cleaner control flow when there is no fence available for use
with the trash list.  An always signalled fence type will always return
TRUE for gst_vulkan_fence_is_signalled.
2019-11-07 20:01:57 +00:00
Matthew Waters
66244e9342 vulkanviewconvert: fix typo of output image view name 2019-11-07 20:01:57 +00:00
Matthew Waters
7a1bb3001a vulkan: use VK_NULL_HANDLE in more places
Fixes compiler warnings on 32-bit platforms assigning a void * to a
64-bit integer value.
2019-11-07 20:01:57 +00:00
Matthew Waters
475a2b0acd vulkan/image: use the full video info for returning vulkan formats
We may need some colorspace information for returning sRGB vs no sRGB.
2019-11-07 20:01:57 +00:00
Yeongjin Jeong
56333073a9 vulkan: Fix build error when gstvulkan is not installed
The following build error occurs:

vkdeviceprovider.h:30:10: fatal error: gst/vulkan/vulkan.h: No such file or directory
  #include <gst/vulkan/vulkan.h>
           ^~~~~~~~~~~~~~~~~~~~~
2019-11-07 03:31:19 +00:00
Aaron Boxer
6d3429af34 documentation: fixed a heap o' typos 2019-11-05 09:11:25 -05:00
Matthew Waters
ecca6cbfd2 vulkanimage: move fence creation earlier
Fixes a critical:

GStreamer-CRITICAL **: 02:26:34.698: gst_mini_object_ref: assertion 'mini_object != NULL' failed
2019-10-28 07:22:45 +00:00
Matthew Waters
103112725c vulkan: change to clamp to edge rather than clamp to border
clamp-to-border will return the border color which is typically black,
white or transparent.  When linear filtering the edge pixels will
typeically be combined with the border color which is not typically what
we want.  Especially when color converting, this removes a green box
around the edge when converting YUV->RGB.
2019-10-28 07:22:45 +00:00
Matthew Waters
34ff895040 vulkan: remove VkImageView from the memory
There can be multiple views per image for different subresource ranges
or planes in multi-planer images.
2019-09-25 11:11:02 +00:00
Matthew Waters
452bb72292 vkbuffer: remove buffer view from the memory
It's only really useful for texture buffers which we currently do not
use.
2019-09-25 11:11:02 +00:00
Matthew Waters
82e86573b8 vulkan: implement command buffer reuse
Using a similar design for reference counting as
GstBuffer/GstBufferPool.
2019-09-19 02:01:35 +00:00
Matthew Waters
2af2402880 vulkan: add device provider implementation 2019-09-17 13:02:44 +10:00
Matthew Waters
66ed62b794 vulkansink: attempt a context query for a device 2019-09-17 13:02:44 +10:00
Matthew Waters
5f76c84feb vulkan: split physical device from logical device 2019-09-17 13:02:44 +10:00
Matthew Waters
407dab607f vulkan: only pass the device/instance/display in to *_handle_*() functions
We don't need to change the pointer value in these functions.
2019-09-17 13:02:43 +10:00
Yeongjin Jeong
8bc5144020 vulkan: Don't dereference null pointer when printing error
When printing error message because the function failed, the GError variable
may not be used and it can be NULL.
2019-08-29 11:19:37 +00:00
Matthew Waters
d9248560e4 vulkancolorconvert: explicitly initalize swizzle arrays
Fixes uninitialized access of the indexed values larger than
the number of planes in the video format.
2019-08-28 10:34:39 +00:00
Matthew Waters
833c596bc5 vulkan/fullscreenrender: free the attachment descriptions
Fixes a memory leak of the attachment descriptions we receive from the
subclass.
2019-08-22 14:57:02 +10:00
Matthew Waters
837cdd598a vulkanviewconvert: perform a renegotiation on multiview mode/flag property changes
Otherwise changing the output* properties have no effect until someone else
performs a renegotiation.
2019-08-22 11:51:01 +10:00
Matthew Waters
e5d574534c shaders/view-convert: remove some debugging colours
Fixes left and right output modes.
2019-08-22 11:50:51 +10:00
Seungha Yang
6b6bb6b203 vulkan: Fix incompatible type build warning
Make declare/define a function consistent.
Note that GstBaseTransform::set_caps should return gboolean

Compiling C object subprojects/gst-plugins-bad/ext/vulkan/f3f9d6b@@gstvulkan@sha/vkviewconvert.c.obj.
../subprojects/gst-plugins-bad/ext/vulkan/vkviewconvert.c(644):
  warning C4133: '=': incompatible types - from 'GstFlowReturn (__cdecl *)(GstBaseTransform *,GstCaps *,GstCaps *)'
  to 'gboolean (__cdecl *)(GstBaseTransform *,GstCaps *,GstCaps *)'
2019-07-09 01:42:58 +00:00
Matthew Waters
014642e188 vulkan: add view converter element 2019-07-05 15:04:28 +10:00
Matthew Waters
6ebaf7276e vulkan: fix output framebuffer creation size
We don't scale when color converting so there is no impact.
2019-07-05 10:47:45 +10:00
Matthew Waters
69af8a9360 vulkan: move swapper object to the gstvulkan library
Allows other sinks and/or user code to display to a VkSurface
2019-07-04 14:18:15 +10:00
Matthew Waters
b5256d94fc vulkan: move trash list to library 2019-07-04 14:18:15 +10:00
Matthew Waters
ec9ea06591 vkswapper: support rescaling to the output size 2019-06-24 16:23:29 +10:00