Commit 2c2d3943 authored by boliu's avatar boliu Committed by Commit bot

Revert of Move AW renderer compositor context to gpu thread (patchset #6...

Revert of Move AW renderer compositor context to gpu thread (patchset #6 id:100001 of https://codereview.chromium.org/769703005/)

Reason for revert:
Suspect causing AwContentsClientFullScreenTest#testPowerSaveBlockerIsTransferredToFullscreen to time out

Original issue's description:
> Move AW renderer compositor context to gpu thread
>
> Use TexSubImage2D instead of TexImage2D to avoid orphaning
> EGLImage
> Create the renderer compositor context on the gpu thread.
>
> BUG=448168, 259924
>
> Committed: https://crrev.com/a4baed454be2bb165cb12eb7df432e9138e746e6
> Cr-Commit-Position: refs/heads/master@{#313846}

TBR=epenner@chromium.org,sievers@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=448168, 259924

Review URL: https://codereview.chromium.org/888903002

Cr-Commit-Position: refs/heads/master@{#313948}
parent 19f53ecc
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
#include "content/browser/android/in_process/synchronous_compositor_factory_impl.h" #include "content/browser/android/in_process/synchronous_compositor_factory_impl.h"
#include "base/command_line.h"
#include "base/observer_list.h" #include "base/observer_list.h"
#include "content/browser/android/in_process/synchronous_compositor_external_begin_frame_source.h" #include "content/browser/android/in_process/synchronous_compositor_external_begin_frame_source.h"
#include "content/browser/android/in_process/synchronous_compositor_impl.h" #include "content/browser/android/in_process/synchronous_compositor_impl.h"
...@@ -14,7 +13,6 @@ ...@@ -14,7 +13,6 @@
#include "gpu/blink/webgraphicscontext3d_in_process_command_buffer_impl.h" #include "gpu/blink/webgraphicscontext3d_in_process_command_buffer_impl.h"
#include "gpu/command_buffer/client/gl_in_process_context.h" #include "gpu/command_buffer/client/gl_in_process_context.h"
#include "gpu/command_buffer/common/gles2_cmd_utils.h" #include "gpu/command_buffer/common/gles2_cmd_utils.h"
#include "gpu/command_buffer/service/gpu_switches.h"
#include "ui/gl/android/surface_texture.h" #include "ui/gl/android/surface_texture.h"
#include "ui/gl/gl_surface.h" #include "ui/gl/gl_surface.h"
#include "ui/gl/gl_surface_stub.h" #include "ui/gl/gl_surface_stub.h"
...@@ -66,8 +64,7 @@ scoped_ptr<gpu::GLInProcessContext> CreateOffscreenContext( ...@@ -66,8 +64,7 @@ scoped_ptr<gpu::GLInProcessContext> CreateOffscreenContext(
scoped_ptr<gpu::GLInProcessContext> CreateContext( scoped_ptr<gpu::GLInProcessContext> CreateContext(
scoped_refptr<gpu::InProcessCommandBuffer::Service> service, scoped_refptr<gpu::InProcessCommandBuffer::Service> service,
const gpu::GLInProcessContextSharedMemoryLimits& mem_limits, const gpu::GLInProcessContextSharedMemoryLimits& mem_limits) {
bool is_offscreen) {
const gfx::GpuPreference gpu_preference = gfx::PreferDiscreteGpu; const gfx::GpuPreference gpu_preference = gfx::PreferDiscreteGpu;
gpu::gles2::ContextCreationAttribHelper in_process_attribs; gpu::gles2::ContextCreationAttribHelper in_process_attribs;
WebGraphicsContext3DImpl::ConvertAttributes( WebGraphicsContext3DImpl::ConvertAttributes(
...@@ -77,7 +74,7 @@ scoped_ptr<gpu::GLInProcessContext> CreateContext( ...@@ -77,7 +74,7 @@ scoped_ptr<gpu::GLInProcessContext> CreateContext(
scoped_ptr<gpu::GLInProcessContext> context(gpu::GLInProcessContext::Create( scoped_ptr<gpu::GLInProcessContext> context(gpu::GLInProcessContext::Create(
service, service,
NULL /* surface */, NULL /* surface */,
is_offscreen, false /* is_offscreen */,
gfx::kNullAcceleratedWidget, gfx::kNullAcceleratedWidget,
gfx::Size(1, 1), gfx::Size(1, 1),
NULL /* share_context */, NULL /* share_context */,
...@@ -222,7 +219,7 @@ scoped_refptr<cc::ContextProvider> SynchronousCompositorFactoryImpl:: ...@@ -222,7 +219,7 @@ scoped_refptr<cc::ContextProvider> SynchronousCompositorFactoryImpl::
// pipeline is only one frame deep. // pipeline is only one frame deep.
mem_limits.mapped_memory_reclaim_limit = 6 * 1024 * 1024; mem_limits.mapped_memory_reclaim_limit = 6 * 1024 * 1024;
return webkit::gpu::ContextProviderInProcess::Create( return webkit::gpu::ContextProviderInProcess::Create(
WrapContext(CreateContext(nullptr, mem_limits, true)), WrapContext(CreateContext(service_, mem_limits)),
"Child-Compositor"); "Child-Compositor");
} }
...@@ -291,10 +288,9 @@ SynchronousCompositorFactoryImpl::TryCreateStreamTextureFactory() { ...@@ -291,10 +288,9 @@ SynchronousCompositorFactoryImpl::TryCreateStreamTextureFactory() {
if (!video_context_provider_.get()) { if (!video_context_provider_.get()) {
DCHECK(service_.get()); DCHECK(service_.get());
// This needs to run in on-screen |service_| context due to SurfaceTexture video_context_provider_ = new VideoContextProvider(
// limitations. CreateContext(service_,
video_context_provider_ = new VideoContextProvider(CreateContext( gpu::GLInProcessContextSharedMemoryLimits()));
service_, gpu::GLInProcessContextSharedMemoryLimits(), false));
} }
return video_context_provider_; return video_context_provider_;
} }
......
...@@ -77,16 +77,13 @@ bool AllowTransferThreadForGpu() { ...@@ -77,16 +77,13 @@ bool AllowTransferThreadForGpu() {
AsyncPixelTransferManager* AsyncPixelTransferManager::Create( AsyncPixelTransferManager* AsyncPixelTransferManager::Create(
gfx::GLContext* context) { gfx::GLContext* context) {
DCHECK(context->IsCurrent(NULL)); DCHECK(context->IsCurrent(NULL));
base::CommandLine* cl = base::CommandLine::ForCurrentProcess();
// Threaded mailbox uses EGLImage which conflicts with EGL uploader. // Threaded mailbox uses EGLImage which conflicts with EGL uploader.
// The spec only allows one EGL image per sibling group, but currently the // The spec only allows one EGL image per sibling group, but currently the
// image handle cannot be shared between the threaded mailbox code and // image handle cannot be shared between the threaded mailbox code and
// AsyncPixelTransferManagerEGL. // AsyncPixelTransferManagerEGL.
bool uses_threaded_mailboxes = bool uses_threaded_mailboxes =
cl->HasSwitch(switches::kEnableThreadedTextureMailboxes); base::CommandLine::ForCurrentProcess()->HasSwitch(
// TexImage2D orphans the EGLImage used for threaded mailbox sharing. switches::kEnableThreadedTextureMailboxes);
bool use_teximage2d_over_texsubimage2d = !uses_threaded_mailboxes;
switch (gfx::GetGLImplementation()) { switch (gfx::GetGLImplementation()) {
case gfx::kGLImplementationEGLGLES2: case gfx::kGLImplementationEGLGLES2:
DCHECK(context); DCHECK(context);
...@@ -96,16 +93,15 @@ AsyncPixelTransferManager* AsyncPixelTransferManager::Create( ...@@ -96,16 +93,15 @@ AsyncPixelTransferManager* AsyncPixelTransferManager::Create(
context->HasExtension("EGL_KHR_image_base") && context->HasExtension("EGL_KHR_image_base") &&
context->HasExtension("EGL_KHR_gl_texture_2D_image") && context->HasExtension("EGL_KHR_gl_texture_2D_image") &&
context->HasExtension("GL_OES_EGL_image") && context->HasExtension("GL_OES_EGL_image") &&
!uses_threaded_mailboxes && AllowTransferThreadForGpu()) { !uses_threaded_mailboxes &&
AllowTransferThreadForGpu()) {
TRACE_EVENT0("gpu", "AsyncPixelTransferManager_CreateWithThread"); TRACE_EVENT0("gpu", "AsyncPixelTransferManager_CreateWithThread");
return new AsyncPixelTransferManagerEGL; return new AsyncPixelTransferManagerEGL;
} }
return new AsyncPixelTransferManagerIdle( return new AsyncPixelTransferManagerIdle;
use_teximage2d_over_texsubimage2d);
case gfx::kGLImplementationOSMesaGL: { case gfx::kGLImplementationOSMesaGL: {
TRACE_EVENT0("gpu", "AsyncPixelTransferManager_CreateIdle"); TRACE_EVENT0("gpu", "AsyncPixelTransferManager_CreateIdle");
return new AsyncPixelTransferManagerIdle( return new AsyncPixelTransferManagerIdle;
use_teximage2d_over_texsubimage2d);
} }
case gfx::kGLImplementationMockGL: case gfx::kGLImplementationMockGL:
return new AsyncPixelTransferManagerStub; return new AsyncPixelTransferManagerStub;
......
...@@ -183,8 +183,9 @@ void AsyncPixelTransferDelegateIdle::PerformAsyncTexSubImage2D( ...@@ -183,8 +183,9 @@ void AsyncPixelTransferDelegateIdle::PerformAsyncTexSubImage2D(
base::TimeTicks begin_time(base::TimeTicks::Now()); base::TimeTicks begin_time(base::TimeTicks::Now());
gfx::ScopedTextureBinder texture_binder(tex_params.target, texture_id_); gfx::ScopedTextureBinder texture_binder(tex_params.target, texture_id_);
if (shared_state_->use_teximage2d_over_texsubimage2d && // If it's a full texture update, use glTexImage2D as it's faster.
tex_params.xoffset == 0 && // TODO(epenner): Make this configurable (http://crbug.com/259924)
if (tex_params.xoffset == 0 &&
tex_params.yoffset == 0 && tex_params.yoffset == 0 &&
tex_params.target == define_params_.target && tex_params.target == define_params_.target &&
tex_params.level == define_params_.level && tex_params.level == define_params_.level &&
...@@ -233,11 +234,8 @@ AsyncPixelTransferManagerIdle::Task::Task( ...@@ -233,11 +234,8 @@ AsyncPixelTransferManagerIdle::Task::Task(
AsyncPixelTransferManagerIdle::Task::~Task() {} AsyncPixelTransferManagerIdle::Task::~Task() {}
AsyncPixelTransferManagerIdle::SharedState::SharedState( AsyncPixelTransferManagerIdle::SharedState::SharedState()
bool use_teximage2d_over_texsubimage2d) : texture_upload_count(0) {}
: use_teximage2d_over_texsubimage2d(use_teximage2d_over_texsubimage2d),
texture_upload_count(0) {
}
AsyncPixelTransferManagerIdle::SharedState::~SharedState() {} AsyncPixelTransferManagerIdle::SharedState::~SharedState() {}
...@@ -252,9 +250,8 @@ void AsyncPixelTransferManagerIdle::SharedState::ProcessNotificationTasks() { ...@@ -252,9 +250,8 @@ void AsyncPixelTransferManagerIdle::SharedState::ProcessNotificationTasks() {
} }
} }
AsyncPixelTransferManagerIdle::AsyncPixelTransferManagerIdle( AsyncPixelTransferManagerIdle::AsyncPixelTransferManagerIdle()
bool use_teximage2d_over_texsubimage2d) : shared_state_() {
: shared_state_(use_teximage2d_over_texsubimage2d) {
} }
AsyncPixelTransferManagerIdle::~AsyncPixelTransferManagerIdle() {} AsyncPixelTransferManagerIdle::~AsyncPixelTransferManagerIdle() {}
......
...@@ -13,8 +13,7 @@ namespace gpu { ...@@ -13,8 +13,7 @@ namespace gpu {
class AsyncPixelTransferManagerIdle : public AsyncPixelTransferManager { class AsyncPixelTransferManagerIdle : public AsyncPixelTransferManager {
public: public:
explicit AsyncPixelTransferManagerIdle( AsyncPixelTransferManagerIdle();
bool use_teximage2d_over_texsubimage2d);
~AsyncPixelTransferManagerIdle() override; ~AsyncPixelTransferManagerIdle() override;
// AsyncPixelTransferManager implementation: // AsyncPixelTransferManager implementation:
...@@ -44,11 +43,10 @@ class AsyncPixelTransferManagerIdle : public AsyncPixelTransferManager { ...@@ -44,11 +43,10 @@ class AsyncPixelTransferManagerIdle : public AsyncPixelTransferManager {
// State shared between Managers and Delegates. // State shared between Managers and Delegates.
struct SharedState { struct SharedState {
explicit SharedState(bool use_teximage2d_over_texsubimage2d); SharedState();
~SharedState(); ~SharedState();
void ProcessNotificationTasks(); void ProcessNotificationTasks();
const bool use_teximage2d_over_texsubimage2d;
int texture_upload_count; int texture_upload_count;
base::TimeDelta total_texture_upload_time; base::TimeDelta total_texture_upload_time;
std::list<Task> tasks; std::list<Task> tasks;
......
...@@ -28,7 +28,7 @@ AsyncPixelTransferManager* AsyncPixelTransferManager::Create( ...@@ -28,7 +28,7 @@ AsyncPixelTransferManager* AsyncPixelTransferManager::Create(
case gfx::kGLImplementationOSMesaGL: case gfx::kGLImplementationOSMesaGL:
case gfx::kGLImplementationDesktopGL: case gfx::kGLImplementationDesktopGL:
case gfx::kGLImplementationEGLGLES2: case gfx::kGLImplementationEGLGLES2:
return new AsyncPixelTransferManagerIdle(true); return new AsyncPixelTransferManagerIdle;
case gfx::kGLImplementationMockGL: case gfx::kGLImplementationMockGL:
return new AsyncPixelTransferManagerStub; return new AsyncPixelTransferManagerStub;
default: default:
......
...@@ -18,7 +18,7 @@ AsyncPixelTransferManager* AsyncPixelTransferManager::Create( ...@@ -18,7 +18,7 @@ AsyncPixelTransferManager* AsyncPixelTransferManager::Create(
case gfx::kGLImplementationOSMesaGL: case gfx::kGLImplementationOSMesaGL:
case gfx::kGLImplementationDesktopGL: case gfx::kGLImplementationDesktopGL:
case gfx::kGLImplementationAppleGL: case gfx::kGLImplementationAppleGL:
return new AsyncPixelTransferManagerIdle(true); return new AsyncPixelTransferManagerIdle;
case gfx::kGLImplementationMockGL: case gfx::kGLImplementationMockGL:
return new AsyncPixelTransferManagerStub; return new AsyncPixelTransferManagerStub;
default: default:
......
...@@ -18,7 +18,7 @@ AsyncPixelTransferManager* AsyncPixelTransferManager::Create( ...@@ -18,7 +18,7 @@ AsyncPixelTransferManager* AsyncPixelTransferManager::Create(
case gfx::kGLImplementationOSMesaGL: case gfx::kGLImplementationOSMesaGL:
case gfx::kGLImplementationDesktopGL: case gfx::kGLImplementationDesktopGL:
case gfx::kGLImplementationEGLGLES2: case gfx::kGLImplementationEGLGLES2:
return new AsyncPixelTransferManagerIdle(true); return new AsyncPixelTransferManagerIdle;
case gfx::kGLImplementationMockGL: case gfx::kGLImplementationMockGL:
return new AsyncPixelTransferManagerStub; return new AsyncPixelTransferManagerStub;
default: default:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment