kmsdrm: rearrange init function so we try ATOMIC compatibility first.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
diff --git a/src/video/kmsdrm/SDL_kmsdrmvideo.c b/src/video/kmsdrm/SDL_kmsdrmvideo.c
index 6b447e1..b9f7792 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