From: Marek Olšák Date: Tue, 10 Apr 2012 19:29:06 +0000 (+0200) Subject: u_vbuf: remove u_vbuf_resource X-Git-Tag: mesa-9.0~2291 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a52b3338c6e51421e3836ae210cd98d9c1ec337b;p=platform%2Fupstream%2Fmesa.git u_vbuf: remove u_vbuf_resource --- diff --git a/src/gallium/auxiliary/util/u_vbuf.h b/src/gallium/auxiliary/util/u_vbuf.h index b5b7298..a17d64a 100644 --- a/src/gallium/auxiliary/util/u_vbuf.h +++ b/src/gallium/auxiliary/util/u_vbuf.h @@ -35,7 +35,6 @@ #include "pipe/p_context.h" #include "pipe/p_state.h" -#include "util/u_transfer.h" /* Hardware vertex fetcher limitations can be described by this structure. */ struct u_vbuf_caps { @@ -78,12 +77,6 @@ struct u_vbuf { void *vertex_elements; }; -/* XXX this is no longer needed and can be removed */ -struct u_vbuf_resource { - struct u_resource b; - uint8_t *user_ptr; -}; - enum u_fetch_alignment { U_VERTEX_FETCH_BYTE_ALIGNED, U_VERTEX_FETCH_DWORD_ALIGNED @@ -101,10 +94,4 @@ void u_vbuf_destroy(struct u_vbuf *mgr); unsigned u_vbuf_draw_max_vertex_count(struct u_vbuf *mgr); - -static INLINE struct u_vbuf_resource *u_vbuf_resource(struct pipe_resource *r) -{ - return (struct u_vbuf_resource*)r; -} - #endif diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h index 9367fc0..29f2717 100644 --- a/src/gallium/drivers/r300/r300_context.h +++ b/src/gallium/drivers/r300/r300_context.h @@ -383,7 +383,7 @@ struct r300_texture_desc { struct r300_resource { - struct u_vbuf_resource b; + struct u_resource b; /* Winsys buffer backing this resource. */ struct pb_buffer *buf; diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index 467339f..4c0daa6 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -120,9 +120,9 @@ static void get_rc_constant_state( case RC_STATE_R300_TEXSCALE_FACTOR: tex = r300_resource(texstate->sampler_views[constant->u.State[1]]->base.texture); /* Add a small number to the texture size to work around rounding errors in hw. */ - vec[0] = tex->b.b.b.width0 / (tex->tex.width0 + 0.001f); - vec[1] = tex->b.b.b.height0 / (tex->tex.height0 + 0.001f); - vec[2] = tex->b.b.b.depth0 / (tex->tex.depth0 + 0.001f); + vec[0] = tex->b.b.width0 / (tex->tex.width0 + 0.001f); + vec[1] = tex->b.b.height0 / (tex->tex.height0 + 0.001f); + vec[2] = tex->b.b.depth0 / (tex->tex.depth0 + 0.001f); vec[3] = 1; break; diff --git a/src/gallium/drivers/r300/r300_fs.c b/src/gallium/drivers/r300/r300_fs.c index 051b292..8a492d2 100644 --- a/src/gallium/drivers/r300/r300_fs.c +++ b/src/gallium/drivers/r300/r300_fs.c @@ -212,7 +212,7 @@ static void get_external_state( state->unit[i].wrap_mode = RC_WRAP_NONE; } - if (t->b.b.b.target == PIPE_TEXTURE_3D) + if (t->b.b.target == PIPE_TEXTURE_3D) state->unit[i].clamp_and_scale_before_fetch = TRUE; } } diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c index c0f5687..d5ba4fa 100644 --- a/src/gallium/drivers/r300/r300_render.c +++ b/src/gallium/drivers/r300/r300_render.c @@ -529,7 +529,7 @@ static void r300_draw_elements_immediate(struct r300_context *r300, switch (index_size) { case 1: - ptr1 = r300_resource(r300->index_buffer.buffer)->b.user_ptr; + ptr1 = r300->index_buffer.buffer->user_ptr; ptr1 += info->start; OUT_CS(R300_VAP_VF_CNTL__PRIM_WALK_INDICES | (info->count << 16) | @@ -553,7 +553,7 @@ static void r300_draw_elements_immediate(struct r300_context *r300, break; case 2: - ptr2 = (uint16_t*)r300_resource(r300->index_buffer.buffer)->b.user_ptr; + ptr2 = (uint16_t*)r300->index_buffer.buffer->user_ptr; ptr2 += info->start; OUT_CS(R300_VAP_VF_CNTL__PRIM_WALK_INDICES | (info->count << 16) | @@ -572,7 +572,7 @@ static void r300_draw_elements_immediate(struct r300_context *r300, break; case 4: - ptr4 = (uint32_t*)r300_resource(r300->index_buffer.buffer)->b.user_ptr; + ptr4 = (uint32_t*)r300->index_buffer.buffer->user_ptr; ptr4 += info->start; OUT_CS(R300_VAP_VF_CNTL__PRIM_WALK_INDICES | (info->count << 16) | @@ -614,7 +614,7 @@ static void r300_draw_elements(struct r300_context *r300, /* Fallback for misaligned ushort indices. */ if (indexSize == 2 && (start & 1) && - !r300_resource(indexBuffer)->b.user_ptr) { + !indexBuffer->user_ptr) { /* If we got here, then orgIndexBuffer == indexBuffer. */ uint16_t *ptr = r300->rws->buffer_map(r300_resource(orgIndexBuffer)->buf, r300->cs, @@ -632,10 +632,10 @@ static void r300_draw_elements(struct r300_context *r300, } r300->rws->buffer_unmap(r300_resource(orgIndexBuffer)->buf); } else { - if (r300_resource(indexBuffer)->b.user_ptr) + if (indexBuffer->user_ptr) r300_upload_index_buffer(r300, &indexBuffer, indexSize, &start, count, - r300_resource(indexBuffer)->b.user_ptr); + indexBuffer->user_ptr); } /* 19 dwords for emit_draw_elements. Give up if the function fails. */ @@ -775,7 +775,7 @@ static void r300_draw_vbo(struct pipe_context* pipe, if (info.instance_count <= 1) { if (info.count <= 8 && - r300_resource(r300->index_buffer.buffer)->b.user_ptr) { + r300->index_buffer.buffer->user_ptr) { r300_draw_elements_immediate(r300, &info); } else { r300_draw_elements(r300, &info, -1); diff --git a/src/gallium/drivers/r300/r300_screen_buffer.c b/src/gallium/drivers/r300/r300_screen_buffer.c index fba17a2..c92b831 100644 --- a/src/gallium/drivers/r300/r300_screen_buffer.c +++ b/src/gallium/drivers/r300/r300_screen_buffer.c @@ -108,8 +108,8 @@ r300_buffer_transfer_map( struct pipe_context *pipe, uint8_t *map; enum pipe_transfer_usage usage; - if (rbuf->b.user_ptr) - return (uint8_t *) rbuf->b.user_ptr + transfer->box.x; + if (rbuf->b.b.user_ptr) + return rbuf->b.b.user_ptr + transfer->box.x; if (rbuf->constant_buffer) return (uint8_t *) rbuf->constant_buffer + transfer->box.x; @@ -158,7 +158,7 @@ static void r300_buffer_transfer_inline_write(struct pipe_context *pipe, memcpy(rbuf->constant_buffer + box->x, data, box->width); return; } - assert(rbuf->b.user_ptr == NULL); + assert(rbuf->b.b.user_ptr == NULL); map = rws->buffer_map(rbuf->buf, r300->cs, PIPE_TRANSFER_WRITE | PIPE_TRANSFER_DISCARD_RANGE | usage); @@ -189,12 +189,11 @@ struct pipe_resource *r300_buffer_create(struct pipe_screen *screen, rbuf = util_slab_alloc(&r300screen->pool_buffers); - rbuf->b.b.b = *templ; - rbuf->b.b.vtbl = &r300_buffer_vtbl; - pipe_reference_init(&rbuf->b.b.b.reference, 1); - rbuf->b.b.b.screen = screen; - rbuf->b.b.b.user_ptr = NULL; - rbuf->b.user_ptr = NULL; + rbuf->b.b = *templ; + rbuf->b.vtbl = &r300_buffer_vtbl; + pipe_reference_init(&rbuf->b.b.reference, 1); + rbuf->b.b.screen = screen; + rbuf->b.b.user_ptr = NULL; rbuf->domain = RADEON_DOMAIN_GTT; rbuf->buf = NULL; rbuf->constant_buffer = NULL; @@ -202,13 +201,13 @@ struct pipe_resource *r300_buffer_create(struct pipe_screen *screen, /* Alloc constant buffers in RAM. */ if (templ->bind & PIPE_BIND_CONSTANT_BUFFER) { rbuf->constant_buffer = MALLOC(templ->width0); - return &rbuf->b.b.b; + return &rbuf->b.b; } rbuf->buf = r300screen->rws->buffer_create(r300screen->rws, - rbuf->b.b.b.width0, alignment, - rbuf->b.b.b.bind, rbuf->domain); + rbuf->b.b.width0, alignment, + rbuf->b.b.bind, rbuf->domain); if (!rbuf->buf) { util_slab_free(&r300screen->pool_buffers, rbuf); return NULL; @@ -217,7 +216,7 @@ struct pipe_resource *r300_buffer_create(struct pipe_screen *screen, rbuf->cs_buf = r300screen->rws->buffer_get_cs_handle(rbuf->buf); - return &rbuf->b.b.b; + return &rbuf->b.b; } struct pipe_resource *r300_user_buffer_create(struct pipe_screen *screen, @@ -229,22 +228,21 @@ struct pipe_resource *r300_user_buffer_create(struct pipe_screen *screen, rbuf = util_slab_alloc(&r300screen->pool_buffers); - pipe_reference_init(&rbuf->b.b.b.reference, 1); - rbuf->b.b.b.screen = screen; - rbuf->b.b.b.target = PIPE_BUFFER; - rbuf->b.b.b.format = PIPE_FORMAT_R8_UNORM; - rbuf->b.b.b.usage = PIPE_USAGE_IMMUTABLE; - rbuf->b.b.b.bind = bind; - rbuf->b.b.b.width0 = ~0; - rbuf->b.b.b.height0 = 1; - rbuf->b.b.b.depth0 = 1; - rbuf->b.b.b.array_size = 1; - rbuf->b.b.b.flags = 0; - rbuf->b.b.b.user_ptr = ptr; - rbuf->b.b.vtbl = &r300_buffer_vtbl; - rbuf->b.user_ptr = ptr; + pipe_reference_init(&rbuf->b.b.reference, 1); + rbuf->b.b.screen = screen; + rbuf->b.b.target = PIPE_BUFFER; + rbuf->b.b.format = PIPE_FORMAT_R8_UNORM; + rbuf->b.b.usage = PIPE_USAGE_IMMUTABLE; + rbuf->b.b.bind = bind; + rbuf->b.b.width0 = ~0; + rbuf->b.b.height0 = 1; + rbuf->b.b.depth0 = 1; + rbuf->b.b.array_size = 1; + rbuf->b.b.flags = 0; + rbuf->b.b.user_ptr = ptr; + rbuf->b.vtbl = &r300_buffer_vtbl; rbuf->domain = RADEON_DOMAIN_GTT; rbuf->buf = NULL; rbuf->constant_buffer = NULL; - return &rbuf->b.b.b; + return &rbuf->b.b; } diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index a5bc662..337008b 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -1840,8 +1840,8 @@ static void r300_set_constant_buffer(struct pipe_context *pipe, if (buf == NULL || buf->width0 == 0) return; - if (rbuf->b.user_ptr) - mapped = (uint32_t*)rbuf->b.user_ptr; + if (rbuf->b.b.user_ptr) + mapped = (uint32_t*)rbuf->b.b.user_ptr; else if (rbuf->constant_buffer) mapped = (uint32_t*)rbuf->constant_buffer; else diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c index 2dabf18..940179c 100644 --- a/src/gallium/drivers/r300/r300_state_derived.c +++ b/src/gallium/drivers/r300/r300_state_derived.c @@ -769,7 +769,7 @@ static void r300_merge_textures_and_samplers(struct r300_context* r300) base_level = view->base.u.tex.first_level; min_level = sampler->min_lod; level_count = MIN3(sampler->max_lod, - tex->b.b.b.last_level - base_level, + tex->b.b.last_level - base_level, view->base.u.tex.last_level - base_level); if (base_level + min_level) { @@ -832,14 +832,14 @@ static void r300_merge_textures_and_samplers(struct r300_context* r300) } /* to emulate 1D textures through 2D ones correctly */ - if (tex->b.b.b.target == PIPE_TEXTURE_1D) { + if (tex->b.b.target == PIPE_TEXTURE_1D) { texstate->filter0 &= ~R300_TX_WRAP_T_MASK; texstate->filter0 |= R300_TX_WRAP_T(R300_TX_CLAMP_TO_EDGE); } /* The hardware doesn't like CLAMP and CLAMP_TO_BORDER * for the 3rd coordinate if the texture isn't 3D. */ - if (tex->b.b.b.target != PIPE_TEXTURE_3D) { + if (tex->b.b.target != PIPE_TEXTURE_3D) { texstate->filter0 &= ~R300_TX_WRAP_R_MASK; } diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c index 75749e7..8c5ee05 100644 --- a/src/gallium/drivers/r300/r300_texture.c +++ b/src/gallium/drivers/r300/r300_texture.c @@ -728,7 +728,7 @@ void r300_texture_setup_format_state(struct r300_screen *screen, unsigned height0_override, struct r300_texture_format_state *out) { - struct pipe_resource *pt = &tex->b.b.b; + struct pipe_resource *pt = &tex->b.b; struct r300_texture_desc *desc = &tex->tex; boolean is_r500 = screen->caps.is_r500; unsigned width, height, depth; @@ -886,12 +886,12 @@ r300_texture_create_object(struct r300_screen *rscreen, if (base->nr_samples > 1) return NULL; - pipe_reference_init(&tex->b.b.b.reference, 1); - tex->b.b.b.screen = &rscreen->screen; - tex->b.b.b.usage = base->usage; - tex->b.b.b.bind = base->bind; - tex->b.b.b.flags = base->flags; - tex->b.b.vtbl = &r300_texture_vtbl; + pipe_reference_init(&tex->b.b.reference, 1); + tex->b.b.screen = &rscreen->screen; + tex->b.b.usage = base->usage; + tex->b.b.bind = base->bind; + tex->b.b.flags = base->flags; + tex->b.vtbl = &r300_texture_vtbl; tex->tex.microtile = microtile; tex->tex.macrotile[0] = macrotile; tex->tex.stride_in_bytes_override = stride_in_bytes_override; @@ -1033,7 +1033,7 @@ struct pipe_surface* r300_create_surface_custom(struct pipe_context * ctx, /* Height must be aligned to the size of a tile. */ tile_height = r300_get_pixel_alignment(surface->base.format, - tex->b.b.b.nr_samples, + tex->b.b.nr_samples, tex->tex.microtile, tex->tex.macrotile[level], DIM_HEIGHT, 0); diff --git a/src/gallium/drivers/r300/r300_texture_desc.c b/src/gallium/drivers/r300/r300_texture_desc.c index c250bf1..04d439b 100644 --- a/src/gallium/drivers/r300/r300_texture_desc.c +++ b/src/gallium/drivers/r300/r300_texture_desc.c @@ -95,7 +95,7 @@ static boolean r300_texture_macro_switch(struct r300_resource *tex, { unsigned tile, texdim; - tile = r300_get_pixel_alignment(tex->b.b.b.format, tex->b.b.b.nr_samples, + tile = r300_get_pixel_alignment(tex->b.b.format, tex->b.b.nr_samples, tex->tex.microtile, RADEON_LAYOUT_TILED, dim, 0); if (dim == DIM_WIDTH) { texdim = u_minify(tex->tex.width0, level); @@ -128,27 +128,27 @@ static unsigned r300_texture_get_stride(struct r300_screen *screen, return tex->tex.stride_in_bytes_override; /* Check the level. */ - if (level > tex->b.b.b.last_level) { + if (level > tex->b.b.last_level) { SCREEN_DBG(screen, DBG_TEX, "%s: level (%u) > last_level (%u)\n", - __FUNCTION__, level, tex->b.b.b.last_level); + __FUNCTION__, level, tex->b.b.last_level); return 0; } width = u_minify(tex->tex.width0, level); - if (util_format_is_plain(tex->b.b.b.format)) { - tile_width = r300_get_pixel_alignment(tex->b.b.b.format, - tex->b.b.b.nr_samples, + if (util_format_is_plain(tex->b.b.format)) { + tile_width = r300_get_pixel_alignment(tex->b.b.format, + tex->b.b.nr_samples, tex->tex.microtile, tex->tex.macrotile[level], DIM_WIDTH, is_rs690); width = align(width, tile_width); - stride = util_format_get_stride(tex->b.b.b.format, width); + stride = util_format_get_stride(tex->b.b.format, width); /* The alignment to 32 bytes is sort of implied by the layout... */ return stride; } else { - return align(util_format_get_stride(tex->b.b.b.format, width), is_rs690 ? 64 : 32); + return align(util_format_get_stride(tex->b.b.format, width), is_rs690 ? 64 : 32); } } @@ -161,16 +161,16 @@ static unsigned r300_texture_get_nblocksy(struct r300_resource *tex, height = u_minify(tex->tex.height0, level); /* Mipmapped and 3D textures must have their height aligned to POT. */ - if ((tex->b.b.b.target != PIPE_TEXTURE_1D && - tex->b.b.b.target != PIPE_TEXTURE_2D && - tex->b.b.b.target != PIPE_TEXTURE_RECT) || - tex->b.b.b.last_level != 0) { + if ((tex->b.b.target != PIPE_TEXTURE_1D && + tex->b.b.target != PIPE_TEXTURE_2D && + tex->b.b.target != PIPE_TEXTURE_RECT) || + tex->b.b.last_level != 0) { height = util_next_power_of_two(height); } - if (util_format_is_plain(tex->b.b.b.format)) { - tile_height = r300_get_pixel_alignment(tex->b.b.b.format, - tex->b.b.b.nr_samples, + if (util_format_is_plain(tex->b.b.format)) { + tile_height = r300_get_pixel_alignment(tex->b.b.format, + tex->b.b.nr_samples, tex->tex.microtile, tex->tex.macrotile[level], DIM_HEIGHT, 0); @@ -187,10 +187,10 @@ static unsigned r300_texture_get_nblocksy(struct r300_resource *tex, /* Align the height so that there is an even number of macrotiles. * Do so for 3 or more macrotiles in the Y direction. */ - if (level == 0 && tex->b.b.b.last_level == 0 && - (tex->b.b.b.target == PIPE_TEXTURE_1D || - tex->b.b.b.target == PIPE_TEXTURE_2D || - tex->b.b.b.target == PIPE_TEXTURE_RECT) && + if (level == 0 && tex->b.b.last_level == 0 && + (tex->b.b.target == PIPE_TEXTURE_1D || + tex->b.b.target == PIPE_TEXTURE_2D || + tex->b.b.target == PIPE_TEXTURE_RECT) && height >= tile_height * 3) { height = align(height, tile_height * 2); } @@ -202,7 +202,7 @@ static unsigned r300_texture_get_nblocksy(struct r300_resource *tex, } } - return util_format_get_nblocksy(tex->b.b.b.format, height); + return util_format_get_nblocksy(tex->b.b.format, height); } /* Get a width in pixels from a stride in bytes. */ @@ -217,7 +217,7 @@ static void r300_setup_miptree(struct r300_screen *screen, struct r300_resource *tex, boolean align_for_cbzb) { - struct pipe_resource *base = &tex->b.b.b; + struct pipe_resource *base = &tex->b.b; unsigned stride, size, layer_size, nblocksy, i; boolean rv350_mode = screen->caps.family >= CHIP_FAMILY_R350; boolean aligned_for_cbzb; @@ -274,15 +274,15 @@ static void r300_setup_miptree(struct r300_screen *screen, static void r300_setup_flags(struct r300_resource *tex) { tex->tex.uses_stride_addressing = - !util_is_power_of_two(tex->b.b.b.width0) || + !util_is_power_of_two(tex->b.b.width0) || (tex->tex.stride_in_bytes_override && - r300_stride_to_width(tex->b.b.b.format, - tex->tex.stride_in_bytes_override) != tex->b.b.b.width0); + r300_stride_to_width(tex->b.b.format, + tex->tex.stride_in_bytes_override) != tex->b.b.width0); tex->tex.is_npot = tex->tex.uses_stride_addressing || - !util_is_power_of_two(tex->b.b.b.height0) || - !util_is_power_of_two(tex->b.b.b.depth0); + !util_is_power_of_two(tex->b.b.height0) || + !util_is_power_of_two(tex->b.b.depth0); } static void r300_setup_cbzb_flags(struct r300_screen *rscreen, @@ -291,20 +291,20 @@ static void r300_setup_cbzb_flags(struct r300_screen *rscreen, unsigned i, bpp; boolean first_level_valid; - bpp = util_format_get_blocksizebits(tex->b.b.b.format); + bpp = util_format_get_blocksizebits(tex->b.b.format); /* 1) The texture must be point-sampled, * 2) The depth must be 16 or 32 bits. * 3) If the midpoint ZB offset is not aligned to 2048, it returns garbage * with certain texture sizes. Macrotiling ensures the alignment. */ - first_level_valid = tex->b.b.b.nr_samples <= 1 && + first_level_valid = tex->b.b.nr_samples <= 1 && (bpp == 16 || bpp == 32) && tex->tex.macrotile[0]; if (SCREEN_DBG_ON(rscreen, DBG_NO_CBZB)) first_level_valid = FALSE; - for (i = 0; i <= tex->b.b.b.last_level; i++) + for (i = 0; i <= tex->b.b.last_level; i++) tex->tex.cbzb_allowed[i] = first_level_valid && tex->tex.macrotile[i]; } @@ -353,8 +353,8 @@ static void r300_setup_hyperz_properties(struct r300_screen *screen, static unsigned hiz_align_x[4] = {8, 32, 48, 32}; static unsigned hiz_align_y[4] = {8, 8, 8, 32}; - if (util_format_is_depth_or_stencil(tex->b.b.b.format) && - util_format_get_blocksizebits(tex->b.b.b.format) == 32 && + if (util_format_is_depth_or_stencil(tex->b.b.format) && + util_format_get_blocksizebits(tex->b.b.format) == 32 && tex->tex.microtile) { unsigned i, pipes; @@ -364,18 +364,18 @@ static void r300_setup_hyperz_properties(struct r300_screen *screen, pipes = screen->info.r300_num_gb_pipes; } - for (i = 0; i <= tex->b.b.b.last_level; i++) { + for (i = 0; i <= tex->b.b.last_level; i++) { unsigned zcomp_numdw, zcompsize, hiz_numdw, stride, height; - stride = r300_stride_to_width(tex->b.b.b.format, + stride = r300_stride_to_width(tex->b.b.format, tex->tex.stride_in_bytes[i]); stride = align(stride, 16); - height = u_minify(tex->b.b.b.height0, i); + height = u_minify(tex->b.b.height0, i); /* The 8x8 compression mode needs macrotiling. */ zcompsize = screen->caps.z_compress == R300_ZCOMP_8X8 && tex->tex.macrotile[i] && - tex->b.b.b.nr_samples <= 1 ? 8 : 4; + tex->b.b.nr_samples <= 1 ? 8 : 4; /* Get the ZMASK buffer size in dwords. */ zcomp_numdw = r300_pixels_to_dwords(stride, height, @@ -383,7 +383,7 @@ static void r300_setup_hyperz_properties(struct r300_screen *screen, zmask_blocks_y_per_dw[pipes-1] * zcompsize); /* Check whether we have enough ZMASK memory. */ - if (util_format_get_blocksizebits(tex->b.b.b.format) == 32 && + if (util_format_get_blocksizebits(tex->b.b.format) == 32 && zcomp_numdw <= screen->caps.zmask_ram * pipes) { tex->tex.zmask_dwords[i] = zcomp_numdw; tex->tex.zcomp8x8[i] = zcompsize == 8; @@ -418,7 +418,7 @@ static void r300_setup_hyperz_properties(struct r300_screen *screen, static void r300_setup_tiling(struct r300_screen *screen, struct r300_resource *tex) { - enum pipe_format format = tex->b.b.b.format; + enum pipe_format format = tex->b.b.format; boolean rv350_mode = screen->caps.family >= CHIP_FAMILY_R350; boolean is_zb = util_format_is_depth_or_stencil(format); boolean dbg_no_tiling = SCREEN_DBG_ON(screen, DBG_NO_TILING); @@ -431,7 +431,7 @@ static void r300_setup_tiling(struct r300_screen *screen, } /* If height == 1, disable microtiling except for zbuffer. */ - if (!is_zb && (tex->b.b.b.height0 == 1 || dbg_no_tiling)) { + if (!is_zb && (tex->b.b.height0 == 1 || dbg_no_tiling)) { return; } @@ -468,24 +468,24 @@ static void r300_tex_print_info(struct r300_resource *tex, func, tex->tex.macrotile[0] ? "YES" : " NO", tex->tex.microtile ? "YES" : " NO", - r300_stride_to_width(tex->b.b.b.format, tex->tex.stride_in_bytes[0]), - tex->b.b.b.width0, tex->b.b.b.height0, tex->b.b.b.depth0, - tex->b.b.b.last_level, tex->tex.size_in_bytes, - util_format_short_name(tex->b.b.b.format)); + r300_stride_to_width(tex->b.b.format, tex->tex.stride_in_bytes[0]), + tex->b.b.width0, tex->b.b.height0, tex->b.b.depth0, + tex->b.b.last_level, tex->tex.size_in_bytes, + util_format_short_name(tex->b.b.format)); } void r300_texture_desc_init(struct r300_screen *rscreen, struct r300_resource *tex, const struct pipe_resource *base) { - tex->b.b.b.target = base->target; - tex->b.b.b.format = base->format; - tex->b.b.b.width0 = base->width0; - tex->b.b.b.height0 = base->height0; - tex->b.b.b.depth0 = base->depth0; - tex->b.b.b.array_size = base->array_size; - tex->b.b.b.last_level = base->last_level; - tex->b.b.b.nr_samples = base->nr_samples; + tex->b.b.target = base->target; + tex->b.b.format = base->format; + tex->b.b.width0 = base->width0; + tex->b.b.height0 = base->height0; + tex->b.b.depth0 = base->depth0; + tex->b.b.array_size = base->array_size; + tex->b.b.last_level = base->last_level; + tex->b.b.nr_samples = base->nr_samples; tex->tex.width0 = base->width0; tex->tex.height0 = base->height0; tex->tex.depth0 = base->depth0; @@ -538,7 +538,7 @@ unsigned r300_texture_get_offset(struct r300_resource *tex, { unsigned offset = tex->tex.offset_in_bytes[level]; - switch (tex->b.b.b.target) { + switch (tex->b.b.target) { case PIPE_TEXTURE_3D: case PIPE_TEXTURE_CUBE: return offset + layer * tex->tex.layer_size_in_bytes[level]; diff --git a/src/gallium/drivers/r300/r300_transfer.c b/src/gallium/drivers/r300/r300_transfer.c index d440db8..44ff390 100644 --- a/src/gallium/drivers/r300/r300_transfer.c +++ b/src/gallium/drivers/r300/r300_transfer.c @@ -54,7 +54,7 @@ static void r300_copy_from_tiled_texture(struct pipe_context *ctx, struct pipe_transfer *transfer = (struct pipe_transfer*)r300transfer; struct pipe_resource *tex = transfer->resource; - ctx->resource_copy_region(ctx, &r300transfer->linear_texture->b.b.b, 0, + ctx->resource_copy_region(ctx, &r300transfer->linear_texture->b.b, 0, 0, 0, 0, tex, transfer->level, &transfer->box); } @@ -70,7 +70,7 @@ static void r300_copy_into_tiled_texture(struct pipe_context *ctx, ctx->resource_copy_region(ctx, tex, transfer->level, transfer->box.x, transfer->box.y, transfer->box.z, - &r300transfer->linear_texture->b.b.b, 0, &src_box); + &r300transfer->linear_texture->b.b, 0, &src_box); /* XXX remove this. */ r300_flush(ctx, 0, NULL); @@ -230,7 +230,7 @@ void* r300_texture_transfer_map(struct pipe_context *ctx, struct r300_transfer *r300transfer = r300_transfer(transfer); struct r300_resource *tex = r300_resource(transfer->resource); char *map; - enum pipe_format format = tex->b.b.b.format; + enum pipe_format format = tex->b.b.format; if (r300transfer->linear_texture) { /* The detiled texture is of the same size as the region being mapped diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 3b437ba..97a27d2 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 e705b89..dd4fc00 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 480bef1..a7a0d9d 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 440af56..c22d361 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 e898a59..febe9bd 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 8cf7890..9632d18 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 2498196..116ec5f 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 6c02ed5..a5b4c91 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 ce66117..99cba96 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) {