Skip to content

Commit

Permalink
drm/vmwgfx: Invalidate surface on non-readback unbind
Browse files Browse the repository at this point in the history
Fixes error messages in vmware.log

Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
Reviewed-by: Michael Banack <banackm@vmware.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
  • Loading branch information
Jakob Bornecrantz authored and Thomas Hellstrom committed Jan 17, 2014
1 parent 96b4362 commit 1985f99
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
Original file line number Diff line number Diff line change
Expand Up @@ -1043,34 +1043,44 @@ static int vmw_gb_surface_unbind(struct vmw_resource *res,
} *cmd1;
struct {
SVGA3dCmdHeader header;
SVGA3dCmdBindGBSurface body;
SVGA3dCmdInvalidateGBSurface body;
} *cmd2;
struct {
SVGA3dCmdHeader header;
SVGA3dCmdBindGBSurface body;
} *cmd3;
uint32_t submit_size;
uint8_t *cmd;


BUG_ON(bo->mem.mem_type != VMW_PL_MOB);

submit_size = sizeof(*cmd2) + (readback ? sizeof(*cmd1) : 0);
submit_size = sizeof(*cmd3) + (readback ? sizeof(*cmd1) : sizeof(*cmd2));
cmd = vmw_fifo_reserve(dev_priv, submit_size);
if (unlikely(cmd == NULL)) {
DRM_ERROR("Failed reserving FIFO space for surface "
"unbinding.\n");
return -ENOMEM;
}

cmd2 = (void *) cmd;
if (readback) {
cmd1 = (void *) cmd;
cmd1->header.id = SVGA_3D_CMD_READBACK_GB_SURFACE;
cmd1->header.size = sizeof(cmd1->body);
cmd1->body.sid = res->id;
cmd2 = (void *) &cmd1[1];
cmd3 = (void *) &cmd1[1];
} else {
cmd2 = (void *) cmd;
cmd2->header.id = SVGA_3D_CMD_INVALIDATE_GB_SURFACE;
cmd2->header.size = sizeof(cmd2->body);
cmd2->body.sid = res->id;
cmd3 = (void *) &cmd2[1];
}
cmd2->header.id = SVGA_3D_CMD_BIND_GB_SURFACE;
cmd2->header.size = sizeof(cmd2->body);
cmd2->body.sid = res->id;
cmd2->body.mobid = SVGA3D_INVALID_ID;

cmd3->header.id = SVGA_3D_CMD_BIND_GB_SURFACE;
cmd3->header.size = sizeof(cmd3->body);
cmd3->body.sid = res->id;
cmd3->body.mobid = SVGA3D_INVALID_ID;

vmw_fifo_commit(dev_priv, submit_size);

Expand Down

0 comments on commit 1985f99

Please sign in to comment.