Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp4530209rwd; Sat, 17 Jun 2023 16:06:37 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4OLHwSb3zVeACnUGXQX5rXIEHlTK16UsKGm8ABKkIe2dfcNTDFPMVPv0g1Aei9T01sIYFK X-Received: by 2002:a17:902:f543:b0:1b0:4bc1:f28b with SMTP id h3-20020a170902f54300b001b04bc1f28bmr16975447plf.25.1687043196665; Sat, 17 Jun 2023 16:06:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687043196; cv=none; d=google.com; s=arc-20160816; b=aNJZxe0LsHEBSUjiBItfd6sP74ODHn8W7OUYnr4/Ij/A2X/xY+Y5Ail6cbz569/Ndr BsRfD1DvmK/ZQP46RGdbIL+Ih7CujRNjDHpvzNaGlYWUf9ESdgS/+N9/i+5cqukO3hHx ci97DDXdvB1r7AGLLoDhkKps+FCcu2dzqOw3pIKRmCxewPe8anT7Hcids4s+RlU2sxNv 7FYuWemTiTtaFQAYV41OZ12xcywZo6Jht/Vz4v2mYsSVzWmpdtGHvcWVgc7fZBXeOpNc aD0SljIKP5KFGRz2IgBTiXp0IckFx3nerfiFkNIUYbYdRK3IZAtT/VNRtUg4MPMrhQ6O 42Dg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:mime-version :references:in-reply-to:message-id:date:subject:from:dkim-signature; bh=knW5hfOdRlNb6ad4KcvWMFXEOrQEnk5DYqTPo5HmSZE=; b=MDMtXnKM71Pg97/nFcqmGGLA7OHXrww3LlF90FtFq+GteCNpCCQxmqKQi4+2FzkYmI 58G8b/DPAT3QHHMkQlkGuMOJaJ4mX2J2PnKJ4ZyNkQ6LFBRF+WUcua1gxe9kp0YKQktq 9Eh381sSlHk+QZL7Qhwk3Ly3WfOYKS94VANL+Ui1j3eH1mck1ifcolecgRp3D2DeUfTa HW0W8pFG588K53AckaxU0QiUThEDsJ/PIEaTkH1use5QGK69qBp25moG+iT5Zao7cnqA DnOJEQI9tR7b4Vs/Y7ihsmRuJCvFR14nCykgrFXa9TLMsN+iRMOBWXY0E539aGknwkby Xxmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kwiboo.se header.s=s1 header.b=Lcs4O2j3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=kwiboo.se Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s4-20020a170902ea0400b001ab06251f98si14374814plg.429.2023.06.17.16.06.24; Sat, 17 Jun 2023 16:06:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kwiboo.se header.s=s1 header.b=Lcs4O2j3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=kwiboo.se Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232271AbjFQWXT (ORCPT + 99 others); Sat, 17 Jun 2023 18:23:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231571AbjFQWXO (ORCPT ); Sat, 17 Jun 2023 18:23:14 -0400 Received: from s.wrqvtbkv.outbound-mail.sendgrid.net (s.wrqvtbkv.outbound-mail.sendgrid.net [149.72.123.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3907110F5 for ; Sat, 17 Jun 2023 15:23:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kwiboo.se; h=from:subject:in-reply-to:references:mime-version:to:cc: content-transfer-encoding:content-type:cc:content-type:from:subject:to; s=s1; bh=knW5hfOdRlNb6ad4KcvWMFXEOrQEnk5DYqTPo5HmSZE=; b=Lcs4O2j3t0Zya8gHh1y5Xz1vPnnl19E8vEuvH6W8bEEnX+iTrflGvDeo1iZzMttdvVL+ 98xgNX3tnCR8MrbFidbigyG/aE4uhdKJDEp0YEq++j+djJJlE/DWVKJ4NczNF+N/3DFhyw VtLIdf3jFLfBo4Uzv6ppFPZdBJBEDPq1fsZAcxAu66me8wCPAxwun24TTtffKiNE8jqg39 amqDdIg9yeNRgixtwQ45aS3cCHoKVNRmlGPfRK65vQ6RswoMdT5lVyUIVkstnKvLcAXpkB //k+G6QHah1WTLcZ0Z1XQL6P2OivTVqscp00Gi5avguR1rdChqWbf+40lYB4AvQg== Received: by filterdrecv-66949dbc98-dbt7m with SMTP id filterdrecv-66949dbc98-dbt7m-1-648E3250-7 2023-06-17 22:23:12.210230445 +0000 UTC m=+3278605.771189366 Received: from bionic.localdomain (unknown) by geopod-ismtpd-1 (SG) with ESMTP id 4XYLAl6XSH2KsNiMfk1_gA Sat, 17 Jun 2023 22:23:12.024 +0000 (UTC) From: Jonas Karlman Subject: [PATCH v3 1/2] drm/fourcc: Add NV20 and NV30 YUV formats Date: Sat, 17 Jun 2023 22:23:12 +0000 (UTC) Message-Id: <20230617222307.3145714-2-jonas@kwiboo.se> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230617222307.3145714-1-jonas@kwiboo.se> References: <20230617222307.3145714-1-jonas@kwiboo.se> MIME-Version: 1.0 X-SG-EID: =?us-ascii?Q?TdbjyGynYnRZWhH+7lKUQJL+ZxmxpowvO2O9SQF5CwCVrYgcwUXgU5DKUU3QxA?= =?us-ascii?Q?fZekEeQsTe+RrMu3cja6a0h=2FnEEJCFmPMWB71Ft?= =?us-ascii?Q?+V7t0A=2FzSB2WM2Yr+B+lLlEGl35eOZtuuZWJsdu?= =?us-ascii?Q?F1uSpyKMXxuqrraykNbNcSNPUH9XsC2mI9giyEV?= =?us-ascii?Q?wwlTRHnBnJKPviaxCHD6r2mBMSuvhCMrD307Un6?= =?us-ascii?Q?P5ZoC9nGUVA+oa=2FvsmzKMnhOYMLpH5Akpemi1V?= To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Sandy Huang , Heiko Stuebner Cc: dri-devel@lists.freedesktop.org, linux-rockchip@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Jonas Karlman X-Entity-ID: P7KYpSJvGCELWjBME/J5tg== Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org DRM_FORMAT_NV20 and DRM_FORMAT_NV30 formats is the 2x1 and non-subsampled variant of NV15, a 10-bit 2-plane YUV format that has no padding between components. Instead, luminance and chrominance samples are grouped into 4s so that each group is packed into an integer number of bytes: YYYY = UVUV = 4 * 10 bits = 40 bits = 5 bytes The '20' and '30' suffix refers to the optimum effective bits per pixel which is achieved when the total number of luminance samples is a multiple of 4. V2: Added NV30 format Signed-off-by: Jonas Karlman Reviewed-by: Sandy Huang --- drivers/gpu/drm/drm_fourcc.c | 8 ++++++++ include/uapi/drm/drm_fourcc.h | 2 ++ 2 files changed, 10 insertions(+) diff --git a/drivers/gpu/drm/drm_fourcc.c b/drivers/gpu/drm/drm_fourcc.c index 0f17dfa8702b..193cf8ed7912 100644 --- a/drivers/gpu/drm/drm_fourcc.c +++ b/drivers/gpu/drm/drm_fourcc.c @@ -299,6 +299,14 @@ const struct drm_format_info *__drm_format_info(u32 format) .num_planes = 2, .char_per_block = { 5, 5, 0 }, .block_w = { 4, 2, 0 }, .block_h = { 1, 1, 0 }, .hsub = 2, .vsub = 2, .is_yuv = true }, + { .format = DRM_FORMAT_NV20, .depth = 0, + .num_planes = 2, .char_per_block = { 5, 5, 0 }, + .block_w = { 4, 2, 0 }, .block_h = { 1, 1, 0 }, .hsub = 2, + .vsub = 1, .is_yuv = true }, + { .format = DRM_FORMAT_NV30, .depth = 0, + .num_planes = 2, .char_per_block = { 5, 5, 0 }, + .block_w = { 4, 2, 0 }, .block_h = { 1, 1, 0 }, .hsub = 1, + .vsub = 1, .is_yuv = true }, { .format = DRM_FORMAT_Q410, .depth = 0, .num_planes = 3, .char_per_block = { 2, 2, 2 }, .block_w = { 1, 1, 1 }, .block_h = { 1, 1, 1 }, .hsub = 1, diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h index 8db7fd3f743e..3151f1fc7ebb 100644 --- a/include/uapi/drm/drm_fourcc.h +++ b/include/uapi/drm/drm_fourcc.h @@ -323,6 +323,8 @@ extern "C" { * index 1 = Cr:Cb plane, [39:0] Cr1:Cb1:Cr0:Cb0 little endian */ #define DRM_FORMAT_NV15 fourcc_code('N', 'V', '1', '5') /* 2x2 subsampled Cr:Cb plane */ +#define DRM_FORMAT_NV20 fourcc_code('N', 'V', '2', '0') /* 2x1 subsampled Cr:Cb plane */ +#define DRM_FORMAT_NV30 fourcc_code('N', 'V', '3', '0') /* non-subsampled Cr:Cb plane */ /* * 2 plane YCbCr MSB aligned -- 2.40.1