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

Issue 2930143004: Add DIRECT_COMPOSITION GpuMemoryBuffer type.

Created:
3 years, 6 months ago by jbauman
Modified:
3 years, 6 months ago
Reviewers:
reveman
CC:
Aaron Boodman, abarth-chromium, chromium-reviews, darin (slow to review), piman+watch_chromium.org, qsr+mojo_chromium.org, viettrungluu+watch_chromium.org, yzshen+watch_chromium.org
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Add DIRECT_COMPOSITION GpuMemoryBuffer type. This is intended only for use as an onscreen swapchain, so it can't be mapped in the renderer. It can be backed either by an IDXGISwapChain (if asynchronous) or an IDCompositionSurface (if synchronous). Currently this type can't be drawn into, but in the future the backing surface will be able to be made current on a 3D context so it can be written to. It will also be able to be used as an overlay. BUG=726597 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel

Patch Set 1 #

Patch Set 2 : change mojo #

Patch Set 3 : add other switch enumeration #

Patch Set 4 : fix build #

Patch Set 5 : more build fixes #

Patch Set 6 : fix more #

Patch Set 7 : fix build #

Patch Set 8 : fix tests #

Patch Set 9 : fix build #

Total comments: 8
Unified diffs Side-by-side diffs Delta from patch set Stats (+441 lines, -6 lines) Patch
M content/browser/gpu/gpu_internals_ui.cc View 1 2 3 4 1 chunk +2 lines, -0 lines 0 comments Download
M gpu/ipc/client/BUILD.gn View 1 chunk +6 lines, -0 lines 0 comments Download
M gpu/ipc/client/gpu_memory_buffer_impl.cc View 3 chunks +10 lines, -0 lines 0 comments Download
A gpu/ipc/client/gpu_memory_buffer_impl_direct_composition.h View 1 2 3 4 5 6 7 8 1 chunk +38 lines, -0 lines 0 comments Download
A gpu/ipc/client/gpu_memory_buffer_impl_direct_composition.cc View 1 chunk +38 lines, -0 lines 0 comments Download
M gpu/ipc/client/gpu_memory_buffer_impl_io_surface.cc View 1 2 3 4 5 1 chunk +2 lines, -0 lines 0 comments Download
M gpu/ipc/client/gpu_memory_buffer_impl_shared_memory.cc View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M gpu/ipc/common/gpu_memory_buffer_support.cc View 1 2 3 4 5 6 7 3 chunks +25 lines, -1 line 0 comments Download
M gpu/ipc/host/gpu_memory_buffer_support.cc View 5 chunks +6 lines, -2 lines 0 comments Download
M gpu/ipc/service/BUILD.gn View 1 chunk +4 lines, -0 lines 0 comments Download
A gpu/ipc/service/gl_image_direct_composition.h View 1 2 3 4 5 1 chunk +56 lines, -0 lines 0 comments Download
A gpu/ipc/service/gl_image_direct_composition.cc View 1 chunk +69 lines, -0 lines 0 comments Download
M gpu/ipc/service/gpu_memory_buffer_factory.cc View 1 2 3 4 5 6 2 chunks +8 lines, -0 lines 0 comments Download
A gpu/ipc/service/gpu_memory_buffer_factory_win.h View 1 chunk +63 lines, -0 lines 2 comments Download
A gpu/ipc/service/gpu_memory_buffer_factory_win.cc View 1 chunk +80 lines, -0 lines 0 comments Download
M ui/gfx/buffer_types.h View 1 chunk +3 lines, -0 lines 2 comments Download
M ui/gfx/gpu_memory_buffer.h View 1 chunk +2 lines, -1 line 0 comments Download
M ui/gfx/gpu_memory_buffer.cc View 1 chunk +1 line, -0 lines 0 comments Download
M ui/gfx/linux/client_native_pixmap_factory_dmabuf.cc View 1 2 3 4 2 chunks +4 lines, -0 lines 0 comments Download
M ui/gfx/mojo/buffer_types.mojom View 1 2 chunks +3 lines, -1 line 0 comments Download
M ui/gfx/mojo/buffer_types_struct_traits.h View 1 2 3 4 chunks +10 lines, -0 lines 0 comments Download
M ui/gl/gl_image.h View 2 chunks +4 lines, -1 line 4 comments Download
M ui/gl/gl_image.cc View 2 chunks +5 lines, -0 lines 0 comments Download
M ui/ozone/platform/drm/gpu/drm_thread.cc View 1 2 3 4 5 6 7 8 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 42 (39 generated)
jbauman
3 years, 6 months ago (2017-06-14 21:04:00 UTC) #40
reveman
https://codereview.chromium.org/2930143004/diff/160001/gpu/ipc/service/gpu_memory_buffer_factory_win.h File gpu/ipc/service/gpu_memory_buffer_factory_win.h (right): https://codereview.chromium.org/2930143004/diff/160001/gpu/ipc/service/gpu_memory_buffer_factory_win.h#newcode56 gpu/ipc/service/gpu_memory_buffer_factory_win.h:56: usage_map_; The factory needs to be stateless to handle ...
3 years, 6 months ago (2017-06-14 21:35:59 UTC) #41
jbauman
3 years, 6 months ago (2017-06-14 22:18:17 UTC) #42
https://codereview.chromium.org/2930143004/diff/160001/gpu/ipc/service/gpu_me...
File gpu/ipc/service/gpu_memory_buffer_factory_win.h (right):

https://codereview.chromium.org/2930143004/diff/160001/gpu/ipc/service/gpu_me...
gpu/ipc/service/gpu_memory_buffer_factory_win.h:56: usage_map_;
On 2017/06/14 21:35:58, reveman wrote:
> The factory needs to be stateless to handle GPU process crashes correctly. Can
> ownership be passed using a handle instead of of keeping track of allocated
> buffers using this map?

I could put the buffer usage in the handle so it could be recreated in a
different process. There's no way to access DirectComposition surfaces outside
the process that created them, so I can't actually own them with a handle.

https://codereview.chromium.org/2930143004/diff/160001/ui/gfx/buffer_types.h
File ui/gfx/buffer_types.h (right):

https://codereview.chromium.org/2930143004/diff/160001/ui/gfx/buffer_types.h#...
ui/gfx/buffer_types.h:46: SCANOUT_ASYNC,
On 2017/06/14 21:35:59, reveman wrote:
> Why do we need to add this here? How flips are synchronized doesn't seem like
> something that buffer usage should be used for..

I wasn't sure how to specify the type of buffer needed (IDCompositionSurface or
IDXGISwapChain) to GpuMemoryBufferManager::CreateGpuMemoryBuffer. Would you want
me to add an extra argument to that?

https://codereview.chromium.org/2930143004/diff/160001/ui/gl/gl_image.h
File ui/gl/gl_image.h (right):

https://codereview.chromium.org/2930143004/diff/160001/ui/gl/gl_image.h#newco...
ui/gl/gl_image.h:97: enum class Type { NONE, MEMORY, IOSURFACE, DXGI_IMAGE,
DIRECT_COMPOSITION };
On 2017/06/14 21:35:59, reveman wrote:
> This type of downcasting is an indication that're not able to create the
proper
> API and abstraction for what we're trying to do. I think we should strive
> towards being able to remove this. Is this really needed in the direct
> composition case?

I guess I could have windows-only GetSwapChain() and GetDCompositionSurface()
methods that would be implemented only by the DirectCompositionChildSurfaceWin,
if you want.

https://codereview.chromium.org/2930143004/diff/160001/ui/gl/gl_image.h#newco...
ui/gl/gl_image.h:100: virtual scoped_refptr<GLSurface> GetSurface();
On 2017/06/14 21:35:59, reveman wrote:
> How is this suppose to be used? Can we do something similar to
> ScheduleOverlayPlane instead?

This is actually going to be used to draw into the texture. The
DirectComposition surfaces can't really be used as FBOs, so we'll need to have a
new GL command that makes a GLImage current on the context. This will retrieve
the GLSurface that will actually be made current.

Powered by Google App Engine
This is Rietveld 408576698