| 728 | } |
| 729 | |
| 730 | static int vulkan_decode_bootstrap(AVCodecContext *avctx, AVBufferRef *frames_ref) |
| 731 | { |
| 732 | int err; |
| 733 | FFVulkanDecodeContext *dec = avctx->internal->hwaccel_priv_data; |
| 734 | const FFVulkanDecodeDescriptor *vk_desc = get_codecdesc(avctx->codec_id); |
| 735 | AVHWFramesContext *frames = (AVHWFramesContext *)frames_ref->data; |
| 736 | AVHWDeviceContext *device = (AVHWDeviceContext *)frames->device_ref->data; |
| 737 | AVVulkanDeviceContext *hwctx = device->hwctx; |
| 738 | FFVulkanDecodeShared *ctx; |
| 739 | |
| 740 | if (dec->shared_ctx) |
| 741 | return 0; |
| 742 | |
| 743 | dec->shared_ctx = av_refstruct_alloc_ext(sizeof(*ctx), 0, NULL, |
| 744 | free_common); |
| 745 | if (!dec->shared_ctx) |
| 746 | return AVERROR(ENOMEM); |
| 747 | |
| 748 | ctx = dec->shared_ctx; |
| 749 | |
| 750 | ctx->s.extensions = ff_vk_extensions_to_mask(hwctx->enabled_dev_extensions, |
| 751 | hwctx->nb_enabled_dev_extensions); |
| 752 | |
| 753 | if (vk_desc->queue_flags & VK_QUEUE_VIDEO_DECODE_BIT_KHR) { |
| 754 | if (!(ctx->s.extensions & FF_VK_EXT_VIDEO_DECODE_QUEUE)) { |
| 755 | av_log(avctx, AV_LOG_ERROR, "Device does not support the %s extension!\n", |
| 756 | VK_KHR_VIDEO_DECODE_QUEUE_EXTENSION_NAME); |
| 757 | av_refstruct_unref(&dec->shared_ctx); |
| 758 | return AVERROR(ENOSYS); |
| 759 | } |
| 760 | } |
| 761 | |
| 762 | err = ff_vk_load_functions(device, &ctx->s.vkfn, ctx->s.extensions, 1, 1); |
| 763 | if (err < 0) { |
| 764 | av_refstruct_unref(&dec->shared_ctx); |
| 765 | return err; |
| 766 | } |
| 767 | |
| 768 | return 0; |
| 769 | } |
| 770 | |
| 771 | static VkResult vulkan_setup_profile(AVCodecContext *avctx, |
| 772 | FFVulkanDecodeProfileData *prof, |
no test coverage detected