Received: by 2002:a05:7208:13ce:b0:7f:395a:35b6 with SMTP id r14csp342799rbe; Thu, 29 Feb 2024 00:49:02 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUuqbp7X4BlWKuG+5lc3N4Ig5/KntzBkcK/IqKC4GBaEjMGBmUGSuUORCJSOOgM/v0ThVFeTcf3yzwZgmEL30zB1LCPgLWc4P+GHKOIVQ== X-Google-Smtp-Source: AGHT+IFQli1PDsPF2T2UGaEh/05mf2S3YpHUGOBB0rk0oDBX6XXUdysptgJkVthrUO7FFKs/5Gkv X-Received: by 2002:a05:6870:9614:b0:21e:b6fc:750d with SMTP id d20-20020a056870961400b0021eb6fc750dmr1334010oaq.32.1709196541803; Thu, 29 Feb 2024 00:49:01 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709196541; cv=pass; d=google.com; s=arc-20160816; b=G0EVEslGb7MbNwLsG2gk+rt0xwAklFzouUl2P8MHHcEaidzlWW0tLfNQuhyY/NPwAw ZPJfJNMcwJGjZiXxMrHFUEtTEmlzfFq1RX/tYYJEv17z7TxP22HzvFquppx6P5UWGpPF YxwqvYz7P8pBtHxJEUjY7d6xxyNFuoCF0S5906LV/OZVTLjNPxR2FaNx8x73U0NSKanx Pwqb96rXiR1xXX4QmsOOVbbecMp4PP0mLiVZmpE6IMAe+s8sheazfUGWD5QoFj+PFwb0 /3UoGijQP/c9nx0uFzjsoEm53KdPyPm1mQY8+YFx+1p63ABArkROi/6Zs8d24qpGj6sa xa+w== 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 :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=eSboyuttpmIuSBz8a8MsRCeoi1fgJYQnwelhi9n8wiY=; fh=bQVeEsjM48kdTC+Wknd6G9LjrO9idjfnPCqvYjmOFSI=; b=g2YvMvFIuxZKbXB9+yT3lFfeSBXnAbUPGP+G3oA7bWcolkSNv+ohn5kvOGVWEngMux iC8PT6qTOwav12sF0JDsxAr5gS3Ru/oN3wxhdhR0U1qCYMscNvq0Dgc7kq3B3qoSdYS0 o1a7814AytBH1bYFhO1uwDrXYHzRpOGPl3Qndk3xUB9aeUa6vQNXD6gkZP6L1C3XSPYX AyL3qgITc3gSGTSPNNZO4WsBEP6J41AjPOvx8QO6AtJzpziBNb+f2rvYNP7VgucJjynN Qla0+0xEl1VgCKVbYYkfG13muPfOcdiICEm+Ruq/HiepRGDYIGXLutt0jNMrUs4eniwU pi+w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=gvX9AuuE; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-kernel+bounces-86342-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-86342-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id bd36-20020a056a0027a400b006e471c6365dsi932535pfb.27.2024.02.29.00.49.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 00:49:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-86342-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=gvX9AuuE; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-kernel+bounces-86342-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-86342-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 74CB5283991 for ; Thu, 29 Feb 2024 08:49:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D522853E20; Thu, 29 Feb 2024 08:48:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="gvX9AuuE" Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (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 4B39D535AF for ; Thu, 29 Feb 2024 08:48:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.235.227.194 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709196518; cv=none; b=mzFTvqOo1bar79j3NBxhXUy41XnknG+bQRUg/vToXU5Lwy2Hs8Gd/gGKvcGaHiB2XZdg0jdtJQDGZXoczksx2vJyLXSc6BpD6Bdmm8w2it0OiESvnju1DIw5zf5p/yPrEc6sq5vSXjunhFYsSTxsh/j2f4I1YxYhUYr5JJ0jaYA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709196518; c=relaxed/simple; bh=kYHhmfnLG5HO9XeGNi2d/5YSdEu6N9g/zbGGaVRMKOA=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=BmwowPOKWrOZ4gslsGFU0w4izkxpYxCKL9C2f2FR66QzOqGd4cqJ/FxT2blgICd12RIHju10GE4o0HbytruVS5yrmu4DKI0Cq3faEM+hTVnd3OjbYSaDTvEgkEC77+s1uMZffcHXZ+m00wN1EskM5yUwJdCppBRZzrwL9kA4cbA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=gvX9AuuE; arc=none smtp.client-ip=46.235.227.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1709196515; bh=kYHhmfnLG5HO9XeGNi2d/5YSdEu6N9g/zbGGaVRMKOA=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=gvX9AuuEiHwkrntXGHzsmKj734fg4wfbGdKn4yAQMkFil9vXY4lJkIv5j2K4TVRaJ ryFqWs9JcOV3h2RdIh/57XVu8wsho+piA4KoMqsLKnthXtfsLA/WcfNIGXLW44od5x E09janHFHzDURjwqXth560VZsQZ7Eb10dgDmzggsxgBNQaD1XeihHsIiVcHgwPY/Iv 2I2j42a3rs6Ue5abbpDS94WrJRYt5B98JetPhU/cY5CRbHwWW7IPp4K9OyCkJqHxrz Zg+TihLG0vg7xi5epI1bQevgyUdaEyUi5kteyeFeC5cMgUuKiYwOhvJg4k9TujgCIa 7U10ziiYpy20Q== Received: from eldfell (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: pq) by madrid.collaboradmins.com (Postfix) with ESMTPSA id C8C4A37810EF; Thu, 29 Feb 2024 08:48:34 +0000 (UTC) Date: Thu, 29 Feb 2024 10:48:33 +0200 From: Pekka Paalanen To: Louis Chauvet Cc: Rodrigo Siqueira , Melissa Wen , =?UTF-8?B?TWHDrXJh?= Canal , Haneen Mohammed , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , arthurgrillo@riseup.net, Jonathan Corbet , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, jeremie.dautheribes@bootlin.com, miquel.raynal@bootlin.com, thomas.petazzoni@bootlin.com Subject: Re: [PATCH v2 3/9] drm/vkms: write/update the documentation for pixel conversion and pixel write functions Message-ID: <20240229104833.2a404d6b.pekka.paalanen@collabora.com> In-Reply-To: References: <20240223-yuv-v2-0-aa6be2827bb7@bootlin.com> <20240223-yuv-v2-3-aa6be2827bb7@bootlin.com> <20240226133700.3fef91d9.pekka.paalanen@collabora.com> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/+HboMIL2MT+JY+7LlICC2fx"; protocol="application/pgp-signature"; micalg=pgp-sha256 --Sig_/+HboMIL2MT+JY+7LlICC2fx Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Tue, 27 Feb 2024 16:02:10 +0100 Louis Chauvet wrote: > [...] >=20 > > > diff --git a/drivers/gpu/drm/vkms/vkms_formats.c b/drivers/gpu/drm/vk= ms/vkms_formats.c > > > index 172830a3936a..cb7a49b7c8e7 100644 > > > --- a/drivers/gpu/drm/vkms/vkms_formats.c > > > +++ b/drivers/gpu/drm/vkms/vkms_formats.c > > > @@ -9,6 +9,17 @@ > > > =20 > > > #include "vkms_formats.h" > > > =20 > > > +/** > > > + * packed_pixels_offset() - Get the offset of the block containing t= he pixel at coordinates x/y > > > + * in the first plane > > > + * > > > + * @frame_info: Buffer metadata > > > + * @x: The x coordinate of the wanted pixel in the buffer > > > + * @y: The y coordinate of the wanted pixel in the buffer > > > + * > > > + * The caller must be aware that this offset is not always a pointer= to a pixel. If individual > > > + * pixel values are needed, they have to be extracted from the resul= ting block. =20 > >=20 > > Just wondering how the caller will be able to extract the right pixel > > from the block without re-using the knowledge already used in this > > function. I'd also expect the function to round down x,y to be > > divisible by block dimensions, but that's not visible in this email. > > Then the caller needs the remainder from the round-down, too? =20 >=20 > You are right, the current implementation is only working when block_h = =3D=3D=20 > block_w =3D=3D 1. I think I wrote the documentation for PATCHv2 5/9, but = when=20 > backporting this comment for PATCHv2 3/9 I forgot to update it. > The new comment will be: >=20 > * pixels_offset() - Get the offset of a given pixel data at coordinate=20 > * x/y in the first plane > [...] > * The caller must ensure that the framebuffer associated with this=20 > * request uses a pixel format where block_h =3D=3D block_w =3D=3D 1. > * If this requirement is not fulfilled, the resulting offset can be=20 > * completly wrong. Hi Louis, if there is no plan for how non-1x1 blocks would work yet, then I think the above wording is fine. In my mind, the below wording would encourage callers to seek out and try arbitrary tricks to make things work for non-1x1 without rewriting the function to actually work. I believe something would need to change in the function signature to make it properly usable for non-1x1 blocks, but I too cannot suggest anything off-hand. >=20 > And yes, even after PATCHv2 5/9 it is not clear what is the offset. Is=20 > this better to replace the last sentence? (I will do the same update for= =20 > the last sentence of packed_pixels_addr) >=20 > [...] > * The returned offset correspond to the offset of the block containing t= he pixel at coordinates=20 > * x/y. > * The caller must use this offset with care, as for formats with block_h= !=3D 1 or block_w !=3D 1=20 > * the requested pixel value may have to be extracted from the block, eve= n if they are=20 > * individually adressable. > =20 > > > + */ > > > static size_t pixel_offset(const struct vkms_frame_info *frame_info,= int x, int y) > > > { > > > struct drm_framebuffer *fb =3D frame_info->fb; > > > @@ -17,12 +28,13 @@ static size_t pixel_offset(const struct vkms_fram= e_info *frame_info, int x, int > > > + (x * fb->format->cpp[0]); > > > } > > > =20 >=20 > [...] >=20 > > > +/** > > > + * Retrieve the correct read_pixel function for a specific format. > > > + * The returned pointer is NULL for unsupported pixel formats. The c= aller must ensure that the > > > + * pointer is valid before using it in a vkms_plane_state. > > > + * > > > + * @format: 4cc of the format =20 > >=20 > > Since there are many different 4cc style pixel format definition tables > > in existence with conflicting definitions, it would not hurt to be more > > specific that this is about DRM_FORMAT_* or drm_fourcc.h. =20 >=20 > Is this better? >=20 > @format: DRM_FORMAT_* value for which to obtain a conversion function = (see [drm_fourcc.h]) Much better! Thanks, pq > > > + */ > > > void *get_pixel_conversion_function(u32 format) > > > { > > > switch (format) { > > > @@ -247,6 +280,13 @@ void *get_pixel_conversion_function(u32 format) > > > } > > > } > > > =20 > > > +/** > > > + * Retrieve the correct write_pixel function for a specific format. > > > + * The returned pointer is NULL for unsupported pixel formats. The c= aller must ensure that the > > > + * pointer is valid before using it in a vkms_writeback_job. > > > + * > > > + * @format: 4cc of the format =20 > >=20 > > This too. =20 >=20 > Ack, I will use the same as above >=20 > > > + */ > > > void *get_pixel_write_function(u32 format) > > > { > > > switch (format) { > > > =20 > >=20 > > I couldn't check if the docs are correct since the patch context is not > > wide enough, but they all sound plausible to me. =20 >=20 > I checked again, I don't see other errors than your first comment. > =20 > >=20 > > Thanks, > > pq =20 >=20 > Kind regards, > Louis Chauvet >=20 > -- > Louis Chauvet, Bootlin > Embedded Linux and Kernel engineering > https://bootlin.com --Sig_/+HboMIL2MT+JY+7LlICC2fx Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEJQjwWQChkWOYOIONI1/ltBGqqqcFAmXgROEACgkQI1/ltBGq qqcOIA//aVbdxJehk47q1mIdt/oLv2wc2VwNal9EyfCqvqtOUgDvCzQBu/ZTrA8q AigVdfkno5Zg80Uypzi+GPVnq16I4eeqG/KdhEe5Av2hVML5WX52fE2RHVJIkGyv 7CcROr/W8JLdELRr4q3P5UM616f/ro4O0m/570KimJv2OZsfTvAOnLjLPuxkSov+ QaMCpMwpTmxyPqokgiBl6VzYVzK/vvI2aae90e1e7WofOaDW+1XAtfj7DrzdsMWP dq9KtZJDFR9Rurxqy90a5Kk1lmXQIxviRhK/jcSMyXkibqM7vNC21kgRjtYbcqbM CplfADBP9O5N6uMdx0rq4sUKBOoGTwn9A3PcMRbec6YFd3kkDo7l1Q7idjpU0fJo xtyP+h5kJfIfybCr8b7MHRp2pqYUbDtPa0bg0Ez7kmtI1kIR99PAf/bzH+JKYgAH DoBfrBSg4m7mTjdFnPHMZPrVxChZc6QcPFtDa4YYajFv9idcnVCLnIwQ48nzr8ts DokTuYJVjiwwrBlgwaWkRTTBNM6Chx0HYf30nhI8+6dTvITz9DLhrH83kuQ5oXx3 cXvagRFWixps/PEoYL2a85BMSfCZONvY25O0oHNoEoEuNEv3teqV6CS3h5iElN+5 VLpfLdWCOozCl0OlJIQXWlcELKOamxkICXPB1/+xP8DN5+yM2/c= =x/di -----END PGP SIGNATURE----- --Sig_/+HboMIL2MT+JY+7LlICC2fx--