]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/amd/display/dc: add helper for panic updates
authorAlex Deucher <alexander.deucher@amd.com>
Tue, 12 Nov 2024 21:19:18 +0000 (16:19 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 18 Dec 2024 17:14:09 +0000 (12:14 -0500)
Add a DC helper for panic updates.

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: Lu Yao <yaolu@kylinos.cn>
Cc: Jocelyn Falempe <jfalempe@redhat.com>
Cc: Harry Wentland <harry.wentland@amd.com>
drivers/gpu/drm/amd/display/dc/core/dc_surface.c
drivers/gpu/drm/amd/display/dc/dc_plane.h

index 3299684f9a4e162e1271f4ebf887a7df36475a2c..f3471d45b312fa22fff39ec530205d878d8b291a 100644 (file)
@@ -270,4 +270,50 @@ void dc_3dlut_func_retain(struct dc_3dlut *lut)
        kref_get(&lut->refcount);
 }
 
+void dc_plane_force_update_for_panic(struct dc_plane_state *plane_state,
+                                    bool clear_tiling)
+{
+       struct dc *dc;
+       int i;
+
+       if (!plane_state)
+               return;
+
+       dc = plane_state->ctx->dc;
+
+       if (!dc || !dc->current_state)
+               return;
 
+       for (i = 0; i < dc->res_pool->pipe_count; i++) {
+               struct pipe_ctx *pipe_ctx = &dc->current_state->res_ctx.pipe_ctx[i];
+
+               if (!pipe_ctx)
+                       continue;
+
+               if (dc->ctx->dce_version >= DCE_VERSION_MAX) {
+                       struct hubp *hubp = pipe_ctx->plane_res.hubp;
+                       if (!hubp)
+                               continue;
+                       /* if framebuffer is tiled, disable tiling */
+                       if (clear_tiling && hubp->funcs->hubp_clear_tiling)
+                               hubp->funcs->hubp_clear_tiling(hubp);
+
+                       /* force page flip to see the new content of the framebuffer */
+                       hubp->funcs->hubp_program_surface_flip_and_addr(hubp,
+                                                                       &plane_state->address,
+                                                                       true);
+               } else {
+                       struct mem_input *mi = pipe_ctx->plane_res.mi;
+                       if (!mi)
+                               continue;
+                       /* if framebuffer is tiled, disable tiling */
+                       if (clear_tiling && mi->funcs->mem_input_clear_tiling)
+                               mi->funcs->mem_input_clear_tiling(mi);
+
+                       /* force page flip to see the new content of the framebuffer */
+                       mi->funcs->mem_input_program_surface_flip_and_addr(mi,
+                                                                          &plane_state->address,
+                                                                          true);
+               }
+       }
+}
index bd37ec82b42d13bb27825ffe8b6ef67c3661ce76..fabcefeda288cf6543d123bd5861228d725f1853 100644 (file)
@@ -34,4 +34,7 @@ const struct dc_plane_status *dc_plane_get_status(
 void dc_plane_state_retain(struct dc_plane_state *plane_state);
 void dc_plane_state_release(struct dc_plane_state *plane_state);
 
+void dc_plane_force_update_for_panic(struct dc_plane_state *plane_state,
+                                    bool clear_tiling);
+
 #endif /* _DC_PLANE_H_ */