Commit graph

116 commits

Author SHA1 Message Date
Seungha Yang
4d0f136297 vkinstance: Don't abort in case that system has no available vulkan device
Specification doesn't have restriction that returned
pPhysicalDeviceCount value must be non-zero

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2304>
2021-06-04 07:44:36 +00:00
Wim Taymans
cefdd0d0f1 vulkan: provide a custom VK_DEFINE_NON_DISPATCHABLE_HANDLE
If the application did not define one yet, define our own
VK_DEFINE_NON_DISPATCHABLE_HANDLE that is independent of the
architecture.

Vulkan, by default, provides a define that depends on the architecture,
which causes the symbol type to be different. This causes an
architecture dependent .gir file, which then causes multilib
installation problems because the .gir files can't be shared.

Make it possible to override the format specifier and provide
a default one that is compatible with the default non dispatchable
handle.

Return VK_NULL_HANDLE from functions that return a non-dispatchable
handle.

Fixes #1566

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2130>
2021-04-06 12:32:57 +02:00
Matthew Waters
640a65bf96 gst: don't use volatile to mean atomic
volatile is not sufficient to provide atomic guarantees and real atomics
should be used instead.  GCC 11 has started warning about using volatile
with atomic operations.

https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1719

Discovered in https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/issues/868

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2098>
2021-03-22 14:34:36 +11:00
Matthew Waters
82a9e4630c vulkan: remove duplicated check
Checking the same value twice is pointless

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/1504

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1977>
2021-01-22 12:38:09 +00:00
Xavier Claessens
2efb4a7adb Meson: Use pkg-config generator 2020-10-23 11:14:18 -04:00
Nirbheek Chauhan
d4fa35efb9 meson: Do not warn when a windowing system is not found
Error out when the vulkan option is enabled, and just print
a message() otherwise. This is more correct and also allows us to pass
--fatal-meson-warnings more reliably.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1391>
2020-09-12 23:52:09 +05:30
Wim Taymans
258b2b15dc vulkan: fix the enumtypes install path
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1528>
2020-08-25 00:04:18 +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
bc95b5d99a build/vulkan: split vulkan gir
also add to docs

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1506>
2020-08-15 02:55:30 +00:00
Mathieu Duponchelle
6baffc2931 docs: mark more types as plugin API 2020-06-23 12:10:17 -04:00
Matthew Waters
c21aefbfb0 vulkan: log extension/layers available/enabled on instance/device creation
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1341>
2020-06-21 09:30:29 +00:00
Matthew Waters
09613696a6 vulkan/device: expose extension/layer choices
Extensions and layers can be enabled before calling
gst_vulkan_device_open().  The available extensions are stored in
GstVulkanPhysicalDevice.

Defaults are still the same.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1341>
2020-06-21 09:30:29 +00:00
Matthew Waters
ceb5ac0e4f vulkan/instance: privatise defult debug callback
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1341>
2020-06-21 09:30:29 +00:00
Matthew Waters
0e72318515 vulkan/instance: expose extension/layer choices
Extensions and layers can be enabled before calling
gst_vulkan_instance_open() but after calling
gst_vulkan_instance_fill_info().

Use the list of available extensions to better choose a default display
implementation to use based on the available Vulkan extensions for surface
output.

Defaults are still the same.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1341>
2020-06-21 09:30:29 +00:00
Matthew Waters
91b8ec1f0a vulkan/physical-device: dump some more information to logs
Also dump the Vulkan 1.1 and Vulkan 1.2 device properties/features
where supported.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1341>
2020-06-21 09:30:29 +00:00
Matthew Waters
aad7ed31e1 vulkan/instance: add vulkan API version selection and checking
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1341>
2020-06-21 09:30:29 +00:00
Matthew Waters
595dd1c149 vulkan/wayland: initialise debug category before debug logging
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1341>
2020-06-21 09:30:29 +00: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
Matthew Waters
a4d900332b vulkanimagememory: fix use-after-free releasing a view
If the view has the last reference to the image, then
gst_clear_mini_object will destroy the image and the lock used in the
next line.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1314>
2020-06-02 13:58:13 +10:00
Matthew Waters
dd44bc3a2d vkimagememory: actually check the length of a ptr array
Not it's value is > 0 which should always be true.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1314>
2020-06-02 13:58:13 +10: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
Jan Alexander Steffens (heftig)
dc57fb7095 vulkan: Drop use of VK_RESULT_BEGIN_RANGE
This was removed in Vulkan 1.2.140.

