summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVille Syrjälä <ville.syrjala@linux.intel.com>2024-07-05 17:52:45 +0300
committerVille Syrjälä <ville.syrjala@linux.intel.com>2024-07-12 15:13:15 +0300
commitf89d7664c3617836aecd291c56c8ab63fe228fbd (patch)
treea9eaadb1112d2d270fa03b1f9462526634cd1092
parent4290eaa8424905dcee4daa0666ec841dc3a0bfb3 (diff)
downloadlinux-f89d7664c3617836aecd291c56c8ab63fe228fbd.tar.gz
linux-f89d7664c3617836aecd291c56c8ab63fe228fbd.tar.bz2
linux-f89d7664c3617836aecd291c56c8ab63fe228fbd.zip
drm/i915/fbc: Extract intel_fbc_max_cfb_height()
Pull the code to determine the maximum CFB height into a separate function. To make this work we need to declare an explicit max height for all older platforms as well. But that is actually just the max plane height as pre-HSW hardware supposedly doesn't have the trick of leaving the extra lines uncompressed. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20240705145254.3355-12-ville.syrjala@linux.intel.com Reviewed-by: Uma Shankar <uma.shankar@intel.com>
-rw-r--r--drivers/gpu/drm/i915/display/intel_fbc.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/drivers/gpu/drm/i915/display/intel_fbc.c b/drivers/gpu/drm/i915/display/intel_fbc.c
index 737e3c1e2304..4d83a7e92144 100644
--- a/drivers/gpu/drm/i915/display/intel_fbc.c
+++ b/drivers/gpu/drm/i915/display/intel_fbc.c
@@ -200,17 +200,30 @@ static unsigned int intel_fbc_cfb_stride(const struct intel_plane_state *plane_s
return _intel_fbc_cfb_stride(display, width, stride);
}
-static unsigned int intel_fbc_cfb_size(const struct intel_plane_state *plane_state)
+/*
+ * Maximum height the hardware will compress, on HSW+
+ * additional lines (up to the actual plane height) will
+ * remain uncompressed.
+ */
+static unsigned int intel_fbc_max_cfb_height(struct intel_display *display)
{
- struct intel_display *display = to_intel_display(plane_state->uapi.plane->dev);
- int height = drm_rect_height(&plane_state->uapi.src) >> 16;
+ struct drm_i915_private *i915 = to_i915(display->drm);
if (DISPLAY_VER(display) >= 8)
- height = min(height, 2560);
- else if (DISPLAY_VER(display) == 7)
- height = min(height, 2048);
+ return 2560;
+ else if (DISPLAY_VER(display) >= 5 || IS_G4X(i915))
+ return 2048;
+ else
+ return 1536;
+}
+
+static unsigned int intel_fbc_cfb_size(const struct intel_plane_state *plane_state)
+{
+ struct intel_display *display = to_intel_display(plane_state->uapi.plane->dev);
+ unsigned int height = drm_rect_height(&plane_state->uapi.src) >> 16;
- return height * intel_fbc_cfb_stride(plane_state);
+ return min(height, intel_fbc_max_cfb_height(display)) *
+ intel_fbc_cfb_stride(plane_state);
}
static u16 intel_fbc_override_cfb_stride(const struct intel_plane_state *plane_state)