Closed Bug 1195653 Opened 9 years ago Closed 9 years ago

[LayerScope] Dump SecondaryEffects (EffectTypes::MASK) on Layerscope viewer

Categories

(Core :: Graphics, defect)

ARM
All
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: chenpighead, Assigned: chenpighead)

References

Details

(Whiteboard: [gfx-noted])

Attachments

(6 files, 10 obsolete files)

45 bytes, text/x-github-pull-request
boris
: review+
u459114
: feedback+
Details | Review
3.71 KB, patch
chenpighead
: review+
Details | Diff | Splinter Review
10.40 KB, patch
chenpighead
: review+
Details | Diff | Splinter Review
1.40 KB, patch
chenpighead
: review+
Details | Diff | Splinter Review
10.64 KB, patch
chenpighead
: review+
Details | Diff | Splinter Review
9.84 KB, patch
u480271
: review+
Details | Diff | Splinter Review
In current version, we only dump PrimaryEffects on Layerscope. It would be great if we dump SecondaryEffects as well. SecondaryEffects provide additional information, such like Mask Layer, which can help engineers to verify whether a mask is correct or not.
Summary: [LayerScope] Dump SecondaryEffects on Layerscope viewer → [LayerScope] Dump SecondaryEffects (EffectTypes::MASK) on Layerscope viewer
With this wip, we can see mask layer attribute on LayerScope viewer now.
Assignee: nobody → jeremychen
Status: NEW → ASSIGNED
Comment on attachment 8649854 [details] [diff] [review]
[wip] Dump SecondaryEffects EffectTypes::Mask on LayerScope viewer

Review of attachment 8649854 [details] [diff] [review]:
-----------------------------------------------------------------

::: gfx/layers/LayerScope.cpp
@@ +1068,5 @@
> +
> +    GLuint texID = GetTextureID(aGLContext, source);
> +    if (IsTextureIdContainsInList(texID)) {
> +        return;
> +    }

Can we move IsTextureIdContainsInList into SendTextureSource?

@@ +1144,5 @@
>  
> +    if (aEffectChain.mSecondaryEffects[EffectTypes::MASK]) {
> +        const Effect* secondaryEffect = aEffectChain.mSecondaryEffects[EffectTypes::MASK];
> +        const EffectMask* effectMask =
> +            static_cast<const EffectMask*>(secondaryEffect);

const EffectMask* effectMask = static_cast<const EffectMask*>(aEffectChain.mSecondaryEffects[EffectTypes::MASK].get());
Blocks: 1205521
Use SendTextureSource() to send mask effect to layerscope viewer.
Attachment #8649854 - Attachment is obsolete: true
Attachment #8662825 - Flags: feedback?(cku)
Since we always check IsTextureIdContainsInList before SendTextureSource(), move IsTextureIdContainsInList into SendTextureSource().
Attachment #8662827 - Flags: feedback?(cku)
Comment on attachment 8662827 [details] [diff] [review]
Part2: Move IsTextureIdContainsInList into SendTextureSource. (v1)

Review of attachment 8662827 [details] [diff] [review]:
-----------------------------------------------------------------

::: gfx/layers/LayerScope.cpp
@@ +1117,5 @@
>          return;
>      }
>  
> +#ifdef MOZ_WIDGET_GONK
> +    GLuint texID = GetTextureID(aGLContext, aSource);

Move this statement into SendGraphicBuffer?
Attachment #8662827 - Flags: feedback?(cku) → feedback+
Comment on attachment 8662825 [details] [diff] [review]
Part1.1: Dump SecondaryEffects (EffectTypes::MASK) on Layerscope viewer (v2)

Review of attachment 8662825 [details] [diff] [review]:
-----------------------------------------------------------------

::: gfx/layers/LayerScope.cpp
@@ +1145,5 @@
> +    }
> +
> +    SendTextureSource(aGLContext, aLayerRef, source, texID, false);
> +}
> +

How to know a texture is a color one or a mask one at viewer side?
Attachment #8662825 - Flags: feedback?(cku) → feedback+
(In reply to C.J. Ku[:cjku] from comment #5)
> Comment on attachment 8662827 [details] [diff] [review]
> Part2: Move IsTextureIdContainsInList into SendTextureSource. (v1)
> 
> Review of attachment 8662827 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> ::: gfx/layers/LayerScope.cpp
> @@ +1117,5 @@
> >          return;
> >      }
> >  
> > +#ifdef MOZ_WIDGET_GONK
> > +    GLuint texID = GetTextureID(aGLContext, aSource);
> 
> Move this statement into SendGraphicBuffer?


Good idea. Thanks for the feedback! :)
(In reply to C.J. Ku[:cjku] from comment #6)
> Comment on attachment 8662825 [details] [diff] [review]
> Part1: Dump SecondaryEffects (EffectTypes::MASK) on Layerscope viewer (v2)
> 
> Review of attachment 8662825 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> ::: gfx/layers/LayerScope.cpp
> @@ +1145,5 @@
> > +    }
> > +
> > +    SendTextureSource(aGLContext, aLayerRef, source, texID, false);
> > +}
> > +
> 
> How to know a texture is a color one or a mask one at viewer side?

