[vlc-commits] [Git][videolan/vlc][master] contrib: mfx: fix linking with x86 DLL on UWP

Hugo Beauzée-Luyssen (@chouquette) gitlab at videolan.org
Fri Oct 22 10:15:06 UTC 2021



Hugo Beauzée-Luyssen pushed to branch master at VideoLAN / VLC


Commits:
18a72511 by Johannes Kauffmann at 2021-10-22T08:26:33+00:00
contrib: mfx: fix linking with x86 DLL on UWP

intel_gfx_api-x86.dll exports InitialiseMediaSession and
DisposeMediaSession, but libqsv_plugin.dll imports
InitialiseMediaSession at 12 and DisposeMediaSession at 4. The name
decorations are caused by the APIENTRY modifier, resulting in
libqsv_plugin.dll not being able to load intel_gfx_api-x86.dll. It
fails with an Entry Point Not Found error. On debug mode UWP, this
will crash the CoreCLR.

Should fix https://code.videolan.org/videolan/LibVLCSharp/-/issues/374.

Backport from upstream mfx_dispatch, fixed since
https://github.com/lu-zero/mfx_dispatch/commit/7e4d221c36c630c1250b23a5dfa15657bc04c10c.

- - - - -


3 changed files:

- + contrib/src/mfx/0002-Fix-linking-statically-with-intel_gfx_api-x86.dll.patch
- + contrib/src/mfx/0003-Don-t-change-the-calling-convention-of-x86-gfx-api.patch
- contrib/src/mfx/rules.mak


Changes:

=====================================
contrib/src/mfx/0002-Fix-linking-statically-with-intel_gfx_api-x86.dll.patch
=====================================
@@ -0,0 +1,39 @@
+From d16955c72e423954145fed985ad1fbda0e5ca977 Mon Sep 17 00:00:00 2001
+From: Johannes Kauffmann <19662702+JohannesKauffmann at users.noreply.github.com>
+Date: Fri, 15 Oct 2021 21:53:51 +0200
+Subject: [PATCH 2/3] Fix linking statically with intel_gfx_api-x86.dll
+
+---
+ src/intel_api_factory.h   | 4 ++--
+ src/intel_gfx_api-x86.def | 4 ++--
+ 2 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/src/intel_api_factory.h b/src/intel_api_factory.h
+index 0be5dcb..29e9773 100644
+--- a/src/intel_api_factory.h
++++ b/src/intel_api_factory.h
+@@ -25,8 +25,8 @@ extern "C"
+ {
+ #endif /* __cplusplus */
+ 
+-HRESULT APIENTRY InitialiseMediaSession(_Out_ HANDLE* handle, _In_ LPVOID lpParam, _Reserved_ LPVOID lpReserved);
+-HRESULT APIENTRY DisposeMediaSession(_In_ const HANDLE handle);
++HRESULT InitialiseMediaSession(_Out_ HANDLE* handle, _In_ LPVOID lpParam, _Reserved_ LPVOID lpReserved);
++HRESULT DisposeMediaSession(_In_ const HANDLE handle);
+ 
+ #ifdef __cplusplus
+ }
+diff --git a/src/intel_gfx_api-x86.def b/src/intel_gfx_api-x86.def
+index 19d0727..c9c15e6 100644
+--- a/src/intel_gfx_api-x86.def
++++ b/src/intel_gfx_api-x86.def
+@@ -1,4 +1,4 @@
+ LIBRARY intel_gfx_api-x86.dll
+ EXPORTS
+-InitialiseMediaSession at 12
+-DisposeMediaSession at 4
++InitialiseMediaSession
++DisposeMediaSession
+-- 
+2.27.0.windows.1
+


=====================================
contrib/src/mfx/0003-Don-t-change-the-calling-convention-of-x86-gfx-api.patch
=====================================
@@ -0,0 +1,35 @@
+From 0d15135fe441acfdbbb840abea53cf696cd21470 Mon Sep 17 00:00:00 2001
+From: Johannes Kauffmann <19662702+JohannesKauffmann at users.noreply.github.com>
+Date: Tue, 19 Oct 2021 21:03:39 +0200
+Subject: [PATCH 3/3] Don't change the calling convention of x86 gfx api
+
+Upstream MediaSDK, since ae85eb2, uses __cdecl, which corresponds to
+WINAPIV in mingw64 and MSDK. The removal of APIENTRY (since f45c0c2)
+changes the calling convention from __stdcall.
+
+The removal of the '@' name decorations (also gone since f45c0c2)
+remains.
+
+Co-authored-by: Steve Lhomme <robux4 at ycbcr.xyz>
+---
+ src/intel_api_factory.h | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/intel_api_factory.h b/src/intel_api_factory.h
+index 29e9773..44ee7eb 100644
+--- a/src/intel_api_factory.h
++++ b/src/intel_api_factory.h
+@@ -25,8 +25,8 @@ extern "C"
+ {
+ #endif /* __cplusplus */
+ 
+-HRESULT InitialiseMediaSession(_Out_ HANDLE* handle, _In_ LPVOID lpParam, _Reserved_ LPVOID lpReserved);
+-HRESULT DisposeMediaSession(_In_ const HANDLE handle);
++HRESULT WINAPIV InitialiseMediaSession(_Out_ HANDLE* handle, _In_ LPVOID lpParam, _Reserved_ LPVOID lpReserved);
++HRESULT WINAPIV DisposeMediaSession(_In_ const HANDLE handle);
+ 
+ #ifdef __cplusplus
+ }
+-- 
+2.27.0.windows.1
+


=====================================
contrib/src/mfx/rules.mak
=====================================
@@ -30,6 +30,8 @@ $(TARBALLS)/mfx-$(MFX_GITHASH).tar.xz:
 mfx: mfx-$(MFX_GITHASH).tar.xz .sum-mfx
 	$(UNPACK)
 	$(APPLY) $(SRC)/mfx/0001-detect-winstore-builds-with-a-regular-mingw32-toolch.patch
+	$(APPLY) $(SRC)/mfx/0002-Fix-linking-statically-with-intel_gfx_api-x86.dll.patch
+	$(APPLY) $(SRC)/mfx/0003-Don-t-change-the-calling-convention-of-x86-gfx-api.patch
 	cd $(UNPACK_DIR) && autoreconf -ivf
 	$(MOVE)
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/18a7251119c712a0b19a73d197427db8565cdb76

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/18a7251119c712a0b19a73d197427db8565cdb76
You're receiving this email because of your account on code.videolan.org.




More information about the vlc-commits mailing list