summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cc/BUILD.gn1
-rw-r--r--cc/cc.gyp1
-rw-r--r--content/common/gpu/image_transport_surface_mac.mm3
-rw-r--r--ui/gl/DEPS10
-rw-r--r--ui/gl/gl.gyp1
-rw-r--r--ui/gl/gl_context_glx.cc1
-rw-r--r--ui/gl/gl_context_mac.mm1
-rw-r--r--ui/gl/gl_surface_android.cc3
-rw-r--r--ui/gl/gl_surface_egl.cc5
-rw-r--r--ui/gl/gl_surface_glx.cc1
-rw-r--r--ui/gl/gl_surface_mac.cc5
-rw-r--r--ui/gl/gl_surface_osmesa.cc17
-rw-r--r--ui/gl/gl_surface_osmesa.h4
-rw-r--r--ui/gl/gl_surface_win.cc11
-rw-r--r--ui/gl/gl_surface_x11.cc7
15 files changed, 39 insertions, 32 deletions
diff --git a/cc/BUILD.gn b/cc/BUILD.gn
index ddabbdd..c2f1cf4 100644
--- a/cc/BUILD.gn
+++ b/cc/BUILD.gn
@@ -474,7 +474,6 @@ component("cc") {
"//ui/events:events_base",
"//ui/gfx",
"//ui/gfx/geometry",
- "//ui/gl",
]
forward_dependent_configs_from = [
"//skia",
diff --git a/cc/cc.gyp b/cc/cc.gyp
index eac03d7..f63d58a 100644
--- a/cc/cc.gyp
+++ b/cc/cc.gyp
@@ -20,7 +20,6 @@
'<(DEPTH)/ui/events/events.gyp:events_base',
'<(DEPTH)/ui/gfx/gfx.gyp:gfx',
'<(DEPTH)/ui/gfx/gfx.gyp:gfx_geometry',
- '<(DEPTH)/ui/gl/gl.gyp:gl',
],
'variables': {
'optimize': 'max',
diff --git a/content/common/gpu/image_transport_surface_mac.mm b/content/common/gpu/image_transport_surface_mac.mm
index c193f6f..3a48063 100644
--- a/content/common/gpu/image_transport_surface_mac.mm
+++ b/content/common/gpu/image_transport_surface_mac.mm
@@ -18,7 +18,8 @@ namespace {
class DRTSurfaceOSMesa : public gfx::GLSurfaceOSMesa {
public:
// Size doesn't matter, the surface is resized to the right size later.
- DRTSurfaceOSMesa() : GLSurfaceOSMesa(GL_RGBA, gfx::Size(1, 1)) {}
+ DRTSurfaceOSMesa()
+ : GLSurfaceOSMesa(gfx::OSMesaSurfaceFormatRGBA, gfx::Size(1, 1)) {}
// Implement a subset of GLSurface.
virtual bool SwapBuffers() OVERRIDE;
diff --git a/ui/gl/DEPS b/ui/gl/DEPS
index 263169b..862c555 100644
--- a/ui/gl/DEPS
+++ b/ui/gl/DEPS
@@ -1,8 +1,16 @@
include_rules = [
"+third_party/khronos",
- "+third_party/mesa/src/include",
"+third_party/skia",
"+ui/events",
"+ui/gfx",
"+ui/ozone/public",
]
+
+specific_include_rules = {
+# This is the only target that should use the osmesa.h header. Everything else
+# should use the GLES2 headers from third_party/khronos/ or use gl_bindings.h to
+# get access to desktop OpenGL.
+ "gl_surface_osmesa.cc": [
+ "+third_party/mesa/src/include/GL/osmesa.h",
+ ]
+}
diff --git a/ui/gl/gl.gyp b/ui/gl/gl.gyp
index 229b21f..49c12f2 100644
--- a/ui/gl/gl.gyp
+++ b/ui/gl/gl.gyp
@@ -30,7 +30,6 @@
'include_dirs': [
'<(DEPTH)/third_party/swiftshader/include',
'<(DEPTH)/third_party/khronos',
- '<(DEPTH)/third_party/mesa/src/include',
'<(gl_binding_output_dir)',
],
'direct_dependent_settings': {
diff --git a/ui/gl/gl_context_glx.cc b/ui/gl/gl_context_glx.cc
index d5ab073..9b6cfb4 100644
--- a/ui/gl/gl_context_glx.cc
+++ b/ui/gl/gl_context_glx.cc
@@ -11,7 +11,6 @@ extern "C" {
#include "base/debug/trace_event.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
-#include "third_party/mesa/src/include/GL/osmesa.h"
#include "ui/gl/GL/glextchromium.h"
#include "ui/gl/gl_bindings.h"
#include "ui/gl/gl_implementation.h"
diff --git a/ui/gl/gl_context_mac.mm b/ui/gl/gl_context_mac.mm
index 4b9c8dd..8cd58b1 100644
--- a/ui/gl/gl_context_mac.mm
+++ b/ui/gl/gl_context_mac.mm
@@ -6,7 +6,6 @@
#include "base/debug/trace_event.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
-#include "third_party/mesa/src/include/GL/osmesa.h"
#include "ui/gl/gl_context_cgl.h"
#include "ui/gl/gl_context_osmesa.h"
#include "ui/gl/gl_context_stub.h"
diff --git a/ui/gl/gl_surface_android.cc b/ui/gl/gl_surface_android.cc
index 1304b38..1254da2 100644
--- a/ui/gl/gl_surface_android.cc
+++ b/ui/gl/gl_surface_android.cc
@@ -58,7 +58,8 @@ scoped_refptr<GLSurface> GLSurface::CreateOffscreenGLSurface(
CHECK_NE(kGLImplementationNone, GetGLImplementation());
switch (GetGLImplementation()) {
case kGLImplementationOSMesaGL: {
- scoped_refptr<GLSurface> surface(new GLSurfaceOSMesa(1, size));
+ scoped_refptr<GLSurface> surface(
+ new GLSurfaceOSMesa(OSMesaSurfaceFormatBGRA, size));
if (!surface->Initialize())
return NULL;
diff --git a/ui/gl/gl_surface_egl.cc b/ui/gl/gl_surface_egl.cc
index e73ba4e..5a0538e 100644
--- a/ui/gl/gl_surface_egl.cc
+++ b/ui/gl/gl_surface_egl.cc
@@ -2,10 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// This include must be here so that the includes provided transitively
-// by gl_surface_egl.h don't make it impossible to compile this code.
-#include "third_party/mesa/src/include/GL/osmesa.h"
-
#include "ui/gl/gl_surface_egl.h"
#if defined(OS_ANDROID)
@@ -21,7 +17,6 @@
#include "ui/gl/egl_util.h"
#include "ui/gl/gl_context.h"
#include "ui/gl/gl_implementation.h"
-#include "ui/gl/gl_surface_osmesa.h"
#include "ui/gl/gl_surface_stub.h"
#include "ui/gl/gl_switches.h"
#include "ui/gl/scoped_make_current.h"
diff --git a/ui/gl/gl_surface_glx.cc b/ui/gl/gl_surface_glx.cc
index 58f97f5..05ab13b 100644
--- a/ui/gl/gl_surface_glx.cc
+++ b/ui/gl/gl_surface_glx.cc
@@ -20,7 +20,6 @@ extern "C" {
#include "base/threading/non_thread_safe.h"
#include "base/threading/thread.h"
#include "base/time/time.h"
-#include "third_party/mesa/src/include/GL/osmesa.h"
#include "ui/events/platform/platform_event_source.h"
#include "ui/gfx/x/x11_connection.h"
#include "ui/gfx/x/x11_types.h"
diff --git a/ui/gl/gl_surface_mac.cc b/ui/gl/gl_surface_mac.cc
index dd5fa0e..1852beb 100644
--- a/ui/gl/gl_surface_mac.cc
+++ b/ui/gl/gl_surface_mac.cc
@@ -11,7 +11,6 @@
#include "base/logging.h"
#include "base/mac/mac_util.h"
#include "base/memory/scoped_ptr.h"
-#include "third_party/mesa/src/include/GL/osmesa.h"
#include "ui/gl/gl_bindings.h"
#include "ui/gl/gl_context.h"
#include "ui/gl/gl_implementation.h"
@@ -130,8 +129,8 @@ scoped_refptr<GLSurface> GLSurface::CreateOffscreenGLSurface(
TRACE_EVENT0("gpu", "GLSurface::CreateOffscreenGLSurface");
switch (GetGLImplementation()) {
case kGLImplementationOSMesaGL: {
- scoped_refptr<GLSurface> surface(new GLSurfaceOSMesa(OSMESA_RGBA,
- size));
+ scoped_refptr<GLSurface> surface(
+ new GLSurfaceOSMesa(OSMesaSurfaceFormatRGBA, size));
if (!surface->Initialize())
return NULL;
diff --git a/ui/gl/gl_surface_osmesa.cc b/ui/gl/gl_surface_osmesa.cc
index 58d955b..4c49166 100644
--- a/ui/gl/gl_surface_osmesa.cc
+++ b/ui/gl/gl_surface_osmesa.cc
@@ -11,9 +11,17 @@
namespace gfx {
-GLSurfaceOSMesa::GLSurfaceOSMesa(unsigned format, const gfx::Size& size)
- : format_(format),
- size_(size) {
+GLSurfaceOSMesa::GLSurfaceOSMesa(OSMesaSurfaceFormat format,
+ const gfx::Size& size)
+ : size_(size) {
+ switch (format) {
+ case OSMesaSurfaceFormatBGRA:
+ format_ = OSMESA_BGRA;
+ break;
+ case OSMesaSurfaceFormatRGBA:
+ format_ = OSMESA_RGBA;
+ break;
+ }
// Implementations of OSMesa surface do not support having a 0 size. In such
// cases use a (1, 1) surface.
if (size_.GetArea() == 0)
@@ -92,7 +100,8 @@ bool GLSurfaceOSMesaHeadless::IsOffscreen() { return false; }
bool GLSurfaceOSMesaHeadless::SwapBuffers() { return true; }
GLSurfaceOSMesaHeadless::GLSurfaceOSMesaHeadless()
- : GLSurfaceOSMesa(OSMESA_BGRA, gfx::Size(1, 1)) {}
+ : GLSurfaceOSMesa(OSMesaSurfaceFormatBGRA, gfx::Size(1, 1)) {
+}
GLSurfaceOSMesaHeadless::~GLSurfaceOSMesaHeadless() { Destroy(); }
diff --git a/ui/gl/gl_surface_osmesa.h b/ui/gl/gl_surface_osmesa.h
index b4b4827..472d7b1 100644
--- a/ui/gl/gl_surface_osmesa.h
+++ b/ui/gl/gl_surface_osmesa.h
@@ -11,12 +11,14 @@
namespace gfx {
+enum OSMesaSurfaceFormat { OSMesaSurfaceFormatBGRA, OSMesaSurfaceFormatRGBA };
+
// A surface that the Mesa software renderer draws to. This is actually just a
// buffer in system memory. GetHandle returns a pointer to the buffer. These
// surfaces can be resized and resizing preserves the contents.
class GL_EXPORT GLSurfaceOSMesa : public GLSurface {
public:
- GLSurfaceOSMesa(unsigned format, const gfx::Size& size);
+ GLSurfaceOSMesa(OSMesaSurfaceFormat format, const gfx::Size& size);
// Implement GLSurface.
virtual bool Initialize() OVERRIDE;
diff --git a/ui/gl/gl_surface_win.cc b/ui/gl/gl_surface_win.cc
index c0a223b..0001103 100644
--- a/ui/gl/gl_surface_win.cc
+++ b/ui/gl/gl_surface_win.cc
@@ -11,7 +11,6 @@
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "base/win/windows_version.h"
-#include "third_party/mesa/src/include/GL/osmesa.h"
#include "ui/gfx/frame_time.h"
#include "ui/gfx/native_widget_types.h"
#include "ui/gl/gl_bindings.h"
@@ -112,9 +111,9 @@ bool GLSurface::InitializeOneOffInternal() {
NativeViewGLSurfaceOSMesa::NativeViewGLSurfaceOSMesa(
gfx::AcceleratedWidget window)
- : GLSurfaceOSMesa(OSMESA_RGBA, gfx::Size(1, 1)),
- window_(window),
- device_context_(NULL) {
+ : GLSurfaceOSMesa(OSMesaSurfaceFormatRGBA, gfx::Size(1, 1)),
+ window_(window),
+ device_context_(NULL) {
DCHECK(window);
}
@@ -265,8 +264,8 @@ scoped_refptr<GLSurface> GLSurface::CreateOffscreenGLSurface(
TRACE_EVENT0("gpu", "GLSurface::CreateOffscreenGLSurface");
switch (GetGLImplementation()) {
case kGLImplementationOSMesaGL: {
- scoped_refptr<GLSurface> surface(new GLSurfaceOSMesa(OSMESA_RGBA,
- size));
+ scoped_refptr<GLSurface> surface(
+ new GLSurfaceOSMesa(OSMesaSurfaceFormatRGBA, size));
if (!surface->Initialize())
return NULL;
diff --git a/ui/gl/gl_surface_x11.cc b/ui/gl/gl_surface_x11.cc
index a5d5aab..bc9f1e6 100644
--- a/ui/gl/gl_surface_x11.cc
+++ b/ui/gl/gl_surface_x11.cc
@@ -8,7 +8,6 @@
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
-#include "third_party/mesa/src/include/GL/osmesa.h"
#include "ui/gfx/native_widget_types.h"
#include "ui/gfx/x/x11_types.h"
#include "ui/gl/gl_bindings.h"
@@ -79,7 +78,7 @@ bool GLSurface::InitializeOneOffInternal() {
NativeViewGLSurfaceOSMesa::NativeViewGLSurfaceOSMesa(
gfx::AcceleratedWidget window)
- : GLSurfaceOSMesa(OSMESA_BGRA, gfx::Size(1, 1)),
+ : GLSurfaceOSMesa(OSMesaSurfaceFormatBGRA, gfx::Size(1, 1)),
xdisplay_(gfx::GetXDisplay()),
window_graphics_context_(0),
window_(window),
@@ -312,8 +311,8 @@ scoped_refptr<GLSurface> GLSurface::CreateOffscreenGLSurface(
TRACE_EVENT0("gpu", "GLSurface::CreateOffscreenGLSurface");
switch (GetGLImplementation()) {
case kGLImplementationOSMesaGL: {
- scoped_refptr<GLSurface> surface(new GLSurfaceOSMesa(OSMESA_RGBA,
- size));
+ scoped_refptr<GLSurface> surface(
+ new GLSurfaceOSMesa(OSMesaSurfaceFormatRGBA, size));
if (!surface->Initialize())
return NULL;