diff options
author | Liu Ying <victor.liu@nxp.com> | 2022-07-29 10:38:25 +0800 |
---|---|---|
committer | Liu Ying <victor.liu@nxp.com> | 2022-08-02 09:06:11 +0800 |
commit | 197c79c1421e727203dae35900479108ede2f719 (patch) | |
tree | 338109a031bfef94db956ce1f7797253f89c3139 /drivers/gpu | |
parent | cfc0f7026ac4244510cc8c1aa7822387f8b65d75 (diff) |
LF-6689 drm/imx: dpu: plane: Check plane_state->src_{w,h,x,y} in ->atomic_check()
Instead of getting plane visible portion's parameters from
plane_state->src, we should get them from plane_state->src_{w,h,x,y}
which are filled by user in struct drm_mode_set_plane(exposed as uapi)
or set by user through prop_src_{w,h,x,y} plane properties via
DRM_IOCTL_MODE_ATOMIC ioctl.
plane_state->src is set by drm_atomic_helper_check_plane_state(), which
happens after we cache the parameters in local variables src_{w,h,x,y}.
It could also be duplicated to plane_state of next commit, if the previous
commit is successful. However, the first plane_state, like for an overlay,
contains zeroed plane_state->src, which makes the check malfunction, e.g.,
the below case to test a NV12 frame on overlay with an invalid height:
modetest -P 39@38:600x633@NV12
Reported-by: Jared Hu <jared.hu@nxp.com>
Cc: Sandor Yu <Sandor.yu@nxp.com>
Cc: Laurentiu Palcu <laurentiu.palcu@nxp.com>
Tested-by: Jared Hu <jared.hu@nxp.com>
Reviewed-by: Sandor Yu <Sandor.yu@nxp.com>
Signed-off-by: Liu Ying <victor.liu@nxp.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/imx/dpu/dpu-plane.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/gpu/drm/imx/dpu/dpu-plane.c b/drivers/gpu/drm/imx/dpu/dpu-plane.c index 7dafd34d7edc..d0db1edb43c6 100644 --- a/drivers/gpu/drm/imx/dpu/dpu-plane.c +++ b/drivers/gpu/drm/imx/dpu/dpu-plane.c @@ -1,5 +1,5 @@ /* - * Copyright 2017-2019 NXP + * Copyright 2017-2019,2022 NXP * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -280,10 +280,10 @@ static int dpu_plane_atomic_check(struct drm_plane *plane, return -EINVAL; } - src_w = drm_rect_width(&new_plane_state->src) >> 16; - src_h = drm_rect_height(&new_plane_state->src) >> 16; - src_x = new_plane_state->src.x1 >> 16; - src_y = new_plane_state->src.y1 >> 16; + src_w = new_plane_state->src_w >> 16; + src_h = new_plane_state->src_h >> 16; + src_x = new_plane_state->src_x >> 16; + src_y = new_plane_state->src_y >> 16; fb_is_interlaced = !!(fb->flags & DRM_MODE_FB_INTERLACED); |