Repository: opencv
Issue: OpenCV with OpenCL on i.mx6quad plus(arm cortex a9)
Labels: category: ocl,category: 3rdparty

##### System information (version)

- OpenCV => 4.3
- Operating System / Platform => Linux version 4.9.11
- Compiler => arm-poky-linux-gnueabi-g++
- Operating System / Platform => i.mx6 quad plus sabresd

##### Detailed description

Hi
I build OpenCV-4.3.0 as shown below
```
General configuration for OpenCV 4.3.0 =====================================
  Version control:               unknown

  Extra modules:
    Location (extra):            /home/sonic/opencv/opencv_contrib-4.3.0/modules
    Version control (extra):     unknown

  Platform:
    Timestamp:                   2020-04-17T00:27:08Z
    Host:                        Linux 4.15.0-96-generic x86_64
    Target:                      Linux 1 arm
    CMake:                       3.10.2
    CMake generator:             Unix Makefiles
    CMake build tool:            /usr/bin/make
    Configuration:               Release

  CPU/HW features:
    Baseline:                    VFPV3 NEON
      requested:                 DETECT
      required:                  VFPV3 NEON

  C/C++:
    Built as dynamic libs?:      YES
    C++ standard:                11
    C++ Compiler:                /opt/fsl-imx-fb/3.14.52-1.1.1/sysroots/i686-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-g++  (ver 4.9.2)
    C++ flags (Release):         --sysroot=/opt/fsl-imx-fb/3.14.52-1.1.1/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi -march=armv7-a -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a9 --sysroot=/opt/fsl-imx-G
    C++ flags (Debug):           --sysroot=/opt/fsl-imx-fb/3.14.52-1.1.1/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi -march=armv7-a -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a9 --sysroot=/opt/fsl-imx-G
    C Compiler:                  /opt/fsl-imx-fb/3.14.52-1.1.1/sysroots/i686-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc
    C flags (Release):           --sysroot=/opt/fsl-imx-fb/3.14.52-1.1.1/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi -march=armv7-a -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a9 --sysroot=/opt/fsl-imx-G
    C flags (Debug):             --sysroot=/opt/fsl-imx-fb/3.14.52-1.1.1/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi -march=armv7-a -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a9 --sysroot=/opt/fsl-imx-G
    Linker flags (Release):      -Wl,--gc-sections -Wl,--as-needed  
    Linker flags (Debug):        -Wl,--gc-sections -Wl,--as-needed  
    ccache:                      NO
    Precompiled headers:         NO
    Extra dependencies:          dl m pthread rt
    3rdparty dependencies:

  OpenCV modules:
    To be built:                 aruco bgsegm bioinspired calib3d ccalib core datasets dnn dnn_objdetect dnn_superres dpm face features2d flann fuzzy gapi hfs highgui img_hash imgcodecs imgproc intensityo
    Disabled:                    world
    Disabled by dependency:      -
    Unavailable:                 alphamat cnn_3dobj cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev cvv freetype hz
    Applications:                perf_tests apps
    Documentation:               NO
    Non-free algorithms:         YES

  GUI: 
    GTK+:                        NO

  Media I/O: 
    ZLib:                        build (ver 1.2.11)
    JPEG:                        libjpeg-turbo (ver 2.0.4-62)
    WEBP:                        build (ver encoder: 0x020f)
    PNG:                         build (ver 1.6.37)
    TIFF:                        build (ver 42 - 4.0.10)
    JPEG 2000:                   build Jasper (ver 1.900.1)
    HDR:                         YES
    SUNRASTER:                   YES
    PXM:                         YES
    PFM:                         YES

  Video I/O:
    DC1394:                      NO
    FFMPEG:                      NO
      avcodec:                   NO
      avformat:                  NO
      avutil:                    NO
      swscale:                   NO
      avresample:                NO
    GStreamer:                   NO
    v4l/v4l2:                    YES (linux/videodev2.h)

  Parallel framework:            pthreads

  Trace:                         YES (with Intel ITT)

  Other third-party libraries:
    Lapack:                      NO
    Custom HAL:                  YES (carotene (ver 0.0.1))
    Protobuf:                    build (3.5.1)

  OpenCL:                        YES (no extra features)
    Include path:                /home/sonic/opencv/opencv-4.3.0-i.mx6/3rdparty/include/opencl/1.2
    Link libraries:              Dynamic load

  Python (for build):            /usr/bin/python2.7

  Install to:                    /home/sonic/opencv/opencv-4.3.0-i.mx6/build/install

```
My first question ,
Is the "Target: Linux 1 arm" means 1 core?
My processor has quad core. If it means 1 core. I want to use quad core.
what shold I do?


