19 #include <stdatomic.h>
23 #include <mfx/mfxvideo.h>
53 #define QSV_VERSION_ATLEAST(MAJOR, MINOR) \
54 (MFX_VERSION_MAJOR > (MAJOR) || \
55 MFX_VERSION_MAJOR == (MAJOR) && MFX_VERSION_MINOR >= (MINOR))
57 #define MFX_IMPL_VIA_MASK(impl) (0x0f00 & (impl))
125 mfxHDLPair *handle_pair;
126 handle_pair = surf->Data.MemId;
127 switch (base_dev_type) {
130 base_handle[0] = handle_pair->first;
135 base_handle[0] = handle_pair->first;
136 base_handle[1] = handle_pair->second;
141 base_handle[0] = handle_pair->first;
159 static uint32_t qsv_get_d3d11va_bind_flags(
int mem_type)
161 uint32_t bind_flags = 0;
163 if ((mem_type & MFX_MEMTYPE_VIDEO_MEMORY_ENCODER_TARGET) && (mem_type & MFX_MEMTYPE_INTERNAL_FRAME))
164 bind_flags = D3D11_BIND_DECODER | D3D11_BIND_VIDEO_ENCODER;
166 bind_flags = D3D11_BIND_DECODER;
168 if ((MFX_MEMTYPE_FROM_VPPOUT & mem_type) || (MFX_MEMTYPE_VIDEO_MEMORY_PROCESSOR_TARGET & mem_type))
169 bind_flags = D3D11_BIND_RENDER_TARGET;
178 int i, planes_nb = 0;
184 for (
i = 0;
i <
desc->nb_components;
i++)
185 planes_nb =
FFMAX(planes_nb,
desc->comp[
i].plane + 1);
187 for (
i = 0;
i < planes_nb;
i++) {
188 int sheight, dheight, y;
196 if (swidth < 0 || dwidth < 0) {
200 sheight =
src->height;
207 for (y = 0; y < sheight; y++) {
210 comp.depth > 8 ? 2 : 1,
214 for (y = sheight; y < dheight; y++) {
227 int hw_handle_supported = 0;
228 mfxHandleType handle_type;
233 err = MFXQueryIMPL(hwctx->
session, &
s->impl);
234 if (err == MFX_ERR_NONE)
235 err = MFXQueryVersion(hwctx->
session, &
s->ver);
236 if (err != MFX_ERR_NONE) {
243 handle_type = MFX_HANDLE_VA_DISPLAY;
246 hw_handle_supported = 1;
250 handle_type = MFX_HANDLE_D3D11_DEVICE;
253 hw_handle_supported = 1;
257 handle_type = MFX_HANDLE_D3D9_DEVICE_MANAGER;
260 hw_handle_supported = 1;
264 if (hw_handle_supported) {
265 err = MFXVideoCORE_GetHandle(hwctx->
session, handle_type, &
s->handle);
266 if (err == MFX_ERR_NONE) {
267 s->handle_type = handle_type;
268 s->child_device_type = device_type;
274 "from the session\n");
283 if (
s->session_download) {
284 MFXVideoVPP_Close(
s->session_download);
285 MFXClose(
s->session_download);
287 s->session_download =
NULL;
288 s->session_download_init = 0;
290 if (
s->session_upload) {
291 MFXVideoVPP_Close(
s->session_upload);
292 MFXClose(
s->session_upload);
294 s->session_upload =
NULL;
295 s->session_upload_init = 0;
321 s->nb_surfaces_used++;
343 if (!device_priv->
handle) {
345 "Cannot create a non-opaque internal surface pool without "
346 "a hardware handle\n");
351 if (!child_device_ref)
358 child_device_hwctx->
display = (VADisplay)device_priv->
handle;
371 child_device_hwctx->
devmgr = (IDirect3DDeviceManager9*)device_priv->
handle;
382 if (!child_frames_ref) {
398 hwctx->
frame_type = MFX_MEMTYPE_VIDEO_MEMORY_PROCESSOR_TARGET;
399 if (hwctx->
frame_type & MFX_MEMTYPE_SHARED_RESOURCE)
400 child_frames_hwctx->
MiscFlags = D3D11_RESOURCE_MISC_SHARED;
407 if (hwctx->
frame_type & MFX_MEMTYPE_VIDEO_MEMORY_PROCESSOR_TARGET)
408 child_frames_hwctx->
surface_type = DXVA2_VideoProcessorRenderTarget;
410 child_frames_hwctx->
surface_type = DXVA2_VideoDecoderRenderTarget;
423 for (
i = 0;
i <
ctx->initial_pool_size;
i++) {
424 s->handle_pairs_internal[
i].first = child_frames_hwctx->
surface_ids +
i;
425 s->handle_pairs_internal[
i].second = (mfxMemId)MFX_INFINITE;
426 s->surfaces_internal[
i].Data.MemId = (mfxMemId)&
s->handle_pairs_internal[
i];
428 hwctx->
frame_type = MFX_MEMTYPE_VIDEO_MEMORY_DECODER_TARGET;
434 for (
i = 0;
i <
ctx->initial_pool_size;
i++) {
436 if(child_frames_hwctx->
BindFlags & D3D11_BIND_RENDER_TARGET) {
437 s->handle_pairs_internal[
i].second = (mfxMemId)MFX_INFINITE;
441 s->surfaces_internal[
i].Data.MemId = (mfxMemId)&
s->handle_pairs_internal[
i];
443 if (child_frames_hwctx->
BindFlags & D3D11_BIND_RENDER_TARGET) {
444 hwctx->
frame_type |= MFX_MEMTYPE_VIDEO_MEMORY_PROCESSOR_TARGET;
446 hwctx->
frame_type |= MFX_MEMTYPE_VIDEO_MEMORY_DECODER_TARGET;
453 for (
i = 0;
i <
ctx->initial_pool_size;
i++) {
454 s->handle_pairs_internal[
i].first = (mfxMemId)child_frames_hwctx->
surfaces[
i];
455 s->handle_pairs_internal[
i].second = (mfxMemId)MFX_INFINITE;
456 s->surfaces_internal[
i].Data.MemId = (mfxMemId)&
s->handle_pairs_internal[
i];
458 if (child_frames_hwctx->
surface_type == DXVA2_VideoProcessorRenderTarget)
459 hwctx->
frame_type = MFX_MEMTYPE_VIDEO_MEMORY_PROCESSOR_TARGET;
461 hwctx->
frame_type = MFX_MEMTYPE_VIDEO_MEMORY_DECODER_TARGET;
465 s->child_frames_ref = child_frames_ref;
466 child_frames_ref =
NULL;
487 surf->Info.BitDepthLuma =
desc->comp[0].depth;
488 surf->Info.BitDepthChroma =
desc->comp[0].depth;
489 surf->Info.Shift =
desc->comp[0].depth > 8;
491 if (
desc->log2_chroma_w &&
desc->log2_chroma_h)
492 surf->Info.ChromaFormat = MFX_CHROMAFORMAT_YUV420;
493 else if (
desc->log2_chroma_w)
494 surf->Info.ChromaFormat = MFX_CHROMAFORMAT_YUV422;
496 surf->Info.ChromaFormat = MFX_CHROMAFORMAT_YUV444;
498 surf->Info.FourCC =
fourcc;
500 surf->Info.CropW =
ctx->width;
502 surf->Info.CropH =
ctx->height;
503 surf->Info.FrameRateExtN = 25;
504 surf->Info.FrameRateExtD = 1;
505 surf->Info.PicStruct = MFX_PICSTRUCT_PROGRESSIVE;
517 if (
ctx->initial_pool_size <= 0) {
523 sizeof(*
s->handle_pairs_internal));
524 if (!
s->handle_pairs_internal)
528 sizeof(*
s->surfaces_internal));
529 if (!
s->surfaces_internal)
532 for (
i = 0;
i <
ctx->initial_pool_size;
i++) {
538 if (!(frames_hwctx->
frame_type & MFX_MEMTYPE_OPAQUE_FRAME)) {
546 if (!
ctx->internal->pool_internal)
549 frames_hwctx->
surfaces =
s->surfaces_internal;
555 static mfxStatus
frame_alloc(mfxHDL pthis, mfxFrameAllocRequest *req,
556 mfxFrameAllocResponse *resp)
561 mfxFrameInfo *
i = &req->Info;
562 mfxFrameInfo *i1 = &hwctx->
surfaces[0].Info;
564 if (!(req->Type & MFX_MEMTYPE_VIDEO_MEMORY_PROCESSOR_TARGET) ||
565 !(req->Type & (MFX_MEMTYPE_FROM_VPPIN | MFX_MEMTYPE_FROM_VPPOUT)) ||
566 !(req->Type & MFX_MEMTYPE_EXTERNAL_FRAME))
567 return MFX_ERR_UNSUPPORTED;
568 if (
i->Width > i1->Width ||
i->Height > i1->Height ||
569 i->FourCC != i1->FourCC ||
i->ChromaFormat != i1->ChromaFormat) {
571 "allocation request: %dx%d %d %d vs %dx%d %d %d\n",
572 i->Width,
i->Height,
i->FourCC,
i->ChromaFormat,
573 i1->Width, i1->Height, i1->FourCC, i1->ChromaFormat);
574 return MFX_ERR_UNSUPPORTED;
577 resp->mids =
s->mem_ids;
583 static mfxStatus
frame_free(mfxHDL pthis, mfxFrameAllocResponse *resp)
588 static mfxStatus
frame_lock(mfxHDL pthis, mfxMemId mid, mfxFrameData *ptr)
590 return MFX_ERR_UNSUPPORTED;
593 static mfxStatus
frame_unlock(mfxHDL pthis, mfxMemId mid, mfxFrameData *ptr)
595 return MFX_ERR_UNSUPPORTED;
600 mfxHDLPair *pair_dst = (mfxHDLPair*)hdl;
601 mfxHDLPair *pair_src = (mfxHDLPair*)mid;
603 pair_dst->first = pair_src->first;
605 if (pair_src->second != (mfxMemId)MFX_INFINITE)
606 pair_dst->second = pair_src->second;
611 mfxSession *session,
int upload)
616 int opaque = !!(frames_hwctx->
frame_type & MFX_MEMTYPE_OPAQUE_FRAME);
618 mfxFrameAllocator frame_allocator = {
630 err = MFXInit(device_priv->
impl, &device_priv->
ver, session);
631 if (err != MFX_ERR_NONE) {
636 if (device_priv->
handle) {
637 err = MFXVideoCORE_SetHandle(*session, device_priv->
handle_type,
639 if (err != MFX_ERR_NONE)
644 err = MFXVideoCORE_SetFrameAllocator(*session, &frame_allocator);
645 if (err != MFX_ERR_NONE)
649 memset(&par, 0,
sizeof(par));
652 par.ExtParam =
s->ext_buffers;
654 par.IOPattern = upload ? MFX_IOPATTERN_OUT_OPAQUE_MEMORY :
655 MFX_IOPATTERN_IN_OPAQUE_MEMORY;
657 par.IOPattern = upload ? MFX_IOPATTERN_OUT_VIDEO_MEMORY :
658 MFX_IOPATTERN_IN_VIDEO_MEMORY;
661 par.IOPattern |= upload ? MFX_IOPATTERN_IN_SYSTEM_MEMORY :
662 MFX_IOPATTERN_OUT_SYSTEM_MEMORY;
665 par.vpp.In = frames_hwctx->
surfaces[0].Info;
671 par.vpp.In.FrameRateExtN = 25;
672 par.vpp.In.FrameRateExtD = 1;
673 par.vpp.Out = par.vpp.In;
675 err = MFXVideoVPP_Init(*session, &par);
676 if (err != MFX_ERR_NONE) {
678 "Surface upload/download will not be possible\n");
691 int opaque = !!(frames_hwctx->
frame_type & MFX_MEMTYPE_OPAQUE_FRAME);
712 sizeof(*
s->surface_ptrs));
713 if (!
s->surface_ptrs)
719 s->opaque_alloc.In.Surfaces =
s->surface_ptrs;
720 s->opaque_alloc.In.NumSurface = frames_hwctx->
nb_surfaces;
721 s->opaque_alloc.In.Type = frames_hwctx->
frame_type;
723 s->opaque_alloc.Out =
s->opaque_alloc.In;
725 s->opaque_alloc.Header.BufferId = MFX_EXTBUFF_OPAQUE_SURFACE_ALLOCATION;
726 s->opaque_alloc.Header.BufferSz =
sizeof(
s->opaque_alloc);
728 s->ext_buffers[0] = (mfxExtBuffer*)&
s->opaque_alloc;
735 s->mem_ids[
i] = frames_hwctx->
surfaces[
i].Data.MemId;
738 s->session_download =
NULL;
739 s->session_upload =
NULL;
741 s->session_download_init = 0;
742 s->session_upload_init = 0;
775 fmts[0] =
ctx->sw_format;
799 mfxHDLPair *pair = (mfxHDLPair*)src_hwctx->
surfaces[
i].Data.MemId;
809 D3D11_TEXTURE2D_DESC texDesc;
816 if (src_hwctx->
frame_type & MFX_MEMTYPE_SHARED_RESOURCE)
817 dst_hwctx->
MiscFlags = D3D11_RESOURCE_MISC_SHARED;
819 mfxHDLPair *pair = (mfxHDLPair*)src_hwctx->
surfaces[
i].Data.MemId;
821 dst_hwctx->
texture_infos[
i].
index = pair->second == (mfxMemId)MFX_INFINITE ? (intptr_t)0 : (intptr_t)pair->second;
824 dst_hwctx->
BindFlags = texDesc.BindFlags;
837 mfxHDLPair *pair = (mfxHDLPair*)src_hwctx->
surfaces[
i].Data.MemId;
838 dst_hwctx->
surfaces[
i] = (IDirect3DSurface9*)pair->first;
841 if (src_hwctx->
frame_type == MFX_MEMTYPE_VIDEO_MEMORY_DECODER_TARGET)
842 dst_hwctx->
surface_type = DXVA2_VideoDecoderRenderTarget;
844 dst_hwctx->
surface_type = DXVA2_VideoProcessorRenderTarget;
859 mfxFrameSurface1 *surf = (mfxFrameSurface1*)
src->data[3];
866 if (!
s->child_frames_ref)
870 switch (child_frames_ctx->device_ctx->type) {
874 mfxHDLPair *pair = (mfxHDLPair*)surf->Data.MemId;
879 child_data = (uint8_t*)(intptr_t)*(VASurfaceID*)pair->first;
886 mfxHDLPair *pair = (mfxHDLPair*)surf->Data.MemId;
887 child_data = pair->first;
894 mfxHDLPair *pair = (mfxHDLPair*)surf->Data.MemId;
895 child_data = pair->first;
903 if (dst->
format == child_frames_ctx->format) {
913 mfxHDLPair *pair = (mfxHDLPair*)surf->Data.MemId;
914 dst->
data[0] = pair->first;
915 dst->
data[1] = pair->second == (mfxMemId)MFX_INFINITE ? (uint8_t *)0 : pair->second;
917 dst->
data[3] = child_data;
938 dummy->format = child_frames_ctx->format;
943 mfxHDLPair *pair = (mfxHDLPair*)surf->Data.MemId;
944 dummy->data[0] = pair->first;
945 dummy->data[1] = pair->second == (mfxMemId)MFX_INFINITE ? (uint8_t *)0 : pair->second;
947 dummy->data[3] = child_data;
963 int download = !!
src->hw_frames_ctx;
964 mfxFrameSurface1 *surf = (mfxFrameSurface1*)(download ?
src->data[3] : dst->
data[3]);
976 dummy->buf[0] = download ?
src->buf[0] : dst->
buf[0];
977 dummy->data[3] = surf->Data.MemId;
978 dummy->hw_frames_ctx =
s->child_frames_ref;
994 switch (
frame->format) {
997 surface->Data.Y =
frame->data[0];
998 surface->Data.UV =
frame->data[1];
1002 surface->Data.Y =
frame->data[0];
1003 surface->Data.U =
frame->data[1];
1004 surface->Data.V =
frame->data[2];
1008 surface->Data.B =
frame->data[0];
1009 surface->Data.G =
frame->data[0] + 1;
1010 surface->Data.R =
frame->data[0] + 2;
1011 surface->Data.A =
frame->data[0] + 3;
1015 surface->Data.Y =
frame->data[0];
1016 surface->Data.U =
frame->data[0] + 1;
1017 surface->Data.V =
frame->data[0] + 3;
1021 surface->Data.Y16 = (mfxU16 *)
frame->data[0];
1022 surface->Data.U16 = (mfxU16 *)
frame->data[0] + 1;
1023 surface->Data.V16 = (mfxU16 *)
frame->data[0] + 3;
1027 return MFX_ERR_UNSUPPORTED;
1029 surface->Data.Pitch =
frame->linesize[0];
1030 surface->Data.TimeStamp =
frame->pts;
1038 atomic_int *inited = upload ? &
s->session_upload_init : &
s->session_download_init;
1039 mfxSession *session = upload ? &
s->session_upload : &
s->session_download;
1065 mfxFrameSurface1
out = {{ 0 }};
1066 mfxFrameSurface1 *in = (mfxFrameSurface1*)
src->data[3];
1068 mfxSyncPoint sync =
NULL;
1072 AVFrame *tmp_frame = &
s->realigned_download_frame;
1085 if (tmp_frame->format != dst->
format ||
1090 tmp_frame->format = dst->
format;
1099 dst_frame = realigned ? tmp_frame : dst;
1101 if (!
s->session_download) {
1102 if (
s->child_frames_ref)
1109 out.Info = in->Info;
1113 err = MFXVideoVPP_RunFrameVPPAsync(
s->session_download, in, &
out,
NULL, &sync);
1114 if (err == MFX_WRN_DEVICE_BUSY)
1116 }
while (err == MFX_WRN_DEVICE_BUSY);
1118 if (err < 0 || !sync) {
1124 err = MFXVideoCORE_SyncOperation(
s->session_download, sync, 1000);
1125 }
while (err == MFX_WRN_IN_EXECUTION);
1132 tmp_frame->width = dst->
width;
1133 tmp_frame->height = dst->
height;
1148 mfxFrameSurface1 in = {{ 0 }};
1149 mfxFrameSurface1 *
out = (mfxFrameSurface1*)dst->
data[3];
1150 mfxFrameInfo tmp_info;
1152 mfxSyncPoint sync =
NULL;
1156 AVFrame *tmp_frame = &
s->realigned_upload_frame;
1167 if (
src->height & 15 ||
src->linesize[0] & 15) {
1169 if (tmp_frame->format !=
src->format ||
1170 tmp_frame->width !=
FFALIGN(
src->width, 16) ||
1171 tmp_frame->height !=
FFALIGN(
src->height, 16)) {
1174 tmp_frame->format =
src->format;
1176 tmp_frame->height =
FFALIGN(
src->height, 16);
1192 tmp_info =
out->Info;
1193 out->Info.CropW =
FFMIN(
out->Info.Width, tmp_frame->width);
1194 out->Info.CropH =
FFMIN(
out->Info.Height, tmp_frame->height);
1197 src_frame = realigned ? tmp_frame :
src;
1199 if (!
s->session_upload) {
1200 if (
s->child_frames_ref)
1207 in.Info =
out->Info;
1211 err = MFXVideoVPP_RunFrameVPPAsync(
s->session_upload, &in,
out,
NULL, &sync);
1212 if (err == MFX_WRN_DEVICE_BUSY)
1214 }
while (err == MFX_WRN_DEVICE_BUSY);
1216 if (err < 0 || !sync) {
1222 err = MFXVideoCORE_SyncOperation(
s->session_upload, sync, 1000);
1223 }
while (err == MFX_WRN_IN_EXECUTION);
1230 out->Info.CropW = tmp_info.CropW;
1231 out->Info.CropH = tmp_info.CropH;
1246 "mapped to QSV frames.\n");
1256 sizeof(*
s->handle_pairs_internal));
1257 if (!
s->handle_pairs_internal)
1260 sizeof(*
s->surfaces_internal));
1261 if (!
s->surfaces_internal)
1266 s->handle_pairs_internal[
i].second = (mfxMemId)MFX_INFINITE;
1267 s->surfaces_internal[
i].Data.MemId = (mfxMemId)&
s->handle_pairs_internal[
i];
1270 dst_hwctx->
frame_type = MFX_MEMTYPE_VIDEO_MEMORY_DECODER_TARGET;
1279 sizeof(*
s->handle_pairs_internal));
1280 if (!
s->handle_pairs_internal)
1283 sizeof(*
s->surfaces_internal));
1284 if (!
s->surfaces_internal)
1289 if (src_hwctx->
BindFlags & D3D11_BIND_RENDER_TARGET) {
1290 s->handle_pairs_internal[
i].second = (mfxMemId)MFX_INFINITE;
1294 s->surfaces_internal[
i].Data.MemId = (mfxMemId)&
s->handle_pairs_internal[
i];
1297 if (src_hwctx->
BindFlags & D3D11_BIND_RENDER_TARGET) {
1298 dst_hwctx->
frame_type |= MFX_MEMTYPE_VIDEO_MEMORY_PROCESSOR_TARGET;
1300 dst_hwctx->
frame_type |= MFX_MEMTYPE_VIDEO_MEMORY_DECODER_TARGET;
1310 sizeof(*
s->handle_pairs_internal));
1311 if (!
s->handle_pairs_internal)
1314 sizeof(*
s->surfaces_internal));
1315 if (!
s->surfaces_internal)
1319 s->handle_pairs_internal[
i].first = (mfxMemId)src_hwctx->
surfaces[
i];
1320 s->handle_pairs_internal[
i].second = (mfxMemId)MFX_INFINITE;
1321 s->surfaces_internal[
i].Data.MemId = (mfxMemId)&
s->handle_pairs_internal[
i];
1324 if (src_hwctx->
surface_type == DXVA2_VideoProcessorRenderTarget)
1325 dst_hwctx->
frame_type = MFX_MEMTYPE_VIDEO_MEMORY_PROCESSOR_TARGET;
1327 dst_hwctx->
frame_type = MFX_MEMTYPE_VIDEO_MEMORY_DECODER_TARGET;
1335 dst_hwctx->
surfaces =
s->surfaces_internal;
1347 switch(
src->format) {
1351 mfxHDLPair *pair = (mfxHDLPair*)hwctx->
surfaces[
i].Data.MemId;
1352 if (*(VASurfaceID*)pair->first == (VASurfaceID)
src->data[3]) {
1361 mfxHDLPair *pair = (mfxHDLPair*)hwctx->
surfaces[
i].Data.MemId;
1362 if (pair->first ==
src->data[0]
1363 && (pair->second ==
src->data[1]
1364 || (pair->second == (mfxMemId)MFX_INFINITE &&
src->data[1] == (uint8_t *)0))) {
1373 mfxHDLPair *pair = (mfxHDLPair*)hwctx->
surfaces[
i].Data.MemId;
1374 if (pair->first ==
src->data[3]) {
1384 "is not in the mapped frames context.\n");
1401 const void *hwconfig,
1439 static const struct {
1443 {
"auto", MFX_IMPL_AUTO },
1444 {
"sw", MFX_IMPL_SOFTWARE },
1445 {
"hw", MFX_IMPL_HARDWARE },
1446 {
"auto_any", MFX_IMPL_AUTO_ANY },
1447 {
"hw_any", MFX_IMPL_HARDWARE_ANY },
1448 {
"hw2", MFX_IMPL_HARDWARE2 },
1449 {
"hw3", MFX_IMPL_HARDWARE3 },
1450 {
"hw4", MFX_IMPL_HARDWARE4 },
1453 mfxIMPL impl = MFX_IMPL_AUTO_ANY;
1458 if (!strcmp(device, impl_map[
i].
name)) {
1459 impl = impl_map[
i].impl;
1463 impl = strtol(device,
NULL, 0);
1466 if (impl != MFX_IMPL_SOFTWARE) {
1468 impl |= MFX_IMPL_VIA_D3D11;
1470 impl |= MFX_IMPL_VIA_D3D9;
1477 mfxIMPL implementation,
1483 mfxVersion ver = { { 3, 1 } };
1485 mfxHandleType handle_type;
1489 switch (child_device_ctx->
type) {
1494 handle_type = MFX_HANDLE_VA_DISPLAY;
1495 handle = (mfxHDL)child_device_hwctx->
display;
1503 handle_type = MFX_HANDLE_D3D11_DEVICE;
1504 handle = (mfxHDL)child_device_hwctx->
device;
1512 handle_type = MFX_HANDLE_D3D9_DEVICE_MANAGER;
1513 handle = (mfxHDL)child_device_hwctx->
devmgr;
1522 err = MFXInit(implementation, &ver, &hwctx->
session);
1523 if (err != MFX_ERR_NONE) {
1530 err = MFXQueryVersion(hwctx->
session, &ver);
1531 if (err != MFX_ERR_NONE) {
1538 "Initialize MFX session: API version is %d.%d, implementation version is %d.%d\n",
1539 MFX_VERSION_MAJOR, MFX_VERSION_MINOR, ver.Major, ver.Minor);
1543 err = MFXInit(implementation, &ver, &hwctx->
session);
1544 if (err != MFX_ERR_NONE) {
1546 "Error initializing an MFX session: %d.\n", err);
1551 err = MFXVideoCORE_SetHandle(hwctx->
session, handle_type, handle);
1552 if (err != MFX_ERR_NONE) {
1574 child_device_ctx,
flags);
1593 ctx->user_opaque = priv;
1601 "\"%s\".\n", e->
value);
1604 }
else if (CONFIG_VAAPI) {
1606 }
else if (CONFIG_DXVA2) {
1608 "WARNING: defaulting child_device_type to AV_HWDEVICE_TYPE_DXVA2 for compatibility "
1609 "with old commandlines. This behaviour will be removed "
1610 "in the future. Please explicitly set device type via \"-init_hw_device\" option.\n");
1612 }
else if (CONFIG_D3D11VA) {
1619 child_device_opts =
NULL;
1620 switch (child_device_type) {
1629 av_dict_set(&child_device_opts,
"kernel_driver",
"i915", 0);
1630 av_dict_set(&child_device_opts,
"driver",
"iHD", 0);
1652 e ? e->
value :
NULL, child_device_opts, 0);