Skip to content

Commit

Permalink
drm/i915: WARN if plane src coords are too big
Browse files Browse the repository at this point in the history
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: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210111163711.12913-2-ville.syrjala@linux.intel.com
Reviewed-by: Karthik B S <karthik.b.s@intel.com>
  • Loading branch information
Ville Syrjälä committed Jan 27, 2021
1 parent 784953a commit 2aa0f4f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
7 changes: 7 additions & 0 deletions drivers/gpu/drm/i915/display/i9xx_plane.c
Original file line number Diff line number Diff line change
Expand Up @@ -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].x = src_x;
plane_state->color_plane[0].y = src_y;
Expand Down
4 changes: 4 additions & 0 deletions drivers/gpu/drm/i915/display/intel_display.c
Original file line number Diff line number Diff line change
Expand Up @@ -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].x = x;
plane_state->color_plane[0].y = y;
Expand Down Expand Up @@ -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].x = x;
plane_state->color_plane[uv_plane].y = y;
Expand Down

0 comments on commit 2aa0f4f

Please sign in to comment.