@@ -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);
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(+)