diff mbox

drm: atomic: fix legacy gamma set helper

Message ID 1460135871-23307-1-git-send-email-lionel.g.landwerlin@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Lionel Landwerlin April 8, 2016, 5:17 p.m. UTC
Color management properties are a bit of an odd use case because
they're not marked as atomic properties. Currently we're not updating
the non atomic values so the drm_crtc_state is out of sync with the
values stored in the crtc object.

Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Bob Paauwe <bob.j.paauwe@intel.com>
Cc: <dri-devel@lists.freedesktop.org>
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
---
 drivers/gpu/drm/drm_atomic_helper.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Paauwe, Bob J April 8, 2016, 6:15 p.m. UTC | #1
On Fri, 8 Apr 2016 18:17:51 +0100
Lionel Landwerlin <lionel.g.landwerlin@intel.com> wrote:

> Color management properties are a bit of an odd use case because
> they're not marked as atomic properties. Currently we're not updating
> the non atomic values so the drm_crtc_state is out of sync with the
> values stored in the crtc object.
> 
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Bob Paauwe <bob.j.paauwe@intel.com>
> Cc: <dri-devel@lists.freedesktop.org>
> Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
> ---
>  drivers/gpu/drm/drm_atomic_helper.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> index 7bf678e..4aacd44 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -2964,16 +2964,22 @@ retry:
>  			config->degamma_lut_property, 0);
>  	if (ret)
>  		goto fail;
> +	drm_object_property_set_value(&crtc->base,
> +			config->degamma_lut_property, 0);
>  
>  	ret = drm_atomic_crtc_set_property(crtc, crtc_state,
>  			config->ctm_property, 0);
>  	if (ret)
>  		goto fail;
> +	drm_object_property_set_value(&crtc->base,
> +			config->ctm_property, 0);
>  
>  	ret = drm_atomic_crtc_set_property(crtc, crtc_state,
>  			config->gamma_lut_property, blob->base.id);
>  	if (ret)
>  		goto fail;
> +	drm_object_property_set_value(&crtc->base,
> +			config->gamma_lut_property, blob->base.id);
>  

This is similar to what I originally did to fix this problem.
But if the commit below fails, you've now changed the non atomic
values, but the atomic values would be reverted back to the original
state so they're out of sync again.  So just moving the set_value calls
to after the commit succeeds might be a better solution.

>  	ret = drm_atomic_commit(state);
>  	if (ret)
diff mbox

Patch

diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index 7bf678e..4aacd44 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -2964,16 +2964,22 @@  retry:
 			config->degamma_lut_property, 0);
 	if (ret)
 		goto fail;
+	drm_object_property_set_value(&crtc->base,
+			config->degamma_lut_property, 0);
 
 	ret = drm_atomic_crtc_set_property(crtc, crtc_state,
 			config->ctm_property, 0);
 	if (ret)
 		goto fail;
+	drm_object_property_set_value(&crtc->base,
+			config->ctm_property, 0);
 
 	ret = drm_atomic_crtc_set_property(crtc, crtc_state,
 			config->gamma_lut_property, blob->base.id);
 	if (ret)
 		goto fail;
+	drm_object_property_set_value(&crtc->base,
+			config->gamma_lut_property, blob->base.id);
 
 	ret = drm_atomic_commit(state);
 	if (ret)