summaryrefslogtreecommitdiffstats
path: root/app/gfx
diff options
context:
space:
mode:
authorapatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-10 18:02:02 +0000
committerapatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-10 18:02:02 +0000
commit5259ead872da61f51c2e528755c140b5661553cb (patch)
tree595121dd45f7ebbcd04fa79e2c888a8fa9d82e7c /app/gfx
parent6049ef9eb7322b0051b8358b48f5a665ef022331 (diff)
downloadchromium_src-5259ead872da61f51c2e528755c140b5661553cb.zip
chromium_src-5259ead872da61f51c2e528755c140b5661553cb.tar.gz
chromium_src-5259ead872da61f51c2e528755c140b5661553cb.tar.bz2
GPU process reports context lost when SwapBuffers fails.
This is to give the renderer or plugin process an opportunity to recover. TEST=try BUG=none Review URL: http://codereview.chromium.org/3305028 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@59115 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'app/gfx')
-rw-r--r--app/gfx/gl/gl_context.h2
-rw-r--r--app/gfx/gl/gl_context_egl.cc7
-rw-r--r--app/gfx/gl/gl_context_egl.h4
-rw-r--r--app/gfx/gl/gl_context_linux.cc23
-rw-r--r--app/gfx/gl/gl_context_mac.cc5
-rw-r--r--app/gfx/gl/gl_context_osmesa.cc3
-rw-r--r--app/gfx/gl/gl_context_osmesa.h2
-rw-r--r--app/gfx/gl/gl_context_stub.h2
-rw-r--r--app/gfx/gl/gl_context_win.cc29
9 files changed, 43 insertions, 34 deletions
diff --git a/app/gfx/gl/gl_context.h b/app/gfx/gl/gl_context.h
index 1282b59..3c1dfe0 100644
--- a/app/gfx/gl/gl_context.h
+++ b/app/gfx/gl/gl_context.h
@@ -32,7 +32,7 @@ class GLContext {
// Swaps front and back buffers. This has no effect for off-screen
// contexts.
- virtual void SwapBuffers() = 0;
+ virtual bool SwapBuffers() = 0;
// Get the size of the back buffer.
virtual gfx::Size GetSize() = 0;
diff --git a/app/gfx/gl/gl_context_egl.cc b/app/gfx/gl/gl_context_egl.cc
index 1156635..47131c7 100644
--- a/app/gfx/gl/gl_context_egl.cc
+++ b/app/gfx/gl/gl_context_egl.cc
@@ -160,8 +160,8 @@ bool NativeViewEGLContext::IsOffscreen() {
return false;
}
-void NativeViewEGLContext::SwapBuffers() {
- eglSwapBuffers(g_display, surface_);
+bool NativeViewEGLContext::SwapBuffers() {
+ return eglSwapBuffers(g_display, surface_) == EGL_TRUE;
}
gfx::Size NativeViewEGLContext::GetSize() {
@@ -277,8 +277,9 @@ bool SecondaryEGLContext::IsOffscreen() {
return true;
}
-void SecondaryEGLContext::SwapBuffers() {
+bool SecondaryEGLContext::SwapBuffers() {
NOTREACHED() << "Attempted to call SwapBuffers on a SecondaryEGLContext.";
+ return false;
}
gfx::Size SecondaryEGLContext::GetSize() {
diff --git a/app/gfx/gl/gl_context_egl.h b/app/gfx/gl/gl_context_egl.h
index 9c59825..76e34d6 100644
--- a/app/gfx/gl/gl_context_egl.h
+++ b/app/gfx/gl/gl_context_egl.h
@@ -47,7 +47,7 @@ class NativeViewEGLContext : public BaseEGLContext {
virtual bool MakeCurrent();
virtual bool IsCurrent();
virtual bool IsOffscreen();
- virtual void SwapBuffers();
+ virtual bool SwapBuffers();
virtual gfx::Size GetSize();
virtual void* GetHandle();
@@ -79,7 +79,7 @@ class SecondaryEGLContext : public BaseEGLContext {
virtual bool MakeCurrent();
virtual bool IsCurrent();
virtual bool IsOffscreen();
- virtual void SwapBuffers();
+ virtual bool SwapBuffers();
virtual gfx::Size GetSize();
virtual void* GetHandle();
diff --git a/app/gfx/gl/gl_context_linux.cc b/app/gfx/gl/gl_context_linux.cc
index 9e0f4d2..b99f2d5 100644
--- a/app/gfx/gl/gl_context_linux.cc
+++ b/app/gfx/gl/gl_context_linux.cc
@@ -40,7 +40,7 @@ class ViewGLContext : public GLContext {
virtual bool MakeCurrent();
virtual bool IsCurrent();
virtual bool IsOffscreen();
- virtual void SwapBuffers();
+ virtual bool SwapBuffers();
virtual gfx::Size GetSize();
virtual void* GetHandle();
@@ -70,7 +70,7 @@ class OSMesaViewGLContext : public GLContext {
virtual bool MakeCurrent();
virtual bool IsCurrent();
virtual bool IsOffscreen();
- virtual void SwapBuffers();
+ virtual bool SwapBuffers();
virtual gfx::Size GetSize();
virtual void* GetHandle();
@@ -103,7 +103,7 @@ class PbufferGLContext : public GLContext {
virtual bool MakeCurrent();
virtual bool IsCurrent();
virtual bool IsOffscreen();
- virtual void SwapBuffers();
+ virtual bool SwapBuffers();
virtual gfx::Size GetSize();
virtual void* GetHandle();
@@ -130,7 +130,7 @@ class PixmapGLContext : public GLContext {
virtual bool MakeCurrent();
virtual bool IsCurrent();
virtual bool IsOffscreen();
- virtual void SwapBuffers();
+ virtual bool SwapBuffers();
virtual gfx::Size GetSize();
virtual void* GetHandle();
@@ -269,9 +269,10 @@ bool ViewGLContext::IsOffscreen() {
return false;
}
-void ViewGLContext::SwapBuffers() {
+bool ViewGLContext::SwapBuffers() {
Display* display = x11_util::GetXDisplay();
glXSwapBuffers(display, window_);
+ return true;
}
gfx::Size ViewGLContext::GetSize() {
@@ -343,11 +344,11 @@ bool OSMesaViewGLContext::IsOffscreen() {
return false;
}
-void OSMesaViewGLContext::SwapBuffers() {
+bool OSMesaViewGLContext::SwapBuffers() {
// Update the size before blitting so that the blit size is exactly the same
// as the window.
if (!UpdateSize())
- return;
+ return false;
gfx::Size size = osmesa_context_.GetSize();
@@ -373,6 +374,8 @@ void OSMesaViewGLContext::SwapBuffers() {
0, 0,
size.width(), size.height(),
0, 0);
+
+ return true;
}
gfx::Size OSMesaViewGLContext::GetSize() {
@@ -575,8 +578,9 @@ bool PbufferGLContext::IsOffscreen() {
return true;
}
-void PbufferGLContext::SwapBuffers() {
+bool PbufferGLContext::SwapBuffers() {
NOTREACHED() << "Attempted to call SwapBuffers on a pbuffer.";
+ return false;
}
gfx::Size PbufferGLContext::GetSize() {
@@ -691,8 +695,9 @@ bool PixmapGLContext::IsOffscreen() {
return true;
}
-void PixmapGLContext::SwapBuffers() {
+bool PixmapGLContext::SwapBuffers() {
NOTREACHED() << "Attempted to call SwapBuffers on a pixmap.";
+ return false;
}
gfx::Size PixmapGLContext::GetSize() {
diff --git a/app/gfx/gl/gl_context_mac.cc b/app/gfx/gl/gl_context_mac.cc
index 16a22eb..29b73be 100644
--- a/app/gfx/gl/gl_context_mac.cc
+++ b/app/gfx/gl/gl_context_mac.cc
@@ -39,7 +39,7 @@ class PbufferGLContext : public GLContext {
virtual bool MakeCurrent();
virtual bool IsCurrent();
virtual bool IsOffscreen();
- virtual void SwapBuffers();
+ virtual bool SwapBuffers();
virtual gfx::Size GetSize();
virtual void* GetHandle();
@@ -158,8 +158,9 @@ bool PbufferGLContext::IsOffscreen() {
return true;
}
-void PbufferGLContext::SwapBuffers() {
+bool PbufferGLContext::SwapBuffers() {
NOTREACHED() << "Cannot call SwapBuffers on a PbufferGLContext.";
+ return false;
}
gfx::Size PbufferGLContext::GetSize() {
diff --git a/app/gfx/gl/gl_context_osmesa.cc b/app/gfx/gl/gl_context_osmesa.cc
index 28eb170..9b73195 100644
--- a/app/gfx/gl/gl_context_osmesa.cc
+++ b/app/gfx/gl/gl_context_osmesa.cc
@@ -80,8 +80,9 @@ bool OSMesaGLContext::IsOffscreen() {
return true;
}
-void OSMesaGLContext::SwapBuffers() {
+bool OSMesaGLContext::SwapBuffers() {
NOTREACHED() << "Should not call SwapBuffers on an OSMesaGLContext.";
+ return false;
}
gfx::Size OSMesaGLContext::GetSize() {
diff --git a/app/gfx/gl/gl_context_osmesa.h b/app/gfx/gl/gl_context_osmesa.h
index 89c927b..caa0895 100644
--- a/app/gfx/gl/gl_context_osmesa.h
+++ b/app/gfx/gl/gl_context_osmesa.h
@@ -28,7 +28,7 @@ class OSMesaGLContext : public GLContext {
virtual bool MakeCurrent();
virtual bool IsCurrent();
virtual bool IsOffscreen();
- virtual void SwapBuffers();
+ virtual bool SwapBuffers();
virtual gfx::Size GetSize();
virtual void* GetHandle();
diff --git a/app/gfx/gl/gl_context_stub.h b/app/gfx/gl/gl_context_stub.h
index b5189ae..034a04d 100644
--- a/app/gfx/gl/gl_context_stub.h
+++ b/app/gfx/gl/gl_context_stub.h
@@ -20,7 +20,7 @@ class StubGLContext : public gfx::GLContext {
virtual bool MakeCurrent() { return true; }
virtual bool IsCurrent() { return true; }
virtual bool IsOffscreen() { return false; }
- virtual void SwapBuffers() {}
+ virtual bool SwapBuffers() { return true; }
virtual gfx::Size GetSize() { return size_; }
virtual void* GetHandle() { return NULL; }
virtual bool HasExtension(const char* name) { return false; }
diff --git a/app/gfx/gl/gl_context_win.cc b/app/gfx/gl/gl_context_win.cc
index f7954b6a1..b625343 100644
--- a/app/gfx/gl/gl_context_win.cc
+++ b/app/gfx/gl/gl_context_win.cc
@@ -42,7 +42,7 @@ class NativeViewGLContext : public GLContext {
virtual bool MakeCurrent();
virtual bool IsCurrent();
virtual bool IsOffscreen();
- virtual void SwapBuffers();
+ virtual bool SwapBuffers();
virtual gfx::Size GetSize();
virtual void* GetHandle();
@@ -71,7 +71,7 @@ class OSMesaViewGLContext : public GLContext {
virtual bool MakeCurrent();
virtual bool IsCurrent();
virtual bool IsOffscreen();
- virtual void SwapBuffers();
+ virtual bool SwapBuffers();
virtual gfx::Size GetSize();
virtual void* GetHandle();
@@ -103,7 +103,7 @@ class PbufferGLContext : public GLContext {
virtual bool MakeCurrent();
virtual bool IsCurrent();
virtual bool IsOffscreen();
- virtual void SwapBuffers();
+ virtual bool SwapBuffers();
virtual gfx::Size GetSize();
virtual void* GetHandle();
@@ -372,9 +372,9 @@ bool NativeViewGLContext::IsOffscreen() {
return false;
}
-void NativeViewGLContext::SwapBuffers() {
+bool NativeViewGLContext::SwapBuffers() {
DCHECK(device_context_);
- ::SwapBuffers(device_context_);
+ return ::SwapBuffers(device_context_) == TRUE;
}
gfx::Size NativeViewGLContext::GetSize() {
@@ -427,7 +427,7 @@ bool OSMesaViewGLContext::IsOffscreen() {
return false;
}
-void OSMesaViewGLContext::SwapBuffers() {
+bool OSMesaViewGLContext::SwapBuffers() {
DCHECK(device_context_);
// Update the size before blitting so that the blit size is exactly the same
@@ -450,13 +450,13 @@ void OSMesaViewGLContext::SwapBuffers() {
info.bV4AlphaMask = 0x000000FF;
// Copy the back buffer to the window's device context.
- StretchDIBits(device_context_,
- 0, 0, size.width(), size.height(),
- 0, 0, size.width(), size.height(),
- osmesa_context_.buffer(),
- reinterpret_cast<BITMAPINFO*>(&info),
- DIB_RGB_COLORS,
- SRCCOPY);
+ return StretchDIBits(device_context_,
+ 0, 0, size.width(), size.height(),
+ 0, 0, size.width(), size.height(),
+ osmesa_context_.buffer(),
+ reinterpret_cast<BITMAPINFO*>(&info),
+ DIB_RGB_COLORS,
+ SRCCOPY) != 0;
}
gfx::Size OSMesaViewGLContext::GetSize() {
@@ -603,8 +603,9 @@ bool PbufferGLContext::IsOffscreen() {
return true;
}
-void PbufferGLContext::SwapBuffers() {
+bool PbufferGLContext::SwapBuffers() {
NOTREACHED() << "Attempted to call SwapBuffers on a pbuffer.";
+ return false;
}
gfx::Size PbufferGLContext::GetSize() {