Bug 23525

Summary: Software rendering on QEMU guests badly broken
Product: Mesa Reporter: Brian Wheeler <bdwheele>
Component: Mesa coreAssignee: mesa-dev
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: medium CC: marc, mat
Version: git   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: example of corruption
fix 24 bits colors / 24 bpp implementation

Description Brian Wheeler 2009-08-26 06:45:47 UTC
Environment:
  * QEMU's latest git, although I've seen this in many earlier versions
    * -vga cirrus 
  * Fedora 12 running as a guest (also happens in the moblin snapshot)

When running the gnome shell preview or glx gears, the display is highly corrupted.  It looks like a bytes-per-pixel issue since the image appears in three places.

When using the VESA emulation glxgears works just fine, but the bulk of the gnome shell doesn't. (and I'm limited to 800x600 with no acceleration)

Fedora 12 has rpms versioned 7.6.0-8 so I assume it is a git snapshot.
Comment 1 Brian Wheeler 2009-08-26 06:46:13 UTC
Created attachment 28916 [details]
example of corruption
Comment 2 Andrew Randrianasulu 2009-12-12 22:07:21 UTC
May be it was bug in Qemu emulator itself  OR Mesa's swrast doesn't work too well with 24/24 (as opposed to 24/32) screen/framebuffer (bpp/fbbpp) configuration.

At least Ubuntu 10.04 LiveCD show this problem, too (it uses mesa 7.6.1-rc2-1ubuntu1).
Comment 3 Andrew Randrianasulu 2009-12-13 01:49:34 UTC
(In reply to comment #2)
> May be it was bug in Qemu emulator itself  OR Mesa's swrast doesn't work too
> well with 24/24 (as opposed to 24/32) screen/framebuffer (bpp/fbbpp)
> configuration.
> 
> At least Ubuntu 10.04 LiveCD show this problem, too (it uses mesa
> 7.6.1-rc2-1ubuntu1).
> 

But it works OK in 16/16 bpp .... 

sudo gedit /etc/X11/xinit/xserverrc - add -fbbpp 16 as server argument
sudo /etc/init.d/gdm stop
startx

(not sure how to force gdm to do the same)
Comment 4 Bernhard M. Wiedemann 2011-02-08 03:16:02 UTC
Mesa-7.10 swrast on Qemu/KVM's emulated 24bit cirrus graphics is still broken.
Looks like this:
http://openqa.opensuse.org/opensuse/permanent/bug/bfo23525.png

but works on vesa driver that has
(II) VESA(0): Creating default Display subsection in Screen section
	"Default Screen" for depth/fbbpp 24/24
(==) VESA(0): Depth 24, (==) framebuffer bpp 24
...
(==) Depth 24 pixmap format is 32 bpp

and also works on fbdev with 16/16
Comment 5 Marc Pignat 2011-07-21 08:12:08 UTC
Created attachment 49386 [details] [review]
fix 24 bits colors / 24 bpp implementation
Comment 6 Brian Paul 2011-07-21 10:55:28 UTC
The patch was committed to master as commit cfec000e7514342fd51859906e173ba2d474a55c

How confident are you in the patch?  Should it go into the 7.11 release?
Comment 7 Marc Pignat 2011-07-22 02:57:10 UTC
Hi Brian!

I have done these tests:
* without my patch : 
 * qemu + cirrus emulation + glxgears -> failed
 * qemu + vga emulation + glxgears -> working fine
* with my patch
 * qemu + cirrus emulation -> working
 * qemu + vga emulation -> still working fine
 
So it seems that this patch solves the problem, and does not introduce
another bug.

So I'm confident in this patch ;)

Regards
Comment 8 Brian Paul 2011-07-22 06:39:30 UTC
OK, I've cherry-picked this to 7.11.
Comment 9 Bernhard M. Wiedemann 2011-11-26 12:24:54 UTC
Just noticed this issue still occurred with Mesa-7.11 (even on real Cirrus HW)
Checking the source, I found that the patch from comment 5 was missing.
Applying the patch, fixed glxgears,
but left other programs (e.g. KDE4's khelpcenter and konqueror (both using KHTML)) with similar bpp corruptions in image rendering, which are not present with other drivers.
Comment 10 Timothy Arceri 2018-04-24 00:42:16 UTC
Fixed by:

commit cfec000e7514342fd51859906e173ba2d474a55c
Author: Marc Pignat <marc@pignat.org>
Date:   Tue Jun 28 15:21:58 2011 +0200

    drisw: Fix 24bpp software rendering, take 2
    
    This patch add the support for 24bpp in the dri/swrast implementation.
    See http://bugs.freedesktop.org/show_bug.cgi?id=23525
    
    Signed-off-by: Marc Pignat <marc at pignat.org>
    Signed-off-by: Brian Paul <brianp@vmware.com>

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.