AnsweredAssumed Answered

Opengl interop / clCreateContextFromType segfault

Question asked by fesc2000 on Oct 17, 2014
Latest reply on Oct 24, 2014 by fesc2000

Hi,

 

i recently did an ill advised updated of my Debian (sid) installation. This caused my OpenCL/OpenGL interoperability to be broken, and i wonder if anyone else is experiencing this ...

 

The call to clCreateContextFromType() either fails with a segfault or X error:

 

Code:

    cl_context_properties cprops[] = {

        CL_CONTEXT_PLATFORM, (cl_context_properties)platform,

        CL_GL_CONTEXT_KHR, (cl_context_properties)glx_context,

        CL_GLX_DISPLAY_KHR, (cl_context_properties)display,

        0 };

 

    context = clCreateContextFromType(cprops,

                                      CL_DEVICE_TYPE_ALL,

                                      NULL,

                                      NULL,

                                      &status);


Result:

X Error of failed request:  BadMatch (invalid parameter attributes)

  Major opcode of failed request:  157 (GLX)

  Minor opcode of failed request:  5 (X_GLXMakeCurrent)

  Serial number of failed request:  36

  Current serial number in output stream:  36

 

Removing CL_GLX_DISPLAY_KHR property just produces a segfault

 

Without CL_GL_CONTEXT_KHR  everything works fine (without using the interop code of course).

This all used to work fine before the update (even without CL_GLX_DISPLAY_KHR property).

 

EDIT:

This only happens when the calls are done from a separate thread .. my main thread initializes X/OpenGl. The actual work, incl. OpenCL initialization is done in a thread which is spawned later. The context is properly transferred to this thread via glXMakeCurrent().

-> If i do the initialization in the main thread it works, but the first call using GL interoperability (e.g. clCreateFromGLTexture) fails with the same X error ...

 

 

 

 

The update moved fglrx driver package version from

fglrx-driver (1:14.6~ga14.201-1) unstable

to

fglrx-driver (1:14.9+ga14.201-1) unstable

 

which is actually the same amd driver package, just a different debian package.

 

xorg is the latest (1.16).

 

fglrxinfo:

OpenGL vendor string: Advanced Micro Devices, Inc.

OpenGL renderer string: ATI Radeon HD 5700 Series

OpenGL version string: 4.4.12968 Compatibility Profile Context 14.201.1009

 

clinfo:

Number of platforms:                             1

  Platform Profile:                              FULL_PROFILE

  Platform Version:                              OpenCL 1.2 AMD-APP (1526.3)

  Platform Name:                                 AMD Accelerated Parallel Processing

  Platform Vendor:                               Advanced Micro Devices, Inc.

  Platform Extensions:                           cl_khr_icd cl_amd_event_callback cl_amd_offline_devices

Outcomes