aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKumar, Mahesh <[email protected]>2016-05-19 15:03:01 -0700
committerMatt Roper <[email protected]>2016-06-01 07:37:39 -0700
commit8d19d7d9dbc25d1a1ffa602ed9eff25a88c98163 (patch)
tree2d8cc813de4a5c31ecf8d6fc5f436be142688a20
parent9c2f7a9d6081072e762189a7341934d6e235cad6 (diff)
drm/i915/skl+: Use scaling amount for plane data rate calculation (v4)
if downscaling is enabled plane data rate increases according to scaling amount. take scaling amount under consideration while calculating plane data rate v2: Address Matt's comments, where data rate was overridden because of missing else. v3 (by Matt): - Add braces to 'else' branch to match kernel coding style - Adjust final calculation now that skl_plane_downscale_amount() returns 16.16 fixed point value instead of a decimal fixed point v4 (by Matt): - Avoid integer overflow by making sure final multiplication is treated as 64-bit. Cc: [email protected] Signed-off-by: Kumar, Mahesh <[email protected]> Signed-off-by: Matt Roper <[email protected]> Reviewed-by: Kumar Mahesh <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
-rw-r--r--drivers/gpu/drm/i915/intel_pm.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index ceb1eecd9dad..08274591db7e 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -2997,6 +2997,7 @@ skl_plane_relative_data_rate(const struct intel_crtc_state *cstate,
{
struct intel_plane_state *intel_pstate = to_intel_plane_state(pstate);
struct drm_framebuffer *fb = pstate->fb;
+ uint32_t down_scale_amount, data_rate;
uint32_t width = 0, height = 0;
unsigned format = fb ? fb->pixel_format : DRM_FORMAT_XRGB8888;
@@ -3016,15 +3017,19 @@ skl_plane_relative_data_rate(const struct intel_crtc_state *cstate,
/* for planar format */
if (format == DRM_FORMAT_NV12) {
if (y) /* y-plane data rate */
- return width * height *
+ data_rate = width * height *
drm_format_plane_cpp(format, 0);
else /* uv-plane data rate */
- return (width / 2) * (height / 2) *
+ data_rate = (width / 2) * (height / 2) *
drm_format_plane_cpp(format, 1);
+ } else {
+ /* for packed formats */
+ data_rate = width * height * drm_format_plane_cpp(format, 0);
}
- /* for packed formats */
- return width * height * drm_format_plane_cpp(format, 0);
+ down_scale_amount = skl_plane_downscale_amount(intel_pstate);
+
+ return (uint64_t)data_rate * down_scale_amount >> 16;
}
/*