diff mbox

[1/3] drm/i915: Use LINEAR modifier instead of NONE

Message ID 20170324212950.2206-1-ben@bwidawsk.net (mailing list archive)
State New, archived
Headers show

Commit Message

Ben Widawsky March 24, 2017, 9:29 p.m. UTC
They're the same, so use the one which makes more sense.

Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
---
 drivers/gpu/drm/i915/intel_display.c | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

Comments

Ville Syrjala March 29, 2017, 8:03 p.m. UTC | #1
On Fri, Mar 24, 2017 at 02:29:48PM -0700, Ben Widawsky wrote:
> They're the same, so use the one which makes more sense.
> 
> Signed-off-by: Ben Widawsky <ben@bwidawsk.net>

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

> ---
>  drivers/gpu/drm/i915/intel_display.c | 28 ++++++++++++++--------------
>  1 file changed, 14 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 9a28a8917dc1..696d106461f8 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -1997,7 +1997,7 @@ intel_tile_width_bytes(const struct drm_framebuffer *fb, int plane)
>  	unsigned int cpp = fb->format->cpp[plane];
>  
>  	switch (fb->modifier) {
> -	case DRM_FORMAT_MOD_NONE:
> +	case DRM_FORMAT_MOD_LINEAR:
>  		return cpp;
>  	case I915_FORMAT_MOD_X_TILED:
>  		if (IS_GEN2(dev_priv))
> @@ -2033,7 +2033,7 @@ intel_tile_width_bytes(const struct drm_framebuffer *fb, int plane)
>  static unsigned int
>  intel_tile_height(const struct drm_framebuffer *fb, int plane)
>  {
> -	if (fb->modifier == DRM_FORMAT_MOD_NONE)
> +	if (fb->modifier == DRM_FORMAT_MOD_LINEAR)
>  		return 1;
>  	else
>  		return intel_tile_size(to_i915(fb->dev)) /
> @@ -2107,7 +2107,7 @@ static unsigned int intel_surf_alignment(const struct drm_framebuffer *fb,
>  		return 4096;
>  
>  	switch (fb->modifier) {
> -	case DRM_FORMAT_MOD_NONE:
> +	case DRM_FORMAT_MOD_LINEAR:
>  		return intel_linear_alignment(dev_priv);
>  	case I915_FORMAT_MOD_X_TILED:
>  		if (INTEL_GEN(dev_priv) >= 9)
> @@ -2290,7 +2290,7 @@ static u32 intel_adjust_tile_offset(int *x, int *y,
>  
>  	WARN_ON(new_offset > old_offset);
>  
> -	if (fb->modifier != DRM_FORMAT_MOD_NONE) {
> +	if (fb->modifier != DRM_FORMAT_MOD_LINEAR) {
>  		unsigned int tile_size, tile_width, tile_height;
>  		unsigned int pitch_tiles;
>  
> @@ -2345,7 +2345,7 @@ static u32 _intel_compute_tile_offset(const struct drm_i915_private *dev_priv,
>  	if (alignment)
>  		alignment--;
>  
> -	if (fb_modifier != DRM_FORMAT_MOD_NONE) {
> +	if (fb_modifier != DRM_FORMAT_MOD_LINEAR) {
>  		unsigned int tile_size, tile_width, tile_height;
>  		unsigned int tile_rows, tiles, pitch_tiles;
>  
> @@ -2471,7 +2471,7 @@ intel_fill_fb_info(struct drm_i915_private *dev_priv,
>  						    DRM_ROTATE_0, tile_size);
>  		offset /= tile_size;
>  
> -		if (fb->modifier != DRM_FORMAT_MOD_NONE) {
> +		if (fb->modifier != DRM_FORMAT_MOD_LINEAR) {
>  			unsigned int tile_width, tile_height;
>  			unsigned int pitch_tiles;
>  			struct drm_rect r;
> @@ -2803,7 +2803,7 @@ static int skl_max_plane_width(const struct drm_framebuffer *fb, int plane,
>  	int cpp = fb->format->cpp[plane];
>  
>  	switch (fb->modifier) {
> -	case DRM_FORMAT_MOD_NONE:
> +	case DRM_FORMAT_MOD_LINEAR:
>  	case I915_FORMAT_MOD_X_TILED:
>  		switch (cpp) {
>  		case 8:
> @@ -3199,7 +3199,7 @@ static void ironlake_update_primary_plane(struct drm_plane *primary,
>  static u32
>  intel_fb_stride_alignment(const struct drm_framebuffer *fb, int plane)
>  {
> -	if (fb->modifier == DRM_FORMAT_MOD_NONE)
> +	if (fb->modifier == DRM_FORMAT_MOD_LINEAR)
>  		return 64;
>  	else
>  		return intel_tile_width_bytes(fb, plane);
> @@ -3298,7 +3298,7 @@ static u32 skl_plane_ctl_format(uint32_t pixel_format)
>  static u32 skl_plane_ctl_tiling(uint64_t fb_modifier)
>  {
>  	switch (fb_modifier) {
> -	case DRM_FORMAT_MOD_NONE:
> +	case DRM_FORMAT_MOD_LINEAR:
>  		break;
>  	case I915_FORMAT_MOD_X_TILED:
>  		return PLANE_CTL_TILED_X;
> @@ -8426,7 +8426,7 @@ skylake_get_initial_plane_config(struct intel_crtc *crtc,
>  	tiling = val & PLANE_CTL_TILED_MASK;
>  	switch (tiling) {
>  	case PLANE_CTL_TILED_LINEAR:
> -		fb->modifier = DRM_FORMAT_MOD_NONE;
> +		fb->modifier = DRM_FORMAT_MOD_LINEAR;
>  		break;
>  	case PLANE_CTL_TILED_X:
>  		plane_config->tiling = I915_TILING_X;
> @@ -10399,7 +10399,7 @@ static void skl_do_mmio_flip(struct intel_crtc *intel_crtc,
>  	ctl = I915_READ(PLANE_CTL(pipe, 0));
>  	ctl &= ~PLANE_CTL_TILED_MASK;
>  	switch (fb->modifier) {
> -	case DRM_FORMAT_MOD_NONE:
> +	case DRM_FORMAT_MOD_LINEAR:
>  		break;
>  	case I915_FORMAT_MOD_X_TILED:
>  		ctl |= PLANE_CTL_TILED_X;
> @@ -13756,7 +13756,7 @@ intel_check_cursor_plane(struct drm_plane *plane,
>  		return -ENOMEM;
>  	}
>  
> -	if (fb->modifier != DRM_FORMAT_MOD_NONE) {
> +	if (fb->modifier != DRM_FORMAT_MOD_LINEAR) {
>  		DRM_DEBUG_KMS("cursor cannot be tiled\n");
>  		return -EINVAL;
>  	}
> @@ -14412,7 +14412,7 @@ static int intel_framebuffer_init(struct intel_framebuffer *intel_fb,
>  				      mode_cmd->modifier[0]);
>  			goto err;
>  		}
> -	case DRM_FORMAT_MOD_NONE:
> +	case DRM_FORMAT_MOD_LINEAR:
>  	case I915_FORMAT_MOD_X_TILED:
>  		break;
>  	default:
> @@ -14435,7 +14435,7 @@ static int intel_framebuffer_init(struct intel_framebuffer *intel_fb,
>  					   mode_cmd->pixel_format);
>  	if (mode_cmd->pitches[0] > pitch_limit) {
>  		DRM_DEBUG_KMS("%s pitch (%u) must be at most %d\n",
> -			      mode_cmd->modifier[0] != DRM_FORMAT_MOD_NONE ?
> +			      mode_cmd->modifier[0] != DRM_FORMAT_MOD_LINEAR ?
>  			      "tiled" : "linear",
>  			      mode_cmd->pitches[0], pitch_limit);
>  		goto err;
> -- 
> 2.12.1
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
Ville Syrjala March 29, 2017, 8:28 p.m. UTC | #2
On Wed, Mar 29, 2017 at 11:03:40PM +0300, Ville Syrjälä wrote:
> On Fri, Mar 24, 2017 at 02:29:48PM -0700, Ben Widawsky wrote:
> > They're the same, so use the one which makes more sense.
> > 
> > Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
> 
> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

And pushed to dinq immediately. Thanks for the patch.

> 
> > ---
> >  drivers/gpu/drm/i915/intel_display.c | 28 ++++++++++++++--------------
> >  1 file changed, 14 insertions(+), 14 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> > index 9a28a8917dc1..696d106461f8 100644
> > --- a/drivers/gpu/drm/i915/intel_display.c
> > +++ b/drivers/gpu/drm/i915/intel_display.c
> > @@ -1997,7 +1997,7 @@ intel_tile_width_bytes(const struct drm_framebuffer *fb, int plane)
> >  	unsigned int cpp = fb->format->cpp[plane];
> >  
> >  	switch (fb->modifier) {
> > -	case DRM_FORMAT_MOD_NONE:
> > +	case DRM_FORMAT_MOD_LINEAR:
> >  		return cpp;
> >  	case I915_FORMAT_MOD_X_TILED:
> >  		if (IS_GEN2(dev_priv))
> > @@ -2033,7 +2033,7 @@ intel_tile_width_bytes(const struct drm_framebuffer *fb, int plane)
> >  static unsigned int
> >  intel_tile_height(const struct drm_framebuffer *fb, int plane)
> >  {
> > -	if (fb->modifier == DRM_FORMAT_MOD_NONE)
> > +	if (fb->modifier == DRM_FORMAT_MOD_LINEAR)
> >  		return 1;
> >  	else
> >  		return intel_tile_size(to_i915(fb->dev)) /
> > @@ -2107,7 +2107,7 @@ static unsigned int intel_surf_alignment(const struct drm_framebuffer *fb,
> >  		return 4096;
> >  
> >  	switch (fb->modifier) {
> > -	case DRM_FORMAT_MOD_NONE:
> > +	case DRM_FORMAT_MOD_LINEAR:
> >  		return intel_linear_alignment(dev_priv);
> >  	case I915_FORMAT_MOD_X_TILED:
> >  		if (INTEL_GEN(dev_priv) >= 9)
> > @@ -2290,7 +2290,7 @@ static u32 intel_adjust_tile_offset(int *x, int *y,
> >  
> >  	WARN_ON(new_offset > old_offset);
> >  
> > -	if (fb->modifier != DRM_FORMAT_MOD_NONE) {
> > +	if (fb->modifier != DRM_FORMAT_MOD_LINEAR) {
> >  		unsigned int tile_size, tile_width, tile_height;
> >  		unsigned int pitch_tiles;
> >  
> > @@ -2345,7 +2345,7 @@ static u32 _intel_compute_tile_offset(const struct drm_i915_private *dev_priv,
> >  	if (alignment)
> >  		alignment--;
> >  
> > -	if (fb_modifier != DRM_FORMAT_MOD_NONE) {
> > +	if (fb_modifier != DRM_FORMAT_MOD_LINEAR) {
> >  		unsigned int tile_size, tile_width, tile_height;
> >  		unsigned int tile_rows, tiles, pitch_tiles;
> >  
> > @@ -2471,7 +2471,7 @@ intel_fill_fb_info(struct drm_i915_private *dev_priv,
> >  						    DRM_ROTATE_0, tile_size);
> >  		offset /= tile_size;
> >  
> > -		if (fb->modifier != DRM_FORMAT_MOD_NONE) {
> > +		if (fb->modifier != DRM_FORMAT_MOD_LINEAR) {
> >  			unsigned int tile_width, tile_height;
> >  			unsigned int pitch_tiles;
> >  			struct drm_rect r;
> > @@ -2803,7 +2803,7 @@ static int skl_max_plane_width(const struct drm_framebuffer *fb, int plane,
> >  	int cpp = fb->format->cpp[plane];
> >  
> >  	switch (fb->modifier) {
> > -	case DRM_FORMAT_MOD_NONE:
> > +	case DRM_FORMAT_MOD_LINEAR:
> >  	case I915_FORMAT_MOD_X_TILED:
> >  		switch (cpp) {
> >  		case 8:
> > @@ -3199,7 +3199,7 @@ static void ironlake_update_primary_plane(struct drm_plane *primary,
> >  static u32
> >  intel_fb_stride_alignment(const struct drm_framebuffer *fb, int plane)
> >  {
> > -	if (fb->modifier == DRM_FORMAT_MOD_NONE)
> > +	if (fb->modifier == DRM_FORMAT_MOD_LINEAR)
> >  		return 64;
> >  	else
> >  		return intel_tile_width_bytes(fb, plane);
> > @@ -3298,7 +3298,7 @@ static u32 skl_plane_ctl_format(uint32_t pixel_format)
> >  static u32 skl_plane_ctl_tiling(uint64_t fb_modifier)
> >  {
> >  	switch (fb_modifier) {
> > -	case DRM_FORMAT_MOD_NONE:
> > +	case DRM_FORMAT_MOD_LINEAR:
> >  		break;
> >  	case I915_FORMAT_MOD_X_TILED:
> >  		return PLANE_CTL_TILED_X;
> > @@ -8426,7 +8426,7 @@ skylake_get_initial_plane_config(struct intel_crtc *crtc,
> >  	tiling = val & PLANE_CTL_TILED_MASK;
> >  	switch (tiling) {
> >  	case PLANE_CTL_TILED_LINEAR:
> > -		fb->modifier = DRM_FORMAT_MOD_NONE;
> > +		fb->modifier = DRM_FORMAT_MOD_LINEAR;
> >  		break;
> >  	case PLANE_CTL_TILED_X:
> >  		plane_config->tiling = I915_TILING_X;
> > @@ -10399,7 +10399,7 @@ static void skl_do_mmio_flip(struct intel_crtc *intel_crtc,
> >  	ctl = I915_READ(PLANE_CTL(pipe, 0));
> >  	ctl &= ~PLANE_CTL_TILED_MASK;
> >  	switch (fb->modifier) {
> > -	case DRM_FORMAT_MOD_NONE:
> > +	case DRM_FORMAT_MOD_LINEAR:
> >  		break;
> >  	case I915_FORMAT_MOD_X_TILED:
> >  		ctl |= PLANE_CTL_TILED_X;
> > @@ -13756,7 +13756,7 @@ intel_check_cursor_plane(struct drm_plane *plane,
> >  		return -ENOMEM;
> >  	}
> >  
> > -	if (fb->modifier != DRM_FORMAT_MOD_NONE) {
> > +	if (fb->modifier != DRM_FORMAT_MOD_LINEAR) {
> >  		DRM_DEBUG_KMS("cursor cannot be tiled\n");
> >  		return -EINVAL;
> >  	}
> > @@ -14412,7 +14412,7 @@ static int intel_framebuffer_init(struct intel_framebuffer *intel_fb,
> >  				      mode_cmd->modifier[0]);
> >  			goto err;
> >  		}
> > -	case DRM_FORMAT_MOD_NONE:
> > +	case DRM_FORMAT_MOD_LINEAR:
> >  	case I915_FORMAT_MOD_X_TILED:
> >  		break;
> >  	default:
> > @@ -14435,7 +14435,7 @@ static int intel_framebuffer_init(struct intel_framebuffer *intel_fb,
> >  					   mode_cmd->pixel_format);
> >  	if (mode_cmd->pitches[0] > pitch_limit) {
> >  		DRM_DEBUG_KMS("%s pitch (%u) must be at most %d\n",
> > -			      mode_cmd->modifier[0] != DRM_FORMAT_MOD_NONE ?
> > +			      mode_cmd->modifier[0] != DRM_FORMAT_MOD_LINEAR ?
> >  			      "tiled" : "linear",
> >  			      mode_cmd->pitches[0], pitch_limit);
> >  		goto err;
> > -- 
> > 2.12.1
> > 
> > _______________________________________________
> > dri-devel mailing list
> > dri-devel@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/dri-devel
> 
> -- 
> Ville Syrjälä
> Intel OTC
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 9a28a8917dc1..696d106461f8 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -1997,7 +1997,7 @@  intel_tile_width_bytes(const struct drm_framebuffer *fb, int plane)
 	unsigned int cpp = fb->format->cpp[plane];
 
 	switch (fb->modifier) {
-	case DRM_FORMAT_MOD_NONE:
+	case DRM_FORMAT_MOD_LINEAR:
 		return cpp;
 	case I915_FORMAT_MOD_X_TILED:
 		if (IS_GEN2(dev_priv))
@@ -2033,7 +2033,7 @@  intel_tile_width_bytes(const struct drm_framebuffer *fb, int plane)
 static unsigned int
 intel_tile_height(const struct drm_framebuffer *fb, int plane)
 {
-	if (fb->modifier == DRM_FORMAT_MOD_NONE)
+	if (fb->modifier == DRM_FORMAT_MOD_LINEAR)
 		return 1;
 	else
 		return intel_tile_size(to_i915(fb->dev)) /
@@ -2107,7 +2107,7 @@  static unsigned int intel_surf_alignment(const struct drm_framebuffer *fb,
 		return 4096;
 
 	switch (fb->modifier) {
-	case DRM_FORMAT_MOD_NONE:
+	case DRM_FORMAT_MOD_LINEAR:
 		return intel_linear_alignment(dev_priv);
 	case I915_FORMAT_MOD_X_TILED:
 		if (INTEL_GEN(dev_priv) >= 9)
@@ -2290,7 +2290,7 @@  static u32 intel_adjust_tile_offset(int *x, int *y,
 
 	WARN_ON(new_offset > old_offset);
 
-	if (fb->modifier != DRM_FORMAT_MOD_NONE) {
+	if (fb->modifier != DRM_FORMAT_MOD_LINEAR) {
 		unsigned int tile_size, tile_width, tile_height;
 		unsigned int pitch_tiles;
 
@@ -2345,7 +2345,7 @@  static u32 _intel_compute_tile_offset(const struct drm_i915_private *dev_priv,
 	if (alignment)
 		alignment--;
 
-	if (fb_modifier != DRM_FORMAT_MOD_NONE) {
+	if (fb_modifier != DRM_FORMAT_MOD_LINEAR) {
 		unsigned int tile_size, tile_width, tile_height;
 		unsigned int tile_rows, tiles, pitch_tiles;
 
@@ -2471,7 +2471,7 @@  intel_fill_fb_info(struct drm_i915_private *dev_priv,
 						    DRM_ROTATE_0, tile_size);
 		offset /= tile_size;
 
-		if (fb->modifier != DRM_FORMAT_MOD_NONE) {
+		if (fb->modifier != DRM_FORMAT_MOD_LINEAR) {
 			unsigned int tile_width, tile_height;
 			unsigned int pitch_tiles;
 			struct drm_rect r;
@@ -2803,7 +2803,7 @@  static int skl_max_plane_width(const struct drm_framebuffer *fb, int plane,
 	int cpp = fb->format->cpp[plane];
 
 	switch (fb->modifier) {
-	case DRM_FORMAT_MOD_NONE:
+	case DRM_FORMAT_MOD_LINEAR:
 	case I915_FORMAT_MOD_X_TILED:
 		switch (cpp) {
 		case 8:
@@ -3199,7 +3199,7 @@  static void ironlake_update_primary_plane(struct drm_plane *primary,
 static u32
 intel_fb_stride_alignment(const struct drm_framebuffer *fb, int plane)
 {
-	if (fb->modifier == DRM_FORMAT_MOD_NONE)
+	if (fb->modifier == DRM_FORMAT_MOD_LINEAR)
 		return 64;
 	else
 		return intel_tile_width_bytes(fb, plane);
@@ -3298,7 +3298,7 @@  static u32 skl_plane_ctl_format(uint32_t pixel_format)
 static u32 skl_plane_ctl_tiling(uint64_t fb_modifier)
 {
 	switch (fb_modifier) {
-	case DRM_FORMAT_MOD_NONE:
+	case DRM_FORMAT_MOD_LINEAR:
 		break;
 	case I915_FORMAT_MOD_X_TILED:
 		return PLANE_CTL_TILED_X;
@@ -8426,7 +8426,7 @@  skylake_get_initial_plane_config(struct intel_crtc *crtc,
 	tiling = val & PLANE_CTL_TILED_MASK;
 	switch (tiling) {
 	case PLANE_CTL_TILED_LINEAR:
-		fb->modifier = DRM_FORMAT_MOD_NONE;
+		fb->modifier = DRM_FORMAT_MOD_LINEAR;
 		break;
 	case PLANE_CTL_TILED_X:
 		plane_config->tiling = I915_TILING_X;
@@ -10399,7 +10399,7 @@  static void skl_do_mmio_flip(struct intel_crtc *intel_crtc,
 	ctl = I915_READ(PLANE_CTL(pipe, 0));
 	ctl &= ~PLANE_CTL_TILED_MASK;
 	switch (fb->modifier) {
-	case DRM_FORMAT_MOD_NONE:
+	case DRM_FORMAT_MOD_LINEAR:
 		break;
 	case I915_FORMAT_MOD_X_TILED:
 		ctl |= PLANE_CTL_TILED_X;
@@ -13756,7 +13756,7 @@  intel_check_cursor_plane(struct drm_plane *plane,
 		return -ENOMEM;
 	}
 
-	if (fb->modifier != DRM_FORMAT_MOD_NONE) {
+	if (fb->modifier != DRM_FORMAT_MOD_LINEAR) {
 		DRM_DEBUG_KMS("cursor cannot be tiled\n");
 		return -EINVAL;
 	}
@@ -14412,7 +14412,7 @@  static int intel_framebuffer_init(struct intel_framebuffer *intel_fb,
 				      mode_cmd->modifier[0]);
 			goto err;
 		}
-	case DRM_FORMAT_MOD_NONE:
+	case DRM_FORMAT_MOD_LINEAR:
 	case I915_FORMAT_MOD_X_TILED:
 		break;
 	default:
@@ -14435,7 +14435,7 @@  static int intel_framebuffer_init(struct intel_framebuffer *intel_fb,
 					   mode_cmd->pixel_format);
 	if (mode_cmd->pitches[0] > pitch_limit) {
 		DRM_DEBUG_KMS("%s pitch (%u) must be at most %d\n",
-			      mode_cmd->modifier[0] != DRM_FORMAT_MOD_NONE ?
+			      mode_cmd->modifier[0] != DRM_FORMAT_MOD_LINEAR ?
 			      "tiled" : "linear",
 			      mode_cmd->pitches[0], pitch_limit);
 		goto err;