Skip to contentSkip to conversation

drm/vmwgfx: Fix KMS with 3D on HW version 10

PATCH In review Ian Forbes 2 participants 2 messages Nov 14, 2025 – Nov 20, 2025

Subsystems (3)
lore
Share & tools
lore

Ian Forbes

author
#0 lore raw

PATCH 1/1 drm/vmwgfx: Fix KMS with 3D on HW version 10

HW version 10 does not have GB Surfaces so there is no backing buffer for surface backed FBs. This would result in a nullptr dereference and crash the driver causing a black screen.

Fixes 965544150d1c ("drm/vmwgfx: Refactor cursor handling")
---
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +8 -6
index 87448e86d3b3..4446f25e526d 100644
@@ -767,13 +767,15 @@ static struct drm_framebuffer *vmw_kms_fb_create(struct drm_device *dev,
 		return ERR_PTR(ret);
 	}
 
-	ttm_bo_reserve(&bo->tbo, false, false, NULL);
-	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 (bo) {
+		ttm_bo_reserve(&bo->tbo, false, false, NULL);
+		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);
+		}
+		ttm_bo_unreserve(&bo->tbo);
 	}
-	ttm_bo_unreserve(&bo->tbo);
 
 	return &vfb->base;
 }
Signature · 1 line
2.51.1
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 38 lines · Ian Forbes

HW version 10 does not have GB Surfaces so there is no backing buffer for surface backed FBs. This would result in a nullptr dereference and crash the driver causing a black screen.

Fixes 965544150d1c ("drm/vmwgfx: Refactor cursor handling")
---
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +8 -7
index 87448e86d3b3..4446f25e526d 100644
@@ -767,13 +767,15 @@ static struct drm_framebuffer *vmw_kms_fb_create(struct drm_device *dev,
                return ERR_PTR(ret);
        }
 
-       ttm_bo_reserve(&bo->tbo, false, false, NULL);
-       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 (bo) {
+               ttm_bo_reserve(&bo->tbo, false, false, NULL);
+               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);
+               }
+               ttm_bo_unreserve(&bo->tbo);
        }
-       ttm_bo_unreserve(&bo->tbo);
 
        return &vfb->base;
 }
--
Quoted 2 lines

2.51.1

Looks great.

z