From patchwork Tue Apr 4 12:15:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Armstrong X-Patchwork-Id: 9661471 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 4AD5F60352 for ; Tue, 4 Apr 2017 12:15:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3E34227CF3 for ; Tue, 4 Apr 2017 12:15:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 332D828502; Tue, 4 Apr 2017 12:15:50 +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 2A9F7284DE for ; Tue, 4 Apr 2017 12:15:49 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 60F156E5A5; Tue, 4 Apr 2017 12:15:47 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr0-x22f.google.com (mail-wr0-x22f.google.com [IPv6:2a00:1450:400c:c0c::22f]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9E7566E098 for ; Tue, 4 Apr 2017 12:15:44 +0000 (UTC) Received: by mail-wr0-x22f.google.com with SMTP id w11so210510273wrc.3 for ; Tue, 04 Apr 2017 05:15:44 -0700 (PDT) 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:in-reply-to:references; bh=++pOKCM67kmr9iKHxXlrxdOF82Y1UUoVgUBZEiZY2L0=; b=XT2I/enQ0G/6UthhlyqQoH06JfRvtPFDeuXMGgyttubbHEbW4LQ8J7HekzXmHy0NRg ezfqjhsXkdUZTuo13jkBLX3+7Oz66kCswjRhT2IpOBAua6Ha87EMKJxDfx4ZVu8gHGm/ hC0C8/cof46F0Ev/hnU5kdxjIieQULRJBaESpmJNNuOgmCOx5ggNfJmmzm5WAwvS8gX4 bUV5LewlRoEZ1OJj7pcOrVUN0kx/YWYuh7PJTx68VM574FnaOR5Yscs3lraIzsamdr1k ttLFNEFcIhp/RzscCkcnj9GLwG9fmuCjexP+p7CUfGz39KWrDSw4gxx1jX2fXnuMRUUA MTyQ== 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:in-reply-to :references; bh=++pOKCM67kmr9iKHxXlrxdOF82Y1UUoVgUBZEiZY2L0=; b=mL2FNqeIRkKaG1rkkAwR9G9GbSJsEJRV7dSHLabpVvoY62HvSSLO0EdhUKrnw4arXY 3CHyMrAbgiiyPypVGZtZ6okg63nRIcVe7vccNuxSIOaXaYzV7+WuFjGkIkxIoZvkYss0 cjqjk0iBV4cyYKd+9neEhmXKthFdbfO6D2+469ZfH8lEy+QHrT0r05AloQSYkHlQfKMz t0AkwNnyNB043Md0+3gIvBAc42IV9FqDwVmYnoRg8c9bHqCXF1L2uf1U1NxXZNuCTpxj Aa8s1qunOLffq+Ro4qo7tRgQs7JqU88/z3nR7UYt3LUpejk4xPlxu+f7yHtRN3aFo9kb CpUg== X-Gm-Message-State: AFeK/H2oTa6+FhHf99wZKZvIWZ6eCCrQW5P+Nb5zCb0ogYJQUNHEnShDPdSx0Tp6h6E+uLik X-Received: by 10.223.130.102 with SMTP id 93mr20966185wrb.59.1491308142272; Tue, 04 Apr 2017 05:15:42 -0700 (PDT) Received: from zoidberg.local ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id a66sm250242wrc.58.2017.04.04.05.15.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 04 Apr 2017 05:15:41 -0700 (PDT) From: Neil Armstrong To: airlied@linux.ie Subject: [PATCH v3 01/11] drm/meson: Use crtc_state for hdisplay and fix atomic flush/enable sync for vsync commit Date: Tue, 4 Apr 2017 14:15:21 +0200 Message-Id: <1491308131-22071-2-git-send-email-narmstrong@baylibre.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1491308131-22071-1-git-send-email-narmstrong@baylibre.com> References: <1491308131-22071-1-git-send-email-narmstrong@baylibre.com> Cc: linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org, Neil Armstrong X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Clean the crtc_enable by using the proper crtc_state instead of the state of the primary plane state data. Also fix the dependency to commit the plane changes even if enable is called after the flush. Acked-by: Daniel Vetter Signed-off-by: Neil Armstrong --- drivers/gpu/drm/meson/meson_crtc.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/meson/meson_crtc.c b/drivers/gpu/drm/meson/meson_crtc.c index 0fe49ec..c986eb0 100644 --- a/drivers/gpu/drm/meson/meson_crtc.c +++ b/drivers/gpu/drm/meson/meson_crtc.c @@ -82,11 +82,18 @@ static void meson_crtc_disable_vblank(struct drm_crtc *crtc) static void meson_crtc_enable(struct drm_crtc *crtc) { struct meson_crtc *meson_crtc = to_meson_crtc(crtc); - struct drm_plane *plane = meson_crtc->priv->primary_plane; + struct drm_crtc_state *crtc_state = crtc->state; struct meson_drm *priv = meson_crtc->priv; + DRM_DEBUG_DRIVER("\n"); + + if (!crtc_state) { + DRM_ERROR("Invalid crtc_state\n"); + return; + } + /* Enable VPP Postblend */ - writel(plane->state->crtc_w, + writel(crtc_state->mode.hdisplay, priv->io_base + _REG(VPP_POSTBLEND_H_SIZE)); writel_bits_relaxed(VPP_POSTBLEND_ENABLE, VPP_POSTBLEND_ENABLE, @@ -101,6 +108,7 @@ static void meson_crtc_disable(struct drm_crtc *crtc) struct meson_drm *priv = meson_crtc->priv; priv->viu.osd1_enabled = false; + priv->viu.osd1_commit = false; /* Disable VPP Postblend */ writel_bits_relaxed(VPP_POSTBLEND_ENABLE, 0, @@ -137,8 +145,7 @@ static void meson_crtc_atomic_flush(struct drm_crtc *crtc, struct meson_crtc *meson_crtc = to_meson_crtc(crtc); struct meson_drm *priv = meson_crtc->priv; - if (priv->viu.osd1_enabled) - priv->viu.osd1_commit = true; + priv->viu.osd1_commit = true; } static const struct drm_crtc_helper_funcs meson_crtc_helper_funcs = {