glmark2 sorts EGL_BUFFER_SIZE backwards when matching EGL configs
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
glmark2 |
New
|
Undecided
|
Unassigned |
Bug Description
By default, glmark2 initializes its target visual_config_ to 'r=1:g=
I have an OpenGL ES 2.0 system with 7 EGL Configs for EGL_SURFACE_TYPE = WINDOW:
glmark2 will list the configs it finds for an all-zero --visual-config:
$ DISPLAY=:0 glmark2-es2 --validate --debug --visual-config 'r=0:g=
Debug: cfg buf rgb colorbuffer dp st config native support surface sample
Debug: id sz lum r g b a th cl caveat render visid type buf ns
Debug: -------
Debug: 0x9 24 rgb 8 8 8 0 0 0 None false 0x21 0x407 0 0
Debug: 0xa 24 rgb 8 8 8 0 24 8 None false 0x21 0x407 0 0
Debug: 0xb 24 rgb 8 8 8 0 24 8 None false 0x21 0x407 1 4
Debug: 0x1 32 rgb 8 8 8 8 0 0 None false 0x47 0x407 0 0
Debug: 0x2 32 rgb 8 8 8 8 24 0 None false 0x47 0x407 0 0
Debug: 0x3 32 rgb 8 8 8 8 24 8 None false 0x47 0x407 0 0
Debug: 0x4 32 rgb 8 8 8 8 24 8 None false 0x47 0x407 1 4
If I request --visual-config 'alpha=0', the EGL will return all Window EGL Configs with depth buffers:
Debug: cfg buf rgb colorbuffer dp st config native support surface sample
Debug: id sz lum r g b a th cl caveat render visid type buf ns
Debug: -------
Debug: 0xa 24 rgb 8 8 8 0 24 8 None false 0x21 0x407 0 0
Debug: 0xb 24 rgb 8 8 8 0 24 8 None false 0x21 0x407 1 4
Debug: 0x2 32 rgb 8 8 8 8 24 0 None false 0x47 0x407 0 0
Debug: 0x3 32 rgb 8 8 8 8 24 8 None false 0x47 0x407 0 0
Debug: 0x4 32 rgb 8 8 8 8 24 8 None false 0x47 0x407 1 4
Debug:
Debug: Best EGLConfig ID: 0x2
Note that the EGL implementation on this machine (ARM Mali) appears to sort the EGL configurations in the proper sort order (per OpenGL ES 2.0 spec 1.4 [0]). In particular, they are sorted:
(1) in decreasing order of the sum of EGL_RED_SIZE+ EGL_BLUE_SIZE + EGL_GREEN_SIZE (since the requested a=0, the config's EGL_ALPHA_SIZE is not summed). For these configs, this value is alway 24.
(2) in increasing order of EGL_BUFFER_SIZE = EGL_RED_SIZE+ EGL_BLUE_SIZE + EGL_GREEN_SIZE + EGL_ALPHA_SIZE. For these configs, there are 2 24-bit configs, and 3 32-configs.
(3) in increasing order of EGL_CONFIG_ID
[0] http://
So, by EGL sort rules, EGLConfig ID: 0xa is first, however, glmark2 is choosing "Best EGLConfig ID: 0x2". Why?
Well, glmark2 scores all components in [r,g,b,a,d,s,buf] by the with the function GLVisualConfig:
/*
* Reward deeper than requested component values, penalize shallower
* than requested component values. Because the ranges of component
* values vary we use a scaling factor to even them out, so that the
* score for all components ranges from [0,MAXIMUM_
*/
score = scale * (component - target);
Thus, a greater EGL_BUFFER_SIZE is scored higher than a lower one, which is backwards from EGL sort order. The same is true for the depth and stencil components. According to EGL, all three of these attributes are: "Selection Criteria: AtLeast; SortOrder: Smaller".
I think the key here is that glmark2 eschews any configs with a stencil component (because there are no scenes currently that make use of stencil buffers). So, the key line (just a few lines below the excerpt from GLVIsualConfig: :match_ score() you included) is the following:
score += score_component (stencil, target.stencil, 0);
This will add '-1000' to the score for any config that has a stencil component, and thus bump it well down the list of "preferred" configs. If this is causing you problems for other reasons (e.g., the implementation in question exposes other features only in configs with a stencil component), let us know, and we can look into changing it. For your immediate purposes, if you change the '0' to a '1' in that line, you should see the behavior you are asking for.
cheers,
Jesse