backend/drm: properly handle GPUs without CRTCs

This commit is contained in:
emersion 2018-10-07 12:59:00 +02:00
parent eb44d18cdd
commit 776008da69
1 changed files with 5 additions and 0 deletions

View File

@ -156,6 +156,11 @@ bool init_drm_resources(struct wlr_drm_backend *drm) {
wlr_log(WLR_INFO, "Found %d DRM CRTCs", res->count_crtcs);
drm->num_crtcs = res->count_crtcs;
if (drm->num_crtcs == 0) {
drmModeFreeResources(res);
return true;
}
drm->crtcs = calloc(drm->num_crtcs, sizeof(drm->crtcs[0]));
if (!drm->crtcs) {
wlr_log_errno(WLR_ERROR, "Allocation failed");