[PATCH 6/7] glamor: Mark a bunch of single-file data static.

Alex Deucher alexdeucher at gmail.com
Wed Jul 1 06:57:11 PDT 2015


On Tue, Jun 30, 2015 at 6:58 PM, Eric Anholt <eric at anholt.net> wrote:
> This gives the compiler a chance to optimize when the data is never
> changed -- for example, with pict_format_combine_tab, the compiler
> ends up inlining the 24 bytes of data into just 10 more bytes of code.
>
> Signed-off-by: Eric Anholt <eric at anholt.net>

Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

> ---
>  glamor/glamor_core.c    | 2 +-
>  glamor/glamor_program.c | 8 ++++----
>  glamor/glamor_render.c  | 2 +-
>  3 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/glamor/glamor_core.c b/glamor/glamor_core.c
> index 965024e..7c31b69 100644
> --- a/glamor/glamor_core.c
> +++ b/glamor/glamor_core.c
> @@ -294,7 +294,7 @@ glamor_fini_finish_access_shaders(ScreenPtr screen)
>      glDeleteProgram(glamor_priv->finish_access_prog[1]);
>  }
>
> -GCOps glamor_gc_ops = {
> +static GCOps glamor_gc_ops = {
>      .FillSpans = glamor_fill_spans,
>      .SetSpans = glamor_set_spans,
>      .PutImage = glamor_put_image,
> diff --git a/glamor/glamor_program.c b/glamor/glamor_program.c
> index 1dc5f19..5619216 100644
> --- a/glamor/glamor_program.c
> +++ b/glamor/glamor_program.c
> @@ -499,7 +499,7 @@ use_source_solid(CARD8 op, PicturePtr src, PicturePtr dst, glamor_program *prog)
>      return TRUE;
>  }
>
> -const glamor_facet glamor_source_solid = {
> +static const glamor_facet glamor_source_solid = {
>      .name = "render_solid",
>      .fs_exec = "       vec4 source = fg;\n",
>      .locations = glamor_program_location_fg,
> @@ -517,7 +517,7 @@ use_source_picture(CARD8 op, PicturePtr src, PicturePtr dst, glamor_program *pro
>                                prog->fill_size_inv_uniform);
>  }
>
> -const glamor_facet glamor_source_picture = {
> +static const glamor_facet glamor_source_picture = {
>      .name = "render_picture",
>      .vs_exec =  "       fill_pos = (fill_offset + primitive.xy + pos) * fill_size_inv;\n",
>      .fs_exec =  "       vec4 source = texture2D(sampler, fill_pos);\n",
> @@ -533,14 +533,14 @@ use_source_1x1_picture(CARD8 op, PicturePtr src, PicturePtr dst, glamor_program
>      return glamor_set_texture_pixmap((PixmapPtr) src->pDrawable);
>  }
>
> -const glamor_facet glamor_source_1x1_picture = {
> +static const glamor_facet glamor_source_1x1_picture = {
>      .name = "render_picture",
>      .fs_exec =  "       vec4 source = texture2D(sampler, vec2(0.5));\n",
>      .locations = glamor_program_location_fillsamp,
>      .use_render = use_source_1x1_picture,
>  };
>
> -const glamor_facet *glamor_facet_source[glamor_program_source_count] = {
> +static const glamor_facet *glamor_facet_source[glamor_program_source_count] = {
>      [glamor_program_source_solid] = &glamor_source_solid,
>      [glamor_program_source_picture] = &glamor_source_picture,
>      [glamor_program_source_1x1_picture] = &glamor_source_1x1_picture,
> diff --git a/glamor/glamor_render.c b/glamor/glamor_render.c
> index 0c776af..22480cd 100644
> --- a/glamor/glamor_render.c
> +++ b/glamor/glamor_render.c
> @@ -723,7 +723,7 @@ glamor_flush_composite_rects(ScreenPtr screen)
>      }
>  }
>
> -int pict_format_combine_tab[][3] = {
> +static const int pict_format_combine_tab[][3] = {
>      {PICT_TYPE_ARGB, PICT_TYPE_A, PICT_TYPE_ARGB},
>      {PICT_TYPE_ABGR, PICT_TYPE_A, PICT_TYPE_ABGR},
>  };
> --
> 2.1.4
>
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel


More information about the xorg-devel mailing list