diff mbox series

drm/i915: Start using plane scale factor for relative data rate

Message ID 20230719104833.25366-1-stanislav.lisovskiy@intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915: Start using plane scale factor for relative data rate | expand

Commit Message

Stanislav Lisovskiy July 19, 2023, 10:48 a.m. UTC
BSpec clearly instructs us to use plane scale factor when calculating
relative data rate to be used when allocating DDB blocks for each plane.
For some reason we use scale factor for data_rate calculation, which is
used for BW calculations, however we are not using it for DDB calculations.
So lets fix it as described in BSpec 68907.

Signed-off-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
---
 drivers/gpu/drm/i915/display/intel_atomic_plane.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Nemesa Garg July 19, 2023, 10:56 a.m. UTC | #1
> -----Original Message-----
> From: Lisovskiy, Stanislav <stanislav.lisovskiy@intel.com>
> Sent: Wednesday, July 19, 2023 4:19 PM
> To: intel-gfx@lists.freedesktop.org
> Cc: Lisovskiy, Stanislav <stanislav.lisovskiy@intel.com>; Saarinen, Jani
> <jani.saarinen@intel.com>; Garg, Nemesa <nemesa.garg@intel.com>
> Subject: [PATCH] drm/i915: Start using plane scale factor for relative data
> rate
> 
> BSpec clearly instructs us to use plane scale factor when calculating relative
> data rate to be used when allocating DDB blocks for each plane.
> For some reason we use scale factor for data_rate calculation, which is used
> for BW calculations, however we are not using it for DDB calculations.
> So lets fix it as described in BSpec 68907.
> 
> Signed-off-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_atomic_plane.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_atomic_plane.c
> b/drivers/gpu/drm/i915/display/intel_atomic_plane.c
> index 7d9578ebae556..60a492e186ab8 100644
> --- a/drivers/gpu/drm/i915/display/intel_atomic_plane.c
> +++ b/drivers/gpu/drm/i915/display/intel_atomic_plane.c
> @@ -212,6 +212,7 @@ intel_plane_relative_data_rate(const struct
> intel_crtc_state *crtc_state,
>  	struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
>  	const struct drm_framebuffer *fb = plane_state->hw.fb;
>  	int width, height;
> +	unsigned int rel_data_rate;
> 
>  	if (plane->id == PLANE_CURSOR)
>  		return 0;
> @@ -241,7 +242,11 @@ intel_plane_relative_data_rate(const struct
> intel_crtc_state *crtc_state,
>  		height /= 2;
>  	}
> 
> -	return width * height * fb->format->cpp[color_plane];
> +	rel_data_rate = width * height * fb->format->cpp[color_plane];
> +
> +	return intel_adjusted_rate(&plane_state->uapi.src,
> +				   &plane_state->uapi.dst,
> +				   rel_data_rate);
>  }
> 
LGTM
Reviewed-by: Garg, Nemesa <nemesa.garg@intel.com>

