Added patch to use NVX_GPU_MEMORY_INFO extension for more exact video memory accounting on NVIDIA graphic cards.

This commit is contained in:
Sebastian Lackner 2015-06-06 20:28:46 +02:00
parent d2765a37f2
commit 6b78b26763
5 changed files with 167 additions and 37 deletions

View File

@ -39,7 +39,7 @@ Wine. All those differences are also documented on the
Included bug fixes and improvements
-----------------------------------
**Bug fixes and features included in the next upcoming release [17]:**
**Bug fixes and features included in the next upcoming release [18]:**
* Add implementation for kernel32.GetNumaProcessorNode ([Wine Bug #38660](https://bugs.winehq.org/show_bug.cgi?id=38660))
* Add semi-stub for FileFsVolumeInformation information class ([Wine Bug #21466](https://bugs.winehq.org/show_bug.cgi?id=21466))
@ -58,6 +58,7 @@ Included bug fixes and improvements
* Support for AT_ROUND_TO_PAGE flag in NtMapViewOfSection
* Support for NtSetInformationFile class FileLinkInformation
* Support for NtSetInformationFile class FileRenameInformation ([Wine Bug #30399](https://bugs.winehq.org/show_bug.cgi?id=30399))
* Use NVX_GPU_MEMORY_INFO extension for more exact video memory accounting on NVIDIA graphic cards
**Bug fixes and features in Wine Staging 1.7.44 [236]:**

2
debian/changelog vendored
View File

@ -36,6 +36,8 @@ wine-staging (1.7.45) UNRELEASED; urgency=low
long lines.
* Added patch to improve stubs for NtQueryEaFile.
* Added patch for semi-stub of FileFsVolumeInformation information class.
* Added patch to use NVX_GPU_MEMORY_INFO extension for more exact video memory
accounting on NVIDIA graphic cards.
* Removed patch to handle '\r' as whitespace in wbemprox queries (accepted
upstream).
* Removed patch to make sure OpenClipboard with current owner doesn't fail

View File

@ -261,6 +261,7 @@ patch_enable_all ()
enable_winecfg_Staging="$1"
enable_winecfg_Unmounted_Devices="$1"
enable_wineconsole_Insert_Mode="$1"
enable_wined3d_Accounting="$1"
enable_wined3d_CSMT_Helper="$1"
enable_wined3d_CSMT_Main="$1"
enable_wined3d_DXTn="$1"
@ -858,6 +859,9 @@ patch_enable ()
wineconsole-Insert_Mode)
enable_wineconsole_Insert_Mode="$2"
;;
wined3d-Accounting)
enable_wined3d_Accounting="$2"
;;
wined3d-CSMT_Helper)
enable_wined3d_CSMT_Helper="$2"
;;
@ -5126,6 +5130,18 @@ if test "$enable_wineconsole_Insert_Mode" -eq 1; then
) >> "$patchlist"
fi
# Patchset wined3d-Accounting
# |
# | Modified files:
# | * dlls/wined3d/device.c, dlls/wined3d/directx.c, dlls/wined3d/wined3d_gl.h
# |
if test "$enable_wined3d_Accounting" -eq 1; then
patch_apply wined3d-Accounting/0001-wined3d-Use-real-values-for-memory-accounting-on-NVI.patch
(
echo '+ { "Michael Müller", "wined3d: Use real values for memory accounting on NVIDIA cards.", 1 },';
) >> "$patchlist"
fi
# Patchset wined3d-Revert_DepthStencil_Location
# |
# | This patchset fixes the following Wine bugs:
@ -5157,42 +5173,6 @@ if test "$enable_wined3d_CSMT_Helper" -eq 1; then
) >> "$patchlist"
fi
# Patchset wined3d-UnhandledBlendFactor
# |
# | Modified files:
# | * dlls/wined3d/state.c
# |
if test "$enable_wined3d_UnhandledBlendFactor" -eq 1; then
patch_apply wined3d-UnhandledBlendFactor/0001-wined3d-Silence-repeated-Unhandled-blend-factor-0-me.patch
(
echo '+ { "Sebastian Lackner", "wined3d: Silence repeated '\''Unhandled blend factor 0'\'' messages.", 1 },';
) >> "$patchlist"
fi
# Patchset wined3d-resource_check_usage
# |
# | Modified files:
# | * dlls/wined3d/resource.c
# |
if test "$enable_wined3d_resource_check_usage" -eq 1; then
patch_apply wined3d-resource_check_usage/0001-wined3d-Silence-repeated-resource_check_usage-FIXME.patch
(
echo '+ { "Erich E. Hoover", "wined3d: Silence repeated resource_check_usage FIXME.", 2 },';
) >> "$patchlist"
fi
# Patchset wined3d-wined3d_swapchain_present
# |
# | Modified files:
# | * dlls/wined3d/swapchain.c
# |
if test "$enable_wined3d_wined3d_swapchain_present" -eq 1; then
patch_apply wined3d-wined3d_swapchain_present/0001-wined3d-Silence-repeated-wined3d_swapchain_present-F.patch
(
echo '+ { "Sebastian Lackner", "wined3d: Silence repeated wined3d_swapchain_present FIXME.", 1 },';
) >> "$patchlist"
fi
# Patchset wined3d-Multisampling
# |
# | This patchset fixes the following Wine bugs:
@ -5242,6 +5222,42 @@ if test "$enable_wined3d_Revert_PixelFormat" -eq 1; then
) >> "$patchlist"
fi
# Patchset wined3d-UnhandledBlendFactor
# |
# | Modified files:
# | * dlls/wined3d/state.c
# |
if test "$enable_wined3d_UnhandledBlendFactor" -eq 1; then
patch_apply wined3d-UnhandledBlendFactor/0001-wined3d-Silence-repeated-Unhandled-blend-factor-0-me.patch
(
echo '+ { "Sebastian Lackner", "wined3d: Silence repeated '\''Unhandled blend factor 0'\'' messages.", 1 },';
) >> "$patchlist"
fi
# Patchset wined3d-resource_check_usage
# |
# | Modified files:
# | * dlls/wined3d/resource.c
# |
if test "$enable_wined3d_resource_check_usage" -eq 1; then
patch_apply wined3d-resource_check_usage/0001-wined3d-Silence-repeated-resource_check_usage-FIXME.patch
(
echo '+ { "Erich E. Hoover", "wined3d: Silence repeated resource_check_usage FIXME.", 2 },';
) >> "$patchlist"
fi
# Patchset wined3d-wined3d_swapchain_present
# |
# | Modified files:
# | * dlls/wined3d/swapchain.c
# |
if test "$enable_wined3d_wined3d_swapchain_present" -eq 1; then
patch_apply wined3d-wined3d_swapchain_present/0001-wined3d-Silence-repeated-wined3d_swapchain_present-F.patch
(
echo '+ { "Sebastian Lackner", "wined3d: Silence repeated wined3d_swapchain_present FIXME.", 1 },';
) >> "$patchlist"
fi
# Patchset wined3d-CSMT_Main
# |
# | This patchset fixes the following Wine bugs:

