Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
ea48ac41
Commit
ea48ac41
authored
Mar 01, 2022
by
Zebediah Figura
Committed by
Alexandre Julliard
Dec 08, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Sleep when waiting for the CS thread.
parent
7d247ca6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
2 deletions
+16
-2
cs.c
dlls/wined3d/cs.c
+2
-1
wined3d_private.h
dlls/wined3d/wined3d_private.h
+14
-1
No files found.
dlls/wined3d/cs.c
View file @
ea48ac41
...
...
@@ -3284,12 +3284,13 @@ static void *wined3d_cs_mt_require_space(struct wined3d_device_context *context,
static
void
wined3d_cs_mt_finish
(
struct
wined3d_device_context
*
context
,
enum
wined3d_cs_queue_id
queue_id
)
{
struct
wined3d_cs
*
cs
=
wined3d_cs_from_context
(
context
);
unsigned
int
spin_count
=
0
;
if
(
cs
->
thread_id
==
GetCurrentThreadId
())
return
wined3d_cs_st_finish
(
context
,
queue_id
);
while
(
cs
->
queue
[
queue_id
].
head
!=
*
(
volatile
ULONG
*
)
&
cs
->
queue
[
queue_id
].
tail
)
YieldProcessor
(
);
wined3d_pause
(
&
spin_count
);
}
static
const
struct
wined3d_device_context_ops
wined3d_cs_mt_ops
=
...
...
dlls/wined3d/wined3d_private.h
View file @
ea48ac41
...
...
@@ -3566,6 +3566,8 @@ enum wined3d_cs_queue_id
#define WINED3D_CS_SPIN_COUNT 2000u
/* How long to wait for commands when there are active queries, in µs. */
#define WINED3D_CS_COMMAND_WAIT_WITH_QUERIES_TIMEOUT 100
/* How long to wait for the CS from the client thread, in µs. */
#define WINED3D_CS_CLIENT_WAIT_TIMEOUT 0
#define WINED3D_CS_QUEUE_MASK (WINED3D_CS_QUEUE_SIZE - 1)
C_ASSERT
(
!
(
WINED3D_CS_QUEUE_SIZE
&
(
WINED3D_CS_QUEUE_SIZE
-
1
)));
...
...
@@ -3758,6 +3760,16 @@ static inline void wined3d_resource_reference(struct wined3d_resource *resource)
resource
->
access_time
=
cs
->
queue
[
WINED3D_CS_QUEUE_DEFAULT
].
head
;
}
#define WINED3D_PAUSE_SPIN_COUNT 200u
static
inline
void
wined3d_pause
(
unsigned
int
*
spin_count
)
{
static
const
LARGE_INTEGER
timeout
=
{.
QuadPart
=
WINED3D_CS_CLIENT_WAIT_TIMEOUT
*
-
10
};
if
(
++*
spin_count
>=
WINED3D_PAUSE_SPIN_COUNT
)
NtDelayExecution
(
FALSE
,
&
timeout
);
}
static
inline
BOOL
wined3d_ge_wrap
(
ULONG
x
,
ULONG
y
)
{
return
(
x
-
y
)
<
UINT_MAX
/
2
;
...
...
@@ -3768,6 +3780,7 @@ static inline void wined3d_resource_wait_idle(const struct wined3d_resource *res
{
const
struct
wined3d_cs
*
cs
=
resource
->
device
->
cs
;
ULONG
access_time
,
tail
,
head
;
unsigned
int
spin_count
=
0
;
if
(
!
cs
->
thread
||
cs
->
thread_id
==
GetCurrentThreadId
())
return
;
...
...
@@ -3806,7 +3819,7 @@ static inline void wined3d_resource_wait_idle(const struct wined3d_resource *res
if
(
!
wined3d_ge_wrap
(
access_time
,
tail
)
&&
access_time
!=
tail
)
break
;
YieldProcessor
(
);
wined3d_pause
(
&
spin_count
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment