compositor-drm: Don't restore original CRTC mode

When leaving Weston, don't attempt to restore the previous CRTC
settings. The framebuffer may well have disappeared, and in every
likelihood, whoever gets the KMS device afterwards will be repainting
anyway.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
dev
Daniel Stone 8 years ago
parent 62c0d63a82
commit c1d0f477bd
  1. 28
      libweston/compositor-drm.c

@ -345,7 +345,6 @@ struct drm_output {
uint32_t crtc_id; /* object ID to pass to DRM functions */ uint32_t crtc_id; /* object ID to pass to DRM functions */
int pipe; /* index of CRTC in resource array / bitmasks */ int pipe; /* index of CRTC in resource array / bitmasks */
uint32_t connector_id; uint32_t connector_id;
drmModeCrtcPtr original_crtc;
struct drm_edid edid; struct drm_edid edid;
/* Holds the properties for the connector */ /* Holds the properties for the connector */
@ -1698,8 +1697,6 @@ drm_output_set_gamma(struct weston_output *output_base,
/* check */ /* check */
if (output_base->gamma_size != size) if (output_base->gamma_size != size)
return; return;
if (!output->original_crtc)
return;
rc = drmModeCrtcSetGamma(backend->drm.fd, rc = drmModeCrtcSetGamma(backend->drm.fd,
output->crtc_id, output->crtc_id,
@ -4193,8 +4190,6 @@ drm_output_enable(struct weston_output *base)
output->base.assign_planes = drm_assign_planes; output->base.assign_planes = drm_assign_planes;
output->base.set_dpms = drm_set_dpms; output->base.set_dpms = drm_set_dpms;
output->base.switch_mode = drm_output_switch_mode; output->base.switch_mode = drm_output_switch_mode;
output->base.gamma_size = output->original_crtc->gamma_size;
output->base.set_gamma = drm_output_set_gamma; output->base.set_gamma = drm_output_set_gamma;
if (output->cursor_plane) if (output->cursor_plane)
@ -4266,7 +4261,6 @@ drm_output_destroy(struct weston_output *base)
struct drm_output *output = to_drm_output(base); struct drm_output *output = to_drm_output(base);
struct drm_backend *b = to_drm_backend(base->compositor); struct drm_backend *b = to_drm_backend(base->compositor);
struct drm_mode *drm_mode, *next; struct drm_mode *drm_mode, *next;
drmModeCrtcPtr origcrtc = output->original_crtc;
if (output->page_flip_pending || output->vblank_pending) { if (output->page_flip_pending || output->vblank_pending) {
output->destroy_pending = 1; output->destroy_pending = 1;
@ -4302,14 +4296,6 @@ drm_output_destroy(struct weston_output *base)
free(drm_mode); free(drm_mode);
} }
if (origcrtc) {
/* Restore original CRTC state */
drmModeSetCrtc(b->drm.fd, origcrtc->crtc_id, origcrtc->buffer_id,
origcrtc->x, origcrtc->y,
&output->connector_id, 1, &origcrtc->mode);
drmModeFreeCrtc(origcrtc);
}
if (output->pageflip_timer) if (output->pageflip_timer)
wl_event_source_remove(output->pageflip_timer); wl_event_source_remove(output->pageflip_timer);
@ -4427,6 +4413,7 @@ create_output_for_connector(struct drm_backend *b,
const char *make = "unknown"; const char *make = "unknown";
const char *model = "unknown"; const char *model = "unknown";
const char *serial_number = "unknown"; const char *serial_number = "unknown";
drmModeCrtcPtr origcrtc;
int i; int i;
static const struct drm_property_info connector_props[] = { static const struct drm_property_info connector_props[] = {
@ -4452,8 +4439,6 @@ create_output_for_connector(struct drm_backend *b,
output->backlight = backlight_init(drm_device, output->backlight = backlight_init(drm_device,
connector->connector_type); connector->connector_type);
output->original_crtc = drmModeGetCrtc(b->drm.fd, output->crtc_id);
name = make_connector_name(connector); name = make_connector_name(connector);
weston_output_init(&output->base, b->compositor, name); weston_output_init(&output->base, b->compositor, name);
free(name); free(name);
@ -4462,6 +4447,13 @@ create_output_for_connector(struct drm_backend *b,
output->base.destroy = drm_output_destroy; output->base.destroy = drm_output_destroy;
output->base.disable = drm_output_disable; output->base.disable = drm_output_disable;
origcrtc = drmModeGetCrtc(b->drm.fd, output->crtc_id);
if (origcrtc == NULL)
goto err_output;
output->base.gamma_size = origcrtc->gamma_size;
drmModeFreeCrtc(origcrtc);
output->destroy_pending = 0; output->destroy_pending = 0;
output->disable_pending = 0; output->disable_pending = 0;
@ -4480,6 +4472,8 @@ create_output_for_connector(struct drm_backend *b,
output->base.serial_number = (char *)serial_number; output->base.serial_number = (char *)serial_number;
output->base.subpixel = drm_subpixel_to_wayland(output->connector->subpixel); output->base.subpixel = drm_subpixel_to_wayland(output->connector->subpixel);
drmModeFreeObjectProperties(props);
if (output->connector->connector_type == DRM_MODE_CONNECTOR_LVDS || if (output->connector->connector_type == DRM_MODE_CONNECTOR_LVDS ||
output->connector->connector_type == DRM_MODE_CONNECTOR_eDP) output->connector->connector_type == DRM_MODE_CONNECTOR_eDP)
output->base.connection_internal = true; output->base.connection_internal = true;
@ -4489,8 +4483,6 @@ create_output_for_connector(struct drm_backend *b,
output->base.mm_width = output->connector->mmWidth; output->base.mm_width = output->connector->mmWidth;
output->base.mm_height = output->connector->mmHeight; output->base.mm_height = output->connector->mmHeight;
drmModeFreeObjectProperties(props);
for (i = 0; i < output->connector->count_modes; i++) { for (i = 0; i < output->connector->count_modes; i++) {
drm_mode = drm_output_add_mode(output, &output->connector->modes[i]); drm_mode = drm_output_add_mode(output, &output->connector->modes[i]);
if (!drm_mode) { if (!drm_mode) {

Loading…
Cancel
Save