From mboxrd@z Thu Jan 1 00:00:00 1970 From: Claude Code Review Bot To: dri-devel-reviews@example.com Subject: Claude review: drm/i915/dp: Decode dsc max delta bpp from sink dpcd Date: Thu, 28 May 2026 12:24:08 +1000 Message-ID: In-Reply-To: <20260527110849.3943338-5-nemesa.garg@intel.com> References: <20260527110849.3943338-1-nemesa.garg@intel.com> <20260527110849.3943338-5-nemesa.garg@intel.com> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 Patch Review **Issues found:** 1. **Out-of-range delta value produces garbage.** When the delta value falls outside the valid range, `max_bpp` retains its raw DPCD field value (unscaled), which then gets shifted left by 4 and returned: ```c case INTEL_OUTPUT_FORMAT_RGB: case INTEL_OUTPUT_FORMAT_YCBCR444: max_bpp = max_bpp_delta_v1 & DP_DSC_RGB_YCbCr444_MAX_BPP_DELTA_MASK; if (max_bpp >= 1 && max_bpp <= 21) max_bpp = max_bpp + DP_DSC_BPP_DELTA_444 - 1; break; ``` If `max_bpp` is 0, the function returns 0 (fine, interpreted as "not available"). But if `max_bpp` is > 21 (values 22-31 for the 5-bit field), the raw field value is returned as a bpp, which is nonsensical. The same applies to the 420 case when `max_bpp` > 7. The function should either return 0 for reserved/invalid values, or clamp. Returning the raw DPCD field value as a bpp is almost certainly wrong. 2. **Superfluous double spaces.** Minor style nit: there are double spaces in two places: ```c max_bpp = max_bpp_delta_v1 & DP_DSC_RGB_YCbCr444_MAX_BPP_DELTA_MASK; max_bpp = max_bpp + DP_DSC_BPP_DELTA_444 - 1; ``` 3. **No handling for YCBCR422.** The function handles RGB, YCbCr444, and YCbCr420 but not YCbCr422, even though patch 3 added the 422 mask and delta constant. The `default: MISSING_CASE()` path will fire if `INTEL_OUTPUT_FORMAT_YCBCR422` is ever passed. This is arguably fine for now (if 422 isn't used in this code path), but is worth noting since the header constants were clearly added with 422 in mind. 4. **The delta-to-bpp conversion semantics should be documented.** The formula `max_bpp = raw_delta + base - 1` is non-obvious. A brief comment explaining what the delta values represent per the DP spec (e.g., "delta of N maps to max bpp of N + 15 for 444") would help future readers understand the magic numbers 16 and 12. 5. **Commit message mentions `DP_DSC_MAX_BPP_DELTA` but the code uses `DP_DSC_MAX_BPP_DELTA_VERSION_1`.** The commit message references the old unversioned name. Minor, but should be consistent. --- **Summary:** The main issues are the out-of-range delta value bug in patch 4 (which can return a nonsensical bpp value), and the misplacement of the YCbCr422 mask in patch 3 (placed under the wrong register). Both should be fixed before merging. --- Generated by Claude Code Patch Reviewer