eglInitialize crash

eglInitialize is crashing on my MX31 device. Parameters given are:

  1. an EGLDisplay recieved after an eglGetDisplay of the default display type. This parameter has the integer value of 1.
    2)NULL
    3)NULL

Any idea of ANYTHING that could cause a crash in this function? Appreciate ur help!

It shouldn’t crash. Passing null-pointers for the major and minor version number is valid according to the standard.

However, my first try would be to pass valid pointers to the two last parameters and see if it works that way…

Nope, that doesnt work either.

My hunch is that its not the eglInitialize code that is crashing. But if I skip eglInitialize(along with some other gl and egl calls), the application runs fine, ofcourse, without UI.

Does eglInitialize start some thread or call some code somewhere that could crash under certain conditions?

If possible, could someone please summarize in simple terms what eglInitialize really does internally. Not much info out there on this.

Thanks alot for your help!

That is entirely implementation dependent.

Could you give some more details on the platform you are using?

Its on an MX31 platform, ARM processor.

Try this (it’s my EGL initialization code, tested also on iMX31):


int initEGL() {
	
	EGLint majorVersion, minorVersion;
	EGLConfig *configList = NULL;
	EGLint numOfConfigs = 0; 
	EGLint configSize = 0;
	const EGLint attrib_list_fsaa[] = {
		EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
		EGL_BUFFER_SIZE, 16,
		EGL_DEPTH_SIZE, 24,
		EGL_STENCIL_SIZE, EGL_DONT_CARE,
		EGL_SAMPLE_BUFFERS, 1,
		EGL_SAMPLES, 4,
		EGL_NONE
	};
	const EGLint attrib_list[] = {
		EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
		EGL_BUFFER_SIZE,  16,
		EGL_DEPTH_SIZE, 24,
		EGL_STENCIL_SIZE, EGL_DONT_CARE,
		EGL_NONE
	};
	
	eglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
	if (eglDisplay == EGL_NO_DISPLAY) {
		printf("eglGetDisplay failed!
");
		return 0;
	}
	else
		printf("eglGetDisplay OK!
");
	
	if (eglInitialize(eglDisplay, &majorVersion, &minorVersion) == EGL_FALSE) {
		printf("eglInitialize failed!
");
		return 0;
	}
	else
		printf("eglInitialize OK: %d.%d
", majorVersion, minorVersion);
	
	if (eglGetConfigs(eglDisplay, configList, configSize, &numOfConfigs) == EGL_FALSE) {
		printf("eglGetConfigs failed!
");
		return 0;
	}
	else
		printf("eglGetConfigs OK!
");

	configSize = numOfConfigs;
	configList = (EGLConfig *)malloc(sizeof(EGLConfig) * configSize);
	if (configList == NULL) {
		printf("Memory allocation to store EGL configurations failed!
");
		return 0;
	}
	else
		printf("Memory allocation to store EGL configurations OK!
");
	
	if (eglChooseConfig(eglDisplay, attrib_list_fsaa, configList, configSize, &numOfConfigs) == EGL_FALSE) {
		printf("eglChooseConfig FSAA failed!
");
		return 0;
	}
	else
		printf("eglChooseConfig FSAA OK!
");
		
	if (numOfConfigs == 0) {
		if (eglChooseConfig(eglDisplay, attrib_list, configList, configSize, &numOfConfigs) == EGL_FALSE) {
			printf("eglChooseConfig without FSAA failed!
");
			return 0;
		}
		else
			printf("eglChooseConfig without FSAA OK!
");
		
		if (numOfConfigs == 0) {
			printf("Can't find the requested configuration!
");
			return 0;
		}
	}
	
	eglConfig = configList[0];
	free(configList);

	eglSurface = eglCreateWindowSurface(eglDisplay, eglConfig, (NativeWindowType)0, NULL);
	if (eglSurface == NULL) {
		printf("eglCreateWindowSurface failed
");
		return 0;
	}
	else
		printf("eglCreateWindowSurface OK!
");

	eglContext = eglCreateContext(eglDisplay, eglConfig, EGL_NO_CONTEXT, NULL);
	if (eglContext == NULL) {
		printf("eglCreateContext failed
");
		return 0;
	}
	else
		printf("eglCreateContext OK!
");

	if (eglMakeCurrent(eglDisplay, eglSurface, eglSurface, eglContext) == EGL_FALSE) {
		printf("eglMakeCurrent failed");
		return 0;
	}
	else
		printf("eglMakeCurrent OK!
");
	
	return 1;
}

Turns out the problem was a mixup of different library versions of opengles for mx31…

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.