diff options
author | Marek Olšák <[email protected]> | 2012-04-10 21:29:06 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2012-04-24 01:39:21 +0200 |
commit | a52b3338c6e51421e3836ae210cd98d9c1ec337b (patch) | |
tree | 0b9d312f88760bbdc91bdd3e9d48195bfde6dce0 /src/gallium/drivers/r600 | |
parent | 7d36478d888accd18d55cc76ba41af0ad7d3baf8 (diff) |
u_vbuf: remove u_vbuf_resource
Diffstat (limited to 'src/gallium/drivers/r600')
-rw-r--r-- | src/gallium/drivers/r600/evergreen_state.c | 6 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600.h | 3 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_blit.c | 10 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_buffer.c | 58 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_hw_context.c | 6 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_query.c | 4 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_state.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_state_common.c | 4 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_texture.c | 28 |
9 files changed, 60 insertions, 61 deletions
diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 3b437bad325..97a27d242c0 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -1408,7 +1408,7 @@ static void evergreen_cb(struct r600_context *rctx, struct r600_pipe_state *rsta format = r600_translate_colorformat(surf->base.format); swap = r600_translate_colorswap(surf->base.format); - if (rtex->resource.b.b.b.usage == PIPE_USAGE_STAGING) { + if (rtex->resource.b.b.usage == PIPE_USAGE_STAGING) { endian = ENDIAN_NONE; } else { endian = r600_colorformat_endian_swap(format); @@ -1725,7 +1725,7 @@ static void evergreen_emit_vertex_buffers(struct r600_context *rctx, struct r600 continue; } - va = r600_resource_va(&rctx->screen->screen, &rbuffer->b.b.b); + va = r600_resource_va(&rctx->screen->screen, &rbuffer->b.b); va += vb[i].buffer_offset; /* fetch resources start at index 992 */ @@ -1771,7 +1771,7 @@ static void evergreen_emit_constant_buffer(struct r600_context *rctx, rbuffer = (struct r600_resource*)cb->buffer; assert(rbuffer); - va = r600_resource_va(&rctx->screen->screen, &rbuffer->b.b.b); + va = r600_resource_va(&rctx->screen->screen, &rbuffer->b.b); va += cb->buffer_offset; r600_write_context_reg(cs, reg_alu_constbuf_size + buffer_index * 4, diff --git a/src/gallium/drivers/r600/r600.h b/src/gallium/drivers/r600/r600.h index e705b895255..dd4fc009d3d 100644 --- a/src/gallium/drivers/r600/r600.h +++ b/src/gallium/drivers/r600/r600.h @@ -28,6 +28,7 @@ #include "../../winsys/radeon/drm/radeon_winsys.h" #include "util/u_double_list.h" +#include "util/u_transfer.h" #include "util/u_vbuf.h" #define R600_ERR(fmt, args...) \ @@ -79,7 +80,7 @@ struct r600_tiling_info { }; struct r600_resource { - struct u_vbuf_resource b; + struct u_resource b; /* Winsys objects. */ struct pb_buffer *buf; diff --git a/src/gallium/drivers/r600/r600_blit.c b/src/gallium/drivers/r600/r600_blit.c index 480bef1baab..a7a0d9dfc1c 100644 --- a/src/gallium/drivers/r600/r600_blit.c +++ b/src/gallium/drivers/r600/r600_blit.c @@ -127,8 +127,8 @@ void r600_blit_uncompress_depth(struct pipe_context *ctx, struct r600_resource_t rctx->family == CHIP_RV620 || rctx->family == CHIP_RV635) depth = 0.0f; - for (level = 0; level <= texture->resource.b.b.b.last_level; level++) { - unsigned num_layers = u_num_layers(&texture->resource.b.b.b, level); + for (level = 0; level <= texture->resource.b.b.last_level; level++) { + unsigned num_layers = u_num_layers(&texture->resource.b.b, level); for (layer = 0; layer < num_layers; layer++) { struct pipe_surface *zsurf, *cbsurf, surf_tmpl; @@ -139,7 +139,7 @@ void r600_blit_uncompress_depth(struct pipe_context *ctx, struct r600_resource_t surf_tmpl.u.tex.last_layer = layer; surf_tmpl.usage = PIPE_BIND_DEPTH_STENCIL; - zsurf = ctx->create_surface(ctx, &texture->resource.b.b.b, &surf_tmpl); + zsurf = ctx->create_surface(ctx, &texture->resource.b.b, &surf_tmpl); surf_tmpl.format = texture->flushed_depth_texture->real_format; surf_tmpl.usage = PIPE_BIND_RENDER_TARGET; @@ -390,8 +390,8 @@ void r600_blit_push_depth(struct pipe_context *ctx, struct r600_resource_texture struct pipe_box sbox; sbox.x = sbox.y = sbox.z = 0; - sbox.width = texture->resource.b.b.b.width0; - sbox.height = texture->resource.b.b.b.height0; + sbox.width = texture->resource.b.b.width0; + sbox.height = texture->resource.b.b.height0; /* XXX that might be wrong */ sbox.depth = 1; diff --git a/src/gallium/drivers/r600/r600_buffer.c b/src/gallium/drivers/r600/r600_buffer.c index 440af5622fa..c22d36147df 100644 --- a/src/gallium/drivers/r600/r600_buffer.c +++ b/src/gallium/drivers/r600/r600_buffer.c @@ -69,7 +69,7 @@ static void r600_set_constants_dirty_if_bound(struct r600_context *rctx, while (mask) { unsigned i = u_bit_scan(&mask); - if (state->cb[i].buffer == &rbuffer->b.b.b) { + if (state->cb[i].buffer == &rbuffer->b.b) { found = true; state->dirty_mask |= 1 << i; } @@ -101,20 +101,20 @@ static void *r600_buffer_transfer_map(struct pipe_context *pipe, /* Create a new one in the same pipe_resource. */ /* XXX We probably want a different alignment for buffers and textures. */ - r600_init_resource(rctx->screen, rbuffer, rbuffer->b.b.b.width0, 4096, - rbuffer->b.b.b.bind, rbuffer->b.b.b.usage); + r600_init_resource(rctx->screen, rbuffer, rbuffer->b.b.width0, 4096, + rbuffer->b.b.bind, rbuffer->b.b.usage); /* We changed the buffer, now we need to bind it where the old one was bound. */ /* Vertex buffers. */ for (i = 0; i < rctx->vbuf_mgr->nr_vertex_buffers; i++) { - if (rctx->vbuf_mgr->vertex_buffer[i].buffer == &rbuffer->b.b.b) { + if (rctx->vbuf_mgr->vertex_buffer[i].buffer == &rbuffer->b.b) { r600_inval_vertex_cache(rctx); r600_atom_dirty(rctx, &rctx->vertex_buffer_state); } } /* Streamout buffers. */ for (i = 0; i < rctx->num_so_targets; i++) { - if (rctx->so_targets[i]->b.buffer == &rbuffer->b.b.b) { + if (rctx->so_targets[i]->b.buffer == &rbuffer->b.b) { r600_context_streamout_end(rctx); rctx->streamout_start = TRUE; rctx->streamout_append_bitmask = ~0; @@ -126,8 +126,8 @@ static void *r600_buffer_transfer_map(struct pipe_context *pipe, } } - if (rbuffer->b.user_ptr) - return (uint8_t*)rbuffer->b.user_ptr + transfer->box.x; + if (rbuffer->b.b.user_ptr) + return rbuffer->b.b.user_ptr + transfer->box.x; data = rctx->ws->buffer_map(rbuffer->buf, rctx->cs, transfer->usage); if (!data) @@ -142,7 +142,7 @@ static void r600_buffer_transfer_unmap(struct pipe_context *pipe, struct r600_resource *rbuffer = r600_resource(transfer->resource); struct r600_context *rctx = (struct r600_context*)pipe; - if (rbuffer->b.user_ptr) + if (rbuffer->b.b.user_ptr) return; rctx->ws->buffer_unmap(rbuffer->buf); @@ -219,18 +219,17 @@ struct pipe_resource *r600_buffer_create(struct pipe_screen *screen, rbuffer = util_slab_alloc(&rscreen->pool_buffers); - rbuffer->b.b.b = *templ; - pipe_reference_init(&rbuffer->b.b.b.reference, 1); - rbuffer->b.b.b.screen = screen; - rbuffer->b.b.b.user_ptr = NULL; - rbuffer->b.b.vtbl = &r600_buffer_vtbl; - rbuffer->b.user_ptr = NULL; + rbuffer->b.b = *templ; + pipe_reference_init(&rbuffer->b.b.reference, 1); + rbuffer->b.b.screen = screen; + rbuffer->b.b.user_ptr = NULL; + rbuffer->b.vtbl = &r600_buffer_vtbl; if (!r600_init_resource(rscreen, rbuffer, templ->width0, alignment, templ->bind, templ->usage)) { util_slab_free(&rscreen->pool_buffers, rbuffer); return NULL; } - return &rbuffer->b.b.b; + return &rbuffer->b.b; } struct pipe_resource *r600_user_buffer_create(struct pipe_screen *screen, @@ -242,20 +241,19 @@ struct pipe_resource *r600_user_buffer_create(struct pipe_screen *screen, rbuffer = util_slab_alloc(&rscreen->pool_buffers); - pipe_reference_init(&rbuffer->b.b.b.reference, 1); - rbuffer->b.b.vtbl = &r600_buffer_vtbl; - rbuffer->b.b.b.screen = screen; - rbuffer->b.b.b.target = PIPE_BUFFER; - rbuffer->b.b.b.format = PIPE_FORMAT_R8_UNORM; - rbuffer->b.b.b.usage = PIPE_USAGE_IMMUTABLE; - rbuffer->b.b.b.bind = bind; - rbuffer->b.b.b.width0 = bytes; - rbuffer->b.b.b.height0 = 1; - rbuffer->b.b.b.depth0 = 1; - rbuffer->b.b.b.array_size = 1; - rbuffer->b.b.b.flags = 0; - rbuffer->b.b.b.user_ptr = ptr; - rbuffer->b.user_ptr = ptr; + pipe_reference_init(&rbuffer->b.b.reference, 1); + rbuffer->b.vtbl = &r600_buffer_vtbl; + rbuffer->b.b.screen = screen; + rbuffer->b.b.target = PIPE_BUFFER; + rbuffer->b.b.format = PIPE_FORMAT_R8_UNORM; + rbuffer->b.b.usage = PIPE_USAGE_IMMUTABLE; + rbuffer->b.b.bind = bind; + rbuffer->b.b.width0 = bytes; + rbuffer->b.b.height0 = 1; + rbuffer->b.b.depth0 = 1; + rbuffer->b.b.array_size = 1; + rbuffer->b.b.flags = 0; + rbuffer->b.b.user_ptr = ptr; rbuffer->buf = NULL; - return &rbuffer->b.b.b; + return &rbuffer->b.b; } diff --git a/src/gallium/drivers/r600/r600_hw_context.c b/src/gallium/drivers/r600/r600_hw_context.c index e898a598e3e..febe9bd665e 100644 --- a/src/gallium/drivers/r600/r600_hw_context.c +++ b/src/gallium/drivers/r600/r600_hw_context.c @@ -858,7 +858,7 @@ void r600_context_pipe_state_set(struct r600_context *ctx, struct r600_pipe_stat if (block->pm4_bo_index[id]) { /* find relocation */ reloc_id = block->pm4_bo_index[id]; - pipe_resource_reference((struct pipe_resource**)&block->reloc[reloc_id].bo, ®->bo->b.b.b); + pipe_resource_reference((struct pipe_resource**)&block->reloc[reloc_id].bo, ®->bo->b.b); block->reloc[reloc_id].bo_usage = reg->bo_usage; /* always force dirty for relocs for now */ dirty |= R600_BLOCK_STATUS_DIRTY; @@ -919,9 +919,9 @@ void r600_context_pipe_state_set_resource(struct r600_context *ctx, struct r600_ if (dirty) { /* TEXTURE RESOURCE */ - pipe_resource_reference((struct pipe_resource**)&block->reloc[1].bo, &state->bo[0]->b.b.b); + pipe_resource_reference((struct pipe_resource**)&block->reloc[1].bo, &state->bo[0]->b.b); block->reloc[1].bo_usage = state->bo_usage[0]; - pipe_resource_reference((struct pipe_resource**)&block->reloc[2].bo, &state->bo[1]->b.b.b); + pipe_resource_reference((struct pipe_resource**)&block->reloc[2].bo, &state->bo[1]->b.b); block->reloc[2].bo_usage = state->bo_usage[1]; r600_context_dirty_resource_block(ctx, block, dirty, num_regs - 1); diff --git a/src/gallium/drivers/r600/r600_query.c b/src/gallium/drivers/r600/r600_query.c index 8cf78905e3d..9632d18e391 100644 --- a/src/gallium/drivers/r600/r600_query.c +++ b/src/gallium/drivers/r600/r600_query.c @@ -92,7 +92,7 @@ static void r600_emit_query_begin(struct r600_context *ctx, struct r600_query *q r600_need_cs_space(ctx, query->num_cs_dw * 2, TRUE); /* Get a new query buffer if needed. */ - if (query->buffer.results_end + query->result_size > query->buffer.buf->b.b.b.width0) { + if (query->buffer.results_end + query->result_size > query->buffer.buf->b.b.width0) { struct r600_query_buffer *qbuf = MALLOC_STRUCT(r600_query_buffer); *qbuf = query->buffer; query->buffer.buf = r600_new_query_buffer(ctx, query->type); @@ -228,7 +228,7 @@ static void r600_emit_query_predication(struct r600_context *ctx, struct r600_qu /* emit predicate packets for all data blocks */ for (qbuf = &query->buffer; qbuf; qbuf = qbuf->previous) { unsigned results_base = 0; - uint64_t va = r600_resource_va(&ctx->screen->screen, &qbuf->buf->b.b.b); + uint64_t va = r600_resource_va(&ctx->screen->screen, &qbuf->buf->b.b); while (results_base < qbuf->results_end) { cs->buf[cs->cdw++] = PKT3(PKT3_SET_PREDICATION, 1, 0); diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index 2498196fd5e..116ec5fca0e 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -1451,7 +1451,7 @@ static void r600_cb(struct r600_context *rctx, struct r600_pipe_state *rstate, format = r600_translate_colorformat(surf->base.format); swap = r600_translate_colorswap(surf->base.format); - if(rtex->resource.b.b.b.usage == PIPE_USAGE_STAGING) { + if(rtex->resource.b.b.usage == PIPE_USAGE_STAGING) { endian = ENDIAN_NONE; } else { endian = r600_colorformat_endian_swap(format); diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c index 6c02ed544c4..a5b4c911ca1 100644 --- a/src/gallium/drivers/r600/r600_state_common.c +++ b/src/gallium/drivers/r600/r600_state_common.c @@ -557,7 +557,7 @@ void r600_set_constant_buffer(struct pipe_context *ctx, uint shader, uint index, cb = &state->cb[index]; cb->buffer_size = buffer->width0; - ptr = u_vbuf_resource(buffer)->user_ptr; + ptr = buffer->user_ptr; if (ptr) { /* Upload the user buffer. */ @@ -778,7 +778,7 @@ void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *dinfo) /* Translate or upload, if needed. */ r600_translate_index_buffer(rctx, &ib, info.count); - ptr = u_vbuf_resource(ib.buffer)->user_ptr; + ptr = ib.buffer->user_ptr; if (ptr) { u_upload_data(rctx->vbuf_mgr->uploader, 0, info.count * ib.index_size, ptr, &ib.offset, &ib.buffer); diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c index ce66117ed47..99cba964a32 100644 --- a/src/gallium/drivers/r600/r600_texture.c +++ b/src/gallium/drivers/r600/r600_texture.c @@ -37,7 +37,7 @@ static void r600_copy_to_staging_texture(struct pipe_context *ctx, struct r600_t struct pipe_transfer *transfer = (struct pipe_transfer*)rtransfer; struct pipe_resource *texture = transfer->resource; - ctx->resource_copy_region(ctx, &rtransfer->staging->b.b.b, + ctx->resource_copy_region(ctx, &rtransfer->staging->b.b, 0, 0, 0, 0, texture, transfer->level, &transfer->box); } @@ -57,7 +57,7 @@ static void r600_copy_from_staging_texture(struct pipe_context *ctx, struct r600 sbox.depth = 1; ctx->resource_copy_region(ctx, texture, transfer->level, transfer->box.x, transfer->box.y, transfer->box.z, - &rtransfer->staging->b.b.b, + &rtransfer->staging->b.b, 0, &sbox); } @@ -66,7 +66,7 @@ unsigned r600_texture_get_offset(struct r600_resource_texture *rtex, { unsigned offset = rtex->offset[level]; - switch (rtex->resource.b.b.b.target) { + switch (rtex->resource.b.b.target) { case PIPE_TEXTURE_3D: case PIPE_TEXTURE_CUBE: default: @@ -163,7 +163,7 @@ static unsigned r600_texture_get_nblocksx(struct pipe_screen *screen, struct r600_resource_texture *rtex, unsigned level) { - struct pipe_resource *ptex = &rtex->resource.b.b.b; + struct pipe_resource *ptex = &rtex->resource.b.b; unsigned nblocksx, block_align, width; unsigned blocksize = util_format_get_blocksize(rtex->real_format); @@ -183,7 +183,7 @@ static unsigned r600_texture_get_nblocksy(struct pipe_screen *screen, struct r600_resource_texture *rtex, unsigned level) { - struct pipe_resource *ptex = &rtex->resource.b.b.b; + struct pipe_resource *ptex = &rtex->resource.b.b; unsigned height, tile_height; height = mip_minify(ptex->height0, level); @@ -208,7 +208,7 @@ static void r600_texture_set_array_mode(struct pipe_screen *screen, struct r600_resource_texture *rtex, unsigned level, unsigned array_mode) { - struct pipe_resource *ptex = &rtex->resource.b.b.b; + struct pipe_resource *ptex = &rtex->resource.b.b; switch (array_mode) { case V_0280A0_ARRAY_LINEAR_GENERAL: @@ -311,7 +311,7 @@ static int r600_setup_surface(struct pipe_screen *screen, unsigned array_mode, unsigned pitch_in_bytes_override) { - struct pipe_resource *ptex = &rtex->resource.b.b.b; + struct pipe_resource *ptex = &rtex->resource.b.b; struct r600_screen *rscreen = (struct r600_screen*)screen; unsigned i; int r; @@ -364,7 +364,7 @@ static void r600_setup_miptree(struct pipe_screen *screen, struct r600_resource_texture *rtex, unsigned array_mode) { - struct pipe_resource *ptex = &rtex->resource.b.b.b; + struct pipe_resource *ptex = &rtex->resource.b.b; enum chip_class chipc = ((struct r600_screen*)screen)->chip_class; unsigned size, layer_size, i, offset; unsigned nblocksx, nblocksy; @@ -501,10 +501,10 @@ r600_texture_create_object(struct pipe_screen *screen, return NULL; resource = &rtex->resource; - resource->b.b.b = *base; - resource->b.b.vtbl = &r600_texture_vtbl; - pipe_reference_init(&resource->b.b.b.reference, 1); - resource->b.b.b.screen = screen; + resource->b.b = *base; + resource->b.vtbl = &r600_texture_vtbl; + pipe_reference_init(&resource->b.b.reference, 1); + resource->b.b.screen = screen; rtex->pitch_override = pitch_in_bytes_override; rtex->real_format = base->format; @@ -573,7 +573,7 @@ r600_texture_create_object(struct pipe_screen *screen, stencil_align = r600_get_base_alignment(screen, rtex->stencil->real_format, array_mode); stencil_offset = align(rtex->size, stencil_align); - for (unsigned i = 0; i <= rtex->stencil->resource.b.b.b.last_level; i++) + for (unsigned i = 0; i <= rtex->stencil->resource.b.b.last_level; i++) rtex->stencil->offset[i] += stencil_offset; rtex->size = stencil_offset + rtex->stencil->size; @@ -581,7 +581,7 @@ r600_texture_create_object(struct pipe_screen *screen, /* Now create the backing buffer. */ if (!buf && alloc_bo) { - struct pipe_resource *ptex = &rtex->resource.b.b.b; + struct pipe_resource *ptex = &rtex->resource.b.b; unsigned base_align = r600_get_base_alignment(screen, ptex->format, array_mode); if (rscreen->use_surface_alloc) { |