From patchwork Mon Dec 18 14:57:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 122219 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp2936208qgn; Mon, 18 Dec 2017 06:58:14 -0800 (PST) X-Google-Smtp-Source: ACJfBovNRHdQJRvhhNuYuolXOAapRH67x5NH7vAtyRGUxrLUHmhTgJQjELSnutvIiJwhirCT+PeH X-Received: by 10.98.178.137 with SMTP id z9mr18964pfl.114.1513609094540; Mon, 18 Dec 2017 06:58:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513609094; cv=none; d=google.com; s=arc-20160816; b=C8SZkZ79PbVa3GyCOMuCMQx4+JdRZ9GYoj8AJyjeI0gzeN+X0+AJ4ENV8vRe+l2uEO emiYaHiAWjORvZD+juutehLRnyrMlGbdxswEYy5HkyVVbFMaJqjIC8fP4sgO0ijNWtfI hgcDup61LhFENUp74v2tPfircKRiI2L4Z6YQ4wzQRXXxRfUc0o9EqUCq/Fxe+LMyv9NS BFc8AHQ0Ot++XLVs/77q+FjE+hSKXlQ30BfSs40WNRnk1whC99029z54YoZpEg2iDI89 CC/JkbV37XqKHLABjI1sZe33GDrfOaycE6cNf+vNVee5iQQVEE22+NJnY49Brdrg4Oyy oL8A== 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=F8eqkOwSD9xulPy3PvTdoAtt9ehb5szKQjx7lv8Wu08=; b=0bilyCqf3OPeclUb2CfgzA1NLwBQ5lpT/4MjGEKeK88owARD4UTAh6IZPJVjq120xT Ew5gZcU91snEpneGjrg1wAgul0jqdyeHysXbkND2sUABv8uHcCA4ih237O+xha7KB2Qb TMx5O/9chIOIOjX2eePhSu/juCiEdOCAievZNZavaNeiiAai5tWQ9YMw6hruFcmOeFkF pFxUp+HH/m9Rdko354rgyvobZeeoT3UQTNZqZGEvavP9Lo3AxRPGDgfa2r3rpW2dEbaq dNCGm8hwpjsITfSbWM5wTLQiGzVx5rbeqI93vpNLjdS7bWmLglRTXsX8/Mye6bdvzNVa QP7A== 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 c67si9593535pfl.262.2017.12.18.06.58.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Dec 2017 06:58:14 -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 C042089C0A; Mon, 18 Dec 2017 14:58:08 +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 6656A89BC2 for ; Mon, 18 Dec 2017 14:58:06 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id 7398F206FC; 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 50D7E20378; Mon, 18 Dec 2017 15:58:05 +0100 (CET) From: Maxime Ripard To: Daniel Vetter , David Airlie , Chen-Yu Tsai , Maxime Ripard Subject: [PATCH v2 06/12] drm/sun4i: engine: Create an atomic_begin callback Date: Mon, 18 Dec 2017 15:57:53 +0100 Message-Id: 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. 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 b810c26d78bb..ec4d54f596d4 100644 --- a/drivers/gpu/drm/sun4i/sunxi_engine.h +++ b/drivers/gpu/drm/sun4i/sunxi_engine.h @@ -33,6 +33,19 @@ struct sunxi_engine_ops { void (*apply_color_correction)(struct sunxi_engine *engine); /** + * @atomic_begin: + * + * This callback allows to prepare our backend 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