[Mesa-dev] [PATCH] gallium: remove unused 'buf' parameter in pipe_buffer_unmap

Keith Whitwell keithw at vmware.com
Mon Dec 20 00:58:25 PST 2010


Looks good, Marek.

Keith

On Sun, 2010-12-19 at 04:02 -0800, Marek Olšák wrote:
> ---
>  src/gallium/auxiliary/util/u_index_modify.c      |   12 ++++++------
>  src/gallium/auxiliary/util/u_inlines.h           |    3 +--
>  src/gallium/auxiliary/util/u_upload_mgr.c        |    4 ++--
>  src/gallium/drivers/nv50/nv50_shader_state.c     |    2 +-
>  src/gallium/drivers/nv50/nv50_vbo.c              |    2 +-
>  src/gallium/drivers/r300/r300_render.c           |   11 +++++------
>  src/gallium/drivers/r300/r300_render_translate.c |    5 ++---
>  src/gallium/drivers/r600/r600_translate.c        |    5 ++---
>  src/gallium/drivers/svga/svga_draw_arrays.c      |    4 ++--
>  src/gallium/drivers/svga/svga_draw_elements.c    |    8 ++++----
>  src/gallium/drivers/svga/svga_state_constants.c  |    2 +-
>  src/gallium/drivers/svga/svga_state_vs.c         |    4 +---
>  src/gallium/drivers/svga/svga_swtnl_backend.c    |    2 +-
>  src/gallium/drivers/svga/svga_swtnl_draw.c       |    9 +++------
>  src/mesa/state_tracker/st_cb_bufferobjects.c     |    6 +++---
>  src/mesa/state_tracker/st_cb_drawtex.c           |    2 +-
>  src/mesa/state_tracker/st_draw_feedback.c        |    8 +++-----
>  17 files changed, 39 insertions(+), 50 deletions(-)
> 
> diff --git a/src/gallium/auxiliary/util/u_index_modify.c b/src/gallium/auxiliary/util/u_index_modify.c
> index 65b079e..3822f60 100644
> --- a/src/gallium/auxiliary/util/u_index_modify.c
> +++ b/src/gallium/auxiliary/util/u_index_modify.c
> @@ -52,8 +52,8 @@ void util_shorten_ubyte_elts(struct pipe_context *context,
>          out_map++;
>      }
> 
> -    pipe_buffer_unmap(context, *elts, src_transfer);
> -    pipe_buffer_unmap(context, new_elts, dst_transfer);
> +    pipe_buffer_unmap(context, src_transfer);
> +    pipe_buffer_unmap(context, dst_transfer);
> 
>      *elts = new_elts;
>  }
> @@ -86,8 +86,8 @@ void util_rebuild_ushort_elts(struct pipe_context *context,
>          out_map++;
>      }
> 
> -    pipe_buffer_unmap(context, *elts, in_transfer);
> -    pipe_buffer_unmap(context, new_elts, out_transfer);
> +    pipe_buffer_unmap(context, in_transfer);
> +    pipe_buffer_unmap(context, out_transfer);
> 
>      *elts = new_elts;
>  }
> @@ -120,8 +120,8 @@ void util_rebuild_uint_elts(struct pipe_context *context,
>          out_map++;
>      }
> 
> -    pipe_buffer_unmap(context, *elts, in_transfer);
> -    pipe_buffer_unmap(context, new_elts, out_transfer);
> +    pipe_buffer_unmap(context, in_transfer);
> +    pipe_buffer_unmap(context, out_transfer);
> 
>      *elts = new_elts;
>  }
> diff --git a/src/gallium/auxiliary/util/u_inlines.h b/src/gallium/auxiliary/util/u_inlines.h
> index e55aafe..9184b6a 100644
> --- a/src/gallium/auxiliary/util/u_inlines.h
> +++ b/src/gallium/auxiliary/util/u_inlines.h
> @@ -242,7 +242,6 @@ pipe_buffer_map(struct pipe_context *pipe,
> 
>  static INLINE void
>  pipe_buffer_unmap(struct pipe_context *pipe,
> -                  struct pipe_resource *buf,
>                    struct pipe_transfer *transfer)
>  {
>     if (transfer) {
> @@ -341,7 +340,7 @@ pipe_buffer_read(struct pipe_context *pipe,
>     if (map)
>        memcpy(data, map + offset, size);
> 
> -   pipe_buffer_unmap(pipe, buf, src_transfer);
> +   pipe_buffer_unmap(pipe, src_transfer);
>  }
> 
>  static INLINE struct pipe_transfer *
> diff --git a/src/gallium/auxiliary/util/u_upload_mgr.c b/src/gallium/auxiliary/util/u_upload_mgr.c
> index af229e6..4daa55d 100644
> --- a/src/gallium/auxiliary/util/u_upload_mgr.c
> +++ b/src/gallium/auxiliary/util/u_upload_mgr.c
> @@ -108,7 +108,7 @@ my_buffer_write(struct pipe_context *pipe,
> 
>     memcpy(map + offset, data, size);
>     pipe_buffer_flush_mapped_range(pipe, transfer, offset, dirty_size);
> -   pipe_buffer_unmap(pipe, buf, transfer);
> +   pipe_buffer_unmap(pipe, transfer);
> 
>     return PIPE_OK;
>  }
> @@ -243,7 +243,7 @@ enum pipe_error u_upload_buffer( struct u_upload_mgr *upload,
> 
>  done:
>     if (map)
> -      pipe_buffer_unmap( upload->pipe, inbuf, transfer );
> +      pipe_buffer_unmap( upload->pipe, transfer );
> 
>     return ret;
>  }
> diff --git a/src/gallium/drivers/nv50/nv50_shader_state.c b/src/gallium/drivers/nv50/nv50_shader_state.c
> index 306aa81..1c1b66d 100644
> --- a/src/gallium/drivers/nv50/nv50_shader_state.c
> +++ b/src/gallium/drivers/nv50/nv50_shader_state.c
> @@ -71,7 +71,7 @@ nv50_transfer_constbuf(struct nv50_context *nv50,
>        map += nr;
>     }
> 
> -   pipe_buffer_unmap(pipe, buf, transfer);
> +   pipe_buffer_unmap(pipe, transfer);
>  }
> 
>  static void
> diff --git a/src/gallium/drivers/nv50/nv50_vbo.c b/src/gallium/drivers/nv50/nv50_vbo.c
> index d41a59d..53f319a 100644
> --- a/src/gallium/drivers/nv50/nv50_vbo.c
> +++ b/src/gallium/drivers/nv50/nv50_vbo.c
> @@ -284,7 +284,7 @@ nv50_draw_elements_inline(struct pipe_context *pipe,
>                 nzi = TRUE;
>         }
> 
> -       pipe_buffer_unmap(pipe, indexBuffer, transfer);
> +       pipe_buffer_unmap(pipe, transfer);
>  }
> 
>  static void
> diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c
> index 1d26eb9..f58d511 100644
> --- a/src/gallium/drivers/r300/r300_render.c
> +++ b/src/gallium/drivers/r300/r300_render.c
> @@ -425,7 +425,7 @@ static void r300_emit_draw_arrays_immediate(struct r300_context *r300,
> 
>          if (transfer[vbi]) {
>              vbuf = &r300->vertex_buffer[vbi];
> -            pipe_buffer_unmap(&r300->context, vbuf->buffer, transfer[vbi]);
> +            pipe_buffer_unmap(&r300->context, transfer[vbi]);
>              transfer[vbi] = NULL;
>          }
>      }
> @@ -568,7 +568,7 @@ static void r300_draw_range_elements(struct pipe_context* pipe,
>          indexBuffer = userbuf;
>          r300_upload_index_buffer(r300, &indexBuffer, indexSize, 0, count, &new_offset);
>          pipe_resource_reference(&userbuf, NULL);
> -        pipe_buffer_unmap(pipe, indexBuffer, transfer);
> +        pipe_buffer_unmap(pipe, transfer);
>      } else {
>          r300_upload_index_buffer(r300, &indexBuffer, indexSize, start, count, &new_offset);
>      }
> @@ -770,14 +770,13 @@ static void r300_swtcl_draw_vbo(struct pipe_context* pipe,
> 
>      for (i = 0; i < r300->vertex_buffer_count; i++) {
>          if (r300->vertex_buffer[i].buffer) {
> -            pipe_buffer_unmap(pipe, r300->vertex_buffer[i].buffer,
> -                              vb_transfer[i]);
> +            pipe_buffer_unmap(pipe, vb_transfer[i]);
>              draw_set_mapped_vertex_buffer(r300->draw, i, NULL);
>          }
>      }
> 
>      if (indexed) {
> -        pipe_buffer_unmap(pipe, r300->index_buffer.buffer, ib_transfer);
> +        pipe_buffer_unmap(pipe, ib_transfer);
>          draw_set_mapped_index_buffer(r300->draw, NULL);
>      }
>  }
> @@ -877,7 +876,7 @@ static void r300_render_unmap_vertices(struct vbuf_render* render,
> 
>      r300render->vbo_max_used = MAX2(r300render->vbo_max_used,
>                                      r300render->vertex_size * (max + 1));
> -    pipe_buffer_unmap(context, r300->vbo, r300render->vbo_transfer);
> +    pipe_buffer_unmap(context, r300render->vbo_transfer);
> 
>      r300render->vbo_transfer = NULL;
>  }
> diff --git a/src/gallium/drivers/r300/r300_render_translate.c b/src/gallium/drivers/r300/r300_render_translate.c
> index 90b2f40..26e00a2 100644
> --- a/src/gallium/drivers/r300/r300_render_translate.c
> +++ b/src/gallium/drivers/r300/r300_render_translate.c
> @@ -128,12 +128,11 @@ void r300_begin_vertex_translate(struct r300_context *r300)
>      /* Unmap all buffers. */
>      for (i = 0; i < r300->vertex_buffer_count; i++) {
>          if (vb_translated[i]) {
> -            pipe_buffer_unmap(pipe, r300->vertex_buffer[i].buffer,
> -                              vb_transfer[i]);
> +            pipe_buffer_unmap(pipe, vb_transfer[i]);
>          }
>      }
> 
> -    pipe_buffer_unmap(pipe, out_buffer, out_transfer);
> +    pipe_buffer_unmap(pipe, out_transfer);
> 
>      /* Setup the new vertex buffer in the first free slot. */
>      for (i = 0; i < PIPE_MAX_ATTRIBS; i++) {
> diff --git a/src/gallium/drivers/r600/r600_translate.c b/src/gallium/drivers/r600/r600_translate.c
> index ba12eee..f80fa7a 100644
> --- a/src/gallium/drivers/r600/r600_translate.c
> +++ b/src/gallium/drivers/r600/r600_translate.c
> @@ -125,12 +125,11 @@ void r600_begin_vertex_translate(struct r600_pipe_context *rctx)
>         /* Unmap all buffers. */
>         for (i = 0; i < rctx->nvertex_buffer; i++) {
>                 if (vb_translated[i]) {
> -                       pipe_buffer_unmap(pipe, rctx->vertex_buffer[i].buffer,
> -                                         vb_transfer[i]);
> +                       pipe_buffer_unmap(pipe, vb_transfer[i]);
>                 }
>         }
> 
> -       pipe_buffer_unmap(pipe, out_buffer, out_transfer);
> +       pipe_buffer_unmap(pipe, out_transfer);
> 
>         /* Setup the new vertex buffer in the first free slot. */
>         for (i = 0; i < PIPE_MAX_ATTRIBS; i++) {
> diff --git a/src/gallium/drivers/svga/svga_draw_arrays.c b/src/gallium/drivers/svga/svga_draw_arrays.c
> index da33fae..be0e7ab 100644
> --- a/src/gallium/drivers/svga/svga_draw_arrays.c
> +++ b/src/gallium/drivers/svga/svga_draw_arrays.c
> @@ -65,14 +65,14 @@ static enum pipe_error generate_indices( struct svga_hwtnl *hwtnl,
>     generate( nr,
>               dst_map );
> 
> -   pipe_buffer_unmap( pipe, dst, transfer );
> +   pipe_buffer_unmap( pipe, transfer );
> 
>     *out_buf = dst;
>     return PIPE_OK;
> 
>  fail:
>     if (dst_map)
> -      pipe_buffer_unmap( pipe, dst, transfer );
> +      pipe_buffer_unmap( pipe, transfer );
> 
>     if (dst)
>        pipe->screen->resource_destroy( pipe->screen, dst );
> diff --git a/src/gallium/drivers/svga/svga_draw_elements.c b/src/gallium/drivers/svga/svga_draw_elements.c
> index c457917..c7ea014 100644
> --- a/src/gallium/drivers/svga/svga_draw_elements.c
> +++ b/src/gallium/drivers/svga/svga_draw_elements.c
> @@ -72,18 +72,18 @@ translate_indices( struct svga_hwtnl *hwtnl,
>                nr,
>                dst_map );
> 
> -   pipe_buffer_unmap( pipe, src, src_transfer );
> -   pipe_buffer_unmap( pipe, dst, dst_transfer );
> +   pipe_buffer_unmap( pipe, src_transfer );
> +   pipe_buffer_unmap( pipe, dst_transfer );
> 
>     *out_buf = dst;
>     return PIPE_OK;
> 
>  fail:
>     if (src_map)
> -      pipe_buffer_unmap( pipe, src, src_transfer );
> +      pipe_buffer_unmap( pipe, src_transfer );
> 
>     if (dst_map)
> -      pipe_buffer_unmap( pipe, dst, dst_transfer );
> +      pipe_buffer_unmap( pipe, dst_transfer );
> 
>     if (dst)
>        pipe->screen->resource_destroy( pipe->screen, dst );
> diff --git a/src/gallium/drivers/svga/svga_state_constants.c b/src/gallium/drivers/svga/svga_state_constants.c
> index 97c818c..daf1024 100644
> --- a/src/gallium/drivers/svga/svga_state_constants.c
> +++ b/src/gallium/drivers/svga/svga_state_constants.c
> @@ -110,7 +110,7 @@ static int emit_consts( struct svga_context *svga,
> 
>  done:
>     if (data)
> -      pipe_buffer_unmap(&svga->pipe, svga->curr.cb[unit], transfer);
> +      pipe_buffer_unmap(&svga->pipe, transfer);
> 
>     return ret;
>  }
> diff --git a/src/gallium/drivers/svga/svga_state_vs.c b/src/gallium/drivers/svga/svga_state_vs.c
> index 5133c70..6682a1e 100644
> --- a/src/gallium/drivers/svga/svga_state_vs.c
> +++ b/src/gallium/drivers/svga/svga_state_vs.c
> @@ -233,9 +233,7 @@ static int update_zero_stride( struct svga_context *svga,
>           translate->run(translate, 0, 1, 0,
>                          svga->curr.zero_stride_constants);
> 
> -         pipe_buffer_unmap(&svga->pipe,
> -                           vbuffer->buffer,
> -                          transfer);
> +         pipe_buffer_unmap(&svga->pipe, transfer);
> 
>           translate->release(translate);
>        }
> diff --git a/src/gallium/drivers/svga/svga_swtnl_backend.c b/src/gallium/drivers/svga/svga_swtnl_backend.c
> index ff3da84..24646b4 100644
> --- a/src/gallium/drivers/svga/svga_swtnl_backend.c
> +++ b/src/gallium/drivers/svga/svga_swtnl_backend.c
> @@ -141,7 +141,7 @@ svga_vbuf_render_unmap_vertices( struct vbuf_render *render,
>     pipe_buffer_flush_mapped_range(&svga->pipe,
>                                   svga_render->vbuf_transfer,
>                                   offset, length);
> -   pipe_buffer_unmap(&svga->pipe, svga_render->vbuf, svga_render->vbuf_transfer);
> +   pipe_buffer_unmap(&svga->pipe, svga_render->vbuf_transfer);
>     svga_render->min_index = min_index;
>     svga_render->max_index = max_index;
>     svga_render->vbuf_used = MAX2(svga_render->vbuf_used, used);
> diff --git a/src/gallium/drivers/svga/svga_swtnl_draw.c b/src/gallium/drivers/svga/svga_swtnl_draw.c
> index 814e8ed..d903984 100644
> --- a/src/gallium/drivers/svga/svga_swtnl_draw.c
> +++ b/src/gallium/drivers/svga/svga_swtnl_draw.c
> @@ -106,20 +106,17 @@ svga_swtnl_draw_vbo(struct svga_context *svga,
>      * unmap vertex/index buffers
>      */
>     for (i = 0; i < svga->curr.num_vertex_buffers; i++) {
> -      pipe_buffer_unmap(&svga->pipe, svga->curr.vb[i].buffer,
> -                       vb_transfer[i]);
> +      pipe_buffer_unmap(&svga->pipe, vb_transfer[i]);
>        draw_set_mapped_vertex_buffer(draw, i, NULL);
>     }
> 
>     if (ib_transfer) {
> -      pipe_buffer_unmap(&svga->pipe, svga->curr.ib.buffer, ib_transfer);
> +      pipe_buffer_unmap(&svga->pipe, ib_transfer);
>        draw_set_mapped_index_buffer(draw, NULL);
>     }
> 
>     if (svga->curr.cb[PIPE_SHADER_VERTEX]) {
> -      pipe_buffer_unmap(&svga->pipe,
> -                        svga->curr.cb[PIPE_SHADER_VERTEX],
> -                       cb_transfer);
> +      pipe_buffer_unmap(&svga->pipe, cb_transfer);
>     }
> 
>     return ret;
> diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.c b/src/mesa/state_tracker/st_cb_bufferobjects.c
> index 8b60f90..d4d9af4 100644
> --- a/src/mesa/state_tracker/st_cb_bufferobjects.c
> +++ b/src/mesa/state_tracker/st_cb_bufferobjects.c
> @@ -360,7 +360,7 @@ st_bufferobj_unmap(struct gl_context *ctx, GLenum target, struct gl_buffer_objec
>     struct st_buffer_object *st_obj = st_buffer_object(obj);
> 
>     if (obj->Length)
> -      pipe_buffer_unmap(pipe, st_obj->buffer, st_obj->transfer);
> +      pipe_buffer_unmap(pipe, st_obj->transfer);
> 
>     st_obj->transfer = NULL;
>     obj->Pointer = NULL;
> @@ -409,8 +409,8 @@ st_copy_buffer_subdata(struct gl_context *ctx,
>     if (srcPtr && dstPtr)
>        memcpy(dstPtr + writeOffset, srcPtr + readOffset, size);
> 
> -   pipe_buffer_unmap(pipe, srcObj->buffer, src_transfer);
> -   pipe_buffer_unmap(pipe, dstObj->buffer, dst_transfer);
> +   pipe_buffer_unmap(pipe, src_transfer);
> +   pipe_buffer_unmap(pipe, dst_transfer);
>  }
> 
> 
> diff --git a/src/mesa/state_tracker/st_cb_drawtex.c b/src/mesa/state_tracker/st_cb_drawtex.c
> index 6cad7d3..22a5ed4 100644
> --- a/src/mesa/state_tracker/st_cb_drawtex.c
> +++ b/src/mesa/state_tracker/st_cb_drawtex.c
> @@ -220,7 +220,7 @@ st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z,
>           }
>        }
> 
> -      pipe_buffer_unmap(pipe, vbuffer, vbuffer_transfer);
> +      pipe_buffer_unmap(pipe, vbuffer_transfer);
> 
>  #undef SET_ATTRIB
>     }
> diff --git a/src/mesa/state_tracker/st_draw_feedback.c b/src/mesa/state_tracker/st_draw_feedback.c
> index 0a6cebb..da67c71 100644
> --- a/src/mesa/state_tracker/st_draw_feedback.c
> +++ b/src/mesa/state_tracker/st_draw_feedback.c
> @@ -259,16 +259,14 @@ st_feedback_draw_vbo(struct gl_context *ctx,
> 
> 
>     /* unmap constant buffers */
> -   pipe_buffer_unmap(pipe, st->state.constants[PIPE_SHADER_VERTEX],
> -                    cb_transfer);
> +   pipe_buffer_unmap(pipe, cb_transfer);
> 
>     /*
>      * unmap vertex/index buffers
>      */
>     for (i = 0; i < PIPE_MAX_ATTRIBS; i++) {
>        if (draw->pt.vertex_buffer[i].buffer) {
> -         pipe_buffer_unmap(pipe, draw->pt.vertex_buffer[i].buffer,
> -                          vb_transfer[i]);
> +         pipe_buffer_unmap(pipe, vb_transfer[i]);
>           pipe_resource_reference(&draw->pt.vertex_buffer[i].buffer, NULL);
>           draw_set_mapped_vertex_buffer(draw, i, NULL);
>        }
> @@ -279,7 +277,7 @@ st_feedback_draw_vbo(struct gl_context *ctx,
>        draw_set_index_buffer(draw, NULL);
> 
>        if (ib_transfer)
> -         pipe_buffer_unmap(pipe, ibuffer.buffer, ib_transfer);
> +         pipe_buffer_unmap(pipe, ib_transfer);
>        pipe_resource_reference(&ibuffer.buffer, NULL);
>     }
>  }
> --
> 1.7.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