[FFmpeg-devel] [PATCH] vulkan: remove AVClass * from the context, use a logging pointer
Andreas Rheinhardt
andreas.rheinhardt at outlook.com
Wed Aug 14 13:18:21 EEST 2024
Lynne via ffmpeg-devel:
> The issue is that VulkanContext mostly always used the AVClass *
> from its structure, which we don't set in decode.
> ---
> libavcodec/vulkan_decode.c | 2 ++
> libavfilter/vf_avgblur_vulkan.c | 2 ++
> libavfilter/vf_blend_vulkan.c | 2 ++
> libavfilter/vf_bwdif_vulkan.c | 4 +--
> libavfilter/vf_chromaber_vulkan.c | 2 ++
> libavfilter/vf_flip_vulkan.c | 2 ++
> libavfilter/vf_gblur_vulkan.c | 2 ++
> libavfilter/vf_libplacebo.c | 2 ++
> libavfilter/vf_nlmeans_vulkan.c | 2 ++
> libavfilter/vf_overlay_vulkan.c | 2 ++
> libavfilter/vf_scale_vulkan.c | 2 ++
> libavfilter/vf_transpose_vulkan.c | 2 ++
> libavfilter/vf_xfade_vulkan.c | 2 ++
> libavfilter/vsrc_testsrc_vulkan.c | 2 ++
> libavfilter/vulkan_filter.c | 33 ++++++++++++++++++----
> libavfilter/vulkan_filter.h | 4 +++
> libavutil/vulkan.c | 46 +++++++++++++++----------------
> libavutil/vulkan.h | 2 +-
> 18 files changed, 83 insertions(+), 32 deletions(-)
>
> diff --git a/libavcodec/vulkan_decode.c b/libavcodec/vulkan_decode.c
> index b89bfa17f2..67e0584814 100644
> --- a/libavcodec/vulkan_decode.c
> +++ b/libavcodec/vulkan_decode.c
> @@ -1165,6 +1165,8 @@ int ff_vk_decode_init(AVCodecContext *avctx)
> s = &ctx->s;
> vk = &ctx->s.vkfn;
>
> + s->log = avctx;
> +
> s->frames_ref = av_buffer_ref(avctx->hw_frames_ctx);
> s->frames = (AVHWFramesContext *)s->frames_ref->data;
> s->hwfc = s->frames->hwctx;
> diff --git a/libavfilter/vf_avgblur_vulkan.c b/libavfilter/vf_avgblur_vulkan.c
> index 6bc1b616a6..e38307fbdf 100644
> --- a/libavfilter/vf_avgblur_vulkan.c
> +++ b/libavfilter/vf_avgblur_vulkan.c
> @@ -26,6 +26,8 @@
> #include "video.h"
>
> typedef struct AvgBlurVulkanContext {
> + const AVClass *class;
> +
> FFVulkanContext vkctx;
>
> int initialized;
> diff --git a/libavfilter/vf_blend_vulkan.c b/libavfilter/vf_blend_vulkan.c
> index 417be766b8..aa05126cc5 100644
> --- a/libavfilter/vf_blend_vulkan.c
> +++ b/libavfilter/vf_blend_vulkan.c
> @@ -41,6 +41,8 @@ typedef struct FilterParamsVulkan {
> } FilterParamsVulkan;
>
> typedef struct BlendVulkanContext {
> + const AVClass *class;
> +
> FFVulkanContext vkctx;
> FFFrameSync fs;
>
> diff --git a/libavfilter/vf_bwdif_vulkan.c b/libavfilter/vf_bwdif_vulkan.c
> index 57711fb672..b024acb50e 100644
> --- a/libavfilter/vf_bwdif_vulkan.c
> +++ b/libavfilter/vf_bwdif_vulkan.c
> @@ -323,6 +323,7 @@ static int bwdif_vulkan_config_input(AVFilterLink *inlink)
> return 0;
>
> /* Save the ref, without reffing it */
> + vkctx->log = s;
1. The comment is for the line below and not for this.
2. Why do you want to use the private context as logcontext? We normally
always log to the AVFilterContext.
> vkctx->input_frames_ref = inlink->hw_frames_ctx;
>
> /* Defaults */
> @@ -349,9 +350,6 @@ static int bwdif_vulkan_config_output(AVFilterLink *outlink)
> if (err < 0)
> return err;
>
> - /* For logging */
> - vkctx->class = y->class;
> -
> outlink->hw_frames_ctx = av_buffer_ref(vkctx->frames_ref);
> if (!outlink->hw_frames_ctx)
> return AVERROR(ENOMEM);
> diff --git a/libavfilter/vf_chromaber_vulkan.c b/libavfilter/vf_chromaber_vulkan.c
> index 0b96a7400f..3b50776e07 100644
> --- a/libavfilter/vf_chromaber_vulkan.c
> +++ b/libavfilter/vf_chromaber_vulkan.c
> @@ -26,6 +26,8 @@
> #include "video.h"
>
> typedef struct ChromaticAberrationVulkanContext {
> + const AVClass *class;
> +
> FFVulkanContext vkctx;
>
> int initialized;
> diff --git a/libavfilter/vf_flip_vulkan.c b/libavfilter/vf_flip_vulkan.c
> index ecd2567ebc..966cfbfcb5 100644
> --- a/libavfilter/vf_flip_vulkan.c
> +++ b/libavfilter/vf_flip_vulkan.c
> @@ -33,6 +33,8 @@ enum FlipType {
> };
>
> typedef struct FlipVulkanContext {
> + const AVClass *class;
> +
> FFVulkanContext vkctx;
>
> int initialized;
> diff --git a/libavfilter/vf_gblur_vulkan.c b/libavfilter/vf_gblur_vulkan.c
> index 09be6015c3..93d0bb82fe 100644
> --- a/libavfilter/vf_gblur_vulkan.c
> +++ b/libavfilter/vf_gblur_vulkan.c
> @@ -31,6 +31,8 @@
> #define GBLUR_MAX_KERNEL_SIZE 127
>
> typedef struct GBlurVulkanContext {
> + const AVClass *class;
> +
> FFVulkanContext vkctx;
>
> int initialized;
> diff --git a/libavfilter/vf_libplacebo.c b/libavfilter/vf_libplacebo.c
> index be9000aa8e..40887e7b03 100644
> --- a/libavfilter/vf_libplacebo.c
> +++ b/libavfilter/vf_libplacebo.c
> @@ -151,6 +151,8 @@ typedef struct LibplaceboInput {
> } LibplaceboInput;
>
> typedef struct LibplaceboContext {
> + const AVClass *class;
> +
> /* lavfi vulkan*/
> FFVulkanContext vkctx;
>
> diff --git a/libavfilter/vf_nlmeans_vulkan.c b/libavfilter/vf_nlmeans_vulkan.c
> index be9305854b..d6abf3fbc4 100644
> --- a/libavfilter/vf_nlmeans_vulkan.c
> +++ b/libavfilter/vf_nlmeans_vulkan.c
> @@ -31,6 +31,8 @@
> #define TYPE_SIZE (TYPE_ELEMS*4)
>
> typedef struct NLMeansVulkanContext {
> + const AVClass *class;
> +
> FFVulkanContext vkctx;
>
> int initialized;
> diff --git a/libavfilter/vf_overlay_vulkan.c b/libavfilter/vf_overlay_vulkan.c
> index c09de24142..0c76050490 100644
> --- a/libavfilter/vf_overlay_vulkan.c
> +++ b/libavfilter/vf_overlay_vulkan.c
> @@ -27,6 +27,8 @@
> #include "video.h"
>
> typedef struct OverlayVulkanContext {
> + const AVClass *class;
> +
> FFVulkanContext vkctx;
> FFFrameSync fs;
>
> diff --git a/libavfilter/vf_scale_vulkan.c b/libavfilter/vf_scale_vulkan.c
> index 7210509de3..a90343f36c 100644
> --- a/libavfilter/vf_scale_vulkan.c
> +++ b/libavfilter/vf_scale_vulkan.c
> @@ -35,6 +35,8 @@ enum ScalerFunc {
> };
>
> typedef struct ScaleVulkanContext {
> + const AVClass *class;
> +
> FFVulkanContext vkctx;
>
> int initialized;
> diff --git a/libavfilter/vf_transpose_vulkan.c b/libavfilter/vf_transpose_vulkan.c
> index 263a934dc5..18761b62bf 100644
> --- a/libavfilter/vf_transpose_vulkan.c
> +++ b/libavfilter/vf_transpose_vulkan.c
> @@ -28,6 +28,8 @@
> #include "video.h"
>
> typedef struct TransposeVulkanContext {
> + const AVClass *class;
> +
> FFVulkanContext vkctx;
>
> int initialized;
> diff --git a/libavfilter/vf_xfade_vulkan.c b/libavfilter/vf_xfade_vulkan.c
> index be041eaef4..e2d41cf2fe 100644
> --- a/libavfilter/vf_xfade_vulkan.c
> +++ b/libavfilter/vf_xfade_vulkan.c
> @@ -34,6 +34,8 @@ typedef struct XFadeParameters {
> } XFadeParameters;
>
> typedef struct XFadeVulkanContext {
> + const AVClass *class;
> +
> FFVulkanContext vkctx;
>
> int transition;
> diff --git a/libavfilter/vsrc_testsrc_vulkan.c b/libavfilter/vsrc_testsrc_vulkan.c
> index 480b23ac9f..e9fcf69b52 100644
> --- a/libavfilter/vsrc_testsrc_vulkan.c
> +++ b/libavfilter/vsrc_testsrc_vulkan.c
> @@ -37,6 +37,8 @@ typedef struct TestSrcVulkanPushData {
> } TestSrcVulkanPushData;
>
> typedef struct TestSrcVulkanContext {
> + const AVClass *class;
> +
> FFVulkanContext vkctx;
>
> int initialized;
> diff --git a/libavfilter/vulkan_filter.c b/libavfilter/vulkan_filter.c
> index cef42eeb4d..5a05a16a84 100644
> --- a/libavfilter/vulkan_filter.c
> +++ b/libavfilter/vulkan_filter.c
> @@ -163,11 +163,10 @@ skip:
> return err;
> }
>
> -int ff_vk_filter_config_input(AVFilterLink *inlink)
> +int ff_vk_filter_config_input_base(AVFilterLink *inlink, FFVulkanContext *s)
> {
> AVHWFramesContext *input_frames;
> AVFilterContext *avctx = inlink->dst;
> - FFVulkanContext *s = inlink->dst->priv;
>
> if (!inlink->hw_frames_ctx) {
> av_log(inlink->dst, AV_LOG_ERROR, "Vulkan filtering requires a "
> @@ -195,14 +194,26 @@ int ff_vk_filter_config_input(AVFilterLink *inlink)
> return 0;
> }
>
> -int ff_vk_filter_config_output(AVFilterLink *outlink)
> +int ff_vk_filter_config_input(AVFilterLink *inlink)
> +{
> + struct {
> + const AVClass *av_class;
> + FFVulkanContext vkctx;
> + } *base = inlink->dst->priv;
This is not ok.
A struct {
Type1 a;
Type2 b;
};
can't simply be used to read from a
struct {
Type1 a;
Type2 b;
...
};
This would only be permissible if there were a
union {
struct {
Type1 a;
Type2 b;
};
struct {
Type1 a;
Type2 b;
...
};
};
visible to this function and if the private context were such a union
(it would then work by the common-initial-sequence guarantee of the spec).
Without such a union, nothing guarantees that the offset of b in these
two structures is the same.
> +
> + base->vkctx.log = inlink->dst->priv;
Once again: We typically don't log to the private context.
> +
> + return ff_vk_filter_config_input_base(inlink, &base->vkctx);
> +}
> +
> +int ff_vk_filter_config_output_base(AVFilterLink *outlink, FFVulkanContext *s)
> {
> int err;
> - FFVulkanContext *s = outlink->src->priv;
>
> av_buffer_unref(&outlink->hw_frames_ctx);
>
> - err = ff_vk_filter_init_context(outlink->src, s, s->input_frames_ref,
> + err = ff_vk_filter_init_context(outlink->src, s,
> + s->input_frames_ref,
> s->output_width, s->output_height,
> s->output_format);
> if (err < 0)
> @@ -218,6 +229,18 @@ int ff_vk_filter_config_output(AVFilterLink *outlink)
> return err;
> }
>
> +int ff_vk_filter_config_output(AVFilterLink *outlink)
> +{
> + struct {
> + const AVClass *av_class;
> + FFVulkanContext vkctx;
> + } *base = outlink->src->priv;
> +
> + base->vkctx.log = outlink->src->priv;
> +
> + return ff_vk_filter_config_output_base(outlink, &base->vkctx);
> +}
> +
> int ff_vk_filter_init(AVFilterContext *avctx)
> {
> FFVulkanContext *s = avctx->priv;
> diff --git a/libavfilter/vulkan_filter.h b/libavfilter/vulkan_filter.h
> index d2c14601d9..112dbd1400 100644
> --- a/libavfilter/vulkan_filter.h
> +++ b/libavfilter/vulkan_filter.h
> @@ -29,6 +29,10 @@
> * General lavfi IO functions
> */
> int ff_vk_filter_init (AVFilterContext *avctx);
> +int ff_vk_filter_config_input_base(AVFilterLink *inlink, FFVulkanContext *s);
> +int ff_vk_filter_config_output_base(AVFilterLink *outlink, FFVulkanContext *s);
> +
> +/* Relies on { AVClass, FFVulkanContext, ... } being the filter context layout. */
> int ff_vk_filter_config_input (AVFilterLink *inlink);
> int ff_vk_filter_config_output(AVFilterLink *outlink);
>
> diff --git a/libavutil/vulkan.c b/libavutil/vulkan.c
> index bb8e7ae786..3e094f5950 100644
> --- a/libavutil/vulkan.c
> +++ b/libavutil/vulkan.c
> @@ -305,7 +305,7 @@ int ff_vk_exec_pool_init(FFVulkanContext *s, FFVkQueueFamilyCtx *qf,
> ret = vk->CreateCommandPool(s->hwctx->act_dev, &cqueue_create,
> s->hwctx->alloc, &pool->cmd_buf_pool);
> if (ret != VK_SUCCESS) {
> - av_log(s, AV_LOG_ERROR, "Command pool creation failure: %s\n",
> + av_log(s->log, AV_LOG_ERROR, "Command pool creation failure: %s\n",
> ff_vk_ret2str(ret));
> err = AVERROR_EXTERNAL;
> goto fail;
> @@ -328,7 +328,7 @@ int ff_vk_exec_pool_init(FFVulkanContext *s, FFVkQueueFamilyCtx *qf,
> ret = vk->AllocateCommandBuffers(s->hwctx->act_dev, &cbuf_create,
> pool->cmd_bufs);
> if (ret != VK_SUCCESS) {
> - av_log(s, AV_LOG_ERROR, "Command buffer alloc failure: %s\n",
> + av_log(s->log, AV_LOG_ERROR, "Command buffer alloc failure: %s\n",
> ff_vk_ret2str(ret));
> err = AVERROR_EXTERNAL;
> goto fail;
> @@ -345,7 +345,7 @@ int ff_vk_exec_pool_init(FFVulkanContext *s, FFVkQueueFamilyCtx *qf,
> ret = vk->CreateQueryPool(s->hwctx->act_dev, &query_pool_info,
> s->hwctx->alloc, &pool->query_pool);
> if (ret != VK_SUCCESS) {
> - av_log(s, AV_LOG_ERROR, "Query pool alloc failure: %s\n",
> + av_log(s->log, AV_LOG_ERROR, "Query pool alloc failure: %s\n",
> ff_vk_ret2str(ret));
> err = AVERROR_EXTERNAL;
> goto fail;
> @@ -402,7 +402,7 @@ int ff_vk_exec_pool_init(FFVulkanContext *s, FFVkQueueFamilyCtx *qf,
> ret = vk->CreateFence(s->hwctx->act_dev, &fence_create, s->hwctx->alloc,
> &e->fence);
> if (ret != VK_SUCCESS) {
> - av_log(s, AV_LOG_ERROR, "Failed to create submission fence: %s\n",
> + av_log(s->log, AV_LOG_ERROR, "Failed to create submission fence: %s\n",
> ff_vk_ret2str(ret));
> return AVERROR_EXTERNAL;
> }
> @@ -521,7 +521,7 @@ int ff_vk_exec_start(FFVulkanContext *s, FFVkExecContext *e)
>
> ret = vk->BeginCommandBuffer(e->buf, &cmd_start);
> if (ret != VK_SUCCESS) {
> - av_log(s, AV_LOG_ERROR, "Failed to start command recoding: %s\n",
> + av_log(s->log, AV_LOG_ERROR, "Failed to start command recoding: %s\n",
> ff_vk_ret2str(ret));
> return AVERROR_EXTERNAL;
> }
> @@ -728,7 +728,7 @@ int ff_vk_exec_submit(FFVulkanContext *s, FFVkExecContext *e)
>
> ret = vk->EndCommandBuffer(e->buf);
> if (ret != VK_SUCCESS) {
> - av_log(s, AV_LOG_ERROR, "Unable to finish command buffer: %s\n",
> + av_log(s->log, AV_LOG_ERROR, "Unable to finish command buffer: %s\n",
> ff_vk_ret2str(ret));
> ff_vk_exec_discard_deps(s, e);
> return AVERROR_EXTERNAL;
> @@ -739,7 +739,7 @@ int ff_vk_exec_submit(FFVulkanContext *s, FFVkExecContext *e)
> s->hwctx->unlock_queue(s->device, e->qf, e->qi);
>
> if (ret != VK_SUCCESS) {
> - av_log(s, AV_LOG_ERROR, "Unable to submit command buffer: %s\n",
> + av_log(s->log, AV_LOG_ERROR, "Unable to submit command buffer: %s\n",
> ff_vk_ret2str(ret));
> ff_vk_exec_discard_deps(s, e);
> return AVERROR_EXTERNAL;
> @@ -811,7 +811,7 @@ int ff_vk_alloc_mem(FFVulkanContext *s, VkMemoryRequirements *req,
> }
>
> if (index < 0) {
> - av_log(s->device, AV_LOG_ERROR, "No memory type found for flags 0x%x\n",
> + av_log(s->log, AV_LOG_ERROR, "No memory type found for flags 0x%x\n",
> req_flags);
> return AVERROR(EINVAL);
> }
> @@ -868,7 +868,7 @@ int ff_vk_create_buf(FFVulkanContext *s, FFVkBuffer *buf, size_t size,
>
> ret = vk->CreateBuffer(s->hwctx->act_dev, &buf_spawn, s->hwctx->alloc, &buf->buf);
> if (ret != VK_SUCCESS) {
> - av_log(s, AV_LOG_ERROR, "Failed to create buffer: %s\n",
> + av_log(s->log, AV_LOG_ERROR, "Failed to create buffer: %s\n",
> ff_vk_ret2str(ret));
> return AVERROR_EXTERNAL;
> }
> @@ -898,7 +898,7 @@ int ff_vk_create_buf(FFVulkanContext *s, FFVkBuffer *buf, size_t size,
>
> ret = vk->BindBufferMemory(s->hwctx->act_dev, buf->buf, buf->mem, 0);
> if (ret != VK_SUCCESS) {
> - av_log(s, AV_LOG_ERROR, "Failed to bind memory to buffer: %s\n",
> + av_log(s->log, AV_LOG_ERROR, "Failed to bind memory to buffer: %s\n",
> ff_vk_ret2str(ret));
> return AVERROR_EXTERNAL;
> }
> @@ -964,7 +964,7 @@ int ff_vk_map_buffers(FFVulkanContext *s, FFVkBuffer **buf, uint8_t *mem[],
> ret = vk->MapMemory(s->hwctx->act_dev, buf[i]->mem, 0,
> VK_WHOLE_SIZE, 0, &dst);
> if (ret != VK_SUCCESS) {
> - av_log(s, AV_LOG_ERROR, "Failed to map buffer memory: %s\n",
> + av_log(s->log, AV_LOG_ERROR, "Failed to map buffer memory: %s\n",
> ff_vk_ret2str(ret));
> return AVERROR_EXTERNAL;
> }
> @@ -989,7 +989,7 @@ int ff_vk_map_buffers(FFVulkanContext *s, FFVkBuffer **buf, uint8_t *mem[],
> ret = vk->InvalidateMappedMemoryRanges(s->hwctx->act_dev, inval_count,
> inval_list);
> if (ret != VK_SUCCESS) {
> - av_log(s, AV_LOG_ERROR, "Failed to invalidate memory: %s\n",
> + av_log(s->log, AV_LOG_ERROR, "Failed to invalidate memory: %s\n",
> ff_vk_ret2str(ret));
> return AVERROR_EXTERNAL;
> }
> @@ -1024,7 +1024,7 @@ int ff_vk_unmap_buffers(FFVulkanContext *s, FFVkBuffer **buf, int nb_buffers,
> ret = vk->FlushMappedMemoryRanges(s->hwctx->act_dev, flush_count,
> flush_list);
> if (ret != VK_SUCCESS) {
> - av_log(s, AV_LOG_ERROR, "Failed to flush memory: %s\n",
> + av_log(s->log, AV_LOG_ERROR, "Failed to flush memory: %s\n",
> ff_vk_ret2str(ret));
> err = AVERROR_EXTERNAL; /* We still want to try to unmap them */
> }
> @@ -1102,7 +1102,7 @@ int ff_vk_get_pooled_buffer(FFVulkanContext *ctx, AVBufferPool **buf_pool,
> ff_vk_free_buf(ctx, data);
> memset(data, 0, sizeof(*data));
>
> - av_log(ctx, AV_LOG_DEBUG, "Allocating buffer of %"SIZE_SPECIFIER" bytes for pool %p\n",
> + av_log(ctx->log, AV_LOG_DEBUG, "Allocating buffer of %"SIZE_SPECIFIER" bytes for pool %p\n",
> size, *buf_pool);
>
> err = ff_vk_create_buf(ctx, data, size,
> @@ -1168,7 +1168,7 @@ int ff_vk_init_sampler(FFVulkanContext *s, VkSampler *sampler,
> ret = vk->CreateSampler(s->hwctx->act_dev, &sampler_info,
> s->hwctx->alloc, sampler);
> if (ret != VK_SUCCESS) {
> - av_log(s, AV_LOG_ERROR, "Unable to init sampler: %s\n",
> + av_log(s->log, AV_LOG_ERROR, "Unable to init sampler: %s\n",
> ff_vk_ret2str(ret));
> return AVERROR_EXTERNAL;
> }
> @@ -1254,7 +1254,7 @@ int ff_vk_create_imageviews(FFVulkanContext *s, FFVkExecContext *e,
> ret = vk->CreateImageView(s->hwctx->act_dev, &view_create_info,
> s->hwctx->alloc, &iv->views[i]);
> if (ret != VK_SUCCESS) {
> - av_log(s, AV_LOG_ERROR, "Failed to create imageview: %s\n",
> + av_log(s->log, AV_LOG_ERROR, "Failed to create imageview: %s\n",
> ff_vk_ret2str(ret));
> err = AVERROR_EXTERNAL;
> goto fail;
> @@ -1405,7 +1405,7 @@ int ff_vk_shader_create(FFVulkanContext *s, FFVkSPIRVShader *shd,
>
> shd->shader.pName = entrypoint;
>
> - av_log(s, AV_LOG_VERBOSE, "Shader %s compiled! Size: %zu bytes\n",
> + av_log(s->log, AV_LOG_VERBOSE, "Shader %s compiled! Size: %zu bytes\n",
> shd->name, spirv_size);
>
> shader_create.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO;
> @@ -1417,7 +1417,7 @@ int ff_vk_shader_create(FFVulkanContext *s, FFVkSPIRVShader *shd,
> ret = vk->CreateShaderModule(s->hwctx->act_dev, &shader_create, NULL,
> &shd->shader.module);
> if (ret != VK_SUCCESS) {
> - av_log(s, AV_LOG_VERBOSE, "Error creating shader module: %s\n",
> + av_log(s->log, AV_LOG_VERBOSE, "Error creating shader module: %s\n",
> ff_vk_ret2str(ret));
> return AVERROR_EXTERNAL;
> }
> @@ -1506,7 +1506,7 @@ int ff_vk_pipeline_descriptor_set_add(FFVulkanContext *s, FFVulkanPipeline *pl,
> ret = vk->CreateDescriptorSetLayout(s->hwctx->act_dev, &desc_create_layout,
> s->hwctx->alloc, &set->layout);
> if (ret != VK_SUCCESS) {
> - av_log(s, AV_LOG_ERROR, "Unable to init descriptor set layout: %s",
> + av_log(s->log, AV_LOG_ERROR, "Unable to init descriptor set layout: %s",
> ff_vk_ret2str(ret));
> return AVERROR_EXTERNAL;
> }
> @@ -1653,7 +1653,7 @@ static int vk_set_descriptor_image(FFVulkanContext *s, FFVulkanPipeline *pl,
> desc_size = s->desc_buf_props.combinedImageSamplerDescriptorSize;
> break;
> default:
> - av_log(s, AV_LOG_ERROR, "Invalid descriptor type at set %i binding %i: %i!\n",
> + av_log(s->log, AV_LOG_ERROR, "Invalid descriptor type at set %i binding %i: %i!\n",
> set, bind, desc_get_info.type);
> return AVERROR(EINVAL);
> break;
> @@ -1699,7 +1699,7 @@ int ff_vk_set_descriptor_buffer(FFVulkanContext *s, FFVulkanPipeline *pl,
> desc_size = s->desc_buf_props.storageTexelBufferDescriptorSize;
> break;
> default:
> - av_log(s, AV_LOG_ERROR, "Invalid descriptor type at set %i binding %i: %i!\n",
> + av_log(s->log, AV_LOG_ERROR, "Invalid descriptor type at set %i binding %i: %i!\n",
> set, bind, desc_get_info.type);
> return AVERROR(EINVAL);
> break;
> @@ -1760,7 +1760,7 @@ static int init_pipeline_layout(FFVulkanContext *s, FFVulkanPipeline *pl)
> s->hwctx->alloc, &pl->pipeline_layout);
> av_free(desc_layouts);
> if (ret != VK_SUCCESS) {
> - av_log(s, AV_LOG_ERROR, "Unable to init pipeline layout: %s\n",
> + av_log(s->log, AV_LOG_ERROR, "Unable to init pipeline layout: %s\n",
> ff_vk_ret2str(ret));
> return AVERROR_EXTERNAL;
> }
> @@ -1792,7 +1792,7 @@ int ff_vk_init_compute_pipeline(FFVulkanContext *s, FFVulkanPipeline *pl,
> &pipeline_create_info,
> s->hwctx->alloc, &pl->pipeline);
> if (ret != VK_SUCCESS) {
> - av_log(s, AV_LOG_ERROR, "Unable to init compute pipeline: %s\n",
> + av_log(s->log, AV_LOG_ERROR, "Unable to init compute pipeline: %s\n",
> ff_vk_ret2str(ret));
> return AVERROR_EXTERNAL;
> }
> diff --git a/libavutil/vulkan.h b/libavutil/vulkan.h
> index 05bd71ae45..2d4942d0d4 100644
> --- a/libavutil/vulkan.h
> +++ b/libavutil/vulkan.h
> @@ -227,7 +227,7 @@ typedef struct FFVkExecPool {
> } FFVkExecPool;
>
> typedef struct FFVulkanContext {
> - const AVClass *class; /* Filters and encoders use this */
> + void *log;
>
> FFVulkanFunctions vkfn;
> FFVulkanExtensions extensions;
More information about the ffmpeg-devel
mailing list