Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
libavcodec/qsv: Fix MFXInit for some hw setups
By accessing MFX through D3D11 we can use Intel GPUs without enabling
them in windows.
This can be verified using msdk_sys_analyzer from the Intel Media SDK.
  • Loading branch information
oysteinkrog committed Dec 4, 2019
1 parent 55e3a16 commit 338fbcd
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion libavcodec/qsv.c
Expand Up @@ -328,17 +328,41 @@ static int qsv_load_plugins(mfxSession session, const char *load_plugins,
int ff_qsv_init_internal_session(AVCodecContext *avctx, mfxSession *session,
const char *load_plugins)
{
mfxIMPL impl = MFX_IMPL_AUTO_ANY;
mfxVersion ver = { { QSV_VERSION_MINOR, QSV_VERSION_MAJOR } };

const char *desc;
int ret;

// https://trac.ffmpeg.org/ticket/7933
// try d3d11
mfxIMPL impl = MFX_IMPL_HARDWARE_ANY | MFX_IMPL_VIA_D3D11;
ret = MFXInit(impl, &ver, session);
if (ret >= 0)
av_log(avctx, AV_LOG_DEBUG, "MFX Initialized with HARDWARE_ANY | VIA_D3D11\n");

if (ret < 0)
{
// try d3d9
impl = MFX_IMPL_HARDWARE_ANY | MFX_IMPL_VIA_D3D9;
ret = MFXInit(impl, &ver, session);
if(ret >= 0)
av_log(avctx, AV_LOG_DEBUG, "MFX Initialized with HARDWARE_ANY | VIA_D3D9\n");
}

// try any
if (ret < 0)
{
impl = MFX_IMPL_AUTO_ANY;
ret = MFXInit(impl, &ver, session);
if(ret >= 0)
av_log(avctx, AV_LOG_DEBUG, "MFX Initialized with AUTO_ANY\n");
}

if (ret < 0)
return ff_qsv_print_error(avctx, ret,
"Error initializing an internal MFX session");


ret = qsv_load_plugins(*session, load_plugins, avctx);
if (ret < 0) {
av_log(avctx, AV_LOG_ERROR, "Error loading plugins\n");
Expand Down

0 comments on commit 338fbcd

Please sign in to comment.