Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3215963imu; Sat, 24 Nov 2018 00:18:29 -0800 (PST) X-Google-Smtp-Source: AJdET5drj6q2F9jE3kJCyt1xr4QKKSad4wapBkOvY6GKuwWawmK/44UK0Sw+XZArNExGsheio3DS X-Received: by 2002:a62:6143:: with SMTP id v64mr19369050pfb.142.1543047509647; Sat, 24 Nov 2018 00:18:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543047509; cv=none; d=google.com; s=arc-20160816; b=sFZDkbMoneDCXp9tTiMlxYABGaRFbr9McRAFHo+Txfv+O03fXREIWbk6YrGY4lv8zS E/wPB4LykNaBmESeCPSMewroNSfJpeUpUJtTd7yw1s8UfrhdPlmOKaQLyUnpNIagg30M UK55uDJx/CF0KVNFrVQJoQ/Tp8BE+EySNNy+zU+XiDbekwpHioY7dvgLSctwMugF+VEW ZSIQzHPv2yU4PVoOmoW+JrSgQvk3kb7JpzYUL6HZKIx+H/29J2dGJTfVcRuinUVhH+a5 24XMjmxv4wFKpnBmCsL1MwQkOzzFpHx/J6bSg4sVKL9qWP1coA6cedDfza5hqroy7IFl 6yDg== 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=GkLrgYXYwSMpwuLWsdnOIwm3V2t7dWya3GzbV6GhLzU=; b=EfG/Um5pN/z3H667sznkf7MsklFFby6Q0vjszaPqp3xJPbizCy1X2QJNzGD6cQ5ZeW TkMjJa7fvHyBh4Zyr3O/znSJAGwtYUqGOSWf/50Yf59QYxv0qvKgXvwwuqS/KRvsUocY DY+kifRLuKdxOeqpwIahdSn8U21VQHvQu75y7W/vKA17uD5NvlbeqPlmULifAtLInCv8 24TM6hVEPBvHkUSwxQNVvrFjqcnsyPSygwrrGvKq5lVr3G0df+OCt/mGoP18ZdCft0jA vBiBkkf8EXJoqCjt2ZsReXV3c5cEHs8gSw2Q2nvulckTbo3R5NwQHvDfhvfvuIu3ioVw zAkw== 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 13si9279620pld.398.2018.11.24.00.18.15; Sat, 24 Nov 2018 00:18:29 -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 S2393928AbeKWUMT (ORCPT + 99 others); Fri, 23 Nov 2018 15:12:19 -0500 Received: from mail.bootlin.com ([62.4.15.54]:49408 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2408927AbeKWUK3 (ORCPT ); Fri, 23 Nov 2018 15:10:29 -0500 Received: by mail.bootlin.com (Postfix, from userid 110) id 0C44720EB8; 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 2E69620EC0; 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 33/43] drm/sun4i: frontend: Add support for tiled YUV input mode configuration Date: Fri, 23 Nov 2018 10:25:05 +0100 Message-Id: <20181123092515.2511-34-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 the data input mode definitions for the tiled YUV mode, that are used in the input mode helper if tiling is requested. The modifier is passed to the helper from the framebuffer to determine if tiling is requested. Only semiplanar and planar YUV formats are supported for tiling mode. Signed-off-by: Paul Kocialkowski --- drivers/gpu/drm/sun4i/sun4i_frontend.c | 14 ++++++++++---- drivers/gpu/drm/sun4i/sun4i_frontend.h | 2 ++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun4i_frontend.c b/drivers/gpu/drm/sun4i/sun4i_frontend.c index b78e0a208c95..efa1ff0802bd 100644 --- a/drivers/gpu/drm/sun4i/sun4i_frontend.c +++ b/drivers/gpu/drm/sun4i/sun4i_frontend.c @@ -186,9 +186,11 @@ static int sun4i_frontend_drm_format_to_input_fmt(uint32_t fmt, u32 *val) return 0; } -static int sun4i_frontend_drm_format_to_input_mode(uint32_t fmt, u32 *val) +static int sun4i_frontend_drm_format_to_input_mode(uint32_t fmt, + uint64_t modifier, u32 *val) { int num_planes = drm_format_num_planes(fmt); + bool tiled = (modifier == DRM_FORMAT_MOD_ALLWINNER_TILED); switch (num_planes) { case 1: @@ -196,11 +198,13 @@ static int sun4i_frontend_drm_format_to_input_mode(uint32_t fmt, u32 *val) return 0; case 2: - *val = SUN4I_FRONTEND_INPUT_FMT_DATA_MOD_SEMIPLANAR; + *val = tiled ? SUN4I_FRONTEND_INPUT_FMT_DATA_MOD_MB32_SEMIPLANAR + : SUN4I_FRONTEND_INPUT_FMT_DATA_MOD_SEMIPLANAR; return 0; case 3: - *val = SUN4I_FRONTEND_INPUT_FMT_DATA_MOD_PLANAR; + *val = tiled ? SUN4I_FRONTEND_INPUT_FMT_DATA_MOD_MB32_PLANAR + : SUN4I_FRONTEND_INPUT_FMT_DATA_MOD_PLANAR; return 0; default: @@ -320,6 +324,7 @@ int sun4i_frontend_update_formats(struct sun4i_frontend *frontend, struct drm_plane_state *state = plane->state; struct drm_framebuffer *fb = state->fb; uint32_t format = fb->format->format; + uint64_t modifier = fb->modifier; u32 out_fmt_val; u32 in_fmt_val, in_mod_val, in_ps_val; unsigned int i; @@ -332,7 +337,8 @@ int sun4i_frontend_update_formats(struct sun4i_frontend *frontend, return ret; } - ret = sun4i_frontend_drm_format_to_input_mode(format, &in_mod_val); + ret = sun4i_frontend_drm_format_to_input_mode(format, modifier, + &in_mod_val); if (ret) { DRM_DEBUG_DRIVER("Invalid input mode\n"); return ret; diff --git a/drivers/gpu/drm/sun4i/sun4i_frontend.h b/drivers/gpu/drm/sun4i/sun4i_frontend.h index b209eacdf8c2..ae53ee644694 100644 --- a/drivers/gpu/drm/sun4i/sun4i_frontend.h +++ b/drivers/gpu/drm/sun4i/sun4i_frontend.h @@ -33,6 +33,8 @@ #define SUN4I_FRONTEND_INPUT_FMT_DATA_MOD_PLANAR (0 << 8) #define SUN4I_FRONTEND_INPUT_FMT_DATA_MOD_PACKED (1 << 8) #define SUN4I_FRONTEND_INPUT_FMT_DATA_MOD_SEMIPLANAR (2 << 8) +#define SUN4I_FRONTEND_INPUT_FMT_DATA_MOD_MB32_PLANAR (4 << 8) +#define SUN4I_FRONTEND_INPUT_FMT_DATA_MOD_MB32_SEMIPLANAR (6 << 8) #define SUN4I_FRONTEND_INPUT_FMT_DATA_FMT_YUV444 (0 << 4) #define SUN4I_FRONTEND_INPUT_FMT_DATA_FMT_YUV422 (1 << 4) #define SUN4I_FRONTEND_INPUT_FMT_DATA_FMT_YUV420 (2 << 4) -- 2.19.1