diff options
author | vabr <vabr@chromium.org> | 2015-05-29 03:40:27 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-05-29 10:41:10 +0000 |
commit | 9b3f11392a034ab4479126eede391e253c7c0969 (patch) | |
tree | eae5a5a112cf12893f0ffb228ed22863023cca89 | |
parent | 583a6c2a684d55ab7d2fc7f758e3af1bb4adf244 (diff) | |
download | chromium_src-9b3f11392a034ab4479126eede391e253c7c0969.zip chromium_src-9b3f11392a034ab4479126eede391e253c7c0969.tar.gz chromium_src-9b3f11392a034ab4479126eede391e253c7c0969.tar.bz2 |
Revert of Adding status to swap complete (patchset #18 id:340001 of https://codereview.chromium.org/1084173004/)
Reason for revert:
Looks like this broke compilation on http://build.chromium.org/p/chromium.chromiumos/builders/Linux%20ChromiumOS%20Ozone%20Builder/builds/17401.
Speculatively reverting for now. If confirmed, will file a bug with details, otherwise re-revert.
Cheers,
your's sheriff
Original issue's description:
> Adding status to swap buffers completion
>
> This will give us more options than completing all swaps successfully, or losing context
>
> BUG=476966
> TBR=torne - approved interface change
>
> Committed: https://crrev.com/c794eda78e9ba3c46b550b433e9fe5a248d40104
> Cr-Commit-Position: refs/heads/master@{#331906}
TBR=alexst@chromium.org,danakj@chromium.org,dnicoara@chromium.org,nasko@chromium.org,piman@chromium.org,spang@chromium.org,torne@chromium.org,dcheng@chromium.org,achaulk@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=476966
Review URL: https://codereview.chromium.org/1166463004
Cr-Commit-Position: refs/heads/master@{#331939}
54 files changed, 190 insertions, 307 deletions
diff --git a/android_webview/browser/aw_gl_surface.cc b/android_webview/browser/aw_gl_surface.cc index a542275..5ff9272 100644 --- a/android_webview/browser/aw_gl_surface.cc +++ b/android_webview/browser/aw_gl_surface.cc @@ -21,8 +21,8 @@ unsigned int AwGLSurface::GetBackingFrameBufferObject() { return fbo_; } -gfx::SwapResult AwGLSurface::SwapBuffers() { - return gfx::SwapResult::SWAP_ACK; +bool AwGLSurface::SwapBuffers() { + return true; } gfx::Size AwGLSurface::GetSize() { diff --git a/android_webview/browser/aw_gl_surface.h b/android_webview/browser/aw_gl_surface.h index 6366a35..128b5515 100644 --- a/android_webview/browser/aw_gl_surface.h +++ b/android_webview/browser/aw_gl_surface.h @@ -20,7 +20,7 @@ class GL_EXPORT AwGLSurface : public gfx::GLSurface { void Destroy() override; bool IsOffscreen() override; unsigned int GetBackingFrameBufferObject() override; - gfx::SwapResult SwapBuffers() override; + bool SwapBuffers() override; gfx::Size GetSize() override; void* GetHandle() override; void* GetDisplay() override; diff --git a/content/browser/compositor/gpu_browser_compositor_output_surface.cc b/content/browser/compositor/gpu_browser_compositor_output_surface.cc index 943a27a..273f40b 100644 --- a/content/browser/compositor/gpu_browser_compositor_output_surface.cc +++ b/content/browser/compositor/gpu_browser_compositor_output_surface.cc @@ -105,8 +105,7 @@ void GpuBrowserCompositorOutputSurface::SwapBuffers( } void GpuBrowserCompositorOutputSurface::OnSwapBuffersCompleted( - const std::vector<ui::LatencyInfo>& latency_info, - gfx::SwapResult result) { + const std::vector<ui::LatencyInfo>& latency_info) { #if defined(OS_MACOSX) // On Mac, delay acknowledging the swap to the output surface client until // it has been drawn, see OnSurfaceDisplayed(); diff --git a/content/browser/compositor/gpu_browser_compositor_output_surface.h b/content/browser/compositor/gpu_browser_compositor_output_surface.h index e1d1a49..1259858 100644 --- a/content/browser/compositor/gpu_browser_compositor_output_surface.h +++ b/content/browser/compositor/gpu_browser_compositor_output_surface.h @@ -7,7 +7,6 @@ #include "base/cancelable_callback.h" #include "content/browser/compositor/browser_compositor_output_surface.h" -#include "ui/gfx/swap_result.h" namespace ui { class CompositorVSyncManager; @@ -59,11 +58,9 @@ class GpuBrowserCompositorOutputSurface #endif CommandBufferProxyImpl* GetCommandBufferProxy(); - void OnSwapBuffersCompleted(const std::vector<ui::LatencyInfo>& latency_info, - gfx::SwapResult result); + void OnSwapBuffersCompleted(const std::vector<ui::LatencyInfo>& latency_info); - base::CancelableCallback<void(const std::vector<ui::LatencyInfo>&, - gfx::SwapResult)> + base::CancelableCallback<void(const std::vector<ui::LatencyInfo>&)> swap_buffers_completion_callback_; base::CancelableCallback<void(base::TimeTicks timebase, base::TimeDelta interval)> diff --git a/content/browser/renderer_host/compositor_impl_android.cc b/content/browser/renderer_host/compositor_impl_android.cc index f5ec1e5..9ee5ef6 100644 --- a/content/browser/renderer_host/compositor_impl_android.cc +++ b/content/browser/renderer_host/compositor_impl_android.cc @@ -60,7 +60,6 @@ #include "third_party/skia/include/core/SkMallocPixelRef.h" #include "ui/android/window_android.h" #include "ui/gfx/android/device_display_info.h" -#include "ui/gfx/swap_result.h" namespace content { @@ -119,14 +118,13 @@ class OutputSurfaceWithoutParent : public cc::OutputSurface { return command_buffer_proxy; } - void OnSwapBuffersCompleted(const std::vector<ui::LatencyInfo>& latency_info, - gfx::SwapResult result) { + void OnSwapBuffersCompleted( + const std::vector<ui::LatencyInfo>& latency_info) { RenderWidgetHostImpl::CompositorFrameDrawn(latency_info); OutputSurface::OnSwapBuffersComplete(); } - base::CancelableCallback<void(const std::vector<ui::LatencyInfo>&, - gfx::SwapResult)> + base::CancelableCallback<void(const std::vector<ui::LatencyInfo>&)> swap_buffers_completion_callback_; scoped_refptr<base::MessageLoopProxy> main_thread_; diff --git a/content/common/gpu/client/command_buffer_proxy_impl.cc b/content/common/gpu/client/command_buffer_proxy_impl.cc index 36e6459..8ca94b3 100644 --- a/content/common/gpu/client/command_buffer_proxy_impl.cc +++ b/content/common/gpu/client/command_buffer_proxy_impl.cc @@ -598,16 +598,14 @@ gpu::CommandBufferSharedState* CommandBufferProxyImpl::shared_state() const { } void CommandBufferProxyImpl::OnSwapBuffersCompleted( - const std::vector<ui::LatencyInfo>& latency_info, - gfx::SwapResult result) { + const std::vector<ui::LatencyInfo>& latency_info) { if (!swap_buffers_completion_callback_.is_null()) { if (!ui::LatencyInfo::Verify( latency_info, "CommandBufferProxyImpl::OnSwapBuffersCompleted")) { - swap_buffers_completion_callback_.Run(std::vector<ui::LatencyInfo>(), - result); + swap_buffers_completion_callback_.Run(std::vector<ui::LatencyInfo>()); return; } - swap_buffers_completion_callback_.Run(latency_info, result); + swap_buffers_completion_callback_.Run(latency_info); } } diff --git a/content/common/gpu/client/command_buffer_proxy_impl.h b/content/common/gpu/client/command_buffer_proxy_impl.h index 9f85bb2..4bd2006b 100644 --- a/content/common/gpu/client/command_buffer_proxy_impl.h +++ b/content/common/gpu/client/command_buffer_proxy_impl.h @@ -22,7 +22,6 @@ #include "gpu/command_buffer/common/gpu_memory_allocation.h" #include "ipc/ipc_listener.h" #include "ui/events/latency_info.h" -#include "ui/gfx/swap_result.h" struct GPUCommandBufferConsoleMessage; @@ -137,8 +136,7 @@ class CommandBufferProxyImpl void SetLatencyInfo(const std::vector<ui::LatencyInfo>& latency_info); using SwapBuffersCompletionCallback = - base::Callback<void(const std::vector<ui::LatencyInfo>& latency_info, - gfx::SwapResult result)>; + base::Callback<void(const std::vector<ui::LatencyInfo>& latency_info)>; void SetSwapBuffersCompletionCallback( const SwapBuffersCompletionCallback& callback); @@ -182,8 +180,7 @@ class CommandBufferProxyImpl void OnConsoleMessage(const GPUCommandBufferConsoleMessage& message); void OnSetMemoryAllocation(const gpu::MemoryAllocation& allocation); void OnSignalSyncPointAck(uint32 id); - void OnSwapBuffersCompleted(const std::vector<ui::LatencyInfo>& latency_info, - gfx::SwapResult result); + void OnSwapBuffersCompleted(const std::vector<ui::LatencyInfo>& latency_info); void OnUpdateVSyncParameters(base::TimeTicks timebase, base::TimeDelta interval); diff --git a/content/common/gpu/gpu_command_buffer_stub.cc b/content/common/gpu/gpu_command_buffer_stub.cc index 729f66d..bb4044a 100644 --- a/content/common/gpu/gpu_command_buffer_stub.cc +++ b/content/common/gpu/gpu_command_buffer_stub.cc @@ -1107,10 +1107,8 @@ uint64 GpuCommandBufferStub::GetMemoryUsage() const { } void GpuCommandBufferStub::SendSwapBuffersCompleted( - const std::vector<ui::LatencyInfo>& latency_info, - gfx::SwapResult result) { - Send(new GpuCommandBufferMsg_SwapBuffersCompleted(route_id_, latency_info, - result)); + const std::vector<ui::LatencyInfo>& latency_info) { + Send(new GpuCommandBufferMsg_SwapBuffersCompleted(route_id_, latency_info)); } void GpuCommandBufferStub::SendUpdateVSyncParameters(base::TimeTicks timebase, diff --git a/content/common/gpu/gpu_command_buffer_stub.h b/content/common/gpu/gpu_command_buffer_stub.h index 24ba37a..c9e215c 100644 --- a/content/common/gpu/gpu_command_buffer_stub.h +++ b/content/common/gpu/gpu_command_buffer_stub.h @@ -27,7 +27,6 @@ #include "ui/gfx/geometry/size.h" #include "ui/gfx/gpu_memory_buffer.h" #include "ui/gfx/native_widget_types.h" -#include "ui/gfx/swap_result.h" #include "ui/gl/gl_surface.h" #include "ui/gl/gpu_preference.h" #include "url/gurl.h" @@ -149,8 +148,7 @@ class GpuCommandBufferStub uint64 GetMemoryUsage() const; void SendSwapBuffersCompleted( - const std::vector<ui::LatencyInfo>& latency_info, - gfx::SwapResult result); + const std::vector<ui::LatencyInfo>& latency_info); void SendUpdateVSyncParameters(base::TimeTicks timebase, base::TimeDelta interval); diff --git a/content/common/gpu/gpu_messages.h b/content/common/gpu/gpu_messages.h index 2f30dac..6bdec50 100644 --- a/content/common/gpu/gpu_messages.h +++ b/content/common/gpu/gpu_messages.h @@ -33,7 +33,6 @@ #include "ui/gfx/geometry/size.h" #include "ui/gfx/gpu_memory_buffer.h" #include "ui/gfx/native_widget_types.h" -#include "ui/gfx/swap_result.h" #include "ui/gl/gpu_preference.h" #if defined(OS_ANDROID) @@ -53,7 +52,6 @@ IPC_ENUM_TRAITS_MAX_VALUE(gfx::GpuPreference, gfx::GpuPreferenceLast) IPC_ENUM_TRAITS_MAX_VALUE(gfx::SurfaceType, gfx::SURFACE_TYPE_LAST) -IPC_ENUM_TRAITS_MAX_VALUE(gfx::SwapResult, gfx::SwapResult::SWAP_RESULT_LAST) IPC_ENUM_TRAITS_MAX_VALUE(gpu::MemoryAllocation::PriorityCutoff, gpu::MemoryAllocation::CUTOFF_LAST) IPC_ENUM_TRAITS_MAX_VALUE(gpu::error::Error, gpu::error::kErrorLast) @@ -560,9 +558,8 @@ IPC_MESSAGE_ROUTED2(GpuCommandBufferMsg_Destroyed, gpu::error::Error /* error */) // Tells the browser that SwapBuffers returned and passes latency info -IPC_MESSAGE_ROUTED2(GpuCommandBufferMsg_SwapBuffersCompleted, - std::vector<ui::LatencyInfo> /* latency_info */, - gfx::SwapResult /* result */) +IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_SwapBuffersCompleted, + std::vector<ui::LatencyInfo> /* latency_info */) // Tells the browser about updated parameters for vsync alignment. IPC_MESSAGE_ROUTED2(GpuCommandBufferMsg_UpdateVSyncParameters, diff --git a/content/common/gpu/image_transport_surface.cc b/content/common/gpu/image_transport_surface.cc index 6d2808f..ac5eb2e 100644 --- a/content/common/gpu/image_transport_surface.cc +++ b/content/common/gpu/image_transport_surface.cc @@ -187,7 +187,7 @@ void PassThroughImageTransportSurface::SetLatencyInfo( latency_info_.push_back(latency_info[i]); } -gfx::SwapResult PassThroughImageTransportSurface::SwapBuffers() { +bool PassThroughImageTransportSurface::SwapBuffers() { // GetVsyncValues before SwapBuffers to work around Mali driver bug: // crbug.com/223558. SendVSyncUpdateIfAvailable(); @@ -206,16 +206,12 @@ gfx::SwapResult PassThroughImageTransportSurface::SwapBuffers() { new std::vector<ui::LatencyInfo>(); latency_info_ptr->swap(latency_info_); return gfx::GLSurfaceAdapter::SwapBuffersAsync(base::Bind( - &PassThroughImageTransportSurface::SwapBuffersCallBack, - weak_ptr_factory_.GetWeakPtr(), base::Owned(latency_info_ptr))) - ? gfx::SwapResult::SWAP_ACK - : gfx::SwapResult::SWAP_FAILED; + &PassThroughImageTransportSurface::SwapBuffersCallBack, + weak_ptr_factory_.GetWeakPtr(), base::Owned(latency_info_ptr))); } -gfx::SwapResult PassThroughImageTransportSurface::PostSubBuffer(int x, - int y, - int width, - int height) { +bool PassThroughImageTransportSurface::PostSubBuffer( + int x, int y, int width, int height) { SendVSyncUpdateIfAvailable(); base::TimeTicks swap_time = base::TimeTicks::Now(); @@ -232,17 +228,14 @@ gfx::SwapResult PassThroughImageTransportSurface::PostSubBuffer(int x, new std::vector<ui::LatencyInfo>(); latency_info_ptr->swap(latency_info_); return gfx::GLSurfaceAdapter::PostSubBufferAsync( - x, y, width, height, - base::Bind(&PassThroughImageTransportSurface::SwapBuffersCallBack, - weak_ptr_factory_.GetWeakPtr(), - base::Owned(latency_info_ptr))) - ? gfx::SwapResult::SWAP_ACK - : gfx::SwapResult::SWAP_FAILED; + x, y, width, height, + base::Bind(&PassThroughImageTransportSurface::SwapBuffersCallBack, + weak_ptr_factory_.GetWeakPtr(), + base::Owned(latency_info_ptr))); } void PassThroughImageTransportSurface::SwapBuffersCallBack( - std::vector<ui::LatencyInfo>* latency_info_ptr, - gfx::SwapResult result) { + std::vector<ui::LatencyInfo>* latency_info_ptr) { base::TimeTicks swap_ack_time = base::TimeTicks::Now(); for (auto& latency : *latency_info_ptr) { latency.AddLatencyNumberWithTimestamp( @@ -250,7 +243,7 @@ void PassThroughImageTransportSurface::SwapBuffersCallBack( swap_ack_time, 1); } - helper_->stub()->SendSwapBuffersCompleted(*latency_info_ptr, result); + helper_->stub()->SendSwapBuffersCompleted(*latency_info_ptr); } bool PassThroughImageTransportSurface::OnMakeCurrent(gfx::GLContext* context) { diff --git a/content/common/gpu/image_transport_surface.h b/content/common/gpu/image_transport_surface.h index c0bceab..d3f2e85 100644 --- a/content/common/gpu/image_transport_surface.h +++ b/content/common/gpu/image_transport_surface.h @@ -19,7 +19,6 @@ #include "ui/gfx/geometry/rect.h" #include "ui/gfx/geometry/size.h" #include "ui/gfx/native_widget_types.h" -#include "ui/gfx/swap_result.h" #include "ui/gl/gl_surface.h" struct AcceleratedSurfaceMsg_BufferPresented_Params; @@ -176,8 +175,8 @@ class PassThroughImageTransportSurface // GLSurface implementation. bool Initialize() override; void Destroy() override; - gfx::SwapResult SwapBuffers() override; - gfx::SwapResult PostSubBuffer(int x, int y, int width, int height) override; + bool SwapBuffers() override; + bool PostSubBuffer(int x, int y, int width, int height) override; bool OnMakeCurrent(gfx::GLContext* context) override; // ImageTransportSurface implementation. @@ -197,8 +196,7 @@ class PassThroughImageTransportSurface // If updated vsync parameters can be determined, send this information to // the browser. virtual void SendVSyncUpdateIfAvailable(); - void SwapBuffersCallBack(std::vector<ui::LatencyInfo>* latency_info_ptr, - gfx::SwapResult result); + void SwapBuffersCallBack(std::vector<ui::LatencyInfo>* latency_info_ptr); ImageTransportHelper* GetHelper() { return helper_.get(); } diff --git a/content/common/gpu/image_transport_surface_android.cc b/content/common/gpu/image_transport_surface_android.cc index 56030ef..6d67df2 100644 --- a/content/common/gpu/image_transport_surface_android.cc +++ b/content/common/gpu/image_transport_surface_android.cc @@ -59,7 +59,7 @@ class DirectSurfaceAndroid : public PassThroughImageTransportSurface { gfx::GLSurface* surface); // gfx::GLSurface implementation. - gfx::SwapResult SwapBuffers() override; + bool SwapBuffers() override; protected: ~DirectSurfaceAndroid() override; @@ -123,7 +123,7 @@ DirectSurfaceAndroid::DirectSurfaceAndroid(GpuChannelManager* manager, DirectSurfaceAndroid::~DirectSurfaceAndroid() {} -gfx::SwapResult DirectSurfaceAndroid::SwapBuffers() { +bool DirectSurfaceAndroid::SwapBuffers() { DidAccessGpu(); return PassThroughImageTransportSurface::SwapBuffers(); } diff --git a/content/common/gpu/image_transport_surface_fbo_mac.h b/content/common/gpu/image_transport_surface_fbo_mac.h index d39e2459..d5a0c20 100644 --- a/content/common/gpu/image_transport_surface_fbo_mac.h +++ b/content/common/gpu/image_transport_surface_fbo_mac.h @@ -71,8 +71,8 @@ class ImageTransportSurfaceFBO void Destroy() override; bool DeferDraws() override; bool IsOffscreen() override; - gfx::SwapResult SwapBuffers() override; - gfx::SwapResult PostSubBuffer(int x, int y, int width, int height) override; + bool SwapBuffers() override; + bool PostSubBuffer(int x, int y, int width, int height) override; bool SupportsPostSubBuffer() override; gfx::Size GetSize() override; void* GetHandle() override; diff --git a/content/common/gpu/image_transport_surface_fbo_mac.mm b/content/common/gpu/image_transport_surface_fbo_mac.mm index 102a6b3..f1aa838 100644 --- a/content/common/gpu/image_transport_surface_fbo_mac.mm +++ b/content/common/gpu/image_transport_surface_fbo_mac.mm @@ -169,10 +169,9 @@ void ImageTransportSurfaceFBO::AdjustBufferAllocation() { } } -gfx::SwapResult ImageTransportSurfaceFBO::SwapBuffers() { +bool ImageTransportSurfaceFBO::SwapBuffers() { TRACE_EVENT0("gpu", "ImageTransportSurfaceFBO::SwapBuffers"); - return SwapBuffersInternal() ? gfx::SwapResult::SWAP_ACK - : gfx::SwapResult::SWAP_FAILED; + return SwapBuffersInternal(); } bool ImageTransportSurfaceFBO::SwapBuffersInternal() { @@ -209,13 +208,10 @@ void ImageTransportSurfaceFBO::SetRendererID(int renderer_id) { context_->share_group()->SetRendererID(renderer_id); } -gfx::SwapResult ImageTransportSurfaceFBO::PostSubBuffer(int x, - int y, - int width, - int height) { +bool ImageTransportSurfaceFBO::PostSubBuffer( + int x, int y, int width, int height) { TRACE_EVENT0("gpu", "ImageTransportSurfaceFBO::PostSubBuffer"); - return SwapBuffersInternal() ? gfx::SwapResult::SWAP_ACK - : gfx::SwapResult::SWAP_FAILED; + return SwapBuffersInternal(); } bool ImageTransportSurfaceFBO::SupportsPostSubBuffer() { diff --git a/content/common/gpu/image_transport_surface_mac.mm b/content/common/gpu/image_transport_surface_mac.mm index 04b6bc3..7966d5a 100644 --- a/content/common/gpu/image_transport_surface_mac.mm +++ b/content/common/gpu/image_transport_surface_mac.mm @@ -28,15 +28,15 @@ class DRTSurfaceOSMesa : public gfx::GLSurfaceOSMesa { : GLSurfaceOSMesa(gfx::OSMesaSurfaceFormatRGBA, gfx::Size(1, 1)) {} // Implement a subset of GLSurface. - gfx::SwapResult SwapBuffers() override; + bool SwapBuffers() override; private: ~DRTSurfaceOSMesa() override {} DISALLOW_COPY_AND_ASSIGN(DRTSurfaceOSMesa); }; -gfx::SwapResult DRTSurfaceOSMesa::SwapBuffers() { - return gfx::SwapResult::SWAP_ACK; +bool DRTSurfaceOSMesa::SwapBuffers() { + return true; } bool g_allow_os_mesa = false; diff --git a/content/common/gpu/null_transport_surface.cc b/content/common/gpu/null_transport_surface.cc index 33521a0..ebcea85 100644 --- a/content/common/gpu/null_transport_surface.cc +++ b/content/common/gpu/null_transport_surface.cc @@ -49,17 +49,15 @@ void NullTransportSurface::Destroy() { // Do not destroy |surface_| since we use the shared offscreen surface. } -gfx::SwapResult NullTransportSurface::SwapBuffers() { +bool NullTransportSurface::SwapBuffers() { NOTIMPLEMENTED(); - return gfx::SwapResult::SWAP_FAILED; + return false; } -gfx::SwapResult NullTransportSurface::PostSubBuffer(int x, - int y, - int width, - int height) { +bool NullTransportSurface::PostSubBuffer( + int x, int y, int width, int height) { NOTIMPLEMENTED(); - return gfx::SwapResult::SWAP_FAILED; + return false; } void NullTransportSurface::SendVSyncUpdateIfAvailable() { diff --git a/content/common/gpu/null_transport_surface.h b/content/common/gpu/null_transport_surface.h index 8b78d15..53f86fc 100644 --- a/content/common/gpu/null_transport_surface.h +++ b/content/common/gpu/null_transport_surface.h @@ -23,8 +23,8 @@ class NullTransportSurface : public PassThroughImageTransportSurface { // gfx::GLSurfaceAdapter implementation. bool Initialize() override; void Destroy() override; - gfx::SwapResult SwapBuffers() override; - gfx::SwapResult PostSubBuffer(int x, int y, int width, int height) override; + bool SwapBuffers() override; + bool PostSubBuffer(int x, int y, int width, int height) override; bool OnMakeCurrent(gfx::GLContext* context) override; protected: diff --git a/gpu/command_buffer/service/gl_surface_mock.h b/gpu/command_buffer/service/gl_surface_mock.h index 1d756d4..0652be6 100644 --- a/gpu/command_buffer/service/gl_surface_mock.h +++ b/gpu/command_buffer/service/gl_surface_mock.h @@ -5,9 +5,8 @@ #ifndef GPU_COMMAND_BUFFER_SERVICE_GL_SURFACE_MOCK_H_ #define GPU_COMMAND_BUFFER_SERVICE_GL_SURFACE_MOCK_H_ -#include "testing/gmock/include/gmock/gmock.h" -#include "ui/gfx/swap_result.h" #include "ui/gl/gl_surface.h" +#include "testing/gmock/include/gmock/gmock.h" namespace gpu { @@ -19,9 +18,8 @@ class GLSurfaceMock : public gfx::GLSurface { MOCK_METHOD0(Destroy, void()); MOCK_METHOD1(Resize, bool(const gfx::Size& size)); MOCK_METHOD0(IsOffscreen, bool()); - MOCK_METHOD0(SwapBuffers, gfx::SwapResult()); - MOCK_METHOD4(PostSubBuffer, - gfx::SwapResult(int x, int y, int width, int height)); + MOCK_METHOD0(SwapBuffers, bool()); + MOCK_METHOD4(PostSubBuffer, bool(int x, int y, int width, int height)); MOCK_METHOD0(SupportsPostSubBuffer, bool()); MOCK_METHOD0(GetSize, gfx::Size()); MOCK_METHOD0(GetHandle, void*()); diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc index 951bbd6..1e8e80f 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc @@ -8485,8 +8485,7 @@ error::Error GLES2DecoderImpl::HandlePostSubBufferCHROMIUM( gpu_state_tracer_->TakeSnapshotWithCurrentFramebuffer( is_offscreen ? offscreen_size_ : surface_->GetSize()); } - if (surface_->PostSubBuffer(c.x, c.y, c.width, c.height) != - gfx::SwapResult::SWAP_FAILED) { + if (surface_->PostSubBuffer(c.x, c.y, c.width, c.height)) { return error::kNoError; } else { LOG(ERROR) << "Context lost because PostSubBuffer failed."; @@ -11019,7 +11018,7 @@ void GLES2DecoderImpl::DoSwapBuffers() { glFlush(); } } else { - if (surface_->SwapBuffers() == gfx::SwapResult::SWAP_FAILED) { + if (!surface_->SwapBuffers()) { LOG(ERROR) << "Context lost because SwapBuffers failed."; if (!CheckResetStatus()) { MarkContextLost(error::kUnknown); diff --git a/ui/gfx/gfx.gyp b/ui/gfx/gfx.gyp index 5f315f9..5c72178 100644 --- a/ui/gfx/gfx.gyp +++ b/ui/gfx/gfx.gyp @@ -278,7 +278,6 @@ 'skbitmap_operations.h', 'skia_util.cc', 'skia_util.h', - 'swap_result.h', 'switches.cc', 'switches.h', 'sys_color_change_listener.cc', diff --git a/ui/gfx/swap_result.h b/ui/gfx/swap_result.h deleted file mode 100644 index 32a6c5a..0000000 --- a/ui/gfx/swap_result.h +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef UI_GFX_SWAP_RESULT_H_ -#define UI_GFX_SWAP_RESULT_H_ - -namespace gfx { - -enum class SwapResult { - SWAP_ACK, - SWAP_FAILED, - SWAP_NAK_RECREATE_BUFFERS, - SWAP_RESULT_LAST = SWAP_NAK_RECREATE_BUFFERS, -}; - -} // namespace gfx - -#endif // UI_GFX_SWAP_RESULT_H_ diff --git a/ui/gl/gl_surface.cc b/ui/gl/gl_surface.cc index 8a60ca5..4769092 100644 --- a/ui/gl/gl_surface.cc +++ b/ui/gl/gl_surface.cc @@ -12,7 +12,6 @@ #include "base/logging.h" #include "base/threading/thread_local.h" #include "base/trace_event/trace_event.h" -#include "ui/gfx/swap_result.h" #include "ui/gl/gl_context.h" #include "ui/gl/gl_implementation.h" #include "ui/gl/gl_switches.h" @@ -195,13 +194,13 @@ unsigned int GLSurface::GetBackingFrameBufferObject() { bool GLSurface::SwapBuffersAsync(const SwapCompletionCallback& callback) { DCHECK(!IsSurfaceless()); - gfx::SwapResult result = SwapBuffers(); - callback.Run(result); - return result == gfx::SwapResult::SWAP_ACK; + bool success = SwapBuffers(); + callback.Run(); + return success; } -gfx::SwapResult GLSurface::PostSubBuffer(int x, int y, int width, int height) { - return gfx::SwapResult::SWAP_FAILED; +bool GLSurface::PostSubBuffer(int x, int y, int width, int height) { + return false; } bool GLSurface::PostSubBufferAsync(int x, @@ -209,9 +208,9 @@ bool GLSurface::PostSubBufferAsync(int x, int width, int height, const SwapCompletionCallback& callback) { - gfx::SwapResult result = PostSubBuffer(x, y, width, height); - callback.Run(result); - return result == gfx::SwapResult::SWAP_ACK; + bool success = PostSubBuffer(x, y, width, height); + callback.Run(); + return success; } bool GLSurface::OnMakeCurrent(GLContext* context) { @@ -320,7 +319,7 @@ bool GLSurfaceAdapter::IsOffscreen() { return surface_->IsOffscreen(); } -gfx::SwapResult GLSurfaceAdapter::SwapBuffers() { +bool GLSurfaceAdapter::SwapBuffers() { return surface_->SwapBuffers(); } @@ -329,10 +328,7 @@ bool GLSurfaceAdapter::SwapBuffersAsync( return surface_->SwapBuffersAsync(callback); } -gfx::SwapResult GLSurfaceAdapter::PostSubBuffer(int x, - int y, - int width, - int height) { +bool GLSurfaceAdapter::PostSubBuffer(int x, int y, int width, int height) { return surface_->PostSubBuffer(x, y, width, height); } diff --git a/ui/gl/gl_surface.h b/ui/gl/gl_surface.h index 9fee0a3..b67ca69 100644 --- a/ui/gl/gl_surface.h +++ b/ui/gl/gl_surface.h @@ -15,7 +15,6 @@ #include "ui/gfx/geometry/size.h" #include "ui/gfx/native_widget_types.h" #include "ui/gfx/overlay_transform.h" -#include "ui/gfx/swap_result.h" #include "ui/gl/gl_export.h" #include "ui/gl/gl_implementation.h" @@ -59,7 +58,7 @@ class GL_EXPORT GLSurface : public base::RefCounted<GLSurface> { // Swaps front and back buffers. This has no effect for off-screen // contexts. - virtual gfx::SwapResult SwapBuffers() = 0; + virtual bool SwapBuffers() = 0; // Get the size of the surface. virtual gfx::Size GetSize() = 0; @@ -74,7 +73,7 @@ class GL_EXPORT GLSurface : public base::RefCounted<GLSurface> { // FBO. Otherwise returns 0. virtual unsigned int GetBackingFrameBufferObject(); - typedef base::Callback<void(SwapResult)> SwapCompletionCallback; + typedef base::Callback<void()> SwapCompletionCallback; // Swaps front and back buffers. This has no effect for off-screen // contexts. On some platforms, we want to send SwapBufferAck only after the // surface is displayed on screen. The callback can be used to delay sending @@ -83,7 +82,7 @@ class GL_EXPORT GLSurface : public base::RefCounted<GLSurface> { virtual bool SwapBuffersAsync(const SwapCompletionCallback& callback); // Copy part of the backbuffer to the frontbuffer. - virtual gfx::SwapResult PostSubBuffer(int x, int y, int width, int height); + virtual bool PostSubBuffer(int x, int y, int width, int height); // Copy part of the backbuffer to the frontbuffer. On some platforms, we want // to send SwapBufferAck only after the surface is displayed on screen. The @@ -205,9 +204,9 @@ class GL_EXPORT GLSurfaceAdapter : public GLSurface { bool Recreate() override; bool DeferDraws() override; bool IsOffscreen() override; - gfx::SwapResult SwapBuffers() override; + bool SwapBuffers() override; bool SwapBuffersAsync(const SwapCompletionCallback& callback) override; - gfx::SwapResult PostSubBuffer(int x, int y, int width, int height) override; + bool PostSubBuffer(int x, int y, int width, int height) override; bool PostSubBufferAsync(int x, int y, int width, diff --git a/ui/gl/gl_surface_egl.cc b/ui/gl/gl_surface_egl.cc index 4d64da7..b6cf38f 100644 --- a/ui/gl/gl_surface_egl.cc +++ b/ui/gl/gl_surface_egl.cc @@ -661,7 +661,7 @@ bool NativeViewGLSurfaceEGL::IsOffscreen() { return false; } -gfx::SwapResult NativeViewGLSurfaceEGL::SwapBuffers() { +bool NativeViewGLSurfaceEGL::SwapBuffers() { TRACE_EVENT2("gpu", "NativeViewGLSurfaceEGL:RealSwapBuffers", "width", GetSize().width(), "height", GetSize().height()); @@ -704,10 +704,10 @@ gfx::SwapResult NativeViewGLSurfaceEGL::SwapBuffers() { if (!eglSwapBuffers(GetDisplay(), surface_)) { DVLOG(1) << "eglSwapBuffers failed with error " << GetLastEGLErrorString(); - return gfx::SwapResult::SWAP_FAILED; + return false; } - return gfx::SwapResult::SWAP_ACK; + return true; } gfx::Size NativeViewGLSurfaceEGL::GetSize() { @@ -766,17 +766,15 @@ bool NativeViewGLSurfaceEGL::SupportsPostSubBuffer() { return supports_post_sub_buffer_; } -gfx::SwapResult NativeViewGLSurfaceEGL::PostSubBuffer(int x, - int y, - int width, - int height) { +bool NativeViewGLSurfaceEGL::PostSubBuffer( + int x, int y, int width, int height) { DCHECK(supports_post_sub_buffer_); if (!eglPostSubBufferNV(GetDisplay(), surface_, x, y, width, height)) { DVLOG(1) << "eglPostSubBufferNV failed with error " << GetLastEGLErrorString(); - return gfx::SwapResult::SWAP_FAILED; + return false; } - return gfx::SwapResult::SWAP_ACK; + return true; } VSyncProvider* NativeViewGLSurfaceEGL::GetVSyncProvider() { @@ -857,9 +855,9 @@ bool PbufferGLSurfaceEGL::IsOffscreen() { return true; } -gfx::SwapResult PbufferGLSurfaceEGL::SwapBuffers() { +bool PbufferGLSurfaceEGL::SwapBuffers() { NOTREACHED() << "Attempted to call SwapBuffers on a PbufferGLSurfaceEGL."; - return gfx::SwapResult::SWAP_FAILED; + return false; } gfx::Size PbufferGLSurfaceEGL::GetSize() { @@ -943,9 +941,9 @@ bool SurfacelessEGL::IsSurfaceless() const { return true; } -gfx::SwapResult SurfacelessEGL::SwapBuffers() { +bool SurfacelessEGL::SwapBuffers() { LOG(ERROR) << "Attempted to call SwapBuffers with SurfacelessEGL."; - return gfx::SwapResult::SWAP_FAILED; + return false; } gfx::Size SurfacelessEGL::GetSize() { diff --git a/ui/gl/gl_surface_egl.h b/ui/gl/gl_surface_egl.h index 07d0271..c643855 100644 --- a/ui/gl/gl_surface_egl.h +++ b/ui/gl/gl_surface_egl.h @@ -80,11 +80,11 @@ class GL_EXPORT NativeViewGLSurfaceEGL : public GLSurfaceEGL { bool Resize(const gfx::Size& size) override; bool Recreate() override; bool IsOffscreen() override; - gfx::SwapResult SwapBuffers() override; + bool SwapBuffers() override; gfx::Size GetSize() override; EGLSurface GetHandle() override; bool SupportsPostSubBuffer() override; - gfx::SwapResult PostSubBuffer(int x, int y, int width, int height) override; + bool PostSubBuffer(int x, int y, int width, int height) override; VSyncProvider* GetVSyncProvider() override; // Create a NativeViewGLSurfaceEGL with an externally provided VSyncProvider. @@ -130,7 +130,7 @@ class GL_EXPORT PbufferGLSurfaceEGL : public GLSurfaceEGL { bool Initialize() override; void Destroy() override; bool IsOffscreen() override; - gfx::SwapResult SwapBuffers() override; + bool SwapBuffers() override; gfx::Size GetSize() override; bool Resize(const gfx::Size& size) override; EGLSurface GetHandle() override; @@ -159,7 +159,7 @@ class GL_EXPORT SurfacelessEGL : public GLSurfaceEGL { void Destroy() override; bool IsOffscreen() override; bool IsSurfaceless() const override; - gfx::SwapResult SwapBuffers() override; + bool SwapBuffers() override; gfx::Size GetSize() override; bool Resize(const gfx::Size& size) override; EGLSurface GetHandle() override; diff --git a/ui/gl/gl_surface_glx.cc b/ui/gl/gl_surface_glx.cc index b021a42..0602dfa 100644 --- a/ui/gl/gl_surface_glx.cc +++ b/ui/gl/gl_surface_glx.cc @@ -540,13 +540,13 @@ bool NativeViewGLSurfaceGLX::IsOffscreen() { return false; } -gfx::SwapResult NativeViewGLSurfaceGLX::SwapBuffers() { +bool NativeViewGLSurfaceGLX::SwapBuffers() { TRACE_EVENT2("gpu", "NativeViewGLSurfaceGLX:RealSwapBuffers", "width", GetSize().width(), "height", GetSize().height()); glXSwapBuffers(g_display, GetDrawableHandle()); - return gfx::SwapResult::SWAP_ACK; + return true; } gfx::Size NativeViewGLSurfaceGLX::GetSize() { @@ -567,13 +567,11 @@ void* NativeViewGLSurfaceGLX::GetConfig() { return config_; } -gfx::SwapResult NativeViewGLSurfaceGLX::PostSubBuffer(int x, - int y, - int width, - int height) { +bool NativeViewGLSurfaceGLX::PostSubBuffer( + int x, int y, int width, int height) { DCHECK(gfx::g_driver_glx.ext.b_GLX_MESA_copy_sub_buffer); glXCopySubBufferMESA(g_display, GetDrawableHandle(), x, y, width, height); - return gfx::SwapResult::SWAP_ACK; + return true; } VSyncProvider* NativeViewGLSurfaceGLX::GetVSyncProvider() { @@ -619,9 +617,9 @@ bool UnmappedNativeViewGLSurfaceGLX::IsOffscreen() { return true; } -gfx::SwapResult UnmappedNativeViewGLSurfaceGLX::SwapBuffers() { +bool UnmappedNativeViewGLSurfaceGLX::SwapBuffers() { NOTREACHED() << "Attempted to call SwapBuffers on an unmapped window."; - return gfx::SwapResult::SWAP_FAILED; + return false; } gfx::Size UnmappedNativeViewGLSurfaceGLX::GetSize() { diff --git a/ui/gl/gl_surface_glx.h b/ui/gl/gl_surface_glx.h index 1db5e4c..46b044f 100644 --- a/ui/gl/gl_surface_glx.h +++ b/ui/gl/gl_surface_glx.h @@ -61,12 +61,12 @@ class GL_EXPORT NativeViewGLSurfaceGLX : public GLSurfaceGLX, void Destroy() override; bool Resize(const gfx::Size& size) override; bool IsOffscreen() override; - gfx::SwapResult SwapBuffers() override; + bool SwapBuffers() override; gfx::Size GetSize() override; void* GetHandle() override; bool SupportsPostSubBuffer() override; void* GetConfig() override; - gfx::SwapResult PostSubBuffer(int x, int y, int width, int height) override; + bool PostSubBuffer(int x, int y, int width, int height) override; VSyncProvider* GetVSyncProvider() override; protected: @@ -103,7 +103,7 @@ class GL_EXPORT UnmappedNativeViewGLSurfaceGLX : public GLSurfaceGLX { bool Initialize() override; void Destroy() override; bool IsOffscreen() override; - gfx::SwapResult SwapBuffers() override; + bool SwapBuffers() override; gfx::Size GetSize() override; void* GetHandle() override; void* GetConfig() override; diff --git a/ui/gl/gl_surface_mac.cc b/ui/gl/gl_surface_mac.cc index 0aea62f..85e9714 100644 --- a/ui/gl/gl_surface_mac.cc +++ b/ui/gl/gl_surface_mac.cc @@ -32,9 +32,9 @@ class GL_EXPORT NoOpGLSurface : public GLSurface { bool Initialize() override { return true; } void Destroy() override {} bool IsOffscreen() override { return true; } - gfx::SwapResult SwapBuffers() override { + bool SwapBuffers() override { NOTREACHED() << "Cannot call SwapBuffers on a NoOpGLSurface."; - return gfx::SwapResult::SWAP_FAILED; + return false; } gfx::Size GetSize() override { return size_; } void* GetHandle() override { return NULL; } diff --git a/ui/gl/gl_surface_osmesa.cc b/ui/gl/gl_surface_osmesa.cc index 00acc95..7f1b1ad 100644 --- a/ui/gl/gl_surface_osmesa.cc +++ b/ui/gl/gl_surface_osmesa.cc @@ -84,9 +84,9 @@ bool GLSurfaceOSMesa::IsOffscreen() { return true; } -gfx::SwapResult GLSurfaceOSMesa::SwapBuffers() { +bool GLSurfaceOSMesa::SwapBuffers() { NOTREACHED() << "Should not call SwapBuffers on an GLSurfaceOSMesa."; - return gfx::SwapResult::SWAP_FAILED; + return false; } gfx::Size GLSurfaceOSMesa::GetSize() { @@ -107,9 +107,7 @@ GLSurfaceOSMesa::~GLSurfaceOSMesa() { bool GLSurfaceOSMesaHeadless::IsOffscreen() { return false; } -gfx::SwapResult GLSurfaceOSMesaHeadless::SwapBuffers() { - return gfx::SwapResult::SWAP_ACK; -} +bool GLSurfaceOSMesaHeadless::SwapBuffers() { return true; } GLSurfaceOSMesaHeadless::GLSurfaceOSMesaHeadless() : GLSurfaceOSMesa(OSMesaSurfaceFormatBGRA, gfx::Size(1, 1)) { diff --git a/ui/gl/gl_surface_osmesa.h b/ui/gl/gl_surface_osmesa.h index 1aa90bd..cd65e65 100644 --- a/ui/gl/gl_surface_osmesa.h +++ b/ui/gl/gl_surface_osmesa.h @@ -25,7 +25,7 @@ class GL_EXPORT GLSurfaceOSMesa : public GLSurface { void Destroy() override; bool Resize(const gfx::Size& new_size) override; bool IsOffscreen() override; - gfx::SwapResult SwapBuffers() override; + bool SwapBuffers() override; gfx::Size GetSize() override; void* GetHandle() override; unsigned GetFormat() override; @@ -49,7 +49,7 @@ class GLSurfaceOSMesaHeadless : public GLSurfaceOSMesa { explicit GLSurfaceOSMesaHeadless(); bool IsOffscreen() override; - gfx::SwapResult SwapBuffers() override; + bool SwapBuffers() override; protected: ~GLSurfaceOSMesaHeadless() override; diff --git a/ui/gl/gl_surface_ozone.cc b/ui/gl/gl_surface_ozone.cc index 3b2e76a..064c5c6 100644 --- a/ui/gl/gl_surface_ozone.cc +++ b/ui/gl/gl_surface_ozone.cc @@ -44,7 +44,7 @@ class GL_EXPORT GLSurfaceOzoneEGL : public NativeViewGLSurfaceEGL { // GLSurface: bool Initialize() override; bool Resize(const gfx::Size& size) override; - gfx::SwapResult SwapBuffers() override; + bool SwapBuffers() override; bool ScheduleOverlayPlane(int z_order, OverlayTransform transform, GLImage* image, @@ -87,13 +87,11 @@ bool GLSurfaceOzoneEGL::Resize(const gfx::Size& size) { return NativeViewGLSurfaceEGL::Resize(size); } -gfx::SwapResult GLSurfaceOzoneEGL::SwapBuffers() { - gfx::SwapResult result = NativeViewGLSurfaceEGL::SwapBuffers(); - if (result != gfx::SwapResult::SWAP_ACK) - return result; +bool GLSurfaceOzoneEGL::SwapBuffers() { + if (!NativeViewGLSurfaceEGL::SwapBuffers()) + return false; - return ozone_surface_->OnSwapBuffers() ? gfx::SwapResult::SWAP_ACK - : gfx::SwapResult::SWAP_FAILED; + return ozone_surface_->OnSwapBuffers(); } bool GLSurfaceOzoneEGL::ScheduleOverlayPlane(int z_order, @@ -143,7 +141,7 @@ class GL_EXPORT GLSurfaceOzoneSurfaceless : public SurfacelessEGL { // GLSurface: bool Initialize() override; bool Resize(const gfx::Size& size) override; - gfx::SwapResult SwapBuffers() override; + bool SwapBuffers() override; bool ScheduleOverlayPlane(int z_order, OverlayTransform transform, GLImage* image, @@ -152,7 +150,7 @@ class GL_EXPORT GLSurfaceOzoneSurfaceless : public SurfacelessEGL { bool IsOffscreen() override; VSyncProvider* GetVSyncProvider() override; bool SupportsPostSubBuffer() override; - gfx::SwapResult PostSubBuffer(int x, int y, int width, int height) override; + bool PostSubBuffer(int x, int y, int width, int height) override; bool SwapBuffersAsync(const SwapCompletionCallback& callback) override; bool PostSubBufferAsync(int x, int y, @@ -194,8 +192,7 @@ class GL_EXPORT GLSurfaceOzoneSurfaceless : public SurfacelessEGL { EGLSyncKHR InsertFence(); void FenceRetired(EGLSyncKHR fence, PendingFrame* frame); - void SwapCompleted(const SwapCompletionCallback& callback, - gfx::SwapResult result); + void SwapCompleted(const SwapCompletionCallback& callback); // The native surface. Deleting this is allowed to free the EGLNativeWindow. scoped_ptr<ui::SurfaceOzoneEGL> ozone_surface_; @@ -268,14 +265,14 @@ bool GLSurfaceOzoneSurfaceless::Resize(const gfx::Size& size) { return SurfacelessEGL::Resize(size); } -gfx::SwapResult GLSurfaceOzoneSurfaceless::SwapBuffers() { +bool GLSurfaceOzoneSurfaceless::SwapBuffers() { glFlush(); // TODO: the following should be replaced by a per surface flush as it gets // implemented in GL drivers. if (has_implicit_external_sync_) { EGLSyncKHR fence = InsertFence(); if (!fence) - return SwapResult::SWAP_FAILED; + return false; EGLDisplay display = GetDisplay(); WaitForFence(display, fence); @@ -287,8 +284,7 @@ gfx::SwapResult GLSurfaceOzoneSurfaceless::SwapBuffers() { unsubmitted_frames_.back()->ScheduleOverlayPlanes(widget_); unsubmitted_frames_.back()->overlays.clear(); - return ozone_surface_->OnSwapBuffers() ? gfx::SwapResult::SWAP_ACK - : gfx::SwapResult::SWAP_FAILED; + return ozone_surface_->OnSwapBuffers(); } bool GLSurfaceOzoneSurfaceless::ScheduleOverlayPlane(int z_order, OverlayTransform transform, @@ -308,13 +304,13 @@ VSyncProvider* GLSurfaceOzoneSurfaceless::GetVSyncProvider() { bool GLSurfaceOzoneSurfaceless::SupportsPostSubBuffer() { return true; } -gfx::SwapResult GLSurfaceOzoneSurfaceless::PostSubBuffer(int x, - int y, - int width, - int height) { +bool GLSurfaceOzoneSurfaceless::PostSubBuffer(int x, + int y, + int width, + int height) { // The actual sub buffer handling is handled at higher layers. SwapBuffers(); - return gfx::SwapResult::SWAP_ACK; + return true; } bool GLSurfaceOzoneSurfaceless::SwapBuffersAsync( const SwapCompletionCallback& callback) { @@ -324,7 +320,7 @@ bool GLSurfaceOzoneSurfaceless::SwapBuffersAsync( glFlush(); - SwapCompletionCallback surface_swap_callback = + base::Closure surface_swap_callback = base::Bind(&GLSurfaceOzoneSurfaceless::SwapCompleted, weak_factory_.GetWeakPtr(), callback); @@ -399,9 +395,8 @@ void GLSurfaceOzoneSurfaceless::FenceRetired(EGLSyncKHR fence, } void GLSurfaceOzoneSurfaceless::SwapCompleted( - const SwapCompletionCallback& callback, - gfx::SwapResult result) { - callback.Run(result); + const SwapCompletionCallback& callback) { + callback.Run(); swap_buffers_pending_ = false; SubmitFrame(); @@ -421,7 +416,7 @@ class GL_EXPORT GLSurfaceOzoneSurfacelessSurfaceImpl bool OnMakeCurrent(GLContext* context) override; bool Resize(const gfx::Size& size) override; bool SupportsPostSubBuffer() override; - gfx::SwapResult SwapBuffers() override; + bool SwapBuffers() override; bool SwapBuffersAsync(const SwapCompletionCallback& callback) override; void Destroy() override; @@ -524,17 +519,16 @@ bool GLSurfaceOzoneSurfacelessSurfaceImpl::SupportsPostSubBuffer() { return false; } -gfx::SwapResult GLSurfaceOzoneSurfacelessSurfaceImpl::SwapBuffers() { +bool GLSurfaceOzoneSurfacelessSurfaceImpl::SwapBuffers() { if (!images_[current_surface_]->ScheduleOverlayPlane( widget_, 0, OverlayTransform::OVERLAY_TRANSFORM_NONE, gfx::Rect(GetSize()), gfx::RectF(1, 1))) - return gfx::SwapResult::SWAP_FAILED; - gfx::SwapResult result = GLSurfaceOzoneSurfaceless::SwapBuffers(); - if (result != gfx::SwapResult::SWAP_ACK) - return result; + return false; + if (!GLSurfaceOzoneSurfaceless::SwapBuffers()) + return false; current_surface_ ^= 1; BindFramebuffer(); - return gfx::SwapResult::SWAP_ACK; + return true; } bool GLSurfaceOzoneSurfacelessSurfaceImpl::SwapBuffersAsync( diff --git a/ui/gl/gl_surface_stub.cc b/ui/gl/gl_surface_stub.cc index c49165f..a27d2af 100644 --- a/ui/gl/gl_surface_stub.cc +++ b/ui/gl/gl_surface_stub.cc @@ -13,8 +13,8 @@ bool GLSurfaceStub::IsOffscreen() { return false; } -gfx::SwapResult GLSurfaceStub::SwapBuffers() { - return gfx::SwapResult::SWAP_ACK; +bool GLSurfaceStub::SwapBuffers() { + return true; } gfx::Size GLSurfaceStub::GetSize() { diff --git a/ui/gl/gl_surface_stub.h b/ui/gl/gl_surface_stub.h index bf21573..1bdd32a 100644 --- a/ui/gl/gl_surface_stub.h +++ b/ui/gl/gl_surface_stub.h @@ -17,7 +17,7 @@ class GL_EXPORT GLSurfaceStub : public GLSurface { // Implement GLSurface. void Destroy() override; bool IsOffscreen() override; - gfx::SwapResult SwapBuffers() override; + bool SwapBuffers() override; gfx::Size GetSize() override; void* GetHandle() override; diff --git a/ui/gl/gl_surface_wgl.cc b/ui/gl/gl_surface_wgl.cc index 82e34ec..698539f 100644 --- a/ui/gl/gl_surface_wgl.cc +++ b/ui/gl/gl_surface_wgl.cc @@ -250,7 +250,7 @@ bool NativeViewGLSurfaceWGL::IsOffscreen() { return false; } -gfx::SwapResult NativeViewGLSurfaceWGL::SwapBuffers() { +bool NativeViewGLSurfaceWGL::SwapBuffers() { TRACE_EVENT2("gpu", "NativeViewGLSurfaceWGL:RealSwapBuffers", "width", GetSize().width(), "height", GetSize().height()); @@ -259,19 +259,18 @@ gfx::SwapResult NativeViewGLSurfaceWGL::SwapBuffers() { // it as it moves. RECT rect; if (!GetClientRect(window_, &rect)) - return gfx::SwapResult::SWAP_FAILED; + return false; if (!MoveWindow(child_window_, 0, 0, rect.right - rect.left, rect.bottom - rect.top, FALSE)) { - return gfx::SwapResult::SWAP_FAILED; + return false; } DCHECK(device_context_); - return ::SwapBuffers(device_context_) == TRUE ? gfx::SwapResult::SWAP_ACK - : gfx::SwapResult::SWAP_FAILED; + return ::SwapBuffers(device_context_) == TRUE; } gfx::Size NativeViewGLSurfaceWGL::GetSize() { @@ -346,9 +345,9 @@ bool PbufferGLSurfaceWGL::IsOffscreen() { return true; } -gfx::SwapResult PbufferGLSurfaceWGL::SwapBuffers() { +bool PbufferGLSurfaceWGL::SwapBuffers() { NOTREACHED() << "Attempted to call SwapBuffers on a pbuffer."; - return gfx::SwapResult::SWAP_FAILED; + return false; } gfx::Size PbufferGLSurfaceWGL::GetSize() { diff --git a/ui/gl/gl_surface_wgl.h b/ui/gl/gl_surface_wgl.h index 934e9f3..e4548da 100644 --- a/ui/gl/gl_surface_wgl.h +++ b/ui/gl/gl_surface_wgl.h @@ -37,7 +37,7 @@ class NativeViewGLSurfaceWGL : public GLSurfaceWGL { bool Initialize() override; void Destroy() override; bool IsOffscreen() override; - gfx::SwapResult SwapBuffers() override; + bool SwapBuffers() override; gfx::Size GetSize() override; void* GetHandle() override; @@ -61,7 +61,7 @@ class PbufferGLSurfaceWGL : public GLSurfaceWGL { bool Initialize() override; void Destroy() override; bool IsOffscreen() override; - gfx::SwapResult SwapBuffers() override; + bool SwapBuffers() override; gfx::Size GetSize() override; void* GetHandle() override; diff --git a/ui/gl/gl_surface_win.cc b/ui/gl/gl_surface_win.cc index c416e6b..7f6dfd7 100644 --- a/ui/gl/gl_surface_win.cc +++ b/ui/gl/gl_surface_win.cc @@ -37,9 +37,9 @@ class NativeViewGLSurfaceOSMesa : public GLSurfaceOSMesa { bool Initialize() override; void Destroy() override; bool IsOffscreen() override; - gfx::SwapResult SwapBuffers() override; + bool SwapBuffers() override; bool SupportsPostSubBuffer() override; - gfx::SwapResult PostSubBuffer(int x, int y, int width, int height) override; + bool PostSubBuffer(int x, int y, int width, int height) override; private: ~NativeViewGLSurfaceOSMesa() override; @@ -208,7 +208,7 @@ bool NativeViewGLSurfaceOSMesa::IsOffscreen() { return false; } -gfx::SwapResult NativeViewGLSurfaceOSMesa::SwapBuffers() { +bool NativeViewGLSurfaceOSMesa::SwapBuffers() { DCHECK(device_context_); gfx::Size size = GetSize(); @@ -241,17 +241,15 @@ gfx::SwapResult NativeViewGLSurfaceOSMesa::SwapBuffers() { DIB_RGB_COLORS, SRCCOPY); - return gfx::SwapResult::SWAP_ACK; + return true; } bool NativeViewGLSurfaceOSMesa::SupportsPostSubBuffer() { return true; } -gfx::SwapResult NativeViewGLSurfaceOSMesa::PostSubBuffer(int x, - int y, - int width, - int height) { +bool NativeViewGLSurfaceOSMesa::PostSubBuffer( + int x, int y, int width, int height) { DCHECK(device_context_); gfx::Size size = GetSize(); @@ -284,7 +282,7 @@ gfx::SwapResult NativeViewGLSurfaceOSMesa::PostSubBuffer(int x, DIB_RGB_COLORS, SRCCOPY); - return gfx::SwapResult::SWAP_ACK; + return true; } scoped_refptr<GLSurface> GLSurface::CreateViewGLSurface( diff --git a/ui/gl/gl_surface_x11.cc b/ui/gl/gl_surface_x11.cc index 4e14a43..f7d6a41 100644 --- a/ui/gl/gl_surface_x11.cc +++ b/ui/gl/gl_surface_x11.cc @@ -32,9 +32,9 @@ class NativeViewGLSurfaceOSMesa : public GLSurfaceOSMesa { void Destroy() override; bool Resize(const gfx::Size& new_size) override; bool IsOffscreen() override; - gfx::SwapResult SwapBuffers() override; + bool SwapBuffers() override; bool SupportsPostSubBuffer() override; - gfx::SwapResult PostSubBuffer(int x, int y, int width, int height) override; + bool PostSubBuffer(int x, int y, int width, int height) override; protected: ~NativeViewGLSurfaceOSMesa() override; @@ -181,7 +181,7 @@ bool NativeViewGLSurfaceOSMesa::IsOffscreen() { return false; } -gfx::SwapResult NativeViewGLSurfaceOSMesa::SwapBuffers() { +bool NativeViewGLSurfaceOSMesa::SwapBuffers() { TRACE_EVENT2("gpu", "NativeViewGLSurfaceOSMesa:RealSwapBuffers", "width", GetSize().width(), "height", GetSize().height()); @@ -191,7 +191,7 @@ gfx::SwapResult NativeViewGLSurfaceOSMesa::SwapBuffers() { XWindowAttributes attributes; if (!XGetWindowAttributes(xdisplay_, window_, &attributes)) { LOG(ERROR) << "XGetWindowAttributes failed for window " << window_ << "."; - return gfx::SwapResult::SWAP_FAILED; + return false; } // Copy the frame into the pixmap. @@ -216,17 +216,15 @@ gfx::SwapResult NativeViewGLSurfaceOSMesa::SwapBuffers() { 0, 0); - return gfx::SwapResult::SWAP_ACK; + return true; } bool NativeViewGLSurfaceOSMesa::SupportsPostSubBuffer() { return true; } -gfx::SwapResult NativeViewGLSurfaceOSMesa::PostSubBuffer(int x, - int y, - int width, - int height) { +bool NativeViewGLSurfaceOSMesa::PostSubBuffer( + int x, int y, int width, int height) { gfx::Size size = GetSize(); // Move (0,0) from lower-left to upper-left @@ -235,7 +233,7 @@ gfx::SwapResult NativeViewGLSurfaceOSMesa::PostSubBuffer(int x, XWindowAttributes attributes; if (!XGetWindowAttributes(xdisplay_, window_, &attributes)) { LOG(ERROR) << "XGetWindowAttributes failed for window " << window_ << "."; - return gfx::SwapResult::SWAP_FAILED; + return false; } // Copy the frame into the pixmap. @@ -266,7 +264,7 @@ gfx::SwapResult NativeViewGLSurfaceOSMesa::PostSubBuffer(int x, x, y); - return gfx::SwapResult::SWAP_ACK; + return true; } NativeViewGLSurfaceOSMesa::~NativeViewGLSurfaceOSMesa() { diff --git a/ui/ozone/platform/cast/surface_ozone_egl_cast.cc b/ui/ozone/platform/cast/surface_ozone_egl_cast.cc index 56dee58..9170240 100644 --- a/ui/ozone/platform/cast/surface_ozone_egl_cast.cc +++ b/ui/ozone/platform/cast/surface_ozone_egl_cast.cc @@ -23,7 +23,7 @@ bool SurfaceOzoneEglCast::OnSwapBuffers() { bool SurfaceOzoneEglCast::OnSwapBuffersAsync( const SwapCompletionCallback& callback) { - callback.Run(gfx::SwapResult::SWAP_ACK); + callback.Run(); return true; } diff --git a/ui/ozone/platform/drm/gpu/crtc_controller.cc b/ui/ozone/platform/drm/gpu/crtc_controller.cc index cf82f68..6aa5795 100644 --- a/ui/ozone/platform/drm/gpu/crtc_controller.cc +++ b/ui/ozone/platform/drm/gpu/crtc_controller.cc @@ -76,7 +76,7 @@ bool CrtcController::SchedulePageFlip( const OverlayPlane* primary = OverlayPlane::GetPrimaryPlane(overlays); if (!primary) { LOG(ERROR) << "No primary plane to display on crtc " << crtc_; - page_flip_request->Signal(gfx::SwapResult::SWAP_ACK); + page_flip_request->Signal(); return true; } DCHECK(primary->buffer.get()); @@ -86,19 +86,19 @@ bool CrtcController::SchedulePageFlip( << mode_.hdisplay << "x" << mode_.vdisplay << " got " << primary->buffer->GetSize().ToString() << " for" << " crtc=" << crtc_ << " connector=" << connector_; - page_flip_request->Signal(gfx::SwapResult::SWAP_ACK); + page_flip_request->Signal(); return true; } if (!drm_->plane_manager()->AssignOverlayPlanes(plane_list, overlays, crtc_, this)) { PLOG(ERROR) << "Failed to assign overlay planes for crtc " << crtc_; - page_flip_request->Signal(gfx::SwapResult::SWAP_FAILED); + page_flip_request->Signal(); return false; } if (test_only) { - page_flip_request->Signal(gfx::SwapResult::SWAP_ACK); + page_flip_request->Signal(); } else { pending_planes_ = overlays; page_flip_request_ = page_flip_request; @@ -164,7 +164,7 @@ void CrtcController::SignalPageFlipRequest() { // locally to avoid deleting the object we are making a call on. scoped_refptr<PageFlipRequest> last_request; last_request.swap(page_flip_request_); - last_request->Signal(gfx::SwapResult::SWAP_ACK); + last_request->Signal(); } } diff --git a/ui/ozone/platform/drm/gpu/drm_surface.cc b/ui/ozone/platform/drm/gpu/drm_surface.cc index 6528dbf..ccf0ce7 100644 --- a/ui/ozone/platform/drm/gpu/drm_surface.cc +++ b/ui/ozone/platform/drm/gpu/drm_surface.cc @@ -20,8 +20,6 @@ namespace ui { namespace { -void EmptyPageFlipCallback(gfx::SwapResult result) { -} scoped_refptr<DrmBuffer> AllocateBuffer(const scoped_refptr<DrmDevice>& drm, const gfx::Size& size) { @@ -73,7 +71,7 @@ void DrmSurface::PresentCanvas(const gfx::Rect& damage) { UpdateNativeSurface(damage); window_delegate_->SchedulePageFlip(true /* is_sync */, - base::Bind(&EmptyPageFlipCallback)); + base::Bind(&base::DoNothing)); // Update our front buffer pointer. front_buffer_ ^= 1; diff --git a/ui/ozone/platform/drm/gpu/drm_window.cc b/ui/ozone/platform/drm/gpu/drm_window.cc index b2f7a46..2e5b26e 100644 --- a/ui/ozone/platform/drm/gpu/drm_window.cc +++ b/ui/ozone/platform/drm/gpu/drm_window.cc @@ -124,8 +124,7 @@ void DrmWindow::QueueOverlayPlane(const OverlayPlane& plane) { pending_planes_.push_back(plane); } -bool DrmWindow::SchedulePageFlip(bool is_sync, - const SwapCompletionCallback& callback) { +bool DrmWindow::SchedulePageFlip(bool is_sync, const base::Closure& callback) { last_submitted_planes_.clear(); last_submitted_planes_.swap(pending_planes_); last_swap_sync_ = is_sync; @@ -135,7 +134,7 @@ bool DrmWindow::SchedulePageFlip(bool is_sync, callback); } - callback.Run(gfx::SwapResult::SWAP_ACK); + callback.Run(); return true; } diff --git a/ui/ozone/platform/drm/gpu/drm_window.h b/ui/ozone/platform/drm/gpu/drm_window.h index 1164f17..74e1e53 100644 --- a/ui/ozone/platform/drm/gpu/drm_window.h +++ b/ui/ozone/platform/drm/gpu/drm_window.h @@ -11,11 +11,8 @@ #include "ui/gfx/geometry/point.h" #include "ui/gfx/geometry/rect.h" #include "ui/gfx/native_widget_types.h" -#include "ui/gfx/swap_result.h" #include "ui/ozone/ozone_export.h" #include "ui/ozone/platform/drm/gpu/overlay_plane.h" -#include "ui/ozone/platform/drm/gpu/page_flip_request.h" -#include "ui/ozone/public/surface_ozone_egl.h" class SkBitmap; @@ -82,8 +79,7 @@ class OZONE_EXPORT DrmWindow { // immediately, otherwise queue up on the window and forward when the hardware // is once again ready. void QueueOverlayPlane(const OverlayPlane& plane); - - bool SchedulePageFlip(bool is_sync, const SwapCompletionCallback& callback); + bool SchedulePageFlip(bool is_sync, const base::Closure& callback); // Returns the last buffer associated with this window. const OverlayPlane* GetLastModesetBuffer(); diff --git a/ui/ozone/platform/drm/gpu/gbm_surface.cc b/ui/ozone/platform/drm/gpu/gbm_surface.cc index 08a32f4..8b5b167 100644 --- a/ui/ozone/platform/drm/gpu/gbm_surface.cc +++ b/ui/ozone/platform/drm/gpu/gbm_surface.cc @@ -19,9 +19,6 @@ namespace ui { namespace { -void DoNothing(gfx::SwapResult) { -} - class GbmSurfaceBuffer : public GbmBufferBase { public: static scoped_refptr<GbmSurfaceBuffer> CreateBuffer( @@ -134,7 +131,7 @@ bool GbmSurface::ResizeNativeWindow(const gfx::Size& viewport_size) { } bool GbmSurface::OnSwapBuffers() { - return OnSwapBuffersAsync(base::Bind(&DoNothing)); + return OnSwapBuffersAsync(base::Bind(&base::DoNothing)); } bool GbmSurface::OnSwapBuffersAsync(const SwapCompletionCallback& callback) { @@ -147,7 +144,7 @@ bool GbmSurface::OnSwapBuffersAsync(const SwapCompletionCallback& callback) { primary = GbmSurfaceBuffer::CreateBuffer(gbm_, pending_buffer); if (!primary.get()) { LOG(ERROR) << "Failed to associate the buffer with the controller"; - callback.Run(gfx::SwapResult::SWAP_FAILED); + callback.Run(); return false; } } @@ -158,7 +155,7 @@ bool GbmSurface::OnSwapBuffersAsync(const SwapCompletionCallback& callback) { if (!GbmSurfaceless::OnSwapBuffersAsync( base::Bind(&GbmSurface::OnSwapBuffersCallback, weak_factory_.GetWeakPtr(), callback, pending_buffer))) { - callback.Run(gfx::SwapResult::SWAP_FAILED); + callback.Run(); return false; } @@ -166,14 +163,13 @@ bool GbmSurface::OnSwapBuffersAsync(const SwapCompletionCallback& callback) { } void GbmSurface::OnSwapBuffersCallback(const SwapCompletionCallback& callback, - gbm_bo* pending_buffer, - gfx::SwapResult result) { + gbm_bo* pending_buffer) { // If there was a frontbuffer, it is no longer active. Release it back to GBM. if (current_buffer_) gbm_surface_release_buffer(native_surface_, current_buffer_); current_buffer_ = pending_buffer; - callback.Run(result); + callback.Run(); } } // namespace ui diff --git a/ui/ozone/platform/drm/gpu/gbm_surface.h b/ui/ozone/platform/drm/gpu/gbm_surface.h index 45757ec..65ec8c7 100644 --- a/ui/ozone/platform/drm/gpu/gbm_surface.h +++ b/ui/ozone/platform/drm/gpu/gbm_surface.h @@ -39,8 +39,7 @@ class GbmSurface : public GbmSurfaceless { private: void OnSwapBuffersCallback(const SwapCompletionCallback& callback, - gbm_bo* pending_buffer, - gfx::SwapResult result); + gbm_bo* pending_buffer); scoped_refptr<GbmDevice> gbm_; diff --git a/ui/ozone/platform/drm/gpu/gbm_surfaceless.cc b/ui/ozone/platform/drm/gpu/gbm_surfaceless.cc index 244b8ab..c906cfd 100644 --- a/ui/ozone/platform/drm/gpu/gbm_surfaceless.cc +++ b/ui/ozone/platform/drm/gpu/gbm_surfaceless.cc @@ -14,10 +14,6 @@ #include "ui/ozone/platform/drm/gpu/hardware_display_controller.h" namespace ui { -namespace { -void EmptyPageFlipCallback(gfx::SwapResult result) { -} -} // namespace GbmSurfaceless::GbmSurfaceless(DrmWindow* window_delegate, DrmDeviceManager* drm_device_manager) @@ -39,7 +35,7 @@ bool GbmSurfaceless::ResizeNativeWindow(const gfx::Size& viewport_size) { bool GbmSurfaceless::OnSwapBuffers() { return window_delegate_->SchedulePageFlip(true /* is_sync */, - base::Bind(&EmptyPageFlipCallback)); + base::Bind(&base::DoNothing)); } bool GbmSurfaceless::OnSwapBuffersAsync( diff --git a/ui/ozone/platform/drm/gpu/hardware_display_controller.cc b/ui/ozone/platform/drm/gpu/hardware_display_controller.cc index 07cd837..3fbfe7f 100644 --- a/ui/ozone/platform/drm/gpu/hardware_display_controller.cc +++ b/ui/ozone/platform/drm/gpu/hardware_display_controller.cc @@ -14,7 +14,6 @@ #include "third_party/skia/include/core/SkCanvas.h" #include "ui/gfx/geometry/point.h" #include "ui/gfx/geometry/size.h" -#include "ui/gfx/swap_result.h" #include "ui/ozone/platform/drm/gpu/crtc_controller.h" #include "ui/ozone/platform/drm/gpu/drm_buffer.h" #include "ui/ozone/platform/drm/gpu/drm_device.h" @@ -64,14 +63,14 @@ bool HardwareDisplayController::SchedulePageFlip( const OverlayPlaneList& plane_list, bool is_sync, bool test_only, - const PageFlipCallback& callback) { + const base::Closure& callback) { TRACE_EVENT0("drm", "HDC::SchedulePageFlip"); DCHECK(!is_disabled_); // Ignore requests with no planes to schedule. if (plane_list.empty()) { - callback.Run(gfx::SwapResult::SWAP_ACK); + callback.Run(); return true; } diff --git a/ui/ozone/platform/drm/gpu/hardware_display_controller.h b/ui/ozone/platform/drm/gpu/hardware_display_controller.h index 3772c35..b09d547 100644 --- a/ui/ozone/platform/drm/gpu/hardware_display_controller.h +++ b/ui/ozone/platform/drm/gpu/hardware_display_controller.h @@ -17,7 +17,6 @@ #include "base/containers/scoped_ptr_hash_map.h" #include "base/memory/scoped_ptr.h" #include "base/memory/scoped_vector.h" -#include "ui/gfx/swap_result.h" #include "ui/ozone/ozone_export.h" #include "ui/ozone/platform/drm/gpu/hardware_display_plane_manager.h" #include "ui/ozone/platform/drm/gpu/overlay_plane.h" @@ -87,8 +86,6 @@ class DrmDevice; // framebuffers. Though, in this case, it would be possible to have all // connectors active if some use the same CRTC to mirror the display. class OZONE_EXPORT HardwareDisplayController { - typedef base::Callback<void(gfx::SwapResult)> PageFlipCallback; - public: HardwareDisplayController(scoped_ptr<CrtcController> controller, const gfx::Point& origin); @@ -126,7 +123,7 @@ class OZONE_EXPORT HardwareDisplayController { bool SchedulePageFlip(const OverlayPlaneList& plane_list, bool is_sync, bool test_only, - const PageFlipCallback& callback); + const base::Closure& callback); // Set the hardware cursor to show the contents of |surface|. bool SetCursor(const scoped_refptr<ScanoutBuffer>& buffer); diff --git a/ui/ozone/platform/drm/gpu/hardware_display_controller_unittest.cc b/ui/ozone/platform/drm/gpu/hardware_display_controller_unittest.cc index da99c07..0ff9473 100644 --- a/ui/ozone/platform/drm/gpu/hardware_display_controller_unittest.cc +++ b/ui/ozone/platform/drm/gpu/hardware_display_controller_unittest.cc @@ -54,7 +54,7 @@ class HardwareDisplayControllerTest : public testing::Test { void SetUp() override; void TearDown() override; - void PageFlipCallback(gfx::SwapResult); + void PageFlipCallback(); protected: scoped_ptr<ui::HardwareDisplayController> controller_; @@ -82,7 +82,7 @@ void HardwareDisplayControllerTest::TearDown() { drm_ = nullptr; } -void HardwareDisplayControllerTest::PageFlipCallback(gfx::SwapResult) { +void HardwareDisplayControllerTest::PageFlipCallback() { page_flips_++; } diff --git a/ui/ozone/platform/drm/gpu/page_flip_request.cc b/ui/ozone/platform/drm/gpu/page_flip_request.cc index 4d1b60d..dfca208 100644 --- a/ui/ozone/platform/drm/gpu/page_flip_request.cc +++ b/ui/ozone/platform/drm/gpu/page_flip_request.cc @@ -4,28 +4,19 @@ #include "ui/ozone/platform/drm/gpu/page_flip_request.h" +#include "base/barrier_closure.h" + namespace ui { -PageFlipRequest::PageFlipRequest(int crtc_count, - const SwapCompletionCallback& callback) - : callback_(callback), - crtc_count_(crtc_count), - result_(gfx::SwapResult::SWAP_ACK) { +PageFlipRequest::PageFlipRequest(int crtc_count, const base::Closure& callback) + : callback_(base::BarrierClosure(crtc_count, callback)) { } PageFlipRequest::~PageFlipRequest() { } -void PageFlipRequest::Signal(gfx::SwapResult result) { - if (result == gfx::SwapResult::SWAP_FAILED) - result_ = gfx::SwapResult::SWAP_FAILED; - else if (result != gfx::SwapResult::SWAP_ACK) - result_ = result; - - if (!--crtc_count_) { - callback_.Run(result_); - callback_.Reset(); - } +void PageFlipRequest::Signal() { + callback_.Run(); } } // namespace ui diff --git a/ui/ozone/platform/drm/gpu/page_flip_request.h b/ui/ozone/platform/drm/gpu/page_flip_request.h index 6daa8a3..c1a63b2 100644 --- a/ui/ozone/platform/drm/gpu/page_flip_request.h +++ b/ui/ozone/platform/drm/gpu/page_flip_request.h @@ -5,27 +5,22 @@ #ifndef UI_OZONE_PLATFORM_DRM_GPU_PAGE_FLIP_REQUEST_H_ #define UI_OZONE_PLATFORM_DRM_GPU_PAGE_FLIP_REQUEST_H_ -#include "base/atomic_ref_count.h" #include "base/callback.h" #include "base/memory/scoped_ptr.h" -#include "ui/gfx/swap_result.h" -#include "ui/ozone/public/surface_ozone_egl.h" namespace ui { class PageFlipRequest : public base::RefCounted<PageFlipRequest> { public: - PageFlipRequest(int crtc_count, const SwapCompletionCallback& callback); + PageFlipRequest(int crtc_count, const base::Closure& callback); - void Signal(gfx::SwapResult result); + void Signal(); private: friend class base::RefCounted<PageFlipRequest>; ~PageFlipRequest(); - SwapCompletionCallback callback_; - int crtc_count_; - gfx::SwapResult result_; + base::Closure callback_; DISALLOW_COPY_AND_ASSIGN(PageFlipRequest); }; diff --git a/ui/ozone/platform/drm/gpu/screen_manager_unittest.cc b/ui/ozone/platform/drm/gpu/screen_manager_unittest.cc index f8b59a6..bd8671b 100644 --- a/ui/ozone/platform/drm/gpu/screen_manager_unittest.cc +++ b/ui/ozone/platform/drm/gpu/screen_manager_unittest.cc @@ -14,9 +14,6 @@ namespace { -void EmptySwapCallback(gfx::SwapResult) { -} - // Create a basic mode for a 6x4 screen. const drmModeModeInfo kDefaultMode = {0, 6, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, {'\0'}}; @@ -462,7 +459,7 @@ TEST_F(ScreenManagerTest, EnableControllerWhenWindowHasBuffer) { scoped_refptr<ui::ScanoutBuffer> buffer = buffer_generator_->Create(drm_, GetPrimaryBounds().size()); window->QueueOverlayPlane(ui::OverlayPlane(buffer)); - window->SchedulePageFlip(false /* is_sync */, base::Bind(&EmptySwapCallback)); + window->SchedulePageFlip(false /* is_sync */, base::Bind(&base::DoNothing)); screen_manager_->AddWindow(1, window.Pass()); screen_manager_->AddDisplayController(drm_, kPrimaryCrtc, kPrimaryConnector); diff --git a/ui/ozone/platform/egltest/ozone_platform_egltest.cc b/ui/ozone/platform/egltest/ozone_platform_egltest.cc index 31f35a6..73ff47b 100644 --- a/ui/ozone/platform/egltest/ozone_platform_egltest.cc +++ b/ui/ozone/platform/egltest/ozone_platform_egltest.cc @@ -216,7 +216,7 @@ class SurfaceOzoneEgltest : public SurfaceOzoneEGL { bool OnSwapBuffers() override { return true; } bool OnSwapBuffersAsync(const SwapCompletionCallback& callback) override { - callback.Run(gfx::SwapResult::SWAP_ACK); + callback.Run(); return true; } diff --git a/ui/ozone/public/surface_ozone_egl.h b/ui/ozone/public/surface_ozone_egl.h index 3056dec..1714dd9 100644 --- a/ui/ozone/public/surface_ozone_egl.h +++ b/ui/ozone/public/surface_ozone_egl.h @@ -9,7 +9,6 @@ #include "base/callback.h" #include "base/memory/scoped_ptr.h" #include "ui/gfx/overlay_transform.h" -#include "ui/gfx/swap_result.h" #include "ui/ozone/ozone_base_export.h" namespace gfx { @@ -20,8 +19,6 @@ class VSyncProvider; namespace ui { class NativePixmap; -typedef base::Callback<void(gfx::SwapResult)> SwapCompletionCallback; - // The platform-specific part of an EGL surface. // // This class owns any bits that the ozone implementation needs freed when @@ -42,6 +39,7 @@ class OZONE_BASE_EXPORT SurfaceOzoneEGL { // be used to present the new front buffer if the platform requires this. virtual bool OnSwapBuffers() = 0; + typedef base::Closure SwapCompletionCallback; // Called after we swap buffers. This is usually a no-op but can // be used to present the new front buffer if the platform requires this. // The callback should be run on the calling thread |