From 1e0d30a515e4cac891b6c590f12a33e0e8a8e295 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 25 Jan 2008 20:53:31 +0000 Subject: gallium: rename pipe_buffer_handle to pipe_buffer, rework pipebuffer/ code Provide an actual definition of the pipe_buffer struct, containing the parameters used to create the buffer, and its refcount. Shift refcounting buffers out of the winsys interface, similar to surfaces & textures. Rework pipebuffer/ to reflect the fact these changes, and also Michel's reworking of the buffer interface. --- src/mesa/pipe/i965simple/brw_blit.c | 6 +++--- src/mesa/pipe/i965simple/brw_blit.h | 8 ++++---- src/mesa/pipe/i965simple/brw_context.h | 6 +++--- src/mesa/pipe/i965simple/brw_draw.c | 4 ++-- src/mesa/pipe/i965simple/brw_draw.h | 2 +- src/mesa/pipe/i965simple/brw_draw_upload.c | 4 ++-- src/mesa/pipe/i965simple/brw_state.h | 2 +- src/mesa/pipe/i965simple/brw_state_pool.c | 7 ++++--- src/mesa/pipe/i965simple/brw_surface.c | 2 +- src/mesa/pipe/i965simple/brw_tex_layout.c | 3 ++- src/mesa/pipe/i965simple/brw_winsys.h | 8 ++++---- src/mesa/pipe/i965simple/brw_wm_surface_state.c | 2 +- 12 files changed, 28 insertions(+), 26 deletions(-) (limited to 'src/mesa/pipe/i965simple') diff --git a/src/mesa/pipe/i965simple/brw_blit.c b/src/mesa/pipe/i965simple/brw_blit.c index 4692129e40..bbd366294f 100644 --- a/src/mesa/pipe/i965simple/brw_blit.c +++ b/src/mesa/pipe/i965simple/brw_blit.c @@ -42,7 +42,7 @@ void brw_fill_blit(struct brw_context *brw, unsigned cpp, short dst_pitch, - struct pipe_buffer_handle *dst_buffer, + struct pipe_buffer *dst_buffer, unsigned dst_offset, boolean dst_tiled, short x, short y, @@ -113,11 +113,11 @@ static unsigned translate_raster_op(unsigned logicop) void brw_copy_blit(struct brw_context *brw, unsigned cpp, short src_pitch, - struct pipe_buffer_handle *src_buffer, + struct pipe_buffer *src_buffer, unsigned src_offset, boolean src_tiled, short dst_pitch, - struct pipe_buffer_handle *dst_buffer, + struct pipe_buffer *dst_buffer, unsigned dst_offset, boolean dst_tiled, short src_x, short src_y, diff --git a/src/mesa/pipe/i965simple/brw_blit.h b/src/mesa/pipe/i965simple/brw_blit.h index 371a135375..7f17a70173 100644 --- a/src/mesa/pipe/i965simple/brw_blit.h +++ b/src/mesa/pipe/i965simple/brw_blit.h @@ -3,13 +3,13 @@ #include "pipe/p_compiler.h" -struct pipe_buffer_handle; +struct pipe_buffer; struct brw_context; void brw_fill_blit(struct brw_context *intel, unsigned cpp, short dst_pitch, - struct pipe_buffer_handle *dst_buffer, + struct pipe_buffer *dst_buffer, unsigned dst_offset, boolean dst_tiled, short x, short y, @@ -18,11 +18,11 @@ void brw_fill_blit(struct brw_context *intel, void brw_copy_blit(struct brw_context *intel, unsigned cpp, short src_pitch, - struct pipe_buffer_handle *src_buffer, + struct pipe_buffer *src_buffer, unsigned src_offset, boolean src_tiled, short dst_pitch, - struct pipe_buffer_handle *dst_buffer, + struct pipe_buffer *dst_buffer, unsigned dst_offset, boolean dst_tiled, short src_x, short src_y, diff --git a/src/mesa/pipe/i965simple/brw_context.h b/src/mesa/pipe/i965simple/brw_context.h index c610a435e0..65664d853d 100644 --- a/src/mesa/pipe/i965simple/brw_context.h +++ b/src/mesa/pipe/i965simple/brw_context.h @@ -260,7 +260,7 @@ struct brw_texture { /* The data is held here: */ - struct pipe_buffer_handle *buffer; + struct pipe_buffer *buffer; }; /* Data about a particular attempt to compile a program. Note that @@ -350,7 +350,7 @@ struct brw_surface_binding_table { struct brw_cache; struct brw_mem_pool { - struct pipe_buffer_handle *buffer; + struct pipe_buffer *buffer; unsigned size; unsigned offset; /* offset of first free byte */ @@ -615,7 +615,7 @@ struct brw_context unsigned nr_surfaces; unsigned max_threads; - struct pipe_buffer_handle *scratch_buffer; + struct pipe_buffer *scratch_buffer; unsigned scratch_buffer_size; unsigned sampler_count; diff --git a/src/mesa/pipe/i965simple/brw_draw.c b/src/mesa/pipe/i965simple/brw_draw.c index acfb524a30..7598e3dc8a 100644 --- a/src/mesa/pipe/i965simple/brw_draw.c +++ b/src/mesa/pipe/i965simple/brw_draw.c @@ -144,7 +144,7 @@ static boolean brw_emit_prim( struct brw_context *brw, * fallback conditions. */ static boolean brw_try_draw_elements( struct pipe_context *pipe, - struct pipe_buffer_handle *index_buffer, + struct pipe_buffer *index_buffer, unsigned index_size, unsigned mode, unsigned start, @@ -183,7 +183,7 @@ static boolean brw_try_draw_elements( struct pipe_context *pipe, static boolean brw_draw_elements( struct pipe_context *pipe, - struct pipe_buffer_handle *indexBuffer, + struct pipe_buffer *indexBuffer, unsigned indexSize, unsigned mode, unsigned start, diff --git a/src/mesa/pipe/i965simple/brw_draw.h b/src/mesa/pipe/i965simple/brw_draw.h index 053f2efb9d..62fe0d5d0e 100644 --- a/src/mesa/pipe/i965simple/brw_draw.h +++ b/src/mesa/pipe/i965simple/brw_draw.h @@ -42,7 +42,7 @@ boolean brw_upload_vertices( struct brw_context *brw, unsigned max_index ); boolean brw_upload_indices(struct brw_context *brw, - const struct pipe_buffer_handle *index_buffer, + const struct pipe_buffer *index_buffer, int ib_size, int start, int count); boolean brw_upload_vertex_buffers( struct brw_context *brw ); diff --git a/src/mesa/pipe/i965simple/brw_draw_upload.c b/src/mesa/pipe/i965simple/brw_draw_upload.c index 43e53914e9..aa85d93866 100644 --- a/src/mesa/pipe/i965simple/brw_draw_upload.c +++ b/src/mesa/pipe/i965simple/brw_draw_upload.c @@ -47,7 +47,7 @@ struct brw_array_state { unsigned dword; } vb0; - struct pipe_buffer_handle *buffer; + struct pipe_buffer *buffer; unsigned offset; unsigned max_index; @@ -272,7 +272,7 @@ boolean brw_upload_vertex_elements( struct brw_context *brw ) } boolean brw_upload_indices( struct brw_context *brw, - const struct pipe_buffer_handle *index_buffer, + const struct pipe_buffer *index_buffer, int ib_size, int start, int count) { /* Emit the indexbuffer packet: diff --git a/src/mesa/pipe/i965simple/brw_state.h b/src/mesa/pipe/i965simple/brw_state.h index 8b4d7aabf0..258e9a556e 100644 --- a/src/mesa/pipe/i965simple/brw_state.h +++ b/src/mesa/pipe/i965simple/brw_state.h @@ -106,7 +106,7 @@ boolean brw_search_cache( struct brw_cache *cache, void brw_init_caches( struct brw_context *brw ); void brw_destroy_caches( struct brw_context *brw ); -static inline struct pipe_buffer_handle *brw_cache_buffer(struct brw_context *brw, +static inline struct pipe_buffer *brw_cache_buffer(struct brw_context *brw, enum brw_cache_id id) { return brw->cache[id].pool->buffer; diff --git a/src/mesa/pipe/i965simple/brw_state_pool.c b/src/mesa/pipe/i965simple/brw_state_pool.c index 2f930be837..7c67f0ee25 100644 --- a/src/mesa/pipe/i965simple/brw_state_pool.c +++ b/src/mesa/pipe/i965simple/brw_state_pool.c @@ -44,6 +44,7 @@ #include "pipe/p_winsys.h" #include "pipe/p_util.h" +#include "pipe/p_inlines.h" #include "brw_context.h" #include "brw_state.h" @@ -101,9 +102,9 @@ static void brw_destroy_pool( struct brw_context *brw, { struct brw_mem_pool *pool = &brw->pool[pool_id]; - pool->brw->pipe.winsys->buffer_reference( pool->brw->pipe.winsys, - &pool->buffer, - NULL ); + pipe_buffer_reference( pool->brw->pipe.winsys, + &pool->buffer, + NULL ); } diff --git a/src/mesa/pipe/i965simple/brw_surface.c b/src/mesa/pipe/i965simple/brw_surface.c index 76b8c73d5c..252aec7d29 100644 --- a/src/mesa/pipe/i965simple/brw_surface.c +++ b/src/mesa/pipe/i965simple/brw_surface.c @@ -64,7 +64,7 @@ brw_get_tex_surface(struct pipe_context *pipe, if (ps) { assert(ps->format); assert(ps->refcount); - pipe->winsys->buffer_reference(pipe->winsys, &ps->buffer, tex->buffer); + pipe_buffer_reference(pipe->winsys, &ps->buffer, tex->buffer); ps->format = pt->format; ps->cpp = pt->cpp; ps->width = pt->width[level]; diff --git a/src/mesa/pipe/i965simple/brw_tex_layout.c b/src/mesa/pipe/i965simple/brw_tex_layout.c index eadacbf09e..b8b6b579e2 100644 --- a/src/mesa/pipe/i965simple/brw_tex_layout.c +++ b/src/mesa/pipe/i965simple/brw_tex_layout.c @@ -39,6 +39,7 @@ #include "pipe/p_context.h" #include "pipe/p_defines.h" #include "pipe/p_util.h" +#include "pipe/p_inlines.h" #include "pipe/p_winsys.h" #include "brw_context.h" @@ -341,7 +342,7 @@ brw_texture_release(struct pipe_context *pipe, struct pipe_texture **pt) DBG("%s deleting %p\n", __FUNCTION__, (void *) tex); */ - pipe->winsys->buffer_reference(pipe->winsys, &tex->buffer, NULL); + pipe_buffer_reference(pipe->winsys, &tex->buffer, NULL); for (i = 0; i < PIPE_MAX_TEXTURE_LEVELS; i++) if (tex->image_offset[i]) diff --git a/src/mesa/pipe/i965simple/brw_winsys.h b/src/mesa/pipe/i965simple/brw_winsys.h index b60f63aa5b..3523a58614 100644 --- a/src/mesa/pipe/i965simple/brw_winsys.h +++ b/src/mesa/pipe/i965simple/brw_winsys.h @@ -50,7 +50,7 @@ * etc. */ -struct pipe_buffer_handle; +struct pipe_buffer; struct pipe_fence_handle; struct pipe_winsys; @@ -136,7 +136,7 @@ struct brw_winsys { * I915_BUFFER_ACCESS_READ macros. */ void (*batch_reloc)(struct brw_winsys *sws, - struct pipe_buffer_handle *buf, + struct pipe_buffer *buf, unsigned access_flags, unsigned delta); @@ -159,7 +159,7 @@ struct brw_winsys { * simulator: */ void (*buffer_subdata_typed)(struct brw_winsys *sws, - struct pipe_buffer_handle *buf, + struct pipe_buffer *buf, unsigned long offset, unsigned long size, const void *data, @@ -170,7 +170,7 @@ struct brw_winsys { * of places yet: */ unsigned (*get_buffer_offset)( struct brw_winsys *sws, - struct pipe_buffer_handle *buf, + struct pipe_buffer *buf, unsigned flags ); }; diff --git a/src/mesa/pipe/i965simple/brw_wm_surface_state.c b/src/mesa/pipe/i965simple/brw_wm_surface_state.c index fc40e0438c..cbb4f2efd3 100644 --- a/src/mesa/pipe/i965simple/brw_wm_surface_state.c +++ b/src/mesa/pipe/i965simple/brw_wm_surface_state.c @@ -127,7 +127,7 @@ static unsigned translate_tex_format( enum pipe_format pipe_format ) } static unsigned brw_buffer_offset(struct brw_context *brw, - struct pipe_buffer_handle *buffer) + struct pipe_buffer *buffer) { return brw->winsys->get_buffer_offset(brw->winsys, buffer, -- cgit v1.2.3