drm/vmwgfx: Fix KMS with 3D on HW version 10
Subsystems (3)
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")
Signed-off-by Ian Forbes <[email protected]>
--- drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +8 -6
@@ -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
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")Signed-off-by Ian Forbes <[email protected]>--- drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +8
-7@@ -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.
Reviewed-by Zack Rusin <[email protected]>
z