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