WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
79317
Remove GraphicsContext3D::paintsIntoCanvasBuffer and unify WebGL and canvas 2d logic
https://bugs.webkit.org/show_bug.cgi?id=79317
Summary
Remove GraphicsContext3D::paintsIntoCanvasBuffer and unify WebGL and canvas 2...
James Robinson
Reported
2012-02-22 18:47:34 PST
Remove GraphicsContext3D::paintsIntoCanvasBuffer and unify WebGL and canvas 2d logic
Attachments
Patch
(10.79 KB, patch)
2012-02-22 18:53 PST
,
James Robinson
no flags
Details
Formatted Diff
Diff
Patch
(1.44 KB, patch)
2012-02-22 23:10 PST
,
James Robinson
no flags
Details
Formatted Diff
Diff
Patch
(1.21 KB, patch)
2012-02-23 11:55 PST
,
Matthew Delaney
oliver
: review+
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
James Robinson
Comment 1
2012-02-22 18:53:22 PST
Created
attachment 128367
[details]
Patch
Kenneth Russell
Comment 2
2012-02-22 19:04:14 PST
Comment on
attachment 128367
[details]
Patch Thumbs up. r=me
James Robinson
Comment 3
2012-02-22 19:06:50 PST
Committed
r108597
: <
http://trac.webkit.org/changeset/108597
>
Matthew Delaney
Comment 4
2012-02-22 19:54:49 PST
I believe you left something out. Last I checked, we aren't using the ACCELERATED_2D_CANVAS flag that was used here:
http://trac.webkit.org/changeset/108597/trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp
So, CRC2D.cpp I think should have this full line unless I missed something else in your patch (I'm on a bumpy bus at the moment): #if ENABLE(ACCELERATED_2D_CANVAS) && USE(ACCELERATED_COMPOSITING)
James Robinson
Comment 5
2012-02-22 19:59:34 PST
(In reply to
comment #4
)
> I believe you left something out. Last I checked, we aren't using the ACCELERATED_2D_CANVAS flag that was used here:
http://trac.webkit.org/changeset/108597/trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp
> > So, CRC2D.cpp I think should have this full line unless I missed something else in your patch (I'm on a bumpy bus at the moment): > #if ENABLE(ACCELERATED_2D_CANVAS) && USE(ACCELERATED_COMPOSITING)
I believe the existing checks in CanvasRenderingContext2D::isAccelerated() are sufficient for the mac build, which doesn't set ENABLE(ACCELERATED_2D_CANVAS). Let me know if that's not the case.
Matthew Delaney
Comment 6
2012-02-22 20:09:17 PST
Ugh, all these poorly named variables. I can hardly view it on here, but if that m_context->paintsIntoBuffer check was a 2d context, then in our case we want it to return true whether or not it's accelerated. In the 2D case, we're always rendering into an intermediary buffer which is what I think that check was for, right? I'll have to check when I get home though it doesn't look right at first glance. I'm all for cleanup there though!
James Robinson
Comment 7
2012-02-22 20:17:39 PST
I see, so you want paintsIntoCanvasBuffer() to return true for accelerated 2d canvases? That's easy enough to accomplish. Would you mind expanding a bit on why? I was under the (perhaps mistaken) impression that the Mac accelerated canvas 2d implementation was also constructing a composited layer for the canvas content and thus there is no need to do anything at paint time. Perhaps the better thing to key this off of is asking the CanvasRenderingContext if it is currently compositing into a layer or not.
Simon Fraser (smfr)
Comment 8
2012-02-22 22:49:34 PST
> I was under the (perhaps mistaken) impression that the Mac accelerated canvas 2d implementation was also constructing a composited layer for the canvas content and thus there is no need to do anything at paint time.
No. We do that for WebGL, but not for normal canvases. For those, we use an IOSurface-backed ImageBuffer, but we still paint that buffer into a CALayer to get the canvas displayed. We do that for synchronization reasons; we have to ensure that the painting into the canvas buffer is flushed somehow, and painting the buffer is equivalent to doing some kind of context flush.
James Robinson
Comment 9
2012-02-22 23:09:54 PST
(In reply to
comment #8
)
> > I was under the (perhaps mistaken) impression that the Mac accelerated canvas 2d implementation was also constructing a composited layer for the canvas content and thus there is no need to do anything at paint time. > > No. We do that for WebGL, but not for normal canvases. For those, we use an IOSurface-backed ImageBuffer, but we still paint that buffer into a CALayer to get the canvas displayed. We do that for synchronization reasons; we have to ensure that the painting into the canvas buffer is flushed somehow, and painting the buffer is equivalent to doing some kind of context flush.
Gotcha. I think
James Robinson
Comment 10
2012-02-22 23:10:47 PST
Reopening to attach new patch.
James Robinson
Comment 11
2012-02-22 23:10:49 PST
Created
attachment 128402
[details]
Patch
James Robinson
Comment 12
2012-02-22 23:14:40 PST
Whoops, hit commit too soon. This completely untested patch should restore the previous behavior for !ENABLE(ACCELERATED_2D_CANVAS) builds - would one of you like to confirm whether this helps? If not I can test it tomorrow on a Mac Pro with Lion. The interesting case is a 2d canvas that happens to be composited for other reasons (a 3d transform or the like). I'm a bit academically curious about how the synchronization is different between canvas and WebGL in CoreAnimation. For instance, I know that some WebGL sites move an DOM element on top of the WebGL content in script and expect them to stay in sync - is that different for webgl and canvas content?
Matthew Delaney
Comment 13
2012-02-23 11:46:22 PST
Comment on
attachment 128402
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=128402&action=review
I just built ToT and it's definitely broken, so please commit this asap.
> Source/WebCore/html/HTMLCanvasElement.cpp:277 > +#if !ENABLE(ACCELERATED_2D_CANVAS)
I think USE(IOSURFACE_CANVAS_BACKING_STORE) is more precise
James Robinson
Comment 14
2012-02-23 11:55:29 PST
(In reply to
comment #13
)
> (From update of
attachment 128402
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=128402&action=review
> > I just built ToT and it's definitely broken, so please commit this asap. >
Find me a review and sure :)
> > Source/WebCore/html/HTMLCanvasElement.cpp:277 > > +#if !ENABLE(ACCELERATED_2D_CANVAS) > > I think USE(IOSURFACE_CANVAS_BACKING_STORE) is more precise
I think that makes a lot less sense in the context of this function. The question this is asking is "if the accelerated 2d canvas feature is off, then all 2d contexts paint into the canvas buffer". This is the case for IOSURFACE_CANVAS_BACKING_STORE and any other possible canvas 2d rendering model that isn't ENABLE(ACCELERATED_2D_CANVAS).
Matthew Delaney
Comment 15
2012-02-23 11:55:44 PST
Created
attachment 128522
[details]
Patch
Matthew Delaney
Comment 16
2012-02-23 12:00:56 PST
(In reply to
comment #14
)
> (In reply to
comment #13
) > > (From update of
attachment 128402
[details]
[details]) > > View in context:
https://bugs.webkit.org/attachment.cgi?id=128402&action=review
> > > > I just built ToT and it's definitely broken, so please commit this asap. > > > > Find me a review and sure :)
Wanna just review mine instead? :-)
> > > > Source/WebCore/html/HTMLCanvasElement.cpp:277 > > > +#if !ENABLE(ACCELERATED_2D_CANVAS) > > > > I think USE(IOSURFACE_CANVAS_BACKING_STORE) is more precise > > I think that makes a lot less sense in the context of this function. The question this is asking is "if the accelerated 2d canvas feature is off, then all 2d contexts paint into the canvas buffer". This is the case for IOSURFACE_CANVAS_BACKING_STORE and any other possible canvas 2d rendering model that isn't ENABLE(ACCELERATED_2D_CANVAS).
I think this logic is a bit misplaced in general. The confusing part is that we have multiple flags that say "accelerated canvas" of which the iosurface backing store one is probably the most confusing. I'll just clean this up in a separate patch, but it's still true that for now my having the iosurface flag is more precise here.
James Robinson
Comment 17
2012-02-23 12:15:48 PST
Comment on
attachment 128522
[details]
Patch Won't this break WebGL?
Matthew Delaney
Comment 18
2012-02-23 12:16:51 PST
Committed
r108657
: <
http://trac.webkit.org/changeset/108657
>
Matthew Delaney
Comment 19
2012-02-23 12:18:18 PST
(In reply to
comment #17
)
> (From update of
attachment 128522
[details]
) > Won't this break WebGL?
Damn, you're right. Not sure your original path is going to work then...
Matthew Delaney
Comment 20
2012-02-23 12:25:37 PST
(In reply to
comment #19
)
> (In reply to
comment #17
) > > (From update of
attachment 128522
[details]
[details]) > > Won't this break WebGL? > > Damn, you're right. Not sure your original path is going to work then...
I see, I forgot the is2d() here. Adding that in now.
Matthew Delaney
Comment 21
2012-02-23 12:29:07 PST
(In reply to
comment #20
)
> (In reply to
comment #19
) > > (In reply to
comment #17
) > > > (From update of
attachment 128522
[details]
[details] [details]) > > > Won't this break WebGL? > > > > Damn, you're right. Not sure your original path is going to work then... > > I see, I forgot the is2d() here. Adding that in now.
Committed that quick fix here:
http://trac.webkit.org/changeset/108658
Stephen White
Comment 22
2012-02-23 22:43:22 PST
Comment on
attachment 128367
[details]
Patch Post-hoc drive-by: this is great to see. Now if we could get rid of its use in GraphicsContext3DPrivate::platformTexture(), we could get rid of m_webViewImpl altogether. (Kind of weird the way it's grabbing the onscreen context at that point, actually.)
James Robinson
Comment 23
2012-02-24 10:58:56 PST
(In reply to
comment #22
)
> (From update of
attachment 128367
[details]
) > Post-hoc drive-by: this is great to see. Now if we could get rid of its use in GraphicsContext3DPrivate::platformTexture(), we could get rid of m_webViewImpl altogether. (Kind of weird the way it's grabbing the onscreen context at that point, actually.)
http://trac.webkit.org/changeset/108706/trunk/Source/WebKit/chromium/src/GraphicsContext3DChromium.cpp
:)
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug