Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp1979839lqe; Tue, 9 Apr 2024 06:31:00 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUM19TEzRox1kS48vefJdyoMDyCrFjF1bcZdNIwNq3zIYrllNH1c3QkvAD+C4Fuf4A7QXwd0M1jpjqFIolcJKqx6JLsGDss9FHehRY7MA== X-Google-Smtp-Source: AGHT+IEDLD/JHNtdvzjpfcrw7XdJ2f2E7GykXtXm95JTMEJjoAkVAh230VlhcaJeVvmtl2pYYRvA X-Received: by 2002:a05:6102:3049:b0:47a:185e:f86b with SMTP id w9-20020a056102304900b0047a185ef86bmr1677553vsa.17.1712669460329; Tue, 09 Apr 2024 06:31:00 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712669460; cv=pass; d=google.com; s=arc-20160816; b=n54mI0LfOm+zqsxIShLD6z56AJ/rcN+evHq7wUzlOgnhXdvBqquZQyAryVqg/z/ot5 R+YZfdE8YLJ2ImKRAZ4D0Yc791HrSbrCjgxfcDlmkYTdfBn+OOK7wtn3AoocWhQShzkD nqe9GpvODWrNw1FQdfGFk3KM5VavptLBZdzie7AzQ0W2PNYBLQ+x8BJs1WWqNbe7OIfB TAcemaDEVPWk35azWDr86s/sRtsLKyigJ+O8X51oIiM0RVDN+dbZ2wlEptVRL03UFRW3 qqNEYP9uL8ITrLvbytYb5Ee5Saw09ppjqqooplTus6GTI/m6apAimGU3l9PO/RbU6ORl u3BA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=SEB6zkSJJhnV1xPil5tjnP9+rrhWJG+icwGJTNeHQgY=; fh=VAOzQyCZUIkIVRfkT59kO+F4O4ceAQVh6KAZCdsXYJ4=; b=oaPed96xfW/7goukWeBYmPdIjTv+1InkeIbrJCUCtvhh/6DMrxJa/XI99hzCaBxFvD vxPOTIsDeMhQXcSf0+J4WUe+9Q+GjmHDVl8zZYZzarWbIS5PHLLrBbRy6FF3gKN19lwE QBPHOpiX+2qThWkY6q1+6h96w54jwXxwSIl0nOgnwsKpomrAIH3VAVc/brnYl4clVEhh ZHMW7aXK/jn7wASYgCanOXeP8jJRhhf7C/JGWVW6pu+Xfo7gJFyJVvxMKZ8OOJcAvQKA mGhN8ViDrGMRDGOcq+GUA7j59NPwmYXsqvMeqAdyl3UrCWj1BfWwbBd48eVbXgE9+R6F l7RA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=UJxGcM6P; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-136944-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-136944-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id c36-20020a0561023ca400b0047a0c2221a2si457929vsv.66.2024.04.09.06.31.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Apr 2024 06:31:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-136944-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=UJxGcM6P; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-136944-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-136944-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 034831C221DB for ; Tue, 9 Apr 2024 13:31:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 10F6412F394; Tue, 9 Apr 2024 13:25:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="UJxGcM6P" Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [217.70.183.193]) (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 C555A12FB33 for ; Tue, 9 Apr 2024 13:25:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.193 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712669153; cv=none; b=H9tvmqu73qDmEt4UAx9GOrzsv5ZuJTT8bFMoY29uhe1jhxiR3BWkSwKdHyqy/kgXwXiCjpx+cHr4T6xYtPgfs8SCaMBgSsLR7jneDKd97A0silybjVfWroZ6iIP94C8eHsLcPJF0JYLC1HGi3gD69Px5sRBrUb9q7CkGwKB7/Uw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712669153; c=relaxed/simple; bh=wrfbM/7ZhlgBzw2eIfyFq2UguxKdPGwVe5WR560stW4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=B6uMkW5af60SX1qLNSPfplZTQtSQ4PqvZFaz12HSk9zZYTgNDM1QidmMP/9la6rx/rZ3WOG7U3jGmKhXoEii6VUapYQ8d8m7IzRAcOvhTRWRMzzUZCz9LqJerWzj/SBfhlQaNBHLIH2PXLbfS8ZEuxSAuDYPo5DLWwZ05Pzyzvk= 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=UJxGcM6P; arc=none smtp.client-ip=217.70.183.193 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 Received: by mail.gandi.net (Postfix) with ESMTPSA id 1482C240009; Tue, 9 Apr 2024 13:25:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1712669150; 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=SEB6zkSJJhnV1xPil5tjnP9+rrhWJG+icwGJTNeHQgY=; b=UJxGcM6PxsnEKn47Kik77njQu/Vz/XN3WLlqHuegbgJ2fxvKvRCINg5eNtzhCboUN4YqTG 1svtcnw8U+WHflW4+yT/1wVFfGl07SsLeYwHyLjB0ahmtdEK5R0PpKNtcqPnOAgKyLgoO3 X1plVb5TGCGzoIgO1is2bWgvlKK7+2pImDKTQw0QjNxylA6yz1G5L7fi6XgDh7PilKvAdk +kiFiIwB8VyX6CFPNjybpbMj/cvhQm53+hdOHVLxtcYVu7GhsagTCVGm4ebuTa0D5NoiMy lFelde+QLzJrnh1wtvt8Xm4yNcUPLJDvLjJM6ox6v3H3A3Gi0/JPl5lA443qJA== From: Louis Chauvet Date: Tue, 09 Apr 2024 15:25:24 +0200 Subject: [PATCH v6 06/17] 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: 8bit Message-Id: <20240409-yuv-v6-6-de1c5728fd70@bootlin.com> References: <20240409-yuv-v6-0-de1c5728fd70@bootlin.com> In-Reply-To: <20240409-yuv-v6-0-de1c5728fd70@bootlin.com> To: Rodrigo Siqueira , Melissa Wen , =?utf-8?q?Ma=C3=ADra_Canal?= , Haneen Mohammed , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , rdunlap@infradead.org, 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, Louis Chauvet , Pekka Paalanen , =?utf-8?q?Ma=C3=ADra_Canal?= X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=6553; i=louis.chauvet@bootlin.com; h=from:subject:message-id; bh=wrfbM/7ZhlgBzw2eIfyFq2UguxKdPGwVe5WR560stW4=; b=owEBbQKS/ZANAwAIASCtLsZbECziAcsmYgBmFUHReLu1TUTPGXBIoeV/hQvLaw34rmSTm5RCT j7D5lBLV9KJAjMEAAEIAB0WIQRPj7g/vng8MQxQWQQgrS7GWxAs4gUCZhVB0QAKCRAgrS7GWxAs 4i7iEACganlvjVU3KseR0lOtb+fL4ulJlUTvHNvUqrUJtURnUpyv301A/mxZIhsA/JyTixnEGak TGnV45EZGf8cK/3gJEkUy/0C8mLCr5vtbZPWydG2BLB0XOOhz9HbhsQv896JSz65956vc8ZziZz s9nWFfg0gsR0GgX/2Ye4nGTbK9BDZq1qU3zzpQB7h8iozp1JJgSVG3cw4rZNgPVHFT3msslK7vP oRWAe6IcQJ/g1fTrGUiPFod+fmRy21rbSq/hL6BH73A3bsjILKyPUfwVPubMIRDeufclv6rc+5S CGf/sQ6BWeaHLLxOjirOTAbTmKSFzbR6RnlKEj6OVVt8T+64F1XxM1QdTQmm/lk9WwcSQgfDup9 l3piY3jzdllR3JDwrWYlrjKj5wRg5Mv4aRimNjep/SGr69aeFMevwbsHR+W5qPlUjZXvt2Q0Z6f YoNQRSgW6bpOsc97Rjyh4fMINXyI1W1dlHhztN2fUY1rAAI952RU17qeQeBaGY/rO7NPI0ax8Gg invVpUZqOGnbG/v3cDcVYhRPaXGHnHKC8U0Gkb/W+exXQCseUmyD8WWkt6ojvHrR0+qguGiRV0V xLxgt0pmiWKPw7inYnjdYlOwSSGtV0bHWt7kF+CfnBiGJFC2vrg2/WCvkXhVoulibrZi3nwuiM1 oxevHDgFIJA4D4g== 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Ć­ra Canal Signed-off-by: Louis Chauvet --- drivers/gpu/drm/vkms/vkms_drv.h | 4 ++-- drivers/gpu/drm/vkms/vkms_formats.c | 24 ++++++++++++------------ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/gpu/drm/vkms/vkms_drv.h b/drivers/gpu/drm/vkms/vkms_drv.h index d6fd9ff973d1..2e1a1b824a3c 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_pixel); +typedef void (*pixel_write_t)(u8 *out_pixel, const struct pixel_argb_u16 *in_pixel); 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_pixel); +typedef void (*pixel_read_t)(const u8 *in_pixel, struct pixel_argb_u16 *out_pixel); /** * struct vkms_plane_state - Driver specific plane state diff --git a/drivers/gpu/drm/vkms/vkms_formats.c b/drivers/gpu/drm/vkms/vkms_formats.c index c28c32b00e39..69cf9733fec5 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 *frame_info, int limit, i * They are used in the vkms_compose_row() function to handle multiple formats. */ -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 pixel_argb_u16 *out_pixel) out_pixel->b = (u16)in_pixel[0] * 257; } -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 = (u16)0xffff; out_pixel->r = (u16)in_pixel[2] * 257; @@ -97,7 +97,7 @@ static void XRGB8888_to_argb_u16(u8 *in_pixel, struct pixel_argb_u16 *out_pixel) out_pixel->b = (u16)in_pixel[0] * 257; } -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) { u16 *pixel = (u16 *)in_pixel; @@ -107,7 +107,7 @@ static void ARGB16161616_to_argb_u16(u8 *in_pixel, struct pixel_argb_u16 *out_pi out_pixel->b = le16_to_cpu(pixel[0]); } -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) { u16 *pixel = (u16 *)in_pixel; @@ -117,7 +117,7 @@ static void XRGB16161616_to_argb_u16(u8 *in_pixel, struct pixel_argb_u16 *out_pi out_pixel->b = le16_to_cpu(pixel[0]); } -static void RGB565_to_argb_u16(u8 *in_pixel, struct pixel_argb_u16 *out_pixel) +static void RGB565_to_argb_u16(const u8 *in_pixel, struct pixel_argb_u16 *out_pixel) { u16 *pixel = (u16 *)in_pixel; @@ -142,7 +142,7 @@ static void RGB565_to_argb_u16(u8 *in_pixel, struct pixel_argb_u16 *out_pixel) * It is used to avoid null pointer to be used as a function. In theory, this function should * never be called, except if you found a bug in the driver/DRM core. */ -static void magenta_to_argb_u16(u8 *in_pixel, struct pixel_argb_u16 *out_pixel) +static void magenta_to_argb_u16(const u8 *in_pixel, struct pixel_argb_u16 *out_pixel) { out_pixel->a = (u16)0xFFFF; out_pixel->r = (u16)0xFFFF; @@ -188,7 +188,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_u16 *in_pixel) { /* * This sequence below is important because the format's byte order is @@ -206,7 +206,7 @@ static void argb_u16_to_ARGB8888(u8 *out_pixel, struct pixel_argb_u16 *in_pixel) out_pixel[0] = DIV_ROUND_CLOSEST(in_pixel->b, 257); } -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_u16 *in_pixel) { out_pixel[3] = 0xff; out_pixel[2] = DIV_ROUND_CLOSEST(in_pixel->r, 257); @@ -214,7 +214,7 @@ static void argb_u16_to_XRGB8888(u8 *out_pixel, struct pixel_argb_u16 *in_pixel) out_pixel[0] = DIV_ROUND_CLOSEST(in_pixel->b, 257); } -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_argb_u16 *in_pixel) { u16 *pixel = (u16 *)out_pixel; @@ -224,7 +224,7 @@ static void argb_u16_to_ARGB16161616(u8 *out_pixel, struct pixel_argb_u16 *in_pi pixel[0] = cpu_to_le16(in_pixel->b); } -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_argb_u16 *in_pixel) { u16 *pixel = (u16 *)out_pixel; @@ -234,7 +234,7 @@ static void argb_u16_to_XRGB16161616(u8 *out_pixel, struct pixel_argb_u16 *in_pi pixel[0] = cpu_to_le16(in_pixel->b); } -static void argb_u16_to_RGB565(u8 *out_pixel, struct pixel_argb_u16 *in_pixel) +static void argb_u16_to_RGB565(u8 *out_pixel, const struct pixel_argb_u16 *in_pixel) { u16 *pixel = (u16 *)out_pixel; @@ -259,7 +259,7 @@ static void argb_u16_to_RGB565(u8 *out_pixel, struct pixel_argb_u16 *in_pixel) * It is used to avoid null pointer to be used as a function. In theory, this should never * happen, except if there is a bug in the driver */ -static void argb_u16_to_nothing(u8 *out_pixel, struct pixel_argb_u16 *in_pixel) +static void argb_u16_to_nothing(u8 *out_pixel, const struct pixel_argb_u16 *in_pixel) {} /** -- 2.43.0