From: Damian Hobson-Garcia Date: Wed, 21 Sep 2022 22:35:45 +0000 (-0400) Subject: lease-manager: Check that DRM device is viable for modesetting X-Git-Tag: 17.90.0~1 X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?p=src%2Fdrm-lease-manager.git;a=commitdiff_plain;h=a8cf122960eb44be1cffb654934d1aef5cf4ad69 lease-manager: Check that DRM device is viable for modesetting 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 Change-Id: Ia8cf27127e4d61c13c6d8dfc633282776da74060 --- diff --git a/drm-lease-manager/lease-manager.c b/drm-lease-manager/lease-manager.c index 885ca29..51a4613 100644 --- a/drm-lease-manager/lease-manager.c +++ b/drm-lease-manager/lease-manager.c @@ -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",