From patchwork Tue Mar 21 15:25:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Armstrong X-Patchwork-Id: 9636851 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 EA411602D6 for ; Tue, 21 Mar 2017 15:26:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E04D42833B for ; Tue, 21 Mar 2017 15:26:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D483A28418; Tue, 21 Mar 2017 15:26:02 +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 6CC3C2833B for ; Tue, 21 Mar 2017 15:26:02 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4D1976E719; Tue, 21 Mar 2017 15:26:01 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-x231.google.com (mail-wm0-x231.google.com [IPv6:2a00:1450:400c:c09::231]) by gabe.freedesktop.org (Postfix) with ESMTPS id D1DB66E719 for ; Tue, 21 Mar 2017 15:25:57 +0000 (UTC) Received: by mail-wm0-x231.google.com with SMTP id 196so3425714wmm.1 for ; Tue, 21 Mar 2017 08:25:57 -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=VeYx6Cvbvl2H8g6NWamWWOuqrKgVO9h3opJfmd6eM6k=; b=TZ74UsLdSkvB548W6zr1c1Zeqs82RivZ1Ihz9MbysIQRxNUAeO3lHhgitaw0xcflYZ H7CH27Lbgm+mw6GZ5LnbxTkpnxRsTW8WTprLZyec42PgZW9mooa7/XphxCsr9XrygpKW 90Faj65mT73YFk7oEKYkEFVLx3ksq/LvBMePCu8AkGdeqGae6/qVgym9PK1QjTKKxfzI SSPb/VCYAtxiICsyp+4hwhhxIkT8Np2Eq+zwQEteaioMLvB2msCld7ET/KPCPULgxkXm yqoABI6SGUPwO2o7Mi5XlRn8LTTne0ToN0IUcdHSkqarW0SAyMAbiu7v5UpJbCfBLi6h LbUg== 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=VeYx6Cvbvl2H8g6NWamWWOuqrKgVO9h3opJfmd6eM6k=; b=ack5EKCkzFDDyxFQcRMaja1DuVW+0VQJNcaTmYpOIxLnTxK7LNnyw1plzmeDyzJV8H MhuPTH28aNssiB+pcfX94d5cSQdURbAjII58V/t0wevtU1pXW1kJkJ2QwCIK0z4VSyY3 Z6SExBTiwasJ85KNAtvnH7255q4GpcjxbunkBRGQnJSqudN5rz8BPPLRuQslymLbaGO3 WkWOUon3/WZEWlaVlsJD7j41+Azr/zIOHzR8G1wxlXjjFQfN6ZQPK+sMelV8ClfDo936 VTWsh2QQLOeow15kpOnB4/aTfX++VEK7BU9hgBc7h/AStVCRiPFEliia7scpMkxAufwp DKgQ== X-Gm-Message-State: AFeK/H1yszECi2BEXgtU4TcMBY4tcJX85KDWp4iu6lhtK1s3cVmY7DA93mI77IIoMzy5EODz X-Received: by 10.28.30.19 with SMTP id e19mr3267817wme.52.1490109956483; Tue, 21 Mar 2017 08:25:56 -0700 (PDT) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id b13sm18088890wmf.6.2017.03.21.08.25.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 21 Mar 2017 08:25:55 -0700 (PDT) From: Neil Armstrong To: airlied@linux.ie Subject: [PATCH v2 01/13] drm/meson: Use crtc_state for hdisplay and fix atomic flush/enable sync for vsync commit Date: Tue, 21 Mar 2017 16:25:38 +0100 Message-Id: <1490109950-21421-2-git-send-email-narmstrong@baylibre.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1490109950-21421-1-git-send-email-narmstrong@baylibre.com> References: <1490109950-21421-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. 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 = {