From 8480215938fd8a92a3c52305d1200c4567c95c23 Mon Sep 17 00:00:00 2001 From: Stefan Reimer Date: Thu, 25 Oct 2012 18:17:17 -0700 Subject: [PATCH] Removed wine and nvidia-drivers, both patches are upstream now --- app-emulation/wine/Manifest | 15 - app-emulation/wine/files/pulseaudio.patch | 3388 ----------------- .../wine/files/wine-1.1.15-winegcc.patch | 55 - .../files/wine-1.4_rc2-multilib-portage.patch | 40 - .../wine/files/wine-1.5.10-osmesa-check.patch | 33 - app-emulation/wine/wine-1.4.ebuild | 232 -- app-emulation/wine/wine-1.5.11.ebuild | 249 -- app-emulation/wine/wine.diff | 21 - x11-drivers/nvidia-drivers/Manifest | 18 - x11-drivers/nvidia-drivers/ebuild.diff | 24 - .../nvidia-drivers/files/nvidia-169.07 | 14 - .../files/nvidia-autostart.desktop | 8 - .../files/nvidia-drivers-pax-const.patch | 17 - .../files/nvidia-drivers-pax-usercopy.patch | 54 - .../nvidia-drivers/files/nvidia-smi.init | 25 - .../nvidia-drivers/files/nvidia-udev.sh | 17 - .../nvidia-drivers/files/nvidia.udev-rule | 6 - .../nvidia-drivers-295.59.ebuild | 598 --- .../nvidia-drivers-304.37-r1.ebuild | 446 --- 19 files changed, 5260 deletions(-) delete mode 100644 app-emulation/wine/Manifest delete mode 100644 app-emulation/wine/files/pulseaudio.patch delete mode 100644 app-emulation/wine/files/wine-1.1.15-winegcc.patch delete mode 100644 app-emulation/wine/files/wine-1.4_rc2-multilib-portage.patch delete mode 100644 app-emulation/wine/files/wine-1.5.10-osmesa-check.patch delete mode 100644 app-emulation/wine/wine-1.4.ebuild delete mode 100644 app-emulation/wine/wine-1.5.11.ebuild delete mode 100644 app-emulation/wine/wine.diff delete mode 100644 x11-drivers/nvidia-drivers/Manifest delete mode 100644 x11-drivers/nvidia-drivers/ebuild.diff delete mode 100644 x11-drivers/nvidia-drivers/files/nvidia-169.07 delete mode 100644 x11-drivers/nvidia-drivers/files/nvidia-autostart.desktop delete mode 100644 x11-drivers/nvidia-drivers/files/nvidia-drivers-pax-const.patch delete mode 100644 x11-drivers/nvidia-drivers/files/nvidia-drivers-pax-usercopy.patch delete mode 100644 x11-drivers/nvidia-drivers/files/nvidia-smi.init delete mode 100644 x11-drivers/nvidia-drivers/files/nvidia-udev.sh delete mode 100644 x11-drivers/nvidia-drivers/files/nvidia.udev-rule delete mode 100644 x11-drivers/nvidia-drivers/nvidia-drivers-295.59.ebuild delete mode 100644 x11-drivers/nvidia-drivers/nvidia-drivers-304.37-r1.ebuild diff --git a/app-emulation/wine/Manifest b/app-emulation/wine/Manifest deleted file mode 100644 index 8bf42c4..0000000 --- a/app-emulation/wine/Manifest +++ /dev/null @@ -1,15 +0,0 @@ -AUX pulseaudio.patch 109370 RMD160 a7412efb915018d657ae329aeed2b907e285425c SHA1 bcf663862186bb62a6ccefb85297c6b218b06087 SHA256 71e28f02a9a3d341e123303ad7ff2ee63aaa33945cd6d40fdb2986b9a393a4a1 -AUX wine-1.1.15-winegcc.patch 1556 RMD160 ca7e0df0a45507e7d31ed81c5712111b83ed9bfa SHA1 4b155fe7cb5e831b7f92757d52aa1ab12569b232 SHA256 dbd89db561d7583faf317d795b8c11231575d885e21c6414add39079604dbd0d -AUX wine-1.4_rc2-multilib-portage.patch 1256 RMD160 6445df9cc97ad523f54de256f37810366a0693fd SHA1 8d0d794f74952a53d38c75a8cb586f784a3b9357 SHA256 9d0acd304d11d1bf73f56699754aaa1bfe1facba90648ee330fdbe08d9ff4938 -AUX wine-1.5.10-osmesa-check.patch 1620 RMD160 35bd25cccfcd1cbe9b59f55a078a1fbc12aee0db SHA1 713163fc3399b0a99e31faa788da966107e9194a SHA256 3c6c5081cd28231e251c6bacdcee3042decf87ee985624ca76d7b9c1d35a0184 -DIST wine-1.4.tar.bz2 20035856 RMD160 ee523c4cf15984197487432790c0e5bbba3ec495 SHA1 ce5d56b9b949c01dde663ab39739ffcfb41a73c4 SHA256 99a437bb8bd350bb1499d59183635e58217e73d631379c43cfd0d6020428ee65 -DIST wine-1.5.11.tar.bz2 20651401 RMD160 d4fe8cd101f940041b490dfd88d05607fc89ed9d SHA1 35420a64d33e4886c3ccd37f8ca2a2acf1e6086b SHA256 2854c853546ded26e9c15ba43c29ceace72b7815f25dfd048dd69dc321521488 -DIST wine-mono-0.0.4.msi 44408320 RMD160 4a68b97bbe6f5202de594c51a2cc45ea7e1e5089 SHA1 7d827f7d28a88ae0da95a136573783124ffce4b1 SHA256 15d8a612cdeca4eff3137353f29fdeb7a99e055cd633844c91cd00e0186b8882 -DIST wine_gecko-1.4-x86.msi 14732288 RMD160 02363538a77a954f2bf1014b28ec1ed8fe2d1b6e SHA1 c30aa99621e98336eb4b7e2074118b8af8ea2ad5 SHA256 b30e0ac29a91a6fc40c73b5b760a56360a1d5323282545e32efaa40c75d8986d -DIST wine_gecko-1.4-x86_64.msi 14980096 RMD160 5613e27d474085c31b53c868ed020445bdee37ae SHA1 bf0aaf56a8cf9abd75be02b56b05e5c4e9a4df93 SHA256 ceab7f1866e85175ed4cd3b5d081ee4f77c8d32ac7adf489a19c1f7329187219 -DIST wine_gecko-1.7-x86.msi 16995328 RMD160 6ce45f67498be7c1c010e9fc1eef166529213f4b SHA1 efebc4ed7a86708e2dc8581033a3c5d6effe0b0b SHA256 2ed524e79cc88137b28430389af19cb032989311921462a29f72d6f121954913 -DIST wine_gecko-1.7-x86_64.msi 17438720 RMD160 7ef9720567d11abe143e0d57de58ded0dffbf508 SHA1 2253e7ce3a699ddd110c6c9ce4c7ca7e6f7c02f5 SHA256 19d0364a43621738fa3fd1713ef9590ad0cc61ea4c8858ad3f8703a81b13c927 -DIST winepulse-2012.06.15.patch 100596 RMD160 33782944497666b150c77ec1c3dd00433a5b2933 SHA1 7720987932e42036a3d9764b5a571af961c750e5 SHA256 f6baf816e6170c406607d81e298fea2d175452ca822ee4cd2748fe4381ecd4dc -EBUILD wine-1.4.ebuild 6236 RMD160 aea6af88d59cfcb02d72c1194a85b26d59fd40a4 SHA1 c03b0d215b10f4d5f6230796a9becf2925693f49 SHA256 8e6ed9bdaa8ff6f89d72f0eccc580a689fbc8aae8692c481893a1a5aa307cea4 -EBUILD wine-1.5.11.ebuild 6991 RMD160 4dff7893609989ccf4dc7c07a87686b02df5804f SHA1 c824d1068216c0e1fa82d25b55e70ab4203f653d SHA256 caa455feecc2b39b7c1b6c42d9328aba052abbd21c9392a3767b7657e20627ad -MISC wine.diff 862 RMD160 6325375b9e12c041a41582801981ec65972e87dc SHA1 9d469367f3024a842140967ed0f6f3621d274772 SHA256 38266c6b96f7280f8aa81a10fbf3fc8a0e03722fbb75c7828f2f883c54b6f2c9 diff --git a/app-emulation/wine/files/pulseaudio.patch b/app-emulation/wine/files/pulseaudio.patch deleted file mode 100644 index bad69a9..0000000 --- a/app-emulation/wine/files/pulseaudio.patch +++ /dev/null @@ -1,3388 +0,0 @@ -From d10e1f620b180d2bf480cc21f5d58a1c915a1489 Mon Sep 17 00:00:00 2001 -From: Stefan Reimer -Date: Sun, 29 Apr 2012 14:10:12 -0700 -Subject: [PATCH] Pulseaudio V17 - ---- - configure | 97 +- - configure.ac | 31 +- - dlls/mmdevapi/main.c | 2 +- - dlls/winepulse.drv/Makefile.in | 9 + - dlls/winepulse.drv/mmdevdrv.c | 3101 +++++++++++++++++++++++++++++++++ - dlls/winepulse.drv/winepulse.drv.spec | 5 + - 6 files changed, 3240 insertions(+), 5 deletions(-) - create mode 100644 dlls/winepulse.drv/Makefile.in - create mode 100644 dlls/winepulse.drv/mmdevdrv.c - create mode 100644 dlls/winepulse.drv/winepulse.drv.spec - -diff --git a/configure b/configure -index 46827c1..a9f0b1e 100755 ---- a/configure -+++ b/configure -@@ -629,6 +629,8 @@ OSS4INCL - ALSALIBS - GSTREAMER_INCL - GSTREAMER_LIBS -+PULSEINCL -+PULSELIBS - LIBGETTEXTPO - ZLIB - FREETYPEINCL -@@ -805,6 +807,7 @@ with_openssl - with_oss - with_png - with_pthread -+with_pulse - with_sane - with_tiff - with_v4l -@@ -1495,6 +1498,7 @@ Optional Packages: - --without-oss do not use the OSS sound support - --without-png do not use PNG - --without-pthread do not use the pthread library -+ --without-pulse do not use PulseAudio sound support - --without-sane do not use SANE (scanner support) - --without-tiff do not use TIFF - --without-v4l do not use v4l1 (v4l support) -@@ -2679,6 +2683,12 @@ if test "${with_pthread+set}" = set; then : - fi - - -+# Check whether --with-pulse was given. -+if test "${with_pulse+set}" = set; then : -+ withval=$with_pulse; -+fi -+ -+ - # Check whether --with-sane was given. - if test "${with_sane+set}" = set; then : - withval=$with_sane; -@@ -10613,6 +10623,87 @@ esac - fi - fi - -+PULSELIBS="" -+ -+PULSEINCL="" -+ -+if test "x$with_pulse" != "xno"; -+then -+ ac_save_CPPFLAGS="$CPPFLAGS" -+ if test "$PKG_CONFIG" != "false"; -+ then -+ ac_pulse_libs="`$PKG_CONFIG --libs libpulse 2>/dev/null`" -+ ac_pulse_cflags="`$PKG_CONFIG --cflags-only-I libpulse 2>/dev/null`" -+ -+ CPPFLAGS="$CPPFLAGS $ac_pulse_cflags" -+ for ac_header in pulse/pulseaudio.h -+do : -+ ac_fn_c_check_header_mongrel "$LINENO" "pulse/pulseaudio.h" "ac_cv_header_pulse_pulseaudio_h" "$ac_includes_default" -+if test "x$ac_cv_header_pulse_pulseaudio_h" = xyes; then : -+ cat >>confdefs.h <<_ACEOF -+#define HAVE_PULSE_PULSEAUDIO_H 1 -+_ACEOF -+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pa_stream_is_corked in -lpulse" >&5 -+$as_echo_n "checking for pa_stream_is_corked in -lpulse... " >&6; } -+if ${ac_cv_lib_pulse_pa_stream_is_corked+:} false; then : -+ $as_echo_n "(cached) " >&6 -+else -+ ac_check_lib_save_LIBS=$LIBS -+LIBS="-lpulse $ac_pulse_libs $LIBS" -+cat confdefs.h - <<_ACEOF >conftest.$ac_ext -+/* end confdefs.h. */ -+ -+/* Override any GCC internal prototype to avoid an error. -+ Use char because int might match the return type of a GCC -+ builtin and then its argument prototype would still apply. */ -+#ifdef __cplusplus -+extern "C" -+#endif -+char pa_stream_is_corked (); -+int -+main () -+{ -+return pa_stream_is_corked (); -+ ; -+ return 0; -+} -+_ACEOF -+if ac_fn_c_try_link "$LINENO"; then : -+ ac_cv_lib_pulse_pa_stream_is_corked=yes -+else -+ ac_cv_lib_pulse_pa_stream_is_corked=no -+fi -+rm -f core conftest.err conftest.$ac_objext \ -+ conftest$ac_exeext conftest.$ac_ext -+LIBS=$ac_check_lib_save_LIBS -+fi -+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pulse_pa_stream_is_corked" >&5 -+$as_echo "$ac_cv_lib_pulse_pa_stream_is_corked" >&6; } -+if test "x$ac_cv_lib_pulse_pa_stream_is_corked" = xyes; then : -+ -+$as_echo "#define HAVE_PULSEAUDIO 1" >>confdefs.h -+ -+ PULSELIBS="$ac_pulse_libs" -+ PULSEINCL="$ac_pulse_cflags" -+fi -+ -+ -+fi -+ -+done -+ -+ fi -+ CPPFLAGS="$ac_save_CPPFLAGS" -+fi -+if test "$ac_cv_lib_pulse_pa_stream_is_corked" != "yes"; then : -+ case "x$with_pulse" in -+ x) as_fn_append wine_warnings "|libpulse ${notice_platform}development files not found or too old, Pulse won't be supported." ;; -+ xno) ;; -+ *) as_fn_error $? "libpulse ${notice_platform}development files not found or too old, Pulse won't be supported. -+This is an error since --with-pulse was requested." "$LINENO" 5 ;; -+esac -+fi -+ - if test "x$with_gstreamer" != "xno" - then - ac_save_CPPFLAGS="$CPPFLAGS" -@@ -11872,12 +11963,13 @@ fi - - test -n "$ALSALIBS" || enable_winealsa_drv=${enable_winealsa_drv:-no} - test -n "$COREAUDIO" || enable_winecoreaudio_drv=${enable_winecoreaudio_drv:-no} -+test -n "$PULSELIBS" || enable_winepulse_drv=${enable_winepulse_drv:-no} - test "x$ac_cv_member_oss_sysinfo_numaudioengines" = xyes || enable_wineoss_drv=${enable_wineoss_drv:-no} - test "$ac_cv_header_linux_joystick_h" = "yes" || enable_winejoystick_drv=${enable_winejoystick_drv:-no} - --if test "x$ALSALIBS$COREAUDIO" = "x" -a \ -+if test "x$ALSALIBS$COREAUDIO$PULSELIBS" = "x" -a \ - "x$ac_cv_member_oss_sysinfo_numaudioengines" != xyes -a \ -- "x$with_alsa$with_coreaudio$with_oss" != xnonono -+ "x$with_alsa$with_coreaudio$with_oss$with_pulse" != xnononono - then - as_fn_append wine_warnings "|No sound system was found. Windows applications will be silent." - fi -@@ -15402,6 +15494,7 @@ wine_fn_config_dll winemp3.acm enable_winemp3_acm - wine_fn_config_dll wineoss.drv enable_wineoss_drv - wine_fn_config_dll wineps.drv enable_wineps_drv install-lib,po - wine_fn_config_dll wineps16.drv16 enable_win16 -+wine_fn_config_dll winepulse.drv enable_winepulse_drv - wine_fn_config_dll wineqtdecoder enable_wineqtdecoder - wine_fn_config_dll winequartz.drv enable_winequartz_drv - wine_fn_config_dll winex11.drv enable_winex11_drv -diff --git a/configure.ac b/configure.ac -index efc03af..d9bd62b 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -74,6 +74,7 @@ AC_ARG_WITH(png, AS_HELP_STRING([--without-png],[do not use PNG]), - [if test "x$withval" = "xno"; then ac_cv_header_png_h=no; fi]) - AC_ARG_WITH(pthread, AS_HELP_STRING([--without-pthread],[do not use the pthread library]), - [if test "x$withval" = "xno"; then ac_cv_header_pthread_h=no; fi]) -+AC_ARG_WITH(pulse, AC_HELP_STRING([--without-pulse],[do not use PulseAudio sound support])) - AC_ARG_WITH(sane, AS_HELP_STRING([--without-sane],[do not use SANE (scanner support)])) - AC_ARG_WITH(tiff, AS_HELP_STRING([--without-tiff],[do not use TIFF]), - [if test "x$withval" = "xno"; then ac_cv_header_tiffio_h=no; fi]) -@@ -1474,6 +1475,30 @@ then - [GetText ${notice_platform}development files not found (or too old), po files can't be rebuilt.]) - fi - -+dnl **** Check for PulseAudio **** -+AC_SUBST(PULSELIBS,"") -+AC_SUBST(PULSEINCL,"") -+if test "x$with_pulse" != "xno"; -+then -+ ac_save_CPPFLAGS="$CPPFLAGS" -+ if test "$PKG_CONFIG" != "false"; -+ then -+ ac_pulse_libs="`$PKG_CONFIG --libs libpulse 2>/dev/null`" -+ ac_pulse_cflags="`$PKG_CONFIG --cflags-only-I libpulse 2>/dev/null`" -+ -+ CPPFLAGS="$CPPFLAGS $ac_pulse_cflags" -+ AC_CHECK_HEADERS(pulse/pulseaudio.h, -+ [AC_CHECK_LIB(pulse, pa_stream_is_corked, -+ [AC_DEFINE(HAVE_PULSEAUDIO, 1, [Define if you have pulseaudio]) -+ PULSELIBS="$ac_pulse_libs" -+ PULSEINCL="$ac_pulse_cflags"],,$ac_pulse_libs) -+ ]) -+ fi -+ CPPFLAGS="$ac_save_CPPFLAGS" -+fi -+WINE_WARNING_WITH(pulse, [test "$ac_cv_lib_pulse_pa_stream_is_corked" != "yes"], -+ [libpulse ${notice_platform}development files not found or too old, Pulse won't be supported.]) -+ - dnl **** Check for gstreamer **** - if test "x$with_gstreamer" != "xno" - then -@@ -1680,13 +1705,14 @@ WINE_CHECK_SONAME(odbc,SQLConnect,,[AC_DEFINE_UNQUOTED(SONAME_LIBODBC,["libodbc. - dnl **** Disable unsupported winmm drivers **** - test -n "$ALSALIBS" || enable_winealsa_drv=${enable_winealsa_drv:-no} - test -n "$COREAUDIO" || enable_winecoreaudio_drv=${enable_winecoreaudio_drv:-no} -+test -n "$PULSELIBS" || enable_winepulse_drv=${enable_winepulse_drv:-no} - test "x$ac_cv_member_oss_sysinfo_numaudioengines" = xyes || enable_wineoss_drv=${enable_wineoss_drv:-no} - test "$ac_cv_header_linux_joystick_h" = "yes" || enable_winejoystick_drv=${enable_winejoystick_drv:-no} - - dnl **** Check for any sound system **** --if test "x$ALSALIBS$COREAUDIO" = "x" -a \ -+if test "x$ALSALIBS$COREAUDIO$PULSELIBS" = "x" -a \ - "x$ac_cv_member_oss_sysinfo_numaudioengines" != xyes -a \ -- "x$with_alsa$with_coreaudio$with_oss" != xnonono -+ "x$with_alsa$with_coreaudio$with_oss$with_pulse" != xnononono - then - WINE_WARNING([No sound system was found. Windows applications will be silent.]) - fi -@@ -2908,6 +2934,7 @@ WINE_CONFIG_DLL(winemp3.acm) - WINE_CONFIG_DLL(wineoss.drv) - WINE_CONFIG_DLL(wineps.drv,,[install-lib,po]) - WINE_CONFIG_DLL(wineps16.drv16,enable_win16) -+WINE_CONFIG_DLL(winepulse.drv) - WINE_CONFIG_DLL(wineqtdecoder) - WINE_CONFIG_DLL(winequartz.drv) - WINE_CONFIG_DLL(winex11.drv) -diff --git a/dlls/mmdevapi/main.c b/dlls/mmdevapi/main.c -index c0e2ff6..5755ea8 100644 ---- a/dlls/mmdevapi/main.c -+++ b/dlls/mmdevapi/main.c -@@ -111,7 +111,7 @@ static BOOL init_driver(void) - { - static const WCHAR drv_value[] = {'A','u','d','i','o',0}; - -- static WCHAR default_list[] = {'a','l','s','a',',','o','s','s',',', -+ static WCHAR default_list[] = {'p','u','l','s','e',',','a','l','s','a',',','o','s','s',',', - 'c','o','r','e','a','u','d','i','o',0}; - - DriverFuncs driver; -diff --git a/dlls/winepulse.drv/Makefile.in b/dlls/winepulse.drv/Makefile.in -new file mode 100644 -index 0000000..0f595f1 ---- /dev/null -+++ b/dlls/winepulse.drv/Makefile.in -@@ -0,0 +1,9 @@ -+MODULE = winepulse.drv -+IMPORTS = dxguid uuid winmm user32 advapi32 ole32 -+EXTRALIBS = @PULSELIBS@ @LIBPTHREAD@ -+EXTRAINCL = @PULSEINCL@ -+ -+C_SRCS = \ -+ mmdevdrv.c -+ -+@MAKE_DLL_RULES@ -diff --git a/dlls/winepulse.drv/mmdevdrv.c b/dlls/winepulse.drv/mmdevdrv.c -new file mode 100644 -index 0000000..5cc460f ---- /dev/null -+++ b/dlls/winepulse.drv/mmdevdrv.c -@@ -0,0 +1,3101 @@ -+/* -+ * Copyright 2011-2012 Maarten Lankhorst -+ * Copyright 2010-2011 Maarten Lankhorst for CodeWeavers -+ * Copyright 2011 Andrew Eikum for CodeWeavers -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2.1 of the License, or (at your option) any later version. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA -+ * -+ * Pulseaudio driver support.. hell froze over -+ */ -+ -+#define NONAMELESSUNION -+#define COBJMACROS -+#include "config.h" -+#include -+#include -+ -+#include -+#include -+#include -+#include -+ -+#include -+ -+#include "windef.h" -+#include "winbase.h" -+#include "winnls.h" -+#include "winreg.h" -+#include "wine/debug.h" -+#include "wine/unicode.h" -+#include "wine/list.h" -+ -+#include "ole2.h" -+#include "dshow.h" -+#include "dsound.h" -+#include "propsys.h" -+ -+#include "initguid.h" -+#include "ks.h" -+#include "ksmedia.h" -+#include "mmdeviceapi.h" -+#include "audioclient.h" -+#include "endpointvolume.h" -+#include "audiopolicy.h" -+ -+#include "wine/list.h" -+ -+#define NULL_PTR_ERR MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, RPC_X_NULL_REF_POINTER) -+ -+WINE_DEFAULT_DEBUG_CHANNEL(pulse); -+WINE_DECLARE_DEBUG_CHANNEL(winediag); -+ -+static const REFERENCE_TIME MinimumPeriod = 30000; -+static const REFERENCE_TIME DefaultPeriod = 100000; -+ -+static pa_context *pulse_ctx; -+static pa_mainloop *pulse_ml; -+ -+static HANDLE pulse_thread; -+static pthread_mutex_t pulse_lock = PTHREAD_MUTEX_INITIALIZER; -+static pthread_cond_t pulse_cond = PTHREAD_COND_INITIALIZER; -+static struct list g_sessions = LIST_INIT(g_sessions); -+ -+/* Mixer format + period times */ -+static WAVEFORMATEXTENSIBLE pulse_fmt[2]; -+static REFERENCE_TIME pulse_min_period[2], pulse_def_period[2]; -+ -+static DWORD pulse_stream_volume; -+ -+const WCHAR pulse_keyW[] = {'S','o','f','t','w','a','r','e','\\', -+ 'W','i','n','e','\\','P','u','l','s','e',0}; -+const WCHAR pulse_streamW[] = { 'S','t','r','e','a','m','V','o','l',0 }; -+ -+static GUID pulse_render_guid = -+{ 0xfd47d9cc, 0x4218, 0x4135, { 0x9c, 0xe2, 0x0c, 0x19, 0x5c, 0x87, 0x40, 0x5b } }; -+static GUID pulse_capture_guid = -+{ 0x25da76d0, 0x033c, 0x4235, { 0x90, 0x02, 0x19, 0xf4, 0x88, 0x94, 0xac, 0x6f } }; -+ -+static HANDLE warn_once; -+ -+BOOL WINAPI DllMain(HINSTANCE dll, DWORD reason, void *reserved) -+{ -+ if (reason == DLL_PROCESS_ATTACH) { -+ HKEY key; -+ if (RegOpenKeyW(HKEY_CURRENT_USER, pulse_keyW, &key) == ERROR_SUCCESS) { -+ DWORD size = sizeof(pulse_stream_volume); -+ RegQueryValueExW(key, pulse_streamW, 0, NULL, -+ (BYTE*)&pulse_stream_volume, &size); -+ RegCloseKey(key); -+ } -+ DisableThreadLibraryCalls(dll); -+ } else if (reason == DLL_PROCESS_DETACH) { -+ if (pulse_ctx) { -+ pa_context_disconnect(pulse_ctx); -+ pa_context_unref(pulse_ctx); -+ } -+ if (pulse_ml) -+ pa_mainloop_quit(pulse_ml, 0); -+ if (pulse_thread) -+ CloseHandle(pulse_thread); -+ if (warn_once) -+ CloseHandle(warn_once); -+ } -+ return TRUE; -+} -+ -+typedef struct ACImpl ACImpl; -+ -+typedef struct _AudioSession { -+ GUID guid; -+ struct list clients; -+ -+ IMMDevice *device; -+ -+ float master_vol; -+ UINT32 channel_count; -+ float *channel_vols; -+ BOOL mute; -+ -+ struct list entry; -+} AudioSession; -+ -+typedef struct _AudioSessionWrapper { -+ IAudioSessionControl2 IAudioSessionControl2_iface; -+ IChannelAudioVolume IChannelAudioVolume_iface; -+ ISimpleAudioVolume ISimpleAudioVolume_iface; -+ -+ LONG ref; -+ -+ ACImpl *client; -+ AudioSession *session; -+} AudioSessionWrapper; -+ -+typedef struct _ACPacket { -+ struct list entry; -+ UINT64 qpcpos; -+ BYTE *data; -+ UINT32 discont; -+} ACPacket; -+ -+struct ACImpl { -+ IAudioClient IAudioClient_iface; -+ IAudioRenderClient IAudioRenderClient_iface; -+ IAudioCaptureClient IAudioCaptureClient_iface; -+ IAudioClock IAudioClock_iface; -+ IAudioClock2 IAudioClock2_iface; -+ IAudioStreamVolume IAudioStreamVolume_iface; -+ IMMDevice *parent; -+ struct list entry; -+ float vol[PA_CHANNELS_MAX]; -+ -+ LONG ref; -+ EDataFlow dataflow; -+ DWORD flags; -+ AUDCLNT_SHAREMODE share; -+ HANDLE event; -+ -+ UINT32 bufsize_frames, bufsize_bytes, locked, capture_period, pad, started, peek_ofs; -+ void *locked_ptr, *tmp_buffer; -+ -+ pa_stream *stream; -+ pa_sample_spec ss; -+ pa_channel_map map; -+ -+ INT64 clock_lastpos, clock_written; -+ pa_usec_t clock_pulse; -+ -+ AudioSession *session; -+ AudioSessionWrapper *session_wrapper; -+ struct list packet_free_head; -+ struct list packet_filled_head; -+}; -+ -+static const WCHAR defaultW[] = {'P','u','l','s','e','a','u','d','i','o',0}; -+ -+static const IAudioClientVtbl AudioClient_Vtbl; -+static const IAudioRenderClientVtbl AudioRenderClient_Vtbl; -+static const IAudioCaptureClientVtbl AudioCaptureClient_Vtbl; -+static const IAudioSessionControl2Vtbl AudioSessionControl2_Vtbl; -+static const ISimpleAudioVolumeVtbl SimpleAudioVolume_Vtbl; -+static const IChannelAudioVolumeVtbl ChannelAudioVolume_Vtbl; -+static const IAudioClockVtbl AudioClock_Vtbl; -+static const IAudioClock2Vtbl AudioClock2_Vtbl; -+static const IAudioStreamVolumeVtbl AudioStreamVolume_Vtbl; -+ -+static AudioSessionWrapper *AudioSessionWrapper_Create(ACImpl *client); -+ -+static inline ACImpl *impl_from_IAudioClient(IAudioClient *iface) -+{ -+ return CONTAINING_RECORD(iface, ACImpl, IAudioClient_iface); -+} -+ -+static inline ACImpl *impl_from_IAudioRenderClient(IAudioRenderClient *iface) -+{ -+ return CONTAINING_RECORD(iface, ACImpl, IAudioRenderClient_iface); -+} -+ -+static inline ACImpl *impl_from_IAudioCaptureClient(IAudioCaptureClient *iface) -+{ -+ return CONTAINING_RECORD(iface, ACImpl, IAudioCaptureClient_iface); -+} -+ -+static inline AudioSessionWrapper *impl_from_IAudioSessionControl2(IAudioSessionControl2 *iface) -+{ -+ return CONTAINING_RECORD(iface, AudioSessionWrapper, IAudioSessionControl2_iface); -+} -+ -+static inline AudioSessionWrapper *impl_from_ISimpleAudioVolume(ISimpleAudioVolume *iface) -+{ -+ return CONTAINING_RECORD(iface, AudioSessionWrapper, ISimpleAudioVolume_iface); -+} -+ -+static inline AudioSessionWrapper *impl_from_IChannelAudioVolume(IChannelAudioVolume *iface) -+{ -+ return CONTAINING_RECORD(iface, AudioSessionWrapper, IChannelAudioVolume_iface); -+} -+ -+static inline ACImpl *impl_from_IAudioClock(IAudioClock *iface) -+{ -+ return CONTAINING_RECORD(iface, ACImpl, IAudioClock_iface); -+} -+ -+static inline ACImpl *impl_from_IAudioClock2(IAudioClock2 *iface) -+{ -+ return CONTAINING_RECORD(iface, ACImpl, IAudioClock2_iface); -+} -+ -+static inline ACImpl *impl_from_IAudioStreamVolume(IAudioStreamVolume *iface) -+{ -+ return CONTAINING_RECORD(iface, ACImpl, IAudioStreamVolume_iface); -+} -+ -+/* Following pulseaudio design here, mainloop has the lock taken whenever -+ * it is handling something for pulse, and the lock is required whenever -+ * doing any pa_* call that can affect the state in any way -+ * -+ * pa_cond_wait is used when waiting on results, because the mainloop needs -+ * the same lock taken to affect the state -+ * -+ * This is basically the same as the pa_threaded_mainloop implementation, -+ * but that cannot be used because it uses pthread_create directly -+ * -+ * pa_threaded_mainloop_(un)lock -> pthread_mutex_(un)lock -+ * pa_threaded_mainloop_signal -> pthread_cond_signal -+ * pa_threaded_mainloop_wait -> pthread_cond_wait -+ */ -+ -+static int pulse_poll_func(struct pollfd *ufds, unsigned long nfds, int timeout, void *userdata) { -+ int r; -+ pthread_mutex_unlock(&pulse_lock); -+ r = poll(ufds, nfds, timeout); -+ pthread_mutex_lock(&pulse_lock); -+ return r; -+} -+ -+static DWORD CALLBACK pulse_mainloop_thread(void *tmp) { -+ int ret; -+ pulse_ml = pa_mainloop_new(); -+ pa_mainloop_set_poll_func(pulse_ml, pulse_poll_func, NULL); -+ pthread_mutex_lock(&pulse_lock); -+ pthread_cond_signal(&pulse_cond); -+ pa_mainloop_run(pulse_ml, &ret); -+ pthread_mutex_unlock(&pulse_lock); -+ pa_mainloop_free(pulse_ml); -+ CloseHandle(pulse_thread); -+ return ret; -+} -+ -+static void pulse_contextcallback(pa_context *c, void *userdata); -+static void pulse_stream_state(pa_stream *s, void *user); -+ -+static const enum pa_channel_position pulse_pos_from_wfx[] = { -+ PA_CHANNEL_POSITION_FRONT_LEFT, -+ PA_CHANNEL_POSITION_FRONT_RIGHT, -+ PA_CHANNEL_POSITION_FRONT_CENTER, -+ PA_CHANNEL_POSITION_LFE, -+ PA_CHANNEL_POSITION_REAR_LEFT, -+ PA_CHANNEL_POSITION_REAR_RIGHT, -+ PA_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER, -+ PA_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER, -+ PA_CHANNEL_POSITION_REAR_CENTER, -+ PA_CHANNEL_POSITION_SIDE_LEFT, -+ PA_CHANNEL_POSITION_SIDE_RIGHT, -+ PA_CHANNEL_POSITION_TOP_CENTER, -+ PA_CHANNEL_POSITION_TOP_FRONT_LEFT, -+ PA_CHANNEL_POSITION_TOP_FRONT_CENTER, -+ PA_CHANNEL_POSITION_TOP_FRONT_RIGHT, -+ PA_CHANNEL_POSITION_TOP_REAR_LEFT, -+ PA_CHANNEL_POSITION_TOP_REAR_CENTER, -+ PA_CHANNEL_POSITION_TOP_REAR_RIGHT -+}; -+ -+static void pulse_probe_settings(int render, WAVEFORMATEXTENSIBLE *fmt) { -+ WAVEFORMATEX *wfx = &fmt->Format; -+ pa_stream *stream; -+ pa_channel_map map; -+ pa_sample_spec ss; -+ pa_buffer_attr attr; -+ int ret, i; -+ unsigned int length = 0; -+ -+ pa_channel_map_init_auto(&map, 2, PA_CHANNEL_MAP_ALSA); -+ ss.rate = 48000; -+ ss.format = PA_SAMPLE_FLOAT32LE; -+ ss.channels = map.channels; -+ -+ attr.maxlength = -1; -+ attr.tlength = -1; -+ attr.minreq = attr.fragsize = pa_frame_size(&ss); -+ attr.prebuf = 0; -+ -+ stream = pa_stream_new(pulse_ctx, "format test stream", &ss, &map); -+ if (stream) -+ pa_stream_set_state_callback(stream, pulse_stream_state, NULL); -+ if (!stream) -+ ret = -1; -+ else if (render) -+ ret = pa_stream_connect_playback(stream, NULL, &attr, -+ PA_STREAM_START_CORKED|PA_STREAM_FIX_RATE|PA_STREAM_FIX_CHANNELS|PA_STREAM_EARLY_REQUESTS, NULL, NULL); -+ else -+ ret = pa_stream_connect_record(stream, NULL, &attr, PA_STREAM_START_CORKED|PA_STREAM_FIX_RATE|PA_STREAM_FIX_CHANNELS|PA_STREAM_EARLY_REQUESTS); -+ if (ret >= 0) { -+ while (pa_stream_get_state(stream) == PA_STREAM_CREATING) -+ pthread_cond_wait(&pulse_cond, &pulse_lock); -+ if (pa_stream_get_state(stream) == PA_STREAM_READY) { -+ ss = *pa_stream_get_sample_spec(stream); -+ map = *pa_stream_get_channel_map(stream); -+ if (render) -+ length = pa_stream_get_buffer_attr(stream)->minreq; -+ else -+ length = pa_stream_get_buffer_attr(stream)->fragsize; -+ pa_stream_disconnect(stream); -+ while (pa_stream_get_state(stream) == PA_STREAM_READY) -+ pthread_cond_wait(&pulse_cond, &pulse_lock); -+ } -+ } -+ if (stream) -+ pa_stream_unref(stream); -+ if (length) -+ pulse_def_period[!render] = pulse_min_period[!render] = pa_bytes_to_usec(10 * length, &ss); -+ else -+ pulse_min_period[!render] = MinimumPeriod; -+ if (pulse_def_period[!render] <= DefaultPeriod) -+ pulse_def_period[!render] = DefaultPeriod; -+ -+ wfx->wFormatTag = WAVE_FORMAT_EXTENSIBLE; -+ wfx->cbSize = sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX); -+ wfx->nChannels = ss.channels; -+ wfx->wBitsPerSample = 8 * pa_sample_size_of_format(ss.format); -+ wfx->nSamplesPerSec = ss.rate; -+ wfx->nBlockAlign = pa_frame_size(&ss); -+ wfx->nAvgBytesPerSec = wfx->nSamplesPerSec * wfx->nBlockAlign; -+ if (ss.format != PA_SAMPLE_S24_32LE) -+ fmt->Samples.wValidBitsPerSample = wfx->wBitsPerSample; -+ else -+ fmt->Samples.wValidBitsPerSample = 24; -+ if (ss.format == PA_SAMPLE_FLOAT32LE) -+ fmt->SubFormat = KSDATAFORMAT_SUBTYPE_IEEE_FLOAT; -+ else -+ fmt->SubFormat = KSDATAFORMAT_SUBTYPE_PCM; -+ -+ fmt->dwChannelMask = 0; -+ for (i = 0; i < map.channels; ++i) -+ switch (map.map[i]) { -+ default: FIXME("Unhandled channel %s\n", pa_channel_position_to_string(map.map[i])); break; -+ case PA_CHANNEL_POSITION_FRONT_LEFT: fmt->dwChannelMask |= SPEAKER_FRONT_LEFT; break; -+ case PA_CHANNEL_POSITION_MONO: -+ case PA_CHANNEL_POSITION_FRONT_CENTER: fmt->dwChannelMask |= SPEAKER_FRONT_CENTER; break; -+ case PA_CHANNEL_POSITION_FRONT_RIGHT: fmt->dwChannelMask |= SPEAKER_FRONT_RIGHT; break; -+ case PA_CHANNEL_POSITION_REAR_LEFT: fmt->dwChannelMask |= SPEAKER_BACK_LEFT; break; -+ case PA_CHANNEL_POSITION_REAR_CENTER: fmt->dwChannelMask |= SPEAKER_BACK_CENTER; break; -+ case PA_CHANNEL_POSITION_REAR_RIGHT: fmt->dwChannelMask |= SPEAKER_BACK_RIGHT; break; -+ case PA_CHANNEL_POSITION_LFE: fmt->dwChannelMask |= SPEAKER_LOW_FREQUENCY; break; -+ case PA_CHANNEL_POSITION_SIDE_LEFT: fmt->dwChannelMask |= SPEAKER_SIDE_LEFT; break; -+ case PA_CHANNEL_POSITION_SIDE_RIGHT: fmt->dwChannelMask |= SPEAKER_SIDE_RIGHT; break; -+ case PA_CHANNEL_POSITION_TOP_CENTER: fmt->dwChannelMask |= SPEAKER_TOP_CENTER; break; -+ case PA_CHANNEL_POSITION_TOP_FRONT_LEFT: fmt->dwChannelMask |= SPEAKER_TOP_FRONT_LEFT; break; -+ case PA_CHANNEL_POSITION_TOP_FRONT_CENTER: fmt->dwChannelMask |= SPEAKER_TOP_FRONT_CENTER; break; -+ case PA_CHANNEL_POSITION_TOP_FRONT_RIGHT: fmt->dwChannelMask |= SPEAKER_TOP_FRONT_RIGHT; break; -+ case PA_CHANNEL_POSITION_TOP_REAR_LEFT: fmt->dwChannelMask |= SPEAKER_TOP_BACK_LEFT; break; -+ case PA_CHANNEL_POSITION_TOP_REAR_CENTER: fmt->dwChannelMask |= SPEAKER_TOP_BACK_CENTER; break; -+ case PA_CHANNEL_POSITION_TOP_REAR_RIGHT: fmt->dwChannelMask |= SPEAKER_TOP_BACK_RIGHT; break; -+ } -+} -+ -+static HRESULT pulse_connect(void) -+{ -+ int len; -+ WCHAR path[PATH_MAX], *name; -+ char *str; -+ -+ if (!pulse_thread) -+ { -+ if (!(pulse_thread = CreateThread(NULL, 0, pulse_mainloop_thread, NULL, 0, NULL))) -+ { -+ ERR("Failed to create mainloop thread."); -+ return E_FAIL; -+ } -+ SetThreadPriority(pulse_thread, THREAD_PRIORITY_TIME_CRITICAL); -+ pthread_cond_wait(&pulse_cond, &pulse_lock); -+ } -+ -+ if (pulse_ctx && PA_CONTEXT_IS_GOOD(pa_context_get_state(pulse_ctx))) -+ return S_OK; -+ if (pulse_ctx) -+ pa_context_unref(pulse_ctx); -+ -+ GetModuleFileNameW(NULL, path, sizeof(path)/sizeof(*path)); -+ name = strrchrW(path, '\\'); -+ if (!name) -+ name = path; -+ else -+ name++; -+ len = WideCharToMultiByte(CP_UNIXCP, 0, name, -1, NULL, 0, NULL, NULL); -+ str = pa_xmalloc(len); -+ WideCharToMultiByte(CP_UNIXCP, 0, name, -1, str, len, NULL, NULL); -+ TRACE("Name: %s\n", str); -+ pulse_ctx = pa_context_new(pa_mainloop_get_api(pulse_ml), str); -+ pa_xfree(str); -+ if (!pulse_ctx) { -+ ERR("Failed to create context\n"); -+ return E_FAIL; -+ } -+ -+ pa_context_set_state_callback(pulse_ctx, pulse_contextcallback, NULL); -+ -+ TRACE("libpulse protocol version: %u. API Version %u\n", pa_context_get_protocol_version(pulse_ctx), PA_API_VERSION); -+ if (pa_context_connect(pulse_ctx, NULL, 0, NULL) < 0) -+ goto fail; -+ -+ /* Wait for connection */ -+ while (pthread_cond_wait(&pulse_cond, &pulse_lock)) { -+ pa_context_state_t state = pa_context_get_state(pulse_ctx); -+ -+ if (state == PA_CONTEXT_FAILED || state == PA_CONTEXT_TERMINATED) -+ goto fail; -+ -+ if (state == PA_CONTEXT_READY) -+ break; -+ } -+ -+ TRACE("Connected to server %s with protocol version: %i.\n", -+ pa_context_get_server(pulse_ctx), -+ pa_context_get_server_protocol_version(pulse_ctx)); -+ pulse_probe_settings(1, &pulse_fmt[0]); -+ pulse_probe_settings(0, &pulse_fmt[1]); -+ return S_OK; -+ -+fail: -+ pa_context_unref(pulse_ctx); -+ pulse_ctx = NULL; -+ return E_FAIL; -+} -+ -+static void pulse_contextcallback(pa_context *c, void *userdata) { -+ switch (pa_context_get_state(c)) { -+ default: -+ FIXME("Unhandled state: %i\n", pa_context_get_state(c)); -+ case PA_CONTEXT_CONNECTING: -+ case PA_CONTEXT_UNCONNECTED: -+ case PA_CONTEXT_AUTHORIZING: -+ case PA_CONTEXT_SETTING_NAME: -+ case PA_CONTEXT_TERMINATED: -+ TRACE("State change to %i\n", pa_context_get_state(c)); -+ return; -+ -+ case PA_CONTEXT_READY: -+ TRACE("Ready\n"); -+ break; -+ -+ case PA_CONTEXT_FAILED: -+ ERR("Context failed: %s\n", pa_strerror(pa_context_errno(c))); -+ break; -+ } -+ pthread_cond_signal(&pulse_cond); -+} -+ -+static HRESULT pulse_stream_valid(ACImpl *This) { -+ if (!This->stream) -+ return AUDCLNT_E_NOT_INITIALIZED; -+ if (!This->stream || pa_stream_get_state(This->stream) != PA_STREAM_READY) -+ return AUDCLNT_E_DEVICE_INVALIDATED; -+ return S_OK; -+} -+ -+static void dump_attr(const pa_buffer_attr *attr) { -+ TRACE("maxlength: %u\n", attr->maxlength); -+ TRACE("minreq: %u\n", attr->minreq); -+ TRACE("fragsize: %u\n", attr->fragsize); -+ TRACE("tlength: %u\n", attr->tlength); -+ TRACE("prebuf: %u\n", attr->prebuf); -+} -+ -+static void pulse_op_cb(pa_stream *s, int success, void *user) { -+ TRACE("Success: %i\n", success); -+ *(int*)user = success; -+ pthread_cond_signal(&pulse_cond); -+} -+ -+static void pulse_ctx_op_cb(pa_context *c, int success, void *user) { -+ TRACE("Success: %i\n", success); -+ *(int*)user = success; -+ pthread_cond_signal(&pulse_cond); -+} -+ -+static void pulse_attr_update(pa_stream *s, void *user) { -+ const pa_buffer_attr *attr = pa_stream_get_buffer_attr(s); -+ TRACE("New attributes or device moved:\n"); -+ dump_attr(attr); -+} -+ -+static void pulse_wr_callback(pa_stream *s, size_t bytes, void *userdata) -+{ -+ ACImpl *This = userdata; -+ pa_usec_t time; -+ UINT32 oldpad = This->pad; -+ -+ if (bytes < This->bufsize_bytes) -+ This->pad = This->bufsize_bytes - bytes; -+ else -+ This->pad = 0; -+ -+ assert(oldpad >= This->pad); -+ -+ if (0 && This->pad && pa_stream_get_time(This->stream, &time) >= 0) -+ This->clock_pulse = time; -+ else -+ This->clock_pulse = PA_USEC_INVALID; -+ -+ This->clock_written += oldpad - This->pad; -+ TRACE("New pad: %u (-%u)\n", This->pad / pa_frame_size(&This->ss), (oldpad - This->pad) / pa_frame_size(&This->ss)); -+ -+ if (This->event) -+ SetEvent(This->event); -+} -+ -+static void pulse_underflow_callback(pa_stream *s, void *userdata) -+{ -+ ACImpl *This = userdata; -+ This->clock_pulse = PA_USEC_INVALID; -+ WARN("Underflow\n"); -+} -+ -+/* Latency is periodically updated even when nothing is played, -+ * because of PA_STREAM_AUTO_TIMING_UPDATE so use it as timer -+ * -+ * Perfect for passing all tests :) -+ */ -+static void pulse_latency_callback(pa_stream *s, void *userdata) -+{ -+ ACImpl *This = userdata; -+ if (!This->pad && This->event) -+ SetEvent(This->event); -+} -+ -+static void pulse_started_callback(pa_stream *s, void *userdata) -+{ -+ ACImpl *This = userdata; -+ pa_usec_t time; -+ -+ TRACE("(Re)started playing\n"); -+ assert(This->clock_pulse == PA_USEC_INVALID); -+ if (0 && pa_stream_get_time(This->stream, &time) >= 0) -+ This->clock_pulse = time; -+ if (This->event) -+ SetEvent(This->event); -+} -+ -+static void pulse_rd_loop(ACImpl *This, size_t bytes) -+{ -+ while (bytes >= This->capture_period) { -+ ACPacket *p, *next; -+ LARGE_INTEGER stamp, freq; -+ BYTE *dst, *src; -+ UINT32 src_len, copy, rem = This->capture_period; -+ if (!(p = (ACPacket*)list_head(&This->packet_free_head))) { -+ p = (ACPacket*)list_head(&This->packet_filled_head); -+ if (!p->discont) { -+ next = (ACPacket*)p->entry.next; -+ next->discont = 1; -+ } else -+ p = (ACPacket*)list_tail(&This->packet_filled_head); -+ assert(This->pad == This->bufsize_bytes); -+ } else { -+ assert(This->pad < This->bufsize_bytes); -+ This->pad += This->capture_period; -+ assert(This->pad <= This->bufsize_bytes); -+ } -+ QueryPerformanceCounter(&stamp); -+ QueryPerformanceFrequency(&freq); -+ p->qpcpos = (stamp.QuadPart * (INT64)10000000) / freq.QuadPart; -+ p->discont = 0; -+ list_remove(&p->entry); -+ list_add_tail(&This->packet_filled_head, &p->entry); -+ -+ dst = p->data; -+ while (rem) { -+ pa_stream_peek(This->stream, (const void**)&src, &src_len); -+ assert(src_len); -+ assert(This->peek_ofs < src_len); -+ src += This->peek_ofs; -+ src_len -= This->peek_ofs; -+ assert(src_len <= bytes); -+ -+ copy = rem; -+ if (copy > src_len) -+ copy = src_len; -+ memcpy(dst, src, rem); -+ src += copy; -+ src_len -= copy; -+ dst += copy; -+ rem -= copy; -+ -+ if (!src_len) { -+ This->peek_ofs = 0; -+ pa_stream_drop(This->stream); -+ } else -+ This->peek_ofs += copy; -+ } -+ bytes -= This->capture_period; -+ } -+} -+ -+static void pulse_rd_drop(ACImpl *This, size_t bytes) -+{ -+ while (bytes >= This->capture_period) { -+ UINT32 src_len, copy, rem = This->capture_period; -+ while (rem) { -+ const void *src; -+ pa_stream_peek(This->stream, &src, &src_len); -+ assert(src_len); -+ assert(This->peek_ofs < src_len); -+ src_len -= This->peek_ofs; -+ assert(src_len <= bytes); -+ -+ copy = rem; -+ if (copy > src_len) -+ copy = src_len; -+ -+ src_len -= copy; -+ rem -= copy; -+ -+ if (!src_len) { -+ This->peek_ofs = 0; -+ pa_stream_drop(This->stream); -+ } else -+ This->peek_ofs += copy; -+ bytes -= copy; -+ } -+ } -+} -+ -+static void pulse_rd_callback(pa_stream *s, size_t bytes, void *userdata) -+{ -+ ACImpl *This = userdata; -+ -+ TRACE("Readable total: %u, fragsize: %u\n", bytes, pa_stream_get_buffer_attr(s)->fragsize); -+ assert(bytes >= This->peek_ofs); -+ bytes -= This->peek_ofs; -+ if (bytes < This->capture_period) -+ return; -+ -+ if (This->started) -+ pulse_rd_loop(This, bytes); -+ else -+ pulse_rd_drop(This, bytes); -+ -+ if (This->event) -+ SetEvent(This->event); -+} -+ -+static void pulse_stream_state(pa_stream *s, void *user) -+{ -+ pa_stream_state_t state = pa_stream_get_state(s); -+ TRACE("Stream state changed to %i\n", state); -+ pthread_cond_signal(&pulse_cond); -+} -+ -+static HRESULT pulse_stream_connect(ACImpl *This, UINT32 period_bytes) { -+ int ret; -+ char buffer[64]; -+ static LONG number; -+ pa_buffer_attr attr; -+ if (This->stream) { -+ pa_stream_disconnect(This->stream); -+ while (pa_stream_get_state(This->stream) == PA_STREAM_READY) -+ pthread_cond_wait(&pulse_cond, &pulse_lock); -+ pa_stream_unref(This->stream); -+ } -+ ret = InterlockedIncrement(&number); -+ sprintf(buffer, "audio stream #%i", ret); -+ This->stream = pa_stream_new(pulse_ctx, buffer, &This->ss, &This->map); -+ pa_stream_set_state_callback(This->stream, pulse_stream_state, This); -+ pa_stream_set_buffer_attr_callback(This->stream, pulse_attr_update, This); -+ pa_stream_set_moved_callback(This->stream, pulse_attr_update, This); -+ -+ /* Pulseaudio will fill in correct values */ -+ attr.minreq = attr.fragsize = period_bytes; -+ attr.maxlength = attr.tlength = This->bufsize_bytes; -+ attr.prebuf = pa_frame_size(&This->ss); -+ dump_attr(&attr); -+ if (This->dataflow == eRender) -+ ret = pa_stream_connect_playback(This->stream, NULL, &attr, -+ PA_STREAM_START_CORKED|PA_STREAM_START_UNMUTED|PA_STREAM_AUTO_TIMING_UPDATE|PA_STREAM_INTERPOLATE_TIMING|PA_STREAM_EARLY_REQUESTS, NULL, NULL); -+ else -+ ret = pa_stream_connect_record(This->stream, NULL, &attr, -+ PA_STREAM_START_CORKED|PA_STREAM_START_UNMUTED|PA_STREAM_AUTO_TIMING_UPDATE|PA_STREAM_INTERPOLATE_TIMING|PA_STREAM_EARLY_REQUESTS); -+ if (ret < 0) { -+ WARN("Returns %i\n", ret); -+ return AUDCLNT_E_ENDPOINT_CREATE_FAILED; -+ } -+ while (pa_stream_get_state(This->stream) == PA_STREAM_CREATING) -+ pthread_cond_wait(&pulse_cond, &pulse_lock); -+ if (pa_stream_get_state(This->stream) != PA_STREAM_READY) -+ return AUDCLNT_E_ENDPOINT_CREATE_FAILED; -+ -+ if (This->dataflow == eRender) { -+ pa_stream_set_write_callback(This->stream, pulse_wr_callback, This); -+ pa_stream_set_underflow_callback(This->stream, pulse_underflow_callback, This); -+ pa_stream_set_started_callback(This->stream, pulse_started_callback, This); -+ } else -+ pa_stream_set_read_callback(This->stream, pulse_rd_callback, This); -+ return S_OK; -+} -+ -+HRESULT WINAPI AUDDRV_GetEndpointIDs(EDataFlow flow, const WCHAR ***ids, GUID **keys, -+ UINT *num, UINT *def_index) -+{ -+ HRESULT hr = S_OK; -+ TRACE("%d %p %p %p\n", flow, ids, num, def_index); -+ -+ pthread_mutex_lock(&pulse_lock); -+ hr = pulse_connect(); -+ pthread_mutex_unlock(&pulse_lock); -+ if (FAILED(hr)) -+ return hr; -+ *num = 1; -+ *def_index = 0; -+ -+ *ids = HeapAlloc(GetProcessHeap(), 0, sizeof(**ids)); -+ if (!*ids) -+ return E_OUTOFMEMORY; -+ (*ids)[0] = defaultW; -+ -+ *keys = HeapAlloc(GetProcessHeap(), 0, sizeof(**keys)); -+ if (!*keys) { -+ HeapFree(GetProcessHeap(), 0, *ids); -+ *ids = NULL; -+ return E_OUTOFMEMORY; -+ } -+ if (flow == eRender) -+ (*keys)[0] = pulse_render_guid; -+ else -+ (*keys)[0] = pulse_capture_guid; -+ -+ return S_OK; -+} -+ -+int WINAPI AUDDRV_GetPriority(void) -+{ -+ HRESULT hr; -+ if (getenv("WINENOPULSE")) { -+ FIXME_(winediag)("winepulse has been temporarily disabled through the environment\n"); -+ return 0; -+ } -+ pthread_mutex_lock(&pulse_lock); -+ hr = pulse_connect(); -+ pthread_mutex_unlock(&pulse_lock); -+ return SUCCEEDED(hr) ? 3 : 0; -+} -+ -+HRESULT WINAPI AUDDRV_GetAudioEndpoint(GUID *guid, IMMDevice *dev, IAudioClient **out) -+{ -+ HRESULT hr; -+ ACImpl *This; -+ int i; -+ EDataFlow dataflow; -+ -+ /* Give one visible warning per session -+ * Sadly wine has chosen not to accept the winepulse patch, so support ourselves -+ */ -+ if (!warn_once && (warn_once = CreateEventA(0, 0, 0, "__winepulse_warn_event")) && GetLastError() != ERROR_ALREADY_EXISTS) { -+ FIXME_(winediag)("Winepulse is not officially supported by the wine project\n"); -+ FIXME_(winediag)("For sound related feedback and support, please visit http://ubuntuforums.org/showthread.php?t=1960599\n"); -+ } else { -+ WARN_(winediag)("Winepulse is not officially supported by the wine project\n"); -+ WARN_(winediag)("For sound related feedback and support, please visit http://ubuntuforums.org/showthread.php?t=1960599\n"); -+ } -+ -+ TRACE("%s %p %p\n", debugstr_guid(guid), dev, out); -+ if (IsEqualGUID(guid, &pulse_render_guid)) -+ dataflow = eRender; -+ else if (IsEqualGUID(guid, &pulse_capture_guid)) -+ dataflow = eCapture; -+ else -+ return E_UNEXPECTED; -+ -+ *out = NULL; -+ pthread_mutex_lock(&pulse_lock); -+ hr = pulse_connect(); -+ pthread_mutex_unlock(&pulse_lock); -+ if (FAILED(hr)) -+ return hr; -+ -+ This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*This)); -+ if (!This) -+ return E_OUTOFMEMORY; -+ -+ This->IAudioClient_iface.lpVtbl = &AudioClient_Vtbl; -+ This->IAudioRenderClient_iface.lpVtbl = &AudioRenderClient_Vtbl; -+ This->IAudioCaptureClient_iface.lpVtbl = &AudioCaptureClient_Vtbl; -+ This->IAudioClock_iface.lpVtbl = &AudioClock_Vtbl; -+ This->IAudioClock2_iface.lpVtbl = &AudioClock2_Vtbl; -+ This->IAudioStreamVolume_iface.lpVtbl = &AudioStreamVolume_Vtbl; -+ This->dataflow = dataflow; -+ This->parent = dev; -+ This->clock_pulse = PA_USEC_INVALID; -+ for (i = 0; i < PA_CHANNELS_MAX; ++i) -+ This->vol[i] = 1.f; -+ IMMDevice_AddRef(This->parent); -+ -+ *out = &This->IAudioClient_iface; -+ IAudioClient_AddRef(&This->IAudioClient_iface); -+ -+ return S_OK; -+} -+ -+static HRESULT WINAPI AudioClient_QueryInterface(IAudioClient *iface, -+ REFIID riid, void **ppv) -+{ -+ TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), ppv); -+ -+ if (!ppv) -+ return E_POINTER; -+ *ppv = NULL; -+ if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IAudioClient)) -+ *ppv = iface; -+ if (*ppv) { -+ IUnknown_AddRef((IUnknown*)*ppv); -+ return S_OK; -+ } -+ WARN("Unknown interface %s\n", debugstr_guid(riid)); -+ return E_NOINTERFACE; -+} -+ -+static ULONG WINAPI AudioClient_AddRef(IAudioClient *iface) -+{ -+ ACImpl *This = impl_from_IAudioClient(iface); -+ ULONG ref; -+ ref = InterlockedIncrement(&This->ref); -+ TRACE("(%p) Refcount now %u\n", This, ref); -+ return ref; -+} -+ -+static ULONG WINAPI AudioClient_Release(IAudioClient *iface) -+{ -+ ACImpl *This = impl_from_IAudioClient(iface); -+ ULONG ref; -+ ref = InterlockedDecrement(&This->ref); -+ TRACE("(%p) Refcount now %u\n", This, ref); -+ if (!ref) { -+ if (This->stream) { -+ pthread_mutex_lock(&pulse_lock); -+ if (PA_STREAM_IS_GOOD(pa_stream_get_state(This->stream))) { -+ pa_stream_disconnect(This->stream); -+ while (PA_STREAM_IS_GOOD(pa_stream_get_state(This->stream))) -+ pthread_cond_wait(&pulse_cond, &pulse_lock); -+ } -+ pa_stream_unref(This->stream); -+ This->stream = NULL; -+ list_remove(&This->entry); -+ pthread_mutex_unlock(&pulse_lock); -+ } -+ IMMDevice_Release(This->parent); -+ HeapFree(GetProcessHeap(), 0, This->tmp_buffer); -+ HeapFree(GetProcessHeap(), 0, This); -+ } -+ return ref; -+} -+ -+static void dump_fmt(const WAVEFORMATEX *fmt) -+{ -+ TRACE("wFormatTag: 0x%x (", fmt->wFormatTag); -+ switch(fmt->wFormatTag) { -+ case WAVE_FORMAT_PCM: -+ TRACE("WAVE_FORMAT_PCM"); -+ break; -+ case WAVE_FORMAT_IEEE_FLOAT: -+ TRACE("WAVE_FORMAT_IEEE_FLOAT"); -+ break; -+ case WAVE_FORMAT_EXTENSIBLE: -+ TRACE("WAVE_FORMAT_EXTENSIBLE"); -+ break; -+ default: -+ TRACE("Unknown"); -+ break; -+ } -+ TRACE(")\n"); -+ -+ TRACE("nChannels: %u\n", fmt->nChannels); -+ TRACE("nSamplesPerSec: %u\n", fmt->nSamplesPerSec); -+ TRACE("nAvgBytesPerSec: %u\n", fmt->nAvgBytesPerSec); -+ TRACE("nBlockAlign: %u\n", fmt->nBlockAlign); -+ TRACE("wBitsPerSample: %u\n", fmt->wBitsPerSample); -+ TRACE("cbSize: %u\n", fmt->cbSize); -+ -+ if (fmt->wFormatTag == WAVE_FORMAT_EXTENSIBLE) { -+ WAVEFORMATEXTENSIBLE *fmtex = (void*)fmt; -+ TRACE("dwChannelMask: %08x\n", fmtex->dwChannelMask); -+ TRACE("Samples: %04x\n", fmtex->Samples.wReserved); -+ TRACE("SubFormat: %s\n", wine_dbgstr_guid(&fmtex->SubFormat)); -+ } -+} -+ -+static WAVEFORMATEX *clone_format(const WAVEFORMATEX *fmt) -+{ -+ WAVEFORMATEX *ret; -+ size_t size; -+ -+ if (fmt->wFormatTag == WAVE_FORMAT_EXTENSIBLE) -+ size = sizeof(WAVEFORMATEXTENSIBLE); -+ else -+ size = sizeof(WAVEFORMATEX); -+ -+ ret = CoTaskMemAlloc(size); -+ if (!ret) -+ return NULL; -+ -+ memcpy(ret, fmt, size); -+ -+ ret->cbSize = size - sizeof(WAVEFORMATEX); -+ -+ return ret; -+} -+ -+static DWORD get_channel_mask(unsigned int channels) -+{ -+ switch(channels) { -+ case 0: -+ return 0; -+ case 1: -+ return SPEAKER_FRONT_CENTER; -+ case 2: -+ return SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT; -+ case 3: -+ return SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | -+ SPEAKER_LOW_FREQUENCY; -+ case 4: -+ return SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_BACK_LEFT | -+ SPEAKER_BACK_RIGHT; -+ case 5: -+ return SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_BACK_LEFT | -+ SPEAKER_BACK_RIGHT | SPEAKER_LOW_FREQUENCY; -+ case 6: -+ return SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_BACK_LEFT | -+ SPEAKER_BACK_RIGHT | SPEAKER_LOW_FREQUENCY | SPEAKER_FRONT_CENTER; -+ case 7: -+ return SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_BACK_LEFT | -+ SPEAKER_BACK_RIGHT | SPEAKER_LOW_FREQUENCY | SPEAKER_FRONT_CENTER | -+ SPEAKER_BACK_CENTER; -+ case 8: -+ return SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_BACK_LEFT | -+ SPEAKER_BACK_RIGHT | SPEAKER_LOW_FREQUENCY | SPEAKER_FRONT_CENTER | -+ SPEAKER_SIDE_LEFT | SPEAKER_SIDE_RIGHT; -+ } -+ FIXME("Unknown speaker configuration: %u\n", channels); -+ return 0; -+} -+ -+static void session_init_vols(AudioSession *session, UINT channels) -+{ -+ if (session->channel_count < channels) { -+ UINT i; -+ -+ if (session->channel_vols) -+ session->channel_vols = HeapReAlloc(GetProcessHeap(), 0, -+ session->channel_vols, sizeof(float) * channels); -+ else -+ session->channel_vols = HeapAlloc(GetProcessHeap(), 0, -+ sizeof(float) * channels); -+ if (!session->channel_vols) -+ return; -+ -+ for(i = session->channel_count; i < channels; ++i) -+ session->channel_vols[i] = 1.f; -+ -+ session->channel_count = channels; -+ } -+} -+ -+static AudioSession *create_session(const GUID *guid, IMMDevice *device, -+ UINT num_channels) -+{ -+ AudioSession *ret; -+ -+ ret = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(AudioSession)); -+ if (!ret) -+ return NULL; -+ -+ memcpy(&ret->guid, guid, sizeof(GUID)); -+ -+ ret->device = device; -+ -+ list_init(&ret->clients); -+ -+ list_add_head(&g_sessions, &ret->entry); -+ -+ session_init_vols(ret, num_channels); -+ -+ ret->master_vol = 1.f; -+ -+ return ret; -+} -+ -+/* if channels == 0, then this will return or create a session with -+ * matching dataflow and GUID. otherwise, channels must also match */ -+static HRESULT get_audio_session(const GUID *sessionguid, -+ IMMDevice *device, UINT channels, AudioSession **out) -+{ -+ AudioSession *session; -+ -+ if (!sessionguid || IsEqualGUID(sessionguid, &GUID_NULL)) { -+ *out = create_session(&GUID_NULL, device, channels); -+ if (!*out) -+ return E_OUTOFMEMORY; -+ -+ return S_OK; -+ } -+ -+ *out = NULL; -+ LIST_FOR_EACH_ENTRY(session, &g_sessions, AudioSession, entry) { -+ if (session->device == device && -+ IsEqualGUID(sessionguid, &session->guid)) { -+ session_init_vols(session, channels); -+ *out = session; -+ break; -+ } -+ } -+ -+ if (!*out) { -+ *out = create_session(sessionguid, device, channels); -+ if (!*out) -+ return E_OUTOFMEMORY; -+ } -+ -+ return S_OK; -+} -+ -+static HRESULT pulse_spec_from_waveformat(ACImpl *This, const WAVEFORMATEX *fmt) -+{ -+ pa_channel_map_init(&This->map); -+ This->ss.rate = fmt->nSamplesPerSec; -+ This->ss.format = PA_SAMPLE_INVALID; -+ switch(fmt->wFormatTag) { -+ case WAVE_FORMAT_IEEE_FLOAT: -+ if (!fmt->nChannels || fmt->nChannels > 2 || fmt->wBitsPerSample != 32) -+ break; -+ This->ss.format = PA_SAMPLE_FLOAT32LE; -+ pa_channel_map_init_auto(&This->map, fmt->nChannels, PA_CHANNEL_MAP_ALSA); -+ break; -+ case WAVE_FORMAT_PCM: -+ if (!fmt->nChannels || fmt->nChannels > 2) -+ break; -+ if (fmt->wBitsPerSample == 8) -+ This->ss.format = PA_SAMPLE_U8; -+ else if (fmt->wBitsPerSample == 16) -+ This->ss.format = PA_SAMPLE_S16LE; -+ else -+ return AUDCLNT_E_UNSUPPORTED_FORMAT; -+ pa_channel_map_init_auto(&This->map, fmt->nChannels, PA_CHANNEL_MAP_ALSA); -+ break; -+ case WAVE_FORMAT_EXTENSIBLE: { -+ WAVEFORMATEXTENSIBLE *wfe = (WAVEFORMATEXTENSIBLE*)fmt; -+ DWORD mask = wfe->dwChannelMask; -+ DWORD i = 0, j; -+ if (fmt->cbSize != (sizeof(*wfe) - sizeof(*fmt)) && fmt->cbSize != sizeof(*wfe)) -+ break; -+ if (IsEqualGUID(&wfe->SubFormat, &KSDATAFORMAT_SUBTYPE_IEEE_FLOAT) && -+ (!wfe->Samples.wValidBitsPerSample || wfe->Samples.wValidBitsPerSample == 32) && -+ fmt->wBitsPerSample == 32) -+ This->ss.format = PA_SAMPLE_FLOAT32LE; -+ else if (IsEqualGUID(&wfe->SubFormat, &KSDATAFORMAT_SUBTYPE_PCM)) { -+ DWORD valid = wfe->Samples.wValidBitsPerSample; -+ if (!valid) -+ valid = fmt->wBitsPerSample; -+ if (!valid || valid > fmt->wBitsPerSample) -+ break; -+ switch (fmt->wBitsPerSample) { -+ case 8: -+ if (valid == 8) -+ This->ss.format = PA_SAMPLE_U8; -+ break; -+ case 16: -+ if (valid == 16) -+ This->ss.format = PA_SAMPLE_S16LE; -+ break; -+ case 24: -+ if (valid == 24) -+ This->ss.format = PA_SAMPLE_S24LE; -+ break; -+ case 32: -+ if (valid == 24) -+ This->ss.format = PA_SAMPLE_S24_32LE; -+ else if (valid == 32) -+ This->ss.format = PA_SAMPLE_S32LE; -+ break; -+ default: -+ return AUDCLNT_E_UNSUPPORTED_FORMAT; -+ } -+ } -+ This->map.channels = fmt->nChannels; -+ if (!mask || mask == SPEAKER_ALL) -+ mask = get_channel_mask(fmt->nChannels); -+ else if (mask == ~0U && fmt->nChannels == 1) -+ mask = SPEAKER_FRONT_CENTER; -+ for (j = 0; j < sizeof(pulse_pos_from_wfx)/sizeof(*pulse_pos_from_wfx) && i < fmt->nChannels; ++j) { -+ if (mask & (1 << j)) -+ This->map.map[i++] = pulse_pos_from_wfx[j]; -+ } -+ -+ /* Special case for mono since pulse appears to map it differently */ -+ if (mask == SPEAKER_FRONT_CENTER) -+ This->map.map[0] = PA_CHANNEL_POSITION_MONO; -+ -+ if (i < fmt->nChannels || (mask & SPEAKER_RESERVED)) { -+ This->map.channels = 0; -+ ERR("Invalid channel mask: %i/%i and %x(%x)\n", i, fmt->nChannels, mask, wfe->dwChannelMask); -+ break; -+ } -+ break; -+ } -+ case WAVE_FORMAT_ALAW: -+ case WAVE_FORMAT_MULAW: -+ if (fmt->wBitsPerSample != 8) { -+ FIXME("Unsupported bpp %u for LAW\n", fmt->wBitsPerSample); -+ return AUDCLNT_E_UNSUPPORTED_FORMAT; -+ } -+ if (fmt->nChannels != 1 && fmt->nChannels != 2) { -+ FIXME("Unsupported channels %u for LAW\n", fmt->nChannels); -+ return AUDCLNT_E_UNSUPPORTED_FORMAT; -+ } -+ This->ss.format = fmt->wFormatTag == WAVE_FORMAT_MULAW ? PA_SAMPLE_ULAW : PA_SAMPLE_ALAW; -+ pa_channel_map_init_auto(&This->map, fmt->nChannels, PA_CHANNEL_MAP_ALSA); -+ break; -+ default: -+ WARN("Unhandled tag %x\n", fmt->wFormatTag); -+ return AUDCLNT_E_UNSUPPORTED_FORMAT; -+ } -+ This->ss.channels = This->map.channels; -+ if (!pa_channel_map_valid(&This->map) || This->ss.format == PA_SAMPLE_INVALID) { -+ ERR("Invalid format! Channel spec valid: %i, format: %i\n", pa_channel_map_valid(&This->map), This->ss.format); -+ dump_fmt(fmt); -+ return AUDCLNT_E_UNSUPPORTED_FORMAT; -+ } -+ return S_OK; -+} -+ -+static HRESULT WINAPI AudioClient_Initialize(IAudioClient *iface, -+ AUDCLNT_SHAREMODE mode, DWORD flags, REFERENCE_TIME duration, -+ REFERENCE_TIME period, const WAVEFORMATEX *fmt, -+ const GUID *sessionguid) -+{ -+ ACImpl *This = impl_from_IAudioClient(iface); -+ HRESULT hr = S_OK; -+ UINT period_bytes; -+ -+ TRACE("(%p)->(%x, %x, %s, %s, %p, %s)\n", This, mode, flags, -+ wine_dbgstr_longlong(duration), wine_dbgstr_longlong(period), fmt, debugstr_guid(sessionguid)); -+ -+ if (!fmt) -+ return E_POINTER; -+ -+ if (mode != AUDCLNT_SHAREMODE_SHARED && mode != AUDCLNT_SHAREMODE_EXCLUSIVE) -+ return AUDCLNT_E_NOT_INITIALIZED; -+ if (mode == AUDCLNT_SHAREMODE_EXCLUSIVE) -+ return AUDCLNT_E_EXCLUSIVE_MODE_NOT_ALLOWED; -+ -+ if (flags & ~(AUDCLNT_STREAMFLAGS_CROSSPROCESS | -+ AUDCLNT_STREAMFLAGS_LOOPBACK | -+ AUDCLNT_STREAMFLAGS_EVENTCALLBACK | -+ AUDCLNT_STREAMFLAGS_NOPERSIST | -+ AUDCLNT_STREAMFLAGS_RATEADJUST | -+ AUDCLNT_SESSIONFLAGS_EXPIREWHENUNOWNED | -+ AUDCLNT_SESSIONFLAGS_DISPLAY_HIDE | -+ AUDCLNT_SESSIONFLAGS_DISPLAY_HIDEWHENEXPIRED)) { -+ TRACE("Unknown flags: %08x\n", flags); -+ return E_INVALIDARG; -+ } -+ -+ pthread_mutex_lock(&pulse_lock); -+ if (This->stream) { -+ pthread_mutex_unlock(&pulse_lock); -+ return AUDCLNT_E_ALREADY_INITIALIZED; -+ } -+ -+ hr = pulse_spec_from_waveformat(This, fmt); -+ if (FAILED(hr)) -+ goto exit; -+ -+ if (mode == AUDCLNT_SHAREMODE_SHARED) { -+ period = pulse_def_period[This->dataflow == eCapture]; -+ if (duration < 2 * period) -+ duration = 2 * period; -+ } -+ period_bytes = pa_frame_size(&This->ss) * MulDiv(period, This->ss.rate, 10000000); -+ -+ if (duration < 20000000) -+ This->bufsize_frames = ceil((duration / 10000000.) * fmt->nSamplesPerSec); -+ else -+ This->bufsize_frames = 2 * fmt->nSamplesPerSec; -+ This->bufsize_bytes = This->bufsize_frames * pa_frame_size(&This->ss); -+ -+ This->share = mode; -+ This->flags = flags; -+ hr = pulse_stream_connect(This, period_bytes); -+ if (SUCCEEDED(hr)) { -+ UINT32 unalign; -+ const pa_buffer_attr *attr = pa_stream_get_buffer_attr(This->stream); -+ /* Update frames according to new size */ -+ dump_attr(attr); -+ if (This->dataflow == eRender) -+ This->bufsize_bytes = attr->tlength; -+ else { -+ This->capture_period = period_bytes = attr->fragsize; -+ if ((unalign = This->bufsize_bytes % period_bytes)) -+ This->bufsize_bytes += period_bytes - unalign; -+ } -+ This->bufsize_frames = This->bufsize_bytes / pa_frame_size(&This->ss); -+ } -+ if (SUCCEEDED(hr)) { -+ UINT32 i, capture_packets = This->capture_period ? This->bufsize_bytes / This->capture_period : 0; -+ This->tmp_buffer = HeapAlloc(GetProcessHeap(), 0, This->bufsize_bytes + capture_packets * sizeof(ACPacket)); -+ if (!This->tmp_buffer) -+ hr = E_OUTOFMEMORY; -+ else { -+ ACPacket *cur_packet = (ACPacket*)((char*)This->tmp_buffer + This->bufsize_bytes); -+ BYTE *data = This->tmp_buffer; -+ memset(This->tmp_buffer, This->ss.format == PA_SAMPLE_U8 ? 0x80 : 0, This->bufsize_bytes); -+ list_init(&This->packet_free_head); -+ list_init(&This->packet_filled_head); -+ for (i = 0; i < capture_packets; ++i, ++cur_packet) { -+ list_add_tail(&This->packet_free_head, &cur_packet->entry); -+ cur_packet->data = data; -+ data += This->capture_period; -+ } -+ assert(!This->capture_period || This->bufsize_bytes == This->capture_period * capture_packets); -+ assert(!capture_packets || data - This->bufsize_bytes == This->tmp_buffer); -+ } -+ } -+ if (SUCCEEDED(hr)) -+ hr = get_audio_session(sessionguid, This->parent, fmt->nChannels, &This->session); -+ if (SUCCEEDED(hr)) -+ list_add_tail(&This->session->clients, &This->entry); -+ -+exit: -+ if (FAILED(hr)) { -+ HeapFree(GetProcessHeap(), 0, This->tmp_buffer); -+ This->tmp_buffer = NULL; -+ if (This->stream) { -+ pa_stream_disconnect(This->stream); -+ pa_stream_unref(This->stream); -+ This->stream = NULL; -+ } -+ } -+ pthread_mutex_unlock(&pulse_lock); -+ return hr; -+} -+ -+static HRESULT WINAPI AudioClient_GetBufferSize(IAudioClient *iface, -+ UINT32 *out) -+{ -+ ACImpl *This = impl_from_IAudioClient(iface); -+ HRESULT hr; -+ -+ TRACE("(%p)->(%p)\n", This, out); -+ -+ if (!out) -+ return E_POINTER; -+ -+ pthread_mutex_lock(&pulse_lock); -+ hr = pulse_stream_valid(This); -+ if (SUCCEEDED(hr)) -+ *out = This->bufsize_frames; -+ pthread_mutex_unlock(&pulse_lock); -+ -+ return hr; -+} -+ -+static HRESULT WINAPI AudioClient_GetStreamLatency(IAudioClient *iface, -+ REFERENCE_TIME *latency) -+{ -+ ACImpl *This = impl_from_IAudioClient(iface); -+ const pa_buffer_attr *attr; -+ REFERENCE_TIME lat; -+ HRESULT hr; -+ -+ TRACE("(%p)->(%p)\n", This, latency); -+ -+ if (!latency) -+ return E_POINTER; -+ -+ pthread_mutex_lock(&pulse_lock); -+ hr = pulse_stream_valid(This); -+ if (FAILED(hr)) { -+ pthread_mutex_unlock(&pulse_lock); -+ return hr; -+ } -+ attr = pa_stream_get_buffer_attr(This->stream); -+ if (This->dataflow == eRender) -+ lat = attr->minreq / pa_frame_size(&This->ss); -+ else -+ lat = attr->fragsize / pa_frame_size(&This->ss); -+ *latency = 10000000; -+ *latency *= lat; -+ *latency /= This->ss.rate; -+ pthread_mutex_unlock(&pulse_lock); -+ TRACE("Latency: %u ms\n", (DWORD)(*latency / 10000)); -+ return S_OK; -+} -+ -+static void ACImpl_GetRenderPad(ACImpl *This, UINT32 *out) -+{ -+ *out = This->pad / pa_frame_size(&This->ss); -+} -+ -+static void ACImpl_GetCapturePad(ACImpl *This, UINT32 *out) -+{ -+ ACPacket *packet = This->locked_ptr; -+ if (!packet && !list_empty(&This->packet_filled_head)) { -+ packet = (ACPacket*)list_head(&This->packet_filled_head); -+ This->locked_ptr = packet; -+ list_remove(&packet->entry); -+ } -+ if (out) -+ *out = This->pad / pa_frame_size(&This->ss); -+} -+ -+static HRESULT WINAPI AudioClient_GetCurrentPadding(IAudioClient *iface, -+ UINT32 *out) -+{ -+ ACImpl *This = impl_from_IAudioClient(iface); -+ HRESULT hr; -+ -+ TRACE("(%p)->(%p)\n", This, out); -+ -+ if (!out) -+ return E_POINTER; -+ -+ pthread_mutex_lock(&pulse_lock); -+ hr = pulse_stream_valid(This); -+ if (FAILED(hr)) { -+ pthread_mutex_unlock(&pulse_lock); -+ return hr; -+ } -+ -+ if (This->dataflow == eRender) -+ ACImpl_GetRenderPad(This, out); -+ else -+ ACImpl_GetCapturePad(This, out); -+ pthread_mutex_unlock(&pulse_lock); -+ -+ TRACE("%p Pad: %u ms (%u)\n", This, MulDiv(*out, 1000, This->ss.rate), *out); -+ return S_OK; -+} -+ -+static HRESULT WINAPI AudioClient_IsFormatSupported(IAudioClient *iface, -+ AUDCLNT_SHAREMODE mode, const WAVEFORMATEX *fmt, -+ WAVEFORMATEX **out) -+{ -+ ACImpl *This = impl_from_IAudioClient(iface); -+ HRESULT hr = S_OK; -+ WAVEFORMATEX *closest = NULL; -+ -+ TRACE("(%p)->(%x, %p, %p)\n", This, mode, fmt, out); -+ -+ if (!fmt || (mode == AUDCLNT_SHAREMODE_SHARED && !out)) -+ return E_POINTER; -+ -+ if (out) -+ *out = NULL; -+ if (mode != AUDCLNT_SHAREMODE_SHARED && mode != AUDCLNT_SHAREMODE_EXCLUSIVE) -+ return E_INVALIDARG; -+ if (mode == AUDCLNT_SHAREMODE_EXCLUSIVE) -+ return This->dataflow == eCapture ? AUDCLNT_E_UNSUPPORTED_FORMAT : AUDCLNT_E_EXCLUSIVE_MODE_NOT_ALLOWED; -+ switch (fmt->wFormatTag) { -+ case WAVE_FORMAT_EXTENSIBLE: -+ if (fmt->cbSize < sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX)) -+ return E_INVALIDARG; -+ dump_fmt(fmt); -+ break; -+ case WAVE_FORMAT_ALAW: -+ case WAVE_FORMAT_MULAW: -+ case WAVE_FORMAT_IEEE_FLOAT: -+ case WAVE_FORMAT_PCM: -+ dump_fmt(fmt); -+ break; -+ default: -+ dump_fmt(fmt); -+ return AUDCLNT_E_UNSUPPORTED_FORMAT; -+ } -+ if (fmt->nChannels == 0) -+ return AUDCLNT_E_UNSUPPORTED_FORMAT; -+ closest = clone_format(fmt); -+ if (!closest) { -+ if (out) -+ *out = NULL; -+ return E_OUTOFMEMORY; -+ } -+ -+ if (fmt->wFormatTag == WAVE_FORMAT_EXTENSIBLE) { -+ UINT32 mask = 0, i, channels = 0; -+ WAVEFORMATEXTENSIBLE *ext = (WAVEFORMATEXTENSIBLE*)closest; -+ -+ if ((fmt->nChannels > 1 && ext->dwChannelMask == SPEAKER_ALL) || -+ (fmt->nChannels == 1 && ext->dwChannelMask == ~0U)) { -+ mask = ext->dwChannelMask; -+ channels = fmt->nChannels; -+ } else if (ext->dwChannelMask) { -+ for (i = 1; !(i & SPEAKER_RESERVED); i <<= 1) { -+ if (i & ext->dwChannelMask) { -+ mask |= i; -+ channels++; -+ } -+ } -+ if (channels < fmt->nChannels) -+ mask = get_channel_mask(fmt->nChannels); -+ } else -+ mask = ext->dwChannelMask; -+ if (ext->dwChannelMask != mask) { -+ ext->dwChannelMask = mask; -+ hr = S_FALSE; -+ } -+ } -+ -+ if (hr == S_OK || !out) { -+ CoTaskMemFree(closest); -+ if (out) -+ *out = NULL; -+ } else if (closest) { -+ closest->nBlockAlign = -+ closest->nChannels * closest->wBitsPerSample / 8; -+ closest->nAvgBytesPerSec = -+ closest->nBlockAlign * closest->nSamplesPerSec; -+ *out = closest; -+ } -+ -+ TRACE("returning: %08x %p\n", hr, out ? *out : NULL); -+ return hr; -+} -+ -+static HRESULT WINAPI AudioClient_GetMixFormat(IAudioClient *iface, -+ WAVEFORMATEX **pwfx) -+{ -+ ACImpl *This = impl_from_IAudioClient(iface); -+ WAVEFORMATEXTENSIBLE *fmt = &pulse_fmt[This->dataflow == eCapture]; -+ -+ TRACE("(%p)->(%p)\n", This, pwfx); -+ -+ if (!pwfx) -+ return E_POINTER; -+ -+ *pwfx = clone_format(&fmt->Format); -+ if (!*pwfx) -+ return E_OUTOFMEMORY; -+ dump_fmt(*pwfx); -+ return S_OK; -+} -+ -+static HRESULT WINAPI AudioClient_GetDevicePeriod(IAudioClient *iface, -+ REFERENCE_TIME *defperiod, REFERENCE_TIME *minperiod) -+{ -+ ACImpl *This = impl_from_IAudioClient(iface); -+ -+ TRACE("(%p)->(%p, %p)\n", This, defperiod, minperiod); -+ -+ if (!defperiod && !minperiod) -+ return E_POINTER; -+ -+ if (defperiod) -+ *defperiod = pulse_def_period[This->dataflow == eCapture]; -+ if (minperiod) -+ *minperiod = pulse_min_period[This->dataflow == eCapture]; -+ -+ return S_OK; -+} -+ -+static HRESULT WINAPI AudioClient_Start(IAudioClient *iface) -+{ -+ ACImpl *This = impl_from_IAudioClient(iface); -+ HRESULT hr = S_OK; -+ int success; -+ pa_operation *o; -+ -+ TRACE("(%p)\n", This); -+ -+ pthread_mutex_lock(&pulse_lock); -+ hr = pulse_stream_valid(This); -+ if (FAILED(hr)) { -+ pthread_mutex_unlock(&pulse_lock); -+ return hr; -+ } -+ -+ if ((This->flags & AUDCLNT_STREAMFLAGS_EVENTCALLBACK) && !This->event) { -+ pthread_mutex_unlock(&pulse_lock); -+ return AUDCLNT_E_EVENTHANDLE_NOT_SET; -+ } -+ -+ if (This->started) { -+ pthread_mutex_unlock(&pulse_lock); -+ return AUDCLNT_E_NOT_STOPPED; -+ } -+ This->clock_pulse = PA_USEC_INVALID; -+ -+ if (pa_stream_is_corked(This->stream)) { -+ o = pa_stream_cork(This->stream, 0, pulse_op_cb, &success); -+ if (o) { -+ while(pa_operation_get_state(o) == PA_OPERATION_RUNNING) -+ pthread_cond_wait(&pulse_cond, &pulse_lock); -+ pa_operation_unref(o); -+ } else -+ success = 0; -+ if (!success) -+ hr = E_FAIL; -+ } -+ if (SUCCEEDED(hr)) { -+ This->started = TRUE; -+ if (This->dataflow == eRender && This->event) -+ pa_stream_set_latency_update_callback(This->stream, pulse_latency_callback, This); -+ } -+ pthread_mutex_unlock(&pulse_lock); -+ return hr; -+} -+ -+static HRESULT WINAPI AudioClient_Stop(IAudioClient *iface) -+{ -+ ACImpl *This = impl_from_IAudioClient(iface); -+ HRESULT hr = S_OK; -+ pa_operation *o; -+ int success; -+ -+ TRACE("(%p)\n", This); -+ -+ pthread_mutex_lock(&pulse_lock); -+ hr = pulse_stream_valid(This); -+ if (FAILED(hr)) { -+ pthread_mutex_unlock(&pulse_lock); -+ return hr; -+ } -+ -+ if (!This->started) { -+ pthread_mutex_unlock(&pulse_lock); -+ return S_FALSE; -+ } -+ -+ if (This->dataflow == eRender) { -+ o = pa_stream_cork(This->stream, 1, pulse_op_cb, &success); -+ if (o) { -+ while(pa_operation_get_state(o) == PA_OPERATION_RUNNING) -+ pthread_cond_wait(&pulse_cond, &pulse_lock); -+ pa_operation_unref(o); -+ } else -+ success = 0; -+ if (!success) -+ hr = E_FAIL; -+ } -+ if (SUCCEEDED(hr)) { -+ This->started = FALSE; -+ This->clock_pulse = PA_USEC_INVALID; -+ } -+ pthread_mutex_unlock(&pulse_lock); -+ return hr; -+} -+ -+static HRESULT WINAPI AudioClient_Reset(IAudioClient *iface) -+{ -+ ACImpl *This = impl_from_IAudioClient(iface); -+ HRESULT hr = S_OK; -+ -+ TRACE("(%p)\n", This); -+ -+ pthread_mutex_lock(&pulse_lock); -+ hr = pulse_stream_valid(This); -+ if (FAILED(hr)) { -+ pthread_mutex_unlock(&pulse_lock); -+ return hr; -+ } -+ -+ if (This->started) { -+ pthread_mutex_unlock(&pulse_lock); -+ return AUDCLNT_E_NOT_STOPPED; -+ } -+ -+ if (This->locked) { -+ pthread_mutex_unlock(&pulse_lock); -+ return AUDCLNT_E_BUFFER_OPERATION_PENDING; -+ } -+ -+ if (This->dataflow == eRender) { -+ /* If there is still data in the render buffer it needs to be removed from the server */ -+ int success = 0; -+ if (This->pad) { -+ pa_operation *o = pa_stream_flush(This->stream, pulse_op_cb, &success); -+ if (o) { -+ while(pa_operation_get_state(o) == PA_OPERATION_RUNNING) -+ pthread_cond_wait(&pulse_cond, &pulse_lock); -+ pa_operation_unref(o); -+ } -+ } -+ if (success || !This->pad) -+ This->clock_lastpos = This->clock_written = This->pad = 0; -+ } else { -+ ACPacket *p; -+ This->clock_written += This->pad; -+ This->pad = 0; -+ -+ if ((p = This->locked_ptr)) { -+ This->locked_ptr = NULL; -+ list_add_tail(&This->packet_free_head, &p->entry); -+ } -+ list_move_tail(&This->packet_free_head, &This->packet_filled_head); -+ } -+ pthread_mutex_unlock(&pulse_lock); -+ -+ return hr; -+} -+ -+static HRESULT WINAPI AudioClient_SetEventHandle(IAudioClient *iface, -+ HANDLE event) -+{ -+ ACImpl *This = impl_from_IAudioClient(iface); -+ HRESULT hr; -+ -+ TRACE("(%p)->(%p)\n", This, event); -+ -+ if (!event) -+ return E_INVALIDARG; -+ -+ pthread_mutex_lock(&pulse_lock); -+ hr = pulse_stream_valid(This); -+ if (FAILED(hr)) { -+ pthread_mutex_unlock(&pulse_lock); -+ return hr; -+ } -+ -+ if (!(This->flags & AUDCLNT_STREAMFLAGS_EVENTCALLBACK)) -+ hr = AUDCLNT_E_EVENTHANDLE_NOT_EXPECTED; -+ else if (This->event) -+ hr = HRESULT_FROM_WIN32(ERROR_INVALID_NAME); -+ else -+ This->event = event; -+ pthread_mutex_unlock(&pulse_lock); -+ return hr; -+} -+ -+static HRESULT WINAPI AudioClient_GetService(IAudioClient *iface, REFIID riid, -+ void **ppv) -+{ -+ ACImpl *This = impl_from_IAudioClient(iface); -+ HRESULT hr; -+ -+ TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(riid), ppv); -+ -+ if (!ppv) -+ return E_POINTER; -+ *ppv = NULL; -+ -+ pthread_mutex_lock(&pulse_lock); -+ hr = pulse_stream_valid(This); -+ pthread_mutex_unlock(&pulse_lock); -+ if (FAILED(hr)) -+ return hr; -+ -+ if (IsEqualIID(riid, &IID_IAudioRenderClient)) { -+ if (This->dataflow != eRender) -+ return AUDCLNT_E_WRONG_ENDPOINT_TYPE; -+ *ppv = &This->IAudioRenderClient_iface; -+ } else if (IsEqualIID(riid, &IID_IAudioCaptureClient)) { -+ if (This->dataflow != eCapture) -+ return AUDCLNT_E_WRONG_ENDPOINT_TYPE; -+ *ppv = &This->IAudioCaptureClient_iface; -+ } else if (IsEqualIID(riid, &IID_IAudioClock)) { -+ *ppv = &This->IAudioClock_iface; -+ } else if (IsEqualIID(riid, &IID_IAudioStreamVolume)) { -+ *ppv = &This->IAudioStreamVolume_iface; -+ } else if (IsEqualIID(riid, &IID_IAudioSessionControl) || -+ IsEqualIID(riid, &IID_IChannelAudioVolume) || -+ IsEqualIID(riid, &IID_ISimpleAudioVolume)) { -+ if (!This->session_wrapper) { -+ This->session_wrapper = AudioSessionWrapper_Create(This); -+ if (!This->session_wrapper) -+ return E_OUTOFMEMORY; -+ } -+ if (IsEqualIID(riid, &IID_IAudioSessionControl)) -+ *ppv = &This->session_wrapper->IAudioSessionControl2_iface; -+ else if (IsEqualIID(riid, &IID_IChannelAudioVolume)) -+ *ppv = &This->session_wrapper->IChannelAudioVolume_iface; -+ else if (IsEqualIID(riid, &IID_ISimpleAudioVolume)) -+ *ppv = &This->session_wrapper->ISimpleAudioVolume_iface; -+ } -+ -+ if (*ppv) { -+ IUnknown_AddRef((IUnknown*)*ppv); -+ return S_OK; -+ } -+ -+ FIXME("stub %s\n", debugstr_guid(riid)); -+ return E_NOINTERFACE; -+} -+ -+static const IAudioClientVtbl AudioClient_Vtbl = -+{ -+ AudioClient_QueryInterface, -+ AudioClient_AddRef, -+ AudioClient_Release, -+ AudioClient_Initialize, -+ AudioClient_GetBufferSize, -+ AudioClient_GetStreamLatency, -+ AudioClient_GetCurrentPadding, -+ AudioClient_IsFormatSupported, -+ AudioClient_GetMixFormat, -+ AudioClient_GetDevicePeriod, -+ AudioClient_Start, -+ AudioClient_Stop, -+ AudioClient_Reset, -+ AudioClient_SetEventHandle, -+ AudioClient_GetService -+}; -+ -+static HRESULT WINAPI AudioRenderClient_QueryInterface( -+ IAudioRenderClient *iface, REFIID riid, void **ppv) -+{ -+ TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), ppv); -+ -+ if (!ppv) -+ return E_POINTER; -+ *ppv = NULL; -+ -+ if (IsEqualIID(riid, &IID_IUnknown) || -+ IsEqualIID(riid, &IID_IAudioRenderClient)) -+ *ppv = iface; -+ if (*ppv) { -+ IUnknown_AddRef((IUnknown*)*ppv); -+ return S_OK; -+ } -+ -+ WARN("Unknown interface %s\n", debugstr_guid(riid)); -+ return E_NOINTERFACE; -+} -+ -+static ULONG WINAPI AudioRenderClient_AddRef(IAudioRenderClient *iface) -+{ -+ ACImpl *This = impl_from_IAudioRenderClient(iface); -+ return AudioClient_AddRef(&This->IAudioClient_iface); -+} -+ -+static ULONG WINAPI AudioRenderClient_Release(IAudioRenderClient *iface) -+{ -+ ACImpl *This = impl_from_IAudioRenderClient(iface); -+ return AudioClient_Release(&This->IAudioClient_iface); -+} -+ -+static HRESULT WINAPI AudioRenderClient_GetBuffer(IAudioRenderClient *iface, -+ UINT32 frames, BYTE **data) -+{ -+ ACImpl *This = impl_from_IAudioRenderClient(iface); -+ UINT32 avail, pad, req, bytes = frames * pa_frame_size(&This->ss); -+ HRESULT hr = S_OK; -+ int ret = -1; -+ -+ TRACE("(%p)->(%u, %p)\n", This, frames, data); -+ -+ if (!data) -+ return E_POINTER; -+ *data = NULL; -+ -+ pthread_mutex_lock(&pulse_lock); -+ hr = pulse_stream_valid(This); -+ if (FAILED(hr) || This->locked) { -+ pthread_mutex_unlock(&pulse_lock); -+ return FAILED(hr) ? hr : AUDCLNT_E_OUT_OF_ORDER; -+ } -+ if (!frames) { -+ pthread_mutex_unlock(&pulse_lock); -+ return S_OK; -+ } -+ -+ ACImpl_GetRenderPad(This, &pad); -+ avail = This->bufsize_frames - pad; -+ if (avail < frames || bytes > This->bufsize_bytes) { -+ pthread_mutex_unlock(&pulse_lock); -+ WARN("Wanted to write %u, but only %u available\n", frames, avail); -+ return AUDCLNT_E_BUFFER_TOO_LARGE; -+ } -+ -+ This->locked = frames; -+ req = bytes; -+ ret = pa_stream_begin_write(This->stream, &This->locked_ptr, &req); -+ if (ret < 0 || req < bytes) { -+ FIXME("%p Not using pulse locked data: %i %u/%u %u/%u\n", This, ret, req/pa_frame_size(&This->ss), frames, pad, This->bufsize_frames); -+ if (ret >= 0) -+ pa_stream_cancel_write(This->stream); -+ *data = This->tmp_buffer; -+ This->locked_ptr = NULL; -+ } else -+ *data = This->locked_ptr; -+ pthread_mutex_unlock(&pulse_lock); -+ return hr; -+} -+ -+static HRESULT WINAPI AudioRenderClient_ReleaseBuffer( -+ IAudioRenderClient *iface, UINT32 written_frames, DWORD flags) -+{ -+ ACImpl *This = impl_from_IAudioRenderClient(iface); -+ UINT32 written_bytes = written_frames * pa_frame_size(&This->ss); -+ -+ TRACE("(%p)->(%u, %x)\n", This, written_frames, flags); -+ -+ pthread_mutex_lock(&pulse_lock); -+ if (!This->locked || !written_frames) { -+ if (This->locked_ptr) -+ pa_stream_cancel_write(This->stream); -+ This->locked = 0; -+ This->locked_ptr = NULL; -+ pthread_mutex_unlock(&pulse_lock); -+ return written_frames ? AUDCLNT_E_OUT_OF_ORDER : S_OK; -+ } -+ -+ if (This->locked < written_frames) { -+ pthread_mutex_unlock(&pulse_lock); -+ return AUDCLNT_E_INVALID_SIZE; -+ } -+ -+ if (flags & AUDCLNT_BUFFERFLAGS_SILENT) { -+ if (This->ss.format == PA_SAMPLE_U8) -+ memset(This->tmp_buffer, 128, written_bytes); -+ else -+ memset(This->tmp_buffer, 0, written_bytes); -+ } -+ -+ This->locked = 0; -+ if (This->locked_ptr) -+ pa_stream_write(This->stream, This->locked_ptr, written_bytes, NULL, 0, PA_SEEK_RELATIVE); -+ else -+ pa_stream_write(This->stream, This->tmp_buffer, written_bytes, NULL, 0, PA_SEEK_RELATIVE); -+ This->pad += written_bytes; -+ This->locked_ptr = NULL; -+ TRACE("Released %u, pad %u\n", written_frames, This->pad / pa_frame_size(&This->ss)); -+ assert(This->pad <= This->bufsize_bytes); -+ pthread_mutex_unlock(&pulse_lock); -+ return S_OK; -+} -+ -+static const IAudioRenderClientVtbl AudioRenderClient_Vtbl = { -+ AudioRenderClient_QueryInterface, -+ AudioRenderClient_AddRef, -+ AudioRenderClient_Release, -+ AudioRenderClient_GetBuffer, -+ AudioRenderClient_ReleaseBuffer -+}; -+ -+static HRESULT WINAPI AudioCaptureClient_QueryInterface( -+ IAudioCaptureClient *iface, REFIID riid, void **ppv) -+{ -+ TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), ppv); -+ -+ if (!ppv) -+ return E_POINTER; -+ *ppv = NULL; -+ -+ if (IsEqualIID(riid, &IID_IUnknown) || -+ IsEqualIID(riid, &IID_IAudioCaptureClient)) -+ *ppv = iface; -+ if (*ppv) { -+ IUnknown_AddRef((IUnknown*)*ppv); -+ return S_OK; -+ } -+ -+ WARN("Unknown interface %s\n", debugstr_guid(riid)); -+ return E_NOINTERFACE; -+} -+ -+static ULONG WINAPI AudioCaptureClient_AddRef(IAudioCaptureClient *iface) -+{ -+ ACImpl *This = impl_from_IAudioCaptureClient(iface); -+ return IAudioClient_AddRef(&This->IAudioClient_iface); -+} -+ -+static ULONG WINAPI AudioCaptureClient_Release(IAudioCaptureClient *iface) -+{ -+ ACImpl *This = impl_from_IAudioCaptureClient(iface); -+ return IAudioClient_Release(&This->IAudioClient_iface); -+} -+ -+static HRESULT WINAPI AudioCaptureClient_GetBuffer(IAudioCaptureClient *iface, -+ BYTE **data, UINT32 *frames, DWORD *flags, UINT64 *devpos, -+ UINT64 *qpcpos) -+{ -+ ACImpl *This = impl_from_IAudioCaptureClient(iface); -+ HRESULT hr; -+ ACPacket *packet; -+ -+ TRACE("(%p)->(%p, %p, %p, %p, %p)\n", This, data, frames, flags, -+ devpos, qpcpos); -+ -+ if (!data || !frames || !flags) -+ return E_POINTER; -+ -+ pthread_mutex_lock(&pulse_lock); -+ hr = pulse_stream_valid(This); -+ if (FAILED(hr) || This->locked) { -+ pthread_mutex_unlock(&pulse_lock); -+ return FAILED(hr) ? hr : AUDCLNT_E_OUT_OF_ORDER; -+ } -+ -+ ACImpl_GetCapturePad(This, NULL); -+ if ((packet = This->locked_ptr)) { -+ *frames = This->capture_period / pa_frame_size(&This->ss); -+ *flags = 0; -+ if (packet->discont) -+ *flags |= AUDCLNT_BUFFERFLAGS_DATA_DISCONTINUITY; -+ if (devpos) { -+ if (packet->discont) -+ *devpos = (This->clock_written + This->capture_period) / pa_frame_size(&This->ss); -+ else -+ *devpos = This->clock_written / pa_frame_size(&This->ss); -+ } -+ if (qpcpos) -+ *qpcpos = packet->qpcpos; -+ *data = packet->data; -+ } -+ else -+ *frames = 0; -+ This->locked = *frames; -+ pthread_mutex_unlock(&pulse_lock); -+ return *frames ? S_OK : AUDCLNT_S_BUFFER_EMPTY; -+} -+ -+static HRESULT WINAPI AudioCaptureClient_ReleaseBuffer( -+ IAudioCaptureClient *iface, UINT32 done) -+{ -+ ACImpl *This = impl_from_IAudioCaptureClient(iface); -+ -+ TRACE("(%p)->(%u)\n", This, done); -+ -+ pthread_mutex_lock(&pulse_lock); -+ if (!This->locked && done) { -+ pthread_mutex_unlock(&pulse_lock); -+ return AUDCLNT_E_OUT_OF_ORDER; -+ } -+ if (done && This->locked != done) { -+ pthread_mutex_unlock(&pulse_lock); -+ return AUDCLNT_E_INVALID_SIZE; -+ } -+ if (done) { -+ ACPacket *packet = This->locked_ptr; -+ This->locked_ptr = NULL; -+ This->pad -= This->capture_period; -+ if (packet->discont) -+ This->clock_written += 2 * This->capture_period; -+ else -+ This->clock_written += This->capture_period; -+ list_add_tail(&This->packet_free_head, &packet->entry); -+ } -+ This->locked = 0; -+ pthread_mutex_unlock(&pulse_lock); -+ return S_OK; -+} -+ -+static HRESULT WINAPI AudioCaptureClient_GetNextPacketSize( -+ IAudioCaptureClient *iface, UINT32 *frames) -+{ -+ ACImpl *This = impl_from_IAudioCaptureClient(iface); -+ ACPacket *p; -+ -+ TRACE("(%p)->(%p)\n", This, frames); -+ if (!frames) -+ return E_POINTER; -+ -+ pthread_mutex_lock(&pulse_lock); -+ ACImpl_GetCapturePad(This, NULL); -+ p = This->locked_ptr; -+ if (p) -+ *frames = This->capture_period / pa_frame_size(&This->ss); -+ else -+ *frames = 0; -+ pthread_mutex_unlock(&pulse_lock); -+ return S_OK; -+} -+ -+static const IAudioCaptureClientVtbl AudioCaptureClient_Vtbl = -+{ -+ AudioCaptureClient_QueryInterface, -+ AudioCaptureClient_AddRef, -+ AudioCaptureClient_Release, -+ AudioCaptureClient_GetBuffer, -+ AudioCaptureClient_ReleaseBuffer, -+ AudioCaptureClient_GetNextPacketSize -+}; -+ -+static HRESULT WINAPI AudioClock_QueryInterface(IAudioClock *iface, -+ REFIID riid, void **ppv) -+{ -+ ACImpl *This = impl_from_IAudioClock(iface); -+ -+ TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), ppv); -+ -+ if (!ppv) -+ return E_POINTER; -+ *ppv = NULL; -+ -+ if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IAudioClock)) -+ *ppv = iface; -+ else if (IsEqualIID(riid, &IID_IAudioClock2)) -+ *ppv = &This->IAudioClock2_iface; -+ if (*ppv) { -+ IUnknown_AddRef((IUnknown*)*ppv); -+ return S_OK; -+ } -+ -+ WARN("Unknown interface %s\n", debugstr_guid(riid)); -+ return E_NOINTERFACE; -+} -+ -+static ULONG WINAPI AudioClock_AddRef(IAudioClock *iface) -+{ -+ ACImpl *This = impl_from_IAudioClock(iface); -+ return IAudioClient_AddRef(&This->IAudioClient_iface); -+} -+ -+static ULONG WINAPI AudioClock_Release(IAudioClock *iface) -+{ -+ ACImpl *This = impl_from_IAudioClock(iface); -+ return IAudioClient_Release(&This->IAudioClient_iface); -+} -+ -+static HRESULT WINAPI AudioClock_GetFrequency(IAudioClock *iface, UINT64 *freq) -+{ -+ ACImpl *This = impl_from_IAudioClock(iface); -+ HRESULT hr; -+ -+ TRACE("(%p)->(%p)\n", This, freq); -+ -+ pthread_mutex_lock(&pulse_lock); -+ hr = pulse_stream_valid(This); -+ if (SUCCEEDED(hr)) -+ *freq = This->ss.rate * pa_frame_size(&This->ss); -+ pthread_mutex_unlock(&pulse_lock); -+ return hr; -+} -+ -+static HRESULT WINAPI AudioClock_GetPosition(IAudioClock *iface, UINT64 *pos, -+ UINT64 *qpctime) -+{ -+ ACImpl *This = impl_from_IAudioClock(iface); -+ pa_usec_t time; -+ HRESULT hr; -+ -+ TRACE("(%p)->(%p, %p)\n", This, pos, qpctime); -+ -+ if (!pos) -+ return E_POINTER; -+ -+ pthread_mutex_lock(&pulse_lock); -+ hr = pulse_stream_valid(This); -+ if (FAILED(hr)) { -+ pthread_mutex_unlock(&pulse_lock); -+ return hr; -+ } -+ -+ *pos = This->clock_written; -+ if (This->clock_pulse != PA_USEC_INVALID && pa_stream_get_time(This->stream, &time) >= 0) { -+ UINT32 delta = pa_usec_to_bytes(time - This->clock_pulse, &This->ss); -+ if (delta < This->pad) -+ *pos += delta; -+ else -+ *pos += This->pad; -+ } -+ -+ /* Make time never go backwards */ -+ if (*pos < This->clock_lastpos) -+ *pos = This->clock_lastpos; -+ else -+ This->clock_lastpos = *pos; -+ pthread_mutex_unlock(&pulse_lock); -+ -+ TRACE("%p Position: %u\n", This, (unsigned)*pos); -+ -+ if (qpctime) { -+ LARGE_INTEGER stamp, freq; -+ QueryPerformanceCounter(&stamp); -+ QueryPerformanceFrequency(&freq); -+ *qpctime = (stamp.QuadPart * (INT64)10000000) / freq.QuadPart; -+ } -+ -+ return S_OK; -+} -+ -+static HRESULT WINAPI AudioClock_GetCharacteristics(IAudioClock *iface, -+ DWORD *chars) -+{ -+ ACImpl *This = impl_from_IAudioClock(iface); -+ -+ TRACE("(%p)->(%p)\n", This, chars); -+ -+ if (!chars) -+ return E_POINTER; -+ -+ *chars = AUDIOCLOCK_CHARACTERISTIC_FIXED_FREQ; -+ -+ return S_OK; -+} -+ -+static const IAudioClockVtbl AudioClock_Vtbl = -+{ -+ AudioClock_QueryInterface, -+ AudioClock_AddRef, -+ AudioClock_Release, -+ AudioClock_GetFrequency, -+ AudioClock_GetPosition, -+ AudioClock_GetCharacteristics -+}; -+ -+static HRESULT WINAPI AudioClock2_QueryInterface(IAudioClock2 *iface, -+ REFIID riid, void **ppv) -+{ -+ ACImpl *This = impl_from_IAudioClock2(iface); -+ return IAudioClock_QueryInterface(&This->IAudioClock_iface, riid, ppv); -+} -+ -+static ULONG WINAPI AudioClock2_AddRef(IAudioClock2 *iface) -+{ -+ ACImpl *This = impl_from_IAudioClock2(iface); -+ return IAudioClient_AddRef(&This->IAudioClient_iface); -+} -+ -+static ULONG WINAPI AudioClock2_Release(IAudioClock2 *iface) -+{ -+ ACImpl *This = impl_from_IAudioClock2(iface); -+ return IAudioClient_Release(&This->IAudioClient_iface); -+} -+ -+static HRESULT WINAPI AudioClock2_GetDevicePosition(IAudioClock2 *iface, -+ UINT64 *pos, UINT64 *qpctime) -+{ -+ ACImpl *This = impl_from_IAudioClock2(iface); -+ HRESULT hr = AudioClock_GetPosition(&This->IAudioClock_iface, pos, qpctime); -+ if (SUCCEEDED(hr)) -+ *pos /= pa_frame_size(&This->ss); -+ return hr; -+} -+ -+static const IAudioClock2Vtbl AudioClock2_Vtbl = -+{ -+ AudioClock2_QueryInterface, -+ AudioClock2_AddRef, -+ AudioClock2_Release, -+ AudioClock2_GetDevicePosition -+}; -+ -+static HRESULT WINAPI AudioStreamVolume_QueryInterface( -+ IAudioStreamVolume *iface, REFIID riid, void **ppv) -+{ -+ TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), ppv); -+ -+ if (!ppv) -+ return E_POINTER; -+ *ppv = NULL; -+ -+ if (IsEqualIID(riid, &IID_IUnknown) || -+ IsEqualIID(riid, &IID_IAudioStreamVolume)) -+ *ppv = iface; -+ if (*ppv) { -+ IUnknown_AddRef((IUnknown*)*ppv); -+ return S_OK; -+ } -+ -+ WARN("Unknown interface %s\n", debugstr_guid(riid)); -+ return E_NOINTERFACE; -+} -+ -+static ULONG WINAPI AudioStreamVolume_AddRef(IAudioStreamVolume *iface) -+{ -+ ACImpl *This = impl_from_IAudioStreamVolume(iface); -+ return IAudioClient_AddRef(&This->IAudioClient_iface); -+} -+ -+static ULONG WINAPI AudioStreamVolume_Release(IAudioStreamVolume *iface) -+{ -+ ACImpl *This = impl_from_IAudioStreamVolume(iface); -+ return IAudioClient_Release(&This->IAudioClient_iface); -+} -+ -+static HRESULT WINAPI AudioStreamVolume_GetChannelCount( -+ IAudioStreamVolume *iface, UINT32 *out) -+{ -+ ACImpl *This = impl_from_IAudioStreamVolume(iface); -+ -+ TRACE("(%p)->(%p)\n", This, out); -+ -+ if (!out) -+ return E_POINTER; -+ -+ *out = This->ss.channels; -+ -+ return S_OK; -+} -+ -+struct pulse_info_cb_data { -+ UINT32 n; -+ float *levels; -+}; -+ -+static void pulse_sink_input_info_cb(pa_context *c, const pa_sink_input_info *info, int eol, void *data) -+{ -+ struct pulse_info_cb_data *d = data; -+ int i; -+ if (eol) -+ return; -+ for (i = 0; i < d->n; ++i) -+ d->levels[i] = (float)info->volume.values[i] / (float)PA_VOLUME_NORM; -+ pthread_cond_signal(&pulse_cond); -+} -+ -+static void pulse_source_info_cb(pa_context *c, const pa_source_info *info, int eol, void *data) -+{ -+ struct pulse_info_cb_data *d = data; -+ int i; -+ if (eol) -+ return; -+ for (i = 0; i < d->n; ++i) -+ d->levels[i] = (float)info->volume.values[i] / (float)PA_VOLUME_NORM; -+ pthread_cond_signal(&pulse_cond); -+} -+ -+static HRESULT WINAPI AudioStreamVolume_SetAllVolumes( -+ IAudioStreamVolume *iface, UINT32 count, const float *levels) -+{ -+ ACImpl *This = impl_from_IAudioStreamVolume(iface); -+ pa_operation *o; -+ HRESULT hr; -+ int success = 0, i; -+ pa_cvolume cv; -+ -+ TRACE("(%p)->(%d, %p)\n", This, count, levels); -+ -+ if (!levels) -+ return E_POINTER; -+ -+ if (count != This->ss.channels) -+ return E_INVALIDARG; -+ -+ pthread_mutex_lock(&pulse_lock); -+ hr = pulse_stream_valid(This); -+ if (FAILED(hr)) -+ goto out; -+ -+ if (pulse_stream_volume) { -+ cv.channels = count; -+ for (i = 0; i < cv.channels; ++i) -+ cv.values[i] = levels[i] * (float)PA_VOLUME_NORM; -+ if (This->dataflow == eRender) -+ o = pa_context_set_sink_input_volume(pulse_ctx, pa_stream_get_index(This->stream), &cv, pulse_ctx_op_cb, &success); -+ else -+ o = pa_context_set_source_volume_by_index(pulse_ctx, pa_stream_get_device_index(This->stream), &cv, pulse_ctx_op_cb, &success); -+ if (o) { -+ while(pa_operation_get_state(o) == PA_OPERATION_RUNNING) -+ pthread_cond_wait(&pulse_cond, &pulse_lock); -+ pa_operation_unref(o); -+ } -+ if (!success) -+ hr = AUDCLNT_E_BUFFER_ERROR; -+ } else { -+ int i; -+ for (i = 0; i < count; ++i) -+ This->vol[i] = levels[i]; -+ } -+ -+out: -+ pthread_mutex_unlock(&pulse_lock); -+ return hr; -+} -+ -+static HRESULT WINAPI AudioStreamVolume_GetAllVolumes( -+ IAudioStreamVolume *iface, UINT32 count, float *levels) -+{ -+ ACImpl *This = impl_from_IAudioStreamVolume(iface); -+ pa_operation *o; -+ HRESULT hr; -+ struct pulse_info_cb_data info; -+ -+ TRACE("(%p)->(%d, %p)\n", This, count, levels); -+ -+ if (!levels) -+ return E_POINTER; -+ -+ if (count != This->ss.channels) -+ return E_INVALIDARG; -+ -+ pthread_mutex_lock(&pulse_lock); -+ hr = pulse_stream_valid(This); -+ if (FAILED(hr)) -+ goto out; -+ -+ if (pulse_stream_volume) { -+ info.n = count; -+ info.levels = levels; -+ if (This->dataflow == eRender) -+ o = pa_context_get_sink_input_info(pulse_ctx, pa_stream_get_index(This->stream), pulse_sink_input_info_cb, &info); -+ else -+ o = pa_context_get_source_info_by_index(pulse_ctx, pa_stream_get_device_index(This->stream), pulse_source_info_cb, &info); -+ if (o) { -+ while(pa_operation_get_state(o) == PA_OPERATION_RUNNING) -+ pthread_cond_wait(&pulse_cond, &pulse_lock); -+ pa_operation_unref(o); -+ } else -+ hr = AUDCLNT_E_BUFFER_ERROR; -+ } else { -+ int i; -+ for (i = 0; i < count; ++i) -+ levels[i] = This->vol[i]; -+ } -+ -+out: -+ pthread_mutex_unlock(&pulse_lock); -+ return hr; -+} -+ -+static HRESULT WINAPI AudioStreamVolume_SetChannelVolume( -+ IAudioStreamVolume *iface, UINT32 index, float level) -+{ -+ ACImpl *This = impl_from_IAudioStreamVolume(iface); -+ HRESULT hr; -+ float volumes[PA_CHANNELS_MAX]; -+ -+ TRACE("(%p)->(%d, %f)\n", This, index, level); -+ -+ if (level < 0.f || level > 1.f) -+ return E_INVALIDARG; -+ -+ if (index >= This->ss.channels) -+ return E_INVALIDARG; -+ -+ hr = AudioStreamVolume_GetAllVolumes(iface, This->ss.channels, volumes); -+ volumes[index] = level; -+ if (SUCCEEDED(hr)) -+ hr = AudioStreamVolume_SetAllVolumes(iface, This->ss.channels, volumes); -+ return hr; -+} -+ -+static HRESULT WINAPI AudioStreamVolume_GetChannelVolume( -+ IAudioStreamVolume *iface, UINT32 index, float *level) -+{ -+ ACImpl *This = impl_from_IAudioStreamVolume(iface); -+ float volumes[PA_CHANNELS_MAX]; -+ HRESULT hr; -+ -+ TRACE("(%p)->(%d, %p)\n", This, index, level); -+ -+ if (!level) -+ return E_POINTER; -+ -+ if (index >= This->ss.channels) -+ return E_INVALIDARG; -+ -+ hr = AudioStreamVolume_GetAllVolumes(iface, This->ss.channels, volumes); -+ if (SUCCEEDED(hr)) -+ *level = volumes[index]; -+ return hr; -+} -+ -+static const IAudioStreamVolumeVtbl AudioStreamVolume_Vtbl = -+{ -+ AudioStreamVolume_QueryInterface, -+ AudioStreamVolume_AddRef, -+ AudioStreamVolume_Release, -+ AudioStreamVolume_GetChannelCount, -+ AudioStreamVolume_SetChannelVolume, -+ AudioStreamVolume_GetChannelVolume, -+ AudioStreamVolume_SetAllVolumes, -+ AudioStreamVolume_GetAllVolumes -+}; -+ -+static AudioSessionWrapper *AudioSessionWrapper_Create(ACImpl *client) -+{ -+ AudioSessionWrapper *ret; -+ -+ ret = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, -+ sizeof(AudioSessionWrapper)); -+ if (!ret) -+ return NULL; -+ -+ ret->IAudioSessionControl2_iface.lpVtbl = &AudioSessionControl2_Vtbl; -+ ret->ISimpleAudioVolume_iface.lpVtbl = &SimpleAudioVolume_Vtbl; -+ ret->IChannelAudioVolume_iface.lpVtbl = &ChannelAudioVolume_Vtbl; -+ -+ ret->ref = !client; -+ -+ ret->client = client; -+ if (client) { -+ ret->session = client->session; -+ AudioClient_AddRef(&client->IAudioClient_iface); -+ } -+ -+ return ret; -+} -+ -+static HRESULT WINAPI AudioSessionControl_QueryInterface( -+ IAudioSessionControl2 *iface, REFIID riid, void **ppv) -+{ -+ TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), ppv); -+ -+ if (!ppv) -+ return E_POINTER; -+ *ppv = NULL; -+ -+ if (IsEqualIID(riid, &IID_IUnknown) || -+ IsEqualIID(riid, &IID_IAudioSessionControl) || -+ IsEqualIID(riid, &IID_IAudioSessionControl2)) -+ *ppv = iface; -+ if (*ppv) { -+ IUnknown_AddRef((IUnknown*)*ppv); -+ return S_OK; -+ } -+ -+ WARN("Unknown interface %s\n", debugstr_guid(riid)); -+ return E_NOINTERFACE; -+} -+ -+static ULONG WINAPI AudioSessionControl_AddRef(IAudioSessionControl2 *iface) -+{ -+ AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); -+ ULONG ref; -+ ref = InterlockedIncrement(&This->ref); -+ TRACE("(%p) Refcount now %u\n", This, ref); -+ return ref; -+} -+ -+static ULONG WINAPI AudioSessionControl_Release(IAudioSessionControl2 *iface) -+{ -+ AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); -+ ULONG ref; -+ ref = InterlockedDecrement(&This->ref); -+ TRACE("(%p) Refcount now %u\n", This, ref); -+ if (!ref) { -+ if (This->client) { -+ This->client->session_wrapper = NULL; -+ AudioClient_Release(&This->client->IAudioClient_iface); -+ } -+ HeapFree(GetProcessHeap(), 0, This); -+ } -+ return ref; -+} -+ -+static HRESULT WINAPI AudioSessionControl_GetState(IAudioSessionControl2 *iface, -+ AudioSessionState *state) -+{ -+ AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); -+ ACImpl *client; -+ -+ TRACE("(%p)->(%p)\n", This, state); -+ -+ if (!state) -+ return NULL_PTR_ERR; -+ -+ pthread_mutex_lock(&pulse_lock); -+ if (list_empty(&This->session->clients)) { -+ *state = AudioSessionStateExpired; -+ goto out; -+ } -+ LIST_FOR_EACH_ENTRY(client, &This->session->clients, ACImpl, entry) { -+ if (client->started) { -+ *state = AudioSessionStateActive; -+ goto out; -+ } -+ } -+ *state = AudioSessionStateInactive; -+ -+out: -+ pthread_mutex_unlock(&pulse_lock); -+ return S_OK; -+} -+ -+static HRESULT WINAPI AudioSessionControl_GetDisplayName( -+ IAudioSessionControl2 *iface, WCHAR **name) -+{ -+ AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); -+ -+ FIXME("(%p)->(%p) - stub\n", This, name); -+ -+ return E_NOTIMPL; -+} -+ -+static HRESULT WINAPI AudioSessionControl_SetDisplayName( -+ IAudioSessionControl2 *iface, const WCHAR *name, const GUID *session) -+{ -+ AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); -+ -+ FIXME("(%p)->(%p, %s) - stub\n", This, name, debugstr_guid(session)); -+ -+ return E_NOTIMPL; -+} -+ -+static HRESULT WINAPI AudioSessionControl_GetIconPath( -+ IAudioSessionControl2 *iface, WCHAR **path) -+{ -+ AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); -+ -+ FIXME("(%p)->(%p) - stub\n", This, path); -+ -+ return E_NOTIMPL; -+} -+ -+static HRESULT WINAPI AudioSessionControl_SetIconPath( -+ IAudioSessionControl2 *iface, const WCHAR *path, const GUID *session) -+{ -+ AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); -+ -+ FIXME("(%p)->(%p, %s) - stub\n", This, path, debugstr_guid(session)); -+ -+ return E_NOTIMPL; -+} -+ -+static HRESULT WINAPI AudioSessionControl_GetGroupingParam( -+ IAudioSessionControl2 *iface, GUID *group) -+{ -+ AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); -+ -+ FIXME("(%p)->(%p) - stub\n", This, group); -+ -+ return E_NOTIMPL; -+} -+ -+static HRESULT WINAPI AudioSessionControl_SetGroupingParam( -+ IAudioSessionControl2 *iface, const GUID *group, const GUID *session) -+{ -+ AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); -+ -+ FIXME("(%p)->(%s, %s) - stub\n", This, debugstr_guid(group), -+ debugstr_guid(session)); -+ -+ return E_NOTIMPL; -+} -+ -+static HRESULT WINAPI AudioSessionControl_RegisterAudioSessionNotification( -+ IAudioSessionControl2 *iface, IAudioSessionEvents *events) -+{ -+ AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); -+ -+ FIXME("(%p)->(%p) - stub\n", This, events); -+ -+ return S_OK; -+} -+ -+static HRESULT WINAPI AudioSessionControl_UnregisterAudioSessionNotification( -+ IAudioSessionControl2 *iface, IAudioSessionEvents *events) -+{ -+ AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); -+ -+ FIXME("(%p)->(%p) - stub\n", This, events); -+ -+ return S_OK; -+} -+ -+static HRESULT WINAPI AudioSessionControl_GetSessionIdentifier( -+ IAudioSessionControl2 *iface, WCHAR **id) -+{ -+ AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); -+ -+ FIXME("(%p)->(%p) - stub\n", This, id); -+ -+ return E_NOTIMPL; -+} -+ -+static HRESULT WINAPI AudioSessionControl_GetSessionInstanceIdentifier( -+ IAudioSessionControl2 *iface, WCHAR **id) -+{ -+ AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); -+ -+ FIXME("(%p)->(%p) - stub\n", This, id); -+ -+ return E_NOTIMPL; -+} -+ -+static HRESULT WINAPI AudioSessionControl_GetProcessId( -+ IAudioSessionControl2 *iface, DWORD *pid) -+{ -+ AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); -+ -+ TRACE("(%p)->(%p)\n", This, pid); -+ -+ if (!pid) -+ return E_POINTER; -+ -+ *pid = GetCurrentProcessId(); -+ -+ return S_OK; -+} -+ -+static HRESULT WINAPI AudioSessionControl_IsSystemSoundsSession( -+ IAudioSessionControl2 *iface) -+{ -+ AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); -+ -+ TRACE("(%p)\n", This); -+ -+ return S_FALSE; -+} -+ -+static HRESULT WINAPI AudioSessionControl_SetDuckingPreference( -+ IAudioSessionControl2 *iface, BOOL optout) -+{ -+ AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); -+ -+ TRACE("(%p)->(%d)\n", This, optout); -+ -+ return S_OK; -+} -+ -+static const IAudioSessionControl2Vtbl AudioSessionControl2_Vtbl = -+{ -+ AudioSessionControl_QueryInterface, -+ AudioSessionControl_AddRef, -+ AudioSessionControl_Release, -+ AudioSessionControl_GetState, -+ AudioSessionControl_GetDisplayName, -+ AudioSessionControl_SetDisplayName, -+ AudioSessionControl_GetIconPath, -+ AudioSessionControl_SetIconPath, -+ AudioSessionControl_GetGroupingParam, -+ AudioSessionControl_SetGroupingParam, -+ AudioSessionControl_RegisterAudioSessionNotification, -+ AudioSessionControl_UnregisterAudioSessionNotification, -+ AudioSessionControl_GetSessionIdentifier, -+ AudioSessionControl_GetSessionInstanceIdentifier, -+ AudioSessionControl_GetProcessId, -+ AudioSessionControl_IsSystemSoundsSession, -+ AudioSessionControl_SetDuckingPreference -+}; -+ -+typedef struct _SessionMgr { -+ IAudioSessionManager2 IAudioSessionManager2_iface; -+ -+ LONG ref; -+ -+ IMMDevice *device; -+} SessionMgr; -+ -+static HRESULT WINAPI AudioSessionManager_QueryInterface(IAudioSessionManager2 *iface, -+ REFIID riid, void **ppv) -+{ -+ TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), ppv); -+ -+ if (!ppv) -+ return E_POINTER; -+ *ppv = NULL; -+ -+ if (IsEqualIID(riid, &IID_IUnknown) || -+ IsEqualIID(riid, &IID_IAudioSessionManager) || -+ IsEqualIID(riid, &IID_IAudioSessionManager2)) -+ *ppv = iface; -+ if (*ppv) { -+ IUnknown_AddRef((IUnknown*)*ppv); -+ return S_OK; -+ } -+ -+ WARN("Unknown interface %s\n", debugstr_guid(riid)); -+ return E_NOINTERFACE; -+} -+ -+static inline SessionMgr *impl_from_IAudioSessionManager2(IAudioSessionManager2 *iface) -+{ -+ return CONTAINING_RECORD(iface, SessionMgr, IAudioSessionManager2_iface); -+} -+ -+static ULONG WINAPI AudioSessionManager_AddRef(IAudioSessionManager2 *iface) -+{ -+ SessionMgr *This = impl_from_IAudioSessionManager2(iface); -+ ULONG ref; -+ ref = InterlockedIncrement(&This->ref); -+ TRACE("(%p) Refcount now %u\n", This, ref); -+ return ref; -+} -+ -+static ULONG WINAPI AudioSessionManager_Release(IAudioSessionManager2 *iface) -+{ -+ SessionMgr *This = impl_from_IAudioSessionManager2(iface); -+ ULONG ref; -+ ref = InterlockedDecrement(&This->ref); -+ TRACE("(%p) Refcount now %u\n", This, ref); -+ if (!ref) -+ HeapFree(GetProcessHeap(), 0, This); -+ return ref; -+} -+ -+static HRESULT WINAPI AudioSessionManager_GetAudioSessionControl( -+ IAudioSessionManager2 *iface, const GUID *session_guid, DWORD flags, -+ IAudioSessionControl **out) -+{ -+ SessionMgr *This = impl_from_IAudioSessionManager2(iface); -+ AudioSession *session; -+ AudioSessionWrapper *wrapper; -+ HRESULT hr; -+ -+ TRACE("(%p)->(%s, %x, %p)\n", This, debugstr_guid(session_guid), -+ flags, out); -+ -+ hr = get_audio_session(session_guid, This->device, 0, &session); -+ if (FAILED(hr)) -+ return hr; -+ -+ wrapper = AudioSessionWrapper_Create(NULL); -+ if (!wrapper) -+ return E_OUTOFMEMORY; -+ -+ wrapper->session = session; -+ -+ *out = (IAudioSessionControl*)&wrapper->IAudioSessionControl2_iface; -+ -+ return S_OK; -+} -+ -+static HRESULT WINAPI AudioSessionManager_GetSimpleAudioVolume( -+ IAudioSessionManager2 *iface, const GUID *session_guid, DWORD flags, -+ ISimpleAudioVolume **out) -+{ -+ SessionMgr *This = impl_from_IAudioSessionManager2(iface); -+ AudioSession *session; -+ AudioSessionWrapper *wrapper; -+ HRESULT hr; -+ -+ TRACE("(%p)->(%s, %x, %p)\n", This, debugstr_guid(session_guid), -+ flags, out); -+ -+ hr = get_audio_session(session_guid, This->device, 0, &session); -+ if (FAILED(hr)) -+ return hr; -+ -+ wrapper = AudioSessionWrapper_Create(NULL); -+ if (!wrapper) -+ return E_OUTOFMEMORY; -+ -+ wrapper->session = session; -+ -+ *out = &wrapper->ISimpleAudioVolume_iface; -+ -+ return S_OK; -+} -+ -+static HRESULT WINAPI AudioSessionManager_GetSessionEnumerator( -+ IAudioSessionManager2 *iface, IAudioSessionEnumerator **out) -+{ -+ SessionMgr *This = impl_from_IAudioSessionManager2(iface); -+ FIXME("(%p)->(%p) - stub\n", This, out); -+ return E_NOTIMPL; -+} -+ -+static HRESULT WINAPI AudioSessionManager_RegisterSessionNotification( -+ IAudioSessionManager2 *iface, IAudioSessionNotification *notification) -+{ -+ SessionMgr *This = impl_from_IAudioSessionManager2(iface); -+ FIXME("(%p)->(%p) - stub\n", This, notification); -+ return E_NOTIMPL; -+} -+ -+static HRESULT WINAPI AudioSessionManager_UnregisterSessionNotification( -+ IAudioSessionManager2 *iface, IAudioSessionNotification *notification) -+{ -+ SessionMgr *This = impl_from_IAudioSessionManager2(iface); -+ FIXME("(%p)->(%p) - stub\n", This, notification); -+ return E_NOTIMPL; -+} -+ -+static HRESULT WINAPI AudioSessionManager_RegisterDuckNotification( -+ IAudioSessionManager2 *iface, const WCHAR *session_id, -+ IAudioVolumeDuckNotification *notification) -+{ -+ SessionMgr *This = impl_from_IAudioSessionManager2(iface); -+ FIXME("(%p)->(%p) - stub\n", This, notification); -+ return E_NOTIMPL; -+} -+ -+static HRESULT WINAPI AudioSessionManager_UnregisterDuckNotification( -+ IAudioSessionManager2 *iface, -+ IAudioVolumeDuckNotification *notification) -+{ -+ SessionMgr *This = impl_from_IAudioSessionManager2(iface); -+ FIXME("(%p)->(%p) - stub\n", This, notification); -+ return E_NOTIMPL; -+} -+ -+static const IAudioSessionManager2Vtbl AudioSessionManager2_Vtbl = -+{ -+ AudioSessionManager_QueryInterface, -+ AudioSessionManager_AddRef, -+ AudioSessionManager_Release, -+ AudioSessionManager_GetAudioSessionControl, -+ AudioSessionManager_GetSimpleAudioVolume, -+ AudioSessionManager_GetSessionEnumerator, -+ AudioSessionManager_RegisterSessionNotification, -+ AudioSessionManager_UnregisterSessionNotification, -+ AudioSessionManager_RegisterDuckNotification, -+ AudioSessionManager_UnregisterDuckNotification -+}; -+ -+static HRESULT WINAPI SimpleAudioVolume_QueryInterface( -+ ISimpleAudioVolume *iface, REFIID riid, void **ppv) -+{ -+ TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), ppv); -+ -+ if (!ppv) -+ return E_POINTER; -+ *ppv = NULL; -+ -+ if (IsEqualIID(riid, &IID_IUnknown) || -+ IsEqualIID(riid, &IID_ISimpleAudioVolume)) -+ *ppv = iface; -+ if (*ppv) { -+ IUnknown_AddRef((IUnknown*)*ppv); -+ return S_OK; -+ } -+ -+ WARN("Unknown interface %s\n", debugstr_guid(riid)); -+ return E_NOINTERFACE; -+} -+ -+static ULONG WINAPI SimpleAudioVolume_AddRef(ISimpleAudioVolume *iface) -+{ -+ AudioSessionWrapper *This = impl_from_ISimpleAudioVolume(iface); -+ return AudioSessionControl_AddRef(&This->IAudioSessionControl2_iface); -+} -+ -+static ULONG WINAPI SimpleAudioVolume_Release(ISimpleAudioVolume *iface) -+{ -+ AudioSessionWrapper *This = impl_from_ISimpleAudioVolume(iface); -+ return AudioSessionControl_Release(&This->IAudioSessionControl2_iface); -+} -+ -+static HRESULT WINAPI SimpleAudioVolume_SetMasterVolume( -+ ISimpleAudioVolume *iface, float level, const GUID *context) -+{ -+ AudioSessionWrapper *This = impl_from_ISimpleAudioVolume(iface); -+ AudioSession *session = This->session; -+ -+ TRACE("(%p)->(%f, %s)\n", session, level, wine_dbgstr_guid(context)); -+ -+ if (level < 0.f || level > 1.f) -+ return E_INVALIDARG; -+ -+ if (context) -+ FIXME("Notifications not supported yet\n"); -+ -+ TRACE("Pulseaudio does not support session volume control\n"); -+ -+ pthread_mutex_lock(&pulse_lock); -+ session->master_vol = level; -+ pthread_mutex_unlock(&pulse_lock); -+ -+ return S_OK; -+} -+ -+static HRESULT WINAPI SimpleAudioVolume_GetMasterVolume( -+ ISimpleAudioVolume *iface, float *level) -+{ -+ AudioSessionWrapper *This = impl_from_ISimpleAudioVolume(iface); -+ AudioSession *session = This->session; -+ -+ TRACE("(%p)->(%p)\n", session, level); -+ -+ if (!level) -+ return NULL_PTR_ERR; -+ -+ *level = session->master_vol; -+ -+ return S_OK; -+} -+ -+static HRESULT WINAPI SimpleAudioVolume_SetMute(ISimpleAudioVolume *iface, -+ BOOL mute, const GUID *context) -+{ -+ AudioSessionWrapper *This = impl_from_ISimpleAudioVolume(iface); -+ AudioSession *session = This->session; -+ -+ TRACE("(%p)->(%u, %p)\n", session, mute, context); -+ -+ if (context) -+ FIXME("Notifications not supported yet\n"); -+ -+ session->mute = mute; -+ -+ return S_OK; -+} -+ -+static HRESULT WINAPI SimpleAudioVolume_GetMute(ISimpleAudioVolume *iface, -+ BOOL *mute) -+{ -+ AudioSessionWrapper *This = impl_from_ISimpleAudioVolume(iface); -+ AudioSession *session = This->session; -+ -+ TRACE("(%p)->(%p)\n", session, mute); -+ -+ if (!mute) -+ return NULL_PTR_ERR; -+ -+ *mute = session->mute; -+ -+ return S_OK; -+} -+ -+static const ISimpleAudioVolumeVtbl SimpleAudioVolume_Vtbl = -+{ -+ SimpleAudioVolume_QueryInterface, -+ SimpleAudioVolume_AddRef, -+ SimpleAudioVolume_Release, -+ SimpleAudioVolume_SetMasterVolume, -+ SimpleAudioVolume_GetMasterVolume, -+ SimpleAudioVolume_SetMute, -+ SimpleAudioVolume_GetMute -+}; -+ -+static HRESULT WINAPI ChannelAudioVolume_QueryInterface( -+ IChannelAudioVolume *iface, REFIID riid, void **ppv) -+{ -+ TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), ppv); -+ -+ if (!ppv) -+ return E_POINTER; -+ *ppv = NULL; -+ -+ if (IsEqualIID(riid, &IID_IUnknown) || -+ IsEqualIID(riid, &IID_IChannelAudioVolume)) -+ *ppv = iface; -+ if (*ppv) { -+ IUnknown_AddRef((IUnknown*)*ppv); -+ return S_OK; -+ } -+ -+ WARN("Unknown interface %s\n", debugstr_guid(riid)); -+ return E_NOINTERFACE; -+} -+ -+static ULONG WINAPI ChannelAudioVolume_AddRef(IChannelAudioVolume *iface) -+{ -+ AudioSessionWrapper *This = impl_from_IChannelAudioVolume(iface); -+ return AudioSessionControl_AddRef(&This->IAudioSessionControl2_iface); -+} -+ -+static ULONG WINAPI ChannelAudioVolume_Release(IChannelAudioVolume *iface) -+{ -+ AudioSessionWrapper *This = impl_from_IChannelAudioVolume(iface); -+ return AudioSessionControl_Release(&This->IAudioSessionControl2_iface); -+} -+ -+static HRESULT WINAPI ChannelAudioVolume_GetChannelCount( -+ IChannelAudioVolume *iface, UINT32 *out) -+{ -+ AudioSessionWrapper *This = impl_from_IChannelAudioVolume(iface); -+ AudioSession *session = This->session; -+ -+ TRACE("(%p)->(%p)\n", session, out); -+ -+ if (!out) -+ return NULL_PTR_ERR; -+ -+ *out = session->channel_count; -+ -+ return S_OK; -+} -+ -+static HRESULT WINAPI ChannelAudioVolume_SetChannelVolume( -+ IChannelAudioVolume *iface, UINT32 index, float level, -+ const GUID *context) -+{ -+ AudioSessionWrapper *This = impl_from_IChannelAudioVolume(iface); -+ AudioSession *session = This->session; -+ -+ TRACE("(%p)->(%d, %f, %s)\n", session, index, level, -+ wine_dbgstr_guid(context)); -+ -+ if (level < 0.f || level > 1.f) -+ return E_INVALIDARG; -+ -+ if (index >= session->channel_count) -+ return E_INVALIDARG; -+ -+ if (context) -+ FIXME("Notifications not supported yet\n"); -+ -+ TRACE("Pulseaudio does not support session volume control\n"); -+ -+ pthread_mutex_lock(&pulse_lock); -+ session->channel_vols[index] = level; -+ pthread_mutex_unlock(&pulse_lock); -+ -+ return S_OK; -+} -+ -+static HRESULT WINAPI ChannelAudioVolume_GetChannelVolume( -+ IChannelAudioVolume *iface, UINT32 index, float *level) -+{ -+ AudioSessionWrapper *This = impl_from_IChannelAudioVolume(iface); -+ AudioSession *session = This->session; -+ -+ TRACE("(%p)->(%d, %p)\n", session, index, level); -+ -+ if (!level) -+ return NULL_PTR_ERR; -+ -+ if (index >= session->channel_count) -+ return E_INVALIDARG; -+ -+ *level = session->channel_vols[index]; -+ -+ return S_OK; -+} -+ -+static HRESULT WINAPI ChannelAudioVolume_SetAllVolumes( -+ IChannelAudioVolume *iface, UINT32 count, const float *levels, -+ const GUID *context) -+{ -+ AudioSessionWrapper *This = impl_from_IChannelAudioVolume(iface); -+ AudioSession *session = This->session; -+ int i; -+ -+ TRACE("(%p)->(%d, %p, %s)\n", session, count, levels, -+ wine_dbgstr_guid(context)); -+ -+ if (!levels) -+ return NULL_PTR_ERR; -+ -+ if (count != session->channel_count) -+ return E_INVALIDARG; -+ -+ if (context) -+ FIXME("Notifications not supported yet\n"); -+ -+ TRACE("Pulseaudio does not support session volume control\n"); -+ -+ pthread_mutex_lock(&pulse_lock); -+ for(i = 0; i < count; ++i) -+ session->channel_vols[i] = levels[i]; -+ pthread_mutex_unlock(&pulse_lock); -+ return S_OK; -+} -+ -+static HRESULT WINAPI ChannelAudioVolume_GetAllVolumes( -+ IChannelAudioVolume *iface, UINT32 count, float *levels) -+{ -+ AudioSessionWrapper *This = impl_from_IChannelAudioVolume(iface); -+ AudioSession *session = This->session; -+ int i; -+ -+ TRACE("(%p)->(%d, %p)\n", session, count, levels); -+ -+ if (!levels) -+ return NULL_PTR_ERR; -+ -+ if (count != session->channel_count) -+ return E_INVALIDARG; -+ -+ for(i = 0; i < count; ++i) -+ levels[i] = session->channel_vols[i]; -+ -+ return S_OK; -+} -+ -+static const IChannelAudioVolumeVtbl ChannelAudioVolume_Vtbl = -+{ -+ ChannelAudioVolume_QueryInterface, -+ ChannelAudioVolume_AddRef, -+ ChannelAudioVolume_Release, -+ ChannelAudioVolume_GetChannelCount, -+ ChannelAudioVolume_SetChannelVolume, -+ ChannelAudioVolume_GetChannelVolume, -+ ChannelAudioVolume_SetAllVolumes, -+ ChannelAudioVolume_GetAllVolumes -+}; -+ -+HRESULT WINAPI AUDDRV_GetAudioSessionManager(IMMDevice *device, -+ IAudioSessionManager2 **out) -+{ -+ SessionMgr *This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(SessionMgr)); -+ *out = NULL; -+ if (!This) -+ return E_OUTOFMEMORY; -+ This->IAudioSessionManager2_iface.lpVtbl = &AudioSessionManager2_Vtbl; -+ This->device = device; -+ This->ref = 1; -+ *out = &This->IAudioSessionManager2_iface; -+ return S_OK; -+} -diff --git a/dlls/winepulse.drv/winepulse.drv.spec b/dlls/winepulse.drv/winepulse.drv.spec -new file mode 100644 -index 0000000..612bf46 ---- /dev/null -+++ b/dlls/winepulse.drv/winepulse.drv.spec -@@ -0,0 +1,5 @@ -+# MMDevAPI driver functions -+@ stdcall -private GetPriority() AUDDRV_GetPriority -+@ stdcall -private GetEndpointIDs(long ptr ptr ptr ptr) AUDDRV_GetEndpointIDs -+@ stdcall -private GetAudioEndpoint(ptr ptr ptr) AUDDRV_GetAudioEndpoint -+@ stdcall -private GetAudioSessionManager(ptr ptr) AUDDRV_GetAudioSessionManager --- -1.7.3.4 - diff --git a/app-emulation/wine/files/wine-1.1.15-winegcc.patch b/app-emulation/wine/files/wine-1.1.15-winegcc.patch deleted file mode 100644 index a1cd890..0000000 --- a/app-emulation/wine/files/wine-1.1.15-winegcc.patch +++ /dev/null @@ -1,55 +0,0 @@ -http://bugs.gentoo.org/260726 - ---- wine-1.1.15/tools/winegcc/winegcc.c -+++ wine-1.1.15/tools/winegcc/winegcc.c -@@ -215,10 +215,13 @@ - strarray* files; - }; - -+#undef FORCE_POINTER_SIZE - #ifdef __i386__ - static const enum target_cpu build_cpu = CPU_x86; -+#define FORCE_POINTER_SIZE - #elif defined(__x86_64__) - static const enum target_cpu build_cpu = CPU_x86_64; -+#define FORCE_POINTER_SIZE - #elif defined(__sparc__) - static const enum target_cpu build_cpu = CPU_SPARC; - #elif defined(__ALPHA__) -@@ -968,6 +971,9 @@ - opts.linker_args = strarray_alloc(); - opts.compiler_args = strarray_alloc(); - opts.winebuild_args = strarray_alloc(); -+#ifdef FORCE_POINTER_SIZE -+ opts.force_pointer_size = sizeof(size_t); -+#endif - - /* determine the processor type */ - if (strendswith(argv[0], "winecpp")) opts.processor = proc_cpp; ---- wine-1.1.15/tools/winebuild/main.c -+++ wine-1.1.15/tools/winebuild/main.c -@@ -50,10 +50,13 @@ - int link_ext_symbols = 0; - int force_pointer_size = 0; - -+#undef FORCE_POINTER_SIZE - #ifdef __i386__ - enum target_cpu target_cpu = CPU_x86; -+#define FORCE_POINTER_SIZE - #elif defined(__x86_64__) - enum target_cpu target_cpu = CPU_x86_64; -+#define FORCE_POINTER_SIZE - #elif defined(__sparc__) - enum target_cpu target_cpu = CPU_SPARC; - #elif defined(__ALPHA__) -@@ -574,6 +577,10 @@ - signal( SIGTERM, exit_on_signal ); - signal( SIGINT, exit_on_signal ); - -+#ifdef FORCE_POINTER_SIZE -+ force_pointer_size = sizeof(size_t); -+#endif -+ - output_file = stdout; - argv = parse_options( argc, argv, spec ); - diff --git a/app-emulation/wine/files/wine-1.4_rc2-multilib-portage.patch b/app-emulation/wine/files/wine-1.4_rc2-multilib-portage.patch deleted file mode 100644 index be6ffc5..0000000 --- a/app-emulation/wine/files/wine-1.4_rc2-multilib-portage.patch +++ /dev/null @@ -1,40 +0,0 @@ -https://bugs.gentoo.org/show_bug.cgi?id=395615 - -Explicitly add the required -m32/m64 to *FLAGS; this overrides any -arch-specific -m* flags that may have been appended by multilib-portage. - -Even though -m32/m64 is now added to *FLAGS, -m32/m64 still has to be -explicitly added to CC and CXX due to wine's build system. For example, -winegcc saves the build-time value of CC and uses it at runtime. - ---- a/configure.ac -+++ b/configure.ac -@@ -133,12 +133,18 @@ - then - CC="$CC -m64" - CXX="$CXX -m64" -+ CFLAGS="$CFLAGS -m64" -+ LDFLAGS="$LDFLAGS -m64" -+ CXXFLAGS="$CXXFLAGS -m64" - host_cpu="x86_64" - notice_platform="64-bit " - AC_SUBST(TARGETFLAGS,"-m64") - else - CC="$CC -m32" - CXX="$CXX -m32" -+ CFLAGS="$CFLAGS -m32" -+ LDFLAGS="$LDFLAGS -m32" -+ CXXFLAGS="$CXXFLAGS -m32" - host_cpu="i386" - notice_platform="32-bit " - AC_SUBST(TARGETFLAGS,"-m32") -@@ -150,6 +156,9 @@ - then - CC="$CC -m32" - CXX="$CXX -m32" -+ CFLAGS="$CFLAGS -m32" -+ LDFLAGS="$LDFLAGS -m32" -+ CXXFLAGS="$CXXFLAGS -m32" - AC_MSG_CHECKING([whether $CC works]) - AC_LINK_IFELSE([AC_LANG_PROGRAM()],AC_MSG_RESULT([yes]), - [AC_MSG_RESULT([no]) diff --git a/app-emulation/wine/files/wine-1.5.10-osmesa-check.patch b/app-emulation/wine/files/wine-1.5.10-osmesa-check.patch deleted file mode 100644 index 86d90ca..0000000 --- a/app-emulation/wine/files/wine-1.5.10-osmesa-check.patch +++ /dev/null @@ -1,33 +0,0 @@ -From a233e35ca650db2758de0fd31450b8ce2d86d5e3 Mon Sep 17 00:00:00 2001 -From: Alexandre Rostovtsev -Date: Tue, 7 Aug 2012 01:29:01 -0400 -Subject: [PATCH] Do not check for libGL symbols when checking libOSMesa - -If mesa had been built with shared glapi, glAccum is not available in -libOSMesa without explicitly linking to libGL. In addition, in -mesa-8.0.x and earlier, libOSMesa needs to be explicitly linked to -libglapi if mesa was built with shared glapi, see -https://bugs.gentoo.org/show_bug.cgi?id=399813 ---- - configure.ac | 5 ++++- - 1 files changed, 4 insertions(+), 1 deletions(-) - -diff --git a/configure.ac b/configure.ac -index 4bd43d1..c7a718f 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -1132,7 +1132,10 @@ This probably prevents linking to OpenGL. Try deleting the file and restarting c - - if test "$ac_cv_header_GL_osmesa_h" = "yes" - then -- WINE_CHECK_SONAME(OSMesa,glAccum,,,[$X_LIBS $X_PRE_LIBS $XLIB -lm $X_EXTRA_LIBS]) -+ WINE_CHECK_SONAME(OSMesa,OSMesaCreateContext,,,[$X_LIBS $X_PRE_LIBS $XLIB -lm $X_EXTRA_LIBS]) -+ if test "x$ac_cv_lib_soname_OSMesa" = "x"; then -+ WINE_CHECK_SONAME(OSMesa,OSMesaCreateContext,,,[-lglapi $X_LIBS $X_PRE_LIBS $XLIB -lm $X_EXTRA_LIBS]) -+ fi - fi - WINE_NOTICE_WITH(osmesa,[test "x$ac_cv_lib_soname_OSMesa" = "x"], - [libOSMesa ${notice_platform}development files not found (or too old), OpenGL rendering in bitmaps won't be supported.]) --- -1.7.8.6 - diff --git a/app-emulation/wine/wine-1.4.ebuild b/app-emulation/wine/wine-1.4.ebuild deleted file mode 100644 index ab81560..0000000 --- a/app-emulation/wine/wine-1.4.ebuild +++ /dev/null @@ -1,232 +0,0 @@ -# Copyright 1999-2012 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/app-emulation/wine/wine-1.4.ebuild,v 1.1 2012/03/07 23:49:32 tetromino Exp $ - -EAPI="4" - -inherit autotools eutils flag-o-matic multilib pax-utils - -if [[ ${PV} == "9999" ]] ; then - EGIT_REPO_URI="git://source.winehq.org/git/wine.git" - inherit git-2 - SRC_URI="" - #KEYWORDS="" -else - MY_P="${PN}-${PV/_/-}" - SRC_URI="mirror://sourceforge/${PN}/${MY_P}.tar.bz2" - KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd" - S=${WORKDIR}/${MY_P} -fi - -GV="1.4" -DESCRIPTION="free implementation of Windows(tm) on Unix" -HOMEPAGE="http://www.winehq.org/" -SRC_URI="${SRC_URI} - gecko? ( - mirror://sourceforge/wine/wine_gecko-${GV}-x86.msi - win64? ( mirror://sourceforge/wine/wine_gecko-${GV}-x86_64.msi ) - )" - -LICENSE="LGPL-2.1" -SLOT="0" -IUSE="alsa capi cups custom-cflags elibc_glibc fontconfig +gecko gnutls gphoto2 -gsm gstreamer hardened jpeg lcms ldap mp3 ncurses nls odbc openal opencl +opengl -+oss +perl png pulseaudio samba scanner selinux ssl test +threads +truetype udisks v4l +win32 +win64 +X xcomposite xinerama xml" -REQUIRED_USE="elibc_glibc? ( threads )" #286560 -RESTRICT="test" #72375 - -MLIB_DEPS="amd64? ( - truetype? ( >=app-emulation/emul-linux-x86-xlibs-2.1 ) - X? ( - >=app-emulation/emul-linux-x86-xlibs-2.1 - >=app-emulation/emul-linux-x86-soundlibs-2.1 - ) - mp3? ( app-emulation/emul-linux-x86-soundlibs ) - odbc? ( app-emulation/emul-linux-x86-db ) - openal? ( app-emulation/emul-linux-x86-sdl ) - opengl? ( app-emulation/emul-linux-x86-opengl ) - scanner? ( app-emulation/emul-linux-x86-medialibs ) - v4l? ( app-emulation/emul-linux-x86-medialibs ) - app-emulation/emul-linux-x86-baselibs - >=sys-kernel/linux-headers-2.6 - )" -RDEPEND="truetype? ( >=media-libs/freetype-2.0.0 media-fonts/corefonts ) - perl? ( dev-lang/perl dev-perl/XML-Simple ) - capi? ( net-dialup/capi4k-utils ) - ncurses? ( >=sys-libs/ncurses-5.2 ) - fontconfig? ( media-libs/fontconfig ) - gphoto2? ( media-libs/libgphoto2 ) - openal? ( media-libs/openal ) - udisks? ( - sys-apps/dbus - sys-fs/udisks - ) - gnutls? ( net-libs/gnutls ) - gstreamer? ( media-libs/gstreamer media-libs/gst-plugins-base ) - X? ( - x11-libs/libXcursor - x11-libs/libXrandr - x11-libs/libXi - x11-libs/libXmu - x11-libs/libXxf86vm - x11-apps/xmessage - ) - xinerama? ( x11-libs/libXinerama ) - alsa? ( media-libs/alsa-lib ) - cups? ( net-print/cups ) - opencl? ( virtual/opencl ) - opengl? ( virtual/opengl ) - gsm? ( media-sound/gsm ) - jpeg? ( virtual/jpeg ) - ldap? ( net-nds/openldap ) - lcms? ( =media-libs/lcms-1* ) - mp3? ( >=media-sound/mpg123-1.5.0 ) - nls? ( sys-devel/gettext ) - odbc? ( dev-db/unixODBC ) - samba? ( >=net-fs/samba-3.0.25 ) - selinux? ( sec-policy/selinux-wine ) - xml? ( dev-libs/libxml2 dev-libs/libxslt ) - scanner? ( media-gfx/sane-backends ) - ssl? ( dev-libs/openssl ) - png? ( media-libs/libpng ) - v4l? ( media-libs/libv4l ) - !win64? ( ${MLIB_DEPS} ) - win32? ( ${MLIB_DEPS} ) - xcomposite? ( x11-libs/libXcomposite ) - pulseaudio? ( media-sound/pulseaudio )" -DEPEND="${RDEPEND} - X? ( - x11-proto/inputproto - x11-proto/xextproto - x11-proto/xf86vidmodeproto - ) - xinerama? ( x11-proto/xineramaproto ) - !hardened? ( sys-devel/prelink ) - dev-util/pkgconfig - virtual/yacc - sys-devel/flex" - -src_unpack() { - if use win64 ; then - [[ $(( $(gcc-major-version) * 100 + $(gcc-minor-version) )) -lt 404 ]] \ - && die "you need gcc-4.4+ to build 64bit wine" - fi - - if use win32 && use opencl; then - [[ x$(eselect opencl show) = "xintel" ]] && - die "Cannot build wine[opencl,win32]: intel-ocl-sdk is 64-bit only" # 403947 - fi - - if [[ ${PV} == "9999" ]] ; then - git-2_src_unpack - else - unpack ${MY_P}.tar.bz2 - fi -} - -src_prepare() { - epatch "${FILESDIR}"/${PN}-1.1.15-winegcc.patch #260726 - epatch "${FILESDIR}"/${PN}-1.4_rc2-multilib-portage.patch #395615 - epatch "${FILESDIR}"/pulseaudio.patch - epatch_user #282735 - eautoreconf - sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die - sed -i '/^MimeType/d' tools/wine.desktop || die #117785 -} - -do_configure() { - local builddir="${WORKDIR}/wine$1" - mkdir -p "${builddir}" - pushd "${builddir}" >/dev/null - - ECONF_SOURCE=${S} \ - econf \ - --sysconfdir=/etc/wine \ - $(use_with alsa) \ - $(use_with capi) \ - $(use_with lcms cms) \ - $(use_with cups) \ - $(use_with ncurses curses) \ - $(use_with udisks dbus) \ - $(use_with fontconfig) \ - $(use_with gnutls) \ - $(use_with gphoto2 gphoto) \ - $(use_with gsm) \ - $(use_with gstreamer) \ - --without-hal \ - $(use_with jpeg) \ - $(use_with ldap) \ - $(use_with mp3 mpg123) \ - $(use_with nls gettext) \ - $(use_with openal) \ - $(use_with opencl) \ - $(use_with opengl) \ - $(use_with ssl openssl) \ - $(use_with oss) \ - $(use_with png) \ - $(use_with pulseaudio) \ - $(use_with threads pthread) \ - $(use_with scanner sane) \ - $(use_enable test tests) \ - $(use_with truetype freetype) \ - $(use_with v4l) \ - $(use_with X x) \ - $(use_with xcomposite) \ - $(use_with xinerama) \ - $(use_with xml) \ - $(use_with xml xslt) \ - $2 - - emake -j1 depend - - popd >/dev/null -} - -src_configure() { - export LDCONFIG=/bin/true - use custom-cflags || strip-flags - - if use win64 ; then - do_configure 64 --enable-win64 - use win32 && ABI=x86 do_configure 32 --with-wine64=../wine64 - else - ABI=x86 do_configure 32 --disable-win64 - fi -} - -src_compile() { - local b - for b in 64 32 ; do - local builddir="${WORKDIR}/wine${b}" - [[ -d ${builddir} ]] || continue - emake -C "${builddir}" all - done -} - -src_install() { - local b - for b in 64 32 ; do - local builddir="${WORKDIR}/wine${b}" - [[ -d ${builddir} ]] || continue - emake -C "${builddir}" install DESTDIR="${D}" - done - dodoc ANNOUNCE AUTHORS README - if use gecko ; then - insinto /usr/share/wine/gecko - doins "${DISTDIR}"/wine_gecko-${GV}-x86.msi - use win64 && doins "${DISTDIR}"/wine_gecko-${GV}-x86_64.msi - fi - if ! use perl ; then - rm "${D}"usr/bin/{wine{dump,maker},function_grep.pl} "${D}"usr/share/man/man1/wine{dump,maker}.1 || die - fi - - if use win32 || ! use win64; then - pax-mark psmr "${D}"usr/bin/wine{,-preloader} #255055 - fi - use win64 && pax-mark psmr "${D}"usr/bin/wine64{,-preloader} - - if use win64 && ! use win32; then - dosym /usr/bin/wine{64,} # 404331 - dosym /usr/bin/wine{64,}-preloader - fi -} diff --git a/app-emulation/wine/wine-1.5.11.ebuild b/app-emulation/wine/wine-1.5.11.ebuild deleted file mode 100644 index 2e53f98..0000000 --- a/app-emulation/wine/wine-1.5.11.ebuild +++ /dev/null @@ -1,249 +0,0 @@ -# Copyright 1999-2012 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/app-emulation/wine/wine-1.5.11.ebuild,v 1.1 2012/08/18 00:03:20 tetromino Exp $ - -EAPI="4" - -inherit autotools eutils flag-o-matic multilib pax-utils - -if [[ ${PV} == "9999" ]] ; then - EGIT_REPO_URI="git://source.winehq.org/git/wine.git" - inherit git-2 - SRC_URI="" - #KEYWORDS="" -else - MY_P="${PN}-${PV/_/-}" - SRC_URI="mirror://sourceforge/${PN}/Source/${MY_P}.tar.bz2" - KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd" - S=${WORKDIR}/${MY_P} -fi - -GV="1.7" -MV="0.0.4" -PULSE_PATCH="winepulse-2012.06.15.patch" -DESCRIPTION="free implementation of Windows(tm) on Unix" -HOMEPAGE="http://www.winehq.org/" -SRC_URI="${SRC_URI} - gecko? ( - mirror://sourceforge/${PN}/Wine%20Gecko/${GV}/wine_gecko-${GV}-x86.msi - win64? ( mirror://sourceforge/${PN}/Wine%20Gecko/${GV}/wine_gecko-${GV}-x86_64.msi ) - ) - mono? ( mirror://sourceforge/${PN}/Wine%20Mono/${MV}/wine-mono-${MV}.msi ) - http://source.winehq.org/patches/data/87234 -> ${PULSE_PATCH}" - -LICENSE="LGPL-2.1" -SLOT="0" -IUSE="alsa capi cups custom-cflags elibc_glibc fontconfig +gecko gnutls gphoto2 gsm gstreamer hardened jpeg lcms ldap +mono mp3 ncurses nls odbc openal opencl +opengl osmesa +oss +perl png pulseaudio samba scanner selinux ssl test +threads +truetype udisks v4l +win32 +win64 +X xcomposite xinerama xml" -REQUIRED_USE="elibc_glibc? ( threads ) - mono? ( || ( win32 !win64 ) ) - osmesa? ( opengl )" #286560 -RESTRICT="test" #72375 - -MLIB_DEPS="amd64? ( - truetype? ( >=app-emulation/emul-linux-x86-xlibs-2.1 ) - X? ( - >=app-emulation/emul-linux-x86-xlibs-2.1 - >=app-emulation/emul-linux-x86-soundlibs-2.1[pulseaudio(+)?] - ) - mp3? ( app-emulation/emul-linux-x86-soundlibs ) - odbc? ( app-emulation/emul-linux-x86-db ) - openal? ( app-emulation/emul-linux-x86-sdl ) - opengl? ( app-emulation/emul-linux-x86-opengl ) - scanner? ( app-emulation/emul-linux-x86-medialibs ) - v4l? ( app-emulation/emul-linux-x86-medialibs ) - app-emulation/emul-linux-x86-baselibs - >=sys-kernel/linux-headers-2.6 - )" -RDEPEND="truetype? ( >=media-libs/freetype-2.0.0 media-fonts/corefonts ) - perl? ( dev-lang/perl dev-perl/XML-Simple ) - capi? ( net-dialup/capi4k-utils ) - ncurses? ( >=sys-libs/ncurses-5.2 ) - fontconfig? ( media-libs/fontconfig ) - gphoto2? ( media-libs/libgphoto2 ) - openal? ( media-libs/openal ) - udisks? ( - sys-apps/dbus - sys-fs/udisks:2 - ) - gnutls? ( net-libs/gnutls ) - gstreamer? ( media-libs/gstreamer media-libs/gst-plugins-base ) - X? ( - x11-libs/libXcursor - x11-libs/libXrandr - x11-libs/libXi - x11-libs/libXmu - x11-libs/libXxf86vm - ) - xinerama? ( x11-libs/libXinerama ) - alsa? ( media-libs/alsa-lib ) - cups? ( net-print/cups ) - opencl? ( virtual/opencl ) - opengl? ( virtual/opengl ) - gsm? ( media-sound/gsm ) - jpeg? ( virtual/jpeg ) - ldap? ( net-nds/openldap ) - lcms? ( =media-libs/lcms-1* ) - mp3? ( >=media-sound/mpg123-1.5.0 ) - nls? ( sys-devel/gettext ) - odbc? ( dev-db/unixODBC ) - osmesa? ( media-libs/mesa[osmesa] ) - pulseaudio? ( media-sound/pulseaudio ) - samba? ( >=net-fs/samba-3.0.25 ) - selinux? ( sec-policy/selinux-wine ) - xml? ( dev-libs/libxml2 dev-libs/libxslt ) - scanner? ( media-gfx/sane-backends ) - ssl? ( dev-libs/openssl ) - png? ( media-libs/libpng ) - v4l? ( media-libs/libv4l ) - !win64? ( ${MLIB_DEPS} ) - win32? ( ${MLIB_DEPS} ) - xcomposite? ( x11-libs/libXcomposite )" -DEPEND="${RDEPEND} - X? ( - x11-proto/inputproto - x11-proto/xextproto - x11-proto/xf86vidmodeproto - ) - xinerama? ( x11-proto/xineramaproto ) - !hardened? ( sys-devel/prelink ) - virtual/pkgconfig - virtual/yacc - sys-devel/flex" - -src_unpack() { - if use win64 ; then - [[ $(( $(gcc-major-version) * 100 + $(gcc-minor-version) )) -lt 404 ]] \ - && die "you need gcc-4.4+ to build 64bit wine" - fi - - if use win32 && use opencl; then - [[ x$(eselect opencl show) = "xintel" ]] && - die "Cannot build wine[opencl,win32]: intel-ocl-sdk is 64-bit only" # 403947 - fi - - if [[ ${PV} == "9999" ]] ; then - git-2_src_unpack - else - unpack ${MY_P}.tar.bz2 - fi -} - -src_prepare() { - epatch "${FILESDIR}"/${PN}-1.1.15-winegcc.patch #260726 - epatch "${FILESDIR}"/${PN}-1.4_rc2-multilib-portage.patch #395615 - epatch "${FILESDIR}"/${PN}-1.5.10-osmesa-check.patch #429386 - # epatch "${DISTDIR}/${PULSE_PATCH}" #421365 - epatch "${FILESDIR}"/pulseaudio.patch - epatch_user #282735 - eautoreconf - sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die - sed -i '/^MimeType/d' tools/wine.desktop || die #117785 -} - -do_configure() { - local builddir="${WORKDIR}/wine$1" - mkdir -p "${builddir}" - pushd "${builddir}" >/dev/null - - with_osmesa=$(use_with osmesa) - if use osmesa && use amd64 && [[ $1 = 32 ]]; then #430268 - elog "win32 osmesa support is disabled for now, see bug #430268" - with_osmesa=--without-osmesa - fi - - ECONF_SOURCE=${S} \ - econf \ - --sysconfdir=/etc/wine \ - $(use_with alsa) \ - $(use_with capi) \ - $(use_with lcms cms) \ - $(use_with cups) \ - $(use_with ncurses curses) \ - $(use_with udisks dbus) \ - $(use_with fontconfig) \ - $(use_with gnutls) \ - $(use_with gphoto2 gphoto) \ - $(use_with gsm) \ - $(use_with gstreamer) \ - --without-hal \ - $(use_with jpeg) \ - $(use_with ldap) \ - $(use_with mp3 mpg123) \ - $(use_with nls gettext) \ - $(use_with openal) \ - $(use_with opencl) \ - $(use_with opengl) \ - $(use_with ssl openssl) \ - ${with_osmesa} \ - $(use_with oss) \ - $(use_with png) \ - $(use_with threads pthread) \ - $(use_with pulseaudio) \ - $(use_with scanner sane) \ - $(use_enable test tests) \ - $(use_with truetype freetype) \ - $(use_with v4l) \ - $(use_with X x) \ - $(use_with xcomposite) \ - $(use_with xinerama) \ - $(use_with xml) \ - $(use_with xml xslt) \ - $2 - - emake -j1 depend - - popd >/dev/null -} - -src_configure() { - export LDCONFIG=/bin/true - use custom-cflags || strip-flags - - if use win64 ; then - do_configure 64 --enable-win64 - use win32 && ABI=x86 do_configure 32 --with-wine64=../wine64 - else - ABI=x86 do_configure 32 --disable-win64 - fi -} - -src_compile() { - local b - for b in 64 32 ; do - local builddir="${WORKDIR}/wine${b}" - [[ -d ${builddir} ]] || continue - emake -C "${builddir}" all - done -} - -src_install() { - local b - for b in 64 32 ; do - local builddir="${WORKDIR}/wine${b}" - [[ -d ${builddir} ]] || continue - emake -C "${builddir}" install DESTDIR="${D}" - done - dodoc ANNOUNCE AUTHORS README - if use gecko ; then - insinto /usr/share/wine/gecko - doins "${DISTDIR}"/wine_gecko-${GV}-x86.msi - use win64 && doins "${DISTDIR}"/wine_gecko-${GV}-x86_64.msi - fi - if use mono ; then - insinto /usr/share/wine/mono - doins "${DISTDIR}"/wine-mono-${MV}.msi - fi - if ! use perl ; then - rm "${D}"usr/bin/{wine{dump,maker},function_grep.pl} "${D}"usr/share/man/man1/wine{dump,maker}.1 || die - fi - - if use win32 || ! use win64; then - pax-mark psmr "${D}"usr/bin/wine{,-preloader} #255055 - fi - use win64 && pax-mark psmr "${D}"usr/bin/wine64{,-preloader} - - if use win64 && ! use win32; then - dosym /usr/bin/wine{64,} # 404331 - dosym /usr/bin/wine{64,}-preloader - fi -} diff --git a/app-emulation/wine/wine.diff b/app-emulation/wine/wine.diff deleted file mode 100644 index dd103e4..0000000 --- a/app-emulation/wine/wine.diff +++ /dev/null @@ -1,21 +0,0 @@ ---- /mnt/portage/portage/app-emulation/wine/wine-1.5.10.ebuild 2012-08-07 01:06:43.000000000 -0700 -+++ wine-1.5.10.ebuild 2012-08-07 09:31:02.394262211 -0700 -@@ -133,7 +133,8 @@ - epatch "${FILESDIR}"/${PN}-1.1.15-winegcc.patch #260726 - epatch "${FILESDIR}"/${PN}-1.4_rc2-multilib-portage.patch #395615 - epatch "${FILESDIR}"/${PN}-1.5.10-osmesa-check.patch #429386 -- epatch "${DISTDIR}/${PULSE_PATCH}" #421365 -+ # epatch "${DISTDIR}/${PULSE_PATCH}" #421365 -+ epatch "${FILESDIR}"/pulseaudio.patch - epatch_user #282735 - eautoreconf - sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die -@@ -178,7 +179,7 @@ - $(use_with oss) \ - $(use_with png) \ - $(use_with threads pthread) \ -- $(use_with pulseaudio pulse) \ -+ $(use_with pulseaudio) \ - $(use_with scanner sane) \ - $(use_enable test tests) \ - $(use_with truetype freetype) \ diff --git a/x11-drivers/nvidia-drivers/Manifest b/x11-drivers/nvidia-drivers/Manifest deleted file mode 100644 index 476619a..0000000 --- a/x11-drivers/nvidia-drivers/Manifest +++ /dev/null @@ -1,18 +0,0 @@ -AUX nvidia-169.07 639 RMD160 8baddb6fd1bf7f0e2688870a78e8ace051d62e3f SHA1 b30487ba2a24a6b1359d1fd831eeb1705060953c SHA256 a8c4860f008d53776fda7a17b59524f271236559af688e9a2c9845cbbcba1577 -AUX nvidia-autostart.desktop 227 RMD160 d057866bb52d20295a631a3f90b2e0628a65bd21 SHA1 319f959724171fa85639bbb451cf3882ab88f512 SHA256 850c22fad5ac5a0cf6795b47cfc34f88f151f2802fa1256d2c2422108d59400a -AUX nvidia-drivers-pax-const.patch 833 RMD160 100c36ed4c7db0f30c0680b276a708cd5ed75749 SHA1 b336665366340fec6bd400f36d3e4b9de86473f5 SHA256 74ba8aa3b03e1b4a0515fd84c159eaeb7635fa1364e77544b01ff6f571f0e6d8 -AUX nvidia-drivers-pax-usercopy.patch 2350 RMD160 c102590aba1b4191c08fc0ac045640bab3f8f5e2 SHA1 5cd57aef42db6dbb5cf97ed773ec632d3a5f3ec7 SHA256 56980f43db38d582bc6a9bfd881973fce6e3e056b77ce4f4005bdcf79526a863 -AUX nvidia-smi.init 671 RMD160 22a1b0b4f48312f8a10e869dd3976c1bb9c7e061 SHA1 ad3c5ccbfc4e7d451b7dff3080f56bebcd24ecb7 SHA256 5776a661b510e072d34e779c23dfc710a13d04c49acc22772d2aeb0e415820d6 -AUX nvidia-udev.sh 185 RMD160 26d8e7e1447daa7d4fd09993f855b58ae1754a72 SHA1 d607b57662e0542b335cbc86ed3c946bb522891f SHA256 120c0af2b64fbcbd7032217a78eec8b104874c1ca68726367bce22c57944e07e -AUX nvidia.udev-rule 462 RMD160 a7bc1d61d75a7fd7847903064ae5974e4079db5a SHA1 ac04cf8838bab05d5c092446d34c0154b9f6220e SHA256 37b152a5055a16d1947171567178e2841679ddf03dba9d48e7d30f1e3b469ac6 -DIST NVIDIA-FreeBSD-x86-295.59.tar.gz 32092806 SHA256 9a3e1794418add03ad97aad93608d1bc1f2f9c5a82e0321a2a8ba1c9db7d41dd SHA512 e6bb158b8c1bad81068a000b9a4848d038bee2c78519b8a4f61627dd63e84baf233b2328aa4e7b56d9b2de862f1e67318ee67a332e6f9002171ecc5cb157d419 WHIRLPOOL 6b2ba86629d3364b1efb988227860c998e6d0f3161252a742c46600ebe8b7d1f22e4e9d5368067deff8df191be975f05db8df6200d7747d9dd2a7c135713ef89 -DIST NVIDIA-FreeBSD-x86-304.37.tar.gz 33291575 RMD160 b72600868b2237a4d6eb3af93e2aba75195cba74 SHA1 6bc5e80d051cd76e6ea246a3495695fdde283966 SHA256 e6c3a1d4a757b5d4f2ab54a43d5d7008fcb1b481f14515f58adcd31f3edc6576 -DIST NVIDIA-FreeBSD-x86_64-295.59.tar.gz 33049711 SHA256 4993f2c4874c080352856b1eac529c7be61aff73ea9db7012a04a571f3553bfd SHA512 be7ddf23181386979b085825d0b22c0270a1acd3b17aba1468f16370db5ad7886d96d66eede213427f442c7e857e44e5a734aa5f20753d4ed9f4b2dc649dcad2 WHIRLPOOL c833c5a587645765b781cd869bccdab92fabd9ae133574c3698ec5b29d4b91ae93635de6fba962586af426e6b797b2a8f6c897af7958a0a596155c5cfd9ea6e0 -DIST NVIDIA-FreeBSD-x86_64-304.37.tar.gz 34210803 RMD160 b27019f04c4d9e7841af883cd5cf0fedecfa7b58 SHA1 57897fa95d4b49a5078bdb41a460e287b863588b SHA256 0d00046c8463954b6c8e13e245b2619758e947389161a113aa005ef7566e5dd3 -DIST NVIDIA-Linux-x86-295.59.run 34730118 SHA256 084bbb76c57d5c2a5b780322a95dcc230ec6e25b4f6c176574a93621399ce5a0 SHA512 91194816de17831e1abb4a2c80dac483dc78222a29921371d43a81626e3a6537468da663ca7a0c0c0a987d116801fce9f169d205beaaa061ab34c8e1818a7b82 WHIRLPOOL fe35d7f3edc5562fdbc2c6045889cb22cf87ff766e55ed68b9ebe0eeffe5c3d044306bbcad4b9086db921ca2489507ce6754803581156e118880fdaa35ec52f9 -DIST NVIDIA-Linux-x86-304.37.run 39349097 RMD160 e5507f4ae7e778113c55c06a24c8140fbbe182f5 SHA1 cb61d9062fa40a7800e8ba91ef2ae1d9625059b9 SHA256 ab3174a0c9ab37a8fc3f4a8fc1121d72fbdd5e00ddecf44f7dbd84bb8d51b337 -DIST NVIDIA-Linux-x86_64-295.59.run 58529480 RMD160 de86cf0c445f3c6625e340fbc7f2340b49e9e466 SHA1 67a0b326172309e262d31f40d1f545f371ca374a SHA256 4b1d96389abd2b804ad470c5189142a02ee4c82c1ac56cea37ecb45e8051313e -DIST NVIDIA-Linux-x86_64-304.37.run 64075318 RMD160 485ceaf89f630a37b8094d8c84216deca4f9759c SHA1 3841a52212a8d03f02b2c0d8177bb46008f1e735 SHA256 cae75158047d0b97ea48f269fd2903a6731f53b978a1065720343436c97ca9c2 -EBUILD nvidia-drivers-295.59.ebuild 18723 RMD160 e8a593ba24bbf2f619b98e18d046498bba887f8f SHA1 9ae2717e9e1b21e525e9514a8f1468adb7e3fbcd SHA256 e4cc8079bdb25440819e152cb02eb45a032ffcaaa2c7108d8d5aac155e41c42f -EBUILD nvidia-drivers-304.37-r1.ebuild 12624 RMD160 ae2fca9d93a83efa3d9e6227e24a9f12321ca6e6 SHA1 3855149a930a7f692509306620f188498381cfb5 SHA256 270c3a4c95fdb6a6d409701b1beeafd918936f530498c7fe177abc9705565ec7 -MISC ebuild.diff 819 RMD160 5668203536b3d046ea030fdb4ba2daf148b3a1cb SHA1 963315046afaa709d62cbf5f591f93f2edfc5903 SHA256 3666c4509013c78d959f7095cf2d29dd7ede1488fed93974b00f81c92b553403 diff --git a/x11-drivers/nvidia-drivers/ebuild.diff b/x11-drivers/nvidia-drivers/ebuild.diff deleted file mode 100644 index cabda53..0000000 --- a/x11-drivers/nvidia-drivers/ebuild.diff +++ /dev/null @@ -1,24 +0,0 @@ ---- /mnt/portage/portage/x11-drivers/nvidia-drivers/nvidia-drivers-304.37-r1.ebuild 2012-08-21 22:01:31.000000000 -0700 -+++ nvidia-drivers-304.37-r1.ebuild 2012-08-22 21:13:33.716791429 -0700 -@@ -22,7 +22,7 @@ - LICENSE="NVIDIA" - SLOT="0" - KEYWORDS="-* ~amd64 ~x86 ~amd64-fbsd ~x86-fbsd" --IUSE="acpi multilib kernel_FreeBSD kernel_linux +tools +X" -+IUSE="acpi multilib kernel_FreeBSD kernel_linux pax_kernel +tools +X" - RESTRICT="strip" - EMULTILIB_PKG="true" - -@@ -139,6 +139,12 @@ - # If greater than 2.6.5 use M= instead of SUBDIR= - convert_to_m "${NV_SRC}"/Makefile.kbuild - fi -+ -+ if use pax_kernel; then -+ epatch "${FILESDIR}"/nvidia-drivers-pax-const.patch -+ epatch "${FILESDIR}"/nvidia-drivers-pax-usercopy.patch -+ fi -+ - cat <<- EOF > "${S}"/nvidia.icd - /usr/$(get_libdir)/libnvidia-opencl.so - EOF diff --git a/x11-drivers/nvidia-drivers/files/nvidia-169.07 b/x11-drivers/nvidia-drivers/files/nvidia-169.07 deleted file mode 100644 index a96b0cd..0000000 --- a/x11-drivers/nvidia-drivers/files/nvidia-169.07 +++ /dev/null @@ -1,14 +0,0 @@ -# Nvidia drivers support -alias char-major-195 nvidia -alias /dev/nvidiactl char-major-195 - -# To tweak the driver the following options can be used, note that -# you should be careful, as it could cause instability!! For more -# options see /usr/share/doc/PACKAGE/README -# -# !!! SECURITY WARNING !!! -# DO NOT MODIFY OR REMOVE THE DEVICE FILE RELATED OPTIONS UNLESS YOU KNOW -# WHAT YOU ARE DOING. -# ONLY ADD TRUSTED USERS TO THE VIDEO GROUP, THESE USERS MAY BE ABLE TO CRASH, -# COMPROMISE, OR IRREPARABLY DAMAGE THE MACHINE. -options nvidia NVreg_DeviceFileMode=432 NVreg_DeviceFileUID=0 NVreg_DeviceFileGID=VIDEOGID NVreg_ModifyDeviceFiles=1 diff --git a/x11-drivers/nvidia-drivers/files/nvidia-autostart.desktop b/x11-drivers/nvidia-drivers/files/nvidia-autostart.desktop deleted file mode 100644 index f6d0564..0000000 --- a/x11-drivers/nvidia-drivers/files/nvidia-autostart.desktop +++ /dev/null @@ -1,8 +0,0 @@ -[Desktop Entry] -Type=Application -Name=NVIDIA X Server Settings -Comment=Configure NVIDIA X Server Settings -Exec=sh -c "/opt/bin/nvidia-settings --load-config-only" -Terminal=false -Icon=nvidia-settings -Categories=System;Settings; diff --git a/x11-drivers/nvidia-drivers/files/nvidia-drivers-pax-const.patch b/x11-drivers/nvidia-drivers/files/nvidia-drivers-pax-const.patch deleted file mode 100644 index f3b8259..0000000 --- a/x11-drivers/nvidia-drivers/files/nvidia-drivers-pax-const.patch +++ /dev/null @@ -1,17 +0,0 @@ -Binary files kernel.orig/.nv-procfs.c.swp and kernel/.nv-procfs.c.swp differ -diff -urp kernel.orig/nv-procfs.c kernel/nv-procfs.c ---- kernel.orig/nv-procfs.c 2011-07-13 03:29:30.000000000 +0200 -+++ kernel/nv-procfs.c 2011-07-19 15:45:27.982993911 +0200 -@@ -707,8 +707,10 @@ int nv_register_procfs(void) - * However, in preparation for this, we need to preserve - * the procfs read() and write() operations. - */ -- nv_procfs_registry_fops.read = entry->proc_fops->read; -- nv_procfs_registry_fops.write = entry->proc_fops->write; -+ pax_open_kernel(); -+ *(void **)&nv_procfs_registry_fops.read = entry->proc_fops->read; -+ *(void **)&nv_procfs_registry_fops.write = entry->proc_fops->write; -+ pax_close_kernel(); - - entry = NV_CREATE_PROC_FILE("registry", proc_nvidia, - nv_procfs_read_registry, diff --git a/x11-drivers/nvidia-drivers/files/nvidia-drivers-pax-usercopy.patch b/x11-drivers/nvidia-drivers/files/nvidia-drivers-pax-usercopy.patch deleted file mode 100644 index ce8c201..0000000 --- a/x11-drivers/nvidia-drivers/files/nvidia-drivers-pax-usercopy.patch +++ /dev/null @@ -1,54 +0,0 @@ -diff -urp kernel.orig/nv.c kernel/nv.c ---- kernel.orig/nv.c 2011-09-24 02:32:09.000000000 +0200 -+++ kernel/nv.c 2011-10-05 19:13:41.474242252 +0200 -@@ -1105,7 +1105,7 @@ static int __init nvidia_init_module(voi - NV_SPIN_LOCK_INIT(&km_lock); - #endif - -- NV_KMEM_CACHE_CREATE(nv_stack_t_cache, "nv_stack_t", nv_stack_t); -+ NV_KMEM_CACHE_CREATE(nv_stack_t_cache, "nv_stack_t", nv_stack_t, SLAB_USERCOPY); - if (nv_stack_t_cache == NULL) - { - nv_printf(NV_DBG_ERRORS, "NVRM: stack cache allocation failed!\n"); -@@ -1220,7 +1220,7 @@ static int __init nvidia_init_module(voi - } - #endif - -- NV_KMEM_CACHE_CREATE(nv_pte_t_cache, "nv_pte_t", nv_pte_t); -+ NV_KMEM_CACHE_CREATE(nv_pte_t_cache, "nv_pte_t", nv_pte_t, 0); - if (nv_pte_t_cache == NULL) - { - rc = -ENOMEM; -@@ -1229,7 +1229,7 @@ static int __init nvidia_init_module(voi - } - - NV_KMEM_CACHE_CREATE(nvidia_p2p_page_t_cache, "nvidia_p2p_page_t", -- nvidia_p2p_page_t); -+ nvidia_p2p_page_t, 0); - if (nvidia_p2p_page_t_cache == NULL) - { - rc = -ENOMEM; -diff -urp kernel.orig/nv-linux.h kernel/nv-linux.h ---- kernel.orig/nv-linux.h 2011-09-24 02:32:09.000000000 +0200 -+++ kernel/nv-linux.h 2011-10-05 19:14:42.522238996 +0200 -@@ -695,16 +695,16 @@ extern nv_spinlock_t km_lock; - - #if defined(NV_KMEM_CACHE_CREATE_PRESENT) - #if (NV_KMEM_CACHE_CREATE_ARGUMENT_COUNT == 6) --#define NV_KMEM_CACHE_CREATE(kmem_cache, name, type) \ -+#define NV_KMEM_CACHE_CREATE(kmem_cache, name, type, flags) \ - { \ - kmem_cache = kmem_cache_create(name, sizeof(type), \ -- 0, 0, NULL, NULL); \ -+ 0, flags, NULL, NULL); \ - } - #elif (NV_KMEM_CACHE_CREATE_ARGUMENT_COUNT == 5) --#define NV_KMEM_CACHE_CREATE(kmem_cache, name, type) \ -+#define NV_KMEM_CACHE_CREATE(kmem_cache, name, type, flags) \ - { \ - kmem_cache = kmem_cache_create(name, sizeof(type), \ -- 0, 0, NULL); \ -+ 0, flags, NULL); \ - } - #else - #error "NV_KMEM_CACHE_CREATE_ARGUMENT_COUNT value unrecognized!" diff --git a/x11-drivers/nvidia-drivers/files/nvidia-smi.init b/x11-drivers/nvidia-drivers/files/nvidia-smi.init deleted file mode 100644 index 2cfd4c4..0000000 --- a/x11-drivers/nvidia-drivers/files/nvidia-smi.init +++ /dev/null @@ -1,25 +0,0 @@ -#!/sbin/runscript -# Copyright 1999-2012 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/x11-drivers/nvidia-drivers/files/nvidia-smi.init,v 1.1 2012/07/22 21:08:43 cardoe Exp $ - -pidfile="/var/run/nvidia-smi.pid" - -depend() { - after modules -} - -start() { - ebegin "Starting NVIDIA System Management Interface" - rm -f ${pidfile} - start-stop-daemon --start --quiet --pidfile ${pidfile} \ - --make-pidfile --background --exec /opt/bin/nvidia-smi -- \ - -q -l 300 - eend $? -} - -stop() { - ebegin "Stopping NVIDIA System Management Interface" - start-stop-daemon --stop --quiet --pidfile ${pidfile} - eend $? -} diff --git a/x11-drivers/nvidia-drivers/files/nvidia-udev.sh b/x11-drivers/nvidia-drivers/files/nvidia-udev.sh deleted file mode 100644 index 9487b08..0000000 --- a/x11-drivers/nvidia-drivers/files/nvidia-udev.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -if [ $# -ne 1 ]; then - echo "Invalid args" >&2 - exit 1 -fi - -case $1 in - add|ADD) - /opt/bin/nvidia-smi > /dev/null - ;; - remove|REMOVE) - rm -f /dev/nvidia* - ;; -esac - -exit 0 diff --git a/x11-drivers/nvidia-drivers/files/nvidia.udev-rule b/x11-drivers/nvidia-drivers/files/nvidia.udev-rule deleted file mode 100644 index 2eb30bb..0000000 --- a/x11-drivers/nvidia-drivers/files/nvidia.udev-rule +++ /dev/null @@ -1,6 +0,0 @@ -ACTION=="add", DEVPATH=="/module/nvidia", SUBSYSTEM=="module", RUN+="nvidia-udev.sh $env{ACTION}" -# Previously the ACTION was "add|remove" but one user on bug #376527 had a -# problem until he recompiled udev-171-r5, which is one of the versions I -# tested with and it was fine. I'm breaking the rules out just to be safe -# so someone else doesn't have an issue -ACTION=="remove", DEVPATH=="/module/nvidia", SUBSYSTEM=="module", RUN+="nvidia-udev.sh $env{ACTION}" diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-295.59.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-295.59.ebuild deleted file mode 100644 index 9658ee3..0000000 --- a/x11-drivers/nvidia-drivers/nvidia-drivers-295.59.ebuild +++ /dev/null @@ -1,598 +0,0 @@ -# Copyright 1999-2012 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: -# /var/cvsroot/gentoo-x86/x11-drivers/nvidia-drivers/nvidia-drivers-295.59.ebuild,v 1.1 2012/06/14 23:03:14 cardoe Exp $ - -EAPI="2" - -inherit eutils unpacker multilib portability versionator linux-mod flag-o-matic nvidia-driver - -X86_NV_PACKAGE="NVIDIA-Linux-x86-${PV}" -AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}" -X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${PV}" -AMD64_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86_64-${PV}" - -DESCRIPTION="NVIDIA X11 driver and GLX libraries" -HOMEPAGE="http://www.nvidia.com/" -SRC_URI="x86? ( http://us.download.nvidia.com/XFree86/Linux-x86/${PV}/${X86_NV_PACKAGE}.run ) - amd64? ( http://us.download.nvidia.com/XFree86/Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}.run ) - amd64-fbsd? ( http://us.download.nvidia.com/XFree86/FreeBSD-x86_64/${PV}/${AMD64_FBSD_NV_PACKAGE}.tar.gz ) - x86-fbsd? ( http://us.download.nvidia.com/XFree86/FreeBSD-x86/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )" - -LICENSE="NVIDIA" -SLOT="0" -KEYWORDS="-* ~amd64 ~x86 ~amd64-fbsd ~x86-fbsd" -IUSE="acpi multilib kernel_FreeBSD kernel_linux pax_kernel +tools" -RESTRICT="strip" -EMULTILIB_PKG="true" - -COMMON="=sys-libs/glibc-2.6.1 ) - multilib? ( app-emulation/emul-linux-x86-xlibs ) - >=app-admin/eselect-opengl-1.0.9 - app-admin/eselect-opencl" -DEPEND="${COMMON} - kernel_linux? ( virtual/linux-sources )" -RDEPEND="${COMMON} - x11-libs/libXvMC - acpi? ( sys-power/acpid ) - tools? ( - dev-libs/atk - dev-libs/glib - x11-libs/gdk-pixbuf - x11-libs/gtk+:2 - x11-libs/libX11 - x11-libs/libXext - x11-libs/pango - )" -PDEPEND=">=x11-libs/libvdpau-0.3-r1" - -QA_TEXTRELS_x86=" - usr/lib/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0 - usr/lib/libXvMCNVIDIA.so.${PV} - usr/lib/libcuda.so.${PV} - usr/lib/libnvcuvid.so.${PV} - usr/lib/libnvidia-cfg.so.${PV} - usr/lib/libnvidia-compiler.so.${PV} - usr/lib/libnvidia-glcore.so.${PV} - usr/lib/libnvidia-ml.so.${PV} - usr/lib/libvdpau_nvidia.so.${PV} - usr/lib/opengl/nvidia/extensions/libglx.so.${PV} - usr/lib/opengl/nvidia/lib/libGL.so.${PV} - usr/lib/opengl/nvidia/lib/libnvidia-tls.so.${PV} - usr/lib/xorg/modules/drivers/nvidia_drv.so" - -QA_TEXTRELS_x86_fbsd="boot/modules/nvidia.ko - usr/lib/opengl/nvidia/lib/libGL.so.1 - usr/lib/libnvidia-glcore.so.1 - usr/lib/libvdpau_nvidia.so.1 - usr/lib/libnvidia-cfg.so.1 - usr/lib/opengl/nvidia/extensions/libglx.so.1 - usr/lib/xorg/modules/drivers/nvidia_drv.so" - -QA_TEXTRELS_amd64="usr/lib32/opengl/nvidia/lib/libnvidia-tls.so.${PV} - usr/lib32/libnvidia-glcore.so.${PV} - usr/lib32/libvdpau_nvidia.so.${PV} - usr/lib32/opengl/nvidia/lib/libGL.so.${PV} - usr/lib32/libcuda.so.${PV} - usr/lib32/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0 - usr/lib32/libnvidia-compiler.so.${PV}" - -QA_EXECSTACK_x86="usr/lib/opengl/nvidia/lib/libGL.so.${PV} - usr/lib/libnvidia-glcore.so.${PV} - usr/lib/opengl/nvidia/extensions/libglx.so.${PV} - usr/lib64/libXvMCNVIDIA.so.${PV} - usr/lib/libXvMCNVIDIA.a:NVXVMC.o - usr/lib/libvdpau_nvidia.so.${PV} - usr/lib/libnvidia-compiler.so.${PV} - usr/lib/libcuda.so.${PV} - usr/lib/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0" - -QA_EXECSTACK_amd64="usr/lib32/libnvidia-glcore.so.${PV} - usr/lib32/opengl/nvidia/lib/libGL.so.${PV} - usr/lib32/opengl/nvidia/lib/libnvidia-tls.so.${PV} - usr/lib32/libvdpau_nvidia.so.${PV} - usr/lib32/libcuda.so.${PV} - usr/lib32/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0 - usr/lib32/libnvidia-compiler.so.${PV} - usr/lib64/libXvMCNVIDIA.a:NVXVMC.o - usr/lib64/libnvidia-cfg.so.${PV} - usr/lib64/libnvidia-ml.so.${PV} - usr/lib64/libvdpau_nvidia.so.${PV} - usr/lib64/opengl/nvidia/lib/libnvidia-tls.so.${PV} - usr/lib64/opengl/nvidia/lib/libGL.so.${PV} - usr/lib64/libnvidia-glcore.so.${PV} - usr/lib64/opengl/nvidia/extensions/libglx.so.${PV} - usr/lib64/libXvMCNVIDIA.so.${PV} - usr/lib64/libcuda.so.${PV} - usr/lib64/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0 - usr/lib64/libnvidia-compiler.so.${PV} - usr/lib64/xorg/modules/drivers/nvidia_drv.so - opt/bin/nvidia-smi - opt/bin/nvidia-xconfig - opt/bin/nvidia-debugdump - opt/bin/nvidia-settings" - -QA_WX_LOAD_x86="usr/lib/libnvidia-glcore.so.${PV} - usr/lib/opengl/nvidia/lib/libGL.so.${PV} - usr/lib/opengl/nvidia/extensions/libglx.so.${PV} - usr/lib/libXvMCNVIDIA.a - usr/lib64/libXvMCNVIDIA.so.${PV}" - -QA_WX_LOAD_amd64="usr/lib32/opengl/nvidia/lib/libGL.so.${PV} - usr/lib32/libnvidia-glcore.so.${PV} - usr/lib64/opengl/nvidia/lib/libGL.so.${PV} - usr/lib64/libnvidia-glcore.so.${PV} - usr/lib64/opengl/nvidia/extensions/libglx.so.${PV} - usr/lib64/libXvMCNVIDIA.so.${PV}" - -QA_SONAME_x86="usr/lib/libnvidia-compiler.so.${PV}" - -QA_SONAME_amd64="usr/lib64/libnvidia-compiler.so.${PV} - usr/lib32/libnvidia-compiler.so.${PV}" - -QA_DT_HASH_amd64="usr/lib32/libcuda.so.${PV} - usr/lib32/opengl/nvidia/lib/libGL.so.${PV} - usr/lib32/libnvidia-glcore.so.${PV} - usr/lib32/opengl/nvidia/lib/libnvidia-tls.so.${PV} - usr/lib32/libvdpau_nvidia.so.${PV} - usr/lib32/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0 - usr/lib32/libnvidia-compiler.so.${PV} - usr/lib64/libXvMCNVIDIA.so.${PV} - usr/lib64/libcuda.so.${PV} - usr/lib64/libnvidia-cfg.so.${PV} - usr/lib64/libnvidia-glcore.so.${PV} - usr/lib64/libnvidia-ml.so.${PV} - usr/lib64/opengl/nvidia/lib/libGL.so.${PV} - usr/lib64/opengl/nvidia/lib/libnvidia-tls.so.${PV} - usr/lib64/opengl/nvidia/extensions/libglx.so.${PV} - usr/lib64/xorg/modules/drivers/nvidia_drv.so - usr/lib64/libvdpau_nvidia.so.${PV} - usr/lib64/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0 - usr/lib64/libnvidia-compiler.so.${PV} - usr/lib64/libnvcuvid.so.${PV} - opt/bin/nvidia-smi - opt/bin/nvidia-xconfig - opt/bin/nvidia-debugdump - opt/bin/nvidia-settings" - -QA_DT_HASH_x86="usr/lib/libcuda.so.${PV} - usr/lib/libnvidia-cfg.so.${PV} - usr/lib/libnvidia-glcore.so.${PV} - usr/lib/libnvidia-ml.so.${PV} - usr/lib/opengl/nvidia/lib/libGL.so.${PV} - usr/lib/opengl/nvidia/lib/libnvidia-tls.so.${PV} - usr/lib/opengl/nvidia/extensions/libglx.so.${PV} - usr/lib/xorg/modules/drivers/nvidia_drv.so - usr/lib/libXvMCNVIDIA.so.${PV} - usr/lib/libvdpau_nvidia.so.${PV} - usr/lib/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0 - usr/lib/libnvidia-compiler.so.${PV} - usr/lib/libnvcuvid.so.${PV} - opt/bin/nvidia-smi - opt/bin/nvidia-xconfig - opt/bin/nvidia-debugdump - opt/bin/nvidia-settings" - -S=${WORKDIR}/ - -mtrr_check() { - ebegin "Checking for MTRR support" - linux_chkconfig_present MTRR - eend $? - - if [[ $? -ne 0 ]] ; then - eerror "Please enable MTRR support in your kernel config, found at:" - eerror - eerror " Processor type and features" - eerror " [*] MTRR (Memory Type Range Register) support" - eerror - eerror "and recompile your kernel ..." - die "MTRR support not detected!" - fi -} - -lockdep_check() { - if linux_chkconfig_present LOCKDEP; then - eerror "You've enabled LOCKDEP -- lock tracking -- in the kernel." - eerror "Unfortunately, this option exports the symbol " - eerror "'lockdep_init_map' as GPL-only which will prevent " - eerror "${P} from compiling." - eerror "Please make sure the following options have been unset:" - eerror - eerror " Kernel hacking --->" - eerror " [ ] Lock debugging: detect incorrect freeing of live locks" - eerror " [ ] Lock debugging: prove locking correctness" - eerror " [ ] Lock usage statistics" - eerror "in 'menuconfig'" - die "LOCKDEP enabled" - fi -} - -pkg_setup() { - # try to turn off distcc and ccache for people that have a problem with it - export DISTCC_DISABLE=1 - export CCACHE_DISABLE=1 - - if use amd64 && has_multilib_profile && [ "${DEFAULT_ABI}" != "amd64" ]; then - eerror "This ebuild doesn't currently support changing your default abi." - die "Unexpected \${DEFAULT_ABI} = ${DEFAULT_ABI}" - fi - - if use kernel_linux; then - linux-mod_pkg_setup - MODULE_NAMES="nvidia(video:${S}/kernel)" - BUILD_PARAMS="IGNORE_CC_MISMATCH=yes V=1 SYSSRC=${KV_DIR} \ - SYSOUT=${KV_OUT_DIR} CC=$(tc-getBUILD_CC)" - # linux-mod_src_compile calls set_arch_to_kernel, which - # sets the ARCH to x86 but NVIDIA's wrapping Makefile - # expects x86_64 or i386 and then converts it to x86 - # later on in the build process - BUILD_FIXES="ARCH=$(uname -m | sed -e 's/i.86/i386/')" - mtrr_check - lockdep_check - fi - - # On BSD userland it wants real make command - use userland_BSD && MAKE="$(get_bmake)" - - export _POSIX2_VERSION="199209" - - # Since Nvidia ships 3 different series of drivers, we need to give the user - # some kind of guidance as to what version they should install. This tries - # to point the user in the right direction but can't be perfect. check - # nvidia-driver.eclass - nvidia-driver-check-warning - - # set variables to where files are in the package structure - if use kernel_FreeBSD; then - use x86-fbsd && S="${WORKDIR}/${X86_FBSD_NV_PACKAGE}" - use amd64-fbsd && S="${WORKDIR}/${AMD64_FBSD_NV_PACKAGE}" - NV_DOC="${S}/doc" - NV_EXEC="${S}/obj" - NV_LIB="${S}/obj" - NV_SRC="${S}/src" - NV_MAN="${S}/x11/man" - NV_X11="${S}/obj" - NV_X11_DRV="${NV_X11}" - NV_X11_EXT="${NV_X11}" - NV_SOVER=1 - elif use kernel_linux; then - NV_DOC="${S}" - NV_EXEC="${S}" - NV_LIB="${S}" - NV_SRC="${S}/kernel" - NV_MAN="${S}" - NV_X11="${S}" - NV_X11_DRV="${NV_X11}" - NV_X11_EXT="${NV_X11}" - NV_SOVER=${PV} - else - die "Could not determine proper NVIDIA package" - fi -} - -src_unpack() { - if use kernel_linux && kernel_is lt 2 6 7; then - echo - ewarn "Your kernel version is ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}" - ewarn "This is not officially supported for ${P}. It is likely you" - ewarn "will not be able to compile or use the kernel module." - ewarn "It is recommended that you upgrade your kernel to a version >= 2.6.7" - echo - ewarn "DO NOT file bug reports for kernel versions less than 2.6.7 as they will be ignored." - fi - - if ! use kernel_FreeBSD; then - cd "${S}" - unpack_makeself - else - unpack ${A} - fi -} - -src_prepare() { - # Please add a brief description for every added patch - use kernel_FreeBSD && cd doc - - if use kernel_linux; then - # Quiet down warnings the user does not need to see - sed -i \ - -e 's:-Wsign-compare::g' \ - "${NV_SRC}"/Makefile.kbuild - - # If greater than 2.6.5 use M= instead of SUBDIR= - convert_to_m "${NV_SRC}"/Makefile.kbuild - fi - - if use pax_kernel; then - epatch "${FILESDIR}"/nvidia-drivers-pax-const.patch - epatch "${FILESDIR}"/nvidia-drivers-pax-usercopy.patch - fi - - cat <<- EOF > "${S}"/nvidia.icd - /usr/$(get_libdir)/libcuda.so - EOF - - # Allow user patches so they can support RC kernels and whatever else - epatch_user -} - -src_compile() { - # This is already the default on Linux, as there's no toplevel Makefile, but - # on FreeBSD there's one and triggers the kernel module build, as we install - # it by itself, pass this. - - cd "${NV_SRC}" - if use kernel_FreeBSD; then - MAKE="$(get_bmake)" CFLAGS="-Wno-sign-compare" emake CC="$(tc-getCC)" \ - LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)" || die - elif use kernel_linux; then - linux-mod_src_compile - fi -} - -src_install() { - if use kernel_linux; then - linux-mod_src_install - - VIDEOGROUP="$(egetent group video | cut -d ':' -f 3)" - if [ -z "$VIDEOGROUP" ]; then - eerror "Failed to determine the video group gid." - die "Failed to determine the video group gid." - fi - - # Add the aliases - [ -f "${FILESDIR}/nvidia-169.07" ] || die "nvidia missing in FILESDIR" - sed -e 's:PACKAGE:'${PF}':g' \ - -e 's:VIDEOGID:'${VIDEOGROUP}':' "${FILESDIR}"/nvidia-169.07 > \ - "${WORKDIR}"/nvidia - insinto /etc/modprobe.d - newins "${WORKDIR}"/nvidia nvidia.conf || die - - # Ensures that our device nodes are created when not using X - exeinto /lib/udev - doexe "${FILESDIR}"/nvidia-udev.sh - - insinto /lib/udev/rules.d - newins "${FILESDIR}"/nvidia.udev-rule 99-nvidia.rules - elif use kernel_FreeBSD; then - if use x86-fbsd; then - insinto /boot/modules - doins "${S}/src/nvidia.kld" || die - fi - - exeinto /boot/modules - doexe "${S}/src/nvidia.ko" || die - fi - - # NVIDIA kernel <-> userspace driver config lib - dolib.so ${NV_LIB}/libnvidia-cfg.so.${NV_SOVER} || \ - die "failed to install libnvidia-cfg" - dosym libnvidia-cfg.so.${NV_SOVER} \ - /usr/$(get_libdir)/libnvidia-cfg.so.1 || \ - die "failed to create libnvidia-cfg.so symlink" - dosym libnvidia-cfg.so.1 \ - /usr/$(get_libdir)/libnvidia-cfg.so || \ - die "failed to create libnvidia-cfg.so symlink" - - if use kernel_linux; then - # NVIDIA monitoring library - dolib.so ${NV_LIB}/libnvidia-ml.so.${NV_SOVER} || \ - die "failed to install libnvidia-ml" - dosym libnvidia-ml.so.${NV_SOVER} \ - /usr/$(get_libdir)/libnvidia-ml.so.1 || \ - die "failed to create libnvidia-ml.so symlink" - dosym libnvidia-ml.so.1 \ - /usr/$(get_libdir)/libnvidia-ml.so || \ - die "failed to create libnvidia-ml.so symlink" - - # NVIDIA video decode <-> CUDA - dolib.so ${NV_LIB}/libnvcuvid.so.${NV_SOVER} || \ - die "failed to install libnvcuvid.so" - dosym libnvcuvid.so.${NV_SOVER} \ - /usr/$(get_libdir)/libnvcuvid.so.1 || \ - die "failed to create libnvcuvid.so symlink" - dosym libnvcuvid.so.1 \ - /usr/$(get_libdir)/libnvcuvid.so || \ - die "failed to create libnvcuvid.so symlink" - fi - - # Xorg DDX driver - insinto /usr/$(get_libdir)/xorg/modules/drivers - doins ${NV_X11_DRV}/nvidia_drv.so || die "failed to install nvidia_drv.so" - - # Xorg GLX driver - insinto /usr/$(get_libdir)/opengl/nvidia/extensions - doins ${NV_X11_EXT}/libglx.so.${NV_SOVER} || \ - die "failed to install libglx.so" - dosym libglx.so.${NV_SOVER} \ - /usr/$(get_libdir)/opengl/nvidia/extensions/libglx.so || \ - die "failed to create libglx.so symlink" - - # XvMC driver - dolib.a ${NV_X11}/libXvMCNVIDIA.a || \ - die "failed to install libXvMCNVIDIA.so" - dolib.so ${NV_X11}/libXvMCNVIDIA.so.${NV_SOVER} || \ - die "failed to install libXvMCNVIDIA.so" - dosym libXvMCNVIDIA.so.${NV_SOVER} \ - /usr/$(get_libdir)/libXvMCNVIDIA.so.1 || \ - die "failed to create libXvMCNVIDIA.so symlink" - dosym libXvMCNVIDIA.so.1 /usr/$(get_libdir)/libXvMCNVIDIA.so || \ - die "failed to create libXvMCNVIDIA.so symlink" - dosym libXvMCNVIDIA.so.${NV_SOVER} \ - /usr/$(get_libdir)/libXvMCNVIDIA_dynamic.so.1 || \ - die "failed to create libXvMCNVIDIA_dynamic.so symlink" - - # OpenCL ICD for NVIDIA - if use kernel_linux; then - insinto /etc/OpenCL/vendors - doins nvidia.icd - fi - - # Documentation - dohtml ${NV_DOC}/html/* - if use kernel_FreeBSD; then - dodoc "${NV_DOC}/README" - doman "${NV_MAN}/nvidia-xconfig.1" - doman "${NV_MAN}/nvidia-settings.1" - else - # Docs - newdoc "${NV_DOC}/README.txt" README - dodoc "${NV_DOC}/NVIDIA_Changelog" - doman "${NV_MAN}/nvidia-smi.1.gz" - doman "${NV_MAN}/nvidia-xconfig.1.gz" - doman "${NV_MAN}/nvidia-settings.1.gz" - fi - - # Helper Apps - exeinto /opt/bin/ - doexe ${NV_EXEC}/nvidia-xconfig || die - use kernel_linux && { doexe ${NV_EXEC}/nvidia-debugdump || die ; } - if use tools; then - doexe ${NV_EXEC}/nvidia-settings || die - fi - doexe ${NV_EXEC}/nvidia-bug-report.sh || die - if use kernel_linux; then - doexe ${NV_EXEC}/nvidia-smi || die - fi - - # Desktop entries for nvidia-settings - if use tools && use kernel_linux ; then - sed -e 's:__UTILS_PATH__:/opt/bin:' \ - -e 's:__PIXMAP_PATH__:/usr/share/pixmaps:' \ - -i "${NV_EXEC}/nvidia-settings.desktop" - newmenu ${NV_EXEC}/nvidia-settings.desktop nvidia-settings-opt.desktop - fi - - doicon ${NV_EXEC}/nvidia-settings.png - - if has_multilib_profile && use multilib ; then - local OABI=${ABI} - for ABI in $(get_install_abis) ; do - src_install-libs - done - ABI=${OABI} - unset OABI - else - src_install-libs - fi - - is_final_abi || die "failed to iterate through all ABIs" -} - -# Install nvidia library: -# the first parameter is the place where to install it -# the second parameter is the base name of the library -# the third parameter is the provided soversion -donvidia() { - dodir $1 - exeinto $1 - - libname=$(basename $2) - - doexe $2.$3 || die "failed to install $2" - dosym ${libname}.$3 $1/${libname} || die "failed to symlink $2" - [[ $3 != "1" ]] && dosym ${libname}.$3 $1/${libname}.1 -} - -src_install-libs() { - local inslibdir=$(get_libdir) - local NV_ROOT="/usr/${inslibdir}/opengl/nvidia" - local CL_ROOT=/usr/${inslibdir}/OpenCL/vendors/nvidia - local libdir= sover= - - if use kernel_linux; then - if has_multilib_profile && [[ ${ABI} == "x86" ]] ; then - libdir=32 - else - libdir=. - fi - sover=${PV} - else - libdir=obj - # on FreeBSD it has just .1 suffix - sover=1 - fi - - # The GLX libraries - donvidia ${NV_ROOT}/lib ${libdir}/libGL.so ${sover} - donvidia /usr/${inslibdir} ${libdir}/libnvidia-glcore.so ${sover} - if use kernel_FreeBSD; then - donvidia ${NV_ROOT}/lib ${libdir}/libnvidia-tls.so ${sover} - else - donvidia ${NV_ROOT}/lib ${libdir}/tls/libnvidia-tls.so ${sover} - fi - - # VDPAU - donvidia /usr/${inslibdir} ${libdir}/libvdpau_nvidia.so ${sover} - - # CUDA & OpenCL - if use kernel_linux; then - donvidia /usr/${inslibdir} ${libdir}/libcuda.so ${sover} - donvidia /usr/${inslibdir} ${libdir}/libnvidia-compiler.so ${sover} - donvidia ${CL_ROOT} ${libdir}/libOpenCL.so 1.0.0 - #dosym libOpenCL.so.1 ${CL_ROOT}/libOpenCL.so - fi -} - -pkg_preinst() { - use kernel_linux && linux-mod_pkg_preinst - - # Clean the dynamic libGL stuff's home to ensure - # we dont have stale libs floating around - if [ -d "${ROOT}"/usr/lib/opengl/nvidia ] ; then - rm -rf "${ROOT}"/usr/lib/opengl/nvidia/* - fi - # Make sure we nuke the old nvidia-glx's env.d file - if [ -e "${ROOT}"/etc/env.d/09nvidia ] ; then - rm -f "${ROOT}"/etc/env.d/09nvidia - fi -} - -pkg_postinst() { - use kernel_linux && linux-mod_pkg_postinst - - # Switch to the nvidia implementation - "${ROOT}"/usr/bin/eselect opengl set --use-old nvidia - "${ROOT}"/usr/bin/eselect opencl set --use-old nvidia - - echo - elog "You must be in the video group to use the NVIDIA device" - elog "For more info, read the docs at" - elog "http://www.gentoo.org/doc/en/nvidia-guide.xml#doc_chap3_sect6" - elog - - elog "This ebuild installs a kernel module and X driver. Both must" - elog "match explicitly in their version. This means, if you restart" - elog "X, you must modprobe -r nvidia before starting it back up" - elog - - elog "To use the NVIDIA GLX, run \"eselect opengl set nvidia\"" - elog - elog "To use the NVIDIA CUDA/OpenCL, run \"eselect opencl set nvidia\"" - elog - elog "NVIDIA has requested that any bug reports submitted have the" - elog "output of /opt/bin/nvidia-bug-report.sh included." - elog - elog "To work with compiz, you must enable the AddARGBGLXVisuals option." - elog - elog "If you are having resolution problems, try disabling DynamicTwinView." - elog - - if ! use tools; then - elog "USE=tools controls whether the nvidia-settings application" - elog "is installed. If you would like to use it, enable that" - elog "flag and re-emerge this ebuild. Optionally you can install" - elog "media-video/nvidia-settings" - fi -} - -pkg_prerm() { - "${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11 -} - -pkg_postrm() { - use kernel_linux && linux-mod_pkg_postrm - "${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11 -} diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-304.37-r1.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-304.37-r1.ebuild deleted file mode 100644 index d2cfa2e..0000000 --- a/x11-drivers/nvidia-drivers/nvidia-drivers-304.37-r1.ebuild +++ /dev/null @@ -1,446 +0,0 @@ -# Copyright 1999-2012 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/x11-drivers/nvidia-drivers/nvidia-drivers-304.37-r1.ebuild,v 1.3 2012/08/22 04:50:23 cardoe Exp $ - -EAPI=4 - -inherit eutils flag-o-matic linux-info linux-mod multilib nvidia-driver \ - portability toolchain-funcs unpacker user versionator - -X86_NV_PACKAGE="NVIDIA-Linux-x86-${PV}" -AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}" -X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${PV}" -AMD64_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86_64-${PV}" - -DESCRIPTION="NVIDIA X11 driver and GLX libraries" -HOMEPAGE="http://www.nvidia.com/" -SRC_URI="x86? ( http://us.download.nvidia.com/XFree86/Linux-x86/${PV}/${X86_NV_PACKAGE}.run ) - amd64? ( http://us.download.nvidia.com/XFree86/Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}.run ) - amd64-fbsd? ( http://us.download.nvidia.com/XFree86/FreeBSD-x86_64/${PV}/${AMD64_FBSD_NV_PACKAGE}.tar.gz ) - x86-fbsd? ( http://us.download.nvidia.com/XFree86/FreeBSD-x86/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )" - -LICENSE="NVIDIA" -SLOT="0" -KEYWORDS="-* ~amd64 ~x86 ~amd64-fbsd ~x86-fbsd" -IUSE="acpi multilib kernel_FreeBSD kernel_linux pax_kernel +tools +X" -RESTRICT="strip" -EMULTILIB_PKG="true" - -COMMON="app-admin/eselect-opencl - kernel_linux? ( >=sys-libs/glibc-2.6.1 ) - multilib? ( app-emulation/emul-linux-x86-xlibs ) - X? ( - =app-admin/eselect-opengl-1.0.9 - )" -DEPEND="${COMMON} - kernel_linux? ( - virtual/linux-sources - virtual/pkgconfig - )" -RDEPEND="${COMMON} - acpi? ( sys-power/acpid ) - tools? ( - dev-libs/atk - dev-libs/glib - x11-libs/gdk-pixbuf - x11-libs/gtk+:2 - x11-libs/libX11 - x11-libs/libXext - x11-libs/pango[X] - ) - X? ( x11-libs/libXvMC )" -PDEPEND="X? ( >=x11-libs/libvdpau-0.3-r1 )" - -REQUIRED_USE="tools? ( X )" - -QA_PREBUILT="" - -S=${WORKDIR}/ - -pkg_pretend() { - - if use amd64 && has_multilib_profile && \ - [ "${DEFAULT_ABI}" != "amd64" ]; then - eerror "This ebuild doesn't currently support changing your default ABI" - die "Unexpected \${DEFAULT_ABI} = ${DEFAULT_ABI}" - fi - - # Kernel features/options to check for - CONFIG_CHECK="~ZONE_DMA ~MTRR ~SYSVIPC ~!LOCKDEP" - use x86 && CONFIG_CHECK+=" ~HIGHMEM" - - # Now do the above checks - use kernel_linux && check_extra_config -} - -pkg_setup() { - # try to turn off distcc and ccache for people that have a problem with it - export DISTCC_DISABLE=1 - export CCACHE_DISABLE=1 - - if use kernel_linux; then - linux-mod_pkg_setup - MODULE_NAMES="nvidia(video:${S}/kernel)" - BUILD_PARAMS="IGNORE_CC_MISMATCH=yes V=1 SYSSRC=${KV_DIR} \ - SYSOUT=${KV_OUT_DIR} CC=$(tc-getBUILD_CC)" - # linux-mod_src_compile calls set_arch_to_kernel, which - # sets the ARCH to x86 but NVIDIA's wrapping Makefile - # expects x86_64 or i386 and then converts it to x86 - # later on in the build process - BUILD_FIXES="ARCH=$(uname -m | sed -e 's/i.86/i386/')" - fi - - # Since Nvidia ships 3 different series of drivers, we need to give the user - # some kind of guidance as to what version they should install. This tries - # to point the user in the right direction but can't be perfect. check - # nvidia-driver.eclass - nvidia-driver-check-warning - - # set variables to where files are in the package structure - if use kernel_FreeBSD; then - use x86-fbsd && S="${WORKDIR}/${X86_FBSD_NV_PACKAGE}" - use amd64-fbsd && S="${WORKDIR}/${AMD64_FBSD_NV_PACKAGE}" - NV_DOC="${S}/doc" - NV_OBJ="${S}/obj" - NV_SRC="${S}/src" - NV_MAN="${S}/x11/man" - NV_X11="${S}/obj" - NV_SOVER=1 - elif use kernel_linux; then - NV_DOC="${S}" - NV_OBJ="${S}" - NV_SRC="${S}/kernel" - NV_MAN="${S}" - NV_X11="${S}" - NV_SOVER=${PV} - else - die "Could not determine proper NVIDIA package" - fi -} - -src_unpack() { - if ! use kernel_FreeBSD; then - cd "${S}" - unpack_makeself - else - unpack ${A} - fi -} - -src_prepare() { - # Please add a brief description for every added patch - - if use kernel_linux; then - if kernel_is lt 2 6 9 ; then - eerror "You must build this against 2.6.9 or higher kernels." - fi - - # If greater than 2.6.5 use M= instead of SUBDIR= - convert_to_m "${NV_SRC}"/Makefile.kbuild - fi - - if use pax_kernel; then - epatch "${FILESDIR}"/nvidia-drivers-pax-const.patch - epatch "${FILESDIR}"/nvidia-drivers-pax-usercopy.patch - fi - - cat <<- EOF > "${S}"/nvidia.icd - /usr/$(get_libdir)/libnvidia-opencl.so - EOF - - # Allow user patches so they can support RC kernels and whatever else - epatch_user -} - -src_compile() { - # This is already the default on Linux, as there's no toplevel Makefile, but - # on FreeBSD there's one and triggers the kernel module build, as we install - # it by itself, pass this. - - cd "${NV_SRC}" - if use kernel_FreeBSD; then - MAKE="$(get_bmake)" CFLAGS="-Wno-sign-compare" emake CC="$(tc-getCC)" \ - LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)" || die - elif use kernel_linux; then - linux-mod_src_compile - fi -} - -# Install nvidia library: -# the first parameter is the library to install -# the second parameter is the provided soversion -# the third parameter is the target directory if its not /usr/lib -donvidia() { - # Full path to library minus SOVER - MY_LIB="$1" - - # SOVER to use - MY_SOVER="$2" - - # Where to install - MY_DEST="$3" - - if [[ -z "${MY_DEST}" ]]; then - MY_DEST="/usr/$(get_libdir)" - action="dolib.so" - else - exeinto ${MY_DEST} - action="doexe" - fi - - # Get just the library name - libname=$(basename $1) - - # Add it to QA_PREBUILT - QA_PREBUILT+=" ${MY_DEST}/${libname}.${MY_SOVER}" - - # Install the library with the correct SOVER - ${action} ${MY_LIB}.${MY_SOVER} || \ - die "failed to install ${libname}" - - # If SOVER wasn't 1, then we need to create a .1 symlink - if [[ "${MY_SOVER}" != "1" ]]; then - dosym ${libname}.${MY_SOVER} \ - ${MY_DEST}/${libname}.1 || \ - die "failed to create ${libname} symlink" - fi - - # Always create the symlink from the raw lib to the .1 - dosym ${libname}.1 \ - ${MY_DEST}/${libname} || \ - die "failed to create ${libname} symlink" -} - -src_install() { - if use kernel_linux; then - linux-mod_src_install - - VIDEOGROUP="$(egetent group video | cut -d ':' -f 3)" - if [ -z "$VIDEOGROUP" ]; then - eerror "Failed to determine the video group gid." - die "Failed to determine the video group gid." - fi - - # Add the aliases - [ -f "${FILESDIR}/nvidia-169.07" ] || die "nvidia missing in FILESDIR" - sed -e 's:PACKAGE:'${PF}':g' \ - -e 's:VIDEOGID:'${VIDEOGROUP}':' "${FILESDIR}"/nvidia-169.07 > \ - "${WORKDIR}"/nvidia - insinto /etc/modprobe.d - newins "${WORKDIR}"/nvidia nvidia.conf || die - - local udevdir=/lib/udev - has_version sys-fs/udev && udevdir="$($(tc-getPKG_CONFIG) --variable=udevdir udev)" - - # Ensures that our device nodes are created when not using X - exeinto "${udevdir}" - doexe "${FILESDIR}"/nvidia-udev.sh - - insinto "${udevdir}"/rules.d - newins "${FILESDIR}"/nvidia.udev-rule 99-nvidia.rules - elif use kernel_FreeBSD; then - if use x86-fbsd; then - insinto /boot/modules - doins "${S}/src/nvidia.kld" || die - fi - - exeinto /boot/modules - doexe "${S}/src/nvidia.ko" || die - fi - - # NVIDIA kernel <-> userspace driver config lib - donvidia ${NV_OBJ}/libnvidia-cfg.so ${NV_SOVER} - - if use kernel_linux; then - # NVIDIA video decode <-> CUDA - donvidia ${NV_OBJ}/libnvcuvid.so ${NV_SOVER} - fi - - if use X; then - # Xorg DDX driver - insinto /usr/$(get_libdir)/xorg/modules/drivers - doins ${NV_X11}/nvidia_drv.so || die "failed to install nvidia_drv.so" - - # Xorg GLX driver - donvidia ${NV_X11}/libglx.so ${NV_SOVER} \ - /usr/$(get_libdir)/opengl/nvidia/extensions - - # XvMC driver - dolib.a ${NV_X11}/libXvMCNVIDIA.a || \ - die "failed to install libXvMCNVIDIA.so" - donvidia ${NV_X11}/libXvMCNVIDIA.so ${NV_SOVER} - dosym libXvMCNVIDIA.so.${NV_SOVER} \ - /usr/$(get_libdir)/libXvMCNVIDIA_dynamic.so.1 || \ - die "failed to create libXvMCNVIDIA_dynamic.so symlink" - fi - - # OpenCL ICD for NVIDIA - if use kernel_linux; then - insinto /etc/OpenCL/vendors - doins nvidia.icd - donvidia ${NV_OBJ}/libnvidia-opencl.so ${NV_SOVER} - fi - - # Documentation - dohtml ${NV_DOC}/html/* - if use kernel_FreeBSD; then - dodoc "${NV_DOC}/README" - use X && doman "${NV_MAN}/nvidia-xconfig.1" - use tools && doman "${NV_MAN}/nvidia-settings.1" - else - # Docs - newdoc "${NV_DOC}/README.txt" README - dodoc "${NV_DOC}/NVIDIA_Changelog" - doman "${NV_MAN}/nvidia-smi.1.gz" - use X && doman "${NV_MAN}/nvidia-xconfig.1.gz" - use tools && doman "${NV_MAN}/nvidia-settings.1.gz" - doman "${NV_MAN}/nvidia-cuda-proxy-control.1.gz" - fi - - # Helper Apps - exeinto /opt/bin/ - - if use X; then - doexe ${NV_OBJ}/nvidia-xconfig || die - fi - - if use kernel_linux ; then - doexe ${NV_OBJ}/nvidia-debugdump || die - doexe ${NV_OBJ}/nvidia-cuda-proxy-control || die - doexe ${NV_OBJ}/nvidia-cuda-proxy-server || die - doexe ${NV_OBJ}/nvidia-smi || die - newinitd "${FILESDIR}/nvidia-smi.init" nvidia-smi - fi - - if use tools; then - doexe ${NV_OBJ}/nvidia-settings || die - fi - - exeinto /usr/bin/ - doexe ${NV_OBJ}/nvidia-bug-report.sh || die - - # Desktop entries for nvidia-settings - if use tools ; then - newicon ${NV_OBJ}/nvidia-settings.png nvidia-drivers-settings.png - domenu "${FILESDIR}"/nvidia-drivers-settings.desktop - insinto /etc/xdg/autostart - doins "${FILESDIR}"/nvidia-autostart.desktop - fi - - #doenvd "${FILESDIR}"/50nvidia-prelink-blacklist - - if has_multilib_profile && use multilib ; then - local OABI=${ABI} - for ABI in $(get_install_abis) ; do - src_install-libs - done - ABI=${OABI} - unset OABI - else - src_install-libs - fi - - is_final_abi || die "failed to iterate through all ABIs" -} - -src_install-libs() { - local inslibdir=$(get_libdir) - local GL_ROOT="/usr/$(get_libdir)/opengl/nvidia/lib" - local CL_ROOT="/usr/$(get_libdir)/OpenCL/vendors/nvidia" - local libdir=${NV_OBJ} - - if use kernel_linux && has_multilib_profile && \ - [[ ${ABI} == "x86" ]] ; then - libdir=${NV_OBJ}/32 - fi - - if use X; then - # The GLX libraries - donvidia ${libdir}/libGL.so ${NV_SOVER} ${GL_ROOT} - donvidia ${libdir}/libnvidia-glcore.so ${NV_SOVER} - if use kernel_FreeBSD; then - donvidia ${libdir}/libnvidia-tls.so ${NV_SOVER} ${GL_ROOT} - else - donvidia ${libdir}/tls/libnvidia-tls.so ${NV_SOVER} ${GL_ROOT} - fi - - # VDPAU - donvidia ${libdir}/libvdpau_nvidia.so ${NV_SOVER} - fi - - # NVIDIA monitoring library - if use kernel_linux ; then - donvidia ${libdir}/libnvidia-ml.so ${NV_SOVER} - fi - - # CUDA & OpenCL - if use kernel_linux; then - donvidia ${libdir}/libcuda.so ${NV_SOVER} - donvidia ${libdir}/libnvidia-compiler.so ${NV_SOVER} - donvidia ${libdir}/libOpenCL.so 1.0.0 ${CL_ROOT} - fi -} - -pkg_preinst() { - use kernel_linux && linux-mod_pkg_preinst - - # Clean the dynamic libGL stuff's home to ensure - # we dont have stale libs floating around - if [ -d "${ROOT}"/usr/lib/opengl/nvidia ] ; then - rm -rf "${ROOT}"/usr/lib/opengl/nvidia/* - fi - # Make sure we nuke the old nvidia-glx's env.d file - if [ -e "${ROOT}"/etc/env.d/09nvidia ] ; then - rm -f "${ROOT}"/etc/env.d/09nvidia - fi -} - -pkg_postinst() { - use kernel_linux && linux-mod_pkg_postinst - - # Switch to the nvidia implementation - use X && "${ROOT}"/usr/bin/eselect opengl set --use-old nvidia - "${ROOT}"/usr/bin/eselect opencl set --use-old nvidia - - elog "You must be in the video group to use the NVIDIA device" - elog "For more info, read the docs at" - elog "http://www.gentoo.org/doc/en/nvidia-guide.xml#doc_chap3_sect6" - elog - elog "This ebuild installs a kernel module and X driver. Both must" - elog "match explicitly in their version. This means, if you restart" - elog "X, you must modprobe -r nvidia before starting it back up" - elog - elog "To use the NVIDIA GLX, run \"eselect opengl set nvidia\"" - elog - elog "To use the NVIDIA CUDA/OpenCL, run \"eselect opencl set nvidia\"" - elog - elog "NVIDIA has requested that any bug reports submitted have the" - elog "output of /opt/bin/nvidia-bug-report.sh included." - elog - if ! use X; then - elog "You have elected to not install the X.org driver. Along with" - elog "this the OpenGL libraries, XvMC, and VDPAU libraries were not" - elog "installed. Additionally, once the driver is loaded your card" - elog "and fan will run at max speed which may not be desirable." - elog "Use the 'nvidia-smi' init script to have your card and fan" - elog "speed scale appropriately." - elog - fi - if ! use tools; then - elog "USE=tools controls whether the nvidia-settings application" - elog "is installed. If you would like to use it, enable that" - elog "flag and re-emerge this ebuild. Optionally you can install" - elog "media-video/nvidia-settings" - elog - fi -} - -pkg_prerm() { - use X && "${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11 -} - -pkg_postrm() { - use kernel_linux && linux-mod_pkg_postrm - use X && "${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11 -}