I'm considering sending this information from gecko to layerscope viewer through protobuf. Still debug my wip. I'll send feedback request once it is ready.
Attachment #8662825 - Attachment description: Part1: Dump SecondaryEffects (EffectTypes::MASK) on Layerscope viewer (v2) → Part1.1: Dump SecondaryEffects (EffectTypes::MASK) on Layerscope viewer (v2)
Since we always check IsTextureIdContainsInList before SendTextureSource(), move IsTextureIdContainsInList into SendTextureSource().
Attachment #8662827 - Attachment is obsolete: true
Comment on attachment 8663592 [details] [diff] [review]
Part1.5: Send isMask info to LayerScope viewer by TexturePacket. (v1)

Review of attachment 8663592 [details] [diff] [review]:
-----------------------------------------------------------------

::: gfx/layers/LayerScope.cpp
@@ +531,5 @@
>            mTarget(target),
>            mName(name),
>            mContextAddress(reinterpret_cast<intptr_t>(cx)),
> +          mDatasize(0),
> +          mPacket(Move(aPacket))

Why don't you just pass a boolean parameter,aIsMaskTexture, here?

@@ +1168,5 @@
>      TextureSourceOGL* sourceCr = sourceYCbCr->GetSubSource(Cr)->AsSourceOGL();
>  
> +    auto packet = MakeUnique<layerscope::Packet>();
> +
> +    SendTextureSource(aGLContext, aLayerRef, sourceY, false, Move(packet));

Move the same unique_ptr three times?
Attachment #8663592 - Flags: feedback?(cku) → feedback-
Comment on attachment 8663588 [details] [diff] [review]
Part1.3: Add isMask attribute field to LayerScopePacket.proto. (v1)

Review of attachment 8663588 [details] [diff] [review]:
-----------------------------------------------------------------

::: gfx/layers/protobuf/LayerScopePacket.proto
@@ +31,5 @@
>    optional uint64 glcontext = 8;
>    optional bytes data = 9;
> +
> +  // Texture effect attributes (10 to 19)
> +  // TODO: reserved for texture effect attributes, see Bug 1205521

