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
fecfb442
Commit
fecfb442
authored
Mar 27, 2024
by
Rémi Bernon
Committed by
Alexandre Julliard
Mar 28, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
win32u: Use named adapters instead of struct gdi_adapter.
parent
00a0c978
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
50 additions
and
70 deletions
+50
-70
sysparams.c
dlls/win32u/sysparams.c
+15
-24
init.c
dlls/wineandroid.drv/init.c
+2
-5
display.c
dlls/winemac.drv/display.c
+4
-6
display.c
dlls/winewayland.drv/display.c
+7
-14
display.c
dlls/winex11.drv/display.c
+4
-3
x11drv.h
dlls/winex11.drv/x11drv.h
+8
-2
xinerama.c
dlls/winex11.drv/xinerama.c
+4
-4
xrandr.c
dlls/winex11.drv/xrandr.c
+5
-5
gdi_driver.h
include/wine/gdi_driver.h
+1
-7
No files found.
dlls/win32u/sysparams.c
View file @
fecfb442
...
...
@@ -1294,11 +1294,11 @@ static BOOL write_adapter_to_registry( const struct adapter *adapter, HKEY *adap
return
TRUE
;
}
static
void
add_adapter
(
const
struct
gdi_adapter
*
adapter
,
void
*
param
)
static
void
add_adapter
(
const
char
*
name
,
UINT
state_flags
,
void
*
param
)
{
struct
device_manager_ctx
*
ctx
=
param
;
TRACE
(
"
\n
"
);
TRACE
(
"
name %s, state_flags %#x
\n
"
,
name
,
state_flags
);
if
(
ctx
->
adapter_key
)
{
...
...
@@ -1309,11 +1309,11 @@ static void add_adapter( const struct gdi_adapter *adapter, void *param )
memset
(
&
ctx
->
adapter
,
0
,
sizeof
(
ctx
->
adapter
)
);
ctx
->
adapter
.
gpu
=
&
ctx
->
gpu
;
ctx
->
adapter
.
id
=
ctx
->
adapter_count
;
ctx
->
adapter
.
state_flags
=
adapter
->
state_flags
;
ctx
->
adapter
.
state_flags
=
state_flags
;
/* Wine specific config key where
adapter
settings will be held, symlinked with the logically indexed config key */
sprintf
(
ctx
->
adapter
.
path
,
"%s
\\
%s
\\
Video
\\
%s
\\
Adapters
\\
%04x
"
,
config_keyA
,
control_keyA
+
strlen
(
"
\\
Registry
\\
Machine"
),
ctx
->
gpu
.
guid
,
ctx
->
gpu
.
adapter_count
);
/* Wine specific config key where
source
settings will be held, symlinked with the logically indexed config key */
sprintf
(
ctx
->
adapter
.
path
,
"%s
\\
%s
\\
Video
\\
%s
\\
Sources
\\
%s
"
,
config_keyA
,
control_keyA
+
strlen
(
"
\\
Registry
\\
Machine"
),
ctx
->
gpu
.
guid
,
name
);
if
(
!
write_adapter_to_registry
(
&
ctx
->
adapter
,
&
ctx
->
adapter_key
))
WARN
(
"Failed to write adapter to registry
\n
"
);
...
...
@@ -1444,12 +1444,9 @@ static void add_mode( const DEVMODEW *mode, BOOL current, void *param )
if
(
!
ctx
->
gpu
.
adapter_count
)
{
static
const
struct
gdi_adapter
default_adapter
=
{
.
state_flags
=
DISPLAY_DEVICE_ATTACHED_TO_DESKTOP
|
DISPLAY_DEVICE_PRIMARY_DEVICE
|
DISPLAY_DEVICE_VGA_COMPATIBLE
,
};
TRACE
(
"adding default fake adapter
\n
"
);
add_adapter
(
&
default_adapter
,
ctx
);
static
const
DWORD
source_flags
=
DISPLAY_DEVICE_ATTACHED_TO_DESKTOP
|
DISPLAY_DEVICE_PRIMARY_DEVICE
|
DISPLAY_DEVICE_VGA_COMPATIBLE
;
TRACE
(
"adding default fake source
\n
"
);
add_adapter
(
"Default"
,
source_flags
,
ctx
);
}
nopos_mode
=
*
mode
;
...
...
@@ -1755,11 +1752,8 @@ static BOOL default_update_display_devices( const struct gdi_device_manager *man
{
.
dmFields
=
DM_DISPLAYORIENTATION
|
DM_BITSPERPEL
|
DM_PELSWIDTH
|
DM_PELSHEIGHT
|
DM_DISPLAYFLAGS
|
DM_DISPLAYFREQUENCY
,
.
dmBitsPerPel
=
16
,
.
dmPelsWidth
=
1024
,
.
dmPelsHeight
=
768
,
.
dmDisplayFrequency
=
60
,
},
};
static
const
DWORD
source_flags
=
DISPLAY_DEVICE_ATTACHED_TO_DESKTOP
|
DISPLAY_DEVICE_PRIMARY_DEVICE
|
DISPLAY_DEVICE_VGA_COMPATIBLE
;
static
const
struct
gdi_gpu
gpu
;
static
const
struct
gdi_adapter
adapter
=
{
.
state_flags
=
DISPLAY_DEVICE_ATTACHED_TO_DESKTOP
|
DISPLAY_DEVICE_PRIMARY_DEVICE
|
DISPLAY_DEVICE_VGA_COMPATIBLE
,
};
struct
gdi_monitor
monitor
=
{
0
};
DEVMODEW
mode
=
{{
0
}};
UINT
i
;
...
...
@@ -1767,7 +1761,7 @@ static BOOL default_update_display_devices( const struct gdi_device_manager *man
if
(
!
force
)
return
TRUE
;
manager
->
add_gpu
(
&
gpu
,
ctx
);
manager
->
add_adapter
(
&
adapter
,
ctx
);
manager
->
add_adapter
(
"Default"
,
source_flags
,
ctx
);
if
(
!
read_adapter_mode
(
ctx
->
adapter_key
,
ENUM_CURRENT_SETTINGS
,
&
mode
))
{
...
...
@@ -1831,10 +1825,10 @@ static void desktop_add_gpu( const struct gdi_gpu *gpu, void *param )
{
}
static
void
desktop_add_adapter
(
const
struct
gdi_adapter
*
adapter
,
void
*
param
)
static
void
desktop_add_adapter
(
const
char
*
name
,
UINT
state_flags
,
void
*
param
)
{
struct
device_manager_ctx
*
ctx
=
param
;
ctx
->
is_primary
=
!!
(
adapter
->
state_flags
&
DISPLAY_DEVICE_PRIMARY_DEVICE
);
ctx
->
is_primary
=
!!
(
state_flags
&
DISPLAY_DEVICE_PRIMARY_DEVICE
);
}
static
void
desktop_add_monitor
(
const
struct
gdi_monitor
*
monitor
,
void
*
param
)
...
...
@@ -1863,11 +1857,8 @@ static const struct gdi_device_manager desktop_device_manager =
static
BOOL
desktop_update_display_devices
(
BOOL
force
,
struct
device_manager_ctx
*
ctx
)
{
static
const
DWORD
source_flags
=
DISPLAY_DEVICE_ATTACHED_TO_DESKTOP
|
DISPLAY_DEVICE_PRIMARY_DEVICE
|
DISPLAY_DEVICE_VGA_COMPATIBLE
;
static
const
struct
gdi_gpu
gpu
;
static
const
struct
gdi_adapter
adapter
=
{
.
state_flags
=
DISPLAY_DEVICE_ATTACHED_TO_DESKTOP
|
DISPLAY_DEVICE_PRIMARY_DEVICE
|
DISPLAY_DEVICE_VGA_COMPATIBLE
,
};
struct
gdi_monitor
monitor
=
{
0
};
static
struct
screen_size
{
...
...
@@ -1932,7 +1923,7 @@ static BOOL desktop_update_display_devices( BOOL force, struct device_manager_ct
}
add_gpu
(
&
gpu
,
ctx
);
add_adapter
(
&
adapter
,
ctx
);
add_adapter
(
"Default"
,
source_flags
,
ctx
);
if
(
!
read_adapter_mode
(
ctx
->
adapter_key
,
ENUM_CURRENT_SETTINGS
,
&
current
))
{
current
=
mode
;
...
...
dlls/wineandroid.drv/init.c
View file @
fecfb442
...
...
@@ -273,11 +273,8 @@ BOOL ANDROID_UpdateDisplayDevices( const struct gdi_device_manager *device_manag
{
if
(
force
||
force_display_devices_refresh
)
{
static
const
DWORD
source_flags
=
DISPLAY_DEVICE_ATTACHED_TO_DESKTOP
|
DISPLAY_DEVICE_PRIMARY_DEVICE
|
DISPLAY_DEVICE_VGA_COMPATIBLE
;
static
const
struct
gdi_gpu
gpu
;
static
const
struct
gdi_adapter
adapter
=
{
.
state_flags
=
DISPLAY_DEVICE_ATTACHED_TO_DESKTOP
|
DISPLAY_DEVICE_PRIMARY_DEVICE
|
DISPLAY_DEVICE_VGA_COMPATIBLE
,
};
struct
gdi_monitor
gdi_monitor
=
{
.
rc_monitor
=
virtual_screen_rect
,
...
...
@@ -290,7 +287,7 @@ BOOL ANDROID_UpdateDisplayDevices( const struct gdi_device_manager *device_manag
.
dmBitsPerPel
=
screen_bpp
,
.
dmPelsWidth
=
screen_width
,
.
dmPelsHeight
=
screen_height
,
.
dmDisplayFrequency
=
60
,
};
device_manager
->
add_gpu
(
&
gpu
,
param
);
device_manager
->
add_adapter
(
&
adapter
,
param
);
device_manager
->
add_adapter
(
"Default"
,
source_flags
,
param
);
device_manager
->
add_monitor
(
&
gdi_monitor
,
param
);
device_manager
->
add_mode
(
&
mode
,
TRUE
,
param
);
force_display_devices_refresh
=
FALSE
;
...
...
dlls/winemac.drv/display.c
View file @
fecfb442
...
...
@@ -1178,12 +1178,10 @@ BOOL macdrv_UpdateDisplayDevices( const struct gdi_device_manager *device_manage
for
(
adapter
=
adapters
;
adapter
<
adapters
+
adapter_count
;
adapter
++
)
{
DEVMODEW
current_mode
=
{
.
dmSize
=
sizeof
(
current_mode
)
};
struct
gdi_adapter
gdi_adapter
=
{
.
id
=
adapter
->
id
,
.
state_flags
=
adapter
->
state_flags
,
};
device_manager
->
add_adapter
(
&
gdi_adapter
,
param
);
char
buffer
[
32
];
sprintf
(
buffer
,
"%04x"
,
adapter
->
id
);
device_manager
->
add_adapter
(
buffer
,
adapter
->
state_flags
,
param
);
if
(
macdrv_get_monitors
(
adapter
->
id
,
&
monitors
,
&
monitor_count
))
break
;
TRACE
(
"adapter: %#x, monitor count: %d
\n
"
,
adapter
->
id
,
monitor_count
);
...
...
dlls/winewayland.drv/display.c
View file @
fecfb442
...
...
@@ -211,18 +211,11 @@ static void wayland_add_device_gpu(const struct gdi_device_manager *device_manag
}
static
void
wayland_add_device_adapter
(
const
struct
gdi_device_manager
*
device_manager
,
void
*
param
,
INT
output_id
)
void
*
param
,
UINT
state_flags
,
struct
output_info
*
output_info
)
{
struct
gdi_adapter
adapter
;
adapter
.
id
=
output_id
;
adapter
.
state_flags
=
DISPLAY_DEVICE_ATTACHED_TO_DESKTOP
;
if
(
output_id
==
0
)
adapter
.
state_flags
|=
DISPLAY_DEVICE_PRIMARY_DEVICE
;
TRACE
(
"id=0x%s state_flags=0x%x
\n
"
,
wine_dbgstr_longlong
(
adapter
.
id
),
(
UINT
)
adapter
.
state_flags
);
device_manager
->
add_adapter
(
&
adapter
,
param
);
TRACE
(
"name=%s state_flags=0x%x
\n
"
,
output_info
->
output
->
name
,
state_flags
);
device_manager
->
add_adapter
(
output_info
->
output
->
name
,
state_flags
,
param
);
}
static
void
wayland_add_device_monitor
(
const
struct
gdi_device_manager
*
device_manager
,
...
...
@@ -283,7 +276,7 @@ BOOL WAYLAND_UpdateDisplayDevices(const struct gdi_device_manager *device_manage
BOOL
force
,
void
*
param
)
{
struct
wayland_output
*
output
;
INT
output_id
=
0
;
DWORD
state_flags
=
DISPLAY_DEVICE_ATTACHED_TO_DESKTOP
|
DISPLAY_DEVICE_PRIMARY_DEVICE
;
struct
wl_array
output_info_array
;
struct
output_info
*
output_info
;
...
...
@@ -312,10 +305,10 @@ BOOL WAYLAND_UpdateDisplayDevices(const struct gdi_device_manager *device_manage
wl_array_for_each
(
output_info
,
&
output_info_array
)
{
wayland_add_device_adapter
(
device_manager
,
param
,
output_id
);
wayland_add_device_adapter
(
device_manager
,
param
,
state_flags
,
output_info
);
wayland_add_device_monitor
(
device_manager
,
param
,
output_info
);
wayland_add_device_modes
(
device_manager
,
param
,
output_info
);
output_id
++
;
state_flags
&=
~
DISPLAY_DEVICE_PRIMARY_DEVICE
;
}
wl_array_release
(
&
output_info_array
);
...
...
dlls/winex11.drv/display.c
View file @
fecfb442
...
...
@@ -397,7 +397,7 @@ RECT get_host_primary_monitor_rect(void)
{
INT
gpu_count
,
adapter_count
,
monitor_count
;
struct
gdi_gpu
*
gpus
=
NULL
;
struct
gdi
_adapter
*
adapters
=
NULL
;
struct
x11drv
_adapter
*
adapters
=
NULL
;
struct
gdi_monitor
*
monitors
=
NULL
;
RECT
rect
=
{
0
};
...
...
@@ -515,7 +515,7 @@ static const char *debugstr_devmodew( const DEVMODEW *devmode )
BOOL
X11DRV_UpdateDisplayDevices
(
const
struct
gdi_device_manager
*
device_manager
,
BOOL
force
,
void
*
param
)
{
struct
gdi
_adapter
*
adapters
;
struct
x11drv
_adapter
*
adapters
;
struct
gdi_monitor
*
monitors
;
struct
gdi_gpu
*
gpus
;
INT
gpu_count
,
adapter_count
,
monitor_count
;
...
...
@@ -548,7 +548,8 @@ BOOL X11DRV_UpdateDisplayDevices( const struct gdi_device_manager *device_manage
x11drv_settings_id
settings_id
;
BOOL
is_primary
=
adapters
[
adapter
].
state_flags
&
DISPLAY_DEVICE_PRIMARY_DEVICE
;
device_manager
->
add_adapter
(
&
adapters
[
adapter
],
param
);
sprintf
(
buffer
,
"%04lx"
,
adapters
[
adapter
].
id
);
device_manager
->
add_adapter
(
buffer
,
adapters
[
adapter
].
state_flags
,
param
);
if
(
!
host_handler
.
get_monitors
(
adapters
[
adapter
].
id
,
&
monitors
,
&
monitor_count
))
break
;
TRACE
(
"adapter: %#lx, monitor count: %d
\n
"
,
adapters
[
adapter
].
id
,
monitor_count
);
...
...
dlls/winex11.drv/x11drv.h
View file @
fecfb442
...
...
@@ -761,6 +761,12 @@ void init_user_driver(void);
/* X11 display device handler. Used to initialize display device registry data */
struct
x11drv_adapter
{
ULONG_PTR
id
;
DWORD
state_flags
;
};
/* Required functions for display device registry initialization */
struct
x11drv_display_device_handler
{
...
...
@@ -779,7 +785,7 @@ struct x11drv_display_device_handler
* The first adapter has to be primary if GPU is primary.
*
* Return FALSE on failure with parameters unchanged */
BOOL
(
*
get_adapters
)(
ULONG_PTR
gpu_id
,
struct
gdi
_adapter
**
adapters
,
int
*
count
);
BOOL
(
*
get_adapters
)(
ULONG_PTR
gpu_id
,
struct
x11drv
_adapter
**
adapters
,
int
*
count
);
/* get_monitors will be called to get a list of monitors in EnumDisplayDevices context under an adapter.
* The first monitor has to be primary if adapter is primary.
...
...
@@ -791,7 +797,7 @@ struct x11drv_display_device_handler
void
(
*
free_gpus
)(
struct
gdi_gpu
*
gpus
);
/* free_adapters will be called to free an adapter list from get_adapters */
void
(
*
free_adapters
)(
struct
gdi
_adapter
*
adapters
);
void
(
*
free_adapters
)(
struct
x11drv
_adapter
*
adapters
);
/* free_monitors will be called to free a monitor list from get_monitors */
void
(
*
free_monitors
)(
struct
gdi_monitor
*
monitors
,
int
count
);
...
...
dlls/winex11.drv/xinerama.c
View file @
fecfb442
...
...
@@ -213,9 +213,9 @@ static void xinerama_free_gpus( struct gdi_gpu *gpus )
free
(
gpus
);
}
static
BOOL
xinerama_get_adapters
(
ULONG_PTR
gpu_id
,
struct
gdi
_adapter
**
new_adapters
,
int
*
count
)
static
BOOL
xinerama_get_adapters
(
ULONG_PTR
gpu_id
,
struct
x11drv
_adapter
**
new_adapters
,
int
*
count
)
{
struct
gdi
_adapter
*
adapters
=
NULL
;
struct
x11drv
_adapter
*
adapters
=
NULL
;
INT
index
=
0
;
INT
i
,
j
;
INT
primary_index
;
...
...
@@ -268,7 +268,7 @@ static BOOL xinerama_get_adapters( ULONG_PTR gpu_id, struct gdi_adapter **new_ad
/* Primary adapter has to be first */
if
(
primary_index
)
{
struct
gdi
_adapter
tmp
;
struct
x11drv
_adapter
tmp
;
tmp
=
adapters
[
primary_index
];
adapters
[
primary_index
]
=
adapters
[
0
];
adapters
[
0
]
=
tmp
;
...
...
@@ -280,7 +280,7 @@ static BOOL xinerama_get_adapters( ULONG_PTR gpu_id, struct gdi_adapter **new_ad
return
TRUE
;
}
static
void
xinerama_free_adapters
(
struct
gdi
_adapter
*
adapters
)
static
void
xinerama_free_adapters
(
struct
x11drv
_adapter
*
adapters
)
{
free
(
adapters
);
}
...
...
dlls/winex11.drv/xrandr.c
View file @
fecfb442
...
...
@@ -863,9 +863,9 @@ static void xrandr14_free_gpus( struct gdi_gpu *gpus )
free
(
gpus
);
}
static
BOOL
xrandr14_get_adapters
(
ULONG_PTR
gpu_id
,
struct
gdi
_adapter
**
new_adapters
,
int
*
count
)
static
BOOL
xrandr14_get_adapters
(
ULONG_PTR
gpu_id
,
struct
x11drv
_adapter
**
new_adapters
,
int
*
count
)
{
struct
gdi
_adapter
*
adapters
=
NULL
;
struct
x11drv
_adapter
*
adapters
=
NULL
;
XRRScreenResources
*
screen_resources
=
NULL
;
XRRProviderInfo
*
provider_info
=
NULL
;
XRRCrtcInfo
*
enum_crtc_info
,
*
crtc_info
=
NULL
;
...
...
@@ -999,7 +999,7 @@ static BOOL xrandr14_get_adapters( ULONG_PTR gpu_id, struct gdi_adapter **new_ad
/* Make primary adapter the first */
if
(
primary_adapter
)
{
struct
gdi
_adapter
tmp
=
adapters
[
0
];
struct
x11drv
_adapter
tmp
=
adapters
[
0
];
adapters
[
0
]
=
adapters
[
primary_adapter
];
adapters
[
primary_adapter
]
=
tmp
;
}
...
...
@@ -1024,7 +1024,7 @@ done:
return
ret
;
}
static
void
xrandr14_free_adapters
(
struct
gdi
_adapter
*
adapters
)
static
void
xrandr14_free_adapters
(
struct
x11drv
_adapter
*
adapters
)
{
free
(
adapters
);
}
...
...
@@ -1219,7 +1219,7 @@ static BOOL xrandr14_get_id( const WCHAR *device_name, BOOL is_primary, x11drv_s
struct
current_mode
*
tmp_modes
,
*
new_current_modes
=
NULL
;
INT
gpu_count
,
adapter_count
,
new_current_mode_count
=
0
;
INT
gpu_idx
,
adapter_idx
,
display_idx
;
struct
gdi
_adapter
*
adapters
;
struct
x11drv
_adapter
*
adapters
;
struct
gdi_gpu
*
gpus
;
WCHAR
*
end
;
...
...
include/wine/gdi_driver.h
View file @
fecfb442
...
...
@@ -249,12 +249,6 @@ struct gdi_gpu
ULONGLONG
memory_size
;
};
struct
gdi_adapter
{
ULONG_PTR
id
;
DWORD
state_flags
;
};
struct
gdi_monitor
{
RECT
rc_monitor
;
/* RcMonitor in MONITORINFO struct */
...
...
@@ -266,7 +260,7 @@ struct gdi_monitor
struct
gdi_device_manager
{
void
(
*
add_gpu
)(
const
struct
gdi_gpu
*
gpu
,
void
*
param
);
void
(
*
add_adapter
)(
const
struct
gdi_adapter
*
adapter
,
void
*
param
);
void
(
*
add_adapter
)(
const
char
*
name
,
UINT
state_flags
,
void
*
param
);
void
(
*
add_monitor
)(
const
struct
gdi_monitor
*
monitor
,
void
*
param
);
void
(
*
add_mode
)(
const
DEVMODEW
*
mode
,
BOOL
current
,
void
*
param
);
};
...
...
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