mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 00:36:51 +00:00
vulkan: number of memories in buffer rather than number of planes
New vulkan formats don't match the number of planes with the number of memories attached to the buffer. This patch changes the pattern of using planes for traverse the memories with the number of attached memories. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4351>
This commit is contained in:
parent
565fe3291e
commit
e177080bec
5 changed files with 74 additions and 51 deletions
|
@ -1211,6 +1211,7 @@ gst_vulkan_color_convert_transform (GstBaseTransform * bt, GstBuffer * inbuf,
|
|||
GError *error = NULL;
|
||||
VkResult err;
|
||||
int i;
|
||||
guint in_n_mems, out_n_mems;
|
||||
|
||||
fence = gst_vulkan_device_create_fence (vfilter->device, &error);
|
||||
if (!fence)
|
||||
|
@ -1219,7 +1220,8 @@ gst_vulkan_color_convert_transform (GstBaseTransform * bt, GstBuffer * inbuf,
|
|||
if (!gst_vulkan_full_screen_quad_set_input_buffer (conv->quad, inbuf, &error))
|
||||
goto error;
|
||||
|
||||
for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&conv->quad->in_info); i++) {
|
||||
in_n_mems = gst_buffer_n_memory (inbuf);
|
||||
for (i = 0; i < in_n_mems; i++) {
|
||||
GstMemory *img_mem = gst_buffer_peek_memory (inbuf, i);
|
||||
if (!gst_is_vulkan_image_memory (img_mem)) {
|
||||
g_set_error_literal (&error, GST_VULKAN_ERROR, GST_VULKAN_FAILED,
|
||||
|
@ -1237,7 +1239,8 @@ gst_vulkan_color_convert_transform (GstBaseTransform * bt, GstBuffer * inbuf,
|
|||
{
|
||||
gboolean need_render_buf = FALSE;
|
||||
|
||||
for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&conv->quad->out_info); i++) {
|
||||
out_n_mems = gst_buffer_n_memory (outbuf);
|
||||
for (i = 0; i < out_n_mems; i++) {
|
||||
GstMemory *mem = gst_buffer_peek_memory (outbuf, i);
|
||||
if (!gst_is_vulkan_image_memory (mem)) {
|
||||
g_set_error_literal (&error, GST_VULKAN_ERROR, GST_VULKAN_FAILED,
|
||||
|
@ -1279,7 +1282,7 @@ gst_vulkan_color_convert_transform (GstBaseTransform * bt, GstBuffer * inbuf,
|
|||
|
||||
if (need_render_buf) {
|
||||
render_buf = gst_buffer_new ();
|
||||
for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&conv->quad->out_info); i++) {
|
||||
for (i = 0; i < out_n_mems; i++) {
|
||||
gst_buffer_append_memory (render_buf,
|
||||
gst_memory_ref ((GstMemory *) render_img_mems[i]));
|
||||
}
|
||||
|
@ -1291,7 +1294,7 @@ gst_vulkan_color_convert_transform (GstBaseTransform * bt, GstBuffer * inbuf,
|
|||
render_buf = outbuf;
|
||||
}
|
||||
|
||||
for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&conv->quad->out_info); i++) {
|
||||
for (i = 0; i < out_n_mems; i++) {
|
||||
GstMemory *img_mem = gst_buffer_peek_memory (render_buf, i);
|
||||
if (!gst_is_vulkan_image_memory (img_mem)) {
|
||||
g_set_error_literal (&error, GST_VULKAN_ERROR, GST_VULKAN_FAILED,
|
||||
|
@ -1352,7 +1355,7 @@ gst_vulkan_color_convert_transform (GstBaseTransform * bt, GstBuffer * inbuf,
|
|||
fence, &error))
|
||||
goto unlock_error;
|
||||
|
||||
for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&conv->quad->out_info); i++) {
|
||||
for (i = 0; i < out_n_mems; i++) {
|
||||
if (render_img_mems[i] != out_img_mems[i]) {
|
||||
VkImageMemoryBarrier out_image_memory_barrier;
|
||||
VkImageMemoryBarrier render_image_memory_barrier;
|
||||
|
|
|
@ -148,7 +148,7 @@ _image_to_raw_perform (gpointer impl, GstBuffer * inbuf, GstBuffer ** outbuf)
|
|||
GError *error = NULL;
|
||||
GstFlowReturn ret;
|
||||
VkResult err;
|
||||
int i;
|
||||
int i, n_mems;
|
||||
|
||||
if (!raw->cmd_pool) {
|
||||
if (!(raw->cmd_pool =
|
||||
|
@ -198,7 +198,8 @@ _image_to_raw_perform (gpointer impl, GstBuffer * inbuf, GstBuffer ** outbuf)
|
|||
goto unlock_error;
|
||||
}
|
||||
|
||||
for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&raw->out_info); i++) {
|
||||
n_mems = gst_buffer_n_memory (*outbuf);
|
||||
for (i = 0; i < n_mems; i++) {
|
||||
VkBufferImageCopy region;
|
||||
GstMemory *in_mem, *out_mem;
|
||||
GstVulkanBufferMemory *buf_mem;
|
||||
|
|
|
@ -228,6 +228,8 @@ _raw_to_buffer_set_caps (gpointer impl, GstCaps * in_caps, GstCaps * out_caps)
|
|||
struct RawToBufferUpload *raw = impl;
|
||||
guint out_width, out_height;
|
||||
guint i;
|
||||
VkFormat vk_fmts[4] = { VK_FORMAT_UNDEFINED, };
|
||||
int n_imgs;
|
||||
|
||||
if (!gst_video_info_from_caps (&raw->in_info, in_caps))
|
||||
return FALSE;
|
||||
|
@ -238,14 +240,16 @@ _raw_to_buffer_set_caps (gpointer impl, GstCaps * in_caps, GstCaps * out_caps)
|
|||
out_width = GST_VIDEO_INFO_WIDTH (&raw->out_info);
|
||||
out_height = GST_VIDEO_INFO_HEIGHT (&raw->out_info);
|
||||
|
||||
for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&raw->out_info); i++) {
|
||||
GstVulkanImageMemory *img_mem;
|
||||
VkFormat vk_format;
|
||||
if (!gst_vulkan_format_from_video_info_2 (raw->upload->
|
||||
device->physical_device, &raw->out_info, VK_IMAGE_TILING_OPTIMAL,
|
||||
FALSE, vk_fmts, &n_imgs, NULL))
|
||||
return FALSE;
|
||||
|
||||
vk_format = gst_vulkan_format_from_video_info (&raw->out_info, i);
|
||||
for (i = 0; i < n_imgs; i++) {
|
||||
GstVulkanImageMemory *img_mem;
|
||||
|
||||
img_mem = (GstVulkanImageMemory *)
|
||||
gst_vulkan_image_memory_alloc (raw->upload->device, vk_format,
|
||||
gst_vulkan_image_memory_alloc (raw->upload->device, vk_fmts[i],
|
||||
out_width, out_height, VK_IMAGE_TILING_OPTIMAL,
|
||||
VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT,
|
||||
VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT);
|
||||
|
@ -272,7 +276,7 @@ _raw_to_buffer_perform (gpointer impl, GstBuffer * inbuf, GstBuffer ** outbuf)
|
|||
struct RawToBufferUpload *raw = impl;
|
||||
GstVideoFrame v_frame;
|
||||
GstFlowReturn ret;
|
||||
guint i;
|
||||
guint i, n_mems;
|
||||
|
||||
if (!raw->pool) {
|
||||
GstStructure *config;
|
||||
|
@ -301,7 +305,8 @@ _raw_to_buffer_perform (gpointer impl, GstBuffer * inbuf, GstBuffer ** outbuf)
|
|||
return GST_FLOW_ERROR;
|
||||
}
|
||||
|
||||
for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&raw->out_info); i++) {
|
||||
n_mems = gst_buffer_n_memory (*outbuf);
|
||||
for (i = 0; i < n_mems; i++) {
|
||||
GstMapInfo map_info;
|
||||
gsize plane_size;
|
||||
GstMemory *mem;
|
||||
|
@ -440,7 +445,7 @@ _buffer_to_image_perform (gpointer impl, GstBuffer * inbuf, GstBuffer ** outbuf)
|
|||
GError *error = NULL;
|
||||
VkResult err;
|
||||
GstVulkanCommandBuffer *cmd_buf;
|
||||
guint i;
|
||||
guint i, n_mems;
|
||||
|
||||
if (!raw->cmd_pool) {
|
||||
if (!(raw->cmd_pool =
|
||||
|
@ -490,7 +495,8 @@ _buffer_to_image_perform (gpointer impl, GstBuffer * inbuf, GstBuffer ** outbuf)
|
|||
goto unlock_error;
|
||||
}
|
||||
|
||||
for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&raw->out_info); i++) {
|
||||
n_mems = gst_buffer_n_memory (*outbuf);
|
||||
for (i = 0; i < n_mems; i++) {
|
||||
VkBufferImageCopy region;
|
||||
GstMemory *in_mem, *out_mem;
|
||||
GstVulkanBufferMemory *buf_mem;
|
||||
|
@ -769,7 +775,7 @@ _raw_to_image_perform (gpointer impl, GstBuffer * inbuf, GstBuffer ** outbuf)
|
|||
GstVulkanCommandBuffer *cmd_buf;
|
||||
GError *error = NULL;
|
||||
VkResult err;
|
||||
guint i;
|
||||
guint i, n_mems;
|
||||
|
||||
if (!raw->cmd_pool) {
|
||||
if (!(raw->cmd_pool =
|
||||
|
@ -819,7 +825,8 @@ _raw_to_image_perform (gpointer impl, GstBuffer * inbuf, GstBuffer ** outbuf)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&raw->out_info); i++) {
|
||||
n_mems = gst_buffer_n_memory (*outbuf);
|
||||
for (i = 0; i < n_mems; i++) {
|
||||
VkBufferImageCopy region;
|
||||
GstMemory *in_mem, *out_mem;
|
||||
GstVulkanBufferMemory *buf_mem;
|
||||
|
|
|
@ -292,7 +292,7 @@ calculate_reorder_indexes (GstVideoFormat in_format,
|
|||
|
||||
static void
|
||||
update_descriptor_set (GstVulkanViewConvert * conv,
|
||||
GstVulkanImageView ** in_views)
|
||||
GstVulkanImageView ** in_views, guint n_mems)
|
||||
{
|
||||
GstVulkanVideoFilter *vfilter = GST_VULKAN_VIDEO_FILTER (conv);
|
||||
VkDescriptorImageInfo image_info[GST_VIDEO_MAX_PLANES];
|
||||
|
@ -308,7 +308,7 @@ update_descriptor_set (GstVulkanViewConvert * conv,
|
|||
in_flags = GST_VIDEO_INFO_MULTIVIEW_FLAGS (&vfilter->in_info);
|
||||
out_flags = GST_VIDEO_INFO_MULTIVIEW_FLAGS (&vfilter->out_info);
|
||||
|
||||
for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&vfilter->in_info); i++) {
|
||||
for (i = 0; i < n_mems; i++) {
|
||||
if ((in_flags & GST_VIDEO_MULTIVIEW_FLAGS_RIGHT_VIEW_FIRST) ==
|
||||
(out_flags & GST_VIDEO_MULTIVIEW_FLAGS_RIGHT_VIEW_FIRST)) {
|
||||
views[2 * i] = in_views[i]->view;
|
||||
|
@ -319,7 +319,7 @@ update_descriptor_set (GstVulkanViewConvert * conv,
|
|||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&vfilter->in_info) * 2; i++) {
|
||||
for (i = 0; i < n_mems * 2; i++) {
|
||||
/* *INDENT-OFF* */
|
||||
image_info[i] = (VkDescriptorImageInfo) {
|
||||
.imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL,
|
||||
|
@ -1778,7 +1778,8 @@ done:
|
|||
}
|
||||
|
||||
static gboolean
|
||||
create_descriptor_set_layout (GstVulkanViewConvert * conv, GError ** error)
|
||||
create_descriptor_set_layout (GstVulkanViewConvert * conv, guint n_mems,
|
||||
GError ** error)
|
||||
{
|
||||
GstVulkanVideoFilter *vfilter = GST_VULKAN_VIDEO_FILTER (conv);
|
||||
VkDescriptorSetLayoutBinding bindings[GST_VIDEO_MAX_PLANES * 2 + 1] =
|
||||
|
@ -1797,9 +1798,9 @@ create_descriptor_set_layout (GstVulkanViewConvert * conv, GError ** error)
|
|||
.pImmutableSamplers = NULL,
|
||||
.stageFlags = VK_SHADER_STAGE_VERTEX_BIT | VK_SHADER_STAGE_FRAGMENT_BIT
|
||||
};
|
||||
for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&vfilter->in_info) * 2; i++) {
|
||||
for (i = 0; i < n_mems * 2; i++) {
|
||||
bindings[descriptor_n++] = (VkDescriptorSetLayoutBinding) {
|
||||
.binding = i+1,
|
||||
.binding = i + 1,
|
||||
.descriptorCount = 1,
|
||||
.descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,
|
||||
.pImmutableSamplers = NULL,
|
||||
|
@ -1914,6 +1915,7 @@ gst_vulkan_view_convert_transform (GstBaseTransform * bt, GstBuffer * inbuf,
|
|||
GstVulkanFence *fence = NULL;
|
||||
GError *error = NULL;
|
||||
VkResult err;
|
||||
guint in_n_mems, out_n_mems;
|
||||
int i;
|
||||
|
||||
if (!gst_vulkan_full_screen_quad_set_input_buffer (conv->quad, inbuf, &error))
|
||||
|
@ -1926,7 +1928,8 @@ gst_vulkan_view_convert_transform (GstBaseTransform * bt, GstBuffer * inbuf,
|
|||
if (!fence)
|
||||
goto error;
|
||||
|
||||
for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&conv->quad->in_info); i++) {
|
||||
in_n_mems = gst_buffer_n_memory (inbuf);
|
||||
for (i = 0; i < in_n_mems; i++) {
|
||||
GstMemory *img_mem = gst_buffer_peek_memory (inbuf, i);
|
||||
if (!gst_is_vulkan_image_memory (img_mem)) {
|
||||
g_set_error_literal (&error, GST_VULKAN_ERROR, GST_VULKAN_FAILED,
|
||||
|
@ -1940,7 +1943,8 @@ gst_vulkan_view_convert_transform (GstBaseTransform * bt, GstBuffer * inbuf,
|
|||
gst_vulkan_trash_mini_object_unref,
|
||||
(GstMiniObject *) in_img_views[i]));
|
||||
}
|
||||
for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&conv->quad->out_info); i++) {
|
||||
out_n_mems = gst_buffer_n_memory (outbuf);
|
||||
for (i = 0; i < out_n_mems; i++) {
|
||||
GstMemory *mem = gst_buffer_peek_memory (outbuf, i);
|
||||
if (!gst_is_vulkan_image_memory (mem)) {
|
||||
g_set_error_literal (&error, GST_VULKAN_ERROR, GST_VULKAN_FAILED,
|
||||
|
@ -1964,7 +1968,7 @@ gst_vulkan_view_convert_transform (GstBaseTransform * bt, GstBuffer * inbuf,
|
|||
}
|
||||
|
||||
if (!conv->quad->descriptor_set_layout)
|
||||
if (!create_descriptor_set_layout (conv, &error))
|
||||
if (!create_descriptor_set_layout (conv, in_n_mems, &error))
|
||||
goto error;
|
||||
|
||||
if (!gst_vulkan_full_screen_quad_prepare_draw (conv->quad, fence, &error))
|
||||
|
@ -1992,7 +1996,7 @@ gst_vulkan_view_convert_transform (GstBaseTransform * bt, GstBuffer * inbuf,
|
|||
goto error;
|
||||
}
|
||||
|
||||
update_descriptor_set (conv, in_img_views);
|
||||
update_descriptor_set (conv, in_img_views, in_n_mems);
|
||||
if (!gst_vulkan_full_screen_quad_fill_command_buffer (conv->quad, cmd_buf,
|
||||
fence, &error))
|
||||
goto unlock_error;
|
||||
|
|
|
@ -129,7 +129,7 @@ create_sampler (GstVulkanFullScreenQuad * self, GError ** error)
|
|||
|
||||
static GstVulkanDescriptorSet *
|
||||
get_and_update_descriptor_set (GstVulkanFullScreenQuad * self,
|
||||
GstVulkanImageView ** views, GError ** error)
|
||||
GstVulkanImageView ** views, guint n_mems, GError ** error)
|
||||
{
|
||||
GstVulkanFullScreenQuadPrivate *priv = GET_PRIV (self);
|
||||
GstVulkanDescriptorSet *set;
|
||||
|
@ -169,7 +169,7 @@ get_and_update_descriptor_set (GstVulkanFullScreenQuad * self,
|
|||
};
|
||||
}
|
||||
|
||||
for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&self->in_info); i++) {
|
||||
for (i = 0; i < n_mems; i++) {
|
||||
image_info[i] = (VkDescriptorImageInfo) {
|
||||
.imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL,
|
||||
.imageView = views[i]->view,
|
||||
|
@ -198,12 +198,13 @@ get_and_update_descriptor_set (GstVulkanFullScreenQuad * self,
|
|||
static gboolean
|
||||
create_descriptor_set_layout (GstVulkanFullScreenQuad * self, GError ** error)
|
||||
{
|
||||
GstVulkanFullScreenQuadPrivate *priv = GET_PRIV (self);
|
||||
VkDescriptorSetLayoutBinding bindings[GST_VIDEO_MAX_PLANES + 1] = { {0,} };
|
||||
VkDescriptorSetLayoutCreateInfo layout_info;
|
||||
VkDescriptorSetLayout descriptor_set_layout;
|
||||
int descriptor_n = 0;
|
||||
VkResult err;
|
||||
int i;
|
||||
int i, n_mems;
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
bindings[descriptor_n++] = (VkDescriptorSetLayoutBinding) {
|
||||
|
@ -213,7 +214,8 @@ create_descriptor_set_layout (GstVulkanFullScreenQuad * self, GError ** error)
|
|||
.pImmutableSamplers = NULL,
|
||||
.stageFlags = VK_SHADER_STAGE_VERTEX_BIT | VK_SHADER_STAGE_FRAGMENT_BIT
|
||||
};
|
||||
for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&self->in_info); i++) {
|
||||
n_mems = gst_buffer_n_memory (priv->inbuf);
|
||||
for (i = 0; i < n_mems; i++) {
|
||||
bindings[descriptor_n++] = (VkDescriptorSetLayoutBinding) {
|
||||
.binding = i+1,
|
||||
.descriptorCount = 1,
|
||||
|
@ -295,9 +297,10 @@ create_render_pass (GstVulkanFullScreenQuad * self, GError ** error)
|
|||
VkSubpassDescription subpass;
|
||||
VkRenderPass render_pass;
|
||||
VkResult err;
|
||||
int i;
|
||||
int i, n_mems;
|
||||
|
||||
for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&self->out_info); i++) {
|
||||
n_mems = gst_buffer_n_memory (priv->outbuf);
|
||||
for (i = 0; i < n_mems; i++) {
|
||||
/* *INDENT-OFF* */
|
||||
color_attachments[i] = (VkAttachmentDescription) {
|
||||
.format = gst_vulkan_format_from_video_info (&self->out_info, i),
|
||||
|
@ -321,14 +324,14 @@ create_render_pass (GstVulkanFullScreenQuad * self, GError ** error)
|
|||
/* *INDENT-OFF* */
|
||||
subpass = (VkSubpassDescription) {
|
||||
.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS,
|
||||
.colorAttachmentCount = GST_VIDEO_INFO_N_PLANES (&self->out_info),
|
||||
.colorAttachmentCount = n_mems,
|
||||
.pColorAttachments = color_attachment_refs
|
||||
};
|
||||
|
||||
render_pass_info = (VkRenderPassCreateInfo) {
|
||||
.sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO,
|
||||
.pNext = NULL,
|
||||
.attachmentCount = GST_VIDEO_INFO_N_PLANES (&self->out_info),
|
||||
.attachmentCount = n_mems,
|
||||
.pAttachments = color_attachments,
|
||||
.subpassCount = 1,
|
||||
.pSubpasses = &subpass
|
||||
|
@ -523,7 +526,7 @@ create_pipeline (GstVulkanFullScreenQuad * self, GError ** error)
|
|||
.pNext = NULL,
|
||||
.logicOpEnable = VK_FALSE,
|
||||
.logicOp = VK_LOGIC_OP_COPY,
|
||||
.attachmentCount = GST_VIDEO_INFO_N_PLANES (&self->out_info),
|
||||
.attachmentCount = gst_buffer_n_memory (priv->outbuf),
|
||||
.pAttachments = color_blend_attachments,
|
||||
.blendConstants = { 0.0f, 0.0f, 0.0f, 0.0f }
|
||||
};
|
||||
|
@ -575,7 +578,7 @@ create_descriptor_pool (GstVulkanFullScreenQuad * self, GError ** error)
|
|||
/* *INDENT-OFF* */
|
||||
pool_sizes[0] = (VkDescriptorPoolSize) {
|
||||
.type = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,
|
||||
.descriptorCount = max_sets * GST_VIDEO_INFO_N_PLANES (&self->in_info),
|
||||
.descriptorCount = max_sets * gst_buffer_n_memory (priv->inbuf),
|
||||
};
|
||||
|
||||
if (priv->uniforms) {
|
||||
|
@ -615,7 +618,7 @@ create_descriptor_pool (GstVulkanFullScreenQuad * self, GError ** error)
|
|||
|
||||
static gboolean
|
||||
create_framebuffer (GstVulkanFullScreenQuad * self, GstVulkanImageView ** views,
|
||||
GError ** error)
|
||||
guint n_mems, GError ** error)
|
||||
{
|
||||
VkImageView attachments[GST_VIDEO_MAX_PLANES] = { 0, };
|
||||
VkFramebufferCreateInfo framebuffer_info;
|
||||
|
@ -623,7 +626,7 @@ create_framebuffer (GstVulkanFullScreenQuad * self, GstVulkanImageView ** views,
|
|||
VkResult err;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&self->out_info); i++) {
|
||||
for (i = 0; i < n_mems; i++) {
|
||||
attachments[i] = views[i]->view;
|
||||
}
|
||||
|
||||
|
@ -632,7 +635,7 @@ create_framebuffer (GstVulkanFullScreenQuad * self, GstVulkanImageView ** views,
|
|||
.sType = VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO,
|
||||
.pNext = NULL,
|
||||
.renderPass = (VkRenderPass) self->render_pass->handle,
|
||||
.attachmentCount = GST_VIDEO_INFO_N_PLANES (&self->out_info),
|
||||
.attachmentCount = n_mems,
|
||||
.pAttachments = attachments,
|
||||
.width = GST_VIDEO_INFO_WIDTH (&self->out_info),
|
||||
.height = GST_VIDEO_INFO_HEIGHT (&self->out_info),
|
||||
|
@ -1373,7 +1376,7 @@ gst_vulkan_full_screen_quad_prepare_draw (GstVulkanFullScreenQuad * self,
|
|||
GstVulkanFullScreenQuadPrivate *priv;
|
||||
GstVulkanImageView *in_views[GST_VIDEO_MAX_PLANES] = { NULL, };
|
||||
GstVulkanImageView *out_views[GST_VIDEO_MAX_PLANES] = { NULL, };
|
||||
int i;
|
||||
int i, n_mems;
|
||||
|
||||
g_return_val_if_fail (GST_IS_VULKAN_FULL_SCREEN_QUAD (self), FALSE);
|
||||
g_return_val_if_fail (fence != NULL, FALSE);
|
||||
|
@ -1392,7 +1395,8 @@ gst_vulkan_full_screen_quad_prepare_draw (GstVulkanFullScreenQuad * self,
|
|||
goto error;
|
||||
|
||||
if (!self->descriptor_set) {
|
||||
for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&self->in_info); i++) {
|
||||
n_mems = gst_buffer_n_memory (priv->inbuf);
|
||||
for (i = 0; i < n_mems; i++) {
|
||||
GstVulkanImageMemory *img_mem = peek_image_from_buffer (priv->inbuf, i);
|
||||
if (!gst_is_vulkan_image_memory ((GstMemory *) img_mem)) {
|
||||
g_set_error_literal (error, GST_VULKAN_ERROR, GST_VULKAN_FAILED,
|
||||
|
@ -1406,12 +1410,13 @@ gst_vulkan_full_screen_quad_prepare_draw (GstVulkanFullScreenQuad * self,
|
|||
(GstMiniObject *) in_views[i]));
|
||||
}
|
||||
if (!(self->descriptor_set =
|
||||
get_and_update_descriptor_set (self, in_views, error)))
|
||||
get_and_update_descriptor_set (self, in_views, n_mems, error)))
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (!self->framebuffer) {
|
||||
for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&self->out_info); i++) {
|
||||
n_mems = gst_buffer_n_memory (priv->outbuf);
|
||||
for (i = 0; i < n_mems; i++) {
|
||||
GstVulkanImageMemory *img_mem = peek_image_from_buffer (priv->outbuf, i);
|
||||
if (!gst_is_vulkan_image_memory ((GstMemory *) img_mem)) {
|
||||
g_set_error_literal (error, GST_VULKAN_ERROR, GST_VULKAN_FAILED,
|
||||
|
@ -1424,7 +1429,7 @@ gst_vulkan_full_screen_quad_prepare_draw (GstVulkanFullScreenQuad * self,
|
|||
gst_vulkan_trash_mini_object_unref,
|
||||
(GstMiniObject *) out_views[i]));
|
||||
}
|
||||
if (!create_framebuffer (self, out_views, error))
|
||||
if (!create_framebuffer (self, out_views, n_mems, error))
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
@ -1461,6 +1466,7 @@ gst_vulkan_full_screen_quad_fill_command_buffer (GstVulkanFullScreenQuad * self,
|
|||
GstVulkanImageView *in_views[GST_VIDEO_MAX_PLANES] = { NULL, };
|
||||
GstVulkanImageView *out_views[GST_VIDEO_MAX_PLANES] = { NULL, };
|
||||
int i;
|
||||
guint n_in_mems, n_out_mems;
|
||||
|
||||
g_return_val_if_fail (GST_IS_VULKAN_FULL_SCREEN_QUAD (self), FALSE);
|
||||
g_return_val_if_fail (cmd != NULL, FALSE);
|
||||
|
@ -1468,7 +1474,8 @@ gst_vulkan_full_screen_quad_fill_command_buffer (GstVulkanFullScreenQuad * self,
|
|||
|
||||
priv = GET_PRIV (self);
|
||||
|
||||
for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&self->in_info); i++) {
|
||||
n_in_mems = gst_buffer_n_memory (priv->inbuf);
|
||||
for (i = 0; i < n_in_mems; i++) {
|
||||
GstVulkanImageMemory *img_mem = peek_image_from_buffer (priv->inbuf, i);
|
||||
if (!gst_is_vulkan_image_memory ((GstMemory *) img_mem)) {
|
||||
g_set_error_literal (error, GST_VULKAN_ERROR, GST_VULKAN_FAILED,
|
||||
|
@ -1480,7 +1487,8 @@ gst_vulkan_full_screen_quad_fill_command_buffer (GstVulkanFullScreenQuad * self,
|
|||
gst_vulkan_trash_list_acquire (self->trash_list, fence,
|
||||
gst_vulkan_trash_mini_object_unref, (GstMiniObject *) in_views[i]));
|
||||
}
|
||||
for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&self->out_info); i++) {
|
||||
n_out_mems = gst_buffer_n_memory (priv->outbuf);
|
||||
for (i = 0; i < n_out_mems; i++) {
|
||||
GstVulkanImageMemory *img_mem = peek_image_from_buffer (priv->outbuf, i);
|
||||
if (!gst_is_vulkan_image_memory ((GstMemory *) img_mem)) {
|
||||
g_set_error_literal (error, GST_VULKAN_ERROR, GST_VULKAN_FAILED,
|
||||
|
@ -1494,7 +1502,7 @@ gst_vulkan_full_screen_quad_fill_command_buffer (GstVulkanFullScreenQuad * self,
|
|||
(GstMiniObject *) out_views[i]));
|
||||
}
|
||||
|
||||
for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&self->in_info); i++) {
|
||||
for (i = 0; i < n_in_mems; i++) {
|
||||
/* *INDENT-OFF* */
|
||||
VkImageMemoryBarrier in_image_memory_barrier = {
|
||||
.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,
|
||||
|
@ -1524,7 +1532,7 @@ gst_vulkan_full_screen_quad_fill_command_buffer (GstVulkanFullScreenQuad * self,
|
|||
in_image_memory_barrier.newLayout;
|
||||
}
|
||||
|
||||
for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&self->out_info); i++) {
|
||||
for (i = 0; i < n_out_mems; i++) {
|
||||
/* *INDENT-OFF* */
|
||||
VkImageMemoryBarrier out_image_memory_barrier = {
|
||||
.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,
|
||||
|
@ -1569,7 +1577,7 @@ gst_vulkan_full_screen_quad_fill_command_buffer (GstVulkanFullScreenQuad * self,
|
|||
GST_VIDEO_INFO_WIDTH (&self->out_info),
|
||||
GST_VIDEO_INFO_HEIGHT (&self->out_info)
|
||||
},
|
||||
.clearValueCount = GST_VIDEO_INFO_N_PLANES (&self->out_info),
|
||||
.clearValueCount = n_out_mems,
|
||||
.pClearValues = clearColors,
|
||||
};
|
||||
/* *INDENT-ON* */
|
||||
|
|
Loading…
Reference in a new issue