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

Unified Diff: ui/gfx/gl/gl_context_glx.cc

Issue 8060045: Use shared D3D9 texture to transport the compositor's backing buffer to the browser... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 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: ui/gfx/gl/gl_context_glx.cc
===================================================================
--- ui/gfx/gl/gl_context_glx.cc (revision 106500)
+++ ui/gfx/gl/gl_context_glx.cc (working copy)
@@ -46,7 +46,8 @@
GLContextGLX::GLContextGLX(GLShareGroup* share_group)
: GLContext(share_group),
- context_(NULL) {
+ context_(NULL),
+ display_(NULL) {
}
GLContextGLX::~GLContextGLX() {
@@ -55,7 +56,7 @@
bool GLContextGLX::Initialize(
GLSurface* compatible_surface, GpuPreference gpu_preference) {
- GLSurfaceGLX* surface_glx = static_cast<GLSurfaceGLX*>(compatible_surface);
+ display_ = static_cast<Display*>(compatible_surface->GetDisplay());
GLXContext share_handle = static_cast<GLXContext>(
share_group() ? share_group()->GetHandle() : NULL);
@@ -68,14 +69,15 @@
attribs.push_back(GLX_LOSE_CONTEXT_ON_RESET_ARB);
attribs.push_back(0);
context_ = glXCreateContextAttribsARB(
- GLSurfaceGLX::GetDisplay(),
- static_cast<GLXFBConfig>(surface_glx->GetConfig()),
+ display_,
+ static_cast<GLXFBConfig>(compatible_surface->GetConfig()),
share_handle,
True,
&attribs.front());
if (context_) {
DLOG(INFO) << " Successfully allocated "
- << (surface_glx->IsOffscreen() ? "offscreen" : "onscreen")
+ << (compatible_surface->IsOffscreen() ?
+ "offscreen" : "onscreen")
<< " GL context with LOSE_CONTEXT_ON_RESET_ARB";
} else {
// TODO(kbr): it is not expected that things will work properly
@@ -93,24 +95,23 @@
// The means by which the context is created depends on whether
// the drawable type works reliably with GLX 1.3. If it does not
// then fall back to GLX 1.2.
- if (surface_glx->IsOffscreen()) {
+ if (compatible_surface->IsOffscreen()) {
context_ = glXCreateNewContext(
- GLSurfaceGLX::GetDisplay(),
- static_cast<GLXFBConfig>(surface_glx->GetConfig()),
+ display_,
+ static_cast<GLXFBConfig>(compatible_surface->GetConfig()),
GLX_RGBA_TYPE,
share_handle,
True);
} else {
- Display* display = GLSurfaceGLX::GetDisplay();
-
// Get the visuals for the X drawable.
XWindowAttributes attributes;
if (!XGetWindowAttributes(
- display,
- reinterpret_cast<GLXDrawable>(surface_glx->GetHandle()),
+ display_,
+ reinterpret_cast<GLXDrawable>(compatible_surface->GetHandle()),
&attributes)) {
LOG(ERROR) << "XGetWindowAttributes failed for window " <<
- reinterpret_cast<GLXDrawable>(surface_glx->GetHandle()) << ".";
+ reinterpret_cast<GLXDrawable>(
+ compatible_surface->GetHandle()) << ".";
return false;
}
@@ -119,7 +120,7 @@
int visual_info_count = 0;
scoped_ptr_malloc<XVisualInfo, ScopedPtrXFree> visual_info_list(
- XGetVisualInfo(display, VisualIDMask,
+ XGetVisualInfo(display_, VisualIDMask,
&visual_info_template,
&visual_info_count));
@@ -131,7 +132,7 @@
// Attempt to create a context with each visual in turn until one works.
context_ = glXCreateContext(
- display,
+ display_,
visual_info_list.get(),
share_handle,
True);
@@ -144,9 +145,9 @@
return false;
}
- DLOG(INFO) << (surface_glx->IsOffscreen() ? "Offscreen" : "Onscreen")
+ DLOG(INFO) << (compatible_surface->IsOffscreen() ? "Offscreen" : "Onscreen")
<< " context was "
- << (glXIsDirect(GLSurfaceGLX::GetDisplay(),
+ << (glXIsDirect(display_,
static_cast<GLXContext>(context_))
? "direct" : "indirect")
<< ".";
@@ -156,7 +157,7 @@
void GLContextGLX::Destroy() {
if (context_) {
- glXDestroyContext(GLSurfaceGLX::GetDisplay(),
+ glXDestroyContext(display_,
static_cast<GLXContext>(context_));
context_ = NULL;
}
@@ -168,7 +169,7 @@
return true;
if (!glXMakeCurrent(
- GLSurfaceGLX::GetDisplay(),
+ display_,
reinterpret_cast<GLXDrawable>(surface->GetHandle()),
static_cast<GLXContext>(context_))) {
LOG(ERROR) << "Couldn't make context current with X drawable.";
@@ -190,7 +191,7 @@
return;
SetCurrent(NULL, NULL);
- glXMakeContextCurrent(GLSurfaceGLX::GetDisplay(), 0, 0, NULL);
+ glXMakeContextCurrent(display_, 0, 0, NULL);
}
bool GLContextGLX::IsCurrent(GLSurface* surface) {
@@ -227,13 +228,13 @@
// respect this setting anyway (tearing still occurs) and it
// dramatically increases latency.
if (interval == 1 &&
- IsCompositingWindowManagerActive(GLSurfaceGLX::GetDisplay())) {
+ IsCompositingWindowManagerActive(display_)) {
LOG(INFO) <<
"Forcing vsync off because compositing window manager was detected.";
interval = 0;
}
glXSwapIntervalEXT(
- GLSurfaceGLX::GetDisplay(),
+ display_,
glXGetCurrentDrawable(),
interval);
} else {
« gpu/DEPS ('K') | « ui/gfx/gl/gl_context_glx.h ('k') | ui/gfx/gl/gl_context_osmesa.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698