Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3216713imu; Sat, 24 Nov 2018 00:19:30 -0800 (PST) X-Google-Smtp-Source: AFSGD/XDmxZDg0I/pma8LnhNtXjpSDY5xwwDKU8dIC8ZccJNc9FQbCcdEXFqQJX8EJ466duBxDFF X-Received: by 2002:a63:d301:: with SMTP id b1mr17213673pgg.61.1543047570876; Sat, 24 Nov 2018 00:19:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543047570; cv=none; d=google.com; s=arc-20160816; b=OiCCv9n4HySObJ2UQPlsskYOEiDIx/eVHipJhJ4+xVuq11mcGyH95w9Knrm9Sabl2I lA7tWEieL3mIDnbmjHdW802D3TLYNVXKVdCSVqgsw/iCjX6fYr79A+iQFI1m3UXRsoew 6THq2sV2HBV7zLoNRp1XB1qumg5w9foFcKBZd5tkdfDKOsnbhv63hT64linfrvtKDvCl o4WnNaxT014yEffDfb8tvpFQUeTg8Tum4IVFR43MwU0CH5FHoZ4tQmhsYPTfhUFyddWz NYekJ01HXP+pXKKGi0kwuprMEndgJEamqTE6x/4vdfLngiBpnEzczru3R70pz+lQTKnD lSIA== 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=MUaowF+F3c8zOkQwbtQCEbgd/hqNMlHZCvdd8TLuMew=; b=ZQ1hIGXEH3YoHWh/WyZ6+H2B968H+INY/r9H3lnUI70NnFeInObXy5LNJ6MRjbnwS4 dsNQBes6V47ewcWI1RYkWuja7FaqBl5srIUrr6hTppt+8aag8DOtNR9CAwQw7a33Lm6o t16TGI61tBklgX9cVUtrElbbKYzto16Mdlh1lA6N+EuHxvJADepRtX5GTMNpFIwmn5xs A9WxdVRK1eSh1EpZX/Z8g9o8xLlwCxdx4bQ6egahLAuF9w0AJZbQBXYVV0jHpI5Jjo5b pfS/mim1we+FpMQ2eXNy7myJZiXt0Q116IoV7NKHLI6dtX8KorG7lq25CWo3coMqz8/J J7gQ== 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 r18si53317424pgb.491.2018.11.24.00.19.16; Sat, 24 Nov 2018 00:19:30 -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 S2394026AbeKWUM1 (ORCPT + 99 others); Fri, 23 Nov 2018 15:12:27 -0500 Received: from mail.bootlin.com ([62.4.15.54]:49432 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2408929AbeKWUK2 (ORCPT ); Fri, 23 Nov 2018 15:10:28 -0500 Received: by mail.bootlin.com (Postfix, from userid 110) id 0215720F10; Fri, 23 Nov 2018 10:26:59 +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 E1C8C20EB8; Fri, 23 Nov 2018 10:26:35 +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 32/43] drm/sun4i: Pass modifier to backend and frontend format support helpers Date: Fri, 23 Nov 2018 10:25:04 +0100 Message-Id: <20181123092515.2511-33-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 To prepare the introduction of tiled mode support, pass the framebuffer format modifier to the helpers dealing with format support. Since only linear mode is supported for now, add corresponding checks in each helper. Signed-off-by: Paul Kocialkowski --- drivers/gpu/drm/sun4i/sun4i_backend.c | 10 +++++++--- drivers/gpu/drm/sun4i/sun4i_backend.h | 2 +- drivers/gpu/drm/sun4i/sun4i_frontend.c | 5 ++++- drivers/gpu/drm/sun4i/sun4i_frontend.h | 2 +- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun4i_backend.c b/drivers/gpu/drm/sun4i/sun4i_backend.c index 986bdb64521c..bbadc2ab9f4d 100644 --- a/drivers/gpu/drm/sun4i/sun4i_backend.c +++ b/drivers/gpu/drm/sun4i/sun4i_backend.c @@ -175,10 +175,13 @@ static const uint32_t sun4i_backend_formats[] = { DRM_FORMAT_YVYU, }; -bool sun4i_backend_format_is_supported(uint32_t fmt) +bool sun4i_backend_format_is_supported(uint32_t fmt, uint64_t modifier) { unsigned int i; + if (modifier != DRM_FORMAT_MOD_LINEAR) + return false; + for (i = 0; i < ARRAY_SIZE(sun4i_backend_formats); i++) if (sun4i_backend_formats[i] == fmt) return true; @@ -455,14 +458,15 @@ static bool sun4i_backend_plane_uses_frontend(struct drm_plane_state *state) struct sun4i_layer *layer = plane_to_sun4i_layer(state->plane); struct sun4i_backend *backend = layer->backend; uint32_t format = state->fb->format->format; + uint64_t modifier = state->fb->modifier; if (IS_ERR(backend->frontend)) return false; - if (!sun4i_frontend_format_is_supported(format)) + if (!sun4i_frontend_format_is_supported(format, modifier)) return false; - if (!sun4i_backend_format_is_supported(format)) + if (!sun4i_backend_format_is_supported(format, modifier)) return true; /* diff --git a/drivers/gpu/drm/sun4i/sun4i_backend.h b/drivers/gpu/drm/sun4i/sun4i_backend.h index 93db3af675b3..01f66463271b 100644 --- a/drivers/gpu/drm/sun4i/sun4i_backend.h +++ b/drivers/gpu/drm/sun4i/sun4i_backend.h @@ -198,7 +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); +bool sun4i_backend_format_is_supported(uint32_t fmt, uint64_t modifier); 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, diff --git a/drivers/gpu/drm/sun4i/sun4i_frontend.c b/drivers/gpu/drm/sun4i/sun4i_frontend.c index 001139417cf5..b78e0a208c95 100644 --- a/drivers/gpu/drm/sun4i/sun4i_frontend.c +++ b/drivers/gpu/drm/sun4i/sun4i_frontend.c @@ -299,10 +299,13 @@ static const uint32_t sun4i_frontend_formats[] = { DRM_FORMAT_YVYU, }; -bool sun4i_frontend_format_is_supported(uint32_t fmt) +bool sun4i_frontend_format_is_supported(uint32_t fmt, uint64_t modifier) { unsigned int i; + if (modifier != DRM_FORMAT_MOD_LINEAR) + return false; + for (i = 0; i < ARRAY_SIZE(sun4i_frontend_formats); i++) if (sun4i_frontend_formats[i] == fmt) return true; diff --git a/drivers/gpu/drm/sun4i/sun4i_frontend.h b/drivers/gpu/drm/sun4i/sun4i_frontend.h index 54ec71a3e2f4..b209eacdf8c2 100644 --- a/drivers/gpu/drm/sun4i/sun4i_frontend.h +++ b/drivers/gpu/drm/sun4i/sun4i_frontend.h @@ -115,6 +115,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); +bool sun4i_frontend_format_is_supported(uint32_t fmt, uint64_t modifier); #endif /* _SUN4I_FRONTEND_H_ */ -- 2.19.1