2023-01-09 15:09:46

by Melissa Wen

[permalink] [raw]
Subject: [RFC PATCH v2 00/18] Add DRM CRTC 3D LUT interface

Hi,

After collecting comments in different places, here is a second version
of the work on adding DRM CRTC 3D LUT support to the current DRM color
mgmt interface. In comparison to previous proposals [1][2][3], here we
add 3D LUT before gamma 1D LUT, but also a shaper 1D LUT before 3D LUT,
that means the following DRM CRTC color correction pipeline:

Blend -> Degamma 1D LUT -> CTM -> Shaper 1D LUT -> 3D LUT -> Gamma 1D LUT

and we also add a DRM CRTC LUT3D_MODE property, based on Alex Hung
proposal for pre-blending 3D LUT [4] (Thanks!), instead of just a
LUT3D_SIZE, that allows userspace to use different supported settings of
3D LUT, fitting VA-API and new color API better. In this sense, I
adjusted the pre-blending proposal for post-blending usage.

Patches 1-6 targets the addition of shaper LUT and 3D LUT properties to
the current DRM CRTC color mgmt pipeline. Patch 6 can be considered an
extra/optional patch to define a default value for LUT3D_MODE, inspired
by what we do for the plane blend mode property (pre-multiplied).

Patches 7-18 targets AMD display code to enable shaper and 3D LUT usage
on DCN 301 (our HW case). Patches 7-9 performs code cleanups on current
AMD DM colors code, patch 10 updates AMD stream in case of user 3D LUT
changes, patch 11/12 rework AMD MPC 3D LUT resource handling by context
for DCN 301 (easily extendible to other DCN families). Finally, from
13-18, we wire up SHAPER LUT, LUT3D and LUT3D MODE to AMD display
driver, exposing modes supported by HW and programming user shaper and
3D LUT accordingly.

Our target userspace is Gamescope/SteamOS.

Basic IGT tests were based on [5][6] and are available here (in-progress):
https://gitlab.freedesktop.org/mwen/igt-gpu-tools/-/commits/crtc-lut3d-api

[1] https://lore.kernel.org/all/[email protected]/
[2] https://github.com/vsyrjala/linux/commit/4d28e8ddf2a076f30f9e5bdc17cbb4656fe23e69
[3] https://lore.kernel.org/amd-gfx/[email protected]/
[4] https://lore.kernel.org/dri-devel/[email protected]/
[5] https://patchwork.freedesktop.org/series/90165/
[6] https://patchwork.freedesktop.org/series/109402/
[VA_API] http://intel.github.io/libva/structVAProcFilterParameterBuffer3DLUT.html
[KMS_pipe_API] https://gitlab.freedesktop.org/pq/color-and-hdr/-/issues/11

Let me know your thoughts.

Thanks,

Melissa

Alex Hung (2):
drm: Add 3D LUT mode and its attributes
drm/amd/display: Define 3D LUT struct for HDR planes

Melissa Wen (16):
drm/drm_color_mgmt: add shaper LUT to color mgmt properties
drm/drm_color_mgmt: add 3D LUT props to DRM color mgmt
drm/drm_color_mgmt: add function to create 3D LUT modes supported
drm/drm_color_mgmt: add function to attach 3D LUT props
drm/drm_color_mgmt: set first lut3d mode as default
drm/amd/display: remove unused regamma condition
drm/amd/display: add comments to describe DM crtc color mgmt behavior
drm/amd/display: encapsulate atomic regamma operation
drm/amd/display: update lut3d and shaper lut to stream
drm/amd/display: handle MPC 3D LUT resources for a given context
drm/amd/display: acquire/release 3D LUT resources for ctx on DCN301
drm/amd/display: expand array of supported 3D LUT modes
drm/amd/display: enable 3D-LUT DRM properties if supported
drm/amd/display: add user 3D LUT support to the amdgpu_dm color
pipeline
drm/amd/display: decouple steps to reuse in shaper LUT support
drm/amd/display: add user shaper LUT support to amdgpu_dm color
pipeline

.../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 6 +
.../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h | 3 +
.../amd/display/amdgpu_dm/amdgpu_dm_color.c | 370 ++++++++++++++++--
.../amd/display/amdgpu_dm/amdgpu_dm_crtc.c | 2 +
drivers/gpu/drm/amd/display/dc/core/dc.c | 49 ++-
drivers/gpu/drm/amd/display/dc/dc.h | 8 +
.../amd/display/dc/dcn301/dcn301_resource.c | 47 ++-
.../amd/display/modules/color/color_gamma.h | 43 ++
drivers/gpu/drm/drm_atomic_state_helper.c | 7 +
drivers/gpu/drm/drm_atomic_uapi.c | 24 ++
drivers/gpu/drm/drm_color_mgmt.c | 127 ++++++
drivers/gpu/drm/drm_fb_helper.c | 5 +
drivers/gpu/drm/drm_mode_config.c | 21 +
include/drm/drm_color_mgmt.h | 8 +
include/drm/drm_crtc.h | 32 +-
include/drm/drm_mode_config.h | 25 ++
include/drm/drm_mode_object.h | 2 +-
include/uapi/drm/drm_mode.h | 17 +
18 files changed, 757 insertions(+), 39 deletions(-)

--
2.35.1


2023-01-09 15:10:16

by Melissa Wen

[permalink] [raw]
Subject: [RFC PATCH v2 14/18] drm/amd/display: expand array of supported 3D LUT modes

AMD MPC block support 3D LUTs of dimensions 17 and 9, and also bit
depth 12 and 10, therefore, advertise them to the userspace.

Signed-off-by: Melissa Wen <[email protected]>
---
.../amd/display/modules/color/color_gamma.h | 31 +++++++++++++++++++
1 file changed, 31 insertions(+)

diff --git a/drivers/gpu/drm/amd/display/modules/color/color_gamma.h b/drivers/gpu/drm/amd/display/modules/color/color_gamma.h
index 8e159b1eb9c6..69b9a1aa6dd4 100644
--- a/drivers/gpu/drm/amd/display/modules/color/color_gamma.h
+++ b/drivers/gpu/drm/amd/display/modules/color/color_gamma.h
@@ -47,6 +47,37 @@ static const struct drm_mode_lut3d_mode lut3d_mode_17_12bit = {
.flags = 0,
};

+static const struct drm_mode_lut3d_mode amdgpu_lut3d_modes[] = {
+ {
+ .lut_size = 17,
+ .lut_stride = {17, 17, 18},
+ .bit_depth = 12,
+ .color_format = DRM_FORMAT_XRGB16161616,
+ .flags = 0,
+ },
+ {
+ .lut_size = 17,
+ .lut_stride = {17, 17, 18},
+ .bit_depth = 10,
+ .color_format = DRM_FORMAT_XRGB16161616,
+ .flags = 0,
+ },
+ {
+ .lut_size = 9,
+ .lut_stride = {9, 9, 10},
+ .bit_depth = 12,
+ .color_format = DRM_FORMAT_XRGB16161616,
+ .flags = 0,
+ },
+ {
+ .lut_size = 9,
+ .lut_stride = {9, 9, 10},
+ .bit_depth = 10,
+ .color_format = DRM_FORMAT_XRGB16161616,
+ .flags = 0,
+ },
+};
+
/* For SetRegamma ADL interface support
* Must match escape type
*/
--
2.35.1

2023-01-09 15:19:57

by Melissa Wen

[permalink] [raw]
Subject: [RFC PATCH v2 05/18] drm/drm_color_mgmt: add function to attach 3D LUT props

If the driver supports user 3D LUT then it calls a drm function to
attach 3D LUT related properties according to HW caps.

Signed-off-by: Melissa Wen <[email protected]>
---
drivers/gpu/drm/drm_color_mgmt.c | 35 ++++++++++++++++++++++++++++++++
include/drm/drm_color_mgmt.h | 3 +++
2 files changed, 38 insertions(+)

diff --git a/drivers/gpu/drm/drm_color_mgmt.c b/drivers/gpu/drm/drm_color_mgmt.c
index 6ce48007cdd4..06503f693ecd 100644
--- a/drivers/gpu/drm/drm_color_mgmt.c
+++ b/drivers/gpu/drm/drm_color_mgmt.c
@@ -269,6 +269,41 @@ int drm_crtc_create_lut3d_mode_property(struct drm_crtc *crtc,
}
EXPORT_SYMBOL(drm_crtc_create_lut3d_mode_property);

