OSDN Git Service

drm/i915/dp: Rearrange check for illegal mode and comments in mode_valid
authorAnkit Nautiyal <ankit.k.nautiyal@intel.com>
Thu, 27 Apr 2023 12:56:05 +0000 (18:26 +0530)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Fri, 5 May 2023 15:12:02 +0000 (18:12 +0300)
Check for MODE_H_ILLEGAL before calculating max rates, lanes etc.
Move comments about compressed bpp U6.4 format closer to where it is used.

Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230427125605.487769-7-ankit.k.nautiyal@intel.com
drivers/gpu/drm/i915/display/intel_dp.c

index 11a7d6c..0cc5768 100644 (file)
@@ -1139,6 +1139,9 @@ intel_dp_mode_valid(struct drm_connector *_connector,
        if (target_clock > max_dotclk)
                return MODE_CLOCK_HIGH;
 
+       if (intel_dp_hdisplay_bad(dev_priv, mode->hdisplay))
+               return MODE_H_ILLEGAL;
+
        max_link_clock = intel_dp_max_link_rate(intel_dp);
        max_lanes = intel_dp_max_lane_count(intel_dp);
 
@@ -1146,13 +1149,6 @@ intel_dp_mode_valid(struct drm_connector *_connector,
        mode_rate = intel_dp_link_required(target_clock,
                                           intel_dp_mode_min_output_bpp(connector, mode));
 
-       if (intel_dp_hdisplay_bad(dev_priv, mode->hdisplay))
-               return MODE_H_ILLEGAL;
-
-       /*
-        * Output bpp is stored in 6.4 format so right shift by 4 to get the
-        * integer value since we support only integer values of bpp.
-        */
        if (HAS_DSC(dev_priv) &&
            drm_dp_sink_supports_dsc(intel_dp->dsc_dpcd)) {
                /*
@@ -1161,6 +1157,10 @@ intel_dp_mode_valid(struct drm_connector *_connector,
                 */
                int pipe_bpp = intel_dp_dsc_compute_bpp(intel_dp, U8_MAX);
 
+               /*
+                * Output bpp is stored in 6.4 format so right shift by 4 to get the
+                * integer value since we support only integer values of bpp.
+                */
                if (intel_dp_is_edp(intel_dp)) {
                        dsc_max_output_bpp =
                                drm_edp_dsc_sink_output_bpp(intel_dp->dsc_dpcd) >> 4;