include/drm/drm_color_mgmt.h
Source file repositories/reference/linux-study-clean/include/drm/drm_color_mgmt.h
File Facts
- System
- Linux kernel
- Corpus path
include/drm/drm_color_mgmt.h- Extension
.h- Size
- 5980 bytes
- Lines
- 179
- Domain
- Repository Root And Misc
- Bucket
- include
- Inferred role
- Repository Root And Misc: implementation source
- Status
- source implementation candidate
Why This File Exists
Top-level or miscellaneous repository surface. Use this as map coverage unless a later manual pass promotes the file into a deeper subsystem dossier.
- Top-level or miscellaneous repository surface. Use this as map coverage unless a later manual pass promotes the file into a deeper subsystem dossier.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/ctype.hlinux/math64.hdrm/drm_property.h
Detected Declarations
struct drm_crtcstruct drm_planeenum drm_color_encodingenum drm_color_rangeenum drm_color_lut_testsfunction drm_color_lut_extractfunction drm_color_lut32_extractfunction drm_color_lut_sizefunction drm_color_lut32_size
Annotated Snippet
#ifndef __DRM_COLOR_MGMT_H__
#define __DRM_COLOR_MGMT_H__
#include <linux/ctype.h>
#include <linux/math64.h>
#include <drm/drm_property.h>
struct drm_crtc;
struct drm_plane;
/**
* drm_color_lut_extract - clamp and round LUT entries
* @user_input: input value
* @bit_precision: number of bits the hw LUT supports
*
* Extract a degamma/gamma LUT value provided by user (in the form of
* &drm_color_lut entries) and round it to the precision supported by the
* hardware, following OpenGL int<->float conversion rules
* (see eg. OpenGL 4.6 specification - 2.3.5 Fixed-Point Data Conversions).
*/
static inline u32 drm_color_lut_extract(u32 user_input, int bit_precision)
{
if (bit_precision > 16)
return DIV_ROUND_CLOSEST_ULL(mul_u32_u32(user_input, (1 << bit_precision) - 1),
(1 << 16) - 1);
else
return DIV_ROUND_CLOSEST(user_input * ((1 << bit_precision) - 1),
(1 << 16) - 1);
}
/**
* drm_color_lut32_extract - clamp and round LUT entries
* @user_input: input value
* @bit_precision: number of bits the hw LUT supports
*
* Extract U0.bit_precision from a U0.32 LUT value.
*
*/
static inline u32 drm_color_lut32_extract(u32 user_input, int bit_precision)
{
u64 max = (bit_precision >= 64) ? ~0ULL : (1ULL << bit_precision) - 1;
return DIV_ROUND_CLOSEST_ULL((u64)user_input * max,
(1ULL << 32) - 1);
}
u64 drm_color_ctm_s31_32_to_qm_n(u64 user_input, u32 m, u32 n);
void drm_crtc_enable_color_mgmt(struct drm_crtc *crtc,
uint degamma_lut_size,
bool has_ctm,
uint gamma_lut_size);
int drm_mode_crtc_set_gamma_size(struct drm_crtc *crtc,
int gamma_size);
/**
* drm_color_lut_size - calculate the number of entries in the LUT
* @blob: blob containing the LUT
*
* Returns:
* The number of entries in the color LUT stored in @blob.
*/
static inline int drm_color_lut_size(const struct drm_property_blob *blob)
{
return blob->length / sizeof(struct drm_color_lut);
}
/**
* drm_color_lut32_size - calculate the number of entries in the extended LUT
* @blob: blob containing the LUT
*
* Returns:
* The number of entries in the color LUT stored in @blob.
*/
static inline int drm_color_lut32_size(const struct drm_property_blob *blob)
{
return blob->length / sizeof(struct drm_color_lut32);
}
enum drm_color_encoding {
DRM_COLOR_YCBCR_BT601,
DRM_COLOR_YCBCR_BT709,
DRM_COLOR_YCBCR_BT2020,
DRM_COLOR_ENCODING_MAX,
};
enum drm_color_range {
DRM_COLOR_YCBCR_LIMITED_RANGE,
DRM_COLOR_YCBCR_FULL_RANGE,
Annotation
- Immediate include surface: `linux/ctype.h`, `linux/math64.h`, `drm/drm_property.h`.
- Detected declarations: `struct drm_crtc`, `struct drm_plane`, `enum drm_color_encoding`, `enum drm_color_range`, `enum drm_color_lut_tests`, `function drm_color_lut_extract`, `function drm_color_lut32_extract`, `function drm_color_lut_size`, `function drm_color_lut32_size`.
- Atlas domain: Repository Root And Misc / include.
- Implementation status: source implementation candidate.
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.