Bug 1216

Summary: Colors in OpenGL apps are mixed up with i810 DRI driver
Product: xorg Reporter: Stefan Dirsch <sndirsch>
Component: Driver/intelAssignee: Xorg Project Team <xorg-team>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: high CC: ajax, eich, miguelrp
Version: git   
Hardware: Other   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Bug Depends on:    
Bug Blocks: 351    
Attachments:
Description Flags
p_i855-colorfix.diff
none
i8x0-rgb-bgr.diff none

Description Stefan Dirsch 2004-08-28 00:14:30 UTC
Colors in OpenGL apps are mixed up with i810 DRI driver (tested with i855). 
 
* How to reproduce:  
 
Start glxgears, when i810 DRI is enabled. Compare the colors of the gears the  
when DRI is disabled. 
 
It happens in 16 and 24bit color depth. And the problem doesn't happen with  
the radeon driver, neither in 16 nor in 24bit. Therefore I think it's an i810  
driver related issue.
Comment 1 Stefan Dirsch 2004-08-28 00:21:37 UTC
This happens with CVS sources from date 04-08-22.  
Comment 2 Egbert Eich 2004-08-30 07:55:45 UTC
This may be a blocker for the release. At least it should be checked if we
cannot fix it for the release.
Comment 3 Kevin E. Martin 2004-08-30 18:54:15 UTC
I'm very surprised that no one else has complained about this problem as color
errors are usually very obvious.  Perhaps this is a problem specific to your
system or your particular kernel/drm driver?

Also, have you brought this problem up on the dri-devel list?  That would be a
good place to see if this is a known issue.
Comment 4 Stefan Dirsch 2004-08-30 23:08:30 UTC
It's a 2.6 kernel. The DRM driver is taken from the same X.Org CVS sources. I 
need to subscribe to the dri-devel ML first and let you know about the results 
ASAP. 
Comment 5 Miguel Rodríguez 2004-08-31 00:16:33 UTC
It works fine here. It's a 865 chipset, with the i915 drm driver. Running third
X.org release candidate.
Comment 6 Dave Airlie 2004-08-31 01:20:57 UTC
I've noticed on my i865 that in neverwinter nights some of the colours are not
what they should be, but I never got a test case small enough to track it down...

Keithw commited some changes to the i915 driver in DRI CVS (and they are in
Xorg), to change the pixel packing..  no idea what reverting does might do...
Comment 7 Stefan Dirsch 2004-08-31 02:10:44 UTC
Just verified that it also happens with i845G. i915 DRM kernel module and  
i915 DRI driver are used. Meanwhile Keith Whitwell sent me a patch, which 
might fix the problem by replacing EMIT_4UB_4F_RGBA/EMIT_3UB_3F_RGB with 
EMIT_4UB_4F_BGRA/EMIT_3UB_3F_BGR in i830_vtbl.c:i830_render_start(...). Build 
is still running and I hope to get the results within an hour. 
Comment 8 Stefan Dirsch 2004-08-31 02:55:09 UTC
Created attachment 784 [details] [review]
p_i855-colorfix.diff

This patch fixes the color mixup on i845G/i855. Unfortunately I don't have any
i830/i865 machines for testing available.
Comment 9 Alex Deucher 2004-08-31 06:41:29 UTC
looks like Keith fixed this in mesa cvs:
http://marc.theaimsgroup.com/?l=mesa3d-cvs&m=109395385102951&w=2
Comment 10 Egbert Eich 2004-08-31 06:56:38 UTC
The attached fix doesn't work for i865G (Grantsdale-G) (PCI id 0x1066).
The colors of the red and blue gear are interchanged.
Comment 11 Stefan Dirsch 2004-08-31 07:03:15 UTC
So this fixes it for i845/i855 and breaks it for i865? Great. :-( 
BTW, I think you mean Device ID 2572, don't you? 
Comment 12 Stefan Dirsch 2004-08-31 07:07:30 UTC
Egbert, just to make sure. The colors are not interchanged before applying the 
patch, right? 
Comment 13 Egbert Eich 2004-08-31 09:51:46 UTC
They are. The patch doesn't change anything for i865G.
Comment 14 Stefan Dirsch 2004-08-31 12:23:28 UTC
Egbert, that's really strange that it does work fine for Miguel, but doesn't 
for you. Even after applying the patch. Is there different 865G hardware 
available? Maybe you need the other hunks, that Alex mentioned in comment #9 
(i915_fragprog.c i915_texprog.c)? 
Comment 15 Miguel Rodríguez 2004-08-31 13:17:53 UTC
Just to make sure I'm properly understood. I meant it works ok before applying
the patch (haven't tried if it changes anything). In any case I'm starting to
feel nervous if I tested the output correctly, so I'll try again tomorrow
morning when I'm againt at the box with the i865G chipset.
Comment 16 Adam Jackson 2004-08-31 19:28:33 UTC
http://marc.theaimsgroup.com/?l=mesa3d-cvs&m=109395385102951&w=2

looks related...
Comment 17 Stefan Dirsch 2004-08-31 19:52:52 UTC
Yes, that's the same link that Alex already posted in comment #9. Could anyone 
generate the diff and attach it, please? 
Comment 18 Stefan Dirsch 2004-08-31 20:05:23 UTC
Created attachment 799 [details] [review]
i8x0-rgb-bgr.diff

Here it is. :-)
Comment 19 Miguel Rodríguez 2004-09-01 00:02:46 UTC
Have tried again... Definetelly I was confused and wrong, without the patch the
red and the blue geras are interchanged. Sorry.
Comment 20 Stefan Dirsch 2004-09-01 00:22:54 UTC
Miguel, does it help to apply the patch of comment #18? 
Comment 21 Miguel Rodríguez 2004-09-01 00:35:31 UTC
Yes, it does. Just to be sure, from top to bottom and from left to right, the
colors are blue, red and green.
Comment 22 Stefan Dirsch 2004-09-01 01:23:18 UTC
Miguel, this are the correct colors. I wonder why the patch didn't help for 
Egbert (he used the patch of comment #8, which is a subset of patch #18). He 
has a 865 as well. Unfortunately he won't have access to this machine for about 
the next 10 days. Therefore I vote for applying the patch of comment #18. 
Comment 23 Miguel Rodríguez 2004-09-01 01:30:24 UTC
Ok. I have run two mores tests.
a) I reverted the patch #18 and colors were red, blue and green
b) applied the patch from #8 and colors were again blue, red and green

Hope this helps. If there is some other program to run to compare both patches I
can try it.
Comment 24 Stefan Dirsch 2004-09-01 01:43:08 UTC
Miguel, thanks for verifying that it works also with patch #8. I assume that  
you can't see any difference with glxgears with patch#8 and patch#18. You  
might need a more complex OpenGL program (with textures at least I think). 
Comment 25 Kevin E. Martin 2004-09-01 10:39:01 UTC
It sounds like the patch from Keith Whitwell is the one that we should go with.
 If there is any objection to my including it, please let me know by 6pm EDT
today (which is the deadline for all patches).
Comment 26 Kevin E. Martin 2004-09-01 19:06:17 UTC
I've now checked in the patch.
Closing.

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.