drm/vmwgfx: Fix a width / pitch mismatch on framebuffer updates
[linux-2.6-block.git] / drivers / gpu / drm / vmwgfx / vmwgfx_kms.c
index 274c90da44a74646712b743f269babed93d8eedf..b221a8c4028228d31707df756c14507084603f23 100644 (file)
@@ -763,21 +763,25 @@ static int vmw_create_dmabuf_proxy(struct drm_device *dev,
        uint32_t format;
        struct drm_vmw_size content_base_size;
        struct vmw_resource *res;
+       unsigned int bytes_pp;
        int ret;
 
        switch (mode_cmd->depth) {
        case 32:
        case 24:
                format = SVGA3D_X8R8G8B8;
+               bytes_pp = 4;
                break;
 
        case 16:
        case 15:
                format = SVGA3D_R5G6B5;
+               bytes_pp = 2;
                break;
 
        case 8:
                format = SVGA3D_P8;
+               bytes_pp = 1;
                break;
 
        default:
@@ -785,7 +789,7 @@ static int vmw_create_dmabuf_proxy(struct drm_device *dev,
                return -EINVAL;
        }
 
-       content_base_size.width  = mode_cmd->width;
+       content_base_size.width  = mode_cmd->pitch / bytes_pp;
        content_base_size.height = mode_cmd->height;
        content_base_size.depth  = 1;