Skip to content

Commit 1985f99

Browse files
Jakob Bornecrantzthomashvmw
authored andcommitted
drm/vmwgfx: Invalidate surface on non-readback unbind
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>
1 parent 96b4362 commit 1985f99

1 file changed

Lines changed: 18 additions & 8 deletions

File tree

‎drivers/gpu/drm/vmwgfx/vmwgfx_surface.c‎

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,34 +1043,44 @@ static int vmw_gb_surface_unbind(struct vmw_resource *res,
10431043
} *cmd1;
10441044
struct {
10451045
SVGA3dCmdHeader header;
1046-
SVGA3dCmdBindGBSurface body;
1046+
SVGA3dCmdInvalidateGBSurface body;
10471047
} *cmd2;
1048+
struct {
1049+
SVGA3dCmdHeader header;
1050+
SVGA3dCmdBindGBSurface body;
1051+
} *cmd3;
10481052
uint32_t submit_size;
10491053
uint8_t *cmd;
10501054

10511055

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

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

1062-
cmd2 = (void *) cmd;
10631066
if (readback) {
10641067
cmd1 = (void *) cmd;
10651068
cmd1->header.id = SVGA_3D_CMD_READBACK_GB_SURFACE;
10661069
cmd1->header.size = sizeof(cmd1->body);
10671070
cmd1->body.sid = res->id;
1068-
cmd2 = (void *) &cmd1[1];
1071+
cmd3 = (void *) &cmd1[1];
1072+
} else {
1073+
cmd2 = (void *) cmd;
1074+
cmd2->header.id = SVGA_3D_CMD_INVALIDATE_GB_SURFACE;
1075+
cmd2->header.size = sizeof(cmd2->body);
1076+
cmd2->body.sid = res->id;
1077+
cmd3 = (void *) &cmd2[1];
10691078
}
1070-
cmd2->header.id = SVGA_3D_CMD_BIND_GB_SURFACE;
1071-
cmd2->header.size = sizeof(cmd2->body);
1072-
cmd2->body.sid = res->id;
1073-
cmd2->body.mobid = SVGA3D_INVALID_ID;
1079+
1080+
cmd3->header.id = SVGA_3D_CMD_BIND_GB_SURFACE;
1081+
cmd3->header.size = sizeof(cmd3->body);
1082+
cmd3->body.sid = res->id;
1083+
cmd3->body.mobid = SVGA3D_INVALID_ID;
10741084

10751085
vmw_fifo_commit(dev_priv, submit_size);
10761086

0 commit comments

Comments
 (0)