[Mesa-dev] [PATCH] pb_buffer: inline 'base' sub-struct

Jose Fonseca jfonseca at vmware.com
Mon Sep 12 04:21:25 PDT 2011


I didn't look at the diff in detail, but I'm fine with removing the inner struct.

Jose

----- Original Message -----
> ---
>  src/gallium/auxiliary/pipebuffer/pb_buffer.h       |   24
>  ++++++--------
>  .../auxiliary/pipebuffer/pb_buffer_fenced.c        |   32
>  ++++++++++----------
>  .../auxiliary/pipebuffer/pb_buffer_malloc.c        |    8 ++--
>  src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c |   30
>  +++++++++---------
>  src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c |   30
>  +++++++++---------
>  src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c    |   10 +++---
>  .../auxiliary/pipebuffer/pb_bufmgr_ondemand.c      |    8 ++--
>  src/gallium/auxiliary/pipebuffer/pb_bufmgr_pool.c  |   18 +++++-----
>  src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c  |   18 +++++-----
>  src/gallium/winsys/r600/drm/r600_hw_context.c      |    2 +-
>  src/gallium/winsys/radeon/drm/radeon_drm_bo.c      |   18 +++++-----
>  src/gallium/winsys/svga/drm/vmw_buffer.c           |    8 ++--
>  src/gallium/winsys/svga/drm/vmw_context.c          |    2 +-
>  13 files changed, 102 insertions(+), 106 deletions(-)
> 
> diff --git a/src/gallium/auxiliary/pipebuffer/pb_buffer.h
> b/src/gallium/auxiliary/pipebuffer/pb_buffer.h
> index 5a13f39..a5ec93c 100644
> --- a/src/gallium/auxiliary/pipebuffer/pb_buffer.h
> +++ b/src/gallium/auxiliary/pipebuffer/pb_buffer.h
> @@ -97,14 +97,10 @@ typedef unsigned pb_size;
>   */
>  struct pb_buffer
>  {
> -   /* This used to be a pipe_buffer struct:
> -    */
> -   struct {
> -      struct pipe_reference  reference;
> -      unsigned               size;
> -      unsigned               alignment;
> -      unsigned               usage;
> -   } base;
> +   struct pipe_reference  reference;
> +   unsigned               size;
> +   unsigned               alignment;
> +   unsigned               usage;
>  
>     /**
>      * Pointer to the virtual function table.
> @@ -169,7 +165,7 @@ pb_map(struct pb_buffer *buf,
>     assert(buf);
>     if(!buf)
>        return NULL;
> -   assert(pipe_is_referenced(&buf->base.reference));
> +   assert(pipe_is_referenced(&buf->reference));
>     return buf->vtbl->map(buf, flags, flush_ctx);
>  }
>  
> @@ -180,7 +176,7 @@ pb_unmap(struct pb_buffer *buf)
>     assert(buf);
>     if(!buf)
>        return;
> -   assert(pipe_is_referenced(&buf->base.reference));
> +   assert(pipe_is_referenced(&buf->reference));
>     buf->vtbl->unmap(buf);
>  }
>  
> @@ -196,11 +192,11 @@ pb_get_base_buffer( struct pb_buffer *buf,
>        offset = 0;
>        return;
>     }
> -   assert(pipe_is_referenced(&buf->base.reference));
> +   assert(pipe_is_referenced(&buf->reference));
>     assert(buf->vtbl->get_base_buffer);
>     buf->vtbl->get_base_buffer(buf, base_buf, offset);
>     assert(*base_buf);
> -   assert(*offset < (*base_buf)->base.size);
> +   assert(*offset < (*base_buf)->size);
>  }
>  
>  
> @@ -232,7 +228,7 @@ pb_destroy(struct pb_buffer *buf)
>     assert(buf);
>     if(!buf)
>        return;
> -   assert(!pipe_is_referenced(&buf->base.reference));
> +   assert(!pipe_is_referenced(&buf->reference));
>     buf->vtbl->destroy(buf);
>  }
>  
> @@ -242,7 +238,7 @@ pb_reference(struct pb_buffer **dst,
>  {
>     struct pb_buffer *old = *dst;
>  
> -   if (pipe_reference(&(*dst)->base.reference,
> &src->base.reference))
> +   if (pipe_reference(&(*dst)->reference, &src->reference))
>        pb_destroy( old );
>     *dst = src;
>  }
> diff --git a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c
> b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c
> index c310f28..9e0cace 100644
> --- a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c
> +++ b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c
> @@ -210,8 +210,8 @@ fenced_manager_dump_locked(struct fenced_manager
> *fenced_mgr)
>        assert(!fenced_buf->fence);
>        debug_printf("%10p %7u %8u %7s\n",
>                     (void *) fenced_buf,
> -                   fenced_buf->base.base.size,
> -
>                   p_atomic_read(&fenced_buf->base.base.reference.count),
> +                   fenced_buf->base.size,
> +                   p_atomic_read(&fenced_buf->base.reference.count),
>                     fenced_buf->buffer ? "gpu" : (fenced_buf->data ?
>                     "cpu" : "none"));
>        curr = next;
>        next = curr->next;
> @@ -226,8 +226,8 @@ fenced_manager_dump_locked(struct fenced_manager
> *fenced_mgr)
>        signaled = ops->fence_signalled(ops, fenced_buf->fence, 0);
>        debug_printf("%10p %7u %8u %7s %10p %s\n",
>                     (void *) fenced_buf,
> -                   fenced_buf->base.base.size,
> -
>                   p_atomic_read(&fenced_buf->base.base.reference.count),
> +                   fenced_buf->base.size,
> +                   p_atomic_read(&fenced_buf->base.reference.count),
>                     "gpu",
>                     (void *) fenced_buf->fence,
>                     signaled == 0 ? "y" : "n");
> @@ -244,7 +244,7 @@ static INLINE void
>  fenced_buffer_destroy_locked(struct fenced_manager *fenced_mgr,
>                               struct fenced_buffer *fenced_buf)
>  {
> -   assert(!pipe_is_referenced(&fenced_buf->base.base.reference));
> +   assert(!pipe_is_referenced(&fenced_buf->base.reference));
>  
>     assert(!fenced_buf->fence);
>     assert(fenced_buf->head.prev);
> @@ -269,11 +269,11 @@ static INLINE void
>  fenced_buffer_add_locked(struct fenced_manager *fenced_mgr,
>                           struct fenced_buffer *fenced_buf)
>  {
> -   assert(pipe_is_referenced(&fenced_buf->base.base.reference));
> +   assert(pipe_is_referenced(&fenced_buf->base.reference));
>     assert(fenced_buf->flags & PB_USAGE_GPU_READ_WRITE);
>     assert(fenced_buf->fence);
>  
> -   p_atomic_inc(&fenced_buf->base.base.reference.count);
> +   p_atomic_inc(&fenced_buf->base.reference.count);
>  
>     LIST_DEL(&fenced_buf->head);
>     assert(fenced_mgr->num_unfenced);
> @@ -311,7 +311,7 @@ fenced_buffer_remove_locked(struct fenced_manager
> *fenced_mgr,
>     LIST_ADDTAIL(&fenced_buf->head, &fenced_mgr->unfenced);
>     ++fenced_mgr->num_unfenced;
>  
> -   if (p_atomic_dec_zero(&fenced_buf->base.base.reference.count)) {
> +   if (p_atomic_dec_zero(&fenced_buf->base.reference.count)) {
>        fenced_buffer_destroy_locked(fenced_mgr, fenced_buf);
>        return TRUE;
>     }
> @@ -337,7 +337,7 @@ fenced_buffer_finish_locked(struct fenced_manager
> *fenced_mgr,
>     debug_warning("waiting for GPU");
>  #endif
>  
> -   assert(pipe_is_referenced(&fenced_buf->base.base.reference));
> +   assert(pipe_is_referenced(&fenced_buf->base.reference));
>     assert(fenced_buf->fence);
>  
>     if(fenced_buf->fence) {
> @@ -353,7 +353,7 @@ fenced_buffer_finish_locked(struct fenced_manager
> *fenced_mgr,
>  
>        pipe_mutex_lock(fenced_mgr->mutex);
>  
> -      assert(pipe_is_referenced(&fenced_buf->base.base.reference));
> +      assert(pipe_is_referenced(&fenced_buf->base.reference));
>  
>        /*
>         * Only proceed if the fence object didn't change in the
>         meanwhile.
> @@ -662,7 +662,7 @@ fenced_buffer_destroy(struct pb_buffer *buf)
>     struct fenced_buffer *fenced_buf = fenced_buffer(buf);
>     struct fenced_manager *fenced_mgr = fenced_buf->mgr;
>  
> -   assert(!pipe_is_referenced(&fenced_buf->base.base.reference));
> +   assert(!pipe_is_referenced(&fenced_buf->base.reference));
>  
>     pipe_mutex_lock(fenced_mgr->mutex);
>  
> @@ -837,7 +837,7 @@ fenced_buffer_fence(struct pb_buffer *buf,
>  
>     pipe_mutex_lock(fenced_mgr->mutex);
>  
> -   assert(pipe_is_referenced(&fenced_buf->base.base.reference));
> +   assert(pipe_is_referenced(&fenced_buf->base.reference));
>     assert(fenced_buf->buffer);
>  
>     if(fence != fenced_buf->fence) {
> @@ -929,10 +929,10 @@ fenced_bufmgr_create_buffer(struct pb_manager
> *mgr,
>     if(!fenced_buf)
>        goto no_buffer;
>  
> -   pipe_reference_init(&fenced_buf->base.base.reference, 1);
> -   fenced_buf->base.base.alignment = desc->alignment;
> -   fenced_buf->base.base.usage = desc->usage;
> -   fenced_buf->base.base.size = size;
> +   pipe_reference_init(&fenced_buf->base.reference, 1);
> +   fenced_buf->base.alignment = desc->alignment;
> +   fenced_buf->base.usage = desc->usage;
> +   fenced_buf->base.size = size;
>     fenced_buf->size = size;
>     fenced_buf->desc = *desc;
>  
> diff --git a/src/gallium/auxiliary/pipebuffer/pb_buffer_malloc.c
> b/src/gallium/auxiliary/pipebuffer/pb_buffer_malloc.c
> index 5754f47..b106a1a 100644
> --- a/src/gallium/auxiliary/pipebuffer/pb_buffer_malloc.c
> +++ b/src/gallium/auxiliary/pipebuffer/pb_buffer_malloc.c
> @@ -135,10 +135,10 @@ pb_malloc_buffer_create(pb_size size,
>     if(!buf)
>        return NULL;
>  
> -   pipe_reference_init(&buf->base.base.reference, 1);
> -   buf->base.base.usage = desc->usage;
> -   buf->base.base.size = size;
> -   buf->base.base.alignment = desc->alignment;
> +   pipe_reference_init(&buf->base.reference, 1);
> +   buf->base.usage = desc->usage;
> +   buf->base.size = size;
> +   buf->base.alignment = desc->alignment;
>     buf->base.vtbl = &malloc_buffer_vtbl;
>  
>     buf->data = align_malloc(size, desc->alignment < sizeof(void*) ?
>     sizeof(void*) : desc->alignment);
> diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c
> b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c
> index 25accef..58721c0 100644
> --- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c
> +++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c
> @@ -112,7 +112,7 @@ _pb_cache_buffer_destroy(struct pb_cache_buffer
> *buf)
>     LIST_DEL(&buf->head);
>     assert(mgr->numDelayed);
>     --mgr->numDelayed;
> -   assert(!pipe_is_referenced(&buf->base.base.reference));
> +   assert(!pipe_is_referenced(&buf->base.reference));
>     pb_reference(&buf->buffer, NULL);
>     FREE(buf);
>  }
> @@ -153,7 +153,7 @@ pb_cache_buffer_destroy(struct pb_buffer *_buf)
>     struct pb_cache_manager *mgr = buf->mgr;
>  
>     pipe_mutex_lock(mgr->mutex);
> -   assert(!pipe_is_referenced(&buf->base.base.reference));
> +   assert(!pipe_is_referenced(&buf->base.reference));
>     
>     _pb_cache_buffer_list_check_free(mgr);
>     
> @@ -227,17 +227,17 @@ pb_cache_is_buffer_compat(struct
> pb_cache_buffer *buf,
>                            pb_size size,
>                            const struct pb_desc *desc)
>  {
> -   if(buf->base.base.size < size)
> +   if(buf->base.size < size)
>        return 0;
>  
>     /* be lenient with size */
> -   if(buf->base.base.size >= 2*size)
> +   if(buf->base.size >= 2*size)
>        return 0;
>     
> -   if(!pb_check_alignment(desc->alignment,
> buf->base.base.alignment))
> +   if(!pb_check_alignment(desc->alignment, buf->base.alignment))
>        return 0;
>     
> -   if(!pb_check_usage(desc->usage, buf->base.base.usage))
> +   if(!pb_check_usage(desc->usage, buf->base.usage))
>        return 0;
>  
>     if (buf->mgr->provider->is_buffer_busy) {
> @@ -313,7 +313,7 @@ pb_cache_manager_create_buffer(struct pb_manager
> *_mgr,
>        --mgr->numDelayed;
>        pipe_mutex_unlock(mgr->mutex);
>        /* Increase refcount */
> -      pipe_reference_init(&buf->base.base.reference, 1);
> +      pipe_reference_init(&buf->base.reference, 1);
>        return &buf->base;
>     }
>     
> @@ -329,15 +329,15 @@ pb_cache_manager_create_buffer(struct
> pb_manager *_mgr,
>        return NULL;
>     }
>     
> -   assert(pipe_is_referenced(&buf->buffer->base.reference));
> -   assert(pb_check_alignment(desc->alignment,
> buf->buffer->base.alignment));
> -   assert(pb_check_usage(desc->usage, buf->buffer->base.usage));
> -   assert(buf->buffer->base.size >= size);
> +   assert(pipe_is_referenced(&buf->buffer->reference));
> +   assert(pb_check_alignment(desc->alignment,
> buf->buffer->alignment));
> +   assert(pb_check_usage(desc->usage, buf->buffer->usage));
> +   assert(buf->buffer->size >= size);
>     
> -   pipe_reference_init(&buf->base.base.reference, 1);
> -   buf->base.base.alignment = buf->buffer->base.alignment;
> -   buf->base.base.usage = buf->buffer->base.usage;
> -   buf->base.base.size = buf->buffer->base.size;
> +   pipe_reference_init(&buf->base.reference, 1);
> +   buf->base.alignment = buf->buffer->alignment;
> +   buf->base.usage = buf->buffer->usage;
> +   buf->base.size = buf->buffer->size;
>     
>     buf->base.vtbl = &pb_cache_buffer_vtbl;
>     buf->mgr = mgr;
> diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c
> b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c
> index 7604e75..b923735 100644
> --- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c
> +++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c
> @@ -162,7 +162,7 @@ pb_debug_buffer_fill(struct pb_debug_buffer *buf)
>     assert(map);
>     if(map) {
>        fill_random_pattern(map, buf->underflow_size);
> -      fill_random_pattern(map + buf->underflow_size +
> buf->base.base.size,
> +      fill_random_pattern(map + buf->underflow_size +
> buf->base.size,
>                            buf->overflow_size);
>        pb_unmap(buf->buffer);
>     }
> @@ -196,12 +196,12 @@ pb_debug_buffer_check(struct pb_debug_buffer
> *buf)
>                        buf->underflow_size - max_ofs);
>        }
>        
> -      overflow = !check_random_pattern(map + buf->underflow_size +
> buf->base.base.size,
> +      overflow = !check_random_pattern(map + buf->underflow_size +
> buf->base.size,
>                                         buf->overflow_size,
>                                         &min_ofs, &max_ofs);
>        if(overflow) {
>           debug_printf("buffer overflow (size %u plus offset %u to
>           %u%s bytes) detected\n",
> -                      buf->base.base.size,
> +                      buf->base.size,
>                        min_ofs,
>                        max_ofs,
>                        max_ofs == buf->overflow_size - 1 ? "+" : "");
> @@ -216,7 +216,7 @@ pb_debug_buffer_check(struct pb_debug_buffer
> *buf)
>        if(underflow)
>           fill_random_pattern(map, buf->underflow_size);
>        if(overflow)
> -         fill_random_pattern(map + buf->underflow_size +
> buf->base.base.size,
> +         fill_random_pattern(map + buf->underflow_size +
> buf->base.size,
>                               buf->overflow_size);
>  
>        pb_unmap(buf->buffer);
> @@ -230,7 +230,7 @@ pb_debug_buffer_destroy(struct pb_buffer *_buf)
>     struct pb_debug_buffer *buf = pb_debug_buffer(_buf);
>     struct pb_debug_manager *mgr = buf->mgr;
>     
> -   assert(!pipe_is_referenced(&buf->base.base.reference));
> +   assert(!pipe_is_referenced(&buf->base.reference));
>     
>     pb_debug_buffer_check(buf);
>  
> @@ -352,7 +352,7 @@ pb_debug_manager_dump(struct pb_debug_manager
> *mgr)
>        buf = LIST_ENTRY(struct pb_debug_buffer, curr, head);
>  
>        debug_printf("buffer = %p\n", (void *) buf);
> -      debug_printf("    .size = 0x%x\n", buf->base.base.size);
> +      debug_printf("    .size = 0x%x\n", buf->base.size);
>        debug_backtrace_dump(buf->create_backtrace,
>        PB_DEBUG_CREATE_BACKTRACE);
>        
>        curr = next;
> @@ -400,21 +400,21 @@ pb_debug_manager_create_buffer(struct
> pb_manager *_mgr,
>        return NULL;
>     }
>     
> -   assert(pipe_is_referenced(&buf->buffer->base.reference));
> -   assert(pb_check_alignment(real_desc.alignment,
> buf->buffer->base.alignment));
> -   assert(pb_check_usage(real_desc.usage, buf->buffer->base.usage));
> -   assert(buf->buffer->base.size >= real_size);
> +   assert(pipe_is_referenced(&buf->buffer->reference));
> +   assert(pb_check_alignment(real_desc.alignment,
> buf->buffer->alignment));
> +   assert(pb_check_usage(real_desc.usage, buf->buffer->usage));
> +   assert(buf->buffer->size >= real_size);
>     
> -   pipe_reference_init(&buf->base.base.reference, 1);
> -   buf->base.base.alignment = desc->alignment;
> -   buf->base.base.usage = desc->usage;
> -   buf->base.base.size = size;
> +   pipe_reference_init(&buf->base.reference, 1);
> +   buf->base.alignment = desc->alignment;
> +   buf->base.usage = desc->usage;
> +   buf->base.size = size;
>     
>     buf->base.vtbl = &pb_debug_buffer_vtbl;
>     buf->mgr = mgr;
>  
>     buf->underflow_size = mgr->underflow_size;
> -   buf->overflow_size = buf->buffer->base.size - buf->underflow_size
> - size;
> +   buf->overflow_size = buf->buffer->size - buf->underflow_size -
> size;
>     
>     debug_backtrace_capture(buf->create_backtrace, 1,
>     PB_DEBUG_CREATE_BACKTRACE);
>  
> diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c
> b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c
> index 88da786..fe96e5c 100644
> --- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c
> +++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c
> @@ -97,7 +97,7 @@ mm_buffer_destroy(struct pb_buffer *buf)
>     struct mm_buffer *mm_buf = mm_buffer(buf);
>     struct mm_pb_manager *mm = mm_buf->mgr;
>     
> -   assert(!pipe_is_referenced(&mm_buf->base.base.reference));
> +   assert(!pipe_is_referenced(&mm_buf->base.reference));
>     
>     pipe_mutex_lock(mm->mutex);
>     u_mmFreeMem(mm_buf->block);
> @@ -192,10 +192,10 @@ mm_bufmgr_create_buffer(struct pb_manager *mgr,
>        return NULL;
>     }
>  
> -   pipe_reference_init(&mm_buf->base.base.reference, 1);
> -   mm_buf->base.base.alignment = desc->alignment;
> -   mm_buf->base.base.usage = desc->usage;
> -   mm_buf->base.base.size = size;
> +   pipe_reference_init(&mm_buf->base.reference, 1);
> +   mm_buf->base.alignment = desc->alignment;
> +   mm_buf->base.usage = desc->usage;
> +   mm_buf->base.size = size;
>     
>     mm_buf->base.vtbl = &mm_buffer_vtbl;
>     
> diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_ondemand.c
> b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_ondemand.c
> index 694a092..e44bc9b 100644
> --- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_ondemand.c
> +++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_ondemand.c
> @@ -244,10 +244,10 @@ pb_ondemand_manager_create_buffer(struct
> pb_manager *_mgr,
>     if(!buf)
>        return NULL;
>  
> -   pipe_reference_init(&buf->base.base.reference, 1);
> -   buf->base.base.alignment = desc->alignment;
> -   buf->base.base.usage = desc->usage;
> -   buf->base.base.size = size;
> +   pipe_reference_init(&buf->base.reference, 1);
> +   buf->base.alignment = desc->alignment;
> +   buf->base.usage = desc->usage;
> +   buf->base.size = size;
>     buf->base.vtbl = &pb_ondemand_buffer_vtbl;
>     
>     buf->mgr = mgr;
> diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_pool.c
> b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_pool.c
> index 2f7c738..a8e9a34 100644
> --- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_pool.c
> +++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_pool.c
> @@ -108,7 +108,7 @@ pool_buffer_destroy(struct pb_buffer *buf)
>     struct pool_buffer *pool_buf = pool_buffer(buf);
>     struct pool_pb_manager *pool = pool_buf->mgr;
>     
> -   assert(!pipe_is_referenced(&pool_buf->base.base.reference));
> +   assert(!pipe_is_referenced(&pool_buf->base.reference));
>  
>     pipe_mutex_lock(pool->mutex);
>     LIST_ADD(&pool_buf->head, &pool->free);
> @@ -218,10 +218,10 @@ pool_bufmgr_create_buffer(struct pb_manager
> *mgr,
>     pipe_mutex_unlock(pool->mutex);
>     
>     pool_buf = LIST_ENTRY(struct pool_buffer, item, head);
> -   assert(!pipe_is_referenced(&pool_buf->base.base.reference));
> -   pipe_reference_init(&pool_buf->base.base.reference, 1);
> -   pool_buf->base.base.alignment = desc->alignment;
> -   pool_buf->base.base.usage = desc->usage;
> +   assert(!pipe_is_referenced(&pool_buf->base.reference));
> +   pipe_reference_init(&pool_buf->base.reference, 1);
> +   pool_buf->base.alignment = desc->alignment;
> +   pool_buf->base.usage = desc->usage;
>     
>     return SUPER(pool_buf);
>  }
> @@ -297,10 +297,10 @@ pool_bufmgr_create(struct pb_manager *provider,
>  
>     pool_buf = pool->bufs;
>     for (i = 0; i < numBufs; ++i) {
> -      pipe_reference_init(&pool_buf->base.base.reference, 0);
> -      pool_buf->base.base.alignment = 0;
> -      pool_buf->base.base.usage = 0;
> -      pool_buf->base.base.size = bufSize;
> +      pipe_reference_init(&pool_buf->base.reference, 0);
> +      pool_buf->base.alignment = 0;
> +      pool_buf->base.usage = 0;
> +      pool_buf->base.size = bufSize;
>        pool_buf->base.vtbl = &pool_buffer_vtbl;
>        pool_buf->mgr = pool;
>        pool_buf->start = i * bufSize;
> diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c
> b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c
> index 176f9aa..bd84b62 100644
> --- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c
> +++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c
> @@ -201,7 +201,7 @@ pb_slab_buffer_destroy(struct pb_buffer *_buf)
>  
>     pipe_mutex_lock(mgr->mutex);
>     
> -   assert(!pipe_is_referenced(&buf->base.base.reference));
> +   assert(!pipe_is_referenced(&buf->base.reference));
>     
>     buf->mapCount = 0;
>  
> @@ -326,7 +326,7 @@ pb_slab_create(struct pb_slab_manager *mgr)
>     }
>     pb_unmap(slab->bo);
>  
> -   numBuffers = slab->bo->base.size / mgr->bufSize;
> +   numBuffers = slab->bo->size / mgr->bufSize;
>  
>     slab->buffers = CALLOC(numBuffers, sizeof(*slab->buffers));
>     if (!slab->buffers) {
> @@ -342,10 +342,10 @@ pb_slab_create(struct pb_slab_manager *mgr)
>  
>     buf = slab->buffers;
>     for (i=0; i < numBuffers; ++i) {
> -      pipe_reference_init(&buf->base.base.reference, 0);
> -      buf->base.base.size = mgr->bufSize;
> -      buf->base.base.alignment = 0;
> -      buf->base.base.usage = 0;
> +      pipe_reference_init(&buf->base.reference, 0);
> +      buf->base.size = mgr->bufSize;
> +      buf->base.alignment = 0;
> +      buf->base.usage = 0;
>        buf->base.vtbl = &pb_slab_buffer_vtbl;
>        buf->slab = slab;
>        buf->start = i* mgr->bufSize;
> @@ -421,9 +421,9 @@ pb_slab_manager_create_buffer(struct pb_manager
> *_mgr,
>     pipe_mutex_unlock(mgr->mutex);
>     buf = LIST_ENTRY(struct pb_slab_buffer, list, head);
>     
> -   pipe_reference_init(&buf->base.base.reference, 1);
> -   buf->base.base.alignment = desc->alignment;
> -   buf->base.base.usage = desc->usage;
> +   pipe_reference_init(&buf->base.reference, 1);
> +   buf->base.alignment = desc->alignment;
> +   buf->base.usage = desc->usage;
>     
>     return &buf->base;
>  }
> diff --git a/src/gallium/winsys/r600/drm/r600_hw_context.c
> b/src/gallium/winsys/r600/drm/r600_hw_context.c
> index 6623078..848e768 100644
> --- a/src/gallium/winsys/r600/drm/r600_hw_context.c
> +++ b/src/gallium/winsys/r600/drm/r600_hw_context.c
> @@ -982,7 +982,7 @@ void r600_context_bo_flush(struct r600_context
> *ctx, unsigned flush_flags,
>  	} else {
>  		ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_SURFACE_SYNC, 3,
>  		ctx->predicate_drawing);
>  		ctx->pm4[ctx->pm4_cdwords++] = flush_flags;
> -		ctx->pm4[ctx->pm4_cdwords++] = (bo->buf->base.size + 255) >> 8;
> +		ctx->pm4[ctx->pm4_cdwords++] = (bo->buf->size + 255) >> 8;
>  		ctx->pm4[ctx->pm4_cdwords++] = 0x00000000;
>  		ctx->pm4[ctx->pm4_cdwords++] = 0x0000000A;
>  		ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_NOP, 0,
>  		ctx->predicate_drawing);
> diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
> b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
> index b45efe5..1dc6eeb 100644
> --- a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
> +++ b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
> @@ -356,10 +356,10 @@ static struct pb_buffer
> *radeon_bomgr_create_bo(struct pb_manager *_mgr,
>      if (!bo)
>  	return NULL;
>  
> -    pipe_reference_init(&bo->base.base.reference, 1);
> -    bo->base.base.alignment = desc->alignment;
> -    bo->base.base.usage = desc->usage;
> -    bo->base.base.size = size;
> +    pipe_reference_init(&bo->base.reference, 1);
> +    bo->base.alignment = desc->alignment;
> +    bo->base.usage = desc->usage;
> +    bo->base.size = size;
>      bo->base.vtbl = &radeon_bo_vtbl;
>      bo->mgr = mgr;
>      bo->rws = mgr->rws;
> @@ -592,10 +592,10 @@ static struct pb_buffer
> *radeon_winsys_bo_from_handle(struct radeon_winsys *rws,
>      bo->name = whandle->handle;
>  
>      /* Initialize it. */
> -    pipe_reference_init(&bo->base.base.reference, 1);
> -    bo->base.base.alignment = 0;
> -    bo->base.base.usage = PB_USAGE_GPU_WRITE | PB_USAGE_GPU_READ;
> -    bo->base.base.size = bo->size;
> +    pipe_reference_init(&bo->base.reference, 1);
> +    bo->base.alignment = 0;
> +    bo->base.usage = PB_USAGE_GPU_WRITE | PB_USAGE_GPU_READ;
> +    bo->base.size = bo->size;
>      bo->base.vtbl = &radeon_bo_vtbl;
>      bo->mgr = mgr;
>      bo->rws = mgr->rws;
> @@ -609,7 +609,7 @@ done:
>      if (stride)
>          *stride = whandle->stride;
>      if (size)
> -        *size = bo->base.base.size;
> +        *size = bo->base.size;
>  
>      return (struct pb_buffer*)bo;
>  
> diff --git a/src/gallium/winsys/svga/drm/vmw_buffer.c
> b/src/gallium/winsys/svga/drm/vmw_buffer.c
> index 80d5dfc..69f0787 100644
> --- a/src/gallium/winsys/svga/drm/vmw_buffer.c
> +++ b/src/gallium/winsys/svga/drm/vmw_buffer.c
> @@ -193,10 +193,10 @@ vmw_gmr_bufmgr_create_buffer(struct pb_manager
> *_mgr,
>     if(!buf)
>        goto error1;
>  
> -   pipe_reference_init(&buf->base.base.reference, 1);
> -   buf->base.base.alignment = desc->alignment;
> -   buf->base.base.usage = desc->usage;
> -   buf->base.base.size = size;
> +   pipe_reference_init(&buf->base.reference, 1);
> +   buf->base.alignment = desc->alignment;
> +   buf->base.usage = desc->usage;
> +   buf->base.size = size;
>     buf->base.vtbl = &vmw_gmr_buffer_vtbl;
>     buf->mgr = mgr;
>  
> diff --git a/src/gallium/winsys/svga/drm/vmw_context.c
> b/src/gallium/winsys/svga/drm/vmw_context.c
> index f2124c1..633ef38 100644
> --- a/src/gallium/winsys/svga/drm/vmw_context.c
> +++ b/src/gallium/winsys/svga/drm/vmw_context.c
> @@ -319,7 +319,7 @@ vmw_swc_region_relocation(struct
> svga_winsys_context *swc,
>      * SVGA virtual device it's not a performance issue since
>      flushing commands
>      * to the FIFO won't cause flushing in the host.
>      */
> -   vswc->seen_regions += reloc->buffer->base.size;
> +   vswc->seen_regions += reloc->buffer->size;
>     if(vswc->seen_regions >= VMW_GMR_POOL_SIZE/3)
>        vswc->preemptive_flush = TRUE;
>  }
> --
> 1.7.4.1
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
> 


More information about the mesa-dev mailing list