Rebase against d7e4193df2f22a87031e44ce358a626a5f92b295.

FIXME: Should destroy_default_sampler() also be called from delete_opengl_contexts() in the non-CSMT case?
This commit is contained in:
Sebastian Lackner 2016-01-07 00:05:49 +01:00
parent ff0e7cc638
commit 98e45e14d9
12 changed files with 238 additions and 503 deletions

View File

@ -1,58 +0,0 @@
From d3a6fb5dc0a0494627c0980ca8d5e5ee89df4fbc Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sat, 5 Dec 2015 19:36:20 +0100
Subject: kernel32: Clamp maximum window size to screen buffer size.
---
dlls/kernel32/console.c | 4 ++--
dlls/kernel32/tests/console.c | 9 +++++++++
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/dlls/kernel32/console.c b/dlls/kernel32/console.c
index 3c53b52..85e4ba8 100644
--- a/dlls/kernel32/console.c
+++ b/dlls/kernel32/console.c
@@ -2160,8 +2160,8 @@ BOOL WINAPI GetConsoleScreenBufferInfo(HANDLE hConsoleOutput, LPCONSOLE_SCREEN_B
csbi->srWindow.Right = reply->win_right;
csbi->srWindow.Top = reply->win_top;
csbi->srWindow.Bottom = reply->win_bottom;
- csbi->dwMaximumWindowSize.X = reply->max_width;
- csbi->dwMaximumWindowSize.Y = reply->max_height;
+ csbi->dwMaximumWindowSize.X = min(reply->width, reply->max_width);
+ csbi->dwMaximumWindowSize.Y = min(reply->height, reply->max_height);
}
}
SERVER_END_REQ;
diff --git a/dlls/kernel32/tests/console.c b/dlls/kernel32/tests/console.c
index f362415..43a4b75 100644
--- a/dlls/kernel32/tests/console.c
+++ b/dlls/kernel32/tests/console.c
@@ -2686,9 +2686,11 @@ static void test_GetLargestConsoleWindowSize(HANDLE std_output)
COORD c, font;
RECT r;
LONG workarea_w, workarea_h, maxcon_w, maxcon_h;
+ CONSOLE_SCREEN_BUFFER_INFO sbi;
CONSOLE_FONT_INFO cfi;
DWORD index, i;
HMODULE hmod;
+ BOOL ret;
DWORD (WINAPI *pGetNumberOfConsoleFonts)(void);
BOOL (WINAPI *pSetConsoleFont)(HANDLE, DWORD);
@@ -2740,6 +2742,13 @@ static void test_GetLargestConsoleWindowSize(HANDLE std_output)
maxcon_h = workarea_h / font.Y;
ok(c.X == maxcon_w || c.X == maxcon_w - 1 /* Win10 */, "got %d, expected %d\n", c.X, maxcon_w);
ok(c.Y == maxcon_h || c.Y == maxcon_h - 1 /* Win10 */, "got %d, expected %d\n", c.Y, maxcon_h);
+
+ ret = GetConsoleScreenBufferInfo(std_output, &sbi);
+ ok(ret, "GetConsoleScreenBufferInfo failed %u\n", GetLastError());
+ ok(sbi.dwMaximumWindowSize.X == min(c.X, sbi.dwSize.X), "got %d, expected %d\n",
+ sbi.dwMaximumWindowSize.X, min(c.X, sbi.dwSize.X));
+ ok(sbi.dwMaximumWindowSize.Y == min(c.Y, sbi.dwSize.Y), "got %d, expected %d\n",
+ sbi.dwMaximumWindowSize.Y, min(c.Y, sbi.dwSize.Y));
}
pSetConsoleFont(std_output, index); /* restore original font size */
}
--
2.6.2

View File

@ -1 +0,0 @@
Depends: ntdll-x86_64_set_cpu_context

View File

