diff mbox series

[v7,2/4] drm: Define ImageEnhancemenT LUT structures exposed to user

Message ID 20241218-dpst-v7-2-81bfe7d08c2d@intel.com (mailing list archive)
State New
Headers show
Series Display Global Histogram | expand

Commit Message

Arun R Murthy Dec. 18, 2024, 2:52 p.m. UTC
ImageEnhancemenT(IET) hardware interpolates the LUT value to generate
the enhanced output image. LUT takes an input value, outputs a new
value based on the data within the LUT. 1D LUT can remap individual
input values to new output values based on the LUT sample. LUT can be
interpolated by the hardware by multiple modes Ex: Direct Lookup LUT,
Multiplicative LUT etc
The list of supported mode by hardware along with the format(exponent
mantissa) is exposed to user by the iet_lut_caps property. Maximum
format being 8.24 i.e 8 exponent and 24 mantissa.
For illustration a hardware supporting 1.9 format denotes this as
0x10001FF. In order to know the exponent do a bitwise AND with
0xF000000. The LUT value to be provided by user would be a 10bit value
with 1 bit integer and 9 bit fractional value.

Multiple formats can be supported, hence pointer is used over here.
User can then provide the LUT with any one of the supported modes in
any of the supported formats.
The entries in the LUT can vary depending on the hardware capability
with max being 255. This will also be exposed as iet_lut_caps so user
can generate a LUT with the specified entries.

Signed-off-by: Arun R Murthy <arun.r.murthy@intel.com>
---
 include/uapi/drm/drm_mode.h | 46 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)
diff mbox series

Patch

diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h
index 7a7039381142bb5dba269bdaec42c18be34e2d05..34a6f48078fe7ff067002a459835c9af57d18848 100644
--- a/include/uapi/drm/drm_mode.h
+++ b/include/uapi/drm/drm_mode.h
@@ -1367,6 +1367,17 @@  struct drm_mode_closefb {
  */
 #define DRM_MODE_HISTOGRAM_HSV_MAX_RGB			(1 << 0)
 
+/* LUT values are points on exponential graph with x axis and y-axis y=f(x) */
+#define DRM_MODE_IET_LOOKUP_LUT				(1 << 0)
+/*
+ * LUT values, points on negative exponential graph with x-axis and y-axis
+ * y = y/x so upon multiplying x, y is obtained, hence multiplicative. The
+ * format of LUT can at max be 8.24(8integer 24 fractional) represented by
+ * u32. Depending on the hardware capability and exponent mantissa can be
+ * chosen.
+ */
+#define DRM_MODE_IET_MULTIPLICATIVE			(1 << 1)
+
 /**
  * struct drm_histogram_caps
  *
@@ -1414,6 +1425,41 @@  struct drm_histogram {
 	__u32 nr_elements;
 };
 
+/**
+ * struct drm_iet_caps
+ *
+ * @iet_mode: pixel factor enhancement modes defined in the above macros
+ * @iet_sample_format: holds the address of an array of u32 LUT sample formats
+ *		       depending on the hardware capability. Max being 8.24
+ *		       Doing a bitwise AND will get the present sample.
+ *		       Ex: for 1 integer 9 fraction AND with 0x10001FF
+ */
+struct drm_iet_caps {
+	u8 iet_mode;
+	u64 iet_sample_format;
+	__u32 nr_iet_sample_formats;
+};
+
+/**
+ * struct drm_iet_1dlut_sample
+ * @iet_mode: image enhancement mode, this will also convey the channel.
+ * @iet_format: LUT exponent and mantissa format, max being 8.24
+ * @data_ptr: pointer to the array of values which is of type u32.
+ *	      1 channel: 10 bit corrected value and remaining bits are reserved.
+ *	      multi channel: pointer to struct drm_color_lut
+ * @nr_elements: number of entries pointed by the data @data_ptr
+ * @reserved: reserved for future use
+ * @reserved1: reserved for future use
+ */
+struct drm_iet_1dlut_sample {
+	__u8 iet_mode;
+	__u32 iet_format;
+	__u64 data_ptr;
+	__u32 nr_elements;
+	__u32 reserved;
+	__u32 reserved1;
+};
+
 #if defined(__cplusplus)
 }
 #endif