Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

clGetPlatformIds is failed for Mobile GPU (Adreno 405)

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?

Code:

    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);
    theProgI2I.build(devs);
cv::ocl::attachContext(p.getInfo<CL_PLATFORM_NAME>(), p(), theContext(), devs[0]());

clGetPlatformIds is failed for Mobile GPU (Adreno 405)

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?

Code:

    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);
    theProgI2I.build(devs);
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.