From patchwork Mon Dec 18 14:57:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 122227 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp2936857qgn; Mon, 18 Dec 2017 06:58:54 -0800 (PST) X-Google-Smtp-Source: ACJfBosXxLLr/PiU5W9Y2Qn9IZe2V7w7BA/UYZnHSYXwoklHLIo5fSvl6S7aMwPCQvSiUpFR95Pw X-Received: by 10.159.197.1 with SMTP id bj1mr19092plb.118.1513609134602; Mon, 18 Dec 2017 06:58:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513609134; cv=none; d=google.com; s=arc-20160816; b=rJMz6t1Qc3Xk//bnRUW82QTN2OoKUmzYMdl5ha8WJLatlXFAgwvD3w69BjBWO9bMbs BS1XFNvxYRv1pqdT0vl+Ye5UuVToxeIsW31ENppGsumHHK6oQgi+Svz5XxTQwi9wWEQc ScyU0TE54LIj1MXqCYL0cXoKwHNU1JcV54DpI4pm9YfY/FdcQT4U7PO89mb2EPiOfXbw m9UZMCRRFDi9nUVSu1IyAo0G56c6/BYvTb2duFXrSLr2J7J/eYUec6wLeiRL7lOc8Mmv 7PfG46rVGSqCi40ed+I2fYnjea2rHEbcGVL35rN/mkj4l9CZIxARxIqWWptNxdk9bWkg VxNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:cc:references:in-reply-to:references:in-reply-to :message-id:date:subject:to:from:delivered-to :arc-authentication-results; bh=bSS6unrSMzmnyLGaQGoK0rNNJXZNeAJp4C+r3r/WgCU=; b=Ip4uIgG6EnoLNt7P+M/6Eiw8otvtmXkj0dUxQ7aYojxGagEf2yWbIt6UmV6wEkKrq5 H4PJFHTaI/EB87FdteQJNytJ2c0lUqwGMvMiGsHGtctyM3P++qEtJETOBsNxFQ4O3h6n XQP6k1ssJjyEtzCG6T/pGFQ4Th39p3xG6DWD8cT1FLgfZXutX622WvZfzHOq6nYx6w86 E6axDaBRYR4FrYWoly5gdad939z59Yg5wNrVjSezU5vxXSsSlBruwoULhUfM5nnvOT0w zBoqPm5Gv4b/C/sX2wxTtRcp5b3wzU54qj2ySUjNw8qpPWvxdDr3PjAGKW/bAWOTvjn2 lyGQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id f13si8537144pgn.617.2017.12.18.06.58.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Dec 2017 06:58:54 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1F5F66E1C1; Mon, 18 Dec 2017 14:58:10 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail.free-electrons.com (mail.free-electrons.com [62.4.15.54]) by gabe.freedesktop.org (Postfix) with ESMTP id 5896189C0A for ; Mon, 18 Dec 2017 14:58:06 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id 14BA2206F1; Mon, 18 Dec 2017 15:58:05 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.free-electrons.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from localhost (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.free-electrons.com (Postfix) with ESMTPSA id DFA1920378; Mon, 18 Dec 2017 15:58:04 +0100 (CET) From: Maxime Ripard To: Daniel Vetter , David Airlie , Chen-Yu Tsai , Maxime Ripard Subject: [PATCH v2 05/12] drm/sun4i: engine: Add a VBLANK quirk callback Date: Mon, 18 Dec 2017 15:57:52 +0100 Message-Id: <63abbe22845c3332e032053a26948486a3514fa8.1513609024.git-series.maxime.ripard@free-electrons.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: References: In-Reply-To: References: Cc: Thomas Petazzoni , narmstrong@baylibre.com, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, thomas@vitsch.nl 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" In some cases, the display engine needs to apply some quirks during the VBLANK event. In the Display Engine 1.0 case for example, we can only disable the frontend once the backend has been, which is at VBLANK. Let's introduce a callback that can be implemented by the various engines. Signed-off-by: Maxime Ripard Reviewed-by: Chen-Yu Tsai --- drivers/gpu/drm/sun4i/sun4i_tcon.c | 4 ++++ drivers/gpu/drm/sun4i/sunxi_engine.h | 12 ++++++++++++ 2 files changed, 16 insertions(+) diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c index e122f5b2a395..55f54b54293c 100644 --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c @@ -368,6 +368,7 @@ static irqreturn_t sun4i_tcon_handler(int irq, void *private) struct sun4i_tcon *tcon = private; struct drm_device *drm = tcon->drm; struct sun4i_crtc *scrtc = tcon->crtc; + struct sunxi_engine *engine = scrtc->engine; unsigned int status; regmap_read(tcon->regs, SUN4I_TCON_GINT0_REG, &status); @@ -385,6 +386,9 @@ static irqreturn_t sun4i_tcon_handler(int irq, void *private) SUN4I_TCON_GINT0_VBLANK_INT(1), 0); + if (engine->ops->vblank_quirk) + engine->ops->vblank_quirk(engine); + return IRQ_HANDLED; } diff --git a/drivers/gpu/drm/sun4i/sunxi_engine.h b/drivers/gpu/drm/sun4i/sunxi_engine.h index da2dd36dfbb6..b810c26d78bb 100644 --- a/drivers/gpu/drm/sun4i/sunxi_engine.h +++ b/drivers/gpu/drm/sun4i/sunxi_engine.h @@ -86,6 +86,18 @@ struct sunxi_engine_ops { struct drm_plane **(*layers_init)(struct drm_device *drm, struct sunxi_engine *engine); + /** + * @vblank_quirk: + * + * This callback is used to implement backend-specific + * behaviour part of the VBLANK event. It is run with all the + * constraints of an interrupt (can't sleep, all local + * interrupts disabled) and therefore should be as fast as + * possible. + * + * This function is optional. + */ + void (*vblank_quirk)(struct sunxi_engine *engine); }; /**