[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230109143846.1966301-6-mwen@igalia.com>
Date: Mon, 9 Jan 2023 13:38:33 -0100
From: Melissa Wen <mwen@...lia.com>
To: maarten.lankhorst@...ux.intel.com, mripard@...nel.org,
tzimmermann@...e.de, airlied@...il.com, daniel@...ll.ch
Cc: Joshua Ashton <joshua@...ggi.es>, alex.hung@....com,
nicholas.kazlauskas@....com, sungjoon.kim@....com,
seanpaul@...omium.org, bhawanpreet.lakha@....com,
Shashank Sharma <shashank.sharma@....com>,
ville.syrjala@...ux.intel.com, kernel-dev@...lia.com,
laurent.pinchart+renesas@...asonboard.com,
Melissa Wen <mwen@...lia.com>, dri-devel@...ts.freedesktop.org,
linux-kernel@...r.kernel.org
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 <mwen@...lia.com>
---
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
Powered by blists - more mailing lists