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 EC35C47394 for ; Wed, 6 Sep 2023 06:01:23 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1CE2868C76E; Wed, 6 Sep 2023 09:01:20 +0300 (EEST) Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.93]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7D31668C59D for ; Wed, 6 Sep 2023 09:01:12 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1693980077; x=1725516077; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=K7gMgIztAup3Sxb/FsOOYnTis2EP6sAYKWBP3dhL+kE=; b=OCfMIQwNIHViEF2gM+o8Pnoy06tbpxg9pqtIBx2xEgR2Fq2yvskN/lJb VCc7Odxv8tsp7FjhYBqQGezlHHyEcHZ3HUDqJNqkDisqqUrDhHfAr6/XV qnhzRkg5FgiRUAFQDZibdy0Ze26/9BaRSBxlkuJcneieO1Dup/l1puXqQ B3BHpAwrncPP+nAn3+GT8bp4000q6LNV0Kfapfp7boJdV5sttgm1JwEyq sAPWHxDtUczl82V/j8iv/J4wk2LRWXwDfsCdRENtEsQTww8ZDe8TGcTYv xTftP7ABz5xl4z6se09yYbgqjBx4VTrYAgJhkwsZQQUX7YgGhu8k04fMq A==; X-IronPort-AV: E=McAfee;i="6600,9927,10824"; a="374372395" X-IronPort-AV: E=Sophos;i="6.02,231,1688454000"; d="scan'208";a="374372395" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Sep 2023 23:01:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10824"; a="734918995" X-IronPort-AV: E=Sophos;i="6.02,231,1688454000"; d="scan'208";a="734918995" Received: from xhh-dg264.sh.intel.com ([10.238.2.76]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Sep 2023 23:01:08 -0700 From: "Xiang, Haihao" To: ffmpeg-devel@ffmpeg.org Date: Wed, 6 Sep 2023 14:00:40 +0800 Message-Id: <20230906060052.698620-1-haihao.xiang@intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 01/13] lavu/hwcontext_qsv: update AVQSVFramesContext to support dynamic frame pools 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 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: From: Haihao Xiang When AVQSVFramesContext.nb_surfaces is set to 0, a dynamic frame pool is expected, otherwise a fixed frame pool is expected. In addition, AVQSVFramesContext.info is added. User should provide AVQSVFramesContext.info instead of AVQSVFramesContext.surfaces for dynamic frame pools. Signed-off-by: Haihao Xiang --- doc/APIchanges | 3 +++ libavutil/hwcontext_qsv.c | 4 ++-- libavutil/hwcontext_qsv.h | 22 +++++++++++++++++++++- libavutil/version.h | 2 +- 4 files changed, 27 insertions(+), 4 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index dbaec30aac..5fa9110c21 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -2,6 +2,9 @@ The last version increases of all libraries were on 2023-02-09 API changes, most recent first: +2023-09-xx - xxxxxxxxxx - lavu 58.20.100 - hwcontext_qsv.h + Add AVQSVFramesContext.info to support dynamic frame pools + 2023-09-02 - xxxxxxxxxx - lavu 58.19.100 - executor.h Add AVExecutor API diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c index 1bfda9e69b..b76a89d13a 100644 --- a/libavutil/hwcontext_qsv.c +++ b/libavutil/hwcontext_qsv.c @@ -613,7 +613,7 @@ static mfxStatus frame_alloc(mfxHDL pthis, mfxFrameAllocRequest *req, QSVFramesContext *s = ctx->internal->priv; AVQSVFramesContext *hwctx = ctx->hwctx; mfxFrameInfo *i = &req->Info; - mfxFrameInfo *i1 = &hwctx->surfaces[0].Info; + mfxFrameInfo *i1 = hwctx->nb_surfaces ? &hwctx->surfaces[0].Info : hwctx->info; if (!(req->Type & MFX_MEMTYPE_VIDEO_MEMORY_PROCESSOR_TARGET) || !(req->Type & (MFX_MEMTYPE_FROM_VPPIN | MFX_MEMTYPE_FROM_VPPOUT)) || @@ -1173,7 +1173,7 @@ static int qsv_init_internal_session(AVHWFramesContext *ctx, MFX_IOPATTERN_OUT_SYSTEM_MEMORY; par.AsyncDepth = 1; - par.vpp.In = frames_hwctx->surfaces[0].Info; + par.vpp.In = frames_hwctx->nb_surfaces ? frames_hwctx->surfaces[0].Info : *frames_hwctx->info; /* Apparently VPP requires the frame rate to be set to some value, otherwise * init will fail (probably for the framerate conversion filter). Since we diff --git a/libavutil/hwcontext_qsv.h b/libavutil/hwcontext_qsv.h index e2dba8ad83..317ae5094f 100644 --- a/libavutil/hwcontext_qsv.h +++ b/libavutil/hwcontext_qsv.h @@ -51,7 +51,27 @@ typedef struct AVQSVDeviceContext { * This struct is allocated as AVHWFramesContext.hwctx */ typedef struct AVQSVFramesContext { - mfxFrameSurface1 *surfaces; + /** + * A pointer to mfxFrameSurface1 or mfxFrameInfo structure. + * + * When nb_surfaces is 0, it is a pointer to mfxFrameInfo structure, + * otherwise it is a pointer to mfxFrameSurface1. + */ + union { + mfxFrameSurface1 *surfaces; + mfxFrameInfo *info; + }; + + /** + * Number of frames + * + * A dynamic frame pool is required when nb_surfaces is 0, otherwise + * a fixed frame pool is required. + * + * User should make sure the configuration can support dynamic frame + * allocation when dynamic frame pool is required. For example, you cannt + * set nb_surfaces to 0 when the child_device_type is AV_HWDEVICE_TYPE_DXVA2. + */ int nb_surfaces; /** diff --git a/libavutil/version.h b/libavutil/version.h index 897feff84f..605f85cd41 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -79,7 +79,7 @@ */ #define LIBAVUTIL_VERSION_MAJOR 58 -#define LIBAVUTIL_VERSION_MINOR 19 +#define LIBAVUTIL_VERSION_MINOR 20 #define LIBAVUTIL_VERSION_MICRO 100 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ -- 2.34.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".