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?
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.