From patchwork Tue Jan 9 10:09:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 123850 Delivered-To: patch@linaro.org Received: by 10.80.140.226 with SMTP id r31csp266366edr; Tue, 9 Jan 2018 02:09:58 -0800 (PST) X-Google-Smtp-Source: ACJfBot1JG7hBMmr/cM46+eOYcvNjM3AIeELNaridraJOr57FDBBIl2oOArDu7b6uqWV1xs693y+ X-Received: by 10.98.17.193 with SMTP id 62mr8735831pfr.126.1515492597970; Tue, 09 Jan 2018 02:09:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515492597; cv=none; d=google.com; s=arc-20160816; b=lFiswftEt4jwMaAjWjVcULYD8KM33GugD10tMcmcHAv2TWPMEPm1cpALvjB3l5oN4S FtB72rheKV0kxobMI5Ck+WnfdUBpH/D45tcjQA00Q6fxe9GLFXsCFAlEuvCOE7+iSHIY NjIE1MMqGIqNe6eY0dfUqwQAs05NJPe3xqqvDEs5vNq6hkGttaTcBU/pBiDBEOTWo85m EWC1LLj/cajh45X4QtGlIFVQ1Q51NWJ/fpgc6RYa7uDx/MmXwH5IMo2FEQEz/mA6Oljv FsHpeO8IwvkxtDieZLEWjYI0M5XzHS3NCSLe98OTMIARxyuHGOsenn6h69I6jU9WUaPo IVHw== 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=wsjo59dYEgETpZ1UmkXDZeJKyuqj+uF+Bel8odEnUGg=; b=fwTmNfQke5D5rlPckf3WwJL0XGsnq4/M7CLvz6vv5s7LFD5aQxyvTdjkOXaxRbtLCP 6TtM6OfHBhFz55eS+u9HWZ1AelmQpP3UOKUDk1i78sWZNE/kmswguQV5tc1qJE4+H06B BtCaTz9ZYdDhWvo9cCu0GTaQFHnHtp/eEJNCSvPJx2NauLZBruSVHEeO6RuviWQ7nt52 SVONPjfwx8ppSezkrCbHfl4OSA6Hn1vkl/DH9OlJdYMJvO1d0RVKQnMXdaAZXR1iFQkm cPMJPlomn+ANGlUhNVZSLoYKjahuCJ/cjmY4W9TI/dUNwf8vZ3rLhvjmhSLjAeppLygS Bv+g== 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 p11si9844397pfh.334.2018.01.09.02.09.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Jan 2018 02:09:57 -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 392C16E6EE; Tue, 9 Jan 2018 10:09:51 +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 CC3936E6E8 for ; Tue, 9 Jan 2018 10:09:49 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id 53FAC20949; Tue, 9 Jan 2018 11:09:48 +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 01CFD20727; Tue, 9 Jan 2018 11:09:30 +0100 (CET) From: Maxime Ripard To: Daniel Vetter , David Airlie , Chen-Yu Tsai , Maxime Ripard Subject: [PATCH v3 06/13] drm/sun4i: engine: Add a VBLANK quirk callback Date: Tue, 9 Jan 2018 11:09:19 +0100 Message-Id: <7c298d43aa1500196aa5d15d7a7c0f228c7a6f3c.1515492513.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. Reviewed-by: Chen-Yu Tsai Signed-off-by: Maxime Ripard --- drivers/gpu/drm/sun4i/sun4i_tcon.c | 4 ++++ drivers/gpu/drm/sun4i/sunxi_engine.h | 13 +++++++++++++ 2 files changed, 17 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 b819d4f9f02f..54c029877531 100644 --- a/drivers/gpu/drm/sun4i/sunxi_engine.h +++ b/drivers/gpu/drm/sun4i/sunxi_engine.h @@ -85,6 +85,19 @@ struct sunxi_engine_ops { * This function is optional. */ void (*disable_color_correction)(struct sunxi_engine *engine); + + /** + * @vblank_quirk: + * + * This callback is used to implement engine-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); }; /**