From patchwork Tue Jan 9 10:09:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 123851 Delivered-To: patch@linaro.org Received: by 10.80.140.226 with SMTP id r31csp266500edr; Tue, 9 Jan 2018 02:10:06 -0800 (PST) X-Google-Smtp-Source: ACJfBovj5O33/kvE2fggD4tW8FPlQ1/ap8vGy0GVEJ8LqqKZW9aGHdy4kp9otOnDhIzujwKGy6mm X-Received: by 10.101.72.4 with SMTP id h4mr12213177pgs.64.1515492606131; Tue, 09 Jan 2018 02:10:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515492606; cv=none; d=google.com; s=arc-20160816; b=cDrY54vPFIreMooGcIwKoxp/b0SwNSncybNLfygQO4BuLxud1Z+1tD5usrfjEDFLV/ NN+5ixmkcR4gS6aGx4EOQzmH7KJxTOtICmpyjIWdUSwb9n7N7TD7Q+5C0V+7eAilMHyp jRxDoiquShIJyJx0r/8h4GL6L69slWcuv5AhMK60yvxAtkTKECch3oSb/QnMAhFuW4c2 lZ3D6g06AhWbIFSnlNkt8vT7ZBBgG3TXJ1+umIhcqttjCYxCiIStFwx4Foq3zuoX5QL2 T+LKIP9UCk02268OfQSUYqbAIbaLvb4SC2jeWexnECnu4tMU9QT/C5yoaUikZssjKQa+ DpGA== 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=5ppOn4nIDcMgZR9fgDUt45lOY+UHWCwXSj39tS/dgDA=; b=laU886C6v0jWPsQzaMhZOyf7yvXDsGpsC5I2WdcDH+Emirey7FfpArjNrrGhepDMqb PJDvx0vPNVB9KtOLwdkOoMcrXpu+901yAaK4onHKMrraJ49hbjvAXwPE70N8Ewgd0sbu 1H11jS7ci9cZxlfK+XSN2aNCjL5M5VbM+mDTG9o/T/qdfsgWFAfRTekqpPDbtHMrfROA f3kmaXO+ES3AxOr1YG3wUt4YuSQ4OiMwfG/MM0Y1z8wv7NJDBMkRYC84tEUyeCRRXf15 3lj3ZIxAxJU3M1dEJnTrpuYxAX+YG0vhkUPpwoxStpaY8K1OB/BIDixqHDstTv0TPmew KL+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 x12si8839891pgc.25.2018.01.09.02.10.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Jan 2018 02:10:06 -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 48E576E6F5; 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 CE5406E6E9 for ; Tue, 9 Jan 2018 10:09:49 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id 5684D2093C; 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 627DD2072D; Tue, 9 Jan 2018 11:09:31 +0100 (CET) From: Maxime Ripard To: Daniel Vetter , David Airlie , Chen-Yu Tsai , Maxime Ripard Subject: [PATCH v3 07/13] drm/sun4i: engine: Create an atomic_begin callback Date: Tue, 9 Jan 2018 11:09:20 +0100 Message-Id: <44110951ae0cc13767fefc7fc1d9e2ec782d0a40.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" We have to implement some display engine specific behaviours in atomic_begin. Let's add a function for that. Reviewed-by: Chen-Yu Tsai Signed-off-by: Maxime Ripard --- drivers/gpu/drm/sun4i/sun4i_crtc.c | 6 +++++- drivers/gpu/drm/sun4i/sunxi_engine.h | 13 +++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/sun4i/sun4i_crtc.c b/drivers/gpu/drm/sun4i/sun4i_crtc.c index 2a565325714f..f549f2874353 100644 --- a/drivers/gpu/drm/sun4i/sun4i_crtc.c +++ b/drivers/gpu/drm/sun4i/sun4i_crtc.c @@ -64,6 +64,7 @@ static void sun4i_crtc_atomic_begin(struct drm_crtc *crtc, { struct sun4i_crtc *scrtc = drm_crtc_to_sun4i_crtc(crtc); struct drm_device *dev = crtc->dev; + struct sunxi_engine *engine = scrtc->engine; unsigned long flags; if (crtc->state->event) { @@ -73,7 +74,10 @@ static void sun4i_crtc_atomic_begin(struct drm_crtc *crtc, scrtc->event = crtc->state->event; spin_unlock_irqrestore(&dev->event_lock, flags); crtc->state->event = NULL; - } + } + + if (engine->ops->atomic_begin) + engine->ops->atomic_begin(engine, old_state); } static void sun4i_crtc_atomic_flush(struct drm_crtc *crtc, diff --git a/drivers/gpu/drm/sun4i/sunxi_engine.h b/drivers/gpu/drm/sun4i/sunxi_engine.h index 54c029877531..baa7a1f95300 100644 --- a/drivers/gpu/drm/sun4i/sunxi_engine.h +++ b/drivers/gpu/drm/sun4i/sunxi_engine.h @@ -23,6 +23,19 @@ struct sunxi_engine; */ struct sunxi_engine_ops { /** + * @atomic_begin: + * + * This callback allows to prepare our engine for an atomic + * update. This is mirroring the + * &drm_crtc_helper_funcs.atomic_begin callback, so any + * documentation there applies. + * + * This function is optional. + */ + void (*atomic_begin)(struct sunxi_engine *engine, + struct drm_crtc_state *old_state); + + /** * @atomic_check: * * This callback allows to validate plane-update related CRTC