+/**
+ * drm_crtc_enable_lut3d - enable 3D LUT properties
+ * @crtc: DRM CRTC
+ * @shaper_lut_size: the size of shaper lut
+ *
+ * This function lets the driver enable the 3D LUT color correction property
+ * on a CRTC. This includes 3D LUT and also a shaper LUT, if set. The shaper
+ * LUT property is only attached if its size is not 0 and 3D LUT is set, being
+ * therefore optional.
+ */
+void drm_crtc_enable_lut3d(struct drm_crtc *crtc,
+ uint shaper_lut_size)
+{
+ struct drm_device *dev = crtc->dev;
+ struct drm_mode_config *config = &dev->mode_config;
+
+ if (!config->lut3d_mode_property)
+ return;
+
+ drm_object_attach_property(&crtc->base,
+ config->lut3d_property, 0);
+ drm_object_attach_property(&crtc->base,
+ config->lut3d_mode_property, 0);
+
+ if (!shaper_lut_size)
+ return;
+
+ drm_object_attach_property(&crtc->base,
+ config->shaper_lut_property, 0);
+ drm_object_attach_property(&crtc->base,
+ config->shaper_lut_size_property,
+ shaper_lut_size);
+}
+EXPORT_SYMBOL(drm_crtc_enable_lut3d);
+
/**
* drm_mode_crtc_set_gamma_size - set the gamma table size
* @crtc: CRTC to set the gamma table size for
diff --git a/include/drm/drm_color_mgmt.h b/include/drm/drm_color_mgmt.h
index af9305925572..db2026dc825e 100644
--- a/include/drm/drm_color_mgmt.h
+++ b/include/drm/drm_color_mgmt.h
@@ -63,6 +63,9 @@ int drm_crtc_create_lut3d_mode_property(struct drm_crtc *crtc,
const struct drm_mode_lut3d_mode modes[],
unsigned int num_modes);

+void drm_crtc_enable_lut3d(struct drm_crtc *crtc,
+ uint shaper_lut_size);
+
int drm_mode_crtc_set_gamma_size(struct drm_crtc *crtc,
int gamma_size);

--
2.35.1

2023-01-09 15:20:18

by Melissa Wen

[permalink] [raw]
Subject: [RFC PATCH v2 12/18] drm/amd/display: acquire/release 3D LUT resources for ctx on DCN301

Acquire and release 3D LUT and shaper LUT every time we create/remove a
new ctx and add/remove stream to/from it. 3D LUT acquire/release can
fail and therefore we should check its availability during atomic check
considering the new context created not the current one.

Signed-off-by: Melissa Wen <[email protected]>
---
.../amd/display/dc/dcn301/dcn301_resource.c | 47 ++++++++++++++++++-
1 file changed, 45 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dcn301/dcn301_resource.c b/drivers/gpu/drm/amd/display/dc/dcn301/dcn301_resource.c
index ee62ae3eb98f..5bae0972bd5e 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn301/dcn301_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn301/dcn301_resource.c
@@ -1260,6 +1260,49 @@ static struct display_stream_compressor *dcn301_dsc_create(
return &dsc->base;
}

+static enum dc_status
+dcn301_add_stream_to_ctx(struct dc *dc,
+ struct dc_state *new_ctx,
+ struct dc_stream_state *dc_stream)
+{
+ enum dc_status result = DC_ERROR_UNEXPECTED;
+ struct dc_3dlut *lut3d_func_new = NULL;
+ struct dc_transfer_func *func_shaper_new = NULL;
+
+ result = dcn20_add_stream_to_ctx(dc, new_ctx, dc_stream);
+ if (result != DC_OK)
+ return result;
+
+ if (!dc_acquire_release_mpc_3dlut_for_ctx(dc, true, new_ctx, dc_stream,
+ &lut3d_func_new, &func_shaper_new))
+ return DC_ERROR_UNEXPECTED;
+
+ dc_stream->lut3d_func = lut3d_func_new;
+ dc_stream->func_shaper = func_shaper_new;
+
+ return DC_OK;
+}
+
+static enum dc_status
+dcn301_remove_stream_from_ctx(struct dc *dc,
+ struct dc_state *new_ctx,
+ struct dc_stream_state *dc_stream)
+{
+ struct dc_3dlut *lut3d_func;
+ struct dc_transfer_func *func_shaper;
+
+ lut3d_func = (struct dc_3dlut *)dc_stream->lut3d_func;
+ func_shaper = (struct dc_transfer_func *)dc_stream->func_shaper;
+
+ if (!dc_acquire_release_mpc_3dlut_for_ctx(dc, false, new_ctx, dc_stream,
+ &lut3d_func, &func_shaper))
+ return DC_ERROR_UNEXPECTED;
+
+ dc_stream->lut3d_func = lut3d_func;
+ dc_stream->func_shaper = func_shaper;
+
+ return dcn20_remove_stream_from_ctx(dc, new_ctx, dc_stream);
+}

static void dcn301_destroy_resource_pool(struct resource_pool **pool)
{
@@ -1406,9 +1449,9 @@ static struct resource_funcs dcn301_res_pool_funcs = {
.update_soc_for_wm_a = dcn30_update_soc_for_wm_a,
.populate_dml_pipes = dcn30_populate_dml_pipes_from_context,
.acquire_idle_pipe_for_layer = dcn20_acquire_idle_pipe_for_layer,
- .add_stream_to_ctx = dcn30_add_stream_to_ctx,
+ .add_stream_to_ctx = dcn301_add_stream_to_ctx,
.add_dsc_to_stream_resource = dcn20_add_dsc_to_stream_resource,
- .remove_stream_from_ctx = dcn20_remove_stream_from_ctx,
+ .remove_stream_from_ctx = dcn301_remove_stream_from_ctx,
.populate_dml_writeback_from_context = dcn30_populate_dml_writeback_from_context,
.set_mcif_arb_params = dcn30_set_mcif_arb_params,
.find_first_free_match_stream_enc_for_link = dcn10_find_first_free_match_stream_enc_for_link,
--
2.35.1

2023-01-09 15:20:23

by Melissa Wen

[permalink] [raw]
Subject: [RFC PATCH v2 18/18] drm/amd/display: add user shaper LUT support to amdgpu_dm color pipeline

Now, we can use shaper LUT to delinearize and/or normalize the color
space for a more efficient 3D LUT support (so far, only for DRM atomic
color mgmt). If a degamma 1D LUT is passed to linearize the color space,
a custom shaper 1D LUT can be used before applying 3D LUT.

Signed-off-by: Melissa Wen <[email protected]>
---
.../amd/display/amdgpu_dm/amdgpu_dm_color.c | 95 ++++++++++++++++---
1 file changed, 83 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c
index 8a930f9bce60..81b20ac9ff19 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c
@@ -497,14 +497,62 @@ static void amdgpu_dm_atomic_lut3d(struct dc_stream_state *stream,
stream->lut3d_func = lut;
}

+static int __set_func_shaper(struct dc_transfer_func *shaper_func,
+ const struct drm_color_lut *lut, uint32_t lut_size)
+{
+ struct dc_gamma *gamma = NULL;
+ struct calculate_buffer cal_buffer = {0};
+ bool res;
+
+ ASSERT(lut && lut_size == MAX_COLOR_LUT_ENTRIES);
+
+ cal_buffer.buffer_index = -1;
+
+ gamma = dc_create_gamma();
+ if (!gamma)
+ return -ENOMEM;
+
+ gamma->num_entries = lut_size;
+ __drm_lut_to_dc_gamma(lut, gamma, false);
+
+ /*
+ * Color module doesn't like calculating gamma params
+ * on top of a linear input. But degamma params can be used
+ * instead to simulate this.
+ */
+ gamma->type = GAMMA_CUSTOM;
+ res = mod_color_calculate_degamma_params(NULL, shaper_func, gamma, true);
+
+ dc_gamma_release(&gamma);
+
+ return res ? 0 : -ENOMEM;
+}
+
static int amdgpu_dm_atomic_shaper_lut(struct dc_stream_state *stream,
+ const struct drm_color_lut *shaper_lut,
+ uint32_t shaper_size,
struct dc_transfer_func *func_shaper_new)
{
- /* We don't get DRM shaper LUT yet. We assume the input color space is already
+ /* If no DRM shaper LUT, we assume the input color space is already
* delinearized, so we don't need a shaper LUT and we can just BYPASS
*/
- func_shaper_new->type = TF_TYPE_BYPASS;
- func_shaper_new->tf = TRANSFER_FUNCTION_LINEAR;
+ if (!shaper_size) {
+ func_shaper_new->type = TF_TYPE_BYPASS;
+ func_shaper_new->tf = TRANSFER_FUNCTION_LINEAR;
+ } else {
+ int r;
+
+ /* If DRM shaper LUT is set, we assume a linear color space
+ * (linearized by DRM degamma 1D LUT or not)
+ */
+ func_shaper_new->type = TF_TYPE_DISTRIBUTED_POINTS;
+ func_shaper_new->tf = TRANSFER_FUNCTION_LINEAR;
+
+ r = __set_func_shaper(func_shaper_new, shaper_lut, shaper_size);
+ if (r)
+ return r;
+ }
+
stream->func_shaper = func_shaper_new;

return 0;
@@ -514,6 +562,8 @@ static int amdgpu_dm_atomic_shaper_lut(struct dc_stream_state *stream,
* interface
* @dc: Display Core control structure
* @stream: DC stream state to set shaper LUT and 3D LUT
+ * @drm_shaper_lut: DRM CRTC (user) shaper LUT
+ * @drm_shaper_size: size of shaper LUT
* @drm_lut3d: DRM CRTC (user) 3D LUT
* @drm_lut3d_size: size of 3D LUT
*
@@ -522,6 +572,8 @@ static int amdgpu_dm_atomic_shaper_lut(struct dc_stream_state *stream,
*/
static int amdgpu_dm_atomic_shaper_lut3d(struct dc *dc,
struct dc_stream_state *stream,
+ const struct drm_color_lut *drm_shaper_lut,
+ uint32_t drm_shaper_size,
const struct drm_color_lut *drm_lut3d,
uint32_t drm_lut3d_size,
const struct drm_mode_lut3d_mode *mode)
@@ -532,11 +584,11 @@ static int amdgpu_dm_atomic_shaper_lut3d(struct dc *dc,
lut3d_func_new = (struct dc_3dlut *) stream->lut3d_func;
func_shaper_new = (struct dc_transfer_func *) stream->func_shaper;

-
amdgpu_dm_atomic_lut3d(stream, drm_lut3d, drm_lut3d_size,
mode, lut3d_func_new);

- return amdgpu_dm_atomic_shaper_lut(stream, func_shaper_new);
+ return amdgpu_dm_atomic_shaper_lut(stream, drm_shaper_lut,
+ drm_shaper_size, func_shaper_new);
}

static const struct drm_mode_lut3d_mode *
@@ -569,13 +621,23 @@ get_lut3d_mode(struct amdgpu_device *adev,
int amdgpu_dm_verify_lut3d_size(struct amdgpu_device *adev,
const struct drm_crtc_state *crtc_state)
{
- const struct drm_color_lut *lut3d = NULL;
+ const struct drm_color_lut *shaper = NULL, *lut3d = NULL;
const struct drm_mode_lut3d_mode *mode;
uint32_t exp_size, size;

+ /* shaper LUT is only available if 3D LUT color caps*/
+ exp_size = has_mpc_lut3d_caps(&adev->dm) ? MAX_COLOR_LUT_ENTRIES : 0;
+ shaper = __extract_blob_lut(crtc_state->shaper_lut, &size);
+
+ if (shaper && size != exp_size) {
+ DRM_DEBUG_DRIVER(
+ "Invalid Shaper LUT size. Should be %u but got %u.\n",
+ exp_size, size);
+ return -EINVAL;
+ }
+
mode = get_lut3d_mode(adev, crtc_state);
exp_size = mode ? mode->lut_size * mode->lut_size * mode->lut_size : 0;
-
lut3d = __extract_blob_lut(crtc_state->lut3d, &size);

if (lut3d && size != exp_size) {
@@ -617,11 +679,11 @@ int amdgpu_dm_update_crtc_color_mgmt(struct dm_crtc_state *crtc)
bool has_rom = adev->asic_type <= CHIP_RAVEN;
struct drm_color_ctm *ctm = NULL;
const struct drm_color_lut *degamma_lut, *regamma_lut;
- const struct drm_color_lut *lut3d;
+ const struct drm_color_lut *shaper_lut, *lut3d;
uint32_t degamma_size, regamma_size;
- uint32_t lut3d_size;
+ uint32_t lut3d_size, shaper_size;
bool has_regamma, has_degamma;
- bool has_lut3d;
+ bool has_lut3d, has_shaper_lut;
bool is_legacy;
int r;

@@ -634,12 +696,14 @@ int amdgpu_dm_update_crtc_color_mgmt(struct dm_crtc_state *crtc)
return r;

degamma_lut = __extract_blob_lut(crtc->base.degamma_lut, &degamma_size);
+ shaper_lut = __extract_blob_lut(crtc->base.shaper_lut, &shaper_size);
lut3d = __extract_blob_lut(crtc->base.lut3d, &lut3d_size);
regamma_lut = __extract_blob_lut(crtc->base.gamma_lut, &regamma_size);

has_degamma =
degamma_lut && !__is_lut_linear(degamma_lut, degamma_size);

+ has_shaper_lut = shaper_lut != NULL;
has_lut3d = lut3d != NULL;

has_regamma =
@@ -680,10 +744,17 @@ int amdgpu_dm_update_crtc_color_mgmt(struct dm_crtc_state *crtc)
return r;
} else {
if (has_lut3d) {
- r = amdgpu_dm_atomic_shaper_lut3d(adev->dm.dc, stream, lut3d, lut3d_size,
+ /* enable 3D LUT only for DRM atomic color mgmt */
+ shaper_size = has_shaper_lut ? shaper_size : 0;
+
+ r = amdgpu_dm_atomic_shaper_lut3d(adev->dm.dc, stream,
+ shaper_lut, shaper_size,
+ lut3d, lut3d_size,
get_lut3d_mode(adev, &crtc->base));
- if (r)
+ if (r) {
+ DRM_DEBUG_DRIVER("Failed to set shaper and 3D LUT\n");
return r;
+ }
}
/* Note: OGAM is disabled if 3D LUT is successfully programmed.
* See params and set_output_gamma in
--
2.35.1

2023-01-09 15:20:27

by Melissa Wen

[permalink] [raw]
Subject: [RFC PATCH v2 01/18] drm: Add 3D LUT mode and its attributes

From: Alex Hung <[email protected]>

A struct is defined for 3D LUT modes to be supported by hardware.
The elements includes lut_size, lut_stride, bit_depth, color_format
and flags.

Note: A patchset "IGT tests for pre-blending 3D LUT interfaces" for this
proposal is sent to IGT mailing list.

Signed-off-by: Alex Hung <[email protected]>
---
include/uapi/drm/drm_mode.h | 17 +++++++++++++++++
1 file changed, 17 insertions(+)

diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h
index fa953309d9ce..fddb86dad4db 100644
--- a/include/uapi/drm/drm_mode.h
+++ b/include/uapi/drm/drm_mode.h
@@ -849,6 +849,23 @@ struct drm_color_lut {
__u16 reserved;
};

+/*
+ * struct drm_mode_lut3d_mode - 3D LUT mode information.
+ * @lut_size: number of valid points on every dimension of 3D LUT.
+ * @lut_stride: number of points on every dimension of 3D LUT.
+ * @bit_depth: number of bits of RGB. If color_mode defines entries with higher
+ * bit_depth the least significant bits will be truncated.
+ * @color_format: fourcc values, ex. DRM_FORMAT_XRGB16161616 or DRM_FORMAT_XBGR16161616.
+ * @flags: flags for hardware-sepcific features
+ */
+struct drm_mode_lut3d_mode {
+ __u16 lut_size;
+ __u16 lut_stride[3];
+ __u16 bit_depth;
+ __u32 color_format;
+ __u32 flags;
+};
+
/**
* struct hdr_metadata_infoframe - HDR Metadata Infoframe Data.
*
--
2.35.1

2023-01-09 15:20:36

by Melissa Wen

[permalink] [raw]
Subject: [RFC PATCH v2 17/18] drm/amd/display: decouple steps to reuse in shaper LUT support

Decouple steps of shaper LUT setup and LUT size validation according to
HW caps as a preparation for shaper LUT support.

Signed-off-by: Melissa Wen <[email protected]>
---
.../amd/display/amdgpu_dm/amdgpu_dm_color.c | 22 ++++++++++++-------
1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c
index 0fb1244c8aef..8a930f9bce60 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c
@@ -497,6 +497,19 @@ static void amdgpu_dm_atomic_lut3d(struct dc_stream_state *stream,
stream->lut3d_func = lut;
}

+static int amdgpu_dm_atomic_shaper_lut(struct dc_stream_state *stream,
+ struct dc_transfer_func *func_shaper_new)
+{
+ /* We don't get DRM shaper LUT yet. We assume the input color space is already
+ * delinearized, so we don't need a shaper LUT and we can just BYPASS
+ */
+ func_shaper_new->type = TF_TYPE_BYPASS;
+ func_shaper_new->tf = TRANSFER_FUNCTION_LINEAR;
+ stream->func_shaper = func_shaper_new;
+
+ return 0;
+}
+
/* amdgpu_dm_atomic_shaper_lut3d - set DRM CRTC shaper LUT and 3D LUT to DC
* interface
* @dc: Display Core control structure
@@ -519,18 +532,11 @@ static int amdgpu_dm_atomic_shaper_lut3d(struct dc *dc,
lut3d_func_new = (struct dc_3dlut *) stream->lut3d_func;
func_shaper_new = (struct dc_transfer_func *) stream->func_shaper;

- /* We don't get DRM shaper LUT yet. We assume the input color space is
- * already delinearized, so we don't need a shaper LUT and we can just
- * BYPASS.
- */
- func_shaper_new->type = TF_TYPE_BYPASS;
- func_shaper_new->tf = TRANSFER_FUNCTION_LINEAR;
- stream->func_shaper = func_shaper_new;

amdgpu_dm_atomic_lut3d(stream, drm_lut3d, drm_lut3d_size,
mode, lut3d_func_new);

- return 0;
+ return amdgpu_dm_atomic_shaper_lut(stream, func_shaper_new);
}

static const struct drm_mode_lut3d_mode *
--
2.35.1

2023-01-09 15:22:29

by Melissa Wen

[permalink] [raw]
Subject: [RFC PATCH v2 09/18] drm/amd/display: encapsulate atomic regamma operation

We are introducing DRM 3D LUT property to DM color pipeline in the next
patch, but so far, only for atomic interface. By checking
.set_output_transfer_func in DC drivers with MPC 3D LUT support, we can
verify that regamma is only programmed when 3D LUT programming fails. As
a groundwork to introduce 3D LUT programming and better understand each
step, detach atomic regamma programming from the crtc colocr updating
code.

Signed-off-by: Melissa Wen <[email protected]>
---
.../amd/display/amdgpu_dm/amdgpu_dm_color.c | 52 ++++++++++++-------
1 file changed, 33 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c
index b54ef1392895..54d95745f0f0 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c
@@ -291,6 +291,36 @@ static int __set_output_tf(struct dc_transfer_func *func,
return res ? 0 : -ENOMEM;
}

+static int amdgpu_dm_set_atomic_regamma(struct dc_stream_state *stream,
+ const struct drm_color_lut *regamma_lut,
+ uint32_t regamma_size)
+{
+ int ret = 0;
+
+ if (regamma_size) {
+ /* CRTC RGM goes into RGM LUT.
+ *
+ * Note: here there is no implicit sRGB regamma. We are using
+ * degamma calculation from color module to calculate the curve
+ * from a linear base.
+ */
+ stream->out_transfer_func->type = TF_TYPE_DISTRIBUTED_POINTS;
+ stream->out_transfer_func->tf = TRANSFER_FUNCTION_LINEAR;
+
+ ret = __set_output_tf(stream->out_transfer_func, regamma_lut,
+ regamma_size);
+ } else {
+ /*
+ * No CRTC RGM means we can just put the block into bypass
+ * since we don't have any plane level adjustments using it.
+ */
+ stream->out_transfer_func->type = TF_TYPE_BYPASS;
+ stream->out_transfer_func->tf = TRANSFER_FUNCTION_LINEAR;
+ }
+
+ return ret;
+}
+
/**
* __set_input_tf - calculates the input transfer function based on expected
* input space.
@@ -438,27 +468,11 @@ int amdgpu_dm_update_crtc_color_mgmt(struct dm_crtc_state *crtc)
regamma_size, has_rom);
if (r)
return r;
- } else if (has_regamma) {
- /* CRTC RGM goes into RGM LUT.
- *
- * Note: here there is no implicit sRGB regamma. We are using
- * degamma calculation from color module to calculate the curve
- * from a linear base.
- */
- stream->out_transfer_func->type = TF_TYPE_DISTRIBUTED_POINTS;
- stream->out_transfer_func->tf = TRANSFER_FUNCTION_LINEAR;
-
- r = __set_output_tf(stream->out_transfer_func, regamma_lut,
- regamma_size);
+ } else {
+ regamma_size = has_regamma ? regamma_size : 0;
+ r = amdgpu_dm_set_atomic_regamma(stream, regamma_lut, regamma_size);
if (r)
return r;
- } else {
- /*
- * No CRTC RGM means we can just put the block into bypass
- * since we don't have any plane level adjustments using it.
- */
- stream->out_transfer_func->type = TF_TYPE_BYPASS;
- stream->out_transfer_func->tf = TRANSFER_FUNCTION_LINEAR;
}

/*
--
2.35.1

2023-01-09 15:33:45

by Melissa Wen

[permalink] [raw]
Subject: [RFC PATCH v2 11/18] drm/amd/display: handle MPC 3D LUT resources for a given context

In the original dc_acquire_release_mpc_3dlut(), only current ctx is
considered, which doesn't fit the steps for atomic checking new ctx.
Therefore, create a function to handle 3D LUT resource for a given
context, so that we can check resources availability in atomic_check
time and handle failures properly.

Signed-off-by: Melissa Wen <[email protected]>
---
drivers/gpu/drm/amd/display/dc/core/dc.c | 39 ++++++++++++++++++++++++
drivers/gpu/drm/amd/display/dc/dc.h | 8 +++++
2 files changed, 47 insertions(+)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c
index 88f1130c3b83..76270d21286a 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc.c
@@ -2085,6 +2085,45 @@ bool dc_acquire_release_mpc_3dlut(
return ret;
}

+bool
+dc_acquire_release_mpc_3dlut_for_ctx(struct dc *dc,
+ bool acquire,
+ struct dc_state *state,
+ struct dc_stream_state *stream,
+ struct dc_3dlut **lut,
+ struct dc_transfer_func **shaper)
+{
+ int pipe_idx;
+ bool ret = false;
+ bool found_pipe_idx = false;
+ const struct resource_pool *pool = dc->res_pool;
+ struct resource_context *res_ctx = &state->res_ctx;
+ int mpcc_id = 0;
+
+ if (pool && res_ctx) {
+ if (acquire) {
+ /*find pipe idx for the given stream*/
+ for (pipe_idx = 0; pipe_idx < pool->pipe_count; pipe_idx++) {
+ if (res_ctx->pipe_ctx[pipe_idx].stream == stream) {
+ found_pipe_idx = true;
+ mpcc_id = res_ctx->pipe_ctx[pipe_idx].plane_res.hubp->inst;
+ break;
+ }
+ }
+ } else
+ found_pipe_idx = true;/*for release pipe_idx is not required*/
+
+ if (found_pipe_idx) {
+ if (acquire && pool->funcs->acquire_post_bldn_3dlut)
+ ret = pool->funcs->acquire_post_bldn_3dlut(res_ctx, pool, mpcc_id, lut, shaper);
+ else if (!acquire && pool->funcs->release_post_bldn_3dlut)
+ ret = pool->funcs->release_post_bldn_3dlut(res_ctx, pool, lut, shaper);
+ }
+ }
+ return ret;
+}
+
+
static bool is_flip_pending_in_pipes(struct dc *dc, struct dc_state *context)
{
int i;
diff --git a/drivers/gpu/drm/amd/display/dc/dc.h b/drivers/gpu/drm/amd/display/dc/dc.h
index 72963617553e..a5abf7f308c3 100644
--- a/drivers/gpu/drm/amd/display/dc/dc.h
+++ b/drivers/gpu/drm/amd/display/dc/dc.h
@@ -1345,6 +1345,14 @@ bool dc_acquire_release_mpc_3dlut(
struct dc_3dlut **lut,
struct dc_transfer_func **shaper);

+bool
+dc_acquire_release_mpc_3dlut_for_ctx(struct dc *dc,
+ bool acquire,
+ struct dc_state *state,
+ struct dc_stream_state *stream,
+ struct dc_3dlut **lut,
+ struct dc_transfer_func **shaper);
+
void dc_resource_state_copy_construct(
const struct dc_state *src_ctx,
struct dc_state *dst_ctx);
--
2.35.1

2023-01-09 15:43:27

by Melissa Wen

[permalink] [raw]
Subject: [RFC PATCH v2 16/18] drm/amd/display: add user 3D LUT support to the amdgpu_dm color pipeline

Map DRM 3D LUT in the atomic color mgmt pipeline to DC. 3D LUT works
better in a non-linear color space, therefore using a degamma to
linearize the input space may produce unexpected results. The next patch
introduces shaper LUT support that can be used to delinearize the color
space before applying 3D LUT conversion.

Note that there is no implicit sRGB degamma/regamma in the current
implementation for DRM atomic color mgmt. Atomic degamma/regamma 1D LUT
is applied considering a linear base.

For reference, see IGT test amdgpu/amd_color and commit
cf020d49b3c4 ("drm/amd/display: Rework CRTC color management")

dc_acquire_release_mpc_3dlut initializes the bits required to program
3DLUT in DC MPC hw block, that is applied by set_output_transfer_func().
I still need to double check the timing to acquire and release shaper
and 3D LUTs from the resource pool.

Signed-off-by: Melissa Wen <[email protected]>
---
.../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 6 +
.../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h | 2 +
.../amd/display/amdgpu_dm/amdgpu_dm_color.c | 189 ++++++++++++++++++
3 files changed, 197 insertions(+)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index b8638f0508b0..7aa41dd2143b 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -9704,6 +9704,12 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev,
goto fail;
}

+ ret = amdgpu_dm_verify_lut3d_size(adev, new_crtc_state);
+ if (ret) {
+ DRM_DEBUG_DRIVER("amdgpu_dm_verify_lut_sizes() failed\n");
+ goto fail;
+ }
+
if (!new_crtc_state->enable)
continue;

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
index 6f04719d0c1f..59ab1b8f7b05 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
@@ -786,6 +786,8 @@ void amdgpu_dm_trigger_timing_sync(struct drm_device *dev);

void amdgpu_dm_init_color_mod(void);
int amdgpu_dm_verify_lut_sizes(const struct drm_crtc_state *crtc_state);
+int amdgpu_dm_verify_lut3d_size(struct amdgpu_device *adev,
+ const struct drm_crtc_state *crtc_state);
void amdgpu_dm_enable_lut3d_prop(struct amdgpu_display_manager *dm, struct drm_crtc *crtc);
int amdgpu_dm_update_crtc_color_mgmt(struct dm_crtc_state *crtc);
int amdgpu_dm_update_plane_color_mgmt(struct dm_crtc_state *crtc,
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c
index c547957acd73..0fb1244c8aef 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c
@@ -413,6 +413,175 @@ void amdgpu_dm_enable_lut3d_prop(struct amdgpu_display_manager *dm, struct drm_c
drm_crtc_enable_lut3d(crtc, MAX_COLOR_LUT_ENTRIES, true);
}

+static void __to_dc_lut3d_color(struct dc_rgb *rgb,
+ const struct drm_color_lut lut,
+ int bit_precision)
+{
+ rgb->red = drm_color_lut_extract(lut.red, bit_precision);
+ rgb->green = drm_color_lut_extract(lut.green, bit_precision);
+ rgb->blue = drm_color_lut_extract(lut.blue, bit_precision);
+}
+
+static void __drm_3dlut_to_dc_3dlut(const struct drm_color_lut *lut,
+ uint32_t lut3d_size,
+ struct tetrahedral_params *params,
+ bool use_tetrahedral_9,
+ int bit_depth)
+{
+ struct dc_rgb *lut0;
+ struct dc_rgb *lut1;
+ struct dc_rgb *lut2;
+ struct dc_rgb *lut3;
+ int lut_i, i;
+
+
+ if (use_tetrahedral_9) {
+ lut0 = params->tetrahedral_9.lut0;
+ lut1 = params->tetrahedral_9.lut1;
+ lut2 = params->tetrahedral_9.lut2;
+ lut3 = params->tetrahedral_9.lut3;
+ } else {
+ lut0 = params->tetrahedral_17.lut0;
+ lut1 = params->tetrahedral_17.lut1;
+ lut2 = params->tetrahedral_17.lut2;
+ lut3 = params->tetrahedral_17.lut3;
+ }
+
+ for (lut_i = 0, i = 0; i < lut3d_size - 4; lut_i++, i += 4) {
+ /* We should consider the 3dlut RGB values are distributed
+ * along four arrays lut0-3 where the first sizes 1229 and the
+ * other 1228. The bit depth supported for 3dlut channel is
+ * 12-bit, but DC also supports 10-bit.
+ *
+ * TODO: improve color pipeline API to enable the userspace set
+ * bit depth and 3D LUT size/stride, as specified by VA-API.
+ */
+ __to_dc_lut3d_color(&lut0[lut_i], lut[i], bit_depth);
+ __to_dc_lut3d_color(&lut1[lut_i], lut[i + 1], bit_depth);
+ __to_dc_lut3d_color(&lut2[lut_i], lut[i + 2], bit_depth);
+ __to_dc_lut3d_color(&lut3[lut_i], lut[i + 3], bit_depth);
+ }
+ /* lut0 has 1229 points (lut_size/4 + 1) */
+ __to_dc_lut3d_color(&lut0[lut_i], lut[i], bit_depth);
+}
+
+/* amdgpu_dm_atomic_lut3d - set DRM 3D LUT to DC stream
+ * @stream: DC stream state to set shaper LUT and 3D LUT
+ * @drm_lut3d: DRM CRTC (user) 3D LUT
+ * @drm_lut3d_size: size of 3D LUT
+ * @lut3d: DC 3D LUT
+ *
+ * Map DRM CRTC 3D LUT to DC 3D LUT and all necessary bits to program it
+ * on DCN MPC accordingly.
+ */
+static void amdgpu_dm_atomic_lut3d(struct dc_stream_state *stream,
+ const struct drm_color_lut *drm_lut,
+ uint32_t drm_lut3d_size,
+ const struct drm_mode_lut3d_mode *mode,
+ struct dc_3dlut *lut)
+{
+ int size = mode->lut_size * mode->lut_size * mode->lut_size;
+
+ ASSERT(lut && drm_lut3d_size == size);
+
+ /* Stride and bit depth is not programmable by API so far. Therefore,
+ * only supports 17x17x17 3D LUT with 12-bit.
+ */
+ lut->lut_3d.use_tetrahedral_9 = mode->lut_size == 9;
+ lut->lut_3d.use_12bits = mode->bit_depth == 12;
+ lut->state.bits.initialized = 1;
+
+ __drm_3dlut_to_dc_3dlut(drm_lut, size, &lut->lut_3d,
+ lut->lut_3d.use_tetrahedral_9, mode->bit_depth);
+
+ stream->lut3d_func = lut;
+}
+
+/* amdgpu_dm_atomic_shaper_lut3d - set DRM CRTC shaper LUT and 3D LUT to DC
+ * interface
+ * @dc: Display Core control structure
+ * @stream: DC stream state to set shaper LUT and 3D LUT
+ * @drm_lut3d: DRM CRTC (user) 3D LUT
+ * @drm_lut3d_size: size of 3D LUT
+ *
+ * Returns:
+ * 0 on success.
+ */
+static int amdgpu_dm_atomic_shaper_lut3d(struct dc *dc,
+ struct dc_stream_state *stream,
+ const struct drm_color_lut *drm_lut3d,
+ uint32_t drm_lut3d_size,
+ const struct drm_mode_lut3d_mode *mode)
+{
+ struct dc_3dlut *lut3d_func_new;
+ struct dc_transfer_func *func_shaper_new;
+
+ lut3d_func_new = (struct dc_3dlut *) stream->lut3d_func;
+ func_shaper_new = (struct dc_transfer_func *) stream->func_shaper;
+
+ /* We don't get DRM shaper LUT yet. We assume the input color space is
+ * already delinearized, so we don't need a shaper LUT and we can just
+ * BYPASS.
+ */
+ func_shaper_new->type = TF_TYPE_BYPASS;
+ func_shaper_new->tf = TRANSFER_FUNCTION_LINEAR;
+ stream->func_shaper = func_shaper_new;
+
+ amdgpu_dm_atomic_lut3d(stream, drm_lut3d, drm_lut3d_size,
+ mode, lut3d_func_new);
+
+ return 0;
+}
+
+static const struct drm_mode_lut3d_mode *
+get_lut3d_mode(struct amdgpu_device *adev,
+ const struct drm_crtc_state *crtc_state)
+{
+ struct drm_property_blob *blob;
+
+ if (!has_mpc_lut3d_caps(&adev->dm))
+ return NULL;
+
+ blob = drm_property_lookup_blob(crtc_state->state->dev,
+ crtc_state->lut3d_mode);
+
+ return blob ? (const struct drm_mode_lut3d_mode *)blob->data : NULL;
+}
+
+/**
+ * amdgpu_dm_verify_lut3d_size - verifies if 3D LUT is supported and if DRM 3D
+ * LUT matches the hw supported size
+ * @adev: amdgpu device
+ * @crtc_state: the DRM CRTC state
+ *
+ * Verifies if post-blending (MPC) 3D LUT is supported by the HW (DCN 3.0 or
+ * newer) and if the DRM 3D LUT matches the supported size.
+ *
+ * Returns:
+ * 0 on success. -EINVAL if lut size are invalid.
+ */
+int amdgpu_dm_verify_lut3d_size(struct amdgpu_device *adev,
+ const struct drm_crtc_state *crtc_state)
+{
+ const struct drm_color_lut *lut3d = NULL;
+ const struct drm_mode_lut3d_mode *mode;
+ uint32_t exp_size, size;
+
+ mode = get_lut3d_mode(adev, crtc_state);
+ exp_size = mode ? mode->lut_size * mode->lut_size * mode->lut_size : 0;
+
+ lut3d = __extract_blob_lut(crtc_state->lut3d, &size);
+
+ if (lut3d && size != exp_size) {
+ DRM_DEBUG_DRIVER("Invalid Gamma 3D LUT size. Should be %u but got %u.\n",
+ exp_size, size);
+ return -EINVAL;
+ }
+
+ return 0;
+}
+
+
/**
* amdgpu_dm_update_crtc_color_mgmt: Maps DRM color management to DC stream.
* @crtc: amdgpu_dm crtc state
@@ -442,8 +611,11 @@ int amdgpu_dm_update_crtc_color_mgmt(struct dm_crtc_state *crtc)
bool has_rom = adev->asic_type <= CHIP_RAVEN;
struct drm_color_ctm *ctm = NULL;
const struct drm_color_lut *degamma_lut, *regamma_lut;
+ const struct drm_color_lut *lut3d;
uint32_t degamma_size, regamma_size;
+ uint32_t lut3d_size;
bool has_regamma, has_degamma;
+ bool has_lut3d;
bool is_legacy;
int r;

@@ -451,12 +623,19 @@ int amdgpu_dm_update_crtc_color_mgmt(struct dm_crtc_state *crtc)
if (r)
return r;

+ r = amdgpu_dm_verify_lut3d_size(adev, &crtc->base);
+ if (r)
+ return r;
+
degamma_lut = __extract_blob_lut(crtc->base.degamma_lut, &degamma_size);
+ lut3d = __extract_blob_lut(crtc->base.lut3d, &lut3d_size);
regamma_lut = __extract_blob_lut(crtc->base.gamma_lut, &regamma_size);

has_degamma =
degamma_lut && !__is_lut_linear(degamma_lut, degamma_size);

+ has_lut3d = lut3d != NULL;
+
has_regamma =
regamma_lut && !__is_lut_linear(regamma_lut, regamma_size);

@@ -494,6 +673,16 @@ int amdgpu_dm_update_crtc_color_mgmt(struct dm_crtc_state *crtc)
if (r)
return r;
} else {
+ if (has_lut3d) {
+ r = amdgpu_dm_atomic_shaper_lut3d(adev->dm.dc, stream, lut3d, lut3d_size,
+ get_lut3d_mode(adev, &crtc->base));
+ if (r)
+ return r;
+ }
+ /* Note: OGAM is disabled if 3D LUT is successfully programmed.
+ * See params and set_output_gamma in
+ * dcn30_set_output_transfer_func()
+ */
regamma_size = has_regamma ? regamma_size : 0;
r = amdgpu_dm_set_atomic_regamma(stream, regamma_lut, regamma_size);
if (r)
--
2.35.1

2023-06-13 16:01:43

by Jacopo Mondi

[permalink] [raw]
Subject: Re: [RFC PATCH v2 00/18] Add DRM CRTC 3D LUT interface

Hello

I'm completing the support for 3D LUT on R-Car DU peripheral
and I have used this series as a base.

I'm wondering, since quite some time has passed without any update if
this series is still a thing and it makes any sense for me to try to
bring it forward.

I'm asking as I've noticed:
"[PATCH 00/36] drm/amd/display: add AMD driver-specific properties for color mgmt"

which seems to supersede this proposal with driver-specific
properties.

I asked Melissa privately but I wasn't able to get an hold of her, so
if anyone has any clue feel free to reply :)

Thanks
j

On Mon, Jan 09, 2023 at 01:38:28PM -0100, Melissa Wen wrote:
> Hi,
>
> After collecting comments in different places, here is a second version
> of the work on adding DRM CRTC 3D LUT support to the current DRM color
> mgmt interface. In comparison to previous proposals [1][2][3], here we
> add 3D LUT before gamma 1D LUT, but also a shaper 1D LUT before 3D LUT,
> that means the following DRM CRTC color correction pipeline:
>
> Blend -> Degamma 1D LUT -> CTM -> Shaper 1D LUT -> 3D LUT -> Gamma 1D LUT
>
> and we also add a DRM CRTC LUT3D_MODE property, based on Alex Hung
> proposal for pre-blending 3D LUT [4] (Thanks!), instead of just a
> LUT3D_SIZE, that allows userspace to use different supported settings of
> 3D LUT, fitting VA-API and new color API better. In this sense, I
> adjusted the pre-blending proposal for post-blending usage.
>
> Patches 1-6 targets the addition of shaper LUT and 3D LUT properties to
> the current DRM CRTC color mgmt pipeline. Patch 6 can be considered an
> extra/optional patch to define a default value for LUT3D_MODE, inspired
> by what we do for the plane blend mode property (pre-multiplied).
>
> Patches 7-18 targets AMD display code to enable shaper and 3D LUT usage
> on DCN 301 (our HW case). Patches 7-9 performs code cleanups on current
> AMD DM colors code, patch 10 updates AMD stream in case of user 3D LUT
> changes, patch 11/12 rework AMD MPC 3D LUT resource handling by context
> for DCN 301 (easily extendible to other DCN families). Finally, from
> 13-18, we wire up SHAPER LUT, LUT3D and LUT3D MODE to AMD display
> driver, exposing modes supported by HW and programming user shaper and
> 3D LUT accordingly.
>
> Our target userspace is Gamescope/SteamOS.
>
> Basic IGT tests were based on [5][6] and are available here (in-progress):
> https://gitlab.freedesktop.org/mwen/igt-gpu-tools/-/commits/crtc-lut3d-api
>
> [1] https://lore.kernel.org/all/[email protected]/
> [2] https://github.com/vsyrjala/linux/commit/4d28e8ddf2a076f30f9e5bdc17cbb4656fe23e69
> [3] https://lore.kernel.org/amd-gfx/[email protected]/
> [4] https://lore.kernel.org/dri-devel/[email protected]/
> [5] https://patchwork.freedesktop.org/series/90165/
> [6] https://patchwork.freedesktop.org/series/109402/
> [VA_API] http://intel.github.io/libva/structVAProcFilterParameterBuffer3DLUT.html
> [KMS_pipe_API] https://gitlab.freedesktop.org/pq/color-and-hdr/-/issues/11
>
> Let me know your thoughts.
>
> Thanks,
>
> Melissa
>
> Alex Hung (2):
> drm: Add 3D LUT mode and its attributes
> drm/amd/display: Define 3D LUT struct for HDR planes
>
> Melissa Wen (16):
> drm/drm_color_mgmt: add shaper LUT to color mgmt properties
> drm/drm_color_mgmt: add 3D LUT props to DRM color mgmt
> drm/drm_color_mgmt: add function to create 3D LUT modes supported
> drm/drm_color_mgmt: add function to attach 3D LUT props
> drm/drm_color_mgmt: set first lut3d mode as default
> drm/amd/display: remove unused regamma condition
> drm/amd/display: add comments to describe DM crtc color mgmt behavior
> drm/amd/display: encapsulate atomic regamma operation
> drm/amd/display: update lut3d and shaper lut to stream
> drm/amd/display: handle MPC 3D LUT resources for a given context
> drm/amd/display: acquire/release 3D LUT resources for ctx on DCN301
> drm/amd/display: expand array of supported 3D LUT modes
> drm/amd/display: enable 3D-LUT DRM properties if supported
> drm/amd/display: add user 3D LUT support to the amdgpu_dm color
> pipeline
> drm/amd/display: decouple steps to reuse in shaper LUT support
> drm/amd/display: add user shaper LUT support to amdgpu_dm color
> pipeline
>
> .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 6 +
> .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h | 3 +
> .../amd/display/amdgpu_dm/amdgpu_dm_color.c | 370 ++++++++++++++++--
> .../amd/display/amdgpu_dm/amdgpu_dm_crtc.c | 2 +
> drivers/gpu/drm/amd/display/dc/core/dc.c | 49 ++-
> drivers/gpu/drm/amd/display/dc/dc.h | 8 +
> .../amd/display/dc/dcn301/dcn301_resource.c | 47 ++-
> .../amd/display/modules/color/color_gamma.h | 43 ++
> drivers/gpu/drm/drm_atomic_state_helper.c | 7 +
> drivers/gpu/drm/drm_atomic_uapi.c | 24 ++
> drivers/gpu/drm/drm_color_mgmt.c | 127 ++++++
> drivers/gpu/drm/drm_fb_helper.c | 5 +
> drivers/gpu/drm/drm_mode_config.c | 21 +
> include/drm/drm_color_mgmt.h | 8 +
> include/drm/drm_crtc.h | 32 +-
> include/drm/drm_mode_config.h | 25 ++
> include/drm/drm_mode_object.h | 2 +-
> include/uapi/drm/drm_mode.h | 17 +
> 18 files changed, 757 insertions(+), 39 deletions(-)
>
> --
> 2.35.1
>

2023-06-15 07:53:51

by Pekka Paalanen

[permalink] [raw]
Subject: Re: [RFC PATCH v2 00/18] Add DRM CRTC 3D LUT interface

On Tue, 13 Jun 2023 17:43:55 +0200
Jacopo Mondi <[email protected]> wrote:

> Hello
>
> I'm completing the support for 3D LUT on R-Car DU peripheral
> and I have used this series as a base.
>
> I'm wondering, since quite some time has passed without any update if
> this series is still a thing and it makes any sense for me to try to
> bring it forward.
>
> I'm asking as I've noticed:
> "[PATCH 00/36] drm/amd/display: add AMD driver-specific properties for color mgmt"
>
> which seems to supersede this proposal with driver-specific
> properties.
>
> I asked Melissa privately but I wasn't able to get an hold of her, so
> if anyone has any clue feel free to reply :)

Hi,

since no-one else replied, I'll point you to the thread starting at
https://lists.freedesktop.org/archives/dri-devel/2023-May/403173.html
and continuing to June. That is the plan of getting a common UAPI for
these things.


Thanks,
pq


>
> Thanks
> j
>
> On Mon, Jan 09, 2023 at 01:38:28PM -0100, Melissa Wen wrote:
> > Hi,
> >
> > After collecting comments in different places, here is a second version
> > of the work on adding DRM CRTC 3D LUT support to the current DRM color
> > mgmt interface. In comparison to previous proposals [1][2][3], here we
> > add 3D LUT before gamma 1D LUT, but also a shaper 1D LUT before 3D LUT,
> > that means the following DRM CRTC color correction pipeline:
> >
> > Blend -> Degamma 1D LUT -> CTM -> Shaper 1D LUT -> 3D LUT -> Gamma 1D LUT
> >
> > and we also add a DRM CRTC LUT3D_MODE property, based on Alex Hung
> > proposal for pre-blending 3D LUT [4] (Thanks!), instead of just a
> > LUT3D_SIZE, that allows userspace to use different supported settings of
> > 3D LUT, fitting VA-API and new color API better. In this sense, I
> > adjusted the pre-blending proposal for post-blending usage.
> >
> > Patches 1-6 targets the addition of shaper LUT and 3D LUT properties to
> > the current DRM CRTC color mgmt pipeline. Patch 6 can be considered an
> > extra/optional patch to define a default value for LUT3D_MODE, inspired
> > by what we do for the plane blend mode property (pre-multiplied).
> >
> > Patches 7-18 targets AMD display code to enable shaper and 3D LUT usage
> > on DCN 301 (our HW case). Patches 7-9 performs code cleanups on current
> > AMD DM colors code, patch 10 updates AMD stream in case of user 3D LUT
> > changes, patch 11/12 rework AMD MPC 3D LUT resource handling by context
> > for DCN 301 (easily extendible to other DCN families). Finally, from
> > 13-18, we wire up SHAPER LUT, LUT3D and LUT3D MODE to AMD display
> > driver, exposing modes supported by HW and programming user shaper and
> > 3D LUT accordingly.
> >
> > Our target userspace is Gamescope/SteamOS.
> >
> > Basic IGT tests were based on [5][6] and are available here (in-progress):
> > https://gitlab.freedesktop.org/mwen/igt-gpu-tools/-/commits/crtc-lut3d-api
> >
> > [1] https://lore.kernel.org/all/[email protected]/
> > [2] https://github.com/vsyrjala/linux/commit/4d28e8ddf2a076f30f9e5bdc17cbb4656fe23e69
> > [3] https://lore.kernel.org/amd-gfx/[email protected]/
> > [4] https://lore.kernel.org/dri-devel/[email protected]/
> > [5] https://patchwork.freedesktop.org/series/90165/
> > [6] https://patchwork.freedesktop.org/series/109402/
> > [VA_API] http://intel.github.io/libva/structVAProcFilterParameterBuffer3DLUT.html
> > [KMS_pipe_API] https://gitlab.freedesktop.org/pq/color-and-hdr/-/issues/11
> >
> > Let me know your thoughts.
> >
> > Thanks,
> >
> > Melissa
> >
> > Alex Hung (2):
> > drm: Add 3D LUT mode and its attributes
> > drm/amd/display: Define 3D LUT struct for HDR planes
> >
> > Melissa Wen (16):
> > drm/drm_color_mgmt: add shaper LUT to color mgmt properties
> > drm/drm_color_mgmt: add 3D LUT props to DRM color mgmt
> > drm/drm_color_mgmt: add function to create 3D LUT modes supported
> > drm/drm_color_mgmt: add function to attach 3D LUT props
> > drm/drm_color_mgmt: set first lut3d mode as default
> > drm/amd/display: remove unused regamma condition
> > drm/amd/display: add comments to describe DM crtc color mgmt behavior
> > drm/amd/display: encapsulate atomic regamma operation
> > drm/amd/display: update lut3d and shaper lut to stream
> > drm/amd/display: handle MPC 3D LUT resources for a given context
> > drm/amd/display: acquire/release 3D LUT resources for ctx on DCN301
> > drm/amd/display: expand array of supported 3D LUT modes
> > drm/amd/display: enable 3D-LUT DRM properties if supported
> > drm/amd/display: add user 3D LUT support to the amdgpu_dm color
> > pipeline
> > drm/amd/display: decouple steps to reuse in shaper LUT support
> > drm/amd/display: add user shaper LUT support to amdgpu_dm color
> > pipeline
> >
> > .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 6 +
> > .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h | 3 +
> > .../amd/display/amdgpu_dm/amdgpu_dm_color.c | 370 ++++++++++++++++--
> > .../amd/display/amdgpu_dm/amdgpu_dm_crtc.c | 2 +
> > drivers/gpu/drm/amd/display/dc/core/dc.c | 49 ++-
> > drivers/gpu/drm/amd/display/dc/dc.h | 8 +
> > .../amd/display/dc/dcn301/dcn301_resource.c | 47 ++-
> > .../amd/display/modules/color/color_gamma.h | 43 ++
> > drivers/gpu/drm/drm_atomic_state_helper.c | 7 +
> > drivers/gpu/drm/drm_atomic_uapi.c | 24 ++
> > drivers/gpu/drm/drm_color_mgmt.c | 127 ++++++
> > drivers/gpu/drm/drm_fb_helper.c | 5 +
> > drivers/gpu/drm/drm_mode_config.c | 21 +
> > include/drm/drm_color_mgmt.h | 8 +
> > include/drm/drm_crtc.h | 32 +-
> > include/drm/drm_mode_config.h | 25 ++
> > include/drm/drm_mode_object.h | 2 +-
> > include/uapi/drm/drm_mode.h | 17 +
> > 18 files changed, 757 insertions(+), 39 deletions(-)
> >
> > --
> > 2.35.1
> >


Attachments:
(No filename) (849.00 B)
OpenPGP digital signature

2023-06-15 08:15:51

by Jacopo Mondi

[permalink] [raw]
Subject: Re: [RFC PATCH v2 00/18] Add DRM CRTC 3D LUT interface

Hi Pekka
thanks for the reply

On Thu, Jun 15, 2023 at 10:14:05AM +0300, Pekka Paalanen wrote:
> On Tue, 13 Jun 2023 17:43:55 +0200
> Jacopo Mondi <[email protected]> wrote:
>
> > Hello
> >
> > I'm completing the support for 3D LUT on R-Car DU peripheral
> > and I have used this series as a base.
> >
> > I'm wondering, since quite some time has passed without any update if
> > this series is still a thing and it makes any sense for me to try to
> > bring it forward.
> >
> > I'm asking as I've noticed:
> > "[PATCH 00/36] drm/amd/display: add AMD driver-specific properties for color mgmt"
> >
> > which seems to supersede this proposal with driver-specific
> > properties.
> >
> > I asked Melissa privately but I wasn't able to get an hold of her, so
> > if anyone has any clue feel free to reply :)
>
> Hi,
>
> since no-one else replied, I'll point you to the thread starting at
> https://lists.freedesktop.org/archives/dri-devel/2023-May/403173.html

Yes, Melissa pointed me to that series privately yesterday.

However, and here I might be missing something, per-plane properties do
not apply well to the HW pipeline I'm looking at.

The R-Car DU has a 1D LUT and a 3D LUT at the CRTC level (I guess
'post blending' is the right term here) ? A per-plane property
doesn't seem to match how the HW work, but please feel free to correct
me as this is all rather new to me and I might be overlooking
something.

My plan at the moment would have been to base my work on Melissa's RFC
and re-send to prop discussions, unless it is certainly a dead-end and
I have missed how to properly use per-plane properties on our HW.

Thank you!

> and continuing to June. That is the plan of getting a common UAPI for
> these things.
>
>
> Thanks,
> pq
>
>
> >
> > Thanks
> > j
> >
> > On Mon, Jan 09, 2023 at 01:38:28PM -0100, Melissa Wen wrote:
> > > Hi,
> > >
> > > After collecting comments in different places, here is a second version
> > > of the work on adding DRM CRTC 3D LUT support to the current DRM color
> > > mgmt interface. In comparison to previous proposals [1][2][3], here we
> > > add 3D LUT before gamma 1D LUT, but also a shaper 1D LUT before 3D LUT,
> > > that means the following DRM CRTC color correction pipeline:
> > >
> > > Blend -> Degamma 1D LUT -> CTM -> Shaper 1D LUT -> 3D LUT -> Gamma 1D LUT
> > >
> > > and we also add a DRM CRTC LUT3D_MODE property, based on Alex Hung
> > > proposal for pre-blending 3D LUT [4] (Thanks!), instead of just a
> > > LUT3D_SIZE, that allows userspace to use different supported settings of
> > > 3D LUT, fitting VA-API and new color API better. In this sense, I
> > > adjusted the pre-blending proposal for post-blending usage.
> > >
> > > Patches 1-6 targets the addition of shaper LUT and 3D LUT properties to
> > > the current DRM CRTC color mgmt pipeline. Patch 6 can be considered an
> > > extra/optional patch to define a default value for LUT3D_MODE, inspired
> > > by what we do for the plane blend mode property (pre-multiplied).
> > >
> > > Patches 7-18 targets AMD display code to enable shaper and 3D LUT usage
> > > on DCN 301 (our HW case). Patches 7-9 performs code cleanups on current
> > > AMD DM colors code, patch 10 updates AMD stream in case of user 3D LUT
> > > changes, patch 11/12 rework AMD MPC 3D LUT resource handling by context
> > > for DCN 301 (easily extendible to other DCN families). Finally, from
> > > 13-18, we wire up SHAPER LUT, LUT3D and LUT3D MODE to AMD display
> > > driver, exposing modes supported by HW and programming user shaper and
> > > 3D LUT accordingly.
> > >
> > > Our target userspace is Gamescope/SteamOS.
> > >
> > > Basic IGT tests were based on [5][6] and are available here (in-progress):
> > > https://gitlab.freedesktop.org/mwen/igt-gpu-tools/-/commits/crtc-lut3d-api
> > >
> > > [1] https://lore.kernel.org/all/[email protected]/
> > > [2] https://github.com/vsyrjala/linux/commit/4d28e8ddf2a076f30f9e5bdc17cbb4656fe23e69
> > > [3] https://lore.kernel.org/amd-gfx/[email protected]/
> > > [4] https://lore.kernel.org/dri-devel/[email protected]/
> > > [5] https://patchwork.freedesktop.org/series/90165/
> > > [6] https://patchwork.freedesktop.org/series/109402/
> > > [VA_API] http://intel.github.io/libva/structVAProcFilterParameterBuffer3DLUT.html
> > > [KMS_pipe_API] https://gitlab.freedesktop.org/pq/color-and-hdr/-/issues/11
> > >
> > > Let me know your thoughts.
> > >
> > > Thanks,
> > >
> > > Melissa
> > >
> > > Alex Hung (2):
> > > drm: Add 3D LUT mode and its attributes
> > > drm/amd/display: Define 3D LUT struct for HDR planes
> > >
> > > Melissa Wen (16):
> > > drm/drm_color_mgmt: add shaper LUT to color mgmt properties
> > > drm/drm_color_mgmt: add 3D LUT props to DRM color mgmt
> > > drm/drm_color_mgmt: add function to create 3D LUT modes supported
> > > drm/drm_color_mgmt: add function to attach 3D LUT props
> > > drm/drm_color_mgmt: set first lut3d mode as default
> > > drm/amd/display: remove unused regamma condition
> > > drm/amd/display: add comments to describe DM crtc color mgmt behavior
> > > drm/amd/display: encapsulate atomic regamma operation
> > > drm/amd/display: update lut3d and shaper lut to stream
> > > drm/amd/display: handle MPC 3D LUT resources for a given context
> > > drm/amd/display: acquire/release 3D LUT resources for ctx on DCN301
> > > drm/amd/display: expand array of supported 3D LUT modes
> > > drm/amd/display: enable 3D-LUT DRM properties if supported
> > > drm/amd/display: add user 3D LUT support to the amdgpu_dm color
> > > pipeline
> > > drm/amd/display: decouple steps to reuse in shaper LUT support
> > > drm/amd/display: add user shaper LUT support to amdgpu_dm color
> > > pipeline
> > >
> > > .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 6 +
> > > .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h | 3 +
> > > .../amd/display/amdgpu_dm/amdgpu_dm_color.c | 370 ++++++++++++++++--
> > > .../amd/display/amdgpu_dm/amdgpu_dm_crtc.c | 2 +
> > > drivers/gpu/drm/amd/display/dc/core/dc.c | 49 ++-
> > > drivers/gpu/drm/amd/display/dc/dc.h | 8 +
> > > .../amd/display/dc/dcn301/dcn301_resource.c | 47 ++-
> > > .../amd/display/modules/color/color_gamma.h | 43 ++
> > > drivers/gpu/drm/drm_atomic_state_helper.c | 7 +
> > > drivers/gpu/drm/drm_atomic_uapi.c | 24 ++
> > > drivers/gpu/drm/drm_color_mgmt.c | 127 ++++++
> > > drivers/gpu/drm/drm_fb_helper.c | 5 +
> > > drivers/gpu/drm/drm_mode_config.c | 21 +
> > > include/drm/drm_color_mgmt.h | 8 +
> > > include/drm/drm_crtc.h | 32 +-
> > > include/drm/drm_mode_config.h | 25 ++
> > > include/drm/drm_mode_object.h | 2 +-
> > > include/uapi/drm/drm_mode.h | 17 +
> > > 18 files changed, 757 insertions(+), 39 deletions(-)
> > >
> > > --
> > > 2.35.1
> > >
>



Attachments:
(No filename) (7.06 kB)
signature.asc (849.00 B)
Download all attachments

2023-06-15 10:57:22

by Pekka Paalanen

[permalink] [raw]
Subject: Re: [RFC PATCH v2 00/18] Add DRM CRTC 3D LUT interface

On Thu, 15 Jun 2023 10:07:35 +0200
Jacopo Mondi <[email protected]> wrote:

> Hi Pekka
> thanks for the reply
>
> On Thu, Jun 15, 2023 at 10:14:05AM +0300, Pekka Paalanen wrote:
> > On Tue, 13 Jun 2023 17:43:55 +0200
> > Jacopo Mondi <[email protected]> wrote:
> >
> > > Hello
> > >
> > > I'm completing the support for 3D LUT on R-Car DU peripheral
> > > and I have used this series as a base.
> > >
> > > I'm wondering, since quite some time has passed without any update if
> > > this series is still a thing and it makes any sense for me to try to
> > > bring it forward.
> > >
> > > I'm asking as I've noticed:
> > > "[PATCH 00/36] drm/amd/display: add AMD driver-specific properties for color mgmt"
> > >
> > > which seems to supersede this proposal with driver-specific
> > > properties.
> > >
> > > I asked Melissa privately but I wasn't able to get an hold of her, so
> > > if anyone has any clue feel free to reply :)
> >
> > Hi,
> >
> > since no-one else replied, I'll point you to the thread starting at
> > https://lists.freedesktop.org/archives/dri-devel/2023-May/403173.html
>
> Yes, Melissa pointed me to that series privately yesterday.
>
> However, and here I might be missing something, per-plane properties do
> not apply well to the HW pipeline I'm looking at.
>
> The R-Car DU has a 1D LUT and a 3D LUT at the CRTC level (I guess
> 'post blending' is the right term here) ? A per-plane property
> doesn't seem to match how the HW work, but please feel free to correct
> me as this is all rather new to me and I might be overlooking
> something.

Post-blending, correct. The long term plan is to replicate the same
idea to post-blending as it is planned for pre-blending.

>
> My plan at the moment would have been to base my work on Melissa's RFC
> and re-send to prop discussions, unless it is certainly a dead-end and
> I have missed how to properly use per-plane properties on our HW.

I'm not a kernel dev nor a maintainer, so I can't comment on what would
be acceptable in the mean time before the new pipeline design is
implemented. The long term plan is to supersede all existing color
transformation related properties with pipelines.


Thanks,
pq

>
> Thank you!
>
> > and continuing to June. That is the plan of getting a common UAPI for
> > these things.
> >
> >
> > Thanks,
> > pq
> >
> >
> > >
> > > Thanks
> > > j
> > >
> > > On Mon, Jan 09, 2023 at 01:38:28PM -0100, Melissa Wen wrote:
> > > > Hi,
> > > >
> > > > After collecting comments in different places, here is a second version
> > > > of the work on adding DRM CRTC 3D LUT support to the current DRM color
> > > > mgmt interface. In comparison to previous proposals [1][2][3], here we
> > > > add 3D LUT before gamma 1D LUT, but also a shaper 1D LUT before 3D LUT,
> > > > that means the following DRM CRTC color correction pipeline:
> > > >
> > > > Blend -> Degamma 1D LUT -> CTM -> Shaper 1D LUT -> 3D LUT -> Gamma 1D LUT
> > > >
> > > > and we also add a DRM CRTC LUT3D_MODE property, based on Alex Hung
> > > > proposal for pre-blending 3D LUT [4] (Thanks!), instead of just a
> > > > LUT3D_SIZE, that allows userspace to use different supported settings of
> > > > 3D LUT, fitting VA-API and new color API better. In this sense, I
> > > > adjusted the pre-blending proposal for post-blending usage.
> > > >
> > > > Patches 1-6 targets the addition of shaper LUT and 3D LUT properties to
> > > > the current DRM CRTC color mgmt pipeline. Patch 6 can be considered an
> > > > extra/optional patch to define a default value for LUT3D_MODE, inspired
> > > > by what we do for the plane blend mode property (pre-multiplied).
> > > >
> > > > Patches 7-18 targets AMD display code to enable shaper and 3D LUT usage
> > > > on DCN 301 (our HW case). Patches 7-9 performs code cleanups on current
> > > > AMD DM colors code, patch 10 updates AMD stream in case of user 3D LUT
> > > > changes, patch 11/12 rework AMD MPC 3D LUT resource handling by context
> > > > for DCN 301 (easily extendible to other DCN families). Finally, from
> > > > 13-18, we wire up SHAPER LUT, LUT3D and LUT3D MODE to AMD display
> > > > driver, exposing modes supported by HW and programming user shaper and
> > > > 3D LUT accordingly.
> > > >
> > > > Our target userspace is Gamescope/SteamOS.
> > > >
> > > > Basic IGT tests were based on [5][6] and are available here (in-progress):
> > > > https://gitlab.freedesktop.org/mwen/igt-gpu-tools/-/commits/crtc-lut3d-api
> > > >
> > > > [1] https://lore.kernel.org/all/[email protected]/
> > > > [2] https://github.com/vsyrjala/linux/commit/4d28e8ddf2a076f30f9e5bdc17cbb4656fe23e69
> > > > [3] https://lore.kernel.org/amd-gfx/[email protected]/
> > > > [4] https://lore.kernel.org/dri-devel/[email protected]/
> > > > [5] https://patchwork.freedesktop.org/series/90165/
> > > > [6] https://patchwork.freedesktop.org/series/109402/
> > > > [VA_API] http://intel.github.io/libva/structVAProcFilterParameterBuffer3DLUT.html
> > > > [KMS_pipe_API] https://gitlab.freedesktop.org/pq/color-and-hdr/-/issues/11
> > > >
> > > > Let me know your thoughts.
> > > >
> > > > Thanks,
> > > >
> > > > Melissa
> > > >
> > > > Alex Hung (2):
> > > > drm: Add 3D LUT mode and its attributes
> > > > drm/amd/display: Define 3D LUT struct for HDR planes
> > > >
> > > > Melissa Wen (16):
> > > > drm/drm_color_mgmt: add shaper LUT to color mgmt properties
> > > > drm/drm_color_mgmt: add 3D LUT props to DRM color mgmt
> > > > drm/drm_color_mgmt: add function to create 3D LUT modes supported
> > > > drm/drm_color_mgmt: add function to attach 3D LUT props
> > > > drm/drm_color_mgmt: set first lut3d mode as default
> > > > drm/amd/display: remove unused regamma condition
> > > > drm/amd/display: add comments to describe DM crtc color mgmt behavior
> > > > drm/amd/display: encapsulate atomic regamma operation
> > > > drm/amd/display: update lut3d and shaper lut to stream
> > > > drm/amd/display: handle MPC 3D LUT resources for a given context
> > > > drm/amd/display: acquire/release 3D LUT resources for ctx on DCN301
> > > > drm/amd/display: expand array of supported 3D LUT modes
> > > > drm/amd/display: enable 3D-LUT DRM properties if supported
> > > > drm/amd/display: add user 3D LUT support to the amdgpu_dm color
> > > > pipeline
> > > > drm/amd/display: decouple steps to reuse in shaper LUT support
> > > > drm/amd/display: add user shaper LUT support to amdgpu_dm color
> > > > pipeline
> > > >
> > > > .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 6 +
> > > > .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h | 3 +
> > > > .../amd/display/amdgpu_dm/amdgpu_dm_color.c | 370 ++++++++++++++++--
> > > > .../amd/display/amdgpu_dm/amdgpu_dm_crtc.c | 2 +
> > > > drivers/gpu/drm/amd/display/dc/core/dc.c | 49 ++-
> > > > drivers/gpu/drm/amd/display/dc/dc.h | 8 +
> > > > .../amd/display/dc/dcn301/dcn301_resource.c | 47 ++-
> > > > .../amd/display/modules/color/color_gamma.h | 43 ++
> > > > drivers/gpu/drm/drm_atomic_state_helper.c | 7 +
> > > > drivers/gpu/drm/drm_atomic_uapi.c | 24 ++
> > > > drivers/gpu/drm/drm_color_mgmt.c | 127 ++++++
> > > > drivers/gpu/drm/drm_fb_helper.c | 5 +
> > > > drivers/gpu/drm/drm_mode_config.c | 21 +
> > > > include/drm/drm_color_mgmt.h | 8 +
> > > > include/drm/drm_crtc.h | 32 +-
> > > > include/drm/drm_mode_config.h | 25 ++
> > > > include/drm/drm_mode_object.h | 2 +-
> > > > include/uapi/drm/drm_mode.h | 17 +
> > > > 18 files changed, 757 insertions(+), 39 deletions(-)
> > > >
> > > > --
> > > > 2.35.1
> > > >
> >
>
>


Attachments:
(No filename) (849.00 B)
OpenPGP digital signature