Re: [PATCH v4 4/5] drm/mipi-dbi: Add support for DRM_FORMAT_RGB888

From: Dmitry Baryshkov
Date: Tue Jun 04 2024 - 09:53:59 EST


On Tue, Jun 04, 2024 at 03:20:31PM +0200, Noralf Trønnes via B4 Relay wrote:
> From: Noralf Trønnes <noralf@xxxxxxxxxxx>
>
> 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.
>
> v4:
> - s/emulation_format/pixel_format/ (Dmitry)
>
> Signed-off-by: Noralf Trønnes <noralf@xxxxxxxxxxx>
> ---
> drivers/gpu/drm/drm_mipi_dbi.c | 29 +++++++++++++++++++++++++----
> include/drm/drm_mipi_dbi.h | 5 +++++
> 2 files changed, 30 insertions(+), 4 deletions(-)
>

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxx>


--
With best wishes
Dmitry