summaryrefslogtreecommitdiffstats
path: root/cc/test/test_gpu_memory_buffer_manager.cc
diff options
context:
space:
mode:
authoremircan <emircan@chromium.org>2015-03-26 17:05:54 -0700
committerCommit bot <commit-bot@chromium.org>2015-03-27 00:06:46 +0000
commit164855329ada6f5ef96d2147fe38ae25111258c4 (patch)
tree2d6ef53b04fcadff7fa73bab99df236d642fc899 /cc/test/test_gpu_memory_buffer_manager.cc
parent5050705ee16d1b3ca4acf279c0d174a5336629fb (diff)
downloadchromium_src-164855329ada6f5ef96d2147fe38ae25111258c4.zip
chromium_src-164855329ada6f5ef96d2147fe38ae25111258c4.tar.gz
chromium_src-164855329ada6f5ef96d2147fe38ae25111258c4.tar.bz2
We 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. Review URL: https://codereview.chromium.org/1024113003 Cr-Commit-Position: refs/heads/master@{#322503}
Diffstat (limited to 'cc/test/test_gpu_memory_buffer_manager.cc')
-rw-r--r--cc/test/test_gpu_memory_buffer_manager.cc11
1 files changed, 6 insertions, 5 deletions
diff --git a/cc/test/test_gpu_memory_buffer_manager.cc b/cc/test/test_gpu_memory_buffer_manager.cc
index 7430051..b43cd76 100644
--- a/cc/test/test_gpu_memory_buffer_manager.cc
+++ b/cc/test/test_gpu_memory_buffer_manager.cc
@@ -41,13 +41,14 @@ class GpuMemoryBufferImpl : public gfx::GpuMemoryBuffer {
mapped_(false) {}
// Overridden from gfx::GpuMemoryBuffer:
- void* Map() override {
+ bool Map(void** data) override {
DCHECK(!mapped_);
if (!shared_memory_->Map(StrideInBytes(size_.width(), format_) *
size_.height()))
- return NULL;
+ return false;
mapped_ = true;
- return shared_memory_->memory();
+ *data = shared_memory_->memory();
+ return true;
}
void Unmap() override {
DCHECK(mapped_);
@@ -56,8 +57,8 @@ class GpuMemoryBufferImpl : public gfx::GpuMemoryBuffer {
}
bool IsMapped() const override { return mapped_; }
Format GetFormat() const override { return format_; }
- uint32 GetStride() const override {
- return StrideInBytes(size_.width(), format_);
+ void GetStride(uint32* stride) const override {
+ *stride = StrideInBytes(size_.width(), format_);
}
gfx::GpuMemoryBufferHandle GetHandle() const override {
gfx::GpuMemoryBufferHandle handle;