diff options
author | Jakob Bornecrantz <jakob@vmware.com> | 2011-11-03 16:03:08 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2011-11-07 08:16:55 -0500 |
commit | 2ac863719e518ae1a8f328849e64ea26a222f079 (patch) | |
tree | bc3900daf89dfe3f5c8cc994499a7164c16316c2 /drivers | |
parent | d41025c0d6a7b3d80d68f07f943b72962d66ac74 (diff) |
vmwgfx: Snoop DMA transfers with non-covering sizes
Enough to get cursors working under Wayland.
Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c index 8de24836edb..03daefa7339 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | |||
@@ -216,7 +216,7 @@ void vmw_kms_cursor_snoop(struct vmw_surface *srf, | |||
216 | SVGA3dCmdHeader header; | 216 | SVGA3dCmdHeader header; |
217 | SVGA3dCmdSurfaceDMA dma; | 217 | SVGA3dCmdSurfaceDMA dma; |
218 | } *cmd; | 218 | } *cmd; |
219 | int ret; | 219 | int i, ret; |
220 | 220 | ||
221 | cmd = container_of(header, struct vmw_dma_cmd, header); | 221 | cmd = container_of(header, struct vmw_dma_cmd, header); |
222 | 222 | ||
@@ -238,16 +238,19 @@ void vmw_kms_cursor_snoop(struct vmw_surface *srf, | |||
238 | box_count = (cmd->header.size - sizeof(SVGA3dCmdSurfaceDMA)) / | 238 | box_count = (cmd->header.size - sizeof(SVGA3dCmdSurfaceDMA)) / |
239 | sizeof(SVGA3dCopyBox); | 239 | sizeof(SVGA3dCopyBox); |
240 | 240 | ||
241 | if (cmd->dma.guest.pitch != (64 * 4) || | 241 | if (cmd->dma.guest.ptr.offset % PAGE_SIZE || |
242 | cmd->dma.guest.ptr.offset % PAGE_SIZE || | ||
243 | box->x != 0 || box->y != 0 || box->z != 0 || | 242 | box->x != 0 || box->y != 0 || box->z != 0 || |
244 | box->srcx != 0 || box->srcy != 0 || box->srcz != 0 || | 243 | box->srcx != 0 || box->srcy != 0 || box->srcz != 0 || |
245 | box->w != 64 || box->h != 64 || box->d != 1 || | 244 | box->d != 1 || box_count != 1) { |
246 | box_count != 1) { | ||
247 | /* TODO handle none page aligned offsets */ | 245 | /* TODO handle none page aligned offsets */ |
248 | /* TODO handle partial uploads and pitch != 256 */ | 246 | /* TODO handle more dst & src != 0 */ |
249 | /* TODO handle more then one copy (size != 64) */ | 247 | /* TODO handle more then one copy */ |
250 | DRM_ERROR("lazy programmer, can't handle weird stuff\n"); | 248 | DRM_ERROR("Cant snoop dma request for cursor!\n"); |
249 | DRM_ERROR("(%u, %u, %u) (%u, %u, %u) (%ux%ux%u) %u %u\n", | ||
250 | box->srcx, box->srcy, box->srcz, | ||
251 | box->x, box->y, box->z, | ||
252 | box->w, box->h, box->d, box_count, | ||
253 | cmd->dma.guest.ptr.offset); | ||
251 | return; | 254 | return; |
252 | } | 255 | } |
253 | 256 | ||
@@ -266,7 +269,16 @@ void vmw_kms_cursor_snoop(struct vmw_surface *srf, | |||
266 | 269 | ||
267 | virtual = ttm_kmap_obj_virtual(&map, &dummy); | 270 | virtual = ttm_kmap_obj_virtual(&map, &dummy); |
268 | 271 | ||
269 | memcpy(srf->snooper.image, virtual, 64*64*4); | 272 | if (box->w == 64 && cmd->dma.guest.pitch == 64*4) { |
273 | memcpy(srf->snooper.image, virtual, 64*64*4); | ||
274 | } else { | ||
275 | /* Image is unsigned pointer. */ | ||
276 | for (i = 0; i < box->h; i++) | ||
277 | memcpy(srf->snooper.image + i * 64, | ||
278 | virtual + i * cmd->dma.guest.pitch, | ||
279 | box->w * 4); | ||
280 | } | ||
281 | |||
270 | srf->snooper.age++; | 282 | srf->snooper.age++; |
271 | 283 | ||
272 | /* we can't call this function from this function since execbuf has | 284 | /* we can't call this function from this function since execbuf has |