Closed Bug 611292 Opened 12 years ago Closed 12 years ago

Block software and non-GL2 OpenGL on OS X

Categories

(Core :: Graphics, defect)

x86
macOS
defect
Not set
major

Tracking

()

RESOLVED FIXED
Tracking Status
blocking2.0 --- betaN+

People

(Reporter: chousuke, Assigned: bjacob)

References

Details

(Keywords: perf, regression)

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:2.0b8pre) Gecko/20101110 Firefox/4.0b8pre
Build Identifier: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:2.0b8pre) Gecko/20101110 Firefox/4.0b8pre

Firefox appears to work fine if run in 64-bit mode on Snow Leopard, but running it in 32-bit mode is unusably slow, with very noticeable lag when interacting with the UI. 

Window size seems to affect this, as the slowness is most noticeable when I have Firefox maximised on my secondary (1080p) display.

Reproducible: Always

Steps to Reproduce:
1. Open Firefox/Minefield in 32-bit mode (by selecting the option via the "Get Info" dialog)
2. Make Firefox fullscreen on a large display (perhaps has to be secondary?)
3. Use Firefox as usual
Actual Results:  
Firefox is noticeably slow; even typing text in the URL bar is very laggy; It basically renders Firefox unusable in 32-bit mode on my computer.

Expected Results:  
This slowness does not appear in 64-bit mode.

Happens with a fresh profile on both Minefield and 4.0b7.

Hardware information:

Hardware Overview:

  Model Name:	MacBook
  Model Identifier:	MacBook2,1
  Processor Name:	Intel Core 2 Duo
  Processor Speed:	2.16 GHz
  Number Of Processors:	1
  Total Number Of Cores:	2
  L2 Cache:	4 MB
  Memory:	3 GB
  Bus Speed:	667 MHz

Graphics, displays:

Intel GMA 950:

  Chipset Model:	GMA 950
  Type:	GPU
  Bus:	Built-In
  VRAM (Total):	64 MB of Shared System Memory
  Vendor:	Intel (0x8086)
  Device ID:	0x27a2
  Revision ID:	0x0003
  Displays:
Color LCD:
  Resolution:	1280 x 800
  Pixel Depth:	32-Bit Color (ARGB8888)
  Main Display:	Yes
  Mirror:	Off
  Online:	Yes
  Built-In:	Yes
BenQ G2410HD:
  Resolution:	1920 x 1080 @ 60 Hz
  Pixel Depth:	32-Bit Color (ARGB8888)
  Mirror:	Off
  Online:	Yes
  Rotation:	Supported
Jarkko, If this a regression, can you identify dates for a smaller regression range?  Does it happen when started in safe mode? https://support.mozilla.com/kb/Safe+Mode
Keywords: perf
I suspect I would have to bisect nightlies from quite a long ago to find a more specific date for this, and I don't have time for that right now.

However, the problem seems to disappear if I run Firefox in safe mode. I didn't even think of that since I tested with a clean profile. What's the difference between a clean profile and safe mode?
WFM in MBP Merom 2.2GHz, OS X 10.6.5. I mainly use the release build (3.6.12) but I installed 4.0b7, tried both 64 & 32 bit modes, and did not see any performance issues.
Huh, I just did some testing and removed everything Firefox-related from my computer (after backing up my profile, of course) and now the problem manifests even in safe mode. Maybe I had accidentally opened FF in 64-bit mode when I tested; though I'm pretty sure I didn't...

I'll try to find a version where this does not happen.
Scratch the safemode comment. That was just me typoing the switch... Today is not my day.

Anyway, I narrowed the problem down to between these two versions: 

