Commit 2ac86371 authored by Jakob Bornecrantz's avatar Jakob Bornecrantz Committed by Dave Airlie
Browse files

vmwgfx: Snoop DMA transfers with non-covering sizes



Enough to get cursors working under Wayland.

Signed-off-by: default avatarJakob Bornecrantz <jakob@vmware.com>
Signed-off-by: default avatarThomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent d41025c0
...@@ -216,7 +216,7 @@ void vmw_kms_cursor_snoop(struct vmw_surface *srf, ...@@ -216,7 +216,7 @@ void vmw_kms_cursor_snoop(struct vmw_surface *srf,
SVGA3dCmdHeader header; SVGA3dCmdHeader header;
SVGA3dCmdSurfaceDMA dma; SVGA3dCmdSurfaceDMA dma;
} *cmd; } *cmd;
int ret; int i, ret;
cmd = container_of(header, struct vmw_dma_cmd, header); cmd = container_of(header, struct vmw_dma_cmd, header);
...@@ -238,16 +238,19 @@ void vmw_kms_cursor_snoop(struct vmw_surface *srf, ...@@ -238,16 +238,19 @@ void vmw_kms_cursor_snoop(struct vmw_surface *srf,
box_count = (cmd->header.size - sizeof(SVGA3dCmdSurfaceDMA)) / box_count = (cmd->header.size - sizeof(SVGA3dCmdSurfaceDMA)) /
sizeof(SVGA3dCopyBox); sizeof(SVGA3dCopyBox);
if (cmd->dma.guest.pitch != (64 * 4) || if (cmd->dma.guest.ptr.offset % PAGE_SIZE ||
cmd->dma.guest.ptr.offset % PAGE_SIZE ||
box->x != 0 || box->y != 0 || box->z != 0 || box->x != 0 || box->y != 0 || box->z != 0 ||
box->srcx != 0 || box->srcy != 0 || box->srcz != 0 || box->srcx != 0 || box->srcy != 0 || box->srcz != 0 ||
box->w != 64 || box->h != 64 || box->d != 1 || box->d != 1 || box_count != 1) {
box_count != 1) {
/* TODO handle none page aligned offsets */ /* TODO handle none page aligned offsets */
/* TODO handle partial uploads and pitch != 256 */ /* TODO handle more dst & src != 0 */
/* TODO handle more then one copy (size != 64) */ /* TODO handle more then one copy */
DRM_ERROR("lazy programmer, can't handle weird stuff\n"); DRM_ERROR("Cant snoop dma request for cursor!\n");
DRM_ERROR("(%u, %u, %u) (%u, %u, %u) (%ux%ux%u) %u %u\n",
box->srcx, box->srcy, box->srcz,
box->x, box->y, box->z,
box->w, box->h, box->d, box_count,
cmd->dma.guest.ptr.offset);
return; return;
} }
...@@ -266,7 +269,16 @@ void vmw_kms_cursor_snoop(struct vmw_surface *srf, ...@@ -266,7 +269,16 @@ void vmw_kms_cursor_snoop(struct vmw_surface *srf,
virtual = ttm_kmap_obj_virtual(&map, &dummy); virtual = ttm_kmap_obj_virtual(&map, &dummy);
if (box->w == 64 && cmd->dma.guest.pitch == 64*4) {
memcpy(srf->snooper.image, virtual, 64*64*4); memcpy(srf->snooper.image, virtual, 64*64*4);
} else {
/* Image is unsigned pointer. */
for (i = 0; i < box->h; i++)
memcpy(srf->snooper.image + i * 64,
virtual + i * cmd->dma.guest.pitch,
box->w * 4);
}
srf->snooper.age++; srf->snooper.age++;
/* we can't call this function from this function since execbuf has /* we can't call this function from this function since execbuf has
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment