[PATCH weston v5 37/42] [XXX] compositor-drm: Don't restore original CRTC mode

Daniel Stone daniels at collabora.com
Wed Nov 16 14:25:29 UTC 2016


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.

XXX: This breaks gamma. Need to work around that.

Signed-off-by: Daniel Stone <daniels at collabora.com>

Differential Revision: https://phabricator.freedesktop.org/D1502
---
 libweston/compositor-drm.c | 20 +-------------------
 1 file changed, 1 insertion(+), 19 deletions(-)

diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
index d8b28ac..9ccd291 100644
--- a/libweston/compositor-drm.c
+++ b/libweston/compositor-drm.c
@@ -293,7 +293,6 @@ struct drm_output {
 	uint32_t crtc_id; /* object ID to pass to DRM functions */
 	int pipe; /* index of CRTC in resource array / bitmasks */
 	uint32_t connector_id;
-	drmModeCrtcPtr original_crtc;
 	struct drm_edid edid;
 	drmModePropertyPtr dpms_prop;
 	uint32_t gbm_format;
@@ -1484,8 +1483,6 @@ drm_output_set_gamma(struct weston_output *output_base,
 	/* check */
 	if (output_base->gamma_size != size)
 		return;
-	if (!output->original_crtc)
-		return;
 
 	rc = drmModeCrtcSetGamma(backend->drm.fd,
 				 output->crtc_id,
@@ -3617,8 +3614,6 @@ drm_output_set_mode(struct weston_output *base,
 	output->base.serial_number = "unknown";
 	wl_list_init(&output->base.mode_list);
 
-	output->original_crtc = drmModeGetCrtc(b->drm.fd, output->crtc_id);
-
 	if (connector_get_current_mode(output->connector, b->drm.fd, &crtc_mode) < 0)
 		goto err_free;
 
@@ -3645,9 +3640,6 @@ drm_output_set_mode(struct weston_output *base,
 	return 0;
 
 err_free:
-	drmModeFreeCrtc(output->original_crtc);
-	output->original_crtc = NULL;
-
 	wl_list_for_each_safe(drm_mode, next, &output->base.mode_list,
 							base.link) {
 		wl_list_remove(&drm_mode->base.link);
@@ -3728,7 +3720,7 @@ drm_output_enable(struct weston_output *base)
 	output->base.set_dpms = drm_set_dpms;
 	output->base.switch_mode = drm_output_switch_mode;
 
-	output->base.gamma_size = output->original_crtc->gamma_size;
+	output->base.gamma_size = 0; /* XXX */
 	output->base.set_gamma = drm_output_set_gamma;
 
 	output->base.subpixel = drm_subpixel_to_wayland(output->connector->subpixel);
@@ -3792,7 +3784,6 @@ drm_output_destroy(struct weston_output *base)
 {
 	struct drm_output *output = to_drm_output(base);
 	struct drm_backend *b = to_drm_backend(base->compositor);
-	drmModeCrtcPtr origcrtc = output->original_crtc;
 
 	if (output->page_flip_pending || output->vblank_pending) {
 		output->destroy_pending = 1;
@@ -3803,14 +3794,6 @@ drm_output_destroy(struct weston_output *base)
 	if (output->base.enabled)
 		drm_output_deinit(&output->base);
 
-	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);
-	}
-
 	weston_output_destroy(&output->base);
 
 	drmModeFreeConnector(output->connector);
@@ -3901,7 +3884,6 @@ create_output_for_connector(struct drm_backend *b,
 
 	output->destroy_pending = 0;
 	output->disable_pending = 0;
-	output->original_crtc = NULL;
 
 	output->state_cur = drm_output_state_alloc(output);
 
-- 
2.9.3



More information about the wayland-devel mailing list