drm/mediatek: Ensure the cursor plane is on top of other overlays
Subsystems (3)
PATCH 1/1 drm/mediatek: Ensure the cursor plane is on top of other overlays
From: Sean Paul <[email protected]>
Currently the cursor is placed on the first overlay plane, which means it will be at the bottom of the stack when the hw does the compositing with anything other than primary plane. Since mtk doesn't support plane zpos, change the cursor location to the top-most plane.
--- drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/mediatek/mtk_drm_crtc.c +5 -3
@@ -689,11 +689,12 @@ static int mtk_drm_crtc_num_comp_planes(struct mtk_drm_crtc *mtk_crtc, }static inline -enum drm_plane_type mtk_drm_crtc_plane_type (unsigned int plane_idx) +enum drm_plane_type mtk_drm_crtc_plane_type (unsigned int plane_idx, +unsigned int num_planes) {if (plane_idx ==0 )return DRM_PLANE_TYPE_PRIMARY ; -else if (plane_idx ==1 ) +else if (plane_idx == (num_planes -1 ))return DRM_PLANE_TYPE_CURSOR ;else return DRM_PLANE_TYPE_OVERLAY ;
@@ -712,7 +713,8 @@ static int mtk_drm_crtc_init_comp_planes(struct drm_device *drm_dev, ret =mtk_plane_init (drm_dev, &mtk_crtc->planes[mtk_crtc->layer_nr],BIT (pipe), -mtk_drm_crtc_plane_type (mtk_crtc->layer_nr), +mtk_drm_crtc_plane_type (mtk_crtc->layer_nr, + num_planes),mtk_ddp_comp_supported_rotations (comp));if (ret)return ret;
Signature · 6 lines
Sean Paul, Software Engineer, Google / Chromium OS _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Hi, Sean:
Quoted 7 lines · Sean Paul
From: Sean Paul <[email protected]>
Currently the cursor is placed on the first overlay plane, which means it will be at the bottom of the stack when the hw does the compositing with anything other than primary plane. Since mtk doesn't support plane zpos, change the cursor location to the top-most plane.
Quoted 25 lines
Signed-off-by Sean Paul <[email protected]>--- drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)drivers/gpu/drm/mediatek/mtk_drm_crtc.c +3
-2@@ -689,11 +689,12 @@ static int mtk_drm_crtc_num_comp_planes(struct mtk_drm_crtc *mtk_crtc, }static inline -enum drm_plane_type mtk_drm_crtc_plane_type (unsigned int plane_idx) +enum drm_plane_type mtk_drm_crtc_plane_type (unsigned int plane_idx, +unsigned int num_planes) {if (plane_idx ==0 )return DRM_PLANE_TYPE_PRIMARY ; -else if (plane_idx ==1 ) +else if (plane_idx == (num_planes -1 ))return DRM_PLANE_TYPE_CURSOR ;else return DRM_PLANE_TYPE_OVERLAY ;
drivers/gpu/drm/mediatek/mtk_drm_crtc.c static int mtk_drm_crtc_init_comp_planes(struct drm_device *drm_dev, · line 720
Quoted 9 lines
drivers/gpu/drm/mediatek/mtk_drm_crtc.c +2
-1@@ -712,7 +713,8 @@ static int mtk_drm_crtc_init_comp_planes(struct drm_device *drm_dev, ret =mtk_plane_init (drm_dev, &mtk_crtc->planes[mtk_crtc->layer_nr],BIT (pipe), -mtk_drm_crtc_plane_type (mtk_crtc->layer_nr), +mtk_drm_crtc_plane_type (mtk_crtc->layer_nr, + num_planes),mtk_ddp_comp_supported_rotations (comp));if (ret)return ret;
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/1 drm/mediatek: Ensure the cursor plane is on top of other overlays
From: Sean Paul <[email protected]>
Currently the cursor is placed on the first overlay plane, which means it will be at the bottom of the stack when the hw does the compositing with anything other than primary plane. Since mtk doesn't support plane zpos, change the cursor location to the top-most plane.
--- drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 29 +++++++++++++++++-------- 1 file changed, 20 insertions(+), 9 deletions(-)
drivers/gpu/drm/mediatek/mtk_drm_crtc.c +20 -9
@@ -658,10 +658,21 @@ static const struct drm_crtc_helper_funcs mtk_crtc_helper_funcs = {static int mtk_drm_crtc_init (struct drm_device *drm,struct mtk_drm_crtc *mtk_crtc, -struct drm_plane *primary, -struct drm_plane *cursor,unsigned int pipe) +unsigned int pipe) { -int ret; +int i, ret; + +struct drm_plane *primary =NULL ; +struct drm_plane *cursor =NULL ; + +for (i =0 ; i < mtk_crtc->layer_nr; ++i) { +if (!primary && mtk_crtc->planes[i].type == +DRM_PLANE_TYPE_PRIMARY ) + primary = &mtk_crtc->planes[i]; +if (!cursor && mtk_crtc->planes[i].type == +DRM_PLANE_TYPE_CURSOR ) + cursor = &mtk_crtc->planes[i]; + } ret =drm_crtc_init_with_planes (drm, &mtk_crtc->base, primary, cursor, &mtk_crtc_funcs,NULL );
@@ -711,11 +722,12 @@ static int mtk_drm_crtc_num_comp_planes(struct mtk_drm_crtc *mtk_crtc, }static inline -enum drm_plane_type mtk_drm_crtc_plane_type (unsigned int plane_idx) +enum drm_plane_type mtk_drm_crtc_plane_type (unsigned int plane_idx, +unsigned int num_planes) {if (plane_idx ==0 )return DRM_PLANE_TYPE_PRIMARY ; -else if (plane_idx ==1 ) +else if (plane_idx == (num_planes -1 ))return DRM_PLANE_TYPE_CURSOR ;else return DRM_PLANE_TYPE_OVERLAY ;
@@ -734,7 +746,8 @@ static int mtk_drm_crtc_init_comp_planes(struct drm_device *drm_dev, ret =mtk_plane_init (drm_dev, &mtk_crtc->planes[mtk_crtc->layer_nr],BIT (pipe), -mtk_drm_crtc_plane_type (mtk_crtc->layer_nr), +mtk_drm_crtc_plane_type (mtk_crtc->layer_nr, + num_planes),mtk_ddp_comp_supported_rotations (comp));if (ret)return ret;
@@ -830,9 +843,7 @@ int mtk_drm_crtc_create(struct drm_device *drm_dev,return ret; } - ret =mtk_drm_crtc_init (drm_dev, mtk_crtc, &mtk_crtc->planes[0 ], - mtk_crtc->layer_nr >1 ? &mtk_crtc->planes[1 ] : -NULL , pipe); + ret =mtk_drm_crtc_init (drm_dev, mtk_crtc, pipe);if (ret <0 )return ret;
Signature · 7 lines
2.25.0.341.g760bfbb309-goog _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Apologies if I have formatted this wrong / sent to the wrong place!
The patch posted had an issue, another place in the driver was assuming planes[1] still referred to the cursor.
Now search for the cursor before sending (as the plane cannot be hard-coded, some devices have different numbers of planes).
Thanks
Evan Benn
Quoted 80 lines · On Thu, Feb 6, 2020 at 6:00 PM <[email protected]> wrote:
From: Sean Paul <[email protected]>
Currently the cursor is placed on the first overlay plane, which means it will be at the bottom of the stack when the hw does the compositing with anything other than primary plane. Since mtk doesn't support plane zpos, change the cursor location to the top-most plane.
Signed-off-by Evan Benn <[email protected]>Signed-off-by Sean Paul <[email protected]>--- drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 29 +++++++++++++++++-------- 1 file changed, 20 insertions(+), 9 deletions(-)drivers/gpu/drm/mediatek/mtk_drm_crtc.c +20
-10@@ -658,10 +658,21 @@ static const struct drm_crtc_helper_funcs mtk_crtc_helper_funcs = {static int mtk_drm_crtc_init (struct drm_device *drm,struct mtk_drm_crtc *mtk_crtc, -struct drm_plane *primary, -struct drm_plane *cursor,unsigned int pipe) +unsigned int pipe) { -int ret; +int i, ret; + +struct drm_plane *primary =NULL ; +struct drm_plane *cursor =NULL ; + +for (i =0 ; i < mtk_crtc->layer_nr; ++i) { +if (!primary && mtk_crtc->planes[i].type == +DRM_PLANE_TYPE_PRIMARY ) + primary = &mtk_crtc->planes[i]; +if (!cursor && mtk_crtc->planes[i].type == +DRM_PLANE_TYPE_CURSOR ) + cursor = &mtk_crtc->planes[i]; + } ret =drm_crtc_init_with_planes (drm, &mtk_crtc->base, primary, cursor, &mtk_crtc_funcs,NULL );@@ -711,11 +722,12 @@ static int mtk_drm_crtc_num_comp_planes(struct mtk_drm_crtc *mtk_crtc, }static inline -enum drm_plane_type mtk_drm_crtc_plane_type (unsigned int plane_idx) +enum drm_plane_type mtk_drm_crtc_plane_type (unsigned int plane_idx, +unsigned int num_planes) {if (plane_idx ==0 )return DRM_PLANE_TYPE_PRIMARY ; -else if (plane_idx ==1 ) +else if (plane_idx == (num_planes -1 ))return DRM_PLANE_TYPE_CURSOR ;else return DRM_PLANE_TYPE_OVERLAY ;@@ -734,7 +746,8 @@ static int mtk_drm_crtc_init_comp_planes(struct drm_device *drm_dev, ret =mtk_plane_init (drm_dev, &mtk_crtc->planes[mtk_crtc->layer_nr],BIT (pipe), -mtk_drm_crtc_plane_type (mtk_crtc->layer_nr), +mtk_drm_crtc_plane_type (mtk_crtc->layer_nr, + num_planes),mtk_ddp_comp_supported_rotations (comp));if (ret)return ret;@@ -830,9 +843,7 @@ int mtk_drm_crtc_create(struct drm_device *drm_dev,return ret; } - ret =mtk_drm_crtc_init (drm_dev, mtk_crtc, &mtk_crtc->planes[0 ], - mtk_crtc->layer_nr >1 ? &mtk_crtc->planes[1 ] : -NULL , pipe); + ret =mtk_drm_crtc_init (drm_dev, mtk_crtc, pipe);if (ret <0 )return ret; --
Quoted 2 lines
2.25.0.341.g760bfbb309-goog
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Hi, Evan:
It looks like Sean's version has some problem. So this version is
Quoted 68 lines · On Thu, 2020-02-06 at 17:59 +1100, [email protected] wrote:
From: Sean Paul <[email protected]>
Currently the cursor is placed on the first overlay plane, which means it will be at the bottom of the stack when the hw does the compositing with anything other than primary plane. Since mtk doesn't support plane zpos, change the cursor location to the top-most plane.
Signed-off-by Evan Benn <[email protected]>Signed-off-by Sean Paul <[email protected]>--- drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 29 +++++++++++++++++-------- 1 file changed, 20 insertions(+), 9 deletions(-)drivers/gpu/drm/mediatek/mtk_drm_crtc.c +19
-6@@ -658,10 +658,21 @@ static const struct drm_crtc_helper_funcs mtk_crtc_helper_funcs = {static int mtk_drm_crtc_init (struct drm_device *drm,struct mtk_drm_crtc *mtk_crtc, -struct drm_plane *primary, -struct drm_plane *cursor,unsigned int pipe) +unsigned int pipe) { -int ret; +int i, ret; + +struct drm_plane *primary =NULL ; +struct drm_plane *cursor =NULL ; + +for (i =0 ; i < mtk_crtc->layer_nr; ++i) { +if (!primary && mtk_crtc->planes[i].type == +DRM_PLANE_TYPE_PRIMARY ) + primary = &mtk_crtc->planes[i]; +if (!cursor && mtk_crtc->planes[i].type == +DRM_PLANE_TYPE_CURSOR ) + cursor = &mtk_crtc->planes[i]; + } ret =drm_crtc_init_with_planes (drm, &mtk_crtc->base, primary, cursor, &mtk_crtc_funcs,NULL );@@ -711,11 +722,12 @@ static int mtk_drm_crtc_num_comp_planes(struct mtk_drm_crtc *mtk_crtc, }static inline -enum drm_plane_type mtk_drm_crtc_plane_type (unsigned int plane_idx) +enum drm_plane_type mtk_drm_crtc_plane_type (unsigned int plane_idx, +unsigned int num_planes) {if (plane_idx ==0 )return DRM_PLANE_TYPE_PRIMARY ; -else if (plane_idx ==1 ) +else if (plane_idx == (num_planes -1 ))return DRM_PLANE_TYPE_CURSOR ;else return DRM_PLANE_TYPE_OVERLAY ;@@ -734,7 +746,8 @@ static int mtk_drm_crtc_init_comp_planes(struct drm_device *drm_dev, ret =mtk_plane_init (drm_dev, &mtk_crtc->planes[mtk_crtc->layer_nr],BIT (pipe), -mtk_drm_crtc_plane_type (mtk_crtc->layer_nr), +mtk_drm_crtc_plane_type (mtk_crtc->layer_nr, + num_planes),mtk_ddp_comp_supported_rotations (comp));if (ret)return ret;
drivers/gpu/drm/mediatek/mtk_drm_crtc.c int mtk_drm_crtc_create(struct drm_device *drm_dev, · line 849
Quoted 10 lines
drivers/gpu/drm/mediatek/mtk_drm_crtc.c +1
-3@@ -830,9 +843,7 @@ int mtk_drm_crtc_create(struct drm_device *drm_dev,return ret; } - ret =mtk_drm_crtc_init (drm_dev, mtk_crtc, &mtk_crtc->planes[0 ], - mtk_crtc->layer_nr >1 ? &mtk_crtc->planes[1 ] : -NULL , pipe); + ret =mtk_drm_crtc_init (drm_dev, mtk_crtc, pipe);if (ret <0 )return ret;
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 8 lines · On Thu, Feb 06, 2020 at 05:59:51PM +1100, [email protected] wrote:
From: Sean Paul <[email protected]>
Currently the cursor is placed on the first overlay plane, which means it will be at the bottom of the stack when the hw does the compositing with anything other than primary plane. Since mtk doesn't support plane zpos, change the cursor location to the top-most plane.
Signed-off-by Evan Benn <[email protected]>
Hi Evan,
Thanks for spotting the issue! I think this should probably be 2 patches, one to fix crtc init and then the cursor patch on top of that. We generally try to only do one thing per patch.
A few other nits below..
Quoted 10 lines
Signed-off-by Sean Paul <[email protected]>--- drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 29 +++++++++++++++++-------- 1 file changed, 20 insertions(+), 9 deletions(-)drivers/gpu/drm/mediatek/mtk_drm_crtc.c +0
-0
drivers/gpu/drm/mediatek/mtk_drm_crtc.c static const struct drm_crtc_helper_funcs mtk_crtc_helper_funcs = { · line 664
Quoted 10 lines
drivers/gpu/drm/mediatek/mtk_drm_crtc.c +3
-3@@ -658,10 +658,21 @@ static const struct drm_crtc_helper_funcs mtk_crtc_helper_funcs = {static int mtk_drm_crtc_init (struct drm_device *drm,struct mtk_drm_crtc *mtk_crtc, -struct drm_plane *primary, -struct drm_plane *cursor,unsigned int pipe) +unsigned int pipe) { -int ret; +int i, ret; +
extra line
drivers/gpu/drm/mediatek/mtk_drm_crtc.c static const struct drm_crtc_helper_funcs mtk_crtc_helper_funcs = { · line 666
Quoted 2 lines
drivers/gpu/drm/mediatek/mtk_drm_crtc.c +2
-0+struct drm_plane *primary =NULL ; +struct drm_plane *cursor =NULL ;
These should be on top of the int declaration
drivers/gpu/drm/mediatek/mtk_drm_crtc.c static const struct drm_crtc_helper_funcs mtk_crtc_helper_funcs = { · line 668
Quoted 2 lines
drivers/gpu/drm/mediatek/mtk_drm_crtc.c +2
-0+ +for (i =0 ; i < mtk_crtc->layer_nr; ++i) {
We don't really do pre-increment in kernel for loops
drivers/gpu/drm/mediatek/mtk_drm_crtc.c static const struct drm_crtc_helper_funcs mtk_crtc_helper_funcs = { · line 670
Quoted 2 lines
drivers/gpu/drm/mediatek/mtk_drm_crtc.c +2
-0+if (!primary && mtk_crtc->planes[i].type == +DRM_PLANE_TYPE_PRIMARY )
Line breaks should be around '&&':
if (!primary &&
mtk_crtc->planes[i].type == DRM_PLANE_TYPE_PRIMARY)drivers/gpu/drm/mediatek/mtk_drm_crtc.c static const struct drm_crtc_helper_funcs mtk_crtc_helper_funcs = { · line 672
Quoted 2 lines
drivers/gpu/drm/mediatek/mtk_drm_crtc.c +2
-0+ primary = &mtk_crtc->planes[i]; + if (!cursor && mtk_crtc->planes[i].type ==
else if?
drivers/gpu/drm/mediatek/mtk_drm_crtc.c static const struct drm_crtc_helper_funcs mtk_crtc_helper_funcs = { · line 674
Quoted 2 lines
drivers/gpu/drm/mediatek/mtk_drm_crtc.c +2
-0+ DRM_PLANE_TYPE_CURSOR) + cursor = &mtk_crtc->planes[i];
Since we can only have one primary and one cursor, the NULL checks on primary and cursor are unnecessary, you can just blindly assign them when you hit a plane of the right type. If the driver creates multiples the behavior is undefined anyways.
Quoted 43 lines
drivers/gpu/drm/mediatek/mtk_drm_crtc.c +7
-6+ } ret =drm_crtc_init_with_planes (drm, &mtk_crtc->base, primary, cursor, &mtk_crtc_funcs,NULL );@@ -711,11 +722,12 @@ static int mtk_drm_crtc_num_comp_planes(struct mtk_drm_crtc *mtk_crtc, }static inline -enum drm_plane_type mtk_drm_crtc_plane_type (unsigned int plane_idx) +enum drm_plane_type mtk_drm_crtc_plane_type (unsigned int plane_idx, +unsigned int num_planes) {if (plane_idx ==0 )return DRM_PLANE_TYPE_PRIMARY ; -else if (plane_idx ==1 ) +else if (plane_idx == (num_planes -1 ))return DRM_PLANE_TYPE_CURSOR ;else return DRM_PLANE_TYPE_OVERLAY ;@@ -734,7 +746,8 @@ static int mtk_drm_crtc_init_comp_planes(struct drm_device *drm_dev, ret =mtk_plane_init (drm_dev, &mtk_crtc->planes[mtk_crtc->layer_nr],BIT (pipe), -mtk_drm_crtc_plane_type (mtk_crtc->layer_nr), +mtk_drm_crtc_plane_type (mtk_crtc->layer_nr, + num_planes),mtk_ddp_comp_supported_rotations (comp));if (ret)return ret;@@ -830,9 +843,7 @@ int mtk_drm_crtc_create(struct drm_device *drm_dev,return ret; } - ret =mtk_drm_crtc_init (drm_dev, mtk_crtc, &mtk_crtc->planes[0 ], - mtk_crtc->layer_nr >1 ? &mtk_crtc->planes[1 ] : -NULL , pipe); + ret =mtk_drm_crtc_init (drm_dev, mtk_crtc, pipe);if (ret <0 )return ret;Signature · 1 line
2.25.0.341.g760bfbb309-goog
Signature · 5 lines
Sean Paul, Software Engineer, Google / Chromium OS _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/1 drm/mediatek: Find the cursor plane instead of hard coding it
The cursor and primary planes were hard coded.
Now search for them for passing to drm_crtc_init_with_planes
---
drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)
drivers/gpu/drm/mediatek/mtk_drm_crtc.c +12 -6
@@ -658,10 +658,18 @@ static const struct drm_crtc_helper_funcs mtk_crtc_helper_funcs = {static int mtk_drm_crtc_init (struct drm_device *drm,struct mtk_drm_crtc *mtk_crtc, -struct drm_plane *primary, -struct drm_plane *cursor,unsigned int pipe) +unsigned int pipe) { -int ret; +struct drm_plane *primary =NULL ; +struct drm_plane *cursor =NULL ; +int i, ret; + +for (i =0 ; i < mtk_crtc->layer_nr; i++) { +if (mtk_crtc->planes[i].type ==DRM_PLANE_TYPE_PRIMARY ) + primary = &mtk_crtc->planes[i]; +else if (mtk_crtc->planes[i].type ==DRM_PLANE_TYPE_CURSOR ) + cursor = &mtk_crtc->planes[i]; + } ret =drm_crtc_init_with_planes (drm, &mtk_crtc->base, primary, cursor, &mtk_crtc_funcs,NULL );
@@ -830,9 +838,7 @@ int mtk_drm_crtc_create(struct drm_device *drm_dev,return ret; } - ret =mtk_drm_crtc_init (drm_dev, mtk_crtc, &mtk_crtc->planes[0 ], - mtk_crtc->layer_nr >1 ? &mtk_crtc->planes[1 ] : -NULL , pipe); + ret =mtk_drm_crtc_init (drm_dev, mtk_crtc, pipe);if (ret <0 )return ret;
Signature · 1 line
2.25.0.341.g760bfbb309-goog
Re: [PATCH] drm/mediatek: Find the cursor plane instead of hard coding it
Apologies for the confusing thread. Please apply the above patch:
'drm/mediatek: Find the cursor plane instead of hard coding it' before Sean Paul's original patch:
'drm/mediatek: Ensure the cursor plane is on top of other overlays'
This way authorship is correctly preserved, but we do not introduce the bug.
Thanks
Quoted 50 lines · Evan Benn
The cursor and primary planes were hard coded.
Now search for them for passing todrm_crtc_init_with_planesSigned-off-by Evan Benn <[email protected]>---
drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)drivers/gpu/drm/mediatek/mtk_drm_crtc.c +12
-7@@ -658,10 +658,18 @@ static const struct drm_crtc_helper_funcs mtk_crtc_helper_funcs = {static int mtk_drm_crtc_init (struct drm_device *drm,struct mtk_drm_crtc *mtk_crtc, -struct drm_plane *primary, -struct drm_plane *cursor,unsigned int pipe) +unsigned int pipe) { -int ret; +struct drm_plane *primary =NULL ; +struct drm_plane *cursor =NULL ; +int i, ret; + +for (i =0 ; i < mtk_crtc->layer_nr; i++) { +if (mtk_crtc->planes[i].type ==DRM_PLANE_TYPE_PRIMARY ) + primary = &mtk_crtc->planes[i]; +else if (mtk_crtc->planes[i].type ==DRM_PLANE_TYPE_CURSOR ) + cursor = &mtk_crtc->planes[i]; + } ret =drm_crtc_init_with_planes (drm, &mtk_crtc->base, primary, cursor, &mtk_crtc_funcs,NULL );@@ -830,9 +838,7 @@ int mtk_drm_crtc_create(struct drm_device *drm_dev,return ret; } - ret =mtk_drm_crtc_init (drm_dev, mtk_crtc, &mtk_crtc->planes[0 ], - mtk_crtc->layer_nr >1 ? &mtk_crtc->planes[1 ] : -NULL , pipe); + ret =mtk_drm_crtc_init (drm_dev, mtk_crtc, pipe);if (ret <0 )return ret; --2.25.0.341.g760bfbb309-goog
Re: [PATCH] drm/mediatek: Find the cursor plane instead of hard coding it
In reply to Evan BennHi, Evan:
Quoted 3 lines · Evan Benn
The cursor and primary planes were hard coded.
Now search for them for passing todrm_crtc_init_with_planes
Quoted 33 lines
Signed-off-by Evan Benn <[email protected]>---
drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)drivers/gpu/drm/mediatek/mtk_drm_crtc.c +11
-3@@ -658,10 +658,18 @@ static const struct drm_crtc_helper_funcs mtk_crtc_helper_funcs = {static int mtk_drm_crtc_init (struct drm_device *drm,struct mtk_drm_crtc *mtk_crtc, -struct drm_plane *primary, -struct drm_plane *cursor,unsigned int pipe) +unsigned int pipe) { -int ret; +struct drm_plane *primary =NULL ; +struct drm_plane *cursor =NULL ; +int i, ret; + +for (i =0 ; i < mtk_crtc->layer_nr; i++) { +if (mtk_crtc->planes[i].type ==DRM_PLANE_TYPE_PRIMARY ) + primary = &mtk_crtc->planes[i]; +else if (mtk_crtc->planes[i].type ==DRM_PLANE_TYPE_CURSOR ) + cursor = &mtk_crtc->planes[i]; + } ret =drm_crtc_init_with_planes (drm, &mtk_crtc->base, primary, cursor, &mtk_crtc_funcs,NULL );
drivers/gpu/drm/mediatek/mtk_drm_crtc.c int mtk_drm_crtc_create(struct drm_device *drm_dev, · line 844
Quoted 10 lines
drivers/gpu/drm/mediatek/mtk_drm_crtc.c +1
-3@@ -830,9 +838,7 @@ int mtk_drm_crtc_create(struct drm_device *drm_dev,return ret; } - ret =mtk_drm_crtc_init (drm_dev, mtk_crtc, &mtk_crtc->planes[0 ], - mtk_crtc->layer_nr >1 ? &mtk_crtc->planes[1 ] : -NULL , pipe); + ret =mtk_drm_crtc_init (drm_dev, mtk_crtc, pipe);if (ret <0 )return ret;
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
CK Hu
AppliedRe: [PATCH] drm/mediatek: Find the cursor plane instead of hard coding it
Hi, Evan:
Quoted 8 lines · CK Hu
Hi, Evan:
Quoted 3 lines · Evan Benn
The cursor and primary planes were hard coded.
Now search for them for passing todrm_crtc_init_with_planesReviewed-by CK Hu <[email protected]>
Applied to mediatek-drm-fixes-5.6 [1], thanks.
[1]
https://github.com/ckhu-mediatek/linux.git-tags/commits/mediatek-drm-fixes-5.6
Regards,
CK
Quoted 37 lines
Quoted 37 lines
Signed-off-by Evan Benn <[email protected]>---
drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)drivers/gpu/drm/mediatek/mtk_drm_crtc.c +11
-3@@ -658,10 +658,18 @@ static const struct drm_crtc_helper_funcs mtk_crtc_helper_funcs = {static int mtk_drm_crtc_init (struct drm_device *drm,struct mtk_drm_crtc *mtk_crtc, -struct drm_plane *primary, -struct drm_plane *cursor,unsigned int pipe) +unsigned int pipe) { -int ret; +struct drm_plane *primary =NULL ; +struct drm_plane *cursor =NULL ; +int i, ret; + +for (i =0 ; i < mtk_crtc->layer_nr; i++) { +if (mtk_crtc->planes[i].type ==DRM_PLANE_TYPE_PRIMARY ) + primary = &mtk_crtc->planes[i]; +else if (mtk_crtc->planes[i].type ==DRM_PLANE_TYPE_CURSOR ) + cursor = &mtk_crtc->planes[i]; + } ret =drm_crtc_init_with_planes (drm, &mtk_crtc->base, primary, cursor, &mtk_crtc_funcs,NULL );@@ -830,9 +838,7 @@ int mtk_drm_crtc_create(struct drm_device *drm_dev,return ret; }
Quoted 8 lines
drivers/gpu/drm/mediatek/mtk_drm_crtc.c int mtk_drm_crtc_create(struct drm_device *drm_dev, · line 844
Quoted 7 lines
drivers/gpu/drm/mediatek/mtk_drm_crtc.c +1
-3- ret =mtk_drm_crtc_init (drm_dev, mtk_crtc, &mtk_crtc->planes[0 ], - mtk_crtc->layer_nr >1 ? &mtk_crtc->planes[1 ] : -NULL , pipe); + ret =mtk_drm_crtc_init (drm_dev, mtk_crtc, pipe);if (ret <0 )return ret;
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm/mediatek: Find the cursor plane instead of hard coding it
Quoted 6 lines · CK Hu
Hi, Evan:
Quoted 2 lines · CK Hu
Hi, Evan:
Quoted 9 lines
Quoted 6 lines · Evan Benn
Quoted 3 lines
The cursor and primary planes were hard coded.
Now search for them for passing todrm_crtc_init_with_planesReviewed-by CK Hu <[email protected]>Applied to mediatek-drm-fixes-5.6 [1], thanks.
Hi CK,
Thanks for picking this up. Before you send the pull, could you please reverse the order of these 2 patches? Evan's should come before mine to prevent a regression.
Sean
Quoted 56 lines
[1]
https://github.com/ckhu-mediatek/linux.git-tags/commits/mediatek-drm-fixes-5.6Regards,
CKQuoted 37 lines
Quoted 37 lines
Signed-off-by Evan Benn <[email protected]>---
drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)drivers/gpu/drm/mediatek/mtk_drm_crtc.c +11
-3@@ -658,10 +658,18 @@ static const struct drm_crtc_helper_funcs mtk_crtc_helper_funcs = {static int mtk_drm_crtc_init (struct drm_device *drm,struct mtk_drm_crtc *mtk_crtc, -struct drm_plane *primary, -struct drm_plane *cursor,unsigned int pipe) +unsigned int pipe) { -int ret; +struct drm_plane *primary =NULL ; +struct drm_plane *cursor =NULL ; +int i, ret; + +for (i =0 ; i < mtk_crtc->layer_nr; i++) { +if (mtk_crtc->planes[i].type ==DRM_PLANE_TYPE_PRIMARY ) + primary = &mtk_crtc->planes[i]; +else if (mtk_crtc->planes[i].type ==DRM_PLANE_TYPE_CURSOR ) + cursor = &mtk_crtc->planes[i]; + } ret =drm_crtc_init_with_planes (drm, &mtk_crtc->base, primary, cursor, &mtk_crtc_funcs,NULL );@@ -830,9 +838,7 @@ int mtk_drm_crtc_create(struct drm_device *drm_dev,return ret; }Quoted 8 lines
drivers/gpu/drm/mediatek/mtk_drm_crtc.c int mtk_drm_crtc_create(struct drm_device *drm_dev, · line 844
Quoted 7 lines
drivers/gpu/drm/mediatek/mtk_drm_crtc.c +1
-3- ret =mtk_drm_crtc_init (drm_dev, mtk_crtc, &mtk_crtc->planes[0 ], - mtk_crtc->layer_nr >1 ? &mtk_crtc->planes[1 ] : -NULL , pipe); + ret =mtk_drm_crtc_init (drm_dev, mtk_crtc, pipe);if (ret <0 )return ret;_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm/mediatek: Find the cursor plane instead of hard coding it
Quoted 17 lines · Sean Paul
Quoted 6 lines · CK Hu
Hi, Evan:
Quoted 2 lines · CK Hu
Hi, Evan:
Quoted 9 lines
Quoted 6 lines · Evan Benn
Quoted 3 lines
The cursor and primary planes were hard coded.
Now search for them for passing todrm_crtc_init_with_planesReviewed-by CK Hu <[email protected]>Applied to mediatek-drm-fixes-5.6 [1], thanks.
Quoted 7 lines
Hi CK,
Thanks for picking this up. Before you send the pull, could you please reverse the order of these 2 patches? Evan's should come before mine to prevent a regression.Sean
Hi, Sean:
Thanks for your notice. I've reversed the order.
Regards,
CK
Quoted 52 lines
Quoted 52 lines
[1]
https://github.com/ckhu-mediatek/linux.git-tags/commits/mediatek-drm-fixes-5.6Regards,
CKQuoted 45 lines
Quoted 44 lines
Signed-off-by Evan Benn <[email protected]>---
drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)drivers/gpu/drm/mediatek/mtk_drm_crtc.c +12
-6@@ -658,10 +658,18 @@ static const struct drm_crtc_helper_funcs mtk_crtc_helper_funcs = {static int mtk_drm_crtc_init (struct drm_device *drm,struct mtk_drm_crtc *mtk_crtc, -struct drm_plane *primary, -struct drm_plane *cursor,unsigned int pipe) +unsigned int pipe) { -int ret; +struct drm_plane *primary =NULL ; +struct drm_plane *cursor =NULL ; +int i, ret; + +for (i =0 ; i < mtk_crtc->layer_nr; i++) { +if (mtk_crtc->planes[i].type ==DRM_PLANE_TYPE_PRIMARY ) + primary = &mtk_crtc->planes[i]; +else if (mtk_crtc->planes[i].type ==DRM_PLANE_TYPE_CURSOR ) + cursor = &mtk_crtc->planes[i]; + } ret =drm_crtc_init_with_planes (drm, &mtk_crtc->base, primary, cursor, &mtk_crtc_funcs,NULL );@@ -830,9 +838,7 @@ int mtk_drm_crtc_create(struct drm_device *drm_dev,return ret; } - ret =mtk_drm_crtc_init (drm_dev, mtk_crtc, &mtk_crtc->planes[0 ], - mtk_crtc->layer_nr >1 ? &mtk_crtc->planes[1 ] : -NULL , pipe); + ret =mtk_drm_crtc_init (drm_dev, mtk_crtc, pipe);if (ret <0 )return ret;
Quoted 4 lines
Quoted 4 lines
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm/mediatek: Find the cursor plane instead of hard coding it
In reply to Evan BennQuoted 5 lines · Evan Benn
The cursor and primary planes were hard coded.
Now search for them for passing todrm_crtc_init_with_planesSigned-off-by Evan Benn <[email protected]>
I like it!
Quoted 43 lines
---
drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)drivers/gpu/drm/mediatek/mtk_drm_crtc.c +12
-7@@ -658,10 +658,18 @@ static const struct drm_crtc_helper_funcs mtk_crtc_helper_funcs = {static int mtk_drm_crtc_init (struct drm_device *drm,struct mtk_drm_crtc *mtk_crtc, -struct drm_plane *primary, -struct drm_plane *cursor,unsigned int pipe) +unsigned int pipe) { -int ret; +struct drm_plane *primary =NULL ; +struct drm_plane *cursor =NULL ; +int i, ret; + +for (i =0 ; i < mtk_crtc->layer_nr; i++) { +if (mtk_crtc->planes[i].type ==DRM_PLANE_TYPE_PRIMARY ) + primary = &mtk_crtc->planes[i]; +else if (mtk_crtc->planes[i].type ==DRM_PLANE_TYPE_CURSOR ) + cursor = &mtk_crtc->planes[i]; + } ret =drm_crtc_init_with_planes (drm, &mtk_crtc->base, primary, cursor, &mtk_crtc_funcs,NULL );@@ -830,9 +838,7 @@ int mtk_drm_crtc_create(struct drm_device *drm_dev,return ret; } - ret =mtk_drm_crtc_init (drm_dev, mtk_crtc, &mtk_crtc->planes[0 ], - mtk_crtc->layer_nr >1 ? &mtk_crtc->planes[1 ] : -NULL , pipe); + ret =mtk_drm_crtc_init (drm_dev, mtk_crtc, pipe);if (ret <0 )return ret; --
Quoted 2 lines
2.25.0.341.g760bfbb309-goog
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
CK Hu
AppliedHi, Sean:
Quoted 5 lines · CK Hu
Hi, Sean:
Quoted 2 lines · Sean Paul
From: Sean Paul <[email protected]>
Quoted 7 lines
Quoted 5 lines
Currently the cursor is placed on the first overlay plane, which means it will be at the bottom of the stack when the hw does the compositing with anything other than primary plane. Since mtk doesn't support plane zpos, change the cursor location to the top-most plane.
Reviewed-by CK Hu <[email protected]>
Applied to mediatek-drm-fixes-5.6 [1], thanks.
[1]
https://github.com/ckhu-mediatek/linux.git-tags/commits/mediatek-drm-fixes-5.6
Regards,
CK
Quoted 27 lines
Quoted 27 lines
Signed-off-by Sean Paul <[email protected]>--- drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)drivers/gpu/drm/mediatek/mtk_drm_crtc.c +3
-2@@ -689,11 +689,12 @@ static int mtk_drm_crtc_num_comp_planes(struct mtk_drm_crtc *mtk_crtc, }static inline -enum drm_plane_type mtk_drm_crtc_plane_type (unsigned int plane_idx) +enum drm_plane_type mtk_drm_crtc_plane_type (unsigned int plane_idx, +unsigned int num_planes) {if (plane_idx ==0 )return DRM_PLANE_TYPE_PRIMARY ; -else if (plane_idx ==1 ) +else if (plane_idx == (num_planes -1 ))return DRM_PLANE_TYPE_CURSOR ;else return DRM_PLANE_TYPE_OVERLAY ;@@ -712,7 +713,8 @@ static int mtk_drm_crtc_init_comp_planes(struct drm_device *drm_dev, ret = mtk_plane_init(drm_dev,
Quoted 9 lines
drivers/gpu/drm/mediatek/mtk_drm_crtc.c static int mtk_drm_crtc_init_comp_planes(struct drm_device *drm_dev, · line 720
Quoted 8 lines
drivers/gpu/drm/mediatek/mtk_drm_crtc.c +2
-1&mtk_crtc->planes[mtk_crtc->layer_nr],BIT (pipe), -mtk_drm_crtc_plane_type (mtk_crtc->layer_nr), +mtk_drm_crtc_plane_type (mtk_crtc->layer_nr, + num_planes), mtk_ddp_comp_supported_rotations(comp));if (ret)return ret;
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel