Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - SIGSEGV fault while calling vgCreateEGLImageTargetKHR API: (1 Item)
   
SIGSEGV fault while calling vgCreateEGLImageTargetKHR API  
I'm creating a graphics application to run on i.MX6 Sabre SDB and I’m running into a SIGSEGV fault when I call ‘
vgCreateEGLImageTargetKHR’ API.  Can someone please help me figure out the root cause for this?

I’m trying to use the EGL_KHR_image extension as a means to share images between the OpenGLES2 and OpenVG rendering 
APIs.  
So, I wrote some code to create an EGLImageKHR type as shown below.  After successful creation of the EGLImageKHR, I was
 able to create an OpenGLES2 texture using the EGL image (glEGLImageTargetTexture2DOES ) and render it to the display.  


But, I see a SIGSEGV fault, when I attempt to create an OpenVG texture using the same EGL Image.  The OpenVG extension 
function that I’m using is - vgCreateEGLImageTargetKHR

void * driver_CreateEglImageBuffer(EGL_DDB *pDdb)
{
    int             size[2] = {pDdb->width, pDdb->height};
    int             format = SCREEN_FORMAT_RGBA8888;
    void *          ret_buffer = NULL;
    int             result;

    /* Create a pixmap buffer.  This buffer will be used to hold the
    ** bitmap and eventually create an eglImage.
    */
    result = screen_create_pixmap((screen_pixmap_t *)&(pDdb->pixmap.pixmapId), 
                                  egl_layer->win.screen_ctx);
    if (result == 0) 
    {
        int usage = SCREEN_USAGE_OPENGL_ES2 | SCREEN_USAGE_OPENVG;
        screen_buffer_t screen_pbuf;

        screen_set_pixmap_property_iv(pDdb->pixmap.pixmapId, SCREEN_PROPERTY_USAGE, &usage);
        screen_set_pixmap_property_iv(pDdb->pixmap.pixmapId, SCREEN_PROPERTY_FORMAT, &format);
        screen_set_pixmap_property_iv(pDdb->pixmap.pixmapId, SCREEN_PROPERTY_BUFFER_SIZE, size);
        result = screen_create_pixmap_buffer(pDdb->pixmap.pixmapId);
        if (result != 0) 
        {
            screen_destroy_pixmap(pDdb->pixmap.pixmapId);
            printf("Fail! screen_create_pixmap_buffer() returned %d\n", result);
        }
        else
        {
            screen_get_pixmap_property_pv(pDdb->pixmap.pixmapId, SCREEN_PROPERTY_RENDER_BUFFERS,
                                                   (void**)&screen_pbuf);
            
            /* Get the buffer pointer */
            screen_get_buffer_property_pv(screen_pbuf, SCREEN_PROPERTY_POINTER,
                                                   (void**)&pDdb->pixmap.pixmapBuffer);
            /* Get the buffer stride */
            screen_get_buffer_property_iv(screen_pbuf, SCREEN_PROPERTY_STRIDE,
                                                    (int *)&(pDdb->stride));
            /* Create EGL Image */
            pDdb->pixmap.eglImage = eglCreateImageKHR(egl_layer->win.eglDisplay,
                                                     EGL_NO_CONTEXT,
                                                     EGL_NATIVE_PIXMAP_KHR,
                                                     (void *)pDdb->pixmap.pixmapId,
                                                     NULL);
            if (pDdb->pixmap.eglImage == EGL_NO_IMAGE_KHR)
            {
                EGLint eglError = eglGetError();
                if (eglError != EGL_SUCCESS)
                {
                    printf("eglGetError() = %i\n", eglError);
                }
            }
            else
            {
                ret_buffer = pDdb->pixmap.pixmapBuffer;
            }
        }
    }
    return ret_buffer;
}