aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/0075-drm-amd-display-Fix-distribution-of-segments-for-PQ.patch
blob: 02000d995ba1f5ccc32df5f96407d105de16edbd (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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
From dcbd3c03aa29210c440812be3d2928f248e89a74 Mon Sep 17 00:00:00 2001
From: Anthony Koo <Anthony.Koo@amd.com>
Date: Fri, 16 Dec 2016 12:12:03 -0500
Subject: [PATCH 0075/4131] drm/amd/display: Fix distribution of segments for
 PQ

For PQ case, redistribution of segments should be done differently
for FP16 case in order to handle content above FP16 value of 1.0

Signed-off-by: Anthony Koo <anthony.koo@amd.com>
Reviewed-by: Aric Cyr <Aric.Cyr@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/display/dc/calcs/gamma_calcs.c | 51 ++++++++++++++++++++--
 1 file changed, 48 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/calcs/gamma_calcs.c b/drivers/gpu/drm/amd/display/dc/calcs/gamma_calcs.c
index 973be8f..729652a 100644
--- a/drivers/gpu/drm/amd/display/dc/calcs/gamma_calcs.c
+++ b/drivers/gpu/drm/amd/display/dc/calcs/gamma_calcs.c
@@ -387,6 +387,49 @@ static bool build_hw_curve_configuration(
 	return result;
 }
 
+static bool setup_distribution_points_pq(
+		struct gamma_curve *arr_curve_points,
+		struct curve_points *arr_points,
+		uint32_t *hw_points_num,
+		struct hw_x_point *coordinates_x,
+		enum surface_pixel_format format)
+{
+	struct curve_config cfg;
+
+	cfg.offset = 0;
+	cfg.segments[0] = 2;
+	cfg.segments[1] = 2;
+	cfg.segments[2] = 2;
+	cfg.segments[3] = 2;
+	cfg.segments[4] = 2;
+	cfg.segments[5] = 2;
+	cfg.segments[6] = 3;
+	cfg.segments[7] = 4;
+	cfg.segments[8] = 4;
+	cfg.segments[9] = 4;
+	cfg.segments[10] = 4;
+	cfg.segments[11] = 5;
+	cfg.segments[12] = 5;
+	cfg.segments[13] = 5;
+	cfg.segments[14] = 5;
+	cfg.segments[15] = 5;
+
+	if (format == SURFACE_PIXEL_FORMAT_GRPH_ARGB16161616F ||
+			format == SURFACE_PIXEL_FORMAT_GRPH_ABGR16161616F)
+		cfg.begin = -11;
+	else
+		cfg.begin = -16;
+
+	if (!build_hw_curve_configuration(
+		&cfg, arr_curve_points,
+		arr_points,
+		coordinates_x, hw_points_num)) {
+		ASSERT_CRITICAL(false);
+		return false;
+	}
+	return true;
+}
+
 static bool setup_distribution_points(
 		struct gamma_curve *arr_curve_points,
 		struct curve_points *arr_points,
@@ -1414,15 +1457,17 @@ bool calculate_regamma_params(struct pwl_params *params,
 
 	scale_gamma(rgb_user, ramp, dividers);
 
-	setup_distribution_points(arr_curve_points, arr_points,
-			&params->hw_points_num, coordinates_x);
-
 	if (stream->public.out_transfer_func &&
 		stream->public.out_transfer_func->tf == TRANSFER_FUNCTION_PQ) {
+		setup_distribution_points_pq(arr_curve_points, arr_points,
+				&params->hw_points_num, coordinates_x,
+				surface->public.format);
 		build_regamma_curve_pq(rgb_regamma, rgb_oem, coeff128_oem,
 				ramp, surface, params->hw_points_num,
 				coordinates_x, axix_x_256, dividers);
 	} else {
+		setup_distribution_points(arr_curve_points, arr_points,
+				&params->hw_points_num, coordinates_x);
 		build_regamma_curve(rgb_regamma, rgb_oem, coeff128_oem,
 				ramp, surface, params->hw_points_num,
 				coordinates_x, axix_x_256, dividers);
-- 
2.7.4