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
2d3309d8
Commit
2d3309d8
authored
Apr 14, 2021
by
Jacek Caban
Committed by
Alexandre Julliard
Apr 14, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winevulkan: Move fill_luid_property and its callers to loader.c.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
1cc6b492
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
109 additions
and
95 deletions
+109
-95
loader.c
dlls/winevulkan/loader.c
+109
-0
vulkan.c
dlls/winevulkan/vulkan.c
+0
-95
No files found.
dlls/winevulkan/loader.c
View file @
2d3309d8
...
...
@@ -23,6 +23,9 @@
#include "winbase.h"
#include "winreg.h"
#include "winuser.h"
#include "initguid.h"
#include "devguid.h"
#include "setupapi.h"
#include "vulkan_private.h"
...
...
@@ -33,10 +36,27 @@ WINE_DEFAULT_DEBUG_CHANNEL(vulkan);
*/
#define WINE_VULKAN_ICD_VERSION 4
DEFINE_DEVPROPKEY
(
DEVPROPKEY_GPU_LUID
,
0x60b193cb
,
0x5276
,
0x4d0f
,
0x96
,
0xfc
,
0xf1
,
0x73
,
0xab
,
0xad
,
0x3e
,
0xc6
,
2
);
DEFINE_DEVPROPKEY
(
WINE_DEVPROPKEY_GPU_VULKAN_UUID
,
0x233a9ef3
,
0xafc4
,
0x4abd
,
0xb5
,
0x64
,
0xc3
,
0x2f
,
0x21
,
0xf1
,
0x53
,
0x5c
,
2
);
static
HINSTANCE
hinstance
;
static
void
*
wine_vk_get_global_proc_addr
(
const
char
*
name
);
#define wine_vk_find_struct(s, t) wine_vk_find_struct_((void *)s, VK_STRUCTURE_TYPE_##t)
static
void
*
wine_vk_find_struct_
(
void
*
s
,
VkStructureType
t
)
{
VkBaseOutStructure
*
header
;
for
(
header
=
s
;
header
;
header
=
header
->
pNext
)
{
if
(
header
->
sType
==
t
)
return
header
;
}
return
NULL
;
}
VkResult
WINAPI
wine_vkEnumerateInstanceLayerProperties
(
uint32_t
*
count
,
VkLayerProperties
*
properties
)
{
TRACE
(
"%p, %p
\n
"
,
count
,
properties
);
...
...
@@ -186,6 +206,95 @@ VkResult WINAPI wine_vk_icdNegotiateLoaderICDInterfaceVersion(uint32_t *supporte
return
VK_SUCCESS
;
}
static
HANDLE
get_display_device_init_mutex
(
void
)
{
static
const
WCHAR
init_mutexW
[]
=
{
'd'
,
'i'
,
's'
,
'p'
,
'l'
,
'a'
,
'y'
,
'_'
,
'd'
,
'e'
,
'v'
,
'i'
,
'c'
,
'e'
,
'_'
,
'i'
,
'n'
,
'i'
,
't'
,
0
};
HANDLE
mutex
=
CreateMutexW
(
NULL
,
FALSE
,
init_mutexW
);
WaitForSingleObject
(
mutex
,
INFINITE
);
return
mutex
;
}
static
void
release_display_device_init_mutex
(
HANDLE
mutex
)
{
ReleaseMutex
(
mutex
);
CloseHandle
(
mutex
);
}
/* Wait until graphics driver is loaded by explorer */
static
void
wait_graphics_driver_ready
(
void
)
{
static
BOOL
ready
=
FALSE
;
if
(
!
ready
)
{
SendMessageW
(
GetDesktopWindow
(),
WM_NULL
,
0
,
0
);
ready
=
TRUE
;
}
}
static
void
fill_luid_property
(
VkPhysicalDeviceProperties2
*
properties2
)
{
static
const
WCHAR
pci
[]
=
{
'P'
,
'C'
,
'I'
,
0
};
VkPhysicalDeviceIDProperties
*
id
;
SP_DEVINFO_DATA
device_data
;
DWORD
type
,
device_idx
=
0
;
HDEVINFO
devinfo
;
HANDLE
mutex
;
GUID
uuid
;
LUID
luid
;
if
(
!
(
id
=
wine_vk_find_struct
(
properties2
,
PHYSICAL_DEVICE_ID_PROPERTIES
)))
return
;
wait_graphics_driver_ready
();
mutex
=
get_display_device_init_mutex
();
devinfo
=
SetupDiGetClassDevsW
(
&
GUID_DEVCLASS_DISPLAY
,
pci
,
NULL
,
0
);
device_data
.
cbSize
=
sizeof
(
device_data
);
while
(
SetupDiEnumDeviceInfo
(
devinfo
,
device_idx
++
,
&
device_data
))
{
if
(
!
SetupDiGetDevicePropertyW
(
devinfo
,
&
device_data
,
&
WINE_DEVPROPKEY_GPU_VULKAN_UUID
,
&
type
,
(
BYTE
*
)
&
uuid
,
sizeof
(
uuid
),
NULL
,
0
))
continue
;
if
(
!
IsEqualGUID
(
&
uuid
,
id
->
deviceUUID
))
continue
;
if
(
SetupDiGetDevicePropertyW
(
devinfo
,
&
device_data
,
&
DEVPROPKEY_GPU_LUID
,
&
type
,
(
BYTE
*
)
&
luid
,
sizeof
(
luid
),
NULL
,
0
))
{
memcpy
(
&
id
->
deviceLUID
,
&
luid
,
sizeof
(
id
->
deviceLUID
));
id
->
deviceLUIDValid
=
VK_TRUE
;
id
->
deviceNodeMask
=
1
;
break
;
}
}
SetupDiDestroyDeviceInfoList
(
devinfo
);
release_display_device_init_mutex
(
mutex
);
TRACE
(
"deviceName:%s deviceLUIDValid:%d LUID:%08x:%08x deviceNodeMask:%#x.
\n
"
,
properties2
->
properties
.
deviceName
,
id
->
deviceLUIDValid
,
luid
.
HighPart
,
luid
.
LowPart
,
id
->
deviceNodeMask
);
}
void
WINAPI
wine_vkGetPhysicalDeviceProperties2
(
VkPhysicalDevice
phys_dev
,
VkPhysicalDeviceProperties2
*
properties2
)
{
TRACE
(
"%p, %p
\n
"
,
phys_dev
,
properties2
);
thunk_vkGetPhysicalDeviceProperties2
(
phys_dev
,
properties2
);
fill_luid_property
(
properties2
);
}
void
WINAPI
wine_vkGetPhysicalDeviceProperties2KHR
(
VkPhysicalDevice
phys_dev
,
VkPhysicalDeviceProperties2
*
properties2
)
{
TRACE
(
"%p, %p
\n
"
,
phys_dev
,
properties2
);
thunk_vkGetPhysicalDeviceProperties2KHR
(
phys_dev
,
properties2
);
fill_luid_property
(
properties2
);
}
BOOL
WINAPI
DllMain
(
HINSTANCE
hinst
,
DWORD
reason
,
void
*
reserved
)
{
TRACE
(
"%p, %u, %p
\n
"
,
hinst
,
reason
,
reserved
);
...
...
dlls/winevulkan/vulkan.c
View file @
2d3309d8
...
...
@@ -26,17 +26,11 @@
#include "winbase.h"
#include "winreg.h"
#include "winuser.h"
#include "initguid.h"
#include "devguid.h"
#include "setupapi.h"
#include "vulkan_private.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
vulkan
);
DEFINE_DEVPROPKEY
(
DEVPROPKEY_GPU_LUID
,
0x60b193cb
,
0x5276
,
0x4d0f
,
0x96
,
0xfc
,
0xf1
,
0x73
,
0xab
,
0xad
,
0x3e
,
0xc6
,
2
);
DEFINE_DEVPROPKEY
(
WINE_DEVPROPKEY_GPU_VULKAN_UUID
,
0x233a9ef3
,
0xafc4
,
0x4abd
,
0xb5
,
0x64
,
0xc3
,
0x2f
,
0x21
,
0xf1
,
0x53
,
0x5c
,
2
);
#define wine_vk_find_struct(s, t) wine_vk_find_struct_((void *)s, VK_STRUCTURE_TYPE_##t)
static
void
*
wine_vk_find_struct_
(
void
*
s
,
VkStructureType
t
)
{
...
...
@@ -1525,95 +1519,6 @@ VkResult WINAPI wine_vkGetPhysicalDeviceCalibrateableTimeDomainsEXT(VkPhysicalDe
return
res
;
}
static
HANDLE
get_display_device_init_mutex
(
void
)
{
static
const
WCHAR
init_mutexW
[]
=
{
'd'
,
'i'
,
's'
,
'p'
,
'l'
,
'a'
,
'y'
,
'_'
,
'd'
,
'e'
,
'v'
,
'i'
,
'c'
,
'e'
,
'_'
,
'i'
,
'n'
,
'i'
,
't'
,
0
};
HANDLE
mutex
=
CreateMutexW
(
NULL
,
FALSE
,
init_mutexW
);
WaitForSingleObject
(
mutex
,
INFINITE
);
return
mutex
;
}
static
void
release_display_device_init_mutex
(
HANDLE
mutex
)
{
ReleaseMutex
(
mutex
);
CloseHandle
(
mutex
);
}
/* Wait until graphics driver is loaded by explorer */
static
void
wait_graphics_driver_ready
(
void
)
{
static
BOOL
ready
=
FALSE
;
if
(
!
ready
)
{
SendMessageW
(
GetDesktopWindow
(),
WM_NULL
,
0
,
0
);
ready
=
TRUE
;
}
}
static
void
fill_luid_property
(
VkPhysicalDeviceProperties2
*
properties2
)
{
static
const
WCHAR
pci
[]
=
{
'P'
,
'C'
,
'I'
,
0
};
VkPhysicalDeviceIDProperties
*
id
;
SP_DEVINFO_DATA
device_data
;
DWORD
type
,
device_idx
=
0
;
HDEVINFO
devinfo
;
HANDLE
mutex
;
GUID
uuid
;
LUID
luid
;
if
(
!
(
id
=
wine_vk_find_struct
(
properties2
,
PHYSICAL_DEVICE_ID_PROPERTIES
)))
return
;
wait_graphics_driver_ready
();
mutex
=
get_display_device_init_mutex
();
devinfo
=
SetupDiGetClassDevsW
(
&
GUID_DEVCLASS_DISPLAY
,
pci
,
NULL
,
0
);
device_data
.
cbSize
=
sizeof
(
device_data
);
while
(
SetupDiEnumDeviceInfo
(
devinfo
,
device_idx
++
,
&
device_data
))
{
if
(
!
SetupDiGetDevicePropertyW
(
devinfo
,
&
device_data
,
&
WINE_DEVPROPKEY_GPU_VULKAN_UUID
,
&
type
,
(
BYTE
*
)
&
uuid
,
sizeof
(
uuid
),
NULL
,
0
))
continue
;
if
(
!
IsEqualGUID
(
&
uuid
,
id
->
deviceUUID
))
continue
;
if
(
SetupDiGetDevicePropertyW
(
devinfo
,
&
device_data
,
&
DEVPROPKEY_GPU_LUID
,
&
type
,
(
BYTE
*
)
&
luid
,
sizeof
(
luid
),
NULL
,
0
))
{
memcpy
(
&
id
->
deviceLUID
,
&
luid
,
sizeof
(
id
->
deviceLUID
));
id
->
deviceLUIDValid
=
VK_TRUE
;
id
->
deviceNodeMask
=
1
;
break
;
}
}
SetupDiDestroyDeviceInfoList
(
devinfo
);
release_display_device_init_mutex
(
mutex
);
TRACE
(
"deviceName:%s deviceLUIDValid:%d LUID:%08x:%08x deviceNodeMask:%#x.
\n
"
,
properties2
->
properties
.
deviceName
,
id
->
deviceLUIDValid
,
luid
.
HighPart
,
luid
.
LowPart
,
id
->
deviceNodeMask
);
}
void
WINAPI
wine_vkGetPhysicalDeviceProperties2
(
VkPhysicalDevice
phys_dev
,
VkPhysicalDeviceProperties2
*
properties2
)
{
TRACE
(
"%p, %p
\n
"
,
phys_dev
,
properties2
);
thunk_vkGetPhysicalDeviceProperties2
(
phys_dev
,
properties2
);
fill_luid_property
(
properties2
);
}
void
WINAPI
wine_vkGetPhysicalDeviceProperties2KHR
(
VkPhysicalDevice
phys_dev
,
VkPhysicalDeviceProperties2
*
properties2
)
{
TRACE
(
"%p, %p
\n
"
,
phys_dev
,
properties2
);
thunk_vkGetPhysicalDeviceProperties2KHR
(
phys_dev
,
properties2
);
fill_luid_property
(
properties2
);
}
void
WINAPI
wine_vkGetPhysicalDeviceExternalSemaphoreProperties
(
VkPhysicalDevice
phys_dev
,
const
VkPhysicalDeviceExternalSemaphoreInfo
*
semaphore_info
,
VkExternalSemaphoreProperties
*
properties
)
{
...
...
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