提交 a50e2bf5 编写于 作者: T Thomas Hellstrom 提交者: Dave Airlie

drm/vmwgfx: Fix a width / pitch mismatch on framebuffer updates

When the framebuffer is a vmwgfx dma buffer and a proxy surface is
created, the vmw_kms_update_proxy() function requires that the proxy
surface width and the framebuffer pitch are compatible, otherwise
display corruption occurs as seen in gnome-shell/native with software
3D. Since the framebuffer pitch is determined by user-space, allocate
a proxy surface the width of which is based on the framebuffer pitch
rather than on the framebuffer width.

Cc: <stable@vger.kernel.org>
Reported-by: NRaphael Hertzog <buxy@kali.org>
Tested-by: NMati Aharoni <muts@kali.org>
Signed-off-by: NThomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: NBrian Paul <brianp@vmware.com>
Signed-off-by: NDave Airlie <airlied@redhat.com>
上级 fb89ac51
...@@ -763,21 +763,25 @@ static int vmw_create_dmabuf_proxy(struct drm_device *dev, ...@@ -763,21 +763,25 @@ static int vmw_create_dmabuf_proxy(struct drm_device *dev,
uint32_t format; uint32_t format;
struct drm_vmw_size content_base_size; struct drm_vmw_size content_base_size;
struct vmw_resource *res; struct vmw_resource *res;
unsigned int bytes_pp;
int ret; int ret;
switch (mode_cmd->depth) { switch (mode_cmd->depth) {
case 32: case 32:
case 24: case 24:
format = SVGA3D_X8R8G8B8; format = SVGA3D_X8R8G8B8;
bytes_pp = 4;
break; break;
case 16: case 16:
case 15: case 15:
format = SVGA3D_R5G6B5; format = SVGA3D_R5G6B5;
bytes_pp = 2;
break; break;
case 8: case 8:
format = SVGA3D_P8; format = SVGA3D_P8;
bytes_pp = 1;
break; break;
default: default:
...@@ -785,7 +789,7 @@ static int vmw_create_dmabuf_proxy(struct drm_device *dev, ...@@ -785,7 +789,7 @@ static int vmw_create_dmabuf_proxy(struct drm_device *dev,
return -EINVAL; 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.height = mode_cmd->height;
content_base_size.depth = 1; content_base_size.depth = 1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册