Skip to content

Commit ef10531

Browse files
ckborahjnikula
authored andcommitted
drm/i915/color: Create a transfer function color pipeline
Add a color pipeline with three colorops in the sequence 1D LUT - 3x4 CTM - 1D LUT This pipeline can be used to do any color space conversion or HDR tone mapping v2: Change namespace to drm_plane_colorop* v3: Use simpler/pre-existing colorops for first iteration v4: - s/*_tf_*/*_color_* (Jani) - Refactor to separate files (Jani) - Add missing space in comment (Suraj) - Consolidate patch that adds/attaches pipeline property v5: - Limit MAX_COLOR_PIPELINES to 2.(Suraj) Increase it as and when we add more pipelines. - Remove redundant initialization code (Suraj) v6: - Use drm_plane_create_color_pipeline_property() (Arun) Now MAX_COLOR_PIPELINES is 1 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-5-uma.shankar@intel.com Signed-off-by: Jani Nikula <jani.nikula@intel.com>
1 parent 730df50 commit ef10531

4 files changed

Lines changed: 95 additions & 0 deletions

File tree

drivers/gpu/drm/i915/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ i915-y += \
240240
display/intel_cmtg.o \
241241
display/intel_color.o \
242242
display/intel_colorop.o \
243+
display/intel_color_pipeline.o \
243244
display/intel_combo_phy.o \
244245
display/intel_connector.o \
245246
display/intel_crtc.o \
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
// SPDX-License-Identifier: MIT
2+
/*
3+
* Copyright © 2025 Intel Corporation
4+
*/
5+
#include "intel_colorop.h"
6+
#include "intel_color_pipeline.h"
7+
#include "intel_de.h"
8+
#include "intel_display_types.h"
9+
#include "skl_universal_plane.h"
10+
11+
#define MAX_COLOR_PIPELINES 1
12+
#define PLANE_DEGAMMA_SIZE 128
13+
#define PLANE_GAMMA_SIZE 32
14+
15+
static
16+
int _intel_color_pipeline_plane_init(struct drm_plane *plane, struct drm_prop_enum_list *list)
17+
{
18+
struct intel_colorop *colorop;
19+
struct drm_device *dev = plane->dev;
20+
int ret;
21+
struct drm_colorop *prev_op;
22+
23+
colorop = intel_colorop_create(INTEL_PLANE_CB_PRE_CSC_LUT);
24+
25+
ret = drm_plane_colorop_curve_1d_lut_init(dev, &colorop->base, plane,
26+
PLANE_DEGAMMA_SIZE,
27+
DRM_COLOROP_LUT1D_INTERPOLATION_LINEAR,
28+
DRM_COLOROP_FLAG_ALLOW_BYPASS);
29+
30+
if (ret)
31+
return ret;
32+
33+
list->type = colorop->base.base.id;
34+
list->name = kasprintf(GFP_KERNEL, "Color Pipeline %d", colorop->base.base.id);
35+
36+
/* TODO: handle failures and clean up */
37+
prev_op = &colorop->base;
38+
39+
colorop = intel_colorop_create(INTEL_PLANE_CB_CSC);
40+
ret = drm_plane_colorop_ctm_3x4_init(dev, &colorop->base, plane,
41+
DRM_COLOROP_FLAG_ALLOW_BYPASS);
42+
if (ret)
43+
return ret;
44+
45+
drm_colorop_set_next_property(prev_op, &colorop->base);
46+
prev_op = &colorop->base;
47+
48+
colorop = intel_colorop_create(INTEL_PLANE_CB_POST_CSC_LUT);
49+
ret = drm_plane_colorop_curve_1d_lut_init(dev, &colorop->base, plane,
50+
PLANE_GAMMA_SIZE,
51+
DRM_COLOROP_LUT1D_INTERPOLATION_LINEAR,
52+
DRM_COLOROP_FLAG_ALLOW_BYPASS);
53+
if (ret)
54+
return ret;
55+
56+
drm_colorop_set_next_property(prev_op, &colorop->base);
57+
58+
return 0;
59+
}
60+
61+
int intel_color_pipeline_plane_init(struct drm_plane *plane)
62+
{
63+
struct drm_device *dev = plane->dev;
64+
struct intel_display *display = to_intel_display(dev);
65+
struct drm_prop_enum_list pipelines[MAX_COLOR_PIPELINES];
66+
int len = 0;
67+
int ret;
68+
69+
/* Currently expose pipeline only for HDR planes */
70+
if (!icl_is_hdr_plane(display, to_intel_plane(plane)->id))
71+
return 0;
72+
73+
/* Add pipeline consisting of transfer functions */
74+
ret = _intel_color_pipeline_plane_init(plane, &pipelines[len]);
75+
if (ret)
76+
return ret;
77+
len++;
78+
79+
return drm_plane_create_color_pipeline_property(plane, pipelines, len);
80+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/* SPDX-License-Identifier: MIT */
2+
/*
3+
* Copyright © 2025 Intel Corporation
4+
*/
5+
6+
#ifndef __INTEL_COLOR_PIPELINE_H__
7+
#define __INTEL_COLOR_PIPELINE_H__
8+
9+
struct drm_plane;
10+
11+
int intel_color_pipeline_plane_init(struct drm_plane *plane);
12+
13+
#endif /* __INTEL_COLOR_PIPELINE_H__ */

drivers/gpu/drm/xe/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,7 @@ xe-$(CONFIG_DRM_XE_DISPLAY) += \
243243
i915-display/intel_cmtg.o \
244244
i915-display/intel_color.o \
245245
i915-display/intel_colorop.o \
246+
i915-display/intel_color_pipeline.o \
246247
i915-display/intel_combo_phy.o \
247248
i915-display/intel_connector.o \
248249
i915-display/intel_crtc.o \

0 commit comments

Comments
 (0)