lease-manager: Check that DRM device is viable for modesetting 33/28033/1
authorDamian Hobson-Garcia <dhobsong@igel.co.jp>
Wed, 21 Sep 2022 22:35:45 +0000 (18:35 -0400)
committerDamian Hobson-Garcia <dhobsong@igel.co.jp>
Mon, 26 Sep 2022 20:35:22 +0000 (05:35 +0900)
Don't try to create leases from any DRM device that doesn't have
at least one connector, CRTC, and encoder.  This allows any such
devices to be skipped when looking for a viable device when one
is not provided on the command line.

Bug-AGL: SPEC-4573

Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
Change-Id: Ia8cf27127e4d61c13c6d8dfc633282776da74060

drm-lease-manager/lease-manager.c

index 885ca29..51a4613 100644 (file)
@@ -532,6 +532,13 @@ static struct lm *drm_device_get_resources(const char *device)
                goto err;
        }
 
+       if (lm->drm_resource->count_connectors <= 0 ||
+               lm->drm_resource->count_crtcs <= 0 ||
+               lm->drm_resource->count_encoders <= 0) {
+               DEBUG_LOG("Insufficient DRM resources on device(%s)\n", device);
+               goto err;
+       }
+
        lm->drm_plane_resource = drmModeGetPlaneResources(lm->drm_fd);
        if (!lm->drm_plane_resource) {
                DEBUG_LOG("drmModeGetPlaneResources failed: %s\n",