summaryrefslogtreecommitdiffstats
path: root/content/browser/gpu/browser_gpu_channel_host_factory.cc
diff options
context:
space:
mode:
authorchirantan <chirantan@chromium.org>2015-05-22 11:15:17 -0700
committerCommit bot <commit-bot@chromium.org>2015-05-22 18:15:40 +0000
commit1b81bc40235207ece7fe8cae3e7c1d828f7aa68f (patch)
treee131fbae72170b08b2c09779bf0edfdd851c2b32 /content/browser/gpu/browser_gpu_channel_host_factory.cc
parent56e65858b85d1c39dc1a91f470c04f703cf2cb08 (diff)
downloadchromium_src-1b81bc40235207ece7fe8cae3e7c1d828f7aa68f.zip
chromium_src-1b81bc40235207ece7fe8cae3e7c1d828f7aa68f.tar.gz
chromium_src-1b81bc40235207ece7fe8cae3e7c1d828f7aa68f.tar.bz2
Revert of Add PERSISTENT_MAP usage for GpuMemoryBuffers. (patchset #11 id:330001 of https://codereview.chromium.org/1139903005/)
Reason for revert: The is causing the freon chrome on chrome os build to fail. Looks like a case for PERSISTENT_MAP also needs to be added to ui::GbmSurfaceFactory::CanCreateNativePixmap() in ui/ozone/platform/drm/gbm_surface_factory.cc. Here is a link to a failing build: https://uberchromegw.corp.google.com/i/chromeos/builders/amd64-generic_freon%20chromium%20PFQ/builds/1151 Original issue's description: > Add PERSISTENT_MAP usage for GpuMemoryBuffers. > > A GpuMemoryBuffer with this usage flag will always point at the > same memory contents each time it is mapped. This will enable > partial tile updates by avoiding rastering content from the > previous frame again in the compositor. > > R=reveman,piman > BUG=489447 > > Committed: https://crrev.com/77180b4434d93f45022b8c65110344cdced4b19d > Cr-Commit-Position: refs/heads/master@{#330987} TBR=reveman@chromium.org,alexst@chromium.org,piman@chromium.org,sky@chromium.org,danakj@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=489447 Review URL: https://codereview.chromium.org/1151943003 Cr-Commit-Position: refs/heads/master@{#331140}
Diffstat (limited to 'content/browser/gpu/browser_gpu_channel_host_factory.cc')
-rw-r--r--content/browser/gpu/browser_gpu_channel_host_factory.cc72
1 files changed, 27 insertions, 45 deletions
diff --git a/content/browser/gpu/browser_gpu_channel_host_factory.cc b/content/browser/gpu/browser_gpu_channel_host_factory.cc
index 4019ccb..205542c 100644
--- a/content/browser/gpu/browser_gpu_channel_host_factory.cc
+++ b/content/browser/gpu/browser_gpu_channel_host_factory.cc
@@ -43,38 +43,8 @@ namespace {
base::LazyInstance<std::set<gfx::GpuMemoryBuffer::Usage>>
g_enabled_gpu_memory_buffer_usages;
-
-bool IsGpuMemoryBufferFactoryConfigurationSupported(
- gfx::GpuMemoryBuffer::Format format,
- gfx::GpuMemoryBuffer::Usage usage,
- gfx::GpuMemoryBufferType type) {
- switch (type) {
- case gfx::SHARED_MEMORY_BUFFER:
- // Shared memory buffers must be created in-process.
- return false;
-#if defined(OS_MACOSX)
- case gfx::IO_SURFACE_BUFFER:
- return GpuMemoryBufferFactoryIOSurface::
- IsGpuMemoryBufferConfigurationSupported(format, usage);
-#endif
-#if defined(OS_ANDROID)
- case gfx::SURFACE_TEXTURE_BUFFER:
- return GpuMemoryBufferFactorySurfaceTexture::
- IsGpuMemoryBufferConfigurationSupported(format, usage);
-#endif
-#if defined(USE_OZONE)
- case gfx::OZONE_NATIVE_BUFFER:
- return GpuMemoryBufferFactoryOzoneNativeBuffer::
- IsGpuMemoryBufferConfigurationSupported(format, usage);
-#endif
- default:
- NOTREACHED();
- return false;
- }
}
-} // namespace
-
BrowserGpuChannelHostFactory* BrowserGpuChannelHostFactory::instance_ = NULL;
struct BrowserGpuChannelHostFactory::CreateRequest {
@@ -284,23 +254,17 @@ bool BrowserGpuChannelHostFactory::IsGpuMemoryBufferFactoryUsageEnabled(
}
// static
-uint32 BrowserGpuChannelHostFactory::GetImageTextureTarget(
- gfx::GpuMemoryBuffer::Format format,
- gfx::GpuMemoryBuffer::Usage usage) {
- if (!IsGpuMemoryBufferFactoryUsageEnabled(usage))
+uint32 BrowserGpuChannelHostFactory::GetImageTextureTarget() {
+ if (!IsGpuMemoryBufferFactoryUsageEnabled(gfx::GpuMemoryBuffer::MAP))
return GL_TEXTURE_2D;
std::vector<gfx::GpuMemoryBufferType> supported_types;
GpuMemoryBufferFactory::GetSupportedTypes(&supported_types);
DCHECK(!supported_types.empty());
- // The GPU service will always use the preferred type, if the |format| and
- // |usage| allows.
+ // The GPU service will always use the preferred type.
gfx::GpuMemoryBufferType type = supported_types[0];
- if (!IsGpuMemoryBufferFactoryConfigurationSupported(format, usage, type))
- return GL_TEXTURE_2D;
-
switch (type) {
case gfx::SURFACE_TEXTURE_BUFFER:
case gfx::OZONE_NATIVE_BUFFER:
@@ -507,15 +471,33 @@ bool BrowserGpuChannelHostFactory::IsGpuMemoryBufferConfigurationSupported(
if (!IsGpuMemoryBufferFactoryUsageEnabled(usage))
return false;
+ // Preferred type is always used by factory.
std::vector<gfx::GpuMemoryBufferType> supported_types;
GpuMemoryBufferFactory::GetSupportedTypes(&supported_types);
DCHECK(!supported_types.empty());
-
- // The GPU service will always use the preferred type, if the |format| and
- // |usage| allows.
- gfx::GpuMemoryBufferType type = supported_types[0];
-
- return IsGpuMemoryBufferFactoryConfigurationSupported(format, usage, type);
+ switch (supported_types[0]) {
+ case gfx::SHARED_MEMORY_BUFFER:
+ // Shared memory buffers must be created in-process.
+ return false;
+#if defined(OS_MACOSX)
+ case gfx::IO_SURFACE_BUFFER:
+ return GpuMemoryBufferFactoryIOSurface::
+ IsGpuMemoryBufferConfigurationSupported(format, usage);
+#endif
+#if defined(OS_ANDROID)
+ case gfx::SURFACE_TEXTURE_BUFFER:
+ return GpuMemoryBufferFactorySurfaceTexture::
+ IsGpuMemoryBufferConfigurationSupported(format, usage);
+#endif
+#if defined(USE_OZONE)
+ case gfx::OZONE_NATIVE_BUFFER:
+ return GpuMemoryBufferFactoryOzoneNativeBuffer::
+ IsGpuMemoryBufferConfigurationSupported(format, usage);
+#endif
+ default:
+ NOTREACHED();
+ return false;
+ }
}
void BrowserGpuChannelHostFactory::CreateGpuMemoryBuffer(