Commit 372b9ffb authored by Ville Syrjälä's avatar Ville Syrjälä

drm/i915: Fix skl+ max plane width

The spec has changed since skl_max_plane_width() was written.
Now the SKL limits are lower than what they were initially, and
GLK and ICL have different limits. Update the code to match the
spec.
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190418195907.23912-1-ville.syrjala@linux.intel.comReviewed-by: default avatarJosé Roberto de Souza <jose.souza@intel.com>
parent 9c11b121
...@@ -2964,41 +2964,55 @@ static int skl_max_plane_width(const struct drm_framebuffer *fb, ...@@ -2964,41 +2964,55 @@ static int skl_max_plane_width(const struct drm_framebuffer *fb,
switch (fb->modifier) { switch (fb->modifier) {
case DRM_FORMAT_MOD_LINEAR: case DRM_FORMAT_MOD_LINEAR:
case I915_FORMAT_MOD_X_TILED: case I915_FORMAT_MOD_X_TILED:
switch (cpp) {
case 8:
return 4096; return 4096;
case 4:
case 2:
case 1:
return 8192;
default:
MISSING_CASE(cpp);
break;
}
break;
case I915_FORMAT_MOD_Y_TILED_CCS: case I915_FORMAT_MOD_Y_TILED_CCS:
case I915_FORMAT_MOD_Yf_TILED_CCS: case I915_FORMAT_MOD_Yf_TILED_CCS:
/* FIXME AUX plane? */ /* FIXME AUX plane? */
case I915_FORMAT_MOD_Y_TILED: case I915_FORMAT_MOD_Y_TILED:
case I915_FORMAT_MOD_Yf_TILED: case I915_FORMAT_MOD_Yf_TILED:
switch (cpp) { if (cpp == 8)
case 8:
return 2048; return 2048;
case 4: else
return 4096; return 4096;
case 2:
case 1:
return 8192;
default: default:
MISSING_CASE(cpp); MISSING_CASE(fb->modifier);
break; return 2048;
} }
break; }
static int glk_max_plane_width(const struct drm_framebuffer *fb,
int color_plane,
unsigned int rotation)
{
int cpp = fb->format->cpp[color_plane];
switch (fb->modifier) {
case DRM_FORMAT_MOD_LINEAR:
case I915_FORMAT_MOD_X_TILED:
if (cpp == 8)
return 4096;
else
return 5120;
case I915_FORMAT_MOD_Y_TILED_CCS:
case I915_FORMAT_MOD_Yf_TILED_CCS:
/* FIXME AUX plane? */
case I915_FORMAT_MOD_Y_TILED:
case I915_FORMAT_MOD_Yf_TILED:
if (cpp == 8)
return 2048;
else
return 5120;
default: default:
MISSING_CASE(fb->modifier); MISSING_CASE(fb->modifier);
return 2048;
} }
}
return 2048; static int icl_max_plane_width(const struct drm_framebuffer *fb,
int color_plane,
unsigned int rotation)
{
return 5120;
} }
static bool skl_check_main_ccs_coordinates(struct intel_plane_state *plane_state, static bool skl_check_main_ccs_coordinates(struct intel_plane_state *plane_state,
...@@ -3041,16 +3055,24 @@ static bool skl_check_main_ccs_coordinates(struct intel_plane_state *plane_state ...@@ -3041,16 +3055,24 @@ static bool skl_check_main_ccs_coordinates(struct intel_plane_state *plane_state
static int skl_check_main_surface(struct intel_plane_state *plane_state) static int skl_check_main_surface(struct intel_plane_state *plane_state)
{ {
struct drm_i915_private *dev_priv = to_i915(plane_state->base.plane->dev);
const struct drm_framebuffer *fb = plane_state->base.fb; const struct drm_framebuffer *fb = plane_state->base.fb;
unsigned int rotation = plane_state->base.rotation; unsigned int rotation = plane_state->base.rotation;
int x = plane_state->base.src.x1 >> 16; int x = plane_state->base.src.x1 >> 16;
int y = plane_state->base.src.y1 >> 16; int y = plane_state->base.src.y1 >> 16;
int w = drm_rect_width(&plane_state->base.src) >> 16; int w = drm_rect_width(&plane_state->base.src) >> 16;
int h = drm_rect_height(&plane_state->base.src) >> 16; int h = drm_rect_height(&plane_state->base.src) >> 16;
int max_width = skl_max_plane_width(fb, 0, rotation); int max_width;
int max_height = 4096; int max_height = 4096;
u32 alignment, offset, aux_offset = plane_state->color_plane[1].offset; u32 alignment, offset, aux_offset = plane_state->color_plane[1].offset;
if (INTEL_GEN(dev_priv) >= 11)
max_width = icl_max_plane_width(fb, 0, rotation);
else if (INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv))
max_width = glk_max_plane_width(fb, 0, rotation);
else
max_width = skl_max_plane_width(fb, 0, rotation);
if (w > max_width || h > max_height) { if (w > max_width || h > max_height) {
DRM_DEBUG_KMS("requested Y/RGB source size %dx%d too big (limit %dx%d)\n", DRM_DEBUG_KMS("requested Y/RGB source size %dx%d too big (limit %dx%d)\n",
w, h, max_width, max_height); w, h, max_width, max_height);
......
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