Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [High] drm/tidss: build failure due to undeclared dispc_vp_*() readout
  helpers
- [Medium] drm/tidss: unchecked tidss_runtime_get() in
  tidss_crtc_readout_state()
--

commit 9881c280c684258267a1385984e8908b2bf1845f
Author: Maxime Ripard <[email protected]>

drm/tidss: crtc: Implement hardware state readout

This commit implements the hardware state readout, state installation, and
state comparison hooks for tidss CRTCs.

> diff --git a/drivers/gpu/drm/tidss/tidss_crtc.c 
> b/drivers/gpu/drm/tidss/tidss_crtc.c
> index d2664bda53a99..c72194e93bde1 100644
> --- a/drivers/gpu/drm/tidss/tidss_crtc.c
> +++ b/drivers/gpu/drm/tidss/tidss_crtc.c

[ ... ]

> @@ -372,6 +376,131 @@ static struct drm_crtc_state 
> *tidss_crtc_create_state(struct drm_crtc *crtc)
>       return &tstate->base;
>  }
>  
> +static int tidss_crtc_readout_state(struct drm_crtc *crtc,
> +                                 struct drm_atomic_sro_state *state,
> +                                 struct drm_crtc_state *crtc_state)
> +{
> +     struct drm_device *ddev = crtc->dev;
> +     struct tidss_device *tidss = to_tidss(ddev);
> +     struct dispc_device *dispc = tidss->dispc;
> +     struct tidss_crtc_state *tstate = to_tidss_crtc_state(crtc_state);
> +     struct tidss_crtc *tcrtc =
> +             to_tidss_crtc(crtc);
> +     struct drm_display_mode mode = {};
> +     int ret;
> +
> +     tidss_runtime_get(tidss);

[Severity: Medium]
Should tidss_crtc_readout_state() check the return value of
tidss_runtime_get() before reading DISPC registers, as
tidss_crtc_install_state() does below?

tidss_runtime_get() wraps pm_runtime_resume_and_get(), which drops the
usage count on failure.  Continuing on error accesses DISPC registers while
the DSS power domain and functional clock are disabled, and then
unconditionally calls tidss_runtime_put() on exit, underflowing the runtime
PM usage counter.

> +
> +     if (!dispc_vp_is_enabled(dispc, tcrtc->hw_videoport))
> +             goto out;
> +
> +     tstate->base.active = 1;
> +     tstate->base.enable = 1;
> +
> +     ret = dispc_vp_readout_mode(dispc, tcrtc->hw_videoport, &mode);
> +     if (ret)
> +             goto err_runtime_put;
> +
> +     ret = drm_atomic_set_mode_for_crtc(&tstate->base, &mode);
> +     if (WARN_ON(ret))
> +             goto err_runtime_put;
> +
> +     drm_mode_copy(&tstate->base.adjusted_mode, &mode);
> +
> +     tstate->bus_flags = dispc_vp_get_bus_flags(dispc, tcrtc->hw_videoport);
> +     ret = dispc_vp_get_bus_format(dispc, tcrtc->hw_videoport,
> +                                   &tstate->bus_format);

[Severity: High]
Does this commit fail to build when CONFIG_DRM_TIDSS is enabled?

dispc_vp_is_enabled(), dispc_vp_readout_mode(), dispc_vp_get_bus_flags(),
dispc_vp_get_bus_format(), and dispc_vp_set_dpi_output() (called in
tidss_crtc_install_state() below) are neither declared in tidss_dispc.h nor
defined in tidss_dispc.c at this point in the series.  They are only added
later in commit "drm/tidss: dispc: Add hardware state readout helpers",
which breaks compilation and bisection here.

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

Reply via email to