Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(158)

Issue 1273563002: Mac Overlays: Add GPU back-pressure (Closed)

Created:
5 years, 4 months ago by ccameron
Modified:
5 years, 4 months ago
CC:
chromium-reviews, danakj+watch_chromium.org, darin-cc_chromium.org, jam, jbauman+watch_chromium.org, kalyank, nona+watch_chromium.org, piman+watch_chromium.org, shuchen+watch_chromium.org, sievers+watch_chromium.org, James Su, tfarina, yusukes+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Mac Overlays: Add GPU back-pressure Issue a GL fence after every SwapBuffers. Do not call -[CALayer setContents:] with the content being rendered by that SwapBuffers until the fence has passed. Query the previous's frame's GL fence at the beginning of each SwapBuffers. Also issue a callback to query the GL fence at the mid-point of the VSync period (if there is no subsequent SwapBuffers, or if the frame takes more than one VSync to render). Note that waiting for the GL fence to complete before calling -[CALayer setContents] is not required for correctness -- only the expected content (everything before the glFlush) will appear in the layer. Rather, the reason for waiting for the GL fence is to make the time at which the content will appear on-screen more reliable. Because there may be multiple calls to SwapBuffers in flight, store the data necessary to call -[CALayer setContents] in a PendingSwap structure. Maintain a queue of these structures. Because the ImageTransportSurface does not know anything about the VSync period, send the CGDirectDisplayID for the attached display to the ImageTransportSurface in the AcceleratedSurfaceMsg_BufferPresented IPC (which is where the CGL renderer ID is already communicated). Send this information instead of the raw VSync parameters so that the updates to all windows on a single display may be coalesced into a single callback in the future. Note that this display is the display that is used for vsync by the RenderWidgetHostViewMac, so if vsync is disabled, it will be 0. Separate gfx::ScopedSetGLToRealGLApi into its own header file to simplify header orders. Access the IOSurface of the GLImageIOSurface directly, rather than using its ScheduleOverlayPlane method. This simplifies things immediately, in that we can reason about the underlying IOSurface's lifetime better than weak pointers to images. It will also simplify the implementation of partial swap and multiple overlays. BUG=515696 Committed: https://crrev.com/5c207cac73c835b5f362670d6b46333dfae1f4c4 Cr-Commit-Position: refs/heads/master@{#342548} Committed: https://crrev.com/01ae4cbc31c1092b8c0ed15ff3a9773badfa278a Cr-Commit-Position: refs/heads/master@{#342603}

Patch Set 1 #

Patch Set 2 : Clean up headers #

Patch Set 3 : More sdk differences #

Total comments: 18

Patch Set 4 : Incorporate review feedback #

Total comments: 16

Patch Set 5 : Incorporate review feedback #

Total comments: 2

Patch Set 6 : IRF #

Total comments: 2

Patch Set 7 : Clean up, more feedback #

Patch Set 8 : And rebase #

Patch Set 9 : Use default fences #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+440 lines, -69 lines) Patch
M content/browser/compositor/gpu_surfaceless_browser_compositor_output_surface.cc View 2 chunks +4 lines, -0 lines 0 comments Download
M content/browser/gpu/gpu_process_host_ui_shim.cc View 1 2 3 4 1 chunk +2 lines, -1 line 0 comments Download
M content/browser/renderer_host/render_widget_host_view_mac.h View 1 2 3 4 1 chunk +1 line, -0 lines 0 comments Download
M content/browser/renderer_host/render_widget_host_view_mac.mm View 1 2 3 4 1 chunk +7 lines, -0 lines 0 comments Download
M content/common/gpu/gpu_messages.h View 1 2 3 4 1 chunk +3 lines, -0 lines 0 comments Download
M content/common/gpu/image_transport_surface_calayer_mac.mm View 1 1 chunk +1 line, -1 line 0 comments Download
M content/common/gpu/image_transport_surface_overlay_mac.h View 1 2 3 4 5 6 3 chunks +41 lines, -3 lines 0 comments Download
M content/common/gpu/image_transport_surface_overlay_mac.mm View 1 2 3 4 5 6 7 8 3 chunks +268 lines, -28 lines 1 comment Download
M gpu/command_buffer/service/gl_context_virtual.cc View 1 2 3 4 5 6 7 1 chunk +2 lines, -0 lines 0 comments Download
M ui/accelerated_widget_mac/accelerated_widget_mac.h View 1 2 3 4 3 chunks +5 lines, -1 line 0 comments Download
M ui/accelerated_widget_mac/accelerated_widget_mac.mm View 1 2 3 4 3 chunks +9 lines, -1 line 0 comments Download
M ui/accelerated_widget_mac/display_link_mac.h View 1 2 3 4 5 6 3 chunks +10 lines, -1 line 0 comments Download
M ui/accelerated_widget_mac/display_link_mac.cc View 1 2 3 4 5 6 3 chunks +22 lines, -0 lines 0 comments Download
M ui/gl/BUILD.gn View 1 2 3 4 5 6 7 1 chunk +2 lines, -0 lines 0 comments Download
M ui/gl/gl.gyp View 1 2 3 4 5 6 7 1 chunk +2 lines, -0 lines 0 comments Download
M ui/gl/gl_gl_api_implementation.h View 1 2 chunks +1 line, -9 lines 0 comments Download
M ui/gl/gl_gl_api_implementation.cc View 1 2 3 4 5 6 7 1 chunk +0 lines, -9 lines 0 comments Download
M ui/gl/gl_image_io_surface.h View 1 chunk +2 lines, -0 lines 0 comments Download
M ui/gl/gl_image_io_surface.mm View 1 chunk +5 lines, -15 lines 0 comments Download
A ui/gl/scoped_api.h View 1 2 3 4 1 chunk +28 lines, -0 lines 0 comments Download
A ui/gl/scoped_api.cc View 1 2 3 4 1 chunk +20 lines, -0 lines 0 comments Download
M ui/views/cocoa/bridged_native_widget.h View 1 2 3 4 1 chunk +1 line, -0 lines 0 comments Download
M ui/views/cocoa/bridged_native_widget.mm View 1 2 3 4 1 chunk +4 lines, -0 lines 0 comments Download

Messages

Total messages: 40 (13 generated)
ccameron
This turned out to be fairly clean. Let me know if there are any concerns ...
5 years, 4 months ago (2015-08-05 03:04:41 UTC) #2
tapted
didn't quite finish - gotta run. (lots of the opengl stuff is still over my ...
5 years, 4 months ago (2015-08-05 07:55:57 UTC) #3
ccameron
Thanks -- updated. https://codereview.chromium.org/1273563002/diff/40001/content/common/gpu/image_transport_surface_overlay_mac.h File content/common/gpu/image_transport_surface_overlay_mac.h (right): https://codereview.chromium.org/1273563002/diff/40001/content/common/gpu/image_transport_surface_overlay_mac.h#newcode56 content/common/gpu/image_transport_surface_overlay_mac.h:56: struct PendingSwap { On 2015/08/05 07:55:56, ...
5 years, 4 months ago (2015-08-05 21:00:43 UTC) #4
Ken Russell (switch to Gerrit)
This LGTM overall -- your CL description addressed every major question I had reading through ...
5 years, 4 months ago (2015-08-05 21:55:24 UTC) #5
tapted
lgtm % nits https://codereview.chromium.org/1273563002/diff/60001/content/common/gpu/image_transport_surface_overlay_mac.h File content/common/gpu/image_transport_surface_overlay_mac.h (right): https://codereview.chromium.org/1273563002/diff/60001/content/common/gpu/image_transport_surface_overlay_mac.h#newcode9 content/common/gpu/image_transport_surface_overlay_mac.h:9: #include <IOSurface/IOSurface.h> nit: I think IOSurface, ...
5 years, 4 months ago (2015-08-06 00:56:49 UTC) #6
ccameron
Thanks! Adding jbauman@ to stamp gpu/command_buffer/service Adding dcheng@ for IPC stamp https://codereview.chromium.org/1273563002/diff/60001/content/common/gpu/image_transport_surface_overlay_mac.h File content/common/gpu/image_transport_surface_overlay_mac.h (right): ...
5 years, 4 months ago (2015-08-06 01:42:47 UTC) #8
jbauman
gpu/command_buffer/service lgtm, though I'd like one change for content/common/gpu. https://codereview.chromium.org/1273563002/diff/80001/content/common/gpu/image_transport_surface_overlay_mac.mm File content/common/gpu/image_transport_surface_overlay_mac.mm (right): https://codereview.chromium.org/1273563002/diff/80001/content/common/gpu/image_transport_surface_overlay_mac.mm#newcode51 content/common/gpu/image_transport_surface_overlay_mac.mm:51: ...
5 years, 4 months ago (2015-08-06 01:53:10 UTC) #9
ccameron
Thanks! https://codereview.chromium.org/1273563002/diff/80001/content/common/gpu/image_transport_surface_overlay_mac.mm File content/common/gpu/image_transport_surface_overlay_mac.mm (right): https://codereview.chromium.org/1273563002/diff/80001/content/common/gpu/image_transport_surface_overlay_mac.mm#newcode51 content/common/gpu/image_transport_surface_overlay_mac.mm:51: scoped_ptr<gfx::GLFenceAPPLE> fence; On 2015/08/06 01:53:09, jbauman wrote: > ...
5 years, 4 months ago (2015-08-06 02:27:39 UTC) #10
dcheng
IPC changes LGTM but one thought about making it easy to convert a move-based approach ...
5 years, 4 months ago (2015-08-07 00:28:37 UTC) #11
ccameron
Thanks! I went through the patch and cleaned up some of the functions (split them ...
5 years, 4 months ago (2015-08-07 22:14:16 UTC) #12
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1273563002/140001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1273563002/140001
5 years, 4 months ago (2015-08-08 05:35:56 UTC) #15
commit-bot: I haz the power
Try jobs failed on following builders: android_clang_dbg_recipe on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/android_clang_dbg_recipe/builds/106495)
5 years, 4 months ago (2015-08-08 06:16:19 UTC) #17
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1273563002/140001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1273563002/140001
5 years, 4 months ago (2015-08-08 18:11:19 UTC) #19
commit-bot: I haz the power
Try jobs failed on following builders: android_clang_dbg_recipe on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/android_clang_dbg_recipe/builds/106524)
5 years, 4 months ago (2015-08-08 18:47:44 UTC) #21
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1273563002/140001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1273563002/140001
5 years, 4 months ago (2015-08-08 19:02:05 UTC) #23
commit-bot: I haz the power
Try jobs failed on following builders: android_clang_dbg_recipe on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/android_clang_dbg_recipe/builds/106526)
5 years, 4 months ago (2015-08-08 19:38:49 UTC) #25
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1273563002/140001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1273563002/140001
5 years, 4 months ago (2015-08-09 00:32:43 UTC) #27
commit-bot: I haz the power
Committed patchset #8 (id:140001)
5 years, 4 months ago (2015-08-09 01:04:44 UTC) #28
commit-bot: I haz the power
Patchset 8 (id:??) landed as https://crrev.com/5c207cac73c835b5f362670d6b46333dfae1f4c4 Cr-Commit-Position: refs/heads/master@{#342548}
5 years, 4 months ago (2015-08-09 01:05:28 UTC) #29
Ken Russell (switch to Gerrit)
A revert of this CL (patchset #8 id:140001) has been created in https://codereview.chromium.org/1280033004/ by kbr@chromium.org. ...
5 years, 4 months ago (2015-08-09 18:54:20 UTC) #30
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1273563002/160001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1273563002/160001
5 years, 4 months ago (2015-08-10 10:14:37 UTC) #33
ccameron
On 2015/08/09 18:54:20, Ken Russell OOO-till-Aug-17 wrote: > A revert of this CL (patchset #8 ...
5 years, 4 months ago (2015-08-10 10:15:00 UTC) #34
commit-bot: I haz the power
Committed patchset #9 (id:160001)
5 years, 4 months ago (2015-08-10 10:44:23 UTC) #35
commit-bot: I haz the power
Patchset 9 (id:??) landed as https://crrev.com/01ae4cbc31c1092b8c0ed15ff3a9773badfa278a Cr-Commit-Position: refs/heads/master@{#342603}
5 years, 4 months ago (2015-08-10 10:45:13 UTC) #36
Ken Russell (switch to Gerrit)
On 2015/08/10 10:15:00, ccameron wrote: > On 2015/08/09 18:54:20, Ken Russell OOO-till-Aug-17 wrote: > > ...
5 years, 4 months ago (2015-08-10 16:41:54 UTC) #37
reveman
https://codereview.chromium.org/1273563002/diff/160001/content/common/gpu/image_transport_surface_overlay_mac.mm File content/common/gpu/image_transport_surface_overlay_mac.mm (right): https://codereview.chromium.org/1273563002/diff/160001/content/common/gpu/image_transport_surface_overlay_mac.mm#newcode148 content/common/gpu/image_transport_surface_overlay_mac.mm:148: static_cast<gfx::GLImageIOSurface*>(pending_overlay_image_); this static cast seems scary. how do we ...
5 years, 4 months ago (2015-08-18 08:44:12 UTC) #39
ccameron
5 years, 4 months ago (2015-08-18 19:29:39 UTC) #40
Message was sent while issue was closed.
On 2015/08/18 08:44:12, reveman wrote:
>
https://codereview.chromium.org/1273563002/diff/160001/content/common/gpu/ima...
> File content/common/gpu/image_transport_surface_overlay_mac.mm (right):
> 
>
https://codereview.chromium.org/1273563002/diff/160001/content/common/gpu/ima...
> content/common/gpu/image_transport_surface_overlay_mac.mm:148:
> static_cast<gfx::GLImageIOSurface*>(pending_overlay_image_);
> this static cast seems scary. how do we know that this is a GLImageIOSurface?
> and how protect against changes that break that guarantee?

I can create a static GLImageIOSurface::GetFromGLImage which will look up all
created GLImages -- does that sound reasonable?

Powered by Google App Engine
This is Rietveld 408576698