mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 02:48:06 +02:00
winsys/amdgpu: Use render node only as fallback
If ac_drm_device_initialize returns -EACCES for the fd passed in.
A render node file description can't have DRM master status, which means
AMDGPU_CTX_PRIORITY_HIGH can't work without CAP_SYS_NICE (which
generally only the root user has).
Fixes: 8f30e90fc1 ("winsys/amdgpu: Prefer render node FD for ac_drm_device_initialize")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40974>
This commit is contained in:
parent
69708ff3f5
commit
5cc3264b53
1 changed files with 6 additions and 8 deletions
|
|
@ -394,7 +394,7 @@ amdgpu_winsys_create(int fd, const struct pipe_screen_config *config,
|
|||
{
|
||||
struct amdgpu_screen_winsys *sws;
|
||||
struct amdgpu_winsys *aws;
|
||||
ac_drm_device *dev = NULL;
|
||||
ac_drm_device *dev;
|
||||
uint32_t drm_major, drm_minor;
|
||||
int r;
|
||||
|
||||
|
|
@ -412,7 +412,8 @@ amdgpu_winsys_create(int fd, const struct pipe_screen_config *config,
|
|||
|
||||
/* Initialize the amdgpu device. This should always return the same pointer
|
||||
* for the same fd. */
|
||||
if (drmGetNodeTypeFromFd(fd) != DRM_NODE_RENDER) {
|
||||
r = ac_drm_device_initialize(fd, is_virtio, &drm_major, &drm_minor, &dev);
|
||||
if (r == -EACCES && drmGetNodeTypeFromFd(fd) != DRM_NODE_RENDER) {
|
||||
char *render_device = drmGetRenderDeviceNameFromFd(fd);
|
||||
|
||||
if (render_device) {
|
||||
|
|
@ -431,12 +432,9 @@ amdgpu_winsys_create(int fd, const struct pipe_screen_config *config,
|
|||
}
|
||||
}
|
||||
|
||||
if (!dev) {
|
||||
r = ac_drm_device_initialize(fd, is_virtio, &drm_major, &drm_minor, &dev);
|
||||
if (r) {
|
||||
mesa_loge("amdgpu: amd%s_device_initialize failed.\n", is_virtio ? "vgpu" : "gpu");
|
||||
goto fail;
|
||||
}
|
||||
if (r) {
|
||||
mesa_loge("amdgpu: amd%s_device_initialize failed.\n", is_virtio ? "vgpu" : "gpu");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/* Lookup a winsys if we have already created one for this device. */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue