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

Unified Diff: content/common/gpu/image_transport_surface_fbo_mac.mm

Issue 454243002: Make GPU back-pressure work with remote CALayers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix flashes Created 6 years, 4 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/image_transport_surface_fbo_mac.mm
diff --git a/content/common/gpu/image_transport_surface_fbo_mac.cc b/content/common/gpu/image_transport_surface_fbo_mac.mm
similarity index 93%
rename from content/common/gpu/image_transport_surface_fbo_mac.cc
rename to content/common/gpu/image_transport_surface_fbo_mac.mm
index 3e86a484fe9d0ce87b4168c1fbdc9356c2e3c681..c85a492e21abaa630dbf50cd573604d3fe326722 100644
--- a/content/common/gpu/image_transport_surface_fbo_mac.cc
+++ b/content/common/gpu/image_transport_surface_fbo_mac.mm
@@ -5,6 +5,7 @@
#include "content/common/gpu/image_transport_surface_fbo_mac.h"
#include "content/common/gpu/gpu_messages.h"
+#include "content/common/gpu/image_transport_surface_calayer_mac.h"
#include "content/common/gpu/image_transport_surface_iosurface_mac.h"
#include "ui/gfx/native_widget_types.h"
#include "ui/gl/gl_context.h"
@@ -14,12 +15,10 @@
namespace content {
ImageTransportSurfaceFBO::ImageTransportSurfaceFBO(
- StorageProvider* storage_provider,
GpuChannelManager* manager,
GpuCommandBufferStub* stub,
gfx::PluginWindowHandle handle)
- : storage_provider_(storage_provider),
- backbuffer_suggested_allocation_(true),
+ : backbuffer_suggested_allocation_(true),
frontbuffer_suggested_allocation_(true),
fbo_id_(0),
texture_id_(0),
@@ -30,6 +29,9 @@ ImageTransportSurfaceFBO::ImageTransportSurfaceFBO(
made_current_(false),
is_swap_buffers_pending_(false),
did_unschedule_(false) {
+ // TODO(ccameron): If the remote layer API is supported on this system,
+ // use a CALayerStorageProvider instead of an IOSurfaceStorageProvider.
+ storage_provider_.reset(new IOSurfaceStorageProvider(this));
helper_.reset(new ImageTransportHelper(this, manager, stub, handle));
}
@@ -142,27 +144,9 @@ bool ImageTransportSurfaceFBO::SwapBuffers() {
bool ImageTransportSurfaceFBO::PostSubBuffer(
int x, int y, int width, int height) {
- DCHECK(backbuffer_suggested_allocation_);
- if (!frontbuffer_suggested_allocation_)
- return true;
- glFlush();
-
- GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params params;
- params.surface_handle = storage_provider_->GetSurfaceHandle();
- params.x = x;
- params.y = y;
- params.width = width;
- params.height = height;
- params.surface_size = GetSize();
- params.surface_scale_factor = scale_factor_;
- params.latency_info.swap(latency_info_);
- helper_->SendAcceleratedSurfacePostSubBuffer(params);
-
- DCHECK(!is_swap_buffers_pending_);
- is_swap_buffers_pending_ = true;
-
- storage_provider_->WillSwapBuffers();
- return true;
+ // Mac does not support sub-buffer swaps.
+ NOTREACHED();
+ return false;
}
bool ImageTransportSurfaceFBO::SupportsPostSubBuffer() {
@@ -183,9 +167,12 @@ void* ImageTransportSurfaceFBO::GetDisplay() {
void ImageTransportSurfaceFBO::OnBufferPresented(
const AcceleratedSurfaceMsg_BufferPresented_Params& params) {
- DCHECK(is_swap_buffers_pending_);
-
context_->share_group()->SetRendererID(params.renderer_id);
+ storage_provider_->CanFreeSwappedBuffer();
+}
+
+void ImageTransportSurfaceFBO::UnblockContextAfterPendingSwap() {
+ DCHECK(is_swap_buffers_pending_);
is_swap_buffers_pending_ = false;
if (did_unschedule_) {
did_unschedule_ = false;
« no previous file with comments | « content/common/gpu/image_transport_surface_fbo_mac.cc ('k') | content/common/gpu/image_transport_surface_iosurface_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698