Last Comment Bug 715952 - glxtest incorrectly creates the backing pixmap and causes X errors
: glxtest incorrectly creates the backing pixmap and causes X errors
Product: Core
Classification: Components
Component: Graphics (show other bugs)
: Trunk
: x86_64 Linux
: -- normal (vote)
: mozilla12
Assigned To: Nicholas Miell
: Milan Sreckovic [:milan]
Depends on:
  Show dependency treegraph
Reported: 2012-01-06 10:19 PST by Nicholas Miell
Modified: 2012-04-17 22:19 PDT (History)
4 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

Fix glxtest pixmap creation (769 bytes, patch)
2012-01-06 10:19 PST, Nicholas Miell
jacob.benoit.1: review+
Details | Diff | Splinter Review

Description Nicholas Miell 2012-01-06 10:19:56 PST
Created attachment 586472 [details] [diff] [review]
Fix glxtest pixmap creation

The call to XCreatePixmap() at hardcodes the depth to be 32, while the call to glXCreatePixmap() on the next line uses the first GLXFBConfig returned by the previous glXChooseFBConfig() which doesn't necessarily have a depth of 32. 

This appears to work without error with Mesa hardware rendering, but it will cause a BadMatch error when glMakeCurrent(dpy, None, NULL) is called on line 246 with Mesa software rendering as Mesa attempts to XPutImage() a 24-bit pixmap created internally on the 32-bit pixmap supplied by Firefox. Not surprisingly, the first GLXFBConfig returned by glXChooseFBConfig() with Mesa software rendering has a depth of 24.

This has a very easy fix, change the 32 in the call to XCreatePixmap to vInfo->depth. I've tested it on Firefox 9.0.1 on a 64-bit Fedora 16 system, and Firefox now works with Mesa software rendering.
Comment 1 Tim (fmdeveloper) 2012-01-06 14:50:48 PST
Moving over to Toolkit -> General for further triage.
Comment 2 Benoit Jacob [:bjacob] (mostly away) 2012-01-07 15:26:27 PST
Comment on attachment 586472 [details] [diff] [review]
Fix glxtest pixmap creation

Review of attachment 586472 [details] [diff] [review]:

Many thanks for the debugging and the patch!
Comment 3 Benoit Jacob [:bjacob] (mostly away) 2012-01-07 15:28:24 PST
Also, support for Mesa software rendering is very important as it's the only way to make WebGL support ubiquitous without involving proprietary software (Mesa seems to be the only competitive open source software OpenGL implementation).
Comment 4 Benoit Jacob [:bjacob] (mostly away) 2012-01-07 15:47:35 PST
Comment 5 Ed Morley [:emorley] 2012-01-09 15:10:23 PST

Note You need to log in before you can comment on or make changes to this bug.