From: Michel Dänzer <michel.daen...@amd.com>

The main motivation was that it was at least theoretically possible for
stream_for_cursor to be dereferenced when it was NULL.

The code also becomes slightly smaller, and hopefully easier to
understand.

Signed-off-by: Michel Dänzer <michel.daen...@amd.com>
---
 .../drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c   | 21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c 
b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c
index b5d048b364a4..d1093ba29336 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c
@@ -2124,26 +2124,23 @@ static void dcn10_apply_ctx_for_surface(
        }
 
        if (num_planes > 0) {
-               struct dc_stream_state *stream_for_cursor = NULL;
-
                program_all_pipe_in_tree(dc, top_pipe_to_program, context);
 
                for (i = 0; i < dc->res_pool->pipe_count; i++) {
                        struct pipe_ctx *pipe_ctx = 
&context->res_ctx.pipe_ctx[i];
 
                        if (stream == pipe_ctx->stream) {
-                               stream_for_cursor = pipe_ctx->stream;
-                               break;
-                       }
-               }
+                               /* TODO: this is a hack w/a for switching from 
mpo to pipe split */
+                               if (stream->cursor_attributes.address.quad_part 
!= 0) {
+                                       struct dc_cursor_position position = { 
0 };
 
-               /* TODO: this is a hack w/a for switching from mpo to pipe 
split */
-               if (stream_for_cursor->cursor_attributes.address.quad_part != 
0) {
-                       struct dc_cursor_position position = { 0 };
+                                       
dc_stream_set_cursor_position(pipe_ctx->stream, &position);
+                                       
dc_stream_set_cursor_attributes(pipe_ctx->stream,
+                                                                       
&stream->cursor_attributes);
+                               }
 
-                       dc_stream_set_cursor_position(stream_for_cursor, 
&position);
-                       dc_stream_set_cursor_attributes(stream_for_cursor,
-                               &stream_for_cursor->cursor_attributes);
+                               break;
+                       }
                }
        }
 
-- 
2.15.0

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reply via email to