[PATCH 2/7] drm/vkms: Add comments

From: Arthur Grillo
Date: Wed Mar 06 2024 - 15:04:19 EST


Signed-off-by: Arthur Grillo <arthurgrillo@xxxxxxxxxx>
---
drivers/gpu/drm/vkms/vkms_formats.c | 47 +++++++++++++++++++++++++++++++++++++
1 file changed, 47 insertions(+)

diff --git a/drivers/gpu/drm/vkms/vkms_formats.c b/drivers/gpu/drm/vkms/vkms_formats.c
index 44d9b9b3bdc3..55ed3f598bd7 100644
--- a/drivers/gpu/drm/vkms/vkms_formats.c
+++ b/drivers/gpu/drm/vkms/vkms_formats.c
@@ -577,6 +577,18 @@ get_conversion_matrix_to_argb_u16(u32 format, enum drm_color_encoding encoding,
},
.y_offset = 0,
};
+
+ /*
+ * Those matrixies were generated using the colour python framework
+ *
+ * Below are the function calls used to generate eac matrix, go to
+ * https://colour.readthedocs.io/en/develop/generated/colour.matrix_YCbCr.html
+ * for more info:
+ *
+ * numpy.around(colour.matrix_YCbCr(K=colour.WEIGHTS_YCBCR["ITU-R BT.601"],
+ * is_legal = False,
+ * bits = 8) * 2**32).astype(int)
+ */
static struct conversion_matrix yuv_bt601_full = {
.matrix = {
{ 4294967296, 0, 6021544149 },
@@ -585,6 +597,12 @@ get_conversion_matrix_to_argb_u16(u32 format, enum drm_color_encoding encoding,
},
.y_offset = 0,
};
+
+ /*
+ * numpy.around(colour.matrix_YCbCr(K=colour.WEIGHTS_YCBCR["ITU-R BT.601"],
+ * is_legal = True,
+ * bits = 8) * 2**32).astype(int)
+ */
static struct conversion_matrix yuv_bt601_limited = {
.matrix = {
{ 5020601039, 0, 6881764740 },
@@ -593,6 +611,12 @@ get_conversion_matrix_to_argb_u16(u32 format, enum drm_color_encoding encoding,
},
.y_offset = 16,
};
+
+ /*
+ * numpy.around(colour.matrix_YCbCr(K=colour.WEIGHTS_YCBCR["ITU-R BT.709"],
+ * is_legal = False,
+ * bits = 8) * 2**32).astype(int)
+ */
static struct conversion_matrix yuv_bt709_full = {
.matrix = {
{ 4294967296, 0, 6763714498 },
@@ -601,6 +625,12 @@ get_conversion_matrix_to_argb_u16(u32 format, enum drm_color_encoding encoding,
},
.y_offset = 0,
};
+
+ /*
+ * numpy.around(colour.matrix_YCbCr(K=colour.WEIGHTS_YCBCR["ITU-R BT.709"],
+ * is_legal = True,
+ * bits = 8) * 2**32).astype(int)
+ */
static struct conversion_matrix yuv_bt709_limited = {
.matrix = {
{ 5020601039, 0, 7729959424 },
@@ -609,6 +639,12 @@ get_conversion_matrix_to_argb_u16(u32 format, enum drm_color_encoding encoding,
},
.y_offset = 16,
};
+
+ /*
+ * numpy.around(colour.matrix_YCbCr(K=colour.WEIGHTS_YCBCR["ITU-R BT.2020"],
+ * is_legal = False,
+ * bits = 8) * 2**32).astype(int)
+ */
static struct conversion_matrix yuv_bt2020_full = {
.matrix = {
{ 4294967296, 0, 6333358775 },
@@ -617,6 +653,12 @@ get_conversion_matrix_to_argb_u16(u32 format, enum drm_color_encoding encoding,
},
.y_offset = 0,
};
+
+ /*
+ * numpy.around(colour.matrix_YCbCr(K=colour.WEIGHTS_YCBCR["ITU-R BT.2020"],
+ * is_legal = True,
+ * bits = 8) * 2**32).astype(int)
+ */
static struct conversion_matrix yuv_bt2020_limited = {
.matrix = {
{ 5020601039, 0, 7238124312 },
@@ -625,6 +667,11 @@ get_conversion_matrix_to_argb_u16(u32 format, enum drm_color_encoding encoding,
},
.y_offset = 16,
};
+
+ /*
+ * The next matrices are just the previous ones, but with the first and
+ * second columns swapped
+ */
static struct conversion_matrix yvu_bt601_full = {
.matrix = {
{ 4294967296, 6021544149, 0 },

--
2.43.0