hwcontext_vulkan: set usage for DRM imports to the frames context usage
authorLynne <dev@lynne.ee>
Thu, 14 May 2020 23:21:51 +0000 (00:21 +0100)
committerLynne <dev@lynne.ee>
Sat, 23 May 2020 18:07:43 +0000 (19:07 +0100)
They're nothing special, and there's no reason they should always use the
default flags.

libavutil/hwcontext_vulkan.c

index 9374b86..3e70252 100644 (file)
@@ -1944,6 +1944,7 @@ static int vulkan_map_from_drm_frame_desc(AVHWFramesContext *hwfc, AVVkFrame **f
     AVVulkanDeviceContext *hwctx = ctx->hwctx;
     VulkanDevicePriv *p = ctx->internal->priv;
     VulkanFramesPriv *fp = hwfc->internal->priv;
+    AVVulkanFramesContext *frames_hwctx = hwfc->hwctx;
     const AVPixFmtDescriptor *fmt_desc = av_pix_fmt_desc_get(hwfc->sw_format);
     const int has_modifiers = p->extensions & EXT_DRM_MODIFIER_FLAGS;
     VkSubresourceLayout plane_data[AV_NUM_DATA_POINTERS] = { 0 };
@@ -2043,7 +2044,7 @@ static int vulkan_map_from_drm_frame_desc(AVHWFramesContext *hwfc, AVVkFrame **f
             .flags                 = VK_IMAGE_CREATE_ALIAS_BIT,
             .tiling                = f->tiling,
             .initialLayout         = VK_IMAGE_LAYOUT_UNDEFINED, /* specs say so */
-            .usage                 = DEFAULT_USAGE_FLAGS,
+            .usage                 = frames_hwctx->usage,
             .samples               = VK_SAMPLE_COUNT_1_BIT,
             .pQueueFamilyIndices   = p->qfs,
             .queueFamilyIndexCount = p->num_qfs,