From nobody Wed Oct 8 02:17:13 2025 Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) (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 C2D72298CC0 for ; Thu, 3 Jul 2025 07:57:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751529453; cv=none; b=ZAGNHFPXco+iFGjoK2xbh2rggcRohsMyHjyfmE5aL2C7KzfU4+cMQgd4KXA07EIwe7sBgxlyxu2tGranLVxN68fyQprHGlfk3nd800OMhKqmrtLPdNiWJRU9gAgES+Tb9RLi1QOoaGoi06D/ACCjj7sE1XniLYIia6F5JEZcWI8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751529453; c=relaxed/simple; bh=fzU1hPTIkJFhW985S4PykPiWZ/4b5hWSIWUZe75Y7Iw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=OZKkn1Yokk7/WMuNFUr5XtxMBp1TOa0XkBzVJ22YhIP4gt7WEx8VXl6V1jf3ok2+IxC5YhoA9qhvwWvrJwezlzlDv1uJOq3Wk2kZkTde8G5GeZe464yVRfuCqpGlVpqGX5BUj7KelUUV3tWOTyFVjf4zz5wJwOdq7evkmVVPEuo= 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=JP5LWQbK; arc=none smtp.client-ip=217.70.183.201 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="JP5LWQbK" Received: by mail.gandi.net (Postfix) with ESMTPSA id BB94844479; Thu, 3 Jul 2025 07:57:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1751529444; 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=7h1Ypg5TBoP40Ulb9+gSJIHxVgy6r6WRfGMOnrSNVLU=; b=JP5LWQbKDuDU0CLUG1W0lYPQ2BfrzH/neenvzFKJk9BQX1jNvSDY3kwsqJPmGxx/ycnXoA l14d1+p6D4pwrhiFHIDHrzCkdiEAgYnXS399GDEl8TDLwUCZZRNgMCY7WMd+J/uStjiTZ5 sP8q6TJjztxre8B7QGvoOVLG9u1dtBmDFlg0b/mfdGgRvMrwuEsL86Awe36EEZji/x3i/s 56ejVV5aKSMT9fRL+uU/qhTO/8Eye5nvQQs4Rzu1dEngAJRjnvrgPicG6PZgIswl5t/1St V4RcnbjAIyg2y7d9aI/IgYEB0I2a7AK+CePdYq6xiSd2QSh8cRNTfZritDW/sw== From: Louis Chauvet Date: Thu, 03 Jul 2025 09:56:57 +0200 Subject: [PATCH v7 1/8] drm/vkms: Create helpers macro to avoid code duplication in format callbacks 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: <20250703-b4-new-color-formats-v7-1-15fd8fd2e15c@bootlin.com> References: <20250703-b4-new-color-formats-v7-0-15fd8fd2e15c@bootlin.com> In-Reply-To: <20250703-b4-new-color-formats-v7-0-15fd8fd2e15c@bootlin.com> To: Melissa Wen , =?utf-8?q?Ma=C3=ADra_Canal?= , Haneen Mohammed , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Rodrigo Siqueira , Simona Vetter Cc: dri-devel@lists.freedesktop.org, arthurgrillo@riseup.net, linux-kernel@vger.kernel.org, jeremie.dautheribes@bootlin.com, miquel.raynal@bootlin.com, thomas.petazzoni@bootlin.com, seanpaul@google.com, nicolejadeyee@google.com, Louis Chauvet , =?utf-8?q?Ma=C3=ADra_Canal?= X-Mailer: b4 0.15-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=8638; i=louis.chauvet@bootlin.com; h=from:subject:message-id; bh=fzU1hPTIkJFhW985S4PykPiWZ/4b5hWSIWUZe75Y7Iw=; b=owEBbQKS/ZANAwAIASCtLsZbECziAcsmYgBoZjff0DvdwSlvPFkmN0PTrF5KUhNueFsjapjvr 9sq7J694QiJAjMEAAEIAB0WIQRPj7g/vng8MQxQWQQgrS7GWxAs4gUCaGY33wAKCRAgrS7GWxAs 4pSJD/97tJlgKE7Vk8rORByNAYu5n7Od3Vh/703c1QB51vmALr9dRbcR4cTM9Rq66mVcQrFd3AS 3lE5/Edglzlr/3TXBsQHVJeF8CVlxsculkB4Uoj6FHRS4Dj0G2UvIjjgCjTRGw5PY3BWIAAXowm D8rqjBxe8hpJ+tAV3jtDPZKAlnekHL+0zMpNn/Zu1zhGDdMZ4Z9OL6LCMXfE6o3ZY9oJBVoBCFr Q8/v/Nt9QO8Di04LMqpYw3/UQu7i+07NtSziPvvmUBwPHh4bh/zJeoLfFBa6B8LZYWQTGcbkMiU XYlfK/b6rx3/K2RXS2uoHXjQ7WGwPaw7X6pzcAzrsfh1zdQXAAUvLh227sUOENSll6qnGN95Zi7 JPNa97yZ7CQ1gWBDB2+quG6WPx0IP+jdYifAsMhn7s2jWCdk7TZJm6ID+ZlIcS0YjrrR+hJQb6j ONNSqPbsgblN47PApYOC+PH8+N0czzq4N0P7LtrbTU0nkwm2Kt+Su308S7iS3Fe4PSPDaVO1lu+ pXvM0NxYlmHu3qzYw+3t6XEMMMWHDdbUp2lRGXdu8lsc9JR4nmxnBCqtSyr3j8sVEfFbubPQOcM EYTrw8I7Zq//b9fXGjUtwzKhV8bV854lPxo0JnuvBhFtyRPT2JjBXDS70MHjPp4yU7cpHmlOqEU trvf0ZQhM4sJysQ== X-Developer-Key: i=louis.chauvet@bootlin.com; a=openpgp; fpr=8B7104AE9A272D6693F527F2EC1883F55E0B40A5 X-GND-State: clean X-GND-Score: -100 X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgdduleejfecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfitefpfffkpdcuggftfghnshhusghstghrihgsvgenuceurghilhhouhhtmecufedtudenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephfffufggtgfgkfhfjgfvvefosehtkeertdertdejnecuhfhrohhmpefnohhuihhsucevhhgruhhvvghtuceolhhouhhishdrtghhrghuvhgvthessghoohhtlhhinhdrtghomheqnecuggftrfgrthhtvghrnheptdeiveeiudehtddtgfethfduudefffduteekgeevueetudevheehieevtddttdeknecukfhppeeltddrkeelrdduieefrdduvdejnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepledtrdekledrudeifedruddvjedphhgvlhhopegludelvddrudeikedrtddrvddtngdpmhgrihhlfhhrohhmpehlohhuihhsrdgthhgruhhvvghtsegsohhothhlihhnrdgtohhmpdhnsggprhgtphhtthhopedvtddprhgtphhtthhopehsihhmohhnrgesfhhffihllhdrtghhpdhrtghpthhtohephhgrmhhohhgrmhhmvggurdhsrgesghhmrghilhdrtghomhdprhgtphhtthhopehsvggrnhhprghulhesghhoohhglhgvrdgtohhmpdhrtghpthhtohepmhgvlhhishhsrgdrshhrfiesghhmrghilhdrtghomhdprhgtphhtthhopehnihgtohhlvghjrgguvgihvggvsehgohhoghhlvgdrtghomhdprhgtp hhtthhopegrihhrlhhivggusehgmhgrihhlrdgtohhmpdhrtghpthhtoheprghrthhhuhhrghhrihhllhhosehrihhsvghuphdrnhgvthdprhgtphhtthhopehthhhomhgrshdrphgvthgriiiiohhnihessghoohhtlhhinhdrtghomh X-GND-Sasl: louis.chauvet@bootlin.com The callback functions for line conversion are almost identical for some format. The generic READ_LINE macro generate all the required boilerplate to process a line. Two overrides of this macro have been added to avoid duplication of the same arguments every time. Reviewed-by: Ma=C3=ADra Canal Signed-off-by: Louis Chauvet Acked-by: Daniel Stone --- drivers/gpu/drm/vkms/vkms_formats.c | 192 ++++++++++++--------------------= ---- 1 file changed, 65 insertions(+), 127 deletions(-) diff --git a/drivers/gpu/drm/vkms/vkms_formats.c b/drivers/gpu/drm/vkms/vkm= s_formats.c index 6d0227c6635a..07b13481378b 100644 --- a/drivers/gpu/drm/vkms/vkms_formats.c +++ b/drivers/gpu/drm/vkms/vkms_formats.c @@ -292,6 +292,64 @@ VISIBLE_IF_KUNIT struct pixel_argb_u16 argb_u16_from_y= uv888(u8 y, u8 channel_1, } EXPORT_SYMBOL_IF_KUNIT(argb_u16_from_yuv888); =20 +/** + * READ_LINE() - Generic generator for a read_line function which can be u= sed for format with one + * plane and a block_h =3D=3D block_w =3D=3D 1. + * + * @function_name: Function name to generate + * @pixel_name: Temporary pixel name used in the @__VA_ARGS__ parameters + * @pixel_type: Used to specify the type you want to cast the pixel pointer + * @callback: Callback to call for each pixels. This fonction should take = @__VA_ARGS__ as parameter + * and return a pixel_argb_u16 + * __VA_ARGS__: Argument to pass inside the callback. You can use @pixel_n= ame to access current + * pixel. + */ +#define READ_LINE(function_name, pixel_name, pixel_type, callback, ...) = \ +static void function_name(const struct vkms_plane_state *plane, int x_star= t, \ + int y_start, enum pixel_read_direction direction, int count, \ + struct pixel_argb_u16 out_pixel[]) \ +{ \ + struct pixel_argb_u16 *end =3D out_pixel + count; \ + int step =3D get_block_step_bytes(plane->frame_info->fb, direction, 0); = \ + u8 *src_pixels; \ + \ + packed_pixels_addr_1x1(plane->frame_info, x_start, y_start, 0, &src_pixel= s); \ + \ + while (out_pixel < end) { \ + pixel_type *(pixel_name) =3D (pixel_type *)src_pixels; \ + *out_pixel =3D (callback)(__VA_ARGS__); \ + out_pixel +=3D 1; \ + src_pixels +=3D step; \ + } \ +} + +/** + * READ_LINE_ARGB8888() - Generic generator for ARGB8888 formats. + * The pixel type used is u8, so pixel_name[0]..pixel_name[n] are the n co= mponents of the pixel. + * + * @function_name: Function name to generate + * @pixel_name: temporary pixel to use in @a, @r, @g and @b parameters + * @a: alpha value + * @r: red value + * @g: green value + * @b: blue value + */ +#define READ_LINE_ARGB8888(function_name, pixel_name, a, r, g, b) \ + READ_LINE(function_name, pixel_name, u8, argb_u16_from_u8888, a, r, g, b) +/** + * READ_LINE_le16161616() - Generic generator for ARGB16161616 formats. + * The pixel type used is u16, so pixel_name[0]..pixel_name[n] are the n c= omponents of the pixel. + * + * @function_name: Function name to generate + * @pixel_name: temporary pixel to use in @a, @r, @g and @b parameters + * @a: alpha value + * @r: red value + * @g: green value + * @b: blue value + */ +#define READ_LINE_le16161616(function_name, pixel_name, a, r, g, b) \ + READ_LINE(function_name, pixel_name, __le16, argb_u16_from_le16161616, a,= r, g, b) + /* * The following functions are read_line function for each pixel format su= pported by VKMS. * @@ -378,138 +436,18 @@ static void R4_read_line(const struct vkms_plane_sta= te *plane, int x_start, Rx_read_line(plane, x_start, y_start, direction, count, out_pixel); } =20 -static void R8_read_line(const struct vkms_plane_state *plane, int x_start, - int y_start, enum pixel_read_direction direction, int count, - struct pixel_argb_u16 out_pixel[]) -{ - struct pixel_argb_u16 *end =3D out_pixel + count; - u8 *src_pixels; - int step =3D get_block_step_bytes(plane->frame_info->fb, direction, 0); =20 - packed_pixels_addr_1x1(plane->frame_info, x_start, y_start, 0, &src_pixel= s); +READ_LINE_ARGB8888(XRGB8888_read_line, px, 0xFF, px[2], px[1], px[0]) =20 - while (out_pixel < end) { - *out_pixel =3D argb_u16_from_gray8(*src_pixels); - src_pixels +=3D step; - out_pixel +=3D 1; - } -} +READ_LINE_ARGB8888(ARGB8888_read_line, px, px[3], px[2], px[1], px[0]) +READ_LINE_ARGB8888(ABGR8888_read_line, px, px[3], px[0], px[1], px[2]) =20 -static void ARGB8888_read_line(const struct vkms_plane_state *plane, int x= _start, int y_start, - enum pixel_read_direction direction, int count, - struct pixel_argb_u16 out_pixel[]) -{ - struct pixel_argb_u16 *end =3D out_pixel + count; - u8 *src_pixels; - - packed_pixels_addr_1x1(plane->frame_info, x_start, y_start, 0, &src_pixel= s); +READ_LINE_le16161616(ARGB16161616_read_line, px, px[3], px[2], px[1], px[0= ]) +READ_LINE_le16161616(XRGB16161616_read_line, px, cpu_to_le16(0xFFFF), px[2= ], px[1], px[0]) =20 - int step =3D get_block_step_bytes(plane->frame_info->fb, direction, 0); +READ_LINE(RGB565_read_line, px, __le16, argb_u16_from_RGB565, px) =20 - while (out_pixel < end) { - u8 *px =3D (u8 *)src_pixels; - *out_pixel =3D argb_u16_from_u8888(px[3], px[2], px[1], px[0]); - out_pixel +=3D 1; - src_pixels +=3D step; - } -} - -static void XRGB8888_read_line(const struct vkms_plane_state *plane, int x= _start, int y_start, - enum pixel_read_direction direction, int count, - struct pixel_argb_u16 out_pixel[]) -{ - struct pixel_argb_u16 *end =3D out_pixel + count; - u8 *src_pixels; - - packed_pixels_addr_1x1(plane->frame_info, x_start, y_start, 0, &src_pixel= s); - - int step =3D get_block_step_bytes(plane->frame_info->fb, direction, 0); - - while (out_pixel < end) { - u8 *px =3D (u8 *)src_pixels; - *out_pixel =3D argb_u16_from_u8888(255, px[2], px[1], px[0]); - out_pixel +=3D 1; - src_pixels +=3D step; - } -} - -static void ABGR8888_read_line(const struct vkms_plane_state *plane, int x= _start, int y_start, - enum pixel_read_direction direction, int count, - struct pixel_argb_u16 out_pixel[]) -{ - struct pixel_argb_u16 *end =3D out_pixel + count; - u8 *src_pixels; - - packed_pixels_addr_1x1(plane->frame_info, x_start, y_start, 0, &src_pixel= s); - - int step =3D get_block_step_bytes(plane->frame_info->fb, direction, 0); - - while (out_pixel < end) { - u8 *px =3D (u8 *)src_pixels; - /* Switch blue and red pixels. */ - *out_pixel =3D argb_u16_from_u8888(px[3], px[0], px[1], px[2]); - out_pixel +=3D 1; - src_pixels +=3D step; - } -} - -static void ARGB16161616_read_line(const struct vkms_plane_state *plane, i= nt x_start, - int y_start, enum pixel_read_direction direction, int count, - struct pixel_argb_u16 out_pixel[]) -{ - struct pixel_argb_u16 *end =3D out_pixel + count; - u8 *src_pixels; - - packed_pixels_addr_1x1(plane->frame_info, x_start, y_start, 0, &src_pixel= s); - - int step =3D get_block_step_bytes(plane->frame_info->fb, direction, 0); - - while (out_pixel < end) { - u16 *px =3D (u16 *)src_pixels; - *out_pixel =3D argb_u16_from_u16161616(px[3], px[2], px[1], px[0]); - out_pixel +=3D 1; - src_pixels +=3D step; - } -} - -static void XRGB16161616_read_line(const struct vkms_plane_state *plane, i= nt x_start, - int y_start, enum pixel_read_direction direction, int count, - struct pixel_argb_u16 out_pixel[]) -{ - struct pixel_argb_u16 *end =3D out_pixel + count; - u8 *src_pixels; - - packed_pixels_addr_1x1(plane->frame_info, x_start, y_start, 0, &src_pixel= s); - - int step =3D get_block_step_bytes(plane->frame_info->fb, direction, 0); - - while (out_pixel < end) { - __le16 *px =3D (__le16 *)src_pixels; - *out_pixel =3D argb_u16_from_le16161616(cpu_to_le16(0xFFFF), px[2], px[1= ], px[0]); - out_pixel +=3D 1; - src_pixels +=3D step; - } -} - -static void RGB565_read_line(const struct vkms_plane_state *plane, int x_s= tart, - int y_start, enum pixel_read_direction direction, int count, - struct pixel_argb_u16 out_pixel[]) -{ - struct pixel_argb_u16 *end =3D out_pixel + count; - u8 *src_pixels; - - packed_pixels_addr_1x1(plane->frame_info, x_start, y_start, 0, &src_pixel= s); - - int step =3D get_block_step_bytes(plane->frame_info->fb, direction, 0); - - while (out_pixel < end) { - __le16 *px =3D (__le16 *)src_pixels; - - *out_pixel =3D argb_u16_from_RGB565(px); - out_pixel +=3D 1; - src_pixels +=3D step; - } -} +READ_LINE(R8_read_line, px, u8, argb_u16_from_gray8, *px) =20 /* * This callback can be used for YUV formats where U and V values are --=20 2.49.0 From nobody Wed Oct 8 02:17:13 2025 Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) (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 728A2299A85 for ; Thu, 3 Jul 2025 07:57:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751529454; cv=none; b=G7fEu7l9JDETcIMOZ8l5BQYi8RMqhH3/Mx9M/q24OD/qKVD90NgsRePeLq+5uTdRRHBaRTNTtc47U+qQwNLAnnJneHT+gzPFHjeftAlYqU9Gfkr7oNtCcR5QyyhZcnh0ldjbvm40KYXGrgjmQL7qlSUGr914sQQUTKUKwEV68Yw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751529454; c=relaxed/simple; bh=42H3WCbIUPVqNcXYaCmH0LfI1AJz/I3qKmRbMLEC9CA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=lTMnpPWNKiBcImdAqCWve1nwN6n+D8uxdHmF4GvShm7FO4Cye8RK+mm8kMnJ1d0mAwyVHCQrv8LZxLaGkzXy2AeCWeH/3paopfpDgIJKl3ttTJ/QgbK2U2Hbp7f0rAVMzav2YmfTy77babB7K0+oDNPGFbnwvdMTPfIZyUogS+s= 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=iGUyfV/n; arc=none smtp.client-ip=217.70.183.201 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="iGUyfV/n" Received: by mail.gandi.net (Postfix) with ESMTPSA id BB4EC44470; Thu, 3 Jul 2025 07:57:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1751529445; 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=YC72D6jmas7HbuDoo2dtheGUQpMnyB3xcANLswY5f98=; b=iGUyfV/nsUxta62JtWshRLK5RdZz58lkBAhpMNU/bCAgPg4Zu+DOrxLCxBCARBmN+jDKzk SKs++PckSIkuHqWMtgxc+Uq9oqWynip6KsUoEUuA9/9fi39VUou6ZCllQTKZBoVOB/h7Yb 3hsiD1sN8jD8frsk+Xjr1N1QRn/MEiXSHWDNq0aHU978IXmHWGtODFBnoYfVIxR/U1H4ks j47Dh6c/RymEIDS+pe+WFLa5soZOScMok6/r3am7lXB5BTghXkX9q2pWqFPzQZNmgR6UaF ctXuXDp7AIih2/b7R9OFjy/yk+SI0aYAZMPPqK/guevRR19+HGXojvJAUbViHQ== From: Louis Chauvet Date: Thu, 03 Jul 2025 09:56:58 +0200 Subject: [PATCH v7 2/8] drm/vkms: Add support for ARGB8888 formats 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: <20250703-b4-new-color-formats-v7-2-15fd8fd2e15c@bootlin.com> References: <20250703-b4-new-color-formats-v7-0-15fd8fd2e15c@bootlin.com> In-Reply-To: <20250703-b4-new-color-formats-v7-0-15fd8fd2e15c@bootlin.com> To: Melissa Wen , =?utf-8?q?Ma=C3=ADra_Canal?= , Haneen Mohammed , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Rodrigo Siqueira , Simona Vetter Cc: dri-devel@lists.freedesktop.org, arthurgrillo@riseup.net, linux-kernel@vger.kernel.org, jeremie.dautheribes@bootlin.com, miquel.raynal@bootlin.com, thomas.petazzoni@bootlin.com, seanpaul@google.com, nicolejadeyee@google.com, Louis Chauvet , =?utf-8?q?Ma=C3=ADra_Canal?= X-Mailer: b4 0.15-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=2495; i=louis.chauvet@bootlin.com; h=from:subject:message-id; bh=42H3WCbIUPVqNcXYaCmH0LfI1AJz/I3qKmRbMLEC9CA=; b=owEBbQKS/ZANAwAIASCtLsZbECziAcsmYgBoZjffekWgOst9vJqF478qmegCye2fa0yJNJ11B 62v0/j4vHSJAjMEAAEIAB0WIQRPj7g/vng8MQxQWQQgrS7GWxAs4gUCaGY33wAKCRAgrS7GWxAs 4km+D/9kcHtS52jaPCalLxl8GAEp1aNMOLHyDLC98nbWHBe9LOqFtYNse74fprDT9dAn2KDA2hG 42iWMBxqPPHv2FM0THPhQ/AuZWVe5XOTiHTd7hoEyS9Hh0xhkka5jzvcr0TdyepGzrAkHoLwQq3 k2kdbieLPfcpfWOsGkaQpDkP++bZJcYijx7DApuTyxgHItKmXV9wHfFDNd4vMwf4L5l1lKxS6vq Mb1+g85ELUropPHCffuN2LyO721ua4dzh6vUes84T1cahLdoxFhK8ynIipcnig4lTYHqHAgdHgh nrKridfN53duIcGkQK4LsG71lQuNNy2Rrve0nlbkkDnNa8/GhWQdU0lVqIb6Oq15hZ3HEkLG+cY PvhEI4FnPbBFua+MRxwBG8xyeHx/5JkdXU45nt8pSNJfjUP+lyem5IbA4NT4BbOzHgefQWzv9rZ ck6mS68clMhXcoZG4OX8ZelEeEmJxRZneT5XRs4MXe1SeZO78EB+33/+zYLeLQRgYL9seDWVBFI 1ylcnZ8yYbZRZalJVhRMKf8mHF/2GWp2vf+7vVpnDFYRtKYPZnlmAb1JrAWiC0eR8yYgH4Nurog IqhAVlDIY4BsxWQR9ok8owMtYMVN6rnLC8IWcpkORfXtWqXPHHuS3CL6rhc+N28FDMw052Pn41s GygNH0yvtj4MCKA== X-Developer-Key: i=louis.chauvet@bootlin.com; a=openpgp; fpr=8B7104AE9A272D6693F527F2EC1883F55E0B40A5 X-GND-State: clean X-GND-Score: -100 X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgdduleejfecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfitefpfffkpdcuggftfghnshhusghstghrihgsvgenuceurghilhhouhhtmecufedtudenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephfffufggtgfgkfhfjgfvvefosehtkeertdertdejnecuhfhrohhmpefnohhuihhsucevhhgruhhvvghtuceolhhouhhishdrtghhrghuvhgvthessghoohhtlhhinhdrtghomheqnecuggftrfgrthhtvghrnheptdeiveeiudehtddtgfethfduudefffduteekgeevueetudevheehieevtddttdeknecukfhppeeltddrkeelrdduieefrdduvdejnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepledtrdekledrudeifedruddvjedphhgvlhhopegludelvddrudeikedrtddrvddtngdpmhgrihhlfhhrohhmpehlohhuihhsrdgthhgruhhvvghtsegsohhothhlihhnrdgtohhmpdhnsggprhgtphhtthhopedvtddprhgtphhtthhopehsihhmohhnrgesfhhffihllhdrtghhpdhrtghpthhtohephhgrmhhohhgrmhhmvggurdhsrgesghhmrghilhdrtghomhdprhgtphhtthhopehsvggrnhhprghulhesghhoohhglhgvrdgtohhmpdhrtghpthhtohepmhgvlhhishhsrgdrshhrfiesghhmrghilhdrtghomhdprhgtphhtthhopehnihgtohhlvghjrgguvgihvggvsehgohhoghhlvgdrtghomhdprhgtp hhtthhopegrihhrlhhivggusehgmhgrihhlrdgtohhmpdhrtghpthhtoheprghrthhhuhhrghhrihhllhhosehrihhsvghuphdrnhgvthdprhgtphhtthhopehthhhomhgrshdrphgvthgriiiiohhnihessghoohhtlhhinhdrtghomh X-GND-Sasl: louis.chauvet@bootlin.com The formats XRGB8888 and ARGB8888 were already supported. Add the support for: - XBGR8888 - ABGR8888 - RGBA8888 - BGRA8888 Reviewed-by: Ma=C3=ADra Canal Signed-off-by: Louis Chauvet Acked-by: Daniel Stone --- drivers/gpu/drm/vkms/vkms_formats.c | 13 +++++++++++-- drivers/gpu/drm/vkms/vkms_plane.c | 5 ++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/vkms/vkms_formats.c b/drivers/gpu/drm/vkms/vkm= s_formats.c index 07b13481378b..b11cb2955943 100644 --- a/drivers/gpu/drm/vkms/vkms_formats.c +++ b/drivers/gpu/drm/vkms/vkms_formats.c @@ -438,9 +438,12 @@ static void R4_read_line(const struct vkms_plane_state= *plane, int x_start, =20 =20 READ_LINE_ARGB8888(XRGB8888_read_line, px, 0xFF, px[2], px[1], px[0]) +READ_LINE_ARGB8888(XBGR8888_read_line, px, 0xFF, px[0], px[1], px[2]) =20 READ_LINE_ARGB8888(ARGB8888_read_line, px, px[3], px[2], px[1], px[0]) READ_LINE_ARGB8888(ABGR8888_read_line, px, px[3], px[0], px[1], px[2]) +READ_LINE_ARGB8888(RGBA8888_read_line, px, px[0], px[3], px[2], px[1]) +READ_LINE_ARGB8888(BGRA8888_read_line, px, px[0], px[1], px[2], px[3]) =20 READ_LINE_le16161616(ARGB16161616_read_line, px, px[3], px[2], px[1], px[0= ]) READ_LINE_le16161616(XRGB16161616_read_line, px, cpu_to_le16(0xFFFF), px[2= ], px[1], px[0]) @@ -650,10 +653,16 @@ pixel_read_line_t get_pixel_read_line_function(u32 fo= rmat) switch (format) { case DRM_FORMAT_ARGB8888: return &ARGB8888_read_line; - case DRM_FORMAT_XRGB8888: - return &XRGB8888_read_line; case DRM_FORMAT_ABGR8888: return &ABGR8888_read_line; + case DRM_FORMAT_BGRA8888: + return &BGRA8888_read_line; + case DRM_FORMAT_RGBA8888: + return &RGBA8888_read_line; + case DRM_FORMAT_XRGB8888: + return &XRGB8888_read_line; + case DRM_FORMAT_XBGR8888: + return &XBGR8888_read_line; case DRM_FORMAT_ARGB16161616: return &ARGB16161616_read_line; case DRM_FORMAT_XRGB16161616: diff --git a/drivers/gpu/drm/vkms/vkms_plane.c b/drivers/gpu/drm/vkms/vkms_= plane.c index e3fdd161d0f0..01fed722808b 100644 --- a/drivers/gpu/drm/vkms/vkms_plane.c +++ b/drivers/gpu/drm/vkms/vkms_plane.c @@ -14,8 +14,11 @@ =20 static const u32 vkms_formats[] =3D { DRM_FORMAT_ARGB8888, - DRM_FORMAT_XRGB8888, DRM_FORMAT_ABGR8888, + DRM_FORMAT_BGRA8888, + DRM_FORMAT_RGBA8888, + DRM_FORMAT_XRGB8888, + DRM_FORMAT_XBGR8888, DRM_FORMAT_XRGB16161616, DRM_FORMAT_ARGB16161616, DRM_FORMAT_RGB565, --=20 2.49.0 From nobody Wed Oct 8 02:17:13 2025 Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) (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 85EC729DB97 for ; Thu, 3 Jul 2025 07:57:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751529455; cv=none; b=fug5F8tc50sckYPyIGhGj0ycniQnQGsv2ZPzNHv4lV+eG0mWsYLZ/c6NVnaVP47wiQU8J4AFn+rzx7KVvSwipf8FlYzZGmmM0gAybcf1yUSASjfwX/xcQFI96tzl1CA6vhR2zwBYC2lLvSadhYOap/2VX6CUuVK+ro05tmusoN0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751529455; c=relaxed/simple; bh=xOVnO/wAOs+8umQBv0fayAWJqQEdaAZdMdK0z7q3Ktc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Gl9NQDACS8CAmdfEfDBGgtsmT63H27a598l32/N6/znIaSeW6j6A7YEO1sNYc9bl6/g0nvG6S1WY0XBmGHCDl01pi1OyrZVcg8WvuXKlS7aY050uCTsOYLLE5vl4rtb0JeD/l2LH9nDhbISWzDCiAxO7kMvsh8kbe1N/7fzKVCE= 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=DPgnWdwd; arc=none smtp.client-ip=217.70.183.201 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="DPgnWdwd" Received: by mail.gandi.net (Postfix) with ESMTPSA id B514844472; Thu, 3 Jul 2025 07:57:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1751529446; 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=XkknVkIauESu+gH93JJT1wc5lLVY2IyRlDbzwQ7xmdg=; b=DPgnWdwdOZ0HyO9eGA/mTXXEiiEUBVKuil3d1KCauVCVf5FUm+vN60DJ5uDr+VgCTkP6JM gEMpVv5s9H91QFRSFUG5kT4BsxmEEMY5XwAnplkne04Vin74q++RtVWK6BnqprZAlp8iA1 ObHkTQTDo6pHu6P9+laCwQoZ1qHSVNOujv9awnPLT8+ptcbfz2FaVpfGrkNTAzDAseUwnc QMi/07FtPkUMzcAhMyAmtCtEwHv3gyQu4G3dxQnVCYLpm3aI6KhPlqXdzJ1oGyWc1jhy0W iN/ZndlmjuYs0rMqpptuf/sSOKhqwhfXWWmDpuglS2L4RI3mv/JQIT/pA+EcmA== From: Louis Chauvet Date: Thu, 03 Jul 2025 09:56:59 +0200 Subject: [PATCH v7 3/8] drm/vkms: Add support for ARGB16161616 formats 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: <20250703-b4-new-color-formats-v7-3-15fd8fd2e15c@bootlin.com> References: <20250703-b4-new-color-formats-v7-0-15fd8fd2e15c@bootlin.com> In-Reply-To: <20250703-b4-new-color-formats-v7-0-15fd8fd2e15c@bootlin.com> To: Melissa Wen , =?utf-8?q?Ma=C3=ADra_Canal?= , Haneen Mohammed , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Rodrigo Siqueira , Simona Vetter Cc: dri-devel@lists.freedesktop.org, arthurgrillo@riseup.net, linux-kernel@vger.kernel.org, jeremie.dautheribes@bootlin.com, miquel.raynal@bootlin.com, thomas.petazzoni@bootlin.com, seanpaul@google.com, nicolejadeyee@google.com, Louis Chauvet , =?utf-8?q?Ma=C3=ADra_Canal?= X-Mailer: b4 0.15-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=2135; i=louis.chauvet@bootlin.com; h=from:subject:message-id; bh=xOVnO/wAOs+8umQBv0fayAWJqQEdaAZdMdK0z7q3Ktc=; b=owEBbQKS/ZANAwAIASCtLsZbECziAcsmYgBoZjfgs94OKW8UYlG/V9pLtEtsdr8/nx9P2fcYt RObsscnUFGJAjMEAAEIAB0WIQRPj7g/vng8MQxQWQQgrS7GWxAs4gUCaGY34AAKCRAgrS7GWxAs 4tiSEACOIRx2S8voG58iBJWoULZHfZornS4FZPdVBWZb61mHFZxLgqRyEr2C7jLJ/0DIBUPuTRC ovBzVHIoARLY82Nx2Cw0ub3/yota5ll1dD9LvpIH5lhloK8xTOQ8YeuWe3Cj0wZO81OSmuQPLvl 2kU/VSvzhOdsx9tC2zauLfmlzZ78U/36DdSsfH4b9Ympjk8pCYCxwTQDU44SiblGydS+GxL3DXk o2D5c+3gXC2MKYRHcyGJNAF/p85WpyBnFr2JO1IBCEY96FOiliGUJVUFDhtuPn1JYN/THbdQbqh 4MycbzWFgrZfU525H6Mr/7lewL+waHi6ir6qREaP7uWpz3mzmTMV18wKCgye66OO/ECCt4aGmh7 Lxn5IIw0XQFUYo5vs7MxL6jbJ5fgSbPhLcgafaBiPS45X0nA49cMH0LQuWFb9Ecg7LwBPsNOzVO a3iLjgsk2NuX19PknugdRNnFOID3cINDMYfai5Ajk4YXpFzQV2MgqTglBlDLBw9qaPa44LlFk1Z Lu8Kw5rhYg8ir1eTv8WwVSLc32FawxdKpe7/ON71m9FWQbsHXeexIkvLxCYv2MVXs+ufVzPFAsv P2hoz90+Oc2Wura6cb7PgjpGnZQ75WMHof98itwRWl1xWZ8uRLoOxdoVg/3ILH/+rC3CeBsa3x+ Yw27h6Yw+va8kFA== X-Developer-Key: i=louis.chauvet@bootlin.com; a=openpgp; fpr=8B7104AE9A272D6693F527F2EC1883F55E0B40A5 X-GND-State: clean X-GND-Score: -100 X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgdduleejfecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfitefpfffkpdcuggftfghnshhusghstghrihgsvgenuceurghilhhouhhtmecufedtudenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephfffufggtgfgkfhfjgfvvefosehtkeertdertdejnecuhfhrohhmpefnohhuihhsucevhhgruhhvvghtuceolhhouhhishdrtghhrghuvhgvthessghoohhtlhhinhdrtghomheqnecuggftrfgrthhtvghrnheptdeiveeiudehtddtgfethfduudefffduteekgeevueetudevheehieevtddttdeknecukfhppeeltddrkeelrdduieefrdduvdejnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepledtrdekledrudeifedruddvjedphhgvlhhopegludelvddrudeikedrtddrvddtngdpmhgrihhlfhhrohhmpehlohhuihhsrdgthhgruhhvvghtsegsohhothhlihhnrdgtohhmpdhnsggprhgtphhtthhopedvtddprhgtphhtthhopehsihhmohhnrgesfhhffihllhdrtghhpdhrtghpthhtohephhgrmhhohhgrmhhmvggurdhsrgesghhmrghilhdrtghomhdprhgtphhtthhopehsvggrnhhprghulhesghhoohhglhgvrdgtohhmpdhrtghpthhtohepmhgvlhhishhsrgdrshhrfiesghhmrghilhdrtghomhdprhgtphhtthhopehnihgtohhlvghjrgguvgihvggvsehgohhoghhlvgdrtghomhdprhgtp hhtthhopegrihhrlhhivggusehgmhgrihhlrdgtohhmpdhrtghpthhtoheprghrthhhuhhrghhrihhllhhosehrihhsvghuphdrnhgvthdprhgtphhtthhopehthhhomhgrshdrphgvthgriiiiohhnihessghoohhtlhhinhdrtghomh X-GND-Sasl: louis.chauvet@bootlin.com The formats XRGB16161616 and ARGB16161616 were already supported. Add the support for: - ABGR16161616 - XBGR16161616 Reviewed-by: Ma=C3=ADra Canal Signed-off-by: Louis Chauvet Acked-by: Daniel Stone --- drivers/gpu/drm/vkms/vkms_formats.c | 6 ++++++ drivers/gpu/drm/vkms/vkms_plane.c | 2 ++ 2 files changed, 8 insertions(+) diff --git a/drivers/gpu/drm/vkms/vkms_formats.c b/drivers/gpu/drm/vkms/vkm= s_formats.c index b11cb2955943..c37d1aae6eac 100644 --- a/drivers/gpu/drm/vkms/vkms_formats.c +++ b/drivers/gpu/drm/vkms/vkms_formats.c @@ -446,7 +446,9 @@ READ_LINE_ARGB8888(RGBA8888_read_line, px, px[0], px[3]= , px[2], px[1]) READ_LINE_ARGB8888(BGRA8888_read_line, px, px[0], px[1], px[2], px[3]) =20 READ_LINE_le16161616(ARGB16161616_read_line, px, px[3], px[2], px[1], px[0= ]) +READ_LINE_le16161616(ABGR16161616_read_line, px, px[3], px[0], px[1], px[2= ]) READ_LINE_le16161616(XRGB16161616_read_line, px, cpu_to_le16(0xFFFF), px[2= ], px[1], px[0]) +READ_LINE_le16161616(XBGR16161616_read_line, px, cpu_to_le16(0xFFFF), px[0= ], px[1], px[2]) =20 READ_LINE(RGB565_read_line, px, __le16, argb_u16_from_RGB565, px) =20 @@ -665,8 +667,12 @@ pixel_read_line_t get_pixel_read_line_function(u32 for= mat) return &XBGR8888_read_line; case DRM_FORMAT_ARGB16161616: return &ARGB16161616_read_line; + case DRM_FORMAT_ABGR16161616: + return &ABGR16161616_read_line; case DRM_FORMAT_XRGB16161616: return &XRGB16161616_read_line; + case DRM_FORMAT_XBGR16161616: + return &XBGR16161616_read_line; case DRM_FORMAT_RGB565: return &RGB565_read_line; case DRM_FORMAT_NV12: diff --git a/drivers/gpu/drm/vkms/vkms_plane.c b/drivers/gpu/drm/vkms/vkms_= plane.c index 01fed722808b..d4c51b4486f7 100644 --- a/drivers/gpu/drm/vkms/vkms_plane.c +++ b/drivers/gpu/drm/vkms/vkms_plane.c @@ -20,7 +20,9 @@ static const u32 vkms_formats[] =3D { DRM_FORMAT_XRGB8888, DRM_FORMAT_XBGR8888, DRM_FORMAT_XRGB16161616, + DRM_FORMAT_XBGR16161616, DRM_FORMAT_ARGB16161616, + DRM_FORMAT_ABGR16161616, DRM_FORMAT_RGB565, DRM_FORMAT_NV12, DRM_FORMAT_NV16, --=20 2.49.0 From nobody Wed Oct 8 02:17:13 2025 Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) (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 789382BD005 for ; Thu, 3 Jul 2025 07:57:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751529457; cv=none; b=uONylwiUOUDuN7mZzoxAHtKsoy1EeGHyZT6S5JmQFuC6ZpVMqXLPseXJ9aCAwsSRiZyBflY7C7LBPmU+zALNR8QaQYDRCGAMRSEK8ihPOSDpwnDDn6TAwOGAUzUI8r7Tc9nISaqdKRnCymeyhvztP8YvJ84i19j+Ct561y44naw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751529457; c=relaxed/simple; bh=y3S+U+2h2DJbwzQKp5+x7Wemr7UdoP66AqsKzkGXz9M=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=VtgwzDW1lQnkdJZiWw+u9YFS6k/wXPqV1qSCtsI15YNIok11/+tFtgjNiDHDa0LYbq5en6+W5eu+pOghtHCAB4PYPdtFNx1yH6ng8xn98xpfR0oC3DbJHYX24IN6fZT9lnZrpyloVKcTVYkSdFPGMC5AD/CW2hgNeDtrcmXLOGk= 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=BafqzH8a; arc=none smtp.client-ip=217.70.183.201 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="BafqzH8a" Received: by mail.gandi.net (Postfix) with ESMTPSA id AFAF444476; Thu, 3 Jul 2025 07:57:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1751529447; 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=gbui+zYgLvZpZpjNwyeYSZBvW/EWcwkD+YwOnsrwh88=; b=BafqzH8aNQ0DZbQyvd64Uc8HkX/W8cQI19Aqm1iwDisNwX55yiary9cFmpbVNgWGgBQ6JL 1P81EpnEKIKWh1DNVTHyTt/UZ89JjOyK5SK6U7EtIU9Qy+PjnyJyqaP/ZjrUk8mW9zIt8o hZf7KLtih6YeZKRix1dy2CV09lRWITrNbK2QxEfzxqZ7Qy7HYtwr86FXk2kIZUDabctPP2 Btvxfy/MCg6BVJoBpXQoWIKZwUL2H8lE3A2dOfz1IbWzSgc9L3Seyi6bPzv4sOI8sOqkYq z5/zzgcMgPdYH+m8uoJQczudv+2J5ny58wEacTZ9dLmuo7dRk+wYaF/OrMbcvw== From: Louis Chauvet Date: Thu, 03 Jul 2025 09:57:00 +0200 Subject: [PATCH v7 4/8] drm/vkms: Add support for RGB565 formats 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: <20250703-b4-new-color-formats-v7-4-15fd8fd2e15c@bootlin.com> References: <20250703-b4-new-color-formats-v7-0-15fd8fd2e15c@bootlin.com> In-Reply-To: <20250703-b4-new-color-formats-v7-0-15fd8fd2e15c@bootlin.com> To: Melissa Wen , =?utf-8?q?Ma=C3=ADra_Canal?= , Haneen Mohammed , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Rodrigo Siqueira , Simona Vetter Cc: dri-devel@lists.freedesktop.org, arthurgrillo@riseup.net, linux-kernel@vger.kernel.org, jeremie.dautheribes@bootlin.com, miquel.raynal@bootlin.com, thomas.petazzoni@bootlin.com, seanpaul@google.com, nicolejadeyee@google.com, Louis Chauvet , =?utf-8?q?Ma=C3=ADra_Canal?= X-Mailer: b4 0.15-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=2212; i=louis.chauvet@bootlin.com; h=from:subject:message-id; bh=y3S+U+2h2DJbwzQKp5+x7Wemr7UdoP66AqsKzkGXz9M=; b=owEBbQKS/ZANAwAIASCtLsZbECziAcsmYgBoZjfgSi/ZxuCgSAMffo7hkKw1IMo3O1sHetqj5 uIWd2ePfI2JAjMEAAEIAB0WIQRPj7g/vng8MQxQWQQgrS7GWxAs4gUCaGY34AAKCRAgrS7GWxAs 4kXVEACbwC7owWcjQUz+oeqc3QLJPhir3zQGBxlL8ZRw/8tp5DFaxQH8tvKd1k+DlkwSyCWGFsa vbqniIPlUEm3TcxAJ2Aput16mP3qUdPH+bEopYbLRk6lsD5+OJSIssPHMVEDh9HuSedO7CVxLVc 3uwuWAf2mDE9B6R9k+CUsgWp9flxeO0ZrslSlAgenbSPfoNX49AVPuO4WzZAn3D/ayMmZdNVFfc 4EhEOMg/UGEmZuPJu2pEWbCCcB+2w1TDeeEquu4IaWcslVyEiTuPql/S9ayj8nyZrxR4ZYKx55G IXbYAaBoPOoEt9LyE9K6LZauwgzaWyovztakONZ/4dHYiijGNOT6NfgrbCpHNkPBMsM7BXjYlog Om22TSFUin7pzKVMmn3TuqbxNUrbg4zfmEt1GsyYgvVAcJ/asBi42ga1UMsT6tSQQv2TcATVyWf 8rl4y1eJVfLxgyKL0BvzzN4egt0/S4D3t6+B8RwUS2W+Tk6BlMXIz8QSdkY3G2JN4OeRzvEfcX8 Ztnxes5UyuIJRTYvE1Pl0CRzaAxEcOonJb05sxvHMOlZwYfhbudmCySBr7sBc7hL4VroSFGjLGT hBUClO+WJqLuVxw4ObTLuj3zMMBEddqHF76EzF2B0H5SXKMoyO4qh6WKuqTI46IN4rlZH2qiUK1 HhWeJgcxvJ6fPqg== X-Developer-Key: i=louis.chauvet@bootlin.com; a=openpgp; fpr=8B7104AE9A272D6693F527F2EC1883F55E0B40A5 X-GND-State: clean X-GND-Score: -100 X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgdduleejfecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfitefpfffkpdcuggftfghnshhusghstghrihgsvgenuceurghilhhouhhtmecufedtudenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephfffufggtgfgkfhfjgfvvefosehtkeertdertdejnecuhfhrohhmpefnohhuihhsucevhhgruhhvvghtuceolhhouhhishdrtghhrghuvhgvthessghoohhtlhhinhdrtghomheqnecuggftrfgrthhtvghrnheptdeiveeiudehtddtgfethfduudefffduteekgeevueetudevheehieevtddttdeknecukfhppeeltddrkeelrdduieefrdduvdejnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepledtrdekledrudeifedruddvjedphhgvlhhopegludelvddrudeikedrtddrvddtngdpmhgrihhlfhhrohhmpehlohhuihhsrdgthhgruhhvvghtsegsohhothhlihhnrdgtohhmpdhnsggprhgtphhtthhopedvtddprhgtphhtthhopehsihhmohhnrgesfhhffihllhdrtghhpdhrtghpthhtohephhgrmhhohhgrmhhmvggurdhsrgesghhmrghilhdrtghomhdprhgtphhtthhopehsvggrnhhprghulhesghhoohhglhgvrdgtohhmpdhrtghpthhtohepmhgvlhhishhsrgdrshhrfiesghhmrghilhdrtghomhdprhgtphhtthhopehnihgtohhlvghjrgguvgihvggvsehgohhoghhlvgdrtghomhdprhgtp hhtthhopegrihhrlhhivggusehgmhgrihhlrdgtohhmpdhrtghpthhtoheprghrthhhuhhrghhrihhllhhosehrihhsvghuphdrnhgvthdprhgtphhtthhopehthhhomhgrshdrphgvthgriiiiohhnihessghoohhtlhhinhdrtghomh X-GND-Sasl: louis.chauvet@bootlin.com The format RGB565 was already supported. Add the support for: - BGR565 Reviewed-by: Ma=C3=ADra Canal Signed-off-by: Louis Chauvet Acked-by: Daniel Stone --- drivers/gpu/drm/vkms/vkms_formats.c | 13 +++++++++++++ drivers/gpu/drm/vkms/vkms_plane.c | 1 + 2 files changed, 14 insertions(+) diff --git a/drivers/gpu/drm/vkms/vkms_formats.c b/drivers/gpu/drm/vkms/vkm= s_formats.c index c37d1aae6eac..544bb6795805 100644 --- a/drivers/gpu/drm/vkms/vkms_formats.c +++ b/drivers/gpu/drm/vkms/vkms_formats.c @@ -259,6 +259,16 @@ static struct pixel_argb_u16 argb_u16_from_grayu16(u16= gray) return argb_u16_from_u16161616(0xFFFF, gray, gray, gray); } =20 +static struct pixel_argb_u16 argb_u16_from_BGR565(const __le16 *pixel) +{ + struct pixel_argb_u16 out_pixel; + + out_pixel =3D argb_u16_from_RGB565(pixel); + swap(out_pixel.r, out_pixel.b); + + return out_pixel; +} + VISIBLE_IF_KUNIT struct pixel_argb_u16 argb_u16_from_yuv888(u8 y, u8 chann= el_1, u8 channel_2, const struct conversion_matrix *matrix) { @@ -451,6 +461,7 @@ READ_LINE_le16161616(XRGB16161616_read_line, px, cpu_to= _le16(0xFFFF), px[2], px[ READ_LINE_le16161616(XBGR16161616_read_line, px, cpu_to_le16(0xFFFF), px[0= ], px[1], px[2]) =20 READ_LINE(RGB565_read_line, px, __le16, argb_u16_from_RGB565, px) +READ_LINE(BGR565_read_line, px, __le16, argb_u16_from_BGR565, px) =20 READ_LINE(R8_read_line, px, u8, argb_u16_from_gray8, *px) =20 @@ -675,6 +686,8 @@ pixel_read_line_t get_pixel_read_line_function(u32 form= at) return &XBGR16161616_read_line; case DRM_FORMAT_RGB565: return &RGB565_read_line; + case DRM_FORMAT_BGR565: + return &BGR565_read_line; case DRM_FORMAT_NV12: case DRM_FORMAT_NV16: case DRM_FORMAT_NV24: diff --git a/drivers/gpu/drm/vkms/vkms_plane.c b/drivers/gpu/drm/vkms/vkms_= plane.c index d4c51b4486f7..6e7597ab935d 100644 --- a/drivers/gpu/drm/vkms/vkms_plane.c +++ b/drivers/gpu/drm/vkms/vkms_plane.c @@ -24,6 +24,7 @@ static const u32 vkms_formats[] =3D { DRM_FORMAT_ARGB16161616, DRM_FORMAT_ABGR16161616, DRM_FORMAT_RGB565, + DRM_FORMAT_BGR565, DRM_FORMAT_NV12, DRM_FORMAT_NV16, DRM_FORMAT_NV24, --=20 2.49.0 From nobody Wed Oct 8 02:17:13 2025 Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) (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 7A31529B783 for ; Thu, 3 Jul 2025 07:57:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751529452; cv=none; b=UNfLa3nNMOwW7Ibf38l71DUDDMoCvxip21QqvVL8VMiIqq3x6uhZw/KfYvzuMO6HDx10mq0cApDVAebNphxQ7J/RHtOtxqmeq2SCes+9/Ew9eh8U0MClC9CANEO2E10zqlzFrqz0cmwy4W4sZP9BvOevgzGo0P/8b9+GB6qyw8A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751529452; c=relaxed/simple; bh=2Jf/qjD85M4WSRxtEpGCluMxSP6BXTGF6SPxegmrRUA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=IRIU+ziyHfH04Bgw3FS3VmvyoZhZ3IAv8iaqM6gtkwz5lE0Alo7q3fA5uE32POyDNR1l9Aa3YDL7q+lOi2lT/qM2ofl/W6bMdqhHyZi6Ud7qpsmZnjcQ9d0H3qvUOs2okcnx4xU4xQ7R/6g0QRAMmX1245pdQJ3XQ/aTE31iRPc= 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=kqA+ZFRb; arc=none smtp.client-ip=217.70.183.201 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="kqA+ZFRb" Received: by mail.gandi.net (Postfix) with ESMTPSA id B4F3E44498; Thu, 3 Jul 2025 07:57:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1751529448; 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=xor3CjGzOLPr9kT51iYNqi58nPlYRydTENN8kwzKB+s=; b=kqA+ZFRbFhdl7+v9Fqmdr92KU64nUi2uYmFQ4d5Dm0AUELC/5ZKqC3A6MpCw6gkezT7ZDr mBoafnbCkFR7asRx8uCpIr+51fdhu4zPMGyPL9kpJIDNnqRngj87U72dExRulO4Ev6AU0V yRAwdHXm81mtYstAzJd6l2UJBL1OeP+WapSAhTwXhKL4r3aKS9jHc04NbXTB8XIme/kT0v e3wIw6zO1ma+GVXaZprNyXWzIgdvwNpSd9CKe/BB/UMs5euPh/37QKKSHxRTFpyqGzPLlB cDKv8mBxe9/bn9Un7pr9bYF34D+MwDO9ZW5tptbB4wYGRyuw1cy1ATw+wW4K3g== From: Louis Chauvet Date: Thu, 03 Jul 2025 09:57:01 +0200 Subject: [PATCH v7 5/8] drm/vkms: Add support for RGB888 formats 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: <20250703-b4-new-color-formats-v7-5-15fd8fd2e15c@bootlin.com> References: <20250703-b4-new-color-formats-v7-0-15fd8fd2e15c@bootlin.com> In-Reply-To: <20250703-b4-new-color-formats-v7-0-15fd8fd2e15c@bootlin.com> To: Melissa Wen , =?utf-8?q?Ma=C3=ADra_Canal?= , Haneen Mohammed , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Rodrigo Siqueira , Simona Vetter Cc: dri-devel@lists.freedesktop.org, arthurgrillo@riseup.net, linux-kernel@vger.kernel.org, jeremie.dautheribes@bootlin.com, miquel.raynal@bootlin.com, thomas.petazzoni@bootlin.com, seanpaul@google.com, nicolejadeyee@google.com, Louis Chauvet , =?utf-8?q?Ma=C3=ADra_Canal?= X-Mailer: b4 0.15-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=2003; i=louis.chauvet@bootlin.com; h=from:subject:message-id; bh=2Jf/qjD85M4WSRxtEpGCluMxSP6BXTGF6SPxegmrRUA=; b=owEBbQKS/ZANAwAIASCtLsZbECziAcsmYgBoZjfgKKG48v6367zrWTwGsloP2cj80JOQmpQVq Dnw875SqYmJAjMEAAEIAB0WIQRPj7g/vng8MQxQWQQgrS7GWxAs4gUCaGY34AAKCRAgrS7GWxAs 4h0KEACCIhqNAH7+RDj0/9EkGBUS6qQUkMr8rWNDStAtmHPVE5jMc2ReNdDTZJyWCOxKj3ecv/2 MhHIIBngLYJez1gDWAP6U96SgoqPlDfOYmI65TjWZnOom+JZBBh5Rpg/xPEVgRQXNVXlg71aT9m g6jIqwaKa9X3v5wh0jtDjhC52kHFUghaqBtD8lnbAmXWA9hFs3nPCkVkj4gn6+nLlSvy6yxlQKA SQfllCiBFTUbrPku1UxsuS0CujxmfSPIpKCEe0KwchIMBDkkdySmYU+ESj3XO8/cIDpsC08oXfn PiNTVYcHHkoaLwOQcKQKNmdohWXQnM7Buy8x0/LcHUp/R9HydDpOWIt48odsHUmkpAJUgUOUvoi w10gj0ziSUpF+JAsjt/ERKcNlo8ZtLWiG1paTNpnymUlcdLWK5u7ZskwU0S2OYzdO4EaK+hLdN/ 599HQDcU51VNJGeFYTZ0h0zE1DUUP+9J8eo4SE2wfkTZxaVc/DEPCxljGwtw67HTP3BuaSi4QwF atS7Jhoq40PzhgGzTnXYg9jbGNKD8xk+/v3EYAwcn7B/HRaU6tKKzCaW6CujCbcVU5Vi42Hyn5j KkvF2HfsnCMs0HuZk7/PpmFyaQ4VD4+zvlqf3IBAVmpUBXXbv3fhgWSFG88xRLa1ozCS1Lf4Jo0 aKXg8Dzu5wqshRA== X-Developer-Key: i=louis.chauvet@bootlin.com; a=openpgp; fpr=8B7104AE9A272D6693F527F2EC1883F55E0B40A5 X-GND-State: clean X-GND-Score: -100 X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgdduleejfecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfitefpfffkpdcuggftfghnshhusghstghrihgsvgenuceurghilhhouhhtmecufedtudenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephfffufggtgfgkfhfjgfvvefosehtkeertdertdejnecuhfhrohhmpefnohhuihhsucevhhgruhhvvghtuceolhhouhhishdrtghhrghuvhgvthessghoohhtlhhinhdrtghomheqnecuggftrfgrthhtvghrnheptdeiveeiudehtddtgfethfduudefffduteekgeevueetudevheehieevtddttdeknecukfhppeeltddrkeelrdduieefrdduvdejnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepledtrdekledrudeifedruddvjedphhgvlhhopegludelvddrudeikedrtddrvddtngdpmhgrihhlfhhrohhmpehlohhuihhsrdgthhgruhhvvghtsegsohhothhlihhnrdgtohhmpdhnsggprhgtphhtthhopedvtddprhgtphhtthhopehsihhmohhnrgesfhhffihllhdrtghhpdhrtghpthhtohephhgrmhhohhgrmhhmvggurdhsrgesghhmrghilhdrtghomhdprhgtphhtthhopehsvggrnhhprghulhesghhoohhglhgvrdgtohhmpdhrtghpthhtohepmhgvlhhishhsrgdrshhrfiesghhmrghilhdrtghomhdprhgtphhtthhopehnihgtohhlvghjrgguvgihvggvsehgohhoghhlvgdrtghomhdprhgtp hhtthhopegrihhrlhhivggusehgmhgrihhlrdgtohhmpdhrtghpthhtoheprghrthhhuhhrghhrihhllhhosehrihhsvghuphdrnhgvthdprhgtphhtthhopehthhhomhgrshdrphgvthgriiiiohhnihessghoohhtlhhinhdrtghomh X-GND-Sasl: louis.chauvet@bootlin.com Add the support for: - RGB888 - BGR888 Reviewed-by: Ma=C3=ADra Canal Signed-off-by: Louis Chauvet Acked-by: Daniel Stone --- drivers/gpu/drm/vkms/vkms_formats.c | 7 +++++++ drivers/gpu/drm/vkms/vkms_plane.c | 2 ++ 2 files changed, 9 insertions(+) diff --git a/drivers/gpu/drm/vkms/vkms_formats.c b/drivers/gpu/drm/vkms/vkm= s_formats.c index 544bb6795805..f1649d9bf430 100644 --- a/drivers/gpu/drm/vkms/vkms_formats.c +++ b/drivers/gpu/drm/vkms/vkms_formats.c @@ -455,6 +455,9 @@ READ_LINE_ARGB8888(ABGR8888_read_line, px, px[3], px[0]= , px[1], px[2]) READ_LINE_ARGB8888(RGBA8888_read_line, px, px[0], px[3], px[2], px[1]) READ_LINE_ARGB8888(BGRA8888_read_line, px, px[0], px[1], px[2], px[3]) =20 +READ_LINE_ARGB8888(RGB888_read_line, px, 0xFF, px[2], px[1], px[0]) +READ_LINE_ARGB8888(BGR888_read_line, px, 0xFF, px[0], px[1], px[2]) + READ_LINE_le16161616(ARGB16161616_read_line, px, px[3], px[2], px[1], px[0= ]) READ_LINE_le16161616(ABGR16161616_read_line, px, px[3], px[0], px[1], px[2= ]) READ_LINE_le16161616(XRGB16161616_read_line, px, cpu_to_le16(0xFFFF), px[2= ], px[1], px[0]) @@ -676,6 +679,10 @@ pixel_read_line_t get_pixel_read_line_function(u32 for= mat) return &XRGB8888_read_line; case DRM_FORMAT_XBGR8888: return &XBGR8888_read_line; + case DRM_FORMAT_RGB888: + return &RGB888_read_line; + case DRM_FORMAT_BGR888: + return &BGR888_read_line; case DRM_FORMAT_ARGB16161616: return &ARGB16161616_read_line; case DRM_FORMAT_ABGR16161616: diff --git a/drivers/gpu/drm/vkms/vkms_plane.c b/drivers/gpu/drm/vkms/vkms_= plane.c index 6e7597ab935d..9f34f3a18d8c 100644 --- a/drivers/gpu/drm/vkms/vkms_plane.c +++ b/drivers/gpu/drm/vkms/vkms_plane.c @@ -19,6 +19,8 @@ static const u32 vkms_formats[] =3D { DRM_FORMAT_RGBA8888, DRM_FORMAT_XRGB8888, DRM_FORMAT_XBGR8888, + DRM_FORMAT_RGB888, + DRM_FORMAT_BGR888, DRM_FORMAT_XRGB16161616, DRM_FORMAT_XBGR16161616, DRM_FORMAT_ARGB16161616, --=20 2.49.0 From nobody Wed Oct 8 02:17:13 2025 Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) (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 7CCDB86347 for ; Thu, 3 Jul 2025 07:57:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751529454; cv=none; b=LvqHnsofZs/IG+sT2asuujt6XW3jkjI+ZrSZuBZpPr+SUgoBdX492CEMDxVjjRp369hWNIxcBigBe6mCLBZzB0+W4UdZobYhX/UWvWOuBa3UQ9GofGFYm9PFKxcGZdCAn/7xgED802nYyhmadDiGFtF3VVIEskUcXkg3z4kZ1Ek= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751529454; c=relaxed/simple; bh=DXHU5NdAVlEqRArAJ3rqlwVknFH8Tyl4jvTB2+MS5Pk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Umq/MgaAbCLOkhJmMgUzadAYllPY1MT/L0aQe5y51rwUAT3UpAoJpsOIWj9VGaWjLWoQs2sociaYj7ANKBytSMtqGuCsIf5OY0jRG4FlmlPnvS3Gp7pBRO5wGV4geknOK/i08UOZ1gNEj4BK7QHz1eKe7ZbVFzXMKKLSoISzQMI= 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=GLCNwHuH; arc=none smtp.client-ip=217.70.183.201 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="GLCNwHuH" Received: by mail.gandi.net (Postfix) with ESMTPSA id B221E44497; Thu, 3 Jul 2025 07:57:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1751529449; 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=V5fdycQpcOVGSAwdzjg/Hh3sq7mvnuiLJ3tLN3MFKYw=; b=GLCNwHuH3XfbI1MdrNbZuqE+H6wH2Kdam2DXv+ngE8YyCqcVDAj+wfIUHQLvIjYDxAWPMP E04OKHA10ZqVpXAhia0A9mls8eKGNSVQGjjGuGDy6ugn33ad0D1LEfnPcq3hTD8e1PEoZO ym4lKHxG/UQb/7Y4K6IoqonrSjIeH24kuQIzzp3PHpxdUpHmJqiknrXvu8ByUlde2ZmIIY XhgZFpONykeWpz50PpuOb5F4reqbrgykvD60zeinmCZEhjcWs4PIlgG3oAixkrnHS/Ugui uauzDgPAV8h7ziuzXPgAkEZFf/izhOnSVIg0zXDmgz/L73+ZTNSsgYhHsNb5nw== From: Louis Chauvet Date: Thu, 03 Jul 2025 09:57:02 +0200 Subject: [PATCH v7 6/8] drm/vkms: Change YUV helpers to support u16 inputs for conversion 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: <20250703-b4-new-color-formats-v7-6-15fd8fd2e15c@bootlin.com> References: <20250703-b4-new-color-formats-v7-0-15fd8fd2e15c@bootlin.com> In-Reply-To: <20250703-b4-new-color-formats-v7-0-15fd8fd2e15c@bootlin.com> To: Melissa Wen , =?utf-8?q?Ma=C3=ADra_Canal?= , Haneen Mohammed , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Rodrigo Siqueira , Simona Vetter Cc: dri-devel@lists.freedesktop.org, arthurgrillo@riseup.net, linux-kernel@vger.kernel.org, jeremie.dautheribes@bootlin.com, miquel.raynal@bootlin.com, thomas.petazzoni@bootlin.com, seanpaul@google.com, nicolejadeyee@google.com, Louis Chauvet , =?utf-8?q?Ma=C3=ADra_Canal?= X-Mailer: b4 0.15-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=18499; i=louis.chauvet@bootlin.com; h=from:subject:message-id; bh=DXHU5NdAVlEqRArAJ3rqlwVknFH8Tyl4jvTB2+MS5Pk=; b=owEBbQKS/ZANAwAIASCtLsZbECziAcsmYgBoZjfhJENPGZ+uozzIjsMtXUTcbrepo/rTAI4jO mVwhMwh4BqJAjMEAAEIAB0WIQRPj7g/vng8MQxQWQQgrS7GWxAs4gUCaGY34QAKCRAgrS7GWxAs 4siSD/4yNzSYaEeKpG/Ggdc9GBB66A6udFsMXw0PrR+mHMvnTlXHlRquz3NExdQESeukWc9LHmf eY2n0vFGwXQ7njjdk566HKc8Zgmrd8tmgOfxSwHYKuP4pXcIXMT1S7no44g+rh+2h1cFYAQbpfm 5iaun6nxdZ4MWpUB4bf+aRn/cTGuOeOOosnLSsP8uUhSPIvYd0DVCdkLLxz3aG3xoP6UCoOSElY VENET/AWyLkx9MHwpv7dceGL1Zy5vYSbho+gn1ShoX5DDMy6LzgT+4CBBLmf6Ojki1F3bs5aAXb M1LksSVM7dMiGQ0dE361l10TJFWPUdNP7cG3ph3uWa1JwnQn1lX8eSSsOhiHzsIvGYL0ol8K/St qr/M6OJfla7x5U48G/fN5Iyp6Bxx+lXisiGcxSTAB0vlSa0reF4ku44QGDlmF4arYNK+4BRhIMC ODur+wLja2TKYc2T6Qo/gXg3yMmX3z+2CKjCYBF8o+V/hpzV/1JluprcO0IlDQZD+S5bg5re8FP wkPCcjA2u4A5KEXA5bFADeOkAf8E0CLh15T4dePPzTBHuvKJ2e2GvXav+O+eYdep2iNpbJ5xeYl I/GzdcrZ4H3aUC015PvdnJhseMeGP4yjfYGBfDF4zWshfqA1+3ue7Urv4E7LGPXXomoj4JqyMkC CSa7ixa9t2bUuBQ== X-Developer-Key: i=louis.chauvet@bootlin.com; a=openpgp; fpr=8B7104AE9A272D6693F527F2EC1883F55E0B40A5 X-GND-State: clean X-GND-Score: -100 X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgdduleejfecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfitefpfffkpdcuggftfghnshhusghstghrihgsvgenuceurghilhhouhhtmecufedtudenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephfffufggtgfgkfhfjgfvvefosehtkeertdertdejnecuhfhrohhmpefnohhuihhsucevhhgruhhvvghtuceolhhouhhishdrtghhrghuvhgvthessghoohhtlhhinhdrtghomheqnecuggftrfgrthhtvghrnhepgeeggeejieejgffgtdfftdegvdfhieegvdetgfettdeiveeihfegfeeukeetffffnecuffhomhgrihhnpehrvggrughthhgvughotghsrdhiohenucfkphepledtrdekledrudeifedruddvjeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeeltddrkeelrdduieefrdduvdejpdhhvghloheplgduledvrdduieekrddtrddvtdgnpdhmrghilhhfrhhomheplhhouhhishdrtghhrghuvhgvthessghoohhtlhhinhdrtghomhdpnhgspghrtghpthhtohepvddtpdhrtghpthhtohepshhimhhonhgrsehffhiflhhlrdgthhdprhgtphhtthhopehhrghmohhhrghmmhgvugdrshgrsehgmhgrihhlrdgtohhmpdhrtghpthhtohepshgvrghnphgruhhlsehgohhoghhlvgdrtghomhdprhgtphhtthhopehmvghlihhsshgrrdhsrhifsehgmhgrihhlrdgtohhmpdhrtghpthhtohepnhhitghol hgvjhgruggvhigvvgesghhoohhglhgvrdgtohhmpdhrtghpthhtoheprghirhhlihgvugesghhmrghilhdrtghomhdprhgtphhtthhopegrrhhthhhurhhgrhhilhhlohesrhhishgvuhhprdhnvghtpdhrtghpthhtohepthhhohhmrghsrdhpvghtrgiiiihonhhisegsohhothhlihhnrdgtohhm X-GND-Sasl: louis.chauvet@bootlin.com Some YUV format uses 16 bit values, so change the helper function for conversion to support those new formats. Reviewed-by: Ma=C3=ADra Canal Signed-off-by: Louis Chauvet Acked-by: Daniel Stone --- drivers/gpu/drm/vkms/tests/vkms_format_test.c | 143 +++++++++++++---------= ---- drivers/gpu/drm/vkms/vkms_formats.c | 22 ++-- drivers/gpu/drm/vkms/vkms_formats.h | 4 +- 3 files changed, 85 insertions(+), 84 deletions(-) diff --git a/drivers/gpu/drm/vkms/tests/vkms_format_test.c b/drivers/gpu/dr= m/vkms/tests/vkms_format_test.c index 2e1daef94831..a7788fbc45dc 100644 --- a/drivers/gpu/drm/vkms/tests/vkms_format_test.c +++ b/drivers/gpu/drm/vkms/tests/vkms_format_test.c @@ -14,20 +14,20 @@ MODULE_IMPORT_NS("EXPORTED_FOR_KUNIT_TESTING"); =20 /** - * struct pixel_yuv_u8 - Internal representation of a pixel color. - * @y: Luma value, stored in 8 bits, without padding, using + * struct pixel_yuv_u16 - Internal representation of a pixel color. + * @y: Luma value, stored in 16 bits, without padding, using * machine endianness - * @u: Blue difference chroma value, stored in 8 bits, without padding, us= ing + * @u: Blue difference chroma value, stored in 16 bits, without padding, u= sing * machine endianness - * @v: Red difference chroma value, stored in 8 bits, without padding, usi= ng + * @v: Red difference chroma value, stored in 16 bits, without padding, us= ing * machine endianness */ -struct pixel_yuv_u8 { - u8 y, u, v; +struct pixel_yuv_u16 { + u16 y, u, v; }; =20 /* - * struct yuv_u8_to_argb_u16_case - Reference values to test the color + * struct yuv_u16_to_argb_u16_case - Reference values to test the color * conversions in VKMS between YUV to ARGB * * @encoding: Encoding used to convert RGB to YUV @@ -39,13 +39,13 @@ struct pixel_yuv_u8 { * @format_pair.yuv: Same color as @format_pair.rgb, but converted to * YUV using @encoding and @range. */ -struct yuv_u8_to_argb_u16_case { +struct yuv_u16_to_argb_u16_case { enum drm_color_encoding encoding; enum drm_color_range range; size_t n_colors; struct format_pair { char *name; - struct pixel_yuv_u8 yuv; + struct pixel_yuv_u16 yuv; struct pixel_argb_u16 argb; } colors[TEST_BUFF_SIZE]; }; @@ -57,14 +57,14 @@ struct yuv_u8_to_argb_u16_case { * For more information got to the docs: * https://colour.readthedocs.io/en/master/generated/colour.RGB_to_YCbCr.h= tml */ -static struct yuv_u8_to_argb_u16_case yuv_u8_to_argb_u16_cases[] =3D { +static struct yuv_u16_to_argb_u16_case yuv_u16_to_argb_u16_cases[] =3D { /* * colour.RGB_to_YCbCr(, * K=3Dcolour.WEIGHTS_YCBCR["ITU-R BT.601"], * in_bits =3D 16, * in_legal =3D False, * in_int =3D True, - * out_bits =3D 8, + * out_bits =3D 16, * out_legal =3D False, * out_int =3D True) * @@ -76,13 +76,13 @@ static struct yuv_u8_to_argb_u16_case yuv_u8_to_argb_u1= 6_cases[] =3D { .range =3D DRM_COLOR_YCBCR_FULL_RANGE, .n_colors =3D 6, .colors =3D { - { "white", { 0xff, 0x80, 0x80 }, { 0xffff, 0xffff, 0xffff, 0xffff }}, - { "gray", { 0x80, 0x80, 0x80 }, { 0xffff, 0x8080, 0x8080, 0x8080 }}, - { "black", { 0x00, 0x80, 0x80 }, { 0xffff, 0x0000, 0x0000, 0x0000 }}, - { "red", { 0x4c, 0x55, 0xff }, { 0xffff, 0xffff, 0x0000, 0x0000 }}, - { "green", { 0x96, 0x2c, 0x15 }, { 0xffff, 0x0000, 0xffff, 0x0000 }}, - { "blue", { 0x1d, 0xff, 0x6b }, { 0xffff, 0x0000, 0x0000, 0xffff }}, - }, + { "white", { 0xffff, 0x8000, 0x8000 }, { 0xffff, 0xffff, 0xffff, 0xffff= }}, + { "gray", { 0x8080, 0x8000, 0x8000 }, { 0xffff, 0x8080, 0x8080, 0x8080= }}, + { "black", { 0x0000, 0x8000, 0x8000 }, { 0xffff, 0x0000, 0x0000, 0x0000= }}, + { "red", { 0x4c8b, 0x54ce, 0xffff }, { 0xffff, 0xffff, 0x0000, 0x0000= }}, + { "green", { 0x9645, 0x2b33, 0x14d1 }, { 0xffff, 0x0000, 0xffff, 0x0000= }}, + { "blue", { 0x1d2f, 0xffff, 0x6b2f }, { 0xffff, 0x0000, 0x0000, 0xffff= }}, + } }, /* * colour.RGB_to_YCbCr(, @@ -90,7 +90,7 @@ static struct yuv_u8_to_argb_u16_case yuv_u8_to_argb_u16_= cases[] =3D { * in_bits =3D 16, * in_legal =3D False, * in_int =3D True, - * out_bits =3D 8, + * out_bits =3D 16, * out_legal =3D True, * out_int =3D True) * Tests cases for color conversion generated by converting RGB @@ -101,13 +101,13 @@ static struct yuv_u8_to_argb_u16_case yuv_u8_to_argb_= u16_cases[] =3D { .range =3D DRM_COLOR_YCBCR_LIMITED_RANGE, .n_colors =3D 6, .colors =3D { - { "white", { 0xeb, 0x80, 0x80 }, { 0xffff, 0xffff, 0xffff, 0xffff }}, - { "gray", { 0x7e, 0x80, 0x80 }, { 0xffff, 0x8080, 0x8080, 0x8080 }}, - { "black", { 0x10, 0x80, 0x80 }, { 0xffff, 0x0000, 0x0000, 0x0000 }}, - { "red", { 0x51, 0x5a, 0xf0 }, { 0xffff, 0xffff, 0x0000, 0x0000 }}, - { "green", { 0x91, 0x36, 0x22 }, { 0xffff, 0x0000, 0xffff, 0x0000 }}, - { "blue", { 0x29, 0xf0, 0x6e }, { 0xffff, 0x0000, 0x0000, 0xffff }}, - }, + { "white", { 0xeb00, 0x8000, 0x8000 }, { 0xffff, 0xffff, 0xffff, 0xffff= }}, + { "gray", { 0x7dee, 0x8000, 0x8000 }, { 0xffff, 0x8080, 0x8080, 0x8080= }}, + { "black", { 0x1000, 0x8000, 0x8000 }, { 0xffff, 0x0000, 0x0000, 0x0000= }}, + { "red", { 0x517b, 0x5a34, 0xf000 }, { 0xffff, 0xffff, 0x0000, 0x0000= }}, + { "green", { 0x908e, 0x35cc, 0x2237 }, { 0xffff, 0x0000, 0xffff, 0x0000= }}, + { "blue", { 0x28f7, 0xf000, 0x6dc9 }, { 0xffff, 0x0000, 0x0000, 0xffff= }}, + } }, /* * colour.RGB_to_YCbCr(, @@ -115,7 +115,7 @@ static struct yuv_u8_to_argb_u16_case yuv_u8_to_argb_u1= 6_cases[] =3D { * in_bits =3D 16, * in_legal =3D False, * in_int =3D True, - * out_bits =3D 8, + * out_bits =3D 16, * out_legal =3D False, * out_int =3D True) * Tests cases for color conversion generated by converting RGB @@ -126,21 +126,21 @@ static struct yuv_u8_to_argb_u16_case yuv_u8_to_argb_= u16_cases[] =3D { .range =3D DRM_COLOR_YCBCR_FULL_RANGE, .n_colors =3D 6, .colors =3D { - { "white", { 0xff, 0x80, 0x80 }, { 0xffff, 0xffff, 0xffff, 0xffff }}, - { "gray", { 0x80, 0x80, 0x80 }, { 0xffff, 0x8080, 0x8080, 0x8080 }}, - { "black", { 0x00, 0x80, 0x80 }, { 0xffff, 0x0000, 0x0000, 0x0000 }}, - { "red", { 0x36, 0x63, 0xff }, { 0xffff, 0xffff, 0x0000, 0x0000 }}, - { "green", { 0xb6, 0x1e, 0x0c }, { 0xffff, 0x0000, 0xffff, 0x0000 }}, - { "blue", { 0x12, 0xff, 0x74 }, { 0xffff, 0x0000, 0x0000, 0xffff }}, - }, + { "white", { 0xffff, 0x8000, 0x8000 }, { 0xffff, 0xffff, 0xffff, 0xffff= }}, + { "gray", { 0x8080, 0x8000, 0x8000 }, { 0xffff, 0x8080, 0x8080, 0x8080= }}, + { "black", { 0x0000, 0x8000, 0x8000 }, { 0xffff, 0x0000, 0x0000, 0x0000= }}, + { "red", { 0x366d, 0x62ac, 0xffff }, { 0xffff, 0xffff, 0x0000, 0x0000= }}, + { "green", { 0xb717, 0x1d55, 0x0bbd }, { 0xffff, 0x0000, 0xffff, 0x0000= }}, + { "blue", { 0x127c, 0xffff, 0x7443 }, { 0xffff, 0x0000, 0x0000, 0xffff= }}, + } }, /* * colour.RGB_to_YCbCr(, * K=3Dcolour.WEIGHTS_YCBCR["ITU-R BT.709"], * in_bits =3D 16, - * int_legal =3D False, + * in_legal =3D False, * in_int =3D True, - * out_bits =3D 8, + * out_bits =3D 16, * out_legal =3D True, * out_int =3D True) * Tests cases for color conversion generated by converting RGB @@ -151,13 +151,13 @@ static struct yuv_u8_to_argb_u16_case yuv_u8_to_argb_= u16_cases[] =3D { .range =3D DRM_COLOR_YCBCR_LIMITED_RANGE, .n_colors =3D 6, .colors =3D { - { "white", { 0xeb, 0x80, 0x80 }, { 0xffff, 0xffff, 0xffff, 0xffff }}, - { "gray", { 0x7e, 0x80, 0x80 }, { 0xffff, 0x8080, 0x8080, 0x8080 }}, - { "black", { 0x10, 0x80, 0x80 }, { 0xffff, 0x0000, 0x0000, 0x0000 }}, - { "red", { 0x3f, 0x66, 0xf0 }, { 0xffff, 0xffff, 0x0000, 0x0000 }}, - { "green", { 0xad, 0x2a, 0x1a }, { 0xffff, 0x0000, 0xffff, 0x0000 }}, - { "blue", { 0x20, 0xf0, 0x76 }, { 0xffff, 0x0000, 0x0000, 0xffff }}, - }, + { "white", { 0xeb00, 0x8000, 0x8000 }, { 0xffff, 0xffff, 0xffff, 0xffff= }}, + { "gray", { 0x7dee, 0x8000, 0x8000 }, { 0xffff, 0x8080, 0x8080, 0x8080= }}, + { "black", { 0x1000, 0x8000, 0x8000 }, { 0xffff, 0x0000, 0x0000, 0x0000= }}, + { "red", { 0x3e8f, 0x6656, 0xf000 }, { 0xffff, 0xffff, 0x0000, 0x0000= }}, + { "green", { 0xaca1, 0x29aa, 0x1a45 }, { 0xffff, 0x0000, 0xffff, 0x0000= }}, + { "blue", { 0x1fd0, 0xf000, 0x75bb }, { 0xffff, 0x0000, 0x0000, 0xffff= }}, + } }, /* * colour.RGB_to_YCbCr(, @@ -165,7 +165,7 @@ static struct yuv_u8_to_argb_u16_case yuv_u8_to_argb_u1= 6_cases[] =3D { * in_bits =3D 16, * in_legal =3D False, * in_int =3D True, - * out_bits =3D 8, + * out_bits =3D 16, * out_legal =3D False, * out_int =3D True) * Tests cases for color conversion generated by converting RGB @@ -176,13 +176,13 @@ static struct yuv_u8_to_argb_u16_case yuv_u8_to_argb_= u16_cases[] =3D { .range =3D DRM_COLOR_YCBCR_FULL_RANGE, .n_colors =3D 6, .colors =3D { - { "white", { 0xff, 0x80, 0x80 }, { 0xffff, 0xffff, 0xffff, 0xffff }}, - { "gray", { 0x80, 0x80, 0x80 }, { 0xffff, 0x8080, 0x8080, 0x8080 }}, - { "black", { 0x00, 0x80, 0x80 }, { 0xffff, 0x0000, 0x0000, 0x0000 }}, - { "red", { 0x43, 0x5c, 0xff }, { 0xffff, 0xffff, 0x0000, 0x0000 }}, - { "green", { 0xad, 0x24, 0x0b }, { 0xffff, 0x0000, 0xffff, 0x0000 }}, - { "blue", { 0x0f, 0xff, 0x76 }, { 0xffff, 0x0000, 0x0000, 0xffff }}, - }, + { "white", { 0xffff, 0x8000, 0x8000 }, { 0xffff, 0xffff, 0xffff, 0xffff= }}, + { "gray", { 0x8080, 0x8000, 0x8000 }, { 0xffff, 0x8080, 0x8080, 0x8080= }}, + { "black", { 0x0000, 0x8000, 0x8000 }, { 0xffff, 0x0000, 0x0000, 0x0000= }}, + { "red", { 0x4340, 0x5c41, 0xffff }, { 0xffff, 0xffff, 0x0000, 0x0000= }}, + { "green", { 0xad91, 0x23bf, 0x0a4c }, { 0xffff, 0x0000, 0xffff, 0x0000= }}, + { "blue", { 0x0f2e, 0xffff, 0x75b5 }, { 0xffff, 0x0000, 0x0000, 0xffff= }}, + } }, /* * colour.RGB_to_YCbCr(, @@ -190,7 +190,7 @@ static struct yuv_u8_to_argb_u16_case yuv_u8_to_argb_u1= 6_cases[] =3D { * in_bits =3D 16, * in_legal =3D False, * in_int =3D True, - * out_bits =3D 8, + * out_bits =3D 16, * out_legal =3D True, * out_int =3D True) * Tests cases for color conversion generated by converting RGB @@ -201,32 +201,30 @@ static struct yuv_u8_to_argb_u16_case yuv_u8_to_argb_= u16_cases[] =3D { .range =3D DRM_COLOR_YCBCR_LIMITED_RANGE, .n_colors =3D 6, .colors =3D { - { "white", { 0xeb, 0x80, 0x80 }, { 0xffff, 0xffff, 0xffff, 0xffff }}, - { "gray", { 0x7e, 0x80, 0x80 }, { 0xffff, 0x8080, 0x8080, 0x8080 }}, - { "black", { 0x10, 0x80, 0x80 }, { 0xffff, 0x0000, 0x0000, 0x0000 }}, - { "red", { 0x4a, 0x61, 0xf0 }, { 0xffff, 0xffff, 0x0000, 0x0000 }}, - { "green", { 0xa4, 0x2f, 0x19 }, { 0xffff, 0x0000, 0xffff, 0x0000 }}, - { "blue", { 0x1d, 0xf0, 0x77 }, { 0xffff, 0x0000, 0x0000, 0xffff }}, - }, + { "white", { 0xeb00, 0x8000, 0x8000 }, { 0xffff, 0xffff, 0xffff, 0xffff= }}, + { "gray", { 0x7dee, 0x8000, 0x8000 }, { 0xffff, 0x8080, 0x8080, 0x8080= }}, + { "black", { 0x1000, 0x8000, 0x8000 }, { 0xffff, 0x0000, 0x0000, 0x0000= }}, + { "red", { 0x4988, 0x60b9, 0xf000 }, { 0xffff, 0xffff, 0x0000, 0x0000= }}, + { "green", { 0xa47b, 0x2f47, 0x1902 }, { 0xffff, 0x0000, 0xffff, 0x0000= }}, + { "blue", { 0x1cfd, 0xf000, 0x76fe }, { 0xffff, 0x0000, 0x0000, 0xffff= }}, + } }, }; =20 /* - * vkms_format_test_yuv_u8_to_argb_u16 - Testing the conversion between YUV + * vkms_format_test_yuv_u16_to_argb_u16 - Testing the conversion between Y= UV * colors to ARGB colors in VKMS * * This test will use the functions get_conversion_matrix_to_argb_u16 and - * argb_u16_from_yuv888 to convert YUV colors (stored in - * yuv_u8_to_argb_u16_cases) into ARGB colors. + * argb_u16_from_yuv161616 to convert YUV colors (stored in + * yuv_u16_to_argb_u16_cases) into ARGB colors. * * The conversion between YUV and RGB is not totally reversible, so there = may be * some difference between the expected value and the result. - * In addition, there may be some rounding error as the input color is 8 b= its - * and output color is 16 bits. */ -static void vkms_format_test_yuv_u8_to_argb_u16(struct kunit *test) +static void vkms_format_test_yuv_u16_to_argb_u16(struct kunit *test) { - const struct yuv_u8_to_argb_u16_case *param =3D test->param_value; + const struct yuv_u16_to_argb_u16_case *param =3D test->param_value; struct pixel_argb_u16 argb; =20 for (size_t i =3D 0; i < param->n_colors; i++) { @@ -236,7 +234,8 @@ static void vkms_format_test_yuv_u8_to_argb_u16(struct = kunit *test) get_conversion_matrix_to_argb_u16 (DRM_FORMAT_NV12, param->encoding, param->range, &matrix); =20 - argb =3D argb_u16_from_yuv888(color->yuv.y, color->yuv.u, color->yuv.v, = &matrix); + argb =3D argb_u16_from_yuv161616(&matrix, color->yuv.y, color->yuv.u, + color->yuv.v); =20 KUNIT_EXPECT_LE_MSG(test, abs_diff(argb.a, color->argb.a), 0x1ff, "On the A channel of the color %s expected 0x%04x, got 0x%04x", @@ -253,19 +252,19 @@ static void vkms_format_test_yuv_u8_to_argb_u16(struc= t kunit *test) } } =20 -static void vkms_format_test_yuv_u8_to_argb_u16_case_desc(struct yuv_u8_to= _argb_u16_case *t, - char *desc) +static void vkms_format_test_yuv_u16_to_argb_u16_case_desc(struct yuv_u16_= to_argb_u16_case *t, + char *desc) { snprintf(desc, KUNIT_PARAM_DESC_SIZE, "%s - %s", drm_get_color_encoding_name(t->encoding), drm_get_color_range_name(t->r= ange)); } =20 -KUNIT_ARRAY_PARAM(yuv_u8_to_argb_u16, yuv_u8_to_argb_u16_cases, - vkms_format_test_yuv_u8_to_argb_u16_case_desc +KUNIT_ARRAY_PARAM(yuv_u16_to_argb_u16, yuv_u16_to_argb_u16_cases, + vkms_format_test_yuv_u16_to_argb_u16_case_desc ); =20 static struct kunit_case vkms_format_test_cases[] =3D { - KUNIT_CASE_PARAM(vkms_format_test_yuv_u8_to_argb_u16, yuv_u8_to_argb_u16_= gen_params), + KUNIT_CASE_PARAM(vkms_format_test_yuv_u16_to_argb_u16, yuv_u16_to_argb_u1= 6_gen_params), {} }; =20 diff --git a/drivers/gpu/drm/vkms/vkms_formats.c b/drivers/gpu/drm/vkms/vkm= s_formats.c index f1649d9bf430..cec27a72bc48 100644 --- a/drivers/gpu/drm/vkms/vkms_formats.c +++ b/drivers/gpu/drm/vkms/vkms_formats.c @@ -269,16 +269,17 @@ static struct pixel_argb_u16 argb_u16_from_BGR565(con= st __le16 *pixel) return out_pixel; } =20 -VISIBLE_IF_KUNIT struct pixel_argb_u16 argb_u16_from_yuv888(u8 y, u8 chann= el_1, u8 channel_2, - const struct conversion_matrix *matrix) +VISIBLE_IF_KUNIT +struct pixel_argb_u16 argb_u16_from_yuv161616(const struct conversion_matr= ix *matrix, + u16 y, u16 channel_1, u16 channel_2) { u16 r, g, b; s64 fp_y, fp_channel_1, fp_channel_2; s64 fp_r, fp_g, fp_b; =20 - fp_y =3D drm_int2fixp(((int)y - matrix->y_offset) * 257); - fp_channel_1 =3D drm_int2fixp(((int)channel_1 - 128) * 257); - fp_channel_2 =3D drm_int2fixp(((int)channel_2 - 128) * 257); + fp_y =3D drm_int2fixp((int)y - matrix->y_offset * 257); + fp_channel_1 =3D drm_int2fixp((int)channel_1 - 128 * 257); + fp_channel_2 =3D drm_int2fixp((int)channel_2 - 128 * 257); =20 fp_r =3D drm_fixp_mul(matrix->matrix[0][0], fp_y) + drm_fixp_mul(matrix->matrix[0][1], fp_channel_1) + @@ -300,7 +301,7 @@ VISIBLE_IF_KUNIT struct pixel_argb_u16 argb_u16_from_yu= v888(u8 y, u8 channel_1, =20 return argb_u16_from_u16161616(0xffff, r, g, b); } -EXPORT_SYMBOL_IF_KUNIT(argb_u16_from_yuv888); +EXPORT_SYMBOL_IF_KUNIT(argb_u16_from_yuv161616); =20 /** * READ_LINE() - Generic generator for a read_line function which can be u= sed for format with one @@ -498,8 +499,8 @@ static void semi_planar_yuv_read_line(const struct vkms= _plane_state *plane, int const struct conversion_matrix *conversion_matrix =3D &plane->conversion_= matrix; =20 for (int i =3D 0; i < count; i++) { - *out_pixel =3D argb_u16_from_yuv888(y_plane[0], uv_plane[0], uv_plane[1], - conversion_matrix); + *out_pixel =3D argb_u16_from_yuv161616(conversion_matrix, y_plane[0] * 2= 57, + uv_plane[0] * 257, uv_plane[1] * 257); out_pixel +=3D 1; y_plane +=3D step_y; if ((i + subsampling_offset + 1) % subsampling =3D=3D 0) @@ -543,8 +544,9 @@ static void planar_yuv_read_line(const struct vkms_plan= e_state *plane, int x_sta const struct conversion_matrix *conversion_matrix =3D &plane->conversion_= matrix; =20 for (int i =3D 0; i < count; i++) { - *out_pixel =3D argb_u16_from_yuv888(*y_plane, *channel_1_plane, *channel= _2_plane, - conversion_matrix); + *out_pixel =3D argb_u16_from_yuv161616(conversion_matrix, + *y_plane * 257, *channel_1_plane * 257, + *channel_2_plane * 257); out_pixel +=3D 1; y_plane +=3D step_y; if ((i + subsampling_offset + 1) % subsampling =3D=3D 0) { diff --git a/drivers/gpu/drm/vkms/vkms_formats.h b/drivers/gpu/drm/vkms/vkm= s_formats.h index b4fe62ab9c65..eeb208cdd6b1 100644 --- a/drivers/gpu/drm/vkms/vkms_formats.h +++ b/drivers/gpu/drm/vkms/vkms_formats.h @@ -14,8 +14,8 @@ void get_conversion_matrix_to_argb_u16(u32 format, enum d= rm_color_encoding encod struct conversion_matrix *matrix); =20 #if IS_ENABLED(CONFIG_KUNIT) -struct pixel_argb_u16 argb_u16_from_yuv888(u8 y, u8 channel_1, u8 channel_= 2, - const struct conversion_matrix *matrix); +struct pixel_argb_u16 argb_u16_from_yuv161616(const struct conversion_matr= ix *matrix, + u16 y, u16 channel_1, u16 channel_2); #endif =20 #endif /* _VKMS_FORMATS_H_ */ --=20 2.49.0 From nobody Wed Oct 8 02:17:13 2025 Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) (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 29AAA72632 for ; Thu, 3 Jul 2025 07:57:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751529454; cv=none; b=A69h+ygHXwJCqBsJ6L7jTzAshzDsl0QCoCT2GYyorx8ahsjAeRF4D4KAVZiBw3rcm4DRbh+rEhMKHIbmzv2B3EYsQhP1/FfHWE6RHzMjxN+oz/PdtyHyfGvJLS9eBr7AhLxFZo91j4PkLUv/KmTUqyT3wRp+vjgNU2ipom0OaVE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751529454; c=relaxed/simple; bh=khezg3IIj7MvmXFuSB7KEBFnDPEBFKcJXKf/c6rTKr8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Jg5NYs93U3taqqXok5P66mM0G2tBn9/0B4iUrY7C4i3S73n5DWmdWtUrsypKxXyjLBewrZyzCFMqDtsQhT8zSMYyWu3WXxioB0+2XRnbDrj8s5rLI6B9myi/tOzyBtM2gvXVHgHUVNhhkl6rUrRWW53aAt/nejzanOEidFljaF8= 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=Hfesy4Bs; arc=none smtp.client-ip=217.70.183.201 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="Hfesy4Bs" Received: by mail.gandi.net (Postfix) with ESMTPSA id A66E144499; Thu, 3 Jul 2025 07:57:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1751529450; 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=T2R1cUmcFf+ifCuobfbCjYsZ1SxCHAqephrzxhWkXK8=; b=Hfesy4BsmKLsllxnIAp9RJCElsono+Ia/FbreQij8jZ28Nxvnp6jj3EcbW6ZZHgtK84jLg oAnR0R1RY5fmzyD+QyJj5eb2ACRE7UR5l+FP0Wn7sb7fvbQ7fzmS8vZ33VG/Uj4clSsQmy IduaAHBZykJculleiKFcwDg8yTimDpbLAWCQOoBkJGPn4rK4n7SCWVv448oT88TsxmY8dJ JoGtrBo+yKk3Q8EgUWNVL5rZlyV+my1vGSyY4pL+HVmqSgYpFfgor3NatIcoVyg1A4sOq3 enMB0ZZQYp8/j/3fHOBCGg5sG/B6XHbEPb92sw2MXXo58PxiAOWUz2a5qE29Ug== From: Louis Chauvet Date: Thu, 03 Jul 2025 09:57:03 +0200 Subject: [PATCH v7 7/8] drm/vkms: Create helper macro for YUV formats 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: <20250703-b4-new-color-formats-v7-7-15fd8fd2e15c@bootlin.com> References: <20250703-b4-new-color-formats-v7-0-15fd8fd2e15c@bootlin.com> In-Reply-To: <20250703-b4-new-color-formats-v7-0-15fd8fd2e15c@bootlin.com> To: Melissa Wen , =?utf-8?q?Ma=C3=ADra_Canal?= , Haneen Mohammed , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Rodrigo Siqueira , Simona Vetter Cc: dri-devel@lists.freedesktop.org, arthurgrillo@riseup.net, linux-kernel@vger.kernel.org, jeremie.dautheribes@bootlin.com, miquel.raynal@bootlin.com, thomas.petazzoni@bootlin.com, seanpaul@google.com, nicolejadeyee@google.com, Louis Chauvet , =?utf-8?q?Ma=C3=ADra_Canal?= X-Mailer: b4 0.15-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=5259; i=louis.chauvet@bootlin.com; h=from:subject:message-id; bh=khezg3IIj7MvmXFuSB7KEBFnDPEBFKcJXKf/c6rTKr8=; b=owEBbQKS/ZANAwAIASCtLsZbECziAcsmYgBoZjfhFkIrR63g/XwFXy5WLy/58X/RmRSka/tyl dXCTwio37GJAjMEAAEIAB0WIQRPj7g/vng8MQxQWQQgrS7GWxAs4gUCaGY34QAKCRAgrS7GWxAs 4n6xD/42k3EQJfLshgIYBvWL4zgd+6pleNf7ZuSXaXvOrouh+W2AzAWY9TLymP89yjBRvsj+v87 EM1fuEVfcqRyMUBnpO4Ku1Gtjpi/gfhvuITm83LuFV9omBOjvcXR8o9T9TQ/w7ZWxmOKJp8xtEZ HfrksjoTWfo2lC85r0PGnZ6x47oEGx7xiHR/IwCgSC2n6lIXnOVYKZDXmYupUNwa4Fn+8TxoGMS pGe92qKKLxUCm/NijkJU37ygCL95xIACcS1ss1NKqTomQ+WJVbzGEvG46weKjb44jcTgkKfCrR7 HLMhVP9Pyyp0XpILc/d/TXNL+S81dSDKCxxT3oxDTr+uyTdxT8O+Luc88xs1tiXrPRcYl9E11+k mTVZyeyeGdd9Jfhs2sOn6FXy5FAQgj88Ys/TwJiEffC/mmQ0Db1FSAbX37/2o6ozRt7JDmlCJ72 nqFrtD+qq4v51ir9yNAlGdZDBDFrCNICa5IsRWQfZJ+mQ+jSjV/By1RfKuT3IL+deItJUGwrm76 HWCxyNVg1gdMR3G8kuoqq1eMWktDFjTXS4jPHP6ZxRXIcfxZMXJ/nLibl/tXtgNNtVUCuJmS6Zg h13l2V1eTTDewzPkart9wd4/sV1O+rF/FA+FlruwkEHmhJ/xRU25w0Mlm50n9Hc20Co1VcWZQKK X59CsvjpXRp4B3A== X-Developer-Key: i=louis.chauvet@bootlin.com; a=openpgp; fpr=8B7104AE9A272D6693F527F2EC1883F55E0B40A5 X-GND-State: clean X-GND-Score: -100 X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgdduleejfecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfitefpfffkpdcuggftfghnshhusghstghrihgsvgenuceurghilhhouhhtmecufedtudenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephfffufggtgfgkfhfjgfvvefosehtkeertdertdejnecuhfhrohhmpefnohhuihhsucevhhgruhhvvghtuceolhhouhhishdrtghhrghuvhgvthessghoohhtlhhinhdrtghomheqnecuggftrfgrthhtvghrnheptdeiveeiudehtddtgfethfduudefffduteekgeevueetudevheehieevtddttdeknecukfhppeeltddrkeelrdduieefrdduvdejnecuvehluhhsthgvrhfuihiivgepheenucfrrghrrghmpehinhgvthepledtrdekledrudeifedruddvjedphhgvlhhopegludelvddrudeikedrtddrvddtngdpmhgrihhlfhhrohhmpehlohhuihhsrdgthhgruhhvvghtsegsohhothhlihhnrdgtohhmpdhnsggprhgtphhtthhopedvtddprhgtphhtthhopehsihhmohhnrgesfhhffihllhdrtghhpdhrtghpthhtohephhgrmhhohhgrmhhmvggurdhsrgesghhmrghilhdrtghomhdprhgtphhtthhopehsvggrnhhprghulhesghhoohhglhgvrdgtohhmpdhrtghpthhtohepmhgvlhhishhsrgdrshhrfiesghhmrghilhdrtghomhdprhgtphhtthhopehnihgtohhlvghjrgguvgihvggvsehgohhoghhlvgdrtghomhdprhgtp hhtthhopegrihhrlhhivggusehgmhgrihhlrdgtohhmpdhrtghpthhtoheprghrthhhuhhrghhrihhllhhosehrihhsvghuphdrnhgvthdprhgtphhtthhopehthhhomhgrshdrphgvthgriiiiohhnihessghoohhtlhhinhdrtghomh X-GND-Sasl: louis.chauvet@bootlin.com The callback functions for line conversion are almost identical for semi-planar formats. The generic READ_LINE_YUV_SEMIPLANAR macro generate all the required boilerplate to process a line from a semi-planar format. Reviewed-by: Ma=C3=ADra Canal Signed-off-by: Louis Chauvet Acked-by: Daniel Stone --- drivers/gpu/drm/vkms/vkms_formats.c | 75 ++++++++++++++++++++++++---------= ---- 1 file changed, 48 insertions(+), 27 deletions(-) diff --git a/drivers/gpu/drm/vkms/vkms_formats.c b/drivers/gpu/drm/vkms/vkm= s_formats.c index cec27a72bc48..639b1c7ca43e 100644 --- a/drivers/gpu/drm/vkms/vkms_formats.c +++ b/drivers/gpu/drm/vkms/vkms_formats.c @@ -479,35 +479,56 @@ READ_LINE(R8_read_line, px, u8, argb_u16_from_gray8, = *px) * - Convert YUV and YVU with the same function (a column swap is needed w= hen setting up * plane->conversion_matrix) */ -static void semi_planar_yuv_read_line(const struct vkms_plane_state *plane= , int x_start, - int y_start, enum pixel_read_direction direction, int count, - struct pixel_argb_u16 out_pixel[]) -{ - u8 *y_plane; - u8 *uv_plane; - - packed_pixels_addr_1x1(plane->frame_info, x_start, y_start, 0, - &y_plane); - packed_pixels_addr_1x1(plane->frame_info, - x_start / plane->frame_info->fb->format->hsub, - y_start / plane->frame_info->fb->format->vsub, 1, - &uv_plane); - int step_y =3D get_block_step_bytes(plane->frame_info->fb, direction, 0); - int step_uv =3D get_block_step_bytes(plane->frame_info->fb, direction, 1); - int subsampling =3D get_subsampling(plane->frame_info->fb->format, direct= ion); - int subsampling_offset =3D get_subsampling_offset(direction, x_start, y_s= tart); - const struct conversion_matrix *conversion_matrix =3D &plane->conversion_= matrix; =20 - for (int i =3D 0; i < count; i++) { - *out_pixel =3D argb_u16_from_yuv161616(conversion_matrix, y_plane[0] * 2= 57, - uv_plane[0] * 257, uv_plane[1] * 257); - out_pixel +=3D 1; - y_plane +=3D step_y; - if ((i + subsampling_offset + 1) % subsampling =3D=3D 0) - uv_plane +=3D step_uv; - } +/** + * READ_LINE_YUV_SEMIPLANAR() - Generic generator for a read_line function= which can be used for yuv + * formats with two planes and block_w =3D=3D block_h =3D=3D 1. + * + * @function_name: Function name to generate + * @pixel_1_name: temporary pixel name for the first plane used in the @__= VA_ARGS__ parameters + * @pixel_2_name: temporary pixel name for the second plane used in the @_= _VA_ARGS__ parameters + * @pixel_1_type: Used to specify the type you want to cast the pixel poin= ter on the plane 1 + * @pixel_2_type: Used to specify the type you want to cast the pixel poin= ter on the plane 2 + * @callback: Callback to call for each pixels. This function should take + * (struct conversion_matrix*, @__VA_ARGS__) as parameter and r= eturn a pixel_argb_u16 + * __VA_ARGS__: Argument to pass inside the callback. You can use @pixel_1= _name and @pixel_2_name + * to access current pixel values + */ +#define READ_LINE_YUV_SEMIPLANAR(function_name, pixel_1_name, pixel_2_name= , pixel_1_type, \ + pixel_2_type, callback, ...) \ +static void function_name(const struct vkms_plane_state *plane, int x_star= t, \ + int y_start, enum pixel_read_direction direction, int count, \ + struct pixel_argb_u16 out_pixel[]) \ +{ \ + u8 *plane_1; \ + u8 *plane_2; \ + \ + packed_pixels_addr_1x1(plane->frame_info, x_start, y_start, 0, \ + &plane_1); \ + packed_pixels_addr_1x1(plane->frame_info, \ + x_start / plane->frame_info->fb->format->hsub, \ + y_start / plane->frame_info->fb->format->vsub, 1, \ + &plane_2); \ + int step_1 =3D get_block_step_bytes(plane->frame_info->fb, direction, 0);= \ + int step_2 =3D get_block_step_bytes(plane->frame_info->fb, direction, 1);= \ + int subsampling =3D get_subsampling(plane->frame_info->fb->format, direct= ion); \ + int subsampling_offset =3D get_subsampling_offset(direction, x_start, y_s= tart); \ + const struct conversion_matrix *conversion_matrix =3D &plane->conversion_= matrix; \ + \ + for (int i =3D 0; i < count; i++) { \ + pixel_1_type *(pixel_1_name) =3D (pixel_1_type *)plane_1; \ + pixel_2_type *(pixel_2_name) =3D (pixel_2_type *)plane_2; \ + *out_pixel =3D (callback)(conversion_matrix, __VA_ARGS__); \ + out_pixel +=3D 1; \ + plane_1 +=3D step_1; \ + if ((i + subsampling_offset + 1) % subsampling =3D=3D 0) \ + plane_2 +=3D step_2; \ + } \ } =20 +READ_LINE_YUV_SEMIPLANAR(YUV888_semiplanar_read_line, y, uv, u8, u8, argb_= u16_from_yuv161616, + y[0] * 257, uv[0] * 257, uv[1] * 257) + /* * This callback can be used for YUV format where each color component is * stored in a different plane (often called planar formats). It will @@ -703,7 +724,7 @@ pixel_read_line_t get_pixel_read_line_function(u32 form= at) case DRM_FORMAT_NV21: case DRM_FORMAT_NV61: case DRM_FORMAT_NV42: - return &semi_planar_yuv_read_line; + return &YUV888_semiplanar_read_line; case DRM_FORMAT_YUV420: case DRM_FORMAT_YUV422: case DRM_FORMAT_YUV444: --=20 2.49.0 From nobody Wed Oct 8 02:17:13 2025 Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) (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 2082429CB48 for ; Thu, 3 Jul 2025 07:57:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751529454; cv=none; b=dvK8yU7J3wRVJNfPOOxvFLHCmc1CnKdF9yNKey5e+1N/DOjzsfgX0XweANXBpp+1+w2P3+ktNnpJNqqTq14TKxEcdg+7/3Wf1rzE2WqYvN2/B5IyIiBEx6s6bjftrxtHW3vWRtT8okiwooQ63V5CDdx3iULggbODvGuNomld4Zs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751529454; c=relaxed/simple; bh=uQQHQYQIw4RBCW8Vz94HnWCi8QMQdtxZuBnFdJ9YykE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=TQGh8fD+O4dmt0MJXNO4RxF0GMpjuEiQAA0UfUp2u8u3sP4P6myL/O2DP4St4c0kDP1jCMjmklQT+Jjd6eGyKe443+LVHrbMlGGYwM9JnJs+Xv42MgjcaNE4KfCPQGPbEYRg4EHpHx65ug0T9F7YqvnhCppyHfdjhNn5xAvUQWI= 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=T89C8O6X; arc=none smtp.client-ip=217.70.183.201 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="T89C8O6X" Received: by mail.gandi.net (Postfix) with ESMTPSA id 95B4144475; Thu, 3 Jul 2025 07:57:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1751529451; 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=1vQA45G32qMp9GLNf8KAtKTtoKGWXKQZw0z0jKrghQ0=; b=T89C8O6X5Dh0tJCvHg8ZXvT7N0G6bvxh9xFPZgOh0rA08EVWzS/lF0URpfxLWJOsrahZ0n t6mrJXsUCQtZmUra28M0EmMIRSAKEg9BBSI+rBbWluCyNjon0BMYH9oL4fwQUkMlKHralg 7DKQPlYGw4Y436vHqRF0m+BJplOuu1pjmp0coqNXGdHAiSA9rfSukcrJxyCUx9zmLfAU7P pkisBU96aEJDdy1wh1Y5EUT+AaDgz0YvdjDHTyLH0KoTObAdIYf6Ta+RL5pE0cVERvMUFw vp0lPQdzQdi8yznArEPHflbGz3LgLKTtflzaIw/CFdIgj51XOF38s/tFV53JwQ== From: Louis Chauvet Date: Thu, 03 Jul 2025 09:57:04 +0200 Subject: [PATCH v7 8/8] drm/vkms: Add P01* formats 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: <20250703-b4-new-color-formats-v7-8-15fd8fd2e15c@bootlin.com> References: <20250703-b4-new-color-formats-v7-0-15fd8fd2e15c@bootlin.com> In-Reply-To: <20250703-b4-new-color-formats-v7-0-15fd8fd2e15c@bootlin.com> To: Melissa Wen , =?utf-8?q?Ma=C3=ADra_Canal?= , Haneen Mohammed , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Rodrigo Siqueira , Simona Vetter Cc: dri-devel@lists.freedesktop.org, arthurgrillo@riseup.net, linux-kernel@vger.kernel.org, jeremie.dautheribes@bootlin.com, miquel.raynal@bootlin.com, thomas.petazzoni@bootlin.com, seanpaul@google.com, nicolejadeyee@google.com, Louis Chauvet , =?utf-8?q?Ma=C3=ADra_Canal?= X-Mailer: b4 0.15-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=1932; i=louis.chauvet@bootlin.com; h=from:subject:message-id; bh=uQQHQYQIw4RBCW8Vz94HnWCi8QMQdtxZuBnFdJ9YykE=; b=owEBbQKS/ZANAwAIASCtLsZbECziAcsmYgBoZjfhEhvNHyvro+IbgXwjjFAE1jhw7tyg9GgXl X++oCrFRjiJAjMEAAEIAB0WIQRPj7g/vng8MQxQWQQgrS7GWxAs4gUCaGY34QAKCRAgrS7GWxAs 4lLvEADIcoG1wEQJH1/wjswnyMbxpsFo/hyuC3ml4ZpvrFnNsPp5NgkbUSqhbTa5G9rf4Y6uN1O puvavazQr8UU5IKJ+pnqWQ/OBfrR2E/g52MxMa0CnL7IRx+NcaBTr2amQ3ktakar9WVcbURnNVa 4Q+sdIoE9ilDt2bp3mVbtuGaoDRkIhbXRifN5e7bp9DXXCLqtqCzD4DP/UwlGLFx3j5JjC8kA+E nB0JRE0obLVVHxTYuUij+sWnQmqIIkP4LrEvZ5g4/kMGFgo+keBx+BmVXBlRqDgKKDw5B8s6jJV kZkxYjoEjFrh/v9+9+BrOY/B/h4KFTcvk046yQCAFbObFH05U331ev7aeEKaUIE33mxGHoE1/Rh FNTBHcqg3ISZQFpcy23ZjamcF/KsSQHsdhU8FGYuGaX63n62wUhvX3VU6ppAYRs0ORiLtmIlrXR Bd/rzm4EuVY0OP2Mb0Vf/RT25r+ZrONB1j6OYgLj/E0VgcDHizAvc3gdyyQzxVJZrhar+F9VGHJ 3oNa1G88rYi0LdPSjfUNE4d15Evmk8lp4hvnS0DM7tjkKS+SqzlhVwsHv252cW4W9AJh3O1ETwz H1S67/s5L1nqhn/bdFo8HBJyiTi0GfinXkz+5EWUYrhoPo7HpwP/NxNEwMsMImSWdKjp5HgzyYZ pYNQyOqEk6Xnsow== X-Developer-Key: i=louis.chauvet@bootlin.com; a=openpgp; fpr=8B7104AE9A272D6693F527F2EC1883F55E0B40A5 X-GND-State: clean X-GND-Score: -100 X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgdduleejfecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfitefpfffkpdcuggftfghnshhusghstghrihgsvgenuceurghilhhouhhtmecufedtudenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephfffufggtgfgkfhfjgfvvefosehtkeertdertdejnecuhfhrohhmpefnohhuihhsucevhhgruhhvvghtuceolhhouhhishdrtghhrghuvhgvthessghoohhtlhhinhdrtghomheqnecuggftrfgrthhtvghrnheptdeiveeiudehtddtgfethfduudefffduteekgeevueetudevheehieevtddttdeknecukfhppeeltddrkeelrdduieefrdduvdejnecuvehluhhsthgvrhfuihiivgepheenucfrrghrrghmpehinhgvthepledtrdekledrudeifedruddvjedphhgvlhhopegludelvddrudeikedrtddrvddtngdpmhgrihhlfhhrohhmpehlohhuihhsrdgthhgruhhvvghtsegsohhothhlihhnrdgtohhmpdhnsggprhgtphhtthhopedvtddprhgtphhtthhopehsihhmohhnrgesfhhffihllhdrtghhpdhrtghpthhtohephhgrmhhohhgrmhhmvggurdhsrgesghhmrghilhdrtghomhdprhgtphhtthhopehsvggrnhhprghulhesghhoohhglhgvrdgtohhmpdhrtghpthhtohepmhgvlhhishhsrgdrshhrfiesghhmrghilhdrtghomhdprhgtphhtthhopehnihgtohhlvghjrgguvgihvggvsehgohhoghhlvgdrtghomhdprhgtp hhtthhopegrihhrlhhivggusehgmhgrihhlrdgtohhmpdhrtghpthhtoheprghrthhhuhhrghhrihhllhhosehrihhsvghuphdrnhgvthdprhgtphhtthhopehthhhomhgrshdrphgvthgriiiiohhnihessghoohhtlhhinhdrtghomh X-GND-Sasl: louis.chauvet@bootlin.com The formats NV 12/16/24/21/61/42 were already supported. Add support for: - P010 - P012 - P016 Reviewed-by: Ma=C3=ADra Canal Signed-off-by: Louis Chauvet Acked-by: Daniel Stone --- drivers/gpu/drm/vkms/vkms_formats.c | 7 ++++++- drivers/gpu/drm/vkms/vkms_plane.c | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/vkms/vkms_formats.c b/drivers/gpu/drm/vkms/vkm= s_formats.c index 639b1c7ca43e..dfb8e13cba87 100644 --- a/drivers/gpu/drm/vkms/vkms_formats.c +++ b/drivers/gpu/drm/vkms/vkms_formats.c @@ -528,7 +528,8 @@ static void function_name(const struct vkms_plane_state= *plane, int x_start, \ =20 READ_LINE_YUV_SEMIPLANAR(YUV888_semiplanar_read_line, y, uv, u8, u8, argb_= u16_from_yuv161616, y[0] * 257, uv[0] * 257, uv[1] * 257) - +READ_LINE_YUV_SEMIPLANAR(YUV161616_semiplanar_read_line, y, uv, u16, u16, = argb_u16_from_yuv161616, + y[0], uv[0], uv[1]) /* * This callback can be used for YUV format where each color component is * stored in a different plane (often called planar formats). It will @@ -725,6 +726,10 @@ pixel_read_line_t get_pixel_read_line_function(u32 for= mat) case DRM_FORMAT_NV61: case DRM_FORMAT_NV42: return &YUV888_semiplanar_read_line; + case DRM_FORMAT_P010: + case DRM_FORMAT_P012: + case DRM_FORMAT_P016: + return &YUV161616_semiplanar_read_line; case DRM_FORMAT_YUV420: case DRM_FORMAT_YUV422: case DRM_FORMAT_YUV444: diff --git a/drivers/gpu/drm/vkms/vkms_plane.c b/drivers/gpu/drm/vkms/vkms_= plane.c index 9f34f3a18d8c..e592e47a5736 100644 --- a/drivers/gpu/drm/vkms/vkms_plane.c +++ b/drivers/gpu/drm/vkms/vkms_plane.c @@ -39,6 +39,9 @@ static const u32 vkms_formats[] =3D { DRM_FORMAT_YVU420, DRM_FORMAT_YVU422, DRM_FORMAT_YVU444, + DRM_FORMAT_P010, + DRM_FORMAT_P012, + DRM_FORMAT_P016, DRM_FORMAT_R1, DRM_FORMAT_R2, DRM_FORMAT_R4, --=20 2.49.0