[Bug 99769] RADEON(0): flip queue failed in radeon_scanout_flip: Cannot allocate memory

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Mon Feb 13 15:17:23 UTC 2017


--- Comment #3 from jorge_monteagudo at hotmail.com ---
I've track down the problem to some code handling OpenGL contexts in my

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 ());

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.


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,
           &numItems );
        if (!pVisualInfo)
                fprintf( stderr, "[CreateOGLContext] Error obtaining visual
info\n" );
                // 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
        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;

You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.x.org/archives/xorg-driver-ati/attachments/20170213/985d0916/attachment.html>

More information about the xorg-driver-ati mailing list