From nobody Wed Oct 8 13:21:51 2025 Received: from relay16.mail.gandi.net (relay16.mail.gandi.net [217.70.178.236]) (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 496F2271464 for ; Fri, 27 Jun 2025 09:12:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.178.236 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751015579; cv=none; b=eUq0c9oEY/G21OeaMLs/8G8ek423nikvImjPmGYAHqXal6cjF9u/mEJe3UhUH2WSDSS//PJqQHjyLadiKIWUWARd94yPueVZWxRf+ukoc9CUwCJWqkqLdMkg/t+nNAfW69jkkO/YEGAttwREn9B1QMRP6qXmk4f+dQpRonTmhYI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751015579; c=relaxed/simple; bh=kz3Mv5c+ZujUHwIVAV2E1O+yPOWW7obed0JJxkIZjbs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=bDQM3NrGGAh3px6+yqn2oPBYYeB8KplUgTIQMchecrn9SS2B6sfwUKxr5sDsyUuz/d7xSE71tuAdGks2MUTr9kkcIoCwCBcNkQuk/18X2fJUTVcFEG5Qz+Ax4jQkVVdgYuZcxhxdTWnF1QwzAZ1qbV+/ZM7ihVLcSIPZ3vRF9i4= 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=Kd0BBwa5; arc=none smtp.client-ip=217.70.178.236 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="Kd0BBwa5" Received: by mail.gandi.net (Postfix) with ESMTPSA id 3ADF243896; Fri, 27 Jun 2025 09:12:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1751015570; 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=uogAM4+ZOSKk76SXJda0LnVy0gMOOnK8hPopxGpta3E=; b=Kd0BBwa5IoqwNolfDqCu70MC48wyvhyzfE36KJXmc/ePWrrlPfjSUFrDv3hRjsN6wBAB6w DF0hOKXBwauvzf0jfjczMuhp1S/y3wIka2VmPxKrnvPgo6BQA4xNl7wdvbwipQsLgtMXZD GdfSt+ZNMHQM1JPJsbtuT7N+UuToNhUQJ0eeQ2+yKHGaMJy4tBLtNNwEMP4tPonqL8er3r 77GFbt+4A/x1EjCyQTKc0UBkTENDmrg3QkpCQ0EyNjzXl7Dr4h+CVeEfErGSTtwTmfEZ5W 5KoGFqEKm8zQW8fq8dlimqiJzUY7C13GGg4JPQcNVrRQBNnLXms8qwluHu7Oiw== From: Louis Chauvet Date: Fri, 27 Jun 2025 11:12:32 +0200 Subject: [PATCH v5 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: <20250627-b4-new-color-formats-v5-1-94452f119c72@bootlin.com> References: <20250627-b4-new-color-formats-v5-0-94452f119c72@bootlin.com> In-Reply-To: <20250627-b4-new-color-formats-v5-0-94452f119c72@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=8563; i=louis.chauvet@bootlin.com; h=from:subject:message-id; bh=kz3Mv5c+ZujUHwIVAV2E1O+yPOWW7obed0JJxkIZjbs=; b=owEBbQKS/ZANAwAIASCtLsZbECziAcsmYgBoXmCLCWTinwuSpnni29jdcdQz+bKXFLHR71vhq 7wtcxL3iQWJAjMEAAEIAB0WIQRPj7g/vng8MQxQWQQgrS7GWxAs4gUCaF5giwAKCRAgrS7GWxAs 4gGID/9JPj3y1nT4dGqBUTmXFdFEO51ICbLFcVgKloUXYRSLe2bRPT1Ie73VxiGCgqafjL7ohU4 ZB6nM03mNgz9aZ+1PcvM13KCwfj6coWesYAn2VC0E/0hioH20C43TxyOQ7dik3uMjqK6g5HG+73 AWwJssTfBWJ03g3Wi6wTmS4xcyLY4rm2YA02KUoVO38DOXwPpD+JMIB6Gn9oy3jsIXcHb7JsUDk iqT1md8Spwbl5jKF129VHALLWiNUxnQLsO+YOvKbrmi8Bn9ix0hZWGMe44piDJABT5bRtOMKpxc sdsLGoR8e3vURBeXfRri24GX4gMCb9HsS1/R0iUA3/KnGDDmDLurwx7HxGGCCXvhIkdEyFmqQ4V 9EIPVkLIR7zIjkH7j6YPGwNmCfrLNhEjOOtuZwf5Ik1C5DVscjX/eVHRk0oKre890SRFabGVTlR YuBC+ss1WcVnUxUZqC+Hbrj33VpzHdbyi2sQWQMVn6NOn08lJ+ZolwnPtpd3oG02Xt3nbjVyrmp SY0vVJxYSSkeB/lBkUNJQLj/Cm9fFiP5O5Lm5kK4YUVE1vM6aEGH1mKi704dx2V8Kc0QD0Eb+BY kHI14Us5PUsHC99k3ibwUmHzsLqz7gxoz+675IbE8TPAO2jamJgIN30Nu7zRzXTDrvZqem6U9Xk +1iHJPeyJTamz1w== X-Developer-Key: i=louis.chauvet@bootlin.com; a=openpgp; fpr=8B7104AE9A272D6693F527F2EC1883F55E0B40A5 X-GND-State: clean X-GND-Score: -100 X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgddvieeiucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuifetpfffkfdpucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddunecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhfffugggtgffkfhgjvfevofesthekredtredtjeenucfhrhhomhepnfhouhhishcuvehhrghuvhgvthcuoehlohhuihhsrdgthhgruhhvvghtsegsohhothhlihhnrdgtohhmqeenucggtffrrghtthgvrhhnpedtieevieduhedttdfgtefhuddufeffudetkeegveeuteduveehheeivedttddtkeenucfkphepledtrdekledrudeifedruddvjeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeeltddrkeelrdduieefrdduvdejpdhhvghloheplgduledvrdduieekrdegvddrieejngdpmhgrihhlfhhrohhmpehlohhuihhsrdgthhgruhhvvghtsegsohhothhlihhnrdgtohhmpdhnsggprhgtphhtthhopedvtddprhgtphhtthhopehmrghirhgrtggrnhgrlhesrhhishgvuhhprdhnvghtpdhrtghpthhtohepshhiqhhuvghirhgrsehighgrlhhirgdrtghomhdprhgtphhtthhopegrrhhthhhurhhgrhhilhhlohesrhhishgvuhhprdhnvghtpdhrtghpthhtohepmhhrihhprghrugeskhgvrhhnvghlrdhorhhgpdhrtghpthhtohepthiiihhmmhgvrhhmrghnnhesshhushgvrdguvgdprhgtphhtt hhopehsihhmohhnrgesfhhffihllhdrtghhpdhrtghpthhtoheplhhouhhishdrtghhrghuvhgvthessghoohhtlhhinhdrtghomhdprhgtphhtthhopehjvghrvghmihgvrdgurghuthhhvghrihgsvghssegsohhothhlihhnrdgtohhm 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 --- drivers/gpu/drm/vkms/vkms_formats.c | 186 ++++++++++++--------------------= ---- 1 file changed, 59 insertions(+), 127 deletions(-) diff --git a/drivers/gpu/drm/vkms/vkms_formats.c b/drivers/gpu/drm/vkms/vkm= s_formats.c index 6d0227c6635a..a9c624081dac 100644 --- a/drivers/gpu/drm/vkms/vkms_formats.c +++ b/drivers/gpu/drm/vkms/vkms_formats.c @@ -292,6 +292,58 @@ 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_= name 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, @r, @g, @b: value of each channel + */ +#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, @r, @g, @b: value of each channel + */ +#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 +430,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 13:21:51 2025 Received: from relay16.mail.gandi.net (relay16.mail.gandi.net [217.70.178.236]) (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 7C8AE299952 for ; Fri, 27 Jun 2025 09:12:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.178.236 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751015580; cv=none; b=SHEoMnRFqyfj0tFdXYgNHqy4OqvCGr7U8uPPBZL+K7k+dt+8tAIJQMu46IIsL5/DXrMROX5kguuMu/hLumVEzgB33/TLnxzVdK2p4Kv3xc4iiBrtu4RYMO7QanaR6yA0mRepFtFLTfQrTmpEDJyzTNXTEiJFeoKG2b8wVMD4pao= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751015580; c=relaxed/simple; bh=VluQZsu6hTa2k+QlWONlhO7+C7gKk5KEXpvKGgiQlG4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=jmTc0WEd+pL0n5BH/clDobVismzSRzkOXRRwqau0/NQkUKaPOhF2eHDrPdXjK8v0gEMEE5qvR2m1B+s+u23zhaJBa1uHgcAg2hV78VvddRp5L9tAi1s0eD5PbApSUYHVmmugpjdwKL5S6RC6Iz6i8rToej0ZcI7CN//4+5c7bbc= 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=GoDTQxz2; arc=none smtp.client-ip=217.70.178.236 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="GoDTQxz2" Received: by mail.gandi.net (Postfix) with ESMTPSA id 6330D438CE; Fri, 27 Jun 2025 09:12:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1751015571; 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=ZkYzGTzKnCPxgrG7djfdUXqx/RAJvRaE5dNYS/hgmd4=; b=GoDTQxz28A9pL5zDDp7/KGZaR53WHWIvuryBJA7kQhNM4QZV1pmhZ8J7dkV58DZWnSkXTh xPVIKISbpTNyd2obbPK8A/PvXOfUxS4aea5BpM+8x6VXzBiLP+lr6NjrcMIsc0OimAuM23 0sQnSDD5xit+W7yqSX2Xj24v3ttfDKE1mPQZ/VIcufCS2OvMNqMr4RC1r7rqNCx7cGlus6 OUfJ55RaDNvQaqzO4aBPLszGG9LT+okawlyghgk6w9q1IzxfmQR9Jiv9UWb1XjuLDikzu/ eRG9XqJu+1N+9WA7h24eKBsHl617czzggwZ92AHe6GlswzAEQ/Qo9vg8uQElOA== From: Louis Chauvet Date: Fri, 27 Jun 2025 11:12:33 +0200 Subject: [PATCH v5 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: <20250627-b4-new-color-formats-v5-2-94452f119c72@bootlin.com> References: <20250627-b4-new-color-formats-v5-0-94452f119c72@bootlin.com> In-Reply-To: <20250627-b4-new-color-formats-v5-0-94452f119c72@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 X-Mailer: b4 0.15-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=2467; i=louis.chauvet@bootlin.com; h=from:subject:message-id; bh=VluQZsu6hTa2k+QlWONlhO7+C7gKk5KEXpvKGgiQlG4=; b=owEBbQKS/ZANAwAIASCtLsZbECziAcsmYgBoXmCMYJpSPP1kl8SWM9D5a4s3g3mhROxI4sFJx 2nLo0P9R3WJAjMEAAEIAB0WIQRPj7g/vng8MQxQWQQgrS7GWxAs4gUCaF5gjAAKCRAgrS7GWxAs 4hqsD/9Wpm6cdjmTUQnvJTDkkt81EWeUxnLhESpjW2WJuT/MNoRTUSwf/SBHD5hbxEd2NAUtcz2 a2RUe6YkAKnsFuPxVHx3HZkX6Rfwn/SIPH4GtRsfAX/ldOdoYUydHae4PkSesRKZYN7RhavRX5s Kzfk/cD2chB0hBIy8ta2dTvlnlxqp58O7nPvqN/waXmKZckF8GvqYhjUoyG7wzCWILkkxPvtHhO iav5McorffbcrMP0MDvnKGlpTqFZtI+Hn9eTERXVzNJpj/QYdN/wfKINeHET0C5YFwU04hXkKlr 8te3xdDQ+p3GWOxegGIb3XsQD0nqlA/Ax/t5Th2q7xR15w/jaeHDQv3YX65Xo5Ijy30flp7WbTM VCO9EQCRPe83+shWev3t5jqp+ijhieytZgSDwM33fiZv1bBc3FhdTZ6ZczshtYPiolqzoNG0k9T KBID9ujUsrLFslJ0rX83MzFnsPvrMPfLHn1wrCCSBGN7rgqP5jSfcHZ6TOQmx48YF7SHhPo/Gl/ CLD2Kys8Glv3oj+RWo2sfGI/jNF84x5TXdtIZshVcRA4dn1VDHL2TeVdsDFTid36SZ9gaz1HQVY I8V7dknmwoYJtUhM7OQwiWV1TtZ8mnl3L013EpbGbth1+bcV2FjXxwSkrpzh8OfO2XY+enmGnR+ ZeZ8QMrUzBLRHaw== X-Developer-Key: i=louis.chauvet@bootlin.com; a=openpgp; fpr=8B7104AE9A272D6693F527F2EC1883F55E0B40A5 X-GND-State: clean X-GND-Score: -100 X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgddvieeiucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuifetpfffkfdpucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddunecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhfffugggtgffkfhgjvfevofesthejredtredtjeenucfhrhhomhepnfhouhhishcuvehhrghuvhgvthcuoehlohhuihhsrdgthhgruhhvvghtsegsohhothhlihhnrdgtohhmqeenucggtffrrghtthgvrhhnpeehtdejtddtteeiiefgleejkeetteevhfdukeegleffjeehgeeivefhgeduffdvvdenucfkphepledtrdekledrudeifedruddvjeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeeltddrkeelrdduieefrdduvdejpdhhvghloheplgduledvrdduieekrdegvddrieejngdpmhgrihhlfhhrohhmpehlohhuihhsrdgthhgruhhvvghtsegsohhothhlihhnrdgtohhmpdhnsggprhgtphhtthhopeduledprhgtphhtthhopehmrghirhgrtggrnhgrlhesrhhishgvuhhprdhnvghtpdhrtghpthhtohepshhiqhhuvghirhgrsehighgrlhhirgdrtghomhdprhgtphhtthhopegrrhhthhhurhhgrhhilhhlohesrhhishgvuhhprdhnvghtpdhrtghpthhtohepmhhrihhprghrugeskhgvrhhnvghlrdhorhhgpdhrtghpthhtohepthiiihhmmhgvrhhmrghnnhesshhushgvrdguvgdprhgtphhtt hhopehsihhmohhnrgesfhhffihllhdrtghhpdhrtghpthhtoheplhhouhhishdrtghhrghuvhgvthessghoohhtlhhinhdrtghomhdprhgtphhtthhopehjvghrvghmihgvrdgurghuthhhvghrihgsvghssegsohhothhlihhnrdgtohhm The formats XRGB8888 and ARGB8888 were already supported. Add the support for: - XBGR8888 - RGBX8888 - BGRX8888 - ABGR8888 - RGBA8888 - BGRA8888 Signed-off-by: Louis Chauvet Reviewed-by: Ma=C3=ADra Canal --- 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 a9c624081dac..231b327e86b3 100644 --- a/drivers/gpu/drm/vkms/vkms_formats.c +++ b/drivers/gpu/drm/vkms/vkms_formats.c @@ -432,9 +432,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]) @@ -644,10 +647,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 13:21:51 2025 Received: from relay16.mail.gandi.net (relay16.mail.gandi.net [217.70.178.236]) (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 5374529ACCE for ; Fri, 27 Jun 2025 09:12:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.178.236 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751015582; cv=none; b=Jroj1tJCyXoVn9vBftPeOGo6+LaRKHy4f95pn2mn6hEZpDfJ27VHOsCCQItiTKzhzVqdrDYpryugFVQALlgSCAHq5hTmH66zPls7uedbQ8OzuRoZzdWHdGukQBhRLwQbcug3SNiJYtjGBr2SEE6G2QF1TbeMpRw3i3cHAndiEEI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751015582; c=relaxed/simple; bh=eek1CthCd1RvO7Qs2r4Pe4gz/Q4+jCBePgrtnVHKvNE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=KWCSQbkL9dH/pIV/WBsFFkhS87V8I5zHb63eBEXpg7WkxSWeZsz6Oh8IkMI9BdW/KH7HLA+7++cdKBsSme96ktIs+5EaKL3cyXv/9GTFGbydWO96BMrycaM3yUthLv2eKdLwXBszWyBGv7QSO3igvxhwGPyzUV03KvulL+E7mSM= 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=grQjveN9; arc=none smtp.client-ip=217.70.178.236 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="grQjveN9" Received: by mail.gandi.net (Postfix) with ESMTPSA id 9396D438D0; Fri, 27 Jun 2025 09:12:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1751015572; 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=vr0T2pNUq0SPCwrqPVAq1LbhS4QqKuEpfagCHD6VWH8=; b=grQjveN9U/pV6SvlPOus1aXe29fD0EvQusl7JukqKZAozXABQipdzApIuRxiBIkFErBBt5 Z9cld0/2rR71E9hLNTFQbs8QGglYi4vu6z2MCbVYdZiKyDF02qVQ5oSTi3QDWkoI+4Kqs+ b/dLGNtltU2d67CrXWYfN2+FDL70tA6j4SHhLV1Miyu71Uzqd1y4fEN/Gm/4PYH+sWfflI /vV+5CM9ETthm3M7BW11s/iAU83ozwU+nGcxylU8j1g4PcBNYomrhH1JOPLX/A+LQyAPaX cgRF+VwnpZCmXwdGe7JSupugls1Ct4jt6JTm39Bemb7YDpZSRqFL50ljr4G13Q== From: Louis Chauvet Date: Fri, 27 Jun 2025 11:12:34 +0200 Subject: [PATCH v5 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: <20250627-b4-new-color-formats-v5-3-94452f119c72@bootlin.com> References: <20250627-b4-new-color-formats-v5-0-94452f119c72@bootlin.com> In-Reply-To: <20250627-b4-new-color-formats-v5-0-94452f119c72@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=eek1CthCd1RvO7Qs2r4Pe4gz/Q4+jCBePgrtnVHKvNE=; b=owEBbQKS/ZANAwAIASCtLsZbECziAcsmYgBoXmCMK7NeRjkHLIRkq5oYVaSuk7scg4NAjFbKL avuXqVC4zuJAjMEAAEIAB0WIQRPj7g/vng8MQxQWQQgrS7GWxAs4gUCaF5gjAAKCRAgrS7GWxAs 4j5HD/0UeXy/3qzl9Do7DHk/dJ1EQ94gLCSPLXnTZCXhq1rzj+LzuyY9pTE5enl/SaIJMe4H0Jy D2TCWzntAprpF0E1SxDQVgsw2BTJAhi5/AJ9Dh2LxveF86Xa6uzPBBct/qENMK99ZZo+3P/LlNc 8U9fUu+x8uulkgltw6bNYMcTk8ViIvigO1Iu/XlzRpEkGiYbCQgcC/4vqWXgEGix0e0luwDgDYn Xh0f1NqfkT4/um0bYThieZrnIz3vx5JJeLW7aolQ0TAR8Ef+Q3I2WuUZWmVBxVtPVoHLT4UqN6Z YLjv7Cj52cMQzfVKCyQn8rXZ2IlhSog0i6mLFn6Cz1WeBZNwXYkTcVIETdoHV2dykhek0STXxTp P0+vt5tFUsiEI2pGKpqHDo/p0v8ngLkLwXJDj3zMvgcMOD2nStdc00qVz1fjUSM3AO/JJBs8a46 /mH5vhtRGGAfBZmRagyJv97Py2D4L3nALxAGHuLAuk4elVElSq3uBDn6dJRxd7D3YAZAet8qNnV hV/J4s5UxHdWESWIRxM2cOA0RK6SDDJCiDODPgfDkNtEDsK4WIfjwg/OGhhIZTUfWbSWXLE8vjQ wJ3VRJhY70hAe+C0NrSBHxefd6EhPR1Dpp8swHC84KBWICL+Ki5Niuwqq5aB6CWEmzHkPn8kYLs ccMwK5kMYxxPUkw== X-Developer-Key: i=louis.chauvet@bootlin.com; a=openpgp; fpr=8B7104AE9A272D6693F527F2EC1883F55E0B40A5 X-GND-State: clean X-GND-Score: -100 X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgddvieeiucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuifetpfffkfdpucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddunecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhfffugggtgffkfhgjvfevofesthekredtredtjeenucfhrhhomhepnfhouhhishcuvehhrghuvhgvthcuoehlohhuihhsrdgthhgruhhvvghtsegsohhothhlihhnrdgtohhmqeenucggtffrrghtthgvrhhnpedtieevieduhedttdfgtefhuddufeffudetkeegveeuteduveehheeivedttddtkeenucfkphepledtrdekledrudeifedruddvjeenucevlhhushhtvghrufhiiigvpedunecurfgrrhgrmhepihhnvghtpeeltddrkeelrdduieefrdduvdejpdhhvghloheplgduledvrdduieekrdegvddrieejngdpmhgrihhlfhhrohhmpehlohhuihhsrdgthhgruhhvvghtsegsohhothhlihhnrdgtohhmpdhnsggprhgtphhtthhopedvtddprhgtphhtthhopehmrghirhgrtggrnhgrlhesrhhishgvuhhprdhnvghtpdhrtghpthhtohepshhiqhhuvghirhgrsehighgrlhhirgdrtghomhdprhgtphhtthhopegrrhhthhhurhhgrhhilhhlohesrhhishgvuhhprdhnvghtpdhrtghpthhtohepmhhrihhprghrugeskhgvrhhnvghlrdhorhhgpdhrtghpthhtohepthiiihhmmhgvrhhmrghnnhesshhushgvrdguvgdprhgtphhtt hhopehsihhmohhnrgesfhhffihllhdrtghhpdhrtghpthhtoheplhhouhhishdrtghhrghuvhgvthessghoohhtlhhinhdrtghomhdprhgtphhtthhopehjvghrvghmihgvrdgurghuthhhvghrihgsvghssegsohhothhlihhnrdgtohhm 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 --- 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 231b327e86b3..44547f56e4b2 100644 --- a/drivers/gpu/drm/vkms/vkms_formats.c +++ b/drivers/gpu/drm/vkms/vkms_formats.c @@ -440,7 +440,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 @@ -659,8 +661,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 13:21:51 2025 Received: from relay16.mail.gandi.net (relay16.mail.gandi.net [217.70.178.236]) (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 2D9C329AB10 for ; Fri, 27 Jun 2025 09:13:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.178.236 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751015582; cv=none; b=U46b8tXEQXCq1vVBN0pBZcrpl3hC5jOykOHL1cbJjAgsI4DfgN6Rv2VHSlZnCgPxyBPIbCqO9TkSY8foV7tLH59IvRkeMO8RKFM5rFeiQiJj8XzM9grQrBkKWImWhmJSvO4seDqNKaS5Sg9fFYdNPHmiVx9P7DJfAErJs3n5m3I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751015582; c=relaxed/simple; bh=8fXFkUR+Lc1tk8kOkE5sv9OnxPn8iF8vc0Fe038bZOo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=dslhxHmz+R3vhM9s+XEDAYqNAsB+l4PO8//qKmDUJsStVDfWB7T4YR78JYhnwpPHTapTVpMjeSWoDIkVMEScNHB0KelrD0RCvjA9OXOitPfOkY3ocLgkTUkb21ri8bPekCRFWQey4iYkybCOS3wg+oYoQAr3DmZJ+TcyNb6kb44= 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=k2JYZRMS; arc=none smtp.client-ip=217.70.178.236 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="k2JYZRMS" Received: by mail.gandi.net (Postfix) with ESMTPSA id 9DA13438D5; Fri, 27 Jun 2025 09:12:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1751015573; 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=r6olnAzZt8q6c0vxZagmakWT4mAYlJndaPLBUR1ASfw=; b=k2JYZRMS3N3ZmeEMtgDCNkdwgV4jmgZ45jfN/cvpukMIEayjvT9e2iswamBIdZXtUW9Fs7 N8Bo9tHaZPnBQEHfZuEZmU547BgcmXBBGeETIltByWMFEtrwJFOhpQBPMChrmKTbV/xJzE FKJ9SBDkmT0z9nBsB7xWUxzxTfRoXL5NohbSudoR/MgDbxsIHy5J+h98TMEQ/5twTtSB5T TTMO5IAguH06a7V7TM4WJ3AgMIqW9qpzaW0wsR9rdmzSxjIxDUaL14N3sdUNmYivn47PJp 5bbmTS732w10WJzpbAjFNzuy3POsFMxA5ROYxueLrduOPnt7CrZ0P85bgYwS3g== From: Louis Chauvet Date: Fri, 27 Jun 2025 11:12:35 +0200 Subject: [PATCH v5 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: <20250627-b4-new-color-formats-v5-4-94452f119c72@bootlin.com> References: <20250627-b4-new-color-formats-v5-0-94452f119c72@bootlin.com> In-Reply-To: <20250627-b4-new-color-formats-v5-0-94452f119c72@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=8fXFkUR+Lc1tk8kOkE5sv9OnxPn8iF8vc0Fe038bZOo=; b=owEBbQKS/ZANAwAIASCtLsZbECziAcsmYgBoXmCMG+QNArV9IHi1DefOQTUyn/g1vwzRZ31GT gJ3mTNFRUOJAjMEAAEIAB0WIQRPj7g/vng8MQxQWQQgrS7GWxAs4gUCaF5gjAAKCRAgrS7GWxAs 4vyPEACrGi6cX3z40PnG6w5c3u74+dUq8cOBVPYC5HDUeduGlK5wT3BI9Wb4u1nQUHVAyE9MjPa FbBTX1D7JcriRWgyoE7Ta049Tczw8ZmDVQZ/IxnojndlPNsDAa36GEZR/W0FnmIQH7ROoPrPxWt e+xR9tY7xB71R5sL9bTiEP1QVBgWiusGUuCcE0ofleDIi6i1gpjLaW27rom5g86ROOifRzadlKh 0Vqkpc8tgBiN0ydIpRi+7lP+dxIo3tWXc19VLyI6yUNbb6+THA6ZY7rOwqrCPvuEEbUFUvwrgj8 nCi8iaYQJE87n+e2Sx52f7GMZku7e9NBXGSmgeMdDRAosU5u6UXELFrHpo0llp57pQWtTXBBb0/ a9IrUG0XMJ70RhcRUSQ2Mo7lrtaOJIy6W6bgU9RRqsmlFxG1VHaKU8M86IAxHXv2tvo6FAqx/VJ iHIR8Uj3wqEmjUb4+O9xUD/LaDu9zYwUCUBqpT9M5lReViLoMiaa++imVwIw2BGPRooEmPJgYHy YmTX2fMoBQJf/l/du3h4fl68SjPZyFFZFTqCohxZshKffiHlh5cuFEwalpFuwXPOAaYoZ0bvERL Ixe4Pif/SaFzUZGyeepQr8angKF0aDm8SdANsDLT9tu4G/ZF0HidTQQwT6u9NI/nmhZq1BeQVHE 9A5ZCzke6Mg1rug== X-Developer-Key: i=louis.chauvet@bootlin.com; a=openpgp; fpr=8B7104AE9A272D6693F527F2EC1883F55E0B40A5 X-GND-State: clean X-GND-Score: -100 X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgddvieeiucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuifetpfffkfdpucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddunecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhfffugggtgffkfhgjvfevofesthekredtredtjeenucfhrhhomhepnfhouhhishcuvehhrghuvhgvthcuoehlohhuihhsrdgthhgruhhvvghtsegsohhothhlihhnrdgtohhmqeenucggtffrrghtthgvrhhnpedtieevieduhedttdfgtefhuddufeffudetkeegveeuteduveehheeivedttddtkeenucfkphepledtrdekledrudeifedruddvjeenucevlhhushhtvghrufhiiigvpedunecurfgrrhgrmhepihhnvghtpeeltddrkeelrdduieefrdduvdejpdhhvghloheplgduledvrdduieekrdegvddrieejngdpmhgrihhlfhhrohhmpehlohhuihhsrdgthhgruhhvvghtsegsohhothhlihhnrdgtohhmpdhnsggprhgtphhtthhopedvtddprhgtphhtthhopehmrghirhgrtggrnhgrlhesrhhishgvuhhprdhnvghtpdhrtghpthhtohepshhiqhhuvghirhgrsehighgrlhhirgdrtghomhdprhgtphhtthhopegrrhhthhhurhhgrhhilhhlohesrhhishgvuhhprdhnvghtpdhrtghpthhtohepmhhrihhprghrugeskhgvrhhnvghlrdhorhhgpdhrtghpthhtohepthiiihhmmhgvrhhmrghnnhesshhushgvrdguvgdprhgtphhtt hhopehsihhmohhnrgesfhhffihllhdrtghhpdhrtghpthhtoheplhhouhhishdrtghhrghuvhgvthessghoohhtlhhinhdrtghomhdprhgtphhtthhopehjvghrvghmihgvrdgurghuthhhvghrihgsvghssegsohhothhlihhnrdgtohhm The format RGB565 was already supported. Add the support for: - BGR565 Reviewed-by: Ma=C3=ADra Canal Signed-off-by: Louis Chauvet --- 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 44547f56e4b2..c4c623472e04 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) { @@ -445,6 +455,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 @@ -669,6 +680,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 13:21:51 2025 Received: from relay16.mail.gandi.net (relay16.mail.gandi.net [217.70.178.236]) (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 54F79299957 for ; Fri, 27 Jun 2025 09:12:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.178.236 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751015578; cv=none; b=rjENYi/IyIMjRv1LnlkpNqqm3vG3QgDXlp4BrNiTZhesc1d+4ZPRVLuwdNiR2yrP4Xmuw4GbpIMh1mLq6jGsgFQGQ2SHEhUeAKh3O0mxrY0C3nKy+h/255dv09k4eHZcEHwQe/yrOM5jcA6L1KXN0QKr/UwE+UcIyhAPYPGbql0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751015578; c=relaxed/simple; bh=QFgxyFHAJEf2laxUq9BXmSxgh7oBLS7xSxpQoHg3nhI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=do5Q3VOK02ks7KLlLdE9olWvcA+m5ng41pcnirtdaZVaJSQUDtWJMEhMjAIeiTVHaEhVbqP5eavPJnw82rmxkT3nmbKmnm7zGncHFUu067tx8sg4qb8s1QHmvcWjR89iURzIs9ia+vIeQWdrUWD1JKAXSBNEQqUkUyTHrmL+ZIw= 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=ekVeFaP/; arc=none smtp.client-ip=217.70.178.236 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="ekVeFaP/" Received: by mail.gandi.net (Postfix) with ESMTPSA id B16654395D; Fri, 27 Jun 2025 09:12:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1751015574; 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=YQ8d/WjZleZAjhhPje5wk6/z6NUbO/uvPr/KAPPpwLk=; b=ekVeFaP/27NfYOsVSqLh1kGPFQN8h5JowJEjTZiEAjc3s0Sb85hC1BIqOW/gb02/RBVggX owKy2pNXRZ9ygfz3HU+v5LEZW/ZerFdVMVD5O42iq7lXdDkcdxqEReZWRIo1TlDT2iDcyg yj4kPHDHbTspW1eU/pT202mxabVaXHIvQKe3Sk7ukoDHZzL2Cna6E6o1ON3ShQaIshJ865 ts4uve460b+SNtWGuXgONj2T+9fld5BpdyzMS0xgdB14hiejtTzwPNepSFFowu/lLT6BWN 2Bv6IpDECk4j3zDVrxEdqbP7rF/GWsmU7wi06OrgjisEC4BVH8aB4TDWZKmj5A== From: Louis Chauvet Date: Fri, 27 Jun 2025 11:12:36 +0200 Subject: [PATCH v5 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: <20250627-b4-new-color-formats-v5-5-94452f119c72@bootlin.com> References: <20250627-b4-new-color-formats-v5-0-94452f119c72@bootlin.com> In-Reply-To: <20250627-b4-new-color-formats-v5-0-94452f119c72@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=QFgxyFHAJEf2laxUq9BXmSxgh7oBLS7xSxpQoHg3nhI=; b=owEBbQKS/ZANAwAIASCtLsZbECziAcsmYgBoXmCNrE8LTStOIfN73gnB68k0X7H9lUnyqLiX2 n+TirrSdqWJAjMEAAEIAB0WIQRPj7g/vng8MQxQWQQgrS7GWxAs4gUCaF5gjQAKCRAgrS7GWxAs 4qNKD/9d7X0Laq422DloJZQEcw7Nwxph8vOUWpdJNTkazqpzbMRLGGn/nltXKm6Js47C1nqmDsD Wur2sHjjgv9b2ZEbfaJhCOmPXpYju2J2wR4m5pb4U9YlCf6T6s5pxQ3NNtzVwr9Nn3UbJFdEfSQ kpEqXId4iYfS09TDObk0E4jgZDpjC+3NK39NLKoDlqFJiuk+duD0PeELGP9KrCDcw/l1jq7g6Ov IFBMQRukRBNgPY6W9tIvl/dFAC7+wa/+KLZ3rGUiiJJM9Ayplaa5FWgG2YYGT706bhGrqHTYwCF QCOGlHICwTt1lkKJGhZ0AWPcg51EXIxCtrhQ8scgm1oPqp9KIQgDIJ/bV591+px+vzzgSbPVs5l p14yUOMh4edKOcoADaNOSPW5zsLJEtxa7lNiQP8YASvH35m6gb7s3HVtaP3qyw1RSeBPKrmFt9V MGVhAD5gsAfUu2JQba9t9URklPxD5JPmgOgcuRouHNqhSj0czs56B/9gb5p0Ljj2GArcI91We9q nM5Lif/sor0Y8w7y990Woxgi65A5fMNlvDkI/aieB34jgvJwZbX2aAVvDlLHJrKXrTSOP1fQ+G3 M4IYRz5LUsvdgPVxKtt6CjHA3RUZil4OTl0DUt0qVFf/jAoORxVmnvUuscqLU70RRNSzwkZ0k2I lbvRlMAGxi/4xPQ== X-Developer-Key: i=louis.chauvet@bootlin.com; a=openpgp; fpr=8B7104AE9A272D6693F527F2EC1883F55E0B40A5 X-GND-State: clean X-GND-Score: -100 X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgddvieeiucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuifetpfffkfdpucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddunecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhfffugggtgffkfhgjvfevofesthekredtredtjeenucfhrhhomhepnfhouhhishcuvehhrghuvhgvthcuoehlohhuihhsrdgthhgruhhvvghtsegsohhothhlihhnrdgtohhmqeenucggtffrrghtthgvrhhnpedtieevieduhedttdfgtefhuddufeffudetkeegveeuteduveehheeivedttddtkeenucfkphepledtrdekledrudeifedruddvjeenucevlhhushhtvghrufhiiigvpedunecurfgrrhgrmhepihhnvghtpeeltddrkeelrdduieefrdduvdejpdhhvghloheplgduledvrdduieekrdegvddrieejngdpmhgrihhlfhhrohhmpehlohhuihhsrdgthhgruhhvvghtsegsohhothhlihhnrdgtohhmpdhnsggprhgtphhtthhopedvtddprhgtphhtthhopehmrghirhgrtggrnhgrlhesrhhishgvuhhprdhnvghtpdhrtghpthhtohepshhiqhhuvghirhgrsehighgrlhhirgdrtghomhdprhgtphhtthhopegrrhhthhhurhhgrhhilhhlohesrhhishgvuhhprdhnvghtpdhrtghpthhtohepmhhrihhprghrugeskhgvrhhnvghlrdhorhhgpdhrtghpthhtohepthiiihhmmhgvrhhmrghnnhesshhushgvrdguvgdprhgtphhtt hhopehsihhmohhnrgesfhhffihllhdrtghhpdhrtghpthhtoheplhhouhhishdrtghhrghuvhgvthessghoohhtlhhinhdrtghomhdprhgtphhtthhopehjvghrvghmihgvrdgurghuthhhvghrihgsvghssegsohhothhlihhnrdgtohhm Add the support for: - RGB888 - BGR888 Reviewed-by: Ma=C3=ADra Canal Signed-off-by: Louis Chauvet --- 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 c4c623472e04..5b50e8622521 100644 --- a/drivers/gpu/drm/vkms/vkms_formats.c +++ b/drivers/gpu/drm/vkms/vkms_formats.c @@ -449,6 +449,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]) @@ -670,6 +673,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 13:21:51 2025 Received: from relay16.mail.gandi.net (relay16.mail.gandi.net [217.70.178.236]) (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 5425F293C63 for ; Fri, 27 Jun 2025 09:12:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.178.236 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751015579; cv=none; b=bWpdqWSP7m6QSsIYXjkEZTRZZ241UnOl8rXzVoMjBB1LHgsjcczd0zghXLexLQ2YhKCYLTXvsPqcOSohoYIuPBgSZLSVnJxyRN6G6ZGe+2ZAC2sU4eqMnlHaZQnR2uwmLhof3VW3oy6m1hCiqFEALvDkNBp/reG3spNfZf0lV+w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751015579; c=relaxed/simple; bh=K3Y7qrKaEMb0Rhv4E+FnFIZvLv3NCLUlzzrFNhA16zM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=nhKSov6ID4wHA4xFljyfJHH8sOYHRkLV3lZoRKl/nNgrTuLM2yoMM5f1xgGBWHKBeStl6e6tH8DD9fuVsu65j95xRhYmMUWigKCHahTYLBgoS/GtSIEShVO911Byd2CWFDfmoXIMOdKCQqVJbpModmZMOe6geXYQSvZ0S7VudPA= 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=GHBKmwEF; arc=none smtp.client-ip=217.70.178.236 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="GHBKmwEF" Received: by mail.gandi.net (Postfix) with ESMTPSA id C297E4386C; Fri, 27 Jun 2025 09:12:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1751015575; 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=L7fZpMVkmYAEU87VQqXWQO1HeEQH6mE1SXHh1/zzRxw=; b=GHBKmwEFxxxUf204Igbit+fVKXB/i4CgSQnqJim+d8BBbCRRn4bEMrftM+fCs4HcQEUf/C atBdh9EPgLk/pEu24LhjsKOTf4zi3Q8PR5vl2j7iPBsq3fsw1vpiuHptJhvYb5KFevPkrZ VwCrFOvwMTayEPjTHYRZkIUkmsw0q+oNgEFwexLinuHCwuNcDj94dlhxqUr6E6NJVSc4SV Hqf6HPDgUfEKUAmxxJHt/k8bW0PE1baKKdeMOkTo1hM1/9tnqROu4Gqmcc8AHRRiNMC8r7 WhiRJuLUFdNVvQzVhuf6Wul4mmvJpQKzvt+68cO1gaztg0G8A5HAKYoXbUPz6A== From: Louis Chauvet Date: Fri, 27 Jun 2025 11:12:37 +0200 Subject: [PATCH v5 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: <20250627-b4-new-color-formats-v5-6-94452f119c72@bootlin.com> References: <20250627-b4-new-color-formats-v5-0-94452f119c72@bootlin.com> In-Reply-To: <20250627-b4-new-color-formats-v5-0-94452f119c72@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 X-Mailer: b4 0.15-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=18390; i=louis.chauvet@bootlin.com; h=from:subject:message-id; bh=K3Y7qrKaEMb0Rhv4E+FnFIZvLv3NCLUlzzrFNhA16zM=; b=owEBbQKS/ZANAwAIASCtLsZbECziAcsmYgBoXmCNYHMmt5kaoN/HUm0VvTF7KUof8lrELQ2wK yiOka+9E/KJAjMEAAEIAB0WIQRPj7g/vng8MQxQWQQgrS7GWxAs4gUCaF5gjQAKCRAgrS7GWxAs 4v7LEADV3O2HAbD1sPSESWb/TN+eUZkz/EIuPFm0SA0czMi9rmdDMt/S7o/Np+RximayHzGmvFq f8ZTaUwlo+fw/7BA0uxbtQuulo/r9Jnzed93nEl1U4dxZh1z5hxal7YBsx3nKv4Q6Kx2oKi0xyW UqzSUp8TnazXPyQLhJ7XT04Fpl3AXnq7FNkiy7xgZJ4FjtRxtTocMUXlZeFXXBm2BRSBx5F9gHP zQ5e1D4XFUM6HwPPCe7OtrLbnDVwyJ1nV9a5n7YqHvGUD2TBgIp+o6QoJv0sCE2Sud2XCXWah2i +WimycKQPVPCIjNRSCqCdkwBSMz4C+10ftp7SqZ9cLVXwO1SGlYOqye4kD1ed4MN29CPRrrexBP uxeIr2T76UKCWvokMoSV0THWVd+BVg4/hCLPWTeutsPFzO+CuGO2kzeWm/MaQZtuzHl9hiyZEV6 HdwuyG4XtATUYBADWCxNSUv0qYhmMLcVqpyIlJk49OhBoQReUiATKtaml6UYjIk2lBj4rTMRx9M aeiWdID7Bcd5AMcp48UF5Hb53fHFU/SEZn2S4cg62rtpxi59u/NfhCeRO/AeVCIExjNPneahj5l 7KL34KmEnNEMR63+jMXCYgW+nxFumoL4GAoU7WN2AP1LZHWhZrEukI6F9tB482vYaFUGmnBeXLM qhagvUeIjLuOKFg== X-Developer-Key: i=louis.chauvet@bootlin.com; a=openpgp; fpr=8B7104AE9A272D6693F527F2EC1883F55E0B40A5 X-GND-State: clean X-GND-Score: -100 X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgddvieeiucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuifetpfffkfdpucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddunecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhfffugggtgffkfhgjvfevofesthejredtredtjeenucfhrhhomhepnfhouhhishcuvehhrghuvhgvthcuoehlohhuihhsrdgthhgruhhvvghtsegsohhothhlihhnrdgtohhmqeenucggtffrrghtthgvrhhnpeelfeekffffkefgffejueejiefhieffleelhedvvdetvdffvdfghefhfeevhedtheenucffohhmrghinheprhgvrgguthhhvgguohgtshdrihhonecukfhppeeltddrkeelrdduieefrdduvdejnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepledtrdekledrudeifedruddvjedphhgvlhhopegludelvddrudeikedrgedvrdeijegnpdhmrghilhhfrhhomheplhhouhhishdrtghhrghuvhgvthessghoohhtlhhinhdrtghomhdpnhgspghrtghpthhtohepudelpdhrtghpthhtohepmhgrihhrrggtrghnrghlsehrihhsvghuphdrnhgvthdprhgtphhtthhopehsihhquhgvihhrrgesihhgrghlihgrrdgtohhmpdhrtghpthhtoheprghrthhhuhhrghhrihhllhhosehrihhsvghuphdrnhgvthdprhgtphhtthhopehmrhhiphgrrhgusehkvghrnhgvlhdrohhrghdprhgtphhtthhopehti ihimhhmvghrmhgrnhhnsehsuhhsvgdruggvpdhrtghpthhtohepshhimhhonhgrsehffhiflhhlrdgthhdprhgtphhtthhopehlohhuihhsrdgthhgruhhvvghtsegsohhothhlihhnrdgtohhmpdhrtghpthhtohepjhgvrhgvmhhivgdruggruhhthhgvrhhisggvshessghoohhtlhhinhdrtghomh Some YUV format uses 16 bit values, so change the helper function for conversion to support those new formats. Signed-off-by: Louis Chauvet Reviewed-by: Ma=C3=ADra Canal --- drivers/gpu/drm/vkms/tests/vkms_format_test.c | 139 +++++++++++++---------= ---- drivers/gpu/drm/vkms/vkms_formats.c | 22 ++-- drivers/gpu/drm/vkms/vkms_formats.h | 4 +- 3 files changed, 84 insertions(+), 81 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..0ebb5352bb32 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,32 @@ 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. + * 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 +236,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 +254,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 5b50e8622521..03eb73f4caef 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 @@ -492,8 +493,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) @@ -537,8 +538,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 13:21:51 2025 Received: from relay16.mail.gandi.net (relay16.mail.gandi.net [217.70.178.236]) (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 7C921299A82 for ; Fri, 27 Jun 2025 09:12:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.178.236 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751015580; cv=none; b=TwUIQFg2g7svz5jrbQmKMGplwaUqfA3/16ewzps6M99X9I2efjU6cp8q2Y4runX/oU5B++ZsbspIP8WRQS0a5G0wK3Ks1D08y7lB3tos2AvGjACssoLoByMQOEfaSONrhG/BhXaI2SC5GxcqNjgiO3RP10AAWIJLWcHHppiOooQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751015580; c=relaxed/simple; bh=6rCEsWIq5fbxDFsCRxdoRDtJo224kyW+P6LIRsIuwz4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=FEdNdiQsRXGCu68/f8S3Q+iXg9dmjccE+yG2UW0x04N1S9PalNRPHMF7d1YitxtS1VSOUcwvXeV3xa49exd9nf9HDErSfX/kEjRdo8EUWb0Br2ECnepE8E3lNgk/X1eZItucEKczTG6zbIR1IlJPzAoxnCzNiLTBqsmiEnP0v3g= 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=CswEsLdB; arc=none smtp.client-ip=217.70.178.236 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="CswEsLdB" Received: by mail.gandi.net (Postfix) with ESMTPSA id D4DA2438D8; Fri, 27 Jun 2025 09:12:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1751015576; 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=cQGedsYFUprS2h2wsTHDGgsQPvYO+g5TGBKhmE6wtXc=; b=CswEsLdBlPsdkSGUetmlQ5DbnWnbFMVBbEWQtJQAfdrV0XZT3I3oN1hwS6x4F/NlGwMEbf 7OMIl1GEGZN3Jr7mprrtss/zKzN+HY37Ohznsx9qGTDHIGVT9iJxNHRUbnB1N21XaoLIeZ h2Rh+0QM2/0xqBHUuHEz1S8HYMnFa+kIxM1s5WiiPsUQhaTonYNjtPgISwaR9EVakBCWOe p6xysoeJ13aOVr4egXikaPwPeZIgZKiLcweuP4T8MwJbP5vTVHl2RdF+KSrW5oplkAO81i oRh4Y21pkMswDxH8CL4WiNsNah48Z7TdzQib6MP2KOhTvVu7Zs9PgC1EwxeKqw== From: Louis Chauvet Date: Fri, 27 Jun 2025 11:12:38 +0200 Subject: [PATCH v5 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: <20250627-b4-new-color-formats-v5-7-94452f119c72@bootlin.com> References: <20250627-b4-new-color-formats-v5-0-94452f119c72@bootlin.com> In-Reply-To: <20250627-b4-new-color-formats-v5-0-94452f119c72@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=5260; i=louis.chauvet@bootlin.com; h=from:subject:message-id; bh=6rCEsWIq5fbxDFsCRxdoRDtJo224kyW+P6LIRsIuwz4=; b=owEBbQKS/ZANAwAIASCtLsZbECziAcsmYgBoXmCNKoIcCSm7iRvzpMnnxpiVdsUB+vIsLxgXJ 8WoKmRr9jqJAjMEAAEIAB0WIQRPj7g/vng8MQxQWQQgrS7GWxAs4gUCaF5gjQAKCRAgrS7GWxAs 4qYcD/4iJ3YpdhZMDzwXxLfrGx3Tke5eYr36EQKqXcXyuiDWKu7+ufV+xtODyYJ1HPRTnO2fBhO uHdhD6O7BF6+eZaw0nQJkyUekWKEbQNMh2G/THigmVFaxtCHdKNsBF+kP/T0sAkSTO4dA88dmGU S9xaBabxlHE9cffQPfEiI2a7Pro47Qlm++KmPYtyDWmXMqtq9krOvQywsvt2FMPNR6Km2xzg/TH sWpK4PON+EuVcmuAtWTVikkVCDJsPOmHB6a1B0OJUtak9epyMw5WPW9GttewiAYwjih0IRLsjcT o0Dt2h0SVnE9QfSkTBKFZR6J+eNF8MhL2OpQWQhU++pu8DOV+mlznW3/+Ia3aqWN14fkoGKi4F9 3NFSYkGa4h/SnotkrTteOntVPbSAnSMEYPZXY+iZPGOHKdfVVhHVlR9y7yutIoUR0Ci7ULDFWpN 7MLgWjx/PKM02OUdTxCspK7AoubdYoj8/kyIAF77ouiD/N8nF2yqtmAgficKNXaEpgyuCQO3U4l YCIMf1OpWBRWjLMLkyVCxiZazHqTNhkciJ849Mga/sN82SQa4mElCH80s5Xyne4EbimPjWH9iUo zY+dC/9vTtEkH92vW1PdwXUYnUUsIKZP5pdK7Ere9Wk+o6EaW5Q1qcX2AGxqs0qx+g7Gh1+Vgkn LaoPDsKVavlb18Q== X-Developer-Key: i=louis.chauvet@bootlin.com; a=openpgp; fpr=8B7104AE9A272D6693F527F2EC1883F55E0B40A5 X-GND-State: clean X-GND-Score: -100 X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgddvieeiucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuifetpfffkfdpucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddunecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhfffugggtgffkfhgjvfevofesthekredtredtjeenucfhrhhomhepnfhouhhishcuvehhrghuvhgvthcuoehlohhuihhsrdgthhgruhhvvghtsegsohhothhlihhnrdgtohhmqeenucggtffrrghtthgvrhhnpedtieevieduhedttdfgtefhuddufeffudetkeegveeuteduveehheeivedttddtkeenucfkphepledtrdekledrudeifedruddvjeenucevlhhushhtvghrufhiiigvpedunecurfgrrhgrmhepihhnvghtpeeltddrkeelrdduieefrdduvdejpdhhvghloheplgduledvrdduieekrdegvddrieejngdpmhgrihhlfhhrohhmpehlohhuihhsrdgthhgruhhvvghtsegsohhothhlihhnrdgtohhmpdhnsggprhgtphhtthhopedvtddprhgtphhtthhopehmrghirhgrtggrnhgrlhesrhhishgvuhhprdhnvghtpdhrtghpthhtohepshhiqhhuvghirhgrsehighgrlhhirgdrtghomhdprhgtphhtthhopegrrhhthhhurhhgrhhilhhlohesrhhishgvuhhprdhnvghtpdhrtghpthhtohepmhhrihhprghrugeskhgvrhhnvghlrdhorhhgpdhrtghpthhtohepthiiihhmmhgvrhhmrghnnhesshhushgvrdguvgdprhgtphhtt hhopehsihhmohhnrgesfhhffihllhdrtghhpdhrtghpthhtoheplhhouhhishdrtghhrghuvhgvthessghoohhtlhhinhdrtghomhdprhgtphhtthhopehjvghrvghmihgvrdgurghuthhhvghrihgsvghssegsohhothhlihhnrdgtohhm 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 --- 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 03eb73f4caef..b18d67436e1d 100644 --- a/drivers/gpu/drm/vkms/vkms_formats.c +++ b/drivers/gpu/drm/vkms/vkms_formats.c @@ -473,35 +473,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 @@ -697,7 +718,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 13:21:51 2025 Received: from relay16.mail.gandi.net (relay16.mail.gandi.net [217.70.178.236]) (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 720E4299AB5 for ; Fri, 27 Jun 2025 09:12:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.178.236 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751015581; cv=none; b=rC8O+rS7Rodiy3A/lXLjsAeloaLb4HD8yFEBQpZWBgG6eUbaF6HHscx9e1w/8QLVsE8m4QrmDNLq+RKTZ3IBNZoTbtkNKF0dktImODvXg444KEhE3I5vY8+O5BFp8jEF4BPPKJEHf0pp8XJ9FyGcIapfv753aFZkFCUGXreVlZk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751015581; c=relaxed/simple; bh=QiFonQJxOo/bY8I4l1uZqGA1dfJimNI0BRwu51L77sY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=pVc9fs0P7DxnKIb178A5dDLpHF0tytAOGMByIhxFM+Wwk1LOUa+yMlr1bnnf6b9Wr+pg0tz4kR15J+T+YtR3XVdc7BMbcowR8VdSkxjKNs9MV8D/sNByRSQ1Z1X+/crEnvj7CPKRIlwmZz0xaDY7vSWznEj8ZTHNIJVFf+j27nI= 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=jgOZsmYN; arc=none smtp.client-ip=217.70.178.236 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="jgOZsmYN" Received: by mail.gandi.net (Postfix) with ESMTPSA id F1FD8438CA; Fri, 27 Jun 2025 09:12:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1751015577; 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=QLPLv18xzapWnsWKvbOSYbL5/1PSNGa2oiksuVxBiWQ=; b=jgOZsmYN9wE0bv05ZB95RFLGnVvDK4Th3jT8To9s296CffHs/YBqfqos4BeLp6V6JkiGJW OOYefHzfvZ/LhYHPS5UvgBqb2NsNG4eE867Ad1919CrdABrlrGzXnVGHz9BwSWpADokwUq lkgmZ0zcmqC0Kn9g//lChZxf9GpUEwPKC2BTj/4aTQo3HS2CgeapNQCvKDtb65y8t0WD4C 5QZIA6m3R0Y0i6NM2OpTpQe6U82Skm09eKSe71lDnj/z/AY5LazuOI9jSPP3O7qKW64Q5e v0Ys+hpiMqs3uwS3e+bktgNg3f8Xuv7XDCYkda6E6Ww+OSB23nPi5Tm0tZ/EMw== From: Louis Chauvet Date: Fri, 27 Jun 2025 11:12:39 +0200 Subject: [PATCH v5 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: <20250627-b4-new-color-formats-v5-8-94452f119c72@bootlin.com> References: <20250627-b4-new-color-formats-v5-0-94452f119c72@bootlin.com> In-Reply-To: <20250627-b4-new-color-formats-v5-0-94452f119c72@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 X-Mailer: b4 0.15-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=1885; i=louis.chauvet@bootlin.com; h=from:subject:message-id; bh=QiFonQJxOo/bY8I4l1uZqGA1dfJimNI0BRwu51L77sY=; b=owEBbQKS/ZANAwAIASCtLsZbECziAcsmYgBoXmCO4AsbQgnO0+C5ntekkA+T0tNHKys9CbiCi 3sHI+W4O0mJAjMEAAEIAB0WIQRPj7g/vng8MQxQWQQgrS7GWxAs4gUCaF5gjgAKCRAgrS7GWxAs 4j4/EACJ1Lg6duJHRyc7JjcwUU2CB9xxf73FJ54bMV7SpE4NyG4NFDPQJr2vVKCHMxzGqunhdnw 7ckd8g3Pl2jVMK/gvgG0von7zHdj39O5/TZ7ZXw41YTnmNKCUQ+FoxjLH2oZYgf5iLf+ntngpdF GrTmpoi11Be2FC7SV49S22HuY31rnzavpisdzeZ18IQuIsVmD194mf9zqGdC7xEXDEpIDVcpSiB VYZ3DJ84/0/363ZETV1UzVj2LRdaWwpfs7BV4tQ66+Gnn1Heb3fK4FpGkW3yFtimZ42gU5ijdA7 FeGWpey3KckrGts7l5gpUkYxne5hTTC3d/VnS5WV9+anjoymI5zanvR86b78GJQquhAa3vlk468 02BZcQrgyBHJTcxnsU+Tnfh2IOTcIYpQqzzCIth/0GNvkz0LygM6oX9bGsQS0izub23oef26ZCV 9NACSlp2rrP8MDh8KQY7APxIAYSaMeSy3sW1oO7nmNi3S9JIOz0MeUWSmdzBirjcmy+NTUqVID4 5hZ4C3xM+jzt7JV3skHyVxDXMDtDfZrFDfFwd46wT7kd4msiZukzhNz0XrPNILrWuPCMQ9D5ws8 8+66Pn+j6RillADKM5CoQtoSYAhG7yPIjh4wALKizdnpjwYWhSfi+mimlAlQ6W/QqQqslXDXVWZ O+DG4uCv2/qfwUw== X-Developer-Key: i=louis.chauvet@bootlin.com; a=openpgp; fpr=8B7104AE9A272D6693F527F2EC1883F55E0B40A5 X-GND-State: clean X-GND-Score: -100 X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgddvieeiucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuifetpfffkfdpucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddunecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhfffugggtgffkfhgjvfevofesthejredtredtjeenucfhrhhomhepnfhouhhishcuvehhrghuvhgvthcuoehlohhuihhsrdgthhgruhhvvghtsegsohhothhlihhnrdgtohhmqeenucggtffrrghtthgvrhhnpeehtdejtddtteeiiefgleejkeetteevhfdukeegleffjeehgeeivefhgeduffdvvdenucfkphepledtrdekledrudeifedruddvjeenucevlhhushhtvghrufhiiigvpedunecurfgrrhgrmhepihhnvghtpeeltddrkeelrdduieefrdduvdejpdhhvghloheplgduledvrdduieekrdegvddrieejngdpmhgrihhlfhhrohhmpehlohhuihhsrdgthhgruhhvvghtsegsohhothhlihhnrdgtohhmpdhnsggprhgtphhtthhopeduledprhgtphhtthhopehmrghirhgrtggrnhgrlhesrhhishgvuhhprdhnvghtpdhrtghpthhtohepshhiqhhuvghirhgrsehighgrlhhirgdrtghomhdprhgtphhtthhopegrrhhthhhurhhgrhhilhhlohesrhhishgvuhhprdhnvghtpdhrtghpthhtohepmhhrihhprghrugeskhgvrhhnvghlrdhorhhgpdhrtghpthhtohepthiiihhmmhgvrhhmrghnnhesshhushgvrdguvgdprhgtphhtt hhopehsihhmohhnrgesfhhffihllhdrtghhpdhrtghpthhtoheplhhouhhishdrtghhrghuvhgvthessghoohhtlhhinhdrtghomhdprhgtphhtthhopehjvghrvghmihgvrdgurghuthhhvghrihgsvghssegsohhothhlihhnrdgtohhm The formats NV 12/16/24/21/61/42 were already supported. Add support for: - P010 - P012 - P016 Signed-off-by: Louis Chauvet --- 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 b18d67436e1d..e540218fdcad 100644 --- a/drivers/gpu/drm/vkms/vkms_formats.c +++ b/drivers/gpu/drm/vkms/vkms_formats.c @@ -522,7 +522,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 @@ -719,6 +720,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