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
|
From 5ce4c024e614a0a2187ca66fdf5da5a739c7f493 Mon Sep 17 00:00:00 2001
From: Amy Zhang <Amy.Zhang@amd.com>
Date: Mon, 12 Dec 2016 10:32:24 -0500
Subject: [PATCH 0057/4131] drm/amd/display: Fix Gamma Adjustment
- Gamma correction is not properly copied to the surface after refactor
- Make sure gamma correction is copied with correct retain
Signed-off-by: Amy Zhang <Amy.Zhang@amd.com>
Reviewed-by: Anthony Koo <Anthony.Koo@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/core/dc.c | 14 ++++++++++++--
drivers/gpu/drm/amd/display/dc/core/dc_surface.c | 3 ++-
drivers/gpu/drm/amd/display/dc/dc.h | 1 +
3 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c
index de99d71..41df500 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc.c
@@ -1302,8 +1302,8 @@ bool dc_commit_surfaces_to_target(
for (i = 0; i < new_surface_count; i++) {
updates[i].surface = new_surfaces[i];
- updates[i].gamma = (struct dc_gamma *)new_surfaces[i]->gamma_correction;
-
+ updates[i].gamma =
+ (struct dc_gamma *)new_surfaces[i]->gamma_correction;
flip_addr[i].address = new_surfaces[i]->address;
flip_addr[i].flip_immediate = new_surfaces[i]->flip_immediate;
plane_info[i].color_space = new_surfaces[i]->color_space;
@@ -1444,6 +1444,16 @@ void dc_update_surfaces_for_target(struct dc *dc, struct dc_surface_update *upda
pipe_ctx->scl_data.recout.width -= 2;
}
}
+
+ if (updates[i].gamma) {
+ if (surface->public.gamma_correction != NULL)
+ dc_gamma_release(surface->public.
+ gamma_correction);
+
+ dc_gamma_retain(updates[i].gamma);
+ surface->public.gamma_correction =
+ updates[i].gamma;
+ }
}
}
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_surface.c b/drivers/gpu/drm/amd/display/dc/core/dc_surface.c
index 045005e..813c37e 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_surface.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_surface.c
@@ -64,7 +64,8 @@ static bool construct(struct dc_context *ctx, struct surface *surface)
static void destruct(struct surface *surface)
{
-
+ if (surface->protected.public.gamma_correction != NULL)
+ dc_gamma_release(surface->protected.public.gamma_correction);
}
/*******************************************************************************
diff --git a/drivers/gpu/drm/amd/display/dc/dc.h b/drivers/gpu/drm/amd/display/dc/dc.h
index 454485b..d9e2ed1 100644
--- a/drivers/gpu/drm/amd/display/dc/dc.h
+++ b/drivers/gpu/drm/amd/display/dc/dc.h
@@ -312,6 +312,7 @@ const struct dc_surface_status *dc_surface_get_status(
void dc_surface_retain(const struct dc_surface *dc_surface);
void dc_surface_release(const struct dc_surface *dc_surface);
+void dc_gamma_retain(const struct dc_gamma *dc_gamma);
void dc_gamma_release(const struct dc_gamma *dc_gamma);
struct dc_gamma *dc_create_gamma(const struct dc *dc);
--
2.7.4
|