1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

hwcontext_vulkan: support user-provided pools

If an external pool was provided we skipped all of frames init,
including the exec context.
This commit is contained in:
Lynne 2020-05-14 23:59:22 +01:00
parent c0b0807871
commit 3dd3d1b7fb
No known key found for this signature in database
GPG Key ID: A2FEA5F03F034464

View File

@ -1697,9 +1697,6 @@ static int vulkan_frames_init(AVHWFramesContext *hwfc)
AVVulkanDeviceContext *dev_hwctx = hwfc->device_ctx->hwctx; AVVulkanDeviceContext *dev_hwctx = hwfc->device_ctx->hwctx;
VulkanDevicePriv *p = hwfc->device_ctx->internal->priv; VulkanDevicePriv *p = hwfc->device_ctx->internal->priv;
if (hwfc->pool)
return 0;
/* Default pool flags */ /* Default pool flags */
hwctx->tiling = hwctx->tiling ? hwctx->tiling : p->use_linear_images ? hwctx->tiling = hwctx->tiling ? hwctx->tiling : p->use_linear_images ?
VK_IMAGE_TILING_LINEAR : VK_IMAGE_TILING_OPTIMAL; VK_IMAGE_TILING_LINEAR : VK_IMAGE_TILING_OPTIMAL;
@ -1722,6 +1719,9 @@ static int vulkan_frames_init(AVHWFramesContext *hwfc)
vulkan_frame_free(hwfc, (uint8_t *)f); vulkan_frame_free(hwfc, (uint8_t *)f);
/* If user did not specify a pool, hwfc->pool will be set to the internal one
* in hwcontext.c just after this gets called */
if (!hwfc->pool) {
hwfc->internal->pool_internal = av_buffer_pool_init2(sizeof(AVVkFrame), hwfc->internal->pool_internal = av_buffer_pool_init2(sizeof(AVVkFrame),
hwfc, vulkan_pool_alloc, hwfc, vulkan_pool_alloc,
NULL); NULL);
@ -1729,6 +1729,7 @@ static int vulkan_frames_init(AVHWFramesContext *hwfc)
free_exec_ctx(hwfc->device_ctx, &p->cmd); free_exec_ctx(hwfc->device_ctx, &p->cmd);
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
} }
}
return 0; return 0;
} }