Ticket #10537: onevpl-legacy-fix-6.0.patch
| File onevpl-legacy-fix-6.0.patch, 10.3 KB (added by , 3 years ago) |
|---|
-
sources/libavcodec/qsv.c
libavcodec/qsv.c | 67 +++++++++++++++++++++++++++++++++----------------------- 1 file changed, 39 insertions(+), 28 deletions(-) diff --git sources/libavcodec/qsv.c sources/libavcodec/qsv.c index 7af154202c..3c99486af7 100644
static int ff_qsv_set_display_handle(AVCodecContext *avctx, QSVSession *qs) 491 491 } 492 492 #endif //AVCODEC_QSV_LINUX_SESSION_HANDLE 493 493 494 static int qsv_create_mfx_session_legacy(AVCodecContext *avctx, 495 mfxIMPL implementation, 496 mfxVersion *pver, 497 int gpu_copy, 498 mfxSession *psession) 499 { 500 mfxInitParam init_par = {MFX_IMPL_AUTO_ANY}; 501 mfxSession session = NULL; 502 mfxStatus sts; 503 504 av_log(avctx, AV_LOG_VERBOSE, 505 "Use Intel(R) Media SDK to create MFX session, the required " 506 "implementation version is %d.%d\n", 507 pver->Major, pver->Minor); 508 509 *psession = NULL; 510 511 init_par.GPUCopy = gpu_copy; 512 init_par.Implementation = implementation; 513 init_par.Version = *pver; 514 sts = MFXInitEx(init_par, &session); 515 if (sts < 0) 516 return ff_qsv_print_error(avctx, sts, 517 "Error initializing a MFX session"); 518 else if (sts > 0) 519 { 520 ff_qsv_print_warning(avctx, sts, 521 "Warning in MFX initialization"); 522 return AVERROR_UNKNOWN; 523 } 524 525 *psession = session; 526 527 return 0; 528 } 529 494 530 #if QSV_ONEVPL 495 531 static int qsv_new_mfx_loader(AVCodecContext *avctx, 496 532 mfxIMPL implementation, … … static int qsv_create_mfx_session(AVCodecContext *avctx, 622 658 loader = *ploader; 623 659 } 624 660 625 if (qsv_create_mfx_session_from_loader(avctx, loader, psession)) 661 if (qsv_create_mfx_session_from_loader(avctx, loader, psession) && 662 qsv_create_mfx_session_legacy(avctx, implementation, pver, gpu_copy, psession)) 626 663 goto fail; 627 664 628 665 if (!*ploader) … … static int qsv_create_mfx_session(AVCodecContext *avctx, 646 683 mfxSession *psession, 647 684 void **ploader) 648 685 { 649 mfxInitParam init_par = { MFX_IMPL_AUTO_ANY };650 mfxSession session = NULL;651 mfxStatus sts;652 653 av_log(avctx, AV_LOG_VERBOSE,654 "Use Intel(R) Media SDK to create MFX session, the required "655 "implementation version is %d.%d\n",656 pver->Major, pver->Minor);657 658 *psession = NULL;659 686 *ploader = NULL; 660 661 init_par.GPUCopy = gpu_copy; 662 init_par.Implementation = implementation; 663 init_par.Version = *pver; 664 sts = MFXInitEx(init_par, &session); 665 if (sts < 0) 666 return ff_qsv_print_error(avctx, sts, 667 "Error initializing a MFX session"); 668 else if (sts > 0) { 669 ff_qsv_print_warning(avctx, sts, 670 "Warning in MFX initialization"); 671 return AVERROR_UNKNOWN; 672 } 673 674 *psession = session; 675 676 return 0; 687 return qsv_create_mfx_session_legacy(avctx, implementation, pver, gpu_copy, psession); 677 688 } 678 689 679 690 #endif -
sources/libavfilter/qsvvpp.c
libavfilter/qsvvpp.c | 54 ++++++++++++++++++++++++++++++++-------------------- 1 file changed, 33 insertions(+), 21 deletions(-) diff --git sources/libavfilter/qsvvpp.c sources/libavfilter/qsvvpp.c index 54e7284234..b1090f8f08 100644
int ff_qsvvpp_filter_frame(QSVVPPContext *s, AVFilterLink *inlink, AVFrame *picr 936 936 return 0; 937 937 } 938 938 939 static int ff_qsvvpp_create_mfx_session_legacy(void *ctx, 940 mfxIMPL implementation, 941 mfxVersion *pver, 942 mfxSession *psession) 943 { 944 mfxSession session = NULL; 945 mfxStatus sts; 946 947 av_log(ctx, AV_LOG_VERBOSE, 948 "Use Intel(R) Media SDK to create MFX session, API version is " 949 "%d.%d, the required implementation version is %d.%d\n", 950 MFX_VERSION_MAJOR, MFX_VERSION_MINOR, pver->Major, pver->Minor); 951 952 *psession = NULL; 953 sts = MFXInit(implementation, pver, &session); 954 if (sts < 0) 955 return ff_qsvvpp_print_error(ctx, sts, 956 "Error initializing an MFX session"); 957 else if (sts > 0) 958 { 959 ff_qsvvpp_print_warning(ctx, sts, "Warning in MFX session initialization"); 960 return AVERROR_UNKNOWN; 961 } 962 963 *psession = session; 964 965 return 0; 966 } 967 939 968 #if QSV_ONEVPL 940 969 941 970 int ff_qsvvpp_create_mfx_session(void *ctx, … … int ff_qsvvpp_create_mfx_session(void *ctx, 979 1008 impl_idx++; 980 1009 } 981 1010 1011 if (sts && !ff_qsvvpp_create_mfx_session_legacy(ctx, implementation, pver, psession)) 1012 return 0; 1013 982 1014 if (sts < 0) 983 1015 return ff_qsvvpp_print_error(ctx, sts, 984 1016 "Error creating a MFX session"); … … int ff_qsvvpp_create_mfx_session(void *ctx, 1001 1033 mfxVersion *pver, 1002 1034 mfxSession *psession) 1003 1035 { 1004 mfxSession session = NULL; 1005 mfxStatus sts; 1006 1007 av_log(ctx, AV_LOG_VERBOSE, 1008 "Use Intel(R) Media SDK to create MFX session, API version is " 1009 "%d.%d, the required implementation version is %d.%d\n", 1010 MFX_VERSION_MAJOR, MFX_VERSION_MINOR, pver->Major, pver->Minor); 1011 1012 *psession = NULL; 1013 sts = MFXInit(implementation, pver, &session); 1014 if (sts < 0) 1015 return ff_qsvvpp_print_error(ctx, sts, 1016 "Error initializing an MFX session"); 1017 else if (sts > 0) { 1018 ff_qsvvpp_print_warning(ctx, sts, "Warning in MFX session initialization"); 1019 return AVERROR_UNKNOWN; 1020 } 1021 1022 *psession = session; 1023 1024 return 0; 1036 return ff_qsvvpp_create_mfx_session_legacy(ctx, implementation, pver, psession); 1025 1037 } 1026 1038 1027 1039 #endif -
sources/libavutil/hwcontext_qsv.c
libavutil/hwcontext_qsv.c | 112 +++++++++++++++++++++++++++------------------- 1 file changed, 65 insertions(+), 47 deletions(-) diff --git sources/libavutil/hwcontext_qsv.c sources/libavutil/hwcontext_qsv.c index 42851d4fd5..8ec1c35e0f 100644
static mfxStatus frame_get_hdl(mfxHDL pthis, mfxMemId mid, mfxHDL *hdl) 661 661 return MFX_ERR_NONE; 662 662 } 663 663 664 static int qsv_create_mfx_session_legacy(void *ctx, 665 mfxHDL handle, 666 mfxHandleType handle_type, 667 mfxIMPL implementation, 668 mfxVersion *pver, 669 mfxSession *psession) 670 { 671 mfxVersion ver; 672 mfxStatus sts; 673 mfxSession session = NULL; 674 675 av_log(ctx, AV_LOG_VERBOSE, 676 "Use Intel(R) Media SDK to create MFX session, API version is " 677 "%d.%d, the required implementation version is %d.%d\n", 678 MFX_VERSION_MAJOR, MFX_VERSION_MINOR, pver->Major, pver->Minor); 679 680 *psession = NULL; 681 ver = *pver; 682 sts = MFXInit(implementation, &ver, &session); 683 if (sts != MFX_ERR_NONE) 684 { 685 av_log(ctx, AV_LOG_ERROR, "Error initializing an MFX session: " 686 "%d.\n", 687 sts); 688 goto fail; 689 } 690 691 sts = MFXQueryVersion(session, &ver); 692 if (sts != MFX_ERR_NONE) 693 { 694 av_log(ctx, AV_LOG_ERROR, "Error querying an MFX session: " 695 "%d.\n", 696 sts); 697 goto fail; 698 } 699 700 av_log(ctx, AV_LOG_VERBOSE, "Initialize MFX session: implementation " 701 "version is %d.%d\n", 702 ver.Major, ver.Minor); 703 704 MFXClose(session); 705 706 sts = MFXInit(implementation, &ver, &session); 707 if (sts != MFX_ERR_NONE) 708 { 709 av_log(ctx, AV_LOG_ERROR, "Error initializing an MFX session: " 710 "%d.\n", 711 sts); 712 goto fail; 713 } 714 715 *psession = session; 716 717 return 0; 718 719 fail: 720 if (session) 721 MFXClose(session); 722 723 return AVERROR_UNKNOWN; 724 } 725 664 726 #if QSV_ONEVPL 665 727 666 728 static int qsv_d3d11_update_config(void *ctx, mfxHDL handle, mfxConfig cfg) … … static int qsv_create_mfx_session(void *ctx, 1016 1078 } else 1017 1079 loader = *ploader; // Use the input mfxLoader to create mfx session 1018 1080 1019 if (qsv_create_mfx_session_from_loader(ctx, loader, psession)) 1081 if (qsv_create_mfx_session_from_loader(ctx, loader, psession) && 1082 qsv_create_mfx_session_legacy(ctx, handle, handle_type, implementation, pver, psession)) 1020 1083 goto fail; 1021 1084 1022 1085 if (!*ploader) … … static int qsv_create_mfx_session(void *ctx, 1041 1104 mfxSession *psession, 1042 1105 void **ploader) 1043 1106 { 1044 mfxVersion ver;1045 mfxStatus sts;1046 mfxSession session = NULL;1047 1048 av_log(ctx, AV_LOG_VERBOSE,1049 "Use Intel(R) Media SDK to create MFX session, API version is "1050 "%d.%d, the required implementation version is %d.%d\n",1051 MFX_VERSION_MAJOR, MFX_VERSION_MINOR, pver->Major, pver->Minor);1052 1053 1107 *ploader = NULL; 1054 *psession = NULL; 1055 ver = *pver; 1056 sts = MFXInit(implementation, &ver, &session); 1057 if (sts != MFX_ERR_NONE) { 1058 av_log(ctx, AV_LOG_ERROR, "Error initializing an MFX session: " 1059 "%d.\n", sts); 1060 goto fail; 1061 } 1062 1063 sts = MFXQueryVersion(session, &ver); 1064 if (sts != MFX_ERR_NONE) { 1065 av_log(ctx, AV_LOG_ERROR, "Error querying an MFX session: " 1066 "%d.\n", sts); 1067 goto fail; 1068 } 1069 1070 av_log(ctx, AV_LOG_VERBOSE, "Initialize MFX session: implementation " 1071 "version is %d.%d\n", ver.Major, ver.Minor); 1072 1073 MFXClose(session); 1074 1075 sts = MFXInit(implementation, &ver, &session); 1076 if (sts != MFX_ERR_NONE) { 1077 av_log(ctx, AV_LOG_ERROR, "Error initializing an MFX session: " 1078 "%d.\n", sts); 1079 goto fail; 1080 } 1081 1082 *psession = session; 1083 1084 return 0; 1085 1086 fail: 1087 if (session) 1088 MFXClose(session); 1089 1090 return AVERROR_UNKNOWN; 1108 return qsv_create_mfx_session_legacy(ctx, handle, handle_type, implementation, pver, psession); 1091 1109 } 1092 1110 1093 1111 #endif
