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 C924A4238E for ; Thu, 14 Apr 2022 10:39:53 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 7498768B35A; Thu, 14 Apr 2022 13:39:51 +0300 (EEST) Received: from w4.tutanota.de (w4.tutanota.de [81.3.6.165]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 80B83680134 for ; Thu, 14 Apr 2022 13:39:44 +0300 (EEST) Received: from w3.tutanota.de (unknown [192.168.1.164]) by w4.tutanota.de (Postfix) with ESMTP id 178B81060253 for ; Thu, 14 Apr 2022 10:39:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1649932783; s=s1; d=lynne.ee; h=From:From:To:To:Subject:Subject:Content-Description:Content-ID:Content-Type:Content-Type:Content-Transfer-Encoding:Content-Transfer-Encoding:Cc:Date:Date:In-Reply-To:In-Reply-To:MIME-Version:MIME-Version:Message-ID:Message-ID:Reply-To:References:References:Sender; bh=5EYirbKsjPXRCDxWwhiOrx/DfRM1/Y+6ItuQk18eIkM=; b=MOcTV29XRVWtRK7YcWdED8S0q0GbOD2LUs0YRscMoJdaEABrgT9QgRbk3k428Da5 ig0XeJw6pWThL6vnLTjUk1cXthd2J1Wwcvny84wmpvmlGv5vBwmhc4k/dtxDbGatoS5 srGNwsK3wztYPWbP/kzD55lvckyNy7oOb7M/1LzUR7ehg46cQBh1h6gePK+78puDXi6 3jWKosL61McSGSa3KEhiJAu/bnwy/N2G3Tu/d3Z6+gMloCF9V5txwPdbEPgDGmrlo+8 CoS1kSB09aGzKI88nfEvra6JOzo55QWHrnK3F7Dx98cZHrjY2Rn4b9rFypl9T5P+LYd PhoGQY9PRw== Date: Thu, 14 Apr 2022 12:39:43 +0200 (CEST) From: Lynne To: FFmpeg development discussions and patches Message-ID: In-Reply-To: <344f7c5ec0628329e97fce3201de7e84dc6a4732.camel@intel.com> References: <20220330034151.834450-1-wenbin.chen@intel.com> <344f7c5ec0628329e97fce3201de7e84dc6a4732.camel@intel.com> MIME-Version: 1.0 Subject: Re: [FFmpeg-devel] [PATCH 1/2] libavutil/hwcontext_vulkan: Fix VK_FORMAT_R8G8_UNORM and VK_FORMAT_R16G16_UNORM map problem on Vulkan 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: 13 Apr 2022, 08:05 by haihao.xiang-at-intel.com@ffmpeg.org: > On Wed, 2022-03-30 at 11:41 +0800, Wenbin Chen wrote: > >> Vulkan map both DRM_FORMAT_RG88 and DRM_FORMAT_GR88 to >> VK_FORMAT_R8G8_UNORM. This cannot distinguish nv12/nv24 and nv21/nv42. >> Vulkan also map both DRM_FORMAT_RG1616 and DRM_FORMAT_GR1616 to >> VK_FORMAT_R16G16_UNORM. This causes issue when map back. >> VK_FORMAT_R16G16 will be mapped to DRM_FORMAT_GR1616, while p010 need >> DRM_FORMAT_RG1616. >> Add sw_format check to vulkan_fmt_to_drm() to fix this problem. >> >> Signed-off-by: Wenbin Chen >> --- >> libavutil/hwcontext_vulkan.c | 13 +++++++++++-- >> 1 file changed, 11 insertions(+), 2 deletions(-) >> >> diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c >> index 237caa4bc0..791649001f 100644 >> --- a/libavutil/hwcontext_vulkan.c >> +++ b/libavutil/hwcontext_vulkan.c >> @@ -3290,8 +3290,17 @@ static void vulkan_unmap_to_drm(AVHWFramesContext >> *hwfc, HWMapDescriptor *hwmap) >> av_free(drm_desc); >> } >> >> -static inline uint32_t vulkan_fmt_to_drm(VkFormat vkfmt) >> +static inline uint32_t vulkan_fmt_to_drm(VkFormat vkfmt, >> + enum AVPixelFormat sw_format) >> { >> + if (vkfmt == VK_FORMAT_R8G8_UNORM && >> + (sw_format == AV_PIX_FMT_NV12 || sw_format == AV_PIX_FMT_NV24)) >> + return DRM_FORMAT_RG88; >> + >> + if (vkfmt == VK_FORMAT_R16G16_UNORM && >> + (sw_format == AV_PIX_FMT_P010 || sw_format == AV_PIX_FMT_P016)) >> + return DRM_FORMAT_RG1616; >> + >> for (int i = 0; i < FF_ARRAY_ELEMS(vulkan_drm_format_map); i++) >> if (vulkan_drm_format_map[i].vk_format == vkfmt) >> return vulkan_drm_format_map[i].drm_fourcc; >> @@ -3373,7 +3382,7 @@ static int vulkan_map_to_drm(AVHWFramesContext *hwfc, >> AVFrame *dst, >> }; >> VkFormat plane_vkfmt = av_vkfmt_from_pixfmt(hwfc->sw_format)[i]; >> >> - drm_desc->layers[i].format = vulkan_fmt_to_drm(plane_vkfmt); >> + drm_desc->layers[i].format = vulkan_fmt_to_drm(plane_vkfmt, hwfc- >> >sw_format); >> drm_desc->layers[i].nb_planes = 1; >> >> if (drm_desc->layers[i].format == DRM_FORMAT_INVALID) { >> > > Patchset LGTM > I'll hold off on pushing all of your and Wenbin's Vulkan patches for now. Your hacks for cheap hardware have seriously broken image and memory allocation for anyone who doesn't care about your niche use cases, and of course it's up to me to salvage it. What's worse, I don't know if it's your drivers that are at fault, or if it's your patches that are at fault, or both. I already had to rip all of your patches off just to get Vulkan Video decoding working. Pushing any more code will just create even more mess for me to deal with, and I'm already knee-deep in it trying to work around the Khronos user synchronized object madness. You'll just have to wait for me to fix them, unless you think you can fix them yourselves, which I doubt. I may have to partially revert your patches too, because right now, everything's pretty broken. _______________________________________________ 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".