From 3b1cd79e05f8496ee4a3af63f45caf1957ba9d87 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Wed, 8 Mar 2017 22:56:02 +0100 Subject: [PATCH] Rebase against 9eecacbeb1561218d4870c83f89a233cabbf7e0c. --- .../definition | 1 - ...FileAccessInformation-class-in-NtQue.patch | 80 -------- .../ntdll-FileAccessInformation/definition | 1 - ...-Implement-LdrEnumerateLoadedModules.patch | 22 +-- ...basic-tests-for-RtlQueryPackageIdent.patch | 20 +- ...rdi-and-rsi-in-raise_func_trampoline.patch | 54 ------ .../ntdll-raise_func_trampoline/definition | 1 - ...-KeAcquireInStackQueuedSpinLock-stub.patch | 99 ---------- ...-KeReleaseInStackQueuedSpinLock-stub.patch | 60 ------ .../ntoskrnl-InStackQueuedSpinLock/definition | 1 - patches/patchinstall.sh | 62 +------ ...end-blits-through-the-command-stream.patch | 134 +++++--------- .../wined3d-CSMT_Main/9999-IfDefined.patch | 172 +++++++----------- 13 files changed, 130 insertions(+), 577 deletions(-) delete mode 100644 patches/ntdll-FileAccessInformation/0001-ntdll-Implement-FileAccessInformation-class-in-NtQue.patch delete mode 100644 patches/ntdll-FileAccessInformation/definition delete mode 100644 patches/ntdll-raise_func_trampoline/0001-ntdll-Save-rdi-and-rsi-in-raise_func_trampoline.patch delete mode 100644 patches/ntdll-raise_func_trampoline/definition delete mode 100644 patches/ntoskrnl-InStackQueuedSpinLock/0001-ntoskrnl.exe-add-KeAcquireInStackQueuedSpinLock-stub.patch delete mode 100644 patches/ntoskrnl-InStackQueuedSpinLock/0002-ntoskrnl.exe-Add-KeReleaseInStackQueuedSpinLock-stub.patch delete mode 100644 patches/ntoskrnl-InStackQueuedSpinLock/definition diff --git a/patches/kernel32-GetCurrentPackageFamilyName/definition b/patches/kernel32-GetCurrentPackageFamilyName/definition index b8adbf87..7d8a5df0 100644 --- a/patches/kernel32-GetCurrentPackageFamilyName/definition +++ b/patches/kernel32-GetCurrentPackageFamilyName/definition @@ -1,2 +1 @@ Fixes: Add stub for kernel32.GetCurrentPackageFamilyName -Fixes: [42586] Add stub for kernel32.GetCurrentPackageFullName diff --git a/patches/ntdll-FileAccessInformation/0001-ntdll-Implement-FileAccessInformation-class-in-NtQue.patch b/patches/ntdll-FileAccessInformation/0001-ntdll-Implement-FileAccessInformation-class-in-NtQue.patch deleted file mode 100644 index 6a4c8418..00000000 --- a/patches/ntdll-FileAccessInformation/0001-ntdll-Implement-FileAccessInformation-class-in-NtQue.patch +++ /dev/null @@ -1,80 +0,0 @@ -From f9538d02d978180bbf563f14cf265b0eac8d71c5 Mon Sep 17 00:00:00 2001 -From: Sebastian Lackner -Date: Sun, 5 Mar 2017 21:48:27 +0100 -Subject: ntdll: Implement FileAccessInformation class in - NtQueryInformationFile. - ---- - dlls/ntdll/file.c | 13 +++++++++++++ - dlls/ntdll/tests/file.c | 24 ++++++++++++++++++++++++ - 2 files changed, 37 insertions(+) - -diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c -index 88ecb2a2f04..d92db6b7db9 100644 ---- a/dlls/ntdll/file.c -+++ b/dlls/ntdll/file.c -@@ -2852,6 +2852,19 @@ NTSTATUS WINAPI NtQueryInformationFile( HANDLE hFile, PIO_STATUS_BLOCK io, - info->EaSize = 0; - } - break; -+ case FileAccessInformation: -+ { -+ FILE_ACCESS_INFORMATION *info = ptr; -+ SERVER_START_REQ( get_object_info ) -+ { -+ req->handle = wine_server_obj_handle( hFile ); -+ io->u.Status = wine_server_call( req ); -+ if (io->u.Status == STATUS_SUCCESS) -+ info->AccessFlags = reply->access; -+ } -+ SERVER_END_REQ; -+ } -+ break; - case FileEndOfFileInformation: - if (fd_get_file_info( fd, &st, &attr ) == -1) io->u.Status = FILE_GetNtStatus(); - else fill_file_info( &st, attr, ptr, class ); -diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c -index 9cbbdba55e0..05c5454871c 100644 ---- a/dlls/ntdll/tests/file.c -+++ b/dlls/ntdll/tests/file.c -@@ -3509,6 +3509,29 @@ static void test_file_id_information(void) - CloseHandle( h ); - } - -+static void test_file_access_information(void) -+{ -+ FILE_ACCESS_INFORMATION info; -+ IO_STATUS_BLOCK io; -+ NTSTATUS status; -+ HANDLE h; -+ -+ if (!(h = create_temp_file(0))) return; -+ -+ status = pNtQueryInformationFile( h, &io, &info, sizeof(info) - 1, FileAccessInformation ); -+ ok( status == STATUS_INFO_LENGTH_MISMATCH, "expected STATUS_INFO_LENGTH_MISMATCH, got %08x\n", status ); -+ -+ status = pNtQueryInformationFile( (HANDLE)0xdeadbeef, &io, &info, sizeof(info), FileAccessInformation ); -+ ok( status == STATUS_INVALID_HANDLE, "expected STATUS_INVALID_HANDLE, got %08x\n", status ); -+ -+ memset(&info, 0x11, sizeof(info)); -+ status = pNtQueryInformationFile( h, &io, &info, sizeof(info), FileAccessInformation ); -+ ok( status == STATUS_SUCCESS, "expected STATUS_SUCCESS, got %08x\n", status ); -+ ok( info.AccessFlags == 0x13019f, "got %08x\n", info.AccessFlags ); -+ -+ CloseHandle( h ); -+} -+ - static void test_query_volume_information_file(void) - { - NTSTATUS status; -@@ -4912,6 +4935,7 @@ START_TEST(file) - test_file_disposition_information(); - test_file_completion_information(); - test_file_id_information(); -+ test_file_access_information(); - test_query_volume_information_file(); - test_query_attribute_information_file(); - test_ioctl(); --- -2.11.0 - diff --git a/patches/ntdll-FileAccessInformation/definition b/patches/ntdll-FileAccessInformation/definition deleted file mode 100644 index 1f2972f7..00000000 --- a/patches/ntdll-FileAccessInformation/definition +++ /dev/null @@ -1 +0,0 @@ -Fixes: [42550] Implement FileAccessInformation class diff --git a/patches/ntdll-LdrEnumerateLoadedModules/0001-ntdll-Implement-LdrEnumerateLoadedModules.patch b/patches/ntdll-LdrEnumerateLoadedModules/0001-ntdll-Implement-LdrEnumerateLoadedModules.patch index 6674dab8..8ea1c846 100644 --- a/patches/ntdll-LdrEnumerateLoadedModules/0001-ntdll-Implement-LdrEnumerateLoadedModules.patch +++ b/patches/ntdll-LdrEnumerateLoadedModules/0001-ntdll-Implement-LdrEnumerateLoadedModules.patch @@ -1,4 +1,4 @@ -From eafb8e1b84a5ee717d5b0e22686303494fc5ccd3 Mon Sep 17 00:00:00 2001 +From 7221933818afc91b76f6b12ead544570d8ff336a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Fri, 3 Feb 2017 00:05:10 +0100 Subject: ntdll: Implement LdrEnumerateLoadedModules. @@ -10,10 +10,10 @@ Subject: ntdll: Implement LdrEnumerateLoadedModules. 3 files changed, 86 insertions(+), 1 deletion(-) diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c -index c0703f008a7..15acf0e197d 100644 +index cf758505a4c..0b507da9a08 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c -@@ -1523,6 +1523,37 @@ NTSTATUS WINAPI LdrFindEntryForAddress(const void* addr, PLDR_MODULE* pmod) +@@ -1393,6 +1393,37 @@ NTSTATUS WINAPI LdrFindEntryForAddress(const void* addr, PLDR_MODULE* pmod) return STATUS_NO_MORE_ENTRIES; } @@ -52,10 +52,10 @@ index c0703f008a7..15acf0e197d 100644 * LdrLockLoaderLock (NTDLL.@) * diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec -index 81767ede7d7..9921b4cb1cc 100644 +index b4269a679fc..66ecb7d0f37 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec -@@ -63,7 +63,7 @@ +@@ -62,7 +62,7 @@ # @ stub LdrDestroyOutOfProcessImage @ stdcall LdrDisableThreadCalloutsForDll(long) @ stub LdrEnumResources @@ -65,10 +65,10 @@ index 81767ede7d7..9921b4cb1cc 100644 @ stdcall LdrFindEntryForAddress(ptr ptr) @ stdcall LdrFindResourceDirectory_U(long ptr long ptr) diff --git a/dlls/ntdll/tests/rtl.c b/dlls/ntdll/tests/rtl.c -index d96ced64cb0..cfff3f5ec49 100644 +index 940c44a05bd..873437e7f4b 100644 --- a/dlls/ntdll/tests/rtl.c +++ b/dlls/ntdll/tests/rtl.c -@@ -111,6 +111,7 @@ static BOOL (WINAPI *pRtlIsCriticalSectionLocked)(CRITICAL_SECTION *); +@@ -102,6 +102,7 @@ static BOOL (WINAPI *pRtlIsCriticalSectionLocked)(CRITICAL_SECTION *); static BOOL (WINAPI *pRtlIsCriticalSectionLockedByThread)(CRITICAL_SECTION *); static NTSTATUS (WINAPI *pRtlInitializeCriticalSectionEx)(CRITICAL_SECTION *, ULONG, ULONG); static NTSTATUS (WINAPI *pRtlQueryPackageIdentity)(HANDLE, WCHAR*, SIZE_T*, WCHAR*, SIZE_T*, BOOLEAN*); @@ -76,7 +76,7 @@ index d96ced64cb0..cfff3f5ec49 100644 static HMODULE hkernel32 = 0; static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL); -@@ -173,6 +174,7 @@ static void InitFunctionPtrs(void) +@@ -156,6 +157,7 @@ static void InitFunctionPtrs(void) pRtlIsCriticalSectionLockedByThread = (void *)GetProcAddress(hntdll, "RtlIsCriticalSectionLockedByThread"); pRtlInitializeCriticalSectionEx = (void *)GetProcAddress(hntdll, "RtlInitializeCriticalSectionEx"); pRtlQueryPackageIdentity = (void *)GetProcAddress(hntdll, "RtlQueryPackageIdentity"); @@ -84,7 +84,7 @@ index d96ced64cb0..cfff3f5ec49 100644 } hkernel32 = LoadLibraryA("kernel32.dll"); ok(hkernel32 != 0, "LoadLibrary failed\n"); -@@ -3230,6 +3232,57 @@ done: +@@ -2228,6 +2230,57 @@ done: CoUninitialize(); } @@ -142,9 +142,9 @@ index d96ced64cb0..cfff3f5ec49 100644 START_TEST(rtl) { InitFunctionPtrs(); -@@ -3267,4 +3320,5 @@ START_TEST(rtl) - test_RtlIsCriticalSectionLocked(); +@@ -2261,4 +2314,5 @@ START_TEST(rtl) test_RtlInitializeCriticalSectionEx(); + test_RtlLeaveCriticalSection(); test_RtlQueryPackageIdentity(); + test_LdrEnumerateLoadedModules(); } diff --git a/patches/ntdll-RtlQueryPackageIdentity/0003-ntdll-tests-Add-basic-tests-for-RtlQueryPackageIdent.patch b/patches/ntdll-RtlQueryPackageIdentity/0003-ntdll-tests-Add-basic-tests-for-RtlQueryPackageIdent.patch index de64c601..b0fb4aeb 100644 --- a/patches/ntdll-RtlQueryPackageIdentity/0003-ntdll-tests-Add-basic-tests-for-RtlQueryPackageIdent.patch +++ b/patches/ntdll-RtlQueryPackageIdentity/0003-ntdll-tests-Add-basic-tests-for-RtlQueryPackageIdent.patch @@ -1,4 +1,4 @@ -From 733ae7526f2498282b42254b867e5c2d278b379a Mon Sep 17 00:00:00 2001 +From 1ad505d34d229476373ba4f3422934f0440f2fee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Sun, 17 Jan 2016 00:50:50 +0100 Subject: ntdll/tests: Add basic tests for RtlQueryPackageIdentity. @@ -9,7 +9,7 @@ Subject: ntdll/tests: Add basic tests for RtlQueryPackageIdentity. 2 files changed, 77 insertions(+), 1 deletion(-) diff --git a/dlls/ntdll/tests/Makefile.in b/dlls/ntdll/tests/Makefile.in -index fc352dd..0de4fe8 100644 +index fc352dd22be..0de4fe8f207 100644 --- a/dlls/ntdll/tests/Makefile.in +++ b/dlls/ntdll/tests/Makefile.in @@ -1,5 +1,5 @@ @@ -20,7 +20,7 @@ index fc352dd..0de4fe8 100644 C_SRCS = \ atom.c \ diff --git a/dlls/ntdll/tests/rtl.c b/dlls/ntdll/tests/rtl.c -index 1b17a7e..95b58c3 100644 +index b18cccf4f35..940c44a05bd 100644 --- a/dlls/ntdll/tests/rtl.c +++ b/dlls/ntdll/tests/rtl.c @@ -25,6 +25,9 @@ @@ -33,7 +33,7 @@ index 1b17a7e..95b58c3 100644 #ifndef __WINE_WINTERNL_H -@@ -99,6 +102,7 @@ static NTSTATUS (WINAPI *pRtlCompressBuffer)(USHORT, const UCHAR*, ULONG, PUCHA +@@ -98,6 +101,7 @@ static NTSTATUS (WINAPI *pRtlCompressBuffer)(USHORT, const UCHAR*, ULONG, PUCHA static BOOL (WINAPI *pRtlIsCriticalSectionLocked)(CRITICAL_SECTION *); static BOOL (WINAPI *pRtlIsCriticalSectionLockedByThread)(CRITICAL_SECTION *); static NTSTATUS (WINAPI *pRtlInitializeCriticalSectionEx)(CRITICAL_SECTION *, ULONG, ULONG); @@ -41,7 +41,7 @@ index 1b17a7e..95b58c3 100644 static HMODULE hkernel32 = 0; static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL); -@@ -153,6 +157,7 @@ static void InitFunctionPtrs(void) +@@ -151,6 +155,7 @@ static void InitFunctionPtrs(void) pRtlIsCriticalSectionLocked = (void *)GetProcAddress(hntdll, "RtlIsCriticalSectionLocked"); pRtlIsCriticalSectionLockedByThread = (void *)GetProcAddress(hntdll, "RtlIsCriticalSectionLockedByThread"); pRtlInitializeCriticalSectionEx = (void *)GetProcAddress(hntdll, "RtlInitializeCriticalSectionEx"); @@ -49,8 +49,8 @@ index 1b17a7e..95b58c3 100644 } hkernel32 = LoadLibraryA("kernel32.dll"); ok(hkernel32 != 0, "LoadLibrary failed\n"); -@@ -2091,6 +2096,76 @@ static void test_RtlInitializeCriticalSectionEx(void) - RtlDeleteCriticalSection(&cs); +@@ -2153,6 +2158,76 @@ static void test_RtlLeaveCriticalSection(void) + ok(!status, "RtlDeleteCriticalSection failed: %x\n", status); } +static void test_RtlQueryPackageIdentity(void) @@ -126,12 +126,12 @@ index 1b17a7e..95b58c3 100644 START_TEST(rtl) { InitFunctionPtrs(); -@@ -2122,4 +2197,5 @@ START_TEST(rtl) - test_RtlDecompressBuffer(); +@@ -2185,4 +2260,5 @@ START_TEST(rtl) test_RtlIsCriticalSectionLocked(); test_RtlInitializeCriticalSectionEx(); + test_RtlLeaveCriticalSection(); + test_RtlQueryPackageIdentity(); } -- -2.7.1 +2.11.0 diff --git a/patches/ntdll-raise_func_trampoline/0001-ntdll-Save-rdi-and-rsi-in-raise_func_trampoline.patch b/patches/ntdll-raise_func_trampoline/0001-ntdll-Save-rdi-and-rsi-in-raise_func_trampoline.patch deleted file mode 100644 index 4d6c1bb1..00000000 --- a/patches/ntdll-raise_func_trampoline/0001-ntdll-Save-rdi-and-rsi-in-raise_func_trampoline.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 7a4b334d01cc105418fb29baa6662ab566c06a42 Mon Sep 17 00:00:00 2001 -From: Andrew Wesie -Date: Sun, 12 Feb 2017 16:41:22 -0600 -Subject: ntdll: Save rdi and rsi in raise_func_trampoline. - -On Windows, RDI and RSI are callee-saved registers, but on Linux -they are caller-saved registers. As such, raise_func_trampoline -needs to explicitly unwind them. - -Signed-off-by: Andrew Wesie ---- - dlls/ntdll/signal_x86_64.c | 12 +++++++++--- - 1 file changed, 9 insertions(+), 3 deletions(-) - -diff --git a/dlls/ntdll/signal_x86_64.c b/dlls/ntdll/signal_x86_64.c -index f33fe4cbfd6..61bb2ddce6f 100644 ---- a/dlls/ntdll/signal_x86_64.c -+++ b/dlls/ntdll/signal_x86_64.c -@@ -2066,9 +2066,11 @@ NTSTATUS context_from_server( CONTEXT *to, const context_t *from ) - extern void raise_func_trampoline( EXCEPTION_RECORD *rec, CONTEXT *context, raise_func func ); - __ASM_GLOBAL_FUNC( raise_func_trampoline, - __ASM_CFI(".cfi_signal_frame\n\t") -- __ASM_CFI(".cfi_def_cfa %rbp,144\n\t") /* red zone + rip + rbp */ -- __ASM_CFI(".cfi_rel_offset %rip,8\n\t") -- __ASM_CFI(".cfi_rel_offset %rbp,0\n\t") -+ __ASM_CFI(".cfi_def_cfa %rbp,160\n\t") /* red zone + rip + rbp + rdi + rsi */ -+ __ASM_CFI(".cfi_rel_offset %rip,24\n\t") -+ __ASM_CFI(".cfi_rel_offset %rbp,16\n\t") -+ __ASM_CFI(".cfi_rel_offset %rdi,8\n\t") -+ __ASM_CFI(".cfi_rel_offset %rsi,0\n\t") - "call *%rdx\n\t" - "int $3") - -@@ -2085,6 +2087,8 @@ static EXCEPTION_RECORD *setup_exception( ucontext_t *sigcontext, raise_func fun - { - CONTEXT context; - EXCEPTION_RECORD rec; -+ ULONG64 rsi; -+ ULONG64 rdi; - ULONG64 rbp; - ULONG64 rip; - ULONG64 red_zone[16]; -@@ -2154,6 +2158,8 @@ static EXCEPTION_RECORD *setup_exception( ucontext_t *sigcontext, raise_func fun - rsp_ptr = (ULONG64 *)RSP_sig(sigcontext) - 16; - *(--rsp_ptr) = RIP_sig(sigcontext); - *(--rsp_ptr) = RBP_sig(sigcontext); -+ *(--rsp_ptr) = RDI_sig(sigcontext); -+ *(--rsp_ptr) = RSI_sig(sigcontext); - - /* now modify the sigcontext to return to the raise function */ - RIP_sig(sigcontext) = (ULONG_PTR)raise_func_trampoline; --- -2.11.0 - diff --git a/patches/ntdll-raise_func_trampoline/definition b/patches/ntdll-raise_func_trampoline/definition deleted file mode 100644 index 69ffc94f..00000000 --- a/patches/ntdll-raise_func_trampoline/definition +++ /dev/null @@ -1 +0,0 @@ -Fixes: Save rdi and rsi in raise_func_trampoline on x86_64 diff --git a/patches/ntoskrnl-InStackQueuedSpinLock/0001-ntoskrnl.exe-add-KeAcquireInStackQueuedSpinLock-stub.patch b/patches/ntoskrnl-InStackQueuedSpinLock/0001-ntoskrnl.exe-add-KeAcquireInStackQueuedSpinLock-stub.patch deleted file mode 100644 index 32bef4e9..00000000 --- a/patches/ntoskrnl-InStackQueuedSpinLock/0001-ntoskrnl.exe-add-KeAcquireInStackQueuedSpinLock-stub.patch +++ /dev/null @@ -1,99 +0,0 @@ -From d41ae9a2e8182b9a57a9b110905a4ffb0dd81e8f Mon Sep 17 00:00:00 2001 -From: Austin English -Date: Thu, 9 Feb 2017 16:51:25 -0600 -Subject: ntoskrnl.exe: add KeAcquireInStackQueuedSpinLock stub (try 2) - -Signed-off-by: Austin English ---- - dlls/hal/hal.spec | 2 +- - dlls/ntoskrnl.exe/ntoskrnl.c | 13 +++++++++++++ - dlls/ntoskrnl.exe/ntoskrnl.exe.spec | 1 + - include/ddk/wdm.h | 10 ++++++++++ - tools/make_specfiles | 4 ++++ - 5 files changed, 29 insertions(+), 1 deletion(-) - -diff --git a/dlls/hal/hal.spec b/dlls/hal/hal.spec -index bd6bc35736a..f441ac5271f 100644 ---- a/dlls/hal/hal.spec -+++ b/dlls/hal/hal.spec -@@ -4,7 +4,7 @@ - @ stub HalClearSoftwareInterrupt - @ stub HalRequestSoftwareInterrupt - @ stub HalSystemVectorDispatchEntry --@ stub KeAcquireInStackQueuedSpinLock -+@ stdcall -norelay KeAcquireInStackQueuedSpinLock(ptr ptr) ntoskrnl.exe.KeAcquireInStackQueuedSpinLock - @ stub KeAcquireInStackQueuedSpinLockRaiseToSynch - @ stub KeAcquireQueuedSpinLock - @ stub KeAcquireQueuedSpinLockRaiseToSynch -diff --git a/dlls/ntoskrnl.exe/ntoskrnl.c b/dlls/ntoskrnl.exe/ntoskrnl.c -index 06320d03cc9..b8f6a25714a 100644 ---- a/dlls/ntoskrnl.exe/ntoskrnl.c -+++ b/dlls/ntoskrnl.exe/ntoskrnl.c -@@ -3188,3 +3188,16 @@ VOID WINAPI KeClearEvent(PRKEVENT event) - { - FIXME("stub: %p\n", event); - } -+ -+/*********************************************************************** -+ * KeAcquireInStackQueuedSpinLock (NTOSKRNL.EXE.@) -+ */ -+#ifdef DEFINE_FASTCALL2_ENTRYPOINT -+DEFINE_FASTCALL2_ENTRYPOINT( KeAcquireInStackQueuedSpinLock ) -+void WINAPI __regs_KeAcquireInStackQueuedSpinLock(KSPIN_LOCK *spinlock, KLOCK_QUEUE_HANDLE *handle) -+#else -+void WINAPI KeAcquireInStackQueuedSpinLock(KSPIN_LOCK *spinlock, KLOCK_QUEUE_HANDLE *handle) -+#endif -+{ -+ FIXME( "stub: %p %p\n", spinlock, handle); -+} -diff --git a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec -index 62c7fb496cf..ba18200c503 100644 ---- a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec -+++ b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec -@@ -41,6 +41,7 @@ - @ stub IoWritePartitionTable - @ stdcall -norelay IofCallDriver(ptr ptr) - @ stdcall -norelay IofCompleteRequest(ptr long) -+@ stdcall -norelay KeAcquireInStackQueuedSpinLock(ptr ptr) - @ stub KeAcquireInStackQueuedSpinLockAtDpcLevel - @ stub KeReleaseInStackQueuedSpinLockFromDpcLevel - @ stub KeSetTimeUpdateNotifyRoutine -diff --git a/include/ddk/wdm.h b/include/ddk/wdm.h -index 4c696f776dd..61374a7ed43 100644 ---- a/include/ddk/wdm.h -+++ b/include/ddk/wdm.h -@@ -1210,6 +1210,16 @@ typedef struct _CALLBACK_OBJECT - UCHAR reserved[3]; - } CALLBACK_OBJECT, *PCALLBACK_OBJECT; - -+typedef struct _KSPIN_LOCK_QUEUE { -+ struct _KSPIN_LOCK_QUEUE * volatile Next; -+ volatile PKSPIN_LOCK Lock; -+} KSPIN_LOCK_QUEUE, *PKSPIN_LOCK_QUEUE; -+ -+typedef struct _KLOCK_QUEUE_HANDLE { -+ KSPIN_LOCK_QUEUE LockQueue; -+ KIRQL OldIrql; -+} KLOCK_QUEUE_HANDLE, *PKLOCK_QUEUE_HANDLE; -+ - typedef NTSTATUS (NTAPI EX_CALLBACK_FUNCTION)(void *CallbackContext, void *Argument1, void *Argument2); - typedef EX_CALLBACK_FUNCTION *PEX_CALLBACK_FUNCTION; - -diff --git a/tools/make_specfiles b/tools/make_specfiles -index 1e2400e4c7f..505bdf1e791 100755 ---- a/tools/make_specfiles -+++ b/tools/make_specfiles -@@ -338,6 +338,10 @@ my @dll_groups = - "bcrypt", - "ncrypt", - ], -+ [ -+ "ntoskrnl.exe", -+ "hal", -+ ] - ); - - my $update_flags = 0; --- -2.11.0 - diff --git a/patches/ntoskrnl-InStackQueuedSpinLock/0002-ntoskrnl.exe-Add-KeReleaseInStackQueuedSpinLock-stub.patch b/patches/ntoskrnl-InStackQueuedSpinLock/0002-ntoskrnl.exe-Add-KeReleaseInStackQueuedSpinLock-stub.patch deleted file mode 100644 index 2e3b8bfc..00000000 --- a/patches/ntoskrnl-InStackQueuedSpinLock/0002-ntoskrnl.exe-Add-KeReleaseInStackQueuedSpinLock-stub.patch +++ /dev/null @@ -1,60 +0,0 @@ -From 15bd72533dd2d899e18c2201dd73ccfd2fb495c0 Mon Sep 17 00:00:00 2001 -From: Sebastian Lackner -Date: Sun, 5 Mar 2017 19:28:08 +0100 -Subject: ntoskrnl.exe: Add KeReleaseInStackQueuedSpinLock stub. - ---- - dlls/hal/hal.spec | 2 +- - dlls/ntoskrnl.exe/ntoskrnl.c | 13 +++++++++++++ - dlls/ntoskrnl.exe/ntoskrnl.exe.spec | 1 + - 3 files changed, 15 insertions(+), 1 deletion(-) - -diff --git a/dlls/hal/hal.spec b/dlls/hal/hal.spec -index f441ac5271f..414e49bfec9 100644 ---- a/dlls/hal/hal.spec -+++ b/dlls/hal/hal.spec -@@ -9,7 +9,7 @@ - @ stub KeAcquireQueuedSpinLock - @ stub KeAcquireQueuedSpinLockRaiseToSynch - @ stub KeAcquireSpinLockRaiseToSynch --@ stub KeReleaseInStackQueuedSpinLock -+@ stdcall -norelay KeReleaseInStackQueuedSpinLock(ptr) ntoskrnl.exe.KeReleaseInStackQueuedSpinLock - @ stub KeReleaseQueuedSpinLock - @ stub KeTryToAcquireQueuedSpinLock - @ stub KeTryToAcquireQueuedSpinLockRaiseToSynch -diff --git a/dlls/ntoskrnl.exe/ntoskrnl.c b/dlls/ntoskrnl.exe/ntoskrnl.c -index b8f6a25714a..8cda7b70388 100644 ---- a/dlls/ntoskrnl.exe/ntoskrnl.c -+++ b/dlls/ntoskrnl.exe/ntoskrnl.c -@@ -3201,3 +3201,16 @@ void WINAPI KeAcquireInStackQueuedSpinLock(KSPIN_LOCK *spinlock, KLOCK_QUEUE_HAN - { - FIXME( "stub: %p %p\n", spinlock, handle); - } -+ -+/*********************************************************************** -+ * KeReleaseInStackQueuedSpinLock (NTOSKRNL.EXE.@) -+ */ -+#ifdef DEFINE_FASTCALL1_ENTRYPOINT -+DEFINE_FASTCALL1_ENTRYPOINT( KeReleaseInStackQueuedSpinLock ) -+void WINAPI __regs_KeReleaseInStackQueuedSpinLock(KLOCK_QUEUE_HANDLE *handle) -+#else -+void WINAPI KeReleaseInStackQueuedSpinLock(KLOCK_QUEUE_HANDLE *handle) -+#endif -+{ -+ FIXME( "stub: %p\n", handle); -+} -diff --git a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec -index ba18200c503..e223eadc1a8 100644 ---- a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec -+++ b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec -@@ -43,6 +43,7 @@ - @ stdcall -norelay IofCompleteRequest(ptr long) - @ stdcall -norelay KeAcquireInStackQueuedSpinLock(ptr ptr) - @ stub KeAcquireInStackQueuedSpinLockAtDpcLevel -+@ stdcall -norelay KeReleaseInStackQueuedSpinLock(ptr) - @ stub KeReleaseInStackQueuedSpinLockFromDpcLevel - @ stub KeSetTimeUpdateNotifyRoutine - @ stub KefAcquireSpinLockAtDpcLevel --- -2.11.0 - diff --git a/patches/ntoskrnl-InStackQueuedSpinLock/definition b/patches/ntoskrnl-InStackQueuedSpinLock/definition deleted file mode 100644 index c0b1a29b..00000000 --- a/patches/ntoskrnl-InStackQueuedSpinLock/definition +++ /dev/null @@ -1 +0,0 @@ -Fixes: [41472] Add stubs for Ke{Aquire,Release}InStackQueuedSpinLock functions diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 5ca1ce0b..a9192252 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -52,7 +52,7 @@ usage() # Get the upstream commit sha upstream_commit() { - echo "3f50319ec384730360d16dd79d703adafaa953fc" + echo "9eecacbeb1561218d4870c83f89a233cabbf7e0c" } # Show version information @@ -227,7 +227,6 @@ patch_enable_all () enable_ntdll_DllOverrides_WOW64="$1" enable_ntdll_DllRedirects="$1" enable_ntdll_Exception="$1" - enable_ntdll_FileAccessInformation="$1" enable_ntdll_FileDispositionInformation="$1" enable_ntdll_FileFsFullSizeInformation="$1" enable_ntdll_FileFsVolumeInformation="$1" @@ -271,9 +270,7 @@ patch_enable_all () enable_ntdll_Zero_mod_name="$1" enable_ntdll__aulldvrm="$1" enable_ntdll_call_thread_func_wrapper="$1" - enable_ntdll_raise_func_trampoline="$1" enable_ntoskrnl_DriverTest="$1" - enable_ntoskrnl_InStackQueuedSpinLock="$1" enable_ntoskrnl_Stubs="$1" enable_nvapi_Stub_DLL="$1" enable_nvcuda_CUDA_Support="$1" @@ -904,9 +901,6 @@ patch_enable () ntdll-Exception) enable_ntdll_Exception="$2" ;; - ntdll-FileAccessInformation) - enable_ntdll_FileAccessInformation="$2" - ;; ntdll-FileDispositionInformation) enable_ntdll_FileDispositionInformation="$2" ;; @@ -1036,15 +1030,9 @@ patch_enable () ntdll-call_thread_func_wrapper) enable_ntdll_call_thread_func_wrapper="$2" ;; - ntdll-raise_func_trampoline) - enable_ntdll_raise_func_trampoline="$2" - ;; ntoskrnl-DriverTest) enable_ntoskrnl_DriverTest="$2" ;; - ntoskrnl-InStackQueuedSpinLock) - enable_ntoskrnl_InStackQueuedSpinLock="$2" - ;; ntoskrnl-Stubs) enable_ntoskrnl_Stubs="$2" ;; @@ -2735,9 +2723,6 @@ fi # Patchset kernel32-GetCurrentPackageFamilyName # | -# | This patchset fixes the following Wine bugs: -# | * [#42586] Add stub for kernel32.GetCurrentPackageFullName -# | # | Modified files: # | * dlls/api-ms-win-appmodel-runtime-l1-1-1/api-ms-win-appmodel-runtime-l1-1-1.spec, dlls/kernel32/kernel32.spec, # | dlls/kernel32/version.c @@ -5354,21 +5339,6 @@ if test "$enable_ntdll_Exception" -eq 1; then ) >> "$patchlist" fi -# Patchset ntdll-FileAccessInformation -# | -# | This patchset fixes the following Wine bugs: -# | * [#42550] Implement FileAccessInformation class -# | -# | Modified files: -# | * dlls/ntdll/file.c, dlls/ntdll/tests/file.c -# | -if test "$enable_ntdll_FileAccessInformation" -eq 1; then - patch_apply ntdll-FileAccessInformation/0001-ntdll-Implement-FileAccessInformation-class-in-NtQue.patch - ( - printf '%s\n' '+ { "Sebastian Lackner", "ntdll: Implement FileAccessInformation class in NtQueryInformationFile.", 1 },'; - ) >> "$patchlist" -fi - # Patchset ntdll-FileFsFullSizeInformation # | # | Modified files: @@ -6003,18 +5973,6 @@ if test "$enable_ntdll_call_thread_func_wrapper" -eq 1; then ) >> "$patchlist" fi -# Patchset ntdll-raise_func_trampoline -# | -# | Modified files: -# | * dlls/ntdll/signal_x86_64.c -# | -if test "$enable_ntdll_raise_func_trampoline" -eq 1; then - patch_apply ntdll-raise_func_trampoline/0001-ntdll-Save-rdi-and-rsi-in-raise_func_trampoline.patch - ( - printf '%s\n' '+ { "Andrew Wesie", "ntdll: Save rdi and rsi in raise_func_trampoline.", 1 },'; - ) >> "$patchlist" -fi - # Patchset ntoskrnl-DriverTest # | # | Modified files: @@ -6034,24 +5992,6 @@ if test "$enable_ntoskrnl_DriverTest" -eq 1; then ) >> "$patchlist" fi -# Patchset ntoskrnl-InStackQueuedSpinLock -# | -# | This patchset fixes the following Wine bugs: -# | * [#41472] Add stubs for Ke{Aquire,Release}InStackQueuedSpinLock functions -# | -# | Modified files: -# | * dlls/hal/hal.spec, dlls/ntoskrnl.exe/ntoskrnl.c, dlls/ntoskrnl.exe/ntoskrnl.exe.spec, include/ddk/wdm.h, -# | tools/make_specfiles -# | -if test "$enable_ntoskrnl_InStackQueuedSpinLock" -eq 1; then - patch_apply ntoskrnl-InStackQueuedSpinLock/0001-ntoskrnl.exe-add-KeAcquireInStackQueuedSpinLock-stub.patch - patch_apply ntoskrnl-InStackQueuedSpinLock/0002-ntoskrnl.exe-Add-KeReleaseInStackQueuedSpinLock-stub.patch - ( - printf '%s\n' '+ { "Austin English", "ntoskrnl.exe: Add KeAcquireInStackQueuedSpinLock stub.", 2 },'; - printf '%s\n' '+ { "Sebastian Lackner", "ntoskrnl.exe: Add KeReleaseInStackQueuedSpinLock stub.", 1 },'; - ) >> "$patchlist" -fi - # Patchset ntoskrnl-Stubs # | # | This patchset fixes the following Wine bugs: diff --git a/patches/wined3d-CSMT_Main/0008-wined3d-Send-blits-through-the-command-stream.patch b/patches/wined3d-CSMT_Main/0008-wined3d-Send-blits-through-the-command-stream.patch index 6b5bdace..120f5ddd 100644 --- a/patches/wined3d-CSMT_Main/0008-wined3d-Send-blits-through-the-command-stream.patch +++ b/patches/wined3d-CSMT_Main/0008-wined3d-Send-blits-through-the-command-stream.patch @@ -1,4 +1,4 @@ -From a34bdbe6dd81562c6bad79e3c1662dd17333c447 Mon Sep 17 00:00:00 2001 +From 5ee5e16ac78dcad58eaa40fe41ee7c771b8721cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Mon, 29 Apr 2013 18:49:53 +0200 Subject: wined3d: Send blits through the command stream. @@ -6,10 +6,11 @@ Subject: wined3d: Send blits through the command stream. This needs more work. This patch breaks error handling, and the split between surface_blt and surface_blt_ugly isn't particularly nice. --- - dlls/wined3d/cs.c | 52 +++++++++++ - dlls/wined3d/surface.c | 208 +++++++++++++++++++++++++---------------- - dlls/wined3d/wined3d_private.h | 7 ++ - 3 files changed, 188 insertions(+), 79 deletions(-) + dlls/wined3d/cs.c | 52 +++++++++++++++ + dlls/wined3d/surface.c | 140 ++++++++++++++++++++++++----------------- + dlls/wined3d/texture.c | 9 ++- + dlls/wined3d/wined3d_private.h | 7 +++ + 4 files changed, 148 insertions(+), 60 deletions(-) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c index 1366973c1e6..f2eb87e35b8 100644 @@ -96,10 +97,10 @@ index 1366973c1e6..f2eb87e35b8 100644 static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size) diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c -index 0dffdfa30f2..47ef3759b3e 100644 +index cd82d46a001..637d300b2f5 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c -@@ -3737,7 +3737,7 @@ const struct blit_shader cpu_blit = { +@@ -3738,7 +3738,7 @@ const struct blit_shader cpu_blit = { cpu_blit_blit_surface, }; @@ -108,7 +109,7 @@ index 0dffdfa30f2..47ef3759b3e 100644 struct wined3d_surface *src_surface, const RECT *src_rect, DWORD flags, const struct wined3d_blt_fx *fx, enum wined3d_texture_filter_type filter) { -@@ -3747,11 +3747,10 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -3748,8 +3748,8 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst struct wined3d_texture *dst_texture = dst_surface->container; struct wined3d_device *device = dst_texture->resource.device; struct wined3d_swapchain *src_swapchain, *dst_swapchain; @@ -118,11 +119,8 @@ index 0dffdfa30f2..47ef3759b3e 100644 + unsigned int src_sub_resource_idx; DWORD src_ds_flags, dst_ds_flags; BOOL scale, convert; -- HRESULT hr; - static const DWORD simple_blit = WINED3D_BLT_ASYNC - | WINED3D_BLT_COLOR_FILL -@@ -3762,66 +3761,17 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -3762,52 +3762,17 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst | WINED3D_BLT_DO_NOT_WAIT | WINED3D_BLT_ALPHA_TEST; @@ -150,20 +148,6 @@ index 0dffdfa30f2..47ef3759b3e 100644 + src_swapchain = src_texture->swapchain; } - -- if (dst_texture->sub_resources[dst_sub_resource_idx].map_count -- || (src_texture && src_texture->sub_resources[src_sub_resource_idx].map_count)) -- { -- WARN("Surface is busy, returning WINEDDERR_SURFACEBUSY.\n"); -- return WINEDDERR_SURFACEBUSY; -- } -- -- if (FAILED(hr = wined3d_texture_check_box_dimensions(dst_texture, dst_surface->texture_level, &dst_box))) -- return hr; -- -- if (src_texture && FAILED(hr = wined3d_texture_check_box_dimensions(src_texture, -- src_surface->texture_level, &src_box))) -- return hr; -- - if (!fx || !(fx->fx)) - flags &= ~WINED3D_BLT_FX; - @@ -194,7 +178,7 @@ index 0dffdfa30f2..47ef3759b3e 100644 } if (!device->d3d_initialized) -@@ -3846,11 +3796,6 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -3832,11 +3797,6 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst goto fallback; } @@ -206,7 +190,7 @@ index 0dffdfa30f2..47ef3759b3e 100644 dst_swapchain = dst_texture->swapchain; /* This isn't strictly needed. FBO blits for example could deal with -@@ -3886,22 +3831,16 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -3872,15 +3832,15 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst TRACE("Depth fill.\n"); if (!wined3d_format_convert_color_to_float(dst_texture->resource.format, NULL, fx->fill_color, &color)) @@ -217,22 +201,15 @@ index 0dffdfa30f2..47ef3759b3e 100644 - return WINED3D_OK; + return; } - else + else if (SUCCEEDED(wined3d_surface_depth_blt(src_surface, src_texture->resource.draw_binding, + src_rect, dst_surface, dst_texture->resource.draw_binding, dst_rect))) { -- if (src_ds_flags != dst_ds_flags) -- { -- WARN("Rejecting depth / stencil blit between incompatible formats.\n"); -- return WINED3DERR_INVALIDCALL; -- } -- - if (SUCCEEDED(wined3d_surface_depth_blt(src_surface, src_texture->resource.draw_binding, - src_rect, dst_surface, dst_texture->resource.draw_binding, dst_rect))) -- return WINED3D_OK; -+ return; +- return WINED3D_OK; ++ return; } } else -@@ -3937,7 +3876,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -3916,7 +3876,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst goto fallback; if (SUCCEEDED(surface_color_fill(dst_surface, dst_rect, &color))) @@ -241,7 +218,7 @@ index 0dffdfa30f2..47ef3759b3e 100644 } else { -@@ -3981,7 +3920,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -3960,7 +3920,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst context, dst_texture->resource.draw_binding); context_release(context); } @@ -250,7 +227,7 @@ index 0dffdfa30f2..47ef3759b3e 100644 } } } -@@ -4005,7 +3944,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -3984,7 +3944,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst wined3d_swapchain_present(dst_swapchain, NULL, NULL, dst_swapchain->win_handle, 0); dst_swapchain->desc.swap_effect = swap_effect; @@ -259,7 +236,7 @@ index 0dffdfa30f2..47ef3759b3e 100644 } if (fbo_blit_supported(&device->adapter->gl_info, blit_op, -@@ -4026,7 +3965,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -4005,7 +3965,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst wined3d_texture_invalidate_location(dst_texture, dst_sub_resource_idx, ~dst_texture->resource.draw_binding); @@ -268,7 +245,7 @@ index 0dffdfa30f2..47ef3759b3e 100644 } blitter = wined3d_select_blitter(&device->adapter->gl_info, &device->adapter->d3d_info, blit_op, -@@ -4036,7 +3975,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -4015,7 +3975,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst { blitter->blit_surface(device, blit_op, filter, src_surface, src_rect, dst_surface, dst_rect, color_key); @@ -277,7 +254,7 @@ index 0dffdfa30f2..47ef3759b3e 100644 } } } -@@ -4044,9 +3983,120 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -4023,9 +3983,73 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst fallback: /* Special cases for render targets. */ if (SUCCEEDED(surface_blt_special(dst_surface, dst_rect, src_surface, src_rect, flags, fx, filter))) @@ -294,17 +271,8 @@ index 0dffdfa30f2..47ef3759b3e 100644 + struct wined3d_surface *src_surface, const RECT *src_rect, DWORD flags, + const struct wined3d_blt_fx *fx, enum wined3d_texture_filter_type filter) +{ -+ struct wined3d_box dst_box = {dst_rect->left, dst_rect->top, dst_rect->right, dst_rect->bottom, 0, 1}; -+ struct wined3d_box src_box = {src_rect->left, src_rect->top, src_rect->right, src_rect->bottom, 0, 1}; + struct wined3d_texture *dst_texture = dst_surface->container; -+ struct wined3d_texture *src_texture = NULL; + struct wined3d_device *device = dst_texture->resource.device; -+ unsigned int dst_sub_resource_idx = surface_get_sub_resource_idx(dst_surface), src_sub_resource_idx; -+ struct wined3d_texture_sub_resource *dst_sub_resource = -+ &dst_texture->sub_resources[dst_sub_resource_idx]; -+ struct wined3d_texture_sub_resource *src_sub_resource = NULL; -+ DWORD src_ds_flags, dst_ds_flags; -+ HRESULT hr; + + TRACE("dst_surface %p, dst_rect %s, src_surface %p, src_rect %s, flags %#x, fx %p, filter %s.\n", + dst_surface, wine_dbgstr_rect(dst_rect), src_surface, wine_dbgstr_rect(src_rect), @@ -323,44 +291,6 @@ index 0dffdfa30f2..47ef3759b3e 100644 + fx->src_color_key.color_space_high_value); + } + -+ if (src_surface) -+ { -+ src_texture = src_surface->container; -+ src_sub_resource_idx = surface_get_sub_resource_idx(src_surface); -+ src_sub_resource = &src_surface->container->sub_resources[src_sub_resource_idx]; -+ } -+ -+ if (dst_sub_resource->map_count || (src_sub_resource && src_sub_resource->map_count)) -+ { -+ wined3d_cs_emit_sync(device->cs); -+ if (dst_sub_resource->map_count || (src_sub_resource && src_sub_resource->map_count)) -+ { -+ WARN("Surface is busy, returning WINEDDERR_SURFACEBUSY.\n"); -+ return WINEDDERR_SURFACEBUSY; -+ } -+ } -+ -+ if (FAILED(hr = wined3d_texture_check_box_dimensions(dst_texture, dst_surface->texture_level, &dst_box))) -+ return hr; -+ -+ if (src_texture && FAILED(hr = wined3d_texture_check_box_dimensions(src_texture, -+ src_surface->texture_level, &src_box))) -+ return hr; -+ -+ dst_ds_flags = dst_texture->resource.format_flags -+ & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL); -+ if (src_surface) -+ src_ds_flags = src_surface->container->resource.format_flags -+ & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL); -+ else -+ src_ds_flags = 0; -+ -+ if (!(flags & WINED3D_BLT_DEPTH_FILL) && (src_ds_flags != dst_ds_flags)) -+ { -+ WARN("Rejecting depth / stencil blit between incompatible formats.\n"); -+ return WINED3DERR_INVALIDCALL; -+ } -+ + /* FIXME: We should select the blitter in the main thread, that way we can return an error if the blit + * is unsupported without duplicating all the checks... */ + if (flags & WINED3D_BLT_COLOR_FILL && (dst_surface->container->resource.format_flags & WINED3DFMT_FLAG_BLOCKS)) @@ -400,6 +330,26 @@ index 0dffdfa30f2..47ef3759b3e 100644 + + return WINED3D_OK; +} +diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c +index a65367398f0..7cd69134a0c 100644 +--- a/dlls/wined3d/texture.c ++++ b/dlls/wined3d/texture.c +@@ -3190,8 +3190,13 @@ HRESULT CDECL wined3d_texture_blt(struct wined3d_texture *dst_texture, unsigned + if (dst_texture->sub_resources[dst_sub_resource_idx].map_count + || (src_texture && src_texture->sub_resources[src_sub_resource_idx].map_count)) + { +- WARN("Sub-resource is busy, returning WINEDDERR_SURFACEBUSY.\n"); +- return WINEDDERR_SURFACEBUSY; ++ wined3d_cs_emit_sync(dst_texture->resource.device->cs); ++ if (dst_texture->sub_resources[dst_sub_resource_idx].map_count ++ || (src_texture && src_texture->sub_resources[src_sub_resource_idx].map_count)) ++ { ++ WARN("Sub-resource is busy, returning WINEDDERR_SURFACEBUSY.\n"); ++ return WINEDDERR_SURFACEBUSY; ++ } + } + + if ((dst_format_flags & WINED3DFMT_FLAG_BLOCKS) && (flags & WINED3D_BLT_COLOR_FILL)) diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index a3716e937a5..1c3ba4644f1 100644 --- a/dlls/wined3d/wined3d_private.h diff --git a/patches/wined3d-CSMT_Main/9999-IfDefined.patch b/patches/wined3d-CSMT_Main/9999-IfDefined.patch index 17c286bb..b07ae33a 100644 --- a/patches/wined3d-CSMT_Main/9999-IfDefined.patch +++ b/patches/wined3d-CSMT_Main/9999-IfDefined.patch @@ -2560,7 +2560,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c { GLint vram_free_kb; UINT64 vram_free; -@@ -2335,7 +2352,11 @@ HRESULT CDECL wined3d_device_set_vs_consts_b(struct wined3d_device *device, +@@ -2353,7 +2370,11 @@ HRESULT CDECL wined3d_device_set_vs_consts_b(struct wined3d_device *device, } else { @@ -2572,7 +2572,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } return WINED3D_OK; -@@ -2384,7 +2405,11 @@ HRESULT CDECL wined3d_device_set_vs_consts_i(struct wined3d_device *device, +@@ -2402,7 +2423,11 @@ HRESULT CDECL wined3d_device_set_vs_consts_i(struct wined3d_device *device, } else { @@ -2584,7 +2584,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } return WINED3D_OK; -@@ -2429,7 +2454,11 @@ HRESULT CDECL wined3d_device_set_vs_consts_f(struct wined3d_device *device, +@@ -2447,7 +2472,11 @@ HRESULT CDECL wined3d_device_set_vs_consts_f(struct wined3d_device *device, memset(&device->recording->changed.vs_consts_f[start_idx], 1, count * sizeof(*device->recording->changed.vs_consts_f)); else @@ -2632,7 +2632,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c return WINED3D_OK; } -@@ -3470,8 +3511,10 @@ HRESULT CDECL wined3d_device_begin_scene(struct wined3d_device *device) +@@ -3481,8 +3522,10 @@ HRESULT CDECL wined3d_device_begin_scene(struct wined3d_device *device) HRESULT CDECL wined3d_device_end_scene(struct wined3d_device *device) { @@ -2643,7 +2643,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c TRACE("device %p.\n", device); if (!device->inScene) -@@ -3480,6 +3523,7 @@ HRESULT CDECL wined3d_device_end_scene(struct wined3d_device *device) +@@ -3491,6 +3534,7 @@ HRESULT CDECL wined3d_device_end_scene(struct wined3d_device *device) return WINED3DERR_INVALIDCALL; } @@ -2651,7 +2651,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c context = context_acquire(device, NULL, 0); /* We only have to do this if we need to read the, swapbuffers performs a flush for us */ context->gl_info->gl_ops.gl.p_glFlush(); -@@ -3487,6 +3531,7 @@ HRESULT CDECL wined3d_device_end_scene(struct wined3d_device *device) +@@ -3498,6 +3542,7 @@ HRESULT CDECL wined3d_device_end_scene(struct wined3d_device *device) * fails. */ context_release(context); @@ -2659,7 +2659,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c device->inScene = FALSE; return WINED3D_OK; } -@@ -3634,11 +3679,17 @@ void CDECL wined3d_device_draw_indexed_primitive_instanced(struct wined3d_device +@@ -3645,11 +3690,17 @@ void CDECL wined3d_device_draw_indexed_primitive_instanced(struct wined3d_device start_idx, index_count, start_instance, instance_count, TRUE); } @@ -2677,7 +2677,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c struct wined3d_context *context; struct wined3d_map_desc src; HRESULT hr = WINED3D_OK; -@@ -3662,6 +3713,13 @@ static HRESULT wined3d_device_update_texture_3d(struct wined3d_device *device, +@@ -3673,6 +3724,13 @@ static HRESULT wined3d_device_update_texture_3d(struct wined3d_device *device, } context = context_acquire(device, NULL, 0); @@ -2691,7 +2691,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c /* Only a prepare, since we're uploading entire volumes. */ wined3d_texture_prepare_texture(dst_texture, context, FALSE); -@@ -3669,15 +3727,22 @@ static HRESULT wined3d_device_update_texture_3d(struct wined3d_device *device, +@@ -3680,15 +3738,22 @@ static HRESULT wined3d_device_update_texture_3d(struct wined3d_device *device, for (i = 0; i < level_count; ++i) { @@ -2714,7 +2714,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (FAILED(hr = wined3d_resource_unmap(&src_texture->resource, src_level + i))) goto done; } -@@ -3685,16 +3750,89 @@ static HRESULT wined3d_device_update_texture_3d(struct wined3d_device *device, +@@ -3696,16 +3761,89 @@ static HRESULT wined3d_device_update_texture_3d(struct wined3d_device *device, done: context_release(context); return hr; @@ -2804,7 +2804,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c TRACE("device %p, src_texture %p, dst_texture %p.\n", device, src_texture, dst_texture); -@@ -3731,6 +3869,7 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device, +@@ -3742,6 +3880,7 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device, return WINED3DERR_INVALIDCALL; } @@ -2812,7 +2812,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c level_count = min(wined3d_texture_get_level_count(src_texture), wined3d_texture_get_level_count(dst_texture)); -@@ -3753,9 +3892,21 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device, +@@ -3764,9 +3903,21 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device, context_release(context); /* Update every surface level of the texture. */ @@ -2834,7 +2834,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c { unsigned int src_levels = src_texture->level_count; unsigned int dst_levels = dst_texture->level_count; -@@ -3788,6 +3939,38 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device, +@@ -3799,6 +3950,38 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device, FIXME("Unsupported texture type %#x.\n", type); return WINED3DERR_INVALIDCALL; } @@ -2873,7 +2873,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } HRESULT CDECL wined3d_device_validate_device(const struct wined3d_device *device, DWORD *num_passes) -@@ -3973,10 +4156,16 @@ void CDECL wined3d_device_copy_resource(struct wined3d_device *device, +@@ -3984,10 +4167,16 @@ void CDECL wined3d_device_copy_resource(struct wined3d_device *device, if (dst_resource->type == WINED3D_RTYPE_BUFFER) { @@ -2890,7 +2890,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c return; } -@@ -4097,8 +4286,14 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev +@@ -4108,8 +4297,14 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev return WINED3DERR_INVALIDCALL; } @@ -2905,7 +2905,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } if (dst_resource->type != WINED3D_RTYPE_TEXTURE_2D) -@@ -4244,10 +4439,15 @@ HRESULT CDECL wined3d_device_clear_rendertarget_view(struct wined3d_device *devi +@@ -4255,10 +4450,15 @@ HRESULT CDECL wined3d_device_clear_rendertarget_view(struct wined3d_device *devi return WINED3DERR_INVALIDCALL; } @@ -2921,7 +2921,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } struct wined3d_rendertarget_view * CDECL wined3d_device_get_rendertarget_view(const struct wined3d_device *device, -@@ -4817,7 +5017,11 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, +@@ -4828,7 +5028,11 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, { if (reset_state) hr = wined3d_device_create_primary_opengl_context(device); @@ -2933,7 +2933,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } /* All done. There is no need to reload resources or shaders, this will happen automatically on the -@@ -5132,3 +5336,58 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL +@@ -5143,3 +5347,58 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL else return CallWindowProcA(proc, window, message, wparam, lparam); } @@ -3137,7 +3137,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c return hr; } -@@ -2431,8 +2449,12 @@ HRESULT surface_color_fill(struct wined3d_surface *s, const RECT *rect, const st +@@ -2432,8 +2450,12 @@ HRESULT surface_color_fill(struct wined3d_surface *s, const RECT *rect, const st { struct wined3d_resource *resource = &s->container->resource; struct wined3d_device *device = resource->device; @@ -3150,7 +3150,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c const struct blit_shader *blitter; HRESULT hr; -@@ -2443,6 +2465,7 @@ HRESULT surface_color_fill(struct wined3d_surface *s, const RECT *rect, const st +@@ -2444,6 +2466,7 @@ HRESULT surface_color_fill(struct wined3d_surface *s, const RECT *rect, const st return WINED3DERR_INVALIDCALL; } @@ -3158,7 +3158,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c view_desc.format_id = resource->format->id; view_desc.flags = 0; view_desc.u.texture.level_idx = s->texture_level; -@@ -2458,6 +2481,19 @@ HRESULT surface_color_fill(struct wined3d_surface *s, const RECT *rect, const st +@@ -2459,6 +2482,19 @@ HRESULT surface_color_fill(struct wined3d_surface *s, const RECT *rect, const st hr = blitter->color_fill(device, view, rect, color); wined3d_rendertarget_view_decref(view); @@ -3178,7 +3178,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c return hr; } -@@ -2772,7 +2808,11 @@ static BOOL surface_load_texture(struct wined3d_surface *surface, +@@ -2773,7 +2809,11 @@ static BOOL surface_load_texture(struct wined3d_surface *surface, /* Don't use PBOs for converted surfaces. During PBO conversion we look at * WINED3D_TEXTURE_CONVERTED but it isn't set (yet) in all cases it is * getting called. */ @@ -3190,7 +3190,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c { TRACE("Removing the pbo attached to surface %p.\n", surface); -@@ -3737,7 +3777,11 @@ const struct blit_shader cpu_blit = { +@@ -3738,7 +3778,11 @@ const struct blit_shader cpu_blit = { cpu_blit_blit_surface, }; @@ -3202,26 +3202,21 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c struct wined3d_surface *src_surface, const RECT *src_rect, DWORD flags, const struct wined3d_blt_fx *fx, enum wined3d_texture_filter_type filter) { -@@ -3747,11 +3791,18 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -3748,8 +3792,13 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst struct wined3d_texture *dst_texture = dst_surface->container; struct wined3d_device *device = dst_texture->resource.device; struct wined3d_swapchain *src_swapchain, *dst_swapchain; +#if !defined(STAGING_CSMT) struct wined3d_texture *src_texture = NULL; unsigned int src_sub_resource_idx = 0; - DWORD src_ds_flags, dst_ds_flags; - BOOL scale, convert; - HRESULT hr; +#else /* STAGING_CSMT */ + struct wined3d_texture *src_texture; + unsigned int src_sub_resource_idx; -+ DWORD src_ds_flags, dst_ds_flags; -+ BOOL scale, convert; +#endif /* STAGING_CSMT */ + DWORD src_ds_flags, dst_ds_flags; + BOOL scale, convert; - static const DWORD simple_blit = WINED3D_BLT_ASYNC - | WINED3D_BLT_COLOR_FILL -@@ -3762,6 +3813,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -3762,6 +3811,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst | WINED3D_BLT_DO_NOT_WAIT | WINED3D_BLT_ALPHA_TEST; @@ -3229,7 +3224,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c TRACE("dst_surface %p, dst_rect %s, src_surface %p, src_rect %s, flags %#x, fx %p, filter %s.\n", dst_surface, wine_dbgstr_rect(dst_rect), src_surface, wine_dbgstr_rect(src_rect), flags, fx, debug_d3dtexturefiltertype(filter)); -@@ -3779,10 +3831,12 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -3779,10 +3829,12 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst fx->src_color_key.color_space_high_value); } @@ -3241,8 +3236,8 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c +#if !defined(STAGING_CSMT) } - if (dst_texture->sub_resources[dst_sub_resource_idx].map_count -@@ -3822,6 +3876,15 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst + if (!fx || !(fx->fx)) +@@ -3808,6 +3860,15 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst if (!once++) FIXME("Can't handle WINED3D_BLT_DO_NOT_WAIT flag.\n"); flags &= ~WINED3D_BLT_DO_NOT_WAIT; @@ -3258,7 +3253,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } if (!device->d3d_initialized) -@@ -3846,11 +3909,13 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -3832,11 +3893,13 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst goto fallback; } @@ -3272,7 +3267,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c dst_swapchain = dst_texture->swapchain; /* This isn't strictly needed. FBO blits for example could deal with -@@ -3886,13 +3951,21 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -3872,15 +3935,26 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst TRACE("Depth fill.\n"); if (!wined3d_format_convert_color_to_float(dst_texture->resource.format, NULL, fx->fill_color, &color)) @@ -3288,25 +3283,18 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c + return; +#endif /* STAGING_CSMT */ } - else + else if (SUCCEEDED(wined3d_surface_depth_blt(src_surface, src_texture->resource.draw_binding, + src_rect, dst_surface, dst_texture->resource.draw_binding, dst_rect))) { +#if !defined(STAGING_CSMT) - if (src_ds_flags != dst_ds_flags) - { - WARN("Rejecting depth / stencil blit between incompatible formats.\n"); -@@ -3902,6 +3975,11 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst - if (SUCCEEDED(wined3d_surface_depth_blt(src_surface, src_texture->resource.draw_binding, - src_rect, dst_surface, dst_texture->resource.draw_binding, dst_rect))) - return WINED3D_OK; + return WINED3D_OK; +#else /* STAGING_CSMT */ -+ if (SUCCEEDED(wined3d_surface_depth_blt(src_surface, src_texture->resource.draw_binding, -+ src_rect, dst_surface, dst_texture->resource.draw_binding, dst_rect))) -+ return; ++ return; +#endif /* STAGING_CSMT */ } } else -@@ -3937,7 +4015,11 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -3916,7 +3990,11 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst goto fallback; if (SUCCEEDED(surface_color_fill(dst_surface, dst_rect, &color))) @@ -3318,7 +3306,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } else { -@@ -3981,7 +4063,11 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -3960,7 +4038,11 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst context, dst_texture->resource.draw_binding); context_release(context); } @@ -3330,7 +3318,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } } } -@@ -4005,7 +4091,11 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -3984,7 +4066,11 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst wined3d_swapchain_present(dst_swapchain, NULL, NULL, dst_swapchain->win_handle, 0); dst_swapchain->desc.swap_effect = swap_effect; @@ -3342,7 +3330,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } if (fbo_blit_supported(&device->adapter->gl_info, blit_op, -@@ -4026,7 +4116,11 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -4005,7 +4091,11 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst wined3d_texture_invalidate_location(dst_texture, dst_sub_resource_idx, ~dst_texture->resource.draw_binding); @@ -3354,7 +3342,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } blitter = wined3d_select_blitter(&device->adapter->gl_info, &device->adapter->d3d_info, blit_op, -@@ -4036,7 +4130,11 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -4015,7 +4105,11 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst { blitter->blit_surface(device, blit_op, filter, src_surface, src_rect, dst_surface, dst_rect, color_key); @@ -3366,7 +3354,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } } } -@@ -4044,9 +4142,128 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -4023,9 +4117,81 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst fallback: /* Special cases for render targets. */ if (SUCCEEDED(surface_blt_special(dst_surface, dst_rect, src_surface, src_rect, flags, fx, filter))) @@ -3388,17 +3376,8 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c + struct wined3d_surface *src_surface, const RECT *src_rect, DWORD flags, + const struct wined3d_blt_fx *fx, enum wined3d_texture_filter_type filter) +{ -+ struct wined3d_box dst_box = {dst_rect->left, dst_rect->top, dst_rect->right, dst_rect->bottom, 0, 1}; -+ struct wined3d_box src_box = {src_rect->left, src_rect->top, src_rect->right, src_rect->bottom, 0, 1}; + struct wined3d_texture *dst_texture = dst_surface->container; -+ struct wined3d_texture *src_texture = NULL; + struct wined3d_device *device = dst_texture->resource.device; -+ unsigned int dst_sub_resource_idx = surface_get_sub_resource_idx(dst_surface), src_sub_resource_idx; -+ struct wined3d_texture_sub_resource *dst_sub_resource = -+ &dst_texture->sub_resources[dst_sub_resource_idx]; -+ struct wined3d_texture_sub_resource *src_sub_resource = NULL; -+ DWORD src_ds_flags, dst_ds_flags; -+ HRESULT hr; + + TRACE("dst_surface %p, dst_rect %s, src_surface %p, src_rect %s, flags %#x, fx %p, filter %s.\n", + dst_surface, wine_dbgstr_rect(dst_rect), src_surface, wine_dbgstr_rect(src_rect), @@ -3417,44 +3396,6 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c + fx->src_color_key.color_space_high_value); + } + -+ if (src_surface) -+ { -+ src_texture = src_surface->container; -+ src_sub_resource_idx = surface_get_sub_resource_idx(src_surface); -+ src_sub_resource = &src_surface->container->sub_resources[src_sub_resource_idx]; -+ } -+ -+ if (dst_sub_resource->map_count || (src_sub_resource && src_sub_resource->map_count)) -+ { -+ wined3d_cs_emit_sync(device->cs); -+ if (dst_sub_resource->map_count || (src_sub_resource && src_sub_resource->map_count)) -+ { -+ WARN("Surface is busy, returning WINEDDERR_SURFACEBUSY.\n"); -+ return WINEDDERR_SURFACEBUSY; -+ } -+ } -+ -+ if (FAILED(hr = wined3d_texture_check_box_dimensions(dst_texture, dst_surface->texture_level, &dst_box))) -+ return hr; -+ -+ if (src_texture && FAILED(hr = wined3d_texture_check_box_dimensions(src_texture, -+ src_surface->texture_level, &src_box))) -+ return hr; -+ -+ dst_ds_flags = dst_texture->resource.format_flags -+ & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL); -+ if (src_surface) -+ src_ds_flags = src_surface->container->resource.format_flags -+ & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL); -+ else -+ src_ds_flags = 0; -+ -+ if (!(flags & WINED3D_BLT_DEPTH_FILL) && (src_ds_flags != dst_ds_flags)) -+ { -+ WARN("Rejecting depth / stencil blit between incompatible formats.\n"); -+ return WINED3DERR_INVALIDCALL; -+ } -+ + /* FIXME: We should select the blitter in the main thread, that way we can return an error if the blit + * is unsupported without duplicating all the checks... */ + if (flags & WINED3D_BLT_COLOR_FILL && (dst_surface->container->resource.format_flags & WINED3DFMT_FLAG_BLOCKS)) @@ -3852,7 +3793,26 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c if (sub_resource->locations & WINED3D_LOCATION_TEXTURE_RGB) wined3d_texture_bind_and_dirtify(texture, context, FALSE); -@@ -3473,13 +3579,49 @@ HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct +@@ -3190,8 +3296,18 @@ HRESULT CDECL wined3d_texture_blt(struct wined3d_texture *dst_texture, unsigned + if (dst_texture->sub_resources[dst_sub_resource_idx].map_count + || (src_texture && src_texture->sub_resources[src_sub_resource_idx].map_count)) + { ++#if !defined(STAGING_CSMT) + WARN("Sub-resource is busy, returning WINEDDERR_SURFACEBUSY.\n"); + return WINEDDERR_SURFACEBUSY; ++#else /* STAGING_CSMT */ ++ wined3d_cs_emit_sync(dst_texture->resource.device->cs); ++ if (dst_texture->sub_resources[dst_sub_resource_idx].map_count ++ || (src_texture && src_texture->sub_resources[src_sub_resource_idx].map_count)) ++ { ++ WARN("Sub-resource is busy, returning WINEDDERR_SURFACEBUSY.\n"); ++ return WINEDDERR_SURFACEBUSY; ++ } ++#endif /* STAGING_CSMT */ + } + + if ((dst_format_flags & WINED3DFMT_FLAG_BLOCKS) && (flags & WINED3D_BLT_COLOR_FILL)) +@@ -3508,13 +3624,49 @@ HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct return WINED3D_OK; } @@ -3902,7 +3862,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c TRACE("texture %p, sub_resource_idx %u, dc %p.\n", texture, sub_resource_idx, dc); -@@ -3504,6 +3646,7 @@ HRESULT CDECL wined3d_texture_get_dc(struct wined3d_texture *texture, unsigned i +@@ -3539,6 +3691,7 @@ HRESULT CDECL wined3d_texture_get_dc(struct wined3d_texture *texture, unsigned i if (texture->resource.map_count && !(texture->flags & WINED3D_TEXTURE_GET_DC_LENIENT)) return WINED3DERR_INVALIDCALL; @@ -3910,7 +3870,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c if (device->d3d_initialized) context = context_acquire(device, NULL, 0); -@@ -3521,11 +3664,40 @@ HRESULT CDECL wined3d_texture_get_dc(struct wined3d_texture *texture, unsigned i +@@ -3556,11 +3709,40 @@ HRESULT CDECL wined3d_texture_get_dc(struct wined3d_texture *texture, unsigned i texture->flags |= WINED3D_TEXTURE_DC_IN_USE; ++texture->resource.map_count; ++sub_resource->map_count; @@ -3951,7 +3911,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c } HRESULT CDECL wined3d_texture_release_dc(struct wined3d_texture *texture, unsigned int sub_resource_idx, HDC dc) -@@ -3556,6 +3728,7 @@ HRESULT CDECL wined3d_texture_release_dc(struct wined3d_texture *texture, unsign +@@ -3591,6 +3773,7 @@ HRESULT CDECL wined3d_texture_release_dc(struct wined3d_texture *texture, unsign return WINED3DERR_INVALIDCALL; } @@ -3959,7 +3919,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c if (!(texture->resource.usage & WINED3DUSAGE_OWNDC) && !(device->wined3d->flags & WINED3D_NO3D)) wined3d_surface_destroy_dc(surface); -@@ -3566,4 +3739,9 @@ HRESULT CDECL wined3d_texture_release_dc(struct wined3d_texture *texture, unsign +@@ -3601,4 +3784,9 @@ HRESULT CDECL wined3d_texture_release_dc(struct wined3d_texture *texture, unsign texture->flags &= ~WINED3D_TEXTURE_DC_IN_USE; return WINED3D_OK;