From fbe5fa909acb45f3ee02bdb0b87b2620686006c5 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Fri, 19 Aug 2016 00:47:59 +0200 Subject: [PATCH] wined3d-CSMT_Main: Added patch to avoid calling SetEvent when worker thread is fast enough. --- patches/patchinstall.sh | 1 + ...ignal-CS-event-when-we-manage-to-uns.patch | 26 +++++++++++++++++++ .../wined3d-CSMT_Main/9999-IfDefined.patch | 2 +- 3 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 patches/wined3d-CSMT_Main/0135-wined3d-Do-not-signal-CS-event-when-we-manage-to-uns.patch diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 65ea639d..f02d1963 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -7375,6 +7375,7 @@ if test "$enable_wined3d_CSMT_Main" -eq 1; then echo '+ { "Sebastian Lackner", "wined3d: Do not query available GPU memory on main thread when CSMT is enabled.", 1 },'; echo '+ { "Nils Kuhnhenn", "wined3d: Fix incorrect return value in wined3d_cs_exec_set_light.", 1 },'; echo '+ { "Nils Kuhnhenn", "wined3d: Fix context_acquire not being called from the command thread in wined3d_texture_add_dirty_region.", 1 },'; + echo '+ { "Sebastian Lackner", "wined3d: Do not signal CS event when we manage to unset waiting_for_event quickly enough.", 1 },'; echo '+ { "Sebastian Lackner", "wined3d: Enable CSMT by default, print a winediag message informing about this patchset.", 1 },'; ) >> "$patchlist" fi diff --git a/patches/wined3d-CSMT_Main/0135-wined3d-Do-not-signal-CS-event-when-we-manage-to-uns.patch b/patches/wined3d-CSMT_Main/0135-wined3d-Do-not-signal-CS-event-when-we-manage-to-uns.patch new file mode 100644 index 00000000..0e48c582 --- /dev/null +++ b/patches/wined3d-CSMT_Main/0135-wined3d-Do-not-signal-CS-event-when-we-manage-to-uns.patch @@ -0,0 +1,26 @@ +From 3ad4bff5048dec66d702823df7f9e6ea0f9041d8 Mon Sep 17 00:00:00 2001 +From: Sebastian Lackner +Date: Thu, 18 Aug 2016 20:50:52 +0200 +Subject: wined3d: Do not signal CS event when we manage to unset + waiting_for_event quickly enough. + +--- + dlls/wined3d/cs.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c +index 02ca2de..ae540c8 100644 +--- a/dlls/wined3d/cs.c ++++ b/dlls/wined3d/cs.c +@@ -3000,7 +3000,7 @@ static void wined3d_cs_wait_event(struct wined3d_cs *cs) + * of doing so. Wait for the event to reset it. ResetEvent is not good + * because the main thread might be beween the waiting_for_event reset + * and SignalEvent call. */ +- if (!InterlockedCompareExchange(&cs->waiting_for_event, FALSE, FALSE)) ++ if (!InterlockedCompareExchange(&cs->waiting_for_event, FALSE, TRUE)) + WaitForSingleObject(cs->event, INFINITE); + } + else +-- +2.9.0 + diff --git a/patches/wined3d-CSMT_Main/9999-IfDefined.patch b/patches/wined3d-CSMT_Main/9999-IfDefined.patch index 799faff2..9d650dae 100644 --- a/patches/wined3d-CSMT_Main/9999-IfDefined.patch +++ b/patches/wined3d-CSMT_Main/9999-IfDefined.patch @@ -3380,7 +3380,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c + * of doing so. Wait for the event to reset it. ResetEvent is not good + * because the main thread might be beween the waiting_for_event reset + * and SignalEvent call. */ -+ if (!InterlockedCompareExchange(&cs->waiting_for_event, FALSE, FALSE)) ++ if (!InterlockedCompareExchange(&cs->waiting_for_event, FALSE, TRUE)) + WaitForSingleObject(cs->event, INFINITE); + } + else