Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Yusuf Khan
mesa
Commits
17479b77
Commit
17479b77
authored
Oct 01, 2022
by
Yusuf Khan
Browse files
nvk: bring the duplicate fd creation out of the winsys
Signed-off-by:
Yusuf Khan
<
yusisamerican@gmail.com
>
parent
165e9883
Pipeline
#702754
waiting for manual action with stages
in 7 seconds
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
src/nouveau/vulkan/nvk_physical_device.c
View file @
17479b77
...
...
@@ -8,6 +8,8 @@
#include
"nvk_shader.h"
#include
"nvk_wsi.h"
#include
"util/os_file.h"
#include
"vulkan/runtime/vk_device.h"
#include
"vulkan/wsi/wsi_common.h"
...
...
@@ -306,9 +308,10 @@ nvk_physical_device_try_create(struct nvk_instance *instance,
instance
,
VK_ERROR_INCOMPATIBLE_DRIVER
,
"Unable to open device %s: %m"
,
path
);
}
struct
nouveau_ws_device
*
ndev
=
nouveau_ws_device_new
(
fd
);
int
dup_fd
=
os_dupfd_cloexec
(
fd
);
struct
nouveau_ws_device
*
ndev
=
nouveau_ws_device_new
(
dup_fd
);
if
(
!
ndev
)
ndev
=
ogk_ws_device_new
(
fd
);
ndev
=
ogk_ws_device_new
(
dup_
fd
);
if
(
!
ndev
)
{
result
=
vk_error
(
instance
,
VK_ERROR_INCOMPATIBLE_DRIVER
);
...
...
@@ -404,6 +407,7 @@ fail_dev_alloc:
fail_fd:
close
(
fd
);
close
(
dup_fd
);
return
result
;
}
...
...
src/nouveau/winsys/nouveau_device.c
View file @
17479b77
...
...
@@ -184,10 +184,9 @@ nouveau_ws_device_new(int fd)
{
struct
nouveau_ws_device
*
device
=
CALLOC_STRUCT
(
nouveau_ws_device
);
uint64_t
value
=
0
;
int
dup_fd
=
os_dupfd_cloexec
(
fd
);
drmVersionPtr
ver
;
ver
=
drmGetVersion
(
dup_
fd
);
ver
=
drmGetVersion
(
fd
);
if
(
!
ver
)
return
NULL
;
...
...
@@ -200,22 +199,22 @@ nouveau_ws_device_new(int fd)
if
(
version
<
0x01000301
)
goto
out_drm
;
if
(
nouveau_ws_device_alloc
(
dup_
fd
,
device
))
if
(
nouveau_ws_device_alloc
(
fd
,
device
))
goto
out_drm
;
if
(
nouveau_ws_device_info
(
dup_
fd
,
device
))
if
(
nouveau_ws_device_info
(
fd
,
device
))
goto
out_drm
;
if
(
nouveau_ws_param
(
dup_
fd
,
NOUVEAU_GETPARAM_PCI_DEVICE
,
&
value
))
if
(
nouveau_ws_param
(
fd
,
NOUVEAU_GETPARAM_PCI_DEVICE
,
&
value
))
goto
out_dev
;
device
->
device_id
=
value
;
if
(
nouveau_ws_param
(
dup_
fd
,
NOUVEAU_GETPARAM_AGP_SIZE
,
&
value
))
if
(
nouveau_ws_param
(
fd
,
NOUVEAU_GETPARAM_AGP_SIZE
,
&
value
))
goto
out_dev
;
os_get_available_system_memory
(
&
device
->
gart_size
);
device
->
gart_size
=
MIN2
(
device
->
gart_size
,
value
);
device
->
fd
=
dup_
fd
;
device
->
fd
=
fd
;
device
->
vendor_id
=
0x10de
;
device
->
winsys
=
NVK_WINSYS_NOUVEAU
;
device
->
cm
=
sm_for_chipset
(
device
->
chipset
);
...
...
@@ -226,7 +225,7 @@ nouveau_ws_device_new(int fd)
else
device
->
local_mem_domain
=
NOUVEAU_WS_GEM_DOMAIN_VRAM
;
if
(
nouveau_ws_param
(
dup_
fd
,
NOUVEAU_GETPARAM_GRAPH_UNITS
,
&
value
))
if
(
nouveau_ws_param
(
fd
,
NOUVEAU_GETPARAM_GRAPH_UNITS
,
&
value
))
goto
out_dev
;
device
->
gpc_count
=
value
&
0x000000ff
;
device
->
mp_count
=
value
>>
8
;
...
...
@@ -250,7 +249,6 @@ nouveau_ws_device_new(int fd)
out_dev:
FREE
(
device
);
out_drm:
close
(
dup_fd
);
return
NULL
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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