Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
c179b269
Commit
c179b269
authored
Feb 27, 2024
by
Rémi Bernon
Committed by
Alexandre Julliard
Mar 07, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
win32u: Keep a reference on the adapters gpu.
parent
e5afb283
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
2 deletions
+22
-2
sysparams.c
dlls/win32u/sysparams.c
+22
-2
No files found.
dlls/win32u/sysparams.c
View file @
c179b269
...
...
@@ -98,6 +98,7 @@ struct display_device
struct
gpu
{
LONG
refcount
;
struct
list
entry
;
LUID
luid
;
unsigned
int
adapter_count
;
...
...
@@ -110,6 +111,7 @@ struct adapter
struct
display_device
dev
;
LUID
gpu_luid
;
unsigned
int
id
;
struct
gpu
*
gpu
;
const
WCHAR
*
config_key
;
unsigned
int
mode_count
;
DEVMODEW
*
modes
;
...
...
@@ -336,6 +338,18 @@ static void release_display_device_init_mutex( HANDLE mutex )
NtClose
(
mutex
);
}
static
struct
gpu
*
gpu_acquire
(
struct
gpu
*
gpu
)
{
InterlockedIncrement
(
&
gpu
->
refcount
);
return
gpu
;
}
static
void
gpu_release
(
struct
gpu
*
gpu
)
{
if
(
!
InterlockedDecrement
(
&
gpu
->
refcount
))
free
(
gpu
);
}
static
struct
adapter
*
adapter_acquire
(
struct
adapter
*
adapter
)
{
InterlockedIncrement
(
&
adapter
->
refcount
);
...
...
@@ -346,6 +360,7 @@ static void adapter_release( struct adapter *adapter )
{
if
(
!
InterlockedDecrement
(
&
adapter
->
refcount
))
{
gpu_release
(
adapter
->
gpu
);
free
(
adapter
->
modes
);
free
(
adapter
);
}
...
...
@@ -1477,7 +1492,7 @@ static void clear_display_devices(void)
{
gpu
=
LIST_ENTRY
(
list_head
(
&
gpus
),
struct
gpu
,
entry
);
list_remove
(
&
gpu
->
entry
);
fre
e
(
gpu
);
gpu_releas
e
(
gpu
);
}
}
...
...
@@ -1521,7 +1536,8 @@ static BOOL update_display_cache_from_registry(void)
if
(
!
read_display_adapter_settings
(
adapter_id
,
adapter
))
{
adapter_release
(
adapter
);
free
(
adapter
->
modes
);
free
(
adapter
);
break
;
}
...
...
@@ -1588,6 +1604,7 @@ static BOOL update_display_cache_from_registry(void)
NtClose
(
gpu_key
);
continue
;
}
gpu
->
refcount
=
1
;
if
((
prop_key
=
reg_open_ascii_key
(
gpu_key
,
devpropkey_gpu_luidA
)))
{
...
...
@@ -1599,7 +1616,10 @@ static BOOL update_display_cache_from_registry(void)
LIST_FOR_EACH_ENTRY
(
adapter
,
&
adapters
,
struct
adapter
,
entry
)
{
if
(
!
memcmp
(
&
adapter
->
gpu_luid
,
&
gpu
->
luid
,
sizeof
(
LUID
)
))
{
adapter
->
gpu
=
gpu_acquire
(
gpu
);
gpu
->
adapter_count
++
;
}
}
list_add_tail
(
&
gpus
,
&
gpu
->
entry
);
...
...
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