New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 884805 link

Starred by 2 users

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 1
Type: Bug

Blocking:
issue 601869



Sign in to add a comment

Prototype reflector replacement using SurfaceLayers

Project Member Reported by kylec...@chromium.org, Sep 17

Issue description

Reflector is used on Chrome OS to mirror content efficiently. It's used for software mirroring, unified mode and docked magnifier. The current implementation is coupled closely with both ui::Compositor and viz::OutputSurface. With OOP-D these two pieces of code run in different processes and reflector doesn't work.

If you build Chrome OS for Linux you can test out features that use reflector. For example, you can use software mirroring by running with the following command line:

$ ./chrome.exe --ash-host-window-bounds=800x800,900+0-800x800 --ash-dev-shortcuts --ash-debug-shortcuts --user-first-display-as-internal

This will launch two displays which are by default in extended mode. If you switch to mirror mode, either by hitting ctrl+shift+m or in the display settings, you'll see the first display mirrored on the second display. If you launch OOP-D by adding --enable-features=VizDisplayCompositor then mirror mode won't work.

Instead of using reflector we can use SurfaceLayer to mirror content. This will likely perform worse without some additional display compositor changes. Please modify MirrorWindowController so it no longer uses Reflector. Something like the following:

1. Don't create a ui::Reflector (eg. where CreateReflector() is called)
2. Get the current SurfaceId for the reflected display's ui::Compositor (which we access at [1] already).
3. Set mirror_window->layer() to embed that SurfaceId. Calling Layer::SetShowPrimarySurface() should handle most of that.

The exact details need to filled in here. Once working there are a few other issues to sort out.

1. Handle when the reflected display SurfaceId changes. This will happen when displays resolution changes, on rotation, etc. MirrorWindowController will need to update the SurfaceId for the ui::Layer.
2. Handle the mirroring display resizing. This likely means modifying MirrorWindowController::OnHostResized().
3. Making sure the change also works with unified mode.

After everything above works then maybe land the change behind a flag.

[1] https://cs.chromium.org/chromium/src/ash/display/mirror_window_controller.cc?l=233&rcl=66bb07a77fc8687d203e47223a64115ae5d727aa
 
Cc: osh...@chromium.org
Just for my education purpose, is there a doc for OOPD?
Project Member

Comment 4 by bugdroid1@chromium.org, Nov 8

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/fe2a8c1f2546b30847fed5f0c5998294c29294c8

commit fe2a8c1f2546b30847fed5f0c5998294c29294c8
Author: Sean Gilhuly <sgilhuly@chromium.org>
Date: Thu Nov 08 15:57:27 2018

Implement software mirroring and unified mode using SurfaceLayers

Reflector doesn't work with OOP-D enabled, so use SurfaceLayers to
embed the root surface of the source display onto mirrored and unified
displays.

e.g.
chrome --ash-host-window-bounds=1200x1200*2,1202+0-1200x1200*2
 --ash-enable-unified-desktop --ash-dev-shortcuts --ash-debug-shortcuts
 --user-first-display-as-internal --enable-features=VizDisplayCompositor


Bug: 884805
Change-Id: I809600606e65f970e00396ff8fa0a75819a5ec7b
Reviewed-on: https://chromium-review.googlesource.com/c/1251766
Reviewed-by: Scott Violet <sky@chromium.org>
Reviewed-by: kylechar <kylechar@chromium.org>
Commit-Queue: Sean Gilhuly <sgilhuly@chromium.org>
Cr-Commit-Position: refs/heads/master@{#606481}
[modify] https://crrev.com/fe2a8c1f2546b30847fed5f0c5998294c29294c8/ash/display/mirror_window_controller.cc
[modify] https://crrev.com/fe2a8c1f2546b30847fed5f0c5998294c29294c8/ash/display/mirror_window_controller_unittest.cc
[modify] https://crrev.com/fe2a8c1f2546b30847fed5f0c5998294c29294c8/components/viz/service/BUILD.gn
[modify] https://crrev.com/fe2a8c1f2546b30847fed5f0c5998294c29294c8/components/viz/service/display_embedder/gl_output_surface.h
[add] https://crrev.com/fe2a8c1f2546b30847fed5f0c5998294c29294c8/components/viz/service/display_embedder/gl_output_surface_offscreen.cc
[add] https://crrev.com/fe2a8c1f2546b30847fed5f0c5998294c29294c8/components/viz/service/display_embedder/gl_output_surface_offscreen.h
[modify] https://crrev.com/fe2a8c1f2546b30847fed5f0c5998294c29294c8/components/viz/service/display_embedder/gpu_display_provider.cc
[modify] https://crrev.com/fe2a8c1f2546b30847fed5f0c5998294c29294c8/ui/compositor/layer.cc
[modify] https://crrev.com/fe2a8c1f2546b30847fed5f0c5998294c29294c8/ui/compositor/layer.h

Sign in to add a comment