From ffbf50b1c67b90c6f45e9128e4ff6ef9c4ac5c29 Mon Sep 17 00:00:00 2001 From: Chad Versace Date: Thu, 22 Jun 2017 11:00:41 -0700 Subject: [PATCH] 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 (v1) --- src/egl/drivers/dri2/platform_android.c | 10 +++++----- src/egl/drivers/dri2/platform_drm.c | 10 +++++----- src/egl/drivers/dri2/platform_surfaceless.c | 11 ++++++----- src/egl/drivers/dri2/platform_x11.c | 22 +++++++++++---------- 4 files changed, 28 insertions(+), 25 deletions(-) diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c index 320ae25f46c..acd45dab4d7 100644 --- a/src/egl/drivers/dri2/platform_android.c +++ b/src/egl/drivers/dri2/platform_android.c @@ -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 diff --git a/src/egl/drivers/dri2/platform_drm.c b/src/egl/drivers/dri2/platform_drm.c index 11928225b99..9b4a942b60f 100644 --- a/src/egl/drivers/dri2/platform_drm.c +++ b/src/egl/drivers/dri2/platform_drm.c @@ -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 = { diff --git a/src/egl/drivers/dri2/platform_surfaceless.c b/src/egl/drivers/dri2/platform_surfaceless.c index d780ce4955c..1091b4febdb 100644 --- a/src/egl/drivers/dri2/platform_surfaceless.c +++ b/src/egl/drivers/dri2/platform_surfaceless.c @@ -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 = { diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c index 16cc31340e0..35612300768 100644 --- a/src/egl/drivers/dri2/platform_x11.c +++ b/src/egl/drivers/dri2/platform_x11.c @@ -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; } -- 2.30.2