Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp951833pxb; Fri, 22 Apr 2022 15:10:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyZZhiLz76WSfsnziBbu3rsFoDsoFchR4ZT3Pc7UjkannWUycy9C8IlWV8meccQXDGzabLx X-Received: by 2002:a65:6388:0:b0:3a3:bf77:8604 with SMTP id h8-20020a656388000000b003a3bf778604mr5694197pgv.12.1650665420410; Fri, 22 Apr 2022 15:10:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650665420; cv=none; d=google.com; s=arc-20160816; b=zt94TBNnASZuEk4/e6vdC1ufCa9P/sr6LEscrmd69lYgTfNfrs2uKWGbhnH8NhrLxB 3hBYvFkxwAjhUlnoxYptHSurjL2ad5c2jAKyzWHSS7G/KRVJibG5oQhRdVyZiVspe1xI lKY3O9stcNf7wXPY+Gjvgez6v2BDc1qz5eN7XRm+MsWoCavgDE04ze1FPSibH36vDy7u nZ4im9hmC/fBtH1EnQBiiA0YQOE0uqMKPf8OFvTyKVNGGn2Q2c+mRRa+QsZkaDRYQ44e OsVMTA6FjBJkJ3KUWE7mQWHPtdaASdN9Sua4HzzHB5jIYs4qtRWEqwXtXLWL6+wvoSC9 LYMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=YjaKTk5rfe2As0aK855QqoMADcsn6nRisT63hGUM3LQ=; b=0fFqBYNkv0E11X3NfzZipMzYEVqCg7NIA4NcG3iHkkiE3J+wl6MeETkxrgzdWTU4g8 wAsuxaz0Agoq1LAIBKJU5LRKRVfjytapj5LdSp838T+D3PcRqUBkLGpVx4BOVPyewXps k/r/HGmjJwfEJMl70FSuj3VIV7J2jofLdIOZOvZEexYote1H0o0MYnV+arjCdx6MQXyL l4utkbzH7PATxHu+O1iEffkUr7SgMLQR2aztbfR5T4CgkDwLbj8UDcigiccPrIZgAjk0 UqmJCsfsgMs9jZdWIdyYxNo6BQxIlXQZElOi/J+nG4nEoLaYXw0W5/c1a97chRJp8v83 Ux2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=a2OkPw9E; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id h7-20020a170902f54700b00153b2d164bcsi11008681plf.196.2022.04.22.15.10.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 15:10:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=a2OkPw9E; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 289223983E4; Fri, 22 Apr 2022 13:16:38 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1385363AbiDUMqv (ORCPT + 99 others); Thu, 21 Apr 2022 08:46:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47228 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241750AbiDUMqs (ORCPT ); Thu, 21 Apr 2022 08:46:48 -0400 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5092431DEE; Thu, 21 Apr 2022 05:43:58 -0700 (PDT) Received: from benjamin-XPS-13-9310.. (unknown [IPv6:2a01:e0a:120:3210:18d1:3570:ff07:2ce2]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: benjamin.gaignard) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id 5FAE31F457F0; Thu, 21 Apr 2022 13:43:56 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1650545036; bh=T8nnqfGvHmSvEWxjKsuZ/CDDN5Se/ZjRG0MdFLi3Vr0=; h=From:To:Cc:Subject:Date:From; b=a2OkPw9ECuJlH/F7V0ue1Tw4gIjA4vpm+2ObZ3O//s/2fzMPTpGWg/xHJYrZtVdrW JJ9bNRJWiRkN2C4xMYjr42RjUfmbM6wcnLHrqjLRD98vJMU1zr5FXxpL4JN/lfzOdW eViI+Jh1jRjfBLlqDUIo+25zY4rSzNzDm7FgcR7r169ZrrnPKRB0+KaHaQK1jDzipb aJ7GdvEBlJat1g850ZdYJdnDVvLMz+htPP2YMdoHAW+rwyOFXfnwaSePIwFFddVtEE 70xlOuqCCNngJR22XSJ2OiYaDQBaNqXRf57j7+QskT3KIOgKFJf3E/ezl3kaqiVqeg QzF19l3YTM7tA== From: Benjamin Gaignard To: mchehab@kernel.org, hverkuil@xs4all.nl, ezequiel@vanguardiasur.com.ar Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, jernej.skrabec@gmail.com, p.zabel@pengutronix.de, nicolas@ndufresne.ca, kernel@collabora.com, Benjamin Gaignard , Nicolas Dufresne Subject: [PATCH v2] media: Add P010LE video format Date: Thu, 21 Apr 2022 14:43:49 +0200 Message-Id: <20220421124349.452404-1-benjamin.gaignard@collabora.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE autolearn=no 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 P010LE is a YUV format with 16-bits per pixel with interleaved UV. Signed-off-by: Benjamin Gaignard Acked-by: Nicolas Dufresne --- version 2: - Fix Hans's remarks - Add 'LE' suffix to pixel name since P010BE can also exist .../media/v4l/pixfmt-yuv-planar.rst | 53 +++++++++++++++++++ drivers/media/v4l2-core/v4l2-common.c | 1 + drivers/media/v4l2-core/v4l2-ioctl.c | 1 + include/uapi/linux/videodev2.h | 1 + 4 files changed, 56 insertions(+) diff --git a/Documentation/userspace-api/media/v4l/pixfmt-yuv-planar.rst b/Documentation/userspace-api/media/v4l/pixfmt-yuv-planar.rst index 8dff5906639b..b9dd4f376fe3 100644 --- a/Documentation/userspace-api/media/v4l/pixfmt-yuv-planar.rst +++ b/Documentation/userspace-api/media/v4l/pixfmt-yuv-planar.rst @@ -109,6 +109,13 @@ All components are stored with the same number of bits per component. - Cb, Cr - No - 16x16 tiles + * - V4L2_PIX_FMT_P010LE + - 'P010' + - 16 + - 4:2:0 + - Cb, Cr + - No + - Linear * - V4L2_PIX_FMT_NV16 - 'NV16' - 8 @@ -171,6 +178,7 @@ horizontally. .. _V4L2-PIX-FMT-NV21: .. _V4L2-PIX-FMT-NV12M: .. _V4L2-PIX-FMT-NV21M: +.. _V4L2-PIX-FMT-P010LE: NV12, NV21, NV12M and NV21M --------------------------- @@ -519,6 +527,51 @@ number of lines as the luma plane. - Cb\ :sub:`33` - Cr\ :sub:`33` +.. _V4L2_PIX_FMT_P010LE: + +P010LE +------ + +Like NV12 with 16 bits per component, data in the 10 high bits, zeros in the 6 low bits, arranged in little endian order + +.. flat-table:: Sample 4x4 P010LE Image + :header-rows: 0 + :stub-columns: 0 + + * - start + 0: + - Y'\ :sub:`00` + - Y'\ :sub:`01` + - Y'\ :sub:`02` + - Y'\ :sub:`03` + * - start + 8: + - Y'\ :sub:`10` + - Y'\ :sub:`11` + - Y'\ :sub:`12` + - Y'\ :sub:`13` + * - start + 16: + - Y'\ :sub:`20` + - Y'\ :sub:`21` + - Y'\ :sub:`22` + - Y'\ :sub:`23` + * - start + 24: + - Y'\ :sub:`30` + - Y'\ :sub:`31` + - Y'\ :sub:`32` + - Y'\ :sub:`33` + * - start + 32: + - Cb\ :sub:`00` + - Cr\ :sub:`00` + - Cb\ :sub:`01` + - Cr\ :sub:`01` + * - start + 40: + - Cb\ :sub:`10` + - Cr\ :sub:`10` + - Cb\ :sub:`11` + - Cr\ :sub:`11` + +.. raw:: latex + + \endgroup Fully Planar YUV Formats ======================== diff --git a/drivers/media/v4l2-core/v4l2-common.c b/drivers/media/v4l2-core/v4l2-common.c index df34b2a283bc..bc73526c41b9 100644 --- a/drivers/media/v4l2-core/v4l2-common.c +++ b/drivers/media/v4l2-core/v4l2-common.c @@ -266,6 +266,7 @@ const struct v4l2_format_info *v4l2_format_info(u32 format) { .format = V4L2_PIX_FMT_NV61, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 1, 2, 0, 0 }, .hdiv = 2, .vdiv = 1 }, { .format = V4L2_PIX_FMT_NV24, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 1, 2, 0, 0 }, .hdiv = 1, .vdiv = 1 }, { .format = V4L2_PIX_FMT_NV42, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 1, 2, 0, 0 }, .hdiv = 1, .vdiv = 1 }, + { .format = V4L2_PIX_FMT_P010LE, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 2, 2, 0, 0 }, .hdiv = 2, .vdiv = 1 }, { .format = V4L2_PIX_FMT_YUV410, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 3, .bpp = { 1, 1, 1, 0 }, .hdiv = 4, .vdiv = 4 }, { .format = V4L2_PIX_FMT_YVU410, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 3, .bpp = { 1, 1, 1, 0 }, .hdiv = 4, .vdiv = 4 }, diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c index 96e307fe3aab..2ba3440099d0 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -1301,6 +1301,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) case V4L2_PIX_FMT_NV61: descr = "Y/CrCb 4:2:2"; break; case V4L2_PIX_FMT_NV24: descr = "Y/CbCr 4:4:4"; break; case V4L2_PIX_FMT_NV42: descr = "Y/CrCb 4:4:4"; break; + case V4L2_PIX_FMT_P010LE: descr = "16-bit Y/CrCb 4:2:0"; break; case V4L2_PIX_FMT_NV12_4L4: descr = "Y/CbCr 4:2:0 (4x4 Linear)"; break; case V4L2_PIX_FMT_NV12_16L16: descr = "Y/CbCr 4:2:0 (16x16 Linear)"; break; case V4L2_PIX_FMT_NV12_32L32: descr = "Y/CbCr 4:2:0 (32x32 Linear)"; break; diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index 4c09969e7112..92822a80a12e 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -601,6 +601,7 @@ struct v4l2_pix_format { #define V4L2_PIX_FMT_NV61 v4l2_fourcc('N', 'V', '6', '1') /* 16 Y/CrCb 4:2:2 */ #define V4L2_PIX_FMT_NV24 v4l2_fourcc('N', 'V', '2', '4') /* 24 Y/CbCr 4:4:4 */ #define V4L2_PIX_FMT_NV42 v4l2_fourcc('N', 'V', '4', '2') /* 24 Y/CrCb 4:4:4 */ +#define V4L2_PIX_FMT_P010LE v4l2_fourcc('P', '0', '1', '0') /* 16 Y/CbCr 4:2:0 16-bit per pixel, little endian*/ /* two non contiguous planes - one Y, one Cr + Cb interleaved */ #define V4L2_PIX_FMT_NV12M v4l2_fourcc('N', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 */ -- 2.32.0