Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp2227285ybg; Fri, 5 Jun 2020 08:38:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzPp7WT82XgKNn28rz7kfvFCO1NQgYszMPA5wtaVDec7+l0jzh93wwYgcDZ2/fnXV70C1QE X-Received: by 2002:a50:9b16:: with SMTP id o22mr9664536edi.130.1591371486530; Fri, 05 Jun 2020 08:38:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591371486; cv=none; d=google.com; s=arc-20160816; b=FspKeHPtxwX+vTAzN9tDu6n8Jd5dhBAftFsQjdbOuC4gsVwuuqjaZdLvTgDCSLPe/K 9cvzRMWLt/W0NcCU1z2y1lAS6LBBIJ87nOSBmw5Q4ga4+ZKq/TbphvQPmug7KxPlpL2h MnIUZANd4VazFWhdnGMLkOrKlEUToiVrMUn1/kls34JiE3dUaP+2dKF6Cg7Dg66FiY0S 1Ua2q+advzCIc6jCTO9loDvB/QCjBN91ycFh/6RbVNA/aoY6ShUpHgnI7S2HInaFo2kl kKVjB3vv5xo4y3fP7ezdlPMmfE2TeQZQoHTpW+FlVcTFzNnPC0p9JoZK17V1YJqAsA41 irdQ== 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 :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id:dkim-signature; bh=gtQA+LLer4oF1MYDGWubeGXcmaERWz1Qz3eCvPepdzE=; b=yXkEeyQvsUurULNVP60zZ9JZRZFadYyhtCGMfCI3cfknWK+i298EMwWpN+qtyxF1G2 h/AomO1nl3jYALd93hUNVEkPyB65myV4NKGm5AVe+0fhxb80bjhBH3PwHMDiVY9MA5Q6 XAPPCAjwf67+bbRYocU1Nx3wpWXD31N3zDZMNqY5rkLMSsnMDpfbMHxvq9ktnyPpxG8A kt85FgZF8Ki07ttBb6oAbI8EWu/+4NwJMeJEFwY0KKQVu1bDoc3Hc7M+t2y4iJwseW7y 1Qu/tbRLe4JoVwBV44HcNlUjwOQtUaD4t7bAjiLMuxAhIZVq5p8/bo9pDdPDawsx2qg9 KMww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ndufresne-ca.20150623.gappssmtp.com header.s=20150623 header.b=L+7U5CYL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r12si3685381edc.599.2020.06.05.08.37.43; Fri, 05 Jun 2020 08:38:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ndufresne-ca.20150623.gappssmtp.com header.s=20150623 header.b=L+7U5CYL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727940AbgFEPfy (ORCPT + 99 others); Fri, 5 Jun 2020 11:35:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726539AbgFEPfy (ORCPT ); Fri, 5 Jun 2020 11:35:54 -0400 Received: from mail-qk1-x744.google.com (mail-qk1-x744.google.com [IPv6:2607:f8b0:4864:20::744]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DFBBDC08C5C2 for ; Fri, 5 Jun 2020 08:35:53 -0700 (PDT) Received: by mail-qk1-x744.google.com with SMTP id n141so10102587qke.2 for ; Fri, 05 Jun 2020 08:35:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ndufresne-ca.20150623.gappssmtp.com; s=20150623; h=message-id:subject:from:to:cc:date:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=gtQA+LLer4oF1MYDGWubeGXcmaERWz1Qz3eCvPepdzE=; b=L+7U5CYL52JcR/NyNlf4v97TCmdMYsKp0in6xqirZNCrodFwN25QtsN0W6eaS82qLw qpImgelVS+V4lRCRz01Phj4serPzJA8LiuPZD6WzOFABjFVFQaIsA9ir2sPaI8yMCujy wfmUoKmY2G+kASsmRZD2iFZhLOI0wHF+/UoLZNMC7mAQinREN+FexPKHul2SxDLyQYD1 /sybO9woUw3iQOb//RpCboHlM0E3gKhbUHtKNIQsaEKdynC2+kSO/lWoxF1GmXpK5T88 VIpj703sh4WuY75oRrz5zVS1CvySOOkptasu34D5/m0RAG9JwMUbLPu2KrpR2Bc6J0aX 02Fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=gtQA+LLer4oF1MYDGWubeGXcmaERWz1Qz3eCvPepdzE=; b=JcrkdmUv/qowdIP/OALwwRuLngxnSoV44/njZ3/jl4zFeh5v6MwbmV1HlVr1eMQcfm tsIkPAOD7oZIDy52uUbeAmHeCeRXPhHFAB3U2Vcr90AzF8xkbiBkrMPYaizFqAcqcrPr JXW8Sois3BaBc1sHiqVv1RqbMs3OdqmDyi9a+flAZ9mOG/lXyURUaEnwcSH1Y1WPxVzC zInjrR9HXus9BaWgmbGBfSGcNVZg2T9YulZeEqb47b+I8U62hC9mrv87DPpN9f9xNsOK SjAOMbmDqC/S40E2esPIL+GaYf+h/SDgjgvQchEgGO+342tCQTUTaXpQTANayBDvPuuk 8WTQ== X-Gm-Message-State: AOAM533OoQdE+o3HkHyUok01nAVBxdRQAk9lMFEQKCpGtJbbIq/3R47+ eo26y8YiYUGezK5YH/EuSs8HKw== X-Received: by 2002:ae9:ebd2:: with SMTP id b201mr10185970qkg.409.1591371352936; Fri, 05 Jun 2020 08:35:52 -0700 (PDT) Received: from skullcanyon ([192.222.193.21]) by smtp.gmail.com with ESMTPSA id 79sm76810qkf.48.2020.06.05.08.35.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jun 2020 08:35:51 -0700 (PDT) Message-ID: <02aa06fd8397b77c9a75d3a8399cb55d3b4d39c1.camel@ndufresne.ca> Subject: Re: [PATCH 1/5] media: videodev2: add Compressed Framebuffer pixel formats From: Nicolas Dufresne To: Neil Armstrong , hverkuil-cisco@xs4all.nl Cc: linux-media@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Maxime Jourdan Date: Fri, 05 Jun 2020 11:35:50 -0400 In-Reply-To: <20200604135317.9235-2-narmstrong@baylibre.com> References: <20200604135317.9235-1-narmstrong@baylibre.com> <20200604135317.9235-2-narmstrong@baylibre.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.2 (3.36.2-1.fc32) 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 Le jeudi 04 juin 2020 à 15:53 +0200, Neil Armstrong a écrit : > From: Maxime Jourdan > > Add two generic Compressed Framebuffer pixel formats to be used > with a modifier when imported back in another subsystem like DRM/KMS. > > These pixel formats represents generic 8bits and 10bits compressed buffers > with a vendor specific layout. > > These are aligned with the DRM_FORMAT_YUV420_8BIT and DRM_FORMAT_YUV420_10BIT > used to describe the underlying compressed buffers used for ARM Framebuffer > Compression. In the Amlogic case, the compression is different but the > underlying buffer components is the same. > > Signed-off-by: Maxime Jourdan > Signed-off-by: Neil Armstrong > --- > drivers/media/v4l2-core/v4l2-ioctl.c | 2 ++ > include/uapi/linux/videodev2.h | 9 +++++++++ > 2 files changed, 11 insertions(+) > > diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c > index 2322f08a98be..8f14adfd5bc5 100644 > --- a/drivers/media/v4l2-core/v4l2-ioctl.c > +++ b/drivers/media/v4l2-core/v4l2-ioctl.c > @@ -1447,6 +1447,8 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) > case V4L2_PIX_FMT_S5C_UYVY_JPG: descr = "S5C73MX interleaved UYVY/JPEG"; break; > case V4L2_PIX_FMT_MT21C: descr = "Mediatek Compressed Format"; break; > case V4L2_PIX_FMT_SUNXI_TILED_NV12: descr = "Sunxi Tiled NV12 Format"; break; > + case V4L2_PIX_FMT_YUV420_8BIT: descr = "Compressed YUV 4:2:0 8-bit Format"; break; > + case V4L2_PIX_FMT_YUV420_10BIT: descr = "Compressed YUV 4:2:0 10-bit Format"; break; When I read the DRM documentation [0], I'm reading that YUV420_8BIT definition matches V4L2_PIX_FMT_YVU420 and V4L2_PIX_FMT_YVU420M fully. In fact, on DRM side, to represent that format you want to expose here, they will strictly combine this generic format (documented un- compressed) with a modifier generated with the macro DRM_FORMAT_MOD_ARM_AFBC(*). And only the combination represent a unique and share-able format. In absence of modifier in V4L2 API, this compressed format should be named accordingly to the compressed algorithm used (something like FMT_YUV420_8BIT_AML_FBC). So I believe these format name cannot be copied as-is like this, as they can only introduce more ambiguity in the already quite hard to follow naming of pixel formats. In fact, it is very common to see multiple different vendor compressions on the same SoC, so I don't really believe a "generic" compressed format make sense. To site one, the IMX8M, which got Verrisillicon/Vivante DEC400 on the GPU, and the Hantro G2 compression format. Both will apply to NV12 class of format so in DRM they would be NV12 + modifier, and the combination forms the unique format. Now, in term of sharing, they must be differiented by userspace, as support for compression/decompression is heterogeneous (in that case the GPU does not support Hantro G2 decompression or compression, and the VPU does not support DEC400). I'll remind that the modifier implementation has great value and is much more scalable then the current V4L2 approach. There has been some early proposal for this, maybe it's time to prioritize because this list will starts growing with hundred or even thousands or format, which is clearly indicated by the increase of modifier generator macro on the DRM side. > default: > if (fmt->description[0]) > return; > diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h > index c3a1cf1c507f..90b9949acb8a 100644 > --- a/include/uapi/linux/videodev2.h > +++ b/include/uapi/linux/videodev2.h > @@ -705,6 +705,15 @@ struct v4l2_pix_format { > #define V4L2_PIX_FMT_FWHT v4l2_fourcc('F', 'W', 'H', 'T') /* Fast Walsh Hadamard Transform (vicodec) */ > #define V4L2_PIX_FMT_FWHT_STATELESS v4l2_fourcc('S', 'F', 'W', 'H') /* Stateless FWHT (vicodec) */ > > +/* > + * Compressed Luminance+Chrominance meta-formats > + * In these formats, the component ordering is specified (Y, followed by U > + * then V), but the exact Linear layout is undefined. > + * These formats can only be used with a non-Linear modifier. > + */ > +#define V4L2_PIX_FMT_YUV420_8BIT v4l2_fourcc('Y', 'U', '0', '8') /* 1-plane YUV 4:2:0 8-bit */ > +#define V4L2_PIX_FMT_YUV420_10BIT v4l2_fourcc('Y', 'U', '1', '0') /* 1-plane YUV 4:2:0 10-bit */ > + > /* Vendor-specific formats */ > #define V4L2_PIX_FMT_CPIA1 v4l2_fourcc('C', 'P', 'I', 'A') /* cpia1 YUV */ > #define V4L2_PIX_FMT_WNVA v4l2_fourcc('W', 'N', 'V', 'A') /* Winnov hw compress */