Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - eglChooseConfig() do not conforms to OpenGL ES 1.0 specification !: (7 Items)
   
eglChooseConfig() do not conforms to OpenGL ES 1.0 specification !  
This bug is very similar to http://community.qnx.com/sf/discussion/do/listPosts/projects.graphics/discussion.
advanced_graphics.topc6683 and maybe caused by the same code.

OpenGL ES 1.0 specification concerning eglChooseConfig() function says (small example):
EGL_RED_SIZE
Must be followed by a nonnegative minimum size specification. If this value
is zero, the smallest available red buffer is preferred. Otherwise, the largest
available red buffer of at least the minimum size is preferred. The default
value is 0.

The same for BLUE and GREEN and ALPHA.

Default photon video mode is set 640x480 32bpp. I set EGL_RED_SIZE, EGL_GREEN_SIZE, EGL_BLUE_SIZE to 5, 5, 5 and ALPHA 
to EGL_DONT_CARE, but eglChooseConfig() always selects 8,8,8,8 framebuffer configuration, while 5,5,5,1 and 5,6,5,0 
framebuffer configurations are available.

When default photon video is set to 640x480 15bpp (RGBA5551), eglChooseConfig() chooses 5,5,5,1 mode as requested.

This bug can be reproduced in my case using at least devg-tnt and devg-radeon video drivers.
Re: eglChooseConfig() do not conforms to OpenGL ES 1.0 specification !  
PR 66630 filed on your behalf.
Re: eglChooseConfig() do not conforms to OpenGL ES 1.0 specification !  
From the EGL 1.2 spec, section 3.4.1 Querying Configurations, Sorting of EGLConfigs:

"If more than one matching EGLConfig is found, then a list of EGLConfigs
is returned. The list is sorted by proceeding in ascending order of the Sort Priority column of table 3.4."

Special sorting rule #3 sorts by larger total number of "requested" color bits, which is the sum of all color components
 with requested component size not equal  to 0 or EGL_DONT_CARE. This rule takes precedence over rule #4, which sorts by
 smaller buffer sizes.

The paragraph you quoted from the OpenGL ES 1.0 seems to agree with this: "If this value is zero, the smallest available
 red buffer is preferred. Otherwise, the largest available red buffer of at least the minimum size is preferred."

If you want to get configs ordered by increasing buffer size, you should set EGL_RED_SIZE, EGL_GREEN_SIZE, EGL_BLUE_SIZE
, and EGL_ALPHA_SIZE to 0 or EGL_DONT_CARE, (or not set them at all since 0 is the default value,) and set 
EGL_BUFFER_SIZE to 16.
Re: eglChooseConfig() do not conforms to OpenGL ES 1.0 specification !  
I'm talking about exact framebuffer configuration match, when I specify R,G,B,A and BUFFER_SIZE to 5,5,5,1 and 16 
eglChooseConfig() returns 8,8,8,8 and assumes BUFFER_SIZE equal to 32.
Re: eglChooseConfig() do not conforms to OpenGL ES 1.0 specification !  
Just tested. eglChooseConfig() returned two possible configurations, which are differ only in EGL_STENCIL_SIZE 
configuration.

Config ID 8
	EGL_BUFFER_SIZE		32 (0x20)
	EGL_ALPHA_SIZE		8 (0x8)
	EGL_BLUE_SIZE		8 (0x8)
	EGL_GREEN_SIZE		8 (0x8)
	EGL_RED_SIZE		8 (0x8)
	EGL_DEPTH_SIZE		16 (0x10)
	EGL_STENCIL_SIZE		0 (0x0)
	EGL_CONFIG_ID		8 (0x8)
	EGL_LEVEL		0 (0x0)
	EGL_MAX_PBUFFER_HEIGHT		4096 (0x1000)
	EGL_MAX_PBUFFER_PIXELS		16777216 (0x1000000)
	EGL_MAX_PBUFFER_WIDTH		4096 (0x1000)
	EGL_NATIVE_RENDERABLE		1 (0x1)
	EGL_NATIVE_VISUAL_ID		5152 (0x1420)
	EGL_NATIVE_VISUAL_TYPE		12344 (0x3038)
	EGL_SAMPLES		0 (0x0)
	EGL_SAMPLE_BUFFERS		0 (0x0)
	EGL_SURFACE_TYPE		7 (0x7)
	EGL_TRANSPARENT_TYPE		0 (0x0)
	EGL_TRANSPARENT_BLUE_VALUE		0 (0x0)
	EGL_TRANSPARENT_GREEN_VALUE		0 (0x0)
	EGL_TRANSPARENT_RED_VALUE		0 (0x0)
	EGL_CONFIG_CAVEAT		EGL_SLOW_CONFIG

Config ID 16
	EGL_BUFFER_SIZE		32 (0x20)
	EGL_ALPHA_SIZE		8 (0x8)
	EGL_BLUE_SIZE		8 (0x8)
	EGL_GREEN_SIZE		8 (0x8)
	EGL_RED_SIZE		8 (0x8)
	EGL_DEPTH_SIZE		16 (0x10)
	EGL_STENCIL_SIZE		16 (0x10)
	EGL_CONFIG_ID		16 (0x10)
	EGL_LEVEL		0 (0x0)
	EGL_MAX_PBUFFER_HEIGHT		4096 (0x1000)
	EGL_MAX_PBUFFER_PIXELS		16777216 (0x1000000)
	EGL_MAX_PBUFFER_WIDTH		4096 (0x1000)
	EGL_NATIVE_RENDERABLE		1 (0x1)
	EGL_NATIVE_VISUAL_ID		5152 (0x1420)
	EGL_NATIVE_VISUAL_TYPE		12344 (0x3038)
	EGL_SAMPLES		0 (0x0)
	EGL_SAMPLE_BUFFERS		0 (0x0)
	EGL_SURFACE_TYPE		7 (0x7)
	EGL_TRANSPARENT_TYPE		0 (0x0)
	EGL_TRANSPARENT_BLUE_VALUE		0 (0x0)
	EGL_TRANSPARENT_GREEN_VALUE		0 (0x0)
	EGL_TRANSPARENT_RED_VALUE		0 (0x0)
	EGL_CONFIG_CAVEAT		EGL_SLOW_CONFIG

As I said before this problem looks very similar to gf_layer_query() problem with enumerating possible pixel formats. 
All results are depend on current graphics mode pixel bit depth.
Re: eglChooseConfig() do not conforms to OpenGL ES 1.0 specification !  
This seems like a problem with the graphics driver, not with eglChooseConfigs per say. Certain drivers only export 
formats that match the current video mode. That's why you are only getting RGBA8888 configs when your video mode is 
32bpp. I don't know if there is a technical justification for that other than that's how the driver was made.
Re: eglChooseConfig() do not conforms to OpenGL ES 1.0 specification !  
> This seems like a problem with the graphics driver, not with eglChooseConfigs 
> per say. Certain drivers only export formats that match the current video mode
> . That's why you are only getting RGBA8888 configs when your video mode is 
> 32bpp. I don't know if there is a technical justification for that other than 
> that's how the driver was made.

No this is not quite correct. Current video mode could be 5551 or 565, but eglChooseConfig() returns only 8888 
framebuffer formats. Because this pixel format is set in /etc/system/config/display.conf.

Do I need to say what will happen if current mode is 565, but 8888 framebuffer configuration only is selected by 
eglChooseConfig() ? :)

Looks like the same problem with glTexImage2D() ... All loaded textures with differ BPP looks like a garbage...