drm/imx: ipuv3-plane: Access old u/vbo properly in ->atomic_check for YU12/YV12
Subsystems (4)
PATCH v2 1/1 drm/imx: ipuv3-plane: Access old u/vbo properly in ->atomic_check for YU12/YV12
Before accessing the u/v offset(aka, u/vbo for IPUv3) of the old plane state's relevant fb, we should make sure the fb is in YU12 or YV12 pixel format(which are the two YUV pixel formats we support only), otherwise, we are likely to trigger BUG_ON() in drm_plane_state_to_u/vbo() since the fb's pixel format is probably not YU12 or YV12.
---v1->v2:
* Correct the condition under which we may access old u/vbo - old->pixel_format is not necessarily the same to fb->pixel_format, instead, it could be YU12 or YV12. This may cover the case in which we switch fb pixel format bewteen YU12 and YV12.
drivers/gpu/drm/imx/ipuv3-plane.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/imx/ipuv3-plane.c +3 -1
@@ -359,7 +359,9 @@ static int ipu_plane_atomic_check(struct drm_plane *plane,if ((ubo >0xfffff8 ) || (vbo >0xfffff8 ))return -EINVAL ; -if (old_fb) { +if (old_fb && + (old_fb->pixel_format ==DRM_FORMAT_YUV420 || + old_fb->pixel_format ==DRM_FORMAT_YVU420 )) { old_ubo =drm_plane_state_to_ubo (old_state); old_vbo =drm_plane_state_to_vbo (old_state);if (ubo != old_ubo || vbo != old_vbo)
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Philipp Zabel
AppliedAm Dienstag, den 18.10.2016, 16:44 +0800 schrieb Liu Ying:
Quoted 10 lines
Before accessing the u/v
offset(aka, u/vbo for IPUv3)of the old plane state's relevant fb, we should make sure the fb is in YU12 or YV12 pixel format(which are the two YUV pixel formats we support only), otherwise, we are likely to triggerBUG_ON()in drm_plane_state_to_u/vbo() since the fb's pixel format is probably not YU12 or YV12.Fixes c6c1f9bc798b ("drm/imx: Add active plane reconfiguration support")Cc [email protected] # 4.8Signed-off-by Liu Ying <[email protected]>
Quoted 6 lines
---
v1->v2:
* Correct the condition under which we may access old u/vbo -old->pixel_formatis not necessarily the same tofb->pixel_format, instead, it could be YU12 or YV12. This may cover the case in which we switch fb pixel format bewteen YU12 and YV12.
Applied, thank you.
regards
Philipp
Quoted 8 lines
drivers/gpu/drm/imx/ipuv3-plane.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/gpu/drm/imx/ipuv3-plane.c +0
-0
drivers/gpu/drm/imx/ipuv3-plane.c static int ipu_plane_atomic_check(struct drm_plane *plane, · line 367
Quoted 10 lines
drivers/gpu/drm/imx/ipuv3-plane.c +3
-1@@ -359,7 +359,9 @@ static int ipu_plane_atomic_check(struct drm_plane *plane,if ((ubo >0xfffff8 ) || (vbo >0xfffff8 ))return -EINVAL ; -if (old_fb) { +if (old_fb && + (old_fb->pixel_format ==DRM_FORMAT_YUV420 || + old_fb->pixel_format ==DRM_FORMAT_YVU420 )) { old_ubo =drm_plane_state_to_ubo (old_state); old_vbo =drm_plane_state_to_vbo (old_state);if (ubo != old_ubo || vbo != old_vbo)
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel