Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/vmwgfx: correct fb_fix_screeninfo.line_length

Previously, the vmwgfx_fb driver would allow users to call FBIOSET_VINFO, but it would not adjust
the FINFO properly, resulting in distorted screen rendering. The patch corrects that behaviour.

See https://bugs.gentoo.org/show_bug.cgi?id=494794 for examples.

Cc: stable@vger.kernel.org
Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>

authored by

Christopher Friedt and committed by
Thomas Hellstrom
aa6de142 89dcbda6

+4 -1
+4 -1
drivers/gpu/drm/vmwgfx/vmwgfx_fb.c
··· 147 147 } 148 148 149 149 if (!vmw_kms_validate_mode_vram(vmw_priv, 150 - info->fix.line_length, 150 + var->xres * var->bits_per_pixel/8, 151 151 var->yoffset + var->yres)) { 152 152 DRM_ERROR("Requested geom can not fit in framebuffer\n"); 153 153 return -EINVAL; ··· 161 161 struct vmw_fb_par *par = info->par; 162 162 struct vmw_private *vmw_priv = par->vmw_priv; 163 163 int ret; 164 + 165 + info->fix.line_length = info->var.xres * info->var.bits_per_pixel/8; 164 166 165 167 ret = vmw_kms_write_svga(vmw_priv, info->var.xres, info->var.yres, 166 168 info->fix.line_length, ··· 179 177 vmw_write(vmw_priv, SVGA_REG_DISPLAY_POSITION_Y, info->var.yoffset); 180 178 vmw_write(vmw_priv, SVGA_REG_DISPLAY_WIDTH, info->var.xres); 181 179 vmw_write(vmw_priv, SVGA_REG_DISPLAY_HEIGHT, info->var.yres); 180 + vmw_write(vmw_priv, SVGA_REG_BYTES_PER_LINE, info->fix.line_length); 182 181 vmw_write(vmw_priv, SVGA_REG_DISPLAY_ID, SVGA_ID_INVALID); 183 182 } 184 183