From patchwork Wed Sep 6 06:00:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Xiang, Haihao" X-Patchwork-Id: 43582 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:4f16:b0:149:dfde:5c0a with SMTP id gi22csp2310835pzb; Tue, 5 Sep 2023 23:02:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGhbj0Perud8q+07iAhVo5YOCaRR1CD55DHAPS9ICRt0kct9tqeJ2JgCYcL4YUipOTwDn/b X-Received: by 2002:a17:906:ee86:b0:9a1:da38:5691 with SMTP id wt6-20020a170906ee8600b009a1da385691mr1752371ejb.74.1693980126036; Tue, 05 Sep 2023 23:02:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693980126; cv=none; d=google.com; s=arc-20160816; b=Li/Pc+p0hQGoGereGXvKvMy8wKhUiKdbf0TQBbtRRW5BWQhREwkk+f21T9HlfkM4hL ui9ythIL+AOhnBdvp+Zq+JHQvd63gykLB5UHg2P/QReU1b8M/+VzMrWv3sgsZdTWGnKs zzgco3s1c3oGLwZafYNb1kdtx8O56qYMQFePFo1/2l3z6o9XQfv15Cfyi8edB08v+6xc nPWDRq+pAJrqcqRp2JG9Sz0wuD3LauMbxJ7bQDDGUAt+MUfI3wp14Sh/bpnBOFOqh9bt oHJkR9cNpcgjcDL3SAMBpEcsb5qJLH+l1Ye+tRVUwYf0Qi5DoAJEno2OlVV3k90us9eY SNQw== 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=qFoSnEJglnS+Ph/mr8EdQP/WEhSRcfSDlSzMxDX5WNU=; fh=1kpmTRI1sW42eNCnNMby7VLIISQBX6KJuVYxOEG0t2A=; b=e8Umyj91AYvok7q1yyaeGLcsPEzluYdoyz6CcBA/D8WDcek3Vmb1kO9/7VfGglNzpK /GH3iRnD1BQedjgq7SiWGj4nIzA+KZ2BWBJ8B0GbXCL3eOCU8iW3JIg5Y9ECV5tYvDKn OkwicG3MZ0C7S2cDxVZ0kddl7kdBZd7cfd2PGEz2Yz6b+PocnsygGopocllDGb21v+/A DyzxknkcqUeFDv+eiJeL7h1mJKEWIA1HDppU7E50YSPMq7CTFPzKQSOB5g467SVPKKym mqSmkph0bKHvGRtFq9aT7yZvfFnFXQBW0g4FTs3DLwViKRSqtL1HjJYgs0NvrdQPmJWR 15Fw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel.com header.s=Intel header.b=gZLZbKUD; 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 fi16-20020a170906da1000b00992dce29d4csi8729334ejb.874.2023.09.05.23.02.05; Tue, 05 Sep 2023 23:02:05 -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=gZLZbKUD; 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 8CFCC68C7E3; Wed, 6 Sep 2023 09:01:32 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.93]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 909B368C76C for ; Wed, 6 Sep 2023 09:01:19 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1693980089; x=1725516089; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=bFBJo8YdeUZfPaLtQQ8pM7gJS7ljkXzsQKfuGbdZQio=; b=gZLZbKUDgFB2XtKfL9pJR47TtMUno7URWw29MfwOi1h5YGwFNW+Oew0t dXWViYiJHyUfhRLJZ+C8dzbm7wbLCMjiIPrWp3FbDaZ/09wO18dxsmuBa cXhG8dyNXGKERQwSjp72Df4MFGj8GzZpAQB+Se0BU0Ge8xQedpFWi1Vlh tXLn1qzEjbBuB7oFT14RrYbjVFG6toLG5tawhPpBLIg7c/XyexaJF0e9N cE4DAiQutl7z+pM/Sk5G0R2t++U8kyGZRbcTpxRSEXVaHdsOkhKcDm3L0 5H+uapDVRNmUD8AG93lCuA6JGTnO1QQgjo39r0YEe1pXVenS2bmU5c2du A==; X-IronPort-AV: E=McAfee;i="6600,9927,10824"; a="374372415" X-IronPort-AV: E=Sophos;i="6.02,231,1688454000"; d="scan'208";a="374372415" 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:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10824"; a="734919028" X-IronPort-AV: E=Sophos;i="6.02,231,1688454000"; d="scan'208";a="734919028" 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:13 -0700 From: "Xiang, Haihao" To: ffmpeg-devel@ffmpeg.org Date: Wed, 6 Sep 2023 14:00:44 +0800 Message-Id: <20230906060052.698620-5-haihao.xiang@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230906060052.698620-1-haihao.xiang@intel.com> References: <20230906060052.698620-1-haihao.xiang@intel.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 05/13] lavc/qsv: fix qsv_frame_get_hdl callback 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: sGpaiUTKxOrb From: Haihao Xiang Signed-off-by: Haihao Xiang --- libavcodec/qsv.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c index 7563625627..3f4b7b8193 100644 --- a/libavcodec/qsv.c +++ b/libavcodec/qsv.c @@ -987,9 +987,18 @@ static mfxStatus qsv_frame_unlock(mfxHDL pthis, mfxMemId mid, mfxFrameData *ptr) static mfxStatus qsv_frame_get_hdl(mfxHDL pthis, mfxMemId mid, mfxHDL *hdl) { - QSVMid *qsv_mid = (QSVMid*)mid; + QSVFramesContext *ctx = (QSVFramesContext *)pthis; + AVHWFramesContext *frames_ctx = (AVHWFramesContext*)ctx->hw_frames_ctx->data; + AVQSVFramesContext *frames_hwctx = frames_ctx->hwctx; mfxHDLPair *pair_dst = (mfxHDLPair*)hdl; - mfxHDLPair *pair_src = (mfxHDLPair*)qsv_mid->handle_pair; + mfxHDLPair *pair_src; + + if (frames_hwctx->nb_surfaces) { + QSVMid *qsv_mid = (QSVMid*)mid; + pair_src = (mfxHDLPair*)qsv_mid->handle_pair; + } else { + pair_src = (mfxHDLPair*)mid; + } pair_dst->first = pair_src->first;