Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3213891imu; Sat, 24 Nov 2018 00:15:34 -0800 (PST) X-Google-Smtp-Source: AJdET5da5LG+59JW/pyslAO9ymYM3fQyWTi5W9pnSzTJ9t40IyRuDrq1nq1IQf5yROo9HrC89djS X-Received: by 2002:a62:e704:: with SMTP id s4mr19608149pfh.124.1543047334601; Sat, 24 Nov 2018 00:15:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543047334; cv=none; d=google.com; s=arc-20160816; b=AlMyaVXuQW3DU0H8KL5NeTeox3puZ8KTIhVWVzdpZDVO3DABZWowLzoG0S0BIohLnB 4DTbBSX3WnqfpaN3UWsqO7b5GLmDYLRqa0iTWgG+GOVuPFqMJcCVLgutkRi2pqMcKG7c sFHaU54lLBz/Qt+tOfB7luXPuPGAnWq47imliH1nWNyqU4uYjuc2gdHKpSt8+7stLpXk PWVZztr29ViYJGoOejdBVRD5SitpGyUy9r3SfiOp25E0PITkCdFeqDGo5ik+VBfU+Xn2 OaPwS696Frf/5xqa73L0D0Lm+6hGM45NTI+ASbL+tEyGDe6GXB7meiQAjtDIH//xuWz/ +ZUw== 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=W4y6nPmKkCdH1J0ZmjypJo6CIRn063wE3oGNlAmoSEQ=; b=axOgvJBW1XxHUtzSt3AkcZYao2Ut28cKU6+6Hqu0mXR9EBamyVMD4lc6k/kidKgDpX p4zcDJRRnbD3toFx/74SIa2zwZ7nmG6JDvTWpJ9lXwo1SDOiYEdPocBG8jNUdqCggT79 5wM2mv5AdXEeWXT4zr6M7E3q2ZNQrhQUUHw5/huIYosO09n/IXv3iFJ0ke4+eLyWJg2O 5K5V/fUwpExNt+hmGrVC4P3va1IgnWhyypQndLfOnCKTqF7EKWLIcOpUzeppyoOD6AEI fNbZaJR2VePRfMaITYj6PMypNt/PGPsmjY576GQAHNuGHVR7qZ8WG4k+S3Mixo/XDTVt /F4A== 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 c136si14212701pfc.141.2018.11.24.00.15.20; Sat, 24 Nov 2018 00:15:34 -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 S2502667AbeKWUKQ (ORCPT + 99 others); Fri, 23 Nov 2018 15:10:16 -0500 Received: from mail.bootlin.com ([62.4.15.54]:49189 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2502641AbeKWUKP (ORCPT ); Fri, 23 Nov 2018 15:10:15 -0500 Received: by mail.bootlin.com (Postfix, from userid 110) id CA3A520DBE; Fri, 23 Nov 2018 10:26:47 +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 A154720DBE; 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 05/43] drm/sun4i: frontend: Add a helper and a list for supported formats Date: Fri, 23 Nov 2018 10:24:37 +0100 Message-Id: <20181123092515.2511-6-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 frontend supports a specific format, an explicit list and a related helper are introduced. Just like in the backend, the prototype of the helper is added to the frontend header so that it can be used later on. The helper is also exported because it will be used outside of the frontend module. Signed-off-by: Paul Kocialkowski --- drivers/gpu/drm/sun4i/sun4i_frontend.c | 16 ++++++++++++++++ drivers/gpu/drm/sun4i/sun4i_frontend.h | 1 + 2 files changed, 17 insertions(+) diff --git a/drivers/gpu/drm/sun4i/sun4i_frontend.c b/drivers/gpu/drm/sun4i/sun4i_frontend.c index 3ea925584891..0f7f8c7b3402 100644 --- a/drivers/gpu/drm/sun4i/sun4i_frontend.c +++ b/drivers/gpu/drm/sun4i/sun4i_frontend.c @@ -128,6 +128,22 @@ static int sun4i_frontend_drm_format_to_output_fmt(uint32_t fmt, u32 *val) } } +static const uint32_t sun4i_frontend_formats[] = { + DRM_FORMAT_XRGB8888, +}; + +bool sun4i_frontend_format_is_supported(uint32_t fmt) +{ + unsigned int i; + + for (i = 0; i < ARRAY_SIZE(sun4i_frontend_formats); i++) + if (sun4i_frontend_formats[i] == fmt) + return true; + + return false; +} +EXPORT_SYMBOL(sun4i_frontend_format_is_supported); + int sun4i_frontend_update_formats(struct sun4i_frontend *frontend, struct drm_plane *plane, uint32_t out_fmt) { diff --git a/drivers/gpu/drm/sun4i/sun4i_frontend.h b/drivers/gpu/drm/sun4i/sun4i_frontend.h index 02661ce81f3e..a9cb908ced16 100644 --- a/drivers/gpu/drm/sun4i/sun4i_frontend.h +++ b/drivers/gpu/drm/sun4i/sun4i_frontend.h @@ -95,5 +95,6 @@ void sun4i_frontend_update_coord(struct sun4i_frontend *frontend, struct drm_plane *plane); int sun4i_frontend_update_formats(struct sun4i_frontend *frontend, struct drm_plane *plane, uint32_t out_fmt); +bool sun4i_frontend_format_is_supported(uint32_t fmt); #endif /* _SUN4I_FRONTEND_H_ */ -- 2.19.1