RE: [PATCH v2 05/13] drm/i915/display: Add DC3CO support check and validate target DC state

Manna, Animesh
2026-04-29T05:13:29Z

> -----Original Message-----
> From: Dibin Moolakadan Subrahmanian
> <dibin.moolakadan.subrahmanian@intel.com>
> Sent: Wednesday, April 22, 2026 9:56 PM
> To: intel-gfx@lists.freedesktop.org; intel-xe@lists.freedesktop.org
> Cc: Manna, Animesh <animesh.manna@intel.com>; Shankar, Uma
> <uma.shankar@intel.com>; Kurmi, Suresh Kumar
> <suresh.kumar.kurmi@intel.com>
> Subject: [PATCH v2 05/13] drm/i915/display: Add DC3CO support check and
> validate target DC state
>
> Validate the requested target DC state against allowed_dc_mask in
> intel_display_power_set_target_dc_state() to avoid programming
> unsupported DC states.
>
> Also add intel_display_power_dc3co_supported() helper to query DC3CO
> support from allowed_dc_mask.
>
> Changes in v2:
> - Squash "Add helper to check DC3CO support" patch into this patch
>
> Signed-off-by: Dibin Moolakadan Subrahmanian
> <dibin.moolakadan.subrahmanian@intel.com>
> Reviewed-by: Uma Shankar <uma.shankar@intel.com>
> ---
> drivers/gpu/drm/i915/display/intel_display_power.c | 14 ++++++++++++++
> drivers/gpu/drm/i915/display/intel_display_power.h | 1 +
> 2 files changed, 15 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_display_power.c
> b/drivers/gpu/drm/i915/display/intel_display_power.c
> index 77c32492caa1..f626803bbd88 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_power.c
> +++ b/drivers/gpu/drm/i915/display/intel_display_power.c
> @@ -302,6 +302,13 @@ void
> intel_display_power_set_target_dc_state(struct intel_display *display,
> struct i915_power_domains *power_domains = &display-
> >power.domains;
>
> mutex_lock(&power_domains->lock);
> +
> + if ((state & power_domains->allowed_dc_mask) != state) {
> + drm_dbg_kms(display->drm,
> + "Rejecting DC state 0x%x (allowed mask 0x%x)\n",
> + state, power_domains->allowed_dc_mask);
> + goto unlock;
> + }
> power_well = lookup_power_well(display, SKL_DISP_DC_OFF);
>
> if (drm_WARN_ON(display->drm, !power_well)) @@ -358,6 +365,13
> @@ u32 intel_display_power_get_current_dc_state(struct intel_display
> *display)
> return current_dc_state;
> }
>
> +bool intel_display_power_dc3co_supported(struct intel_display *display)
> +{
> + struct i915_power_domains *power_domains = &display-
> >power.domains;
> +
> + return (power_domains->allowed_dc_mask &
> DC_STATE_EN_UPTO_DC3CO) ==
> +DC_STATE_EN_UPTO_DC3CO; }
> +

allowed_dc_mask is not set in this patch series, which I presume will be based on HAS_DC3CO() check.
Could not differentiate between intel_display_power_dc3co_supported() and HAS_DC3CO() and both are dependent only on DISPLAY_VER() like if platform is supporting or not.

Regards,
Animesh

> static void __async_put_domains_mask(struct i915_power_domains
> *power_domains,
> struct intel_power_domain_mask *mask)
> { diff --git a/drivers/gpu/drm/i915/display/intel_display_power.h
> b/drivers/gpu/drm/i915/display/intel_display_power.h
> index d616d5d09cbe..05880e9da89f 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_power.h
> +++ b/drivers/gpu/drm/i915/display/intel_display_power.h
> @@ -186,6 +186,7 @@ void intel_display_power_resume(struct intel_display
> *display); void intel_display_power_set_target_dc_state(struct intel_display
> *display,
> u32 state);
> u32 intel_display_power_get_current_dc_state(struct intel_display
> *display);
> +bool intel_display_power_dc3co_supported(struct intel_display
> +*display);
>
> bool intel_display_power_is_enabled(struct intel_display *display,
> enum intel_display_power_domain
> domain);
> --
> 2.43.0