diff mbox series

[1/5] drm/i915/fbc: Remove ancient 16k plane stride limit

Message ID 20230914113854.10008-1-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series [1/5] drm/i915/fbc: Remove ancient 16k plane stride limit | expand

Commit Message

Ville Syrjala Sept. 14, 2023, 11:38 a.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

The 16k max plane stride limit seems to be originally from
i965gm, and no limit explicit limit has been specified since (g4x+).
So let's assume the max plane stride itself is a suitable limit
also for the more recent FBC hardware.

In fact even for i965gm the max X-tiled stride is also 16k so
technically we don't need the check there either, but let's
keep it there anyway since it's explicitly mentioned in the
spec. Gen2/3 have more strict limits checked separately.

Cc: Swati Sharma <swati2.sharma@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/display/intel_fbc.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Sharma, Swati2 Sept. 15, 2023, 5:15 a.m. UTC | #1
Thanks Ville for the fix!
LGTM

Reviewed-by: Swati Sharma <swati2.sharma@intel.com>

On 14-Sep-23 5:08 PM, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> The 16k max plane stride limit seems to be originally from
> i965gm, and no limit explicit limit has been specified since (g4x+).

nitpick: "limit" seems to be extra here

> So let's assume the max plane stride itself is a suitable limit
> also for the more recent FBC hardware.
> 
> In fact even for i965gm the max X-tiled stride is also 16k so
> technically we don't need the check there either, but let's
> keep it there anyway since it's explicitly mentioned in the
> spec. Gen2/3 have more strict limits checked separately.
> 
> Cc: Swati Sharma <swati2.sharma@intel.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> > ---
>   drivers/gpu/drm/i915/display/intel_fbc.c | 6 ++----
>   1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_fbc.c b/drivers/gpu/drm/i915/display/intel_fbc.c
> index 817e5784660b..1b3358a0fbfb 100644
> --- a/drivers/gpu/drm/i915/display/intel_fbc.c
> +++ b/drivers/gpu/drm/i915/display/intel_fbc.c
> @@ -866,7 +866,8 @@ static bool stride_is_valid(const struct intel_plane_state *plane_state)
>   	if (DISPLAY_VER(i915) == 2 || DISPLAY_VER(i915) == 3)
>   		return stride == 4096 || stride == 8192;
>   
> -	if (DISPLAY_VER(i915) == 4 && !IS_G4X(i915) && stride < 2048)
> +	if (DISPLAY_VER(i915) == 4 && !IS_G4X(i915) &&
> +	    (stride < 2048 || stride > 16384))
>   		return false;
>   
>   	/* Display WA #1105: skl,bxt,kbl,cfl,glk */
> @@ -874,9 +875,6 @@ static bool stride_is_valid(const struct intel_plane_state *plane_state)
>   	    fb->modifier == DRM_FORMAT_MOD_LINEAR && stride & 511)
>   		return false;
>   
> -	if (stride > 16384)
> -		return false;
> -
>   	return true;
>   }
>
Matt Roper Sept. 15, 2023, 4:48 p.m. UTC | #2
On Thu, Sep 14, 2023 at 02:38:50PM +0300, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> The 16k max plane stride limit seems to be originally from
> i965gm, and no limit explicit limit has been specified since (g4x+).

There are maximum limits specified on the PLANE_STRIDE register pages
(bspec 7667, 50416, 69877).

display version 9 - 10:   max 8k pixels and 32k bytes
display version 11 - 12:  max 8k pixels
display version 13 - 20:  max 128k bytes


Matt

> So let's assume the max plane stride itself is a suitable limit
> also for the more recent FBC hardware.
> 
> In fact even for i965gm the max X-tiled stride is also 16k so
> technically we don't need the check there either, but let's
> keep it there anyway since it's explicitly mentioned in the
> spec. Gen2/3 have more strict limits checked separately.
> 
> Cc: Swati Sharma <swati2.sharma@intel.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_fbc.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_fbc.c b/drivers/gpu/drm/i915/display/intel_fbc.c
> index 817e5784660b..1b3358a0fbfb 100644
> --- a/drivers/gpu/drm/i915/display/intel_fbc.c
> +++ b/drivers/gpu/drm/i915/display/intel_fbc.c
> @@ -866,7 +866,8 @@ static bool stride_is_valid(const struct intel_plane_state *plane_state)
>  	if (DISPLAY_VER(i915) == 2 || DISPLAY_VER(i915) == 3)
>  		return stride == 4096 || stride == 8192;
>  
> -	if (DISPLAY_VER(i915) == 4 && !IS_G4X(i915) && stride < 2048)
> +	if (DISPLAY_VER(i915) == 4 && !IS_G4X(i915) &&
> +	    (stride < 2048 || stride > 16384))
>  		return false;
>  
>  	/* Display WA #1105: skl,bxt,kbl,cfl,glk */
> @@ -874,9 +875,6 @@ static bool stride_is_valid(const struct intel_plane_state *plane_state)
>  	    fb->modifier == DRM_FORMAT_MOD_LINEAR && stride & 511)
>  		return false;
>  
> -	if (stride > 16384)
> -		return false;
> -
>  	return true;
>  }
>  
> -- 
> 2.41.0
>
Ville Syrjala Sept. 15, 2023, 4:54 p.m. UTC | #3
On Fri, Sep 15, 2023 at 09:48:54AM -0700, Matt Roper wrote:
> On Thu, Sep 14, 2023 at 02:38:50PM +0300, Ville Syrjala wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > 
> > The 16k max plane stride limit seems to be originally from
> > i965gm, and no limit explicit limit has been specified since (g4x+).
> 
> There are maximum limits specified on the PLANE_STRIDE register pages
> (bspec 7667, 50416, 69877).
> 
> display version 9 - 10:   max 8k pixels and 32k bytes
> display version 11 - 12:  max 8k pixels
> display version 13 - 20:  max 128k bytes

