[Mesa-dev] [PATCH 1/9] egl/dri2: Factor out context attribute initialization

Eric Engestrom eric.engestrom at imgtec.com
Fri Nov 3 13:23:25 UTC 2017


On Thursday, 2017-11-02 15:01:40 -0400, Adam Jackson wrote:
> Signed-off-by: Adam Jackson <ajax at redhat.com>
> ---
>  src/egl/drivers/dri2/egl_dri2.c | 35 +++++++++--------------------------
>  1 file changed, 9 insertions(+), 26 deletions(-)
> 
> diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
> index 503450542e..57226f60a7 100644
> --- a/src/egl/drivers/dri2/egl_dri2.c
> +++ b/src/egl/drivers/dri2/egl_dri2.c
> @@ -1247,6 +1247,9 @@ dri2_create_context(_EGLDriver *drv, _EGLDisplay *disp, _EGLConfig *conf,
>     struct dri2_egl_config *dri2_config = dri2_egl_config(conf);
>     const __DRIconfig *dri_config;
>     int api;
> +   unsigned error;
> +   unsigned num_attribs = NUM_ATTRIBS;
> +   uint32_t ctx_attribs[NUM_ATTRIBS];
>  
>     (void) drv;
>  
> @@ -1339,15 +1342,11 @@ dri2_create_context(_EGLDriver *drv, _EGLDisplay *disp, _EGLConfig *conf,
>     else
>        dri_config = NULL;
>  
> +   if (!dri2_fill_context_attribs(dri2_ctx, dri2_dpy, ctx_attribs,
> +				  &num_attribs))
> +      goto cleanup;

Stray tab, and indent is 3 spaces in mesa (install/turn on editorconfig
in your editor for the formatting to be automatically handled)

> +
>     if (dri2_dpy->image_driver) {
> -      unsigned error;
> -      unsigned num_attribs = NUM_ATTRIBS;
> -      uint32_t ctx_attribs[NUM_ATTRIBS];
> -
> -      if (!dri2_fill_context_attribs(dri2_ctx, dri2_dpy, ctx_attribs,
> -                                        &num_attribs))
> -         goto cleanup;
> -
>        dri2_ctx->dri_context =
>           dri2_dpy->image_driver->createContextAttribs(dri2_dpy->dri_screen,
>                                                        api,
> @@ -1360,16 +1359,8 @@ dri2_create_context(_EGLDriver *drv, _EGLDisplay *disp, _EGLConfig *conf,
>        dri2_create_context_attribs_error(error);
>     } else if (dri2_dpy->dri2) {
>        if (dri2_dpy->dri2->base.version >= 3) {
> -         unsigned error;
> -         unsigned num_attribs = NUM_ATTRIBS;
> -         uint32_t ctx_attribs[NUM_ATTRIBS];
> -
> -         if (!dri2_fill_context_attribs(dri2_ctx, dri2_dpy, ctx_attribs,
> -                                        &num_attribs))
> -            goto cleanup;
> -
> -         dri2_ctx->dri_context =
> -            dri2_dpy->dri2->createContextAttribs(dri2_dpy->dri_screen,
> +	 dri2_ctx->dri_context =
> +	    dri2_dpy->dri2->createContextAttribs(dri2_dpy->dri_screen,

These last two lines didn't need reindenting (and this introduces stray
tabs).

With these nits fixed,
Reviewed-by: Eric Engestrom <eric.engestrom at imgtec.com>

>                                                   api,
>                                                   dri_config,
>                                                   shared,
> @@ -1389,14 +1380,6 @@ dri2_create_context(_EGLDriver *drv, _EGLDisplay *disp, _EGLConfig *conf,
>     } else {
>        assert(dri2_dpy->swrast);
>        if (dri2_dpy->swrast->base.version >= 3) {
> -         unsigned error;
> -         unsigned num_attribs = NUM_ATTRIBS;
> -         uint32_t ctx_attribs[NUM_ATTRIBS];
> -
> -         if (!dri2_fill_context_attribs(dri2_ctx, dri2_dpy, ctx_attribs,
> -                                        &num_attribs))
> -            goto cleanup;
> -
>           dri2_ctx->dri_context =
>              dri2_dpy->swrast->createContextAttribs(dri2_dpy->dri_screen,
>                                                     api,
> -- 
> 2.14.3
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list