Skip to contentSkip to conversation

drm/vmwgfx: Don't overwrite KMS surface dirty tracker

PATCH In review Ian Forbes 2 participants 2 messages Mar 2 – Mar 6

Subsystems (3)
lore
Share & tools
lore

Ian Forbes

author
#0 lore raw

PATCH 1/1 drm/vmwgfx: Don't overwrite KMS surface dirty tracker

We were overwriting the surface's dirty tracker here causing a memory leak.

Fixes 965544150d1c ("drm/vmwgfx: Refactor cursor handling")
---
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +2 -1
index 55730e29d3ae..e7bddf840a79 100644
@@ -771,7 +771,8 @@ static struct drm_framebuffer *vmw_kms_fb_create(struct drm_device *dev,
 		ret = vmw_bo_dirty_add(bo);
 		if (!ret && surface && surface->res.func->dirty_alloc) {
 			surface->res.coherent = true;
-			ret = surface->res.func->dirty_alloc(&surface->res);
+			if (surface->res.dirty == NULL)
+				ret = surface->res.func->dirty_alloc(&surface->res);
 		}
 		ttm_bo_unreserve(&bo->tbo);
 	}
Signature · 1 line
2.53.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 15 lines · Ian Forbes

We were overwriting the surface's dirty tracker here causing a memory leak.

Fixes 965544150d1c ("drm/vmwgfx: Refactor cursor handling")
---
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +0 -0
index 55730e29d3ae..e7bddf840a79 100644

drivers/gpu/drm/vmwgfx/vmwgfx_kms.c static struct drm_framebuffer *vmw_kms_fb_create(struct drm_device *dev, · line 778

Quoted 9 lines
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +2 -1
@@ -771,7 +771,8 @@ static struct drm_framebuffer *vmw_kms_fb_create(struct drm_device *dev,
 		ret = vmw_bo_dirty_add(bo);
 		if (!ret && surface && surface->res.func->dirty_alloc) {
 			surface->res.coherent = true;
-			ret = surface->res.func->dirty_alloc(&surface->res);
+			if (surface->res.dirty == NULL)
+				ret = surface->res.func->dirty_alloc(&surface->res);
 		}
 		ttm_bo_unreserve(&bo->tbo);
 	}

LGTM.

Signature · 1 line
Maaz Mombasawala <[email protected]>