From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id C300D4484A for ; Tue, 24 Oct 2023 23:41:32 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id F211968CA63; Wed, 25 Oct 2023 02:41:29 +0300 (EEST) Received: from w4.tutanota.de (w4.tutanota.de [81.3.6.165]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B605568C7CC for ; Wed, 25 Oct 2023 02:41:23 +0300 (EEST) Received: from tutadb.w10.tutanota.de (unknown [192.168.1.10]) by w4.tutanota.de (Postfix) with ESMTP id 6AE9210602E3 for ; Tue, 24 Oct 2023 23:41:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1698190883; s=s1; d=lynne.ee; h=From:From:To:To:Subject:Subject:Content-Description:Content-ID:Content-Type:Content-Type:Content-Transfer-Encoding:Cc:Date:Date:In-Reply-To:MIME-Version:MIME-Version:Message-ID:Message-ID:Reply-To:References:Sender; bh=efjJKKzvw2AG60kcUmwjjDlwoB0b7YpXFFSYnFKBMpg=; b=ezAoWEhvBloMFk4689EtW0P/Vt2FWhh2G7Hd0RFff5iYrCwYHeJcCXJdV7gDkdyi d6xw3CWa3fpdntuzu6pQJnSoC94z27FbIuzGxjcdRq33rnD7nI4mYMPUbUkR30Bs2XI bzr/8ZQOVaLQqROtLJt4oxxOyLjsLAi0tPoM3zX8Kt5gwjo58X9PeutKRhBarQyAUGC Z8j28TBNX67RPir0JjlVv38i6snKW/eMd5IHpl1zhFyvtB7Oa8QoxPJsVjVRVG9rTGl 0+K+znrYLamAaxTxIaOPsfo39+FE114z9ZKFYsRlGkze4fc2UybznPpBEEw15GAAqOO gCuBMKkc5A== Date: Wed, 25 Oct 2023 01:41:23 +0200 (CEST) From: Lynne To: Ffmpeg Devel Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_37683_1621623323.1698190883432" Subject: [FFmpeg-devel] [PATCH 1/2] vulkan_decode: fix pedantic validation issue X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: ------=_Part_37683_1621623323.1698190883432 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Meant to be applied on top of my previous patch to fix frame context dimension allocation. Fixes: "Validation Error: [ VUID-VkImageViewCreateInfo-imageViewType-04974 ] Object 0: handle = 0x9f9b41000000003c, type = VK_OBJECT_TYPE_IMAGE; | MessageID = 0xc120e150 | vkCreateImageView(): Using pCreateInfo->viewType VK_IMAGE_VIEW_TYPE_2D and the subresourceRange.layerCount VK_REMAINING_ARRAY_LAYERS=(17) and must 1 (try looking into VK_IMAGE_VIEW_TYPE_*_ARRAY). The Vulkan spec states: If viewType is VK_IMAGE_VIEW_TYPE_1D, VK_IMAGE_VIEW_TYPE_2D, or VK_IMAGE_VIEW_TYPE_3D; and subresourceRange.layerCount is VK_REMAINING_ARRAY_LAYERS, then the remaining number of layers must be 1" Patch attached. ------=_Part_37683_1621623323.1698190883432 Content-Type: text/x-diff; charset=us-ascii; name=0001-vulkan_decode-fix-pedantic-validation-issue.patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=0001-vulkan_decode-fix-pedantic-validation-issue.patch >From af7bd8c40c1b54a065311f15c72ba676bded561b Mon Sep 17 00:00:00 2001 From: Lynne Date: Tue, 24 Oct 2023 22:43:06 +0200 Subject: [PATCH 1/2] vulkan_decode: fix pedantic validation issue "Validation Error: [ VUID-VkImageViewCreateInfo-imageViewType-04974 ] Object 0: handle = 0x9f9b41000000003c, type = VK_OBJECT_TYPE_IMAGE; | MessageID = 0xc120e150 | vkCreateImageView(): Using pCreateInfo->viewType VK_IMAGE_VIEW_TYPE_2D and the subresourceRange.layerCount VK_REMAINING_ARRAY_LAYERS=(17) and must 1 (try looking into VK_IMAGE_VIEW_TYPE_*_ARRAY). The Vulkan spec states: If viewType is VK_IMAGE_VIEW_TYPE_1D, VK_IMAGE_VIEW_TYPE_2D, or VK_IMAGE_VIEW_TYPE_3D; and subresourceRange.layerCount is VK_REMAINING_ARRAY_LAYERS, then the remaining number of layers must be 1" --- libavcodec/vulkan_decode.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/libavcodec/vulkan_decode.c b/libavcodec/vulkan_decode.c index 3b9576c0a9..c01eeb9cdc 100644 --- a/libavcodec/vulkan_decode.c +++ b/libavcodec/vulkan_decode.c @@ -113,11 +113,12 @@ int ff_vk_params_invalidate(AVCodecContext *avctx, int t, const uint8_t *b, uint return 0; } -static int vk_decode_create_view(FFVulkanDecodeShared *ctx, VkImageView *dst_view, +static int vk_decode_create_view(FFVulkanDecodeContext *dec, VkImageView *dst_view, VkImageAspectFlags *aspect, AVVkFrame *src, - VkFormat vkf) + VkFormat vkf, int is_current) { VkResult ret; + FFVulkanDecodeShared *ctx = dec->shared_ctx; FFVulkanFunctions *vk = &ctx->s.vkfn; VkImageAspectFlags aspect_mask = ff_vk_aspect_bits_from_vkfmt(vkf); @@ -128,7 +129,8 @@ static int vk_decode_create_view(FFVulkanDecodeShared *ctx, VkImageView *dst_vie VkImageViewCreateInfo img_view_create_info = { .sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO, .pNext = &yuv_sampler_info, - .viewType = VK_IMAGE_VIEW_TYPE_2D, + .viewType = dec->layered_dpb && !is_current ? + VK_IMAGE_VIEW_TYPE_2D_ARRAY : VK_IMAGE_VIEW_TYPE_2D, .format = vkf, .image = src->img[0], .components = (VkComponentMapping) { @@ -140,7 +142,8 @@ static int vk_decode_create_view(FFVulkanDecodeShared *ctx, VkImageView *dst_vie .subresourceRange = (VkImageSubresourceRange) { .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT, .baseArrayLayer = 0, - .layerCount = VK_REMAINING_ARRAY_LAYERS, + .layerCount = dec->layered_dpb && !is_current ? + VK_REMAINING_ARRAY_LAYERS : 1, .levelCount = 1, }, }; @@ -203,10 +206,10 @@ int ff_vk_decode_prepare_frame(FFVulkanDecodeContext *dec, AVFrame *pic, if (!vkpic->dpb_frame) return AVERROR(ENOMEM); - err = vk_decode_create_view(ctx, &vkpic->img_view_ref, + err = vk_decode_create_view(dec, &vkpic->img_view_ref, &vkpic->img_aspect_ref, (AVVkFrame *)vkpic->dpb_frame->data[0], - dpb_hwfc->format[0]); + dpb_hwfc->format[0], is_current); if (err < 0) return err; @@ -217,10 +220,10 @@ int ff_vk_decode_prepare_frame(FFVulkanDecodeContext *dec, AVFrame *pic, AVHWFramesContext *frames = (AVHWFramesContext *)pic->hw_frames_ctx->data; AVVulkanFramesContext *hwfc = frames->hwctx; - err = vk_decode_create_view(ctx, &vkpic->img_view_out, + err = vk_decode_create_view(dec, &vkpic->img_view_out, &vkpic->img_aspect, (AVVkFrame *)pic->data[0], - hwfc->format[0]); + hwfc->format[0], is_current); if (err < 0) return err; @@ -1249,9 +1252,9 @@ int ff_vk_decode_init(AVCodecContext *avctx) goto fail; } - err = vk_decode_create_view(ctx, &ctx->layered_view, &ctx->layered_aspect, + err = vk_decode_create_view(dec, &ctx->layered_view, &ctx->layered_aspect, (AVVkFrame *)ctx->layered_frame->data[0], - s->hwfc->format[0]); + s->hwfc->format[0], 0); if (err < 0) goto fail; } -- 2.42.0 ------=_Part_37683_1621623323.1698190883432 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". ------=_Part_37683_1621623323.1698190883432--