From patchwork Mon Dec 18 14:57:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 122225 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp2936663qgn; Mon, 18 Dec 2017 06:58:42 -0800 (PST) X-Google-Smtp-Source: ACJfBovAGZ9E3mnyGFVsju42m000ZxVRSJJvtuljaKtg0NKM5deg7aXAn2Qsz58Q+AO7d7mv4RGR X-Received: by 10.159.207.141 with SMTP id z13mr8218plo.328.1513609122853; Mon, 18 Dec 2017 06:58:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513609122; cv=none; d=google.com; s=arc-20160816; b=EeG2VkfOn+MwknhHOeTuoM40QgJO8hh+iflwvSrElZB3bL56nIjrd0Q9dwVNbW/NM0 rxFwsg9ulWKnf1ktkP7QRsDmp2QhXMu6ATgm8nEJrAW9Tg6kXPY45JjND2AX+Kme2zmu 4jKjNJUuR0X0HheqaoScnUIH4UgecdM9pSJCNJ8PeWEaToWgbIfk/gyAYeJGi1LBYZpx fBEq7OYhfnbavbj6dgQzlI1dH6kLnTXY9t9NTLQAA31Ara/yL2vT5NGQ0CN8RYbbYXwF 0kmuEJTPj9CSCdhBblui4o9VpabvAWW1sy204LvtExWhq5KT2iZsMC48kLyCgK1aNIAJ ZDIw== 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=bGHyOgrQAsxwR8qPetKtn6GaBae1Om5BwFswlXu09Cw=; b=pJBzKL/dGQmGxXZdPEFNtNiL/ekv+hlxxylQKGXN24EyT81iMVDrAp6SfYoyK4wsN9 rMcggdkau6z4do3bDDPsn3YZwjsNt5/gtegl13t3mfblW0mfLgfG1tc0QniPWnh9oyVY BH7jrW2mL0GJ4t2G53r+ZD8ZZn9onn49qOXOXW7AEhEgd/XeXi9rWO2Zbp8QfoGLHiAl QKk5FakggIH1EciS5GNECjhmIkBFz6qVd6L11XkahTU/OW52W8nxes7ALE6X7LCnRKVd 9BJf+zGACJoHF5tMQwBxO7z5Mo2Oim6p7yCOs3F1L9TVtJoQMtyontZKbsXKt5p6arPD vyoA== 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 l1si9504826pff.236.2017.12.18.06.58.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Dec 2017 06:58:42 -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 9307D89BC2; Mon, 18 Dec 2017 14:58:07 +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 2F65789B9F for ; Mon, 18 Dec 2017 14:58:05 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id E1185203B5; Mon, 18 Dec 2017 15:58:03 +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 BC81320378; Mon, 18 Dec 2017 15:58:03 +0100 (CET) From: Maxime Ripard To: Daniel Vetter , David Airlie , Chen-Yu Tsai , Maxime Ripard Subject: [PATCH v2 02/12] sun4i/drm: backend: Document the engine operations Date: Mon, 18 Dec 2017 15:57:49 +0100 Message-Id: <4f1b699706740031c0f3ab4113223e37f62dce6b.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" Our operations were missing some documentation to explain what was expected from them. Let's make that clearer. Signed-off-by: Maxime Ripard --- drivers/gpu/drm/sun4i/sun4i_backend.c | 2 +- drivers/gpu/drm/sun4i/sunxi_engine.h | 51 ++++++++++++++++++++++++++-- 2 files changed, 50 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun4i_backend.c b/drivers/gpu/drm/sun4i/sun4i_backend.c index c99d1a7e815a..f971d3fb5ee4 100644 --- a/drivers/gpu/drm/sun4i/sun4i_backend.c +++ b/drivers/gpu/drm/sun4i/sun4i_backend.c @@ -93,7 +93,7 @@ void sun4i_backend_layer_enable(struct sun4i_backend *backend, static int sun4i_backend_drm_format_to_layer(struct drm_plane *plane, u32 format, u32 *mode) { - if ((plane->type == DRM_PLANE_TYPE_PRIMARY) && + if (plane && (plane->type == DRM_PLANE_TYPE_PRIMARY) && (format == DRM_FORMAT_ARGB8888)) format = DRM_FORMAT_XRGB8888; diff --git a/drivers/gpu/drm/sun4i/sunxi_engine.h b/drivers/gpu/drm/sun4i/sunxi_engine.h index 4cb70ae65c79..36c8388b1646 100644 --- a/drivers/gpu/drm/sun4i/sunxi_engine.h +++ b/drivers/gpu/drm/sun4i/sunxi_engine.h @@ -15,13 +15,60 @@ struct drm_device; struct sunxi_engine; +/** + * struct sunxi_engine_ops - helper operations for sunXi engines + * + * These hooks are used by the common part of the DRM driver to + * implement the proper behaviour. + */ struct sunxi_engine_ops { + /** + * @apply_color_correction: + * + * This callback will enable the color correction in the + * backend. This is useful only for the composite output. + * + * This function is optional. + */ + void (*apply_color_correction)(struct sunxi_engine *engine); + + /** + * @commit: + * + * This callback will trigger the hardware switch to commit + * the new configuration that has been setup during the next + * vblank period. + * + * This function is optional. + */ void (*commit)(struct sunxi_engine *engine); + + /** + * @disable_color_correction: + * + * This callback will stop the color correction in the + * backend. This is useful only for the composite output. + * + * This function is optional. + */ + void (*disable_color_correction)(struct sunxi_engine *engine); + + /** + * @layers_init: + * + * This callback is used to allocate, initialize and register + * the layers supported by that backend. + * + * This function is mandatory. + * + * RETURNS: + * + * The array of struct drm_plane backing the layers, or an + * error pointer on failure. + */ struct drm_plane **(*layers_init)(struct drm_device *drm, struct sunxi_engine *engine); - void (*apply_color_correction)(struct sunxi_engine *engine); - void (*disable_color_correction)(struct sunxi_engine *engine); }; /**