[Intel-gfx] [PATCH 02/10] drm/i915: Split up intel_color_init()
Jani Nikula
jani.nikula at linux.intel.com
Thu Sep 29 10:41:47 UTC 2022
On Thu, 29 Sep 2022, Ville Syrjala <ville.syrjala at linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala at linux.intel.com>
>
> intel_color_init() does both device level and crtc level stuff.
> Split it up accordingly.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
> ---
> drivers/gpu/drm/i915/display/intel_color.c | 15 +++++++++------
> drivers/gpu/drm/i915/display/intel_color.h | 4 +++-
> drivers/gpu/drm/i915/display/intel_crtc.c | 3 +--
> drivers/gpu/drm/i915/display/intel_display.c | 1 +
> 4 files changed, 14 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_color.c b/drivers/gpu/drm/i915/display/intel_color.c
> index bbc56affb3ec..ddfe7c257a72 100644
> --- a/drivers/gpu/drm/i915/display/intel_color.c
> +++ b/drivers/gpu/drm/i915/display/intel_color.c
> @@ -2206,13 +2206,21 @@ static const struct intel_color_funcs ilk_color_funcs = {
> .read_luts = ilk_read_luts,
> };
>
> -void intel_color_init(struct intel_crtc *crtc)
> +void intel_crtc_color_init(struct intel_crtc *crtc)
> {
> struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
> bool has_ctm = INTEL_INFO(dev_priv)->display.color.degamma_lut_size != 0;
>
> drm_mode_crtc_set_gamma_size(&crtc->base, 256);
>
> + drm_crtc_enable_color_mgmt(&crtc->base,
> + INTEL_INFO(dev_priv)->display.color.degamma_lut_size,
> + has_ctm,
> + INTEL_INFO(dev_priv)->display.color.gamma_lut_size);
> +}
> +
> +void intel_color_init_hooks(struct drm_i915_private *dev_priv)
> +{
> if (HAS_GMCH(dev_priv)) {
> if (IS_CHERRYVIEW(dev_priv)) {
> dev_priv->display.funcs.color = &chv_color_funcs;
> @@ -2238,9 +2246,4 @@ void intel_color_init(struct intel_crtc *crtc)
> } else
> dev_priv->display.funcs.color = &ilk_color_funcs;
> }
> -
> - drm_crtc_enable_color_mgmt(&crtc->base,
> - INTEL_INFO(dev_priv)->display.color.degamma_lut_size,
> - has_ctm,
> - INTEL_INFO(dev_priv)->display.color.gamma_lut_size);
> }
> diff --git a/drivers/gpu/drm/i915/display/intel_color.h b/drivers/gpu/drm/i915/display/intel_color.h
> index fd873425e082..67702451e2fd 100644
> --- a/drivers/gpu/drm/i915/display/intel_color.h
> +++ b/drivers/gpu/drm/i915/display/intel_color.h
> @@ -10,9 +10,11 @@
>
> struct intel_crtc_state;
> struct intel_crtc;
> +struct drm_i915_private;
> struct drm_property_blob;
>
> -void intel_color_init(struct intel_crtc *crtc);
> +void intel_color_init_hooks(struct drm_i915_private *i915);
> +void intel_crtc_color_init(struct intel_crtc *crtc);
> int intel_color_check(struct intel_crtc_state *crtc_state);
> void intel_color_commit_noarm(const struct intel_crtc_state *crtc_state);
> void intel_color_commit_arm(const struct intel_crtc_state *crtc_state);
> diff --git a/drivers/gpu/drm/i915/display/intel_crtc.c b/drivers/gpu/drm/i915/display/intel_crtc.c
> index 6792a9056f46..2d9fc7383bfc 100644
> --- a/drivers/gpu/drm/i915/display/intel_crtc.c
> +++ b/drivers/gpu/drm/i915/display/intel_crtc.c
> @@ -365,8 +365,7 @@ int intel_crtc_init(struct drm_i915_private *dev_priv, enum pipe pipe)
> BIT(DRM_SCALING_FILTER_DEFAULT) |
> BIT(DRM_SCALING_FILTER_NEAREST_NEIGHBOR));
>
> - intel_color_init(crtc);
> -
> + intel_crtc_color_init(crtc);
> intel_crtc_drrs_init(crtc);
> intel_crtc_crc_init(crtc);
I'd name all of these like:
intel_color_crtc_init();
intel_drrs_crtc_init();
intel_crc_crtc_init();
I think in gem side the "name functions based on first/context argument"
style has lead to serious problems wrt code organization. They still
stick to it, but I can't make heads or tails where function definitions
or declarations are supposed to be placed or found.
BR,
Jani.
>
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index eb8eaeb19881..a103413cb081 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -8326,6 +8326,7 @@ void intel_init_display_hooks(struct drm_i915_private *dev_priv)
> if (!HAS_DISPLAY(dev_priv))
> return;
>
> + intel_color_init_hooks(dev_priv);
> intel_init_cdclk_hooks(dev_priv);
> intel_audio_hooks_init(dev_priv);
--
Jani Nikula, Intel Open Source Graphics Center
More information about the Intel-gfx
mailing list