summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpiman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-25 20:52:23 +0000
committerpiman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-25 20:52:23 +0000
commit069944679816b4646248a47f19a49ebeb38e88ec (patch)
tree72bc253e39154505ce1b6ef1df7d1f96e17e8191
parent92e1a00ddcbb8b672368046bfeda5f6c145d777c (diff)
downloadchromium_src-069944679816b4646248a47f19a49ebeb38e88ec.zip
chromium_src-069944679816b4646248a47f19a49ebeb38e88ec.tar.gz
chromium_src-069944679816b4646248a47f19a49ebeb38e88ec.tar.bz2
aura: Change shared context to be offscreen for arm
ARM drivers don't like to have 2 EGLSurface on the same Window. So we need to make the UI shared context offscren. This also requires the image transport surface to be an "offscreen" GLSurface (a pbuffer), however the GLES2Decoder needs to be "onscreen" (i.e. it calls SwapBuffers on the surface instead managing the offscreen buffers itself). So this decouples the 2 notions of "offscreen". BUG=chrome-os-partner:8284 TEST=gpu_unittests. Aura chrome --ui-use-gpu-process with poster circle and webgl on tegra, lumpy, desktop GL. Desktop chrome with poster circle and webgl. Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=131177 Review URL: http://codereview.chromium.org/10007034 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@133975 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--content/browser/renderer_host/image_transport_factory.cc2
-rw-r--r--content/common/gpu/gpu_command_buffer_stub.cc1
-rw-r--r--content/common/gpu/texture_image_transport_surface.cc2
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder.cc52
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder.h4
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder_mock.h3
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc2
-rw-r--r--gpu/command_buffer/tests/gl_manager.cc1
-rw-r--r--gpu/demos/framework/window.cc1
-rw-r--r--gpu/gles2_conform_support/egl/display.cc1
-rw-r--r--webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc1
11 files changed, 40 insertions, 30 deletions
diff --git a/content/browser/renderer_host/image_transport_factory.cc b/content/browser/renderer_host/image_transport_factory.cc
index f7d2072..95f000a 100644
--- a/content/browser/renderer_host/image_transport_factory.cc
+++ b/content/browser/renderer_host/image_transport_factory.cc
@@ -408,7 +408,7 @@ class GpuProcessTransportFactory : public ui::ContextFactory,
WebKit::WebGraphicsContext3D::Attributes attrs;
attrs.shareResources = true;
data->shared_context.reset(new WebGraphicsContext3DCommandBufferImpl(
- data->surface_id,
+ 0,
GURL(),
factory,
data->swap_client->AsWeakPtr()));
diff --git a/content/common/gpu/gpu_command_buffer_stub.cc b/content/common/gpu/gpu_command_buffer_stub.cc
index 90876b6..b6f6d28 100644
--- a/content/common/gpu/gpu_command_buffer_stub.cc
+++ b/content/common/gpu/gpu_command_buffer_stub.cc
@@ -295,6 +295,7 @@ void GpuCommandBufferStub::OnInitialize(
// Initialize the decoder with either the view or pbuffer GLContext.
if (!decoder_->Initialize(surface_.get(),
context_.get(),
+ !surface_id(),
initial_size_,
disallowed_features_,
allowed_extensions_.c_str(),
diff --git a/content/common/gpu/texture_image_transport_surface.cc b/content/common/gpu/texture_image_transport_surface.cc
index 4f374a1..de9d335 100644
--- a/content/common/gpu/texture_image_transport_surface.cc
+++ b/content/common/gpu/texture_image_transport_surface.cc
@@ -123,7 +123,7 @@ bool TextureImageTransportSurface::Resize(const gfx::Size&) {
}
bool TextureImageTransportSurface::IsOffscreen() {
- return false;
+ return parent_stub_ ? parent_stub_->surface()->IsOffscreen() : true;
}
bool TextureImageTransportSurface::OnMakeCurrent(gfx::GLContext* context) {
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index 79f2c04..adf0519 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -472,6 +472,7 @@ class GLES2DecoderImpl : public base::SupportsWeakPtr<GLES2DecoderImpl>,
// Overridden from GLES2Decoder.
virtual bool Initialize(const scoped_refptr<gfx::GLSurface>& surface,
const scoped_refptr<gfx::GLContext>& context,
+ bool offscreen,
const gfx::Size& size,
const DisallowedFeatures& disallowed_features,
const char* allowed_extensions,
@@ -1947,6 +1948,7 @@ GLES2DecoderImpl::~GLES2DecoderImpl() {
bool GLES2DecoderImpl::Initialize(
const scoped_refptr<gfx::GLSurface>& surface,
const scoped_refptr<gfx::GLContext>& context,
+ bool offscreen,
const gfx::Size& size,
const DisallowedFeatures& disallowed_features,
const char* allowed_extensions,
@@ -2069,7 +2071,7 @@ bool GLES2DecoderImpl::Initialize(
glGetIntegerv(GL_STENCIL_BITS, &v);
back_buffer_has_stencil_ = attrib_parser.stencil_size_ != 0 && v > 0;
- if (surface_->IsOffscreen()) {
+ if (offscreen) {
if (attrib_parser.samples_ > 0 && attrib_parser.sample_buffers_ > 0 &&
(context_->HasExtension("GL_EXT_framebuffer_multisample") ||
context_->HasExtension("GL_ANGLE_framebuffer_multisample"))) {
@@ -7710,32 +7712,30 @@ error::Error GLES2DecoderImpl::HandleSwapBuffers(
ScopedResolvedFrameBufferBinder binder(this, true, false);
return error::kNoError;
} else {
- if (surface_->IsOffscreen()) {
- ScopedFrameBufferBinder binder(this,
- offscreen_target_frame_buffer_->id());
-
- if (offscreen_target_buffer_preserved_) {
- // Copy the target frame buffer to the saved offscreen texture.
- offscreen_saved_color_texture_->Copy(
- offscreen_saved_color_texture_->size(),
- offscreen_saved_color_format_);
- } else {
- // Flip the textures in the parent context via the texture manager.
- if (!!offscreen_saved_color_texture_info_.get())
- offscreen_saved_color_texture_info_->
- SetServiceId(offscreen_target_color_texture_->id());
-
- offscreen_saved_color_texture_.swap(offscreen_target_color_texture_);
- offscreen_target_frame_buffer_->AttachRenderTexture(
- offscreen_target_color_texture_.get());
- }
-
- // Ensure the side effects of the copy are visible to the parent
- // context. There is no need to do this for ANGLE because it uses a
- // single D3D device for all contexts.
- if (!IsAngle())
- glFlush();
+ ScopedFrameBufferBinder binder(this,
+ offscreen_target_frame_buffer_->id());
+
+ if (offscreen_target_buffer_preserved_) {
+ // Copy the target frame buffer to the saved offscreen texture.
+ offscreen_saved_color_texture_->Copy(
+ offscreen_saved_color_texture_->size(),
+ offscreen_saved_color_format_);
+ } else {
+ // Flip the textures in the parent context via the texture manager.
+ if (!!offscreen_saved_color_texture_info_.get())
+ offscreen_saved_color_texture_info_->
+ SetServiceId(offscreen_target_color_texture_->id());
+
+ offscreen_saved_color_texture_.swap(offscreen_target_color_texture_);
+ offscreen_target_frame_buffer_->AttachRenderTexture(
+ offscreen_target_color_texture_.get());
}
+
+ // Ensure the side effects of the copy are visible to the parent
+ // context. There is no need to do this for ANGLE because it uses a
+ // single D3D device for all contexts.
+ if (!IsAngle())
+ glFlush();
return error::kNoError;
}
} else {
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.h b/gpu/command_buffer/service/gles2_cmd_decoder.h
index 1d1277b..69be3ed 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.h
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.h
@@ -87,6 +87,9 @@ class GPU_EXPORT GLES2Decoder : public CommonDecoder {
// Parameters:
// surface: the GL surface to render to.
// context: the GL context to render to.
+ // offscreen: whether to make the context offscreen or not. When FBO 0 is
+ // bound, offscreen contexts render to an internal buffer, onscreen ones
+ // to the surface.
// size: the size if the GL context is offscreen.
// allowed_extensions: A string in the same format as
// glGetString(GL_EXTENSIONS) that lists the extensions this context
@@ -95,6 +98,7 @@ class GPU_EXPORT GLES2Decoder : public CommonDecoder {
// true if successful.
virtual bool Initialize(const scoped_refptr<gfx::GLSurface>& surface,
const scoped_refptr<gfx::GLContext>& context,
+ bool offscreen,
const gfx::Size& size,
const DisallowedFeatures& disallowed_features,
const char* allowed_extensions,
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_mock.h b/gpu/command_buffer/service/gles2_cmd_decoder_mock.h
index 4b2d13d..649cb46 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder_mock.h
+++ b/gpu/command_buffer/service/gles2_cmd_decoder_mock.h
@@ -32,9 +32,10 @@ class MockGLES2Decoder : public GLES2Decoder {
MockGLES2Decoder();
virtual ~MockGLES2Decoder();
- MOCK_METHOD6(Initialize,
+ MOCK_METHOD7(Initialize,
bool(const scoped_refptr<gfx::GLSurface>& surface,
const scoped_refptr<gfx::GLContext>& context,
+ bool offscreen,
const gfx::Size& size,
const DisallowedFeatures& disallowed_features,
const char* allowed_extensions,
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc
index 94858ef..c0b1e8c 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc
@@ -341,7 +341,7 @@ void GLES2DecoderTestBase::InitDecoder(
decoder_.reset(GLES2Decoder::Create(group_.get()));
decoder_->set_log_synthesized_gl_errors(false);
decoder_->Initialize(
- surface_, context_, surface_->GetSize(), DisallowedFeatures(),
+ surface_, context_, false, surface_->GetSize(), DisallowedFeatures(),
NULL, attribs);
decoder_->set_engine(engine_.get());
diff --git a/gpu/command_buffer/tests/gl_manager.cc b/gpu/command_buffer/tests/gl_manager.cc
index aab881d..7db4c10 100644
--- a/gpu/command_buffer/tests/gl_manager.cc
+++ b/gpu/command_buffer/tests/gl_manager.cc
@@ -79,6 +79,7 @@ void GLManager::Initialize(const gfx::Size& size) {
ASSERT_TRUE(decoder_->Initialize(
surface_.get(),
context_.get(),
+ true,
size,
::gpu::gles2::DisallowedFeatures(),
allowed_extensions,
diff --git a/gpu/demos/framework/window.cc b/gpu/demos/framework/window.cc
index d5cd3cf..35b6ea9 100644
--- a/gpu/demos/framework/window.cc
+++ b/gpu/demos/framework/window.cc
@@ -94,6 +94,7 @@ bool Window::CreateRenderContext(gfx::AcceleratedWidget hwnd) {
std::vector<int32> attribs;
if (!decoder_->Initialize(surface_.get(),
context_.get(),
+ surface_->IsOffscreen(),
gfx::Size(),
gpu::gles2::DisallowedFeatures(),
NULL,
diff --git a/gpu/gles2_conform_support/egl/display.cc b/gpu/gles2_conform_support/egl/display.cc
index d3dbc08..bc07fae 100644
--- a/gpu/gles2_conform_support/egl/display.cc
+++ b/gpu/gles2_conform_support/egl/display.cc
@@ -112,6 +112,7 @@ EGLSurface Display::CreateWindowSurface(EGLConfig config,
std::vector<int32> attribs;
if (!decoder_->Initialize(gl_surface_.get(),
gl_context_.get(),
+ gl_surface_->IsOffscreen(),
gfx::Size(),
gpu::gles2::DisallowedFeatures(),
NULL,
diff --git a/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc b/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc
index c64e861..d9db876 100644
--- a/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc
+++ b/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc
@@ -426,6 +426,7 @@ bool GLInProcessContext::Initialize(const gfx::Size& size,
if (!decoder_->Initialize(surface_.get(),
context_.get(),
+ true,
size,
::gpu::gles2::DisallowedFeatures(),
allowed_extensions,