Received: by 2002:a05:7208:3003:b0:81:def:69cd with SMTP id f3csp569563rba; Wed, 27 Mar 2024 05:34:43 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV6d32RTo45GL4Z76RPb73YC9S3Gub8p7GBZJpZpxGOJ2FvGTdV23hX2JrxrLr7ZLo6bbZWukHgX1+Hxk0HJg+9ye2LD33bULqf8kJQvw== X-Google-Smtp-Source: AGHT+IH3w547txCYcCpS9X7X2eE+YhaCSaHNDqgTncQSPfK8IERpwewx0qN05CDuHhpSjGvN4UIW X-Received: by 2002:a50:d68a:0:b0:568:9cfe:1974 with SMTP id r10-20020a50d68a000000b005689cfe1974mr2915482edi.18.1711542882993; Wed, 27 Mar 2024 05:34:42 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711542882; cv=pass; d=google.com; s=arc-20160816; b=R8lJDUVRi0kqvCeypPOo2D9s48iyxjB+QB8ylUZfghQ9ijjry5fXx7tPDeZOENODD7 rCCBEd7whBcmV4GuyMCiUfEY9TFzvalNfMHC87CWLr/VdGrENKpXgNhLQDDu0Muu/72O aqdw05NUU5w4qPs5JwiaY9nGZq5iZEsV0F2mxUHDiiBthqbEnxQUYE7kmf/F0WCUWYwy pN4e2rAn2bjDK5AABu6OO+NH2AZpKz+GzA8tb1GTw4cMsZjYygvgSydF809+gD66ZTVW IK50nTNyZHmii+VqgyDj10bImZgi4EKs0pfC8wBZPrcpJBdX7fYUK1guVfOfwvX9etmt TGlw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:content-transfer-encoding:references:in-reply-to:date:cc :to:from:subject:message-id; bh=CicxieCWdbspH8r9Va1yOTKN8/dRtYbKqOwKPv7lxWw=; fh=WxtcOZNDei/8vAOXvWXdHVi/3hM83em3iQ5VEDj0Rhk=; b=o0t2RrP2Vd579Icyo8EHh58wQpaw+tz+ZeNji2ADpMMsjl9HACWQxdVgRgJAp4Qw0q YqE63qKn5QPUjHyGmx0adI1brjWX1AEapcm+nUBh5ObN+mAUkMM80QrfzZuFsrSl/6ui BcCfrLOn0azY6CfbEOH8MiTG1B4PlVzCiDC5ep6jwJH5CJXkYv58Ui2g+nlsHEJCrSmH ff3gY1V16/KklZJ8PGmbq8VOSIiEtGCuRvmgakNz5gkFzxUcx3RL3iCmhpjgSiXEoByu 1x0/68u/fzavZhzT6bG39b+dRG3/A6QKD5oafitiFv+pZZ3AQycYRZ7/5KdCG/rHisPE sJmg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=pengutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-120906-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-120906-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id x12-20020a05640226cc00b0056c1d4c2649si2293158edd.239.2024.03.27.05.34.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 05:34:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-120906-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=pengutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-120906-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-120906-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id B35031F3611F for ; Wed, 27 Mar 2024 12:34:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DD4451482E7; Wed, 27 Mar 2024 12:12:30 +0000 (UTC) Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A1114147C8B for ; Wed, 27 Mar 2024 12:12:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711541550; cv=none; b=fhz50NPQkLHGzJje9RA6ovp7jUQkf6YaSDKx0FJHw0W2iXnOCvxsFAYT7fJWuGmvrqtqvnwHJgrJj7NFzqEplQGaNcPgAF0C8f3AA6tiSBI7hFqZL+YMUGkmBkH/NTxrXxSU4/OURP5y4Ij47abqMI4wtyf+wsJYXoZBjdfjGr8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711541550; c=relaxed/simple; bh=DiOWFNV13xwUAoCXem0V1LNeUxUEOlVmeRbu6TsGaME=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=GWzXhcZMCyTdFNdcLcYD+h4UI0743xySlunjNMGjsl2IK6RbIzNbKLo/eoTyReeWDEoqyYMrvjqe3vso5qx2Kuv3xuGnQ92phWPo2InU9h6Y3JPIH+wQ9x5Xk8XgVujaNjTKy8tYit9xbYTFN/kCQCWDnyZcgQ7WRHYds+bMbI0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rpS8K-0004ds-Ci; Wed, 27 Mar 2024 13:11:56 +0100 Received: from [2a0a:edc0:0:900:1d::4e] (helo=lupine) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rpS8I-008nwn-4g; Wed, 27 Mar 2024 13:11:54 +0100 Received: from pza by lupine with local (Exim 4.96) (envelope-from ) id 1rpS8I-0007xg-0D; Wed, 27 Mar 2024 13:11:54 +0100 Message-ID: <5f6ab3804baa87f6e2299f668d2ab41be3a13f13.camel@pengutronix.de> Subject: Re: [PATCH v5 11/16] drm/vkms: Add YUV support From: Philipp Zabel To: Louis Chauvet , Rodrigo Siqueira , Melissa Wen , =?ISO-8859-1?Q?Ma=EDra?= Canal , Haneen Mohammed , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , arthurgrillo@riseup.net, Jonathan Corbet , pekka.paalanen@haloniitty.fi Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, jeremie.dautheribes@bootlin.com, miquel.raynal@bootlin.com, thomas.petazzoni@bootlin.com, seanpaul@google.com, marcheu@google.com, nicolejadeyee@google.com Date: Wed, 27 Mar 2024 13:11:53 +0100 In-Reply-To: <20240313-yuv-v5-11-e610cbd03f52@bootlin.com> References: <20240313-yuv-v5-0-e610cbd03f52@bootlin.com> <20240313-yuv-v5-11-e610cbd03f52@bootlin.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.46.4-2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: p.zabel@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Hi Louis, On Mi, 2024-03-13 at 18:45 +0100, Louis Chauvet wrote: > From: Arthur Grillo >=20 > Add support to the YUV formats bellow: >=20 > - NV12/NV16/NV24 > - NV21/NV61/NV42 > - YUV420/YUV422/YUV444 > - YVU420/YVU422/YVU444 >=20 > The conversion from yuv to rgb is done with fixed-point arithmetic, using > 32.32 floats and the drm_fixed helpers. s/floats/fixed-point numbers/ Nothing floating here, the point is fixed. [...] > diff --git a/drivers/gpu/drm/vkms/vkms_drv.h b/drivers/gpu/drm/vkms/vkms_= drv.h > index 23e1d247468d..f3116084de5a 100644 > --- a/drivers/gpu/drm/vkms/vkms_drv.h > +++ b/drivers/gpu/drm/vkms/vkms_drv.h > @@ -99,6 +99,27 @@ typedef void (*pixel_read_line_t)(const struct vkms_pl= ane_state *plane, int x_st > int y_start, enum pixel_read_direction direction, int count, > struct pixel_argb_u16 out_pixel[]); > =20 > +/** > + * CONVERSION_MATRIX_FLOAT_DEPTH - Number of digits after the point for = conversion matrix values s/CONVERSION_MATRIX_FLOAT_DEPTH/CONVERSION_MATRIX_FRACTIONAL_BITS/ Just a suggestion, maybe there are better terms, but using "FLOAT" here is confusing. > + */ > +#define CONVERSION_MATRIX_FLOAT_DEPTH 32 > + > +/** > + * struct conversion_matrix - Matrix to use for a specific encoding and = range > + * > + * @matrix: Conversion matrix from yuv to rgb. The matrix is stored in a= row-major manner and is > + * used to compute rgb values from yuv values: > + * [[r],[g],[b]] =3D @matrix * [[y],[u],[v]] > + * OR for yvu formats: > + * [[r],[g],[b]] =3D @matrix * [[y],[v],[u]] > + * The values of the matrix are fixed floats, 32.CONVERSION_MATRIX_FLOA= T_DEPTH s/fixed floats/fixed-point numbers/ regards Philipp