-
Notifications
You must be signed in to change notification settings - Fork 6k
Update the content handler to use the Mozart session API. #3887
Conversation
j9brown
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm with minor nits (mostly TODOs)
content_handler/runtime_holder.cc
Outdated
| if (!is_ready_to_draw_) | ||
| return; // Only draw once per frame. | ||
| is_ready_to_draw_ = false; | ||
| if (!frame_outstanding_ || frame_rendering_) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably shouldn't be discarding the layer tree here. But then, Flutter shouldn't be calling Render() if we didn't call BeginFrame(). So why does the spurious call to Render happen?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I think we should open a bug and leave a TODO here.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. MZ-193
content_handler/runtime_holder.cc
Outdated
| // Attempt to read the device pixel ratio. | ||
| float pixel_ratio = 1.0; | ||
| if (auto& metrics = properties->display_metrics) { | ||
| pixel_ratio = 2.0; // TODO(chinmaygarde): Fix metrics->device_pixel_ratio; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The metrics are being passed through correctly now. We should use them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
|
|
||
| void SessionConnection::OnSessionError() { | ||
| ASSERT_IS_GPU_THREAD; | ||
| // TODO: Not this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't that a TODON'T? ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right. At first I thought I should be doing something smarter, but terminating the process seems good enough to me :)
content_handler/vulkan_surface.cc
Outdated
|
|
||
| mx::vmo session_vmo; | ||
| mx_status_t status = | ||
| exported_vmo_.duplicate(MX_RIGHT_SAME_RIGHTS, &session_vmo); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't duplicate this handle. We don't need to keep it any further past this point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
content_handler/vulkan_surface.cc
Outdated
| return session_image_ != nullptr; | ||
| } | ||
|
|
||
| uint32_t VulkanSurface::GetSessionImageID() const { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's just expose the Image*.
mozart::client::Image* image() { return session_image_.get(); }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
flow/layers/clip_rect_layer.cc
Outdated
| void ClipRectLayer::UpdateScene(SceneUpdateContext& context) { | ||
| FTL_DCHECK(needs_system_composite()); | ||
|
|
||
| // TODO(MZ-138): Need to be able to specify an origin. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the transform is sufficient to set the origin (and we already apply it). So let's remove this TODO here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
flow/layers/clip_rrect_layer.cc
Outdated
| FTL_DCHECK(needs_system_composite()); | ||
|
|
||
| // TODO(MZ-137): Need to be able to express the radii as vectors. | ||
| // TODO(MZ-138): Need to be able to specify an origin. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the transform is sufficient to set the origin (and we already apply it). So let's remove this TODO here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
flow/layers/clip_path_layer.cc
Outdated
|
|
||
| // TODO(MZ-140): Must be able to specify paths as shapes to nodes. | ||
| // Treating the shape as a rectangle for now. | ||
| // TODO(MZ-138): Need to be able to specify an origin. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the transform is sufficient to set the origin (and we already apply it). So let's remove this TODO here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
flow/scene_update_context.cc
Outdated
| // Add a part which represents the frame's geometry for clipping purposes | ||
| // and possibly for its texture. | ||
| // TODO(MZ-137): Need to be able to express the radii as vectors. | ||
| // TODO(MZ-138): Need to be able to specify an origin. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the transform is sufficient to set the origin (and we already apply it). So let's remove this TODO here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
flow/scene_update_context.cc
Outdated
| SceneUpdateContext::Transform::Transform(SceneUpdateContext& context, | ||
| const SkMatrix& transform) | ||
| : Entity(context) { | ||
| // TODO(chinmaygarde): The perspective and shear components in the matrix |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO(MZ-192)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
j9brown
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, minor nits
content_handler/vulkan_surface.h
Outdated
|
|
||
| // |flow::SceneUpdateContext::SurfaceProducerSurface| | ||
| uint32_t GetSessionImageID() const override; | ||
| mozart::client::Image* image() override; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this virtual anyhow? But since it is, per Google C++ style guide, this should be called GetImage(). Sorry for the churn.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The interface is defined in the flow library and there used to be two implementations in the content handler (one for Vulkan and one for software rasterization). The flow layer not know anything about the specific client rendering library used. Hence the virtual methods. I'll fix the signature.
flow/scene_update_context.cc
Outdated
| } | ||
|
|
||
| auto session_image_id = surface->GetSessionImageID(); | ||
| auto session_image_id = surface->image()->id(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Return the Image* from this function instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
4c8e450 to
bd0ee31
Compare
This patch contains the following commits from
chinmaygarde/flutter_engine/tree/session.