From a3262205b545470699d6186b1670d025705fede3 Mon Sep 17 00:00:00 2001 From: Manuel Alfayate Corchete Date: Thu, 22 Oct 2020 17:55:45 +0200 Subject: [PATCH] kmsdrm: rearrange init function so we try ATOMIC compatibility first. --- src/video/kmsdrm/SDL_kmsdrmvideo.c | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/src/video/kmsdrm/SDL_kmsdrmvideo.c b/src/video/kmsdrm/SDL_kmsdrmvideo.c index 6b447e191..b9f779241 100644 --- a/src/video/kmsdrm/SDL_kmsdrmvideo.c +++ b/src/video/kmsdrm/SDL_kmsdrmvideo.c @@ -1179,6 +1179,22 @@ KMSDRM_VideoInit(_THIS) SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "Opened DRM FD (%d)", viddata->drm_fd); + /* Try ATOMIC compatibility */ + + ret = KMSDRM_drmSetClientCap(viddata->drm_fd, DRM_CLIENT_CAP_ATOMIC, 1); + if (ret) { + ret = SDL_SetError("no atomic modesetting support."); + goto cleanup; + } + + ret = KMSDRM_drmSetClientCap(viddata->drm_fd, DRM_CLIENT_CAP_UNIVERSAL_PLANES, 1); + if (ret) { + ret = SDL_SetError("no universal planes support."); + goto cleanup; + } + + /* Create the GBM device */ + viddata->gbm_dev = KMSDRM_gbm_create_device(viddata->drm_fd); if (!viddata->gbm_dev) { ret = SDL_SetError("Couldn't create gbm device."); @@ -1312,21 +1328,7 @@ KMSDRM_VideoInit(_THIS) display.driverdata = dispdata; SDL_AddVideoDisplay(&display, SDL_FALSE); - /****************/ - /* Atomic block */ - /****************/ - ret = KMSDRM_drmSetClientCap(viddata->drm_fd, DRM_CLIENT_CAP_ATOMIC, 1); - if (ret) { - ret = SDL_SetError("no atomic modesetting support."); - goto cleanup; - } - - ret = KMSDRM_drmSetClientCap(viddata->drm_fd, DRM_CLIENT_CAP_UNIVERSAL_PLANES, 1); - if (ret) { - ret = SDL_SetError("no universal planes support."); - goto cleanup; - } /* Use this if you ever need to see info on all available planes. */ #if 0