From patchwork Thu Mar 2 15:39:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Armstrong X-Patchwork-Id: 9600531 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 B12D960453 for ; Thu, 2 Mar 2017 15:41:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9FA7E26419 for ; Thu, 2 Mar 2017 15:41:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 90DD42780C; Thu, 2 Mar 2017 15:41:59 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 87CB526419 for ; Thu, 2 Mar 2017 15:41:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=OGk3Z14OZSIohklQcxjIjUgKMPsLCqImSGAu8w1QzCc=; b=hTtte3w/D3v042Vdve/anubq/q Ikh3UqvAiZI9+A3jAftJFxiSuiKokCoipAcaiE3FVIgqeTMAlKJ5nsITbInh88z4PS30MFGdhKn9G GevQab+zpPUdIgTJjfydfebw0+7btQW1luKAkyJ9bOFuIGm1Gs2P6Odb2tfLpky1qAHyVy395Q+3G LKbkeA3FOHPbThDxZGeU16iAbT3BrpOnQCEGJFNDKS19/NofgC+gSnEYPq6p8l4G+aID9ty5An8Fi 03UiR1CR6920bmumBmbBDp1fn4EmV+Rmdr7aUO2AYY59ftrsX3NBiF716AvFX4XDLULxAR6Rg+ao+ /eHqXDug==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cjSrY-00033r-A5; Thu, 02 Mar 2017 15:41:52 +0000 Received: from mail-wm0-x229.google.com ([2a00:1450:400c:c09::229]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cjSqL-00024W-Vt for linux-arm-kernel@lists.infradead.org; Thu, 02 Mar 2017 15:40:42 +0000 Received: by mail-wm0-x229.google.com with SMTP id v186so138616182wmd.0 for ; Thu, 02 Mar 2017 07:40:17 -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:in-reply-to:references; bh=VeYx6Cvbvl2H8g6NWamWWOuqrKgVO9h3opJfmd6eM6k=; b=YqnPl/avcPZzBImcXC0inGJf1aRIPrwbMyFMwzY2N+cbU4eskgoQ7zuSAh3oKtEzV/ YzLI362YaX/qF/Y8zCVvXkJTLFcb4BqHXMKngqTNSZYMRwiDF5A2VOMDHGbDjE2+8l4Q aJjl1GgnIs/JZpqcVHGAosfhVhlxpwABCE9rZA9kLoory5aXBK6lG4/9GLZAcB0VqnAv NUhLQzVSgMcm+t3KWxCgtc5xJ3TB+7UfG5h0pVuRjWJYRd4/FYBZWuEUas4bxhdB9REV 3KJlhMQYLhy03Rz1ihq9wKR6uyH5e/grQmn4XQPmximA4oFHaGPNXIDNrsvFA2lUTjFP lWEQ== 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=sKPRt7F861x1+T8NU9nj2T2mPSNzDRKnCZUboyLeQYpkriR4mtaIznN/ryrVqPwOgd CLzMWNi0G7mE44OL2m4OO8nwMiA0uSf12NB1rEFybyLf5dCs7IB72GfHu3WcpdFxCmXO H8/fleErRpsStQUJDMCvJ49qrBHouv4gazu7N4MGWXmWjhnMnlZQQOI4n4OSUAfl9PwM huCIcEH0UkkahOKRli0P5eR2whzGJzkhCxZl+ijCaJrt/UQedf7Owqq12NTjHz9kuf/N KvPho/A2m5CZqbvheOzVWcmFXvlxcwYA3Yx2eUG/nKYx64zfEBS+83/RRPPFu7rn2lIg Sglg== X-Gm-Message-State: AMke39k4kORkk11Jy12JdgVgrWezlaaXlce0AIK0mGmXNQpUKX+ihgixsYw1S4TA/uPKlMft X-Received: by 10.28.111.151 with SMTP id c23mr1116905wmi.17.1488469216374; Thu, 02 Mar 2017 07:40:16 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id m201sm11717389wmd.19.2017.03.02.07.40.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 02 Mar 2017 07:40:15 -0800 (PST) From: Neil Armstrong To: airlied@linux.ie Subject: [PATCH 01/11] drm/meson: Use crtc_state for hdisplay and fix atomic flush/enable sync for vsync commit Date: Thu, 2 Mar 2017 16:39:57 +0100 Message-Id: <1488469207-523-2-git-send-email-narmstrong@baylibre.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1488469207-523-1-git-send-email-narmstrong@baylibre.com> References: <1488469207-523-1-git-send-email-narmstrong@baylibre.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170302_074038_285560_6DEA9029 X-CRM114-Status: GOOD ( 12.74 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org, Neil Armstrong MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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 = {