[Intel-gfx] [PATCH v2 1/2] drm/i915: Add function to check for linear surfaces

Ville Syrjälä ville.syrjala at linux.intel.com
Fri Oct 26 15:01:52 UTC 2018


On Thu, Oct 25, 2018 at 04:10:26PM -0700, Dhinakaran Pandiyan wrote:
> A framebuffer can comprise surfaces with distinct tiling formats,
> making checks against modifier alone insufficient. Make use of a
> function to identify a linear surface based on both modifier and color
> plane.
> 
> v2: Typo fix

newline missing here

> Cc: Ville Syrjälä <ville.syrjala at linux.intel.com>
> Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan at intel.com>
> ---
>  drivers/gpu/drm/i915/intel_display.c | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index fe045abb6472..25e5402efd52 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -2205,6 +2205,11 @@ static u32 intel_adjust_tile_offset(int *x, int *y,
>  	return new_offset;
>  }
>  
> +static inline bool is_surface_linear(uint64_t modifier, int color_plane)

inline not needed. s/uint64_t/u64/

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

> +{
> +	return modifier == DRM_FORMAT_MOD_LINEAR;
> +}
> +
>  static u32 intel_adjust_aligned_offset(int *x, int *y,
>  				       const struct drm_framebuffer *fb,
>  				       int color_plane,
> @@ -2217,7 +2222,7 @@ static u32 intel_adjust_aligned_offset(int *x, int *y,
>  
>  	WARN_ON(new_offset > old_offset);
>  
> -	if (fb->modifier != DRM_FORMAT_MOD_LINEAR) {
> +	if (!is_surface_linear(fb->modifier, color_plane)) {
>  		unsigned int tile_size, tile_width, tile_height;
>  		unsigned int pitch_tiles;
>  
> @@ -2281,14 +2286,13 @@ static u32 intel_compute_aligned_offset(struct drm_i915_private *dev_priv,
>  					unsigned int rotation,
>  					u32 alignment)
>  {
> -	uint64_t fb_modifier = fb->modifier;
>  	unsigned int cpp = fb->format->cpp[color_plane];
>  	u32 offset, offset_aligned;
>  
>  	if (alignment)
>  		alignment--;
>  
> -	if (fb_modifier != DRM_FORMAT_MOD_LINEAR) {
> +	if (!is_surface_linear(fb->modifier, color_plane)) {
>  		unsigned int tile_size, tile_width, tile_height;
>  		unsigned int tile_rows, tiles, pitch_tiles;
>  
> @@ -2525,7 +2529,7 @@ intel_fill_fb_info(struct drm_i915_private *dev_priv,
>  						      tile_size);
>  		offset /= tile_size;
>  
> -		if (fb->modifier != DRM_FORMAT_MOD_LINEAR) {
> +		if (!is_surface_linear(fb->modifier, i)) {
>  			unsigned int tile_width, tile_height;
>  			unsigned int pitch_tiles;
>  			struct drm_rect r;
> -- 
> 2.14.1

-- 
Ville Syrjälä
Intel


More information about the Intel-gfx mailing list