I am attempting to create a surface with eglCreatePixmapSurface () using MALI-T 820, but I have failed.Opengl version uses 1.1.I'm trying to create surface with the code below,The return value of eglCreatePixmapSurface () becomes EGL_NO_SURFACE and fails.------------------------------- EGLint const attrib_list[] = { EGL_SURFACE_TYPE,EGL_PIXMAP_BIT, EGL_NONE }; ret = eglChooseConfig(disp, attrib_list, &cconfig, 1, &num_config); if (ret != EGL_TRUE){ fprintf(stderr,"get config failed...%d\n",ret); return EGL_NO_SURFACE; } struct fbdev_pixmap buffer_type; buffer_type.data = (unsigned short *)malloc(1000*1000) ; buffer_type.width = 1000; buffer_type.height = 1000; buffer_type.format = 1; buffer_type.bytes_per_pixel = 4; buffer_type.buffer_size = 32; buffer_type.red_size = 8; buffer_type.green_size = 8; buffer_type.blue_size = 8; buffer_type.alpha_size = 8; buffer_type.luminance_size = 0; surface = eglCreatePixmapSurface(disp, cconfig, (EGLNativePixmapType)(&buffer_type), NULL); if (surface == EGL_NO_SURFACE){ fprintf(stderr,"create surface failed...\n"); return EGL_NO_SURFACE; }-------------------------------The type of fbdev_pixmap to pass to eglCreatePixmapSurface () defines the following itself.-------------------------------typedef struct fbdev_pixmap{ unsigned int height; unsigned int width; unsigned int bytes_per_pixel; unsigned char buffer_size; unsigned char red_size; unsigned char green_size; unsigned char blue_size; unsigned char alpha_size; unsigned char luminance_size; fbdev_pixmap_flags flags; unsigned short *data; unsigned int format;} fbdev_pixmap;-------------------------------Is it wrong because fbdev_pixmap is specified incorrectly?
When dealing with xGL (EGL, OpenGL ES, ...), the output of the GetError() function (eglGetError() for example) will generally provide you some hints about what's going on and went wrong.
You can then read the last invoked function manual page, eglCreatePixmapSurface in this case, to understand the relation between the error code returned by eglGetError and the real issue.
Thanks for the reply Myy.I confirmed that EGL_BAD_MATCH is returned with eglGetError.Therefore, I tried changing the code belowEGL_BAD_ATTRIBUTE was acquired with eglGetError.------------- surface = eglCreatePixmapSurface(disp, cconfig, (EGLNativePixmapType)(&buffer_type), attrib_list);-------------Currently I have set EGL_SURFACE_TYPE, EGL_PIXMAP_BIT, EGL_NONE in attrib_list, but is it incorrect?
Hmm, the thing is, the configuration (cconfig) you chose with eglChooseConfig might not have any depth buffer at all. Since the depth buffer is set as a requirement in your pixmap attributes, you might have a "mismatch" between your chosen screen configuration and your pixmap configuration, and therefore get no surface at all.
When possible, try set up the attrib_list passed to eglChooseConfig, so that it follows the requirements passed to eglCreatePixmapSurface .
Something like this might do the trick :
attrib_list = { EGL_RED_SIZE, 8, EGL_BLUE_SIZE, 8, EGL_GREEN_SIZE, 8, EGL_DEPTH_SIZE, 8, EGL_LUMINANCE_SIZE, 0, EGL_SURFACE_TYPE, EGL_PIXMAP_BIT, EGL_CONFORMANT, EGL_OPENGL_ES2_BIT, // Only if you intend to use OpenGL ES 2.x EGL_NONE, EGL_NONE };
See eglChooseConfig manual page for more details on what you can specify in the attributes list.
Also note that eglCreatePixmapSurface attrib_list and eglChooseConfig attrib_list follow the same syntax, but do not support the same attributes.
Unless you plan to use OpenVG, you can ignore eglCreatePixmapSurface attributes list and pass NULL, like you did in the first place.
Thanks for the reply Myy.I set NULL as the fourth argument of eglCreatePixmapSurface and tried setting up attrib_list that I mentioned, but I got EGL_BAD_MATCH.I will investigate the setting of attrib_list to hand to eglChooseConfig again.
Also, if you know the EGLNativePixmapType you pass to eglCreatePixmapSurface, please let us know the procedure necessary for setting the structure to be passed on by the user side.