Closed
Bug 895116
Opened 11 years ago
Closed 11 years ago
BasicCompositor fixes
Categories
(Core :: Graphics: Layers, defect)
Core
Graphics: Layers
Tracking
()
RESOLVED
FIXED
mozilla25
People
(Reporter: dzbarsky, Assigned: dzbarsky)
References
Details
Attachments
(6 files, 2 obsolete files)
997 bytes,
patch
|
mattwoodrow
:
review+
|
Details | Diff | Splinter Review |
2.79 KB,
patch
|
mattwoodrow
:
review+
|
Details | Diff | Splinter Review |
1.35 KB,
patch
|
roc
:
review+
|
Details | Diff | Splinter Review |
1.38 KB,
patch
|
mattwoodrow
:
review+
|
Details | Diff | Splinter Review |
2.35 KB,
patch
|
mattwoodrow
:
review+
|
Details | Diff | Splinter Review |
1.70 KB,
patch
|
bas.schouten
:
review+
|
Details | Diff | Splinter Review |
No description provided.
Assignee | ||
Comment 1•11 years ago
|
||
...because that's what BasicCanvasLayer expects.
Updated•11 years ago
|
Attachment #777371 -
Flags: review?(matt.woodrow) → review+
Assignee | ||
Comment 2•11 years ago
|
||
Attachment #777418 -
Flags: review?(matt.woodrow)
Updated•11 years ago
|
Attachment #777418 -
Flags: review?(matt.woodrow) → review+
Assignee | ||
Comment 3•11 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/128e7da5f9b2
https://hg.mozilla.org/integration/mozilla-inbound/rev/d07610709b5d
Whiteboard: [leave open]
Comment 4•11 years ago
|
||
Assignee | ||
Comment 5•11 years ago
|
||
This is almost certainly not what we want, but it does fix the rendering. The issue is that we paint twice - once with CanvasLayerComposite::RenderLayer, which comes out upside down, and a second time with CopyableCanvasLayer::PaintWithOpacity. Perhaps we shouldn't be doing that?
Attachment #778875 -
Flags: review?(matt.woodrow)
Comment 6•11 years ago
|
||
Comment on attachment 778875 [details] [diff] [review]
Hack needsYFlip
Review of attachment 778875 [details] [diff] [review]:
-----------------------------------------------------------------
We shouldn't need to do this!
The NeedsYFlip should already be shared with the compositor using texture flags.
We read it here and produce texture coords that have a negative height: http://mxr.mozilla.org/mozilla-central/source/gfx/layers/composite/ImageHost.cpp#125
Then we use that to produce a pattern matrix that should include a y-flip: http://mxr.mozilla.org/mozilla-central/source/gfx/layers/basic/BasicCompositor.cpp#248
And that should result in the image being flipped. Which of these things isn't happening?
Could possibly be a bug with pattern transforms in your azure backend (which are you using?).
Assignee | ||
Comment 7•11 years ago
|
||
Looks like you may have checked these in by accident.
Attachment #778884 -
Flags: review?(roc)
Attachment #778884 -
Flags: review?(roc) → review+
Assignee | ||
Comment 8•11 years ago
|
||
Thanks for the pointers Matt. It made this much easier to track down.
Attachment #778875 -
Attachment is obsolete: true
Attachment #778875 -
Flags: review?(matt.woodrow)
Attachment #778902 -
Flags: review?(matt.woodrow)
Comment 9•11 years ago
|
||
Comment on attachment 778902 [details] [diff] [review]
Fix needsYFlip
Review of attachment 778902 [details] [diff] [review]:
-----------------------------------------------------------------
\o/
Attachment #778902 -
Flags: review?(matt.woodrow) → review+
Assignee | ||
Comment 10•11 years ago
|
||
Comment 11•11 years ago
|
||
Assignee | ||
Comment 12•11 years ago
|
||
This fixes some of the failing border-radius tests. The rest seem to be failing because of opacity problems. I'll try to figure that out next.
Attachment #779403 -
Flags: review?(matt.woodrow)
Comment 13•11 years ago
|
||
Comment on attachment 779403 [details] [diff] [review]
Fix masking
Review of attachment 779403 [details] [diff] [review]:
-----------------------------------------------------------------
::: gfx/layers/basic/BasicCompositor.cpp
@@ +58,5 @@
> MOZ_ASSERT(mThebesImage);
> + mFormat =
> + (mThebesImage->Format() == gfxASurface::ImageFormatA8) ? FORMAT_A8 :
> + (surf.ContentType() == gfxASurface::CONTENT_COLOR_ALPHA) ? FORMAT_B8G8R8A8 :
> + FORMAT_B8G8R8X8;
Just use this function instead: http://mxr.mozilla.org/mozilla-central/source/gfx/thebes/gfx2DGlue.h#201
@@ +255,5 @@
> gfxPoint(aDestRect.XMost(), aDestRect.y),
> gfxPoint(aDestRect.XMost(), aDestRect.YMost()));
> Matrix matrix = ToMatrix(transform);
> if (aMask) {
> + // xxxdz handle the case when our mask transform is more than just a translation
NS_ASSERTION that we're only getting translations for now?
@@ +291,5 @@
> RefPtr<SourceSurface> sourceMask;
> Matrix maskTransform;
> if (aEffectChain.mSecondaryEffects[EFFECT_MASK]) {
> EffectMask *effectMask = static_cast<EffectMask*>(aEffectChain.mSecondaryEffects[EFFECT_MASK].get());
> + static_cast<DeprecatedTextureHost*>(effectMask->mMaskTexture)->Lock();
No matching unlock!
Put this in a separate patch, and then get Bas to review/feedback it.
We're going to want to do this for all the compositor backends, or move it up to shared code.
It's not obvious what the best spot would be though, I'm sure Bas will have an opinion.
Assignee | ||
Comment 14•11 years ago
|
||
Attachment #779403 -
Attachment is obsolete: true
Attachment #779403 -
Flags: review?(matt.woodrow)
Attachment #779433 -
Flags: review?(matt.woodrow)
Comment 16•11 years ago
|
||
Comment on attachment 779434 [details] [diff] [review]
BasicCompositor needs to lock the TextureHost for the mask
Bas, we probably need this for all the Compositor backend.
Any thoughts on the best place to do this locking?
Attachment #779434 -
Flags: review? → review?(bas)
Updated•11 years ago
|
Attachment #779433 -
Flags: review?(matt.woodrow) → review+
Assignee | ||
Comment 17•11 years ago
|
||
Comment on attachment 779433 [details] [diff] [review]
Fix masking
Review of attachment 779433 [details] [diff] [review]:
-----------------------------------------------------------------
::: gfx/layers/basic/BasicCompositor.cpp
@@ +255,5 @@
> if (aMask) {
> + NS_ASSERTION(matrix._11 == 1.0f && matrix._12 == 0.0f &&
> + matrix._21 == 0.0f && matrix._22 == 1.0f,
> + "Can only handle translations for mask transform");
> + aDest->MaskSurface(SurfacePattern(aSource, EXTEND_CLAMP, matrix),
This assertion should be checking aMaskTransform. Fixed locally.
Comment 18•11 years ago
|
||
(In reply to Matt Woodrow (:mattwoodrow) from comment #16)
> Comment on attachment 779434 [details] [diff] [review]
> BasicCompositor needs to lock the TextureHost for the mask
>
> Bas, we probably need this for all the Compositor backend.
>
> Any thoughts on the best place to do this locking?
I don't think there is anywhere shared we can put it. I think it just needs to be like it is here, but for all compositors.
Comment 19•11 years ago
|
||
(In reply to David Zbarsky (:dzbarsky) from comment #17)
> Comment on attachment 779433 [details] [diff] [review]
> Fix masking
>
> Review of attachment 779433 [details] [diff] [review]:
> -----------------------------------------------------------------
>
> ::: gfx/layers/basic/BasicCompositor.cpp
> @@ +255,5 @@
> > if (aMask) {
> > + NS_ASSERTION(matrix._11 == 1.0f && matrix._12 == 0.0f &&
> > + matrix._21 == 0.0f && matrix._22 == 1.0f,
> > + "Can only handle translations for mask transform");
> > + aDest->MaskSurface(SurfacePattern(aSource, EXTEND_CLAMP, matrix),
>
> This assertion should be checking aMaskTransform. Fixed locally.
I don't think this is right. Why can't we handle other kinds of transforms?
Assignee | ||
Comment 20•11 years ago
|
||
(In reply to Nick Cameron [:nrc] from comment #19)
> (In reply to David Zbarsky (:dzbarsky) from comment #17)
> > Comment on attachment 779433 [details] [diff] [review]
> > Fix masking
> >
> > Review of attachment 779433 [details] [diff] [review]:
> > -----------------------------------------------------------------
> >
> > ::: gfx/layers/basic/BasicCompositor.cpp
> > @@ +255,5 @@
> > > if (aMask) {
> > > + NS_ASSERTION(matrix._11 == 1.0f && matrix._12 == 0.0f &&
> > > + matrix._21 == 0.0f && matrix._22 == 1.0f,
> > > + "Can only handle translations for mask transform");
> > > + aDest->MaskSurface(SurfacePattern(aSource, EXTEND_CLAMP, matrix),
> >
> > This assertion should be checking aMaskTransform. Fixed locally.
>
> I don't think this is right. Why can't we handle other kinds of transforms?
The MaskSurface api only takes an offset, not a transform matrix. According to Jeff, we'll "need to transform the draw target and adjust the SurfacePattern's matrix to compensate". This may not be perfect, but it is better than what we have currently.
Comment 21•11 years ago
|
||
(In reply to David Zbarsky (:dzbarsky) from comment #20)
> (In reply to Nick Cameron [:nrc] from comment #19)
> > (In reply to David Zbarsky (:dzbarsky) from comment #17)
> > > Comment on attachment 779433 [details] [diff] [review]
> > > Fix masking
> > >
> > > Review of attachment 779433 [details] [diff] [review]:
> > > -----------------------------------------------------------------
> > >
> > > ::: gfx/layers/basic/BasicCompositor.cpp
> > > @@ +255,5 @@
> > > > if (aMask) {
> > > > + NS_ASSERTION(matrix._11 == 1.0f && matrix._12 == 0.0f &&
> > > > + matrix._21 == 0.0f && matrix._22 == 1.0f,
> > > > + "Can only handle translations for mask transform");
> > > > + aDest->MaskSurface(SurfacePattern(aSource, EXTEND_CLAMP, matrix),
> > >
> > > This assertion should be checking aMaskTransform. Fixed locally.
> >
> > I don't think this is right. Why can't we handle other kinds of transforms?
>
> The MaskSurface api only takes an offset, not a transform matrix. According
> to Jeff, we'll "need to transform the draw target and adjust the
> SurfacePattern's matrix to compensate". This may not be perfect, but it is
> better than what we have currently.
Ah, sorry, I thought this was a transform on a mask _layer_ not a mask _surface_
Assignee | ||
Comment 22•11 years ago
|
||
Comment 23•11 years ago
|
||
(In reply to David Zbarsky (:dzbarsky) from comment #1)
> Created attachment 777371 [details] [diff] [review]
> Use an ImageSurface in CanvasClient2DUpdate
>
> ...because that's what BasicCanvasLayer expects.
What actually expects an ImageSurface and why? We just pass that surface to CopyableCanvasLayer::UpdateSurface and I don't see anything which obviously requires an image surface. We should probably fix that requirement whatever it is and undo your change here because we don't always implement LockImageSurface (sadness) and so this breaks all the windows backends. If we can use a non-image surface that is desirable because ImageSurfaces are as slow as can be.
Flags: needinfo?(dzbarsky)
Comment 24•11 years ago
|
||
(In reply to Nick Cameron [:nrc] from comment #23)
> (In reply to David Zbarsky (:dzbarsky) from comment #1)
> > Created attachment 777371 [details] [diff] [review]
> > Use an ImageSurface in CanvasClient2DUpdate
> >
> > ...because that's what BasicCanvasLayer expects.
>
> What actually expects an ImageSurface and why? We just pass that surface to
> CopyableCanvasLayer::UpdateSurface and I don't see anything which obviously
> requires an image surface. We should probably fix that requirement whatever
> it is and undo your change here because we don't always implement
> LockImageSurface (sadness) and so this breaks all the windows backends. If
> we can use a non-image surface that is desirable because ImageSurfaces are
> as slow as can be.
The answer (via irc) is http://mxr.mozilla.org/mozilla-central/source/gfx/layers/CopyableCanvasLayer.cpp#78.
Flags: needinfo?(dzbarsky)
Updated•11 years ago
|
Attachment #779434 -
Flags: review?(bas) → review+
Assignee | ||
Comment 25•11 years ago
|
||
Comment 26•11 years ago
|
||
Comment on attachment 779434 [details] [diff] [review]
BasicCompositor needs to lock the TextureHost for the mask
Review of attachment 779434 [details] [diff] [review]:
-----------------------------------------------------------------
Random drive by review. To avoid duplicating the logic, I would have done something like this, but I don't know if we guarantee the same pointer would come back. This code tells me, unlock what was locked, don't care how it got locked...
DeprecatedTextureHost* toUnlock = nullptr;
if (aEffectChain.mSecondaryEffects[EFFECT_MASK]) {
EffectMask *effectMask = static_cast<EffectMask*>(aEffectChain.mSecondaryEffects[EFFECT_MASK].get());
+ toUnlock = static_cast<DeprecatedTextureHost*>(effectMask->mMaskTexture);
+ toUnlock->Lock();
...
}
...
+ if (toUnlock) {
+ toUnlock->Unlock();
+ toUnlock = nullptr;
+ }
+
Comment 27•11 years ago
|
||
Assignee | ||
Comment 28•11 years ago
|
||
All the patches here have landed.
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Assignee | ||
Updated•11 years ago
|
Whiteboard: [leave open]
Updated•11 years ago
|
Target Milestone: --- → mozilla25
You need to log in
before you can comment on or make changes to this bug.
Description
•