Last Comment Bug 714723 - CAOpenGLLayer based plugins not being rendered on Firefox 9.0.1
: CAOpenGLLayer based plugins not being rendered on Firefox 9.0.1
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: Plug-ins (show other bugs)
: 9 Branch
: x86 Mac OS X
: -- normal (vote)
: ---
Assigned To: Nobody; OK to take it and work on it
:
Mentors:
Depends on:
Blocks: 687864
  Show dependency treegraph
 
Reported: 2012-01-02 23:32 PST by Vishvesh
Modified: 2012-01-18 07:08 PST (History)
5 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
modified version of NetscapeCoreAnimationPlugin which uses CAOpenGLLayer (20.20 KB, application/octet-stream)
2012-01-02 23:32 PST, Vishvesh
no flags Details

Description Vishvesh 2012-01-02 23:32:58 PST
Created attachment 585361 [details]
modified version of NetscapeCoreAnimationPlugin which uses CAOpenGLLayer

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.63 Safari/535.7

Steps to reproduce:

1. Run any plugin using CAOpenGLLayer for drawing with either Core Animation or Invalidating Core Animation drawing model set.




Actual results:

Nothing is rendered. 

Upon investigation it looks like "- (BOOL)canDrawInCGLContext:(CGLContextObj)ctx pixelFormat:(CGLPixelFormatObj)pf forLayerTime:(CFTimeInterval)t displayTime:(const CVTimeStamp *)ts;" is not called.

This doesn't happen on all the Macintosh machines. I was able to generate this issue on machines having following graphics card.

NVIDIA GeForce 8600M GT
ATI Radeon HD 2600 Pro
Intel GMA X3100





Expected results:

Animation should render
Comment 1 Vishvesh 2012-01-03 00:17:37 PST
It works fine on Intel HD Graphics and NVIDIA GeForce GT 330M. The attached plug-in code uses webkits NetscapeCoreAnimationPlugin with a basic CAOpenGLLayer. I was also able to generate the issue with FireBreath example plug-in(BasicMediaPlayer.plugin).
https://bugzilla.mozilla.org/attachment.cgi?id=569333
Comment 2 Vishvesh 2012-01-04 04:08:37 PST
Any updates on the issue?
Comment 3 Kevin Brosnan [:kbrosnan] 2012-01-04 16:48:33 PST
I just moved it to the correct area in Bugzilla. You can try poking in either https://lists.mozilla.org/listinfo/dev-tech-plugins or #developers on irc.mozilla.org
Comment 4 Benoit Girard (:BenWa) 2012-01-05 10:58:54 PST
I was away. I will be looking into this issue early next week.

I would recommend using ICA where available:
https://wiki.mozilla.org/NPAPI:InvalidatingCoreAnimation
Comment 5 Vishvesh 2012-01-05 21:28:04 PST
I see this issue with ICA too. I intend to implement ICA but right now I don't see much of an advantage since there are render problems with ICA on the above mentioned graphics card.
Comment 6 Vishvesh 2012-01-06 06:43:11 PST
I was able to fix the issue. I commented the property "kCGLPFAAllowOfflineRenderers" in the file nsCoreAnimationSupport.mm.

Line number 455 of Firefox 9 source code.

CGLPixelFormatAttribute attributes[] = {
    kCGLPFAAccelerated,
  //  kCGLPFAAllowOfflineRenderers,
    kCGLPFADepthSize, (CGLPixelFormatAttribute)24,
    (CGLPixelFormatAttribute)0
  };

According to Apple OpenGL mailing thread 

Quoting Apple's engineer:

""kCGLPFAAllowOfflineRenderers allows OpenGL view to work correctly if the user is on a MacPro and has two graphics cards and wants to drag the view across the monitors connected to different graphics cards."
--
Robert Chin
Apple Inc."

http://lists.apple.com/archives/mac-opengl/2010/Jan/msg00036.html

Setting this flag causes the rendering to fail on machines with single Graphics Card. All the machines I saw this issue on were machines with single graphics card.
Comment 7 Vishvesh 2012-01-06 06:44:29 PST
Chromium has multiple checks before setting this property, I think Firefox needs to have them to.
http://src.chromium.org/svn/trunk/src/ui/gfx/gl/gl_context_cgl.cc
Comment 8 Benoit Girard (:BenWa) 2012-01-06 07:09:09 PST
Thanks for the great investigative work Vishvesh :D!

This link has more information for you:
http://developer.apple.com/library/mac/#technotes/tn2229/_index.html

We've introduced this change to support newer macbook pros with dual gpu for battery performance. This is already improved on trunk. We've only enable the kCGLPFAAllowOfflineRenderers for certain plugins that have contacted us asking for this support so your plugin will not get this flag set on trunk.

This change is in Firefox 10: http://mxr.mozilla.org/mozilla-beta/source/gfx/thebes/nsCoreAnimationSupport.mm . Can you see if this is fixed in Firefox 10 beta? I'll see if we plan on releasing an update for Firefox 9.
Comment 9 Vishvesh 2012-01-07 00:46:11 PST
First thing on Monday morning.
Comment 10 Vishvesh 2012-01-09 00:58:19 PST
It seems to be working fine on Firefox 10 beta.
Comment 11 Vishvesh 2012-01-11 03:47:32 PST
(In reply to Benoit Girard (:BenWa) from comment #8)
> Thanks for the great investigative work Vishvesh :D!
> 
> This link has more information for you:
> http://developer.apple.com/library/mac/#technotes/tn2229/_index.html
> 
> We've introduced this change to support newer macbook pros with dual gpu for
> battery performance. This is already improved on trunk. We've only enable
> the kCGLPFAAllowOfflineRenderers for certain plugins that have contacted us
> asking for this support so your plugin will not get this flag set on trunk.
> 
> This change is in Firefox 10:
> http://mxr.mozilla.org/mozilla-beta/source/gfx/thebes/nsCoreAnimationSupport.
> mm . Can you see if this is fixed in Firefox 10 beta? I'll see if we plan on
> releasing an update for Firefox 9.

Is there going to be an update for this issue on Firefox 9?
Comment 12 Benoit Girard (:BenWa) 2012-01-11 05:26:12 PST
I've asked if this was possible. There is no planned security update for Firefox 9.0 in which I could tag this patch along. This will be released in Firefox 10 in ~3 weeks however.
Comment 13 Vishvesh 2012-01-11 05:53:05 PST
Okay

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