drm_output_find_special_plane(b, output,
WDRM_PLANE_TYPE_CURSOR);
+ wl_array_remove_uint32(&b->unused_crtcs, output->crtc_id);
+
return 0;
err_crtc:
drm_output_fini_crtc(struct drm_output *output)
{
struct drm_backend *b = to_drm_backend(output->base.compositor);
+ uint32_t *unused;
if (!b->universal_planes && !b->shutting_down) {
/* With universal planes, the 'special' planes are allocated at
}
drm_property_info_free(output->props_crtc, WDRM_CRTC__COUNT);
+
+ assert(output->crtc_id != 0);
+
+ unused = wl_array_add(&b->unused_crtcs, sizeof(*unused));
+ *unused = output->crtc_id;
+
+ /* Force resetting unused CRTCs */
+ b->state_invalid = true;
+
output->crtc_id = 0;
output->cursor_plane = NULL;
output->scanout_plane = NULL;
struct drm_backend *b = to_drm_backend(base->compositor);
struct drm_head *head = to_drm_head(weston_output_get_first_head(base));
struct weston_mode *m;
+ drmModeRes *resources;
+ int ret;
+
+ resources = drmModeGetResources(b->drm.fd);
+ if (!resources) {
+ weston_log("drmModeGetResources failed\n");
+ return -1;
+ }
+ ret = drm_output_init_crtc(output, resources, head->connector);
+ drmModeFreeResources(resources);
+ if (ret < 0)
+ return -1;
+
+ if (drm_output_init_gamma_size(output) < 0)
+ goto err;
if (b->pageflip_timeout)
drm_output_pageflip_timer_create(output);
&b->compositor->primary_plane);
wl_array_remove_uint32(&b->unused_connectors, head->connector_id);
- wl_array_remove_uint32(&b->unused_crtcs, output->crtc_id);
weston_log("Output %s, (connector %d, crtc %d)\n",
output->base.name, head->connector_id, output->crtc_id);
return 0;
err:
+ drm_output_fini_crtc(output);
+
return -1;
}
unused = wl_array_add(&b->unused_connectors, sizeof(*unused));
*unused = head->connector_id;
- unused = wl_array_add(&b->unused_crtcs, sizeof(*unused));
- *unused = output->crtc_id;
- /* Force programming unused connectors and crtcs. */
- b->state_invalid = true;
+ drm_output_fini_crtc(output);
}
static void
weston_output_release(&output->base);
- drm_output_fini_crtc(output);
-
assert(!output->state_last);
drm_output_state_free(output->state_cur);
output->destroy_pending = 0;
output->disable_pending = 0;
- if (drm_output_init_crtc(output, resources, connector) < 0)
- goto err_output;
-
- if (drm_output_init_gamma_size(output) < 0)
- goto err_output;
-
output->state_cur = drm_output_state_alloc(output, NULL);
for (i = 0; i < head->connector->count_modes; i++) {