aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/2505-drm-amd-display-Fix-ref_count-messed-up-issue.patch
blob: d4617feb6bd6148289d2631f7e556d689db16c97 (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
From 584249c5bb16e3fcb39b7095680b2266d0c0e6ee Mon Sep 17 00:00:00 2001
From: Jerry Zuo <Jerry.Zuo@amd.com>
Date: Mon, 25 Sep 2017 16:39:45 -0400
Subject: [PATCH 2505/4131] drm/amd/display: Fix ref_count messed up issue

In the full update type, need to add ref_count to the newly
created dc_state->stream. It made mistake to add ref_count to
dc->current_state->stream which keeps adding up without release.

Signed-off-by: Jerry Zuo <Jerry.Zuo@amd.com>
Reviewed-by: Roman Li <Roman.Li@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
---
 drivers/gpu/drm/amd/display/dc/core/dc.c | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c
index 03cb200..d733658 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc.c
@@ -1322,6 +1322,7 @@ void dc_commit_updates_for_stream(struct dc *dc,
 	const struct dc_stream_status *stream_status;
 	enum surface_update_type update_type;
 	struct dc_state *context;
+	struct dc_context *dc_ctx = dc->ctx;
 	int i;
 
 	stream_status = dc_stream_get_status(stream);
@@ -1334,8 +1335,17 @@ void dc_commit_updates_for_stream(struct dc *dc,
 		update_surface_trace(dc, srf_updates, surface_count);
 
 
-	if (update_type >= UPDATE_TYPE_FULL)
+	if (update_type >= UPDATE_TYPE_FULL) {
+
+		/* initialize scratch memory for building context */
+		context = dc_create_state();
+		if (context == NULL) {
+			DC_ERROR("Failed to allocate new validate context!\n");
+			return;
+		}
+
 		dc_resource_state_copy_construct(state, context);
+	}
 
 
 	for (i = 0; i < surface_count; i++) {
@@ -1361,6 +1371,15 @@ void dc_commit_updates_for_stream(struct dc *dc,
 
 	dc_post_update_surfaces_to_stream(dc);
 
+	if (dc->current_state != context) {
+
+		struct dc_state *old = dc->current_state;
+
+		dc->current_state = context;
+		dc_release_state(old);
+
+	}
+
 	return;
 
 }
-- 
2.7.4