Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp1883364lqo; Mon, 13 May 2024 00:51:46 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWJQqUg9ujD8K6hnQeC1mGzKW+4304d8rG1HaQyIRLujVfDanaYuXk1IJYyrXGcoxfZ93wYEeyKZJnoIzAgOzgOSKxlThwcBSlE3hp6Xg== X-Google-Smtp-Source: AGHT+IHwXj1mNPA9uPnupaBANFtoxqgNQ14u1rXStxjzobZ2ixPmD0QTBeOIss9nVJjUCLoiU/B3 X-Received: by 2002:a05:620a:1727:b0:790:8656:8427 with SMTP id af79cd13be357-792bbdc4de6mr2148464785a.7.1715586706658; Mon, 13 May 2024 00:51:46 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715586706; cv=pass; d=google.com; s=arc-20160816; b=vynJ2Bbc2hd/tRYwt1sLUXlrx2262NiahzD10H9PhtMfYS3+8q+EyimQuXz6YNZNfr wKI1wkD7vaX8tB9gNUDSwkp2iMKSxYzoBV93Sq6D9tYc0EQDDNBSC6k6P600mssI40Hm vycOorbBGH2C/d7dJ2lti6e0SV724amY6o09YbFBaR1eyeo4mLJ6AdxzMuDxrLhlcoU4 QaFQW4ng9EpWS+bYwvRDzyjxgWsThLlrCwPazb1LDAsuFLlaWh5a1tDRdiyVDWlkL6Bp mtTtl7ujE7Xa4bCjCtvidgDobyvi8ZMYrHHSZuli5T+LB2sAiE1TRCKiIuOkZFZLClPM S45A== 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=8ekcmEL5zAT+zabbD54FzC7zp1oJyO+vw4lBdUWZ0ug=; fh=VAOzQyCZUIkIVRfkT59kO+F4O4ceAQVh6KAZCdsXYJ4=; b=vn3bWeKkABcwQSTMVh/2ali+zVlpcsRFaq8jitHhWtzFG1erRj6x9fm/pEfS/uMIna liwcbl5ClkQnRAiodeJasBT7QbQvqwTcwx4U6uFAmo3un1wGNk5WuSrNO2rKocIk2TP9 q1y/hya7uvnjHZtPdCX28kGN3YuuBqePaJFr+1OjFRtLADhr+5A47xrPYkeBcEzEczfW Sm51bQYl5N2IUek5Xe4x/OMkA2h7YmCZMnSnWNOCezQFfeoTHhCjgKF+UST9NG+pt1ep HHj8O5OvU5RfR9Ts6POJhhfgLa7bs2CZJk/KtVMnzb3nzubCZzZn18aFjIn7NVP1/DPq mwFg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=iKx90MCa; 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-177293-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-177293-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 af79cd13be357-792bf38d4b2si985129585a.728.2024.05.13.00.51.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 May 2024 00:51:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-177293-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=iKx90MCa; 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-177293-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-177293-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 54F251C20F13 for ; Mon, 13 May 2024 07:51:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 95F36148300; Mon, 13 May 2024 07:50:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="iKx90MCa" Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) (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 95910147C72 for ; Mon, 13 May 2024 07:50:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.200 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715586647; cv=none; b=tm9zP+FYWWAFhWAOZeQnAVWhtVpCucxweRWH1wcWhqA4nYutPuCMUQbuPTPlOEFWMXORPJKCCxMVwsidGnDM8NscMbSYx+bzyHgthrEuMZquZqodojAEkBpOpHX4oFNseVGXXpfrs0JxX04xgex9cK0f4zNHWDPVVWJmI0rwzoE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715586647; c=relaxed/simple; bh=9BLSrbAtgkfvZRODYypdS+g+ySxYPqG+gOpDg0n8XJc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=sC0ONmZmBsmVvPajrdFC9AfJq9LQ5OTUrzCIToQBGyxE9e+Jpic4fyijeynfUs3KQYvidAmT1OPkqQNipOO5NtNcZsNVZIVhQfUjxYV1qMIgZ0YlPw4iKQ7L5vhQWhCWGPDYxvgPeC+ddHV4J/I1k2UDYhWvSTTIhBYlIfCDmeY= 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=iKx90MCa; arc=none smtp.client-ip=217.70.183.200 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 33DF820014; Mon, 13 May 2024 07:50:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1715586644; 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=8ekcmEL5zAT+zabbD54FzC7zp1oJyO+vw4lBdUWZ0ug=; b=iKx90MCa0FgLGWonvymDdDOAPeLF+QFlicG7iSascrHXTFj5g6p/Rcvah5U/dCtObLjroa cxP2VHut7B7MA8q4RmNWM2zp4DKJQ7LgM1sUdD8Uzdsyz81EqEosHeG3DgEvdHotBJuahl x2rbBhfYJUI5v/zpM9dQSktD1FoyOlZlm+X0+Tc7M2OkPM0euWRzWZaGVITK/oEDIvvLiF Lo+2GPebwKzswIwN5i6eJe+9sI2oPs5M7TlrqOM/1Y9j5xKTshTGCRIrj8NnJRtHHEzsXQ CwWxj/kngGYmKDjOnRiO+8Yv/jZd0EXnRfiFg/RecAdkJt11EDtpS3Lc5ZKBTA== From: Louis Chauvet Date: Mon, 13 May 2024 09:50:27 +0200 Subject: [PATCH v7 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: <20240513-yuv-v7-6-380e9ffec502@bootlin.com> References: <20240513-yuv-v7-0-380e9ffec502@bootlin.com> In-Reply-To: <20240513-yuv-v7-0-380e9ffec502@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=9BLSrbAtgkfvZRODYypdS+g+ySxYPqG+gOpDg0n8XJc=; b=owEBbQKS/ZANAwAIASCtLsZbECziAcsmYgBmQcZCSlN3cZ/ag2POjkVQYa/qhkTk1x/DATghj vHnxwrM5jKJAjMEAAEIAB0WIQRPj7g/vng8MQxQWQQgrS7GWxAs4gUCZkHGQgAKCRAgrS7GWxAs 4nb/D/9uHnrIIv4vcLxIZooasNd9JE98IyFOpvpoqSsMXeqwL5aL9g1kxrbQ4T2k3z4uSKCU5li ySjeRsqIqceC5Q1AmcV+FRzUh+W+l87tjdjdHTCiKcpmUPSOQWKhOnVbPiN9nfNc7ChjcQIyFPh e791KRoc1yxD60ZOK0/Xcn9CP/BxeybfKQwaBJzRjl3LWdkaCwBeQoVg61LqJ7oe1DX9GZrF5qt Zi53oAYsnQyyFpl6w3qA8P8eXggXAcapIxCJ1MT5AgVEQSK0nAVn6ljQpjlosMoAqGKqLk+2Izk H9ITb2ZhfV8iCevqU07TLHwkOiUF/M7JKyzOwz8noeH1czeWYE109x1BEls5OR8a4NSL7v2vJ/0 BVCCFPyOsm6be1vEegJICFypsACwm7WcAAo2WCGSl0XLe+kJQH9be8LNBDazukZLB3Jb+bJCTzH gc8ByoD2mcmmqos8vujByb7lZc2GoQbuffUrPnRSX86pdQJYzHIS13f/UUBtxsyaDcCDI8BLXHB Bj2WZJYb8Bf3WbGOLIBR6RyD4a8uzHM2c6c4qQY7D7jN6tlHu5ZqFKH0xf0rtM7TyxDISF0+atx NLG3KArcreu3IJEKI4gT7+SC6f0ETo5qgOtrVYsxMtA29CYXoC3u4/yUDiP1VbLMSZVG+UQQpMN VgATpSBf+FhkpwQ== 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 b1542b83b090..17081effe99a 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.2