Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] drm/tidss: dispc readout helpers ordered after callers
  breaking bisect
- [Medium] drm/tidss: bus_flags readout mismatch in
  dispc_vp_get_bus_flags()
--

commit 0fa7c75e1ac8f9d7d7984b674f13c7d7a5955dd7
Author: Maxime Ripard <[email protected]>

drm/tidss: dispc: Add hardware state readout helpers

This commit adds DISPC register readout helpers for video ports, overlay
managers, and planes, and adjusts video port initialization and plane
setup to handle pipelines left running by firmware.

> diff --git a/drivers/gpu/drm/tidss/tidss_dispc.c 
> b/drivers/gpu/drm/tidss/tidss_dispc.c
> index e186c63ba5fb9..8e61216d4532f 100644
> --- a/drivers/gpu/drm/tidss/tidss_dispc.c
> +++ b/drivers/gpu/drm/tidss/tidss_dispc.c

[ ... ]

> @@ -1401,6 +1407,228 @@ int dispc_vp_set_clk_rate(struct dispc_device *dispc, 
> u32 hw_videoport,

[ ... ]

> +u32 dispc_vp_get_bus_flags(struct dispc_device *dispc, u32 hw_videoport)
> +{
> +     u32 flags = 0;
> +     u32 val;
> +
> +     val = dispc_vp_read(dispc, hw_videoport, DISPC_VP_POL_FREQ);
> +     if (FIELD_GET(DISPC_VP_POL_FREQ_IPC_MASK, val))
> +             flags |= DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE;
> +     else
> +             flags |= DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE;
> +
> +     if (FIELD_GET(DISPC_VP_POL_FREQ_IEO_MASK, val))
> +             flags |= DRM_BUS_FLAG_DE_LOW;
> +     else
> +             flags |= DRM_BUS_FLAG_DE_HIGH;
> +
> +     if (FIELD_GET(DISPC_VP_POL_FREQ_RF_MASK, val))
> +             flags |= DRM_BUS_FLAG_SYNC_DRIVE_POSEDGE;
> +     else
> +             flags |= DRM_BUS_FLAG_SYNC_DRIVE_NEGEDGE;
> +
> +     return flags;
> +}

[Severity: Medium]
Can dispc_vp_get_bus_flags() cause state comparison mismatches in
tidss_crtc_compare_state() and drm_atomic_helper_bridge_compare_state()
when a downstream bridge or panel leaves any of the three polarity flags
unspecified?

tidss_bridge_atomic_check() copies next_bridge_state->input_bus_cfg.flags
(or connector->display_info.bus_flags) directly into
tcrtc_state->bus_flags and propagates it to the tidss encoder bridge
state without filling in default polarities, while dispc_vp_prepare()
programs default polarities in DISPC_VP_POL_FREQ for any unset flags.
Because dispc_vp_get_bus_flags() unconditionally sets all three polarity
flags, the read-out bus_flags on the CRTC and tidss encoder bridge will
not match the committed state whenever a panel or bridge omits one of
those flags (for example, panels that only specify DRM_BUS_FLAG_DE_HIGH,
or tidss_oldi when DE polarity is left unset).

[ ... ]

> diff --git a/drivers/gpu/drm/tidss/tidss_dispc.h 
> b/drivers/gpu/drm/tidss/tidss_dispc.h
> index dcd4d3b18ef48..4abcb9e679acf 100644
> --- a/drivers/gpu/drm/tidss/tidss_dispc.h
> +++ b/drivers/gpu/drm/tidss/tidss_dispc.h
> @@ -111,10 +111,13 @@ void dispc_ovr_set_plane(struct dispc_device *dispc, 
> u32 hw_plane,
>                        u32 hw_videoport, u32 x, u32 y, u32 layer);
>  void dispc_ovr_enable_layer(struct dispc_device *dispc,
>                           u32 hw_videoport, u32 layer, bool enable);
> +int dispc_ovr_get_plane(struct dispc_device *dispc, u32 hw_plane,
> +                     u32 *hw_videoport, int *x, int *y, u32 *layer);
>  
>  void dispc_vp_prepare(struct dispc_device *dispc, u32 hw_videoport,
>                     const struct drm_crtc_state *state);
>  void dispc_vp_enable(struct dispc_device *dispc, u32 hw_videoport);
> +bool dispc_vp_is_enabled(struct dispc_device *dispc, u32 hw_videoport);
>  void dispc_vp_disable(struct dispc_device *dispc, u32 hw_videoport);
>  void dispc_vp_unprepare(struct dispc_device *dispc, u32 hw_videoport);
>  bool dispc_vp_go_busy(struct dispc_device *dispc, u32 hw_videoport);
> @@ -128,9 +131,17 @@ int dispc_vp_enable_clk(struct dispc_device *dispc, u32 
> hw_videoport);
>  void dispc_vp_disable_clk(struct dispc_device *dispc, u32 hw_videoport);
>  int dispc_vp_set_clk_rate(struct dispc_device *dispc, u32 hw_videoport,
>                         unsigned long rate);
> +void dispc_vp_set_dpi_output(struct dispc_device *dispc, u32 hw_videoport,
> +                          bool dpi_output);
>  void dispc_vp_setup(struct dispc_device *dispc, u32 hw_videoport,
>                   const struct drm_crtc_state *state, bool newmodeset,
>                   bool dpi_output);
> +int dispc_vp_readout_mode(struct dispc_device *dispc,
> +                       u32 hw_videoport,
> +                       struct drm_display_mode *mode);
> +int dispc_vp_get_bus_format(struct dispc_device *dispc, u32 hw_videoport,
> +                         u32 *bus_fmt);
> +u32 dispc_vp_get_bus_flags(struct dispc_device *dispc, u32 hw_videoport);
>  
>  int dispc_runtime_suspend(struct dispc_device *dispc);
>  int dispc_runtime_resume(struct dispc_device *dispc);
> @@ -141,7 +152,18 @@ int dispc_plane_check(struct dispc_device *dispc, u32 
> hw_plane,
>  void dispc_plane_setup(struct dispc_device *dispc, u32 hw_plane,
>                      struct drm_plane_state *state,
>                      u32 hw_videoport);
> +void dispc_plane_get_picture_size(struct dispc_device *dispc, u32 hw_plane,
> +                               unsigned int *width, unsigned int *height);
> +void dispc_plane_get_size(struct dispc_device *dispc, u32 hw_plane,
> +                       unsigned int *width, unsigned int *height);
> +const struct drm_format_info *
> +dispc_plane_get_current_format(struct dispc_device *dispc, u32 hw_plane);
> +u8 dispc_plane_get_global_alpha(struct dispc_device *dispc, u32 hw_plane);
> +u32 dispc_plane_get_pixel_inc(struct dispc_device *dispc, u32 hw_plane);
> +u32 dispc_plane_get_row_inc(struct dispc_device *dispc, u32 hw_plane);
> +u16 dispc_plane_get_blend_mode(struct dispc_device *dispc, u32 hw_plane);
>  void dispc_plane_enable(struct dispc_device *dispc, u32 hw_plane, bool 
> enable);
> +bool dispc_plane_is_enabled(struct dispc_device *dispc, u32 hw_plane);

[Severity: Medium]
Should this patch be ordered before commit "drm/tidss: crtc: Implement
hardware state readout"?

The earlier commits "drm/tidss: crtc: Implement hardware state readout"
and "drm/tidss: plane: Implement hardware state readout" call these
helpers in tidss_crtc.c and tidss_plane.c before they are declared and
defined here, which breaks the build with CONFIG_DRM_TIDSS enabled at
four intermediate commits in the series during git bisect. (Commit
"drm/tidss: kms: Hook up hardware state readout" also appears to be
ordered before commit "drm/tidss: plane: Implement hardware state
readout".)

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=36

Reply via email to