From nobody Sun Nov 24 18:35:23 2024 Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) (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 EEBEF1E1025; Mon, 18 Nov 2024 18:28:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.196 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731954516; cv=none; b=LrJbPwcCSuJclXvxIZYlcNErYR//oBEl4M/5Tzdcu4YhOGFppR1GgHfADM5D8mShXhe2AcfFXjFb47HJ6/bsTg5kcqSp05PtkF6jOJgEAN0OnqZUqESGPZKh8vtiz48LW+xxivJ+AYU3AZGYMjmq/zp9ZDLf0tZ3ztrvEU3c4Gc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731954516; c=relaxed/simple; bh=OQHoOsCktDa4JPtAf7ru0Af9BSk72HJjl/EfV7gZnK8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=eOaEGijS3+77SD5DMzDVloUmGey9spUKIG71+GKxOVEjWPMzq4PzNYHNRRUSABMobnYVNjQgz/1wE1kYFuvIFYUQapJu5pvAcbcye1P8YWYLF2gJb0FV48kH4GhbZyje1DS8dUwDBBRsdKMbV6Rpq+OeGmXInHCuQrR0cYDLvSk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=mLso3S1d; arc=none smtp.client-ip=217.70.183.196 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="mLso3S1d" Received: by mail.gandi.net (Postfix) with ESMTPSA id C1809E0006; Mon, 18 Nov 2024 18:28:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1731954512; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hLe98ZpQwO7lx+w4LLlsZA+XPkoOuh/i6X5IcUl6w3s=; b=mLso3S1djVeNMqa2gCpS4XoKHTZTms1VIOYRL17B6HfOsvoH30d4ZoIc4s4M+aSUiz3OsU Kn1CT8/1pEUaH5sD62KRnDzwBdS6ly1HFuyhRDvb1bEL7REj/8NA3f4uyv7LCPiUy3+gUi WJLKC2dMaroZFkYIPOTI3Ofamt2GjY/WreZN9sxX1Fn1GKMCXQoRiA3FeGSo2pEDVYY5dr fRgLGfjce3myfb1+nxbfVtyWhYZc086w1+CN3+RWlhhYSU1ZfVejeM0lIr6Thnakry4z7c JylsFODBBodsiknvovCVi2xirweZKk8IIq8WIxExsMR1Fwk3rwWJ/+XxvNzMeQ== From: Louis Chauvet Date: Mon, 18 Nov 2024 19:28:19 +0100 Subject: [PATCH v14 4/9] drm/vkms: Use const for input pointers in pixel_read an pixel_write functions Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241118-yuv-v14-4-2dbc2f1e222c@bootlin.com> References: <20241118-yuv-v14-0-2dbc2f1e222c@bootlin.com> In-Reply-To: <20241118-yuv-v14-0-2dbc2f1e222c@bootlin.com> To: Rodrigo Siqueira , Melissa Wen , =?utf-8?q?Ma=C3=ADra_Canal?= , Haneen Mohammed , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Jonathan Corbet , Louis Chauvet , Simona Vetter , Helen Koike , rdunlap@infradead.org, arthurgrillo@riseup.net, pekka.paalanen@haloniitty.fi, Simona Vetter Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, thomas.petazzoni@bootlin.com, jeremie.dautheribes@bootlin.com, miquel.raynal@bootlin.com, seanpaul@google.com, marcheu@google.com, nicolejadeyee@google.com, Pekka Paalanen , =?utf-8?q?Ma=C3=ADra_Canal?= , =?utf-8?q?Jos=C3=A9_Exp=C3=B3sito?= X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=5810; i=louis.chauvet@bootlin.com; h=from:subject:message-id; bh=OQHoOsCktDa4JPtAf7ru0Af9BSk72HJjl/EfV7gZnK8=; b=owEBbQKS/ZANAwAIASCtLsZbECziAcsmYgBnO4dFLJ6ckM6uHnkWUEE5S81OcClBK4Gvtt4e6 FMPptjhjOyJAjMEAAEIAB0WIQRPj7g/vng8MQxQWQQgrS7GWxAs4gUCZzuHRQAKCRAgrS7GWxAs 4sJ8EAC+KHeIsdr8vJUlvfKLxdnFMjj0Ru6ygUFtriBOX7JdoZj1heYZyjBzt7Rh1/ruXoT5zf5 yq/HX+LfSjMWsdBBaPv0EdJlsk1keStw0aFFwxKn2VBUAgi8awkNgg5d5GHO2uPhXjcumPhtl4m Bo+PfWhRrf9UHJpjh0wLPkpAd75PFFQMdNSnIHXEkMue7/IhAaQeFmkv4bthZ+rhlbadnSdsX7H 0otkH6Qx4kJR7G2L2/rarKhh05i4+cO9m2IdQ7eh6UcfgI1FmoCDUkwemq4nCJ027Dd7WV6YbQY rK8K1jAnj0p+njssywuo0ZUYalkPOYO6kebi72Cjw4WyLMYb7+siehmhZaJR2N1GmhHT6nbW2tK lF066v3bsrMrWmTiRuR8Xnfg23+oiKCHqPSrJLUiJLyZ2fFI6wEAItTo2yykTdsMJpeupp5BY/f KEDFOZwGuFu++iiaqSKJgk8iXS4WU2srnv61RGXoYOuqGWqDSpxZAV5tL+lkdmHIJK8roHLAtBE U6AMYze0ECg5g2i2FU1idmrvP77mj6hFiLabqVsE9psut3f3qTWVzLvbN3dNVgALW4ayssaHsLN pYLVnkA9J2smQFDeNbppuGhxQxUmu075w5T0IQ5JqKyGhDztxEK7dBOj+t3C8YFcLogD83bfRaI 0Wx0vjtPrZavq9w== X-Developer-Key: i=louis.chauvet@bootlin.com; a=openpgp; fpr=8B7104AE9A272D6693F527F2EC1883F55E0B40A5 X-GND-Sasl: louis.chauvet@bootlin.com As the pixel_read and pixel_write function should never modify the input buffer, mark those pointers const. Reviewed-by: Pekka Paalanen Reviewed-by: Ma=C3=ADra Canal Reviewed-by: Jos=C3=A9 Exp=C3=B3sito Signed-off-by: Louis Chauvet --- drivers/gpu/drm/vkms/vkms_drv.h | 4 ++-- drivers/gpu/drm/vkms/vkms_formats.c | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/vkms/vkms_drv.h b/drivers/gpu/drm/vkms/vkms_dr= v.h index e0d46defed835e5670dc1665da9917f807ad0c07..3f45290a0c5d5ae8c38b79970a2= 1deea6a61a0f1 100644 --- a/drivers/gpu/drm/vkms/vkms_drv.h +++ b/drivers/gpu/drm/vkms/vkms_drv.h @@ -61,7 +61,7 @@ struct line_buffer { * @out_pixel: destination address to write the pixel * @in_pixel: pixel to write */ -typedef void (*pixel_write_t)(u8 *out_pixel, struct pixel_argb_u16 *in_pix= el); +typedef void (*pixel_write_t)(u8 *out_pixel, const struct pixel_argb_u16 *= in_pixel); =20 struct vkms_writeback_job { struct iosys_map data[DRM_FORMAT_MAX_PLANES]; @@ -76,7 +76,7 @@ struct vkms_writeback_job { * @in_pixel: pointer to the pixel to read * @out_pixel: pointer to write the converted pixel */ -typedef void (*pixel_read_t)(u8 *in_pixel, struct pixel_argb_u16 *out_pixe= l); +typedef void (*pixel_read_t)(const u8 *in_pixel, struct pixel_argb_u16 *ou= t_pixel); =20 /** * struct vkms_plane_state - Driver specific plane state diff --git a/drivers/gpu/drm/vkms/vkms_formats.c b/drivers/gpu/drm/vkms/vkm= s_formats.c index b9544e67cd4fad7fdd4707527a6ff8ea8f2c35be..06aef516252956eb43e111c0e16= 9f21c1ab5b482 100644 --- a/drivers/gpu/drm/vkms/vkms_formats.c +++ b/drivers/gpu/drm/vkms/vkms_formats.c @@ -75,7 +75,7 @@ static int get_x_position(const struct vkms_frame_info *f= rame_info, int limit, i * They are used in the vkms_compose_row() function to handle multiple for= mats. */ =20 -static void ARGB8888_to_argb_u16(u8 *in_pixel, struct pixel_argb_u16 *out_= pixel) +static void ARGB8888_to_argb_u16(const u8 *in_pixel, struct pixel_argb_u16= *out_pixel) { /* * The 257 is the "conversion ratio". This number is obtained by the @@ -89,7 +89,7 @@ static void ARGB8888_to_argb_u16(u8 *in_pixel, struct pix= el_argb_u16 *out_pixel) out_pixel->b =3D (u16)in_pixel[0] * 257; } =20 -static void XRGB8888_to_argb_u16(u8 *in_pixel, struct pixel_argb_u16 *out_= pixel) +static void XRGB8888_to_argb_u16(const u8 *in_pixel, struct pixel_argb_u16= *out_pixel) { out_pixel->a =3D (u16)0xffff; out_pixel->r =3D (u16)in_pixel[2] * 257; @@ -97,7 +97,7 @@ static void XRGB8888_to_argb_u16(u8 *in_pixel, struct pix= el_argb_u16 *out_pixel) out_pixel->b =3D (u16)in_pixel[0] * 257; } =20 -static void ARGB16161616_to_argb_u16(u8 *in_pixel, struct pixel_argb_u16 *= out_pixel) +static void ARGB16161616_to_argb_u16(const u8 *in_pixel, struct pixel_argb= _u16 *out_pixel) { __le16 *pixel =3D (__le16 *)in_pixel; =20 @@ -107,7 +107,7 @@ static void ARGB16161616_to_argb_u16(u8 *in_pixel, stru= ct pixel_argb_u16 *out_pi out_pixel->b =3D le16_to_cpu(pixel[0]); } =20 -static void XRGB16161616_to_argb_u16(u8 *in_pixel, struct pixel_argb_u16 *= out_pixel) +static void XRGB16161616_to_argb_u16(const u8 *in_pixel, struct pixel_argb= _u16 *out_pixel) { __le16 *pixel =3D (__le16 *)in_pixel; =20 @@ -117,7 +117,7 @@ static void XRGB16161616_to_argb_u16(u8 *in_pixel, stru= ct pixel_argb_u16 *out_pi out_pixel->b =3D le16_to_cpu(pixel[0]); } =20 -static void RGB565_to_argb_u16(u8 *in_pixel, struct pixel_argb_u16 *out_pi= xel) +static void RGB565_to_argb_u16(const u8 *in_pixel, struct pixel_argb_u16 *= out_pixel) { __le16 *pixel =3D (__le16 *)in_pixel; =20 @@ -173,7 +173,7 @@ void vkms_compose_row(struct line_buffer *stage_buffer,= struct vkms_plane_state * They are used in vkms_writeback_row() to convert and store a pixel from= the src_buffer to * the writeback buffer. */ -static void argb_u16_to_ARGB8888(u8 *out_pixel, struct pixel_argb_u16 *in_= pixel) +static void argb_u16_to_ARGB8888(u8 *out_pixel, const struct pixel_argb_u1= 6 *in_pixel) { /* * This sequence below is important because the format's byte order is @@ -191,7 +191,7 @@ static void argb_u16_to_ARGB8888(u8 *out_pixel, struct = pixel_argb_u16 *in_pixel) out_pixel[0] =3D DIV_ROUND_CLOSEST(in_pixel->b, 257); } =20 -static void argb_u16_to_XRGB8888(u8 *out_pixel, struct pixel_argb_u16 *in_= pixel) +static void argb_u16_to_XRGB8888(u8 *out_pixel, const struct pixel_argb_u1= 6 *in_pixel) { out_pixel[3] =3D 0xff; out_pixel[2] =3D DIV_ROUND_CLOSEST(in_pixel->r, 257); @@ -199,7 +199,7 @@ static void argb_u16_to_XRGB8888(u8 *out_pixel, struct = pixel_argb_u16 *in_pixel) out_pixel[0] =3D DIV_ROUND_CLOSEST(in_pixel->b, 257); } =20 -static void argb_u16_to_ARGB16161616(u8 *out_pixel, struct pixel_argb_u16 = *in_pixel) +static void argb_u16_to_ARGB16161616(u8 *out_pixel, const struct pixel_arg= b_u16 *in_pixel) { __le16 *pixel =3D (__le16 *)out_pixel; =20 @@ -209,7 +209,7 @@ static void argb_u16_to_ARGB16161616(u8 *out_pixel, str= uct pixel_argb_u16 *in_pi pixel[0] =3D cpu_to_le16(in_pixel->b); } =20 -static void argb_u16_to_XRGB16161616(u8 *out_pixel, struct pixel_argb_u16 = *in_pixel) +static void argb_u16_to_XRGB16161616(u8 *out_pixel, const struct pixel_arg= b_u16 *in_pixel) { __le16 *pixel =3D (__le16 *)out_pixel; =20 @@ -219,7 +219,7 @@ static void argb_u16_to_XRGB16161616(u8 *out_pixel, str= uct pixel_argb_u16 *in_pi pixel[0] =3D cpu_to_le16(in_pixel->b); } =20 -static void argb_u16_to_RGB565(u8 *out_pixel, struct pixel_argb_u16 *in_pi= xel) +static void argb_u16_to_RGB565(u8 *out_pixel, const struct pixel_argb_u16 = *in_pixel) { __le16 *pixel =3D (__le16 *)out_pixel; =20 --=20 2.47.0