All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/vmwgfx: Make sure the dirty tracker is released on surfaces
@ 2025-03-04 18:49 Zack Rusin
  2025-03-05 16:54 ` Ian Forbes
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Zack Rusin @ 2025-03-04 18:49 UTC (permalink / raw)
  To: dri-devel
  Cc: Broadcom internal kernel review list, ian.forbes, martin.krastev,
	maaz.mombasawala, Zack Rusin

Free all the dirty trackers associated with the surface when the
parent framebuffer is destroyed.

The buffers backing framebuffers are explicitly made coherent. Code
separates buffers from surfaces. Buffers only require a dirty tracker
which is released during the framebuffer cleanup. Surfaces, which can
be coherent to begin with, require a dirty tracker in the backing buffer
and in the resource. Neither was properly cleaned up. Make sure they're
correctly cleaned up when the parent framebuffer is destroyed.

Fixes: 609023571ff2 ("drm/vmwgfx: Refactor cursor handling")
Cc: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Zack Rusin <zack.rusin@broadcom.com>
---
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
index d8937f3de514..339ed2ddb717 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
@@ -438,7 +438,20 @@ static void vmw_framebuffer_surface_destroy(struct drm_framebuffer *framebuffer)
 {
 	struct vmw_framebuffer_surface *vfbs =
 		vmw_framebuffer_to_vfbs(framebuffer);
+	struct vmw_bo *bo = vmw_user_object_buffer(&vfbs->uo);
+	struct vmw_surface *surf = vmw_user_object_surface(&vfbs->uo);
 
+	if (bo) {
+		vmw_bo_dirty_release(bo);
+		/*
+		 * bo->dirty is reference counted so it being NULL
+		 * means that the surface wasn't coherent to begin
+		 * with and so we have to free the dirty tracker
+		 * in the vmw_resource
+		 */
+		if (!bo->dirty && surf && surf->res.dirty)
+			surf->res.func->dirty_free(&surf->res);
+	}
 	drm_framebuffer_cleanup(framebuffer);
 	vmw_user_object_unref(&vfbs->uo);
 
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-03-06  3:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-04 18:49 [PATCH] drm/vmwgfx: Make sure the dirty tracker is released on surfaces Zack Rusin
2025-03-05 16:54 ` Ian Forbes
2025-03-05 18:47 ` kernel test robot
2025-03-05 19:09 ` kernel test robot
2025-03-06  3:56   ` Zack Rusin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.