Re: [Mesa-dev] [PATCH] r600g/compute: Fix Warnings

2014-08-10 Thread Bruno Jimenez
On Sat, 2014-08-09 at 23:51 +0200, Marek Olšák wrote:
> Hi Bruno,
> 
> Sorry, I fixed the warnings by myself before I saw your patch.
> 
> Marek

Hi Marek,

Don't worry, the important thing is that whe warnings are fixed.

Thanks!
Bruno
> 
> On Thu, Aug 7, 2014 at 12:07 PM, Bruno Jiménez  wrote:
> > I have followed the following convention:
> > - Positions in the pool are now 'int' (start_in_dw and related)
> > - Sizes are 'unsigned' (size_in_dw and related)
> > - IDs are 'unsigned'
> >
> > The pool and item's status are left as uint32_t
> > The shadow has been also left as a pointer to an uint32_t
> > ---
> >  src/gallium/drivers/r600/compute_memory_pool.c | 56 
> > +-
> >  src/gallium/drivers/r600/compute_memory_pool.h | 26 ++--
> >  2 files changed, 41 insertions(+), 41 deletions(-)
> >
> > diff --git a/src/gallium/drivers/r600/compute_memory_pool.c 
> > b/src/gallium/drivers/r600/compute_memory_pool.c
> > index 0ee8ceb..8bcab00 100644
> > --- a/src/gallium/drivers/r600/compute_memory_pool.c
> > +++ b/src/gallium/drivers/r600/compute_memory_pool.c
> > @@ -76,7 +76,7 @@ static void compute_memory_pool_init(struct 
> > compute_memory_pool * pool,
> > unsigned initial_size_in_dw)
> >  {
> >
> > -   COMPUTE_DBG(pool->screen, "* compute_memory_pool_init() 
> > initial_size_in_dw = %ld\n",
> > +   COMPUTE_DBG(pool->screen, "* compute_memory_pool_init() 
> > initial_size_in_dw = %u\n",
> > initial_size_in_dw);
> >
> > pool->size_in_dw = initial_size_in_dw;
> > @@ -104,9 +104,9 @@ void compute_memory_pool_delete(struct 
> > compute_memory_pool* pool)
> >   * \param size_in_dw   The size of the space we are looking for.
> >   * \return -1 on failure
> >   */
> > -int64_t compute_memory_prealloc_chunk(
> > +int compute_memory_prealloc_chunk(
> > struct compute_memory_pool* pool,
> > -   int64_t size_in_dw)
> > +   unsigned size_in_dw)
> >  {
> > struct compute_memory_item *item;
> >
> > @@ -114,7 +114,7 @@ int64_t compute_memory_prealloc_chunk(
> >
> > assert(size_in_dw <= pool->size_in_dw);
> >
> > -   COMPUTE_DBG(pool->screen, "* compute_memory_prealloc_chunk() 
> > size_in_dw = %ld\n",
> > +   COMPUTE_DBG(pool->screen, "* compute_memory_prealloc_chunk() 
> > size_in_dw = %u\n",
> > size_in_dw);
> >
> > LIST_FOR_EACH_ENTRY(item, pool->item_list, link) {
> > @@ -139,13 +139,13 @@ int64_t compute_memory_prealloc_chunk(
> >   */
> >  struct list_head *compute_memory_postalloc_chunk(
> > struct compute_memory_pool* pool,
> > -   int64_t start_in_dw)
> > +   int start_in_dw)
> >  {
> > struct compute_memory_item *item;
> > struct compute_memory_item *next;
> > struct list_head *next_link;
> >
> > -   COMPUTE_DBG(pool->screen, "* compute_memory_postalloc_chunck() 
> > start_in_dw = %ld\n",
> > +   COMPUTE_DBG(pool->screen, "* compute_memory_postalloc_chunck() 
> > start_in_dw = %i\n",
> > start_in_dw);
> >
> > /* Check if we can insert it in the front of the list */
> > @@ -181,12 +181,12 @@ struct list_head *compute_memory_postalloc_chunk(
> >   * \see compute_memory_finalize_pending
> >   */
> >  int compute_memory_grow_defrag_pool(struct compute_memory_pool *pool,
> > -   struct pipe_context *pipe, int new_size_in_dw)
> > +   struct pipe_context *pipe, unsigned new_size_in_dw)
> >  {
> > new_size_in_dw = align(new_size_in_dw, ITEM_ALIGNMENT);
> >
> > COMPUTE_DBG(pool->screen, "* compute_memory_grow_defrag_pool() "
> > -   "new_size_in_dw = %d (%d bytes)\n",
> > +   "new_size_in_dw = %u (%u bytes)\n",
> > new_size_in_dw, new_size_in_dw * 4);
> >
> > assert(new_size_in_dw >= pool->size_in_dw);
> > @@ -274,17 +274,17 @@ int compute_memory_finalize_pending(struct 
> > compute_memory_pool* pool,
> >  {
> > struct compute_memory_item *item, *next;
> >
> > -   int64_t allocated = 0;
> > -   int64_t unallocated = 0;
> > -   int64_t last_pos;
> > +   unsigned allocated = 0;
> > +   unsigned unallocated = 0;
> > +   int last_pos;
> >
> > int err = 0;
> >
> > COMPUTE_DBG(pool->screen, "* compute_memory_finalize_pending()\n");
> >
> > LIST_FOR_EACH_ENTRY(item, pool->item_list, link) {
> > -   COMPUTE_DBG(pool->screen, "  + list: offset = %i id = %i 
> > size = %i "
> > -   "(%i bytes)\n",item->start_in_dw, item->id,
> > +   COMPUTE_DBG(pool->screen, "  + list: offset = %i id = %u 
> > size = %u "
> > +   "(%u bytes)\n", item->start_in_dw, item->id,
> > item->size_in_dw, item->size_in_dw * 4);
> > }
> >
> > @@ -347,7 +347,7 @@ void compute_memory_defrag(struct compute_memory_pool 
> > *pool,
> > struct pipe_context *pipe)
> >  {
> > struct compute_memory_item *item;
> > -   int64_t l

Re: [Mesa-dev] [PATCH] r600g/compute: Fix Warnings

2014-08-09 Thread Marek Olšák
Hi Bruno,

Sorry, I fixed the warnings by myself before I saw your patch.

Marek

On Thu, Aug 7, 2014 at 12:07 PM, Bruno Jiménez  wrote:
> I have followed the following convention:
> - Positions in the pool are now 'int' (start_in_dw and related)
> - Sizes are 'unsigned' (size_in_dw and related)
> - IDs are 'unsigned'
>
> The pool and item's status are left as uint32_t
> The shadow has been also left as a pointer to an uint32_t
> ---
>  src/gallium/drivers/r600/compute_memory_pool.c | 56 
> +-
>  src/gallium/drivers/r600/compute_memory_pool.h | 26 ++--
>  2 files changed, 41 insertions(+), 41 deletions(-)
>
> diff --git a/src/gallium/drivers/r600/compute_memory_pool.c 
> b/src/gallium/drivers/r600/compute_memory_pool.c
> index 0ee8ceb..8bcab00 100644
> --- a/src/gallium/drivers/r600/compute_memory_pool.c
> +++ b/src/gallium/drivers/r600/compute_memory_pool.c
> @@ -76,7 +76,7 @@ static void compute_memory_pool_init(struct 
> compute_memory_pool * pool,
> unsigned initial_size_in_dw)
>  {
>
> -   COMPUTE_DBG(pool->screen, "* compute_memory_pool_init() 
> initial_size_in_dw = %ld\n",
> +   COMPUTE_DBG(pool->screen, "* compute_memory_pool_init() 
> initial_size_in_dw = %u\n",
> initial_size_in_dw);
>
> pool->size_in_dw = initial_size_in_dw;
> @@ -104,9 +104,9 @@ void compute_memory_pool_delete(struct 
> compute_memory_pool* pool)
>   * \param size_in_dw   The size of the space we are looking for.
>   * \return -1 on failure
>   */
> -int64_t compute_memory_prealloc_chunk(
> +int compute_memory_prealloc_chunk(
> struct compute_memory_pool* pool,
> -   int64_t size_in_dw)
> +   unsigned size_in_dw)
>  {
> struct compute_memory_item *item;
>
> @@ -114,7 +114,7 @@ int64_t compute_memory_prealloc_chunk(
>
> assert(size_in_dw <= pool->size_in_dw);
>
> -   COMPUTE_DBG(pool->screen, "* compute_memory_prealloc_chunk() 
> size_in_dw = %ld\n",
> +   COMPUTE_DBG(pool->screen, "* compute_memory_prealloc_chunk() 
> size_in_dw = %u\n",
> size_in_dw);
>
> LIST_FOR_EACH_ENTRY(item, pool->item_list, link) {
> @@ -139,13 +139,13 @@ int64_t compute_memory_prealloc_chunk(
>   */
>  struct list_head *compute_memory_postalloc_chunk(
> struct compute_memory_pool* pool,
> -   int64_t start_in_dw)
> +   int start_in_dw)
>  {
> struct compute_memory_item *item;
> struct compute_memory_item *next;
> struct list_head *next_link;
>
> -   COMPUTE_DBG(pool->screen, "* compute_memory_postalloc_chunck() 
> start_in_dw = %ld\n",
> +   COMPUTE_DBG(pool->screen, "* compute_memory_postalloc_chunck() 
> start_in_dw = %i\n",
> start_in_dw);
>
> /* Check if we can insert it in the front of the list */
> @@ -181,12 +181,12 @@ struct list_head *compute_memory_postalloc_chunk(
>   * \see compute_memory_finalize_pending
>   */
>  int compute_memory_grow_defrag_pool(struct compute_memory_pool *pool,
> -   struct pipe_context *pipe, int new_size_in_dw)
> +   struct pipe_context *pipe, unsigned new_size_in_dw)
>  {
> new_size_in_dw = align(new_size_in_dw, ITEM_ALIGNMENT);
>
> COMPUTE_DBG(pool->screen, "* compute_memory_grow_defrag_pool() "
> -   "new_size_in_dw = %d (%d bytes)\n",
> +   "new_size_in_dw = %u (%u bytes)\n",
> new_size_in_dw, new_size_in_dw * 4);
>
> assert(new_size_in_dw >= pool->size_in_dw);
> @@ -274,17 +274,17 @@ int compute_memory_finalize_pending(struct 
> compute_memory_pool* pool,
>  {
> struct compute_memory_item *item, *next;
>
> -   int64_t allocated = 0;
> -   int64_t unallocated = 0;
> -   int64_t last_pos;
> +   unsigned allocated = 0;
> +   unsigned unallocated = 0;
> +   int last_pos;
>
> int err = 0;
>
> COMPUTE_DBG(pool->screen, "* compute_memory_finalize_pending()\n");
>
> LIST_FOR_EACH_ENTRY(item, pool->item_list, link) {
> -   COMPUTE_DBG(pool->screen, "  + list: offset = %i id = %i size 
> = %i "
> -   "(%i bytes)\n",item->start_in_dw, item->id,
> +   COMPUTE_DBG(pool->screen, "  + list: offset = %i id = %u size 
> = %u "
> +   "(%u bytes)\n", item->start_in_dw, item->id,
> item->size_in_dw, item->size_in_dw * 4);
> }
>
> @@ -347,7 +347,7 @@ void compute_memory_defrag(struct compute_memory_pool 
> *pool,
> struct pipe_context *pipe)
>  {
> struct compute_memory_item *item;
> -   int64_t last_pos;
> +   int last_pos;
>
> COMPUTE_DBG(pool->screen, "* compute_memory_defrag()\n");
>
> @@ -374,7 +374,7 @@ void compute_memory_defrag(struct compute_memory_pool 
> *pool,
>   */
>  int compute_memory_promote_item(struct compute_memory_pool *pool,
> struct compute_memory_item *item, struct pipe_context *pipe,
> -   int64_t start_in_dw)
> +