clGetPlatformIds is failed for Mobile GPU (Adreno 405)

asked 2017-08-12 07:43:47 -0500

Uma gravatar image

updated 2017-08-12 22:53:46 -0500

Hai , I am developing an android application which involves processing a each frame from live input(video). For this I am using OPENCV and OPENCL. I have imported the OpenCV module 3.2.0 for android, I have linked the OpenCL lib from my test mobile. OpenCL version is 1.2.I have included corresponding OpenCL header files also. My Mobile GPU is QUALCOMM Adreno 405(32 bit ). I am facing OPENCV error -202 : clGetPlatformIDs failed ! form the function cv::ocl::attachContext(......) while running . How to fix this error?


    haveOpenCL = false;
    cl::Platform p = cl::Platform::getDefault();
    std::string ext = p.getInfo<CL_PLATFORM_EXTENSIONS>();
    if(ext.find("cl_khr_gl_sharing") == std::string::npos)
        LOGE("Warning: CL-GL sharing isn't supported by PLATFORM");
    props[5] = (cl_context_properties) p();

    theContext = cl::Context(CL_DEVICE_TYPE_GPU, props);
    std::vector<cl::Device> devs = theContext.getInfo<CL_CONTEXT_DEVICES>();
    LOGD("Context returned %d devices, taking the 1st one", devs.size());
    LOGD("Platform info :::: %s",p.getInfo<CL_PLATFORM_NAME>().c_str());
    ext = devs[0].getInfo<CL_DEVICE_EXTENSIONS>();
    if(ext.find("cl_khr_gl_sharing") == std::string::npos)
        LOGE("Warning: CL-GL sharing isn't supported by DEVICE");

    theQueue = cl::CommandQueue(theContext, devs[0]);

    cl::Program::Sources src(1, std::make_pair(oclProgI2I, sizeof(oclProgI2I)));
    theProgI2I = cl::Program(theContext, src);;
cv::ocl::attachContext(p.getInfo<CL_PLATFORM_NAME>(), p(), theContext(), devs[0]());

I have separately used clgetplatformids function for which I am getting CL_SUCCESS . But when I tried to use attachcontext function I am getting above error message.

edit retag flag offensive close merge delete


I am getting OpenCV unknown error - 202 (clGetPlatformids) for Adreno GPU 405. OpenCL version 1.2. And platform extensions are cl_img_egl_image cl_khr_byte_addressable_store cl_khr_egl_event cl_khr_egl_image cl_khr_fp16 cl_khr_gl_sharing cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_qcom_create_buffer_from_image cl_qcom_ext_host_ptr cl_qcom_ion_host_ptr cl_qcom_perf_hint cl_qcom_android_native_buffer_host_ptr..

Do I need to update my OpenCL driver?? or How to fix this ? It will be useful if i get any comments on this to proceed further . Thanks in advance.

Uma gravatar imageUma ( 2017-08-14 08:55:32 -0500 )edit