From patchwork Thu Mar 28 02:17:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Xiang, Haihao" X-Patchwork-Id: 47567 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:9f96:b0:1a3:b6bb:3029 with SMTP id mm22csp1031079pzb; Wed, 27 Mar 2024 19:17:55 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWmjr1SiMbFNVPo2qG0RKINVRxewJ2X+wMriZ/uoCIYwnslcv9H/4+9TX7IXOv4i6JtsWTOAHP+x/5TyrVsgCVDVkL6HBk2yM2NIg== X-Google-Smtp-Source: AGHT+IHjESWIzOBMlq4nIY+lA9xydFrGV+E5yLGJN+j11RyZOzli6qgLLGVctKuCA11ZHSmJS9NH X-Received: by 2002:a50:ccc3:0:b0:56c:2ee6:f452 with SMTP id b3-20020a50ccc3000000b0056c2ee6f452mr1277258edj.28.1711592275442; Wed, 27 Mar 2024 19:17:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1711592275; cv=none; d=google.com; s=arc-20160816; b=ALxzPDSHAGpfgyXuXTrEMCzOxMJqxS2u+s2DBM9pvvpZKx3FToXzdl3r235t0xyOHU OryQVmUKvZ22dGVHoYu11LBXLYrM1/DuJYbgsZdQZ/9Rk+RpyE68eEg69oMDWtOa4OJf q/4j2F6tXTPbLwppZVerhcSF/rDYSXEh+sQPghqfJR8VsZ7fFT4tMXRa2o5JaqYygCQv Mu2k9xuAR3nL49nsM/JOLVtcXrHDaM8cVvJ18ro22t2sOodTKBkIVErxfe+XlQnprswJ 5ZLorm0LK6fQbKSXBi89vvS+UN1ELi0IALiZ9P+4e26+PEeCTPaUDIv145n9k9WADSQb yrHA== 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=kep/4ZUEsyozsFgWrezP4/xoH2BjAD1WcCG2MHfCu9w=; fh=1kpmTRI1sW42eNCnNMby7VLIISQBX6KJuVYxOEG0t2A=; b=ofFy/ZuiXly22QVjJsWmZvlwTf/PKxh7EoeXh6hJntMC9diotU/Smg+JY+tYciGI7v +zLHljnnhyLgMHZZpJcm6eXU8dIhtYlfDJgepCUTqlINtpHrgUnaiWNhePiOLMeL59At ciS5YJ+nxzIclrZDt1KI3EJTeojLPwD84ceqQ2etS1F2zbZdrjn/AcbosljNUXpGv8+d K2emRJS7gt+1Y7KlUr1QGvLld7tx8Qh9s4lFp9lfr1M8kdVG+iC5e8RRril7/liGtu1B ezyidcdTYunqU0FdaDXvTuNa2j+7T9UrzRB+bLMs2fG0LWP/64pgu6yCKYUvALbSvKX2 WBRg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel.com header.s=Intel header.b=SQSIUCVu; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id z21-20020a056402275500b00568a519f45asi241973edd.310.2024.03.27.19.17.55; Wed, 27 Mar 2024 19:17:55 -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=@intel.com header.s=Intel header.b=SQSIUCVu; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3027168D582; Thu, 28 Mar 2024 04:17:43 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.21]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id ED97068D6EB for ; Thu, 28 Mar 2024 04:17:35 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711592262; x=1743128262; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=dimF0bmVjubApKBUH0BS26DIrpkZzlZs4c+4ilaW1V8=; b=SQSIUCVurnpjs3sSeGSbELl0sNUHwXrLS/MilCLJMeOZ/kz2NB+0taW3 sMBtoSGYTugpFBZJBmhpdKPajH62YiTQoyHt4zpstdPt3LA1K6p4B0QKe 8Av5pB/Bs4FJLUubyNF9RZEjx07KwKZ23IX/E1eAvvbX0d01QsXlY+gW1 gpeyVH1WXYleBiy4gT7bE0IFHewfJWv3hURqHm950M8z3Im2i5mNHR6C4 v+xsECBz999C6Bv+pgFS1bZAAh7EWvXylWwMU8iFXJcFiQuAHc87ndEji ZUVwt7xtZHPm/lkY1CHWKsyjTrT7izhWVk3qloPlmuAO9GrfugMTLsKuV Q==; X-CSE-ConnectionGUID: LLRfB6peRwOxWovCzmN8jA== X-CSE-MsgGUID: gUVSCvh+R5qBT8jc7HLpxw== X-IronPort-AV: E=McAfee;i="6600,9927,11026"; a="6664788" X-IronPort-AV: E=Sophos;i="6.07,160,1708416000"; d="scan'208";a="6664788" Received: from orviesa007.jf.intel.com ([10.64.159.147]) by orvoesa113.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Mar 2024 19:17:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,160,1708416000"; d="scan'208";a="16890306" Received: from xhh-dg264.sh.intel.com ([10.238.2.76]) by orviesa007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Mar 2024 19:17:29 -0700 From: "Xiang, Haihao" To: ffmpeg-devel@ffmpeg.org Date: Thu, 28 Mar 2024 10:17:17 +0800 Message-Id: <20240328021717.4116418-3-haihao.xiang@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240328021717.4116418-1-haihao.xiang@intel.com> References: <20240328021717.4116418-1-haihao.xiang@intel.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/3] lavfi/vaapi_vpp: Use dynamic frame pool in outlink if possible 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: Haihao Xiang Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: U2Tc0IU/5tJN From: Haihao Xiang This can fix the broken cases for the driver/hardware combination which doesn't rely on fixed surface-array. For example: $ ffmpeg -hwaccel_output_format vaapi -hwaccel vaapi -i input.mp4 \ -vf 'scale_vaapi=w=720:h=480' -c:v hevc_vaapi -f null - Signed-off-by: Haihao Xiang --- libavfilter/vaapi_vpp.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libavfilter/vaapi_vpp.c b/libavfilter/vaapi_vpp.c index 59961bfa4a..0755d674ac 100644 --- a/libavfilter/vaapi_vpp.c +++ b/libavfilter/vaapi_vpp.c @@ -203,7 +203,10 @@ int ff_vaapi_vpp_config_output(AVFilterLink *outlink) output_frames->width = ctx->output_width; output_frames->height = ctx->output_height; - output_frames->initial_pool_size = 4; + if (ctx->hwctx->driver_quirks & AV_VAAPI_DRIVER_QUIRK_DYNAMIC_SURFACE_POOL) + output_frames->initial_pool_size = 0; + else + output_frames->initial_pool_size = 4; err = ff_filter_init_hw_frames(avctx, outlink, 10); if (err < 0) @@ -219,6 +222,8 @@ int ff_vaapi_vpp_config_output(AVFilterLink *outlink) va_frames = output_frames->hwctx; av_assert0(ctx->va_context == VA_INVALID_ID); + av_assert0(output_frames->initial_pool_size || + (va_frames->surface_ids == NULL && va_frames->nb_surfaces == 0)); vas = vaCreateContext(ctx->hwctx->display, ctx->va_config, ctx->output_width, ctx->output_height, VA_PROGRESSIVE,