Skip to content

Commit

Permalink
obs-qsv11: Update Intel Media SDK to 2021 R1
Browse files Browse the repository at this point in the history
Verified my Rocket Lake CPU works now.
  • Loading branch information
jpark37 authored and jp9000 committed Jun 30, 2021
1 parent cf9899b commit 998884a
Show file tree
Hide file tree
Showing 44 changed files with 3,118 additions and 1,943 deletions.
3 changes: 3 additions & 0 deletions plugins/obs-qsv11/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ set(obs-qsv11_libmfx_SOURCES
libmfx/src/mfx_critical_section.cpp
libmfx/src/mfx_dispatcher.cpp
libmfx/src/mfx_dispatcher_log.cpp
libmfx/src/mfx_driver_store_loader.cpp
libmfx/src/mfx_dxva2_device.cpp
libmfx/src/mfx_function_table.cpp
libmfx/src/mfx_library_iterator.cpp
Expand All @@ -18,6 +19,7 @@ set(obs-qsv11_libmfx_SOURCES
)

set(obs-qsv11_libmfx_HEADERS
libmfx/include/msdk/include/mfxadapter.h
libmfx/include/msdk/include/mfxastructures.h
libmfx/include/msdk/include/mfxaudio.h
libmfx/include/msdk/include/mfxaudio++.h
Expand All @@ -36,6 +38,7 @@ set(obs-qsv11_libmfx_HEADERS
libmfx/include/mfx_dispatcher.h
libmfx/include/mfx_dispatcher_defs.h
libmfx/include/mfx_dispatcher_log.h
libmfx/include/mfx_driver_store_loader.h
libmfx/include/mfx_dxva2_device.h
libmfx/include/mfx_exposed_functions_list.h
libmfx/include/mfx_library_iterator.h
Expand Down
48 changes: 19 additions & 29 deletions plugins/obs-qsv11/libmfx/include/mfx_critical_section.h
Original file line number Diff line number Diff line change
@@ -1,32 +1,22 @@
/* ****************************************************************************** *\
Copyright (C) 2012-2013 Intel Corporation. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
- Neither the name of Intel Corporation nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
File Name: mfx_critical_section.h
\* ****************************************************************************** */
// Copyright (c) 2012-2019 Intel Corporation
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

#if !defined(__MFX_CRITICAL_SECTION_H)
#define __MFX_CRITICAL_SECTION_H
Expand Down
75 changes: 39 additions & 36 deletions plugins/obs-qsv11/libmfx/include/mfx_dispatcher.h
Original file line number Diff line number Diff line change
@@ -1,32 +1,22 @@
/* ****************************************************************************** *\
Copyright (C) 2012-2017 Intel Corporation. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
- Neither the name of Intel Corporation nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
File Name: mfx_dispatcher.h
\* ****************************************************************************** */
// Copyright (c) 2012-2020 Intel Corporation
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

#if !defined(__MFX_DISPATCHER_H)
#define __MFX_DISPATCHER_H
Expand All @@ -44,6 +34,8 @@ File Name: mfx_dispatcher.h

mfxStatus MFXQueryVersion(mfxSession session, mfxVersion *version);



enum
{
// to avoid code changing versions are just inherited
Expand Down Expand Up @@ -119,7 +111,7 @@ enum eMfxImplType
enum
{
MFX_DISPATCHER_VERSION_MAJOR = 1,
MFX_DISPATCHER_VERSION_MINOR = 2
MFX_DISPATCHER_VERSION_MINOR = 3
};

struct _mfxSession
Expand All @@ -144,7 +136,7 @@ struct MFX_DISP_HANDLE : public _mfxSession
~MFX_DISP_HANDLE(void);

// Load the library's module
mfxStatus LoadSelectedDLL(const msdk_disp_char *pPath, eMfxImplType implType, mfxIMPL impl, mfxIMPL implInterface, mfxInitParam &par);
mfxStatus LoadSelectedDLL(const wchar_t *pPath, eMfxImplType implType, mfxIMPL impl, mfxIMPL implInterface, mfxInitParam &par);
// Unload the library's module
mfxStatus UnLoadSelectedDLL(void);

Expand All @@ -169,7 +161,7 @@ struct MFX_DISP_HANDLE : public _mfxSession
// Status of loaded dll
mfxStatus loadStatus;
// Resgistry subkey name for windows version
msdk_disp_char subkeyName[MFX_MAX_REGISTRY_KEY_NAME];
wchar_t subkeyName[MFX_MAX_REGISTRY_KEY_NAME];
// Storage ID for windows version
int storageID;

Expand All @@ -186,26 +178,37 @@ struct MFX_DISP_HANDLE : public _mfxSession

};

// This struct extends MFX_DISP_HANDLE, we cannot extend MFX_DISP_HANDLE itself due to possible compatibility issues
// This struct was added in dispatcher version 1.3
// Check dispatcher handle's version when you cast session struct which came from outside of MSDK API function to this
struct MFX_DISP_HANDLE_EX : public MFX_DISP_HANDLE
{
MFX_DISP_HANDLE_EX(const mfxVersion requiredVersion);

mfxU16 mediaAdapterType;
mfxU16 reserved[10];
};

// declare comparison operator
inline
bool operator == (const mfxVersion &one, const mfxVersion &two)
{
return (one.Version == two.Version);

} // bool operator == (const mfxVersion &one, const mfxVersion &two)
}

inline
bool operator < (const mfxVersion &one, const mfxVersion &two)
{
return (one.Major == two.Major) && (one.Minor < two.Minor);
return (one.Major < two.Major) || ((one.Major == two.Major) && (one.Minor < two.Minor));

} // bool operator < (const mfxVersion &one, const mfxVersion &two)
}

inline
bool operator <= (const mfxVersion &one, const mfxVersion &two)
{
return (one == two) || (one < two);
} // bool operator <= (const mfxVersion &one, const mfxVersion &two)
}


