From nobody Thu Nov 28 18:39:29 2024 Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.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 BA7CE1991B3; Mon, 30 Sep 2024 15:32:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.194 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727710351; cv=none; b=T1x3/be98vLLAqh9fJovdXzYiotx+K3TUfypheqxfpROeVL+5BSGf9ljyOeOH8V+t+6AdSi59B9UCVLVSdmH4aM2ePHhm5Hb/dGGkNZUjKfWBIG9kVokNJSv081LVwjovlTVu7xAN9W070Pd25GIxuzkRtQAv4ZxOhVFzqYLliQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727710351; c=relaxed/simple; bh=pcO7PJljvN+5ZMRN62ei/7AXlRn2UOK1It95XxXYjy0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=nMBehWwb/zmMBaRQA57kGpnliaY/gR7rZpyVoSGS6RRs2Vt4zxmM1229ftlnNsO8g0PIM29FugQVRb3kzPJs8c7vXZr4oxhw6COWhm2Wx0lSFCyXL3RXuNs3QEH/TbeAygkm8kMmpkSi2rtXTfCFXcFOtU0ymgwfhFRshtq7QOM= 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=IsMMNWID; arc=none smtp.client-ip=217.70.183.194 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="IsMMNWID" Received: by mail.gandi.net (Postfix) with ESMTPSA id 5C46D40003; Mon, 30 Sep 2024 15:32:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1727710348; 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=hgr/XrTxDtIWwsS5/vbZyxbbV6+JuFoUt1MFA4iMZ/c=; b=IsMMNWIDmmFRkWcJGsRUrdAMjdowvR+aR4VdfhK77O1FOWJbpQdI99Wc/zjVRd4Nm4tubT 0PmSojVj7/TgxbIfWxo/erVXJkfUK2MU2hLl8TVYmdBjnQvhVCpgEtr0HscovuAMpjUdos ymFf9lMt7MCcdZoDkKVRf37PTXRPnXMV/6CJjgBasaYm80sMA75TiKhAXV5EgloqVUcOL8 vFdWLZQ4VeCdRuhrcdQIvaUaf4oON4xcW9BZH23a4oFxcIGQ0TrGhlnqmpddKIXgkIrxS+ Holago6fDQF4YemLHOOTUTrjsZxyPttBB8NZ+eNHn9idCoUw7KyPy0FnoFFUfw== From: Louis Chauvet Date: Mon, 30 Sep 2024 17:31:44 +0200 Subject: [PATCH v11 04/15] 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: <20240930-yuv-v11-4-4b1a26bcfc96@bootlin.com> References: <20240930-yuv-v11-0-4b1a26bcfc96@bootlin.com> In-Reply-To: <20240930-yuv-v11-0-4b1a26bcfc96@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 , 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?= X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=5640; i=louis.chauvet@bootlin.com; h=from:subject:message-id; bh=pcO7PJljvN+5ZMRN62ei/7AXlRn2UOK1It95XxXYjy0=; b=owEBbQKS/ZANAwAIASCtLsZbECziAcsmYgBm+sRuZgIpJ0xgZLi8eXBKKzyjgAwef1YOxm0A1 LfDux2oKReJAjMEAAEIAB0WIQRPj7g/vng8MQxQWQQgrS7GWxAs4gUCZvrEbgAKCRAgrS7GWxAs 4mAdEAC2GjCmS35cV1Obvoph/pYwitgzV83T0hrRAeDGhkb1Xaz9Ol1EBLrpGM8+SpY6O/eiF6y 85Qrr9aTe5EMP65ZjZxGX78l3yvKkm58uCTHgF5lAOTy92pQwws+drbuEFuiJ6SURzQT9OukrFT vVlGjf3IAEG199iVVAO227tqrV1Yju4Brqs9mIEDADHEcKfBwuDDUsktlirhtrfMs5ArQ3kMPeh u9WhRU2XKhy9XQvtQIH9HqNfYZwIZVXxL9KYK5Lq8Xq60kCQrOMZkWtc0PtbtMxpxfkhZBAO1C8 Ctjls/dV/IqljQlxNO9ASJVsVwxD1sSMYbCWebRVY42x7I8GgbrOrGCGedhHVOp3snkhhOZsq2b DUt81AeISVlaTe8uTSzZSAuOSlPTQFQCDLpGMC803f8qhqLGKFX6tKiKiIYKDGVCcz/W+LZ0gTR xiK4/yRCvLuFlzunvhoX1GO8BzF6FQYJtU25prU7cKDIeOxAzETJlhOSeDiqzHB0LAmUaL5kgck WGB4y4gVYRLMcOlrYwS+U7B+rGwyU+PfL0mtEW7eXLaVD8zuxIiDXhGhVI1TH2MX+YI/8cJbqKU 4xxhxYj12fMSdGVj9fdX9psGvlzQSc2VRgD7Fc9Eo3xvidE8NNVx5c2xe/klF2Tpdk1B694Lz6M X69k0P1nE1NPlMw== 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 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 137348f4adb2..a3020c49d1b3 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 b9544e67cd4f..06aef5162529 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.46.2