From nobody Wed Nov 27 21:38:19 2024 Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) (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 D14876F30C for ; Fri, 22 Nov 2024 16:19:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.195 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732292350; cv=none; b=gzcuGZaYITLSRJmSzEwLTnVwQM5QNYETP4QOqi4hrFnjGg4VSfT61NKzkPVaic/1Fq/e+q13QTOYAxCw2xlId/bLvjQtm/kyNrW2di6aaLqNpCnd73dNTtAVJzBbCDqoqBqA2Gmy5F/AvVrFKeP4kI7uqwbnc4jXlqH8T5n3AbA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732292350; c=relaxed/simple; bh=DCSX226vwuqHCnEOZmjENkcyjWmhEEVjaWFvKST7rQA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=lXrQ5Jg4eu47j3EpY+B8onmsIgwbULs71q27eWUy5H4ljkwSd1r4NE476VH6cB/fOxB/nW2mVPEo3oo4rBoNHScP3O5ZTy27PJrUL1mJSRVESWEr+OlERvxWopYH+mOQDSYq6KEgB00Xmc8lH25oWEMupn1skqzbmYxsnqPGP2I= 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=Y0rcMQRZ; arc=none smtp.client-ip=217.70.183.195 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="Y0rcMQRZ" Received: by mail.gandi.net (Postfix) with ESMTPSA id 4ABF760002; Fri, 22 Nov 2024 16:19:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1732292347; 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=oKPlLz9ZC/4CRqq8g5QxpCOYxnAFDUMpkF+GuYmvk1M=; b=Y0rcMQRZ87KOYYj7QFPuC805fGXo7mDiUEK08eJhLub5cGgQwQ6g3qogT4Y7IIXzDgwwIa bAZqaFAin2TjsKpJDLIDQs5bqMAhT+5pgKv9cXXKs9R1DCLlDdd6ooV09TD3sc98qi3gNy tXHnPTyAYhmbdBtLFESRoMjC/qVOshaZZLtcb4nhfzC9PvMSJXodqlfXKDXDTRbpxHxVwe MD7K/19DVQxStdKIDMzjHjaPY/Yy9IyIax6T1A6++r5ojIoPlhipQu5my7CYh5s3pLYZn9 X0VAsTWwHuzq+PeEk0E/QvoFBYVJ74zUifxfk9GXFgcqNz5p296jk6DHbGXCaw== From: Louis Chauvet Date: Fri, 22 Nov 2024 17:19:01 +0100 Subject: [PATCH v3 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: <20241122-b4-new-color-formats-v3-1-23f7776197c9@bootlin.com> References: <20241122-b4-new-color-formats-v3-0-23f7776197c9@bootlin.com> In-Reply-To: <20241122-b4-new-color-formats-v3-0-23f7776197c9@bootlin.com> To: Rodrigo Siqueira , Melissa Wen , =?utf-8?q?Ma=C3=ADra_Canal?= , Haneen Mohammed , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , 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, marcheu@google.com, nicolejadeyee@google.com, Louis Chauvet X-Mailer: b4 0.15-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=7839; i=louis.chauvet@bootlin.com; h=from:subject:message-id; bh=DCSX226vwuqHCnEOZmjENkcyjWmhEEVjaWFvKST7rQA=; b=owEBbQKS/ZANAwAIASCtLsZbECziAcsmYgBnQK722R/bG0K6WvwaRwCUYT/w1exnxyDqkxYoS KZAhjrNluKJAjMEAAEIAB0WIQRPj7g/vng8MQxQWQQgrS7GWxAs4gUCZ0Cu9gAKCRAgrS7GWxAs 4hvlD/0eRnqUgUxXeZE0S4l61LADGbz8ze6ecWrwWuBggsKiV95RyiCUzadelagBjKTsTPk0p0r 49ha4Q2txnEXIk1ttBm9RYanew1LPukbkMXfrLVWHPDrc0/w9UmoGV1HJKrmxtitgg4RMpeiT4S vurgOEWtjaSqVYeVwbuAOeCd7a8JVML+ZJQEaHYKpJLtWBB64S9VoMKvJDAmgHYoQHncWRvKmun 88wS6WzEKIkZx/zq5bOXx9hBy4+Y7LXqeE+igIorKtcIXoo+4pY/YR2a7B60AIyNThyhjF+Z32p XmwCyD1nxPUYGU3hJF2e6sURHELneUFgJQkcsMhrZmLd4a/NNTqkTq8snBNPDrf0tIMEmJ/l/5j azIBbTgPmGJcjKCRBLa0fhZPY3jla3Ji2ufPse+LjOr1Cy6G3QfnDnhbDRfOiQZTlQOQamIb5er zmxdHjRFR/EgrpU1pjGBWdglIxkhx93d7hgrsBkzNnlfRnzkHUR1zg5ePk/stIz5mfr0bJd8RuZ Xr4cVykeSnwc4KyyfDRHLoRd98YdJTTblkxHt8f3cSAHNqnMcAJzcjIvMI+lPR8UMOAa1t2By8x Dy+xIsbdxsD/Ko+eGJtBptDbzH4aOwvmVI18GxM930yu96DCOypsaCaLtCJW6c3zLvplk3qV24I 78tWYdMN7NyPPdw== X-Developer-Key: i=louis.chauvet@bootlin.com; a=openpgp; fpr=8B7104AE9A272D6693F527F2EC1883F55E0B40A5 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. Signed-off-by: Louis Chauvet --- drivers/gpu/drm/vkms/vkms_formats.c | 164 +++++++++++++-------------------= ---- 1 file changed, 58 insertions(+), 106 deletions(-) diff --git a/drivers/gpu/drm/vkms/vkms_formats.c b/drivers/gpu/drm/vkms/vkm= s_formats.c index 2edf1ceccd37ad3a2f9f6d2dcf2044c98d9e10f0..9c4aaca7853102b86dcfd8e39a8= f70392d019aed 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,118 +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; - } -} - -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); - - int step =3D get_block_step_bytes(plane->frame_info->fb, direction, 0); +READ_LINE_ARGB8888(ARGB8888_read_line, px, px[3], px[2], px[1], px[0]) =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; - } -} +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 -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); +READ_LINE(RGB565_read_line, px, __le16, argb_u16_from_RGB565, px) =20 - int step =3D get_block_step_bytes(plane->frame_info->fb, direction, 0); +READ_LINE(R8_read_line, px, u8, argb_u16_from_gray8, *px) =20 - 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 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; - } -} =20 /* * This callback can be used for YUV formats where U and V values are --=20 2.47.0 From nobody Wed Nov 27 21:38:19 2024 Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) (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 C0B707080C for ; Fri, 22 Nov 2024 16:19:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.195 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732292351; cv=none; b=fLFPPyR13xbtIO/F+O0C3CLexdSVYXGgJwqDRr/5NgXcsuzYefqF1mez6MsI6F6aWWX/PYH1gTj5Vfmn+JFh8HKFaJgNMNhjU47wDlGqs0SOa0rTIJGYDP6ndotmiNkHwSq5CtPbmuGQBX10IJ9M5lhVLFjzjd5VztdcWuQk3d0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732292351; c=relaxed/simple; bh=gJNge0fDzpH4LyPjnilSlTnJcUnJayCSzW4JiJCQxPk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=BnttmAGoflEEvguq4pEmPyPC6rXVFOO6DAleOkoSt5BOrD0l0pNN8xnC2lwsSXNqaG2lz+5g2f0VANML23oX+Be//u7usjJBkaCar8ydgvimQzUphnpfBgLX8o2dsX7dnAOyZlpBo+ycuH+lmfo+fySKeNymISM+Yrb5qD+pZHM= 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=hsAQYWuq; arc=none smtp.client-ip=217.70.183.195 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="hsAQYWuq" Received: by mail.gandi.net (Postfix) with ESMTPSA id 4BFBC60008; Fri, 22 Nov 2024 16:19:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1732292348; 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=yQHb2AQUZTKgO+ldjVa5ay9EUsJ/fVjYqsXQJEb7ICc=; b=hsAQYWuqHweJB/UIdhIRgSi3XInhJ58XaXUlMMAZous8mzhTAGJR8x+iUiam/eBFKDeOy0 /cwkAD9RiCgvnG8etq0+6uPl7asr9Zb5/RoN/KkwizEKhSZ48AlPayujkSbwWLUp2DtDo1 I6YYFcyH7AEex5i4JuY5/LGZGUkr21XXWwmys5nZERlJxSQcNGskrrsQre6tDTUAIGGEUM A50g3zNYhVMx3Dk1kXxwoTnqNUHkB+ofVXaWqz7B8x1+SKs8/kACI4CE/btz3Ka5+sX5uj FnvvfacrPSmuLZioSX1Bb2C8STlkuVeDujWpoi5HaYaHVgit2b5n2WprI1DJXQ== From: Louis Chauvet Date: Fri, 22 Nov 2024 17:19:02 +0100 Subject: [PATCH v3 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: <20241122-b4-new-color-formats-v3-2-23f7776197c9@bootlin.com> References: <20241122-b4-new-color-formats-v3-0-23f7776197c9@bootlin.com> In-Reply-To: <20241122-b4-new-color-formats-v3-0-23f7776197c9@bootlin.com> To: Rodrigo Siqueira , Melissa Wen , =?utf-8?q?Ma=C3=ADra_Canal?= , Haneen Mohammed , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , 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, marcheu@google.com, nicolejadeyee@google.com, Louis Chauvet X-Mailer: b4 0.15-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=2802; i=louis.chauvet@bootlin.com; h=from:subject:message-id; bh=gJNge0fDzpH4LyPjnilSlTnJcUnJayCSzW4JiJCQxPk=; b=owEBbQKS/ZANAwAIASCtLsZbECziAcsmYgBnQK72t+Iob3mJaTm9piaeXpkzVIGGytAhcjk9r rIJEe80Jm2JAjMEAAEIAB0WIQRPj7g/vng8MQxQWQQgrS7GWxAs4gUCZ0Cu9gAKCRAgrS7GWxAs 4olkEADXifTgmeQG7EMSKAmVn56M2Qz0MXBMHnFznerbrMXQxGgoX+rZqmgoQ20SsS0hVC+mSZD ge2Bj5lViU3uMAOn6E2H+NgNCf5+7TNYqcSdCzMF0XvCfENfqhhbgsg63+/8r5DLxCmbXEpMORk wACi8sZmS1wynFRIyNHDY0OcuHmS6YRUjxwj23IpspJi60yD4UdggAz0hITUyJOI0uMz8moXFGJ NyHJUCdmmT4KUJk3nBPyAbwhQyA8U64W8T+eWaVWRd3OSRoT3rahcfJ7KpG7VtJ/NzwWQCKbVgs hmGvNw7rdOakgDRXpg9gpHcctoCSwdS3OcFosNHNw1sNd4fGf/WFAgk7tVt/zE5u5pm5lCRfEm0 Vx7/da+mjNZKq6MCdnTMUHEIIf9ZVvTUfGQ0WmHLa+tLKrIlstPtScV5GIkIFBEzslA+Dt0rLg0 Bo5/vsX1eryP9M3YAkutbHNCTeB2UDzZbR9RNz+u6f2bC/zNd5uvYFsAP1L70LTL0CbVJDTkxYp zDXScrlH0ZWn0qKJCXO8dXH0GBOFukjfI+3DLAT9PYhByzHX9S0rvS6nWqsLz6X/ZpgsEDRvrnK 1a45EAocZal83YvzwIumDGmUrscjQpsWEMDbP+Aon4pRxeo7f8bjNkf/kWl0NgJBsHxbIOhrXof jvv5TsUCXv21Mlw== X-Developer-Key: i=louis.chauvet@bootlin.com; a=openpgp; fpr=8B7104AE9A272D6693F527F2EC1883F55E0B40A5 X-GND-Sasl: louis.chauvet@bootlin.com The formats XRGB8888 and ARGB8888 were already supported. Add the support for: - XBGR8888 - RGBX8888 - BGRX8888 - ABGR8888 - RGBA8888 - BGRA8888 Signed-off-by: Louis Chauvet --- drivers/gpu/drm/vkms/vkms_formats.c | 18 ++++++++++++++++++ drivers/gpu/drm/vkms/vkms_plane.c | 6 ++++++ 2 files changed, 24 insertions(+) diff --git a/drivers/gpu/drm/vkms/vkms_formats.c b/drivers/gpu/drm/vkms/vkm= s_formats.c index 9c4aaca7853102b86dcfd8e39a8f70392d019aed..520298fc74a1e24cded8d192efb= aa84041e6339d 100644 --- a/drivers/gpu/drm/vkms/vkms_formats.c +++ b/drivers/gpu/drm/vkms/vkms_formats.c @@ -432,8 +432,14 @@ 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]) +READ_LINE_ARGB8888(RGBX8888_read_line, px, 0xFF, px[3], px[2], px[1]) +READ_LINE_ARGB8888(BGRX8888_read_line, px, 0xFF, px[1], px[2], px[3]) =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]) @@ -636,8 +642,20 @@ pixel_read_line_t get_pixel_read_line_function(u32 for= mat) switch (format) { case DRM_FORMAT_ARGB8888: return &ARGB8888_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_RGBX8888: + return &RGBX8888_read_line; + case DRM_FORMAT_BGRX8888: + return &BGRX8888_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 81941914af87fcefb180dc393f2ec311f1a1d3fa..b7f498944c506631f9eb237bf56= 000bae4f86a1c 100644 --- a/drivers/gpu/drm/vkms/vkms_plane.c +++ b/drivers/gpu/drm/vkms/vkms_plane.c @@ -14,7 +14,13 @@ =20 static const u32 vkms_formats[] =3D { DRM_FORMAT_ARGB8888, + DRM_FORMAT_ABGR8888, + DRM_FORMAT_BGRA8888, + DRM_FORMAT_RGBA8888, DRM_FORMAT_XRGB8888, + DRM_FORMAT_XBGR8888, + DRM_FORMAT_RGBX8888, + DRM_FORMAT_BGRX8888, DRM_FORMAT_XRGB16161616, DRM_FORMAT_ARGB16161616, DRM_FORMAT_RGB565, --=20 2.47.0 From nobody Wed Nov 27 21:38:19 2024 Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) (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 D22D61A0B08 for ; Fri, 22 Nov 2024 16:19:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.195 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732292352; cv=none; b=NPVqPiNS5TmQyTbklHAXXH6FJevepJikwu7JuEcmyeRlELgT0s0BU11xykQj6RzgxvE1UvLnxpqQvkA7Dawbr++M/SPQ7MB5ksn0co9eSq6oeohBblR2axewtDVr+hWdbq4E7El1SOoyayUIJ+ykO0X8QfTbOo5D3HRAaYJRrHU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732292352; c=relaxed/simple; bh=P5nW6CStss6XBXJFB4mg63UIwOzvzkPZvmY9VNXeEMU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=dVhEbuHljKRP3BJMPPAA7ozokd64IENKES6fIYGa6LPQB/FaTHCkJRUIntW0FobKKN8Cde/JXBTrXNRC6ETYTsEjirI4O/HpUr7y8aV3/8aapq1QY5zf3LDpO5hCprpTMdfZYEcuHWTP7fh1U7uqmq2EU1xUBC0WpZRQw7qrCP0= 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=FunLCrRV; arc=none smtp.client-ip=217.70.183.195 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="FunLCrRV" Received: by mail.gandi.net (Postfix) with ESMTPSA id 539686000B; Fri, 22 Nov 2024 16:19:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1732292349; 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=MkFP2awiNhVE1SbicVB5Ya1gxVAKEjnrfHxgO70L7sM=; b=FunLCrRVY2b3jvn54EHv3FHXebghYZG0RKEaBYmIYapDUx+SoDzsULp9BC/Dc78bleWBZt kadeaBAkaPyb6853Qr68l+A25H/f9pKX4o5gdnIt+Nf1x+ut1tWL6de+UICSifcuRdS2DN g39Ue14fOgW0xMd6ZQbR6glqPuE1vYOGzhl8nvNDC6XzC5fRtrVSte5/Cvc+X92q6yFncI gUOYXvZz4uTC06jHYkO0cwv8VqNyr2ewhhr4JaVQX92gA46X0+AVPOvS2VkUG0WmMNzSP4 C5+2LhUQcDFf4lbshx44aNln4Y8ltgc6AIZmxBp0YSqnlGJPVrfmxhkFR2vn2g== From: Louis Chauvet Date: Fri, 22 Nov 2024 17:19:03 +0100 Subject: [PATCH v3 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: <20241122-b4-new-color-formats-v3-3-23f7776197c9@bootlin.com> References: <20241122-b4-new-color-formats-v3-0-23f7776197c9@bootlin.com> In-Reply-To: <20241122-b4-new-color-formats-v3-0-23f7776197c9@bootlin.com> To: Rodrigo Siqueira , Melissa Wen , =?utf-8?q?Ma=C3=ADra_Canal?= , Haneen Mohammed , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , 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, marcheu@google.com, nicolejadeyee@google.com, Louis Chauvet X-Mailer: b4 0.15-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=2200; i=louis.chauvet@bootlin.com; h=from:subject:message-id; bh=P5nW6CStss6XBXJFB4mg63UIwOzvzkPZvmY9VNXeEMU=; b=owEBbQKS/ZANAwAIASCtLsZbECziAcsmYgBnQK72SKwWS6t/hvcDxOfnDTmQbN0sxqCu3Ra1M pHMChROovuJAjMEAAEIAB0WIQRPj7g/vng8MQxQWQQgrS7GWxAs4gUCZ0Cu9gAKCRAgrS7GWxAs 4oeIEACBGWAC1xr5fq6T0d2MtpKpPqxqOU4jlC0Xg5p+CdQqzx38roaFuO9cXVegMwpgRuYWzsv heOp6IpNLjF8KZcUAzb2uhHYV/tdJcHOoWLxQK9fQjuTU5XDfbwWqbU/A3SZrrII18dYzShZudq +7T7BhuuE2J9Ns1MYpNyQTdq4PTeFthY5J/j4yjO32zYncl0AI6zE1y6j37LiB4amd63+PyMCh7 G0LeIuNW1goUrgXJUaXKUtUPQeOgRexkGU12tSWy0hlA2vs4pq0RAYmyEAvqzlL/eth1FMQLKG/ e9Lb3jbUyZcDfqzuQfJK3KyX+o94/PoUAxK87ZWFY4rmIeTWISl1CVbrgl7O5wWLfJEpvZSwg+2 n1B9HrH2tSf9XFIHxuL5Qjy38APME/HuYhAAqBQ3qfYQc9RFeepNJaZEFk7+qyrQlVGvgR0Yir2 w+nKPyzmKn6FIDM+nXQ2HCHILJq1T0qKZaMwNK0UvhDpjl5E12hmyMdZ3gshG+4VWicZTsIm7d0 HppAIsJxdoOmxhOy4BrhlSPgkWcSHqwahz2xz3lvZD8IJwgLkWEka6HznFdBZaGywfObNIIVLkI HVVnF/4a4tCp66yHJuAcq8uLJ+DviglGRyhNrL25GptuZQD4auEKwO8Mru4vEDL9BFmNR6f2XjK 60OLQOsnZX8wdDw== X-Developer-Key: i=louis.chauvet@bootlin.com; a=openpgp; fpr=8B7104AE9A272D6693F527F2EC1883F55E0B40A5 X-GND-Sasl: louis.chauvet@bootlin.com The formats XRGB16161616 and ARGB16161616 were already supported. Add the support for: - ABGR16161616 - XBGR16161616 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 520298fc74a1e24cded8d192efbaa84041e6339d..1f12607c9009643c5749611a500= 1ece2b775e099 100644 --- a/drivers/gpu/drm/vkms/vkms_formats.c +++ b/drivers/gpu/drm/vkms/vkms_formats.c @@ -442,7 +442,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 @@ -658,8 +660,12 @@ pixel_read_line_t get_pixel_read_line_function(u32 for= mat) return &BGRX8888_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 b7f498944c506631f9eb237bf56000bae4f86a1c..505847ec850855ee5c047985b08= 11416ff94e51f 100644 --- a/drivers/gpu/drm/vkms/vkms_plane.c +++ b/drivers/gpu/drm/vkms/vkms_plane.c @@ -22,7 +22,9 @@ static const u32 vkms_formats[] =3D { DRM_FORMAT_RGBX8888, DRM_FORMAT_BGRX8888, DRM_FORMAT_XRGB16161616, + DRM_FORMAT_XBGR16161616, DRM_FORMAT_ARGB16161616, + DRM_FORMAT_ABGR16161616, DRM_FORMAT_RGB565, DRM_FORMAT_NV12, DRM_FORMAT_NV16, --=20 2.47.0 From nobody Wed Nov 27 21:38:19 2024 Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) (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 0075C1DF260 for ; Fri, 22 Nov 2024 16:19:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.195 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732292354; cv=none; b=rWHw6opsuOXp+6B7ze/xN9jqzijDTDVVznWi73IMkICXblxX5lXPeJZfU9ewyHccGSXdzobE0J61HqdLvMv+YGM51tQiO3QKiX+VGEYGiVuAihvPH67R7+R+qvfJy5BmaEM81rzfuvrFsDbKjFiPB9Xc2PS1NnOxlFLVUFJRrK8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732292354; c=relaxed/simple; bh=dbQqGdgqZ8VAgEmYe7A7eY51kRR6HJWf8pH66nmoElg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=D1CVybpBpkUCIkGu+BjMgj5GLsIDlZevYPPBGNe70XHn3buwtixb7uImnxwV2AUyiNTzL3bnJmG4IADp7q2M/okyKoXIdiwMlr4M/+M0XDUzPH/gkiusGoDz2oEAszdBBgwijoJbt2hX44eDXNu/2FJetSISt2lrYGUrgzxLPgA= 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=N+tHvqXE; arc=none smtp.client-ip=217.70.183.195 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="N+tHvqXE" Received: by mail.gandi.net (Postfix) with ESMTPSA id 5367D6000C; Fri, 22 Nov 2024 16:19:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1732292350; 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=wIvwz0pMdTQMLcy9cYC3AU7RkUEZgto8FvismTkIrSs=; b=N+tHvqXEcPO2gO44inl2Xg/nQfAKdUUuVfCV+1VOGbRWAyNvZbjg/E0V/JpBf73eP6CIV/ NFaVooEZ/gJlBZWSzTa4Djd3wGwJjmRan5J4MBsj8v0YUSAacML88U5uZYzGOaHn4M41Eu MY6rZeRNJfNJqYkJHyRuqMZSYWRVGYxSZ13C1oJAzqX7jnyoal4W4qsoRM7Mm85xoD0VvJ Y/hhtFHER//UWDpOYxUIvQGWWsI0dPbNYuRPie93PX6paKKP6USyTudZN2Xb+uKNLm6kJv wN9nJhWrTdkjZvWgXuaEE5l3szl0BdnPx0SwIqaezWsNQS3RZGh06HgZC40HrQ== From: Louis Chauvet Date: Fri, 22 Nov 2024 17:19:04 +0100 Subject: [PATCH v3 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: <20241122-b4-new-color-formats-v3-4-23f7776197c9@bootlin.com> References: <20241122-b4-new-color-formats-v3-0-23f7776197c9@bootlin.com> In-Reply-To: <20241122-b4-new-color-formats-v3-0-23f7776197c9@bootlin.com> To: Rodrigo Siqueira , Melissa Wen , =?utf-8?q?Ma=C3=ADra_Canal?= , Haneen Mohammed , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , 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, marcheu@google.com, nicolejadeyee@google.com, Louis Chauvet X-Mailer: b4 0.15-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=2785; i=louis.chauvet@bootlin.com; h=from:subject:message-id; bh=dbQqGdgqZ8VAgEmYe7A7eY51kRR6HJWf8pH66nmoElg=; b=owEBbQKS/ZANAwAIASCtLsZbECziAcsmYgBnQK72EuhD3HojzcS++/C2YbSlXeLXoG/xKpIBV XS+qw8okLCJAjMEAAEIAB0WIQRPj7g/vng8MQxQWQQgrS7GWxAs4gUCZ0Cu9gAKCRAgrS7GWxAs 4lG8D/40yM3aDRWaUpIrbrAqJM0w1MFLA45iwaBfyU9VX1eskpGbUal7x/rThqEEqJ6Wm+GiMKu sJUgpZhrH/fIl91y46tcpRt2spt0E9C4VpSh7QjEMuSuyM+pHPialeNb9z8994ZYuHiClzjIaU3 o6tscy0CDIeNrX12suphMMKfOzyWrDUPDWyV+X++O4eW9IFW+4aIrI8RyAuWqgmPl9XLQd/eQG3 tsupLT23EAHJLEJLtLHjlGV3vDbOlrTwNQSbIEm2+DlJyOztDk21W0bMxfhstQWYp2YSB0gkCy4 QUGcJQmT/Sazir6JJEQgDT4iTx2QpviRbYwrHbBe9inu+MMzlyI8qRkcZLxl4sgm9w5HvfHIkyC 6HtuoGmEcgys5XWA+pUQrJPwfJSfrL8O3hNuyUo+q7TB8Hr3NZtroNaVP5JmNCzeGCl1yJu2En4 8S0XI5lDoUCr4BYt0eSrGLT8UxJEc1Xi2QB3S1dtG+FXE5YLBXVu+JdKYGaulzri4om0eWu4Hjd BJdasn66JG2TkThqDKdeafj34zOh+WOdfFMwo201swMqZmB6sefntianFNxO+minq3XPFfqrNAb 6lr1GGjQovnk/JAToLF4TRqQylHhlavdNjjlS2yalxfz+WK0WngA1CCsCMyiecRnZqULZdhwQsj JbjxVvANrcQ6QGA== X-Developer-Key: i=louis.chauvet@bootlin.com; a=openpgp; fpr=8B7104AE9A272D6693F527F2EC1883F55E0B40A5 X-GND-Sasl: louis.chauvet@bootlin.com The format RGB565 was already supported. Add the support for: - BGR565 Signed-off-by: Louis Chauvet --- drivers/gpu/drm/vkms/vkms_formats.c | 23 +++++++++++++++++++++++ drivers/gpu/drm/vkms/vkms_plane.c | 1 + 2 files changed, 24 insertions(+) diff --git a/drivers/gpu/drm/vkms/vkms_formats.c b/drivers/gpu/drm/vkms/vkm= s_formats.c index 1f12607c9009643c5749611a5001ece2b775e099..7af6c5c048d5c482f47e4bd7954= b765bc2d13b9d 100644 --- a/drivers/gpu/drm/vkms/vkms_formats.c +++ b/drivers/gpu/drm/vkms/vkms_formats.c @@ -259,6 +259,26 @@ 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; + + s64 fp_rb_ratio =3D drm_fixp_div(drm_int2fixp(65535), drm_int2fixp(31)); + s64 fp_g_ratio =3D drm_fixp_div(drm_int2fixp(65535), drm_int2fixp(63)); + + u16 rgb_565 =3D le16_to_cpu(*pixel); + s64 fp_b =3D drm_int2fixp((rgb_565 >> 11) & 0x1f); + s64 fp_g =3D drm_int2fixp((rgb_565 >> 5) & 0x3f); + s64 fp_r =3D drm_int2fixp(rgb_565 & 0x1f); + + out_pixel.a =3D (u16)0xffff; + out_pixel.b =3D drm_fixp2int_round(drm_fixp_mul(fp_b, fp_rb_ratio)); + out_pixel.g =3D drm_fixp2int_round(drm_fixp_mul(fp_g, fp_g_ratio)); + out_pixel.r =3D drm_fixp2int_round(drm_fixp_mul(fp_r, fp_rb_ratio)); + + 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) { @@ -447,6 +467,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 @@ -668,6 +689,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 505847ec850855ee5c047985b0811416ff94e51f..d3783a8f84c203dcf772ccf84dc= 32a6ddd4fc573 100644 --- a/drivers/gpu/drm/vkms/vkms_plane.c +++ b/drivers/gpu/drm/vkms/vkms_plane.c @@ -26,6 +26,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.47.0 From nobody Wed Nov 27 21:38:19 2024 Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) (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 070621DF74A for ; Fri, 22 Nov 2024 16:19:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.195 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732292355; cv=none; b=LwTenUD3/ZdnBbO/CVwmereUfNYDPJvYU3nQ11r6N1hVoJPWwUoTPwxL4Ii8Yp3TBaajdo4rXdWH4qIjkE/1DsNTgMToWpvSUwFlzNEg91/f2R92S43KiM3iO7oak3RnTX3uZeYJIDVQ1sfZA1CMFH7bh3ziP4LrApsxaOlV5h4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732292355; c=relaxed/simple; bh=0QgKkVDHdfn4g/sZ9Ryhe8fOiTwNEjOz77ipz3qqPqQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=OEjjIIZ7i/NDTc9xg0hbMQBDUc5Rbphh/meOORcrVhoO8iWRHovDWI09+csH3Kay3yN5HdCC8mooRmLrWPnHNOLvSRGr3DAo1XH9cMp5e9STudXkqrHaxjCSob7eYVvM3ElStWDAW3jlxsuABv2qMoD/Rh2sJXsZztKUcgGB3Ak= 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=TSDSVm13; arc=none smtp.client-ip=217.70.183.195 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="TSDSVm13" Received: by mail.gandi.net (Postfix) with ESMTPSA id 6F90360009; Fri, 22 Nov 2024 16:19:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1732292351; 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=hxHofKZoem7NTwx2e51YaIJsnuWipPm4SrZGnIVNA8c=; b=TSDSVm134r4O/GcPCqhjTraNZ/Hv9z/h5WYY8Y3O4XYz+dPPB0+0sjyt4QYSCISl35KkSH zXctHq3wg3n7+5b+mwHuLMrDZ9ydlJfExO9rzqURrvqiTmzRKF3vDMWsDRvs13m+tMlfC/ bOp90pEA9DFJOn93aPGeOhp+OCYt0OdsrmdGKF/rfcm8PD7fbErA2sVkKOFa/mtLjrdjaM YN4MSdlESjkE1jkqOa8cj2p39gisLjNw4XOtGCacHPzwQ8yIwK/BU673+zFj1ssD88LOJv itygsMCVZczfmDvw/CqrVwF6M/tj3tqOSDmt+AQKJKQ45Ik5ySsDFr9kHOH+aw== From: Louis Chauvet Date: Fri, 22 Nov 2024 17:19:05 +0100 Subject: [PATCH v3 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: <20241122-b4-new-color-formats-v3-5-23f7776197c9@bootlin.com> References: <20241122-b4-new-color-formats-v3-0-23f7776197c9@bootlin.com> In-Reply-To: <20241122-b4-new-color-formats-v3-0-23f7776197c9@bootlin.com> To: Rodrigo Siqueira , Melissa Wen , =?utf-8?q?Ma=C3=ADra_Canal?= , Haneen Mohammed , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , 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, marcheu@google.com, nicolejadeyee@google.com, Louis Chauvet X-Mailer: b4 0.15-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=2066; i=louis.chauvet@bootlin.com; h=from:subject:message-id; bh=0QgKkVDHdfn4g/sZ9Ryhe8fOiTwNEjOz77ipz3qqPqQ=; b=owEBbQKS/ZANAwAIASCtLsZbECziAcsmYgBnQK73nQd8g2Uaa6WRCrf0T8UsTYQ3snrQRhVwG lWwD0HmrUaJAjMEAAEIAB0WIQRPj7g/vng8MQxQWQQgrS7GWxAs4gUCZ0Cu9wAKCRAgrS7GWxAs 4mbGEACOcewvrgjp33AeKzYqCsW4WeHqG2cr1ZCK8dCS5HvTlN6eN9+4axKkyKXF5yyIuZYn5Ue OSSzsRypXv4/+8nr1N38LHcw2hZ6t0rMK6prmRvJKgAjlDNtPKUjpCRVK2jpnh+uOMl/uxwADoS jGsvLfw221rYo/xufcI5Vpnwych3M5kHmkXeEhqwgROOuQDS1EFNJuV01H7HS/9k2WC+OSPaTKh c3OppPVXVu3WTIskaEkB9DrA7QDvbq5j5ItM+CNXDJKGrkcSH0Is0zpRz0nyckhSg0xMt0fYzlw wmHkB+yulsGoaqwX6RKCXRXlz8SaBG4N0zonlfhmH6s3ry7FoOujakwZaYsdrGkXsUE6UY8VSB+ dmCa+tQQqaGX4Stiib5pXwOJuvyMCVCUvar1/ALd/prfA9OO/rLAQxEU9orufGTLqMTSB9vskM0 LrxWeEVabtR8ynnlzyNV30diZpCKOyr1QJ8Lb8RhzRR4XUx9+Sw1N9WB9UmvipV+cHUSgkFo//i KvVtUXxZ7dmO6MDhVUBEYNpCpaD3TA7TuKN042MufXZYy3MAoj6aitgY+B6RuAoQv1WMbeBqKfR tvHAPqW6ry3BfFRVlCjSuf0/z0F9mcl6poWeLwIdR25Ku0dlPEbHcQCLwJlq5jXF+AiFATxDBqc wNEcn8WrGbRpbzA== X-Developer-Key: i=louis.chauvet@bootlin.com; a=openpgp; fpr=8B7104AE9A272D6693F527F2EC1883F55E0B40A5 X-GND-Sasl: louis.chauvet@bootlin.com Add the support for: - RGB888 - BGR888 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 7af6c5c048d5c482f47e4bd7954b765bc2d13b9d..f73d3de33807644a7f7294a4dc8= b9de2bec6e427 100644 --- a/drivers/gpu/drm/vkms/vkms_formats.c +++ b/drivers/gpu/drm/vkms/vkms_formats.c @@ -461,6 +461,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]) @@ -679,6 +682,10 @@ pixel_read_line_t get_pixel_read_line_function(u32 for= mat) return &RGBX8888_read_line; case DRM_FORMAT_BGRX8888: return &BGRX8888_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 d3783a8f84c203dcf772ccf84dc32a6ddd4fc573..e82b60fcda4bc2f2337e9c1e655= 15548ee06c9ed 100644 --- a/drivers/gpu/drm/vkms/vkms_plane.c +++ b/drivers/gpu/drm/vkms/vkms_plane.c @@ -21,6 +21,8 @@ static const u32 vkms_formats[] =3D { DRM_FORMAT_XBGR8888, DRM_FORMAT_RGBX8888, DRM_FORMAT_BGRX8888, + DRM_FORMAT_RGB888, + DRM_FORMAT_BGR888, DRM_FORMAT_XRGB16161616, DRM_FORMAT_XBGR16161616, DRM_FORMAT_ARGB16161616, --=20 2.47.0 From nobody Wed Nov 27 21:38:19 2024 Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) (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 32E8F1DF97E for ; Fri, 22 Nov 2024 16:19:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.195 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732292356; cv=none; b=dmWclxqJtbNFGld9a13K5kFaJSGAKMXV9UstmAPzbpvNM+9t9l4DAbd3I8xZX4ogBaKO54MlZIKEfy6dvAGTPTOuLlTuRU0xESHtMwoQs+nM6UJNxOXvtmr562jHDTX9titJp5gtDVzjaQoAwuaxQQZsluuvvsiXhACcIAlPgAM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732292356; c=relaxed/simple; bh=BUrScrD21+8OVFDE9O4vUOYPacl4PSRaT4P7htnDffU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=WtkcSWBEVyoAeg761Ig/CsTuFBxQYvrIrfIYeH06IKwqZLXz48UW3hwLmp2Kq5riRDYgvqeHKfO7JJXqxyeVF/7lY1JnjtKl869b7ePez3tZfOiswamqQkKSLJa36gHT2IAiIL6dEI32Ka6cPgpxO7UBhEKET5CsEP00VzqF0fw= 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=LNSyMyrN; arc=none smtp.client-ip=217.70.183.195 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="LNSyMyrN" Received: by mail.gandi.net (Postfix) with ESMTPSA id 78D9B60002; Fri, 22 Nov 2024 16:19:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1732292352; 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=cw1lm/kzwxajdmu7r2dcdO3tCjaL56NGjbITviJPxno=; b=LNSyMyrNOQOQ/zNP8CZrk9diIYI+GObKO7ndk1ruGTgW9/IT5LNMsNJ3aJMogiRU7vs6d7 EAj8aNqdswC2T/M3DUpLlpQiA6L4vOMiNfy3JQz0Ryyfz3e6nLATZhXWCzQmGollV1BEPI /rsKtXxP2JEmK26AcykVmZdg7y9O83i6RxRrBqQkNO9TnxJX2P94LTUy3psYObTOMH32u9 1WVplKy0oLqUhL6syZ9Hh33PeftbV3Tl1+HYFaM5eLcASBhfHkJLqWE8MB6OnLFKbUvzoo ysNC96jIEUL65F7YRY4sG8wtbfTngWem2FUExvXaoFqeQcMt/W9+m4P8CfmHQA== From: Louis Chauvet Date: Fri, 22 Nov 2024 17:19:06 +0100 Subject: [PATCH v3 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: <20241122-b4-new-color-formats-v3-6-23f7776197c9@bootlin.com> References: <20241122-b4-new-color-formats-v3-0-23f7776197c9@bootlin.com> In-Reply-To: <20241122-b4-new-color-formats-v3-0-23f7776197c9@bootlin.com> To: Rodrigo Siqueira , Melissa Wen , =?utf-8?q?Ma=C3=ADra_Canal?= , Haneen Mohammed , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , 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, marcheu@google.com, nicolejadeyee@google.com, Louis Chauvet X-Mailer: b4 0.15-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=5299; i=louis.chauvet@bootlin.com; h=from:subject:message-id; bh=BUrScrD21+8OVFDE9O4vUOYPacl4PSRaT4P7htnDffU=; b=owEBbQKS/ZANAwAIASCtLsZbECziAcsmYgBnQK73WMmLSZdj6tvlxFVmCvVjNVLuUTIeAGiMF Jz7i9EYw+6JAjMEAAEIAB0WIQRPj7g/vng8MQxQWQQgrS7GWxAs4gUCZ0Cu9wAKCRAgrS7GWxAs 4veoEACodwITQS3HZ4XnZlRC6hHFK8nvgpu5rzCswZMvQVekUhbzEB4fRIU1OvLATkWV2Y57X31 BD1c3Bzto5R1maNK6m5TtxoYIz43B96tD4UYGJTJofhplznVpisi7yKaaJP5nTGbcA7clrO2/DC tUmBjfD17UmMjfg2KxqRSNH1fP/vJk0aqoRvu4zElyQMt9q3zKKdgeePCFZkHeD92HfwOb0tWjW i4hYruh++2Y65gZAJcdBOS7SEFdOpCOpZhfuEvfcnWCsVxtpYtvtypxYoPNLPx+XRZeLC/3cmZ4 mR7Jvs7y8DtGfueRcUuOV6aj4KWegx2iyq+iPVNkDQRUKTvxe9ZEZBJ8PHA/ShNXtFkEeBmWY6L GClzqVPnSIywWKG2U5eaUNgSd4XAjjgc7S94jOlYiRn5ZbdCzIhCI3FciNMA/I/DEVwqgJlp80N lA8jUWcxmHwrzUfgl2UiVXBBCAREZX1BRqRxn6GC8KasrDW01eIs+aoQjLVvj0ABK92/VUpGNSm nGwZQbyM1cSlrWe3TuyRtPLGhUL6mamuMmBqpxf7NRriT1eZrDcUoMiZ/+izgUjo6rolW2PjILt hRt9EFP+iLWwqbP7YhxrP7uQQpePnMFn86mBCnml4wCUDRWW5PEg5matIZnR2IhfRWG7z/tS8wG rTtk9PgCSwK5+pg== X-Developer-Key: i=louis.chauvet@bootlin.com; a=openpgp; fpr=8B7104AE9A272D6693F527F2EC1883F55E0B40A5 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. Add support for the YUV format P010 Signed-off-by: Louis Chauvet --- drivers/gpu/drm/vkms/tests/vkms_format_test.c | 3 ++- drivers/gpu/drm/vkms/vkms_formats.c | 26 ++++++++++++++---------= --- drivers/gpu/drm/vkms/vkms_formats.h | 4 ++-- 3 files changed, 18 insertions(+), 15 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 4f565ecb591c34b08d9df577860488702200a384..1d9a6515ce44f56fc3032f9aad2= d11591bb71a68 100644 --- a/drivers/gpu/drm/vkms/tests/vkms_format_test.c +++ b/drivers/gpu/drm/vkms/tests/vkms_format_test.c @@ -226,7 +226,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 * 257, color->yuv= .u * 257, + color->yuv.v * 257); =20 KUNIT_EXPECT_LE_MSG(test, abs_diff(argb.a, color->argb.a), 257, "On the A channel of the color %s expected 0x%04x, got 0x%04x", diff --git a/drivers/gpu/drm/vkms/vkms_formats.c b/drivers/gpu/drm/vkms/vkm= s_formats.c index f73d3de33807644a7f7294a4dc8b9de2bec6e427..668c3a88a1f3e7d4e3c492a428b= c487291392da2 100644 --- a/drivers/gpu/drm/vkms/vkms_formats.c +++ b/drivers/gpu/drm/vkms/vkms_formats.c @@ -279,16 +279,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) + @@ -310,7 +311,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 @@ -505,8 +506,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) @@ -550,8 +551,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) { @@ -683,9 +685,9 @@ pixel_read_line_t get_pixel_read_line_function(u32 form= at) case DRM_FORMAT_BGRX8888: return &BGRX8888_read_line; case DRM_FORMAT_RGB888: - return RGB888_read_line; + return &RGB888_read_line; case DRM_FORMAT_BGR888: - return BGR888_read_line; + return &BGR888_read_line; case DRM_FORMAT_ARGB16161616: return &ARGB16161616_read_line; case DRM_FORMAT_ABGR16161616: diff --git a/drivers/gpu/drm/vkms/vkms_formats.h b/drivers/gpu/drm/vkms/vkm= s_formats.h index b4fe62ab9c65d465925d29911f26612193a80799..eeb208cdd6b1be9676b4706e0e3= cbb2ad7efe067 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.47.0 From nobody Wed Nov 27 21:38:19 2024 Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) (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 2B94F1DFD8B for ; Fri, 22 Nov 2024 16:19:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.195 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732292357; cv=none; b=geHy/ceoaxDres09NZOLgl0bvAzD2h1IdSWYZThNPmAOM6OX0B1XhToKqaAd4u/OzrBU24QbWMYVyENMqbjzF6Fq7vg/0PnITlqXyTd0ICiQ3xIAc0pM1ayVT/2UXiVKf/ut0lyBPjz5G0Sa6dLTEfWPwP2/amMe6N4X5uEjS64= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732292357; c=relaxed/simple; bh=cRhyJpqK4UQEB6lUCB9BGi7XqZMxLwWjbRwzbxs0rs8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=bDaXAS25ZNNB1yBfgg+N7l/QnkNJZPLe48xCrwNjKO5MNzyhJQZC9IYuSLkodD5DhEZmXIYtERjxQAGPMYeUSh1aqubiX/75bkX5jD88PeWn56Zz6pNsPzB9yK5pFfU0t5mccrKvfSKEGaBXWMIPchAPD/BmS/f2DEgmFK5QuoQ= 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=BNGv9Nb+; arc=none smtp.client-ip=217.70.183.195 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="BNGv9Nb+" Received: by mail.gandi.net (Postfix) with ESMTPSA id 976A960004; Fri, 22 Nov 2024 16:19:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1732292353; 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=zExytEYkGHJ18P/wL/RkrQGgwqv47QAp/V3OFve+Zi0=; b=BNGv9Nb+UG0l8ClI3kvrdQDLuDaDjEmlKxSP00HFdakhEpm6a+B3ZSMdWyMdO/5ou6+Kgx vwZ9g8pIoLdfqFHmDK9DCdqjSRnV1Fpxi7TOl2KJNJHHE3xZ7dR3Eth/txA9ynyM4OZD/3 Ko1X2gZ6CHj61j2z1PmeuaBasEBtn24qQdwhEE0l8WA1K2/bj10LvQT5uIgYKOTCP5J4Yx XbwKKCoh/uTfXnj+GBic2FfkC/zSW6Onm+Q654ECVuoPl4kgLf4Eu9sfLpiEYIUuyfjqAS TA3hSbmDulFrhwLmTJWoPpSqMzz1HyuVKXr9fRqFblZ8Gc3y0sZUiv+zX2wfRw== From: Louis Chauvet Date: Fri, 22 Nov 2024 17:19:07 +0100 Subject: [PATCH v3 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: <20241122-b4-new-color-formats-v3-7-23f7776197c9@bootlin.com> References: <20241122-b4-new-color-formats-v3-0-23f7776197c9@bootlin.com> In-Reply-To: <20241122-b4-new-color-formats-v3-0-23f7776197c9@bootlin.com> To: Rodrigo Siqueira , Melissa Wen , =?utf-8?q?Ma=C3=ADra_Canal?= , Haneen Mohammed , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , 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, marcheu@google.com, nicolejadeyee@google.com, Louis Chauvet X-Mailer: b4 0.15-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=5269; i=louis.chauvet@bootlin.com; h=from:subject:message-id; bh=cRhyJpqK4UQEB6lUCB9BGi7XqZMxLwWjbRwzbxs0rs8=; b=owEBbQKS/ZANAwAIASCtLsZbECziAcsmYgBnQK73e/e3tmAzQU/S2Xd+BCU/ID64NUFP7Gjn0 Zu2YC/YxRGJAjMEAAEIAB0WIQRPj7g/vng8MQxQWQQgrS7GWxAs4gUCZ0Cu9wAKCRAgrS7GWxAs 4kiDEADFFuwryVQO7OFUq2znwPv7XNIB9QbgFLQANGPjLf8UghYQTp/o1gYTpbunQ7ShneCFoEt aFAl5sxXN6zvjH/L2SSgEW1sRcvpHJYFqyLjR44n8l6kg6dx68lMUV5gO+Pqnu3LZX1maqONmgI +DCuQO4AgPYek5KLmGGX9ZgNVecDYxJjY3ehkfG6p5Bdzl5jxz7zirord4BGZ/R9LAGg1SGQMAM 1sH9eehenDgYl35O0u0Vuco0IDWfZUnuNyGsJZjpB29cuDL5ivhyhJVPoviApaV+32VV2DtGLl2 i4H+kxJz5WCWflTIm0GwvD9QcTYRgt1/9UX+YbSKaVxyY1x6HhPU/7CproracRKgLxS8gN+Nnpj kuzOvsOsks34AyGWIDuLTR6VsDEfCtyUVW9LZEAWNFRLh/OCRYLgh0Tyjgd624KH/sDH4NMTkdc CmXfcMlJGIFEWh4nFXktMUSfb4An6aL8xK1AhXurWUblqvetPcCJYC+epfafxVqAH3waJovh11l W/2Qoy2Bc21pBtggNrD7en9COw3KYhXZBO+1GW779xKczM6Hb/CQnEeVH3yulUYuilIZqHfiwuK CnMqcIVtcW98FlprW9Mwym08cy6YoYw42D6BivL4yoS46l2Pi33ZUqRmBGLCC65E3k0EXRoTUzi H0L3RR29Rl7AmPA== X-Developer-Key: i=louis.chauvet@bootlin.com; a=openpgp; fpr=8B7104AE9A272D6693F527F2EC1883F55E0B40A5 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. 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 668c3a88a1f3e7d4e3c492a428bc487291392da2..d2ce5848eb3fb667a882d1efd7c= 8af5baec97bf4 100644 --- a/drivers/gpu/drm/vkms/vkms_formats.c +++ b/drivers/gpu/drm/vkms/vkms_formats.c @@ -486,35 +486,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 @@ -706,7 +727,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.47.0 From nobody Wed Nov 27 21:38:19 2024 Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) (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 144FC1DFDAD for ; Fri, 22 Nov 2024 16:19:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.195 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732292358; cv=none; b=u0Q1KcyRsWC7q80E5ew/KzIurO7AfE3uHDyJp8T06BhHcpudv9k1WpxgA2TO1N0MJW6anmpuUS8k63/IOIGxSc4q7eh5xzju363gs28BSNyYje8JD/pvOa8SNYSF4qKXkG70/ABbJ7eDXOCbJIxVaALLedRhdtGKR6tqAf1mozo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732292358; c=relaxed/simple; bh=DCYx66irwTSpBabckwUwZmGruKQUcBMtLxM8Do3N2IQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=oe7BtRrlSN/NJP+krXE6O4weaWRx0zqcOL2wPDOq81iPrZrgSA6hvIDBo0cXhQAmX07zDctN+c8kVqiY6OxcS+FEJPTGYCXPrxl7BtGCECOw2sOSMb0LfNmPPjl/7p/FzOVqph6hDlypGHTz9VASWM4Ag9LZUlYaj3AdphX4qig= 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=PtHoLXWJ; arc=none smtp.client-ip=217.70.183.195 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="PtHoLXWJ" Received: by mail.gandi.net (Postfix) with ESMTPSA id AD73A60005; Fri, 22 Nov 2024 16:19:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1732292354; 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=E53FflVZUbLnlF8wplWhxBERpMv4taFo3hTXjKtrZCU=; b=PtHoLXWJH0/6BA86CIHExNewbrAdsOGcPzSbF1IfrKNuZX4BJQTPeCS25v9OAc7Il5tZAm MCnKEcaqT4J40LrSHTKYrymGmOy5IRMnPI1IGWWvdeknfdMveIl8yQ89Bc0zol7FQaYHSy g84X3Ioa7SwFOTEwMPilTovRuPrRr/CzcFIuL2o50/X32xNg50mJa0Dhl351ugCCIBCEk7 py4Ql/CtlEq1hGVa5Ii70aYhZtTzVhtVdux74DXVwSUYh2pSzhQqkpAUHsVgi1kERhLPyh WPstHDoe7S1ttQfkogGgO2rPoYreUfCk1hz1zPGsytIiUPSxiMaulKgftI9Tnw== From: Louis Chauvet Date: Fri, 22 Nov 2024 17:19:08 +0100 Subject: [PATCH v3 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: <20241122-b4-new-color-formats-v3-8-23f7776197c9@bootlin.com> References: <20241122-b4-new-color-formats-v3-0-23f7776197c9@bootlin.com> In-Reply-To: <20241122-b4-new-color-formats-v3-0-23f7776197c9@bootlin.com> To: Rodrigo Siqueira , Melissa Wen , =?utf-8?q?Ma=C3=ADra_Canal?= , Haneen Mohammed , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , 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, marcheu@google.com, nicolejadeyee@google.com, Louis Chauvet X-Mailer: b4 0.15-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=1997; i=louis.chauvet@bootlin.com; h=from:subject:message-id; bh=DCYx66irwTSpBabckwUwZmGruKQUcBMtLxM8Do3N2IQ=; b=owEBbQKS/ZANAwAIASCtLsZbECziAcsmYgBnQK74GL6Vhqnot+DzZiz2Gb2MKlgyveVzGXgPM +Jhf+j7xvuJAjMEAAEIAB0WIQRPj7g/vng8MQxQWQQgrS7GWxAs4gUCZ0Cu+AAKCRAgrS7GWxAs 4mv9D/oDnKG8lR+N8flppo33NvpPhyMa8bD3jAMRvLb/FL2nu73pMXwIDsKcS92Q224p4AQiU6h RvEoCNeWOqp7mzon+d2i8S+mXEDZDq0tzEd+D4y5kvCLbvAhZNNfo8rcnW6mKON2r9se7u2yoL0 sRvSV/xp723fSehYpiFLgisALxslaWswFvwvL16hlm0PnhowbsKPndzpuP+Ve6wgtddr8FI2R8j g/ClZPpE1CuKnfbxbqXBtbiWfvfkMnLWHcUudW22WPkceneYsfTd48U+cUbmN34Fu/QW6BQNDg3 aFCDSSSbthn37VyK6ye+1E+1nb/uctHW734k7Xs54CWCwTXKBa2pk7QEunxOIet3b3GDf8bayCf pATVk/YipLYCz2yh/CIbIblgNVqhDA985ML/Gh/RnIaLgQ070U3m1wqHv633wCIsR+vDrqR7rY0 JD3UsP/got/3HbmiIEadODNALWqy/Y6TNUhl+tPavfOa+0WL2K3ePW0/EW+cGUpkdu4Zja7P3ci xp26Py4YCP8f6t8kUNtltqwGxfLjVehXLgxCXiyp7VDXc8+uFlPi+fj6Uj9PSW4IkrBl+SO1qRL 7/f9RZKHCrXhHXjSCCxwe0qoTBY8KC32hdmYewnkcUo/gnNtYnWnMRyj5AAxByHI2o4Lljui+vF siTK1ZIx+hEr0XA== X-Developer-Key: i=louis.chauvet@bootlin.com; a=openpgp; fpr=8B7104AE9A272D6693F527F2EC1883F55E0B40A5 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 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 d2ce5848eb3fb667a882d1efd7c8af5baec97bf4..c895126e9136bff7820ac7dfc1a= 3b6418c9ca2b1 100644 --- a/drivers/gpu/drm/vkms/vkms_formats.c +++ b/drivers/gpu/drm/vkms/vkms_formats.c @@ -535,7 +535,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 @@ -728,6 +729,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 e82b60fcda4bc2f2337e9c1e65515548ee06c9ed..4ab0fab4dd09f4be14308afb2f5= 2bc6465f6396d 100644 --- a/drivers/gpu/drm/vkms/vkms_plane.c +++ b/drivers/gpu/drm/vkms/vkms_plane.c @@ -41,6 +41,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.47.0