diff mbox series

drm/i915/display: Don't allow tile4 framebuffer to do hflip on Xe2

Message ID 20240912144606.862307-1-juhapekka.heikkila@gmail.com (mailing list archive)
State New
Headers show
Series drm/i915/display: Don't allow tile4 framebuffer to do hflip on Xe2 | expand

Commit Message

Juha-Pekka Heikkila Sept. 12, 2024, 2:46 p.m. UTC
On Intel Xe2 hw tile4 is not supported with horizontal flip

bspec 69853

Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
---
 drivers/gpu/drm/i915/display/intel_fb.c            | 13 +++++++++++++
 drivers/gpu/drm/i915/display/intel_fb.h            |  1 +
 drivers/gpu/drm/i915/display/skl_universal_plane.c | 12 ++++++++++++
 3 files changed, 26 insertions(+)

Comments

Ville Syrjälä Sept. 12, 2024, 4:22 p.m. UTC | #1
On Thu, Sep 12, 2024 at 05:46:06PM +0300, Juha-Pekka Heikkila wrote:
> On Intel Xe2 hw tile4 is not supported with horizontal flip
> 
> bspec 69853

That only seems to apply to LNL, I see no defeature noted for BMG.

Curiously they also seem to have added linear+hflip support for LNL...

> 
> Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
> ---
>  drivers/gpu/drm/i915/display/intel_fb.c            | 13 +++++++++++++
>  drivers/gpu/drm/i915/display/intel_fb.h            |  1 +
>  drivers/gpu/drm/i915/display/skl_universal_plane.c | 12 ++++++++++++
>  3 files changed, 26 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_fb.c b/drivers/gpu/drm/i915/display/intel_fb.c
> index d2ff21e98545..c9038d239eb2 100644
> --- a/drivers/gpu/drm/i915/display/intel_fb.c
> +++ b/drivers/gpu/drm/i915/display/intel_fb.c
> @@ -439,6 +439,19 @@ bool intel_fb_needs_64k_phys(u64 modifier)
>  				      INTEL_PLANE_CAP_NEED64K_PHYS);
>  }
>  
> +/**
> + * intel_fb_is_tile4_modifier: Check if a modifier is a tile4 modifier type
> + * @modifier: Modifier to check
> + *
> + * Returns:
> + * Returns %true if @modifier is a tile4 modifier.
> + */
> +bool intel_fb_is_tile4_modifier(u64 modifier)
> +{
> +	return plane_caps_contain_any(lookup_modifier(modifier)->plane_caps,
> +				      INTEL_PLANE_CAP_TILING_4);
> +}
> +
>  static bool check_modifier_display_ver_range(const struct intel_modifier_desc *md,
>  					     u8 display_ver_from, u8 display_ver_until)
>  {
> diff --git a/drivers/gpu/drm/i915/display/intel_fb.h b/drivers/gpu/drm/i915/display/intel_fb.h
> index 068f3aee99aa..bff87994cf2c 100644
> --- a/drivers/gpu/drm/i915/display/intel_fb.h
> +++ b/drivers/gpu/drm/i915/display/intel_fb.h
> @@ -35,6 +35,7 @@ bool intel_fb_is_ccs_modifier(u64 modifier);
>  bool intel_fb_is_rc_ccs_cc_modifier(u64 modifier);
>  bool intel_fb_is_mc_ccs_modifier(u64 modifier);
>  bool intel_fb_needs_64k_phys(u64 modifier);
> +bool intel_fb_is_tile4_modifier(u64 modifier);
>  
>  bool intel_fb_is_ccs_aux_plane(const struct drm_framebuffer *fb, int color_plane);
>  int intel_fb_rc_ccs_cc_plane(const struct drm_framebuffer *fb);
> diff --git a/drivers/gpu/drm/i915/display/skl_universal_plane.c b/drivers/gpu/drm/i915/display/skl_universal_plane.c
> index 17d4c880ecc4..4de41ab5060a 100644
> --- a/drivers/gpu/drm/i915/display/skl_universal_plane.c
> +++ b/drivers/gpu/drm/i915/display/skl_universal_plane.c
> @@ -1591,6 +1591,18 @@ static int skl_plane_check_fb(const struct intel_crtc_state *crtc_state,
>  		return -EINVAL;
>  	}
>  
> +	/*
> +	 * Starting with LNL and BMG tile4 hflip is not supported
> +	 */
> +	if (rotation & DRM_MODE_REFLECT_X &&
> +	    intel_fb_is_tile4_modifier(fb->modifier) &&
> +	    ((DISPLAY_VER(dev_priv) >= 14 && IS_DGFX(dev_priv)) ||
> +	     (DISPLAY_VER(dev_priv) >= 20 && !IS_DGFX(dev_priv)))) {
> +		drm_dbg_kms(&dev_priv->drm,
> +			    "horizontal flip is not supported with tile4 surface formats\n");
> +		return -EINVAL;
> +	}
> +
>  	if (drm_rotation_90_or_270(rotation)) {
>  		if (!intel_fb_supports_90_270_rotation(to_intel_framebuffer(fb))) {
>  			drm_dbg_kms(&dev_priv->drm,
> -- 
> 2.45.2
Lucas De Marchi Sept. 12, 2024, 5:14 p.m. UTC | #2
On Thu, Sep 12, 2024 at 05:46:06PM GMT, Juha-Pekka Heikkila wrote:
>On Intel Xe2 hw tile4 is not supported with horizontal flip
>
>bspec 69853

Usual spelling is: "Bspec: 69853" and as part of the trailers below.

>
>Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
>---
> drivers/gpu/drm/i915/display/intel_fb.c            | 13 +++++++++++++
> drivers/gpu/drm/i915/display/intel_fb.h            |  1 +
> drivers/gpu/drm/i915/display/skl_universal_plane.c | 12 ++++++++++++
> 3 files changed, 26 insertions(+)
>
>diff --git a/drivers/gpu/drm/i915/display/intel_fb.c b/drivers/gpu/drm/i915/display/intel_fb.c
>index d2ff21e98545..c9038d239eb2 100644
>--- a/drivers/gpu/drm/i915/display/intel_fb.c
>+++ b/drivers/gpu/drm/i915/display/intel_fb.c
>@@ -439,6 +439,19 @@ bool intel_fb_needs_64k_phys(u64 modifier)
> 				      INTEL_PLANE_CAP_NEED64K_PHYS);
> }
>
>+/**
>+ * intel_fb_is_tile4_modifier: Check if a modifier is a tile4 modifier type
>+ * @modifier: Modifier to check
>+ *
>+ * Returns:
>+ * Returns %true if @modifier is a tile4 modifier.

double Returns

>+ */
>+bool intel_fb_is_tile4_modifier(u64 modifier)
>+{
>+	return plane_caps_contain_any(lookup_modifier(modifier)->plane_caps,
>+				      INTEL_PLANE_CAP_TILING_4);
>+}
>+
> static bool check_modifier_display_ver_range(const struct intel_modifier_desc *md,
> 					     u8 display_ver_from, u8 display_ver_until)
> {
>diff --git a/drivers/gpu/drm/i915/display/intel_fb.h b/drivers/gpu/drm/i915/display/intel_fb.h
>index 068f3aee99aa..bff87994cf2c 100644
>--- a/drivers/gpu/drm/i915/display/intel_fb.h
>+++ b/drivers/gpu/drm/i915/display/intel_fb.h
>@@ -35,6 +35,7 @@ bool intel_fb_is_ccs_modifier(u64 modifier);
> bool intel_fb_is_rc_ccs_cc_modifier(u64 modifier);
> bool intel_fb_is_mc_ccs_modifier(u64 modifier);
> bool intel_fb_needs_64k_phys(u64 modifier);
>+bool intel_fb_is_tile4_modifier(u64 modifier);
>
> bool intel_fb_is_ccs_aux_plane(const struct drm_framebuffer *fb, int color_plane);
> int intel_fb_rc_ccs_cc_plane(const struct drm_framebuffer *fb);
>diff --git a/drivers/gpu/drm/i915/display/skl_universal_plane.c b/drivers/gpu/drm/i915/display/skl_universal_plane.c
>index 17d4c880ecc4..4de41ab5060a 100644
>--- a/drivers/gpu/drm/i915/display/skl_universal_plane.c
>+++ b/drivers/gpu/drm/i915/display/skl_universal_plane.c
>@@ -1591,6 +1591,18 @@ static int skl_plane_check_fb(const struct intel_crtc_state *crtc_state,
> 		return -EINVAL;
> 	}
>
>+	/*
>+	 * Starting with LNL and BMG tile4 hflip is not supported
>+	 */
>+	if (rotation & DRM_MODE_REFLECT_X &&
>+	    intel_fb_is_tile4_modifier(fb->modifier) &&
>+	    ((DISPLAY_VER(dev_priv) >= 14 && IS_DGFX(dev_priv)) ||
>+	     (DISPLAY_VER(dev_priv) >= 20 && !IS_DGFX(dev_priv)))) {

the correct bspec for BMG is 50387 where the only documented restriction is
on linear surface formats. This can rather be simplified with:

	if (rotation & DRM_MODE_REFLECT_X &&
	    intel_fb_is_tile4_modifier(fb->modifier) &&
	    DISPLAY_VER(dev_priv) >= 20)

Lucas De Marchi

>+		drm_dbg_kms(&dev_priv->drm,
>+			    "horizontal flip is not supported with tile4 surface formats\n");
>+		return -EINVAL;
>+	}
>+
> 	if (drm_rotation_90_or_270(rotation)) {
> 		if (!intel_fb_supports_90_270_rotation(to_intel_framebuffer(fb))) {
> 			drm_dbg_kms(&dev_priv->drm,
>-- 
>2.45.2
>
Matt Roper Sept. 12, 2024, 7:50 p.m. UTC | #3
On Thu, Sep 12, 2024 at 05:46:06PM +0300, Juha-Pekka Heikkila wrote:
> On Intel Xe2 hw tile4 is not supported with horizontal flip
> 
> bspec 69853

The notes on this page seem to say that, but there's also bspec 68904
which seems to have two two conflicting statements that apply to Xe2:

        "Horizontal flip (mirror the image from right to left) supported
        with tile modes other than linear."

implies this _is_ supported for Tile4 (and TileX), but immediately below
that,

        "Horizontal flip (mirror the image from right to left) is not
        supported with tile mode of Tile4.  Horizontal flip (mirror the
        image from right to left) is supported with tile mode of
        linear."

says pretty much the opposite for Tile4 and linear.

It might be worth explicitly confirming this with the hardware guys and
getting them to re-visit the tagging of these bspec pages to avoid the
conflicting information.


Matt

> 
> Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
> ---
>  drivers/gpu/drm/i915/display/intel_fb.c            | 13 +++++++++++++
>  drivers/gpu/drm/i915/display/intel_fb.h            |  1 +
>  drivers/gpu/drm/i915/display/skl_universal_plane.c | 12 ++++++++++++
>  3 files changed, 26 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_fb.c b/drivers/gpu/drm/i915/display/intel_fb.c
> index d2ff21e98545..c9038d239eb2 100644
> --- a/drivers/gpu/drm/i915/display/intel_fb.c
> +++ b/drivers/gpu/drm/i915/display/intel_fb.c
> @@ -439,6 +439,19 @@ bool intel_fb_needs_64k_phys(u64 modifier)
>  				      INTEL_PLANE_CAP_NEED64K_PHYS);
>  }
>  
> +/**
> + * intel_fb_is_tile4_modifier: Check if a modifier is a tile4 modifier type
> + * @modifier: Modifier to check
> + *
> + * Returns:
> + * Returns %true if @modifier is a tile4 modifier.
> + */
> +bool intel_fb_is_tile4_modifier(u64 modifier)
> +{
> +	return plane_caps_contain_any(lookup_modifier(modifier)->plane_caps,
> +				      INTEL_PLANE_CAP_TILING_4);
> +}
> +
>  static bool check_modifier_display_ver_range(const struct intel_modifier_desc *md,
>  					     u8 display_ver_from, u8 display_ver_until)
>  {
> diff --git a/drivers/gpu/drm/i915/display/intel_fb.h b/drivers/gpu/drm/i915/display/intel_fb.h
> index 068f3aee99aa..bff87994cf2c 100644
> --- a/drivers/gpu/drm/i915/display/intel_fb.h
> +++ b/drivers/gpu/drm/i915/display/intel_fb.h
> @@ -35,6 +35,7 @@ bool intel_fb_is_ccs_modifier(u64 modifier);
>  bool intel_fb_is_rc_ccs_cc_modifier(u64 modifier);
>  bool intel_fb_is_mc_ccs_modifier(u64 modifier);
>  bool intel_fb_needs_64k_phys(u64 modifier);
> +bool intel_fb_is_tile4_modifier(u64 modifier);
>  
>  bool intel_fb_is_ccs_aux_plane(const struct drm_framebuffer *fb, int color_plane);
>  int intel_fb_rc_ccs_cc_plane(const struct drm_framebuffer *fb);
> diff --git a/drivers/gpu/drm/i915/display/skl_universal_plane.c b/drivers/gpu/drm/i915/display/skl_universal_plane.c
> index 17d4c880ecc4..4de41ab5060a 100644
> --- a/drivers/gpu/drm/i915/display/skl_universal_plane.c
> +++ b/drivers/gpu/drm/i915/display/skl_universal_plane.c
> @@ -1591,6 +1591,18 @@ static int skl_plane_check_fb(const struct intel_crtc_state *crtc_state,
>  		return -EINVAL;
>  	}
>  
> +	/*
> +	 * Starting with LNL and BMG tile4 hflip is not supported
> +	 */
> +	if (rotation & DRM_MODE_REFLECT_X &&
> +	    intel_fb_is_tile4_modifier(fb->modifier) &&
> +	    ((DISPLAY_VER(dev_priv) >= 14 && IS_DGFX(dev_priv)) ||
> +	     (DISPLAY_VER(dev_priv) >= 20 && !IS_DGFX(dev_priv)))) {
> +		drm_dbg_kms(&dev_priv->drm,
> +			    "horizontal flip is not supported with tile4 surface formats\n");
> +		return -EINVAL;
> +	}
> +
>  	if (drm_rotation_90_or_270(rotation)) {
>  		if (!intel_fb_supports_90_270_rotation(to_intel_framebuffer(fb))) {
>  			drm_dbg_kms(&dev_priv->drm,
> -- 
> 2.45.2
>
Juha-Pekka Heikkila Sept. 13, 2024, 11:40 a.m. UTC | #4
On 12.9.2024 22.50, Matt Roper wrote:
> On Thu, Sep 12, 2024 at 05:46:06PM +0300, Juha-Pekka Heikkila wrote:
>> On Intel Xe2 hw tile4 is not supported with horizontal flip
>>
>> bspec 69853
> 
> The notes on this page seem to say that, but there's also bspec 68904
> which seems to have two two conflicting statements that apply to Xe2:
> 
>          "Horizontal flip (mirror the image from right to left) supported
>          with tile modes other than linear."
> 
> implies this _is_ supported for Tile4 (and TileX), but immediately below
> that,
> 
>          "Horizontal flip (mirror the image from right to left) is not
>          supported with tile mode of Tile4.  Horizontal flip (mirror the
>          image from right to left) is supported with tile mode of
>          linear."
> 
> says pretty much the opposite for Tile4 and linear.
> 
> It might be worth explicitly confirming this with the hardware guys and
> getting them to re-visit the tagging of these bspec pages to avoid the
> conflicting information.
> 

Thanks Matt, I think I'll need to start to bother hw guys with this 
issue to get clarity. Lucas also pointed this is not a limitation on BMG 
but I see LNL and BMG failing same way even if one is display 20 and 
other is display 14 .. and MTL display 14 does work with hflip + tile4.

/Juha-Pekka

> 
>>
>> Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
>> ---
>>   drivers/gpu/drm/i915/display/intel_fb.c            | 13 +++++++++++++
>>   drivers/gpu/drm/i915/display/intel_fb.h            |  1 +
>>   drivers/gpu/drm/i915/display/skl_universal_plane.c | 12 ++++++++++++
>>   3 files changed, 26 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/i915/display/intel_fb.c b/drivers/gpu/drm/i915/display/intel_fb.c
>> index d2ff21e98545..c9038d239eb2 100644
>> --- a/drivers/gpu/drm/i915/display/intel_fb.c
>> +++ b/drivers/gpu/drm/i915/display/intel_fb.c
>> @@ -439,6 +439,19 @@ bool intel_fb_needs_64k_phys(u64 modifier)
>>   				      INTEL_PLANE_CAP_NEED64K_PHYS);
>>   }
>>   
>> +/**
>> + * intel_fb_is_tile4_modifier: Check if a modifier is a tile4 modifier type
>> + * @modifier: Modifier to check
>> + *
>> + * Returns:
>> + * Returns %true if @modifier is a tile4 modifier.
>> + */
>> +bool intel_fb_is_tile4_modifier(u64 modifier)
>> +{
>> +	return plane_caps_contain_any(lookup_modifier(modifier)->plane_caps,
>> +				      INTEL_PLANE_CAP_TILING_4);
>> +}
>> +
>>   static bool check_modifier_display_ver_range(const struct intel_modifier_desc *md,
>>   					     u8 display_ver_from, u8 display_ver_until)
>>   {
>> diff --git a/drivers/gpu/drm/i915/display/intel_fb.h b/drivers/gpu/drm/i915/display/intel_fb.h
>> index 068f3aee99aa..bff87994cf2c 100644
>> --- a/drivers/gpu/drm/i915/display/intel_fb.h
>> +++ b/drivers/gpu/drm/i915/display/intel_fb.h
>> @@ -35,6 +35,7 @@ bool intel_fb_is_ccs_modifier(u64 modifier);
>>   bool intel_fb_is_rc_ccs_cc_modifier(u64 modifier);
>>   bool intel_fb_is_mc_ccs_modifier(u64 modifier);
>>   bool intel_fb_needs_64k_phys(u64 modifier);
>> +bool intel_fb_is_tile4_modifier(u64 modifier);
>>   
>>   bool intel_fb_is_ccs_aux_plane(const struct drm_framebuffer *fb, int color_plane);
>>   int intel_fb_rc_ccs_cc_plane(const struct drm_framebuffer *fb);
>> diff --git a/drivers/gpu/drm/i915/display/skl_universal_plane.c b/drivers/gpu/drm/i915/display/skl_universal_plane.c
>> index 17d4c880ecc4..4de41ab5060a 100644
>> --- a/drivers/gpu/drm/i915/display/skl_universal_plane.c
>> +++ b/drivers/gpu/drm/i915/display/skl_universal_plane.c
>> @@ -1591,6 +1591,18 @@ static int skl_plane_check_fb(const struct intel_crtc_state *crtc_state,
>>   		return -EINVAL;
>>   	}
>>   
>> +	/*
>> +	 * Starting with LNL and BMG tile4 hflip is not supported
>> +	 */
>> +	if (rotation & DRM_MODE_REFLECT_X &&
>> +	    intel_fb_is_tile4_modifier(fb->modifier) &&
>> +	    ((DISPLAY_VER(dev_priv) >= 14 && IS_DGFX(dev_priv)) ||
>> +	     (DISPLAY_VER(dev_priv) >= 20 && !IS_DGFX(dev_priv)))) {
>> +		drm_dbg_kms(&dev_priv->drm,
>> +			    "horizontal flip is not supported with tile4 surface formats\n");
>> +		return -EINVAL;
>> +	}
>> +
>>   	if (drm_rotation_90_or_270(rotation)) {
>>   		if (!intel_fb_supports_90_270_rotation(to_intel_framebuffer(fb))) {
>>   			drm_dbg_kms(&dev_priv->drm,
>> -- 
>> 2.45.2
>>
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_fb.c b/drivers/gpu/drm/i915/display/intel_fb.c
index d2ff21e98545..c9038d239eb2 100644
--- a/drivers/gpu/drm/i915/display/intel_fb.c
+++ b/drivers/gpu/drm/i915/display/intel_fb.c
@@ -439,6 +439,19 @@  bool intel_fb_needs_64k_phys(u64 modifier)
 				      INTEL_PLANE_CAP_NEED64K_PHYS);
 }
 
+/**
+ * intel_fb_is_tile4_modifier: Check if a modifier is a tile4 modifier type
+ * @modifier: Modifier to check
+ *
+ * Returns:
+ * Returns %true if @modifier is a tile4 modifier.
+ */
+bool intel_fb_is_tile4_modifier(u64 modifier)
+{
+	return plane_caps_contain_any(lookup_modifier(modifier)->plane_caps,
+				      INTEL_PLANE_CAP_TILING_4);
+}
+
 static bool check_modifier_display_ver_range(const struct intel_modifier_desc *md,
 					     u8 display_ver_from, u8 display_ver_until)
 {
diff --git a/drivers/gpu/drm/i915/display/intel_fb.h b/drivers/gpu/drm/i915/display/intel_fb.h
index 068f3aee99aa..bff87994cf2c 100644
--- a/drivers/gpu/drm/i915/display/intel_fb.h
+++ b/drivers/gpu/drm/i915/display/intel_fb.h
@@ -35,6 +35,7 @@  bool intel_fb_is_ccs_modifier(u64 modifier);
 bool intel_fb_is_rc_ccs_cc_modifier(u64 modifier);
 bool intel_fb_is_mc_ccs_modifier(u64 modifier);
 bool intel_fb_needs_64k_phys(u64 modifier);
+bool intel_fb_is_tile4_modifier(u64 modifier);
 
 bool intel_fb_is_ccs_aux_plane(const struct drm_framebuffer *fb, int color_plane);
 int intel_fb_rc_ccs_cc_plane(const struct drm_framebuffer *fb);
diff --git a/drivers/gpu/drm/i915/display/skl_universal_plane.c b/drivers/gpu/drm/i915/display/skl_universal_plane.c
index 17d4c880ecc4..4de41ab5060a 100644
--- a/drivers/gpu/drm/i915/display/skl_universal_plane.c
+++ b/drivers/gpu/drm/i915/display/skl_universal_plane.c
@@ -1591,6 +1591,18 @@  static int skl_plane_check_fb(const struct intel_crtc_state *crtc_state,
 		return -EINVAL;
 	}
 
+	/*
+	 * Starting with LNL and BMG tile4 hflip is not supported
+	 */
+	if (rotation & DRM_MODE_REFLECT_X &&
+	    intel_fb_is_tile4_modifier(fb->modifier) &&
+	    ((DISPLAY_VER(dev_priv) >= 14 && IS_DGFX(dev_priv)) ||
+	     (DISPLAY_VER(dev_priv) >= 20 && !IS_DGFX(dev_priv)))) {
+		drm_dbg_kms(&dev_priv->drm,
+			    "horizontal flip is not supported with tile4 surface formats\n");
+		return -EINVAL;
+	}
+
 	if (drm_rotation_90_or_270(rotation)) {
 		if (!intel_fb_supports_90_270_rotation(to_intel_framebuffer(fb))) {
 			drm_dbg_kms(&dev_priv->drm,