[PATCH v2] drm/imx: dc-plane: Add more RGB swizzling options

Liu Ying victor.liu at nxp.com
Mon Nov 3 22:01:04 PST 2025


On 11/04/2025, Marek Vasut wrote:
> On 11/4/25 4:09 AM, Liu Ying wrote:
>> On 11/3/25 00:23, Marek Vasut wrote:
>>> Add additional buffer format swizzling options beyond XR24, the
>>> hardware is capable of sampling other formats, fill them in.
>>>
>>> Signed-off-by: Marek Vasut <marek.vasut at mailbox.org>
>>> ---
>>> Cc: Abel Vesa <abelvesa at kernel.org>
>>> Cc: Conor Dooley <conor+dt at kernel.org>
>>> Cc: Fabio Estevam <festevam at gmail.com>
>>> Cc: Krzysztof Kozlowski <krzk+dt at kernel.org>
>>> Cc: Laurent Pinchart <Laurent.pinchart at ideasonboard.com>
>>> Cc: Liu Ying <victor.liu at nxp.com>
>>> Cc: Lucas Stach <l.stach at pengutronix.de>
>>> Cc: Peng Fan <peng.fan at nxp.com>
>>> Cc: Pengutronix Kernel Team <kernel at pengutronix.de>
>>> Cc: Rob Herring <robh at kernel.org>
>>> Cc: Shawn Guo <shawnguo at kernel.org>
>>> Cc: Thomas Zimmermann <tzimmermann at suse.de>
>>> Cc: devicetree at vger.kernel.org
>>> Cc: dri-devel at lists.freedesktop.org
>>> Cc: imx at lists.linux.dev
>>> Cc: linux-arm-kernel at lists.infradead.org
>>> Cc: linux-clk at vger.kernel.org
>>> ---
>>> V2: - Adjust commit subject
>>>      - Drop the alpha formats for now, add RGB888/BGR888 to dc_plane_formats[]
>>> ---
>>>   drivers/gpu/drm/imx/dc/dc-fu.c    | 24 ++++++++++++++++++++++++
>>>   drivers/gpu/drm/imx/dc/dc-plane.c |  6 ++++++
>>>   2 files changed, 30 insertions(+)
>>>
>>> diff --git a/drivers/gpu/drm/imx/dc/dc-fu.c b/drivers/gpu/drm/imx/dc/dc-fu.c
>>> index 1d8f74babef8a..b4a3f8c58cbb0 100644
>>> --- a/drivers/gpu/drm/imx/dc/dc-fu.c
>>> +++ b/drivers/gpu/drm/imx/dc/dc-fu.c
>>> @@ -65,6 +65,30 @@ static const struct dc_fu_pixel_format pixel_formats[] = {
>>>           DRM_FORMAT_XRGB8888,
>>>           R_BITS(8)   | G_BITS(8)   | B_BITS(8)   | A_BITS(0),
>>>           R_SHIFT(16) | G_SHIFT(8)  | B_SHIFT(0)  | A_SHIFT(0),
>>> +    }, {
>>> +        DRM_FORMAT_XBGR8888,
>>> +        R_BITS(8)   | G_BITS(8)   | B_BITS(8)   | A_BITS(0),
>>> +        R_SHIFT(0)  | G_SHIFT(8)  | B_SHIFT(16) | A_SHIFT(0),
>>> +    }, {
>>> +        DRM_FORMAT_RGBX8888,
>>> +        R_BITS(8)   | G_BITS(8)   | B_BITS(8)   | A_BITS(0),
>>> +        R_SHIFT(24) | G_SHIFT(16) | B_SHIFT(8)  | A_SHIFT(0),
>>> +    }, {
>>> +        DRM_FORMAT_BGRX8888,
>>> +        R_BITS(8)   | G_BITS(8)   | B_BITS(8)   | A_BITS(0),
>>> +        R_SHIFT(8)  | G_SHIFT(16) | B_SHIFT(24) | A_SHIFT(0),
>>> +    }, {
>>> +        DRM_FORMAT_RGB888,
>>> +        R_BITS(8)   | G_BITS(8)   | B_BITS(8)   | A_BITS(0),
>>> +        R_SHIFT(16) | G_SHIFT(8)  | B_SHIFT(0)  | A_SHIFT(0),
>>> +    }, {
>>> +        DRM_FORMAT_BGR888,
>>> +        R_BITS(8)   | G_BITS(8)   | B_BITS(8)   | A_BITS(0),
>>> +        R_SHIFT(0)  | G_SHIFT(8)  | B_SHIFT(16) | A_SHIFT(0),
>>> +    }, {
>>> +        DRM_FORMAT_RGB565,
>>> +        R_BITS(5)   | G_BITS(6)   | B_BITS(5)   | A_BITS(0),
>>> +        R_SHIFT(11) | G_SHIFT(5)  | B_SHIFT(0)  | A_SHIFT(0),
>>>       },
>>>   };
>>>   diff --git a/drivers/gpu/drm/imx/dc/dc-plane.c b/drivers/gpu/drm/imx/dc/dc-plane.c
>>> index e40d5d66c5c1f..4fd58afef16bb 100644
>>> --- a/drivers/gpu/drm/imx/dc/dc-plane.c
>>> +++ b/drivers/gpu/drm/imx/dc/dc-plane.c
>>> @@ -33,6 +33,12 @@ do {                                    \
>>>     static const uint32_t dc_plane_formats[] = {
>>>       DRM_FORMAT_XRGB8888,
>>> +    DRM_FORMAT_XBGR8888,
>>> +    DRM_FORMAT_RGBX8888,
>>> +    DRM_FORMAT_BGRX8888,
>>> +    DRM_FORMAT_RGB888,
>>> +    DRM_FORMAT_BGR888,
>>
>> Can you please drop the above two formats, as I said in v1 comment that it
>> would the driver a lot more complicated when prefetch engines are added?
> 
> Can you elaborate on that ? RGB888 is not packed and should be similar to
> RGBX8888, what kind of problem with prefetch would this cause ?

As I mentioned in v1 comment, prefetch engines don't support these two formats.

For example, if you want to switch formats between DRM_FORMAT_XRGB8888 and
DRM_FORMAT_RGB888, then display driver needs to support enabling prefetch
engine and bypassing prefetch engine, plus disabling display controller
properly w/wo prefetch engine.  Also, primary and overlay planes may use
different formats.  This adds branches to display driver and hence a lot more
complicated.  So, please set these two formats aside first. Prefetch engine
has attractive tile resolving feature.  If you really want to support these
two formats, revisit after prefetch engine is added(I hope I don't need to
go into that rabbit hole).

-- 
Regards,
Liu Ying



More information about the linux-arm-kernel mailing list