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: 9600507 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 C799760453 for ; Thu, 2 Mar 2017 15:40:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B9328285A9 for ; Thu, 2 Mar 2017 15:40:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AE4A7285AF; Thu, 2 Mar 2017 15:40:20 +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 4B2AE285A9 for ; Thu, 2 Mar 2017 15:40:20 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 143DC6EBA6; Thu, 2 Mar 2017 15:40:19 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-x233.google.com (mail-wm0-x233.google.com [IPv6:2a00:1450:400c:c09::233]) by gabe.freedesktop.org (Postfix) with ESMTPS id B63AA6EBA3 for ; Thu, 2 Mar 2017 15:40:17 +0000 (UTC) Received: by mail-wm0-x233.google.com with SMTP id n11so28549661wma.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=rhtKMSme9Sj/+UjsGXIjGFpD5GFjdrXxtuRXZo8W/039GpSonr3qjmrrmVGGc/rNuM rV5PJJR97kMPDboKw8Un6FY7p0bE2WnPbKGMUB7YkmDS9vB1AmF/WI3XEPGwTsXAbfgb xpmx3srvmunocpLs44s2PgY3gTZ3wPG73gH8/q9Q90qmDS6mcChWdTfEwqTGLUnjDuef Q3rHk1ywm26w+qwp1u+NN8XS31KywWyOf+6GJTI1nf0AZdsrDRLax/XVU9PUQ9pUwUyS gfhn+Ju8fw51I3qV1ZqHgbrldrGJlL3JlMLPObwnSc1v2IisT6rwpEp8gpLy6N3cfG97 OmMw== X-Gm-Message-State: AMke39ldBFD3Bdy1rcf07kdn+5ROj7cqpMXVh2yheLOCgRE9An6fOe/PgepstquBgjGZ/6Vv 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> 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 = {