Build identifier: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:2.0b7pre) Gecko/20100929 Firefox/4.0b7pre WORKS (Built from http://hg.mozilla.org/tracemonkey/rev/f9a76b1ff3a3)

Build identifier: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:2.0b7pre) Gecko/20101001 Firefox/4.0b7pre does NOT work (Built from http://hg.mozilla.org/tracemonkey/rev/6ff07c1f4dc2)

(There didn't seem to be a mac build for the 30th? Or did I just miss it?)

Hope this helps. In both cases I downloaded the mac64.dmg and ran it in 32-bit mode, on a clean profile.
Whiteboard: lllllllllllllllllllllllllllllllllllll
Yep, still slow on today's TM build.

I can't really say if I'm hitting any of the bugs in the above query though.
I found out this problem has something to do with hardware acceleration. If I uncheck the "Use hardware acceleration when possible" in advanced settings, the lagginess in 32-bit mode goes away. Of course, performance without hardware acceleration is pretty bad (especially fast scrolling) but at least it's the same for both 32-bit and 64-bit modes.
The regression range in comment 5 includes this checkin:

  Joe Drew — Bug 580405 - Turn on OpenGL accelerated layer composition by
  default on OS X. r=vlad a=b

So that just flipped the default value of the preference comment 8 is about.

bjacob, care to take a look?

I wonder whether 10.5 shows the same performance problem....
Assignee: general → nobody
blocking2.0: --- → ?
Component: JavaScript Engine → Graphics
QA Contact: general → thebes
Summary: Running in 32-bit mode makes Firefox extremely slow → Running in 32-bit mode on Mac OS 10.6 makes Firefox extremely slow with OpenGL layers
Jarkko's graphics card (vendor 8086 device 27a2) is a Intel GMA 945. It's not programmable hardware, it doesn't have programmable shaders, so it can't accelerate our Layers.

When we initialize GL layers, we load OpenGL 2 entry points from the library, which includes the functions to handle programmable shaders. So if OpenGL initialization works, then we have OpenGL 2, and we had been relying on the assumption that that meant that we have *accelerated* OpenGL 2.

So my suspiscion (this is just speculation) is that what's happening to Jarkko might be that in 32-bit mode, he might have some *software shaders* OpenGL 2 library making OpenGL initialization succeeding but actually using slow software shaders, while in 64-bit mode, OpenGL initialization fails as it should, giving him non-OpenGL rendering which is decently fast.

Jarkko: can you please go to about:support in 32-bit firefox and then in 64-bit firefox; at the bottom there's a "graphics" section, please paste here what it says.
It says the same in both modes (in 4.0b7, without acceleration enabled): 

Adapter Description 0x24000,0x20400 
Vendor ID 4000 
Device ID 4000 
Adapter RAM 
Adapter Drivers 
Driver Version
Driver Date
Direct2D Enabled false
DirectWrite Enabled false
GPU Accelerated Windows 0/1

With acceleration, the last line just changes to 1/1 OpenGL, in both modes.
(In reply to comment #11)
> It says the same in both modes (in 4.0b7, without acceleration enabled): 
> 
> Adapter Description 0x24000,0x20400 

Ah, there we go:
http://developer.apple.com/library/mac/#DOCUMENTATION/GraphicsImaging/Reference/CGL_OpenGL/Reference/reference.html
0x24000 is "kCGLRendererIntel900ID: The Intel GMA 900 renderer."
0x20400 is "kCGLRendererGenericFloatID: The floating-point software renderer."

So I guess that the slowness is explained by the fact that, since your Intel GMA 945 card doesn't support OpenGL 2, it's using the fallback renderer 0x20400.

In any case we should just blacklist both 0x24000 and 0x20400. Patch coming.

The only thing that really puzzles me is that you report that it was fast on 64-bit code, using OpenGL (as your about:support info shows). Could it be that the 64-bit version uses a much more optimized software renderer? For example, SSE2 is available by default on 64-bit, so there are reasonable reasons why that would be the case. But I still don't think that we should allow using software OpenGL (we should get the same speed without OpenGL anyway, and also it's just too likely to be very slow at least in certain cases)

> Vendor ID 4000 
> Device ID 4000

These numbers are a bug in our code, I checked our source code getting these numbers on Mac and it's indeed wrong:
http://hg.mozilla.org/mozilla-central/file/22344f2229cc/widget/src/cocoa/GfxInfo.mm#l148
That however isn't what is causing you trouble --- these ids aren't currently used at all.

CC'ing Vlad.
bug 602739 also speculates of being a regression of bug 580405
Blocks: ogl-osx-beta
OS: Windows 7 → Mac OS X
(didn't test it, will put on tryserver if r+)

Explanatory comment from the patch:

  // CGL reports a list of renderers, some renderers are slow (e.g. software)
  // and AFAIK we can't decide which one will be used among them, so let's implement this blocklist
  // by defaulting to BLOCKED_DEVICE, and unblocking when a non-blacklisted renderer is found.
  // The assumption that we make here is that the system will spontaneously use the best/fastest renderer in the list.
  // Note that the presence of software renderer fallbacks means that slow software rendering may be automatically
  // used, which seems to be the case in bug 611292 where the user had a Intel GMA 945 card (non programmable hardware).
  // Therefore we need to explicitly blacklist non-OpenGL2 hardware, which could result in a software renderer
  // being used.
Attachment #493574 - Flags: review?(vladimir)
I'd assume that any software for Mac assumes SSE2 is available, since it's available on all Intel processors ever shipped in Macs...
Attachment #493574 - Flags: review?(vladimir) → review?(joe)
Assignee: nobody → bjacob
Status: UNCONFIRMED → NEW
blocking2.0: ? → betaN+
Ever confirmed: true
Summary: Running in 32-bit mode on Mac OS 10.6 makes Firefox extremely slow with OpenGL layers → Block software and non-GL2 OpenGL on OS X
Comment on attachment 493574 [details] [diff] [review]
blacklist software and non-GL2 hardware renderers on Mac

>+        case kCGLRendererATIRadeonX1000ID: // slow

Actually, this is "can't render to non-power-of-two texture backed framebuffers", iirc.
Attachment #493574 - Flags: review?(joe) → review+
http://hg.mozilla.org/mozilla-central/rev/ea40cb0cd218

Feel free to reopen if you still have trouble.
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Jarko, we've changed the way blacklisting works. It would be very helpful if you could retest your configuration with a nightly from today or later to see if Firefox has become slow again.
I tested with the latest nightly offered on nightly.mozilla.org, built from rev a896a9e237a0. Is that new enough?

For comparison, FF8b (my main browser at the moment) about:support says acceleration is blocked. In 32-bit nightly it says 0/1 windows accelerated, and in 64-bit nightly acceleration is apparently enabled since it says 1/1 (OpenGL)

However, I detect no noticeable slowdown in 64-bit mode. I'm only using a single fullhd monitor at this time though.
You need to log in before you can comment on or make changes to this bug.