[Mesa-dev] [PATCH 09/10] egl/drm: Declare EGLConfig attrib array inside loop
Eric Engestrom
eric at engestrom.ch
Thu Jun 22 18:34:24 UTC 2017
On 22 June 2017 19:10:55 BST, Chad Versace <chadversary at chromium.org> wrote:
> No behavioral change. Just a readability cleanup.
>
> Instead of modifying this small array on each loop iteration, we now
> initialize it in-place with the values it needs.
>
> Cc: Eric Engestrom <eric at engestrom.ch>
> Cc: Emil Velikov <emil.velikov at collabora.com>
> ---
> src/egl/drivers/dri2/platform_x11.c | 24 ++++++++++++------------
> 1 file changed, 12 insertions(+), 12 deletions(-)
>
> diff --git a/src/egl/drivers/dri2/platform_x11.c
> b/src/egl/drivers/dri2/platform_x11.c
> index 2a19cdcc746..16cc31340e0 100644
> --- a/src/egl/drivers/dri2/platform_x11.c
> +++ b/src/egl/drivers/dri2/platform_x11.c
> @@ -730,13 +730,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;
> - unsigned int rgba_masks[4];
> EGLint surface_type;
> - EGLint config_attrs[] = {
> - EGL_NATIVE_VISUAL_ID, 0,
> - EGL_NATIVE_VISUAL_TYPE, 0,
> - EGL_NONE
> - };
>
> d = xcb_screen_allowed_depths_iterator(dri2_dpy->screen);
>
> @@ -763,13 +757,19 @@ dri2_x11_add_configs_for_visuals(struct
> dri2_egl_display *dri2_dpy,
> struct dri2_egl_config *dri2_conf;
> const __DRIconfig *config = dri2_dpy->driver_configs[j];
>
> - config_attrs[1] = visuals[i].visual_id;
> - config_attrs[3] = visuals[i]._class;
> + const EGLint config_attrs[] = {
> + EGL_NATIVE_VISUAL_ID, visuals[i].visual_id,
> + EGL_NATIVE_VISUAL_TYPE, visuals[i]._class,
> + EGL_NONE
> + };
> +
> + unsigned int rgba_masks[4] = {
> + visuals[i].red_mask,
> + visuals[i].green_mask,
> + visuals[i].blue_mask,
> + 0,
> + };
>
> - rgba_masks[0] = visuals[i].red_mask;
> - rgba_masks[1] = visuals[i].green_mask;
> - rgba_masks[2] = visuals[i].blue_mask;
> - rgba_masks[3] = 0;
> dri2_conf = dri2_add_config(disp, config, count + 1, surface_type,
> config_attrs, rgba_masks);
> if (dri2_conf)
s/drm/x11/ in the subject
More information about the mesa-dev
mailing list