diff options
author | Lynne <dev@lynne.ee> | 2020-03-12 16:46:01 +0000 |
---|---|---|
committer | Lynne <dev@lynne.ee> | 2020-03-12 18:16:11 +0000 |
commit | 08d0a8992d75bbcffe9e7f3392cc94a7f84fc9df (patch) | |
tree | 35513087e72a2b93a8b472f953cea8d95cf63b95 /libavutil/hwcontext_vulkan.c | |
parent | d4d74707fbfbe1890f15722c944609a1b4258f39 (diff) | |
download | ffmpeg-08d0a8992d75bbcffe9e7f3392cc94a7f84fc9df.tar.gz |
hwcontext_vulkan: minor corrections for DMABUF mapping
We need to consider the amount of layers instead of the image's planes.
Diffstat (limited to 'libavutil/hwcontext_vulkan.c')
-rw-r--r-- | libavutil/hwcontext_vulkan.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c index 0fe88e6b9f..8ed0e6edfa 100644 --- a/libavutil/hwcontext_vulkan.c +++ b/libavutil/hwcontext_vulkan.c @@ -1643,7 +1643,6 @@ static int vulkan_map_from_drm_frame_desc(AVHWFramesContext *hwfc, AVVkFrame **f AVHWDeviceContext *ctx = hwfc->device_ctx; AVVulkanDeviceContext *hwctx = ctx->hwctx; VulkanDevicePriv *p = ctx->internal->priv; - const int planes = av_pix_fmt_count_planes(hwfc->sw_format); 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]; @@ -1696,7 +1695,8 @@ static int vulkan_map_from_drm_frame_desc(AVHWFramesContext *hwfc, AVVkFrame **f req.memoryTypeBits = fdmp.memoryTypeBits; - err = alloc_mem(ctx, &req, 0x0, &idesc, &f->flags, &f->mem[i]); + err = alloc_mem(ctx, &req, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, + &idesc, &f->flags, &f->mem[i]); if (err) return err; @@ -1789,7 +1789,7 @@ static int vulkan_map_from_drm_frame_desc(AVHWFramesContext *hwfc, AVVkFrame **f } /* Bind the allocated memory to the images */ - ret = vkBindImageMemory2(hwctx->act_dev, planes, bind_info); + ret = vkBindImageMemory2(hwctx->act_dev, desc->nb_layers, bind_info); if (ret != VK_SUCCESS) { av_log(ctx, AV_LOG_ERROR, "Failed to bind memory: %s\n", vk_ret2str(ret)); @@ -1801,11 +1801,12 @@ static int vulkan_map_from_drm_frame_desc(AVHWFramesContext *hwfc, AVVkFrame **f return 0; fail: - for (int i = 0; i < planes; i++) { + for (int i = 0; i < desc->nb_layers; i++) { vkDestroyImage(hwctx->act_dev, f->img[i], hwctx->alloc); - vkFreeMemory(hwctx->act_dev, f->mem[i], hwctx->alloc); vkDestroySemaphore(hwctx->act_dev, f->sem[i], hwctx->alloc); } + for (int i = 0; i < desc->nb_objects; i++) + vkFreeMemory(hwctx->act_dev, f->mem[i], hwctx->alloc); av_free(f); |