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 A4C0C45EB5 for ; Mon, 15 May 2023 06:04:26 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 7AA4468BFE8; Mon, 15 May 2023 09:04:25 +0300 (EEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id CAD4768BE0F for ; Mon, 15 May 2023 09:04:18 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1684130664; x=1715666664; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=wYyOSdMyxchUejL1VBeo0NwMde3vBv1eBsT/g3KrD4I=; b=cJxeGCExrOTk9w1X0K7fjF9b97S0NzVeiBAiqXECo1QefOIfJWJ8owfA kga/cx145nqF8OyWhzUchgFdJeBDwdTJmBlgYlodByPOatij2F4RpfPpf RJPjoOdVdOAtQ/88VEFGDZJl3OCNTlAeSafhUz+kXKH3L+z+1vWBDGovv NtHE4L+r7bvxz/aVnNyPNptLxFGLF2lQV3gaS1dcx6JveXDLmrHjKi54/ LvgwWeEUvCTKczDuYr3e15MmCcWAB6ur7gvUR/7VU0332RCrzkpDGnYwe HMuNcsbZ7rltpvs9psNCxaKp1m0P6+JSvX9uxdK47ZV83P/q2ZFWpbPUw Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10710"; a="351152830" X-IronPort-AV: E=Sophos;i="5.99,275,1677571200"; d="scan'208";a="351152830" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 May 2023 23:04:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10710"; a="812817353" X-IronPort-AV: E=Sophos;i="5.99,275,1677571200"; d="scan'208";a="812817353" Received: from xhh-tgl64.sh.intel.com ([10.238.2.19]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 May 2023 23:04:16 -0700 From: "Xiang, Haihao" To: ffmpeg-devel@ffmpeg.org Date: Mon, 15 May 2023 14:04:03 +0800 Message-Id: <20230515060403.68363-1-haihao.xiang@intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] lavc/qsv: fallback to the default mfx implementation for internal session on Windows 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 The mfx implementation based on D3D11 is expected for an internal session on Windows, however sometimes this implemntation is not supported [1]. A fallback to the default mfx implementation is added in this patch. [1] https://github.com/intel/cartwheel-ffmpeg/issues/246 Signed-off-by: Haihao Xiang --- libavcodec/qsv.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c index 8eabf46b45..7563625627 100644 --- a/libavcodec/qsv.c +++ b/libavcodec/qsv.c @@ -677,18 +677,31 @@ static int qsv_create_mfx_session(AVCodecContext *avctx, int ff_qsv_init_internal_session(AVCodecContext *avctx, QSVSession *qs, const char *load_plugins, int gpu_copy) { + mfxIMPL impls[] = { #if CONFIG_D3D11VA - mfxIMPL impl = MFX_IMPL_AUTO_ANY | MFX_IMPL_VIA_D3D11; -#else - mfxIMPL impl = MFX_IMPL_AUTO_ANY; + MFX_IMPL_AUTO_ANY | MFX_IMPL_VIA_D3D11, #endif + MFX_IMPL_AUTO_ANY + }; + mfxIMPL impl; mfxVersion ver = { { QSV_VERSION_MINOR, QSV_VERSION_MAJOR } }; const char *desc; - int ret = qsv_create_mfx_session(avctx, impl, &ver, gpu_copy, &qs->session, + int ret; + + for (int i = 0; i < FF_ARRAY_ELEMS(impls); i++) { + ret = qsv_create_mfx_session(avctx, impls[i], &ver, gpu_copy, &qs->session, &qs->loader); - if (ret) - return ret; + + if (ret == 0) + break; + + if (i == FF_ARRAY_ELEMS(impls) - 1) + return ret; + else + av_log(avctx, AV_LOG_ERROR, "The current mfx implementation is not " + "supported, try next mfx implementation.\n"); + } #ifdef AVCODEC_QSV_LINUX_SESSION_HANDLE ret = ff_qsv_set_display_handle(avctx, qs); -- 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".