eglCreatePixmapSurface is thorwing EGL_BAD_MATCH error wince6.0

Hi,

I am using eglCreatePixmapSurface in WindowsCE 6.0. The EGl API version is 1.4. The method is always throwing EGL_BAD_MATCH error.
Here is the code. In below code _pixmap is HBITMAP returned by CreateDIBSection.

BOOL create_pixmap()
{
EGLint params[5] = {EGL_NONE,EGL_NONE,EGL_NONE,EGL_NONE,EGL_NONE};
// Init State Data
_display = EGL_NO_DISPLAY;
_surface = EGL_NO_SURFACE;
_context = EGL_NO_CONTEXT;

eglBindAPI(EGL_OPENVG_API);

// Main Display
_display = eglGetDisplay(EGL_DEFAULT_DISPLAY );
if( _display == EGL_NO_DISPLAY || eglGetError() != EGL_SUCCESS )
{
	MessageBox(window, _T("EGL_NO_DISPLAY"), _T("CurveViewTest"), MB_OK);	
	return FALSE;
}

EGLint major;
EGLint minor;
if( eglInitialize( _display, &major, &minor) == EGL_FALSE || eglGetError() != EGL_SUCCESS )
{
	MessageBox(window, _T("eglInitialize Failed"), _T("CurveViewTest"), MB_OK);
	return FALSE;
}

EGLConfig chosenConfig = NULL; 
EGLint ncfg;
EGLConfig* matchingConfigs;

EGLint attributes[] = { 
	EGL_RED_SIZE, 8,
	EGL_GREEN_SIZE, 8,
	EGL_BLUE_SIZE, 8,
	EGL_ALPHA_SIZE, 8,
	EGL_SURFACE_TYPE, EGL_PIXMAP_BIT,
	EGL_SAMPLES, 1,
	EGL_NONE };

eglChooseConfig(_display, attributes, NULL, 0, &ncfg);

matchingConfigs = (EGLConfig*)malloc( ncfg * sizeof(EGLConfig));
if(EGL_FALSE == eglChooseConfig(_display, attributes, matchingConfigs, ncfg, &ncfg))
{
	return FALSE;
}

int ii = 0;
// Look at each EGLConfig 
for (ii=0; ii<ncfg; ii++) 
{    
	chosenConfig = matchingConfigs[ii]; 

	_surface = eglCreatePixmapSurface(_display, chosenConfig, (EGLNativePixmapType) _pixmap, NULL);

	int err = eglGetError();
	if(err != EGL_SUCCESS )
	{
		wchar_t text[255];
		wsprintf(text, _T("eglCreatePixmapSurface error = 0x%x"), err);
		SetWindowText(window, text);
		Sleep(1000);
		continue;
	}
	else
	  break;
}

// Context
_context = eglCreateContext(_display, chosenConfig, 0, 0 );
if( _context == EGL_NO_CONTEXT || eglGetError() != EGL_SUCCESS )
{
	return FALSE;
}
if( eglMakeCurrent(_display, _surface, _surface, _context ) == EGL_FALSE || eglGetError() != EGL_SUCCESS )
{
	return FALSE;
}

return TRUE;

}

Please let me know what is the wrong with the code.

Thanks in advance.