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 <[email protected]>
>>> ---
>>> Cc: Abel Vesa <[email protected]>
>>> Cc: Conor Dooley <[email protected]>
>>> Cc: Fabio Estevam <[email protected]>
>>> Cc: Krzysztof Kozlowski <[email protected]>
>>> Cc: Laurent Pinchart <[email protected]>
>>> Cc: Liu Ying <[email protected]>
>>> Cc: Lucas Stach <[email protected]>
>>> Cc: Peng Fan <[email protected]>
>>> Cc: Pengutronix Kernel Team <[email protected]>
>>> Cc: Rob Herring <[email protected]>
>>> Cc: Shawn Guo <[email protected]>
>>> Cc: Thomas Zimmermann <[email protected]>
>>> Cc: [email protected]
>>> Cc: [email protected]
>>> Cc: [email protected]
>>> Cc: [email protected]
>>> Cc: [email protected]
>>> ---
>>> 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

Reply via email to