summaryrefslogtreecommitdiffstats
path: root/cc/test/test_gpu_memory_buffer_manager.cc
diff options
context:
space:
mode:
authorccameron <ccameron@chromium.org>2016-01-11 15:41:37 -0800
committerCommit bot <commit-bot@chromium.org>2016-01-11 23:43:02 +0000
commit0dfb4b3339bd94b919f51cf5b1ab35197476bfc4 (patch)
treeeb17c3939c437b6b7224820515dd7f5f4a652ffe /cc/test/test_gpu_memory_buffer_manager.cc
parentcd04ad3208f70d0ef1341ca64f0379b84c8fbcd6 (diff)
downloadchromium_src-0dfb4b3339bd94b919f51cf5b1ab35197476bfc4.zip
chromium_src-0dfb4b3339bd94b919f51cf5b1ab35197476bfc4.tar.gz
chromium_src-0dfb4b3339bd94b919f51cf5b1ab35197476bfc4.tar.bz2
GpuMemoryBuffers: Add an IsInUse function
Add a function GpuMemoryBuffer::IsInUseByWindowServer to see if a resource is currently in use by the system. This will only return true on Mac, where it returns the result of IOSurfaceIsInUse. Hook this up to cc::ResourceProvider::CanLockForWrite and InUseByConsumer. These fix the bug where tiles would flicker during reuse. BUG=558701 CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel Review URL: https://codereview.chromium.org/1527483003 Cr-Commit-Position: refs/heads/master@{#368718}
Diffstat (limited to 'cc/test/test_gpu_memory_buffer_manager.cc')
-rw-r--r--cc/test/test_gpu_memory_buffer_manager.cc18
1 files changed, 17 insertions, 1 deletions
diff --git a/cc/test/test_gpu_memory_buffer_manager.cc b/cc/test/test_gpu_memory_buffer_manager.cc
index e1e6e89..a540e32 100644
--- a/cc/test/test_gpu_memory_buffer_manager.cc
+++ b/cc/test/test_gpu_memory_buffer_manager.cc
@@ -27,7 +27,8 @@ class GpuMemoryBufferImpl : public gfx::GpuMemoryBuffer {
shared_memory_(std::move(shared_memory)),
offset_(offset),
stride_(stride),
- mapped_(false) {}
+ mapped_(false),
+ is_in_use_by_window_server_(false) {}
// Overridden from gfx::GpuMemoryBuffer:
bool Map() override {
@@ -50,6 +51,9 @@ class GpuMemoryBufferImpl : public gfx::GpuMemoryBuffer {
shared_memory_->Unmap();
mapped_ = false;
}
+ bool IsInUseByMacOSWindowServer() const override {
+ return is_in_use_by_window_server_;
+ }
gfx::Size GetSize() const override { return size_; }
gfx::BufferFormat GetFormat() const override { return format_; }
int stride(size_t plane) const override {
@@ -73,6 +77,10 @@ class GpuMemoryBufferImpl : public gfx::GpuMemoryBuffer {
return reinterpret_cast<ClientBuffer>(this);
}
+ void SetIsInUseByMacOSWindowServer(bool value) {
+ is_in_use_by_window_server_ = value;
+ }
+
private:
const gfx::Size size_;
gfx::BufferFormat format_;
@@ -80,6 +88,7 @@ class GpuMemoryBufferImpl : public gfx::GpuMemoryBuffer {
size_t offset_;
size_t stride_;
bool mapped_;
+ bool is_in_use_by_window_server_;
};
} // namespace
@@ -90,6 +99,13 @@ TestGpuMemoryBufferManager::TestGpuMemoryBufferManager() {
TestGpuMemoryBufferManager::~TestGpuMemoryBufferManager() {
}
+void TestGpuMemoryBufferManager::SetGpuMemoryBufferIsInUseByMacOSWindowServer(
+ gfx::GpuMemoryBuffer* gpu_memory_buffer,
+ bool in_use) {
+ static_cast<GpuMemoryBufferImpl*>(gpu_memory_buffer)
+ ->SetIsInUseByMacOSWindowServer(in_use);
+}
+
scoped_ptr<gfx::GpuMemoryBuffer>
TestGpuMemoryBufferManager::AllocateGpuMemoryBuffer(const gfx::Size& size,
gfx::BufferFormat format,