Closed
Bug 767484
Opened 12 years ago
Closed 10 years ago
Implement ANativeWindow backed EGLSurface
Categories
(Core :: Graphics: Layers, defect, P2)
Tracking
()
RESOLVED
WONTFIX
People
(Reporter: joe, Assigned: sotaro)
References
Details
(Whiteboard: [soft])
Attachments
(1 file, 17 obsolete files)
(deleted),
patch
|
Details | Diff | Splinter Review |
Once we support sharing textures between the compositor and WebGL, it should be relatively simple to extend that sharing to support gralloc for b2g (he said, waving his hands).
Comment 1•12 years ago
|
||
WebGL stuff is already on the GPU side of things. How does gralloc help us?
We can't do fast cross-process webgl without gralloc. (Until we do GL proxying, anyway.)
Comment 3•12 years ago
|
||
(In reply to Chris Jones [:cjones] [:warhammer] from comment #2)
> We can't do fast cross-process webgl without gralloc. (Until we do GL
> proxying, anyway.)
Why not?
How do you propose sharing the WebGL render target across processes?
Comment 5•12 years ago
|
||
Right, sorry. The extension I was thinking of doesn't exist yet.
I'm doing a refactoring of these backends. Are there any documents on how to create a PBuffer, GL texture, or GL renderbuffer backed by gralloc?
Updated•12 years ago
|
OS: Mac OS X → Gonk
Hardware: x86 → ARM
The android source code! ;)
Not my area of expertise though. You can get an EGLImage out of gralloc buffers, if that helps.
Comment 7•12 years ago
|
||
(In reply to Jeff Gilbert [:jgilbert] from comment #5)
> Right, sorry. The extension I was thinking of doesn't exist yet.
> I'm doing a refactoring of these backends. Are there any documents on how to
> create a PBuffer, GL texture, or GL renderbuffer backed by gralloc?
There's no documentation, but you can create an EGLImage from gralloc buffers, render into those, and then bind them as a texture on the other side. That *should* work across processes.
Updated•12 years ago
|
blocking-basecamp: ? → +
Whiteboard: [soft]
Assignee | ||
Comment 8•12 years ago
|
||
the patch add support of gralloc-backed WebGL rendering. I confirm the rendering on my hardware(MSM8960). it has some problems need to address, but it could be a start.
Comment 9•12 years ago
|
||
This seems much more complicated than is needed for gralloc-based OMTC/inter-process pass-through.
It would seem to me that all we need is the (Content) CanvasLayer, when supplied with a gralloc buffer from the Compositor, is to build an EGLImage backed by the gralloc buffer, and copy from the GLContext backing surface to the gralloc EGLImage. (Similar to bug 728524)
Assignee | ||
Comment 10•12 years ago
|
||
I have often read in many places about "performance is very important in b2g". Then, I created attachment 643291 [details] [diff] [review]. In bug 728524, fCopyTexSubImage2D() is used to copy data, it could affect to the performance.
If we want to do cross-process webgl, multiple gralloc-ed buffers are necessary. From my understanding about android, there is no simple way to do multiple gralloc-buffered OpenGL rendering. Therefore data copy to gralloc-ed buffers becomes necessary.
But in android(gonk), ANativeWindow and eglWindowSurface provide this capability. They could provide multiple gralloc-buffered GL context. By using them, we do not need to call data-copy to gralloc-ed buffers.
IMHO, if we want to get best performance in cross-process webgl in b2g, we need to use ANativeWindow and eglWindowSurface. But their implementation provide complexities...
Comment 11•12 years ago
|
||
Performance is certainly important, but when performance impact is relatively negligable, it's preferable to go with the simpler solution.
In the simple general cross-thread/process approach, double-buffering is sufficient. (for now) The way we do this for cross-threads is by copying from our GLContext's backing surface into the EGLImage, which writes to the compositor's surface directly. Currently, we use CopyTexSubImage, since we are concerned about the massive state save-restore required for drawing the texture to an EGLImage-backed framebuffer. (Even though drawing a textured quad appears to be faster than CopyTexSubImage, in general)
My understanding is that it should be simple to gralloc a buffer and attach it to an EGLImage-backed texture, and likewise content-side, attach an EGLImage to that same gralloc buffer, and just copy into it. This would seem relatively simple, and would get use the vast majority of the performance we need.
An 'easy' to use abstraction which does proper triple-buffering (when needed) is coming soon, but should only be a marginal win over our method here. (for any non-trivial webgl apps)
Assignee | ||
Comment 12•12 years ago
|
||
I agree, when performance impact is relatively negligable, we should use simpler solution.
Comment 14•12 years ago
|
||
The prereq work in bug 716859 is about ready to go up for review. This will be a 200 line patch on top of that.
Comment 15•12 years ago
|
||
Renom if you think we can't ship a v1 without this.
blocking-basecamp: + → ---
blocking-kilimanjaro: --- → +
Comment 16•12 years ago
|
||
Per IRC conversations with a few other folks, I think the best course of action if there is disagreement on whether this blocks or not is to do the following:
- Move the blocking-basecamp flag to ? for re-evaluation
- Indicate a rationale for why you disagree
blocking-basecamp: --- → ?
Updated•12 years ago
|
blocking-basecamp: ? → -
Assignee | ||
Updated•11 years ago
|
Summary: support gralloc-backed WebGL → Support ANativeWindow backed EGLSurface
Assignee | ||
Comment 17•11 years ago
|
||
From Bug 917444 and Bug 894847, I am going to rethink about this again.
Assignee | ||
Comment 18•11 years ago
|
||
This is a wip patch. Confirmed that the patch works on master hamachi.
Assignee | ||
Updated•11 years ago
|
Attachment #643291 -
Attachment is obsolete: true
Assignee | ||
Comment 19•11 years ago
|
||
By applying the patch, crystalskull draws about 33 fps both HWComposer composition and OpenGL composition on master hamachi.
Assignee | ||
Comment 20•11 years ago
|
||
(In reply to Sotaro Ikeda [:sotaro] from comment #18)
> Created attachment 819267 [details] [diff] [review]
> WIP patch - Support ANativeWindow backed EGLSurface
attachment 819267 [details] [diff] [review] does not handle correctly the following case, a dead lock happen in GonkNativeWindowClient.
- app go to background and go to foreground again.
Assignee | ||
Comment 21•11 years ago
|
||
attachment 819267 [details] [diff] [review] is [3]'s wip patch. Updated the patch for current master.
Assignee | ||
Comment 22•11 years ago
|
||
The following is a fps of crystalskull on master hamachi. Compare the fps of HwComposer composition and OpenGL composition. [3] got good fps on the both cases.
[1]
- HwComposer : 32-33fps
- OpenGL: 0fps(< 1 fps), a lot of frame drops?
[2]
- HwComposer : 30-33fps
- OpenGL:25-26fps
[3]
- HwComposer : 32-33fps
- OpenGL : 32-33fps
Assignee | ||
Comment 23•11 years ago
|
||
Sorry, [1], [2], [3] is the following.
[1] Do nothing about frame complete(current behavior)
[2] Ensure frame complete by reading one pixcel
[3] ANativeWindow backed EGLSurface
Assignee | ||
Comment 24•11 years ago
|
||
(In reply to Sotaro Ikeda [:sotaro] from comment #21)
> attachment 819267 [details] [diff] [review] is [3]'s wip patch. Updated the
> patch for current master.
It does not work on SkiaGL backed 2D canvas.
Comment 25•11 years ago
|
||
We just recently did cleanup in bug 814159... which remove backing surface and X-backed GL Context.
Can we expose some interface which would allow to build EGLSurface backed with X window, NativeSurface, or something else, instead ifdef-ing half of GLContext implementation?
Assignee | ||
Comment 26•11 years ago
|
||
attachment 819267 [details] [diff] [review] is just a prototype to show ANativwWindow backed EGLSurface working on b2g. I created a patch for next week's graphics work week in Paris. If I could get good feed back about it there, I am going to implement it more clean way. Comment 25 is also a good input.
Comment 27•11 years ago
|
||
(In reply to Oleg Romashin (:romaxa) from comment #25)
> Can we expose some interface which would allow to build EGLSurface backed
> with X window, NativeSurface, or something else, instead ifdef-ing half of
> GLContext implementation?
Sounds reasonable!
Assignee | ||
Comment 28•11 years ago
|
||
By the discussion in graphics work week in Paris, feed backs to the idea of using ANativeWindow backed EGLSurface were positive.
blocking-b2g: --- → 1.3?
Comment 29•11 years ago
|
||
Why not make GLSreenBuffer to inherit EGLNativeBase directly? use SurfaceTexture and SurfaceTextureClient introduce BinderIPC when deQ/Q. And why not update CreateConfig to enable EGL_SWAP_BEHAVIOUR_PRESERVED_BIT if needed, which is the default for 2D canvas.
Comment 30•11 years ago
|
||
And why not update fBindFramebuffer implementation? The FBO under GLScreenBuffer should be removed now, and fbo 0 means EGLSurface now.
Comment 31•11 years ago
|
||
Instead native_window_set_buffers_geometry, why not mWindowClient->perform?
Assignee | ||
Comment 32•11 years ago
|
||
(In reply to Chiajung Hung [:chiajung] from comment #29)
> Why not make GLSreenBuffer to inherit EGLNativeBase directly? use
> SurfaceTexture and SurfaceTextureClient introduce BinderIPC when deQ/Q.
It does not use Binder IPC. enqueue/dequeue happens between GonkNativeWindowClient and GonkNativeWindow. It is just simple callback.
Assignee | ||
Comment 33•11 years ago
|
||
Intent of it's implementation is to run OpenGL as same as android one.
Assignee | ||
Updated•11 years ago
|
Assignee: nobody → sotaro.ikeda.g
Comment 34•11 years ago
|
||
My inital attemp to implement this is to make GLScreenBuffer inherit EGLNativeBase and hook dequeue to SwapConsumer, queue to SwapProducer. which runs same as Android as well but code path simpler and avoid to depend on android::SurfaceTexture at all.
Assignee | ||
Updated•11 years ago
|
blocking-b2g: 1.3? → koi?
Assignee | ||
Comment 35•11 years ago
|
||
Change to 1.3? again. Right now, there is not urgent necessity to uplift to 1.2.
blocking-b2g: koi? → 1.3?
Comment 36•11 years ago
|
||
Bug 925444 requires proper handling of fence syncs which were introduced in Jellybean. In AOSP fence syncs are handled as a feature of SurfaceTexture [1] and GLConsumer [2].
Sotaro believes this can be addressed in this bug. If that is the case then this bug need to be blocking 1.3.
[1] https://www.codeaurora.org/cgit/quic/la/platform/frameworks/base/tree/core/jni/android/graphics/SurfaceTexture.cpp?h=jb_3.2#n79
[2] https://www.codeaurora.org/cgit/quic/la/platform/frameworks/native/tree/include/gui/GLConsumer.h?h=b2g_jb_3.2#n68
Comment 37•11 years ago
|
||
Sotaro, is this still on target to get resolved for 1.3 FC, if so what is the eta of resolution here ? Given the activity not sue what the next steps are, can you please help outline them with progress ?
Flags: needinfo?(sotaro.ikeda.g)
Comment 38•11 years ago
|
||
I don't think this is blocking or needs to be tracked for 1.3.
Assignee | ||
Comment 39•11 years ago
|
||
(In reply to bhavana bajaj [:bajaj] (on vacation until 12/02/2013) from comment #37)
> Sotaro, is this still on target to get resolved for 1.3 FC, if so what is
> the eta of resolution here ? Given the activity not sue what the next steps
> are, can you please help outline them with progress ?
From Comment 37, this bug is not resolved for 1.3 FC. Next step is to update a patch for not to use a lot of ifdef. To to it, need some re-structure around SurfaceStream.
Flags: needinfo?(sotaro.ikeda.g)
Comment 40•11 years ago
|
||
(In reply to Sotaro Ikeda [:sotaro] from comment #39)
> (In reply to bhavana bajaj [:bajaj] (on vacation until 12/02/2013) from
> comment #37)
> > Sotaro, is this still on target to get resolved for 1.3 FC, if so what is
> > the eta of resolution here ? Given the activity not sue what the next steps
> > are, can you please help outline them with progress ?
>
> From Comment 37, this bug is not resolved for 1.3 FC. Next step is to update
> a patch for not to use a lot of ifdef. To to it, need some re-structure
> around SurfaceStream.
mvines - Can we remove this from the FxOS v1.3 FC blocking list?
Flags: needinfo?(mvines)
Comment 41•11 years ago
|
||
Ah, it was there only because it blocked bug 925444 but that is no longer the case
blocking-b2g: 1.3? → ---
Flags: needinfo?(mvines)
Assignee | ||
Updated•11 years ago
|
blocking-b2g: --- → 1.5?
Assignee | ||
Updated•11 years ago
|
Status: NEW → ASSIGNED
Assignee | ||
Comment 42•11 years ago
|
||
By Bug 917444, WebGL performance was degraded on b2g. This bug could could solve the performance problem.
Updated•11 years ago
|
blocking-b2g: 2.0? → 2.0+
Assignee | ||
Comment 43•11 years ago
|
||
I change my mind. Bug 1001417 seems better way to enhance WebGL on b2g.
Assignee | ||
Comment 44•11 years ago
|
||
milan, how do you think about Comment 43? I changed the "blocking-b2g:" flag to "2.0?".
blocking-b2g: 2.0+ → 2.0?
Flags: needinfo?(milan)
Assignee | ||
Updated•11 years ago
|
Status: ASSIGNED → NEW
Comment 45•11 years ago
|
||
I definitely like the approach in bug 1001417.
blocking-b2g: 2.0? → ---
Flags: needinfo?(milan)
Assignee | ||
Comment 46•11 years ago
|
||
bug 1001417 is a way to go. Set this bus to INCOMPLETE.
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → INCOMPLETE
Assignee | ||
Comment 47•11 years ago
|
||
Reopen this bug. I am going to compere performance to Bug 1001417.
Status: RESOLVED → REOPENED
Resolution: INCOMPLETE → ---
Assignee | ||
Updated•11 years ago
|
Summary: Support ANativeWindow backed EGLSurface → Evaluate ANativeWindow backed EGLSurface performance
Assignee | ||
Comment 48•10 years ago
|
||
Patch for gonk JB.
Attachment #819267 -
Attachment is obsolete: true
Assignee | ||
Comment 49•10 years ago
|
||
Attachment #8428444 -
Attachment is obsolete: true
Assignee | ||
Comment 50•10 years ago
|
||
This bug's way is faster than bug 1001417. But attachment 8428449 [details] [diff] [review] seems to have some problems. Some rendering objects are not rendered(missing).
Assignee | ||
Comment 51•10 years ago
|
||
I recognized that I forgot to add release fence handling correctly.
Assignee | ||
Comment 52•10 years ago
|
||
Add ICS support.
Attachment #8428449 -
Attachment is obsolete: true
Assignee | ||
Comment 53•10 years ago
|
||
Add release fence handling. Still some specific items are not drawn. I am going to think that GLContextEGLGonkNativeWindow is missing some correct function overwrites.
Attachment #8428930 -
Attachment is obsolete: true
Assignee | ||
Comment 54•10 years ago
|
||
At first fps is very high. But after that some how fps becomes lower.
Assignee | ||
Comment 55•10 years ago
|
||
(In reply to Sotaro Ikeda [:sotaro] from comment #54)
> At first fps is very high. But after that some how fps becomes lower.
This performance drop is not always happen. This problem might not be related to graphics.
Assignee | ||
Comment 56•10 years ago
|
||
(In reply to Sotaro Ikeda [:sotaro] from comment #53)
> Created attachment 8428948 [details] [diff] [review]
> WIP patch - Support ANativeWindow backed EGLSurface
>
> Add release fence handling. Still some specific items are not drawn. I am
> going to think that GLContextEGLGonkNativeWindow is missing some correct
> function overwrites.
It became clear that the problem happened because z-buffer was missing.
Assignee | ||
Comment 57•10 years ago
|
||
Fix rendering problem. Still the patch break video playback.
Attachment #8428948 -
Attachment is obsolete: true
Assignee | ||
Comment 58•10 years ago
|
||
(In reply to Sotaro Ikeda [:sotaro] from comment #57)
> Created attachment 8429549 [details] [diff] [review]
> WIP patch - Support ANativeWindow backed EGLSurface
>
> Fix rendering problem. Still the patch break video playback.
The patch is based on Bug 1001417.
Assignee | ||
Updated•10 years ago
|
Summary: Evaluate ANativeWindow backed EGLSurface performance → Implement ANativeWindow backed EGLSurface
Assignee | ||
Comment 59•10 years ago
|
||
Fix crash problem in Youtue site.
Attachment #8429549 -
Attachment is obsolete: true
Assignee | ||
Comment 60•10 years ago
|
||
Add KK support.
Attachment #8429708 -
Attachment is obsolete: true
Assignee | ||
Comment 61•10 years ago
|
||
Add missing files.
Attachment #8430065 -
Attachment is obsolete: true
Assignee | ||
Comment 62•10 years ago
|
||
Update EGLSurface configuration.
Attachment #8430084 -
Attachment is obsolete: true
Assignee | ||
Comment 63•10 years ago
|
||
Add acquire fence handling to GonkNativeWindow.
Attachment #8430391 -
Attachment is obsolete: true
Assignee | ||
Comment 64•10 years ago
|
||
Add "webgl.eglsurface.gonk-native-window" preference.
Attachment #8432737 -
Attachment is obsolete: true
Assignee | ||
Comment 65•10 years ago
|
||
Update EGL config creation.
Attachment #8432759 -
Attachment is obsolete: true
Assignee | ||
Comment 66•10 years ago
|
||
At first, I thought that it seems necessary to handle SurfaceStream's frame copy. But it seem to be used only 2DCanvas not on WebGL.
CanvasClientSurfaceStream::Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer)
{
// snip
if (aLayer->mStream) {
stream = aLayer->mStream;
// Copy our current surface to the current producer surface in our stream, then
// call SwapProducer to make a new buffer ready.
stream->CopySurfaceToProducer(aLayer->mTextureSurface, aLayer->mFactory);
stream->SwapProducer(aLayer->mFactory, gfx::IntSize(aSize.width, aSize.height));
}
http://mxr.mozilla.org/mozilla-central/source/gfx/layers/client/CanvasClient.cpp
Assignee | ||
Comment 67•10 years ago
|
||
Fix build failures on other platforms.
Attachment #8432836 -
Attachment is obsolete: true
Assignee | ||
Comment 68•10 years ago
|
||
Change ISurfaceAllocator's MessageLoop.
Attachment #8433416 -
Attachment is obsolete: true
Assignee | ||
Comment 69•10 years ago
|
||
https://tbpl.mozilla.org/?tree=Try&rev=0db4d4a34dc5
On tryserver, some tests are failed.
Assignee | ||
Comment 70•10 years ago
|
||
un-bitrot.
Assignee | ||
Updated•10 years ago
|
Attachment #8433792 -
Attachment is obsolete: true
Assignee | ||
Comment 72•10 years ago
|
||
SurfaceStream's performance becomes almost same to this bug's patch. In this case, just use SurfaceStream is a good idea.
Status: REOPENED → RESOLVED
Closed: 11 years ago → 10 years ago
Resolution: --- → WONTFIX
You need to log in
before you can comment on or make changes to this bug.
Description
•