Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3214648imu; Sat, 24 Nov 2018 00:16:38 -0800 (PST) X-Google-Smtp-Source: AFSGD/XiqXVqhHdj7U4dYqUv0Fu2xhrvsD8rhIWzf8TmWlIfp6K051BdPZ/ID971QyOimzvM4Cb1 X-Received: by 2002:a63:990a:: with SMTP id d10mr17170115pge.279.1543047398816; Sat, 24 Nov 2018 00:16:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543047398; cv=none; d=google.com; s=arc-20160816; b=ij2g3sv674yF5v4YFM6e6Ab9Wbwzo9l5CIG3Cge4BvjxEfKttTu+UXu7DOTiEz9Emf mNwPc7VkH7JK+5f3FDgBqIVMgtq/tBU7Y533LK7/e+HaIuewBOIs9LZ03cv2t4onekhs 0gv14aHu5/CO17qICI3tlDa/2aABIHoryAaqQ1vmR3xnq2vKc5bekYmrdX18XJptBMAG J/w50aoXe26VbjKLX+lEmKl/9j+t3xpsUMWnyO/OQtHQmn8jCE/Ip4j+EpKWzJYdOg5z pINq9DAi0wCBC47KCsvF6oQg6r1deX2LOIJ/JN5HcQ64ZTZdK4nCbeUEi18WMT8h2AoD 6QFA== 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=beGg9asIcLvna18hAtvtDsqVW6jL/DNTWRbWYhXrLi8=; b=g0F9Mee7BYg2PMRlKPq3zvrOz7lBFbJY6HXplWod4oUL7/T0UFSotRwG4uFk1KfBKF P7Qd2S0qx2rZTEg5Yrfw6gW0XxZmThE/2BhCmwPCAtkYJAQg+euxo2o5T81QK60iHvcO noUFG+eEIerEtbGYjB20XXsMk/QqJJF+Gn0z9Elbi8LS5i5Q2zkeYO+4Rh6zv3MVAMwb t4giDFtg/c6innjKdjln9mYHbkansVSbrcDrbOuwiDGq2Ju7zBRk1egHUBlRB9ozy5oK YU8109KYemSDS2F9+7OKGglJTLqsoMkO4BgYWMGyxJ+UIvUtDSiKdU9boBAE6AITSg29 dppg== 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 q5si43648637pgb.245.2018.11.24.00.16.24; Sat, 24 Nov 2018 00:16:38 -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 S2408990AbeKWUKa (ORCPT + 99 others); Fri, 23 Nov 2018 15:10:30 -0500 Received: from mail.bootlin.com ([62.4.15.54]:49420 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2502738AbeKWUK0 (ORCPT ); Fri, 23 Nov 2018 15:10:26 -0500 Received: by mail.bootlin.com (Postfix, from userid 110) id 7579520DFB; Fri, 23 Nov 2018 10:26:58 +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 440F720E0E; Fri, 23 Nov 2018 10:26:34 +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 26/43] drm/sun4i: frontend: Add support for packed YUV422 input formats Date: Fri, 23 Nov 2018 10:24:58 +0100 Message-Id: <20181123092515.2511-27-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 support for packed YUV formats with 4:2:2 sampling using the frontend. Definitions are introduced for the data format and pixel sequence input format register values. Signed-off-by: Paul Kocialkowski --- drivers/gpu/drm/sun4i/sun4i_frontend.c | 22 ++++++++++++++++++++++ drivers/gpu/drm/sun4i/sun4i_frontend.h | 5 +++++ 2 files changed, 27 insertions(+) diff --git a/drivers/gpu/drm/sun4i/sun4i_frontend.c b/drivers/gpu/drm/sun4i/sun4i_frontend.c index 4700133b96e0..f443e8e1d8ec 100644 --- a/drivers/gpu/drm/sun4i/sun4i_frontend.c +++ b/drivers/gpu/drm/sun4i/sun4i_frontend.c @@ -130,6 +130,8 @@ static int sun4i_frontend_drm_format_to_input_fmt(uint32_t fmt, u32 *val) { if (!drm_format_is_yuv(fmt)) *val = SUN4I_FRONTEND_INPUT_FMT_DATA_FMT_RGB; + else if (drm_format_is_yuv_sampling_422(fmt)) + *val = SUN4I_FRONTEND_INPUT_FMT_DATA_FMT_YUV422; else return -EINVAL; @@ -153,10 +155,26 @@ static int sun4i_frontend_drm_format_to_input_sequence(uint32_t fmt, u32 *val) *val = SUN4I_FRONTEND_INPUT_FMT_DATA_PS_BGRX; return 0; + case DRM_FORMAT_UYVY: + *val = SUN4I_FRONTEND_INPUT_FMT_DATA_PS_UYVY; + return 0; + + case DRM_FORMAT_VYUY: + *val = SUN4I_FRONTEND_INPUT_FMT_DATA_PS_VYUY; + return 0; + case DRM_FORMAT_XRGB8888: *val = SUN4I_FRONTEND_INPUT_FMT_DATA_PS_XRGB; return 0; + case DRM_FORMAT_YUYV: + *val = SUN4I_FRONTEND_INPUT_FMT_DATA_PS_YUYV; + return 0; + + case DRM_FORMAT_YVYU: + *val = SUN4I_FRONTEND_INPUT_FMT_DATA_PS_YVYU; + return 0; + default: return -EINVAL; } @@ -180,7 +198,11 @@ static int sun4i_frontend_drm_format_to_output_fmt(uint32_t fmt, u32 *val) static const uint32_t sun4i_frontend_formats[] = { DRM_FORMAT_BGRX8888, + DRM_FORMAT_UYVY, + DRM_FORMAT_VYUY, DRM_FORMAT_XRGB8888, + DRM_FORMAT_YUYV, + DRM_FORMAT_YVYU, }; bool sun4i_frontend_format_is_supported(uint32_t fmt) diff --git a/drivers/gpu/drm/sun4i/sun4i_frontend.h b/drivers/gpu/drm/sun4i/sun4i_frontend.h index fb097c34e160..399755939a28 100644 --- a/drivers/gpu/drm/sun4i/sun4i_frontend.h +++ b/drivers/gpu/drm/sun4i/sun4i_frontend.h @@ -27,7 +27,12 @@ #define SUN4I_FRONTEND_INPUT_FMT_REG 0x04c #define SUN4I_FRONTEND_INPUT_FMT_DATA_MOD_PACKED (1 << 8) +#define SUN4I_FRONTEND_INPUT_FMT_DATA_FMT_YUV422 (1 << 4) #define SUN4I_FRONTEND_INPUT_FMT_DATA_FMT_RGB (5 << 4) +#define SUN4I_FRONTEND_INPUT_FMT_DATA_PS_UYVY 0 +#define SUN4I_FRONTEND_INPUT_FMT_DATA_PS_YUYV 1 +#define SUN4I_FRONTEND_INPUT_FMT_DATA_PS_VYUY 2 +#define SUN4I_FRONTEND_INPUT_FMT_DATA_PS_YVYU 3 #define SUN4I_FRONTEND_INPUT_FMT_DATA_PS_BGRX 0 #define SUN4I_FRONTEND_INPUT_FMT_DATA_PS_XRGB 1 -- 2.19.1