> Shortly after 2020-04-24, we will be removing the automatically
> generated `VK_*_BEGIN_RANGE`, `VK_*_END_RANGE`, and `VK_*_RANGE_SIZE`
> tokens from the Vulkan headers. These tokens are currently defined for
> some enumerated types, but are explicitly not part of the Vulkan API.
> They existed only to support some Vulkan implementation internals,
> which no longer require them. We will be accepting comments on this
> topic in [#1230], but we strongly suggest any external projects using
> these tokens immediately migrate away from them.

[#1230]: https://github.com/KhronosGroup/Vulkan-Docs/issues/1230

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1255>
2020-05-11 12:04:08 +00:00
Matthew Waters
7127e88389 vulkan/window/xcb: implement keyboard support 2020-03-03 05:00:50 +00:00
Matthew Waters
8c53bcd404 vulkan/window/xcb: implement mouse event support 2020-03-03 05:00:50 +00:00
Matthew Waters
52a9135a2b vulkan/swapper: add get_surface_rectangles
Retrieve the input, output and covered rectangles.
2020-03-03 05:00:50 +00:00
Matthew Waters
af19fa94f4 vulkan/display: implement thread-safe find_window() 2020-03-03 05:00:50 +00:00
Matthew Waters
0ea427823e vulkan/window: add support for mouse/keyboard events 2020-03-03 05:00:50 +00:00
Matthew Waters
bd31caf0b0 vkswapper: keep a reference on the input buffer until present is finished
Otherwise, there may be a very small period of time where the buffer can
be freed while being presented.
2020-02-18 15:52:22 +11:00
Seungha Yang
2a3205b294 vulkan/window/win32: Don't post any WinProc message to parent window
Posting any message to parent seems to be pointless. That might break
parent window.
Regardless of the posting, parent window can catch mouse event
and also any keyboard events will be handled by parent window by default.
2019-12-22 09:16:42 +00:00
Stéphane Cerveau
6bc0e9527e remove various useless linefeed in logs 2019-12-11 10:51:29 +01:00
Matthew Waters
52ff97d085 vulkan/image: expose initialization function for subclasses 2019-12-09 01:49:30 +00:00
Matthew Waters
1c6f3e4b84 vulkan/macos: link directly to MoltenVK
It's currently the only sane way we can use MoltenVK functions to
integrate with Metal API.

It also removes the need to specify the VK_ICD_FILENAMES environment
variable pointing to MoltenVK_icd.json.
2019-12-09 01:49:30 +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
dee29aa8e7 vulkan: fix up some gir annotations 2019-12-04 07:20:27 +00:00
Matthew Waters
c7526a6f68 vulkan: priviatise _invoke_on_main()
https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/1132
2019-12-03 10:17:29 +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
5177c24a7e vulkan/trash: remove free functions covered by GstVulkanHandle 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
960784af1f vulkan/handle: add some handle types 2019-11-28 23:27:21 +00:00
Matthew Waters
a7c2aa473f vulkan/image: don't rely on weak-ref notifies for views
Weak refs don't quite work here correctly as there is always a race with
taking the lock between find_view() and remove_view().  If find_view()
returns a view that is going to removed by remove_view() then we have an
interesting situation.

In theory, the number and type of views for an image are relatively
constant and should not change one they've been set up which means that
it is actually practical to perform pool-like reference counting here
where the image holds a pool of different views that it can give out
as necessary.
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
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
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
4e467e0082 vulkan/wayland: advertise the current surface size
Avoids vkswapper from creating a 0x0 output VkSurface and failing
2019-11-13 22:27:59 +00:00
Matthew Waters
0d57c1817b vkhandle: expose a printf format specifier for a vulkan handle 2019-11-11 11:04:59 +11:00
Matthew Waters
4b491182ae vkdescriptor: set the GError on the 'too many allocations' case 2019-11-11 11:04:59 +11:00
Matthew Waters
982e06ef87 vkswapper: add inherit support
Used on android
2019-11-11 11:04:59 +11:00
Matthew Waters
332f1742d2 vkswapper: output specific values when swapchain flags fail 2019-11-11 11:04:59 +11:00
Matthew Waters
08928541c6 vulkan: add android WSI integration 2019-11-11 11:04:59 +11:00
Nirbheek Chauhan
e0a70d1a0a vulkan: Fix build on ios
These little bits were missed during the refactor in
https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/merge_requests/821
2019-11-10 19:27:06 +05:30