Closed Bug 1064479 Opened 7 years ago Closed 7 years ago

Redo how screen rotation is implemented on B2G/Layers


(Core :: Graphics: Layers, defect)

Not set



blocking-b2g 2.1+
Tracking Status
firefox33 --- wontfix
firefox34 --- fixed
firefox35 --- fixed
b2g-v2.1 --- fixed
b2g-v2.2 --- fixed


(Reporter: jrmuizel, Assigned: jrmuizel)




(2 files, 1 obsolete file)

Currently we use a world transform on the LayerManager. This gets passed to the screen render target which adjusts the gl transform to accomplish the rotation. This causes a lot of the system to have to know about the transform.

Instead we can just bake the transform into the root layer's shadow transform. Everything now mostly just works.
Assignee: nobody → jmuizelaar
This patch shows the simplication that this approach allows. It will also fix bug 1057461
Attachment #8485952 - Attachment is obsolete: true
Summary: Redo how screen rotation is implemented on B2G → Redo how screen rotation is implemented on B2G/Layers
Comment on attachment 8485922 [details] [diff] [review]
Rough out an implementation

Review of attachment 8485922 [details] [diff] [review]:

The main part of this change is:

::: gfx/layers/composite/AsyncCompositionManager.cpp
@@ +126,2 @@
>        ComputeTransformForRotation(mTargetConfig.naturalBounds(),
> +                                  mTargetConfig.rotation());

Store the world transform on the AsyncCompositionManager instead of the layer manager.

@@ +980,5 @@
> +  LayerComposite* rootComposite = root->AsLayerComposite();
> +
> +  gfx::Matrix4x4 trans = rootComposite->GetShadowTransform();
> +  trans *= gfx::Matrix4x4::From2D(mWorldTransform);
> +  rootComposite->SetShadowTransform(trans);

This is the main part of this change.

::: gfx/layers/ipc/CompositorParent.cpp
@@ +800,5 @@
>    // Instruct the LayerManager to update its render bounds now. Since all the orientation
>    // change, dimension change would be done at the stage, update the size here is free of
>    // race condition.
> +  mLayerManager->UpdateRenderBounds(aTargetConfig.naturalBounds());

Set the render bounds to the natural bounds instead of the client bounds so that we don't have to unrotate them in CompositorOGL.
Attachment #8485922 - Flags: review?(nical.bugzilla)
Attachment #8485922 - Flags: review?(matt.woodrow)
Blocks: 1057461
Comment on attachment 8485922 [details] [diff] [review]
Rough out an implementation

Review of attachment 8485922 [details] [diff] [review]:

A nice simplification.
Attachment #8485922 - Flags: review?(matt.woodrow) → review+
Attachment #8485922 - Flags: review?(nical.bugzilla) → review+
This is the solution to bug 1057461, making it 2.1+
blocking-b2g: --- → 2.1+
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla35
Actually, before uplifting it to 2.1, could we check whether it's not causing Bug 1066664?  The image I see there is quite similar to the Bug 1057461
Marking NO_UPLIFT to check to see if this caused the fallout in bug 1066664.

Jeff - Can you find out if this caused bug 1066664?
Flags: needinfo?(jmuizelaar)
Whiteboard: [NO_UPLIFT]
Depends on: 1066664
Flags: needinfo?(jmuizelaar)
Depends on: 1071241
Clearing NO_UPLIFT flag since Bug 1066664 landed in master.  This should land in 2.1 with Bug 1066664
Whiteboard: [NO_UPLIFT]
Please nominate this patch for Aurora approval when you get a chance :)
Flags: needinfo?(jmuizelaar)
Comment on attachment 8485953 [details] [diff] [review]
Implementation and cleanup included together

Approval Request Comment
See the Aurora request comments on bug 1071241.
Attachment #8485953 - Flags: approval-mozilla-aurora?
Flags: needinfo?(jmuizelaar)
Attachment #8485953 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
You need to log in before you can comment on or make changes to this bug.