Sure, but those are handled elsewhere. Here we're only
interested in limits specific to FBC.

> 
> 
> Matt
> 
> > So let's assume the max plane stride itself is a suitable limit
> > also for the more recent FBC hardware.
> > 
> > In fact even for i965gm the max X-tiled stride is also 16k so
> > technically we don't need the check there either, but let's
> > keep it there anyway since it's explicitly mentioned in the
> > spec. Gen2/3 have more strict limits checked separately.
> > 
> > Cc: Swati Sharma <swati2.sharma@intel.com>
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > ---
> >  drivers/gpu/drm/i915/display/intel_fbc.c | 6 ++----
> >  1 file changed, 2 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/display/intel_fbc.c b/drivers/gpu/drm/i915/display/intel_fbc.c
> > index 817e5784660b..1b3358a0fbfb 100644
> > --- a/drivers/gpu/drm/i915/display/intel_fbc.c
> > +++ b/drivers/gpu/drm/i915/display/intel_fbc.c
> > @@ -866,7 +866,8 @@ static bool stride_is_valid(const struct intel_plane_state *plane_state)
> >  	if (DISPLAY_VER(i915) == 2 || DISPLAY_VER(i915) == 3)
> >  		return stride == 4096 || stride == 8192;
> >  
> > -	if (DISPLAY_VER(i915) == 4 && !IS_G4X(i915) && stride < 2048)
> > +	if (DISPLAY_VER(i915) == 4 && !IS_G4X(i915) &&
> > +	    (stride < 2048 || stride > 16384))
> >  		return false;
> >  
> >  	/* Display WA #1105: skl,bxt,kbl,cfl,glk */
> > @@ -874,9 +875,6 @@ static bool stride_is_valid(const struct intel_plane_state *plane_state)
> >  	    fb->modifier == DRM_FORMAT_MOD_LINEAR && stride & 511)
> >  		return false;
> >  
> > -	if (stride > 16384)
> > -		return false;
> > -
> >  	return true;
> >  }
> >  
> > -- 
> > 2.41.0
> > 
> 
> -- 
> Matt Roper
> Graphics Software Engineer
> Linux GPU Platform Enablement
> Intel Corporation
Juha-Pekka Heikkila Sept. 29, 2023, 1:08 p.m. UTC | #4
All 5 patches look ok to me, I didn't spot anything to comment about.

Reviewed-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>

On 14.9.2023 14.38, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> The 16k max plane stride limit seems to be originally from
> i965gm, and no limit explicit limit has been specified since (g4x+).
> So let's assume the max plane stride itself is a suitable limit
> also for the more recent FBC hardware.
> 
> In fact even for i965gm the max X-tiled stride is also 16k so
> technically we don't need the check there either, but let's
> keep it there anyway since it's explicitly mentioned in the
> spec. Gen2/3 have more strict limits checked separately.
> 
> Cc: Swati Sharma <swati2.sharma@intel.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>   drivers/gpu/drm/i915/display/intel_fbc.c | 6 ++----
>   1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_fbc.c b/drivers/gpu/drm/i915/display/intel_fbc.c
> index 817e5784660b..1b3358a0fbfb 100644
> --- a/drivers/gpu/drm/i915/display/intel_fbc.c
> +++ b/drivers/gpu/drm/i915/display/intel_fbc.c
> @@ -866,7 +866,8 @@ static bool stride_is_valid(const struct intel_plane_state *plane_state)
>   	if (DISPLAY_VER(i915) == 2 || DISPLAY_VER(i915) == 3)
>   		return stride == 4096 || stride == 8192;
>   
> -	if (DISPLAY_VER(i915) == 4 && !IS_G4X(i915) && stride < 2048)
> +	if (DISPLAY_VER(i915) == 4 && !IS_G4X(i915) &&
> +	    (stride < 2048 || stride > 16384))
>   		return false;
>   
>   	/* Display WA #1105: skl,bxt,kbl,cfl,glk */
> @@ -874,9 +875,6 @@ static bool stride_is_valid(const struct intel_plane_state *plane_state)
>   	    fb->modifier == DRM_FORMAT_MOD_LINEAR && stride & 511)
>   		return false;
>   
> -	if (stride > 16384)
> -		return false;
> -
>   	return true;
>   }
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_fbc.c b/drivers/gpu/drm/i915/display/intel_fbc.c
index 817e5784660b..1b3358a0fbfb 100644
--- a/drivers/gpu/drm/i915/display/intel_fbc.c
+++ b/drivers/gpu/drm/i915/display/intel_fbc.c
@@ -866,7 +866,8 @@  static bool stride_is_valid(const struct intel_plane_state *plane_state)
 	if (DISPLAY_VER(i915) == 2 || DISPLAY_VER(i915) == 3)
 		return stride == 4096 || stride == 8192;
 
-	if (DISPLAY_VER(i915) == 4 && !IS_G4X(i915) && stride < 2048)
+	if (DISPLAY_VER(i915) == 4 && !IS_G4X(i915) &&
+	    (stride < 2048 || stride > 16384))
 		return false;
 
 	/* Display WA #1105: skl,bxt,kbl,cfl,glk */
@@ -874,9 +875,6 @@  static bool stride_is_valid(const struct intel_plane_state *plane_state)
 	    fb->modifier == DRM_FORMAT_MOD_LINEAR && stride & 511)
 		return false;
 
-	if (stride > 16384)
-		return false;
-
 	return true;
 }