From patchwork Thu Feb 15 10:19:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Armstrong X-Patchwork-Id: 10220805 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id AB067601E7 for ; Thu, 15 Feb 2018 10:19:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8A0A72910C for ; Thu, 15 Feb 2018 10:19:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7CD1829115; Thu, 15 Feb 2018 10:19:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E9A742910C for ; Thu, 15 Feb 2018 10:19:45 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CA98889259; Thu, 15 Feb 2018 10:19:43 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-x243.google.com (mail-wm0-x243.google.com [IPv6:2a00:1450:400c:c09::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id 81BDA89259 for ; Thu, 15 Feb 2018 10:19:42 +0000 (UTC) Received: by mail-wm0-x243.google.com with SMTP id t74so27930366wme.3 for ; Thu, 15 Feb 2018 02:19:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=8wJdEgjeCjI7q0Je5d9D3qQRfDAFGoJ12APny6XUGK8=; b=APebN6ZHnLDOW8YwmQ6rtFoXg+mXqPYl0B2WMV0rW0sDi1trsQoPw8/JFDMj/5eJ92 Fy017efBYLeKICazmhCp2Vs8ZESh80lPxYfQnPhXkhIPAQUxSTgV/ifl3goxjLCea1P6 /hBBYPnkLubif4JLSfjlxrcEV/PJVKwB72+FRoaRFtJpK9pxjDnKRxdENUsiuAD23VpD cj4OgdQNTMLFLqt1N2WVu7ZJIjO6mbzpajhdiPEGEVDQGCWVj2/AjEq1kvD25RBXSBPz BX+4Y9Rnn/KHlytOiJTkr+JbOhxv8GhQ1UnpXA0sLQWzYetBFdChMMOMzVubtGJO+rP4 cnCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=8wJdEgjeCjI7q0Je5d9D3qQRfDAFGoJ12APny6XUGK8=; b=Tdl4MDP6cpDDFUs0dvQPdydZoTIbnOAXEF+dtlIQPl4ezjC32hGQamVR8Fq+Q6+yCk tHIPUEpWPvmL5hCpV0LbmDMn3OfZgTQG62z5DuMhWRqheMLrOUhgogHwAB5VOq4TdDWW kRv+733VDQ0c4okYC6c/DGW7l9/nxbTXw5C8sDO9/pyL3+3ZEYU7pEMVhyh4TlsDCsDz 8ru6TTl337xmA07674BFYpGsa0zHm2QF6jo9ijzNs/SYHfr5v2ZJUqSWs8gSHl/0Xq7U 1OcFdqgbCIhnjfpjNfW2sA8sFDDRBFhHWThwOaFSWb7HjIgypHZYR07gxuwVP1+UOww3 5Wmw== X-Gm-Message-State: APf1xPDvc9yH7PQ4MELzs3Rn7heG5NlKaIc9LpABUZem+IsEZBeSkOqH 8uTceYBSvjKCW7CO1e6XqFn40w== X-Google-Smtp-Source: AH8x2266K+vNSSYeORoz3Gj9BL6nNhPJsmA8/SAQy3ak8oziU85UOFGuBeaC4MuBei8MrGrUhMF6og== X-Received: by 10.28.46.22 with SMTP id u22mr1572646wmu.47.1518689980651; Thu, 15 Feb 2018 02:19:40 -0800 (PST) Received: from bender.baylibre.local ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id 2sm14413310wra.58.2018.02.15.02.19.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 15 Feb 2018 02:19:40 -0800 (PST) From: Neil Armstrong To: airlied@linux.ie Subject: [PATCH] drm/meson: fix vsync buffer update Date: Thu, 15 Feb 2018 11:19:36 +0100 Message-Id: <1518689976-23292-1-git-send-email-narmstrong@baylibre.com> X-Mailer: git-send-email 2.7.4 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Neil Armstrong , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Michal Lazo , linux-amlogic@lists.infradead.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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. Cc: Michal Lazo Fixes: bbbe775ec5b5 ("drm: Add support for Amlogic Meson Graphic Controller") Signed-off-by: Neil Armstrong Acked-by: Daniel Vetter --- 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(-) diff --git a/drivers/gpu/drm/meson/meson_crtc.c b/drivers/gpu/drm/meson/meson_crtc.c index 5155f01..0552020 100644 --- a/drivers/gpu/drm/meson/meson_crtc.c +++ b/drivers/gpu/drm/meson/meson_crtc.c @@ -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)); diff --git a/drivers/gpu/drm/meson/meson_drv.h b/drivers/gpu/drm/meson/meson_drv.h index 5e8b392..8450d6ac 100644 --- a/drivers/gpu/drm/meson/meson_drv.h +++ b/drivers/gpu/drm/meson/meson_drv.h @@ -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 { diff --git a/drivers/gpu/drm/meson/meson_plane.c b/drivers/gpu/drm/meson/meson_plane.c index d0a6ac8..27bd350 100644 --- a/drivers/gpu/drm/meson/meson_plane.c +++ b/drivers/gpu/drm/meson/meson_plane.c @@ -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); }