Part Number:TDA2EVM5777
Hi,
I test 3d surround view use case in Processor-Vison 3.0. Please see the work flow for the use case at the last.
But eglCreateContext return fail. The following is the output.
[HOST] [HOST ] 62.464649 s: EGL: version 1.4
EGL: after eglCreateContext() eglError (0x3005)
[HOST] [HOST ] 62.815714 s: EGL: eglCreateContext() failed !!!
The following is the function which calls eglCreateContext. So is there a way to figure out the reason why eglCreateContext failed?
int System_eglOpen(System_EglObj *pEglObj, struct control_srv_egl_ctx *eglInfo)
{
EGLint num_configs;
EGLint majorVersion;
EGLint minorVersion;
int ret, count;
System_Buffer *nextBuf;
int status;
System_EglPixmapVideoFrameBuffer *eglBuf;
EGLCompatBuffer eglCBuf;
UInt32 flags = pEglObj->chInfo.flags;
const EGLint attribs[] = {
EGL_RED_SIZE, 1,
EGL_GREEN_SIZE, 1,
EGL_BLUE_SIZE, 1,
EGL_ALPHA_SIZE, 0,
EGL_SURFACE_TYPE, EGL_PIXMAP_BIT,
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
EGL_DEPTH_SIZE, 8,
EGL_NONE
};
EGLint context_attribs[] = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE };
memcpy(&(pEglObj->eglInfo), eglInfo, sizeof(pEglObj->eglInfo));
pEglObj->nativeDisplay = pEglObj->eglInfo.get_egl_native_display();
pEglObj->display = eglGetDisplay((EGLNativeDisplayType)pEglObj->nativeDisplay);
System_eglCheckEglError("eglGetDisplay", EGL_TRUE);
if (pEglObj->display == EGL_NO_DISPLAY) {
Vps_printf(" EGL: ERROR: eglGetDisplay() returned EGL_NO_DISPLAY !!!\n");
return -1;
}
ret = eglInitialize(pEglObj->display, &majorVersion, &minorVersion);
System_eglCheckEglError("eglInitialize", ret);
Vps_printf(" EGL: version %d.%d\n", majorVersion, minorVersion);
if (ret != EGL_TRUE) {
Vps_printf(" EGL: eglInitialize() failed !!!\n");
return -1;
}
if (!eglBindAPI(EGL_OPENGL_ES_API)) { // Shiju - add in VSDK
Vps_printf(" EGL: ERROR - failed to bind api EGL_OPENGL_ES_API\n");
return -1;
}
if (!eglChooseConfig(pEglObj->display, attribs, &pEglObj->config, 1, &num_configs))
{
Vps_printf(" EGL: ERROR: eglChooseConfig() failed. Couldn't get an EGL visual config !!!\n");
return -1;
}
pEglObj->context = eglCreateContext(pEglObj->display, pEglObj->config, EGL_NO_CONTEXT, context_attribs);
System_eglCheckEglError("eglCreateContext", EGL_TRUE);
if (pEglObj->context == EGL_NO_CONTEXT) {
Vps_printf(" EGL: eglCreateContext() failed !!!\n");
return -1;
}
#ifdef QNX_BUILD
egl_config_verbose(pEglObj->display, pEglObj->config);
#else
ret = eglMakeCurrent(pEglObj->display, EGL_NO_SURFACE, EGL_NO_SURFACE, pEglObj->context);
System_eglCheckEglError("eglMakeCurrent", ret);
if (ret != EGL_TRUE) {
Vps_printf(" EGL: eglMakeCurrent() failed !!!\n");
return -1;
}
System_eglPrintGLString("Version", GL_VERSION);
System_eglPrintGLString("Vendor", GL_VENDOR);
System_eglPrintGLString("Renderer", GL_RENDERER);
System_eglPrintGLString("Extensions", GL_EXTENSIONS);
#endif
status = OSA_queCreate(&(pEglObj->eglEmptyBufQue), SYSTEM_MAXNUM_EGL_BUFFERS);
OSA_assert(status == SYSTEM_LINK_STATUS_SOK);
status = OSA_queCreate(&(pEglObj->eglFullBufQue), SYSTEM_MAXNUM_EGL_BUFFERS);
OSA_assert(status == SYSTEM_LINK_STATUS_SOK);
for (count = 0; count < SYSTEM_MAXNUM_EGL_BUFFERS; count++)
{
nextBuf = OSA_memAlloc(sizeof(System_Buffer));
OSA_assert(nextBuf != NULL);
nextBuf->payload = OSA_memAlloc(sizeof(System_EglPixmapVideoFrameBuffer));
OSA_assert(nextBuf->payload != NULL);
nextBuf->payloadSize = sizeof(System_EglPixmapVideoFrameBuffer);
nextBuf->bufType = SYSTEM_BUFFER_TYPE_EGLPIXMAP_VIDEO_FRAME;
nextBuf->chNum = 0;
nextBuf->frameId = 0;
eglBuf = nextBuf->payload;
eglCBuf = pEglObj->eglInfo.get_egl_native_buffer(pEglObj->width, pEglObj->height);
eglBuf->eglPixmap = eglCBuf.eglPixmap;
eglBuf->pixmapNative = eglCBuf.pixmapNative;
eglBuf->bufAddr[0] = eglCBuf.pixmapNative;
eglBuf->eglSurface = (UInt32)eglCreatePixmapSurface(pEglObj->display, pEglObj->config, eglBuf->eglPixmap, NULL);
OSA_assert(eglBuf->eglSurface != (UInt32)EGL_NO_SURFACE);
eglBuf->chInfo.flags = System_Link_Ch_Info_Set_Flag_Data_Format(flags, SYSTEM_DF_ABGR32_8888);
eglBuf->chInfo.pitch[0] = eglCBuf.stride;
eglBuf->chInfo.pitch[1] = eglCBuf.stride;
eglBuf->chInfo.pitch[2] = eglCBuf.stride;
eglBuf->chInfo.width = eglCBuf.width;
eglBuf->chInfo.height= eglCBuf.height;
eglBuf->chInfo.startX= 0;
eglBuf->chInfo.startY= 0;
eglBuf->flags = System_Link_Ch_Info_Set_Flag_Data_Format(flags, SYSTEM_DF_ABGR32_8888);
pEglObj->chInfo.width = eglCBuf.width;
pEglObj->chInfo.height= eglCBuf.height;
pEglObj->chInfo.pitch[0] = eglCBuf.stride;
pEglObj->chInfo.pitch[1] = eglCBuf.stride;
pEglObj->chInfo.pitch[2] = eglCBuf.stride;
pEglObj->chInfo.startX = 0;
pEglObj->chInfo.startY = 0;
pEglObj->chInfo.flags = System_Link_Ch_Info_Set_Flag_Data_Format(flags, SYSTEM_DF_ABGR32_8888);
//Vps_printf("System Buffer created = %p, contains = %p (eglpixmap = %p)\n", nextBuf, eglBuf, eglBuf->eglPixmap);
OSA_quePut(&(pEglObj->eglEmptyBufQue), (Int32)nextBuf, OSA_TIMEOUT_FOREVER);
pEglObj->eglBuffers[count] = nextBuf;
}
#ifdef QNX_BUILD
eglBuf = pEglObj->eglBuffers[0]->payload;
ret = eglMakeCurrent(pEglObj->display, (EGLSurface)eglBuf->eglSurface, (EGLSurface)eglBuf->eglSurface, pEglObj->context);
OSA_assert(ret != 0);
egl_config_verbose2();
#endif
return 0;
}
Mason Su
Best Regards