Skip to content

Commit bf0fd73

Browse files
uma-inteljnikula
authored andcommitted
drm/i915/color: Program Plane Post CSC Registers
Extract the LUT and program plane post csc registers. v2: Add DSB support v3: Add support for single segment 1D LUT v4: - s/drm_color_lut_32/drm_color_lut32 (Simon) - Move declaration to beginning of the function (Suraj) - Remove multisegmented code, add it later - Remove dead code for SDR planes, add it later v5: - Fix iterator issues v6: Removed redundant variable (Suraj) Reviewed-by: Suraj Kandpal <suraj.kandpal@intel.com> Signed-off-by: Uma Shankar <uma.shankar@intel.com> Signed-off-by: Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com> Link: https://patch.msgid.link/20251203085211.3663374-13-uma.shankar@intel.com Signed-off-by: Jani Nikula <jani.nikula@intel.com>
1 parent 82caa1c commit bf0fd73

1 file changed

Lines changed: 59 additions & 0 deletions

File tree

drivers/gpu/drm/i915/display/intel_color.c

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3996,11 +3996,70 @@ xelpd_program_plane_pre_csc_lut(struct intel_dsb *dsb,
39963996
}
39973997
}
39983998

3999+
static void
4000+
xelpd_program_plane_post_csc_lut(struct intel_dsb *dsb,
4001+
const struct intel_plane_state *plane_state)
4002+
{
4003+
struct intel_display *display = to_intel_display(plane_state);
4004+
const struct drm_plane_state *state = &plane_state->uapi;
4005+
enum pipe pipe = to_intel_plane(state->plane)->pipe;
4006+
enum plane_id plane = to_intel_plane(state->plane)->id;
4007+
const struct drm_color_lut32 *post_csc_lut = plane_state->hw.gamma_lut->data;
4008+
u32 i, lut_size, lut_val;
4009+
4010+
if (icl_is_hdr_plane(display, plane)) {
4011+
intel_de_write_dsb(display, dsb, PLANE_POST_CSC_GAMC_INDEX_ENH(pipe, plane, 0),
4012+
PLANE_PAL_PREC_AUTO_INCREMENT);
4013+
/* TODO: Add macro */
4014+
intel_de_write_dsb(display, dsb, PLANE_POST_CSC_GAMC_SEG0_INDEX_ENH(pipe, plane, 0),
4015+
PLANE_PAL_PREC_AUTO_INCREMENT);
4016+
if (post_csc_lut) {
4017+
lut_size = 32;
4018+
for (i = 0; i < lut_size; i++) {
4019+
lut_val = drm_color_lut32_extract(post_csc_lut[i].green, 24);
4020+
4021+
intel_de_write_dsb(display, dsb,
4022+
PLANE_POST_CSC_GAMC_DATA_ENH(pipe, plane, 0),
4023+
lut_val);
4024+
}
4025+
4026+
/* Segment 2 */
4027+
do {
4028+
intel_de_write_dsb(display, dsb,
4029+
PLANE_POST_CSC_GAMC_DATA_ENH(pipe, plane, 0),
4030+
(1 << 24));
4031+
} while (i++ < 34);
4032+
} else {
4033+
/*TODO: Add for segment 0 */
4034+
lut_size = 32;
4035+
for (i = 0; i < lut_size; i++) {
4036+
u32 v = (i * ((1 << 24) - 1)) / (lut_size - 1);
4037+
4038+
intel_de_write_dsb(display, dsb,
4039+
PLANE_POST_CSC_GAMC_DATA_ENH(pipe, plane, 0), v);
4040+
}
4041+
4042+
do {
4043+
intel_de_write_dsb(display, dsb,
4044+
PLANE_POST_CSC_GAMC_DATA_ENH(pipe, plane, 0),
4045+
1 << 24);
4046+
} while (i++ < 34);
4047+
}
4048+
4049+
intel_de_write_dsb(display, dsb, PLANE_POST_CSC_GAMC_INDEX_ENH(pipe, plane, 0), 0);
4050+
intel_de_write_dsb(display, dsb,
4051+
PLANE_POST_CSC_GAMC_SEG0_INDEX_ENH(pipe, plane, 0), 0);
4052+
}
4053+
}
4054+
39994055
static void
40004056
xelpd_plane_load_luts(struct intel_dsb *dsb, const struct intel_plane_state *plane_state)
40014057
{
40024058
if (plane_state->hw.degamma_lut)
40034059
xelpd_program_plane_pre_csc_lut(dsb, plane_state);
4060+
4061+
if (plane_state->hw.gamma_lut)
4062+
xelpd_program_plane_post_csc_lut(dsb, plane_state);
40044063
}
40054064

40064065
static const struct intel_color_funcs chv_color_funcs = {

0 commit comments

Comments
 (0)