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

Harry Wentland harry.wentland at amd.com
Thu Nov 24 02:02:35 UTC 2016


From: Dmytro Laktyushkin <Dmytro.Laktyushkin at amd.com>

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

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();
-- 
2.10.1



More information about the amd-gfx mailing list