@ -1,57 +0,0 @@
From abaac4383f22f06b4d6e703d243f30de4bf90229 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sun, 29 Nov 2015 00:34:04 +0100
Subject: ntdll: Allow to set debug registers separately in NtSetContextThread.
---
dlls/ntdll/signal_x86_64.c | 24 ++++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)
diff --git a/dlls/ntdll/signal_x86_64.c b/dlls/ntdll/signal_x86_64.c
index 524de68..02710a4 100644
--- a/dlls/ntdll/signal_x86_64.c
+++ b/dlls/ntdll/signal_x86_64.c
@@ -1800,11 +1800,12 @@ __ASM_GLOBAL_FUNC( RtlCaptureContext,
"ret" );
/***********************************************************************
- * set_cpu_context
+ * __wine_restore_regs
*
* Set the new CPU context.
*/
-__ASM_GLOBAL_FUNC( set_cpu_context,
+extern void __wine_restore_regs( const CONTEXT *context );
+__ASM_GLOBAL_FUNC( __wine_restore_regs,
"subq $40,%rsp\n\t"
__ASM_CFI(".cfi_adjust_cfa_offset 40\n\t")
"ldmxcsr 0x34(%rdi)\n\t" /* context->MxCsr */
@@ -1852,6 +1853,25 @@ __ASM_GLOBAL_FUNC( set_cpu_context,
"movq 0xb0(%rdi),%rdi\n\t" /* context->Rdi */
"iretq" );
+
+/***********************************************************************
+ * set_cpu_context
+ *
+ * Set the new CPU context. Used by NtSetContextThread.
+ */
+void set_cpu_context( const CONTEXT *context )
+{
+ DWORD flags = context->ContextFlags & ~CONTEXT_AMD64;
+ if (flags & CONTEXT_FULL)
+ {
+ if (!(flags & CONTEXT_CONTROL))
+ FIXME( "setting partial context (%x) not supported\n", flags );
+ else
+ __wine_restore_regs( context );
+ }
+}
+
+
/***********************************************************************
* copy_context
*
--
2.6.4

View File

@ -1,29 +0,0 @@
From 71095e2e64ba74798bc037ad25ec9a14d59dbd4b Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Mon, 28 Dec 2015 01:59:47 +0100
Subject: ntdll: Receive debug registers from server on x86_64.
---
dlls/ntdll/thread.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c
index aaf7a71..1455eb1 100644
--- a/dlls/ntdll/thread.c
+++ b/dlls/ntdll/thread.c
@@ -830,9 +830,11 @@ NTSTATUS WINAPI NtGetContextThread( HANDLE handle, CONTEXT *context )
DWORD needed_flags = context->ContextFlags;
BOOL self = (handle == GetCurrentThread());
+ /* on i386/amd64 debug registers always require a server call */
#ifdef __i386__
- /* on i386 debug registers always require a server call */
if (context->ContextFlags & (CONTEXT_DEBUG_REGISTERS & ~CONTEXT_i386)) self = FALSE;
+#elif defined(__x86_64__)
+ if (context->ContextFlags & (CONTEXT_DEBUG_REGISTERS & ~CONTEXT_AMD64)) self = FALSE;
#endif
if (!self)
--
2.6.4

View File

@ -1,117 +0,0 @@
From 2db0a83315fbe9f84369f0123ad1b5f27a4b202e Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Mon, 28 Dec 2015 03:00:56 +0100
Subject: ntdll/tests: Add tests for setting debug registers with
NtSetContextThread.
---
dlls/ntdll/tests/exception.c | 79 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 79 insertions(+)
diff --git a/dlls/ntdll/tests/exception.c b/dlls/ntdll/tests/exception.c
index a368997..f355513 100644
--- a/dlls/ntdll/tests/exception.c
+++ b/dlls/ntdll/tests/exception.c
@@ -1723,6 +1723,83 @@ static void test_dynamic_unwind(void)
#endif /* __x86_64__ */
#if defined(__i386__) || defined(__x86_64__)
+
+static void test_debug_registers(void)
+{
+ NTSTATUS status;
+ CONTEXT ctx, ctx2;
+
+ memset(&ctx, 0, sizeof(ctx));
+ ctx.ContextFlags = CONTEXT_DEBUG_REGISTERS;
+ ctx2.ContextFlags = CONTEXT_DEBUG_REGISTERS;
+
+ ctx.Dr0 = 0x42424240;
+ ctx.Dr2 = 0x126bb070;
+ ctx.Dr3 = 0x0badbad0;
+ ctx.Dr7 = 0xffff0115;
+ status = pNtSetContextThread(GetCurrentThread(), &ctx);
+ ok(status == STATUS_SUCCESS, "NtGetContextThread failed with %08x\n", status);
+ status = pNtGetContextThread(GetCurrentThread(), &ctx2);
+ ok(status == STATUS_SUCCESS, "NtGetContextThread failed with %x\n", status);
+ ctx2.Dr6 &= 0xf00f; ctx2.Dr7 &= ~0xdc00;
+ ok(ctx2.Dr0 == ctx.Dr0, "expected %lx, got %lx\n", (DWORD_PTR)ctx.Dr0, (DWORD_PTR)ctx2.Dr0);
+ ok(ctx2.Dr1 == ctx.Dr1, "expected %lx, got %lx\n", (DWORD_PTR)ctx.Dr1, (DWORD_PTR)ctx2.Dr1);
+ ok(ctx2.Dr2 == ctx.Dr2, "expected %lx, got %lx\n", (DWORD_PTR)ctx.Dr2, (DWORD_PTR)ctx2.Dr2);
+ ok(ctx2.Dr3 == ctx.Dr3, "expected %lx, got %lx\n", (DWORD_PTR)ctx.Dr3, (DWORD_PTR)ctx2.Dr3);
+ ok(ctx2.Dr6 == ctx.Dr6, "expected %lx, got %lx\n", (DWORD_PTR)ctx.Dr6, (DWORD_PTR)ctx2.Dr6);
+ ok(ctx2.Dr7 == ctx.Dr7, "expected %lx, got %lx\n", (DWORD_PTR)ctx.Dr7, (DWORD_PTR)ctx2.Dr7);
+
+ ctx.Dr0 = 0x42424242;
+ ctx.Dr2 = 0x100f0fe7;
+ ctx.Dr3 = 0x0abebabe;
+ ctx.Dr7 = 0x115;
+ status = pNtSetContextThread(GetCurrentThread(), &ctx);
+ ok(status == STATUS_SUCCESS, "NtGetContextThread failed with %08x\n", status);
+ status = pNtGetContextThread(GetCurrentThread(), &ctx2);
+ ok(status == STATUS_SUCCESS, "NtGetContextThread failed with %x\n", status);
+ ctx2.Dr6 &= 0xf00f; ctx2.Dr7 &= ~0xdc00;
+ ok(ctx2.Dr0 == ctx.Dr0, "expected %lx, got %lx\n", (DWORD_PTR)ctx.Dr0, (DWORD_PTR)ctx2.Dr0);
+ ok(ctx2.Dr1 == ctx.Dr1, "expected %lx, got %lx\n", (DWORD_PTR)ctx.Dr1, (DWORD_PTR)ctx2.Dr1);
+ ok(ctx2.Dr2 == ctx.Dr2, "expected %lx, got %lx\n", (DWORD_PTR)ctx.Dr2, (DWORD_PTR)ctx2.Dr2);
+ ok(ctx2.Dr3 == ctx.Dr3, "expected %lx, got %lx\n", (DWORD_PTR)ctx.Dr3, (DWORD_PTR)ctx2.Dr3);
+ ok(ctx2.Dr6 == ctx.Dr6, "expected %lx, got %lx\n", (DWORD_PTR)ctx.Dr6, (DWORD_PTR)ctx2.Dr6);
+ ok(ctx2.Dr7 == ctx.Dr7, "expected %lx, got %lx\n", (DWORD_PTR)ctx.Dr7, (DWORD_PTR)ctx2.Dr7);
+
+ /* setting Gx flags is not allowed */
+ ctx.Dr7 |= 0xaa;
+ status = pNtSetContextThread(GetCurrentThread(), &ctx);
+ ok(status == STATUS_SUCCESS, "NtGetContextThread failed with %08x\n", status);
+ status = pNtGetContextThread(GetCurrentThread(), &ctx2);
+ ok(status == STATUS_SUCCESS, "NtGetContextThread failed with %x\n", status);
+ ctx.Dr7 &= ~0xaa; ctx2.Dr7 &= ~0xdc00;
+todo_wine
+ ok(ctx2.Dr7 == ctx.Dr7, "expected %lx, got %lx\n", (DWORD_PTR)ctx.Dr7, (DWORD_PTR)ctx2.Dr7);
+
+ /* setting GE flag is not allowed on 32-bit, but on 64-bit */
+ ctx.Dr7 |= 0x200;
+ status = pNtSetContextThread(GetCurrentThread(), &ctx);
+ ok(status == STATUS_SUCCESS, "NtGetContextThread failed with %08x\n", status);
+ status = pNtGetContextThread(GetCurrentThread(), &ctx2);
+ ok(status == STATUS_SUCCESS, "NtGetContextThread failed with %x\n", status);
+#ifdef __i386__
+ ctx.Dr7 &= ~0x200; ctx2.Dr7 &= ~0xdc00;
+todo_wine
+ ok(ctx2.Dr7 == ctx.Dr7, "expected %lx, got %lx\n", (DWORD_PTR)ctx.Dr7, (DWORD_PTR)ctx2.Dr7);
+#else
+ ctx2.Dr7 &= ~0xdc00;
+ ok(ctx2.Dr7 == ctx.Dr7, "expected %lx, got %lx\n", (DWORD_PTR)ctx.Dr7, (DWORD_PTR)ctx2.Dr7);
+#endif
+
+ /* clearing LE flag is allowed */
+ ctx.Dr7 &= ~0x100;
+ status = pNtSetContextThread(GetCurrentThread(), &ctx);
+ ok(status == STATUS_SUCCESS, "NtGetContextThread failed with %08x\n", status);
+ status = pNtGetContextThread(GetCurrentThread(), &ctx2);
+ ok(status == STATUS_SUCCESS, "NtGetContextThread failed with %x\n", status);
+ ctx2.Dr7 &= ~0xdc00;
+ ok(ctx2.Dr7 == ctx.Dr7, "expected %lx, got %lx\n", (DWORD_PTR)ctx.Dr7, (DWORD_PTR)ctx2.Dr7);
+}
+
static DWORD outputdebugstring_exceptions;
static LONG CALLBACK outputdebugstring_vectored_handler(EXCEPTION_POINTERS *ExceptionInfo)
@@ -1946,6 +2023,7 @@ START_TEST(exception)
test_unwind();
test_exceptions();
test_rtlraiseexception();
+ test_debug_registers();
test_outputdebugstring(1, FALSE);
test_ripevent(1);
test_vectored_continue_handler();
@@ -1965,6 +2043,7 @@ START_TEST(exception)
pRtlLookupFunctionEntry = (void *)GetProcAddress( hntdll,
"RtlLookupFunctionEntry" );
+ test_debug_registers();
test_outputdebugstring(1, FALSE);
test_ripevent(1);
test_vectored_continue_handler();
--
2.6.4

View File

@ -1 +0,0 @@
Fixes: [39454] Allow to set debug registers separately in NtSetContextThread

View File

@ -52,7 +52,7 @@ usage()
# Get the upstream commit sha
upstream_commit()
{
echo "367b30d8278684aaff373f5666b78264137d7a8f"
echo "d7e4193df2f22a87031e44ce358a626a5f92b295"
}
# Show version information
@ -157,7 +157,6 @@ patch_enable_all ()
enable_kernel32_Cwd_Startup_Info="$1"
enable_kernel32_FreeUserPhysicalPages="$1"
enable_kernel32_GetFinalPathNameByHandle="$1"
enable_kernel32_GetLargestConsoleWindowSize="$1"
enable_kernel32_LocaleNameToLCID="$1"
enable_kernel32_Named_Pipe="$1"
enable_kernel32_NeedCurrentDirectoryForExePath="$1"
@ -220,7 +219,6 @@ patch_enable_all ()
enable_ntdll_WinSqm="$1"
enable_ntdll_WriteWatches="$1"
enable_ntdll_Zero_mod_name="$1"
enable_ntdll_x86_64_set_cpu_context="$1"
enable_ntoskrnl_DriverTest="$1"
enable_ntoskrnl_Stubs="$1"
enable_nvapi_Stub_DLL="$1"
@ -587,9 +585,6 @@ patch_enable ()
kernel32-GetFinalPathNameByHandle)
enable_kernel32_GetFinalPathNameByHandle="$2"
;;
kernel32-GetLargestConsoleWindowSize)
enable_kernel32_GetLargestConsoleWindowSize="$2"
;;
kernel32-LocaleNameToLCID)
enable_kernel32_LocaleNameToLCID="$2"
;;
@ -776,9 +771,6 @@ patch_enable ()
ntdll-Zero_mod_name)
enable_ntdll_Zero_mod_name="$2"
;;
ntdll-x86_64_set_cpu_context)
enable_ntdll_x86_64_set_cpu_context="$2"
;;
ntoskrnl-DriverTest)
enable_ntoskrnl_DriverTest="$2"
;;
@ -1966,13 +1958,6 @@ if test "$enable_ntdll_NtQueryEaFile" -eq 1; then
enable_ntdll_Syscall_Wrappers=1
fi
if test "$enable_ntdll_Exception" -eq 1; then
if test "$enable_ntdll_x86_64_set_cpu_context" -gt 1; then
abort "Patchset ntdll-x86_64_set_cpu_context disabled, but ntdll-Exception depends on that."
fi
enable_ntdll_x86_64_set_cpu_context=1
fi
if test "$enable_ntdll_DllRedirects" -eq 1; then
if test "$enable_ntdll_DllOverrides_WOW64" -gt 1; then
abort "Patchset ntdll-DllOverrides_WOW64 disabled, but ntdll-DllRedirects depends on that."
@ -3534,18 +3519,6 @@ if test "$enable_kernel32_GetFinalPathNameByHandle" -eq 1; then
) >> "$patchlist"
fi
# Patchset kernel32-GetLargestConsoleWindowSize
# |
# | Modified files:
# | * dlls/kernel32/console.c, dlls/kernel32/tests/console.c
# |
if test "$enable_kernel32_GetLargestConsoleWindowSize" -eq 1; then
patch_apply kernel32-GetLargestConsoleWindowSize/0001-kernel32-Clamp-maximum-window-size-to-screen-buffer-.patch
(
echo '+ { "Sebastian Lackner", "kernel32: Clamp maximum window size to screen buffer size.", 1 },';
) >> "$patchlist"
fi
# Patchset kernel32-LocaleNameToLCID
# |
# | This patchset fixes the following Wine bugs:
@ -4148,30 +4121,8 @@ if test "$enable_ntdll_DllRedirects" -eq 1; then
) >> "$patchlist"
fi
# Patchset ntdll-x86_64_set_cpu_context
# |
# | This patchset fixes the following Wine bugs:
# | * [#39454] Allow to set debug registers separately in NtSetContextThread
# |
# | Modified files:
# | * dlls/ntdll/signal_x86_64.c, dlls/ntdll/tests/exception.c, dlls/ntdll/thread.c
# |
if test "$enable_ntdll_x86_64_set_cpu_context" -eq 1; then
patch_apply ntdll-x86_64_set_cpu_context/0001-ntdll-Allow-to-set-debug-registers-separately-in-NtS.patch
patch_apply ntdll-x86_64_set_cpu_context/0002-ntdll-Receive-debug-registers-from-server-on-x86_64.patch
patch_apply ntdll-x86_64_set_cpu_context/0003-ntdll-tests-Add-tests-for-setting-debug-registers-wi.patch
(
echo '+ { "Sebastian Lackner", "ntdll: Allow to set debug registers separately in NtSetContextThread.", 1 },';
echo '+ { "Sebastian Lackner", "ntdll: Receive debug registers from server on x86_64.", 1 },';
echo '+ { "Sebastian Lackner", "ntdll/tests: Add tests for setting debug registers with NtSetContextThread.", 1 },';
) >> "$patchlist"
fi
# Patchset ntdll-Exception
# |
# | This patchset has the following (direct or indirect) dependencies:
# | * ntdll-x86_64_set_cpu_context
# |
# | Modified files:
# | * dlls/kernel32/debugger.c, dlls/ntdll/om.c, dlls/ntdll/tests/exception.c
# |
@ -4476,7 +4427,7 @@ fi
# Patchset ntdll-SystemRoot_Symlink
# |
# | This patchset has the following (direct or indirect) dependencies:
# | * ntdll-x86_64_set_cpu_context, ntdll-Exception, ntdll-Syscall_Wrappers
# | * ntdll-Exception, ntdll-Syscall_Wrappers
# |
# | Modified files:
# | * dlls/ntdll/om.c

