From c794eda78e9ba3c46b550b433e9fe5a248d40104 Mon Sep 17 00:00:00 2001 From: achaulk Date: Thu, 28 May 2015 18:36:21 -0700 Subject: 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 Review URL: https://codereview.chromium.org/1084173004 Cr-Commit-Position: refs/heads/master@{#331906} --- ui/gl/gl_surface_x11.cc | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'ui/gl/gl_surface_x11.cc') diff --git a/ui/gl/gl_surface_x11.cc b/ui/gl/gl_surface_x11.cc index f7d6a41..4e14a43 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; - bool SwapBuffers() override; + gfx::SwapResult SwapBuffers() override; bool SupportsPostSubBuffer() override; - bool PostSubBuffer(int x, int y, int width, int height) override; + gfx::SwapResult PostSubBuffer(int x, int y, int width, int height) override; protected: ~NativeViewGLSurfaceOSMesa() override; @@ -181,7 +181,7 @@ bool NativeViewGLSurfaceOSMesa::IsOffscreen() { return false; } -bool NativeViewGLSurfaceOSMesa::SwapBuffers() { +gfx::SwapResult NativeViewGLSurfaceOSMesa::SwapBuffers() { TRACE_EVENT2("gpu", "NativeViewGLSurfaceOSMesa:RealSwapBuffers", "width", GetSize().width(), "height", GetSize().height()); @@ -191,7 +191,7 @@ bool NativeViewGLSurfaceOSMesa::SwapBuffers() { XWindowAttributes attributes; if (!XGetWindowAttributes(xdisplay_, window_, &attributes)) { LOG(ERROR) << "XGetWindowAttributes failed for window " << window_ << "."; - return false; + return gfx::SwapResult::SWAP_FAILED; } // Copy the frame into the pixmap. @@ -216,15 +216,17 @@ bool NativeViewGLSurfaceOSMesa::SwapBuffers() { 0, 0); - return true; + return gfx::SwapResult::SWAP_ACK; } bool NativeViewGLSurfaceOSMesa::SupportsPostSubBuffer() { return true; } -bool NativeViewGLSurfaceOSMesa::PostSubBuffer( - int x, int y, int width, int height) { +gfx::SwapResult NativeViewGLSurfaceOSMesa::PostSubBuffer(int x, + int y, + int width, + int height) { gfx::Size size = GetSize(); // Move (0,0) from lower-left to upper-left @@ -233,7 +235,7 @@ bool NativeViewGLSurfaceOSMesa::PostSubBuffer( XWindowAttributes attributes; if (!XGetWindowAttributes(xdisplay_, window_, &attributes)) { LOG(ERROR) << "XGetWindowAttributes failed for window " << window_ << "."; - return false; + return gfx::SwapResult::SWAP_FAILED; } // Copy the frame into the pixmap. @@ -264,7 +266,7 @@ bool NativeViewGLSurfaceOSMesa::PostSubBuffer( x, y); - return true; + return gfx::SwapResult::SWAP_ACK; } NativeViewGLSurfaceOSMesa::~NativeViewGLSurfaceOSMesa() { -- cgit v1.1