mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-26 18:20:44 +00:00
vkoperation: synchronization helper object
An operation is an arbitrary amount of work to be executed on the host, a device, or an external entity such as a presentation engine. The purpose of this object is to help on the operation's synchronization through declaring explicit execution dependencies, and memory dependencies between two sets of operations defined by the command’s two synchronization scopes. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5079>
This commit is contained in:
parent
c83c508c5e
commit
265f1274dc
5 changed files with 1580 additions and 0 deletions
1439
subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkoperation.c
Normal file
1439
subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkoperation.c
Normal file
File diff suppressed because it is too large
Load diff
134
subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkoperation.h
Normal file
134
subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkoperation.h
Normal file
|
@ -0,0 +1,134 @@
|
|||
/*
|
||||
* GStreamer
|
||||
* Copyright (C) 2023 Igalia, S.L.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <gst/vulkan/gstvkqueue.h>
|
||||
|
||||
#define GST_TYPE_VULKAN_OPERATION (gst_vulkan_operation_get_type())
|
||||
#define GST_VULKAN_OPERATION(o) (G_TYPE_CHECK_INSTANCE_CAST((o), GST_TYPE_VULKAN_OPERATION, GstVulkanOperation))
|
||||
#define GST_VULKAN_OPERATION_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GST_TYPE_VULKAN_OPERATION, GstVulkanOperationClass))
|
||||
#define GST_IS_VULKAN_OPERATION(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), GST_TYPE_VULKAN_OPERATION))
|
||||
#define GST_IS_VULKAN_OPERATION_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), GST_TYPE_VULKAN_OPERATION))
|
||||
#define GST_VULKAN_OPERATION_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), GST_TYPE_VULKAN_OPERATION, GstVulkanOperationClass))
|
||||
|
||||
GST_VULKAN_API
|
||||
GType gst_vulkan_operation_get_type (void);
|
||||
|
||||
/**
|
||||
* GstVulkanOperation:
|
||||
* @parent: the parent #GstObject
|
||||
* @cmd_buf: the current #GstVulkanCommandBuffer
|
||||
*
|
||||
* When using the operation @cmd_buf, you should lock it using
|
||||
* gst_vulkan_command_buffer_lock(), but you have to unlock it, with
|
||||
* gst_vulkan_command_buffer_unlock(), when calling any of #GstVulkanOperation
|
||||
* methods.
|
||||
*
|
||||
* Since: 1.24
|
||||
*/
|
||||
struct _GstVulkanOperation
|
||||
{
|
||||
GstObject parent;
|
||||
|
||||
GstVulkanCommandBuffer *cmd_buf;
|
||||
|
||||
/* <private> */
|
||||
gpointer _reserved [GST_PADDING];
|
||||
};
|
||||
|
||||
struct _GstVulkanOperationClass
|
||||
{
|
||||
GstObjectClass parent_class;
|
||||
|
||||
/* <private> */
|
||||
gpointer _reserved [GST_PADDING];
|
||||
|
||||
};
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GstVulkanOperation, gst_object_unref)
|
||||
|
||||
GST_VULKAN_API
|
||||
GstVulkanOperation * gst_vulkan_operation_new (GstVulkanCommandPool * cmd_pool);
|
||||
GST_VULKAN_API
|
||||
gboolean gst_vulkan_operation_begin (GstVulkanOperation * self,
|
||||
GError ** error);
|
||||
GST_VULKAN_API
|
||||
gboolean gst_vulkan_operation_wait (GstVulkanOperation * self);
|
||||
GST_VULKAN_API
|
||||
gboolean gst_vulkan_operation_end (GstVulkanOperation * self,
|
||||
GError ** error);
|
||||
GST_VULKAN_API
|
||||
void gst_vulkan_operation_reset (GstVulkanOperation * self);
|
||||
GST_VULKAN_API
|
||||
GArray * gst_vulkan_operation_retrieve_image_barriers
|
||||
(GstVulkanOperation * self);
|
||||
GST_VULKAN_API
|
||||
GArray * gst_vulkan_operation_new_extra_image_barriers
|
||||
(GstVulkanOperation * self);
|
||||
GST_VULKAN_API
|
||||
gboolean gst_vulkan_operation_add_frame_barrier (GstVulkanOperation * self,
|
||||
GstBuffer * frame,
|
||||
guint64 dst_stage,
|
||||
guint64 new_access,
|
||||
VkImageLayout new_layout,
|
||||
GstVulkanQueue * new_queue);
|
||||
GST_VULKAN_API
|
||||
void gst_vulkan_operation_add_extra_image_barriers
|
||||
(GstVulkanOperation * self,
|
||||
GArray * extra_barriers);
|
||||
GST_VULKAN_API
|
||||
void gst_vulkan_operation_update_frame (GstVulkanOperation * self,
|
||||
GstBuffer * frame,
|
||||
guint64 dst_stage,
|
||||
guint64 new_access,
|
||||
VkImageLayout new_layout,
|
||||
GstVulkanQueue * new_queue);
|
||||
GST_VULKAN_API
|
||||
gboolean gst_vulkan_operation_add_dependency_frame
|
||||
(GstVulkanOperation * self,
|
||||
GstBuffer * frame,
|
||||
guint64 wait_stage,
|
||||
guint64 signal_stage);
|
||||
GST_VULKAN_API
|
||||
void gst_vulkan_operation_discard_dependencies
|
||||
(GstVulkanOperation * self);
|
||||
GST_VULKAN_API
|
||||
gboolean gst_vulkan_operation_enable_query (GstVulkanOperation * self,
|
||||
VkQueryType query_type,
|
||||
guint n_queries,
|
||||
gpointer pnext,
|
||||
GError ** error);
|
||||
GST_VULKAN_API
|
||||
gboolean gst_vulkan_operation_get_query (GstVulkanOperation * self,
|
||||
gpointer * data,
|
||||
GError ** error);
|
||||
GST_VULKAN_API
|
||||
gboolean gst_vulkan_operation_begin_query (GstVulkanOperation * self,
|
||||
guint32 id);
|
||||
GST_VULKAN_API
|
||||
gboolean gst_vulkan_operation_end_query (GstVulkanOperation * self,
|
||||
guint32 id);
|
||||
|
||||
GST_VULKAN_API
|
||||
gboolean gst_vulkan_operation_use_sync2 (GstVulkanOperation * self);
|
||||
GST_VULKAN_API
|
||||
gboolean gst_vulkan_operation_pipeline_barrier2 (GstVulkanOperation * self,
|
||||
gpointer dependency_info);
|
|
@ -27,6 +27,7 @@ vulkan_sources = files(
|
|||
'gstvkimageview.c',
|
||||
'gstvkinstance.c',
|
||||
'gstvkmemory.c',
|
||||
'gstvkoperation.c',
|
||||
'gstvkphysicaldevice.c',
|
||||
'gstvkqueue.c',
|
||||
'gstvkswapper.c',
|
||||
|
@ -61,6 +62,7 @@ vulkan_headers = files(
|
|||
'gstvkimageview.h',
|
||||
'gstvkinstance.h',
|
||||
'gstvkmemory.h',
|
||||
'gstvkoperation.h',
|
||||
'gstvkphysicaldevice.h',
|
||||
'gstvkqueue.h',
|
||||
'gstvkswapper.h',
|
||||
|
|
|
@ -59,6 +59,7 @@
|
|||
#include <gst/vulkan/gstvkhandlepool.h>
|
||||
#include <gst/vulkan/gstvkfullscreenquad.h>
|
||||
|
||||
#include <gst/vulkan/gstvkoperation.h>
|
||||
#include <gst/vulkan/gstvkutils.h>
|
||||
#include <gst/vulkan/gstvkvideoutils.h>
|
||||
|
||||
|
|
|
@ -114,6 +114,10 @@ typedef struct _GstVulkanFullScreenQuadPrivate GstVulkanFullScreenQuadPrivate;
|
|||
typedef struct _GstVulkanQueueFamilyOps GstVulkanQueueFamilyOps;
|
||||
typedef struct _GstVulkanVideoProfile GstVulkanVideoProfile;
|
||||
|
||||
typedef struct _GstVulkanOperation GstVulkanOperation;
|
||||
typedef struct _GstVulkanOperationClass GstVulkanOperationClass;
|
||||
typedef struct _GstVulkanOperationPrivate GstVulkanOperationPrivate;
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GST_VULKAN_FWD_H__ */
|
||||
|
|
Loading…
Reference in a new issue