drm/omap: fix plane rotation
Subsystems (3)
PATCH 1/1 drm/omap: fix plane rotation
Plane rotation with omapdrm is currently broken.
It seems omap_plane_mode_set() expects width and height in screen coordinates, so pass it like that.
--- drivers/gpu/drm/omapdrm/omap_plane.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/gpu/drm/omapdrm/omap_plane.c +8 -0
@@ -253,6 +253,14 @@ static int omap_plane_update(struct drm_plane *plane,drm_framebuffer_reference (fb); +/* omap_plane_mode_set() takes adjusted src */ +switch (omap_plane->win.rotation &0xf ) { +case BIT (DRM_ROTATE_90 ): +case BIT (DRM_ROTATE_270 ): +swap (src_w, src_h); +break ; + } + return omap_plane_mode_set(plane, crtc, fb, crtc_x, crtc_y, crtc_w, crtc_h, src_x, src_y, src_w, src_h,
Signature · 1 line
1.7.9.5
Quoted 16 lines · Grazvydas Ignotas
Plane rotation with omapdrm is currently broken.
It seemsomap_plane_mode_set()expects width and height in screen coordinates, so pass it like that.Cc Rob Clark <[email protected]>Signed-off-by Grazvydas Ignotas <[email protected]>--- drivers/gpu/drm/omapdrm/omap_plane.c | 8 ++++++++ 1 file changed, 8 insertions(+)drivers/gpu/drm/omapdrm/omap_plane.c +0
-0@@ -253,6 +253,14 @@ static int omap_plane_update(struct drm_plane *plane,
drivers/gpu/drm/omapdrm/omap_plane.c static int omap_plane_update(struct drm_plane *plane, · line 263
Quoted 10 lines
drivers/gpu/drm/omapdrm/omap_plane.c +8
-0drm_framebuffer_reference (fb); +/* omap_plane_mode_set() takes adjusted src */ +switch (omap_plane->win.rotation &0xf ) { +case BIT (DRM_ROTATE_90 ): +case BIT (DRM_ROTATE_270 ): +swap (src_w, src_h); +break ; + } +
hmm, I think that the better thing would be to do this in omap_framebuffer_update_scanout(). In fact we do already swap src_w/src_h there. Only we don't swap the width/height parameters we pass down to omapdss. Not quite sure if something changed in omapdss with regards to rotation_type, but keeping it with the rest of the rotation related maths in _update_scanout() seems cleaner.
BR,
-R
Quoted 6 lines
drivers/gpu/drm/omapdrm/omap_plane.c +0
-1return omap_plane_mode_set(plane, crtc, fb, crtc_x, crtc_y, crtc_w, crtc_h, src_x, src_y, src_w, src_h, --1.7.9.5
Quoted 19 lines · Rob Clark
Quoted 18 lines · Grazvydas Ignotas
Plane rotation with omapdrm is currently broken.
It seemsomap_plane_mode_set()expects width and height in screen coordinates, so pass it like that.Cc Rob Clark <[email protected]>Signed-off-by Grazvydas Ignotas <[email protected]>--- drivers/gpu/drm/omapdrm/omap_plane.c | 8 ++++++++ 1 file changed, 8 insertions(+)drivers/gpu/drm/omapdrm/omap_plane.c +0
-0@@ -253,6 +253,14 @@ static int omap_plane_update(struct drm_plane *plane,drm_framebuffer_reference (fb);
Quoted 15 lines
drivers/gpu/drm/omapdrm/omap_plane.c static int omap_plane_update(struct drm_plane *plane, · line 263
Quoted 8 lines
drivers/gpu/drm/omapdrm/omap_plane.c +8
-0+/* omap_plane_mode_set() takes adjusted src */ +switch (omap_plane->win.rotation &0xf ) { +case BIT (DRM_ROTATE_90 ): +case BIT (DRM_ROTATE_270 ): +swap (src_w, src_h); +break ; + } +hmm, I think that the better thing would be to do this in
omap_framebuffer_update_scanout(). In fact we do already swap src_w/src_h there. Only we don't swap the width/height parameters we pass down to omapdss. Not quite sure if something changed in omapdss with regards torotation_type, but keeping it with the rest of the rotation related maths in_update_scanout()seems cleaner.
But then it has to know somehow if apply was triggered from omap_crtc_mode_set() or omap_plane_update(). The problem is omap_crtc_mode_set() passes rotated width/height (and crtc rotation works correctly), but omap_plane_update() uses unrotated width/height (so plane rotation is currently broken).
Gražvydas
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 36 lines · Grazvydas Ignotas
Quoted 19 lines · Rob Clark
Quoted 18 lines · Grazvydas Ignotas
Plane rotation with omapdrm is currently broken.
It seemsomap_plane_mode_set()expects width and height in screen coordinates, so pass it like that.Cc Rob Clark <[email protected]>Signed-off-by Grazvydas Ignotas <[email protected]>--- drivers/gpu/drm/omapdrm/omap_plane.c | 8 ++++++++ 1 file changed, 8 insertions(+)drivers/gpu/drm/omapdrm/omap_plane.c +0
-0@@ -253,6 +253,14 @@ static int omap_plane_update(struct drm_plane *plane,drm_framebuffer_reference (fb);Quoted 15 lines
drivers/gpu/drm/omapdrm/omap_plane.c static int omap_plane_update(struct drm_plane *plane, · line 263
Quoted 8 lines
drivers/gpu/drm/omapdrm/omap_plane.c +8
-0+/* omap_plane_mode_set() takes adjusted src */ +switch (omap_plane->win.rotation &0xf ) { +case BIT (DRM_ROTATE_90 ): +case BIT (DRM_ROTATE_270 ): +swap (src_w, src_h); +break ; + } +hmm, I think that the better thing would be to do this in
omap_framebuffer_update_scanout(). In fact we do already swap src_w/src_h there. Only we don't swap the width/height parameters we pass down to omapdss. Not quite sure if something changed in omapdss with regards torotation_type, but keeping it with the rest of the rotation related maths in_update_scanout()seems cleaner.
Quoted 5 lines
But then it has to know somehow if apply was triggered from
omap_crtc_mode_set()oromap_plane_update(). The problem isomap_crtc_mode_set()passes rotated width/height (and crtc rotation works correctly), butomap_plane_update()uses unrotated width/height (so plane rotation is currently broken).
Something still seems a bit suspicious.. drm core is not swapping width/height for crtc (other than for validating the configuration... which might also be needed for planes). I guess it is getting already-rotated width/height from userspace. So probably we want to do the same for planes, so it might be a good idea to move crtc->invert_dimensions into plane.
BR,
-R.
Quoted 2 lines
Gražvydas
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Gražvydas
Quoted 44 lines · Rob Clark
Quoted 36 lines · Grazvydas Ignotas
Quoted 19 lines · Rob Clark
Quoted 18 lines · Grazvydas Ignotas
Plane rotation with omapdrm is currently broken.
It seemsomap_plane_mode_set()expects width and height in screen coordinates, so pass it like that.Cc Rob Clark <[email protected]>Signed-off-by Grazvydas Ignotas <[email protected]>--- drivers/gpu/drm/omapdrm/omap_plane.c | 8 ++++++++ 1 file changed, 8 insertions(+)drivers/gpu/drm/omapdrm/omap_plane.c +0
-0@@ -253,6 +253,14 @@ static int omap_plane_update(struct drm_plane *plane,drm_framebuffer_reference (fb);Quoted 15 lines
drivers/gpu/drm/omapdrm/omap_plane.c static int omap_plane_update(struct drm_plane *plane, · line 263
Quoted 8 lines
drivers/gpu/drm/omapdrm/omap_plane.c +8
-0+/* omap_plane_mode_set() takes adjusted src */ +switch (omap_plane->win.rotation &0xf ) { +case BIT (DRM_ROTATE_90 ): +case BIT (DRM_ROTATE_270 ): +swap (src_w, src_h); +break ; + } +hmm, I think that the better thing would be to do this in
omap_framebuffer_update_scanout(). In fact we do already swap src_w/src_h there. Only we don't swap the width/height parameters we pass down to omapdss. Not quite sure if something changed in omapdss with regards torotation_type, but keeping it with the rest of the rotation related maths in_update_scanout()seems cleaner.Quoted 5 lines
But then it has to know somehow if apply was triggered from
omap_crtc_mode_set()oromap_plane_update(). The problem isomap_crtc_mode_set()passes rotated width/height (and crtc rotation works correctly), butomap_plane_update()uses unrotated width/height (so plane rotation is currently broken).
Quoted 6 lines
Something still seems a bit suspicious.. drm core is not swapping width/height for crtc (other than for validating the configuration... which might also be needed for planes). I guess it is getting already-rotated width/height from userspace. So probably we want to do the same for planes, so it might be a good idea to move
crtc->invert_dimensionsinto plane.
OK I guess I said it wrong..
The display I have is 1080x1920 portrait panel.
For omap_crtc_mode_set(), hdisplay is always 1080 and vdisplay, is 1920, regardless of rotation. That is passed over to omap_plane_mode_set() and everything works.
But in omap_plane_update(), src_w and src_h are passed instead, which correspond to framebuffer size and not display? At least drmModeSetPlane(), where those values originate, seems to expect framebuffer dimensions, but passing 1920, 1080 there (with 90 deg. rotation set) results in corruption on screen caused by bad base address for hardware overlay without my patch.
Gražvydas
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Rob Clark
Reviewed-byQuoted 55 lines · Grazvydas Ignotas
Gražvydas
Quoted 44 lines · Rob Clark
Quoted 36 lines · Grazvydas Ignotas
Quoted 19 lines · Rob Clark
Quoted 18 lines · Grazvydas Ignotas
Plane rotation with omapdrm is currently broken.
It seemsomap_plane_mode_set()expects width and height in screen coordinates, so pass it like that.Cc Rob Clark <[email protected]>Signed-off-by Grazvydas Ignotas <[email protected]>--- drivers/gpu/drm/omapdrm/omap_plane.c | 8 ++++++++ 1 file changed, 8 insertions(+)drivers/gpu/drm/omapdrm/omap_plane.c +0
-0@@ -253,6 +253,14 @@ static int omap_plane_update(struct drm_plane *plane,drm_framebuffer_reference (fb);Quoted 15 lines
drivers/gpu/drm/omapdrm/omap_plane.c static int omap_plane_update(struct drm_plane *plane, · line 263
Quoted 8 lines
drivers/gpu/drm/omapdrm/omap_plane.c +8
-0+/* omap_plane_mode_set() takes adjusted src */ +switch (omap_plane->win.rotation &0xf ) { +case BIT (DRM_ROTATE_90 ): +case BIT (DRM_ROTATE_270 ): +swap (src_w, src_h); +break ; + } +hmm, I think that the better thing would be to do this in
omap_framebuffer_update_scanout(). In fact we do already swap src_w/src_h there. Only we don't swap the width/height parameters we pass down to omapdss. Not quite sure if something changed in omapdss with regards torotation_type, but keeping it with the rest of the rotation related maths in_update_scanout()seems cleaner.Quoted 5 lines
But then it has to know somehow if apply was triggered from
omap_crtc_mode_set()oromap_plane_update(). The problem isomap_crtc_mode_set()passes rotated width/height (and crtc rotation works correctly), butomap_plane_update()uses unrotated width/height (so plane rotation is currently broken).Quoted 6 lines
Something still seems a bit suspicious.. drm core is not swapping width/height for crtc (other than for validating the configuration... which might also be needed for planes). I guess it is getting already-rotated width/height from userspace. So probably we want to do the same for planes, so it might be a good idea to move
crtc->invert_dimensionsinto plane.
Quoted 5 lines
OK I guess I said it wrong..
The display I have is 1080x1920 portrait panel.
Foromap_crtc_mode_set(), hdisplay is always 1080 and vdisplay, is 1920, regardless of rotation. That is passed over toomap_plane_mode_set()and everything works.
ahh, ok, that makes much more sense.. (sorry, it's been a long time
since I looked at rotation)
Quoted 9 lines
But in
omap_plane_update(),src_wandsrc_hare passed instead, which correspond to framebuffer size and not display? At leastdrmModeSetPlane(), where those values originate, seems to expect framebuffer dimensions, but passing 1920, 1080 there (with 90 deg. rotation set) results in corruption on screen caused by bad base address for hardware overlay without my patch.Gražvydas
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 62 lines · Rob Clark
Quoted 55 lines · Grazvydas Ignotas
Gražvydas
Quoted 44 lines · Rob Clark
Quoted 36 lines · Grazvydas Ignotas
Quoted 19 lines · Rob Clark
Quoted 18 lines · Grazvydas Ignotas
Plane rotation with omapdrm is currently broken.
It seemsomap_plane_mode_set()expects width and height in screen coordinates, so pass it like that.Cc Rob Clark <[email protected]>Signed-off-by Grazvydas Ignotas <[email protected]>--- drivers/gpu/drm/omapdrm/omap_plane.c | 8 ++++++++ 1 file changed, 8 insertions(+)drivers/gpu/drm/omapdrm/omap_plane.c +0
-0@@ -253,6 +253,14 @@ static int omap_plane_update(struct drm_plane *plane,drm_framebuffer_reference (fb);Quoted 15 lines
drivers/gpu/drm/omapdrm/omap_plane.c static int omap_plane_update(struct drm_plane *plane, · line 263
Quoted 8 lines
drivers/gpu/drm/omapdrm/omap_plane.c +8
-0+/* omap_plane_mode_set() takes adjusted src */ +switch (omap_plane->win.rotation &0xf ) { +case BIT (DRM_ROTATE_90 ): +case BIT (DRM_ROTATE_270 ): +swap (src_w, src_h); +break ; + } +hmm, I think that the better thing would be to do this in
omap_framebuffer_update_scanout(). In fact we do already swap src_w/src_h there. Only we don't swap the width/height parameters we pass down to omapdss. Not quite sure if something changed in omapdss with regards torotation_type, but keeping it with the rest of the rotation related maths in_update_scanout()seems cleaner.Quoted 5 lines
But then it has to know somehow if apply was triggered from
omap_crtc_mode_set()oromap_plane_update(). The problem isomap_crtc_mode_set()passes rotated width/height (and crtc rotation works correctly), butomap_plane_update()uses unrotated width/height (so plane rotation is currently broken).Quoted 6 lines
Something still seems a bit suspicious.. drm core is not swapping width/height for crtc (other than for validating the configuration... which might also be needed for planes). I guess it is getting already-rotated width/height from userspace. So probably we want to do the same for planes, so it might be a good idea to move
crtc->invert_dimensionsinto plane.Quoted 5 lines
OK I guess I said it wrong..
The display I have is 1080x1920 portrait panel.
Foromap_crtc_mode_set(), hdisplay is always 1080 and vdisplay, is 1920, regardless of rotation. That is passed over toomap_plane_mode_set()and everything works.
Quoted 4 lines
ahh, ok, that makes much more sense.. (sorry, it's been a long time
since I looked at rotation)Reviewed-by Rob Clark <[email protected]>
I can queue this up in my omapdrm fixes branch. I already have a few there.
Tomi
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel