Commit graph

78 commits

Author SHA1 Message Date
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
Seungha Yang 0a2d24d010 vulkan: Fix build on Windows
gstvkwindow_win32.c(166): error C2065: 'msg_source': undeclared identifier
2019-11-08 23:42:08 +09:00
Matthew Waters 670d0a8e88 vulkan: remove the private struct from the public struct
Remove any references to CamelTypePrivate from the public CamelType
struct.  They can be accessed as needed using
camel_type_get_instance_private().
2019-11-07 20:01:57 +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 212b313e29 vulkan: add handle type for arbitrary vulkan handles
Serve two purposes:
1. refcounting of vulkan handles with associated destruction.  When
   combined with the trash list, the user can ensure destruction at
   the correct time according to the vulkan rules.
2. avoids polluting our API with 32-bit vs 64-bit integer/pointers
   differences as exposed through the vulkan API.  on 32-bit, vulkan
   non-dispatchable handles are 64-bit integers and on 64-bit, they
   are pointers.
2019-11-07 20:01:57 +00:00
Matthew Waters f738c1f138 vulkan: fix non-dispatchable handles on 32-bit platforms
non-dispatchable handles are 64-bit integers on 32-bit platforms
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 116549b561 vulkan: use the provided VKAPI_ATTR for the debug callback
Ensures that we get the calling convention correct for the platform we
are using.
2019-11-07 20:01:57 +00:00
Matthew Waters a2aa17278a vulkan: dump surface information 2019-11-07 20:01:57 +00:00
Matthew Waters b55134a4dd vulkan: print criticals/warnings for vulkan errors/warnings
Simplifies finding the erronous cases in using the Vulkan API
incorrectly.
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
Niels De Graef d8f61515d8 Don't pass default GLib marshallers for signals
By passing NULL to `g_signal_new` instead of a marshaller, GLib will
actually internally optimize the signal (if the marshaller is available
in GLib itself) by also setting the valist marshaller. This makes the
signal emission a bit more performant than the regular marshalling,
which still needs to box into `GValue` and call libffi in case of a
generic marshaller.

Note that for custom marshallers, one would use
`g_signal_set_va_marshaller()` with the valist marshaller instead.
2019-11-06 14:27:46 +00:00
Aaron Boxer 6d3429af34 documentation: fixed a heap o' typos 2019-11-05 09:11:25 -05:00
Tim-Philipp Müller f218ec2794 Remove autotools build system 2019-10-14 13:54:27 +01:00
Seungha Yang 1e38255c97 vulkan: Fix build on Windows
* Fix meson build script for Windows. Since the Vulkan dependency
object was declared by us in case of Windows, the dependency object
shouldn't be used for finding header

* Fix build error by including Windows specific header
gstvkdisplay.c(563): error C2065: 'VK_KHR_WIN32_SURFACE_EXTENSION_NAME': undeclared identifier
2019-09-25 22:14:40 +09: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 5165f2509b build/vulkan: fix copy-paste error in gstvkconfig.h 2019-09-25 11:11:02 +00:00
Matthew Waters a03d0a2638 vulkan: remove the winsys-specific headers from gst/vulkan/vulkan.h
Allows not having wayland, xcb, Cocoa, UIKit, windows.h included in the
public GstVulkan API.
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 5f76c84feb vulkan: split physical device from logical device 2019-09-17 13:02:44 +10:00
Matthew Waters 863e785770 vulkan: expose various flags to string methods 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
Matthew Waters cd28c77413 vulkan/window/ios: fix race on window startup
1. The iOS create_surface implementation needs to call out to the main
thread to create the window (UIKit requirement)
2. get_surface() can be called and will attempt to create the VkSurface
from an invalid view/layer.

Also pass the layer for MoltenVK so we don't get pesky 'UIView function
not called on main thread' warnings.
2019-09-16 03:15:39 +00:00
Matthew Waters 656a0cde84 vulkan: create the macos/ios-specific displays 2019-09-16 03:15:39 +00:00
Matthew Waters 96b2413616 vulkan: install public gstvkdebug.h header 2019-09-16 03:15:39 +00:00
Matthew Waters 08b53ca456 vulkan: fix build with older API headers
The protected memory flags were only added later as was the
multi-instance flag.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/1081
2019-09-11 23:59:53 +00:00
Matthew Waters 2b7050120e vulkan: dump most of the device information
Dump anything that can be queried using the physical device like features,
limits, queue properties, memory properties.
2019-09-11 20:22:56 +10:00
Yeongjin Jeong fdab54611b vulkan: Fix some confusing typos
Seems to have been copy pasted from around gl element
2019-08-29 11:19:37 +00:00
Yeongjin Jeong 94671be428 vulkan/xcb: Don't try to create xcb window with non-xcb display
Non-xcb display does not have a xcb_connection and trying
to create xcb window with wild pointer can cause segfault.
2019-08-29 11:19:37 +00:00
Matthew Waters 87311d404e vulkan/swapper: add a couple of missing g_clear_error()'s 2019-08-28 10:34:39 +00:00
Matthew Waters 542af25eb1 vulkan/build: conditionally depend on Vulkan-1.0.gir
Vulkan-1.0.gir is new in gobject-introspection >= 1.61.1
2019-08-28 10:34:39 +00:00
Matthew Waters c237c8de6a vulkandisplay: silence an unused but set error with no enable winsys implementations 2019-08-28 10:34:39 +00:00
Matthew Waters 09883b6a6b vulkan/swapper: check queue present return later
During resizes, the VkQueuePresent can return OUT_OF_DATE and if a buffer
is displayed returning OUT_OF_DATE it would error out and stop the pipeline.

We already have a explicit check for OUT_OF_DATE and the same general
error check in the statements following so just use that code.
2019-08-28 10:34:39 +00:00
Matthew Waters d1f8f7436d vulkan/swapper: destroy the surface in finalize
Fixes a leak of the VkSurface object.
2019-08-28 10:34:39 +00:00
Matthew Waters cac1487479 vulkan/swapper: set some values to NULL in error conditions
So that they are not double free()-ed.
2019-08-28 10:34:39 +00:00
Matthew Waters be9c9e44f1 vulkan/error: add the error value in hex and decimal
Provides more information for what may be an 'Unknown' error.
2019-08-28 10:34:39 +00:00