Thanks and Regards,
Nemesa
>  int intel_plane_calc_min_cdclk(struct intel_atomic_state *state,
> --
> 2.37.3
Stanislav Lisovskiy July 20, 2023, 8:02 a.m. UTC | #2
On Wed, Jul 19, 2023 at 01:48:33PM +0300, Stanislav Lisovskiy wrote:
> BSpec clearly instructs us to use plane scale factor when calculating
> relative data rate to be used when allocating DDB blocks for each plane.
> For some reason we use scale factor for data_rate calculation, which is
> used for BW calculations, however we are not using it for DDB calculations.
> So lets fix it as described in BSpec 68907.
> 
> Signed-off-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_atomic_plane.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_atomic_plane.c b/drivers/gpu/drm/i915/display/intel_atomic_plane.c
> index 7d9578ebae556..60a492e186ab8 100644
> --- a/drivers/gpu/drm/i915/display/intel_atomic_plane.c
> +++ b/drivers/gpu/drm/i915/display/intel_atomic_plane.c
> @@ -212,6 +212,7 @@ intel_plane_relative_data_rate(const struct intel_crtc_state *crtc_state,
>  	struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
>  	const struct drm_framebuffer *fb = plane_state->hw.fb;
>  	int width, height;
> +	unsigned int rel_data_rate;
>  
>  	if (plane->id == PLANE_CURSOR)
>  		return 0;
> @@ -241,7 +242,11 @@ intel_plane_relative_data_rate(const struct intel_crtc_state *crtc_state,
>  		height /= 2;
>  	}
>  
> -	return width * height * fb->format->cpp[color_plane];
> +	rel_data_rate = width * height * fb->format->cpp[color_plane];
> +
> +	return intel_adjusted_rate(&plane_state->uapi.src,
> +				   &plane_state->uapi.dst,
> +				   rel_data_rate);
>  }
>  
>  int intel_plane_calc_min_cdclk(struct intel_atomic_state *state,
> -- 
> 2.37.3
> 

IGT failures are irrelevant here(test is aborted due to some timeout issue).
Jani Nikula Aug. 11, 2023, 9:18 a.m. UTC | #3
On Thu, 20 Jul 2023, "Lisovskiy, Stanislav" <stanislav.lisovskiy@intel.com> wrote:
> On Wed, Jul 19, 2023 at 01:48:33PM +0300, Stanislav Lisovskiy wrote:
>> BSpec clearly instructs us to use plane scale factor when calculating
>> relative data rate to be used when allocating DDB blocks for each plane.
>> For some reason we use scale factor for data_rate calculation, which is
>> used for BW calculations, however we are not using it for DDB calculations.
>> So lets fix it as described in BSpec 68907.
>> 
>> Signed-off-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
>> ---
>>  drivers/gpu/drm/i915/display/intel_atomic_plane.c | 7 ++++++-
>>  1 file changed, 6 insertions(+), 1 deletion(-)
>> 
>> diff --git a/drivers/gpu/drm/i915/display/intel_atomic_plane.c b/drivers/gpu/drm/i915/display/intel_atomic_plane.c
>> index 7d9578ebae556..60a492e186ab8 100644
>> --- a/drivers/gpu/drm/i915/display/intel_atomic_plane.c
>> +++ b/drivers/gpu/drm/i915/display/intel_atomic_plane.c
>> @@ -212,6 +212,7 @@ intel_plane_relative_data_rate(const struct intel_crtc_state *crtc_state,
>>  	struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
>>  	const struct drm_framebuffer *fb = plane_state->hw.fb;
>>  	int width, height;
>> +	unsigned int rel_data_rate;
>>  
>>  	if (plane->id == PLANE_CURSOR)
>>  		return 0;
>> @@ -241,7 +242,11 @@ intel_plane_relative_data_rate(const struct intel_crtc_state *crtc_state,
>>  		height /= 2;
>>  	}
>>  
>> -	return width * height * fb->format->cpp[color_plane];
>> +	rel_data_rate = width * height * fb->format->cpp[color_plane];
>> +
>> +	return intel_adjusted_rate(&plane_state->uapi.src,
>> +				   &plane_state->uapi.dst,
>> +				   rel_data_rate);
>>  }
>>  
>>  int intel_plane_calc_min_cdclk(struct intel_atomic_state *state,
>> -- 
>> 2.37.3
>> 
>
> IGT failures are irrelevant here(test is aborted due to some timeout issue).

Going through old mails... I think errors like that still warrant a
retest before merging, because it can mask real issues that now won't
get tested.

BR,
Jani.
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_atomic_plane.c b/drivers/gpu/drm/i915/display/intel_atomic_plane.c
index 7d9578ebae556..60a492e186ab8 100644
--- a/drivers/gpu/drm/i915/display/intel_atomic_plane.c
+++ b/drivers/gpu/drm/i915/display/intel_atomic_plane.c
@@ -212,6 +212,7 @@  intel_plane_relative_data_rate(const struct intel_crtc_state *crtc_state,
 	struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
 	const struct drm_framebuffer *fb = plane_state->hw.fb;
 	int width, height;
+	unsigned int rel_data_rate;
 
 	if (plane->id == PLANE_CURSOR)
 		return 0;
@@ -241,7 +242,11 @@  intel_plane_relative_data_rate(const struct intel_crtc_state *crtc_state,
 		height /= 2;
 	}
 
-	return width * height * fb->format->cpp[color_plane];
+	rel_data_rate = width * height * fb->format->cpp[color_plane];
+
+	return intel_adjusted_rate(&plane_state->uapi.src,
+				   &plane_state->uapi.dst,
+				   rel_data_rate);
 }
 
 int intel_plane_calc_min_cdclk(struct intel_atomic_state *state,