[Intel-gfx] [PATCH 08/23] drm/i915/intel_fb: Pull FB plane functions from skl_universal_plane.c

Ville Syrjälä ville.syrjala at linux.intel.com
Thu Mar 11 16:18:40 UTC 2021


On Thu, Mar 11, 2021 at 12:17:21AM +0200, Imre Deak wrote:
> Move the FB plane related functions from skl_universal_plane.c to
> intel_fb.c.

Some are only used by the skl plane code, but since these are all
related with each other I guess it's still better to collect it
all into one place.

Reviewed-by: Ville Syrjälä <ville.syrjala at linux.intel.com>

> 
> Signed-off-by: Imre Deak <imre.deak at intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_fb.c       | 32 +++++++++++++++++
>  drivers/gpu/drm/i915/display/intel_fb.h       |  4 +++
>  .../drm/i915/display/skl_universal_plane.c    | 34 -------------------
>  .../drm/i915/display/skl_universal_plane.h    |  2 --
>  4 files changed, 36 insertions(+), 36 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_fb.c b/drivers/gpu/drm/i915/display/intel_fb.c
> index 29b8ec087f53..977ee2acaed1 100644
> --- a/drivers/gpu/drm/i915/display/intel_fb.c
> +++ b/drivers/gpu/drm/i915/display/intel_fb.c
> @@ -26,3 +26,35 @@ bool is_gen12_ccs_cc_plane(const struct drm_framebuffer *fb, int plane)
>  	return fb->modifier == I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS_CC &&
>  	       plane == 2;
>  }
> +
> +int main_to_ccs_plane(const struct drm_framebuffer *fb, int main_plane)
> +{
> +	drm_WARN_ON(fb->dev, !is_ccs_modifier(fb->modifier) ||
> +		    (main_plane && main_plane >= fb->format->num_planes / 2));
> +
> +	return fb->format->num_planes / 2 + main_plane;
> +}
> +
> +int skl_ccs_to_main_plane(const struct drm_framebuffer *fb, int ccs_plane)
> +{
> +	drm_WARN_ON(fb->dev, !is_ccs_modifier(fb->modifier) ||
> +		    ccs_plane < fb->format->num_planes / 2);
> +
> +	if (is_gen12_ccs_cc_plane(fb, ccs_plane))
> +		return 0;
> +
> +	return ccs_plane - fb->format->num_planes / 2;
> +}
> +
> +int skl_main_to_aux_plane(const struct drm_framebuffer *fb, int main_plane)
> +{
> +	struct drm_i915_private *i915 = to_i915(fb->dev);
> +
> +	if (is_ccs_modifier(fb->modifier))
> +		return main_to_ccs_plane(fb, main_plane);
> +	else if (INTEL_GEN(i915) < 11 &&
> +		 intel_format_info_is_yuv_semiplanar(fb->format, fb->modifier))
> +		return 1;
> +	else
> +		return 0;
> +}
> diff --git a/drivers/gpu/drm/i915/display/intel_fb.h b/drivers/gpu/drm/i915/display/intel_fb.h
> index 64e6a2521320..3cde53c75cb3 100644
> --- a/drivers/gpu/drm/i915/display/intel_fb.h
> +++ b/drivers/gpu/drm/i915/display/intel_fb.h
> @@ -14,4 +14,8 @@ bool is_ccs_plane(const struct drm_framebuffer *fb, int plane);
>  bool is_gen12_ccs_plane(const struct drm_framebuffer *fb, int plane);
>  bool is_gen12_ccs_cc_plane(const struct drm_framebuffer *fb, int plane);
>  
> +int main_to_ccs_plane(const struct drm_framebuffer *fb, int main_plane);
> +int skl_ccs_to_main_plane(const struct drm_framebuffer *fb, int ccs_plane);
> +int skl_main_to_aux_plane(const struct drm_framebuffer *fb, int main_plane);
> +
>  #endif /* __INTEL_FB_H__ */
> diff --git a/drivers/gpu/drm/i915/display/skl_universal_plane.c b/drivers/gpu/drm/i915/display/skl_universal_plane.c
> index 3ff1008b0b4a..9a456b3d19a9 100644
> --- a/drivers/gpu/drm/i915/display/skl_universal_plane.c
> +++ b/drivers/gpu/drm/i915/display/skl_universal_plane.c
> @@ -915,40 +915,6 @@ static u32 glk_plane_color_ctl(const struct intel_crtc_state *crtc_state,
>  	return plane_color_ctl;
>  }
>  
> -static int
> -main_to_ccs_plane(const struct drm_framebuffer *fb, int main_plane)
> -{
> -	drm_WARN_ON(fb->dev, !is_ccs_modifier(fb->modifier) ||
> -		    (main_plane && main_plane >= fb->format->num_planes / 2));
> -
> -	return fb->format->num_planes / 2 + main_plane;
> -}
> -
> -int skl_ccs_to_main_plane(const struct drm_framebuffer *fb, int ccs_plane)
> -{
> -	drm_WARN_ON(fb->dev, !is_ccs_modifier(fb->modifier) ||
> -		    ccs_plane < fb->format->num_planes / 2);
> -
> -	if (is_gen12_ccs_cc_plane(fb, ccs_plane))
> -		return 0;
> -
> -	return ccs_plane - fb->format->num_planes / 2;
> -}
> -
> -static int
> -skl_main_to_aux_plane(const struct drm_framebuffer *fb, int main_plane)
> -{
> -	struct drm_i915_private *i915 = to_i915(fb->dev);
> -
> -	if (is_ccs_modifier(fb->modifier))
> -		return main_to_ccs_plane(fb, main_plane);
> -	else if (INTEL_GEN(i915) < 11 &&
> -		 intel_format_info_is_yuv_semiplanar(fb->format, fb->modifier))
> -		return 1;
> -	else
> -		return 0;
> -}
> -
>  static void
>  skl_program_plane(struct intel_plane *plane,
>  		  const struct intel_crtc_state *crtc_state,
> diff --git a/drivers/gpu/drm/i915/display/skl_universal_plane.h b/drivers/gpu/drm/i915/display/skl_universal_plane.h
> index 818266653630..351040b64dc7 100644
> --- a/drivers/gpu/drm/i915/display/skl_universal_plane.h
> +++ b/drivers/gpu/drm/i915/display/skl_universal_plane.h
> @@ -8,7 +8,6 @@
>  
>  #include <linux/types.h>
>  
> -struct drm_framebuffer;
>  struct drm_i915_private;
>  struct intel_crtc;
>  struct intel_initial_plane_config;
> @@ -26,7 +25,6 @@ void skl_get_initial_plane_config(struct intel_crtc *crtc,
>  
>  int skl_format_to_fourcc(int format, bool rgb_order, bool alpha);
>  
> -int skl_ccs_to_main_plane(const struct drm_framebuffer *fb, int ccs_plane);
>  int skl_calc_main_surface_offset(const struct intel_plane_state *plane_state,
>  				 int *x, int *y, u32 *offset);
>  
> -- 
> 2.25.1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Ville Syrjälä
Intel


More information about the Intel-gfx mailing list