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 EB5644000B for ; Fri, 7 Jan 2022 07:36:43 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4EFCA68A6B6; Fri, 7 Jan 2022 09:36:40 +0200 (EET) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E9E2E68A101 for ; Fri, 7 Jan 2022 09:36:33 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1641540999; x=1673076999; h=from:to:subject:date:message-id:mime-version: content-transfer-encoding; bh=RzNg75RP5h4qCVvbQA5kGCoXWuoRaE+gBXWNlPmNQQU=; b=O3qKxgQWBdaAzrJGXsMvk947qCN/FI73k22ndQY2mssxx/rPOjk7RZEQ UyoVmk6fTlOL67Wav6Kx2VRXrU01JlI5K80+5SJn1Wl5wEe9yQ07r12fI WOh0mGop/keOya1HmXmtYH/ifhTXYD3vzP0Rc4jXrFOG64qHFlTMeg32L hsFXqDWPVC67C8stGKRyMhc+USBNszKnHIQg4EAEXctTNA5+haS3KFvpK sqMm1JziSde54W10nizDxWmFOcWmFV09qpVWxFvxQJO9cCGCHs+ciun8/ oa0faxNCBPCQaWt33E9QP3QyjFgaknxM9UmUBzA5cSc9pnrNw2W4te5bX A==; X-IronPort-AV: E=McAfee;i="6200,9189,10219"; a="241639964" X-IronPort-AV: E=Sophos;i="5.88,269,1635231600"; d="scan'208";a="241639964" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jan 2022 23:36:31 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,269,1635231600"; d="scan'208";a="473232112" Received: from chenwenbin-z390-aorus-ultra.sh.intel.com ([10.239.35.110]) by orsmga006.jf.intel.com with ESMTP; 06 Jan 2022 23:36:30 -0800 From: Wenbin Chen To: ffmpeg-devel@ffmpeg.org Date: Fri, 7 Jan 2022 15:36:21 +0800 Message-Id: <20220107073622.1177322-1-wenbin.chen@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH V4 1/2] libavcodec/vaapi_decode: fix the problem that init_pool_size < nb_surface 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: For vaapi if the init_pool_size is not zero, the pool size is fixed. This means max surfaces is init_pool_size, but when mapping vaapi frame to qsv frame, the init_pool_size < nb_surface. The cause is that vaapi_decode_make_config() config the init_pool_size and it is called twice. The first time is to init frame_context and the second time is to init codec. On the second time the init_pool_size is changed to original value so the init_pool_size is lower than the reall size because pool_size used to initialize frame_context need to plus thread_count and 3 (guarantee 4 base work surfaces). Now add code to make sure init_pool_size is only set once. Now the following commandline works: ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 \ -hwaccel_output_format vaapi -i input.264 \ -vf "hwmap=derive_device=qsv,format=qsv" \ -c:v h264_qsv output.264 Signed-off-by: Wenbin Chen --- libavcodec/vaapi_decode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/vaapi_decode.c b/libavcodec/vaapi_decode.c index 665af370ed..da0e72b10b 100644 --- a/libavcodec/vaapi_decode.c +++ b/libavcodec/vaapi_decode.c @@ -650,7 +650,7 @@ int ff_vaapi_decode_init(AVCodecContext *avctx) ctx->hwctx = ctx->device->hwctx; err = vaapi_decode_make_config(avctx, ctx->frames->device_ref, - &ctx->va_config, avctx->hw_frames_ctx); + &ctx->va_config, NULL); if (err) goto fail; -- 2.25.1 _______________________________________________ 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".