This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

eglCreatePixmapSurface  error 0x300a

Note: This was originally posted on 12th September 2012 at http://forums.arm.com

When I try the SAMSUNG S3 run the above code, I failed.


void GLImageRenderBlux::initEGL(int width, int height, SkBitmap bitmap)
{
const EGLint attribList[] = { EGL_WIDTH, width, EGL_HEIGHT, height, EGL_NONE };

EGLConfig config;
EGLint maj;
EGLint min;

m_display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
checkEGLError("eglGetDisplay");
if(m_display == EGL_NO_DISPLAY) {
  LOGE("getDisplay fail!");
  return ;
}

if(eglInitialize(m_display, &maj, &min) == EGL_FALSE) {
  LOGE("Initialize fail");
  return ;
}

config = chooseConfig(m_display);
EGLint contextAttrs[] = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE };

m_context = eglCreateContext(m_display, config, EGL_NO_CONTEXT, contextAttrs);
checkEGLError("eglCreateContext");
if(m_context == EGL_NO_CONTEXT) {
  LOGE("Create Context failure");
  return ;
}


//
SkPixelRef* ref = bitmap.pixelRef();
SkSafeRef(ref);
ref->lockPixels();

egl_native_pixmap_t pixmap;
pixmap.version = sizeof(pixmap);
pixmap.width  = width;
pixmap.height = height;
pixmap.stride = bitmap.rowBytes() / bitmap.bytesPerPixel();
pixmap.format = SkBitmap::kARGB_8888_Config;
pixmap.data   = (uint8_t*)ref->pixels();

ref->unlockPixels();

m_surface = eglCreatePixmapSurface(m_display, config, &pixmap, attribList);
checkEGLError("eglCreatePixmapSurface");
if(m_surface == EGL_NO_SURFACE) {
  LOGE("Create Surface failure");
  return ;
}

if (!eglMakeCurrent(m_display, m_surface, m_surface, m_context)) {
  LOGE("Make Current failure");
  return ;
}
}

EGLConfig GLImageRenderBlux::chooseConfig(EGLDisplay display)
{
EGLConfig config;
EGLint numConfigs;

static const EGLint configAttribs[] = {
   EGL_SURFACE_TYPE,
   EGL_PIXMAP_BIT,
   EGL_RENDERABLE_TYPE,
   EGL_OPENGL_ES2_BIT,
   EGL_NONE
};

eglChooseConfig(display, configAttribs, &config, 1, &numConfigs);
checkEGLError("eglPbufferConfig");
if (numConfigs != 1) {
  LOGE("eglPbufferConfig failed (%d)\n", numConfigs);
}

return config;
}

Error information is as follows:
'eglCreatePixmapSurface error: EGL_BAD_NATIVE_PIXMAP (0x300a)'
'[color=#FF0000]Create Surface failure'[/color]

Does any know how to fix the problem?
Parents Reply Children
No data