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
  • Note: This was originally posted on 20th September 2012 at http://forums.arm.com

    Hi Likai,

       I have been able to reproduce the problem with your code snippet. If you look carefully at the code sample provided in the link you have missed out a GLES Call to set the width and height of the texture using glTexImage2D. Without this call, the framebuffer status will be reported as incomplete as the dimensions have not been defined.

    Please add the following line to remove your error,

    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, g_texWidth, g_texHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);


    You might also want to consider using SurfaceTexture available from Android version 3.0 onwards. Please look at the following documentation also,
    http://developer.and...aceTexture.html

    There is an example in the Android NDK (native-media) that shows how to use this.

    Please let me know if you need any more information.

    Cheers, Karthik
Reply
  • Note: This was originally posted on 20th September 2012 at http://forums.arm.com

    Hi Likai,

       I have been able to reproduce the problem with your code snippet. If you look carefully at the code sample provided in the link you have missed out a GLES Call to set the width and height of the texture using glTexImage2D. Without this call, the framebuffer status will be reported as incomplete as the dimensions have not been defined.

    Please add the following line to remove your error,

    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, g_texWidth, g_texHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);


    You might also want to consider using SurfaceTexture available from Android version 3.0 onwards. Please look at the following documentation also,
    http://developer.and...aceTexture.html

    There is an example in the Android NDK (native-media) that shows how to use this.

    Please let me know if you need any more information.

    Cheers, Karthik
Children
No data