From mboxrd@z Thu Jan 1 00:00:00 1970 From: Claude Code Review Bot To: dri-devel-reviews@example.com Subject: Claude review: Revert "drm/amd/display: Remove unused cm3_helper_translate_curve_to_degamma_hw_format" Date: Thu, 07 May 2026 13:11:57 +1000 Message-ID: In-Reply-To: <20260506191606.15022-3-mwen@igalia.com> References: <20260506191606.15022-1-mwen@igalia.com> <20260506191606.15022-3-mwen@igalia.com> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 Patch Review **Purpose**: Re-introduces `cm3_helper_translate_curve_to_degamma_hw_format()` which was previously removed as unused. It will be wired up in patch 3. **Code review of the reverted function**: This is a straightforward revert of removal. The function uses 12 regions from 2^-12 to 2^0, with 16 samples per region (seg_distr[k]=4), totaling 192 hw_points. Key differences from the regamma helper: - **Corner point slopes**: Non-zero for PQ (extrapolates to 1.0 at 10000 nits / 125 normalized), zero for everything else. The regamma helper uses zero slopes unconditionally. - **Region range**: [2^-12, 1] for encoded input domain vs the regamma helper's much wider range for linear-light input. **Bounds check**: `rgb_resulted` has 259 entries (`256+3`), 192 hw_points fits. The `arr_curve_points` loop at lines 449-458 iterates `k` from 0 to `MAX_REGIONS_NUMBER-1` (33), which fits the 34-entry array. The `(i >> 4) + 1 < TRANSFER_FUNC_POINTS` check at the original seg_distr=4: max index = start_index + 16 = at most 400+16 = 416 < 1025. **Stale pointer after memset**: Lines 339-340 save `corner_points` and `rgb_resulted` as pointers into `lut_params`, then line 343 zeroes the struct. The pointers remain valid (they address fields within the struct, not separate allocations), so this is correct. The function declaration in `dcn30_cm_common.h` is properly added. No issues. --- Generated by Claude Code Patch Reviewer