• Andres Calderon Jaramillo's avatar
    Reland viz: Teach the BufferQueue to use SharedImage. · 13b03208
    Andres Calderon Jaramillo authored
    (See the diff since PS1 for the changes since the original change).
    
    This CL relands https://crrev.com/c/1637737. That CL broke Android Q
    compositing of some mixed WebGL/Canvas2D content. The root cause was an
    incorrect assumption: that when the framebuffer for the root render pass
    is bound, we wouldn't try to bind it again before swapping it. This
    assumption was wrong in the case of drawing a render pass quad onto the
    root render pass. See [1]. The aforementioned CL would call
    BeginSharedImageAccessDirectCHROMIUM() upon binding the root render
    pass' framebuffer and would call EndSharedImageAccessDirectCHROMIUM()
    only when the buffer is swapped. So, binding the framebuffer multiple
    times would result in the shared image system thinking that we wanted
    concurrent access to the SharedImage.
    
    This CL fixes that assumption: in case BindFramebuffer gets called more
    than once before swapping, we just rebind the GL framebuffer without
    requesting to begin access to the shared image.
    
    Additionally, the following changes are made since the original change:
    
    - We cache the textures that are produced by consuming the SharedImages
      from the buffer queue. That way, we don't have to call
      CreateAndTexStorage2DSharedImageCHROMIUM() for the same SharedImage.
    
    - We make sure to delete those textures.
    
    - GpuSurfacelessBrowserCompositorOutputSurface no longer exists, so the
      changes in the original CL for that component are discarded.
    
    - We add some unit test coverage to GLOutputSurfaceBufferQueue to avoid
      this regression in the future. The GLOutputSurfaceBufferQueue
      interface is changed to make it possible to inject a mock buffer queue
      for testing. This in turn, requires a change in the BufferQueue
      interface: instead of passing a SyncTokenProvider on construction, we
      provide a setter method. That way the BufferQueue can be constructed
      before the GLOutputSurfaceBufferQueue (and the latter sets itself as
      the SyncTokenProvider).
    
      There are also, unfortunately, some #include changes to satisfy the
      bots.
    
    Original change's description:
    > This CL migrates the BufferQueue to use SharedImage in order to get
    > rid of direct GL dependencies (necessary to eventually be able to use
    > Vulkan).
    >
    > Stencil buffer management depends on the specific graphics API (e.g.,
    > GL), so it is moved out of the BufferQueue into its user classes
    > GpuSurfacelessBrowserCompositorOutputSurface and
    > GLOutputSurfaceBufferQueue. Note that we don't need to have one
    > stencil buffer per color buffer: we can reuse the same stencil buffer
    > across all the color buffers.
    >
    > Bug: 958670
    > Test: Compositing and overdraw feedback works normally on a nocturne.
    > Change-Id: Ia85ea8fea81e125b49a3ce2be195873e77397237
    > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1637737
    > Commit-Queue: Andres Calderon Jaramillo <andrescj@chromium.org>
    > Reviewed-by: kylechar <kylechar@chromium.org>
    > Reviewed-by: Khushal <khushalsagar@chromium.org>
    > Reviewed-by: Eric Karl <ericrk@chromium.org>
    > Reviewed-by: Robert Kroeger <rjkroege@chromium.org>
    > Reviewed-by: Daniele Castagna <dcastagna@chromium.org>
    > Cr-Commit-Position: refs/heads/master@{#723697}
    
    Bug: 958670,1033279
    Test: visit https://toji.github.io/dinosaurs-static/ on Android Q.
    Change-Id: I176af87749c90b775f95c54e2155f27ea9177a94
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1977969
    Commit-Queue: Andres Calderon Jaramillo <andrescj@chromium.org>
    Reviewed-by: default avatarEric Karl <ericrk@chromium.org>
    Reviewed-by: default avatarRobert Kroeger <rjkroege@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#735022}
    13b03208
gpu_image_decode_cache_unittest.cc 144 KB