View File

@ -1,4 +1,4 @@
From 55240026af497ef2d4e3d8edc456e65b989bf59e Mon Sep 17 00:00:00 2001
From c7d9b4666e695ab3c3c3589337108d221665152c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Wed, 2 Oct 2013 12:36:02 +0200
Subject: wined3d: Don't request the frontbuffer to create dummy textures.
@ -8,10 +8,10 @@ Subject: wined3d: Don't request the frontbuffer to create dummy textures.
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 6f82385..f5cb7bd 100644
index ea125c2..0977e12 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -905,8 +905,7 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device,
@@ -991,8 +991,7 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device,
device->swapchains[0] = swapchain;
device_init_swapchain_state(device, swapchain);
@ -20,7 +20,7 @@ index 6f82385..f5cb7bd 100644
+ context = context_acquire(device, NULL);
create_dummy_textures(device, context);
create_default_sampler(device);
--
2.1.3
2.6.4

View File

@ -1,4 +1,4 @@
From c91b5281332e1879e25088efeee24bc1a337ca30 Mon Sep 17 00:00:00 2001
From 410c5748849a9467bd5ee302ea96a20bd770f059 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Thu, 10 Oct 2013 16:29:42 +0200
Subject: wined3d: Create dummy textures through the CS.
@ -6,16 +6,16 @@ Subject: wined3d: Create dummy textures through the CS.
Hacky version. Just good enough to see if the double context during init is what makes fglrx
crash.
---
dlls/wined3d/cs.c | 29 +++++++++++++++++++++++++++++
dlls/wined3d/device.c | 13 ++++---------
dlls/wined3d/wined3d_private.h | 3 ++-
3 files changed, 35 insertions(+), 10 deletions(-)
dlls/wined3d/cs.c | 30 ++++++++++++++++++++++++++++++
dlls/wined3d/device.c | 17 ++++++-----------
dlls/wined3d/wined3d_private.h | 4 +++-
3 files changed, 39 insertions(+), 12 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 5e4aa53..fb1d1aa 100644
index bd83689..383c9a5 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -87,6 +87,7 @@ enum wined3d_cs_op
@@ -88,6 +88,7 @@ enum wined3d_cs_op
WINED3D_CS_OP_VOLUME_CLEANUP,
WINED3D_CS_OP_SURFACE_CLEANUP,
WINED3D_CS_OP_TEXTURE_CLEANUP,
@ -23,7 +23,7 @@ index 5e4aa53..fb1d1aa 100644
WINED3D_CS_OP_STOP,
};
@@ -512,6 +513,11 @@ struct wined3d_cs_texture_cleanup
@@ -522,6 +523,11 @@ struct wined3d_cs_texture_cleanup
struct wined3d_texture *texture;
};
@ -35,7 +35,7 @@ index 5e4aa53..fb1d1aa 100644
static void wined3d_cs_mt_submit(struct wined3d_cs *cs, size_t size)
{
LONG new_val = (cs->queue.head + size) & (WINED3D_CS_QUEUE_SIZE - 1);
@@ -2473,6 +2479,28 @@ void wined3d_cs_emit_texture_cleanup(struct wined3d_cs *cs, struct wined3d_textu
@@ -2587,6 +2593,29 @@ void wined3d_cs_emit_texture_cleanup(struct wined3d_cs *cs, struct wined3d_textu
cs->ops->submit(cs, sizeof(*op));
}
@ -45,6 +45,7 @@ index 5e4aa53..fb1d1aa 100644
+ struct wined3d_context *context = context_acquire(cs->device, NULL);
+
+ device_create_dummy_textures(cs->device, context);
+ device_create_default_sampler(cs->device);
+
+ context_release(context);
+ return sizeof(*op);
@ -64,7 +65,7 @@ index 5e4aa53..fb1d1aa 100644
static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
{
/* WINED3D_CS_OP_NOP */ wined3d_cs_exec_nop,
@@ -2538,6 +2566,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
@@ -2653,6 +2682,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_VOLUME_CLEANUP */ wined3d_cs_exec_volume_cleanup,
/* WINED3D_CS_OP_SURFACE_CLEANUP */ wined3d_cs_exec_surface_cleanup,
/* WINED3D_CS_OP_TEXTURE_CLEANUP */ wined3d_cs_exec_texture_cleanup,
@ -73,10 +74,10 @@ index 5e4aa53..fb1d1aa 100644
static inline void *_wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size, BOOL prio)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index b3f75ba..28b1c81 100644
index c479b80..04a36a2 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -608,7 +608,7 @@ out:
@@ -651,7 +651,7 @@ out:
}
/* Context activation is done by the caller. */
@ -85,7 +86,16 @@ index b3f75ba..28b1c81 100644
{
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
unsigned int i, j, count;
@@ -854,7 +854,6 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device,
@@ -758,7 +758,7 @@ static void destroy_dummy_textures(struct wined3d_device *device, const struct w
}
/* Context activation is done by the caller. */
-static void create_default_sampler(struct wined3d_device *device)
+void device_create_default_sampler(struct wined3d_device *device)
{
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
@@ -940,7 +940,6 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device,
{
static const struct wined3d_color black = {0.0f, 0.0f, 0.0f, 0.0f};
struct wined3d_swapchain *swapchain = NULL;
@ -93,18 +103,20 @@ index b3f75ba..28b1c81 100644
DWORD clear_flags = 0;
HRESULT hr;
@@ -905,9 +904,7 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device,
@@ -991,10 +990,8 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device,
device->swapchains[0] = swapchain;
device_init_swapchain_state(device, swapchain);
- context = context_acquire(device, NULL);
-
- create_dummy_textures(device, context);
- create_default_sampler(device);
+ /* also calls create_default_sampler */
+ wined3d_cs_emit_create_dummy_textures(device->cs);
device->contexts[0]->last_was_rhw = 0;
@@ -919,7 +916,7 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device,
@@ -1006,7 +1003,7 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device,
case ORM_BACKBUFFER:
{
@ -113,7 +125,7 @@ index b3f75ba..28b1c81 100644
{
TRACE("Using auxiliary buffer for offscreen rendering\n");
device->offscreenBuffer = GL_AUX0;
@@ -935,8 +932,6 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device,
@@ -1022,8 +1019,6 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device,
TRACE("All defaults now set up, leaving 3D init.\n");
@ -122,7 +134,7 @@ index b3f75ba..28b1c81 100644
/* Clear the screen */
if (swapchain->back_buffers && swapchain->back_buffers[0])
clear_flags |= WINED3DCLEAR_TARGET;
@@ -4236,7 +4231,7 @@ static HRESULT create_primary_opengl_context(struct wined3d_device *device, stru
@@ -4503,7 +4498,7 @@ static HRESULT create_primary_opengl_context(struct wined3d_device *device, stru
swapchain->context[0] = context;
swapchain->num_contexts = 1;
@ -132,19 +144,20 @@ index b3f75ba..28b1c81 100644
return WINED3D_OK;
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 2f8cab4..a4e1886 100644
index d187c0a..f9ffece 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2076,7 +2076,7 @@ struct wined3d_gl_bo *wined3d_device_get_bo(struct wined3d_device *device, UINT
@@ -2198,7 +2198,8 @@ struct wined3d_gl_bo *wined3d_device_get_bo(struct wined3d_device *device, UINT
GLenum type_hint, struct wined3d_context *context) DECLSPEC_HIDDEN;
void wined3d_device_release_bo(struct wined3d_device *device, struct wined3d_gl_bo *bo,
const struct wined3d_context *context) DECLSPEC_HIDDEN;
-
+void device_create_dummy_textures(struct wined3d_device *device, struct wined3d_context *context) DECLSPEC_HIDDEN;
+void device_create_default_sampler(struct wined3d_device *device);
static inline BOOL isStateDirty(const struct wined3d_context *context, DWORD state)
{
@@ -2715,6 +2715,7 @@ void wined3d_cs_emit_buffer_cleanup(struct wined3d_cs *cs, struct wined3d_buffer
@@ -2837,6 +2838,7 @@ void wined3d_cs_emit_buffer_cleanup(struct wined3d_cs *cs, struct wined3d_buffer
void wined3d_cs_emit_volume_cleanup(struct wined3d_cs *cs, struct wined3d_volume *volume) DECLSPEC_HIDDEN;
void wined3d_cs_emit_surface_cleanup(struct wined3d_cs *cs, struct wined3d_surface *surface) DECLSPEC_HIDDEN;
void wined3d_cs_emit_texture_cleanup(struct wined3d_cs *cs, struct wined3d_texture *texture) DECLSPEC_HIDDEN;
@ -153,5 +166,5 @@ index 2f8cab4..a4e1886 100644
/* Direct3D terminology with little modifications. We do not have an issued state
* because only the driver knows about it, but we have a created state because d3d
--
2.1.3
2.6.4

View File

@ -1,4 +1,4 @@
From 2fa4aafc16726b74a32cfcfae23d68749545114f Mon Sep 17 00:00:00 2001
From e97fb065249c11f83234e5d8b713112725fc3039 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Fri, 11 Oct 2013 10:11:13 +0200
Subject: wined3d: Delete GL contexts through the CS in reset.
@ -11,10 +11,10 @@ Let's see if this fixes the remaining fglrx crashes...
3 files changed, 48 insertions(+), 11 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 3662432..489fad0 100644
index b0b86ae..b30bb4e 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -89,6 +89,7 @@ enum wined3d_cs_op
@@ -90,6 +90,7 @@ enum wined3d_cs_op
WINED3D_CS_OP_TEXTURE_CLEANUP,
WINED3D_CS_OP_CREATE_DUMMY_TEXTURES,
WINED3D_CS_OP_CREATE_SWAPCHAIN_CONTEXT,
@ -22,7 +22,7 @@ index 3662432..489fad0 100644
WINED3D_CS_OP_STOP,
};
@@ -526,6 +527,12 @@ struct wined3d_cs_create_swapchain_context
@@ -536,6 +537,12 @@ struct wined3d_cs_create_swapchain_context
HRESULT *ret;
};
@ -35,7 +35,7 @@ index 3662432..489fad0 100644
static void wined3d_cs_mt_submit(struct wined3d_cs *cs, size_t size)
{
LONG new_val = (cs->queue.head + size) & (WINED3D_CS_QUEUE_SIZE - 1);
@@ -2534,6 +2541,27 @@ HRESULT wined3d_cs_emit_create_swapchain_context(struct wined3d_cs *cs, struct w
@@ -2649,6 +2656,27 @@ HRESULT wined3d_cs_emit_create_swapchain_context(struct wined3d_cs *cs, struct w
return ret;
}
@ -63,7 +63,7 @@ index 3662432..489fad0 100644
static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
{
/* WINED3D_CS_OP_NOP */ wined3d_cs_exec_nop,
@@ -2601,6 +2629,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
@@ -2717,6 +2745,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_TEXTURE_CLEANUP */ wined3d_cs_exec_texture_cleanup,
/* WINED3D_CS_OP_CREATE_DUMMY_TEXTURES */ wined3d_cs_exec_create_dummy_textures,
/* WINED3D_CS_OP_CREATE_SWAPCHAIN_CONTEXT */ wined3d_cs_exec_create_swapchain_context,
@ -72,10 +72,10 @@ index 3662432..489fad0 100644
static inline void *_wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size, BOOL prio)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index a113e21..b96f20f 100644
index 525b61b..039b645 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -4142,22 +4142,12 @@ void CDECL wined3d_device_evict_managed_resources(struct wined3d_device *device)
@@ -4409,22 +4409,12 @@ void CDECL wined3d_device_evict_managed_resources(struct wined3d_device *device)
}
}
@ -99,7 +99,7 @@ index a113e21..b96f20f 100644
LIST_FOR_EACH_ENTRY(shader, &device->shaders, struct wined3d_shader, shader_list_entry)
{
device->shader_backend->shader_destroy(shader);
@@ -4187,6 +4177,20 @@ static void delete_opengl_contexts(struct wined3d_device *device, struct wined3d
@@ -4454,6 +4444,20 @@ static void delete_opengl_contexts(struct wined3d_device *device, struct wined3d
swapchain->context = NULL;
}
@ -121,19 +121,19 @@ index a113e21..b96f20f 100644
{
HRESULT hr;
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index ab38f0e..2f7dd75 100644
index d5b939c..9f509e5 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2077,6 +2077,8 @@ struct wined3d_gl_bo *wined3d_device_get_bo(struct wined3d_device *device, UINT
void wined3d_device_release_bo(struct wined3d_device *device, struct wined3d_gl_bo *bo,
@@ -2200,6 +2200,8 @@ void wined3d_device_release_bo(struct wined3d_device *device, struct wined3d_gl_
const struct wined3d_context *context) DECLSPEC_HIDDEN;
void device_create_dummy_textures(struct wined3d_device *device, struct wined3d_context *context) DECLSPEC_HIDDEN;
void device_create_default_sampler(struct wined3d_device *device);
+void device_delete_opengl_contexts_cs(struct wined3d_device *device,
+ struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN;
static inline BOOL isStateDirty(const struct wined3d_context *context, DWORD state)
{
@@ -2718,6 +2720,8 @@ void wined3d_cs_emit_texture_cleanup(struct wined3d_cs *cs, struct wined3d_textu
@@ -2841,6 +2843,8 @@ void wined3d_cs_emit_texture_cleanup(struct wined3d_cs *cs, struct wined3d_textu
void wined3d_cs_emit_create_dummy_textures(struct wined3d_cs *cs) DECLSPEC_HIDDEN;
HRESULT wined3d_cs_emit_create_swapchain_context(struct wined3d_cs *cs,
struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN;
@ -143,5 +143,5 @@ index ab38f0e..2f7dd75 100644
/* Direct3D terminology with little modifications. We do not have an issued state
* because only the driver knows about it, but we have a created state because d3d
--
2.1.3
2.6.4

View File

@ -1,17 +1,17 @@
From b596845e64e0d1f5d0674508066409f8eb88bed1 Mon Sep 17 00:00:00 2001
From 166fc2ef37010a9e368cd25a1ee2d3e722c087ed Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Fri, 11 Oct 2013 10:17:42 +0200
Subject: wined3d: Delete GL contexts through the CS in uninit_3d.
---
dlls/wined3d/device.c | 32 +++-----------------------------
1 file changed, 3 insertions(+), 29 deletions(-)
dlls/wined3d/device.c | 34 ++++------------------------------
1 file changed, 4 insertions(+), 30 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 15868f2..d20d3b1 100644
index 039b645..8941632 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -1013,8 +1013,6 @@ static void device_free_sampler(struct wine_rb_entry *entry, void *context)
@@ -1091,8 +1091,6 @@ static void device_free_sampler(struct wine_rb_entry *entry, void *context)
HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device)
{
struct wined3d_resource *resource, *cursor;
@ -20,7 +20,7 @@ index 15868f2..d20d3b1 100644
struct wined3d_surface *surface;
UINT i;
@@ -1026,12 +1024,6 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device)
@@ -1104,12 +1102,6 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device)
if (wined3d_settings.cs_multithreaded)
device->cs->ops->finish(device->cs);
@ -33,7 +33,7 @@ index 15868f2..d20d3b1 100644
if (device->logo_texture)
wined3d_texture_decref(device->logo_texture);
@@ -1061,30 +1053,11 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device)
@@ -1139,31 +1131,11 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device)
TRACE("Unloading resource %p.\n", resource);
wined3d_cs_emit_evict_resource(device->cs, resource);
}
@ -55,6 +55,7 @@ index 15868f2..d20d3b1 100644
- device->blitter->free_private(device);
- device->shader_backend->shader_free_private(device);
- destroy_dummy_textures(device, gl_info);
- destroy_default_sampler(device);
-
- /* Release the context again as soon as possible. In particular,
- * releasing the render target views below may release the last reference
@ -66,7 +67,15 @@ index 15868f2..d20d3b1 100644
if (device->back_buffer_view)
{
@@ -4366,6 +4339,7 @@ void device_delete_opengl_contexts_cs(struct wined3d_device *device, struct wine
@@ -4432,6 +4404,7 @@ void device_delete_opengl_contexts_cs(struct wined3d_device *device, struct wine
device->blitter->free_private(device);
device->shader_backend->shader_free_private(device);
destroy_dummy_textures(device, gl_info);
+ destroy_default_sampler(device);
context_release(context);
@@ -4442,6 +4415,7 @@ void device_delete_opengl_contexts_cs(struct wined3d_device *device, struct wine
HeapFree(GetProcessHeap(), 0, swapchain->context);
swapchain->context = NULL;
@ -75,5 +84,5 @@ index 15868f2..d20d3b1 100644
static void delete_opengl_contexts(struct wined3d_device *device, struct wined3d_swapchain *swapchain)
--
2.5.1
2.6.4

File diff suppressed because it is too large Load Diff