kmsdrm: Check for resources when validating KMSDRM device in check_modesetting.
authorSergey Zhuravlevich <zhurxx@gmail.com>
Sat, 01 Dec 2018 16:31:56 -0500
changeset 124412e2cff8a14b6
parent 12440 2b450a35f471
child 12442 695bf801d4ba
kmsdrm: Check for resources when validating KMSDRM device in check_modesetting.

Fixes Bugzilla #4403.
src/video/kmsdrm/SDL_kmsdrmvideo.c
     1.1 --- a/src/video/kmsdrm/SDL_kmsdrmvideo.c	Sat Dec 01 13:09:00 2018 -0500
     1.2 +++ b/src/video/kmsdrm/SDL_kmsdrmvideo.c	Sat Dec 01 16:31:56 2018 -0500
     1.3 @@ -61,7 +61,13 @@
     1.4          if (SDL_KMSDRM_LoadSymbols()) {
     1.5              drmModeRes *resources = KMSDRM_drmModeGetResources(drm_fd);
     1.6              if (resources != NULL) {
     1.7 -                available = SDL_TRUE;
     1.8 +                SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "%scard%d connector, encoder and CRTC counts are: %d %d %d",
     1.9 +                             KMSDRM_DRI_PATH, devindex,
    1.10 +                             resources->count_connectors, resources->count_encoders, resources->count_crtcs);
    1.11 +
    1.12 +                if (resources->count_connectors > 0 && resources->count_encoders > 0 && resources->count_crtcs > 0) {
    1.13 +                    available = SDL_TRUE;
    1.14 +                }
    1.15                  KMSDRM_drmModeFreeResources(resources);
    1.16              }
    1.17              SDL_KMSDRM_UnloadSymbols();
    1.18 @@ -358,6 +364,7 @@
    1.19          ret = SDL_OutOfMemory();
    1.20          goto cleanup;
    1.21      }
    1.22 +    SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "Opening device /dev/dri/card%d", vdata->devindex);
    1.23      SDL_snprintf(devname, 16, "/dev/dri/card%d", vdata->devindex);
    1.24      vdata->drm_fd = open(devname, O_RDWR | O_CLOEXEC);
    1.25      SDL_free(devname);