Hi,

On 02/09/2025 11:32, Maxime Ripard wrote:
> The tidss dispc driver has a table associating fourcc's and their
> hardware representation.
> 
> So far, we only needed to do the fourcc to hardware lookup, but we'll
> need to do the hardware to fourcc lookup in the future, so let's provide
> a function to do so.
> 
> Signed-off-by: Maxime Ripard <[email protected]>

(Assuming this is still needed in the future versions)

Reviewed-by: Tomi Valkeinen <[email protected]>

 Tomi

> ---
>  drivers/gpu/drm/tidss/tidss_dispc.c | 11 +++++++++++
>  drivers/gpu/drm/tidss/tidss_dispc.h |  1 +
>  2 files changed, 12 insertions(+)
> 
> diff --git a/drivers/gpu/drm/tidss/tidss_dispc.c 
> b/drivers/gpu/drm/tidss/tidss_dispc.c
> index 
> 7d94c1142e8083dab00fcf5c652ae40f98baeabf..32248b5f71b7566dc33d7a7db0efb26d3a9ed1c3
>  100644
> --- a/drivers/gpu/drm/tidss/tidss_dispc.c
> +++ b/drivers/gpu/drm/tidss/tidss_dispc.c
> @@ -2117,10 +2117,21 @@ static const struct {
>       { DRM_FORMAT_UYVY, 0x3f, },
>  
>       { DRM_FORMAT_NV12, 0x3d, },
>  };
>  
> +u32 dispc_plane_find_fourcc_by_dss_code(u8 code)
> +{
> +     unsigned int i;
> +
> +     for (i = 0; i < ARRAY_SIZE(dispc_color_formats); ++i)
> +             if (dispc_color_formats[i].dss_code == code)
> +                     return dispc_color_formats[i].fourcc;
> +
> +     return 0;
> +}
> +
>  static void dispc_plane_set_pixel_format(struct dispc_device *dispc,
>                                        u32 hw_plane, u32 fourcc)
>  {
>       unsigned int i;
>  
> diff --git a/drivers/gpu/drm/tidss/tidss_dispc.h 
> b/drivers/gpu/drm/tidss/tidss_dispc.h
> index 
> 60c1b400eb8933dd13efd4ae3d09dc9569eed96f..849ec984026e223de7c8a55a4b5672c2262f38c0
>  100644
> --- a/drivers/gpu/drm/tidss/tidss_dispc.h
> +++ b/drivers/gpu/drm/tidss/tidss_dispc.h
> @@ -146,10 +146,11 @@ int dispc_plane_check(struct dispc_device *dispc, u32 
> hw_plane,
>  void dispc_plane_setup(struct dispc_device *dispc, u32 hw_plane,
>                      const struct drm_plane_state *state,
>                      u32 hw_videoport);
>  void dispc_plane_enable(struct dispc_device *dispc, u32 hw_plane, bool 
> enable);
>  const u32 *dispc_plane_formats(struct dispc_device *dispc, unsigned int 
> *len);
> +u32 dispc_plane_find_fourcc_by_dss_code(u8 code);
>  
>  int dispc_init(struct tidss_device *tidss);
>  void dispc_remove(struct tidss_device *tidss);
>  
>  #endif
> 

Reply via email to