[Mesa-dev] [PATCH 3/5] util: s/unsigned/enum pipe_resource_usage/ for buffer usage variables

Marek Olšák maraeo at gmail.com
Thu May 26 14:57:40 UTC 2016


Reviewed-by: Marek Olšák <marek.olsak at amd.com>

Marek

On Thu, May 26, 2016 at 4:09 PM, Brian Paul <brianp at vmware.com> wrote:
> ---
>  src/gallium/auxiliary/util/u_debug.c      | 2 +-
>  src/gallium/auxiliary/util/u_debug.h      | 2 +-
>  src/gallium/auxiliary/util/u_inlines.h    | 6 +++---
>  src/gallium/auxiliary/util/u_staging.c    | 2 +-
>  src/gallium/auxiliary/util/u_staging.h    | 2 +-
>  src/gallium/auxiliary/util/u_suballoc.c   | 5 +++--
>  src/gallium/auxiliary/util/u_suballoc.h   | 3 ++-
>  src/gallium/auxiliary/util/u_upload_mgr.c | 4 ++--
>  src/gallium/auxiliary/util/u_upload_mgr.h | 2 +-
>  9 files changed, 15 insertions(+), 13 deletions(-)
>
> diff --git a/src/gallium/auxiliary/util/u_debug.c b/src/gallium/auxiliary/util/u_debug.c
> index db66357..0d63cfe 100644
> --- a/src/gallium/auxiliary/util/u_debug.c
> +++ b/src/gallium/auxiliary/util/u_debug.c
> @@ -550,7 +550,7 @@ debug_print_bind_flags(const char *msg, unsigned usage)
>   * Print PIPE_USAGE_x enum values with a message.
>   */
>  void
> -debug_print_usage_enum(const char *msg, unsigned usage)
> +debug_print_usage_enum(const char *msg, enum pipe_resource_usage usage)
>  {
>     static const struct debug_named_value names[] = {
>        DEBUG_NAMED_VALUE(PIPE_USAGE_DEFAULT),
> diff --git a/src/gallium/auxiliary/util/u_debug.h b/src/gallium/auxiliary/util/u_debug.h
> index 85d0cb6..7da7f53 100644
> --- a/src/gallium/auxiliary/util/u_debug.h
> +++ b/src/gallium/auxiliary/util/u_debug.h
> @@ -473,7 +473,7 @@ void
>  debug_print_bind_flags(const char *msg, unsigned usage);
>
>  void
> -debug_print_usage_enum(const char *msg, unsigned usage);
> +debug_print_usage_enum(const char *msg, enum pipe_resource_usage usage);
>
>
>  #ifdef __cplusplus
> diff --git a/src/gallium/auxiliary/util/u_inlines.h b/src/gallium/auxiliary/util/u_inlines.h
> index 07c058a..a38223c 100644
> --- a/src/gallium/auxiliary/util/u_inlines.h
> +++ b/src/gallium/auxiliary/util/u_inlines.h
> @@ -230,12 +230,12 @@ pipe_surface_equal(struct pipe_surface *s1, struct pipe_surface *s2)
>  /**
>   * Create a new resource.
>   * \param bind  bitmask of PIPE_BIND_x flags
> - * \param usage  bitmask of PIPE_USAGE_x flags
> + * \param usage  a PIPE_USAGE_x value
>   */
>  static inline struct pipe_resource *
>  pipe_buffer_create( struct pipe_screen *screen,
>                     unsigned bind,
> -                   unsigned usage,
> +                   enum pipe_resource_usage usage,
>                     unsigned size )
>  {
>     struct pipe_resource buffer;
> @@ -395,7 +395,7 @@ pipe_buffer_write_nooverlap(struct pipe_context *pipe,
>  static inline struct pipe_resource *
>  pipe_buffer_create_with_data(struct pipe_context *pipe,
>                               unsigned bind,
> -                             unsigned usage,
> +                             enum pipe_resource_usage usage,
>                               unsigned size,
>                               const void *ptr)
>  {
> diff --git a/src/gallium/auxiliary/util/u_staging.c b/src/gallium/auxiliary/util/u_staging.c
> index caef2a8..5b61f5e 100644
> --- a/src/gallium/auxiliary/util/u_staging.c
> +++ b/src/gallium/auxiliary/util/u_staging.c
> @@ -56,7 +56,7 @@ util_staging_resource_template(struct pipe_resource *pt, unsigned width,
>  struct util_staging_transfer *
>  util_staging_transfer_init(struct pipe_context *pipe,
>                             struct pipe_resource *pt,
> -                           unsigned level, unsigned usage,
> +                           unsigned level, enum pipe_resource_usage usage,
>                             const struct pipe_box *box,
>                             boolean direct, struct util_staging_transfer *tx)
>  {
> diff --git a/src/gallium/auxiliary/util/u_staging.h b/src/gallium/auxiliary/util/u_staging.h
> index 6c468aa..eed5584 100644
> --- a/src/gallium/auxiliary/util/u_staging.h
> +++ b/src/gallium/auxiliary/util/u_staging.h
> @@ -56,7 +56,7 @@ struct util_staging_transfer {
>  struct util_staging_transfer *
>  util_staging_transfer_init(struct pipe_context *pipe,
>                             struct pipe_resource *pt,
> -                           unsigned level, unsigned usage,
> +                           unsigned level, enum pipe_resource_usage usage,
>                             const struct pipe_box *box,
>                             boolean direct, struct util_staging_transfer *tx);
>
> diff --git a/src/gallium/auxiliary/util/u_suballoc.c b/src/gallium/auxiliary/util/u_suballoc.c
> index efa9a0c..3f9ede0 100644
> --- a/src/gallium/auxiliary/util/u_suballoc.c
> +++ b/src/gallium/auxiliary/util/u_suballoc.c
> @@ -43,7 +43,7 @@ struct u_suballocator {
>     unsigned size;          /* Size of the whole buffer, in bytes. */
>     unsigned alignment;     /* Alignment of each sub-allocation. */
>     unsigned bind;          /* Bitmask of PIPE_BIND_* flags. */
> -   unsigned usage;         /* One of PIPE_USAGE_* flags. */
> +   enum pipe_resource_usage usage;
>     boolean zero_buffer_memory; /* If the buffer contents should be zeroed. */
>
>     struct pipe_resource *buffer;   /* The buffer we suballocate from. */
> @@ -59,7 +59,8 @@ struct u_suballocator {
>   */
>  struct u_suballocator *
>  u_suballocator_create(struct pipe_context *pipe, unsigned size,
> -                      unsigned alignment, unsigned bind, unsigned usage,
> +                      unsigned alignment, unsigned bind,
> +                      enum pipe_resource_usage usage,
>                       boolean zero_buffer_memory)
>  {
>     struct u_suballocator *allocator = CALLOC_STRUCT(u_suballocator);
> diff --git a/src/gallium/auxiliary/util/u_suballoc.h b/src/gallium/auxiliary/util/u_suballoc.h
> index 1f5550f..5f9ccde 100644
> --- a/src/gallium/auxiliary/util/u_suballoc.h
> +++ b/src/gallium/auxiliary/util/u_suballoc.h
> @@ -35,7 +35,8 @@ struct u_suballocator;
>
>  struct u_suballocator *
>  u_suballocator_create(struct pipe_context *pipe, unsigned size,
> -                      unsigned alignment, unsigned bind, unsigned usage,
> +                      unsigned alignment, unsigned bind,
> +                      enum pipe_resource_usage usage,
>                       boolean zero_buffer_memory);
>
>  void
> diff --git a/src/gallium/auxiliary/util/u_upload_mgr.c b/src/gallium/auxiliary/util/u_upload_mgr.c
> index aa31ef2..cfef1f0 100644
> --- a/src/gallium/auxiliary/util/u_upload_mgr.c
> +++ b/src/gallium/auxiliary/util/u_upload_mgr.c
> @@ -43,7 +43,7 @@ struct u_upload_mgr {
>
>     unsigned default_size;  /* Minimum size of the upload buffer, in bytes. */
>     unsigned bind;          /* Bitmask of PIPE_BIND_* flags. */
> -   unsigned usage;         /* PIPE_USAGE_* */
> +   enum pipe_resource_usage usage;
>     unsigned map_flags;     /* Bitmask of PIPE_TRANSFER_* flags. */
>     boolean map_persistent; /* If persistent mappings are supported. */
>
> @@ -57,7 +57,7 @@ struct u_upload_mgr {
>
>  struct u_upload_mgr *
>  u_upload_create(struct pipe_context *pipe, unsigned default_size,
> -                unsigned bind, unsigned usage)
> +                unsigned bind, enum pipe_resource_usage usage)
>  {
>     struct u_upload_mgr *upload = CALLOC_STRUCT( u_upload_mgr );
>     if (!upload)
> diff --git a/src/gallium/auxiliary/util/u_upload_mgr.h b/src/gallium/auxiliary/util/u_upload_mgr.h
> index 1d933d7..6c70723 100644
> --- a/src/gallium/auxiliary/util/u_upload_mgr.h
> +++ b/src/gallium/auxiliary/util/u_upload_mgr.h
> @@ -48,7 +48,7 @@ struct pipe_resource;
>   */
>  struct u_upload_mgr *
>  u_upload_create(struct pipe_context *pipe, unsigned default_size,
> -                unsigned bind, unsigned usage);
> +                unsigned bind, enum pipe_resource_usage usage);
>
>  /**
>   * Destroy the upload manager.
> --
> 1.9.1
>
> _______________________________________________
> 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