drm/amd/display: PIP overlay corruption
authorMurton Liu <murton.liu@amd.com>
Wed, 23 Jan 2019 22:37:57 +0000 (17:37 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 6 Feb 2019 18:30:28 +0000 (13:30 -0500)
[Why]
When moving mouse onto or off of pip plane,
screen would flash briefly due to garbage negative
pos values being programmed for cursor.
Also, text flashes due to PIP flips taking too long.

[How]
When negative pos value seen, default to 0 and adjust by modifying cursor hotspot.
For flip issue, only do post update when optimize required vs all the time.

Signed-off-by: Murton Liu <murton.liu@amd.com>
Reviewed-by: Aric Cyr <Aric.Cyr@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Acked-by: Sivapiriyan Kumarasamy <Sivapiriyan.Kumarasamy@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/core/dc.c
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubp.c

index af5f486d24e0ab38dd7edc554ae8702a43cf57d7..77e1bd18b1dde815e215af4998f8df26cb7dedff 100644 (file)
@@ -1125,6 +1125,9 @@ bool dc_post_update_surfaces_to_stream(struct dc *dc)
        int i;
        struct dc_state *context = dc->current_state;
 
+       if (dc->optimized_required == false)
+               return true;
+
        post_surface_trace(dc);
 
        for (i = 0; i < dc->res_pool->pipe_count; i++)
index 0ba68d41b9c37b91064a5defbbcf62a3160df53f..683829466a44c4279db97fbb72338fef9851b404 100644 (file)
@@ -1150,9 +1150,28 @@ void hubp1_cursor_set_position(
        REG_UPDATE(CURSOR_CONTROL,
                        CURSOR_ENABLE, cur_en);
 
-       REG_SET_2(CURSOR_POSITION, 0,
-                       CURSOR_X_POSITION, pos->x,
+       //account for cases where we see negative offset relative to overlay plane
+       if (src_x_offset < 0 && src_y_offset < 0) {
+               REG_SET_2(CURSOR_POSITION, 0,
+                       CURSOR_X_POSITION, 0,
+                       CURSOR_Y_POSITION, 0);
+               x_hotspot -= src_x_offset;
+               y_hotspot -= src_y_offset;
+       } else if (src_x_offset < 0) {
+               REG_SET_2(CURSOR_POSITION, 0,
+                       CURSOR_X_POSITION, 0,
                        CURSOR_Y_POSITION, pos->y);
+               x_hotspot -= src_x_offset;
+       } else if (src_y_offset < 0) {
+               REG_SET_2(CURSOR_POSITION, 0,
+                       CURSOR_X_POSITION, pos->x,
+                       CURSOR_Y_POSITION, 0);
+               y_hotspot -= src_y_offset;
+       } else {
+               REG_SET_2(CURSOR_POSITION, 0,
+                               CURSOR_X_POSITION, pos->x,
+                               CURSOR_Y_POSITION, pos->y);
+       }
 
        REG_SET_2(CURSOR_HOT_SPOT, 0,
                        CURSOR_HOT_SPOT_X, x_hotspot,