Fix errors when reporting rotation capability
Subsystems (3)
v4 cover Fix errors when reporting rotation capability
This commit is based on [email protected].
This bug was found when running IGT tests.
For CRTCs that doesn't support rotation should still return DRM_MODE_ROTATE_0, otherwise the test will fail to restart. Returns the hardware capabilities accordingly.
Changes in v4:
- Remove rotation property from the driver data since OVL rotation property for all chips are the same
Changes in v3:
- Return 0 (not support) if rotation capabilities is not defined in the driver data.
Changes in v2:
- Restore DRM_MODE_ROTATE_180 (reflect x + reflect y = rotate 180)
- Define supported rotations in the driver data
Hsiao Chien Sung (1):
drm/mediatek: Fix errors when reporting rotation capability
drivers/gpu/drm/mediatek/mtk_disp_drv.h | 1 + drivers/gpu/drm/mediatek/mtk_disp_ovl.c | 18 ++++++------------ .../gpu/drm/mediatek/mtk_disp_ovl_adaptor.c | 9 +++++++++ drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 1 + drivers/gpu/drm/mediatek/mtk_drm_plane.c | 2 +- 5 files changed, 18 insertions(+), 13 deletions(-)
--
2.39.2
PATCH v4 1/1 drm/mediatek: Fix errors when reporting rotation capability
Create rotation property according to the hardware capability. Since currently OVL of all chips support same rotation, no need to define it in the driver data.
--- drivers/gpu/drm/mediatek/mtk_disp_drv.h | 1 + drivers/gpu/drm/mediatek/mtk_disp_ovl.c | 18 ++++++------------ .../gpu/drm/mediatek/mtk_disp_ovl_adaptor.c | 9 +++++++++ drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 1 + drivers/gpu/drm/mediatek/mtk_drm_plane.c | 2 +- 5 files changed, 18 insertions(+), 13 deletions(-)
drivers/gpu/drm/mediatek/mtk_disp_drv.h +1 -0
@@ -127,6 +127,7 @@ void mtk_ovl_adaptor_register_vblank_cb(struct device *dev, void (*vblank_cb)(vovoid mtk_ovl_adaptor_unregister_vblank_cb (struct device *dev);void mtk_ovl_adaptor_enable_vblank (struct device *dev);void mtk_ovl_adaptor_disable_vblank (struct device *dev); +unsigned int mtk_ovl_adaptor_supported_rotations (struct device *dev);void mtk_ovl_adaptor_start (struct device *dev);void mtk_ovl_adaptor_stop (struct device *dev);unsigned int mtk_ovl_adaptor_layer_nr (struct device *dev);
drivers/gpu/drm/mediatek/mtk_disp_ovl.c +6 -12
@@ -415,6 +415,10 @@ unsigned int mtk_ovl_layer_nr(struct device *dev)unsigned int mtk_ovl_supported_rotations (struct device *dev) { +/* +* although currently OVL can only do reflection, +* reflect x + reflect y = rotate 180 +*/ return DRM_MODE_ROTATE_0 |DRM_MODE_ROTATE_180 |DRM_MODE_REFLECT_X |DRM_MODE_REFLECT_Y ; }
@@ -423,27 +427,17 @@ int mtk_ovl_layer_check(struct device *dev, unsigned int idx, struct mtk_plane_state *mtk_state) {struct drm_plane_state *state = &mtk_state->base; -unsigned int rotation =0 ; - rotation =drm_rotation_simplify (state->rotation, -DRM_MODE_ROTATE_0 | -DRM_MODE_REFLECT_X | -DRM_MODE_REFLECT_Y ); - rotation &= ~DRM_MODE_ROTATE_0 ; - -/* We can only do reflection, not rotation */ -if ((rotation &DRM_MODE_ROTATE_MASK ) !=0 ) +if (state->rotation & ~mtk_ovl_supported_rotations (dev))return -EINVAL ;/* * TODO: Rotating/reflecting YUV buffers is not supported at this time. * Only RGB[AX] variants are supported. */ -if (state->fb->format->is_yuv && rotation !=0 ) +if (state->fb->format->is_yuv && (state->rotation & ~DRM_MODE_ROTATE_0 ))return -EINVAL ; - state->rotation = rotation; -return 0 ; }
drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c +9 -0
@@ -383,6 +383,15 @@ void mtk_ovl_adaptor_register_vblank_cb(struct device *dev, void (*vblank_cb)(vo vblank_cb, vblank_cb_data); } +unsigned int mtk_ovl_adaptor_supported_rotations (struct device *dev) +{ +/* +* should still return DRM_MODE_ROTATE_0 if rotation is not supported, +* or IGT will fail. +*/ +return DRM_MODE_ROTATE_0 ; +} +void mtk_ovl_adaptor_unregister_vblank_cb (struct device *dev) {struct mtk_disp_ovl_adaptor *ovl_adaptor =dev_get_drvdata (dev);
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +1 -0
@@ -422,6 +422,7 @@ static const struct mtk_ddp_comp_funcs ddp_ovl_adaptor = { .remove = mtk_ovl_adaptor_remove_comp, .get_formats = mtk_ovl_adaptor_get_formats, .get_num_formats = mtk_ovl_adaptor_get_num_formats, + .supported_rotations = mtk_ovl_adaptor_supported_rotations, };static const char *const mtk_ddp_comp_stem[MTK_DDP_COMP_TYPE_MAX ] = {
drivers/gpu/drm/mediatek/mtk_drm_plane.c +1 -1
@@ -344,7 +344,7 @@ int mtk_plane_init(struct drm_device *dev, struct drm_plane *plane,return err; } -if (supported_rotations & ~DRM_MODE_ROTATE_0 ) { +if (supported_rotations) { err =drm_plane_create_rotation_property (plane,DRM_MODE_ROTATE_0 , supported_rotations);
--
2.39.2
Re: [PATCH v4 1/1] drm/mediatek: Fix errors when reporting rotation capability
Hi, Hsiao-chien:
Quoted 58 lines · Hsiao Chien Sung
Create rotation property according to the hardware capability. Since currently OVL of all chips support same rotation, no need to define it in the driver data.
Fixes 84d805753983 ("drm/mediatek: Support reflect-y planerotation")
Reviewed-by: AngeloGioacchino Del Regno <
[email protected]>Signed-off-by Hsiao Chien Sung <[email protected]>--- drivers/gpu/drm/mediatek/mtk_disp_drv.h | 1 + drivers/gpu/drm/mediatek/mtk_disp_ovl.c | 18 ++++++-------- ---- .../gpu/drm/mediatek/mtk_disp_ovl_adaptor.c | 9 +++++++++ drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 1 + drivers/gpu/drm/mediatek/mtk_drm_plane.c | 2 +- 5 files changed, 18 insertions(+), 13 deletions(-)drivers/gpu/drm/mediatek/mtk_disp_drv.h +0
-0@@ -127,6 +127,7 @@ void mtk_ovl_adaptor_register_vblank_cb(structdevice *dev, void (*vblank_cb)(vo
voidmtk_ovl_adaptor_unregister_vblank_cb(struct device *dev); voidmtk_ovl_adaptor_enable_vblank(struct device *dev); voidmtk_ovl_adaptor_disable_vblank(struct device *dev);
+unsigned intmtk_ovl_adaptor_supported_rotations(struct device *dev);
voidmtk_ovl_adaptor_start(struct device *dev);
voidmtk_ovl_adaptor_stop(struct device *dev); unsigned intmtk_ovl_adaptor_layer_nr(struct device *dev);drivers/gpu/drm/mediatek/mtk_disp_ovl.c +4
-0@@ -415,6 +415,10 @@ unsigned int mtk_ovl_layer_nr(struct device *dev)unsigned int mtk_ovl_supported_rotations (struct device *dev) { +/* +* although currently OVL can only do reflection, +* reflect x + reflect y = rotate 180 +*/ return DRM_MODE_ROTATE_0 |DRM_MODE_ROTATE_180 |DRM_MODE_REFLECT_X |DRM_MODE_REFLECT_Y ;}
drivers/gpu/drm/mediatek/mtk_disp_ovl.c +0
-1@@ -423,27 +427,17 @@ int mtk_ovl_layer_check(struct device *dev,unsigned int idx, struct mtk_plane_state *mtk_state) { struct drm_plane_state *state = &mtk_state->base; -unsigned int rotation =0 ;
drivers/gpu/drm/mediatek/mtk_disp_ovl.c int mtk_ovl_layer_check(struct device *dev, · line 433
Quoted 10 lines
drivers/gpu/drm/mediatek/mtk_disp_ovl.c +1
-8- rotation =drm_rotation_simplify (state->rotation, -DRM_MODE_ROTATE_0 | -DRM_MODE_REFLECT_X | -DRM_MODE_REFLECT_Y ); - rotation &= ~DRM_MODE_ROTATE_0 ; - -/* We can only do reflection, not rotation */ -if ((rotation &DRM_MODE_ROTATE_MASK ) !=0 ) +if (state->rotation & ~mtk_ovl_supported_rotations (dev))return -EINVAL ;
The commit message of this patch is "Create rotation property according to the hardware capability". I think this modification is not related to create property, so separate this to another patch.
Quoted 61 lines
drivers/gpu/drm/mediatek/mtk_disp_ovl.c +0
-0/* * TODO: Rotating/reflecting YUV buffers is not supported at this time.
drivers/gpu/drm/mediatek/mtk_disp_ovl.c +1
-1* Only RGB[AX] variants are supported. */ -if (state->fb->format->is_yuv && rotation !=0 ) + if (state->fb->format->is_yuv && (state->rotation &~DRM_MODE_ROTATE_0))
drivers/gpu/drm/mediatek/mtk_disp_ovl.c +0
-2return -EINVAL ; - state->rotation = rotation; -return 0 ; }drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c +0
-0@@ -383,6 +383,15 @@ void mtk_ovl_adaptor_register_vblank_cb(structdevice *dev, void (*vblank_cb)(vo
drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c +4
-0vblank_cb, vblank_cb_data); } +unsigned int mtk_ovl_adaptor_supported_rotations (struct device *dev) +{ +/* +* should still return DRM_MODE_ROTATE_0 if rotation is not supported,
drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c +5
-0+* or IGT will fail. +*/ +return DRM_MODE_ROTATE_0 ; +} +void mtk_ovl_adaptor_unregister_vblank_cb (struct device *dev) { struct mtk_disp_ovl_adaptor *ovl_adaptor =
dev_get_drvdata(dev);drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +1
-0@@ -422,6 +422,7 @@ static const struct mtk_ddp_comp_funcs ddp_ovl_adaptor = { .remove = mtk_ovl_adaptor_remove_comp, .get_formats = mtk_ovl_adaptor_get_formats, .get_num_formats = mtk_ovl_adaptor_get_num_formats, + .supported_rotations = mtk_ovl_adaptor_supported_rotations, };static const char * const mtk_ddp_comp_stem[MTK_DDP_COMP_TYPE_MAX] =
{drivers/gpu/drm/mediatek/mtk_drm_plane.c +0
-0
drivers/gpu/drm/mediatek/mtk_drm_plane.c int mtk_plane_init(struct drm_device *dev, struct · line 348
Quoted 6 lines
drivers/gpu/drm/mediatek/mtk_drm_plane.c +1
-1@@ -344,7 +344,7 @@ int mtk_plane_init(struct drm_device *dev, structdrm_plane *plane, return err; } -if (supported_rotations & ~DRM_MODE_ROTATE_0 ) { +if (supported_rotations) {
Why need this modification?
Before Sean's patch [1], only support rotate 0 and does not create property and it works. Why does it must create property for only support rotate 0?
Regards,
CK
Quoted 8 lines
drivers/gpu/drm/mediatek/mtk_drm_plane.c +0
-0err =drm_plane_create_rotation_property (plane, DRM_MODE_ROTAT
E_0,
supported_rota
tions);
--
2.39.2
Re: [PATCH v4 1/1] drm/mediatek: Fix errors when reporting rotation capability
Hi CK,
Quoted 61 lines · CK Hu (胡俊光)
Hi, Hsiao-chien:
Quoted 58 lines · Hsiao Chien Sung
Create rotation property according to the hardware capability. Since currently OVL of all chips support same rotation, no need to define it in the driver data.
Fixes 84d805753983 ("drm/mediatek: Support reflect-y planerotation")
Reviewed-by: AngeloGioacchino Del Regno <
[email protected]>Signed-off-by Hsiao Chien Sung <[email protected]>--- drivers/gpu/drm/mediatek/mtk_disp_drv.h | 1 + drivers/gpu/drm/mediatek/mtk_disp_ovl.c | 18 ++++++-------- ---- .../gpu/drm/mediatek/mtk_disp_ovl_adaptor.c | 9 +++++++++ drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 1 + drivers/gpu/drm/mediatek/mtk_drm_plane.c | 2 +- 5 files changed, 18 insertions(+), 13 deletions(-)drivers/gpu/drm/mediatek/mtk_disp_drv.h +0
-0@@ -127,6 +127,7 @@ void mtk_ovl_adaptor_register_vblank_cb(structdevice *dev, void (*vblank_cb)(vo
voidmtk_ovl_adaptor_unregister_vblank_cb(struct device *dev); voidmtk_ovl_adaptor_enable_vblank(struct device *dev); voidmtk_ovl_adaptor_disable_vblank(struct device *dev);
+unsigned intmtk_ovl_adaptor_supported_rotations(struct device *dev);
voidmtk_ovl_adaptor_start(struct device *dev);
voidmtk_ovl_adaptor_stop(struct device *dev); unsigned intmtk_ovl_adaptor_layer_nr(struct device *dev);drivers/gpu/drm/mediatek/mtk_disp_ovl.c +4
-0@@ -415,6 +415,10 @@ unsigned int mtk_ovl_layer_nr(struct device *dev)unsigned int mtk_ovl_supported_rotations (struct device *dev) { +/* +* although currently OVL can only do reflection, +* reflect x + reflect y = rotate 180 +*/ return DRM_MODE_ROTATE_0 |DRM_MODE_ROTATE_180 |DRM_MODE_REFLECT_X |DRM_MODE_REFLECT_Y ;}
drivers/gpu/drm/mediatek/mtk_disp_ovl.c +0
-1@@ -423,27 +427,17 @@ int mtk_ovl_layer_check(struct device *dev,unsigned int idx, struct mtk_plane_state *mtk_state) { struct drm_plane_state *state = &mtk_state->base; -unsigned int rotation =0 ;
Quoted 15 lines
drivers/gpu/drm/mediatek/mtk_disp_ovl.c int mtk_ovl_layer_check(struct device *dev, unsigned int idx, · line 432
Quoted 10 lines
drivers/gpu/drm/mediatek/mtk_disp_ovl.c +1
-8- rotation =drm_rotation_simplify (state->rotation, -DRM_MODE_ROTATE_0 | -DRM_MODE_REFLECT_X | -DRM_MODE_REFLECT_Y ); - rotation &= ~DRM_MODE_ROTATE_0 ; - -/* We can only do reflection, not rotation */ -if ((rotation &DRM_MODE_ROTATE_MASK ) !=0 ) +if (state->rotation & ~mtk_ovl_supported_rotations (dev))return -EINVAL ;The commit message of this patch is "Create rotation property according
to the hardware capability". I think this modification is not related to create property, so separate this to another patch.
Since these modifications are all related to rotation property, or should I change the title and commit message to "Modify roation property for passing IGT"?
Quoted 69 lines
Quoted 69 lines
drivers/gpu/drm/mediatek/mtk_disp_ovl.c +0
-0/* * TODO: Rotating/reflecting YUV buffers is not supported at this time.
drivers/gpu/drm/mediatek/mtk_disp_ovl.c +1
-1* Only RGB[AX] variants are supported. */ -if (state->fb->format->is_yuv && rotation !=0 ) + if (state->fb->format->is_yuv && (state->rotation &~DRM_MODE_ROTATE_0))
drivers/gpu/drm/mediatek/mtk_disp_ovl.c +0
-2return -EINVAL ; - state->rotation = rotation; -return 0 ; }drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c +0
-0@@ -383,6 +383,15 @@ void mtk_ovl_adaptor_register_vblank_cb(structdevice *dev, void (*vblank_cb)(vo
drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c +1
-0vblank_cb, vblank_cb_data); } +unsigned int mtk_ovl_adaptor_supported_rotations(struct device*dev)
drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c +3
-0+{ +/* +* should still return DRM_MODE_ROTATE_0 if rotation is not supported,
drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c +5
-0+* or IGT will fail. +*/ +return DRM_MODE_ROTATE_0 ; +} +void mtk_ovl_adaptor_unregister_vblank_cb (struct device *dev) { struct mtk_disp_ovl_adaptor *ovl_adaptor =
dev_get_drvdata(dev);drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +1
-0@@ -422,6 +422,7 @@ static const struct mtk_ddp_comp_funcs ddp_ovl_adaptor = { .remove = mtk_ovl_adaptor_remove_comp, .get_formats = mtk_ovl_adaptor_get_formats, .get_num_formats = mtk_ovl_adaptor_get_num_formats, + .supported_rotations = mtk_ovl_adaptor_supported_rotations, };static const char * const mtk_ddp_comp_stem[MTK_DDP_COMP_TYPE_MAX]
=
{drivers/gpu/drm/mediatek/mtk_drm_plane.c +0
-0@@ -344,7 +344,7 @@ int mtk_plane_init(struct drm_device *dev,struct
drm_plane*plane,drivers/gpu/drm/mediatek/mtk_drm_plane.c +0
-0return err; }
Quoted 7 lines
drivers/gpu/drm/mediatek/mtk_drm_plane.c int mtk_plane_init(struct drm_device *dev, struct drm_plane *plane, · line 347
Quoted 2 lines
drivers/gpu/drm/mediatek/mtk_drm_plane.c +1
-1-if (supported_rotations & ~DRM_MODE_ROTATE_0 ) { +if (supported_rotations) {Why need this modification?
Before Sean's patch [1], only support rotate 0 and does not create property and it works. Why does it must create property for only support rotate 0?
Yes, as long as the user doesn't check rotation properties before commiting the pitures, there will be no problem. But IGT somehow checked this DRM_MODE_ROTATE_0 flag before executing the tests (not all of them), and leads to failures in these test itmes.
Quoted 4 lines
[1]
Quoted 12 lines
Regards,
CKQuoted 8 lines
drivers/gpu/drm/mediatek/mtk_drm_plane.c +0
-0err =drm_plane_create_rotation_property (plane, DRM_MODE_ROTAT
E_0,
supported_rota
tions);
--
2.39.2
Thanks,
Shawn
Re: [PATCH v4 1/1] drm/mediatek: Fix errors when reporting rotation capability
Hi, Hsiao-chien:
Quoted 83 lines · Shawn Sung (宋孝謙)
Hi CK,
Quoted 63 lines · CK Hu (胡俊光)
Hi, Hsiao-chien:
Quoted 60 lines · Hsiao Chien Sung
Create rotation property according to the hardware capability. Since currently OVL of all chips support same rotation, no need to define it in the driver data.
Fixes 84d805753983 ("drm/mediatek: Support reflect-y planerotation")
Reviewed-by: AngeloGioacchino Del Regno <
[email protected]>Signed-off-by Hsiao Chien Sung <[email protected]>--- drivers/gpu/drm/mediatek/mtk_disp_drv.h | 1 + drivers/gpu/drm/mediatek/mtk_disp_ovl.c | 18 ++++++---- ---- ---- .../gpu/drm/mediatek/mtk_disp_ovl_adaptor.c | 9 +++++++++ drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 1 + drivers/gpu/drm/mediatek/mtk_drm_plane.c | 2 +- 5 files changed, 18 insertions(+), 13 deletions(-)drivers/gpu/drm/mediatek/mtk_disp_drv.h +0
-0@@ -127,6 +127,7 @@ voidmtk_ovl_adaptor_register_vblank_cb(struct
device *dev, void (*vblank_cb)(vo
voidmtk_ovl_adaptor_unregister_vblank_cb(struct device *dev); voidmtk_ovl_adaptor_enable_vblank(struct device *dev); voidmtk_ovl_adaptor_disable_vblank(struct device *dev);
+unsigned intmtk_ovl_adaptor_supported_rotations(struct device *dev);
voidmtk_ovl_adaptor_start(struct device *dev);
voidmtk_ovl_adaptor_stop(struct device *dev); unsigned intmtk_ovl_adaptor_layer_nr(struct device *dev);drivers/gpu/drm/mediatek/mtk_disp_ovl.c +4
-0@@ -415,6 +415,10 @@ unsigned int mtk_ovl_layer_nr(struct device *dev)unsigned int mtk_ovl_supported_rotations (struct device *dev) { +/* +* although currently OVL can only do reflection, +* reflect x + reflect y = rotate 180 +*/ return DRM_MODE_ROTATE_0 |DRM_MODE_ROTATE_180 |DRM_MODE_REFLECT_X |DRM_MODE_REFLECT_Y ;}
drivers/gpu/drm/mediatek/mtk_disp_ovl.c +0
-1@@ -423,27 +427,17 @@ int mtk_ovl_layer_check(struct device *dev,unsigned int idx, struct mtk_plane_state *mtk_state) { struct drm_plane_state *state = &mtk_state->base; -unsigned int rotation =0 ;Quoted 16 lines
drivers/gpu/drm/mediatek/mtk_disp_ovl.c int mtk_ovl_layer_check(struct device *dev, unsigned int idx, · line 432
Quoted 10 lines
drivers/gpu/drm/mediatek/mtk_disp_ovl.c +1
-8- rotation =drm_rotation_simplify (state->rotation, -DRM_MODE_ROTATE_0 | -DRM_MODE_REFLECT_X | -DRM_MODE_REFLECT_Y ); - rotation &= ~DRM_MODE_ROTATE_0 ; - -/* We can only do reflection, not rotation */ -if ((rotation &DRM_MODE_ROTATE_MASK ) !=0 ) +if (state->rotation & ~mtk_ovl_supported_rotations (dev))return -EINVAL ;The commit message of this patch is "Create rotation property according
to the hardware capability". I think this modification is not related
to create property, so separate this to another patch.
Quoted 3 lines
Since these modifications are all related to rotation property, or should I change the title and commit message to "Modify roation property for passing IGT"?
OK. But I don't know why do this, so describe more about this.
Quoted 80 lines
Quoted 72 lines
Quoted 72 lines
drivers/gpu/drm/mediatek/mtk_disp_ovl.c +0
-0/* * TODO: Rotating/reflecting YUV buffers is not supported at this time.
drivers/gpu/drm/mediatek/mtk_disp_ovl.c +1
-1* Only RGB[AX] variants are supported. */ -if (state->fb->format->is_yuv && rotation !=0 ) + if (state->fb->format->is_yuv && (state->rotation &~DRM_MODE_ROTATE_0))
drivers/gpu/drm/mediatek/mtk_disp_ovl.c +0
-2return -EINVAL ; - state->rotation = rotation; -return 0 ; }drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c +0
-0@@ -383,6 +383,15 @@ voidmtk_ovl_adaptor_register_vblank_cb(struct
device *dev, void (*vblank_cb)(vodrivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c +1
-0vblank_cb, vblank_cb_data); } +unsigned int mtk_ovl_adaptor_supported_rotations(struct device*dev)
drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c +3
-0+{ +/* +* should still return DRM_MODE_ROTATE_0 if rotation is not supported,
drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c +5
-0+* or IGT will fail. +*/ +return DRM_MODE_ROTATE_0 ; +} +void mtk_ovl_adaptor_unregister_vblank_cb (struct device *dev) { struct mtk_disp_ovl_adaptor *ovl_adaptor =
dev_get_drvdata(dev);drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +1
-0@@ -422,6 +422,7 @@ static const struct mtk_ddp_comp_funcs ddp_ovl_adaptor = { .remove = mtk_ovl_adaptor_remove_comp, .get_formats = mtk_ovl_adaptor_get_formats, .get_num_formats = mtk_ovl_adaptor_get_num_formats, + .supported_rotations = mtk_ovl_adaptor_supported_rotations, };static const char * const
mtk_ddp_comp_stem[MTK_DDP_COMP_TYPE_MAX]
=
{drivers/gpu/drm/mediatek/mtk_drm_plane.c +0
-0@@ -344,7 +344,7 @@ int mtk_plane_init(struct drm_device *dev,struct
drm_plane*plane,drivers/gpu/drm/mediatek/mtk_drm_plane.c +0
-0return err; }Quoted 7 lines
drivers/gpu/drm/mediatek/mtk_drm_plane.c int mtk_plane_init(struct drm_device *dev, struct drm_plane *plane, · line 347
Quoted 2 lines
drivers/gpu/drm/mediatek/mtk_drm_plane.c +1
-1-if (supported_rotations & ~DRM_MODE_ROTATE_0 ) { +if (supported_rotations) {Why need this modification?
Before Sean's patch [1], only support rotate 0 and does not create property and it works. Why does it must create property for only support rotate 0?
Quoted 5 lines
Yes, as long as the user doesn't check rotation properties before commiting the pitures, there will be no problem. But IGT somehow checked this
DRM_MODE_ROTATE_0flag before executing the tests (not all
of them), and leads to failures in these test itmes.
OK, so, when supported_rotations == NULL (mtk_disp_rdma), it should also create rotation property. But I'm confused that if IGT assume that all drm driver should have rotation property, why drm core does not add this property for all drm driver?
Regards,
CK
Quoted 7 lines
Quoted 5 lines
[1]
Quoted 15 lines
Quoted 12 lines
Regards,
CKQuoted 8 lines
drivers/gpu/drm/mediatek/mtk_drm_plane.c +0
-0err =drm_plane_create_rotation_property (plane, DRM_MODE_ROTAT
E_0,
supported_rota
tions);
--
2.39.2Thanks,
Shawn
Re: [PATCH v4 1/1] drm/mediatek: Fix errors when reporting rotation capability
Hi CK,
Quoted 89 lines · CK Hu (胡俊光)
Hi, Hsiao-chien:
Quoted 86 lines · Shawn Sung (宋孝謙)
Hi CK,
Quoted 82 lines · CK Hu (胡俊光)
Hi, Hsiao-chien:
Quoted 63 lines · Hsiao Chien Sung
Create rotation property according to the hardware capability. Since currently OVL of all chips support same rotation, no need to define it in the driver data.
Fixes 84d805753983 ("drm/mediatek: Support reflect-y planerotation")
Reviewed-by: AngeloGioacchino Del Regno <
[email protected]>Signed-off-by Hsiao Chien Sung <[email protected]>--- drivers/gpu/drm/mediatek/mtk_disp_drv.h | 1 + drivers/gpu/drm/mediatek/mtk_disp_ovl.c | 18 ++++++---- ---- ---- .../gpu/drm/mediatek/mtk_disp_ovl_adaptor.c | 9 +++++++++ drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 1 + drivers/gpu/drm/mediatek/mtk_drm_plane.c | 2 +- 5 files changed, 18 insertions(+), 13 deletions(-)drivers/gpu/drm/mediatek/mtk_disp_drv.h +0
-0@@ -127,6 +127,7 @@ voidmtk_ovl_adaptor_register_vblank_cb(struct
device *dev, void (*vblank_cb)(vo
voidmtk_ovl_adaptor_unregister_vblank_cb(struct device *dev); voidmtk_ovl_adaptor_enable_vblank(struct device *dev); voidmtk_ovl_adaptor_disable_vblank(struct device *dev);
+unsigned intmtk_ovl_adaptor_supported_rotations(struct device *dev);
voidmtk_ovl_adaptor_start(struct device *dev);
voidmtk_ovl_adaptor_stop(struct device *dev); unsigned intmtk_ovl_adaptor_layer_nr(struct device *dev);drivers/gpu/drm/mediatek/mtk_disp_ovl.c +0
-0@@ -415,6 +415,10 @@ unsigned int mtk_ovl_layer_nr(structdevice
*dev)unsigned int
mtk_ovl_supported_rotations(struct device *dev){drivers/gpu/drm/mediatek/mtk_disp_ovl.c +4
-2+/* +* although currently OVL can only do reflection, +* reflect x + reflect y = rotate 180 +*/ return DRM_MODE_ROTATE_0 |DRM_MODE_ROTATE_180 |DRM_MODE_REFLECT_X |DRM_MODE_REFLECT_Y ; }@@ -423,27 +427,17 @@ int mtk_ovl_layer_check(struct device *dev, unsigned int idx, struct mtk_plane_state *mtk_state) {struct drm_plane_state *state = &mtk_state->base; -unsigned int rotation =0 ; - rotation = drm_rotation_simplify(state->rotation,drivers/gpu/drm/mediatek/mtk_disp_ovl.c int mtk_ovl_layer_check(struct device · line 435
Quoted 10 lines
drivers/gpu/drm/mediatek/mtk_disp_ovl.c +1
-7-DRM_MODE_ROTATE_0 | -DRM_MODE_REFLECT_X | - DRM_MODE_REFLECT_Y); - rotation &= ~DRM_MODE_ROTATE_0 ; - -/* We can only do reflection, not rotation */ -if ((rotation &DRM_MODE_ROTATE_MASK ) !=0 ) +if (state->rotation & ~mtk_ovl_supported_rotations (dev))return -EINVAL ;The commit message of this patch is "Create rotation property according
to the hardware capability". I think this modification is not related
to create property, so separate this to another patch.
Quoted 6 lines
Quoted 3 lines
Since these modifications are all related to rotation property, or should I change the title and commit message to "Modify roation property for passing IGT"?
OK. But I don't know why do this, so describe more about this.
Got it, thanks. Will add more information to the commit message.
Quoted 91 lines
Quoted 85 lines
Quoted 76 lines
Quoted 76 lines
drivers/gpu/drm/mediatek/mtk_disp_ovl.c +0
-0/* * TODO: Rotating/reflecting YUV buffers is not supported at
this time.drivers/gpu/drm/mediatek/mtk_disp_ovl.c +1
-1* Only RGB[AX] variants are supported. */ -if (state->fb->format->is_yuv && rotation !=0 ) + if (state->fb->format->is_yuv && (state->rotation &~DRM_MODE_ROTATE_0))
drivers/gpu/drm/mediatek/mtk_disp_ovl.c +0
-2return -EINVAL ; - state->rotation = rotation; -return 0 ; }drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c +0
-0@@ -383,6 +383,15 @@ voidmtk_ovl_adaptor_register_vblank_cb(struct
device *dev, void (*vblank_cb)(vo
vblank_cb,vblank_cb_data);
}+unsigned int
mtk_ovl_adaptor_supported_rotations(struct device *dev)drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c +3
-0+{ +/* +* should still return DRM_MODE_ROTATE_0 if rotation is not
supported,drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c +5
-0+* or IGT will fail. +*/ +return DRM_MODE_ROTATE_0 ; +} +void mtk_ovl_adaptor_unregister_vblank_cb (struct device *dev) { struct mtk_disp_ovl_adaptor *ovl_adaptor =
dev_get_drvdata(dev);drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +1
-0@@ -422,6 +422,7 @@ static const struct mtk_ddp_comp_funcs ddp_ovl_adaptor = { .remove = mtk_ovl_adaptor_remove_comp, .get_formats = mtk_ovl_adaptor_get_formats, .get_num_formats = mtk_ovl_adaptor_get_num_formats, + .supported_rotations = mtk_ovl_adaptor_supported_rotations, };static const char * const
mtk_ddp_comp_stem[MTK_DDP_COMP_TYPE_MAX]
=
{drivers/gpu/drm/mediatek/mtk_drm_plane.c +0
-0@@ -344,7 +344,7 @@ int mtk_plane_init(struct drm_device *dev,struct
drm_plane*plane,drivers/gpu/drm/mediatek/mtk_drm_plane.c +0
-0return err; }Quoted 8 lines
drivers/gpu/drm/mediatek/mtk_drm_plane.c int mtk_plane_init(struct drm_device *dev, struct drm_plane *plane, · line 347
Quoted 2 lines
drivers/gpu/drm/mediatek/mtk_drm_plane.c +1
-1-if (supported_rotations & ~DRM_MODE_ROTATE_0 ) { +if (supported_rotations) {Why need this modification?
Before Sean's patch [1], only support rotate 0 and does not create
property and it works. Why does it must create property for only support rotate 0?Quoted 5 lines
Yes, as long as the user doesn't check rotation properties before commiting the pitures, there will be no problem. But IGT somehow checked this
DRM_MODE_ROTATE_0flag before executing the tests (not all
of them), and leads to failures in these test itmes.
Quoted 7 lines
OK, so, when
supported_rotations== NULL (mtk_disp_rdma), it should also create rotation property. But I'm confused that if IGT assume that
all drm driver should have rotation property, why drm core does not add
this property for all drm driver?
After checking the report, only "graphics.IgtKms.kms_flip_unstable" has such a constraint. However, since IGT version is still keep updating, there are not guarantees about this behavior.
I did search for "DRM_MODE_ROTATE_0" in the kernel to check if there is any rule or even suggestion about setting this property, but the flag is rarely even mentioned.
Maybe we could also report this issue to IGT team instead of changing the behavior of our driver.
Quoted 12 lines
Regards,
CKQuoted 7 lines
Quoted 5 lines
[1]
Quoted 17 lines
Quoted 17 lines
Quoted 14 lines
Regards,
CKQuoted 10 lines
drivers/gpu/drm/mediatek/mtk_drm_plane.c +0
-0err =drm_plane_create_rotation_property (plane, DRM_MO
DE_ROTATE_0,
supported_rota
tions);
--
2.39.2Thanks,
Shawn