drm/meson: fix vsync buffer update
PATCH 1/1 drm/meson: fix vsync buffer update
The plane buffer address/stride/height was incorrectly updated in the plane_atomic_update operation instead of the vsync irq. This patch delays this operation in the vsync irq along with the other plane delayed setup.
This issue was masked using legacy framebuffer and X11 modesetting, but is clearly visible using gbm rendering when buffer is submitted late after vblank, like using software decoding and OpenGL rendering in Kodi. With this patch, tearing and other artifacts disappears completely.
--- drivers/gpu/drm/meson/meson_crtc.c | 6 ++++++ drivers/gpu/drm/meson/meson_drv.h | 3 +++ drivers/gpu/drm/meson/meson_plane.c | 7 +++---- 3 files changed, 12 insertions(+), 4 deletions(-)
drivers/gpu/drm/meson/meson_crtc.c +6 -0
@@ -36,6 +36,7 @@#include "meson_venc.h" #include "meson_vpp.h" #include "meson_viu.h" +#include "meson_canvas.h" #include "meson_registers.h" /* CRTC definition */
@@ -192,6 +193,11 @@ void meson_crtc_irq(struct meson_drm *priv) }else meson_vpp_disable_interlace_vscaler_osd1 (priv); +meson_canvas_setup (priv,MESON_CANVAS_ID_OSD1 , + priv->viu.osd1_addr, priv->viu.osd1_stride, + priv->viu.osd1_height,MESON_CANVAS_WRAP_NONE , +MESON_CANVAS_BLKMODE_LINEAR ); +/* Enable OSD1 */ writel_bits_relaxed (VPP_OSD1_POSTBLEND ,VPP_OSD1_POSTBLEND , priv->io_base +_REG (VPP_MISC ));
drivers/gpu/drm/meson/meson_drv.h +3 -0
@@ -43,6 +43,9 @@ struct meson_drm {bool osd1_commit;uint32_t osd1_ctrl_stat;uint32_t osd1_blk0_cfg[5 ]; +uint32_t osd1_addr; +uint32_t osd1_stride; +uint32_t osd1_height; } viu;struct {
drivers/gpu/drm/meson/meson_plane.c +3 -4
@@ -164,10 +164,9 @@ static void meson_plane_atomic_update(struct drm_plane *plane,/* Update Canvas with buffer address */ gem =drm_fb_cma_get_gem_obj (fb,0 ); -meson_canvas_setup (priv,MESON_CANVAS_ID_OSD1 , - gem->paddr, fb->pitches[0 ], - fb->height,MESON_CANVAS_WRAP_NONE , -MESON_CANVAS_BLKMODE_LINEAR ); + priv->viu.osd1_addr = gem->paddr; + priv->viu.osd1_stride = fb->pitches[0 ]; + priv->viu.osd1_height = fb->height;spin_unlock_irqrestore (&priv->drm->event_lock, flags); }
Signature · 1 line
2.7.4
Quoted 9 lines · Neil Armstrong
The plane buffer address/stride/height was incorrectly updated in the
plane_atomic_updateoperation instead of the vsync irq. This patch delays this operation in the vsync irq along with the other plane delayed setup.This issue was masked using legacy framebuffer and X11 modesetting, but is clearly visible using gbm rendering when buffer is submitted late after vblank, like using software decoding and OpenGL rendering in Kodi. With this patch, tearing and other artifacts disappears completely.
You mean the frontbuffer rendering nature of X11 with all it's tearing made the issue not noticeable? I'm also not clear what you mean with legacy framebuffer ...
Either way looks reasonable:
Quoted 72 lines
Cc Michal Lazo <[email protected]>Fixes bbbe775ec5b5 ("drm: Add support for Amlogic Meson Graphic Controller")Signed-off-by Neil Armstrong <[email protected]>--- drivers/gpu/drm/meson/meson_crtc.c | 6 ++++++ drivers/gpu/drm/meson/meson_drv.h | 3 +++ drivers/gpu/drm/meson/meson_plane.c | 7 +++---- 3 files changed, 12 insertions(+), 4 deletions(-)drivers/gpu/drm/meson/meson_crtc.c +6
-0@@ -36,6 +36,7 @@#include "meson_venc.h" #include "meson_vpp.h" #include "meson_viu.h" +#include "meson_canvas.h" #include "meson_registers.h" /* CRTC definition */ @@ -192,6 +193,11 @@ void meson_crtc_irq(struct meson_drm *priv) }else meson_vpp_disable_interlace_vscaler_osd1 (priv); +meson_canvas_setup (priv,MESON_CANVAS_ID_OSD1 , + priv->viu.osd1_addr, priv->viu.osd1_stride, + priv->viu.osd1_height,MESON_CANVAS_WRAP_NONE , +MESON_CANVAS_BLKMODE_LINEAR ); +/* Enable OSD1 */ writel_bits_relaxed (VPP_OSD1_POSTBLEND ,VPP_OSD1_POSTBLEND , priv->io_base +_REG (VPP_MISC ));drivers/gpu/drm/meson/meson_drv.h +3
-0@@ -43,6 +43,9 @@ struct meson_drm {bool osd1_commit;uint32_t osd1_ctrl_stat;uint32_t osd1_blk0_cfg[5 ]; +uint32_t osd1_addr; +uint32_t osd1_stride; +uint32_t osd1_height; } viu;struct {drivers/gpu/drm/meson/meson_plane.c +3
-4@@ -164,10 +164,9 @@ static void meson_plane_atomic_update(struct drm_plane *plane,/* Update Canvas with buffer address */ gem =drm_fb_cma_get_gem_obj (fb,0 ); -meson_canvas_setup (priv,MESON_CANVAS_ID_OSD1 , - gem->paddr, fb->pitches[0 ], - fb->height,MESON_CANVAS_WRAP_NONE , -MESON_CANVAS_BLKMODE_LINEAR ); + priv->viu.osd1_addr = gem->paddr; + priv->viu.osd1_stride = fb->pitches[0 ]; + priv->viu.osd1_height = fb->height;spin_unlock_irqrestore (&priv->drm->event_lock, flags); }Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list dri-devel at lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
Neil Armstrong
AppliedQuoted 6 lines · Daniel Vetter
Quoted 5 lines · Neil Armstrong
The plane buffer address/stride/height was incorrectly updated in the
plane_atomic_updateoperation instead of the vsync irq. This patch delays this operation in the vsync irq along with the other plane delayed setup.
Quoted 8 lines
Quoted 4 lines
This issue was masked using legacy framebuffer and X11 modesetting, but is clearly visible using gbm rendering when buffer is submitted late after vblank, like using software decoding and OpenGL rendering in Kodi. With this patch, tearing and other artifacts disappears completely.
You mean the frontbuffer rendering nature of X11 with all it's tearing made the issue not noticeable? I'm also not clear what you mean with legacy framebuffer ...
Yeah I don't have to correct technical terms, sorry.
Quoted 3 lines
Either way looks reasonable:
Acked-by Daniel Vetter <[email protected]>
Thanks,
Pushed to drm-misc-fixes.
Neil
Quoted 74 lines
Quoted 73 lines
Cc Michal Lazo <[email protected]>Fixes bbbe775ec5b5 ("drm: Add support for Amlogic Meson Graphic Controller")Signed-off-by Neil Armstrong <[email protected]>--- drivers/gpu/drm/meson/meson_crtc.c | 6 ++++++ drivers/gpu/drm/meson/meson_drv.h | 3 +++ drivers/gpu/drm/meson/meson_plane.c | 7 +++---- 3 files changed, 12 insertions(+), 4 deletions(-)drivers/gpu/drm/meson/meson_crtc.c +6
-0@@ -36,6 +36,7 @@#include "meson_venc.h" #include "meson_vpp.h" #include "meson_viu.h" +#include "meson_canvas.h" #include "meson_registers.h" /* CRTC definition */ @@ -192,6 +193,11 @@ void meson_crtc_irq(struct meson_drm *priv) }else meson_vpp_disable_interlace_vscaler_osd1 (priv); +meson_canvas_setup (priv,MESON_CANVAS_ID_OSD1 , + priv->viu.osd1_addr, priv->viu.osd1_stride, + priv->viu.osd1_height,MESON_CANVAS_WRAP_NONE , +MESON_CANVAS_BLKMODE_LINEAR ); +/* Enable OSD1 */ writel_bits_relaxed (VPP_OSD1_POSTBLEND ,VPP_OSD1_POSTBLEND , priv->io_base +_REG (VPP_MISC ));drivers/gpu/drm/meson/meson_drv.h +3
-0@@ -43,6 +43,9 @@ struct meson_drm {bool osd1_commit;uint32_t osd1_ctrl_stat;uint32_t osd1_blk0_cfg[5 ]; +uint32_t osd1_addr; +uint32_t osd1_stride; +uint32_t osd1_height; } viu;struct {drivers/gpu/drm/meson/meson_plane.c +3
-4@@ -164,10 +164,9 @@ static void meson_plane_atomic_update(struct drm_plane *plane,/* Update Canvas with buffer address */ gem =drm_fb_cma_get_gem_obj (fb,0 ); -meson_canvas_setup (priv,MESON_CANVAS_ID_OSD1 , - gem->paddr, fb->pitches[0 ], - fb->height,MESON_CANVAS_WRAP_NONE , -MESON_CANVAS_BLKMODE_LINEAR ); + priv->viu.osd1_addr = gem->paddr; + priv->viu.osd1_stride = fb->pitches[0 ]; + priv->viu.osd1_height = fb->height;spin_unlock_irqrestore (&priv->drm->event_lock, flags); }Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list dri-devel at lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel