drm: drop master if unnecessary

This commit is contained in:
JerryXiao 2023-08-12 00:01:31 +08:00
parent 6340351c3b
commit 035ae36dad
Signed by: Jerry
GPG key ID: 22618F758B5BE2E5

3
drm.c
View file

@ -474,6 +474,9 @@ int drm_open() {
{
KMSVNC_FATAL("card %s open failed: %s\n", kmsvnc->card, strerror(errno));
}
if (!kmsvnc->screen_blank && drmIsMaster(drm->drm_fd)) {
if (drmDropMaster(drm->drm_fd)) fprintf(stderr, "Failed to drop master");
}
if (kmsvnc->screen_blank && !drmIsMaster(drm->drm_fd)) {
drm->drm_master_fd = drm_get_master_fd();
drm->drm_master_fd = drm->drm_master_fd > 0 ? drm->drm_master_fd : 0;