Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3216420imu; Sat, 24 Nov 2018 00:19:06 -0800 (PST) X-Google-Smtp-Source: AFSGD/VZtqv0PnPiPuNsCD6Tac9Jgtg96Iu04twELPX4Wr3bbeOBRQ0LGZzMNsxVXz5kLWZ4KkzX X-Received: by 2002:a63:9a52:: with SMTP id e18mr17028982pgo.14.1543047546642; Sat, 24 Nov 2018 00:19:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543047546; cv=none; d=google.com; s=arc-20160816; b=h/lm3UAupOLIRuvQVOs9CQk8MpGi81jQ5fAqiiE64d0iGslHugYs0A0BU0ir8uSQpd 09Veiv6wmcBXd92khG18J3hIIOO4lKCKBuGW2eYBVq6tAX4jBSRpo2wBq8IMSIc6cbRb NV6sdpKw96XvsFwDE08LTWoCi3cLBY69EmowhN2axqd9G9j7pfmdSRf2T09apbbdI+O4 /jurwApmA12flQrEVMu3rtafY4ErO6KxEJRkhJsFTA+g+utTeu6v+mLxVJjZBSY2Fs3N 20uft4Fmio7FapLbow+vtTKvMwyzJogOjrr2t6sRo6xXzqGA2St9zxd8DkfRlrbYHYDI D7QA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=dVwK5SU7BbOLGzLoRaVurpdVTmW8YESVcoT8CvJKJxk=; b=Pbsd0AUQVlsraS7W0yrKGIIblO/KVLqcb1jfuhR9XBjzlJi8irNfSvIKktrcbnh57z UyDhejgUllS3a49Scl8sAL7usFl4DvIiy3VmwSi2l8AoTY2rIbE7e8OYK9u0kAitn/VD fedUDkygyqweINwItbtc74uI/RydaKvo3fPHskt6XB8NF4ue1+R23SH4CdQznojBa6Xn W8+ZstbwKmAbbhR8SMBJZgLNrL9z7AtwZY4TmUoi7GtcFR+7Q2k0cYt6llQA95KoG7g4 5gH7i0NQZF+aBiqWoUDja5c+ktX8E9E+v9GC0ze4Sct+RI1qjqLTcf9NWh/4TgV5Lasf U6cw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s59si16339614plb.237.2018.11.24.00.18.52; Sat, 24 Nov 2018 00:19:06 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2409107AbeKWUOQ (ORCPT + 99 others); Fri, 23 Nov 2018 15:14:16 -0500 Received: from mail.bootlin.com ([62.4.15.54]:49179 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2393892AbeKWUKG (ORCPT ); Fri, 23 Nov 2018 15:10:06 -0500 Received: by mail.bootlin.com (Postfix, from userid 110) id B70BF20F8D; Fri, 23 Nov 2018 10:26:38 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mail.bootlin.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.2 Received: from localhost.localdomain (aaubervilliers-681-1-94-205.w90-88.abo.wanadoo.fr [90.88.35.205]) by mail.bootlin.com (Postfix) with ESMTPSA id 602EE20D29; Fri, 23 Nov 2018 10:26:28 +0100 (CET) From: Paul Kocialkowski To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org Cc: Maarten Lankhorst , Maxime Ripard , Sean Paul , David Airlie , Chen-Yu Tsai , Thomas Petazzoni , linux-sunxi@googlegroups.com, Daniel Vetter , Paul Kocialkowski Subject: [PATCH v2 04/43] drm/sun4i: backend: Add a helper and a list for supported formats Date: Fri, 23 Nov 2018 10:24:36 +0100 Message-Id: <20181123092515.2511-5-paul.kocialkowski@bootlin.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181123092515.2511-1-paul.kocialkowski@bootlin.com> References: <20181123092515.2511-1-paul.kocialkowski@bootlin.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In order to check whether the backend supports a specific format, an explicit list and a related helper are introduced. The prototype of this helper is added to the header so that it can be called from sun4i_layer later (when introducing tiled mode support). Signed-off-by: Paul Kocialkowski --- drivers/gpu/drm/sun4i/sun4i_backend.c | 27 +++++++++++++++++++++++++++ drivers/gpu/drm/sun4i/sun4i_backend.h | 1 + 2 files changed, 28 insertions(+) diff --git a/drivers/gpu/drm/sun4i/sun4i_backend.c b/drivers/gpu/drm/sun4i/sun4i_backend.c index c3444246755b..7dd24eb03f89 100644 --- a/drivers/gpu/drm/sun4i/sun4i_backend.c +++ b/drivers/gpu/drm/sun4i/sun4i_backend.c @@ -155,6 +155,33 @@ static int sun4i_backend_drm_format_to_layer(u32 format, u32 *mode) return 0; } +static const uint32_t sun4i_backend_formats[] = { + DRM_FORMAT_ARGB1555, + DRM_FORMAT_ARGB4444, + DRM_FORMAT_ARGB8888, + DRM_FORMAT_BGRX8888, + DRM_FORMAT_RGB565, + DRM_FORMAT_RGB888, + DRM_FORMAT_RGBA4444, + DRM_FORMAT_RGBA5551, + DRM_FORMAT_UYVY, + DRM_FORMAT_VYUY, + DRM_FORMAT_XRGB8888, + DRM_FORMAT_YUYV, + DRM_FORMAT_YVYU, +}; + +bool sun4i_backend_format_is_supported(uint32_t fmt) +{ + unsigned int i; + + for (i = 0; i < ARRAY_SIZE(sun4i_backend_formats); i++) + if (sun4i_backend_formats[i] == fmt) + return true; + + return false; +} + int sun4i_backend_update_layer_coord(struct sun4i_backend *backend, int layer, struct drm_plane *plane) { diff --git a/drivers/gpu/drm/sun4i/sun4i_backend.h b/drivers/gpu/drm/sun4i/sun4i_backend.h index 339dbff1cce4..93db3af675b3 100644 --- a/drivers/gpu/drm/sun4i/sun4i_backend.h +++ b/drivers/gpu/drm/sun4i/sun4i_backend.h @@ -198,6 +198,7 @@ engine_to_sun4i_backend(struct sunxi_engine *engine) void sun4i_backend_layer_enable(struct sun4i_backend *backend, int layer, bool enable); +bool sun4i_backend_format_is_supported(uint32_t fmt); int sun4i_backend_update_layer_coord(struct sun4i_backend *backend, int layer, struct drm_plane *plane); int sun4i_backend_update_layer_formats(struct sun4i_backend *backend, -- 2.19.1