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 9FFA742A2B for ; Tue, 11 Jan 2022 06:57:05 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3C3A668AEC8; Tue, 11 Jan 2022 08:57:02 +0200 (EET) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 57EBF68A8E6 for ; Tue, 11 Jan 2022 08:56:54 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1641884220; x=1673420220; h=from:to:subject:date:message-id:mime-version: content-transfer-encoding; bh=RzNg75RP5h4qCVvbQA5kGCoXWuoRaE+gBXWNlPmNQQU=; b=RgUGo0xA1eOy1++ASnFN2u4f8n2WIPRklCyHYcnCBMXsz4zxGGOIPRtk ToMdFU/6uWj61G/kBQ//Ffic5LIBRnTE5amWtE7JuyVhY5pMP7EtpAYM/ Z5t6AtPlniAbgHjMdmufob76OP08KGg1SzGVwWewtNSTpTnlO7FuoQmdm MpBNM9rQTl7h4+OgKBb5uw3IMY3zcSn/gbxW9PZkmK72uq14Sq6R/aF7k Fw8Gyng87cJIeQPlvCmjWr1QTaSEmumt+A/ibQbUEqFpFLJnTjkIS2jdn ZIsA3UdA6uJmcONLAqBjalqnciXr0ZOmijVNMIc+ihWqVPco6x/XGnyD2 w==; X-IronPort-AV: E=McAfee;i="6200,9189,10223"; a="243214618" X-IronPort-AV: E=Sophos;i="5.88,279,1635231600"; d="scan'208";a="243214618" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jan 2022 22:56:52 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,279,1635231600"; d="scan'208";a="474427063" Received: from chenwenbin-z390-aorus-ultra.sh.intel.com ([10.239.35.110]) by orsmga006.jf.intel.com with ESMTP; 10 Jan 2022 22:56:52 -0800 From: Wenbin Chen To: ffmpeg-devel@ffmpeg.org Date: Tue, 11 Jan 2022 14:55:37 +0800 Message-Id: <20220111065538.750653-1-wenbin.chen@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH V5 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".