From patchwork Thu May 16 13:18:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Louis Chauvet X-Patchwork-Id: 13666205 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3E9A3C25B77 for ; Thu, 16 May 2024 13:18:37 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E085410E31B; Thu, 16 May 2024 13:18:33 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=bootlin.com header.i=@bootlin.com header.b="kmLcktsd"; dkim-atps=neutral Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0609F10E107 for ; Thu, 16 May 2024 13:18:28 +0000 (UTC) Received: by mail.gandi.net (Postfix) with ESMTPSA id 2FFF560009; Thu, 16 May 2024 13:18:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1715865507; 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=4NUEtLPPG+gknA/6DG8Zyrt9sXcuYUyuc7aw9E6ObTs=; b=kmLcktsd1MZss83SrZqVm248vYUn5BcqYu4CaphQCP5EpwwYBSi4sNX3BStPOfLfC1+OX3 PfuinmXFx6SHW4TAmP4wvtZTTB5M9NFSYv3Szpp/dUMnlegtxZHNeXBwnUVdTCQn0RrobU 0KlH0W4BrMuBAXvuxwNIaHKNjo7bGowiYI3RzbkUOv5oengWdXK+o7hLA36ZpiZjA/cDOz eaZm+p6RoKjc5nVMcCPq4sPOUx/DZA9li8T67wcS1z5qAe9U9g2n5xdZ+Y9jORu5rbuZ2r 2D9PsSLJrhxCLDxV942KHN+RhBUmp08606EqyeQKxvWnpZ3IerEv6pmhfR2elw== From: Louis Chauvet Date: Thu, 16 May 2024 15:18:17 +0200 Subject: [PATCH 1/5] drm/vkms: Create helpers macro to avoid code duplication in format callbacks MIME-Version: 1.0 Message-Id: <20240516-b4-new-color-formats-v1-1-74cf9fe07317@bootlin.com> References: <20240516-b4-new-color-formats-v1-0-74cf9fe07317@bootlin.com> In-Reply-To: <20240516-b4-new-color-formats-v1-0-74cf9fe07317@bootlin.com> To: Rodrigo Siqueira , Melissa Wen , =?utf-8?q?Ma=C3=ADra_Canal?= , Haneen Mohammed , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie 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.14-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=7697; i=louis.chauvet@bootlin.com; h=from:subject:message-id; bh=1IQN3YQIt9/pGs6sVDiW73WHCdJimhva/zrt+9Ypbqo=; b=owEBbQKS/ZANAwAIASCtLsZbECziAcsmYgBmRgee4caU8nRDHKwKfmJ/hjX5o2gRX4xNRERn5 KWGkPcbK0qJAjMEAAEIAB0WIQRPj7g/vng8MQxQWQQgrS7GWxAs4gUCZkYHngAKCRAgrS7GWxAs 4u7RD/4x4MmR4LQEYIz7gyN6oofKv6dZVxlgl4DNU6k0oQqJZWAQmLjuzwHLf3UpEAYTM4lXkjB yT8g/6cuTA4etriFtQu5BGcW02fC61ANk0VAkgMgDJlw+4dqX8w8U926FEMxWJxc/aCPRtXBQzW c1r+hALA6TOtDtf0ygvOF804r62vMKnfal8OASelnVHNaCgenVJ17RsW+mJuIjDA07nXGjlNdhe Ieg6TvsDVGlOYAjzzyoAkR/7d0DWIWXqGbOSdszKc+tQXerovghoVld9ktWg1v4vZR6KiZPHtGv 8d5kgcf4xVqZEvqs6yleMmxpdZvswXllB+AP0kTqTowX4GiKjaX4E++jlwz73RCAZBBzyys9fR5 WMQApCvJFy9MJ5a98iqsShhMDfK4H3tmtl+303WHP+Y9TVnIb7JGrpSDgYMUIY3AI9lTzAToKUL laCLgw/g9xENiRdYeD89wuL7Lsg7djZoMj/Lpx1pho8eXQukMWxOQ2i2Qrxq1cGLjEzcpE9ZeFj qXyYSHNWU5EERtOMeversY7GjwtQwgBjJuVM3N+nTvczjWRWOwgzRPWyIwdsjo4huQASZbzX7s0 6UrJdxlP4ekZvH824DA4J0ZcGzPI4N93IuFcEylvipenD4cPdda+O2YzJMxF2ZiIR0QRYHmJBKL D+11D055ci0vblA== X-Developer-Key: i=louis.chauvet@bootlin.com; a=openpgp; fpr=8B7104AE9A272D6693F527F2EC1883F55E0B40A5 X-GND-Sasl: louis.chauvet@bootlin.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 | 163 +++++++++++++----------------------- 1 file changed, 58 insertions(+), 105 deletions(-) diff --git a/drivers/gpu/drm/vkms/vkms_formats.c b/drivers/gpu/drm/vkms/vkms_formats.c index 88edf773b11b..d26707cff86e 100644 --- a/drivers/gpu/drm/vkms/vkms_formats.c +++ b/drivers/gpu/drm/vkms/vkms_formats.c @@ -284,6 +284,58 @@ VISIBLE_IF_KUNIT struct pixel_argb_u16 argb_u16_from_yuv888(u8 y, u8 channel_1, } EXPORT_SYMBOL_IF_KUNIT(argb_u16_from_yuv888); +/** + * READ_LINE() - Generic generator for a read_line function which can be used for format with one + * plane and a block_h == block_w == 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. The first argument is always a + * &struct 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_start, \ + int y_start, enum pixel_read_direction direction, int count, \ + struct pixel_argb_u16 out_pixel[]) \ +{ \ + struct pixel_argb_u16 *end = out_pixel + count; \ + int step = 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_pixels); \ + \ + while (out_pixel < end) { \ + pixel_type *(pixel_name) = (pixel_type *)src_pixels; \ + *out_pixel = (callback)(__VA_ARGS__); \ + out_pixel += 1; \ + src_pixels += 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 components 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_ARGB16161616() - Generic generator for ARGB16161616 formats. + * The pixel type used is u8, so pixel_name[0]..pixel_name[n] are the n components 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_16161616(function_name, pixel_name, a, r, g, b) \ + READ_LINE(function_name, pixel_name, u16, argb_u16_from_u16161616, a, r, g, b) + /* * The following functions are read_line function for each pixel format supported by VKMS. * @@ -389,118 +441,19 @@ static void R4_read_line(const struct vkms_plane_state *plane, int x_start, Rx_read_line(plane, x_start, y_start, direction, count, out_pixel); } -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 = out_pixel + count; - u8 *src_pixels; - int step = get_block_step_bytes(plane->frame_info->fb, direction, 0); - - packed_pixels_addr_1x1(plane->frame_info, x_start, y_start, 0, &src_pixels); - - while (out_pixel < end) { - *out_pixel = argb_u16_from_gray8(*src_pixels); - src_pixels += step; - out_pixel += 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 = out_pixel + count; - u8 *src_pixels; - - packed_pixels_addr_1x1(plane->frame_info, x_start, y_start, 0, &src_pixels); - - int step = get_block_step_bytes(plane->frame_info->fb, direction, 0); - - while (out_pixel < end) { - u8 *px = (u8 *)src_pixels; - *out_pixel = argb_u16_from_u8888(px[3], px[2], px[1], px[0]); - out_pixel += 1; - src_pixels += 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 = out_pixel + count; - u8 *src_pixels; - - packed_pixels_addr_1x1(plane->frame_info, x_start, y_start, 0, &src_pixels); - - int step = get_block_step_bytes(plane->frame_info->fb, direction, 0); - - while (out_pixel < end) { - u8 *px = (u8 *)src_pixels; - *out_pixel = argb_u16_from_u8888(255, px[2], px[1], px[0]); - out_pixel += 1; - src_pixels += step; - } -} - -static void ARGB16161616_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 = out_pixel + count; - u8 *src_pixels; - packed_pixels_addr_1x1(plane->frame_info, x_start, y_start, 0, &src_pixels); +READ_LINE_ARGB8888(XRGB8888_read_line, px, 255, px[2], px[1], px[0]) - int step = 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]) - while (out_pixel < end) { - u16 *px = (u16 *)src_pixels; - *out_pixel = argb_u16_from_u16161616(px[3], px[2], px[1], px[0]); - out_pixel += 1; - src_pixels += step; - } -} -static void XRGB16161616_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 = out_pixel + count; - u8 *src_pixels; - - packed_pixels_addr_1x1(plane->frame_info, x_start, y_start, 0, &src_pixels); +READ_LINE_16161616(ARGB16161616_read_line, px, px[3], px[2], px[1], px[0]); +READ_LINE_16161616(XRGB16161616_read_line, px, 0xFFFF, px[2], px[1], px[0]); - int step = get_block_step_bytes(plane->frame_info->fb, direction, 0); +READ_LINE(RGB565_read_line, px, u16, argb_u16_from_RGB565, px) - while (out_pixel < end) { - u16 *px = (u16 *)src_pixels; - *out_pixel = argb_u16_from_u16161616(0xFFFF, px[2], px[1], px[0]); - out_pixel += 1; - src_pixels += step; - } -} +READ_LINE(R8_read_line, px, u8, argb_u16_from_gray8, *px) -static void RGB565_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 = out_pixel + count; - u8 *src_pixels; - - packed_pixels_addr_1x1(plane->frame_info, x_start, y_start, 0, &src_pixels); - - int step = get_block_step_bytes(plane->frame_info->fb, direction, 0); - - while (out_pixel < end) { - u16 *px = (u16 *)src_pixels; - - *out_pixel = argb_u16_from_RGB565(px); - out_pixel += 1; - src_pixels += step; - } -} /* * This callback can be used for YUV formats where U and V values are From patchwork Thu May 16 13:18:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Louis Chauvet X-Patchwork-Id: 13666204 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 974B7C25B74 for ; Thu, 16 May 2024 13:18:34 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A733810E1BC; Thu, 16 May 2024 13:18:33 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=bootlin.com header.i=@bootlin.com header.b="C7B1htAo"; dkim-atps=neutral Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) by gabe.freedesktop.org (Postfix) with ESMTPS id C51EE10E107 for ; Thu, 16 May 2024 13:18:30 +0000 (UTC) Received: by mail.gandi.net (Postfix) with ESMTPSA id E5C6760005; Thu, 16 May 2024 13:18:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1715865509; 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=HLHZM9ZEhw6N1E74N1Nghx7nW+1xKLp7LJosjk775lc=; b=C7B1htAoEhuuZ6LrleXEcUGtVZka/7PAUqMvl/rv4Np7mC13VKNZmCWKIMzQj232dDanw3 v2XILhlzSveCCX7OvJBGVvZU24TqJDwjHIpJgEZFj+MpvT9smMMxnwZtPF1/Y0D86gJvrL PGEN+hvyqUW4ODc7XrB1R3FlZf4wbK65vG0IA8A6fApdRrvtDdEB8w9rDynOoPUSyKO7jO PemtsEOLI2CIBj2ttcT5yZx89kxhj9Qqucum+pLEAxwBLVDEwWhqn1QAMsweLL40Adqmft LND+Jw2MwDvE/9UksdikFLsG73RicwoLijhEzdwhD0AvG8eJYqwnRawzSp0dmQ== From: Louis Chauvet Date: Thu, 16 May 2024 15:18:18 +0200 Subject: [PATCH 2/5] drm/vkms: Add support for ARGB8888 formats MIME-Version: 1.0 Message-Id: <20240516-b4-new-color-formats-v1-2-74cf9fe07317@bootlin.com> References: <20240516-b4-new-color-formats-v1-0-74cf9fe07317@bootlin.com> In-Reply-To: <20240516-b4-new-color-formats-v1-0-74cf9fe07317@bootlin.com> To: Rodrigo Siqueira , Melissa Wen , =?utf-8?q?Ma=C3=ADra_Canal?= , Haneen Mohammed , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie 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.14-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=2595; i=louis.chauvet@bootlin.com; h=from:subject:message-id; bh=Bz+7xOk7+Ss37CG2k9sDLkcuE9hiXcLFPLpoYZI/go0=; b=owEBbQKS/ZANAwAIASCtLsZbECziAcsmYgBmRgefLK1GgMQ4QN4HIniJu7MnEMzqonOYp2bWo 8Ckp0RAzTiJAjMEAAEIAB0WIQRPj7g/vng8MQxQWQQgrS7GWxAs4gUCZkYHnwAKCRAgrS7GWxAs 4n7oEAC4hNCKxCXI52Li1iB3UsGZEbAbE9mOWwrMa5tO49DIKJSVP4A1LhAmpShpRG35pBwNOWX Vt/6EQoL7Swf3Dw+nUOeiPpDXJniVzFCRisicQtn68ehgJjGqc2NuVVT7q/eVlJIvq8BmSW0PMv xDiRlQJxfrWctTIXZ/c7nKl6bB5G8G3q4qzH9Rb0VNrmif68nCbsimBIG0kLW6WtcydnEJt47xX BYRJnBSHpbMYmLwbwXSAhJ50YTDIcCPaENet1IedPKgfRNhoCXmjvWIyHr2RlWop3IQdXGgB5Zu F15u9xWURkA6pDqGlJfUZdO6eCLhUwsclgugKLxinwiiP5ppqqd0sII3BxSXt+uG8o8p3CN8LpF XbmhzXyE13/s0ZF/uUNGp9Krqbe1OyBCm32q6eHcOkVFFcTDZ2d8kIZAZNvygFv9R3D/JLCTd3A afgsjR544hbtQImKAMA7Q2657vacMEvIveZckC5NowVzHQKeIJydO0c6VGUCTGakssrWqvTqzzL +FA/MAzLXUoq6zY1tZ7och3gx4cdthVwFnKmE10AcuLquiVG0A4JcPNqEDmVmf1aH+gfJutmkAk KmeFBdgDuPzcxtTv2yGGYvUyLkSKp+BgWTvDYm183A3oSF2Ywg1TrR2amo348rqTxS4Hsq6TNj9 8RbC36CkRlC1XVA== X-Developer-Key: i=louis.chauvet@bootlin.com; a=openpgp; fpr=8B7104AE9A272D6693F527F2EC1883F55E0B40A5 X-GND-Sasl: louis.chauvet@bootlin.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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/vkms_formats.c index d26707cff86e..54fe03c2616d 100644 --- a/drivers/gpu/drm/vkms/vkms_formats.c +++ b/drivers/gpu/drm/vkms/vkms_formats.c @@ -443,8 +443,14 @@ static void R4_read_line(const struct vkms_plane_state *plane, int x_start, READ_LINE_ARGB8888(XRGB8888_read_line, px, 255, px[2], px[1], px[0]) +READ_LINE_ARGB8888(XBGR8888_read_line, px, 255, px[0], px[1], px[2]) +READ_LINE_ARGB8888(RGBX8888_read_line, px, 255, px[3], px[2], px[1]) +READ_LINE_ARGB8888(BGRX8888_read_line, px, 255, px[1], px[2], px[3]) 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]) READ_LINE_16161616(ARGB16161616_read_line, px, px[3], px[2], px[1], px[0]); @@ -659,8 +665,20 @@ pixel_read_line_t get_pixel_read_line_function(u32 format) 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 67f891e7ac58..941a6e92a040 100644 --- a/drivers/gpu/drm/vkms/vkms_plane.c +++ b/drivers/gpu/drm/vkms/vkms_plane.c @@ -14,7 +14,13 @@ static const u32 vkms_formats[] = { 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, From patchwork Thu May 16 13:18:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Louis Chauvet X-Patchwork-Id: 13666207 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EB8D3C25B74 for ; Thu, 16 May 2024 13:18:45 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E6A2C10ECF7; Thu, 16 May 2024 13:18:44 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=bootlin.com header.i=@bootlin.com header.b="fCxgHYG1"; dkim-atps=neutral Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3236710E107 for ; Thu, 16 May 2024 13:18:32 +0000 (UTC) Received: by mail.gandi.net (Postfix) with ESMTPSA id 968976000E; Thu, 16 May 2024 13:18:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1715865510; 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=Vx9t+d+xMex2ioN1WTpmWd+/kN+q1C09EL0d7wxjZ4k=; b=fCxgHYG1dygL6ueJKKJN56gVjqp8TKyyyeBCdnIaPdQWADUurPsmtis68T8/gDRf4jNdy8 7rL4tAZegrJWdX8Fbic7tm9jptky80owYdFZsOgeDSf4/VAYrBidwQBh5jNMUhxYNr4ayq oHKsOzy1WWspgULPFMOkACIm6G8XqJ9619ZSGF6DTDB3eEMs7Td++hUm1V9rlrnIqp+Ydh AEpGFG8Tf5V+MCP0GsVbxrRdOHRXJ+mxcRkP5P9DhAiFEJphumfpuVdjp3BoSGXu9KPPBL IHJJBPTNaquJL8xRA9YPDr2u4k/XS7s+mu4SgtBCYszJZu0+c61lkBDeYXFfnQ== From: Louis Chauvet Date: Thu, 16 May 2024 15:18:19 +0200 Subject: [PATCH 3/5] drm/vkms: Add support for ARGB16161616 formats MIME-Version: 1.0 Message-Id: <20240516-b4-new-color-formats-v1-3-74cf9fe07317@bootlin.com> References: <20240516-b4-new-color-formats-v1-0-74cf9fe07317@bootlin.com> In-Reply-To: <20240516-b4-new-color-formats-v1-0-74cf9fe07317@bootlin.com> To: Rodrigo Siqueira , Melissa Wen , =?utf-8?q?Ma=C3=ADra_Canal?= , Haneen Mohammed , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie 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.14-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=2148; i=louis.chauvet@bootlin.com; h=from:subject:message-id; bh=5IfsKnI5XKfHej2TaJx8ofttFTvbQESKWNRUCYM4Rus=; b=owEBbQKS/ZANAwAIASCtLsZbECziAcsmYgBmRgefF7k6Gb5WPbAEh8zZMhkeUPPMY1wQQjcqw S77aopCS/SJAjMEAAEIAB0WIQRPj7g/vng8MQxQWQQgrS7GWxAs4gUCZkYHnwAKCRAgrS7GWxAs 4kmAEACd7vRpuKPf1Megwk67Wm8GePKaPZILvyzIf2YY9DY91ZuC0QRYAy4EK5k8SkSWvBB4PwA E5IWFgeWjJljW5UHQPRLuwtqGy4/t5CckKxdRw/Nm9+ymBbw0H24RiRMGgZf+i+itbBxrHCjByR w06MOtdQfPBB0gxalHPLeVX347ki7L5omQn7T5Bo3dO+Blv7fD50SkOztHMoFQtJ3VD3Nvu3RhO A6ruvmbynzCT+MO04IP8z+OX0ojJ0rRfe4LLiOAGozbRfeiJNd8I6jL/AUqVRdeJrhHs5Z06Wfh g4/9qMGS2PyfGF0yW4+LG+bgh7StlqmqX5BIwWQkI+HCAhOQ8WYvLCiJXdWjLQYksXkTsvwiP43 Kn+evdQ3H5uJ2Aq2CwgFti1KSuyAy21GzpqO4JLWWxl02EN3IZAc2g8Typa7WXjU45MG9+8AXFi +hNQh13m0yNM9nhLdE5yI62FWsufXYD4WVuyAV134Fllvjrw5gzNJo4kx2tzWE80PFYUX03G0oH HlpeknjTlcbyAWRQe8EV68+sCx1LO68TI9DWgPPmT/PXnuXhUkHYkuyxkcHzHj63m24O6MMk8Yi TCzPbPK0ilCNVqTeYitArhSBmIzQ0HQDkwJ76ccaBtFUVL//2YIymiItmls/f3BTtictEQL+NIi Wsl107/fRd2UPnw== X-Developer-Key: i=louis.chauvet@bootlin.com; a=openpgp; fpr=8B7104AE9A272D6693F527F2EC1883F55E0B40A5 X-GND-Sasl: louis.chauvet@bootlin.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 | 7 ++++++- drivers/gpu/drm/vkms/vkms_plane.c | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/vkms/vkms_formats.c b/drivers/gpu/drm/vkms/vkms_formats.c index 54fe03c2616d..e9cca5ae57bc 100644 --- a/drivers/gpu/drm/vkms/vkms_formats.c +++ b/drivers/gpu/drm/vkms/vkms_formats.c @@ -452,9 +452,10 @@ 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]) - READ_LINE_16161616(ARGB16161616_read_line, px, px[3], px[2], px[1], px[0]); +READ_LINE_16161616(ABGR16161616_read_line, px, px[3], px[0], px[1], px[2]); READ_LINE_16161616(XRGB16161616_read_line, px, 0xFFFF, px[2], px[1], px[0]); +READ_LINE_16161616(XBGR16161616_read_line, px, 0xFFFF, px[0], px[1], px[2]); READ_LINE(RGB565_read_line, px, u16, argb_u16_from_RGB565, px) @@ -681,8 +682,12 @@ pixel_read_line_t get_pixel_read_line_function(u32 format) 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 941a6e92a040..1e971c7760d9 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[] = { 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, From patchwork Thu May 16 13:18:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Louis Chauvet X-Patchwork-Id: 13666208 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B968BC25B78 for ; Thu, 16 May 2024 13:18:46 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2B21310ED06; Thu, 16 May 2024 13:18:45 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=bootlin.com header.i=@bootlin.com header.b="I1LzdYmY"; dkim-atps=neutral Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) by gabe.freedesktop.org (Postfix) with ESMTPS id A316710E107 for ; Thu, 16 May 2024 13:18:33 +0000 (UTC) Received: by mail.gandi.net (Postfix) with ESMTPSA id 060E960010; Thu, 16 May 2024 13:18:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1715865512; 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=6nA+RQr2o0RUIm9d018DCVym4lDDnhOksBWUi79w7y4=; b=I1LzdYmYzaRC0cv+59KZRCiIJ0g4Ar7BcQyMWkVGdp2/pUbzejOfQIfqbUn9QQJmLspuNL OCnEng3h32eM2H8Krx03mvoe7kRQqV30opv1wAdzOdY35N/xZt9Pu+Nvldj5qKuAPjxd2p VDA8LPW88HIa507xA8koASLl1krwLLiNUTbVS8k1X6u8/yg1P79dKd1h8DYcuDoqauR770 9QD7hBA09KnsB8jypzJVI7WIEOP5t8KX2JGBWZXfCiSEZvmaKdSyczHriT1JkUsMCz7Xcc Fb+uT1lt1HpTxRYdARkpTPrMlRZ+HFdFwO+ueq0o6kIM3s/HXkJ6cs2fz1OYWw== From: Louis Chauvet Date: Thu, 16 May 2024 15:18:20 +0200 Subject: [PATCH 4/5] drm/vkms: Add support for RGB565 formats MIME-Version: 1.0 Message-Id: <20240516-b4-new-color-formats-v1-4-74cf9fe07317@bootlin.com> References: <20240516-b4-new-color-formats-v1-0-74cf9fe07317@bootlin.com> In-Reply-To: <20240516-b4-new-color-formats-v1-0-74cf9fe07317@bootlin.com> To: Rodrigo Siqueira , Melissa Wen , =?utf-8?q?Ma=C3=ADra_Canal?= , Haneen Mohammed , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie 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.14-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=2958; i=louis.chauvet@bootlin.com; h=from:subject:message-id; bh=rUDBc7Fls6lB9g+/LJ7W6Vq5BjE+64XKjkh6cy3am8k=; b=owEBbQKS/ZANAwAIASCtLsZbECziAcsmYgBmRgefrJqPnNpEN07KqfPNMcxemb5nNOPRNgpHN I/EojP6AxmJAjMEAAEIAB0WIQRPj7g/vng8MQxQWQQgrS7GWxAs4gUCZkYHnwAKCRAgrS7GWxAs 4uJxEADYJS3QytMjXrQJWf4ZDKKIYti7sQB82/dWKm6lJySdBI9iJuvI9oea0MvkoDiZ3OT5tsu fjDRVo+4tB4i0ebimHN2ySUtoblF5Q45K1gMjrHHSHDa9uiQ1HPkOrmTBUccQPFNLgEQQYuOCtv G9HXw1mQPWCyJWlkdnEQB2oD2Dp26Kkvf7wuD1HFRWwzDg5V6hMW2SFhsUsMAUp60SUxkgdq3fD B2S1nvOTaoD5ZYjBS1uzMXqoLDnHdoSP8hWMujWCMXqaSJw5u6X4XyjlyXp49aAazBv8a3f6jXJ upbO99iYrW4ejd/GGccPvjXgHb7G3fQpO2x+09V3gLYocP8kpHkwwJwMfMkf6B3Uw4gvk07tyot 8QmwRbD1n37J+1oIM0liM+hoPqvr3GqkJoeHqBDv4N5pn9A3wleBbUtnLmpBDI9i8s8lpiR4HSh p+OHJ0FgaGm+iTbcUmf87zYeXJFzQn+2ltEVgyBNMYDmY4iy1UO2FcMbyu/X5EUFmkAGdYjrwTj hs0KsvRHXTR1KoUFjszxlJMppCHN3rm15BJ6wdakkOAK6o/V6nHenSd0sWvVfnCLoXO58UZICc+ 9hgaW7Ro/YcOMF5OKLnsQrgF/4iWvhImXz3hWL8OOAADZUVCrjJLn60JCNcg+0v91/D83pPWlLN wO0XWyZzAshUXDg== X-Developer-Key: i=louis.chauvet@bootlin.com; a=openpgp; fpr=8B7104AE9A272D6693F527F2EC1883F55E0B40A5 X-GND-Sasl: louis.chauvet@bootlin.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The format RGB565 was already supported. Add the support for: - BGR565 Signed-off-by: Louis Chauvet --- drivers/gpu/drm/vkms/vkms_formats.c | 25 ++++++++++++++++++++++++- drivers/gpu/drm/vkms/vkms_plane.c | 1 + 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/vkms/vkms_formats.c b/drivers/gpu/drm/vkms/vkms_formats.c index e9cca5ae57bc..4d7af36aa28a 100644 --- a/drivers/gpu/drm/vkms/vkms_formats.c +++ b/drivers/gpu/drm/vkms/vkms_formats.c @@ -241,7 +241,7 @@ static struct pixel_argb_u16 argb_u16_from_RGB565(const u16 *pixel) return out_pixel; } -static struct pixel_argb_u16 argb_u16_from_gray8(u16 gray) +static struct pixel_argb_u16 argb_u16_from_gray8(u8 gray) { return argb_u16_from_u8888(255, gray, gray, gray); } @@ -251,6 +251,26 @@ static struct pixel_argb_u16 argb_u16_from_gray16(u16 gray) return argb_u16_from_u16161616(255, gray, gray, gray); } +static struct pixel_argb_u16 argb_u16_from_BGR565(const u16 *pixel) +{ + struct pixel_argb_u16 out_pixel; + + s64 fp_rb_ratio = drm_fixp_div(drm_int2fixp(65535), drm_int2fixp(31)); + s64 fp_g_ratio = drm_fixp_div(drm_int2fixp(65535), drm_int2fixp(63)); + + u16 rgb_565 = le16_to_cpu(*pixel); + s64 fp_b = drm_int2fixp((rgb_565 >> 11) & 0x1f); + s64 fp_g = drm_int2fixp((rgb_565 >> 5) & 0x3f); + s64 fp_r = drm_int2fixp(rgb_565 & 0x1f); + + out_pixel.a = (u16)0xffff; + out_pixel.b = drm_fixp2int_round(drm_fixp_mul(fp_b, fp_rb_ratio)); + out_pixel.g = drm_fixp2int_round(drm_fixp_mul(fp_g, fp_g_ratio)); + out_pixel.r = 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 channel_1, u8 channel_2, const struct conversion_matrix *matrix) { @@ -458,6 +478,7 @@ READ_LINE_16161616(XRGB16161616_read_line, px, 0xFFFF, px[2], px[1], px[0]); READ_LINE_16161616(XBGR16161616_read_line, px, 0xFFFF, px[0], px[1], px[2]); READ_LINE(RGB565_read_line, px, u16, argb_u16_from_RGB565, px) +READ_LINE(BGR565_read_line, px, u16, argb_u16_from_BGR565, px) READ_LINE(R8_read_line, px, u8, argb_u16_from_gray8, *px) @@ -690,6 +711,8 @@ pixel_read_line_t get_pixel_read_line_function(u32 format) 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 1e971c7760d9..a243a706459f 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[] = { DRM_FORMAT_ARGB16161616, DRM_FORMAT_ABGR16161616, DRM_FORMAT_RGB565, + DRM_FORMAT_BGR565, DRM_FORMAT_NV12, DRM_FORMAT_NV16, DRM_FORMAT_NV24, From patchwork Thu May 16 13:18:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Louis Chauvet X-Patchwork-Id: 13666206 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EE2F0C25B74 for ; Thu, 16 May 2024 13:18:41 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CC94410E107; Thu, 16 May 2024 13:18:40 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=bootlin.com header.i=@bootlin.com header.b="pNftCPQq"; dkim-atps=neutral Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5546410E107 for ; Thu, 16 May 2024 13:18:35 +0000 (UTC) Received: by mail.gandi.net (Postfix) with ESMTPSA id 7233E60002; Thu, 16 May 2024 13:18:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1715865514; 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=MrS8b39rxDfx4oFYW2S/d2LnfHxde+rqsW+6XOgTsco=; b=pNftCPQqP1awGmnbstlU4DBekkFnYGGJX4eQo4moAulGT9IEZ3+zKZqfcaQTelHwi0KsMW Kq7HlJ4hOgjgQFC1uETzmgb6oMo6kQZJ4Bupmw8o0KFP9QkRFgLrUJEujd8imEkSTe0YOT HWAJ+ZnEerm3SAeb5vRmCsWuWBZRpgHJvGixgODkOhF3V91VdatIgkod6FbHcPcJ8beQD0 R2qkAPNYjXliq8GyfAYZs2zjJbYLgTb/LoWT+95p87pQfuz7P8o/+4qa/5vBDaYhEX7hxt ITOWb+5inqTZs+VaqagW0NakMXANfAGNUjulzug9UaEqVeATcpFrQDMjanPfwg== From: Louis Chauvet Date: Thu, 16 May 2024 15:18:21 +0200 Subject: [PATCH 5/5] drm/vkms: Add support for RGB888 formats MIME-Version: 1.0 Message-Id: <20240516-b4-new-color-formats-v1-5-74cf9fe07317@bootlin.com> References: <20240516-b4-new-color-formats-v1-0-74cf9fe07317@bootlin.com> In-Reply-To: <20240516-b4-new-color-formats-v1-0-74cf9fe07317@bootlin.com> To: Rodrigo Siqueira , Melissa Wen , =?utf-8?q?Ma=C3=ADra_Canal?= , Haneen Mohammed , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie 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.14-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=1936; i=louis.chauvet@bootlin.com; h=from:subject:message-id; bh=/vrxMtadDQYtqI4w4rk5sueAQ3y7eapu4/8W4sRdUvQ=; b=owEBbQKS/ZANAwAIASCtLsZbECziAcsmYgBmRgef1emOyzGd/IpJLMvz4AbwKcC66NGrRXEYu fm92wBcRNCJAjMEAAEIAB0WIQRPj7g/vng8MQxQWQQgrS7GWxAs4gUCZkYHnwAKCRAgrS7GWxAs 4pHgD/9sniUJ7rD+ib4ar88c6BG1CbRJPURj6hQsJe6PoC2U89A8L5a5LP2WvC+nZoVV10o8uIP mw9Da72ZgX4lv7TYhypzYTZd0fZ/geoto3+VbH2tumKEqmDqt9NeaTJbalrSp1bKt9F25IbYv2B AW6xYtLZXK7b6+QxpgR+/3z1Y575yJZqifkl/aL+tS2s+F5nynMnFT0bwfNySAhKDk27zmJB99v 3oYbEww9IgqW8QBnqmJz/cWHcTLidA5mvy9dlZgoD9GelFGlQHFmrFXCGwSIujYUNAzlNvP0sna /Z7ZaTUR6El4PwzvYfIKgdnIYKXo7aGg2mU8Jj4Kx+w/4bCbuVZe3k+r8ZuA3yNJu/ZqOkS/2U8 7ECns5imI6lLC7b42LJRZqgpC7bULaSsp/uvV8n0czNmst4TySs87wlxUQKnqgaSx+14ntgoRXz yliUKFIyRrLnNphIjRT7fBC+0hBWh04nDXY+lFuw41K2C76rOmVqUgdcmrg0H1DK4pQKyruoUoB uv4HPcxsQC3jGFDSfFAtYekwXbLcDL+vgYH1XN/WxHITdgl6CT1Tl0vLQdP120Raeqg08x3/lIV PpZ59a8AkbBDaaf1oGmkK3FNOxxXXzwRCTC34aR2umd9JppRB+rqAbupsj243TvlEkW7Be6YW6X KIPpvsKCQ3pAxsg== X-Developer-Key: i=louis.chauvet@bootlin.com; a=openpgp; fpr=8B7104AE9A272D6693F527F2EC1883F55E0B40A5 X-GND-Sasl: louis.chauvet@bootlin.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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/vkms_formats.c index 4d7af36aa28a..6e651f7e6997 100644 --- a/drivers/gpu/drm/vkms/vkms_formats.c +++ b/drivers/gpu/drm/vkms/vkms_formats.c @@ -472,6 +472,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]) +READ_LINE_ARGB8888(RGB888_read_line, px, 255, px[2], px[1], px[0]) +READ_LINE_ARGB8888(BGR888_read_line, px, 255, px[0], px[1], px[2]) + READ_LINE_16161616(ARGB16161616_read_line, px, px[3], px[2], px[1], px[0]); READ_LINE_16161616(ABGR16161616_read_line, px, px[3], px[0], px[1], px[2]); READ_LINE_16161616(XRGB16161616_read_line, px, 0xFFFF, px[2], px[1], px[0]); @@ -701,6 +704,10 @@ pixel_read_line_t get_pixel_read_line_function(u32 format) 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 a243a706459f..0fa589abc53a 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[] = { DRM_FORMAT_XBGR8888, DRM_FORMAT_RGBX8888, DRM_FORMAT_BGRX8888, + DRM_FORMAT_RGB888, + DRM_FORMAT_BGR888, DRM_FORMAT_XRGB16161616, DRM_FORMAT_XBGR16161616, DRM_FORMAT_ARGB16161616,