View File

@ -0,0 +1,110 @@
From 10565101ae7063c68218c68487b8e57d044496ff Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sat, 6 Jun 2015 06:53:34 +0200
Subject: wined3d: Use real values for memory accounting on NVIDIA cards.
---
dlls/wined3d/device.c | 23 +++++++++++++++++++++++
dlls/wined3d/directx.c | 16 ++++++++++++++--
dlls/wined3d/wined3d_gl.h | 1 +
3 files changed, 38 insertions(+), 2 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 56cf325..8f62570 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -1181,8 +1181,31 @@ void CDECL wined3d_device_set_multithreaded(struct wined3d_device *device)
UINT CDECL wined3d_device_get_available_texture_mem(const struct wined3d_device *device)
{
+ const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
+
TRACE("device %p.\n", device);
+ /* We can not acquire the context unless there is a swapchain. */
+ if (device->swapchains && gl_info->supported[NVX_GPU_MEMORY_INFO] &&
+ !wined3d_settings.emulated_textureram)
+ {
+ GLint vram_free_kb;
+ UINT64 vram_free;
+
+ struct wined3d_context *context = context_acquire(device, NULL);
+ gl_info->gl_ops.gl.p_glGetIntegerv(GL_GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX, &vram_free_kb);
+ vram_free = (UINT64)vram_free_kb * 1024;
+ context_release(context);
+
+ TRACE("Total 0x%s bytes. emulation 0x%s left, driver 0x%s left.\n",
+ wine_dbgstr_longlong(device->adapter->vram_bytes),
+ wine_dbgstr_longlong(device->adapter->vram_bytes - device->adapter->vram_bytes_used),
+ wine_dbgstr_longlong(vram_free));
+
+ vram_free = min(vram_free, device->adapter->vram_bytes - device->adapter->vram_bytes_used);
+ return min(UINT_MAX, vram_free);
+ }
+
TRACE("Emulating 0x%s bytes. 0x%s used, returning 0x%s left.\n",
wine_dbgstr_longlong(device->adapter->vram_bytes),
wine_dbgstr_longlong(device->adapter->vram_bytes_used),
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index eb749ea..c1eeaef 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -220,6 +220,7 @@ static const struct wined3d_extension_map gl_extension_map[] =
{"GL_NV_vertex_program2", NV_VERTEX_PROGRAM2 },
{"GL_NV_vertex_program2_option", NV_VERTEX_PROGRAM2_OPTION },
{"GL_NV_vertex_program3", NV_VERTEX_PROGRAM3 },
+ {"GL_NVX_gpu_memory_info", NVX_GPU_MEMORY_INFO },
/* SGI */
{"GL_SGIS_generate_mipmap", SGIS_GENERATE_MIPMAP },
@@ -1391,7 +1392,8 @@ static const struct gpu_description *get_gpu_description(enum wined3d_pci_vendor
return NULL;
}
-static void init_driver_info(struct wined3d_driver_info *driver_info,
+/* Context activation is done by the caller. */
+static void init_driver_info(struct wined3d_gl_info *gl_info, struct wined3d_driver_info *driver_info,
enum wined3d_pci_vendor vendor, enum wined3d_pci_device device)
{
OSVERSIONINFOW os_version;
@@ -1500,6 +1502,16 @@ static void init_driver_info(struct wined3d_driver_info *driver_info,
driver = DRIVER_UNKNOWN;
}
+ if (gl_info->supported[NVX_GPU_MEMORY_INFO])
+ {
+ GLint vram_kb;
+ gl_info->gl_ops.gl.p_glGetIntegerv(GL_GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX, &vram_kb);
+
+ driver_info->vram_bytes = (UINT64)vram_kb * 1024;
+ TRACE("Got 0x%s as video memory from NVX_GPU_MEMORY_INFO extension.\n",
+ wine_dbgstr_longlong(driver_info->vram_bytes));
+ }
+
if (wined3d_settings.emulated_textureram)
{
TRACE("Overriding amount of video memory with 0x%s bytes.\n",
@@ -3652,7 +3664,7 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter)
adapter->d3d_info.valid_rt_mask |= (1 << i);
fixup_extensions(gl_info, gl_renderer_str, gl_vendor, card_vendor, device);
- init_driver_info(driver_info, card_vendor, device);
+ init_driver_info(gl_info, driver_info, card_vendor, device);
add_gl_compat_wrappers(gl_info);
return TRUE;
diff --git a/dlls/wined3d/wined3d_gl.h b/dlls/wined3d/wined3d_gl.h
index 009dca6..2c400fa 100644
--- a/dlls/wined3d/wined3d_gl.h
+++ b/dlls/wined3d/wined3d_gl.h
@@ -153,6 +153,7 @@ enum wined3d_gl_extension
NV_VERTEX_PROGRAM2,
NV_VERTEX_PROGRAM2_OPTION,
NV_VERTEX_PROGRAM3,
+ NVX_GPU_MEMORY_INFO,
/* SGI */
SGIS_GENERATE_MIPMAP,
/* WGL extensions */
--
2.4.2

View File

@ -0,0 +1 @@
Fixes: Use NVX_GPU_MEMORY_INFO extension for more exact video memory accounting on NVIDIA graphic cards