aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/0175-drm-amd-display-clean-up-redundant-logic.patch
blob: 7b7b4cdbf96362bd1029c42c319a1cedd54d1f61 (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
From d9f62433064c8d0bc94f663b67bff6a759edb5f6 Mon Sep 17 00:00:00 2001
From: Tony Cheng <tony.cheng@amd.com>
Date: Thu, 19 Jan 2017 14:46:26 -0500
Subject: [PATCH 0175/4131] drm/amd/display: clean up redundant logic

Signed-off-by: Tony Cheng <tony.cheng@amd.com>
Reviewed-by: Yongqiang Sun <yongqiang.sun@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_surface.c | 23 ++++++++---------------
 drivers/gpu/drm/amd/display/dc/dc.h              |  1 -
 2 files changed, 8 insertions(+), 16 deletions(-)

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 d607972..21fedd4 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_surface.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_surface.c
@@ -121,26 +121,20 @@ const struct dc_surface_status *dc_surface_get_status(
 		const struct dc_surface *dc_surface)
 {
 	struct dc_surface_status *surface_status;
-	struct core_surface *core_surface;
+	struct core_surface *core_surface = DC_SURFACE_TO_CORE(dc_surface);;
 	struct core_dc *core_dc;
 	int i;
 
-	if (dc_surface == NULL)
-		return NULL;
-
-	core_surface = DC_SURFACE_TO_CORE(dc_surface);
-
-	if (core_surface == NULL || core_surface->ctx == NULL)
-		return NULL;
+	if (!dc_surface ||
+		!core_surface->ctx ||
+		!core_surface->ctx->dc) {
+		ASSERT(0);
+		return NULL; /* remove this if above assert never hit */
+	}
 
 	surface_status = &core_surface->status;
-
-	if (core_surface->ctx == NULL || core_surface->ctx->dc == NULL)
-		return NULL;
-
 	core_dc = DC_TO_CORE(core_surface->ctx->dc);
 
-
 	if (core_dc->current_context == NULL)
 		return NULL;
 
@@ -149,8 +143,7 @@ const struct dc_surface_status *dc_surface_get_status(
 		struct pipe_ctx *pipe_ctx =
 				&core_dc->current_context->res_ctx.pipe_ctx[i];
 
-		if (pipe_ctx->surface !=
-				DC_SURFACE_TO_CORE(dc_surface))
+		if (pipe_ctx->surface != core_surface)
 			continue;
 
 		core_dc->hwss.update_pending_status(pipe_ctx);
diff --git a/drivers/gpu/drm/amd/display/dc/dc.h b/drivers/gpu/drm/amd/display/dc/dc.h
index 332ecf8..c3aca8d 100644
--- a/drivers/gpu/drm/amd/display/dc/dc.h
+++ b/drivers/gpu/drm/amd/display/dc/dc.h
@@ -335,7 +335,6 @@ struct dc_transfer_func *dc_create_transfer_func(void);
 struct dc_flip_addrs {
 	struct dc_plane_address address;
 	bool flip_immediate;
-	/* TODO: DCC format info */
 	/* TODO: add flip duration for FreeSync */
 };
 
-- 
2.7.4