diff options
author | chirantan <chirantan@chromium.org> | 2015-05-22 11:15:17 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-05-22 18:15:40 +0000 |
commit | 1b81bc40235207ece7fe8cae3e7c1d828f7aa68f (patch) | |
tree | e131fbae72170b08b2c09779bf0edfdd851c2b32 /content/browser | |
parent | 56e65858b85d1c39dc1a91f470c04f703cf2cb08 (diff) | |
download | chromium_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')
6 files changed, 34 insertions, 80 deletions
diff --git a/content/browser/browser_main_loop.cc b/content/browser/browser_main_loop.cc index 50d0d82..7c90c64 100644 --- a/content/browser/browser_main_loop.cc +++ b/content/browser/browser_main_loop.cc @@ -469,8 +469,6 @@ void BrowserMainLoop::EarlyInitialization() { if (parsed_command_line_.HasSwitch(switches::kEnableNativeGpuMemoryBuffers)) { BrowserGpuChannelHostFactory::EnableGpuMemoryBufferFactoryUsage( gfx::GpuMemoryBuffer::MAP); - BrowserGpuChannelHostFactory::EnableGpuMemoryBufferFactoryUsage( - gfx::GpuMemoryBuffer::PERSISTENT_MAP); } #if defined(USE_OZONE) diff --git a/content/browser/compositor/gpu_process_transport_factory.cc b/content/browser/compositor/gpu_process_transport_factory.cc index 6173d6c..112405f 100644 --- a/content/browser/compositor/gpu_process_transport_factory.cc +++ b/content/browser/compositor/gpu_process_transport_factory.cc @@ -402,19 +402,7 @@ void GpuProcessTransportFactory::RemoveCompositor(ui::Compositor* compositor) { bool GpuProcessTransportFactory::DoesCreateTestContexts() { return false; } uint32 GpuProcessTransportFactory::GetImageTextureTarget() { - // TODO(reveman): We currently assume that the compositor will use BGRA_8888 - // if it's able to, and RGBA_8888 otherwise. Since we don't know what it will - // use we hardcode BGRA_8888 here for now. We should instead - // move decisions about GpuMemoryBuffer format to the browser embedder so we - // know it here, and pass that decision to the compositor for each usage. - // crbug.com/490362 - gfx::GpuMemoryBuffer::Format format = gfx::GpuMemoryBuffer::BGRA_8888; - - // TODO(danakj): When one-copy uploads support partial update, change this - // usage to PERSISTENT_MAP for one-copy. - gfx::GpuMemoryBuffer::Usage usage = gfx::GpuMemoryBuffer::MAP; - - return BrowserGpuChannelHostFactory::GetImageTextureTarget(format, usage); + return BrowserGpuChannelHostFactory::GetImageTextureTarget(); } cc::SharedBitmapManager* GpuProcessTransportFactory::GetSharedBitmapManager() { 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( diff --git a/content/browser/gpu/browser_gpu_channel_host_factory.h b/content/browser/gpu/browser_gpu_channel_host_factory.h index aac6e69..b4df563 100644 --- a/content/browser/gpu/browser_gpu_channel_host_factory.h +++ b/content/browser/gpu/browser_gpu_channel_host_factory.h @@ -29,8 +29,7 @@ class CONTENT_EXPORT BrowserGpuChannelHostFactory gfx::GpuMemoryBuffer::Usage usage); static bool IsGpuMemoryBufferFactoryUsageEnabled( gfx::GpuMemoryBuffer::Usage usage); - static uint32 GetImageTextureTarget(gfx::GpuMemoryBuffer::Format format, - gfx::GpuMemoryBuffer::Usage usage); + static uint32 GetImageTextureTarget(); // Overridden from GpuChannelHostFactory: bool IsMainThread() override; diff --git a/content/browser/gpu/browser_gpu_memory_buffer_manager.cc b/content/browser/gpu/browser_gpu_memory_buffer_manager.cc index 2db48f1..70184a0 100644 --- a/content/browser/gpu/browser_gpu_memory_buffer_manager.cc +++ b/content/browser/gpu/browser_gpu_memory_buffer_manager.cc @@ -99,9 +99,8 @@ BrowserGpuMemoryBufferManager::AllocateGpuMemoryBufferCommon( // by factory. if (!gpu_memory_buffer_factory_host_->IsGpuMemoryBufferConfigurationSupported( format, usage)) { - DCHECK(GpuMemoryBufferImplSharedMemory::IsFormatSupported(format)) - << format; - DCHECK(GpuMemoryBufferImplSharedMemory::IsUsageSupported(usage)) << usage; + DCHECK(GpuMemoryBufferImplSharedMemory::IsFormatSupported(format)); + DCHECK_EQ(usage, gfx::GpuMemoryBuffer::MAP); return GpuMemoryBufferImplSharedMemory::Create( g_next_gpu_memory_buffer_id.GetNext(), size, format); } @@ -143,8 +142,8 @@ void BrowserGpuMemoryBufferManager::AllocateGpuMemoryBufferForChildProcess( format, usage)) { // Early out if we cannot fallback to shared memory buffer. if (!GpuMemoryBufferImplSharedMemory::IsFormatSupported(format) || - !GpuMemoryBufferImplSharedMemory::IsUsageSupported(usage) || - !GpuMemoryBufferImplSharedMemory::IsSizeValidForFormat(size, format)) { + !GpuMemoryBufferImplSharedMemory::IsSizeValidForFormat(size, format) || + usage != gfx::GpuMemoryBuffer::MAP) { callback.Run(gfx::GpuMemoryBufferHandle()); return; } diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc index 2d0d2c6..9179690 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc @@ -1133,22 +1133,10 @@ static void AppendCompositorCommandLineFlags(base::CommandLine* command_line) { if (IsForceGpuRasterizationEnabled()) command_line->AppendSwitch(switches::kForceGpuRasterization); - // TODO(reveman): We currently assume that the compositor will use BGRA_8888 - // if it's able to, and RGBA_8888 otherwise. Since we don't know what it will - // use we hardcode BGRA_8888 here for now. We should instead - // move decisions about GpuMemoryBuffer format to the browser embedder so we - // know it here, and pass that decision to the compositor for each usage. - // crbug.com/490362 - gfx::GpuMemoryBuffer::Format format = gfx::GpuMemoryBuffer::BGRA_8888; - - // TODO(danakj): When one-copy uploads support partial update, change this - // usage to PERSISTENT_MAP for one-copy. - gfx::GpuMemoryBuffer::Usage usage = gfx::GpuMemoryBuffer::MAP; - command_line->AppendSwitchASCII( switches::kUseImageTextureTarget, base::UintToString( - BrowserGpuChannelHostFactory::GetImageTextureTarget(format, usage))); + BrowserGpuChannelHostFactory::GetImageTextureTarget())); // Appending disable-gpu-feature switches due to software rendering list. GpuDataManagerImpl* gpu_data_manager = GpuDataManagerImpl::GetInstance(); |