drm/drm_colorop: add post-blend colorop support to AMD display driver
Subsystems (4)
v2 cover drm/drm_colorop: add post-blend colorop support to AMD display driver
Hey,
I have been working on gamescope migration from AMD driver-specific color props to KMS colorop API [1] and, with the fixed-matrix replacement for COLOR_ENCODING and COLOR_RANGE[2], the only missing color prop was the CRTC AMD REGAMMA TF (the 1D Curve). So I worked on top of Ariel&Nícolas proposal for post-blend colorop API [3], discarded patches for DRM_CAP_CRTC_COLOR_PIPELINE driver cap flag (as commented in this year Linux Display Hackfest), fixed some issues based on plane colorop recent changes and exposed AMD post-blend colorop pipeline with CTM -> 1D Curve -> 1D LUT, since post-blend Degamma is not actually supported by AMD (even though there is a workaround for enable it in CRTC color mgmt properties).
I have a gamescope implementation that fully migrates its color pipeline from AMD private plane/CRTC color props to pre- and post-blend colorops running on a custom kernel with the required colorop support for AMD.
- Gamescope draft:
https://github.com/ValveSoftware/gamescope/pull/2113/commits
- Kernel branch with all necessary patches:
https://gitlab.freedesktop.org/mwen/drm-misc/-/commits/gamescope_pipeline_w_colorop
This series doesn't take into account the inactive color pipeline work I've been doing for plane color pipeline. My plan is to apply a similar approach post-blend when we agree that the plane series is correct.
- Patch 1-13 are essentially Ariel&Nicolas work for DRM post-blend colorop support where I added patch 10 for tracking plane vs CRTC colorop changes.
- Patch 14 completes deprecation of CRTC color mgmt properties if post-blend color pipeline is enabled by hiding them;
- Patch 15 applies the same bug fix logic as Robert did to guard plane client cap[4];
- Patch 16-20 add support to post-blend colorop API on AMD driver based on plane colorop work.
This is one example of drm_info output on Steam Deck with SteamOS/gamescope implementation and this kernel work:
├───CRTCs
│ ├───CRTC 0
│ │ ├───Object ID: 399
[...]
│ │ └───"COLOR_PIPELINE" (atomic): enum {Bypass, Color Pipeline 400} = Color Pipeline 400
│ │ ├───Bypass
│ │ └───Color Pipeline 400
│ │ ├───Color Operation 400
│ │ │ └───Properties
│ │ │ ├───"TYPE" (immutable): enum {1D Curve, 1D LUT, 3x4 Matrix, Multiplier, 3D LUT, Fixed Matrix} = 3x4 Matrix
│ │ │ ├───"BYPASS" (atomic): range [0, 1] = 1
│ │ │ ├───"NEXT" (atomic, immutable): object colorop = 405
│ │ │ └───"DATA" (atomic): blob = 0
│ │ ├───Color Operation 405
│ │ │ └───Properties
│ │ │ ├───"TYPE" (immutable): enum {1D Curve, 1D LUT, 3x4 Matrix, Multiplier, 3D LUT, Fixed Matrix} = 1D Curve
│ │ │ ├───"BYPASS" (atomic): range [0, 1] = 0
│ │ │ ├───"NEXT" (atomic, immutable): object colorop = 410
│ │ │ └───"CURVE_1D_TYPE" (atomic): enum {sRGB Inverse EOTF, PQ 125 Inverse EOTF, BT.2020 OETF, Gamma 2.2 Inverse, Gamma 2.4 Inverse, Gamma 2.6 Inverse} = PQ 125 Inverse EOTF
│ │ └───Color Operation 410
│ │ └───Properties
│ │ ├───"TYPE" (immutable): enum {1D Curve, 1D LUT, 3x4 Matrix, Multiplier, 3D LUT, Fixed Matrix} = 1D LUT
│ │ ├───"BYPASS" (atomic): range [0, 1] = 1
│ │ ├───"NEXT" (atomic, immutable): object colorop = 0
│ │ ├───"SIZE" (atomic, immutable): range [0, UINT32_MAX] = 4096
│ │ ├───"LUT1D_INTERPOLATION": enum {Linear} = Linear
│ │ └───"DATA" (atomic): blob = 0[...]
├───Plane 3
│ ├───Object ID: 218
[...]
│ └───Properties
│ ├───"type" (immutable): enum {Overlay, Primary, Cursor} = Primary
│ ├───"FB_ID" (atomic): object framebuffer = 513
│ │ ├───Object ID: 513
[...]
│ └───"COLOR_PIPELINE" (atomic): enum {Bypass, Color Pipeline 224} = Color Pipeline 224
│ ├───Bypass
│ └───Color Pipeline 224
│ ├───Color Operation 224
│ │ └───Properties
│ │ ├───"TYPE" (immutable): enum {1D Curve, 1D LUT, 3x4 Matrix, Multiplier, 3D LUT, Fixed Matrix} = Fixed Matrix
│ │ ├───"BYPASS" (atomic): range [0, 1] = 1
│ │ ├───"NEXT" (atomic, immutable): object colorop = 229
│ │ └───"FIXED_MATRIX_TYPE" (atomic): enum {YCbCr 601 Full to RGB, YCbCr 601 Limited to RGB, YCbCr 709 Full to RGB, YCbCr 709 Limited to RGB, YCbCr 2020 NC Full to RGB, YCbCr 2020 NC Limited to RGB} = YCbCr 601 Full to RGB
│ ├───Color Operation 229
│ │ └───Properties
│ │ ├───"TYPE" (immutable): enum {1D Curve, 1D LUT, 3x4 Matrix, Multiplier, 3D LUT, Fixed Matrix} = 1D Curve
│ │ ├───"BYPASS" (atomic): range [0, 1] = 0
│ │ ├───"NEXT" (atomic, immutable): object colorop = 234
│ │ └───"CURVE_1D_TYPE" (atomic): enum {sRGB EOTF, PQ 125 EOTF, BT.2020 Inverse OETF, Gamma 2.2, Gamma 2.4, Gamma 2.6} = sRGB EOTF
│ ├───Color Operation 234
│ │ └───Properties
│ │ ├───"TYPE" (immutable): enum {1D Curve, 1D LUT, 3x4 Matrix, Multiplier, 3D LUT, Fixed Matrix} = Multiplier
│ │ ├───"BYPASS" (atomic): range [0, 1] = 0
│ │ ├───"NEXT" (atomic, immutable): object colorop = 239
│ │ └───"MULTIPLIER" (atomic): range [0, UINT64_MAX] = 4294967296
│ ├───Color Operation 239
│ │ └───Properties
│ │ ├───"TYPE" (immutable): enum {1D Curve, 1D LUT, 3x4 Matrix, Multiplier, 3D LUT, Fixed Matrix} = 3x4 Matrix
│ │ ├───"BYPASS" (atomic): range [0, 1] = 1
│ │ ├───"NEXT" (atomic, immutable): object colorop = 244
│ │ └───"DATA" (atomic): blob = 0
│ ├───Color Operation 244
│ │ └───Properties
│ │ ├───"TYPE" (immutable): enum {1D Curve, 1D LUT, 3x4 Matrix, Multiplier, 3D LUT, Fixed Matrix} = 1D Curve
│ │ ├───"BYPASS" (atomic): range [0, 1] = 0
│ │ ├───"NEXT" (atomic, immutable): object colorop = 249
│ │ └───"CURVE_1D_TYPE" (atomic): enum {sRGB Inverse EOTF, PQ 125 Inverse EOTF, BT.2020 OETF, Gamma 2.2 Inverse, Gamma 2.4 Inverse, Gamma 2.6 Inverse} = sRGB Inverse EOTF
│ ├───Color Operation 249
│ │ └───Properties
│ │ ├───"TYPE" (immutable): enum {1D Curve, 1D LUT, 3x4 Matrix, Multiplier, 3D LUT, Fixed Matrix} = 1D LUT
│ │ ├───"BYPASS" (atomic): range [0, 1] = 0
│ │ ├───"NEXT" (atomic, immutable): object colorop = 256
│ │ ├───"SIZE" (atomic, immutable): range [0, UINT32_MAX] = 4096
│ │ ├───"LUT1D_INTERPOLATION": enum {Linear} = Linear
│ │ └───"DATA" (atomic): blob = 528
│ ├───Color Operation 256
│ │ └───Properties
│ │ ├───"TYPE" (immutable): enum {1D Curve, 1D LUT, 3x4 Matrix, Multiplier, 3D LUT, Fixed Matrix} = 3D LUT
│ │ ├───"BYPASS" (atomic): range [0, 1] = 0
│ │ ├───"NEXT" (atomic, immutable): object colorop = 263
│ │ ├───"SIZE" (atomic, immutable): range [0, UINT32_MAX] = 17
│ │ ├───"LUT3D_INTERPOLATION": enum {Tetrahedral} = Tetrahedral
│ │ └───"DATA" (atomic): blob = 529
│ ├───Color Operation 263
│ │ └───Properties
│ │ ├───"TYPE" (immutable): enum {1D Curve, 1D LUT, 3x4 Matrix, Multiplier, 3D LUT, Fixed Matrix} = 1D Curve
│ │ ├───"BYPASS" (atomic): range [0, 1] = 0
│ │ ├───"NEXT" (atomic, immutable): object colorop = 268
│ │ └───"CURVE_1D_TYPE" (atomic): enum {sRGB EOTF, PQ 125 EOTF, BT.2020 Inverse OETF, Gamma 2.2, Gamma 2.4, Gamma 2.6} = PQ 125 EOTF
│ └───Color Operation 268
│ └───Properties
│ ├───"TYPE" (immutable): enum {1D Curve, 1D LUT, 3x4 Matrix, Multiplier, 3D LUT, Fixed Matrix} = 1D LUT
│ ├───"BYPASS" (atomic): range [0, 1] = 1
│ ├───"NEXT" (atomic, immutable): object colorop = 0
│ ├───"SIZE" (atomic, immutable): range [0, UINT32_MAX] = 4096
│ ├───"LUT1D_INTERPOLATION": enum {Linear} = Linear
│ └───"DATA" (atomic): blob = 0FWIW, here is the drm_info diff:
drm_info.h +1 -0
@@ -21,5 +21,6 @@ enum {/* Remove after updating libdrm */ #define DRM_MODE_OBJECT_COLOROP 0xfafafafa#define DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE 7 +#define DRM_CLIENT_CAP_CRTC_COLOR_PIPELINE 8#endif
json.c +1 -0
@@ -29,6 +29,7 @@ static const struct { { "WRITEBACK_CONNECTORS", DRM_CLIENT_CAP_WRITEBACK_CONNECTORS }, { "CURSOR_PLANE_HOTSPOT", DRM_CLIENT_CAP_CURSOR_PLANE_HOTSPOT }, { "PLANE_COLOR_PIPELINE", DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE }, + { "CRTC_COLOR_PIPELINE", DRM_CLIENT_CAP_CRTC_COLOR_PIPELINE }, };
[1] https://github.com/ValveSoftware/gamescope/pull/2113
[2] https://lore.kernel.org/dri-devel/[email protected]/
[3] https://lore.kernel.org/dri-devel/20251223-mtk-post-blend-color-pipeline-v3-0-7d969f9a37a0@collabora.com/
[4] https://lore.kernel.org/dri-devel/[email protected]/
Let me know your thoughts!
Melissa
Ariel D'Alessandro (2):
drm: Add helper to extract a 3x4 matrix from any CTM matrix dimensions
drm: Add helper to extract a LUT entry from either 16-bit or 32-bit
LUT
Melissa Wen (8):
drm/colorop: distinguish whether a colorop belongs to a plane or a
CRTC
drm/drm_mode_object: hide deprecated CRTC color mgmt props if colorop
is set
drm/drm_ioctl: guard DRM_CLIENT_CAP_CRTC_COLOR_PIPELINE drm/amd/display: add support to post-blend CTM colorop drm/amd/display: add support to post-blend 1D-Curve colorop drm/amd/display: add support to post-blend 1D-LUT colorop drm/amd/display: move CRTC CTM color mgmt prop to check helper drm/amd/display: enable post-blend colorop properties
Nícolas F. R. A. Prado (10):
drm/crtc: Add color pipeline to CRTC state
drm/colorop: Allow parenting colorop to CRTC
drm: Factor out common color_pipeline property initialization code drm/crtc: Add COLOR_PIPELINE property
drm: Introduce DRM_CLIENT_CAP_CRTC_COLOR_PIPELINE drm/atomic: Pass crtc_color_pipeline client cap to atomic check drm/atomic: Print the color pipeline as part of the CRTC state print drm/colorop: Factor out common paths from colorops helpers drm/colorop: Introduce colorop helpers for crtc
drm/crtc: Track crtc color pipeline client cap in drm_crtc_state
.../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h | 3 + .../amd/display/amdgpu_dm/amdgpu_dm_color.c | 250 +++++++++++++--- .../amd/display/amdgpu_dm/amdgpu_dm_colorop.c | 76 +++++ .../amd/display/amdgpu_dm/amdgpu_dm_colorop.h | 2 + .../amd/display/amdgpu_dm/amdgpu_dm_crtc.c | 42 +++ drivers/gpu/drm/drm_atomic.c | 9 +- drivers/gpu/drm/drm_atomic_uapi.c | 97 +++++- drivers/gpu/drm/drm_colorop.c | 282 ++++++++++++++---- drivers/gpu/drm/drm_connector.c | 1 + drivers/gpu/drm/drm_crtc.c | 31 ++ drivers/gpu/drm/drm_crtc_internal.h | 1 + drivers/gpu/drm/drm_ioctl.c | 20 ++ drivers/gpu/drm/drm_mode_object.c | 18 ++ drivers/gpu/drm/drm_plane.c | 34 +-- drivers/gpu/drm/drm_property.c | 44 +++ include/drm/drm_atomic.h | 20 ++ include/drm/drm_atomic_uapi.h | 2 + include/drm/drm_color_mgmt.h | 61 ++++ include/drm/drm_colorop.h | 32 +- include/drm/drm_crtc.h | 27 ++ include/drm/drm_file.h | 7 + include/drm/drm_property.h | 5 + include/uapi/drm/drm.h | 19 ++ 23 files changed, 939 insertions(+), 144 deletions(-)
Signature · 1 line
2.53.0
RFC PATCH v2 1/20 drm/crtc: Add color pipeline to CRTC state
From: Nícolas F. R. A. Prado <[email protected]>
Add a color pipeline to the CRTC state to allow post-blend color pipelines.
--- include/drm/drm_crtc.h | 8 ++++++++ 1 file changed, 8 insertions(+)
include/drm/drm_crtc.h +8 -0
@@ -274,6 +274,14 @@ struct drm_crtc_state {*/ struct drm_property_blob *gamma_lut; +/** +* @color_pipeline: +* +* The first colorop of the active color pipeline, or NULL, if no +* color pipeline is active. +*/ +struct drm_colorop *color_pipeline; +/** * @background_color: *
Signature · 1 line
2.53.0
RFC PATCH v2 2/20 drm/colorop: Allow parenting colorop to CRTC
In reply to Melissa WenFrom: Nícolas F. R. A. Prado <[email protected]>
In order to allow for post-blend color pipelines, colorops need to be assigned to a crtc rather than a plane. Add a crtc to the colorop struct to enable this. Either the plane or the crtc will be set for any given colorop depending on whether it is part of a pre- or post-blend color pipeline.
--- drivers/gpu/drm/drm_atomic.c | 6 +++--- drivers/gpu/drm/drm_colorop.c | 25 +++++++++++++++++++++++++ include/drm/drm_colorop.h | 18 ++++++++++++++++-- 3 files changed, 44 insertions(+), 5 deletions(-)
drivers/gpu/drm/drm_atomic.c +3 -3
@@ -700,7 +700,7 @@ drm_atomic_get_colorop_state(struct drm_atomic_commit *state,if (colorop_state)return colorop_state; - ret =drm_modeset_lock (&colorop->plane->mutex, state->acquire_ctx); + ret =drm_colorop_modeset_lock (colorop, state->acquire_ctx);if (ret)return ERR_PTR (ret);
@@ -2141,10 +2141,10 @@ static void __drm_state_dump(struct drm_device *dev, struct drm_printer *p,list_for_each_entry (colorop, &config->colorop_list, head) {if (take_locks) -drm_modeset_lock (&colorop->plane->mutex,NULL ); +drm_colorop_modeset_lock (colorop,NULL );drm_atomic_colorop_print_state (p, colorop->state);if (take_locks) -drm_modeset_unlock (&colorop->plane->mutex); +drm_colorop_modeset_unlock (colorop); }list_for_each_entry (plane, &config->plane_list, head) {
drivers/gpu/drm/drm_colorop.c +25 -0
@@ -24,6 +24,7 @@* */ +#include <drm/drm_crtc.h> #include <drm/drm_colorop.h> #include <drm/drm_print.h> #include <drm/drm_drv.h>
@@ -780,3 +781,27 @@ void drm_colorop_set_next_property(struct drm_colorop *colorop, struct drm_color colorop->next = next; }EXPORT_SYMBOL (drm_colorop_set_next_property); + +int drm_colorop_modeset_lock (struct drm_colorop *colorop,struct drm_modeset_acquire_ctx *ctx) +{ +if (colorop->plane) +return drm_modeset_lock (&colorop->plane->mutex, ctx); + +if (colorop->crtc) +return drm_modeset_lock (&colorop->crtc->mutex, ctx); + +drm_err (colorop->dev,"Dangling colorop, it must be attached to a plane or a CRTC\n" ); +return -EINVAL ; +} +EXPORT_SYMBOL (drm_colorop_modeset_lock); + +void drm_colorop_modeset_unlock (struct drm_colorop *colorop) +{ +if (colorop->plane) +drm_modeset_unlock (&colorop->plane->mutex); +else if (colorop->crtc) +drm_modeset_unlock (&colorop->crtc->mutex); +else +drm_err (colorop->dev,"Dangling colorop, it must be attached to a plane or a CRTC\n" ); +} +EXPORT_SYMBOL (drm_colorop_modeset_unlock);
include/drm/drm_colorop.h +16 -2
@@ -29,6 +29,7 @@#include <drm/drm_mode_object.h> #include <drm/drm_mode.h> +#include <drm/drm_modeset_lock.h> #include <drm/drm_property.h> /* DRM colorop flags */
@@ -391,11 +392,21 @@ struct drm_colorop {/** * @plane: * -* The plane on which the colorop sits. A drm_colorop is always unique -* to a plane. +* The plane on which the colorop sits if it is a pre-blend colorop. +* In this case it is unique to the plane. +* NOTE: plane and crtc are mutually exclusive. */ struct drm_plane *plane; +/** +* @crtc: +* +* The CRTC on which the colorop sits if it is a post-blend colorop. +* In this case it is unique to the CRTC. +* NOTE: plane and crtc are mutually exclusive. +*/ +struct drm_crtc *crtc; +/** * @state: *
@@ -636,4 +647,7 @@ const char *drm_get_colorop_fixed_matrix_type_name(enum drm_colorop_fixed_matrixvoid drm_colorop_set_next_property (struct drm_colorop *colorop,struct drm_colorop *next); +int drm_colorop_modeset_lock (struct drm_colorop *colorop,struct drm_modeset_acquire_ctx *ctx); +void drm_colorop_modeset_unlock (struct drm_colorop *colorop); +#endif /* __DRM_COLOROP_H__ */
Signature · 1 line
2.53.0
RFC PATCH v2 3/20 drm: Factor out common color_pipeline property initialization code
In reply to Melissa WenFrom: Nícolas F. R. A. Prado <[email protected]>
In preparation for sharing the initialization code for the color pipeline property between pre-blend (plane) and post-blend (crtc) color pipelines, factor out the common initialization to a separate function.
--- drivers/gpu/drm/drm_plane.c | 34 ++++---------------------- drivers/gpu/drm/drm_property.c | 44 ++++++++++++++++++++++++++++++++++ include/drm/drm_property.h | 5 ++++ 3 files changed, 53 insertions(+), 30 deletions(-)
drivers/gpu/drm/drm_plane.c +4 -30
@@ -1839,41 +1839,15 @@ int drm_plane_create_color_pipeline_property(struct drm_plane *plane, const struct drm_prop_enum_list *pipelines, int num_pipelines) { -struct drm_prop_enum_list *all_pipelines;struct drm_property *prop; -int len =0 ; -int i; - all_pipelines =kzalloc_objs (*all_pipelines, num_pipelines +1 ); + prop =drm_property_create_color_pipeline (plane->dev, &plane->base, + pipelines, num_pipelines); +if (IS_ERR (prop)) +return PTR_ERR (prop); -if (!all_pipelines) { -drm_err (plane->dev,"failed to allocate color pipeline\n" ); -return -ENOMEM ; - } - -/* Create default Bypass color pipeline */ - all_pipelines[len].type =0 ; - all_pipelines[len].name ="Bypass" ; - len++; - -/* Add all other color pipelines */ -for (i =0 ; i < num_pipelines; i++, len++) { - all_pipelines[len].type = pipelines[i].type; - all_pipelines[len].name = pipelines[i].name; - } - - prop =drm_property_create_enum (plane->dev,DRM_MODE_PROP_ATOMIC , -"COLOR_PIPELINE" , - all_pipelines, len); -if (!prop) { -kfree (all_pipelines); -return -ENOMEM ; - } - -drm_object_attach_property (&plane->base, prop,0 ); plane->color_pipeline_property = prop; -kfree (all_pipelines);return 0 ; }EXPORT_SYMBOL (drm_plane_create_color_pipeline_property);
drivers/gpu/drm/drm_property.c +44 -0
47 lines not on this page · raw message
include/drm/drm_property.h +5 -0
@@ -297,6 +297,11 @@ bool drm_property_replace_blob(struct drm_property_blob **blob,struct drm_property_blob *drm_property_blob_get (struct drm_property_blob *blob);void drm_property_blob_put (struct drm_property_blob *blob); +struct drm_property * +drm_property_create_color_pipeline (struct drm_device *dev,struct drm_mode_object *obj, +const struct drm_prop_enum_list *pipelines, +int num_pipelines); +/** * drm_property_find - find property object * @dev: DRM device
Signature · 1 line
2.53.0
RFC PATCH v2 4/20 drm/crtc: Add COLOR_PIPELINE property
In reply to Melissa WenFrom: Nícolas F. R. A. Prado <[email protected]>
Add a COLOR_PIPELINE property to the CRTC to allow userspace to set a post-blend color pipeline analogously to how pre-blend color pipelines are set on planes.
--- drivers/gpu/drm/drm_atomic_uapi.c | 50 ++++++++++++++++++++++++++++--- drivers/gpu/drm/drm_crtc.c | 31 +++++++++++++++++++ include/drm/drm_atomic_uapi.h | 2 ++ include/drm/drm_crtc.h | 11 +++++++ 4 files changed, 90 insertions(+), 4 deletions(-)
drivers/gpu/drm/drm_atomic_uapi.c +46 -4
@@ -294,6 +294,34 @@ drm_atomic_set_colorop_for_plane(struct drm_plane_state *plane_state, }EXPORT_SYMBOL (drm_atomic_set_colorop_for_plane); +/** +* drm_atomic_set_colorop_for_crtc - set colorop for crtc +* @crtc_state: atomic state object for the crtc +* @colorop: colorop to use for the crtc +* +* Helper function to select the color pipeline on a crtc by setting +* it to the first drm_colorop element of the pipeline. +*/ +void +drm_atomic_set_colorop_for_crtc (struct drm_crtc_state *crtc_state, +struct drm_colorop *colorop) +{ +struct drm_crtc *crtc = crtc_state->crtc; + +if (colorop) +drm_dbg_atomic (crtc->dev, +"Set [COLOROP:%d] for [CRTC:%d:%s] state %p\n" , + colorop->base.id, crtc->base.id, crtc->name, + crtc_state); +else +drm_dbg_atomic (crtc->dev, +"Set [NOCOLOROP] for [CRTC:%d:%s] state %p\n" , + crtc->base.id, crtc->name, crtc_state); + + crtc_state->color_pipeline = colorop; +} +EXPORT_SYMBOL (drm_atomic_set_colorop_for_crtc); +/** * drm_atomic_set_crtc_for_connector - set CRTC for connector * @conn_state: atomic state object for the connector
@@ -402,8 +430,8 @@ static s32 __user *get_out_fence_for_connector(struct drm_atomic_commit *state, }static int drm_atomic_crtc_set_property (struct drm_crtc *crtc, -struct drm_crtc_state *state,struct drm_property *property, -uint64_t val) +struct drm_crtc_state *state,struct drm_file *file_priv, +struct drm_property *property,uint64_t val) {struct drm_device *dev = crtc->dev;struct drm_mode_config *config = &dev->mode_config;
@@ -412,7 +440,17 @@ static int drm_atomic_crtc_set_property(struct drm_crtc *crtc,if (property == config->prop_active) state->active = val; -else if (property == config->prop_mode_id) { +else if (property == crtc->color_pipeline_property) { +/* find DRM colorop object */ +struct drm_colorop *colorop =NULL ; + + colorop =drm_colorop_find (dev, file_priv, val); + +if (val && !colorop) +return -EACCES ; + +drm_atomic_set_colorop_for_crtc (state, colorop); + }else if (property == config->prop_mode_id) {struct drm_property_blob *mode =drm_property_lookup_blob (dev, val); ret =drm_atomic_set_mode_prop_for_crtc (state, mode);
@@ -519,6 +557,8 @@ drm_atomic_crtc_get_property(struct drm_crtc *crtc, *val = state->scaling_filter; else if (property == crtc->sharpness_strength_property) *val = state->sharpness_strength; + else if (property == crtc->color_pipeline_property) + *val = (state->color_pipeline) ? state->color_pipeline->base.id : 0; else if (crtc->funcs->atomic_get_property) return crtc->funcs->atomic_get_property(crtc, state, property, val); else {
@@ -1106,6 +1146,8 @@ int drm_atomic_get_property(struct drm_mode_object *obj,if (colorop->plane)WARN_ON (!drm_modeset_is_locked (&colorop->plane->mutex)); +else if (colorop->crtc) +WARN_ON (!drm_modeset_is_locked (&colorop->crtc->mutex)); ret =drm_atomic_colorop_get_property (colorop, colorop->state, property, val);break ;
@@ -1262,7 +1304,7 @@ int drm_atomic_set_property(struct drm_atomic_commit *state, } ret =drm_atomic_crtc_set_property (crtc, - crtc_state, prop, prop_value); + crtc_state, file_priv, prop, prop_value);break ; }case DRM_MODE_OBJECT_PLANE : {
drivers/gpu/drm/drm_crtc.c +31 -0
@@ -991,3 +991,34 @@ bool drm_crtc_in_clone_mode(struct drm_crtc_state *crtc_state)return hweight32 (crtc_state->encoder_mask) >1 ; }EXPORT_SYMBOL (drm_crtc_in_clone_mode); + +/** +* drm_crtc_create_color_pipeline_property - create a new color pipeline +* property +* +* @crtc: drm CRTC +* @pipelines: list of pipelines +* @num_pipelines: number of pipelines +* +* Create the COLOR_PIPELINE CRTC property to specify color pipelines on +* the CRTC. +* +* RETURNS: +* Zero for success or -errno +*/ +int drm_crtc_create_color_pipeline_property (struct drm_crtc *crtc, +const struct drm_prop_enum_list *pipelines, +int num_pipelines) +{ +struct drm_property *prop; + + prop =drm_property_create_color_pipeline (crtc->dev, &crtc->base, + pipelines, num_pipelines); +if (IS_ERR (prop)) +return PTR_ERR (prop); + + crtc->color_pipeline_property = prop; + +return 0 ; +} +EXPORT_SYMBOL (drm_crtc_create_color_pipeline_property);
include/drm/drm_atomic_uapi.h +2 -0
@@ -54,6 +54,8 @@ void drm_atomic_set_fb_for_plane(struct drm_plane_state *plane_state, struct drm_framebuffer *fb);bool drm_atomic_set_colorop_for_plane (struct drm_plane_state *plane_state,struct drm_colorop *colorop); +void drm_atomic_set_colorop_for_crtc (struct drm_crtc_state *crtc_state, +struct drm_colorop *colorop);int __must_check drm_atomic_set_crtc_for_connector (struct drm_connector_state *conn_state,struct drm_crtc *crtc);
include/drm/drm_crtc.h +11 -0
@@ -1141,6 +1141,14 @@ struct drm_crtc {*/ struct drm_property *sharpness_strength_property; +/** +* @color_pipeline_property: +* +* Optional "COLOR_PIPELINE" enum property for specifying +* a color pipeline to use on the CRTC. +*/ +struct drm_property *color_pipeline_property; +/** * @state: *
@@ -1376,6 +1384,9 @@ static inline struct drm_crtc *drm_crtc_find(struct drm_device *dev,int drm_crtc_create_scaling_filter_property (struct drm_crtc *crtc,unsigned int supported_filters); +int drm_crtc_create_color_pipeline_property (struct drm_crtc *crtc, +const struct drm_prop_enum_list *pipelines, +int num_pipelines);bool drm_crtc_in_clone_mode (struct drm_crtc_state *crtc_state);int drm_crtc_create_sharpness_strength_property (struct drm_crtc *crtc);#endif /* __DRM_CRTC_H__ */
Signature · 1 line
2.53.0
RFC PATCH v2 5/20 drm: Introduce DRM_CLIENT_CAP_CRTC_COLOR_PIPELINE
In reply to Melissa WenFrom: Nícolas F. R. A. Prado <[email protected]>
Introduce DRM_CLIENT_CAP_CRTC_COLOR_PIPELINE which a DRM client can set to enable the usage of CRTC (post-blend) color pipelines instead of the now deprecated CRTC color management properties: "GAMMA_LUT", "DEGAMMA_LUT" and "CTM".
--- drivers/gpu/drm/drm_atomic_uapi.c | 21 +++++++++++++++++++++ drivers/gpu/drm/drm_connector.c | 1 + drivers/gpu/drm/drm_crtc_internal.h | 1 + drivers/gpu/drm/drm_ioctl.c | 7 +++++++ drivers/gpu/drm/drm_mode_object.c | 9 +++++++++ include/drm/drm_file.h | 7 +++++++ include/uapi/drm/drm.h | 19 +++++++++++++++++++ 7 files changed, 65 insertions(+)
drivers/gpu/drm/drm_atomic_uapi.c +21 -0
@@ -441,6 +441,11 @@ static int drm_atomic_crtc_set_property(struct drm_crtc *crtc,if (property == config->prop_active) state->active = val;else if (property == crtc->color_pipeline_property) { +if (!file_priv->crtc_color_pipeline) { +drm_dbg_atomic (dev, +"Setting COLOR_PIPELINE CRTC property not permitted without DRM_CLIENT_CAP_CRTC_COLOR_PIPELINE client cap\n" ); +return -EINVAL ; + }/* find DRM colorop object */ struct drm_colorop *colorop =NULL ;
@@ -462,6 +467,11 @@ static int drm_atomic_crtc_set_property(struct drm_crtc *crtc,const size_t elem_size =sizeof (struct drm_color_lut );u64 lut_size; +if (file_priv->crtc_color_pipeline) { +drm_dbg_atomic (dev, +"Setting DEGAMMA_LUT CRTC property not permitted with DRM_CLIENT_CAP_CRTC_COLOR_PIPELINE client cap\n" ); +return -EINVAL ; + } ret =drm_object_immutable_property_get_value (&crtc->base, config->degamma_lut_size_property, &lut_size);
@@ -476,6 +486,11 @@ static int drm_atomic_crtc_set_property(struct drm_crtc *crtc, state->color_mgmt_changed |= replaced;return ret; }else if (property == config->ctm_property) { +if (file_priv->crtc_color_pipeline) { +drm_dbg_atomic (dev, +"Setting CTM CRTC property not permitted with DRM_CLIENT_CAP_CRTC_COLOR_PIPELINE client cap\n" ); +return -EINVAL ; + } ret = drm_property_replace_blob_from_id(dev, &state->ctm, val,
@@ -487,6 +502,12 @@ static int drm_atomic_crtc_set_property(struct drm_crtc *crtc,const size_t elem_size =sizeof (struct drm_color_lut );u64 lut_size; +if (file_priv->crtc_color_pipeline) { +drm_dbg_atomic (dev, +"Setting GAMMA_LUT CRTC property not permitted with DRM_CLIENT_CAP_CRTC_COLOR_PIPELINE client cap\n" ); +return -EINVAL ; + } + ret =drm_object_immutable_property_get_value (&crtc->base, config->gamma_lut_size_property, &lut_size);
drivers/gpu/drm/drm_connector.c +1 -0
@@ -3625,6 +3625,7 @@ int drm_mode_getconnector(struct drm_device *dev, void *data,*/ ret =drm_mode_object_get_properties (&connector->base, file_priv->atomic, file_priv->plane_color_pipeline, + file_priv->crtc_color_pipeline, (uint32_t __user *)(unsigned long )(out_resp->props_ptr), (uint64_t __user *)(unsigned long )(out_resp->prop_values_ptr), &out_resp->count_props);
drivers/gpu/drm/drm_crtc_internal.h +1 -0
@@ -164,6 +164,7 @@ void drm_mode_object_unregister(struct drm_device *dev, struct drm_mode_object *object);int drm_mode_object_get_properties (struct drm_mode_object *obj,bool atomic,bool plane_color_pipeline, +bool crtc_color_pipeline,uint32_t __user *prop_ptr,uint64_t __user *prop_values,uint32_t *arg_count_props);
drivers/gpu/drm/drm_ioctl.c +7 -0
@@ -380,6 +380,13 @@ drm_setclientcap(struct drm_device *dev, void *data, struct drm_file *file_priv)return -EINVAL ; file_priv->plane_color_pipeline = req->value;break ; +case DRM_CLIENT_CAP_CRTC_COLOR_PIPELINE : +if (!file_priv->atomic) +return -EINVAL ; +if (req->value >1 ) +return -EINVAL ; + file_priv->crtc_color_pipeline = req->value; +break ;default :return -EINVAL ; }
drivers/gpu/drm/drm_mode_object.c +9 -0
@@ -413,6 +413,7 @@ EXPORT_SYMBOL(drm_object_immutable_property_get_value);/* helper for getconnector and getproperties ioctls */ int drm_mode_object_get_properties (struct drm_mode_object *obj,bool atomic,bool plane_color_pipeline, +bool crtc_color_pipeline,uint32_t __user *prop_ptr,uint64_t __user *prop_values,uint32_t *arg_count_props)
@@ -441,6 +442,13 @@ int drm_mode_object_get_properties(struct drm_mode_object *obj, bool atomic,continue ; } +if (!crtc_color_pipeline && obj->type ==DRM_MODE_OBJECT_CRTC ) { +struct drm_crtc *crtc =obj_to_crtc (obj); + +if (prop == crtc->color_pipeline_property) +continue ; + } +if (*arg_count_props > count) { ret =__drm_object_property_get_value (obj, prop, &val);if (ret)
@@ -500,6 +508,7 @@ int drm_mode_obj_get_properties_ioctl(struct drm_device *dev, void *data, ret =drm_mode_object_get_properties (obj, file_priv->atomic, file_priv->plane_color_pipeline, + file_priv->crtc_color_pipeline, (uint32_t __user *)(unsigned long )(arg->props_ptr), (uint64_t __user *)(unsigned long )(arg->prop_values_ptr), &arg->count_props);
include/drm/drm_file.h +7 -0
@@ -214,6 +214,13 @@ struct drm_file {*/ bool plane_color_pipeline; +/** +* @crtc_color_pipeline: +* +* True if client understands CRTC (post-blend) color pipelines +*/ +bool crtc_color_pipeline; +/** * @was_master: *
include/uapi/drm/drm.h +19 -0
@@ -903,6 +903,25 @@ struct drm_get_cap {*/ #define DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE 7 +/** +* DRM_CLIENT_CAP_CRTC_COLOR_PIPELINE +* +* If set to 1 the DRM core will allow setting the COLOR_PIPELINE +* property on a &drm_crtc, as well as drm_colorop properties. +* +* Setting of these crtc properties will be rejected when this client +* cap is set: +* - GAMMA_LUT +* - DEGAMMA_LUT +* - CTM +* +* The client must enable &DRM_CLIENT_CAP_ATOMIC first. +* +* This client cap can only be set if the driver sets the corresponding driver +* cap &DRM_CAP_CRTC_COLOR_PIPELINE. +*/ +#define DRM_CLIENT_CAP_CRTC_COLOR_PIPELINE 8 +/* DRM_IOCTL_SET_CLIENT_CAP ioctl argument type */ struct drm_set_client_cap {__u64 capability;
Signature · 1 line
2.53.0
RFC PATCH v2 6/20 drm/atomic: Pass crtc_color_pipeline client cap to atomic check
In reply to Melissa WenFrom: Nícolas F. R. A. Prado <[email protected]>
Pass the state of the CRTC (post-blend) color pipeline client cap to the atomic state so that drivers can rely on it to enable color pipeline functionality and ignore the deprecated color management CRTC properties.
--- drivers/gpu/drm/drm_atomic_uapi.c | 1 + include/drm/drm_atomic.h | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+)
drivers/gpu/drm/drm_atomic_uapi.c +1 -0
@@ -1738,6 +1738,7 @@ int drm_mode_atomic_ioctl(struct drm_device *dev, state->acquire_ctx = &ctx; state->allow_modeset = !!(arg->flags &DRM_MODE_ATOMIC_ALLOW_MODESET ); state->plane_color_pipeline = file_priv->plane_color_pipeline; + state->crtc_color_pipeline = file_priv->crtc_color_pipeline; retry: copied_objs =0 ;
include/drm/drm_atomic.h +20 -0
@@ -575,6 +575,26 @@ struct drm_atomic_commit {*/ bool plane_color_pipeline : 1; +/** +* @crtc_color_pipeline: +* +* Indicates whether this atomic state originated with a client that +* set the DRM_CLIENT_CAP_CRTC_COLOR_PIPELINE. +* +* Drivers and helper functions should use this to ignore legacy +* properties that are incompatible with the drm_crtc COLOR_PIPELINE +* behavior, such as: +* +* - GAMMA_LUT +* - DEGAMMA_LUT +* - GAMMA_LUT_SIZE +* - CTM +* +* or any other driver-specific properties that might affect pixel +* values. +*/ + bool crtc_color_pipeline : 1; +/** * @colorops: *
Signature · 1 line
2.53.0
RFC PATCH v2 7/20 drm/atomic: Print the color pipeline as part of the CRTC state print
In reply to Melissa WenFrom: Nícolas F. R. A. Prado <[email protected]>
Print the value of the color pipeline in the CRTC state as part of the CRTC state print.
--- drivers/gpu/drm/drm_atomic.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/drm_atomic.c +2 -0
@@ -554,6 +554,8 @@ static void drm_atomic_crtc_print_state(struct drm_printer *p,drm_printf_indent (p,1 ,"plane_mask=%x\n" , state->plane_mask);drm_printf_indent (p,1 ,"connector_mask=%x\n" , state->connector_mask);drm_printf_indent (p,1 ,"encoder_mask=%x\n" , state->encoder_mask); +drm_printf_indent (p,1 ,"color-pipeline=%d\n" , + state->color_pipeline ? state->color_pipeline->base.id :0 );drm_printf_indent (p,1 ,"mode: " DRM_MODE_FMT "\n" ,DRM_MODE_ARG (&state->mode));drm_printf_indent (p,1 ,"background_color=%llx\n" , state->background_color);
Signature · 1 line
2.53.0
RFC PATCH v2 8/20 drm/colorop: Factor out common paths from colorops helpers
In reply to Melissa WenFrom: Nícolas F. R. A. Prado <[email protected]>
Factor out the common code paths from the colorop helpers so they can be reused by the post-blend colorop helpers.
--- drivers/gpu/drm/drm_colorop.c | 180 +++++++++++++++++++++------------- 1 file changed, 114 insertions(+), 66 deletions(-)
drivers/gpu/drm/drm_colorop.c +114 -66
@@ -109,10 +109,11 @@ static const char * const colorop_fixed_matrix_type_names[] = {/* Init Helpers */ -static int drm_plane_colorop_init (struct drm_device *dev,struct drm_colorop *colorop, -struct drm_plane *plane,const struct drm_colorop_funcs *funcs, -enum drm_colorop_type type, -uint32_t flags) +static int drm_common_colorop_init (struct drm_device *dev, +struct drm_colorop *colorop, +const struct drm_colorop_funcs *funcs, +enum drm_colorop_type type, +uint32_t flags) {struct drm_mode_config *config = &dev->mode_config;struct drm_property *prop;
@@ -125,7 +126,6 @@ static int drm_plane_colorop_init(struct drm_device *dev, struct drm_colorop *co colorop->base.properties = &colorop->properties; colorop->dev = dev; colorop->type = type; - colorop->plane = plane; colorop->next =NULL ; colorop->funcs = funcs;
@@ -175,6 +175,22 @@ static int drm_plane_colorop_init(struct drm_device *dev, struct drm_colorop *coreturn ret; } +static int drm_plane_colorop_init (struct drm_device *dev, +struct drm_colorop *colorop, +struct drm_plane *plane, +const struct drm_colorop_funcs *funcs, +enum drm_colorop_type type, +uint32_t flags) +{ +int ret; + + ret =drm_common_colorop_init (dev, colorop, funcs, type, flags); + + colorop->plane = plane; + +return ret; +} +/** * drm_colorop_cleanup - Cleanup a drm_colorop object in color_pipeline *
@@ -226,45 +242,14 @@ void drm_colorop_pipeline_destroy(struct drm_device *dev) }EXPORT_SYMBOL (drm_colorop_pipeline_destroy); -/** -* drm_plane_colorop_curve_1d_init - Initialize a DRM_COLOROP_1D_CURVE -* -* @dev: DRM device -* @colorop: The drm_colorop object to initialize -* @plane: The associated drm_plane -* @funcs: control functions for the new colorop -* @supported_tfs: A bitfield of supported drm_plane_colorop_curve_1d_init enum values, -* created using BIT(curve_type) and combined with the OR '|' -* operator. -* @flags: bitmask of misc, see DRM_COLOROP_FLAG_* defines. -* @return zero on success, -E value on failure -*/ -int drm_plane_colorop_curve_1d_init (struct drm_device *dev,struct drm_colorop *colorop, -struct drm_plane *plane,const struct drm_colorop_funcs *funcs, -u64 supported_tfs,uint32_t flags) +static int drm_common_colorop_curve_1d_init (struct drm_device *dev, +struct drm_colorop *colorop, +u64 supported_tfs,uint32_t flags) {struct drm_prop_enum_list enum_list[DRM_COLOROP_1D_CURVE_COUNT ];int i, len;struct drm_property *prop; -int ret; - -if (!supported_tfs) { -drm_err (dev, -"No supported TFs for new 1D curve colorop on [PLANE:%d:%s]\n" , - plane->base.id, plane->name); -return -EINVAL ; - } - -if ((supported_tfs & -BIT (DRM_COLOROP_1D_CURVE_COUNT )) !=0 ) { -drm_err (dev,"Unknown TF provided on [PLANE:%d:%s]\n" , - plane->base.id, plane->name); -return -EINVAL ; - } - - ret =drm_plane_colorop_init (dev, colorop, plane, funcs,DRM_COLOROP_1D_CURVE , flags); -if (ret) -return ret; len =0 ;for (i =0 ; i <DRM_COLOROP_1D_CURVE_COUNT ; i++) {
@@ -293,6 +278,45 @@ int drm_plane_colorop_curve_1d_init(struct drm_device *dev, struct drm_colorop *return 0 ; } + +static int drm_colorop_has_supported_tf (struct drm_device *dev,struct drm_mode_object *obj, +const char *name,u64 supported_tfs) +{ +if (!supported_tfs) { +drm_err (dev, +"No supported TFs for new 1D curve colorop on [PLANE:%d:%s]\n" , + obj->id, name); +return -EINVAL ; + } + +if ((supported_tfs & -BIT (DRM_COLOROP_1D_CURVE_COUNT )) !=0 ) { +drm_err (dev,"Unknown TF provided on [PLANE:%d:%s]\n" , + obj->id, name); +return -EINVAL ; + } + +return 0 ; +} + +int drm_plane_colorop_curve_1d_init (struct drm_device *dev, +struct drm_colorop *colorop, +struct drm_plane *plane, +const struct drm_colorop_funcs *funcs, +u64 supported_tfs, +uint32_t flags) +{ +int ret; + + ret =drm_colorop_has_supported_tf (dev, &plane->base, plane->name, supported_tfs); +if (ret) +return ret; + + ret =drm_plane_colorop_init (dev, colorop, plane, funcs,DRM_COLOROP_1D_CURVE , flags); +if (ret) +return ret; + +return drm_common_colorop_curve_1d_init (dev, colorop, supported_tfs, flags); +}EXPORT_SYMBOL (drm_plane_colorop_curve_1d_init);static int drm_colorop_create_data_prop (struct drm_device *dev,struct drm_colorop *colorop)
@@ -313,32 +337,15 @@ static int drm_colorop_create_data_prop(struct drm_device *dev, struct drm_colorreturn 0 ; } -/** -* drm_plane_colorop_curve_1d_lut_init - Initialize a DRM_COLOROP_1D_LUT -* -* @dev: DRM device -* @colorop: The drm_colorop object to initialize -* @plane: The associated drm_plane -* @funcs: control functions for new colorop -* @lut_size: LUT size supported by driver -* @interpolation: 1D LUT interpolation type -* @flags: bitmask of misc, see DRM_COLOROP_FLAG_* defines. -* @return zero on success, -E value on failure -*/ -int drm_plane_colorop_curve_1d_lut_init (struct drm_device *dev,struct drm_colorop *colorop, -struct drm_plane *plane, -const struct drm_colorop_funcs *funcs, -uint32_t lut_size, -enum drm_colorop_lut1d_interpolation_type interpolation, -uint32_t flags) +static int drm_common_colorop_curve_1d_lut_init (struct drm_device *dev, +struct drm_colorop *colorop, +uint32_t lut_size, +enum drm_colorop_lut1d_interpolation_type interpolation, +uint32_t flags) {struct drm_property *prop;int ret; - ret =drm_plane_colorop_init (dev, colorop, plane, funcs,DRM_COLOROP_1D_LUT , flags); -if (ret) -return ret; -/* initialize 1D LUT only attribute */ /* LUT size */ prop = drm_property_create_range(dev, DRM_MODE_PROP_IMMUTABLE | DRM_MODE_PROP_ATOMIC,
@@ -369,18 +376,44 @@ int drm_plane_colorop_curve_1d_lut_init(struct drm_device *dev, struct drm_colorreturn 0 ; } -EXPORT_SYMBOL (drm_plane_colorop_curve_1d_lut_init); -int drm_plane_colorop_ctm_3x4_init (struct drm_device *dev,struct drm_colorop *colorop, -struct drm_plane *plane,const struct drm_colorop_funcs *funcs, -uint32_t flags) +/** +* drm_plane_colorop_curve_1d_lut_init - Initialize a DRM_COLOROP_1D_LUT +* +* @dev: DRM device +* @colorop: The drm_colorop object to initialize +* @plane: The associated drm_plane +* @lut_size: LUT size supported by driver +* @lut1d_interpolation: 1D LUT interpolation type +* @flags: bitmask of misc, see DRM_COLOROP_FLAG_* defines. +* @return zero on success, -E value on failure +*/ +int +drm_plane_colorop_curve_1d_lut_init (struct drm_device *dev, +struct drm_colorop *colorop, +struct drm_plane *plane, +const struct drm_colorop_funcs *funcs, +uint32_t lut_size, +enum drm_colorop_lut1d_interpolation_type lut1d_interpolation, +uint32_t flags) {int ret; - ret =drm_plane_colorop_init (dev, colorop, plane, funcs,DRM_COLOROP_CTM_3X4 , flags); + ret =drm_plane_colorop_init (dev, colorop, plane, funcs,DRM_COLOROP_1D_LUT , flags);if (ret)return ret; +return drm_common_colorop_curve_1d_lut_init (dev, colorop, lut_size, + lut1d_interpolation, flags); +} +EXPORT_SYMBOL (drm_plane_colorop_curve_1d_lut_init); + +static int drm_common_colorop_ctm_3x4_init (struct drm_device *dev, +struct drm_colorop *colorop, +uint32_t flags) +{ +int ret; + ret =drm_colorop_create_data_prop (dev, colorop);if (ret)return ret;
@@ -389,6 +422,21 @@ int drm_plane_colorop_ctm_3x4_init(struct drm_device *dev, struct drm_colorop *creturn 0 ; } + +int drm_plane_colorop_ctm_3x4_init (struct drm_device *dev, +struct drm_colorop *colorop, +struct drm_plane *plane, +const struct drm_colorop_funcs *funcs, +uint32_t flags) +{ +int ret; + + ret =drm_plane_colorop_init (dev, colorop, plane, funcs,DRM_COLOROP_CTM_3X4 , flags); +if (ret) +return ret; + +return drm_common_colorop_ctm_3x4_init (dev, colorop, flags); +}EXPORT_SYMBOL (drm_plane_colorop_ctm_3x4_init);/**
Signature · 1 line
2.53.0
RFC PATCH v2 9/20 drm/colorop: Introduce colorop helpers for crtc
In reply to Melissa WenFrom: Nícolas F. R. A. Prado <[email protected]>
Introduce colorop helper counterparts for post-blend color pipelines that take a CRTC instead of a plane.
--- drivers/gpu/drm/drm_colorop.c | 81 +++++++++++++++++++++++++++++++++++ include/drm/drm_colorop.h | 14 ++++++ 2 files changed, 95 insertions(+)
drivers/gpu/drm/drm_colorop.c +81 -0
@@ -191,6 +191,21 @@ static int drm_plane_colorop_init(struct drm_device *dev,return ret; } +static int drm_crtc_colorop_init (struct drm_device *dev, +struct drm_colorop *colorop, +struct drm_crtc *crtc, +const struct drm_colorop_funcs *funcs, +enum drm_colorop_type type,uint32_t flags) +{ +int ret; + + ret =drm_common_colorop_init (dev, colorop, funcs, type, flags); + + colorop->crtc = crtc; + +return ret; +} +/** * drm_colorop_cleanup - Cleanup a drm_colorop object in color_pipeline *
@@ -319,6 +334,26 @@ int drm_plane_colorop_curve_1d_init(struct drm_device *dev, }EXPORT_SYMBOL (drm_plane_colorop_curve_1d_init); +int drm_crtc_colorop_curve_1d_init (struct drm_device *dev, +struct drm_colorop *colorop, +struct drm_crtc *crtc, +const struct drm_colorop_funcs *funcs, +u64 supported_tfs,uint32_t flags) +{ +int ret; + + ret =drm_colorop_has_supported_tf (dev, &crtc->base, crtc->name, supported_tfs); +if (ret) +return ret; + + ret =drm_crtc_colorop_init (dev, colorop, crtc, funcs,DRM_COLOROP_1D_CURVE , flags); +if (ret) +return ret; + +return drm_common_colorop_curve_1d_init (dev, colorop, supported_tfs, flags); +} +EXPORT_SYMBOL (drm_crtc_colorop_curve_1d_init); +static int drm_colorop_create_data_prop (struct drm_device *dev,struct drm_colorop *colorop) {struct drm_property *prop;
@@ -408,6 +443,37 @@ drm_plane_colorop_curve_1d_lut_init(struct drm_device *dev, }EXPORT_SYMBOL (drm_plane_colorop_curve_1d_lut_init); +/** +* drm_crtc_colorop_curve_1d_lut_init - Initialize a DRM_COLOROP_1D_LUT +* +* @dev: DRM device +* @colorop: The drm_colorop object to initialize +* @crtc: The associated drm_crtc +* @lut_size: LUT size supported by driver +* @interpolation: 1D LUT interpolation type +* @flags: bitmask of misc, see DRM_COLOROP_FLAG_* defines. +* @return zero on success, -E value on failure +*/ +int +drm_crtc_colorop_curve_1d_lut_init (struct drm_device *dev, +struct drm_colorop *colorop, +struct drm_crtc *crtc, +const struct drm_colorop_funcs *funcs, +uint32_t lut_size, +enum drm_colorop_lut1d_interpolation_type interpolation, +uint32_t flags) +{ +int ret; + + ret =drm_crtc_colorop_init (dev, colorop, crtc, funcs,DRM_COLOROP_1D_LUT , flags); +if (ret) +return ret; + +return drm_common_colorop_curve_1d_lut_init (dev, colorop, lut_size, + interpolation, flags); +} +EXPORT_SYMBOL (drm_crtc_colorop_curve_1d_lut_init); +static int drm_common_colorop_ctm_3x4_init (struct drm_device *dev,struct drm_colorop *colorop,uint32_t flags)
@@ -439,6 +505,21 @@ int drm_plane_colorop_ctm_3x4_init(struct drm_device *dev, }EXPORT_SYMBOL (drm_plane_colorop_ctm_3x4_init); +int drm_crtc_colorop_ctm_3x4_init (struct drm_device *dev,struct drm_colorop *colorop, +struct drm_crtc *crtc, +const struct drm_colorop_funcs *funcs, +uint32_t flags) +{ +int ret; + + ret =drm_crtc_colorop_init (dev, colorop, crtc, funcs,DRM_COLOROP_CTM_3X4 , flags); +if (ret) +return ret; + +return drm_common_colorop_ctm_3x4_init (dev, colorop, flags); +} +EXPORT_SYMBOL (drm_crtc_colorop_ctm_3x4_init); +/** * drm_plane_colorop_mult_init - Initialize a DRM_COLOROP_MULTIPLIER *
include/drm/drm_colorop.h +14 -0
@@ -561,6 +561,13 @@ static inline struct drm_colorop *drm_colorop_find(struct drm_device *dev,void drm_colorop_pipeline_destroy (struct drm_device *dev);void drm_colorop_cleanup (struct drm_colorop *colorop); +int drm_crtc_colorop_curve_1d_lut_init (struct drm_device *dev,struct drm_colorop *colorop, +struct drm_crtc *crtc, +const struct drm_colorop_funcs *funcs, +uint32_t lut_size, +enum drm_colorop_lut1d_interpolation_type interpolation, +uint32_t flags); +int drm_plane_colorop_curve_1d_init (struct drm_device *dev,struct drm_colorop *colorop,struct drm_plane *plane,const struct drm_colorop_funcs *funcs,u64 supported_tfs,uint32_t flags);
@@ -570,9 +577,16 @@ int drm_plane_colorop_curve_1d_lut_init(struct drm_device *dev, struct drm_coloruint32_t lut_size, enum drm_colorop_lut1d_interpolation_type interpolation, uint32_t flags); +int drm_crtc_colorop_curve_1d_init (struct drm_device *dev,struct drm_colorop *colorop, +struct drm_crtc *crtc, +const struct drm_colorop_funcs *funcs, +u64 supported_tfs,uint32_t flags); +int drm_plane_colorop_ctm_3x4_init (struct drm_device *dev,struct drm_colorop *colorop,struct drm_plane *plane,const struct drm_colorop_funcs *funcs,uint32_t flags); +int drm_crtc_colorop_ctm_3x4_init (struct drm_device *dev,struct drm_colorop *colorop, +struct drm_crtc *crtc,const struct drm_colorop_funcs *funcs,uint32_t flags);int drm_plane_colorop_mult_init (struct drm_device *dev,struct drm_colorop *colorop,struct drm_plane *plane,const struct drm_colorop_funcs *funcs,uint32_t flags);
Signature · 1 line
2.53.0
RFC PATCH v2 10/20 drm/colorop: distinguish whether a colorop belongs to a plane or a CRTC
In reply to Melissa WenTo correctly track states and color management changes.
--- drivers/gpu/drm/drm_atomic_uapi.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-)
drivers/gpu/drm/drm_atomic_uapi.c +19 -6
@@ -1374,7 +1374,6 @@ int drm_atomic_set_property(struct drm_atomic_commit *state,break ; }case DRM_MODE_OBJECT_COLOROP : { -struct drm_plane_state *plane_state;struct drm_colorop *colorop =obj_to_colorop (obj);struct drm_colorop_state *colorop_state;bool replaced = false;
@@ -1391,12 +1390,26 @@ int drm_atomic_set_property(struct drm_atomic_commit *state,if (ret || !replaced)break ; - plane_state =drm_atomic_get_plane_state (state, colorop->plane); -if (IS_ERR (plane_state)) { - ret =PTR_ERR (plane_state); -break ; +if (colorop->plane) { +struct drm_plane_state *plane_state; + + plane_state =drm_atomic_get_plane_state (state, colorop->plane); +if (IS_ERR (plane_state)) { + ret =PTR_ERR (plane_state); +break ; + } + plane_state->color_mgmt_changed |= replaced; + }else if (colorop->crtc) { +struct drm_crtc_state *crtc_state; + + crtc_state =drm_atomic_get_crtc_state (state, colorop->crtc); +if (IS_ERR (crtc_state)) { + ret =PTR_ERR (crtc_state); +break ; + } + crtc_state->color_mgmt_changed |= replaced; + } - plane_state->color_mgmt_changed |= replaced;break ; }
Signature · 1 line
2.53.0
RFC PATCH v2 11/20 drm/crtc: Track crtc color pipeline client cap in drm_crtc_state
In reply to Melissa WenFrom: Nícolas F. R. A. Prado <[email protected]>
Some drivers, like VKMS, only have access to the drm_crtc_state but not the drm_atomic_state during composition of the output framebuffer. Store the state of the CRTC (post-blend) color pipeline client cap in the drm_crtc_state so those drivers can decide whether to look at the color pipeline or the legacy properties for the color management settings to apply.
--- drivers/gpu/drm/drm_atomic.c | 1 + include/drm/drm_crtc.h | 8 ++++++++ 2 files changed, 9 insertions(+)
drivers/gpu/drm/drm_atomic.c +1 -0
@@ -468,6 +468,7 @@ drm_atomic_get_crtc_state(struct drm_atomic_commit *state, state->crtcs[index].new_state = crtc_state; state->crtcs[index].ptr = crtc; crtc_state->state = state; + crtc_state->color_pipeline_enabled = state->crtc_color_pipeline;drm_dbg_atomic (state->dev,"Added [CRTC:%d:%s] %p state to %p\n" , crtc->base.id, crtc->name, crtc_state, state);
include/drm/drm_crtc.h +8 -0
@@ -282,6 +282,14 @@ struct drm_crtc_state {*/ struct drm_colorop *color_pipeline; +/** +* @color_pipeline_enabled: +* +* Whether color management should be done based on the &color_pipeline +* or the legacy color properties (&ctm, &gamma_lut and °amma_lut). +*/ +bool color_pipeline_enabled; +/** * @background_color: *
Signature · 1 line
2.53.0
RFC PATCH v2 12/20 drm: Add helper to extract a 3x4 matrix from any CTM matrix dimensions
In reply to Melissa WenFrom: Ariel D'Alessandro <[email protected]>
Add a common helper to ease the conversion from both 3x3 or 3x4 matrices to a CTM 3x4 matrix. This is handy for code that needs to handle both dimensions.
--- include/drm/drm_color_mgmt.h | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+)
include/drm/drm_color_mgmt.h +34 -0
@@ -66,6 +66,40 @@ static inline u32 drm_color_lut32_extract(u32 user_input, int bit_precision) (1ULL << 32) - 1); } +/** +* drm_color_ctm_to_ctm_3x4 - Copy CTM matrix contents to 3x4 dimensions matrix +* +* @dest: The destination CTM 3x4 dimensions matrix +* @src: The source CTM matrix (3x3 or 3x4 dimensions depending on @ctm_3x4) +* @ctm_3x4: Boolean indicating the source CTM matrix dimensions +* +* Copy the contents of a CTM matrix from @src, to a CTM 3x4 dimensions matrix. +* The source matrix can be 3x3 or 3x4 dimensions depending on the @ctm_3x4 +* boolean argument. +*/ +static inline void drm_color_ctm_to_ctm_3x4 (struct drm_color_ctm_3x4 *dest, +void *src,bool ctm_3x4) +{ +if (ctm_3x4) { + *dest = *(struct drm_color_ctm_3x4 *)src; + }else { +struct drm_color_ctm *ctm = (struct drm_color_ctm *)src; + + dest->matrix[0 ] = ctm->matrix[0 ]; + dest->matrix[1 ] = ctm->matrix[1 ]; + dest->matrix[2 ] = ctm->matrix[2 ]; + dest->matrix[3 ] =0 ; + dest->matrix[4 ] = ctm->matrix[3 ]; + dest->matrix[5 ] = ctm->matrix[4 ]; + dest->matrix[6 ] = ctm->matrix[5 ]; + dest->matrix[7 ] =0 ; + dest->matrix[8 ] = ctm->matrix[6 ]; + dest->matrix[9 ] = ctm->matrix[7 ]; + dest->matrix[10 ] = ctm->matrix[8 ]; + dest->matrix[11 ] =0 ; + } +} +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,
Signature · 1 line
2.53.0
RFC PATCH v2 13/20 drm: Add helper to extract a LUT entry from either 16-bit or 32-bit LUT
In reply to Melissa WenFrom: Ariel D'Alessandro <[email protected]>
Add a common helper to ease extracting a 32-bit LUT entry from either 16-bit or 32-bit LUT entry. This is handy for code that needs to handle both bit widths.
--- include/drm/drm_color_mgmt.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)
include/drm/drm_color_mgmt.h +27 -0
@@ -66,6 +66,33 @@ static inline u32 drm_color_lut32_extract(u32 user_input, int bit_precision) (1ULL << 32) - 1); } +/** +* drm_color_lut_to_lut32 - Copy LUT entry contents to 32-bit channel color LUT +* +* @dest: The destination 32-bit per channel color LUT entry +* @src: The source array of LUT entries (16-bit or 32-bit depending on @bits32) +* @index: LUT entry array index +* @bits32: Boolean indicating the source LUT entry bit-witdh +* +* Copy the contents of a LUT entry from the source array, to a 32-bit channel +* color LUT. The source array of LUT entries can be 16-bit or 32-bit width +* depending on the @bits32 boolean argument. +*/ +static inline void drm_color_lut_to_lut32 (struct drm_color_lut32 *dest, +void *src,int index,bool bits32) +{ +if (bits32) { + *dest = ((struct drm_color_lut32 *)src)[index]; + }else { +struct drm_color_lut *lut = + &((struct drm_color_lut *)src)[index]; + dest->red = lut->red; + dest->green = lut->green; + dest->blue = lut->blue; + dest->reserved = lut->reserved; + } +} +/** * drm_color_ctm_to_ctm_3x4 - Copy CTM matrix contents to 3x4 dimensions matrix *
Signature · 1 line
2.53.0
RFC PATCH v2 14/20 drm/drm_mode_object: hide deprecated CRTC color mgmt props if colorop is set
In reply to Melissa WenStop advertise CRTC color mgmt properties if post-blend colorop is enabled. Follow the same approach done for plane COLOR_ENCODING and COLOR_RANGE when pre-blend colorop is enabled.
--- drivers/gpu/drm/drm_mode_object.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_mode_object.c +11 -2
@@ -442,10 +442,19 @@ int drm_mode_object_get_properties(struct drm_mode_object *obj, bool atomic,continue ; } -if (!crtc_color_pipeline && obj->type ==DRM_MODE_OBJECT_CRTC ) { +if (obj->type ==DRM_MODE_OBJECT_CRTC ) {struct drm_crtc *crtc =obj_to_crtc (obj); +struct drm_mode_config *config = &crtc->dev->mode_config; -if (prop == crtc->color_pipeline_property) +if (!crtc_color_pipeline && prop == crtc->color_pipeline_property) +continue ; + +if (crtc_color_pipeline && + (prop == config->degamma_lut_property || + prop == config->degamma_lut_size_property || + prop == config->ctm_property || + prop == config->gamma_lut_property || + prop == config->gamma_lut_size_property))continue ; }
Signature · 1 line
2.53.0
RFC PATCH v2 15/20 drm/drm_ioctl: guard DRM_CLIENT_CAP_CRTC_COLOR_PIPELINE
In reply to Melissa WenIf the driver doesn't support post-blend colorop, refuse attempts from usersapce to set it. Same approach is taken for pre-blend colorop.
--- drivers/gpu/drm/drm_ioctl.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_ioctl.c +14 -1
@@ -380,13 +380,26 @@ drm_setclientcap(struct drm_device *dev, void *data, struct drm_file *file_priv)return -EINVAL ; file_priv->plane_color_pipeline = req->value;break ; -case DRM_CLIENT_CAP_CRTC_COLOR_PIPELINE : +case DRM_CLIENT_CAP_CRTC_COLOR_PIPELINE : { +struct drm_crtc *crtc; +bool has_crtc_with_color_pipeline = false; +if (!file_priv->atomic)return -EINVAL ;if (req->value >1 )return -EINVAL ; +drm_for_each_crtc (crtc, dev) { +if (crtc->color_pipeline_property) { + has_crtc_with_color_pipeline = true; +break ; + } + } +if (req->value ==1 && !has_crtc_with_color_pipeline) +return -EOPNOTSUPP ; + file_priv->crtc_color_pipeline = req->value;break ; + }default :return -EINVAL ; }
Signature · 1 line
2.53.0
RFC PATCH v2 16/20 drm/amd/display: add support to post-blend CTM colorop
In reply to Melissa WenInitialize the AMD post-blend color pipeline with CTM as the first color operation in the AMD post-blend color pipeline. AMD post-blend color pipeline for DCN3 is described in DCN 3.0 family color caps and mapping of the kernel doc.
--- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h | 3 + .../amd/display/amdgpu_dm/amdgpu_dm_color.c | 81 +++++++++++++++++++ .../amd/display/amdgpu_dm/amdgpu_dm_colorop.c | 38 +++++++++ .../amd/display/amdgpu_dm/amdgpu_dm_colorop.h | 2 + .../amd/display/amdgpu_dm/amdgpu_dm_crtc.c | 38 +++++++++ 5 files changed, 162 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +3 -0
@@ -1100,6 +1100,9 @@ int amdgpu_dm_verify_lut_sizes(const struct drm_crtc_state *crtc_state);int amdgpu_dm_update_crtc_color_mgmt (struct dm_crtc_state *crtc);int amdgpu_dm_check_crtc_color_mgmt (struct dm_crtc_state *crtc,bool check_only); +int amdgpu_dm_crtc_set_colorop_properties (struct drm_crtc_state *crtc_state, +struct dc_stream_state *dc_stream_state, +bool check_only);int amdgpu_dm_update_plane_color_mgmt (struct dm_crtc_state *crtc,struct drm_plane_state *plane_state,struct dc_plane_state *dc_plane_state);
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c +81 -0
87 lines not on this page · raw message
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_colorop.c +38 -0
@@ -252,3 +252,41 @@ int amdgpu_dm_initialize_default_pipeline(struct drm_plane *plane, struct drm_prreturn ret; } + +int amdgpu_dm_initialize_crtc_default_pipeline (struct drm_crtc *crtc, +struct drm_prop_enum_list *list) +{ +struct drm_colorop *ops[MAX_COLOR_PIPELINE_OPS ]; +struct drm_device *dev = crtc->dev; +int ret; +int i =0 ; + +memset (ops,0 ,sizeof (ops)); + +/* 3x4 matrix */ + ops[i] = kzalloc_obj(struct drm_colorop); +if (!ops[i]) { + ret = -ENOMEM ; + goto cleanup; + } + + ret =drm_crtc_colorop_ctm_3x4_init (dev, ops[i], crtc,NULL , +DRM_COLOROP_FLAG_ALLOW_BYPASS ); +if (ret) + goto cleanup; + + list->type = ops[i]->base.id; + + i++; + + list->name =kasprintf (GFP_KERNEL ,"Color Pipeline %d" , ops[0 ]->base.id); + +return 0 ; +cleanup: +if (ret == -ENOMEM ) +drm_err (crtc->dev,"KMS: Failed to allocate colorop\n" ); + +drm_colorop_pipeline_destroy (dev); + +return ret; +}
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_colorop.h +2 -0
@@ -34,4 +34,6 @@ extern const u64 amdgpu_dm_supported_fm;int amdgpu_dm_initialize_default_pipeline (struct drm_plane *plane,struct drm_prop_enum_list *list); +int amdgpu_dm_initialize_crtc_default_pipeline (struct drm_crtc *crtc,struct drm_prop_enum_list *list); +#endif /* __AMDGPU_DM_COLOROP_H__*/
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c +38 -0
@@ -32,6 +32,7 @@#include "amdgpu_dm_replay.h" #include "amdgpu_dm_crtc.h" #include "amdgpu_dm_plane.h" +#include "amdgpu_dm_colorop.h" #include "amdgpu_dm_trace.h" #include "amdgpu_dm_debugfs.h" #include "modules/inc/mod_power.h"
@@ -518,6 +519,43 @@ amdgpu_dm_atomic_crtc_get_property(struct drm_crtc *crtc,return 0 ; } +#else + +#define MAX_CRTC_COLOR_PIPELINES 5 + +static int +dm_crtc_init_colorops (struct drm_crtc *crtc) +{ +struct drm_prop_enum_list pipelines[MAX_CRTC_COLOR_PIPELINES ] = {}; +struct drm_device *dev = crtc->dev; +struct amdgpu_device *adev =drm_to_adev (dev); +struct dc *dc = adev->dm.dc; +int len =0 ; +int ret =0 ; +int i; + +/* initialize pipeline */ +if (dc->ctx->dce_version >=DCN_VERSION_3_0 ) { + ret =amdgpu_dm_initialize_crtc_default_pipeline (crtc, &pipelines[len]); +if (ret) { +drm_err (dev,"Failed to create color pipeline for CRTC %d: %d\n" , + crtc->base.id, ret); + goto out; + } + len++; + +/* Create COLOR_PIPELINE property and attach */ + ret =drm_crtc_create_color_pipeline_property (crtc, pipelines, len); + } + +out: +for (i =0 ; i < len; i++) +kfree (pipelines[i].name); + +return ret; +} + +#endif /* Implemented only the options currently available for the driver */
Signature · 1 line
2.53.0
RFC PATCH v2 17/20 drm/amd/display: add support to post-blend 1D-Curve colorop
In reply to Melissa WenAdd Regamma TF operation as 1D Curve colorop to the AMD post-blend color pipeline.
--- .../amd/display/amdgpu_dm/amdgpu_dm_color.c | 62 +++++++++++++++++++ .../amd/display/amdgpu_dm/amdgpu_dm_colorop.c | 20 ++++++ 2 files changed, 82 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c +62 -0
@@ -1224,6 +1224,36 @@ __set_dm_crtc_colorop_3x4_matrix(struct drm_crtc_state *crtc_state,return 0 ; } +static int +__set_dm_crtc_colorop_regamma (struct drm_crtc_state *crtc_state, +struct dc_stream_state *dc_stream_state, +struct drm_colorop *colorop, +struct dc_transfer_func *tf) +{ +struct drm_colorop_state *colorop_state =NULL ; +struct drm_atomic_commit *state = crtc_state->state; +enum dc_transfer_func_predefined default_tf =TRANSFER_FUNCTION_LINEAR ; +struct drm_device *dev = crtc_state->state->dev; +int ret =0 ; + + tf->type =TF_TYPE_BYPASS ; + +/* 1D Curve - Regamma TF */ + colorop_state =drm_atomic_get_new_colorop_state (state, colorop); + +if (colorop_state && !colorop_state->bypass && colorop->type ==DRM_COLOROP_1D_CURVE ) { +drm_dbg (dev,"Regamma TF colorop with ID: %d\n" , colorop->base.id); + tf->type =TF_TYPE_DISTRIBUTED_POINTS ; + tf->tf = default_tf =amdgpu_colorop_tf_to_dc_tf (colorop_state->curve_1d_type); + tf->sdr_ref_white_level =SDR_WHITE_LEVEL_INIT_VALUE ; + ret =__set_output_tf (tf,0 ,0 , false); +if (ret) +return ret; + } + +return 0 ; +} +/** * amdgpu_dm_crtc_set_colorop_properties: Set colorop props if programmable by DC. * @crtc_state: DRM crtc state
@@ -1249,10 +1279,42 @@ amdgpu_dm_crtc_set_colorop_properties(struct drm_crtc_state *crtc_state, bool check_only) {struct drm_colorop *colorop = crtc_state->color_pipeline; +struct drm_device *dev = crtc_state->state->dev; +struct dc_transfer_func *out_tf;int ret;/* 3x4 matrix */ ret =__set_dm_crtc_colorop_3x4_matrix (crtc_state, dc_stream_state, colorop, check_only); +if (ret) +return ret; + +if (colorop && check_only) { + out_tf =kvzalloc_obj (*out_tf); +if (!out_tf) +return -ENOMEM ; + }else { + out_tf = &dc_stream_state->out_transfer_func; +if (!colorop) { + out_tf->type =TF_TYPE_BYPASS ; +return 0 ; + } + } + +/* 1D Curve - REGAMMA TF */ + colorop = colorop->next; +if (!colorop) { +drm_dbg (dev,"no regamma TF colorop found\n" ); + ret = -EINVAL ; + goto cleanup; + } + + ret =__set_dm_crtc_colorop_regamma (crtc_state, dc_stream_state, colorop, out_tf); +if (ret) + goto cleanup; + +cleanup: +if (check_only) +kvfree (out_tf);return ret; }
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_colorop.c +20 -0
@@ -258,6 +258,7 @@ int amdgpu_dm_initialize_crtc_default_pipeline(struct drm_crtc *crtc, {struct drm_colorop *ops[MAX_COLOR_PIPELINE_OPS ];struct drm_device *dev = crtc->dev; +struct amdgpu_device *adev =drm_to_adev (dev);int ret;int i =0 ;
@@ -279,6 +280,25 @@ int amdgpu_dm_initialize_crtc_default_pipeline(struct drm_crtc *crtc, i++; +if (adev->dm.dc->caps.color.mpc.ogam_ram) { +/* 1D Curve - REGAMMA TF */ + ops[i] =kzalloc_obj (*ops[0 ]); +if (!ops[i]) { + ret = -ENOMEM ; + goto cleanup; + } + + ret =drm_crtc_colorop_curve_1d_init (dev, ops[i], crtc, &dm_colorop_funcs, + amdgpu_dm_supported_shaper_tfs, +DRM_COLOROP_FLAG_ALLOW_BYPASS ); +if (ret) + goto cleanup; + +drm_colorop_set_next_property (ops[i-1 ], ops[i]); + + i++; + } + list->name =kasprintf (GFP_KERNEL ,"Color Pipeline %d" , ops[0 ]->base.id);return 0 ;
Signature · 1 line
2.53.0
RFC PATCH v2 18/20 drm/amd/display: add support to post-blend 1D-LUT colorop
In reply to Melissa WenAdd Regamma LUT operation as 1D LUT colorop to AMD post-blend color pipeline.
--- .../amd/display/amdgpu_dm/amdgpu_dm_color.c | 38 ++++++++++++++++++- .../amd/display/amdgpu_dm/amdgpu_dm_colorop.c | 18 +++++++++ 2 files changed, 54 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c +36 -2
@@ -1234,6 +1234,8 @@ __set_dm_crtc_colorop_regamma(struct drm_crtc_state *crtc_state,struct drm_atomic_commit *state = crtc_state->state;enum dc_transfer_func_predefined default_tf =TRANSFER_FUNCTION_LINEAR ;struct drm_device *dev = crtc_state->state->dev; +const struct drm_color_lut32 *regamma_lut; +u32 regamma_size;int ret =0 ; tf->type =TF_TYPE_BYPASS ;
@@ -1251,6 +1253,34 @@ __set_dm_crtc_colorop_regamma(struct drm_crtc_state *crtc_state,return ret; } +/* 1D LUT - Regamma LUT */ + colorop = colorop->next; +if (!colorop) { +drm_dbg (dev,"no Regamma LUT colorop found\n" ); +return -EINVAL ; + } + + colorop_state =drm_atomic_get_new_colorop_state (state, colorop); + +if (colorop_state && !colorop_state->bypass && colorop->type ==DRM_COLOROP_1D_LUT ) { +drm_dbg (dev,"Regamma LUT colorop with ID: %d\n" , colorop->base.id); + tf->type =TF_TYPE_DISTRIBUTED_POINTS ; + tf->tf = default_tf; + tf->sdr_ref_white_level =SDR_WHITE_LEVEL_INIT_VALUE ; + regamma_lut =__extract_blob_lut32 (colorop_state->data, ®amma_size); + regamma_size = regamma_lut !=NULL ? regamma_size :0 ; + +/* Custom LUT size must be the same as supported size */ +if (regamma_size == colorop->size) { + ret =__set_output_tf_32 (tf, regamma_lut, regamma_size, false); +if (ret) +return ret; + }else { +drm_dbg (dev,"Regamma LUT size doesn't match blob size\n" ); +return -EINVAL ; + } + } +return 0 ; }
@@ -1300,7 +1330,7 @@ amdgpu_dm_crtc_set_colorop_properties(struct drm_crtc_state *crtc_state, } } -/* 1D Curve - REGAMMA TF */ +/* 1D Curve & LUT - REGAMMA TF & LUT */ colorop = colorop->next;if (!colorop) {drm_dbg (dev,"no regamma TF colorop found\n" );
@@ -1312,6 +1342,11 @@ amdgpu_dm_crtc_set_colorop_properties(struct drm_crtc_state *crtc_state,if (ret) goto cleanup; +/* REGAMMA LUT colorop is already handled, just skip here */ + colorop = colorop->next; +if (!colorop) + ret = -EINVAL ; + cleanup:if (check_only)kvfree (out_tf);
@@ -1339,7 +1374,6 @@ amdgpu_dm_crtc_set_colorop_properties(struct drm_crtc_state *crtc_state,* Returns: * 0 on success. Error code if validation fails. */ -int amdgpu_dm_check_crtc_color_mgmt (struct dm_crtc_state *crtc,bool check_only) {
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_colorop.c +18 -0
@@ -297,6 +297,24 @@ int amdgpu_dm_initialize_crtc_default_pipeline(struct drm_crtc *crtc,drm_colorop_set_next_property (ops[i-1 ], ops[i]); i++; + +/* 1D LUT - REGAMMA LUT */ + ops[i] =kzalloc_obj (*ops[0 ]); +if (!ops[i]) { + ret = -ENOMEM ; + goto cleanup; + } + + ret =drm_crtc_colorop_curve_1d_lut_init (dev, ops[i], crtc, &dm_colorop_funcs, +MAX_COLOR_LUT_ENTRIES , +DRM_COLOROP_LUT1D_INTERPOLATION_LINEAR , +DRM_COLOROP_FLAG_ALLOW_BYPASS ); +if (ret) + goto cleanup; + +drm_colorop_set_next_property (ops[i-1 ], ops[i]); + + i++; } list->name =kasprintf (GFP_KERNEL ,"Color Pipeline %d" , ops[0 ]->base.id);
Signature · 1 line
2.53.0
RFC PATCH v2 19/20 drm/amd/display: move CRTC CTM color mgmt prop to check helper
In reply to Melissa WenMove legacy CRTC CTM color mgmt handlers to AMD atomic check helper to centralize legacy properties in a single place, so that we can reuse the callers to these helpers for colorop setup.
--- .../amd/display/amdgpu_dm/amdgpu_dm_color.c | 66 +++++++++---------- 1 file changed, 32 insertions(+), 34 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c +32 -34
@@ -1385,6 +1385,7 @@ int amdgpu_dm_check_crtc_color_mgmt(struct dm_crtc_state *crtc,uint32_t degamma_size, regamma_size;bool has_regamma, has_degamma;enum dc_transfer_func_predefined tf =TRANSFER_FUNCTION_LINEAR ; +struct drm_color_ctm *ctm =NULL ;bool is_legacy;int r;
@@ -1454,10 +1455,38 @@ int amdgpu_dm_check_crtc_color_mgmt(struct dm_crtc_state *crtc,* have to place the CTM in the OCSC in that case. */ crtc->cm_has_degamma = has_degamma; -if (check_only) +if (check_only) {kvfree (out_tf); +return r; + } -return r; +if (r) +return r; + +/* Setup CRTC CTM. */ +if (crtc->base.ctm) { + ctm = (struct drm_color_ctm *)crtc->base.ctm->data; + +/* +* Gamut remapping must be used for gamma correction +* since it comes before the regamma correction. +* +* OCSC could be used for gamma correction, but we'd need to +* blend the adjustments together with the required output +* conversion matrix - so just use the gamut remap block +* for now. +*/ +__drm_ctm_to_dc_matrix (ctm, stream->gamut_remap_matrix.matrix); + + stream->gamut_remap_matrix.enable_remap = true; + stream->csc_color_matrix.enable_adjustment = false; + }else { +/* Bypass CTM. */ + stream->gamut_remap_matrix.enable_remap = false; + stream->csc_color_matrix.enable_adjustment = false; + } + +return 0 ; }/**
@@ -1484,38 +1513,7 @@ int amdgpu_dm_check_crtc_color_mgmt(struct dm_crtc_state *crtc,*/ int amdgpu_dm_update_crtc_color_mgmt (struct dm_crtc_state *crtc) { -struct dc_stream_state *stream = crtc->stream; -struct drm_color_ctm *ctm =NULL ; -int ret; - - ret =amdgpu_dm_check_crtc_color_mgmt (crtc, false); -if (ret) -return ret; - -/* Setup CRTC CTM. */ -if (crtc->base.ctm) { - ctm = (struct drm_color_ctm *)crtc->base.ctm->data; - -/* -* Gamut remapping must be used for gamma correction -* since it comes before the regamma correction. -* -* OCSC could be used for gamma correction, but we'd need to -* blend the adjustments together with the required output -* conversion matrix - so just use the gamut remap block -* for now. -*/ -__drm_ctm_to_dc_matrix (ctm, stream->gamut_remap_matrix.matrix); - - stream->gamut_remap_matrix.enable_remap = true; - stream->csc_color_matrix.enable_adjustment = false; - }else { -/* Bypass CTM. */ - stream->gamut_remap_matrix.enable_remap = false; - stream->csc_color_matrix.enable_adjustment = false; - } - -return 0 ; +return amdgpu_dm_check_crtc_color_mgmt (crtc, false); } static int
Signature · 1 line
2.53.0
RFC PATCH v2 20/20 drm/amd/display: enable post-blend colorop properties
In reply to Melissa WenOnly enable post-blend colorop properties if there is no AMD private color prop. Prioritize color mgmt via colorop pipeline instead CRTC color mgmt properties.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c | 5 +++++ drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c | 4 ++++ 2 files changed, 9 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c +5 -0
@@ -1389,6 +1389,11 @@ int amdgpu_dm_check_crtc_color_mgmt(struct dm_crtc_state *crtc,bool is_legacy;int r; +if (crtc->base.color_pipeline_enabled) { + r =amdgpu_dm_crtc_set_colorop_properties (&crtc->base, stream, check_only); +return r; + } + tf =amdgpu_tf_to_dc_tf (crtc->regamma_tf); r =amdgpu_dm_verify_lut_sizes (&crtc->base);
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c +4 -0
@@ -804,6 +804,10 @@ int amdgpu_dm_crtc_init(struct amdgpu_display_manager *dm,#ifdef AMD_PRIVATE_COLOR dm_crtc_additional_color_mgmt (&acrtc->base); +#else + res =dm_crtc_init_colorops (&acrtc->base); +if (res) +return res;#endif return 0 ;
Signature · 1 line
2.53.0
Hi Melissa,
thanks a lot for this series!
Quoted 18 lines · Melissa Wen
Hey,
I have been working on gamescope migration from AMD driver-specific color props to KMS colorop API [1] and, with the fixed-matrix replacement for
COLOR_ENCODINGand COLOR_RANGE[2], the only missing color prop was the CRTC AMD REGAMMA TF (the 1D Curve). So I worked on top of Ariel&Nícolas proposal for post-blend colorop API [3], discarded patches forDRM_CAP_CRTC_COLOR_PIPELINEdriver cap flag (as commented in this year Linux Display Hackfest), fixed some issues based on plane colorop recent changes and exposed AMD post-blend colorop pipeline with CTM -> 1D Curve -> 1D LUT, since post-blend Degamma is not actually supported by AMD (even though there is a workaround for enable it in CRTC color mgmt properties).I have a gamescope implementation that fully migrates its color pipeline from AMD private plane/CRTC color props to pre- and post-blend colorops running on a custom kernel with the required colorop support for AMD.
Quoted 5 lines
- Gamescope draft:
https://github.com/ValveSoftware/gamescope/pull/2113/commits- Kernel branch with all necessary patches:
https://gitlab.freedesktop.org/mwen/drm-misc/-/commits/gamescope_pipeline_w_colorop
I used your branch as base for my own one [1] to create an experimental Weston MR [2] testing a typical proper YCbCr color pipeline, using fixed matrix, gamma 2.4 pre-blend (not quite correct for bt1886, I know...) and gamma 2.2 for post-blend - focused on VKMS.
API-wise I'd say it works great and think we should go forward with it. I'll add some more comments regarding the implementation, however overall I hope we can land this in the near future.
Best regards,
Robert
1: https://gitlab.com/rmader/linux/-/commits/gamescope_pipeline_w_colorop-2026-07-28
2: https://gitlab.freedesktop.org/wayland/weston/-/merge_requests/2157
Quoted 208 lines
This series doesn't take into account the inactive color pipeline work I've been doing for plane color pipeline. My plan is to apply a similar approach post-blend when we agree that the plane series is correct.
- Patch 1-13 are essentially Ariel&Nicolas work for DRM post-blend colorop support where I added patch 10 for tracking plane vs CRTC colorop changes.
- Patch 14 completes deprecation of CRTC color mgmt properties if post-blend color pipeline is enabled by hiding them;
- Patch 15 applies the same bug fix logic as Robert did to guard plane client cap[4];
- Patch 16-20 add support to post-blend colorop API on AMD driver based on plane colorop work.This is one example of
drm_infooutput on Steam Deck with SteamOS/gamescope implementation and this kernel work:├───CRTCs │ ├───CRTC 0 │ │ ├───Object ID: 399 [...] │ │ └───"COLOR_PIPELINE" (atomic): enum {Bypass, Color Pipeline 400} = Color Pipeline 400 │ │ ├───Bypass │ │ └───Color Pipeline 400 │ │ ├───Color Operation 400 │ │ │ └───Properties │ │ │ ├───"TYPE" (immutable): enum {1D Curve, 1D LUT, 3x4 Matrix, Multiplier, 3D LUT, Fixed Matrix} = 3x4 Matrix │ │ │ ├───"BYPASS" (atomic): range [0, 1] = 1 │ │ │ ├───"NEXT" (atomic, immutable): object colorop = 405 │ │ │ └───"DATA" (atomic): blob = 0 │ │ ├───Color Operation 405 │ │ │ └───Properties │ │ │ ├───"TYPE" (immutable): enum {1D Curve, 1D LUT, 3x4 Matrix, Multiplier, 3D LUT, Fixed Matrix} = 1D Curve │ │ │ ├───"BYPASS" (atomic): range [0, 1] = 0 │ │ │ ├───"NEXT" (atomic, immutable): object colorop = 410 │ │ │ └───"CURVE_1D_TYPE" (atomic): enum {sRGB Inverse EOTF, PQ 125 Inverse EOTF, BT.2020 OETF, Gamma 2.2 Inverse, Gamma 2.4 Inverse, Gamma 2.6 Inverse} = PQ 125 Inverse EOTF │ │ └───Color Operation 410 │ │ └───Properties │ │ ├───"TYPE" (immutable): enum {1D Curve, 1D LUT, 3x4 Matrix, Multiplier, 3D LUT, Fixed Matrix} = 1D LUT │ │ ├───"BYPASS" (atomic): range [0, 1] = 1 │ │ ├───"NEXT" (atomic, immutable): object colorop = 0 │ │ ├───"SIZE" (atomic, immutable): range [0, UINT32_MAX] = 4096 │ │ ├───"LUT1D_INTERPOLATION": enum {Linear} = Linear │ │ └───"DATA" (atomic): blob = 0[...]
├───Plane 3 │ ├───Object ID: 218 [...] │ └───Properties │ ├───"type" (immutable): enum {Overlay, Primary, Cursor} = Primary │ ├───"FB_ID" (atomic): object framebuffer = 513 │ │ ├───Object ID: 513 [...] │ └───"COLOR_PIPELINE" (atomic): enum {Bypass, Color Pipeline 224} = Color Pipeline 224 │ ├───Bypass │ └───Color Pipeline 224 │ ├───Color Operation 224 │ │ └───Properties │ │ ├───"TYPE" (immutable): enum {1D Curve, 1D LUT, 3x4 Matrix, Multiplier, 3D LUT, Fixed Matrix} = Fixed Matrix │ │ ├───"BYPASS" (atomic): range [0, 1] = 1 │ │ ├───"NEXT" (atomic, immutable): object colorop = 229 │ │ └───"FIXED_MATRIX_TYPE" (atomic): enum {YCbCr 601 Full to RGB, YCbCr 601 Limited to RGB, YCbCr 709 Full to RGB, YCbCr 709 Limited to RGB, YCbCr 2020 NC Full to RGB, YCbCr 2020 NC Limited to RGB} = YCbCr 601 Full to RGB │ ├───Color Operation 229 │ │ └───Properties │ │ ├───"TYPE" (immutable): enum {1D Curve, 1D LUT, 3x4 Matrix, Multiplier, 3D LUT, Fixed Matrix} = 1D Curve │ │ ├───"BYPASS" (atomic): range [0, 1] = 0 │ │ ├───"NEXT" (atomic, immutable): object colorop = 234 │ │ └───"CURVE_1D_TYPE" (atomic): enum {sRGB EOTF, PQ 125 EOTF, BT.2020 Inverse OETF, Gamma 2.2, Gamma 2.4, Gamma 2.6} = sRGB EOTF │ ├───Color Operation 234 │ │ └───Properties │ │ ├───"TYPE" (immutable): enum {1D Curve, 1D LUT, 3x4 Matrix, Multiplier, 3D LUT, Fixed Matrix} = Multiplier │ │ ├───"BYPASS" (atomic): range [0, 1] = 0 │ │ ├───"NEXT" (atomic, immutable): object colorop = 239 │ │ └───"MULTIPLIER" (atomic): range [0, UINT64_MAX] = 4294967296 │ ├───Color Operation 239 │ │ └───Properties │ │ ├───"TYPE" (immutable): enum {1D Curve, 1D LUT, 3x4 Matrix, Multiplier, 3D LUT, Fixed Matrix} = 3x4 Matrix │ │ ├───"BYPASS" (atomic): range [0, 1] = 1 │ │ ├───"NEXT" (atomic, immutable): object colorop = 244 │ │ └───"DATA" (atomic): blob = 0 │ ├───Color Operation 244 │ │ └───Properties │ │ ├───"TYPE" (immutable): enum {1D Curve, 1D LUT, 3x4 Matrix, Multiplier, 3D LUT, Fixed Matrix} = 1D Curve │ │ ├───"BYPASS" (atomic): range [0, 1] = 0 │ │ ├───"NEXT" (atomic, immutable): object colorop = 249 │ │ └───"CURVE_1D_TYPE" (atomic): enum {sRGB Inverse EOTF, PQ 125 Inverse EOTF, BT.2020 OETF, Gamma 2.2 Inverse, Gamma 2.4 Inverse, Gamma 2.6 Inverse} = sRGB Inverse EOTF │ ├───Color Operation 249 │ │ └───Properties │ │ ├───"TYPE" (immutable): enum {1D Curve, 1D LUT, 3x4 Matrix, Multiplier, 3D LUT, Fixed Matrix} = 1D LUT │ │ ├───"BYPASS" (atomic): range [0, 1] = 0 │ │ ├───"NEXT" (atomic, immutable): object colorop = 256 │ │ ├───"SIZE" (atomic, immutable): range [0, UINT32_MAX] = 4096 │ │ ├───"LUT1D_INTERPOLATION": enum {Linear} = Linear │ │ └───"DATA" (atomic): blob = 528 │ ├───Color Operation 256 │ │ └───Properties │ │ ├───"TYPE" (immutable): enum {1D Curve, 1D LUT, 3x4 Matrix, Multiplier, 3D LUT, Fixed Matrix} = 3D LUT │ │ ├───"BYPASS" (atomic): range [0, 1] = 0 │ │ ├───"NEXT" (atomic, immutable): object colorop = 263 │ │ ├───"SIZE" (atomic, immutable): range [0, UINT32_MAX] = 17 │ │ ├───"LUT3D_INTERPOLATION": enum {Tetrahedral} = Tetrahedral │ │ └───"DATA" (atomic): blob = 529 │ ├───Color Operation 263 │ │ └───Properties │ │ ├───"TYPE" (immutable): enum {1D Curve, 1D LUT, 3x4 Matrix, Multiplier, 3D LUT, Fixed Matrix} = 1D Curve │ │ ├───"BYPASS" (atomic): range [0, 1] = 0 │ │ ├───"NEXT" (atomic, immutable): object colorop = 268 │ │ └───"CURVE_1D_TYPE" (atomic): enum {sRGB EOTF, PQ 125 EOTF, BT.2020 Inverse OETF, Gamma 2.2, Gamma 2.4, Gamma 2.6} = PQ 125 EOTF │ └───Color Operation 268 │ └───Properties │ ├───"TYPE" (immutable): enum {1D Curve, 1D LUT, 3x4 Matrix, Multiplier, 3D LUT, Fixed Matrix} = 1D LUT │ ├───"BYPASS" (atomic): range [0, 1] = 1 │ ├───"NEXT" (atomic, immutable): object colorop = 0 │ ├───"SIZE" (atomic, immutable): range [0, UINT32_MAX] = 4096 │ ├───"LUT1D_INTERPOLATION": enum {Linear} = Linear │ └───"DATA" (atomic): blob = 0FWIW, here is the
drm_infodiff:drm_info.h +1
-0@@ -21,5 +21,6 @@ enum {/* Remove after updating libdrm */ #define DRM_MODE_OBJECT_COLOROP 0xfafafafa#define DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE 7 +#define DRM_CLIENT_CAP_CRTC_COLOR_PIPELINE 8#endif json.c +1
-0@@ -29,6 +29,7 @@ static const struct { { "WRITEBACK_CONNECTORS", DRM_CLIENT_CAP_WRITEBACK_CONNECTORS }, { "CURSOR_PLANE_HOTSPOT", DRM_CLIENT_CAP_CURSOR_PLANE_HOTSPOT }, { "PLANE_COLOR_PIPELINE", DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE }, + { "CRTC_COLOR_PIPELINE", DRM_CLIENT_CAP_CRTC_COLOR_PIPELINE }, };[1] https://github.com/ValveSoftware/gamescope/pull/2113
[2] https://lore.kernel.org/dri-devel/[email protected]/
[3] https://lore.kernel.org/dri-devel/20251223-mtk-post-blend-color-pipeline-v3-0-7d969f9a37a0@collabora.com/
[4] https://lore.kernel.org/dri-devel/[email protected]/Let me know your thoughts!
Melissa
Ariel D'Alessandro (2):
drm: Add helper to extract a 3x4 matrix from any CTM matrix dimensions
drm: Add helper to extract a LUT entry from either 16-bit or 32-bit
LUTMelissa Wen (8):
drm/colorop: distinguish whether a colorop belongs to a plane or a
CRTC
drm/drm_mode_object: hide deprecated CRTC color mgmt props if colorop
is set
drm/drm_ioctl: guardDRM_CLIENT_CAP_CRTC_COLOR_PIPELINEdrm/amd/display: add support to post-blend CTM colorop drm/amd/display: add support to post-blend 1D-Curve colorop drm/amd/display: add support to post-blend 1D-LUT colorop drm/amd/display: move CRTC CTM color mgmt prop to check helper drm/amd/display: enable post-blend colorop propertiesNícolas F. R. A. Prado (10):
drm/crtc: Add color pipeline to CRTC state
drm/colorop: Allow parenting colorop to CRTC
drm: Factor out commoncolor_pipelineproperty initialization code drm/crtc: AddCOLOR_PIPELINEproperty
drm: IntroduceDRM_CLIENT_CAP_CRTC_COLOR_PIPELINEdrm/atomic: Passcrtc_color_pipelineclient cap to atomic check drm/atomic: Print the color pipeline as part of the CRTC state print drm/colorop: Factor out common paths from colorops helpers drm/colorop: Introduce colorop helpers for crtc
drm/crtc: Track crtc color pipeline client cap indrm_crtc_state.../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h | 3 + .../amd/display/amdgpu_dm/amdgpu_dm_color.c | 250 +++++++++++++--- .../amd/display/amdgpu_dm/amdgpu_dm_colorop.c | 76 +++++ .../amd/display/amdgpu_dm/amdgpu_dm_colorop.h | 2 + .../amd/display/amdgpu_dm/amdgpu_dm_crtc.c | 42 +++ drivers/gpu/drm/drm_atomic.c | 9 +- drivers/gpu/drm/drm_atomic_uapi.c | 97 +++++- drivers/gpu/drm/drm_colorop.c | 282 ++++++++++++++---- drivers/gpu/drm/drm_connector.c | 1 + drivers/gpu/drm/drm_crtc.c | 31 ++ drivers/gpu/drm/drm_crtc_internal.h | 1 + drivers/gpu/drm/drm_ioctl.c | 20 ++ drivers/gpu/drm/drm_mode_object.c | 18 ++ drivers/gpu/drm/drm_plane.c | 34 +-- drivers/gpu/drm/drm_property.c | 44 +++ include/drm/drm_atomic.h | 20 ++ include/drm/drm_atomic_uapi.h | 2 + include/drm/drm_color_mgmt.h | 61 ++++ include/drm/drm_colorop.h | 32 +- include/drm/drm_crtc.h | 27 ++ include/drm/drm_file.h | 7 + include/drm/drm_property.h | 5 + include/uapi/drm/drm.h | 19 ++ 23 files changed, 939 insertions(+), 144 deletions(-)
Signature · 6 lines
Robert Mader Consultant Software Developer Collabora Ltd. Platinum Building, St John's Innovation Park, Cambridge CB4 0DS, UK Registered in England & Wales, no. 5513718