forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gpu: Add CHROMIUM_image support to in-process command buffer.
This makes it possible to use the in-process command buffer with CHROMIUM_image extension. GpuMemoryBufferManager and ImageFactory interfaces need to be provided when creating an in-process command buffer. Existing implementations of these interfaces in content/ should work just fine. cc::TestGpuMemoryBufferManager and cc::TestImageFactory are used for cc pixel tests. They provide a minimal implementation of these interfaces using shared memory. Note: shared memory is used for in-process testing as it maps better to the GpuMemoryBuffer framework that has been designed for multi-process usage. Non-shared memory might be a bit more efficient but it would require more complexity and not match real usage as well. BUG=423533 Review URL: https://codereview.chromium.org/665463003 Cr-Commit-Position: refs/heads/master@{#301763}
- Loading branch information
1 parent
cb127d4
commit 2232bce
Showing
16 changed files
with
277 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Copyright 2014 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "cc/test/test_image_factory.h" | ||
|
||
#include "ui/gl/gl_image_shared_memory.h" | ||
|
||
namespace cc { | ||
|
||
TestImageFactory::TestImageFactory() { | ||
} | ||
|
||
TestImageFactory::~TestImageFactory() { | ||
} | ||
|
||
scoped_refptr<gfx::GLImage> TestImageFactory::CreateImageForGpuMemoryBuffer( | ||
const gfx::GpuMemoryBufferHandle& handle, | ||
const gfx::Size& size, | ||
gfx::GpuMemoryBuffer::Format format, | ||
unsigned internalformat, | ||
int client_id) { | ||
DCHECK_EQ(handle.type, gfx::SHARED_MEMORY_BUFFER); | ||
|
||
scoped_refptr<gfx::GLImageSharedMemory> image( | ||
new gfx::GLImageSharedMemory(size, internalformat)); | ||
if (!image->Initialize(handle, format)) | ||
return nullptr; | ||
|
||
return image; | ||
} | ||
|
||
} // namespace cc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Copyright 2014 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#ifndef CC_TEST_TEST_IMAGE_FACTORY_H_ | ||
#define CC_TEST_TEST_IMAGE_FACTORY_H_ | ||
|
||
#include "gpu/command_buffer/service/image_factory.h" | ||
|
||
namespace cc { | ||
|
||
class TestImageFactory : public gpu::ImageFactory { | ||
public: | ||
TestImageFactory(); | ||
~TestImageFactory() override; | ||
|
||
// Overridden from gpu::ImageFactory: | ||
scoped_refptr<gfx::GLImage> CreateImageForGpuMemoryBuffer( | ||
const gfx::GpuMemoryBufferHandle& handle, | ||
const gfx::Size& size, | ||
gfx::GpuMemoryBuffer::Format format, | ||
unsigned internalformat, | ||
int client_id) override; | ||
|
||
private: | ||
DISALLOW_COPY_AND_ASSIGN(TestImageFactory); | ||
}; | ||
|
||
} // namespace cc | ||
|
||
#endif // CC_TEST_TEST_IMAGE_FACTORY_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.