egl: Rename 'count' in ${platform}_add_configs_for_visuals (v2)

Rename 'count' to 'config_count'. I didn't understand what the variable
did until I untangled the for-loops. Now the next person won't have that
problem.

v2: Rebase. Fix typo. Apply to all platforms (for emil).

Reviewed-by: Eric Engestrom <eric@engestrom.ch>  (v1)
This commit is contained in:
Chad Versace
2017-06-22 11:00:41 -07:00
parent a6fad55961
commit ffbf50b1c6
4 changed files with 28 additions and 25 deletions

View File

@@ -1036,7 +1036,7 @@ droid_add_configs_for_visuals(_EGLDriver *drv, _EGLDisplay *dpy)
};
unsigned int format_count[ARRAY_SIZE(visuals)] = { 0 };
int count = 0;
int config_count = 0;
/* The nesting of loops is significant here. Also significant is the order
* of the HAL pixel formats. Many Android apps (such as Google's official
@@ -1070,11 +1070,11 @@ droid_add_configs_for_visuals(_EGLDriver *drv, _EGLDisplay *dpy)
struct dri2_egl_config *dri2_conf =
dri2_add_config(dpy, dri2_dpy->driver_configs[j],
count + 1, surface_type, config_attrs,
config_count + 1, surface_type, config_attrs,
visuals[i].rgba_masks);
if (dri2_conf) {
if (dri2_conf->base.ConfigID == count + 1)
count++;
if (dri2_conf->base.ConfigID == config_count + 1)
config_count++;
format_count[i]++;
}
}
@@ -1087,7 +1087,7 @@ droid_add_configs_for_visuals(_EGLDriver *drv, _EGLDisplay *dpy)
}
}
return (count != 0);
return (config_count != 0);
}
static int

View File

@@ -600,7 +600,7 @@ drm_add_configs_for_visuals(_EGLDriver *drv, _EGLDisplay *disp)
};
unsigned int format_count[ARRAY_SIZE(visuals)] = { 0 };
unsigned int count = 0;
unsigned int config_count = 0;
for (unsigned i = 0; dri2_dpy->driver_configs[i]; i++) {
unsigned int red, alpha;
@@ -622,10 +622,10 @@ drm_add_configs_for_visuals(_EGLDriver *drv, _EGLDisplay *disp)
};
dri2_conf = dri2_add_config(disp, dri2_dpy->driver_configs[i],
count + 1, EGL_WINDOW_BIT, attr_list, NULL);
config_count + 1, EGL_WINDOW_BIT, attr_list, NULL);
if (dri2_conf) {
if (dri2_conf->base.ConfigID == count + 1)
count++;
if (dri2_conf->base.ConfigID == config_count + 1)
config_count++;
format_count[j]++;
}
}
@@ -638,7 +638,7 @@ drm_add_configs_for_visuals(_EGLDriver *drv, _EGLDisplay *disp)
}
}
return (count != 0);
return (config_count != 0);
}
static const struct dri2_egl_display_vtbl dri2_drm_display_vtbl = {

View File

@@ -201,18 +201,19 @@ surfaceless_add_configs_for_visuals(_EGLDriver *drv, _EGLDisplay *dpy)
{ "RGB565", { 0x00f800, 0x07e0, 0x1f, 0x0 } },
};
unsigned int format_count[ARRAY_SIZE(visuals)] = { 0 };
unsigned int count = 0;
unsigned int config_count = 0;
for (unsigned i = 0; dri2_dpy->driver_configs[i] != NULL; i++) {
for (unsigned j = 0; j < ARRAY_SIZE(visuals); j++) {
struct dri2_egl_config *dri2_conf;
dri2_conf = dri2_add_config(dpy, dri2_dpy->driver_configs[i],
count + 1, EGL_PBUFFER_BIT, NULL, visuals[j].rgba_masks);
config_count + 1, EGL_PBUFFER_BIT, NULL,
visuals[j].rgba_masks);
if (dri2_conf) {
if (dri2_conf->base.ConfigID == count + 1)
count++;
if (dri2_conf->base.ConfigID == config_count + 1)
config_count++;
format_count[j]++;
}
}
@@ -225,7 +226,7 @@ surfaceless_add_configs_for_visuals(_EGLDriver *drv, _EGLDisplay *dpy)
}
}
return (count != 0);
return (config_count != 0);
}
static const struct dri2_egl_display_vtbl dri2_surfaceless_display_vtbl = {

View File

@@ -729,7 +729,7 @@ dri2_x11_add_configs_for_visuals(struct dri2_egl_display *dri2_dpy,
{
xcb_depth_iterator_t d;
xcb_visualtype_t *visuals;
int count = 0;
int config_count = 0;
EGLint surface_type;
d = xcb_screen_allowed_depths_iterator(dri2_dpy->screen);
@@ -770,11 +770,12 @@ dri2_x11_add_configs_for_visuals(struct dri2_egl_display *dri2_dpy,
0,
};
dri2_conf = dri2_add_config(disp, config, count + 1, surface_type,
config_attrs, rgba_masks);
dri2_conf = dri2_add_config(disp, config, config_count + 1,
surface_type, config_attrs,
rgba_masks);
if (dri2_conf)
if (dri2_conf->base.ConfigID == count + 1)
count++;
if (dri2_conf->base.ConfigID == config_count + 1)
config_count++;
/* Allow a 24-bit RGB visual to match a 32-bit RGBA EGLConfig.
* Otherwise it will only match a 32-bit RGBA visual. On a
@@ -786,11 +787,12 @@ dri2_x11_add_configs_for_visuals(struct dri2_egl_display *dri2_dpy,
if (d.data->depth == 24) {
rgba_masks[3] =
~(rgba_masks[0] | rgba_masks[1] | rgba_masks[2]);
dri2_conf = dri2_add_config(disp, config, count + 1, surface_type,
config_attrs, rgba_masks);
dri2_conf = dri2_add_config(disp, config, config_count + 1,
surface_type, config_attrs,
rgba_masks);
if (dri2_conf)
if (dri2_conf->base.ConfigID == count + 1)
count++;
if (dri2_conf->base.ConfigID == config_count + 1)
config_count++;
}
}
}
@@ -798,7 +800,7 @@ dri2_x11_add_configs_for_visuals(struct dri2_egl_display *dri2_dpy,
xcb_depth_next(&d);
}
if (!count) {
if (!config_count) {
_eglLog(_EGL_WARNING, "DRI2: failed to create any config");
return EGL_FALSE;
}