Skip to content

Commit

Permalink
kmsdrm: rearrange init function so we try ATOMIC compatibility first.
Browse files Browse the repository at this point in the history
  • Loading branch information
vanfanel committed Oct 22, 2020
1 parent b1ea0be commit a326220
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions src/video/kmsdrm/SDL_kmsdrmvideo.c
Expand Up @@ -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.");
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit a326220

Please sign in to comment.