[PATCH libdrm 09/17] radeon: cleanup bo/cs func tables

Alex Deucher alexdeucher at gmail.com
Mon Aug 24 10:06:27 PDT 2015


On Mon, Aug 24, 2015 at 12:34 PM, Emil Velikov <emil.l.velikov at gmail.com> wrote:
> Annotate the data as static const and use C99 designated initializers.
>
> Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>

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

> ---
>  radeon/radeon_bo_gem.c | 23 ++++++++++++-----------
>  radeon/radeon_bo_int.h |  2 +-
>  radeon/radeon_cs_gem.c | 20 ++++++++++----------
>  radeon/radeon_cs_int.h |  2 +-
>  4 files changed, 24 insertions(+), 23 deletions(-)
>
> diff --git a/radeon/radeon_bo_gem.c b/radeon/radeon_bo_gem.c
> index 7fdd437..c9fe19f 100644
> --- a/radeon/radeon_bo_gem.c
> +++ b/radeon/radeon_bo_gem.c
> @@ -270,17 +270,18 @@ static int bo_get_tiling(struct radeon_bo_int *boi, uint32_t *tiling_flags,
>      return r;
>  }
>
> -static struct radeon_bo_funcs bo_gem_funcs = {
> -    bo_open,
> -    bo_ref,
> -    bo_unref,
> -    bo_map,
> -    bo_unmap,
> -    bo_wait,
> -    NULL,
> -    bo_set_tiling,
> -    bo_get_tiling,
> -    bo_is_busy,
> +static const struct radeon_bo_funcs bo_gem_funcs = {
> +    .bo_open = bo_open,
> +    .bo_ref = bo_ref,
> +    .bo_unref = bo_unref,
> +    .bo_map = bo_map,
> +    .bo_unmap = bo_unmap,
> +    .bo_wait = bo_wait,
> +    .bo_is_static = NULL,
> +    .bo_set_tiling = bo_set_tiling,
> +    .bo_get_tiling = bo_get_tiling,
> +    .bo_is_busy = bo_is_busy,
> +    .bo_is_referenced_by_cs = NULL,
>  };
>
>  struct radeon_bo_manager *radeon_bo_manager_gem_ctor(int fd)
> diff --git a/radeon/radeon_bo_int.h b/radeon/radeon_bo_int.h
> index 9589ead..de981b0 100644
> --- a/radeon/radeon_bo_int.h
> +++ b/radeon/radeon_bo_int.h
> @@ -2,7 +2,7 @@
>  #define RADEON_BO_INT
>
>  struct radeon_bo_manager {
> -    struct radeon_bo_funcs  *funcs;
> +    const struct radeon_bo_funcs *funcs;
>      int                     fd;
>  };
>
> diff --git a/radeon/radeon_cs_gem.c b/radeon/radeon_cs_gem.c
> index 1962e91..cdec64e 100644
> --- a/radeon/radeon_cs_gem.c
> +++ b/radeon/radeon_cs_gem.c
> @@ -514,16 +514,16 @@ static void cs_gem_print(struct radeon_cs_int *cs, FILE *file)
>      }
>  }
>
> -static struct radeon_cs_funcs radeon_cs_gem_funcs = {
> -    cs_gem_create,
> -    cs_gem_write_reloc,
> -    cs_gem_begin,
> -    cs_gem_end,
> -    cs_gem_emit,
> -    cs_gem_destroy,
> -    cs_gem_erase,
> -    cs_gem_need_flush,
> -    cs_gem_print,
> +static const struct radeon_cs_funcs radeon_cs_gem_funcs = {
> +    .cs_create = cs_gem_create,
> +    .cs_write_reloc = cs_gem_write_reloc,
> +    .cs_begin = cs_gem_begin,
> +    .cs_end = cs_gem_end,
> +    .cs_emit = cs_gem_emit,
> +    .cs_destroy = cs_gem_destroy,
> +    .cs_erase = cs_gem_erase,
> +    .cs_need_flush = cs_gem_need_flush,
> +    .cs_print = cs_gem_print,
>  };
>
>  static int radeon_get_device_id(int fd, uint32_t *device_id)
> diff --git a/radeon/radeon_cs_int.h b/radeon/radeon_cs_int.h
> index 6cee574..d906ad4 100644
> --- a/radeon/radeon_cs_int.h
> +++ b/radeon/radeon_cs_int.h
> @@ -58,7 +58,7 @@ struct radeon_cs_funcs {
>  };
>
>  struct radeon_cs_manager {
> -    struct radeon_cs_funcs  *funcs;
> +    const struct radeon_cs_funcs  *funcs;
>      int                     fd;
>      int32_t vram_limit, gart_limit;
>      int32_t vram_write_used, gart_write_used;
> --
> 2.5.0
>
> _______________________________________________
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel


More information about the dri-devel mailing list