Try to use direct rendering.
svn path=/branches/work/kwin_composite/; revision=605288
This commit is contained in:
parent
9d25cf5166
commit
a35cf8e954
2 changed files with 27 additions and 5 deletions
|
@ -188,11 +188,7 @@ SceneOpenGL::SceneOpenGL( Workspace* ws )
|
|||
glXGetFBConfigAttrib( display(), fbcdrawable, GLX_VISUAL_ID, &vis_drawable );
|
||||
kDebug() << "Buffer visual: 0x" << QString::number( vis_buffer, 16 ) << ", drawable visual: 0x"
|
||||
<< QString::number( vis_drawable, 16 ) << endl;
|
||||
ctxbuffer = glXCreateNewContext( display(), fbcbuffer, GLX_RGBA_TYPE, NULL, GL_FALSE );
|
||||
if( !tfp_mode && !shm_mode )
|
||||
ctxdrawable = glXCreateNewContext( display(), fbcdrawable, GLX_RGBA_TYPE, ctxbuffer, GL_FALSE );
|
||||
if( !glXMakeContextCurrent( display(), glxbuffer, glxbuffer, ctxbuffer ) )
|
||||
assert( false );
|
||||
initRenderingContext();
|
||||
|
||||
// Initialize OpenGL
|
||||
initGL();
|
||||
|
@ -293,6 +289,31 @@ void SceneOpenGL::cleanupShm()
|
|||
#endif
|
||||
}
|
||||
|
||||
void SceneOpenGL::initRenderingContext()
|
||||
{
|
||||
bool direct_rendering = true;
|
||||
KXErrorHandler errs;
|
||||
ctxbuffer = glXCreateNewContext( display(), fbcbuffer, GLX_RGBA_TYPE, NULL,
|
||||
direct_rendering ? GL_TRUE : GL_FALSE );
|
||||
if( ctxbuffer == NULL || !glXMakeContextCurrent( display(), glxbuffer, glxbuffer, ctxbuffer )
|
||||
|| errs.error( true ))
|
||||
{ // failed
|
||||
if( !direct_rendering )
|
||||
assert( false );
|
||||
glXDestroyContext( display(), ctxbuffer );
|
||||
direct_rendering = false; // try again
|
||||
ctxbuffer = glXCreateNewContext( display(), fbcbuffer, GLX_RGBA_TYPE, NULL, GL_FALSE );
|
||||
if( ctxbuffer == NULL || !glXMakeContextCurrent( display(), glxbuffer, glxbuffer, ctxbuffer ))
|
||||
assert( false );
|
||||
}
|
||||
if( !tfp_mode && !shm_mode )
|
||||
{
|
||||
ctxdrawable = glXCreateNewContext( display(), fbcdrawable, GLX_RGBA_TYPE, ctxbuffer,
|
||||
direct_rendering ? GL_TRUE : GL_FALSE );
|
||||
}
|
||||
kDebug() << "Direct rendering:" << direct_rendering << endl;
|
||||
}
|
||||
|
||||
// create destination buffer
|
||||
void SceneOpenGL::initBuffer()
|
||||
{
|
||||
|
|
|
@ -41,6 +41,7 @@ class SceneOpenGL
|
|||
bool initShm();
|
||||
void cleanupShm();
|
||||
void initBuffer();
|
||||
void initRenderingContext();
|
||||
bool findConfig( const int* attrs, GLXFBConfig* config, VisualID visual = None );
|
||||
typedef GLuint Texture;
|
||||
GC gcroot;
|
||||
|
|
Loading…
Reference in a new issue