Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp1237333lqj; Mon, 3 Jun 2024 14:55:20 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVdPAXHNgsNNWbhIbfTpv0lWL07T04Z/rNX88/b5hUluG70IqnI1N3C7ptpHiVFFTBPIjwAH7Q7N3E7d9f4r3j7bN7sJ2iKTuXT1t/ZhQ== X-Google-Smtp-Source: AGHT+IEBmjSQZVXM3oSQ4orHcYim9mTcrd4tS9mXd0vHOzUOZ5ypT4FSEi9jd72dohzc1nlBdbZE X-Received: by 2002:a05:6e02:110e:b0:374:972c:56f9 with SMTP id e9e14a558f8ab-374972c587bmr55695345ab.29.1717451720601; Mon, 03 Jun 2024 14:55:20 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717451720; cv=pass; d=google.com; s=arc-20160816; b=0VS437ozDklewgJvtcC7Lx1zi8IstkZBVWlFHT0b/qA85ghFFmzvmElhTNhBw/u4PJ j24/3oDDxyPyaVSIAmqO8N3pD2sMS6qPlJ53Y1i7bnzOKRAZXb2bbcYobhMPZ2T4zqWc I6gSH/O/gqjJXtAeQKqqApXcyVhi4A3+s5wngl8uD9jKiIYrgnZXZIDt0cdG5j7gRp5p ZgGw/rvxfxKNZ9Kp06Ql2TWWt60rRf1eZIhY2Pz9sqxqPcAF1J4Q9b+HxDQZsUd3c+gi NDfgc7rX8jXrwkdK/E/dHa0xkwZ6EOW90PPubmgevC3qD5MgSRb314YfAZlXjCR1AZG/ k1jw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=FoNDEjuOcgHDOVnZsyqRle0CnqIa5i20V/byDmBZIYI=; fh=opYweIj4RCItdIdHZXTMBqQKDXWkPG/3F1HoM9Gh5/0=; b=bCsYRzRdP6bqGePbLUxNcThsyr953pDyCjA4eld1+CQeUkCSzBOGB90YWSUkn9Udrb ZD6djUqL+i87IasKfewk5HjP1jahfVcve/tOood5IgfW6SLcDq0QeJnRPYENqo5otd+r O2PDaNt3iA4jY3oPiohtoVKjn2rDq8lm3exiqQXi8MjYrdqTONDNKpiLUN4dZpdiyAiK eO5MESv/36ggQwpiaz7fti42wavYqjbeukKbu+J37sLctoWXyTDUKFk30G3X37Z3gaDM OAoyC60X6G5OtZTpd1GD8mOh6QQziRWSJGUg8DG39tF4scSHzKydqy+EaHOcLq9smxF+ JvXQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pZqbKxER; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-199744-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-199744-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-6c35c73c056si7094741a12.744.2024.06.03.14.55.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Jun 2024 14:55:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-199744-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pZqbKxER; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-199744-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-199744-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 421C5B21150 for ; Mon, 3 Jun 2024 21:47:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 347DF13C827; Mon, 3 Jun 2024 21:47:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="pZqbKxER" Received: from mail-lj1-f169.google.com (mail-lj1-f169.google.com [209.85.208.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9265323A6 for ; Mon, 3 Jun 2024 21:47:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.169 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717451228; cv=none; b=VWdBoYxkJRgHcOo622f96NzSE5w3xWlKZCstaetf1z4ZmFWWAambtn77pennxi11cDujbSwJID/7wcMvbAqDohVzXEaoV49kOsXdZn1LRPUcGjenQqYRM09a4p2wtZN+Lu7VmgPF8lr48npDdO1sRYxuwrXgOKbOqIcga4rI54M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717451228; c=relaxed/simple; bh=MkchS3T1yd/q8NMQ5OnngmwnF/j9QgKZ2Hww8Q8rcjw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=k+HQuzd0EGALLJs1+naRNZNxCA80SmtKxIizbdbiJAdXuPihVV/0gn/baKWFJwzqyqoHrHGNQ//8TYeTigyfEKvBxp8gPPiY8StCIfICEaA3HJi3IzTz2+NViREggVsQqFb8qfx82zYWe2bR2d2K2B610ZxVzPY76Ac22InUSCw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=pZqbKxER; arc=none smtp.client-ip=209.85.208.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-lj1-f169.google.com with SMTP id 38308e7fff4ca-2eabd22d404so2270871fa.2 for ; Mon, 03 Jun 2024 14:47:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1717451225; x=1718056025; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=FoNDEjuOcgHDOVnZsyqRle0CnqIa5i20V/byDmBZIYI=; b=pZqbKxERbLF7hNyIw9z3gbVjV4gq5DACJn8GjOYzmEylzGCiHPbjSb8u0fdhTRZSnu YL4NEwGdNxQzKQQUApo13gmpm+7uXSQcBis79qIss8ZfAkrRoLVdMS6ugjJtMnMpjd5V Oqtj4/gE5vD7r/e8+iV7khiL/TRr4/KdeR2dY8baplZ+XWWaVURlpW/4QlLdTgqjkZdg eDOWi8jUE0ivlmcZETrjhY3r7fLsaZNQ408coNH3A4zXdztRDdoUomkDah348y3BP+Vu vuhuSzpk9YPanDYsngBPiXKCrUy5suNVX8IIMT2ICyixrzS9SNG6fFrh0e7/W7DsvRO2 RnrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717451225; x=1718056025; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=FoNDEjuOcgHDOVnZsyqRle0CnqIa5i20V/byDmBZIYI=; b=kcVRNvRpdIaM9khS3RoWte/uoKBnE7N/7+r+Hzw7E9EiSaJqrjos1lZ7VqNxn5blQ4 JFjwhLV0N5JprZN4EPZRaQMH8mebkZfxQiVhZXpNOqlthmphep9+VbiJW6xmRKlQ3O8l 3VBW6/lY/SPLo0iH6Ndt/WF4E8DPUuLyb+l/f5e2aCLTYfWNzXpiAPnTpFTfn5GIx8Vb /aQAryYrBbaIhRhpkaCbTwHlV72VcwNF0Bha/1AYHk4kWxQBiPZgDK6SJDKtfz/ywLo6 NMtRUzw4S6G+CJzrc7TiDs/Yfv5EMY6ux7lTVAQrS/L65nakHDouN8J5imRVM6qgiO1+ VsKg== X-Forwarded-Encrypted: i=1; AJvYcCVSH3TgPe0pYZyqctk/8kf6EAzQyinf7PVfgoBminW/t0BIIDawW0Pq9X2KRjkeluyBZQgrwp9qidFaMJ5STzkK547KHpEiUYGTNkDl X-Gm-Message-State: AOJu0YyxfEBIZvvv5n1Onb1ndaosIt4VzvbA32iP98mC5TcVXNwjGNcR OJf2CwCmurnXwRtOixcAVJmCr6S/01ZXoEIhGn5ZFT20GVbTS0iT7FSiLJWjQMc= X-Received: by 2002:a2e:b8c7:0:b0:2d6:f69d:c74c with SMTP id 38308e7fff4ca-2ea951e0961mr72022941fa.38.1717451224716; Mon, 03 Jun 2024 14:47:04 -0700 (PDT) Received: from eriador.lumag.spb.ru (dzdbxzyyyyyyyyyyyykxt-3.rev.dnainternet.fi. [2001:14ba:a0c3:3a00::227]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2ea91bb4aedsm13686521fa.33.2024.06.03.14.47.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Jun 2024 14:47:04 -0700 (PDT) Date: Tue, 4 Jun 2024 00:47:02 +0300 From: Dmitry Baryshkov To: noralf@tronnes.org Cc: Neil Armstrong , Jessica Zhang , Sam Ravnborg , David Airlie , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Rob Herring , Krzysztof Kozlowski , Conor Dooley , David Lechner , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Kamlesh Gurudasani , Tommaso Merciai Subject: Re: [PATCH v3 4/5] drm/mipi-dbi: Add support for DRM_FORMAT_RGB888 Message-ID: References: <20240603-panel-mipi-dbi-rgb666-v3-0-59ed53ca73da@tronnes.org> <20240603-panel-mipi-dbi-rgb666-v3-4-59ed53ca73da@tronnes.org> 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=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20240603-panel-mipi-dbi-rgb666-v3-4-59ed53ca73da@tronnes.org> On Mon, Jun 03, 2024 at 01:21:35PM +0200, Noralf Tr?nnes via B4 Relay wrote: > From: Noralf Tr?nnes > > DRM_FORMAT_RGB888 is 24 bits per pixel and it would be natural to send it > on the SPI bus using a 24 bits per word transfer. The problem with this > is that not all SPI controllers support 24 bpw. > > Since DRM_FORMAT_RGB888 is stored in memory as little endian and the SPI > bus is big endian we use 8 bpw to always get the same pixel format on the > bus: b8g8r8. > > The MIPI DCS specification lists the standard commands that can be sent > over the MIPI DBI interface. The set_address_mode (36h) command has one > bit in the parameter that controls RGB/BGR order. This means that the > controller can be configured to receive the pixel as BGR. > > RGB888 is rarely supported on these controllers but RGB666 is very common. > All datasheets I have seen do at least support the pixel format option > where each color is sent as one byte and the 6 MSB's are used. > > All this put together means that we can send each pixel as b8g8r8 and an > RGB666 capable controller sees this as b6x2g6x2r6x2. > > Signed-off-by: Noralf Tr?nnes > --- > drivers/gpu/drm/drm_mipi_dbi.c | 29 +++++++++++++++++++++++++---- > include/drm/drm_mipi_dbi.h | 5 +++++ > 2 files changed, 30 insertions(+), 4 deletions(-) The patch generally LGTM. The only nit is the name of 'emulation_format'. My first impression was that it is a format that the driver is emulating to userspace, however it looks like this is over-the-wire format (with the RGB666 vs RGB888 note kept in mind). If my understanding is correct, I'd suggest renaming emulation_format to something like 'raw_format' or 'panel_format'. > > diff --git a/drivers/gpu/drm/drm_mipi_dbi.c b/drivers/gpu/drm/drm_mipi_dbi.c > index 77f8a828d6e0..eb330676857c 100644 > --- a/drivers/gpu/drm/drm_mipi_dbi.c > +++ b/drivers/gpu/drm/drm_mipi_dbi.c > @@ -206,6 +206,7 @@ int mipi_dbi_buf_copy(void *dst, struct iosys_map *src, struct drm_framebuffer * > struct drm_rect *clip, bool swap, > struct drm_format_conv_state *fmtcnv_state) > { > + struct mipi_dbi_dev *dbidev = drm_to_mipi_dbi_dev(fb->dev); > struct drm_gem_object *gem = drm_gem_fb_get_obj(fb, 0); > struct iosys_map dst_map = IOSYS_MAP_INIT_VADDR(dst); > int ret; > @@ -222,8 +223,18 @@ int mipi_dbi_buf_copy(void *dst, struct iosys_map *src, struct drm_framebuffer * > else > drm_fb_memcpy(&dst_map, NULL, src, fb, clip); > break; > + case DRM_FORMAT_RGB888: > + drm_fb_memcpy(&dst_map, NULL, src, fb, clip); > + break; > case DRM_FORMAT_XRGB8888: > - drm_fb_xrgb8888_to_rgb565(&dst_map, NULL, src, fb, clip, fmtcnv_state, swap); > + switch (dbidev->emulation_format) { > + case DRM_FORMAT_RGB565: > + drm_fb_xrgb8888_to_rgb565(&dst_map, NULL, src, fb, clip, fmtcnv_state, swap); > + break; > + case DRM_FORMAT_RGB888: > + drm_fb_xrgb8888_to_rgb888(&dst_map, NULL, src, fb, clip, fmtcnv_state); > + break; > + } > break; > default: > drm_err_once(fb->dev, "Format is not supported: %p4cc\n", [skipped] > diff --git a/include/drm/drm_mipi_dbi.h b/include/drm/drm_mipi_dbi.h > index b36596efdcc3..85bf19b98cee 100644 > --- a/include/drm/drm_mipi_dbi.h > +++ b/include/drm/drm_mipi_dbi.h > @@ -101,6 +101,11 @@ struct mipi_dbi_dev { > */ > struct drm_display_mode mode; > > + /** > + * @emulation_format: Pixel format to use when emulating XRGB8888 > + */ > + u32 emulation_format; > + > /** > * @tx_buf: Buffer used for transfer (copy clip rect area) > */ > > -- > 2.45.1 > > -- With best wishes Dmitry