Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp1919163lql; Wed, 13 Mar 2024 11:50:14 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUI1CtQderhQvDR8jZeGtP01HyVDgyPqu+6wWUI2birb/XnLdl+iV2Sgrf+dS1vSQxLnyEm21hcpYMG3qEMV2a1EnQp8/bzF5xm0JnS+w== X-Google-Smtp-Source: AGHT+IH73DYFtZxkhE99LsuPm0RVxfBCCaC5AaI4l/4GqVf3+FFxe5ltbaVfVJYhSxy7a++hwryV X-Received: by 2002:a17:907:d301:b0:a46:64f2:c660 with SMTP id vg1-20020a170907d30100b00a4664f2c660mr1039008ejc.58.1710355814132; Wed, 13 Mar 2024 11:50:14 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710355814; cv=pass; d=google.com; s=arc-20160816; b=hHs91KjK5YxFmvVB0pLgGKsh7LUxw0kQfiwMjCg0VDcuh8FE/8jvvMdIzR6d7fAJPs bO18+jWR51ov2CVMgFBfo+d2MIDJIXH96qSKWmLBfS+CFiGSqfljUk5wNbCvia2nuZWB 1EvoV/Jh4AXcw2o6TVc/eBsldN4jK8P9d9IXERluGLEWRMbcL9cIvXMA4Vx3U4C0cKSl G31X6WegACqqkqSSKQrmhOc57hELhN6NbtpW4iI9CodXmm8+QOaUg06eZZU6HGOwOKfZ x5h5aJv+rFGb6ZUUzOlqX17ufLWVp7A/NgLP/+/c4Exvj8p3MysAcg55gcgNg5vrHmZL +8iQ== 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=J5eNM0DhAMIgKT/kkCgWrA9s8H4fNzBpCgQ7okrYfr0=; fh=I1mDzpQ2i/fckVIeMd+WKWb14s85mMQWc3/wF4wbFPI=; b=Gjk49lBAygFgpFfLiRHQve8/XjhQma6aQYbF0fJE876ZWpLAy2NaX5ngr9vW/toaVh 2aL/RsqIg/lZYuP3lRPekgftLBBYw1oken3FemDaT7SWQ8bqCaTXPbD9lqpf2e+R1zIg yb0wfaDHMjmaKbOcdSSI6t/FbqOuS4OFiTnJCHnuZVO1QDBbIoErCgM6ZBRo+VIax8HD G4QlId1tGuin6IVMux0tzpBmgKp8aqgU02mgAyoQi3Lma/KoWbxH1/NumAws1spWEqss VIml1+UJfKS499fZa86zzC3D7swgqKmAvGx3f5RW69zxxI+r/P8XVFJEjCe6ZL+qj9SB EYCA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=FW86Axai; 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-102304-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-102304-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id hg25-20020a170906f35900b00a465fd6b411si645100ejb.925.2024.03.13.11.50.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Mar 2024 11:50:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-102304-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=FW86Axai; 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-102304-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-102304-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 am.mirrors.kernel.org (Postfix) with ESMTPS id A70121F2E8CE for ; Wed, 13 Mar 2024 18:50:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 98A951350E3; Wed, 13 Mar 2024 17:45:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="FW86Axai" 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 5A77A66B57 for ; Wed, 13 Mar 2024 17:45:40 +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=1710351942; cv=none; b=G8J+ZvWUQAfGU5pszZ03HpMIxTsuDE/d00GGfD8xo7i3XOMpBH193OgEXE1QwDPccxoqbOfI0MMhM0S2k9GIcZXHKD+rXTRHKkRNHOzYuITojiMnzqt5jmReUG3nNR4ppG5rmPAGMYNh/5noJHOeIhMMXH0hzJaj4fxIYW9fnQM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710351942; c=relaxed/simple; bh=CsX4Bl/EEHcmw+Z+z88jdKEOU/WdC0wYmGUUTNJHiO0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ogiChCuAt20wfwfBSjVpocyCUZOtQesZfjtEYQrD3aemDqgj5rAaQ+tqDLj9Z24lJdWz/IUewVnJZHPDQ9DGy6WmdRofggJBMVW5zc5wZMPo/mMWVUhLd+JfJlUUg3bt+39SivE/q3F16LhQoDePuVLF6r9coOsM4VjUVdRiD0s= 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=FW86Axai; 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 Received: by mail.gandi.net (Postfix) with ESMTPSA id 91CA14000F; Wed, 13 Mar 2024 17:45:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1710351933; 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=J5eNM0DhAMIgKT/kkCgWrA9s8H4fNzBpCgQ7okrYfr0=; b=FW86Axai64pv208U0YOs8bwxLfeRvCLXuYQaGc+0j4vcP5PYIi1LnxQW5mLQ/lhIUgY4ZF jZBCgpE/xUmgf/477wgcoiPYgbKmbpgp00ntlhoFZqVJaV5pqjRbjUC5PvfuCjlcUZNEOH Uqbq8S5dpWKojQeMtTAQBS2+IdbOYvEFyHQR7JZ24NiKkMEuf+Xmh1x5GDADFFL3I22HFA zOQ9mA9k6JGGSeK1j7zUORm+uZLa2Q9UcS7QUFUK7X/ipN7Py1l6dB3J1iLIB8AA1fvSY4 VsECNzRZEPGOG0mcxRgXGCztUoW9IEMRBf9AuiM4foFFnprUFRgxv97OFTNdEg== From: Louis Chauvet Date: Wed, 13 Mar 2024 18:45:00 +0100 Subject: [PATCH v5 06/16] 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: 7bit Message-Id: <20240313-yuv-v5-6-e610cbd03f52@bootlin.com> References: <20240313-yuv-v5-0-e610cbd03f52@bootlin.com> In-Reply-To: <20240313-yuv-v5-0-e610cbd03f52@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 , 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 X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=6429; i=louis.chauvet@bootlin.com; h=from:subject:message-id; bh=CsX4Bl/EEHcmw+Z+z88jdKEOU/WdC0wYmGUUTNJHiO0=; b=owEBbQKS/ZANAwAIASCtLsZbECziAcsmYgBl8eYzJmuhbk5UOvwem9mRZcBZgFRuaMALqEd0DVpz 5Z9d8nuJAjMEAAEIAB0WIQRPj7g/vng8MQxQWQQgrS7GWxAs4gUCZfHmMwAKCRAgrS7GWxAs4iUmEA CgpBgN8y/k8gzSXSZkY1+CFawep75UCzYQn52KNnsmIoh8Cxu0cvdis6uPF46OLUqtqZUlA4+DGVuw sA8KfaDlCW7ahC/ZhcpOlkegV3V4ou17c1ERlnfywGkO1mgULKuiwEnRxmBmmKsjS9iolckuKias1y fhE2kAVksA244hboNeeyAmB0EvEWNcJhLjL6f+98Rm7UdGws9jG/VsDHqjfp9GIgNUly33v5R59Cl2 steGyfvy1Wca8I7IgKhKO8GsAX6hbqmKEW7euYwi7GGK5Y3ej3LzK8FDCYwBna7pU7O/JK7IU//hmu 3Ufvcu56MYJ96Klk1HwJ8806V+G/QB+OFhKqQhYJtfpTqYZ+9f+CHB1XMB69Qh1f500AYh0/AUZycA 5v4lrJEVMQnnSUu4FtBLWsJlUwhkelqwN3i1163U3rgBG1z2d8sbfDTQKe/JipKILNIPKz1zPYXMXv 8msXGST8+O6FA3GXW6o+XH5+FNiTxronLuEzF9W8Xn1L7HGCUVbzNB6wNcPiRNbQuWy727JvhuybSH I74FWUOPpXlpDRBD0xT6VbFWwN136mpCQFW+/w3qNi9r0v0GjCWFSN2IYYrLbEamDcwn4v2GLNsdLs r41SWd+Ma8tX9hHBberB5lRWSbterkLFcl/ZPU/r5iaixtBfmUVbh7ZAp8uA== 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. 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 4bfc62d26f08..3ead8b39af4a 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); /** * 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 b57d85b8b935..b2f8dfc26c35 100644 --- a/drivers/gpu/drm/vkms/vkms_formats.c +++ b/drivers/gpu/drm/vkms/vkms_formats.c @@ -76,7 +76,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 @@ -90,7 +90,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; @@ -98,7 +98,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; @@ -108,7 +108,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; @@ -118,7 +118,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; @@ -143,7 +143,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 black_to_argb_u16(u8 *in_pixel, struct pixel_argb_u16 *out_pixel) +static void black_to_argb_u16(const u8 *in_pixel, struct pixel_argb_u16 *out_pixel) { out_pixel->a = (u16)0xFFFF; out_pixel->r = 0; @@ -189,7 +189,7 @@ void vkms_compose_row(struct line_buffer *stage_buffer, struct vkms_plane_state * They are used in the `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 @@ -207,7 +207,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); @@ -215,7 +215,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; @@ -225,7 +225,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; @@ -235,7 +235,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; @@ -260,7 +260,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