Closed Bug 775706 Opened 13 years ago Closed 12 years ago

Use SurfaceTexture for WebGL

Categories

(Firefox for Android Graveyard :: Toolbar, defect)

ARM
Android
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: snorp, Unassigned)

Details

Attachments

(1 file, 3 obsolete files)

At least in theory, backing our WebGL contexts with a SurfaceTexture could greatly improve performance due to the lack of copying necessary. We should investigate it.
OS: Mac OS X → Android
Hardware: x86 → ARM
(In reply to James Willcox (:snorp) (jwillcox@mozilla.com) from comment #0) > At least in theory, backing our WebGL contexts with a SurfaceTexture could > greatly improve performance due to the lack of copying necessary. We should > investigate it. With the EGLImage stuff that landed recently, this shouldn't give any great improvement for performance. We should wait on bug 716859 for the refactor of this area.
In theory it should get rid of CopyTexImage, would it not? That should be noticeable, but I don't see any significant difference unfortunately. Also, there's a bug -- load http://conduit.bitops.com/~vladimir/misc/clear-varying-color-noalpha-pm.html and then when it's done, pan the window around. The background (webgl canvas) color will keep changing for a while, as if there were pending updates. That's a little weird. :)
(In reply to Vladimir Vukicevic [:vlad] [:vladv] from comment #3) > In theory it should get rid of CopyTexImage, would it not? That should be > noticeable, but I don't see any significant difference unfortunately. > > Also, there's a bug -- load > http://conduit.bitops.com/~vladimir/misc/clear-varying-color-noalpha-pm.html > and then when it's done, pan the window around. The background (webgl > canvas) color will keep changing for a while, as if there were pending > updates. That's a little weird. :) We're getting a generic and relatively simple interface for this soon. This will provide no-copy webgl where possible. I would much prefer to wait about a week for this to go in.
On Galaxy Nexus there doesn't seem to be much difference between SurfaceTexture and the current implementation. However, on the HTC One X (which is S4/Adreno), there is a pretty dramatic difference. I think we may want SurfaceTexture eventually just to work around buggy CopyTexSubImage2D bustedness.
Interesting! I was also trying on Galaxy Nexus; I'll try on my Tegra 3 One X at some point too.
Attached patch Another WIP, now with fences (obsolete) — Splinter Review
Not sure if I'm really using the fence stuff properly...
Attachment #643979 - Attachment is obsolete: true
SwapBuffers discussion from irc: 14:04 <@vlad> snorp: so UpdateSharedHandle is called in BasicShadowableCanvasLayer::Paint 14:05 <@vlad> which should be the right time, since that'll be called when we're actually about to "composite" (that is, send the transaction to the compositor) 14:05 <@vlad> but the problem you're having is that the main thread can then swap again, if it's already ready to queue another frame before the compositor is ready for it 14:05 <@vlad> (I think.) 14:05 <@vlad> jgilbert's patch doesn't ever swap like that, it builds up a queue of frames and only reuses a frame/texture when the compositor is done with it So to use SurfaceTexture, we have to end up blocking on the compositor being done with the frame. Or to throw it away if it's not ready for it, which is an interesting idea that would require some webgl spec changes (an additonal context creation flag, basically telling the system that rendering will be continuous, so that it can skip compositing frames after it's needed).
Ignore the above, wrong bug.
Attachment #645332 - Attachment is obsolete: true
This looks great -- let's do it, but please make preserveDrawingBuffer=true continue to work (by just bailing out of the SurfaceTexture path, most likely I think).
Attachment #662588 - Attachment is obsolete: true
Attachment #662588 - Flags: review?(vladimir)
Attachment #666964 - Flags: review?(jgilbert)
The ContextFlags changes were a little more invasive than I initially planned, but I think it's more correct now.
This seems like it'll just be immediately supplanted by bug 716859.
Attachment #666964 - Flags: review?(vladimir)
Attachment #666964 - Flags: review?(jgilbert)
This bug obsoleted by bug 716859
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → WONTFIX
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: