drm/i915/dp: Return early if dsc is required but not supported
authorAnkit Nautiyal <ankit.k.nautiyal@intel.com>
Fri, 3 Jan 2025 03:14:24 +0000 (08:44 +0530)
committerAnkit Nautiyal <ankit.k.nautiyal@intel.com>
Tue, 7 Jan 2025 07:57:16 +0000 (13:27 +0530)
Currently, when bandwidth is insufficient for a given mode, we attempt
to use DSC. This is indicated by a debug print, followed by a check for
DSC support.

The debug message states that we are trying DSC, but DSC might not be
supported, which can give an incorrect picture in the logs if we bail
out later.

Correct the order for both DP and DP MST to:
- Check if DSC is required and supported, and return early if DSC is
not supported.
- Print a debug message to indicate that DSC will be tried next.

Suggested-by: Jani Nikula <jani.nikula@linux.intel.com>
Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Reviewed-by: Suraj Kandpal <suraj.kandpal@intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20250103031424.1732774-1-ankit.k.nautiyal@intel.com
drivers/gpu/drm/i915/display/intel_dp.c
drivers/gpu/drm/i915/display/intel_dp_mst.c

index 0d74adae2ec90f77e5d2914f5821509d5efe1ee3..4fa0e0b675b03c4e9f76c30d00915a178d33db32 100644 (file)
@@ -2642,15 +2642,17 @@ intel_dp_compute_link_config(struct intel_encoder *encoder,
                        dsc_needed = true;
        }
 
+       if (dsc_needed && !intel_dp_supports_dsc(intel_dp, connector, pipe_config)) {
+               drm_dbg_kms(display->drm, "DSC required but not available\n");
+               return -EINVAL;
+       }
+
        if (dsc_needed) {
                drm_dbg_kms(display->drm,
                            "Try DSC (fallback=%s, joiner=%s, force=%s)\n",
                            str_yes_no(ret), str_yes_no(joiner_needs_dsc),
                            str_yes_no(intel_dp->force_dsc_en));
 
-               if (!intel_dp_supports_dsc(intel_dp, connector, pipe_config))
-                       return -EINVAL;
-
                if (!intel_dp_compute_config_limits(intel_dp, pipe_config,
                                                    respect_downstream_limits,
                                                    true,
index a9d9d7694acba493cef14e6b504a0e7817e53f9c..7d9a164a7556d3a1d9622572d88ec6aa90cbbb4b 100644 (file)
@@ -633,14 +633,17 @@ static int mst_stream_compute_config(struct intel_encoder *encoder,
                        dsc_needed = true;
        }
 
+       if (dsc_needed && !intel_dp_supports_dsc(intel_dp, connector, pipe_config)) {
+               drm_dbg_kms(display->drm, "DSC required but not available\n");
+               return -EINVAL;
+       }
+
        /* enable compression if the mode doesn't fit available BW */
        if (dsc_needed) {
                drm_dbg_kms(display->drm, "Try DSC (fallback=%s, joiner=%s, force=%s)\n",
                            str_yes_no(ret), str_yes_no(joiner_needs_dsc),
                            str_yes_no(intel_dp->force_dsc_en));
 
-               if (!intel_dp_supports_dsc(intel_dp, connector, pipe_config))
-                       return -EINVAL;
 
                if (!mst_stream_compute_config_limits(intel_dp, connector,
                                                      pipe_config, true,