And I installed opencv-4.3.0 on my board. it works well except when using OpenCL.
Here are OpenCL information as shown below
```
- Device 0 ---
Name : Vivante OpenCL Device GC3000.5450.0000
Availability : 1
Image Support : 1
OpenCL C version : OpenCL C 1.1 
```
my code
```
const string tensorflowConfigFile = "models/ssdlite_mobilenet_v3_face_graph.pbtxt";
const string tensorflowWeightFile = "models/ssdlite_mobilenet_v3_face_frozen_inference_graph.pb";
int FACE_CNN_INPUT_SIZE = 140;

int cam = 0;

int main (int argc, char **argv){
    Net face_net = readNetFromTensorflow(tensorflowWeightFile, tensorflowConfigFile);

    VideoCapture cap(cam);
    cap.set(CAP_PROP_FRAME_WIDTH, 640);
    Mat frame;
    UMat resized_img;

    double tt_send = 0;

    if(!ocl::haveOpenCL())
    {
        cout << "can not use OpenCL" << endl;
    }
    ocl::Context context;
    if(!context.create(ocl::Device::TYPE_GPU))
    {
        cout << " can not create context" << endl;
    }
    cout << context.ndevices() << "GPU device (s) detected" << endl;
    for(size_t i = 0; i < context.ndevices(); i++)
    {
        ocl::Device device = context.device(i);
        cout << "- Device " << i << " ---" << endl;
        cout << "Name : " << device.name() << endl;
        cout << "Availability : " << device.available() << endl;
        cout << "Image Support : " << device.imageSupport() << endl;
        cout << "OpenCL C version : " << device.OpenCL_C_Version() << endl;
    }
    ocl::Device(context.device(0));

    ocl::setUseOpenCL(true);
    cout << getBuildInformation().c_str() << endl;

    while(cap.isOpened()){
        double t = getTickCount();
        cap >> frame;
        if(frame.empty())
            break;
        flip(frame, frame, 1);
        resize(frame, frame, Size(FACE_CNN_INPUT_SIZE,FACE_CNN_INPUT_SIZE));
        resized_img = frame.getUMat(ACCESS_READ);
    }
    return 0;
}
```
I got this error
`what():  OpenCV(4.3.0) /home/sonic/opencv/opencv-4.3.0-i.mx6/modules/core/src/ocl.cpp:4957: error: (-215:Assertion failed) u->origdata == data && "Details: https://github.com/opencv/opencv/issues/6293"'`


##### Issue submission checklist

 - [ ] I report the issue, it's not a question
   <!--
   OpenCV team works with answers.opencv.org, Stack Overflow and other communities
   to discuss problems. Tickets with question without real issue statement will be
   closed.
   -->
 - [ v ] I checked the problem with documentation, FAQ, open issues,
       answers.opencv.org, Stack Overflow, etc and have not found solution
   <!--
   Places to check:
   * OpenCV documentation: https://docs.opencv.org
   * FAQ page: https://github.com/opencv/opencv/wiki/FAQ
   * OpenCV forum: https://answers.opencv.org
   * OpenCV issue tracker: https://github.com/opencv/opencv/issues?q=is%3Aissue
   * Stack Overflow branch: https://stackoverflow.com/questions/tagged/opencv
   -->
 - [ v ] I updated to latest OpenCV version and the issue is still there
   <!--
   master branch for OpenCV 4.x and 3.4 branch for OpenCV 3.x releases.
   OpenCV team supports only latest release for each branch.
   The ticket is closed, if the problem is not reproduced with modern version.
   -->
 - [ ] There is reproducer code and related data files: videos, images, onnx, etc
   <!--
   The best reproducer -- test case for OpenCV that we can add to the library.
   Recommendations for media files and binary files:
   * Try to reproduce the issue with images and videos in opencv_extra repository
     to reduce attachment size
   * Use PNG for images, if you report some CV related bug, but not image reader
     issue
   * Attach the image as archite to the ticket, if you report some reader issue.
     Image hosting services compress images and it breaks the repro code.
   * Provide ONNX file for some public model or ONNX file with with random weights,
     if you report ONNX parsing or handling issue. Architecture details diagram
     from netron tool can be very useful too. See https://lutzroeder.github.io/netron/
   -->