mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-04-27 15:08:10 -04:00
drm/msm/dpu: simplify dpu_plane_validate_src()
The plane's clipped coordinates has already been validated against FB size in the drm_atomic_plane_check(). There is no need to check them again. Remove corresponding checks and inline dpu_plane_validate_src(). Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com> Tested-by: Abhinav Kumar <quic_abhinavk@quicinc.com> # sc7280 Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Patchwork: https://patchwork.freedesktop.org/patch/527364/ Link: https://lore.kernel.org/r/20230316161653.4106395-22-dmitry.baryshkov@linaro.org Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
This commit is contained in:
@@ -895,25 +895,6 @@ static void dpu_plane_cleanup_fb(struct drm_plane *plane,
|
||||
old_pstate->needs_dirtyfb);
|
||||
}
|
||||
|
||||
static bool dpu_plane_validate_src(struct drm_rect *src,
|
||||
struct drm_rect *fb_rect,
|
||||
uint32_t min_src_size)
|
||||
{
|
||||
/* Ensure fb size is supported */
|
||||
if (drm_rect_width(fb_rect) > MAX_IMG_WIDTH ||
|
||||
drm_rect_height(fb_rect) > MAX_IMG_HEIGHT)
|
||||
return false;
|
||||
|
||||
/* Ensure src rect is above the minimum size */
|
||||
if (drm_rect_width(src) < min_src_size ||
|
||||
drm_rect_height(src) < min_src_size)
|
||||
return false;
|
||||
|
||||
/* Ensure src is fully encapsulated in fb */
|
||||
return drm_rect_intersect(fb_rect, src) &&
|
||||
drm_rect_equals(fb_rect, src);
|
||||
}
|
||||
|
||||
static int dpu_plane_check_inline_rotation(struct dpu_plane *pdpu,
|
||||
const struct dpu_sspp_sub_blks *sblk,
|
||||
struct drm_rect src, const struct dpu_format *fmt)
|
||||
@@ -999,6 +980,14 @@ static int dpu_plane_atomic_check(struct drm_plane *plane,
|
||||
fb_rect.x2 = new_plane_state->fb->width;
|
||||
fb_rect.y2 = new_plane_state->fb->height;
|
||||
|
||||
/* Ensure fb size is supported */
|
||||
if (drm_rect_width(&fb_rect) > MAX_IMG_WIDTH ||
|
||||
drm_rect_height(&fb_rect) > MAX_IMG_HEIGHT) {
|
||||
DPU_DEBUG_PLANE(pdpu, "invalid framebuffer " DRM_RECT_FMT "\n",
|
||||
DRM_RECT_ARG(&fb_rect));
|
||||
return -E2BIG;
|
||||
}
|
||||
|
||||
max_linewidth = pdpu->catalog->caps->max_linewidth;
|
||||
|
||||
fmt = to_dpu_format(msm_framebuffer_format(new_plane_state->fb));
|
||||
@@ -1013,7 +1002,8 @@ static int dpu_plane_atomic_check(struct drm_plane *plane,
|
||||
return -EINVAL;
|
||||
|
||||
/* check src bounds */
|
||||
} else if (!dpu_plane_validate_src(&pipe_cfg->src_rect, &fb_rect, min_src_size)) {
|
||||
} else if (drm_rect_width(&pipe_cfg->src_rect) < min_src_size ||
|
||||
drm_rect_height(&pipe_cfg->src_rect) < min_src_size) {
|
||||
DPU_DEBUG_PLANE(pdpu, "invalid source " DRM_RECT_FMT "\n",
|
||||
DRM_RECT_ARG(&pipe_cfg->src_rect));
|
||||
return -E2BIG;
|
||||
|
||||
Reference in New Issue
Block a user