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 9A4434B5F3 for ; Thu, 8 Aug 2024 18:37:51 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 9B8E868DA36; Thu, 8 Aug 2024 21:37:48 +0300 (EEST) Received: from mail.viric.name (mail.viric.name [37.18.133.75]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 687D868D836 for ; Thu, 8 Aug 2024 21:37:42 +0300 (EEST) Received: by mail.viric.name (Postfix, from userid 1000) id A5B5A12BB0B6; Thu, 08 Aug 2024 20:37:41 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=viric.name; s=dkim1; t=1723142261; bh=soc5BgEQo1h6UIjLpU6/iwquqzXcR1a8qPQ2gbf7jwY=; h=Date:From:To:Subject; b=oY22emZewqFTZkMdKXRxL50hDnCIXcyWyP5vWP9zFa2jmojy9p+XdDZ4DP5zuCSmI JYzQ0EbGGJUiErGUyYzN/wVOp2cgBsGAyKJD4A7ZfptRBfrG6yt5y6vV7TtI5vjGYE u+d2w8hSHgr/HCPYR6YlUDnUMP2h6W9i35w4TJyc= Date: Thu, 8 Aug 2024 20:37:41 +0200 From: =?iso-8859-1?Q?Llu=EDs?= Batlle i Rossell To: ffmpeg-devel@ffmpeg.org Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="EuW/CEF4FA3tYVhi" Content-Disposition: inline X-Accept-Language: ca, es, eo, ru, en, jbo, tokipona Subject: [FFmpeg-devel] PATCH: Force vaapi image formats to NV12-only 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: --EuW/CEF4FA3tYVhi Content-Type: text/plain; charset=us-ascii Content-Disposition: inline attached --EuW/CEF4FA3tYVhi Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="0001-Force-vaapi-image-formats-to-NV12-only.patch" >From c6439f3a74529db25777029596791a62eb3c77d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Llu=C3=ADs=20Batlle=20i=20Rossell?= Date: Thu, 8 Aug 2024 20:32:03 +0200 Subject: [PATCH] Force vaapi image formats to NV12-only Vaapi drivers often lack proper image converesions and not all situations allow vaGetImage or vaPutImage with the image formats reported by the API. NV12 seems allowed in all circumstances. With this change now one can use the hwaccel directly without explicit conversions to nv12 for frame downloading to work. gstreamer adopted a similar approach: https://bugzilla.gnome.org/show_bug.cgi?id=752958 --- libavutil/hwcontext_vaapi.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c index 12bc95119a..d678e58d07 100644 --- a/libavutil/hwcontext_vaapi.c +++ b/libavutil/hwcontext_vaapi.c @@ -418,7 +418,12 @@ static int vaapi_device_init(AVHWDeviceContext *hwdev) for (i = 0; i < image_count; i++) { fourcc = image_list[i].fourcc; pix_fmt = vaapi_pix_fmt_from_fourcc(fourcc); - if (pix_fmt == AV_PIX_FMT_NONE) { + if (pix_fmt != AV_PIX_FMT_NV12) { + av_log(hwdev, AV_LOG_DEBUG, "Format %#x -> ignored.\n", + fourcc); + continue; + } + else if (pix_fmt == AV_PIX_FMT_NONE) { av_log(hwdev, AV_LOG_DEBUG, "Format %#x -> unknown.\n", fourcc); } else { -- 2.44.1 --EuW/CEF4FA3tYVhi 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". --EuW/CEF4FA3tYVhi--