On the DM370 with the SGX 530 I was able to use the following code to initialize my EglSurface using CMEM and PIXMAP offscreen surfaces:
// Index to bind the attributes to vertex shaders #define VERTEX_ARRAY 0 #define TEXCOORD_ARRAY 1 // Bit types #define SGXPERF_RGB565 0 #define SGXPERF_ARGB8888 2 // SurfaceTypes #define SGXPERF_SURFACE_TYPE_WINDOW 0 #define SGXPERF_SURFACE_TYPE_PIXMAP_16 1 #define SGXPERF_SURFACE_TYPE_PIXMAP_32 2 typedef struct _NATIVE_PIXMAP_STRUCT { long pixelFormat; long rotation; long width; long height; long stride; long sizeInBytes; long pvAddress; long lAddress; } NATIVE_PIXMAP_STRUCT;
// Init EGL with offscreen PIXMAP support void* GLWidget::commonEglInit(int surfaceType, NATIVE_PIXMAP_STRUCT** pNativePixmapPtr) { int windowWidthTi, windowHeightTi; EGLint iMajorVersion, iMinorVersion; EGLint ai32ContextAttribs[] = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE }; eglDisplay = eglGetDisplay((int)0); if (!eglInitialize(eglDisplay, &iMajorVersion, &iMinorVersion)) return NULL; if ( !eglBindAPI(EGL_OPENGL_ES_API) ) { return NULL; } EGLint pi32ConfigAttribs[5]; pi32ConfigAttribs[0] = EGL_SURFACE_TYPE; pi32ConfigAttribs[1] = EGL_WINDOW_BIT | EGL_PIXMAP_BIT; pi32ConfigAttribs[2] = EGL_RENDERABLE_TYPE; pi32ConfigAttribs[3] = EGL_OPENGL_ES2_BIT; pi32ConfigAttribs[4] = EGL_NONE; int iConfigs; if (!eglChooseConfig(eglDisplay, pi32ConfigAttribs, &eglConfig, 1, &iConfigs) || (iConfigs != 1)) { fprintf(stderr,"Error: eglChooseConfig() failed.\n"); return NULL; } commonCreateNativePixmap(SGXPERF_ARGB8888,WIDTH, HEIGHT, pNativePixmapPtr); eglSurface = eglCreatePixmapSurface(eglDisplay, eglConfig, *pNativePixmapPtr, NULL); if (!fprintf(stderr,"eglCreateSurface\n")) return NULL; eglContext = eglCreateContext(eglDisplay, eglConfig, NULL, ai32ContextAttribs); if (!fprintf(stderr,"eglCreateContext\n")) return NULL; eglMakeCurrent(eglDisplay, eglSurface, eglSurface, eglContext); if (!fprintf(stderr,"eglMakeCurrent\n")) return NULL; EGLBoolean success = eglSwapInterval(eglDisplay, 1); if ( !success ) { fprintf(stderr,"eglSwapInterval\n"); sleep(3600); return NULL; } eglQuerySurface(eglDisplay, eglSurface, EGL_WIDTH, &windowWidthTi); eglQuerySurface(eglDisplay, eglSurface, EGL_HEIGHT, &windowHeightTi); fprintf(stderr,"Window width=%d, Height=%d\n", windowWidthTi, windowHeightTi); (void*)(*pNativePixmapPtr)->lAddress; return (void*)(*pNativePixmapPtr)->lAddress; }
On the AM57xx EVM, I've built and deployed the processor SDK with the OpenGL libraries, cmemk.ko, and pvrsrvctl. I can successfully run the PVR OpenGL demos and they show up on the display. I'm trying to run my application on this new EVM and it always fails with:
Error: eglChooseConfig() failed. Error creating EGL surface!
If I remove the EGL_PIXMAP_BIT in the pi32ConfigAttribs, then it gets further.
Does the AM57xx OpenGL libraries not support PIXMAP surfaces? If they do, how can I get them to work? Thanks!