mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-06-13 14:32:57 -04:00
drm_lease_v1: avoid waking GPU when creating lease device
This is a slight downgrade to the check since it's technically possible for the FD returned by open to be a DRM master and policy preventing the downgrade. With this patch, it's only noticed afterwards. In typical modern environments, all FDs should be non-master right away. Signed-off-by: Leon M. Busch-George <leon@georgemail.eu>
This commit is contained in:
parent
a94cd29eb1
commit
75f0571eb3
1 changed files with 7 additions and 6 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <fcntl.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
@ -586,15 +587,15 @@ static void drm_lease_device_v1_create(struct wlr_drm_lease_v1_manager *manager,
|
||||||
struct wlr_backend *backend) {
|
struct wlr_backend *backend) {
|
||||||
struct wlr_drm_backend *drm_backend = get_drm_backend_from_backend(backend);
|
struct wlr_drm_backend *drm_backend = get_drm_backend_from_backend(backend);
|
||||||
|
|
||||||
// Make sure we can get a non-master FD for the DRM backend. On some setups
|
// Make sure we can access the device without opening it to avoid
|
||||||
// we don't have the permission for this.
|
// potentially waking the GPU from suspend.
|
||||||
int fd = wlr_drm_backend_get_non_master_fd(backend);
|
// A non-master FD is required later which is what open should already
|
||||||
if (fd < 0) {
|
// yield on modern systems.
|
||||||
wlr_log(WLR_INFO, "Skipping %s: failed to get read-only DRM FD",
|
if (faccessat(AT_FDCWD, drm_backend->name, R_OK|W_OK, 0) < 0) {
|
||||||
|
wlr_log(WLR_INFO, "Skipping %s: cannot access DRM device",
|
||||||
drm_backend->name);
|
drm_backend->name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
close(fd);
|
|
||||||
|
|
||||||
wlr_log(WLR_DEBUG, "Creating wlr_drm_lease_device_v1 for %s",
|
wlr_log(WLR_DEBUG, "Creating wlr_drm_lease_device_v1 for %s",
|
||||||
drm_backend->name);
|
drm_backend->name);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue