<html>
<head>
<base href="https://bugs.freedesktop.org/">
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_NEW "
title="NEW - RADEON(0): flip queue failed in radeon_scanout_flip: Cannot allocate memory"
href="https://bugs.freedesktop.org/show_bug.cgi?id=99769#c3">Comment # 3</a>
on <a class="bz_bug_link
bz_status_NEW "
title="NEW - RADEON(0): flip queue failed in radeon_scanout_flip: Cannot allocate memory"
href="https://bugs.freedesktop.org/show_bug.cgi?id=99769">bug 99769</a>
from <span class="vcard"><a class="email" href="mailto:jorge_monteagudo@hotmail.com" title="jorge_monteagudo@hotmail.com">jorge_monteagudo@hotmail.com</a>
</span></b>
<pre>I've track down the problem to some code handling OpenGL contexts in my
application.
In catalyst and nvidia the code works OK but with the radeon/amdgpu driver
makes the screen paint with artifacts and the 'Cannot allocate memory' trace in
Xorg log.
I'm using Qt5 and SDL libraries. The problematic code is:
static GLXContext defaultContext = NULL;
static GLXContext qtContext = NULL;
static QGLPixelBuffer* pixelBuffer = NULL;
...
pixelBuffer = new QGLPixelBuffer (QSize (1,1), QGLFormat::defaultFormat ());
pixelBuffer->makeCurrent();
qtContext = glXGetCurrentContext();
// create default context
defaultContext = CreateOGLContext (qtContext);
// activate it, hiding context created by SDL
ActivateOGLContext (defaultContext);
Then all the OpenGL objects are created in this 'defaultContext' and something
makes not happy the OpenGL stack. Removing the QGLPixelBuffer and using the
default OpenGL context created by SDL makes the trick but I can't use the Qt5
with his own context.
Well, I'll try to isolate a minimum example to replicate this problem, but for
now I can run my app.
Thanks!
The rest of code:
GLXContext CreateOGLContext(GLXContext share)
{
GLXContext ctx = NULL;
// Set error handler
int32_t (*oldHandler)(Display*, XErrorEvent*) = XSetErrorHandler(
&XErrorHandler );
// Flush errors
XSync( m_sdl_info.info.x11.display, False );
// Get window attributes
XWindowAttributes xWindowAttribs;
XGetWindowAttributes( m_sdl_info.info.x11.display,
m_sdl_info.info.x11.window, &xWindowAttribs );
// Get visual id from current display
XVisualInfo visualInfo;
int32_t numItems;
visualInfo.visualid = XVisualIDFromVisual( xWindowAttribs.visual );
// Get visual info matching the desired visual id
XVisualInfo* pVisualInfo = XGetVisualInfo( m_sdl_info.info.x11.display,
VisualIDMask,
&visualInfo,
&numItems );
if (!pVisualInfo)
{
fprintf( stderr, "[CreateOGLContext] Error obtaining visual
info\n" );
}
else
{
// Print selected visual
// fprintf( stderr, "[CreateOGLContext] Visual 0x%x has been
selected\n", (uint32_t)pVisualInfo->visualid );
// Create new context sharing display lists with current one
Bool bDirect = share? glXIsDirect( m_sdl_info.info.x11.display,
share ) : True;
ctx = glXCreateContext( m_sdl_info.info.x11.display,
pVisualInfo, share, bDirect );
// Flush errors
XSync( m_sdl_info.info.x11.display, False );
// Free visual info
XFree( pVisualInfo );
}
XSetErrorHandler( oldHandler );
return ctx;
}
int ActivateOGLContext( GLXContext ctx )
{
// Default returns TRUE! This avoid to do checks when no contexts are
enabled.
int ret = 1;
// Check OpenGL contexts allowed or if we're activating current context
if( ctx == glXGetCurrentContext () )
return ret;
XLockDisplay( m_sdl_info.info.x11.display );
ret = glXMakeCurrent( m_sdl_info.info.x11.display, (ctx == NULL)? None
: m_sdl_info.info.x11.window, ctx );
XSync( m_sdl_info.info.x11.display, False );
XUnlockDisplay( m_sdl_info.info.x11.display );
return ret;
}</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>