summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorreveman <reveman@chromium.org>2015-10-19 16:38:48 -0700
committerCommit bot <commit-bot@chromium.org>2015-10-19 23:39:22 +0000
commit44429f23f3899d52c9493c114ae9b62e1ddeb7af (patch)
treee74bae28607a9c238eaf3e3ec2c4f1466f7d61e3 /content
parentca96543ef138fe76457b5103bb02eebfde401387 (diff)
downloadchromium_src-44429f23f3899d52c9493c114ae9b62e1ddeb7af.zip
chromium_src-44429f23f3899d52c9493c114ae9b62e1ddeb7af.tar.gz
chromium_src-44429f23f3899d52c9493c114ae9b62e1ddeb7af.tar.bz2
Revert of ui: Move GLImage::BindTexImage fallback from GLImage implementations to GLES2CmdDecoder. (patchset #15 id:280001 of https://codereview.chromium.org/1401423003/ )
Reason for revert: Causing android gpu bots to fail Original issue's description: > ui: Move GLImage::BindTexImage fallback from GLImage implementations to GLES2CmdDecoder. > > This allows the GPU service to properly track the memory usage > image backed textures. > > It also reduces the complexity of GLImage implementations > significantly and makes it easier to support format and > buffer types that require a copy or conversion of data to > be used for sampling. > > This change also includes a few minor GLImage cleanups such > as removing gfx:: namespace prefix in places where it's not > needed and making the CopyTexImage GLImage test not part of > the core GLImage tests as it's optional to support that > function. > > BUG=526298 > TEST=gl_tests --gtest_filter=GpuMemoryBuffer*, gpu_unittests, gl_unittests --gtest_filter=GLImage* > > Committed: https://crrev.com/ac2696e324bda3824952148f831e76a8b80594b3 > Cr-Commit-Position: refs/heads/master@{#354870} TBR=dcastagna@chromium.org,ericrk@chromium.org,fsamuel@chromium.org,liberato@chromium.org,sievers@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=526298 Review URL: https://codereview.chromium.org/1418483003 Cr-Commit-Position: refs/heads/master@{#354914}
Diffstat (limited to 'content')
-rw-r--r--content/common/gpu/media/android_deferred_rendering_backing_strategy.cc2
-rw-r--r--content/common/gpu/media/avda_codec_image.cc50
-rw-r--r--content/common/gpu/media/avda_codec_image.h5
-rw-r--r--content/common/gpu/media/gpu_video_decode_accelerator.cc6
-rw-r--r--content/common/gpu/stream_texture_android.cc26
-rw-r--r--content/common/gpu/stream_texture_android.h6
6 files changed, 38 insertions, 57 deletions
diff --git a/content/common/gpu/media/android_deferred_rendering_backing_strategy.cc b/content/common/gpu/media/android_deferred_rendering_backing_strategy.cc
index db83791..cdfc7af 100644
--- a/content/common/gpu/media/android_deferred_rendering_backing_strategy.cc
+++ b/content/common/gpu/media/android_deferred_rendering_backing_strategy.cc
@@ -110,7 +110,7 @@ void AndroidDeferredRenderingBackingStrategy::SetImageForPicture(
}
texture_manager->SetLevelImage(texture_ref, GetTextureTarget(), 0,
- image.get(), gpu::gles2::Texture::UNBOUND);
+ image.get());
}
void AndroidDeferredRenderingBackingStrategy::UseCodecBufferForPictureBuffer(
diff --git a/content/common/gpu/media/avda_codec_image.cc b/content/common/gpu/media/avda_codec_image.cc
index b6242a9..062b39b 100644
--- a/content/common/gpu/media/avda_codec_image.cc
+++ b/content/common/gpu/media/avda_codec_image.cc
@@ -5,7 +5,6 @@
#include "content/common/gpu/media/avda_codec_image.h"
#include "content/common/gpu/media/avda_shared_state.h"
-#include "gpu/command_buffer/service/context_group.h"
#include "gpu/command_buffer/service/context_state.h"
#include "gpu/command_buffer/service/gles2_cmd_decoder.h"
#include "gpu/command_buffer/service/texture_manager.h"
@@ -51,12 +50,18 @@ unsigned AVDACodecImage::GetInternalFormat() {
}
bool AVDACodecImage::BindTexImage(unsigned target) {
- return false;
+ return true;
}
void AVDACodecImage::ReleaseTexImage(unsigned target) {}
-bool AVDACodecImage::CopyTexImage(unsigned target) {
+bool AVDACodecImage::CopyTexSubImage(unsigned target,
+ const gfx::Point& offset,
+ const gfx::Rect& rect) {
+ return false;
+}
+
+void AVDACodecImage::WillUseTexImage() {
// Have we bound the SurfaceTexture's texture handle to the active
// texture unit yet?
bool bound_texture = false;
@@ -70,38 +75,29 @@ bool AVDACodecImage::CopyTexImage(unsigned target) {
// Make sure that we have the right image in the front buffer.
bound_texture |= UpdateSurfaceTexture();
+ // TODO(liberato): Handle the texture matrix properly.
+ // Either we can update the shader with it or we can move all of the logic
+ // to updateTexImage() to the right place in the cc to send it to the shader.
+ // For now, we just skip it. crbug.com/530681
+
// Sneakily bind the ST texture handle in the real GL context.
// If we called UpdateTexImage() to update the ST front buffer, then we can
// skip this. Since one draw/frame is the common case, we optimize for it.
if (!bound_texture)
glBindTexture(GL_TEXTURE_EXTERNAL_OES,
shared_state_->surface_texture_service_id());
-
- // TODO(liberato): Handle the texture matrix properly.
- // Either we can update the shader with it or we can move all of the logic
- // to updateTexImage() to the right place in the cc to send it to the shader.
- // For now, we just skip it. crbug.com/530681
-
- gpu::gles2::TextureManager* texture_manager =
- decoder_->GetContextGroup()->texture_manager();
- gpu::gles2::Texture* texture =
- texture_manager->GetTextureForServiceId(
- shared_state_->surface_texture_service_id());
- if (texture) {
- // By setting image state to UNBOUND instead of COPIED we ensure that
- // CopyTexImage() is called each time the surface texture is used for
- // drawing.
- texture->SetLevelImage(GL_TEXTURE_EXTERNAL_OES, 0, this,
- gpu::gles2::Texture::UNBOUND);
- }
-
- return true;
}
-bool AVDACodecImage::CopyTexSubImage(unsigned target,
- const gfx::Point& offset,
- const gfx::Rect& rect) {
- return false;
+void AVDACodecImage::DidUseTexImage() {
+ // Unbind the ST's service_id in the real GL context in favor of whatever
+ // the decoder thinks is bound there.
+ const gpu::gles2::ContextState* state = decoder_->GetContextState();
+ const gpu::gles2::TextureUnit& active_unit =
+ state->texture_units[state->active_texture_unit];
+ glBindTexture(GL_TEXTURE_EXTERNAL_OES,
+ active_unit.bound_texture_external_oes.get()
+ ? active_unit.bound_texture_external_oes->service_id()
+ : 0);
}
bool AVDACodecImage::ScheduleOverlayPlane(gfx::AcceleratedWidget widget,
diff --git a/content/common/gpu/media/avda_codec_image.h b/content/common/gpu/media/avda_codec_image.h
index 0ced55c..7550dee 100644
--- a/content/common/gpu/media/avda_codec_image.h
+++ b/content/common/gpu/media/avda_codec_image.h
@@ -29,10 +29,13 @@ class AVDACodecImage : public gfx::GLImage {
unsigned GetInternalFormat() override;
bool BindTexImage(unsigned target) override;
void ReleaseTexImage(unsigned target) override;
- bool CopyTexImage(unsigned target) override;
bool CopyTexSubImage(unsigned target,
const gfx::Point& offset,
const gfx::Rect& rect) override;
+ void WillUseTexImage() override;
+ void DidUseTexImage() override;
+ void WillModifyTexImage() override {}
+ void DidModifyTexImage() override {}
bool ScheduleOverlayPlane(gfx::AcceleratedWidget widget,
int z_order,
gfx::OverlayTransform transform,
diff --git a/content/common/gpu/media/gpu_video_decode_accelerator.cc b/content/common/gpu/media/gpu_video_decode_accelerator.cc
index 3a0071f..0de11be 100644
--- a/content/common/gpu/media/gpu_video_decode_accelerator.cc
+++ b/content/common/gpu/media/gpu_video_decode_accelerator.cc
@@ -341,10 +341,8 @@ void GpuVideoDecodeAccelerator::BindImage(uint32 client_texture_id,
gpu::gles2::TextureManager* texture_manager =
command_decoder->GetContextGroup()->texture_manager();
gpu::gles2::TextureRef* ref = texture_manager->GetTexture(client_texture_id);
- if (ref) {
- texture_manager->SetLevelImage(ref, texture_target, 0, image.get(),
- gpu::gles2::Texture::BOUND);
- }
+ if (ref)
+ texture_manager->SetLevelImage(ref, texture_target, 0, image.get());
}
scoped_ptr<media::VideoDecodeAccelerator>
diff --git a/content/common/gpu/stream_texture_android.cc b/content/common/gpu/stream_texture_android.cc
index 3dabc09..20f1da7 100644
--- a/content/common/gpu/stream_texture_android.cc
+++ b/content/common/gpu/stream_texture_android.cc
@@ -45,9 +45,8 @@ bool StreamTexture::Create(
texture_manager->SetLevelInfo(texture, GL_TEXTURE_EXTERNAL_OES, 0, GL_RGBA,
size.width(), size.height(), 1, 0, GL_RGBA,
GL_UNSIGNED_BYTE, gfx::Rect(size));
- texture_manager->SetLevelImage(texture, GL_TEXTURE_EXTERNAL_OES, 0,
- gl_image.get(),
- gpu::gles2::Texture::UNBOUND);
+ texture_manager->SetLevelImage(
+ texture, GL_TEXTURE_EXTERNAL_OES, 0, gl_image.get());
return true;
}
@@ -64,7 +63,6 @@ StreamTexture::StreamTexture(GpuCommandBufferStub* owner_stub,
owner_stub_(owner_stub),
route_id_(route_id),
has_listener_(false),
- texture_id_(texture_id),
weak_factory_(this) {
owner_stub->AddDestructionObserver(this);
memset(current_matrix_, 0, sizeof(current_matrix_));
@@ -94,11 +92,9 @@ void StreamTexture::Destroy(bool have_context) {
NOTREACHED();
}
-bool StreamTexture::CopyTexImage(unsigned target) {
- DCHECK_EQ(target, static_cast<unsigned>(GL_TEXTURE_EXTERNAL_OES));
-
+void StreamTexture::WillUseTexImage() {
if (!owner_stub_ || !surface_texture_.get())
- return true;
+ return;
if (has_pending_frame_) {
scoped_ptr<ui::ScopedMakeCurrent> scoped_make_current;
@@ -132,18 +128,6 @@ bool StreamTexture::CopyTexImage(unsigned target) {
? active_unit.bound_texture_external_oes->service_id()
: 0);
}
-
- TextureManager* texture_manager =
- owner_stub_->decoder()->GetContextGroup()->texture_manager();
- gpu::gles2::Texture* texture =
- texture_manager->GetTextureForServiceId(texture_id_);
- if (texture) {
- // By setting image state to UNBOUND instead of COPIED we ensure that
- // CopyTexImage() is called each time the surface texture is used for
- // drawing.
- texture->SetLevelImage(GL_TEXTURE_EXTERNAL_OES, 0, this,
- gpu::gles2::Texture::UNBOUND);
- }
}
if (has_listener_ && has_valid_frame_) {
@@ -160,8 +144,6 @@ bool StreamTexture::CopyTexImage(unsigned target) {
new GpuStreamTextureMsg_MatrixChanged(route_id_, params));
}
}
-
- return true;
}
void StreamTexture::OnFrameAvailable() {
diff --git a/content/common/gpu/stream_texture_android.h b/content/common/gpu/stream_texture_android.h
index 94a0848..cce4502c 100644
--- a/content/common/gpu/stream_texture_android.h
+++ b/content/common/gpu/stream_texture_android.h
@@ -38,10 +38,13 @@ class StreamTexture : public gfx::GLImage,
unsigned GetInternalFormat() override;
bool BindTexImage(unsigned target) override;
void ReleaseTexImage(unsigned target) override;
- bool CopyTexImage(unsigned target) override;
bool CopyTexSubImage(unsigned target,
const gfx::Point& offset,
const gfx::Rect& rect) override;
+ void WillUseTexImage() override;
+ void DidUseTexImage() override {}
+ void WillModifyTexImage() override {}
+ void DidModifyTexImage() override {}
bool ScheduleOverlayPlane(gfx::AcceleratedWidget widget,
int z_order,
gfx::OverlayTransform transform,
@@ -82,7 +85,6 @@ class StreamTexture : public gfx::GLImage,
GpuCommandBufferStub* owner_stub_;
int32 route_id_;
bool has_listener_;
- uint32 texture_id_;
base::WeakPtrFactory<StreamTexture> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(StreamTexture);