drivers/gpu/drm/i915/display/intel_color.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/i915/display/intel_color.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/i915/display/intel_color.c- Extension
.c- Size
- 129252 bytes
- Lines
- 4390
- Domain
- Driver Families
- Bucket
- drivers/gpu
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
drm/drm_print.hi9xx_plane_regs.hintel_color.hintel_color_regs.hintel_de.hintel_display_types.hintel_display_utils.hintel_dsb.hintel_vrr.hskl_universal_plane.hskl_universal_plane_regs.h
Detected Declarations
struct intel_color_funcsfunction intel_csc_clearfunction lut_is_legacyfunction ilk_update_pipe_cscfunction ilk_read_pipe_cscfunction ilk_read_cscfunction skl_read_cscfunction icl_update_output_cscfunction icl_read_output_cscfunction icl_read_cscfunction ilk_limited_rangefunction ilk_lut_limited_rangefunction ilk_csc_limited_rangefunction ilk_csc_copyfunction ilk_csc_convert_ctmfunction ilk_assign_cscfunction ilk_load_csc_matrixfunction icl_assign_cscfunction icl_load_csc_matrixfunction ctm_to_twos_complementfunction vlv_wgc_csc_convert_ctmfunction vlv_load_wgc_cscfunction vlv_read_wgc_cscfunction vlv_read_cscfunction vlv_assign_cscfunction Mappingfunction chv_load_cgm_cscfunction chv_read_cgm_cscfunction chv_read_cscfunction chv_assign_cscfunction intel_color_lut_packfunction i9xx_lut_8function i9xx_lut_8_packfunction _i9xx_lut_10_ldwfunction i9xx_lut_10_ldwfunction _i9xx_lut_10_udwfunction i9xx_lut_10_udwfunction i9xx_lut_10_packfunction i9xx_lut_10_pack_slopefunction i965_lut_10p6_ldwfunction i965_lut_10p6_udwfunction i965_lut_10p6_packfunction i965_lut_11p6_max_packfunction ilk_lut_10function ilk_lut_10_packfunction ilk_lut_12p4_ldwfunction ilk_lut_12p4_udwfunction ilk_lut_12p4_pack
Annotated Snippet
struct intel_color_funcs {
int (*color_check)(struct intel_atomic_state *state,
struct intel_crtc *crtc);
/*
* Program non-arming double buffered color management registers
* before vblank evasion. The registers should then latch after
* the arming register is written (by color_commit_arm()) during
* the next vblank start, alongside any other double buffered
* registers involved with the same commit. This hook is optional.
*/
void (*color_commit_noarm)(struct intel_dsb *dsb,
const struct intel_crtc_state *crtc_state);
/*
* Program arming double buffered color management registers
* during vblank evasion. The registers (and whatever other registers
* they arm that were written by color_commit_noarm) should then latch
* during the next vblank start, alongside any other double buffered
* registers involved with the same commit.
*/
void (*color_commit_arm)(struct intel_dsb *dsb,
const struct intel_crtc_state *crtc_state);
/*
* Perform any extra tasks needed after all the
* double buffered registers have been latched.
*/
void (*color_post_update)(const struct intel_crtc_state *crtc_state);
/*
* Load LUTs (and other single buffered color management
* registers). Will (hopefully) be called during the vblank
* following the latching of any double buffered registers
* involved with the same commit.
*/
void (*load_luts)(const struct intel_crtc_state *crtc_state);
/*
* Read out the LUTs from the hardware into the software state.
* Used by eg. the hardware state checker.
*/
void (*read_luts)(struct intel_crtc_state *crtc_state);
/*
* Compare the LUTs
*/
bool (*lut_equal)(const struct intel_crtc_state *crtc_state,
const struct drm_property_blob *blob1,
const struct drm_property_blob *blob2,
bool is_pre_csc_lut);
/*
* Read out the CSCs (if any) from the hardware into the
* software state. Used by eg. the hardware state checker.
*/
void (*read_csc)(struct intel_crtc_state *crtc_state);
/*
* Read config other than LUTs and CSCs, before them. Optional.
*/
void (*get_config)(struct intel_crtc_state *crtc_state);
/* Plane CSC*/
void (*load_plane_csc_matrix)(struct intel_dsb *dsb,
const struct intel_plane_state *plane_state);
/* Plane Pre/Post CSC */
void (*load_plane_luts)(struct intel_dsb *dsb,
const struct intel_plane_state *plane_state);
};
#define CTM_COEFF_SIGN (1ULL << 63)
#define CTM_COEFF_1_0 (1ULL << 32)
#define CTM_COEFF_2_0 (CTM_COEFF_1_0 << 1)
#define CTM_COEFF_4_0 (CTM_COEFF_2_0 << 1)
#define CTM_COEFF_8_0 (CTM_COEFF_4_0 << 1)
#define CTM_COEFF_0_5 (CTM_COEFF_1_0 >> 1)
#define CTM_COEFF_0_25 (CTM_COEFF_0_5 >> 1)
#define CTM_COEFF_0_125 (CTM_COEFF_0_25 >> 1)
#define CTM_COEFF_LIMITED_RANGE ((235ULL - 16ULL) * CTM_COEFF_1_0 / 255)
#define CTM_COEFF_NEGATIVE(coeff) (((coeff) & CTM_COEFF_SIGN) != 0)
#define CTM_COEFF_ABS(coeff) ((coeff) & (CTM_COEFF_SIGN - 1))
#define LEGACY_LUT_LENGTH 256
/*
* ILK+ csc matrix:
*
* |R/Cr| | c0 c1 c2 | ( |R/Cr| |preoff0| ) |postoff0|
* |G/Y | = | c3 c4 c5 | x ( |G/Y | + |preoff1| ) + |postoff1|
* |B/Cb| | c6 c7 c8 | ( |B/Cb| |preoff2| ) |postoff2|
*
* ILK/SNB don't have explicit post offsets, and instead
* CSC_MODE_YUV_TO_RGB and CSC_BLACK_SCREEN_OFFSET are used:
Annotation
- Immediate include surface: `drm/drm_print.h`, `i9xx_plane_regs.h`, `intel_color.h`, `intel_color_regs.h`, `intel_de.h`, `intel_display_types.h`, `intel_display_utils.h`, `intel_dsb.h`.
- Detected declarations: `struct intel_color_funcs`, `function intel_csc_clear`, `function lut_is_legacy`, `function ilk_update_pipe_csc`, `function ilk_read_pipe_csc`, `function ilk_read_csc`, `function skl_read_csc`, `function icl_update_output_csc`, `function icl_read_output_csc`, `function icl_read_csc`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.