//
Expand Down
97 changes: 28 additions & 69 deletions plugins/obs-qsv11/libmfx/include/mfx_dispatcher_defs.h
Original file line number Diff line number Diff line change
@@ -1,36 +1,27 @@
/* ****************************************************************************** *\
Copyright (C) 2013-2017 Intel Corporation. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
- Neither the name of Intel Corporation nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
File Name: mfx_dispatcher_defs.h
\* ****************************************************************************** */
// Copyright (c) 2013-2020 Intel Corporation
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

#pragma once
#include "mfxdefs.h"
#include <cstring>
#include <cstdio>

#if defined(MFX_DISPATCHER_LOG)
#include <string>
Expand All @@ -40,49 +31,17 @@ File Name: mfx_dispatcher_defs.h
#define MAX_PLUGIN_PATH 4096
#define MAX_PLUGIN_NAME 4096

#if defined(_WIN32) || defined(_WIN64)
typedef wchar_t msdk_disp_char;
#define MSDK2WIDE(x) x

#if _MSC_VER >= 1400
#define msdk_disp_char_cpy_s(to, to_size, from) wcscpy_s(to,to_size, from)
#else
#define msdk_disp_char_cpy_s(to, to_size, from) wcscpy(to, from)
#endif

#else
typedef char msdk_disp_char;
//#define msdk_disp_char_cpy_s(to, to_size, from) strcpy(to, from)

inline void msdk_disp_char_cpy_s(char * to, size_t to_size, const char * from)
{
size_t source_len = strlen(from);
size_t num_chars = (to_size - 1) < source_len ? (to_size - 1) : source_len;
strncpy(to, from, num_chars);
to[num_chars] = 0;
}

#if defined(MFX_DISPATCHER_LOG)
#define MSDK2WIDE(x) getWideString(x).c_str()

inline std::wstring getWideString(const char * string)
{
size_t len = strlen(string);
return std::wstring(string, string + len);
}
#else
#define MSDK2WIDE(x) x
#endif

#if _MSC_VER < 1400
#define wcscpy_s(to,to_size, from) wcscpy(to, from)
#define wcscat_s(to,to_size, from) wcscat(to, from)
#endif

#if defined(__GNUC__) && !defined(_WIN32) && !defined(_WIN64)
#define sscanf_s sscanf
#define swscanf_s swscanf
#endif


// declare library module's handle
typedef void * mfxModuleHandle;

typedef void (MFX_CDECL * mfxFunctionPointer)(void);

// Tracer uses lib loading from Program Files logic (via Dispatch reg key) to make dispatcher load tracer dll.
// With DriverStore loading put at 1st place, dispatcher loads real lib before it finds tracer dll.
// This workaround explicitly checks tracer presence in Dispatch reg key and loads tracer dll before the search for lib in all other places.
#define MFX_TRACER_WA_FOR_DS 1
Loading

0 comments on commit 998884a

Please sign in to comment.