Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(110)

Unified Diff: content/common/gpu/texture_image_transport_surface.cc

Issue 10974008: Aura: Keep scheduling in line with other platforms. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/common/gpu/texture_image_transport_surface.cc
diff --git a/content/common/gpu/texture_image_transport_surface.cc b/content/common/gpu/texture_image_transport_surface.cc
index c6d28e09004edc0673978e1aedc434bd9f414c49..2bf0d0476abc13b41a06749ac0a5451f1533bb2f 100644
--- a/content/common/gpu/texture_image_transport_surface.cc
+++ b/content/common/gpu/texture_image_transport_surface.cc
@@ -42,7 +42,9 @@ TextureImageTransportSurface::TextureImageTransportSurface(
frontbuffer_is_protected_(true),
protection_state_id_(0),
handle_(handle),
- parent_stub_(NULL) {
+ parent_stub_(NULL),
+ is_swap_buffers_pending_(false),
+ did_unschedule_(false) {
helper_.reset(new ImageTransportHelper(this,
manager,
stub,
@@ -116,6 +118,21 @@ void TextureImageTransportSurface::Destroy() {
helper_->Destroy();
}
+bool TextureImageTransportSurface::DeferDraws() {
+ // The command buffer hit a draw/clear command that could clobber the
+ // texture in use by the UI compositor. If a Swap is pending, abort
+ // processing of the command by returning true and unschedule until the Swap
+ // Ack arrives.
+ if (did_unschedule_)
piman 2012/09/24 16:29:48 nit: How can this be called at all if we're unsche
jonathan.backer 2012/09/24 21:08:18 Done.
+ return true; // Still unscheduled, so just return true.
+ if (is_swap_buffers_pending_) {
+ did_unschedule_ = true;
+ helper_->SetScheduled(false);
+ return true;
+ }
+ return false;
+}
+
bool TextureImageTransportSurface::Resize(const gfx::Size&) {
return true;
}
@@ -254,7 +271,9 @@ bool TextureImageTransportSurface::SwapBuffers() {
params.protection_state_id = protection_state_id_;
params.skip_ack = false;
helper_->SendAcceleratedSurfaceBuffersSwapped(params);
- helper_->SetScheduled(false);
+
+ DCHECK(!is_swap_buffers_pending_);
+ is_swap_buffers_pending_ = true;
return true;
}
@@ -323,7 +342,9 @@ bool TextureImageTransportSurface::PostSubBuffer(
params.height = height;
params.protection_state_id = protection_state_id_;
helper_->SendAcceleratedSurfacePostSubBuffer(params);
- helper_->SetScheduled(false);
+
+ DCHECK(!is_swap_buffers_pending_);
+ is_swap_buffers_pending_ = true;
return true;
}
@@ -383,6 +404,9 @@ void TextureImageTransportSurface::OnBufferPresented(uint32 sync_point) {
}
void TextureImageTransportSurface::BufferPresentedImpl() {
+ DCHECK(is_swap_buffers_pending_);
+ is_swap_buffers_pending_ = false;
+
// We're relying on the fact that the parent context is
// finished with it's context when it inserts the sync point that
// triggers this callback.
@@ -401,7 +425,10 @@ void TextureImageTransportSurface::BufferPresentedImpl() {
// Even if MakeCurrent fails, schedule anyway, to trigger the lost context
// logic.
- helper_->SetScheduled(true);
+ if (did_unschedule_) {
+ did_unschedule_ = false;
+ helper_->SetScheduled(true);
+ }
}
void TextureImageTransportSurface::OnResizeViewACK() {
« no previous file with comments | « content/common/gpu/texture_image_transport_surface.h ('k') | gpu/command_buffer/service/gles2_cmd_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698