DescriptionMac 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
Messages
Total messages: 40 (13 generated)
|