diff options
| -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 8de24836edb1..03daefa73397 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 |
