diff mbox

[2/2] drm/fb-helper: Don't load the display palette if the CRTC is disabled

Message ID 1369669497-18854-2-git-send-email-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ville Syrjälä May 27, 2013, 3:44 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Often the hardware needs certain clocks running when accessing the
palette, so don't go poking at it if the CRTC is disabled. We still
call the fb_helper gamma_set hooks to update the driver's notion of
what the palette should contain, so that if/when CRTC gets enabled,
the driver will load the correct palette.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
The other option would of course to put the check into the load_lut
function itself. I don't really care which way we do it as long as
the check is somewhere...

 drivers/gpu/drm/drm_fb_helper.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Ville Syrjälä May 27, 2013, 3:51 p.m. UTC | #1
On Mon, May 27, 2013 at 06:44:57PM +0300, ville.syrjala@linux.intel.com wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Often the hardware needs certain clocks running when accessing the
> palette, so don't go poking at it if the CRTC is disabled. We still
> call the fb_helper gamma_set hooks to update the driver's notion of
> what the palette should contain, so that if/when CRTC gets enabled,
> the driver will load the correct palette.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
> The other option would of course to put the check into the load_lut
> function itself. I don't really care which way we do it as long as
> the check is somewhere...

And I just realized we already have the check in i915 load_lut at least.
Not sure how I failed to notice it before. So feel free to ignore this
patch. Patch 1/2 still seems relevant though.

> 
>  drivers/gpu/drm/drm_fb_helper.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
> index 1b6ca23..4ecf128 100644
> --- a/drivers/gpu/drm/drm_fb_helper.c
> +++ b/drivers/gpu/drm/drm_fb_helper.c
> @@ -663,7 +663,9 @@ int drm_fb_helper_setcmap(struct fb_cmap *cmap, struct fb_info *info)
>  			if (rc)
>  				goto out;
>  		}
> -		crtc_funcs->load_lut(crtc);
> +
> +		if (crtc->enabled)
> +			crtc_funcs->load_lut(crtc);
>  	}
>   out:
>  	drm_modeset_unlock_all(dev);
> -- 
> 1.8.1.5
Daniel Vetter May 27, 2013, 3:54 p.m. UTC | #2
On Mon, May 27, 2013 at 06:44:57PM +0300, ville.syrjala@linux.intel.com wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Often the hardware needs certain clocks running when accessing the
> palette, so don't go poking at it if the CRTC is disabled. We still
> call the fb_helper gamma_set hooks to update the driver's notion of
> what the palette should contain, so that if/when CRTC gets enabled,
> the driver will load the correct palette.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
> The other option would of course to put the check into the load_lut
> function itself. I don't really care which way we do it as long as
> the check is somewhere...
> 
>  drivers/gpu/drm/drm_fb_helper.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
> index 1b6ca23..4ecf128 100644
> --- a/drivers/gpu/drm/drm_fb_helper.c
> +++ b/drivers/gpu/drm/drm_fb_helper.c
> @@ -663,7 +663,9 @@ int drm_fb_helper_setcmap(struct fb_cmap *cmap, struct fb_info *info)
>  			if (rc)
>  				goto out;
>  		}
> -		crtc_funcs->load_lut(crtc);
> +
> +		if (crtc->enabled)

I'd vote for if (crtc->enabled && crtc_funcs->load_lut) since a lot of kms
drivers only implement dummy ->load_lut functions.

Then please also throw a pile of driver patches on top to kill all the now
redundant crtc->enabled checks and all the dummy load_lut functions. With
that fixed this is

Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>

> +			crtc_funcs->load_lut(crtc);
>  	}
>   out:
>  	drm_modeset_unlock_all(dev);
> -- 
> 1.8.1.5
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
diff mbox

Patch

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 1b6ca23..4ecf128 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -663,7 +663,9 @@  int drm_fb_helper_setcmap(struct fb_cmap *cmap, struct fb_info *info)
 			if (rc)
 				goto out;
 		}
-		crtc_funcs->load_lut(crtc);
+
+		if (crtc->enabled)
+			crtc_funcs->load_lut(crtc);
 	}
  out:
 	drm_modeset_unlock_all(dev);