Commit a8a3b4cd authored by Ville Syrjälä's avatar Ville Syrjälä

drm/i915/fbc: Split plane stride checks per-platform

Carve up stride_is_valid() into per-platform variants to
make it easier to see what limits are actually being imposed.

TODO: maybe go for vfuncs later
Reviewed-by: default avatarJuha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Reviewed-by: default avatarVinod Govindapillai <vinod.govindapillai@intel.com>
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20231003194256.28569-2-ville.syrjala@linux.intel.com
parent da7b3b03
...@@ -853,36 +853,70 @@ void intel_fbc_cleanup(struct drm_i915_private *i915) ...@@ -853,36 +853,70 @@ void intel_fbc_cleanup(struct drm_i915_private *i915)
} }
} }
static bool stride_is_valid(const struct intel_plane_state *plane_state) static bool i8xx_fbc_stride_is_valid(const struct intel_plane_state *plane_state)
{ {
struct drm_i915_private *i915 = to_i915(plane_state->uapi.plane->dev);
const struct drm_framebuffer *fb = plane_state->hw.fb; const struct drm_framebuffer *fb = plane_state->hw.fb;
unsigned int stride = intel_fbc_plane_stride(plane_state) * unsigned int stride = intel_fbc_plane_stride(plane_state) *
fb->format->cpp[0]; fb->format->cpp[0];
/* This should have been caught earlier. */ return stride == 4096 || stride == 8192;
if (drm_WARN_ON_ONCE(&i915->drm, (stride & (64 - 1)) != 0)) }
return false;
/* Below are the additional FBC restrictions. */ static bool i965_fbc_stride_is_valid(const struct intel_plane_state *plane_state)
if (stride < 512) {
return false; const struct drm_framebuffer *fb = plane_state->hw.fb;
unsigned int stride = intel_fbc_plane_stride(plane_state) *
fb->format->cpp[0];
if (DISPLAY_VER(i915) == 2 || DISPLAY_VER(i915) == 3) return stride >= 2048 && stride <= 16384;
return stride == 4096 || stride == 8192; }
if (DISPLAY_VER(i915) == 4 && !IS_G4X(i915) && static bool g4x_fbc_stride_is_valid(const struct intel_plane_state *plane_state)
(stride < 2048 || stride > 16384)) {
return false; return true;
}
static bool skl_fbc_stride_is_valid(const struct intel_plane_state *plane_state)
{
const struct drm_framebuffer *fb = plane_state->hw.fb;
unsigned int stride = intel_fbc_plane_stride(plane_state) *
fb->format->cpp[0];
/* Display WA #1105: skl,bxt,kbl,cfl,glk */ /* Display WA #1105: skl,bxt,kbl,cfl,glk */
if ((DISPLAY_VER(i915) == 9 || IS_GEMINILAKE(i915)) && if (fb->modifier == DRM_FORMAT_MOD_LINEAR && stride & 511)
fb->modifier == DRM_FORMAT_MOD_LINEAR && stride & 511)
return false; return false;
return true; return true;
} }
static bool icl_fbc_stride_is_valid(const struct intel_plane_state *plane_state)
{
return true;
}
static bool stride_is_valid(const struct intel_plane_state *plane_state)
{
struct drm_i915_private *i915 = to_i915(plane_state->uapi.plane->dev);
const struct drm_framebuffer *fb = plane_state->hw.fb;
unsigned int stride = intel_fbc_plane_stride(plane_state) *
fb->format->cpp[0];
/* This should have been caught earlier. */
if (drm_WARN_ON_ONCE(&i915->drm, (stride & (64 - 1)) != 0))
return false;
if (DISPLAY_VER(i915) >= 11)
return icl_fbc_stride_is_valid(plane_state);
else if (DISPLAY_VER(i915) >= 9)
return skl_fbc_stride_is_valid(plane_state);
else if (DISPLAY_VER(i915) >= 5 || IS_G4X(i915))
return g4x_fbc_stride_is_valid(plane_state);
else if (DISPLAY_VER(i915) == 4)
return i965_fbc_stride_is_valid(plane_state);
else
return i8xx_fbc_stride_is_valid(plane_state);
}
static bool pixel_format_is_valid(const struct intel_plane_state *plane_state) static bool pixel_format_is_valid(const struct intel_plane_state *plane_state)
{ {
struct drm_i915_private *i915 = to_i915(plane_state->uapi.plane->dev); struct drm_i915_private *i915 = to_i915(plane_state->uapi.plane->dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment