DescriptionWe redesigned the GpuMemoryBuffer interface to handle multiple buffers. These changes started with the purpose of making use of new EGL_LINUX_DMA_BUF_EXT capabilities[0] and followed by an attempt to change the high level API [1].
[0] https://code.google.com/p/chromium/issues/detail?id=439520
[1] https://codereview.chromium.org/962723002/
The future steps are:
- Add new GPUMemoryBuffer format gfx::GpuMemoryBuffer::YUV_420
StrideInBytes() should take index as input
- Implement multi buffer support on GpuMemoryBufferFactoryOzoneNativeBuffer
Change BufferToPixmapMap as std::map<std::pair<uint32_t, uint32_t>, ScopedVector<NativePixmap> > so that we can create multiple pixmaps(file descriptors) for single GpuMemoryBufferId
- Add support for multiple pixmaps in GLImageLinuxDMABuffer
- Implement support for GpuMemoryBufferImplSharedMemory
Change GpuMemoryBufferHandle to contain std::vector<base::SharedMemoryHandle>
- Add support for GLImageSharedMemory and GLImageMemory
- Look for possible use cases of multiple buffers on Android, Mac, and Win platforms
The new functions added are as below:
class GFX_EXPORT GpuMemoryBuffer {
// Maps each plane of the buffer into the client's address space so it can be
// written to by the CPU. A pointer to plane K is stored at index K-1 of the
// |data| array. This call may block, for instance if the GPU needs to finish
// accessing the buffer or if CPU caches need to be synchronized. Returns
// false on failure.
virtual bool Map(void** data) = 0;
// Fills the stride in bytes for the each plane of the buffer. The stride of
// plane K is stored at index K-1 of the |stride| array.
virtual void GetStride(uint32* stride) const = 0;
};
The classes effected by this change is as below(except the test implementations). Currently none of them supports multiple buffers as the format doesn't exist. They are going to be implemented per platform in future CLs.
+---------------+
|GpuMemoryBuffer|
+------+--------+
|
+--------+----------+
|GpuMemoryBufferImpl|
++----+-----+------++
| | | |
| | | |
+------------------------------++ | | +--+-------------------------+
|GpuMemoryBufferImplSharedMemory| | | |GpuMemoryBufferImplIOSurface|
+-------------------------------+ | | +----------------------------+
| |
+-----------------------------------++ +-+-------------------------------+
|GpuMemoryBufferImplOzoneNatiVeBuffer| |GpuMemoryBufferImplSurfaceTexture|
+------------------------------------+ +---------------------------------+
|ui::GpuMemoryBufferFactory |
|OzoneNatiVeBuffer |
| INITALIZES |
| ui::GLImageOzoneNatiVePixmapDmaBuf |
| OR |
| ui::GLImageOzoneNatiVePixmap |
+------------------------------------+
BUG=439520
TEST= GpuMemoryBufferTest.* in gl_tests and GpuMemoryBufferImplTest.* in content_unittests.
Committed: https://crrev.com/164855329ada6f5ef96d2147fe38ae25111258c4
Cr-Commit-Position: refs/heads/master@{#322503}
Patch Set 1 : #
Total comments: 12
Patch Set 2 : reveman@ comments. #Patch Set 3 : Comment and typo fix. #
Total comments: 19
Patch Set 4 : reveman@ comments. #
Total comments: 16
Patch Set 5 : reveman@ comments. #
Total comments: 8
Patch Set 6 : GpuMemoryBufferImplTest fixes. #Patch Set 7 : reveman@ comments. #Patch Set 8 : Return val fix. #Patch Set 9 : Comment fix. #Messages
Total messages: 29 (10 generated)
|