Re: [PATCH weston 41/68] [XXX] compositor-drm: Don't restore original CRTC mode

2016-12-09 Thread Armin Krezović
On 09.12.2016 20:57, Daniel Stone wrote:
> 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.
> 
> Differential Revision: https://phabricator.freedesktop.org/D1502
> 
> Signed-off-by: Daniel Stone 
> ---
>  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 5959aed..2db48f1 100644
> --- a/libweston/compositor-drm.c
> +++ b/libweston/compositor-drm.c
> @@ -297,7 +297,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;
> @@ -1513,8 +1512,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,
> @@ -3630,8 +3627,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);
> -

Can't you just store gamma_size from here? No need to store the original_crtc,
just get the gamma value and let it go.

>   if (connector_get_current_mode(output->connector, b->drm.fd, 
> &crtc_mode) < 0)
>   goto err_free;
>  
> @@ -3658,9 +3653,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);
> @@ -3741,7 +3733,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);
> @@ -3805,7 +3797,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;
> @@ -3816,14 +3807,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);
> @@ -3914,7 +3897,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);
>  
> 




signature.asc
Description: OpenPGP digital signature
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH weston 41/68] [XXX] compositor-drm: Don't restore original CRTC mode

2016-12-09 Thread Daniel Stone
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.

Differential Revision: https://phabricator.freedesktop.org/D1502

Signed-off-by: Daniel Stone 
---
 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 5959aed..2db48f1 100644
--- a/libweston/compositor-drm.c
+++ b/libweston/compositor-drm.c
@@ -297,7 +297,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;
@@ -1513,8 +1512,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,
@@ -3630,8 +3627,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;
 
@@ -3658,9 +3653,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);
@@ -3741,7 +3733,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);
@@ -3805,7 +3797,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;
@@ -3816,14 +3807,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);
@@ -3914,7 +3897,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

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel