[PATCH weston v10 32/61] compositor-drm: Don't restore original CRTC mode
Daniel Stone
daniels at collabora.com
Tue Apr 4 16:54:50 UTC 2017
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.
Differential Revision: https://phabricator.freedesktop.org/D1502
Signed-off-by: Daniel Stone <daniels at collabora.com>
---
libweston/compositor-drm.c | 24 +++++++-----------------
1 file changed, 7 insertions(+), 17 deletions(-)
diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
index 51ebadde..326af752 100644
--- a/libweston/compositor-drm.c
+++ b/libweston/compositor-drm.c
@@ -349,7 +349,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;
enum dpms_enum dpms;
@@ -1686,8 +1685,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,
@@ -4066,10 +4063,7 @@ drm_output_enable(struct weston_output *base)
output->base.assign_planes = drm_assign_planes;
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.set_gamma = drm_output_set_gamma;
-
output->base.subpixel = drm_subpixel_to_wayland(output->connector->subpixel);
if (output->connector->connector_type == DRM_MODE_CONNECTOR_LVDS ||
@@ -4132,9 +4126,7 @@ static void
drm_output_destroy(struct weston_output *base)
{
struct drm_output *output = to_drm_output(base);
- struct drm_backend *b = to_drm_backend(base->compositor);
struct drm_mode *drm_mode, *next;
- drmModeCrtcPtr origcrtc = output->original_crtc;
if (output->page_flip_pending || output->vblank_pending) {
output->destroy_pending = 1;
@@ -4151,14 +4143,6 @@ drm_output_destroy(struct weston_output *base)
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)
wl_event_source_remove(output->pageflip_timer);
@@ -4274,6 +4258,7 @@ create_output_for_connector(struct drm_backend *b,
{
struct drm_output *output;
struct drm_mode *drm_mode;
+ drmModeCrtcPtr origcrtc;
int i;
i = find_crtc_for_connector(b, resources, connector);
@@ -4294,12 +4279,15 @@ create_output_for_connector(struct drm_backend *b,
output->backlight = backlight_init(drm_device,
connector->connector_type);
- output->original_crtc = drmModeGetCrtc(b->drm.fd, output->crtc_id);
+ origcrtc = drmModeGetCrtc(b->drm.fd, output->crtc_id);
+ if (origcrtc == NULL)
+ goto err;
output->base.enable = drm_output_enable;
output->base.destroy = drm_output_destroy;
output->base.disable = drm_output_disable;
output->base.name = make_connector_name(connector);
+ output->base.gamma_size = origcrtc->gamma_size;
output->destroy_pending = 0;
output->disable_pending = 0;
@@ -4310,6 +4298,8 @@ create_output_for_connector(struct drm_backend *b,
weston_output_init(&output->base, b->compositor);
+ drmModeFreeCrtc(origcrtc);
+
wl_list_init(&output->base.mode_list);
for (i = 0; i < output->connector->count_modes; i++) {
--
2.12.2
More information about the wayland-devel
mailing list