Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: "Lluís Batlle i Rossell" <viric@viric.name>
To: ffmpeg-devel@ffmpeg.org
Subject: [FFmpeg-devel] PATCH: Force vaapi image formats to NV12-only
Date: Thu, 8 Aug 2024 20:37:41 +0200
Message-ID: <ZrUQdcSai7XrJ0Ya@vicerveza.homeunix.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 9 bytes --]

attached

[-- Attachment #2: 0001-Force-vaapi-image-formats-to-NV12-only.patch --]
[-- Type: text/plain, Size: 1513 bytes --]

From c6439f3a74529db25777029596791a62eb3c77d5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Llu=C3=ADs=20Batlle=20i=20Rossell?= <viric@viric.name>
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


[-- Attachment #3: Type: text/plain, Size: 251 bytes --]

_______________________________________________
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".

             reply	other threads:[~2024-08-08 18:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-08 18:37 Lluís Batlle i Rossell [this message]
2024-08-09  3:49 ` Zhao Zhili
2024-08-09  7:43   ` Lluís Batlle i Rossell
2024-08-10  8:51     ` [FFmpeg-devel] PATCH: Fallback to NV12 format in VAAPI drivers Lluís Batlle i Rossell
2024-08-11 17:57       ` Mark Thompson
2024-08-11 20:21         ` Lluís Batlle i Rossell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZrUQdcSai7XrJ0Ya@vicerveza.homeunix.net \
    --to=viric@viric.name \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git