Commit 2aa0f4fa authored by Ville Syrjälä's avatar Ville Syrjälä

drm/i915: WARN if plane src coords are too big

Inform us if we're buggy and are about to exceed the size of the
bitfields in the plane TILEOFF/OFFSET registers.
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210111163711.12913-2-ville.syrjala@linux.intel.comReviewed-by: default avatarKarthik B S <karthik.b.s@intel.com>
parent 784953a4
...@@ -276,6 +276,13 @@ int i9xx_check_plane_surface(struct intel_plane_state *plane_state) ...@@ -276,6 +276,13 @@ int i9xx_check_plane_surface(struct intel_plane_state *plane_state)
} }
} }
if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv)) {
drm_WARN_ON(&dev_priv->drm, src_x > 8191 || src_y > 4095);
} else if (INTEL_GEN(dev_priv) >= 4 &&
fb->modifier == I915_FORMAT_MOD_X_TILED) {
drm_WARN_ON(&dev_priv->drm, src_x > 4095 || src_y > 4095);
}
plane_state->color_plane[0].offset = offset; plane_state->color_plane[0].offset = offset;
plane_state->color_plane[0].x = src_x; plane_state->color_plane[0].x = src_x;
plane_state->color_plane[0].y = src_y; plane_state->color_plane[0].y = src_y;
......
...@@ -3089,6 +3089,8 @@ static int skl_check_main_surface(struct intel_plane_state *plane_state) ...@@ -3089,6 +3089,8 @@ static int skl_check_main_surface(struct intel_plane_state *plane_state)
} }
} }
drm_WARN_ON(&dev_priv->drm, x > 8191 || y > 8191);
plane_state->color_plane[0].offset = offset; plane_state->color_plane[0].offset = offset;
plane_state->color_plane[0].x = x; plane_state->color_plane[0].x = x;
plane_state->color_plane[0].y = y; plane_state->color_plane[0].y = y;
...@@ -3161,6 +3163,8 @@ static int skl_check_nv12_aux_surface(struct intel_plane_state *plane_state) ...@@ -3161,6 +3163,8 @@ static int skl_check_nv12_aux_surface(struct intel_plane_state *plane_state)
} }
} }
drm_WARN_ON(&i915->drm, x > 8191 || y > 8191);
plane_state->color_plane[uv_plane].offset = offset; plane_state->color_plane[uv_plane].offset = offset;
plane_state->color_plane[uv_plane].x = x; plane_state->color_plane[uv_plane].x = x;
plane_state->color_plane[uv_plane].y = y; plane_state->color_plane[uv_plane].y = y;
......
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