reserved for primary textured effect.
Attachment #8663588 - Flags: feedback?(cku) → feedback+
Attachment #8663596 - Flags: feedback?(cku) → feedback-
(In reply to C.J. Ku[:cjku] from comment #15)
> Comment on attachment 8663592 [details] [diff] [review]
> Part1.5: Send isMask info to LayerScope viewer by TexturePacket. (v1)
> 
> Review of attachment 8663592 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> ::: gfx/layers/LayerScope.cpp
> @@ +531,5 @@
> >            mTarget(target),
> >            mName(name),
> >            mContextAddress(reinterpret_cast<intptr_t>(cx)),
> > +          mDatasize(0),
> > +          mPacket(Move(aPacket))
> 
> Why don't you just pass a boolean parameter,aIsMaskTexture, here?

In this bug, I think only passing a boolean is sufficient. However, if I intend to dump secondary mask effect attributes in SendMaskEffect() (see Bug 1205521) by texture packet, the unique_ptr and move operator would be needed. So, I kind of doing this to create the infrastructure for Bug 1205521. Is that okay if I keep the infrastructure but adding some comments here?

> @@ +1168,5 @@
> >      TextureSourceOGL* sourceCr = sourceYCbCr->GetSubSource(Cr)->AsSourceOGL();
> >  
> > +    auto packet = MakeUnique<layerscope::Packet>();
> > +
> > +    SendTextureSource(aGLContext, aLayerRef, sourceY, false, Move(packet));
> 
> Move the same unique_ptr three times?

This is definitely wrong.
Attachment #8663592 - Attachment is obsolete: true
Attachment #8664060 - Flags: feedback?(cku)
Comment on attachment 8663596 [details] [review]
PR for LayerScope: Show mask effect on LayerScope viewer. (v2)

Address the feedback comments.
Attachment #8663596 - Attachment description: Part2: Show mask effect on LayerScope viewer. (v1) → Part2: Show mask effect on LayerScope viewer. (v2)
Attachment #8663596 - Flags: feedback- → feedback?(cku)
I intend to primary/secondary effect attributes by texture packet (see Bug 1205521). So, the unique_ptr and move operator is used here as an infrastructure for Bug 1205521. Comments would be removed after Bug 1205521.
Attachment #8664060 - Attachment is obsolete: true
Attachment #8664060 - Flags: feedback?(cku)
Attachment #8664115 - Flags: feedback?(cku)
Attachment #8664115 - Flags: feedback?(cku) → feedback+
Attachment #8663596 - Flags: feedback?(cku) → feedback+
Attachment #8662825 - Flags: review?(dglastonbury)
Attachment #8663584 - Attachment description: Part1.2: Move IsTextureIdContainsInList into SendTextureSource. (v2) → Part1.2: Move IsTextureIdContainsInList into SendTextureSource. (carry f+:cku, v2)
Attachment #8663584 - Flags: review?(dglastonbury)
Attachment #8663584 - Flags: feedback+
Attachment #8664059 - Flags: review?(dglastonbury)
Attachment #8663590 - Flags: review?(dglastonbury)
Attachment #8664115 - Flags: review?(dglastonbury)
Attachment #8663596 - Flags: review?(boris.chiou)
Attachment #8663596 - Flags: review?(boris.chiou) → review+
Attachment #8663596 - Attachment description: Part2: Show mask effect on LayerScope viewer. (v2) → PR for LayerScope: Show mask effect on LayerScope viewer. (v2)
Comment on attachment 8662825 [details] [diff] [review]
Part1.1: Dump SecondaryEffects (EffectTypes::MASK) on Layerscope viewer (v2)

Review of attachment 8662825 [details] [diff] [review]:
-----------------------------------------------------------------

Comments aren't directly related to the code in the patch.

::: gfx/layers/LayerScope.cpp
@@ +1139,5 @@
> +        return;
> +    }
> +
> +    GLuint texID = GetTextureID(aGLContext, source);
> +    if (IsTextureIdContainsInList(texID)) {

`IsTextureIdContainsInList` is a bad name for this function.

I've looked over the use of the texture id list and would like to suggest some changes:

* change std::list<GLuint> SenderHelper::sTextureIdList to std::vector<GLuint> SenderHelper::sSentTextureIds
  (A vector is fine here and preferable to list. sTextureIdList doesn't document
   what the data is, which is a texture ids that have already been sent)

* SenderHelper::ClearTextureIdList() can become:

void
SenderHelper::ClearSentTextureIds()
{
    sSentTextureIds.clear();
}

or, just inline sSentTextureIds.clear() instead of calling ClearSentTextureIds()

* SenderHelper::IsTextureIdContainsInList() can become:

bool
SenderHelper::HasTextureIdBeenSent(GLuint aTextureId)
{
    return std::find(sSentTextureIds.begin(), sSentTextureIds.end(), aTextureId) != sSentTextureIds.end();
}
Attachment #8662825 - Flags: review?(dglastonbury) → review+
Attachment #8663584 - Flags: review?(dglastonbury) → review+
Attachment #8664059 - Flags: review?(dglastonbury) → review+
Attachment #8663590 - Flags: review?(dglastonbury) → review+
Comment on attachment 8664115 [details] [diff] [review]
Part1.5: Send isMask info to LayerScope viewer by TexturePacket. (v2)

Review of attachment 8664115 [details] [diff] [review]:
-----------------------------------------------------------------

A lot of changes and duplication of packet creation/ownership to just set `ismask` flag. I would prefer to pass flag to SendTextureSource().

::: gfx/layers/LayerScope.cpp
@@ +1069,5 @@
>                                                           size,
>                                                           shaderConfig, aFlipY);
>      gLayerScopeManager.GetSocketManager()->AppendDebugData(
>          new DebugGLTextureData(aGLContext, aLayerRef, textureTarget,
> +                               texID, img, Move(aPacket)));

Does this need to be a Move? The parameter is Move'd again in the initializer list of DebugGLTextureData.

@@ +1149,5 @@
>  
> +    auto packet = MakeUnique<layerscope::Packet>();
> +    layerscope::TexturePacket* texturePacket = packet->mutable_texture();
> +
> +    texturePacket->set_ismask(true);

Exposing packet creation seems like overkill to have this one place that sets a flag.
Can't `ismask` become a parameter to SendTextureSource() instead?
Attachment #8664115 - Flags: review?(dglastonbury) → review-
Rebased. Use bool parameter isMask instead of exposing packet creation in SendMaskEffect().

Exposing packet creation in SendTexturedEffect(), SendMaskEffect() is a solution for Bug 1205521, but not for this bug. Perhaps it would be better to do it in Bug 1205521.
Attachment #8664115 - Attachment is obsolete: true
Attachment #8667738 - Flags: review?(dglastonbury)
Hi Dan, could you take a look at Part1.5 again? Your comments have been addressed. Thanks.
Flags: needinfo?(dglastonbury)
Attachment #8667738 - Flags: review?(dglastonbury) → review+
Jeremy,

  Sorry about delay on review.
Flags: needinfo?(dglastonbury)
try looks positove: https://treeherder.mozilla.org/#/jobs?repo=try&revision=a6139d0e1872
Please check-in gecko patchs (Part1.1~1.5). Thanks.
Hi boris, could you help merge PR for layerscope viewer? Thanks.
Flags: needinfo?(boris.chiou)
Layerscope viewer code merged:
https://github.com/mozilla/layerscope/commit/bb45cbce62f43bfa82d5accbe521846498c9b9ad
Flags: needinfo?(boris.chiou)
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Keywords: leave-open
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: