mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-22 23:28:16 +00:00
vkhandle: expose a printf format specifier for a vulkan handle
This commit is contained in:
parent
4b491182ae
commit
0d57c1817b
3 changed files with 23 additions and 16 deletions
|
@ -34,6 +34,12 @@ GType gst_vulkan_handle_get_type (void);
|
|||
|
||||
VK_DEFINE_NON_DISPATCHABLE_HANDLE(GstVulkanHandleTypedef)
|
||||
|
||||
#if GLIB_SIZEOF_VOID_P == 8
|
||||
# define GST_VULKAN_NON_DISPATCHABLE_HANDLE_FORMAT "p"
|
||||
#else
|
||||
# define GST_VULKAN_NON_DISPATCHABLE_HANDLE_FORMAT G_GUINT64_FORMAT
|
||||
#endif
|
||||
|
||||
typedef void (*GstVulkanHandleDestroyNotify) (GstVulkanHandle * handle, gpointer user_data);
|
||||
|
||||
typedef enum
|
||||
|
|
|
@ -344,10 +344,12 @@ dump_surface_properties (GstVulkanSwapper * swapper)
|
|||
{
|
||||
GstVulkanSwapperPrivate *priv = GET_PRIV (swapper);
|
||||
|
||||
GST_TRACE_OBJECT (swapper, "surface %p, n images [%" G_GUINT32_FORMAT ", %"
|
||||
G_GUINT32_FORMAT "], extent [%" GST_VULKAN_EXTENT2D_FORMAT ", %"
|
||||
GST_VULKAN_EXTENT2D_FORMAT "], max layers %" G_GUINT32_FORMAT
|
||||
" transforms supported 0x%x current transform 0x%x, alpha flags 0x%x, "
|
||||
GST_TRACE_OBJECT (swapper, "surface %"
|
||||
GST_VULKAN_NON_DISPATCHABLE_HANDLE_FORMAT ", n images [%"
|
||||
G_GUINT32_FORMAT ", %" G_GUINT32_FORMAT "], extent [%"
|
||||
GST_VULKAN_EXTENT2D_FORMAT ", %" GST_VULKAN_EXTENT2D_FORMAT
|
||||
"], max layers %" G_GUINT32_FORMAT " transforms supported 0x%x "
|
||||
"current transform 0x%x, alpha flags 0x%x, "
|
||||
"supported image usage flags 0x%x", priv->surface,
|
||||
priv->surf_props.minImageCount,
|
||||
priv->surf_props.maxImageCount,
|
||||
|
@ -367,9 +369,10 @@ dump_surface_formats (GstVulkanSwapper * swapper)
|
|||
int i;
|
||||
|
||||
for (i = 0; i < priv->n_surf_formats; i++) {
|
||||
GST_DEBUG_OBJECT (swapper, "surface %p format 0x%x colorspace 0x%x",
|
||||
priv->surface, priv->surf_formats[i].format,
|
||||
priv->surf_formats[i].colorSpace);
|
||||
GST_DEBUG_OBJECT (swapper, "surface %"
|
||||
GST_VULKAN_NON_DISPATCHABLE_HANDLE_FORMAT
|
||||
" format 0x%x colorspace 0x%x", priv->surface,
|
||||
priv->surf_formats[i].format, priv->surf_formats[i].colorSpace);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -380,7 +383,8 @@ dump_surface_present_modes (GstVulkanSwapper * swapper)
|
|||
int i;
|
||||
|
||||
for (i = 0; i < priv->n_surf_present_modes; i++) {
|
||||
GST_DEBUG_OBJECT (swapper, "surface %p present modes 0x%x",
|
||||
GST_DEBUG_OBJECT (swapper, "surface %"
|
||||
GST_VULKAN_NON_DISPATCHABLE_HANDLE_FORMAT " present modes 0x%x",
|
||||
priv->surface, priv->surf_present_modes[i]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#endif
|
||||
|
||||
#include "gstvktrash.h"
|
||||
#include "gstvkhandle.h"
|
||||
|
||||
GST_DEBUG_CATEGORY (gst_debug_vulkan_trash);
|
||||
#define GST_CAT_DEFAULT gst_debug_vulkan_trash
|
||||
|
@ -90,17 +91,13 @@ gst_vulkan_trash_new (GstVulkanFence * fence, GstVulkanTrashNotify notify,
|
|||
}
|
||||
|
||||
#if GLIB_SIZEOF_VOID_P == 8
|
||||
# define VK_NON_DISPATCHABLE_HANDLE_FORMAT "p"
|
||||
# define GstVulkanHandleType void *
|
||||
# define PUSH_NON_DISPATCHABLE_HANDLE_TO_GPOINTER(pointer, handle) pointer = (gpointer) handle
|
||||
# define TAKE_NON_DISPATCHABLE_HANDLE_FROM_GPOINTER(handle, type, pointer) handle = (type) pointer
|
||||
#else
|
||||
# define VK_NON_DISPATCHABLE_HANDLE_FORMAT G_GUINT64_FORMAT
|
||||
# define GstVulkanHandleType guint64
|
||||
# define PUSH_NON_DISPATCHABLE_HANDLE_TO_GPOINTER(pointer, handle) \
|
||||
G_STMT_START { \
|
||||
pointer = g_new0(guint64, 1); \
|
||||
*((GstVulkanHandleType *) pointer) = (GstVulkanHandleType) handle; \
|
||||
*((GstVulkanHandleTypedef *) pointer) = (GstVulkanHandleTypedef) handle; \
|
||||
} G_STMT_END
|
||||
# define TAKE_NON_DISPATCHABLE_HANDLE_FROM_GPOINTER(handle, type, pointer) \
|
||||
G_STMT_START { \
|
||||
|
@ -116,7 +113,7 @@ G_PASTE(_free_,type_name) (GstVulkanDevice * device, gpointer resource_handle) \
|
|||
type resource; \
|
||||
TAKE_NON_DISPATCHABLE_HANDLE_FROM_GPOINTER(resource, type, resource_handle); \
|
||||
GST_TRACE_OBJECT (device, "Freeing vulkan " G_STRINGIFY (type) \
|
||||
" %" VK_NON_DISPATCHABLE_HANDLE_FORMAT, resource); \
|
||||
" %" GST_VULKAN_NON_DISPATCHABLE_HANDLE_FORMAT, resource); \
|
||||
func (device->device, resource, NULL); \
|
||||
} \
|
||||
GstVulkanTrash * \
|
||||
|
@ -151,7 +148,7 @@ static void \
|
|||
G_PASTE(_free_,type_name) (GstVulkanDevice * device, struct G_PASTE(free_parent_info_,type_name) *info) \
|
||||
{ \
|
||||
GST_TRACE_OBJECT (device, "Freeing vulkan " G_STRINGIFY (type) \
|
||||
" %" VK_NON_DISPATCHABLE_HANDLE_FORMAT, info->resource); \
|
||||
" %" GST_VULKAN_NON_DISPATCHABLE_HANDLE_FORMAT, info->resource); \
|
||||
func (device->device, info->parent, 1, &info->resource); \
|
||||
g_free (info); \
|
||||
} \
|
||||
|
@ -165,7 +162,7 @@ G_PASTE(gst_vulkan_trash_new_free_,type_name) (GstVulkanFence * fence, \
|
|||
info = g_new0 (struct G_PASTE(free_parent_info_,type_name), 1); \
|
||||
/* FIXME: keep parent alive ? */\
|
||||
info->parent = parent; \
|
||||
info->resource = (GstVulkanHandleType) type_name; \
|
||||
info->resource = type_name; \
|
||||
trash = gst_vulkan_trash_new (fence, \
|
||||
(GstVulkanTrashNotify) G_PASTE(_free_,type_name), info); \
|
||||
return trash; \
|
||||
|
|
Loading…
Reference in a new issue