From: Matteo Bruni mbruni@codeweavers.com
Over the last few Wine releases we greatly reduced the need for the application thread to wait for replies from the CS thread. Compared to the time when the command stream was initially introduced, it's now quite likely that, when the command queues become empty, they are going to stay like that for a while (e.g. the game is throttling the framerate or is busy doing some CPU work on its part before generating more commands).
As a first step, reduce the spin count to reduce the busy waiting in wined3d_cs_run(). In my tests this significantly reduces CPU usage, with minimally decreased performance in a few rare cases but also significantly improved performance in many cases (notably with integrated GPUs where freeing the CPU directly allows more power to be allocated to the GPU). --- dlls/wined3d/wined3d_private.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index c71ac59270b..efdcff41e58 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -5079,7 +5079,7 @@ enum wined3d_push_constants #else #define WINED3D_CS_QUEUE_SIZE 0x400000u #endif -#define WINED3D_CS_SPIN_COUNT 10000000u +#define WINED3D_CS_SPIN_COUNT 2000u #define WINED3D_CS_QUEUE_MASK (WINED3D_CS_QUEUE_SIZE - 1)
C_ASSERT(!(WINED3D_CS_QUEUE_SIZE & (WINED3D_CS_QUEUE_SIZE - 1)));