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: 9600535 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 A6F3960453 for ; Thu, 2 Mar 2017 15:42:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 97CB9272F9 for ; Thu, 2 Mar 2017 15:42:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8CC6627BFF; Thu, 2 Mar 2017 15:42:12 +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 46440272F9 for ; Thu, 2 Mar 2017 15:42:12 +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=oWdQzDT3CTX6ng1TLwHG1ttes9w+3h0ZZ1MNY8LnIow=; b=RXm7gjLnkALRzsLBqCq9ZfKHom m8UDXEwX2KFgjn0yG/8GvlwkY7SAnUQfRFz2kjzKwKrUDCgoEcsAHbStDRWvCOTgn2tSMTLbD4feo PNhGBnUHyr1eBSIGOd0VJwZaaUqLLhEbFwxYUw09tVuTkFFBQq4S37kh8dGGpcmANBALuj4IqDdTF 7mjBzkfh4fs2tHIiQ8v52jKGVvZytPNFGrVy5ABXXRyBh8wuq4DPAWzt88iPCcZ7KFGCjOgCW3sz/ 12Mx8aIWVEHWHae6WA6r+DCwsFMkzqSZKYcm5W/wrzrDIVZMAED5mkZoBMAo2D9Eemw6cu25InTgm mFOSDXRA==; 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 1cjSrk-0003LS-Qj; Thu, 02 Mar 2017 15:42:04 +0000 Received: from mail-wm0-x22e.google.com ([2a00:1450:400c:c09::22e]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cjSqL-00024X-Ty for linux-amlogic@lists.infradead.org; Thu, 02 Mar 2017 15:40:42 +0000 Received: by mail-wm0-x22e.google.com with SMTP id n11so27670533wma.1 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=BCdWG2XMxzP5tP4EUxHoTU+m63WHfVnqGFLG6jgKFKZjgFaX55LSdfk5KKz2jv8zx4 lXL7GeQEIsDkz1tlTnr3QPqsduZmKk9iutXBnWXxcoJ+RjBmJDMMKoIXksC4zvR6eM7h 5WfS22MYAXiJe28hk7bM51wxhSaF26y3YwD1jVQwFfbVDqRtVmUrGUsduck11mx5PmOt roxJOpGMQBhIYTbrVXZQ6X7qspp3/topihXryKSV+KvxcRC1Lif+nEV5J+bujjLLQ9Rb KKdQZyJP6Plb6ebT/Tz9O7rnPaeyFtdpW1bLMjMJH0zgy3vIQdgl8I+rExO7ao41gxka +oNw== X-Gm-Message-State: AMke39lIa87l2lZ7cnt7YOEfH+SmC5lRZ7KIKYYG7kW9nCpmGOds4h58Uh4saTKc0f8sbTfh 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_229501_32958988 X-CRM114-Status: GOOD ( 11.18 ) X-BeenThere: linux-amlogic@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-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=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 = {