aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/files/0624-drm-amd-dal-Add-new-gamma-ramp-interface-to-dc.patch
blob: 902e118daa35312fbbcf1a3c6341f0eb75b1c061 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
From b32b1a0948a3ee9817e9b3ea421ffe74f09a4103 Mon Sep 17 00:00:00 2001
From: Jun Lei <Jun.Lei@amd.com>
Date: Wed, 16 Dec 2015 14:41:31 -0500
Subject: [PATCH 0624/1110] drm/amd/dal: Add new gamma ramp interface to dc

Signed-off-by: Jun Lei <Jun.Lei@amd.com>
Acked-by: Jordan Lazare <Jordan.Lazare@amd.com>
---
 drivers/gpu/drm/amd/dal/dc/dc.h       |  3 ++-
 drivers/gpu/drm/amd/dal/dc/dc_types.h | 32 ++++++++++++++++++++++++++++++++
 2 files changed, 34 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/dal/dc/dc.h b/drivers/gpu/drm/amd/dal/dc/dc.h
index 264b428..c9cdd9c 100644
--- a/drivers/gpu/drm/amd/dal/dc/dc.h
+++ b/drivers/gpu/drm/amd/dal/dc/dc.h
@@ -75,7 +75,8 @@ struct dc_surface {
 	enum dc_rotation_angle rotation;
 	enum plane_stereo_format stereo_format;
 
-	struct gamma_ramp gamma_correction;
+	struct gamma_ramp gamma_correction; /* deprecated */
+	struct dc_gamma_ramp gamma;
 };
 
 /*
diff --git a/drivers/gpu/drm/amd/dal/dc/dc_types.h b/drivers/gpu/drm/amd/dal/dc/dc_types.h
index b6526e9..1834fe0 100644
--- a/drivers/gpu/drm/amd/dal/dc/dc_types.h
+++ b/drivers/gpu/drm/amd/dal/dc/dc_types.h
@@ -665,6 +665,38 @@ enum dc_connection_type {
 	dc_connection_active_dongle
 };
 
+/*
+ * Gamma ramp representation in DC
+ *
+ * A gamma ramp is just a curve defined within the range of [min, max] with
+ * arbitrary precision.
+ *
+ * DM is responsible for providing DC with an interface to obtain any y value
+ * within that range with a selected precision.
+ *
+ * bit32 ------------------------------------------------- bit 0
+ *       [  padding  ][ exponent bits ][  fraction bits  ]
+ *
+ * DC specifies the input x value and precision to the callback function
+ * get_gamma_value as well as providing the context and DM returns the y
+ * value.
+ *
+ * If fraction_bits + exponent_bits exceed width of 32 bits, get_gamma_value
+ * returns 0.  If x is outside the bounds of [min, max], get_gamma_value
+ * returns 0.
+ *
+ */
+struct dc_gamma_ramp {
+	uint32_t (*get_gamma_value) (
+			void *context,
+			uint8_t exponent_bits,
+			uint8_t fraction_bits,
+			uint32_t x);
+	void *context;
+	uint32_t min;
+	uint32_t max;
+};
+
 struct dc_csc_adjustments {
 	struct fixed31_32 contrast;
 	struct fixed31_32 saturation;
-- 
2.7.4