New issue
Advanced search Search tips

Issue 906794 link

Starred by 1 user

Issue metadata

Status: Started
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Feature

Blocking:
issue 882513



Sign in to add a comment

Teach LayerTreeHostImpl UI Resource Uploader to use SharedImage + Add SII Upload API

Project Member Reported by ericrk@chromium.org, Nov 19

Issue description

LayerTreeHostImpl uses GL to upload textures for use in UI Resources. Converting this to SharedImage.

This requires a new SharedImageInterface API that allows for creation of a SharedImage with initial data.

We can't just use GMBs as we need ETC1 support, which is problematic in that case.
 
Blocking: 882513
Labels: Proj-Vulkanize
Project Member

Comment 3 by bugdroid1@chromium.org, Nov 21

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

commit 7cc7b44bc19ad230ca4656e047a8661c1c91d8e2
Author: Eric Karl <ericrk@chromium.org>
Date: Wed Nov 21 22:50:36 2018

Ensure that TexStorage/TexImage calculated format values are equivalent

We currently track various GL values (format/type/swizzle) for each
viz::Format on SharedImageBackingFactoryGLTexture. Depending on whether
we plan to use TexStorgae2D or TexImage2D, we calculate these
differently.

With the ability to upload data at texture creation time, we need to
dynamically chose TexStorage2D or TexImage2D.

Rather than duplicate the calculate format/type/swizzle, this CL
ensures that these were actually the same all along (and fixes some
cases where they weren't).

This lets us simplify our format info calculation logic a bit.

Bug: 906794
Change-Id: I4c97aade94ecf267df8a1adfb45aeda8e14d1c12
Reviewed-on: https://chromium-review.googlesource.com/c/1345538
Commit-Queue: Eric Karl <ericrk@chromium.org>
Reviewed-by: Antoine Labour <piman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#610246}
[modify] https://crrev.com/7cc7b44bc19ad230ca4656e047a8661c1c91d8e2/components/viz/common/resources/resource_format_utils.cc
[modify] https://crrev.com/7cc7b44bc19ad230ca4656e047a8661c1c91d8e2/gpu/command_buffer/service/shared_image_backing_factory_gl_texture.cc
[modify] https://crrev.com/7cc7b44bc19ad230ca4656e047a8661c1c91d8e2/gpu/command_buffer/service/shared_image_backing_factory_gl_texture.h
[modify] https://crrev.com/7cc7b44bc19ad230ca4656e047a8661c1c91d8e2/gpu/command_buffer/service/shared_image_backing_factory_gl_texture_unittest.cc

Labels: -Type-Bug Type-Feature
Cc: samans@chromium.org
Project Member

Comment 6 by bugdroid1@chromium.org, Dec 11

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

commit 8d678f89ac9bbc6f02c01842473ada033d8babdc
Author: Eric Karl <ericrk@chromium.org>
Date: Tue Dec 11 06:51:00 2018

Add SII method to upload data at creation and use for LTHI

Adds a method to SharedImage interface (SII) which allows us to create
a shared image and upload initial data in a single command. This method
is then used in LTHI to convert the UI Resource uploader code to SII.

As SII can't rely on the command buffer, it uses the following pattern
for uploads:
 - Allocate a 1MB (or required size) block of shared memory.
 - Sub allocate from it for each upload, duplicating the SHM and
   transferring ownership to the GPU service for each upload.
 - When the current shared memory buffer is used up, drop it on the
   client side. It will be kept alive by the duplicated handles passed
   to the service, until these are no longer needed.
 - Repeat.

This may be a bit inefficient, so we may need a more complex allocation
scheme in the future.

Bug: 906794
Change-Id: Ie91ab352b06097da6e00f80582b0cc92d690a6f9
Reviewed-on: https://chromium-review.googlesource.com/c/1343346
Commit-Queue: Eric Karl <ericrk@chromium.org>
Reviewed-by: Chris Palmer <palmer@chromium.org>
Reviewed-by: Antoine Labour <piman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#615451}
[modify] https://crrev.com/8d678f89ac9bbc6f02c01842473ada033d8babdc/cc/trees/layer_tree_host_impl.cc
[modify] https://crrev.com/8d678f89ac9bbc6f02c01842473ada033d8babdc/cc/trees/layer_tree_host_impl.h
[modify] https://crrev.com/8d678f89ac9bbc6f02c01842473ada033d8babdc/cc/trees/layer_tree_host_impl_unittest.cc
[modify] https://crrev.com/8d678f89ac9bbc6f02c01842473ada033d8babdc/cc/trees/layer_tree_host_unittest.cc
[modify] https://crrev.com/8d678f89ac9bbc6f02c01842473ada033d8babdc/cc/trees/layer_tree_host_unittest_context.cc
[modify] https://crrev.com/8d678f89ac9bbc6f02c01842473ada033d8babdc/components/viz/test/test_context_provider.cc
[modify] https://crrev.com/8d678f89ac9bbc6f02c01842473ada033d8babdc/components/viz/test/test_context_provider.h
[modify] https://crrev.com/8d678f89ac9bbc6f02c01842473ada033d8babdc/gpu/command_buffer/client/shared_image_interface.h
[modify] https://crrev.com/8d678f89ac9bbc6f02c01842473ada033d8babdc/gpu/command_buffer/service/shared_image_backing_factory.h
[modify] https://crrev.com/8d678f89ac9bbc6f02c01842473ada033d8babdc/gpu/command_buffer/service/shared_image_backing_factory_ahardwarebuffer.cc
[modify] https://crrev.com/8d678f89ac9bbc6f02c01842473ada033d8babdc/gpu/command_buffer/service/shared_image_backing_factory_ahardwarebuffer.h
[modify] https://crrev.com/8d678f89ac9bbc6f02c01842473ada033d8babdc/gpu/command_buffer/service/shared_image_backing_factory_gl_texture.cc
[modify] https://crrev.com/8d678f89ac9bbc6f02c01842473ada033d8babdc/gpu/command_buffer/service/shared_image_backing_factory_gl_texture.h
[modify] https://crrev.com/8d678f89ac9bbc6f02c01842473ada033d8babdc/gpu/command_buffer/service/shared_image_backing_factory_gl_texture_unittest.cc
[modify] https://crrev.com/8d678f89ac9bbc6f02c01842473ada033d8babdc/gpu/command_buffer/service/shared_image_factory.cc
[modify] https://crrev.com/8d678f89ac9bbc6f02c01842473ada033d8babdc/gpu/command_buffer/service/shared_image_factory.h
[modify] https://crrev.com/8d678f89ac9bbc6f02c01842473ada033d8babdc/gpu/command_buffer/service/wrapped_sk_image.cc
[modify] https://crrev.com/8d678f89ac9bbc6f02c01842473ada033d8babdc/gpu/command_buffer/service/wrapped_sk_image.h
[modify] https://crrev.com/8d678f89ac9bbc6f02c01842473ada033d8babdc/gpu/ipc/client/shared_image_interface_proxy.cc
[modify] https://crrev.com/8d678f89ac9bbc6f02c01842473ada033d8babdc/gpu/ipc/client/shared_image_interface_proxy.h
[modify] https://crrev.com/8d678f89ac9bbc6f02c01842473ada033d8babdc/gpu/ipc/common/gpu_messages.h
[modify] https://crrev.com/8d678f89ac9bbc6f02c01842473ada033d8babdc/gpu/ipc/in_process_command_buffer.cc
[modify] https://crrev.com/8d678f89ac9bbc6f02c01842473ada033d8babdc/gpu/ipc/in_process_command_buffer.h
[modify] https://crrev.com/8d678f89ac9bbc6f02c01842473ada033d8babdc/gpu/ipc/service/shared_image_stub.cc
[modify] https://crrev.com/8d678f89ac9bbc6f02c01842473ada033d8babdc/gpu/ipc/service/shared_image_stub.h

Still need to land a bit more to get Vulkan UI working (the above patch just establishes the new interface and uses it for GL). That said, Vulkan should ~work if you build on Android, just w/out UI.
Project Member

Comment 8 by bugdroid1@chromium.org, Dec 14

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

commit 0223f1ecf06062d3c5a27161d3db279d65391650
Author: Eric Karl <ericrk@chromium.org>
Date: Fri Dec 14 00:20:07 2018

Enable SII Data Uploads for Vulkan via WrappedSkImage

Adds support for initial data uploads to WrappedSkImage, allowing UI
to work with Vulkan.

Does not yet support ETC1 compressed textures, as Skia doesn't seem to
have a way to provide these. Will figure out how to get this working
in a follow-up.

Bug: 906794
Change-Id: Icf8894f7e7ed4ebedd9d7c31d0cce09f76e6aaf1
Reviewed-on: https://chromium-review.googlesource.com/c/1372529
Reviewed-by: Yaron Friedman <yfriedman@chromium.org>
Reviewed-by: Jonathan Backer <backer@chromium.org>
Commit-Queue: Eric Karl <ericrk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#616520}
[modify] https://crrev.com/0223f1ecf06062d3c5a27161d3db279d65391650/chrome/browser/android/thumbnail/thumbnail_cache.cc
[modify] https://crrev.com/0223f1ecf06062d3c5a27161d3db279d65391650/gpu/command_buffer/service/shared_image_factory.cc
[modify] https://crrev.com/0223f1ecf06062d3c5a27161d3db279d65391650/gpu/command_buffer/service/shared_image_factory.h
[modify] https://crrev.com/0223f1ecf06062d3c5a27161d3db279d65391650/gpu/command_buffer/service/wrapped_sk_image.cc

Labels: -Pri-1 Pri-2
The code in question now works. The only missing piece is allowing for Vulkan upload of ETC1 images. Dropping priority.

Sign in to add a comment