From patchwork Fri Aug 5 03:59:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philip Langdale X-Patchwork-Id: 37141 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1649:b0:8b:613a:194d with SMTP id no9csp789254pzb; Thu, 4 Aug 2022 20:59:35 -0700 (PDT) X-Google-Smtp-Source: AA6agR45m7wLEYPGcvU/MgUBDeyV9LDK4sPI7nvpHPn9Tr5qUkbnIR+fo0tCrHia9Zw6fivmcjfk X-Received: by 2002:a17:906:58d6:b0:72f:25c0:af2b with SMTP id e22-20020a17090658d600b0072f25c0af2bmr3884093ejs.326.1659671974691; Thu, 04 Aug 2022 20:59:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659671974; cv=none; d=google.com; s=arc-20160816; b=Nw7Xi2xkVFHu1CPDBRQnc9cVgcUiynVqLpaItSS1SuYa/7rPaGhNri3QRYoGGNV8dw ffvHGFbW9qr8zmfzIunxG8tKZ+qUNn0HnpT+srhmbT/r5BwWpE97a4ncldlmG1VRVHMU G+CGLhVKFm3Lk0ovluhE1TVsZf66Vqr2MABhOWFvSZwo/w2zMDWLOOKT6N1qHxlFKKG6 2Z00fTcBL+tMk55+wxueK3CGnJAhrDTph8m1qqJXwNXtCBLaGB6OFhzs+cckIqmy1aw8 2Ps3SUn69pLSGOeZLVxI5qU4POYqzuePvZ8x/JQ0fh3k4u7YapWmVcufYnnmFgZZru9M nwmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:delivered-to; bh=oI2jHXNMfESHXquwbsCudTijAQ2+xzzRS6B5gpra8pg=; b=o6Xb7lpN2f0mEGitp9ic6ac+NT5SiGtie3H9bjh1PBymXS62PI4vIR/TGUoGbup2PC 9d9RNCiWgqid/ooeLbSEUqYXVexvbXGgbh+/td1oh1MvFVyR15ljxYYOjnYfjDSmS+N7 zDb4SUxIsFdZFNMtOlq0ouM4HxSPu7GdHb8P0mkAJ4J0NbVkAAWS/YrQnjg7k/IftZ5j SzuCtPmoUM+boeTHPtuiZEMugMXEQjyVQWpJy9EC9sgoH8uo3imcGQSjLxdpgqY+QiRP qDatBA+foSF0GvWvdtdOsYPvpqYI8Ncj0SP0pN0Q+xJGod01JDRCONz2fX43HOWYe0x4 UVEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@overt.org header.s=mail header.b=KB5i9N69; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=overt.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id sc20-20020a1709078a1400b00730b372e9d8si2334943ejc.937.2022.08.04.20.59.34; Thu, 04 Aug 2022 20:59:34 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@overt.org header.s=mail header.b=KB5i9N69; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=overt.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C781068BA7A; Fri, 5 Aug 2022 06:59:30 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail.overt.org (mail.overt.org [157.230.92.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2C12068B9C6 for ; Fri, 5 Aug 2022 06:59:24 +0300 (EEST) Received: from authenticated-user (mail.overt.org [157.230.92.47]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by mail.overt.org (Postfix) with ESMTPSA id CC4AF3F6FD; Thu, 4 Aug 2022 22:59:22 -0500 (CDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=overt.org; s=mail; t=1659671963; bh=JFUKE1VoV6bhbqx2UYB2T0ikFn/xjHMvYMnzylB9rsQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KB5i9N6913xUuIKTP4haQSGTiHe6d+kqO1YLoICs16ukUXPHt4qXx7GwybnfSrvxk qSC6MW6vrwl/0dKcoZ6eZNvpGLFM6WQGjCoxvMpyfQocTV24YJN7BU5SFwN6TzynNK /DTfdtKr4nYlYwz0L0KnJFX8Gx2prOb/MkRQbKZvFCy/p3onvdYrbLwxhccPmOEr20 p6Bmtn1f84/Nu3LGtXT7pCvsu05YZ5VC3DM9zbb82Bc5wSS90oGmHdApr+SVikzHb0 8lIu6afkQgfGeqHLShToLDi3K8NwMuZpRnUhg9eTqdkCizz+QD90ZJGTM3F4FhUJXJ VB8dCaloIDsXA== From: Philip Langdale To: ffmpeg-devel@ffmpeg.org Date: Thu, 4 Aug 2022 20:59:03 -0700 Message-Id: <20220805035904.59799-2-philipl@overt.org> In-Reply-To: <20220805035904.59799-1-philipl@overt.org> References: <20220805035904.59799-1-philipl@overt.org> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/2] lavc/vaapi_decode: add missing flag when picking best pixel format 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 Cc: Philip Langdale Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 4wyk0tM5crfa vaapi_decode_find_best_format currently does not set the VA_SURFACE_ATTRIB_SETTABLE flag on the pixel format attribute that it returns. Without this flag, the attribute will be ignored by vaCreateSurfaces, meaning that the driver's default logic for picking a pixel format will kick in. So far, this hasn't produced visible problems, but when trying to decode 4:4:4 content, at least on Intel, the driver will pick the 444P planar format, even though the decoder can only return the AYUV packed format. The hwcontext_vaapi code that sets surface attributes when picking formats does not have this bug. Applications may use their own logic for finding the best format, and so may not hit this bug. eg: mpv is unaffected. Signed-off-by: Philip Langdale --- libavcodec/vaapi_decode.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavcodec/vaapi_decode.c b/libavcodec/vaapi_decode.c index db48efc3ed..38813eb8e4 100644 --- a/libavcodec/vaapi_decode.c +++ b/libavcodec/vaapi_decode.c @@ -358,6 +358,7 @@ static int vaapi_decode_find_best_format(AVCodecContext *avctx, ctx->pixel_format_attribute = (VASurfaceAttrib) { .type = VASurfaceAttribPixelFormat, + .flags = VA_SURFACE_ATTRIB_SETTABLE, .value.value.i = best_fourcc, };