From nobody Thu Jan 1 12:25:41 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B8DE6C25B47 for ; Mon, 23 Oct 2023 17:47:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230338AbjJWRrv (ORCPT ); Mon, 23 Oct 2023 13:47:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229594AbjJWRrn (ORCPT ); Mon, 23 Oct 2023 13:47:43 -0400 Received: from smtp.forwardemail.net (smtp.forwardemail.net [149.28.215.223]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC090C5 for ; Mon, 23 Oct 2023 10:47:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kwiboo.se; h=Content-Transfer-Encoding: MIME-Version: References: In-Reply-To: Message-ID: Date: Subject: Cc: To: From; q=dns/txt; s=fe-e1b5cab7be; t=1698083255; bh=TcqfL7WT/26UkL5hYF7z7ghgcNNj+2lG8PRtctbZnJA=; b=RPLKy7AZG/4BCwh129OoICcssDAu+JiX/AlHtHhB6uY6jNLZmKSkXyn2Zfrb+87DOLp3m4sDF ldMmHD/wdT+qTTfcDXaRdcwr+JQrfhKt3iayFzw61Wi9Yb5F6SxEM2l2x0iP9IaiN2JwOC2N2pO HSEIp6O7yWgBHc7O8d18R4c0DvY0hGiUPAPxZG0G4R/5XXIz+CRPL5IW1B6FVcgO4ADyIDM0YWr bT8R3GeaMlkcFfb9FYAGb5fz6MgL4m0USy+3/NVKTzPZWlqwSDCiR1WxqXky0TRjMW1PdGZDaGK YjMIPtmDTHvmxyTWDrhPSWA6rtHTE710Ul5+7ZTdW4NQ== From: Jonas Karlman To: Heiko Stuebner , Sandy Huang , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter Cc: Christopher Obbard , dri-devel@lists.freedesktop.org, linux-rockchip@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Jonas Karlman Subject: [PATCH v5 1/2] drm/fourcc: Add NV20 and NV30 YUV formats Date: Mon, 23 Oct 2023 17:37:14 +0000 Message-ID: <20231023173718.188102-2-jonas@kwiboo.se> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231023173718.188102-1-jonas@kwiboo.se> References: <20231023173718.188102-1-jonas@kwiboo.se> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Report-Abuse-To: abuse@forwardemail.net X-Report-Abuse: abuse@forwardemail.net X-Complaints-To: abuse@forwardemail.net X-ForwardEmail-Version: 0.4.40 X-ForwardEmail-Sender: rfc822; jonas@kwiboo.se, smtp.forwardemail.net, 149.28.215.223 X-ForwardEmail-ID: 6536af57288c5302e78a77e3 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 =3D UVUV =3D 4 * 10 bits =3D 40 bits =3D 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 Reviewed-by: Christopher Obbard Tested-by: Christopher Obbard --- 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 fo= rmat) .num_planes =3D 2, .char_per_block =3D { 5, 5, 0 }, .block_w =3D { 4, 2, 0 }, .block_h =3D { 1, 1, 0 }, .hsub =3D 2, .vsub =3D 2, .is_yuv =3D true }, + { .format =3D DRM_FORMAT_NV20, .depth =3D 0, + .num_planes =3D 2, .char_per_block =3D { 5, 5, 0 }, + .block_w =3D { 4, 2, 0 }, .block_h =3D { 1, 1, 0 }, .hsub =3D 2, + .vsub =3D 1, .is_yuv =3D true }, + { .format =3D DRM_FORMAT_NV30, .depth =3D 0, + .num_planes =3D 2, .char_per_block =3D { 5, 5, 0 }, + .block_w =3D { 4, 2, 0 }, .block_h =3D { 1, 1, 0 }, .hsub =3D 1, + .vsub =3D 1, .is_yuv =3D true }, { .format =3D DRM_FORMAT_Q410, .depth =3D 0, .num_planes =3D 3, .char_per_block =3D { 2, 2, 2 }, .block_w =3D { 1, 1, 1 }, .block_h =3D { 1, 1, 1 }, .hsub =3D 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 =3D 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 */ =20 /* * 2 plane YCbCr MSB aligned --=20 2.42.0