Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3216407imu; Sat, 24 Nov 2018 00:19:06 -0800 (PST) X-Google-Smtp-Source: AFSGD/Xms9gdpJETQKbSJlgQfvFlXMPtBcF2TzScyYxC+ZnI//TWf0CQPtf3HumAGfvsufUWDbLb X-Received: by 2002:a17:902:1005:: with SMTP id b5mr11084593pla.310.1543047546121; 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=KKf1GJcszyuSR59AF9XHutaO7XvYc7qc4dZ8RZYikCk0nWm+M8lV2ukonVIhF2NwY2 duYO813u/1wF9pyskgOu4kYCk2fB7DoDTFYWiKhlpKM39XH6+5i1e7fKzLA8H2HgLt/e CD4QqUsGJxTo2CRHON4m+j6B+U55zOaQ3ImBlJlS5fDMHtf/9MxBQbzh0j9dekJnjTRl rD5MPEI9aAhm6HpL3K9IxvMdYbv6WjW4qyecXmb4BjV1ftibRx5eQXn0s8l6em/jJhbZ 1nYnBvz854O6kKRmPWejN/wvDMUJNQ3rFV9WhbPzV8ofRT57YEor6Z0PnB7uI1J9WQvy XRgQ== 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=Fh+5kmDSRxQ220hW8iZ9FWDCKNHuIe/BAZkZJHqtfF4=; b=ZbQxFJkJKKfkpKJfueNSJyXJqunbDUJZckTq3T9s2zWjrp1x9FL2+NNznpohqDzIF/ oRnAt0bGmPBu5q1i0EOOoicjz+mheEq+Ru0LRPAfwIokss4z7kF2fs0cE0IXOUdcK81m EJpqvnJQ6iiQcHxcvL9UkN9jRg6u5U4hg+W9etUYC9bq+u5X2v6bsp2pPfHbNVbLoj1Z YfGPUx5nwzN2jwcOFrV5EDai8NsPBh9HC459G+/Vf7MYc+baMmJ6WoRoh2xIvu6neRGA CfiVtgqRW/EgoWQEwifJbNo8yaIA9xafjzCdWYPdy0i/KfDeBPHCWkfUBbypqU6MB1V5 L0xQ== 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.18.51; 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 S2409072AbeKWULM (ORCPT + 99 others); Fri, 23 Nov 2018 15:11:12 -0500 Received: from mail.bootlin.com ([62.4.15.54]:49445 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2409000AbeKWUKg (ORCPT ); Fri, 23 Nov 2018 15:10:36 -0500 Received: by mail.bootlin.com (Postfix, from userid 110) id 15E9221667; Fri, 23 Nov 2018 10:27:08 +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 AF7B320F45; Fri, 23 Nov 2018 10:26:36 +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 35/43] drm/sun4i: frontend: Add and use helper for checking tiling support Date: Fri, 23 Nov 2018 10:25:07 +0100 Message-Id: <20181123092515.2511-36-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 This introduces a helper to check whether a frontend input format supports tiling mode. This helper is used when tiling is requested in the frontend format support helper. Only semiplanar and planar YUV formats are supported by the hardware. Signed-off-by: Paul Kocialkowski --- drivers/gpu/drm/sun4i/sun4i_frontend.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/sun4i/sun4i_frontend.c b/drivers/gpu/drm/sun4i/sun4i_frontend.c index 3f76a5572449..b9c18fa2fff3 100644 --- a/drivers/gpu/drm/sun4i/sun4i_frontend.c +++ b/drivers/gpu/drm/sun4i/sun4i_frontend.c @@ -120,6 +120,26 @@ static bool sun4i_frontend_format_chroma_requires_swap(uint32_t fmt) } } +static bool sun4i_frontend_format_supports_tiling(uint32_t fmt) +{ + switch (fmt) { + case DRM_FORMAT_NV12: + case DRM_FORMAT_NV16: + case DRM_FORMAT_NV21: + case DRM_FORMAT_NV61: + case DRM_FORMAT_YUV411: + case DRM_FORMAT_YUV420: + case DRM_FORMAT_YUV422: + case DRM_FORMAT_YVU420: + case DRM_FORMAT_YVU422: + case DRM_FORMAT_YVU411: + return true; + + default: + return false; + } +} + void sun4i_frontend_update_buffer(struct sun4i_frontend *frontend, struct drm_plane *plane) { @@ -355,7 +375,9 @@ bool sun4i_frontend_format_is_supported(uint32_t fmt, uint64_t modifier) { unsigned int i; - if (modifier != DRM_FORMAT_MOD_LINEAR) + if (modifier == DRM_FORMAT_MOD_ALLWINNER_TILED) + return sun4i_frontend_format_supports_tiling(fmt); + else if (modifier != DRM_FORMAT_MOD_LINEAR) return false; for (i = 0; i < ARRAY_SIZE(sun4i_frontend_formats); i++) -- 2.19.1