[06/39] drm/amd/dal: fix flip optimization

Submitted by Harry Wentland on Nov. 24, 2016, 2:02 a.m.

Details

Message ID 20161124020308.28124-7-harry.wentland@amd.com
State New
Headers show
Series "dal patches for nov 23, 2016" ( rev: 1 ) in AMD X.Org drivers

Not browsing as part of any series.

Commit Message

Harry Wentland Nov. 24, 2016, 2:02 a.m.
From: Dmytro Laktyushkin <Dmytro.Laktyushkin@amd.com>

Change-Id: I5e9db1a93d9330809bf2474ba4fc75026ecda545
Signed-off-by: Dmytro Laktyushkin <Dmytro.Laktyushkin@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
---
 drivers/gpu/drm/amd/dal/dc/core/dc.c | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/amd/dal/dc/core/dc.c b/drivers/gpu/drm/amd/dal/dc/core/dc.c
index 7636fc6d7052..6e32f1bd935c 100644
--- a/drivers/gpu/drm/amd/dal/dc/core/dc.c
+++ b/drivers/gpu/drm/amd/dal/dc/core/dc.c
@@ -1324,12 +1324,10 @@  void dc_update_surfaces_for_target(struct dc *dc, struct dc_surface_update *upda
 	struct validate_context *context = core_dc->temp_flip_context;
 	int i, j;
 	bool is_new_pipe_surface[MAX_SURFACES];
+	const struct dc_surface *new_surfaces[MAX_SURFACES] = { 0 };
 
 	update_surface_trace(dc, updates, surface_count);
 
-	for (j = 0; j < MAX_SURFACES; j++)
-		is_new_pipe_surface[j] = true;
-
 	*context = *core_dc->current_context;
 
 	for (i = 0; i < context->res_ctx.pool->pipe_count; i++) {
@@ -1344,8 +1342,22 @@  void dc_update_surfaces_for_target(struct dc *dc, struct dc_surface_update *upda
 				&context->res_ctx.pipe_ctx[cur_pipe->bottom_pipe->pipe_idx];
 	}
 
+	for (j = 0; j < MAX_SURFACES; j++)
+		is_new_pipe_surface[j] = true;
+
+	for (i = 0 ; i < surface_count; i++) {
+		struct core_surface *surface = DC_SURFACE_TO_CORE(updates[i].surface);
+
+		new_surfaces[i] = updates[i].surface;
+		for (j = 0; j < context->res_ctx.pool->pipe_count; j++) {
+			struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[j];
+
+			if (surface == pipe_ctx->surface)
+				is_new_pipe_surface[i] = false;
+		}
+	}
+
 	if (dc_target) {
-		const struct dc_surface *new_surfaces[MAX_SURFACES] = { 0 };
 		struct core_target *target = DC_TARGET_TO_CORE(dc_target);
 
 		if (core_dc->current_context->target_count == 0)
@@ -1358,18 +1370,6 @@  void dc_update_surfaces_for_target(struct dc *dc, struct dc_surface_update *upda
 		if (i == core_dc->current_context->target_count)
 			return;
 
-		for (i = 0 ; i < surface_count; i++) {
-			struct core_surface *surface = DC_SURFACE_TO_CORE(updates[i].surface);
-
-			new_surfaces[i] = updates[i].surface;
-			for (j = 0; j < context->res_ctx.pool->pipe_count; j++) {
-				struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[j];
-
-				if (surface == pipe_ctx->surface)
-					is_new_pipe_surface[i] = false;
-			}
-		}
-
 		if (!resource_attach_surfaces_to_context(
 				new_surfaces, surface_count, dc_target, context)) {
 			BREAK_TO_DEBUGGER();