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 B3B3949D8A for ; Mon, 11 Mar 2024 04:56:23 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E0EA168D019; Mon, 11 Mar 2024 06:56:20 +0200 (EET) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5BFE168CD83 for ; Mon, 11 Mar 2024 06:56:14 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1710132980; x=1741668980; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=sd0DmQBJSN9K+oM5hUwOKtegxeTHgtoHKXBpyGOSn6w=; b=g235Tk9RDm1bmrFwZyOMY0chsCMcjtVLpAimJEoing/vSi5XnTwVDXxE AD0XCMHeWUdbKgIWRW2MKXnNq2g9uOAkhbHjUZujwaXec41j2Ev6ymy9I tN9nmVymtxCSkPH8fIC5LKvdU+O3THnUCTcnlMxe/PF6CrXtjiNdMmR/5 aTTesHfC82+gJPw434jRXgsVLJzHImsAMy//dZH8aDzwctePAIPqxHLZT CgObp7pKAwez+bQKmz+qUSiG7QhQQufJShlcE41NHqp3VU5H1kpk32xkt ZlUBMYGnF4wixZlAtwlcgj0hPX7/9JwfIBFMJk2uHrvZmIt2GufZgm2F/ w==; X-IronPort-AV: E=McAfee;i="6600,9927,11009"; a="27248958" X-IronPort-AV: E=Sophos;i="6.07,115,1708416000"; d="scan'208";a="27248958" Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Mar 2024 21:56:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,115,1708416000"; d="scan'208";a="34183022" Received: from xhh-dg264.sh.intel.com ([10.238.2.76]) by fmviesa002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Mar 2024 21:56:10 -0700 From: "Xiang, Haihao" To: ffmpeg-devel@ffmpeg.org Date: Mon, 11 Mar 2024 12:56:02 +0800 Message-Id: <20240311045602.3086332-1-haihao.xiang@intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] lavu/hwcontext_qsv: Join the download/upload session to the main session 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 This may reduce the number of internal threads when using hwupload or hwdownload filter. Signed-off-by: Haihao Xiang --- libavutil/hwcontext_qsv.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c index 378cd5e826..e5e043d2d1 100644 --- a/libavutil/hwcontext_qsv.c +++ b/libavutil/hwcontext_qsv.c @@ -55,6 +55,10 @@ (MFX_VERSION_MAJOR > (MAJOR) || \ MFX_VERSION_MAJOR == (MAJOR) && MFX_VERSION_MINOR >= (MINOR)) +#define QSV_RUNTIME_VERSION_ATLEAST(MFX_VERSION, MAJOR, MINOR) \ + ((MFX_VERSION.Major > (MAJOR)) || \ + (MFX_VERSION.Major == (MAJOR) && MFX_VERSION.Minor >= (MINOR))) + #define MFX_IMPL_VIA_MASK(impl) (0x0f00 & (impl)) #define QSV_ONEVPL QSV_VERSION_ATLEAST(2, 0) #define QSV_HAVE_OPAQUE !QSV_ONEVPL @@ -1136,6 +1140,17 @@ static int qsv_init_internal_session(AVHWFramesContext *ctx, int ret = AVERROR_UNKNOWN; /* hwctx->loader is non-NULL for oneVPL user and NULL for non-oneVPL user */ void **loader = &hwctx->loader; + mfxSession parent_session = hwctx->session; + mfxIMPL impl; + mfxVersion ver; + + err = MFXQueryIMPL(parent_session, &impl); + if (err == MFX_ERR_NONE) + err = MFXQueryVersion(parent_session, &ver); + if (err != MFX_ERR_NONE) { + av_log(ctx, AV_LOG_ERROR, "Error querying the session attributes.\n"); + return AVERROR_UNKNOWN; + } #if QSV_HAVE_OPAQUE QSVFramesContext *s = ctx->hwctx; @@ -1156,6 +1171,15 @@ static int qsv_init_internal_session(AVHWFramesContext *ctx, } } + if (QSV_RUNTIME_VERSION_ATLEAST(ver, 1, 25)) { + err = MFXJoinSession(parent_session, *session); + if (err != MFX_ERR_NONE) { + av_log(ctx, AV_LOG_ERROR, "Error joining session.\n"); + ret = AVERROR_UNKNOWN; + goto fail; + } + } + if (!opaque) { err = MFXVideoCORE_SetFrameAllocator(*session, &frame_allocator); if (err != MFX_ERR_NONE) { -- 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".