diff options
author | Marek Olšák <[email protected]> | 2012-01-29 23:25:42 +0100 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2012-01-31 23:12:30 +0100 |
commit | e4340c1908a6a3b09e1a15d5195f6da7d00494d0 (patch) | |
tree | 593986b14150b70682913d4c37e4e97ad3f19492 /src/gallium/drivers/r600 | |
parent | 78293b99b23268e6698f1267aaf40647c17d95a5 (diff) |
r600g: merge r600_context with r600_pipe_context
The split made no sense.
Diffstat (limited to 'src/gallium/drivers/r600')
-rw-r--r-- | src/gallium/drivers/r600/evergreen_hw_context.c | 1 | ||||
-rw-r--r-- | src/gallium/drivers/r600/evergreen_state.c | 84 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600.h | 52 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_asm.c | 4 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_asm.h | 4 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_blit.c | 26 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_buffer.c | 18 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_hw_context.c | 3 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_pipe.c | 32 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_pipe.h | 85 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_query.c | 38 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_resource.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_resource.h | 4 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_shader.c | 10 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_state.c | 92 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_state_common.c | 122 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_texture.c | 8 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_translate.c | 2 |
18 files changed, 291 insertions, 296 deletions
diff --git a/src/gallium/drivers/r600/evergreen_hw_context.c b/src/gallium/drivers/r600/evergreen_hw_context.c index 5f2f3bb539b..b95491a4d6e 100644 --- a/src/gallium/drivers/r600/evergreen_hw_context.c +++ b/src/gallium/drivers/r600/evergreen_hw_context.c @@ -912,7 +912,6 @@ int evergreen_context_init(struct r600_context *ctx, struct r600_screen *screen) { int r; - memset(ctx, 0, sizeof(struct r600_context)); ctx->screen = screen; ctx->ws = screen->ws; diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 72ce29c579c..3131f564e1e 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -695,7 +695,7 @@ boolean evergreen_is_format_supported(struct pipe_screen *screen, static void evergreen_set_blend_color(struct pipe_context *ctx, const struct pipe_blend_color *state) { - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_context *rctx = (struct r600_context *)ctx; struct r600_pipe_state *rstate = CALLOC_STRUCT(r600_pipe_state); if (rstate == NULL) @@ -709,13 +709,13 @@ static void evergreen_set_blend_color(struct pipe_context *ctx, free(rctx->states[R600_PIPE_STATE_BLEND_COLOR]); rctx->states[R600_PIPE_STATE_BLEND_COLOR] = rstate; - r600_context_pipe_state_set(&rctx->ctx, rstate); + r600_context_pipe_state_set(rctx, rstate); } static void *evergreen_create_blend_state(struct pipe_context *ctx, const struct pipe_blend_state *state) { - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_context *rctx = (struct r600_context *)ctx; struct r600_pipe_blend *blend = CALLOC_STRUCT(r600_pipe_blend); struct r600_pipe_state *rstate; uint32_t color_control, target_mask; @@ -796,7 +796,7 @@ static void *evergreen_create_blend_state(struct pipe_context *ctx, static void *evergreen_create_dsa_state(struct pipe_context *ctx, const struct pipe_depth_stencil_alpha_state *state) { - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_context *rctx = (struct r600_context *)ctx; struct r600_pipe_dsa *dsa = CALLOC_STRUCT(r600_pipe_dsa); unsigned db_depth_control, alpha_test_control, alpha_ref; unsigned db_render_override, db_render_control; @@ -873,7 +873,7 @@ static void *evergreen_create_dsa_state(struct pipe_context *ctx, static void *evergreen_create_rs_state(struct pipe_context *ctx, const struct pipe_rasterizer_state *state) { - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_context *rctx = (struct r600_context *)ctx; struct r600_pipe_rasterizer *rs = CALLOC_STRUCT(r600_pipe_rasterizer); struct r600_pipe_state *rstate; unsigned tmp; @@ -1120,12 +1120,12 @@ static struct pipe_sampler_view *evergreen_create_sampler_view(struct pipe_conte static void evergreen_set_vs_sampler_view(struct pipe_context *ctx, unsigned count, struct pipe_sampler_view **views) { - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_context *rctx = (struct r600_context *)ctx; struct r600_pipe_sampler_view **resource = (struct r600_pipe_sampler_view **)views; for (int i = 0; i < count; i++) { if (resource[i]) { - evergreen_context_pipe_state_set_vs_resource(&rctx->ctx, &resource[i]->state, + evergreen_context_pipe_state_set_vs_resource(rctx, &resource[i]->state, i + R600_MAX_CONST_BUFFERS); } } @@ -1134,7 +1134,7 @@ static void evergreen_set_vs_sampler_view(struct pipe_context *ctx, unsigned cou static void evergreen_set_ps_sampler_view(struct pipe_context *ctx, unsigned count, struct pipe_sampler_view **views) { - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_context *rctx = (struct r600_context *)ctx; struct r600_pipe_sampler_view **resource = (struct r600_pipe_sampler_view **)views; int i; int has_depth = 0; @@ -1144,10 +1144,10 @@ static void evergreen_set_ps_sampler_view(struct pipe_context *ctx, unsigned cou if (resource[i]) { if (((struct r600_resource_texture *)resource[i]->base.texture)->depth) has_depth = 1; - evergreen_context_pipe_state_set_ps_resource(&rctx->ctx, &resource[i]->state, + evergreen_context_pipe_state_set_ps_resource(rctx, &resource[i]->state, i + R600_MAX_CONST_BUFFERS); } else - evergreen_context_pipe_state_set_ps_resource(&rctx->ctx, NULL, + evergreen_context_pipe_state_set_ps_resource(rctx, NULL, i + R600_MAX_CONST_BUFFERS); pipe_sampler_view_reference( @@ -1162,7 +1162,7 @@ static void evergreen_set_ps_sampler_view(struct pipe_context *ctx, unsigned cou } for (i = count; i < NUM_TEX_UNITS; i++) { if (rctx->ps_samplers.views[i]) { - evergreen_context_pipe_state_set_ps_resource(&rctx->ctx, NULL, + evergreen_context_pipe_state_set_ps_resource(rctx, NULL, i + R600_MAX_CONST_BUFFERS); pipe_sampler_view_reference((struct pipe_sampler_view **)&rctx->ps_samplers.views[i], NULL); } @@ -1173,7 +1173,7 @@ static void evergreen_set_ps_sampler_view(struct pipe_context *ctx, unsigned cou static void evergreen_bind_ps_sampler(struct pipe_context *ctx, unsigned count, void **states) { - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_context *rctx = (struct r600_context *)ctx; struct r600_pipe_state **rstates = (struct r600_pipe_state **)states; @@ -1181,24 +1181,24 @@ static void evergreen_bind_ps_sampler(struct pipe_context *ctx, unsigned count, rctx->ps_samplers.n_samplers = count; for (int i = 0; i < count; i++) { - evergreen_context_pipe_state_set_ps_sampler(&rctx->ctx, rstates[i], i); + evergreen_context_pipe_state_set_ps_sampler(rctx, rstates[i], i); } } static void evergreen_bind_vs_sampler(struct pipe_context *ctx, unsigned count, void **states) { - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_context *rctx = (struct r600_context *)ctx; struct r600_pipe_state **rstates = (struct r600_pipe_state **)states; for (int i = 0; i < count; i++) { - evergreen_context_pipe_state_set_vs_sampler(&rctx->ctx, rstates[i], i); + evergreen_context_pipe_state_set_vs_sampler(rctx, rstates[i], i); } } static void evergreen_set_clip_state(struct pipe_context *ctx, const struct pipe_clip_state *state) { - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_context *rctx = (struct r600_context *)ctx; struct r600_pipe_state *rstate = CALLOC_STRUCT(r600_pipe_state); struct pipe_resource *cbuf; @@ -1224,7 +1224,7 @@ static void evergreen_set_clip_state(struct pipe_context *ctx, free(rctx->states[R600_PIPE_STATE_CLIP]); rctx->states[R600_PIPE_STATE_CLIP] = rstate; - r600_context_pipe_state_set(&rctx->ctx, rstate); + r600_context_pipe_state_set(rctx, rstate); cbuf = pipe_user_buffer_create(ctx->screen, state->ucp, @@ -1246,7 +1246,7 @@ static void evergreen_set_sample_mask(struct pipe_context *pipe, unsigned sample static void evergreen_set_scissor_state(struct pipe_context *ctx, const struct pipe_scissor_state *state) { - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_context *rctx = (struct r600_context *)ctx; struct r600_pipe_state *rstate = CALLOC_STRUCT(r600_pipe_state); uint32_t tl, br; @@ -1283,13 +1283,13 @@ static void evergreen_set_scissor_state(struct pipe_context *ctx, free(rctx->states[R600_PIPE_STATE_SCISSOR]); rctx->states[R600_PIPE_STATE_SCISSOR] = rstate; - r600_context_pipe_state_set(&rctx->ctx, rstate); + r600_context_pipe_state_set(rctx, rstate); } static void evergreen_set_viewport_state(struct pipe_context *ctx, const struct pipe_viewport_state *state) { - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_context *rctx = (struct r600_context *)ctx; struct r600_pipe_state *rstate = CALLOC_STRUCT(r600_pipe_state); if (rstate == NULL) @@ -1309,10 +1309,10 @@ static void evergreen_set_viewport_state(struct pipe_context *ctx, free(rctx->states[R600_PIPE_STATE_VIEWPORT]); rctx->states[R600_PIPE_STATE_VIEWPORT] = rstate; - r600_context_pipe_state_set(&rctx->ctx, rstate); + r600_context_pipe_state_set(rctx, rstate); } -static void evergreen_cb(struct r600_pipe_context *rctx, struct r600_pipe_state *rstate, +static void evergreen_cb(struct r600_context *rctx, struct r600_pipe_state *rstate, const struct pipe_framebuffer_state *state, int cb) { struct r600_resource_texture *rtex; @@ -1451,7 +1451,7 @@ static void evergreen_cb(struct r600_pipe_context *rctx, struct r600_pipe_state &rtex->resource, RADEON_USAGE_READWRITE); } -static void evergreen_db(struct r600_pipe_context *rctx, struct r600_pipe_state *rstate, +static void evergreen_db(struct r600_context *rctx, struct r600_pipe_state *rstate, const struct pipe_framebuffer_state *state) { struct r600_resource_texture *rtex; @@ -1517,7 +1517,7 @@ static void evergreen_db(struct r600_pipe_context *rctx, struct r600_pipe_state static void evergreen_set_framebuffer_state(struct pipe_context *ctx, const struct pipe_framebuffer_state *state) { - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_context *rctx = (struct r600_context *)ctx; struct r600_pipe_state *rstate = CALLOC_STRUCT(r600_pipe_state); uint32_t shader_mask, tl, br; int tl_x, tl_y, br_x, br_y; @@ -1525,8 +1525,8 @@ static void evergreen_set_framebuffer_state(struct pipe_context *ctx, if (rstate == NULL) return; - evergreen_context_flush_dest_caches(&rctx->ctx); - rctx->ctx.num_dest_buffers = state->nr_cbufs; + evergreen_context_flush_dest_caches(rctx); + rctx->num_dest_buffers = state->nr_cbufs; /* unreference old buffer and reference new one */ rstate->id = R600_PIPE_STATE_FRAMEBUFFER; @@ -1541,7 +1541,7 @@ static void evergreen_set_framebuffer_state(struct pipe_context *ctx, } if (state->zsbuf) { evergreen_db(rctx, rstate, state); - rctx->ctx.num_dest_buffers++; + rctx->num_dest_buffers++; } shader_mask = 0; @@ -1611,7 +1611,7 @@ static void evergreen_set_framebuffer_state(struct pipe_context *ctx, free(rctx->states[R600_PIPE_STATE_FRAMEBUFFER]); rctx->states[R600_PIPE_STATE_FRAMEBUFFER] = rstate; - r600_context_pipe_state_set(&rctx->ctx, rstate); + r600_context_pipe_state_set(rctx, rstate); if (state->zsbuf) { evergreen_polygon_offset_update(rctx); @@ -1620,9 +1620,9 @@ static void evergreen_set_framebuffer_state(struct pipe_context *ctx, static void evergreen_texture_barrier(struct pipe_context *ctx) { - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_context *rctx = (struct r600_context *)ctx; - r600_context_flush_all(&rctx->ctx, S_0085F0_TC_ACTION_ENA(1) | S_0085F0_CB_ACTION_ENA(1) | + r600_context_flush_all(rctx, S_0085F0_TC_ACTION_ENA(1) | S_0085F0_CB_ACTION_ENA(1) | S_0085F0_CB0_DEST_BASE_ENA(1) | S_0085F0_CB1_DEST_BASE_ENA(1) | S_0085F0_CB2_DEST_BASE_ENA(1) | S_0085F0_CB3_DEST_BASE_ENA(1) | S_0085F0_CB4_DEST_BASE_ENA(1) | S_0085F0_CB5_DEST_BASE_ENA(1) | @@ -1631,7 +1631,7 @@ static void evergreen_texture_barrier(struct pipe_context *ctx) S_0085F0_CB10_DEST_BASE_ENA(1) | S_0085F0_CB11_DEST_BASE_ENA(1)); } -void evergreen_init_state_functions(struct r600_pipe_context *rctx) +void evergreen_init_state_functions(struct r600_context *rctx) { rctx->context.create_blend_state = evergreen_create_blend_state; rctx->context.create_depth_stencil_alpha_state = evergreen_create_dsa_state; @@ -1677,7 +1677,7 @@ void evergreen_init_state_functions(struct r600_pipe_context *rctx) rctx->context.set_stream_output_targets = r600_set_so_targets; } -static void cayman_init_config(struct r600_pipe_context *rctx) +static void cayman_init_config(struct r600_context *rctx) { struct r600_pipe_state *rstate = &rctx->config; unsigned tmp; @@ -1756,10 +1756,10 @@ static void cayman_init_config(struct r600_pipe_context *rctx) r600_pipe_state_add_reg(rstate, R_0288EC_SQ_LDS_ALLOC_PS, 0, NULL, 0); r600_pipe_state_add_reg(rstate, CM_R_028804_DB_EQAA, 0x110000, NULL, 0); - r600_context_pipe_state_set(&rctx->ctx, rstate); + r600_context_pipe_state_set(rctx, rstate); } -void evergreen_init_config(struct r600_pipe_context *rctx) +void evergreen_init_config(struct r600_context *rctx) { struct r600_pipe_state *rstate = &rctx->config; int ps_prio; @@ -2182,10 +2182,10 @@ void evergreen_init_config(struct r600_pipe_context *rctx) r600_pipe_state_add_reg(rstate, R_028810_PA_CL_CLIP_CNTL, 0x0, NULL, 0); - r600_context_pipe_state_set(&rctx->ctx, rstate); + r600_context_pipe_state_set(rctx, rstate); } -void evergreen_polygon_offset_update(struct r600_pipe_context *rctx) +void evergreen_polygon_offset_update(struct r600_context *rctx) { struct r600_pipe_state state; @@ -2231,13 +2231,13 @@ void evergreen_polygon_offset_update(struct r600_pipe_context *rctx) r600_pipe_state_add_reg(&state, R_028B78_PA_SU_POLY_OFFSET_DB_FMT_CNTL, offset_db_fmt_cntl, NULL, 0); - r600_context_pipe_state_set(&rctx->ctx, &state); + r600_context_pipe_state_set(rctx, &state); } } void evergreen_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shader *shader) { - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_context *rctx = (struct r600_context *)ctx; struct r600_pipe_state *rstate = &shader->rstate; struct r600_shader *rshader = &shader->shader; unsigned i, exports_ps, num_cout, spi_ps_in_control_0, spi_input_z, spi_ps_in_control_1, db_shader_control; @@ -2395,7 +2395,7 @@ void evergreen_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shader void evergreen_pipe_shader_vs(struct pipe_context *ctx, struct r600_pipe_shader *shader) { - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_context *rctx = (struct r600_context *)ctx; struct r600_pipe_state *rstate = &shader->rstate; struct r600_shader *rshader = &shader->shader; unsigned spi_vs_out_id[10] = {}; @@ -2457,7 +2457,7 @@ void evergreen_pipe_shader_vs(struct pipe_context *ctx, struct r600_pipe_shader void evergreen_fetch_shader(struct pipe_context *ctx, struct r600_vertex_element *ve) { - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_context *rctx = (struct r600_context *)ctx; struct r600_pipe_state *rstate = &ve->rstate; rstate->id = R600_PIPE_STATE_FETCH_SHADER; rstate->nregs = 0; @@ -2468,7 +2468,7 @@ void evergreen_fetch_shader(struct pipe_context *ctx, ve->fetch_shader, RADEON_USAGE_READ); } -void *evergreen_create_db_flush_dsa(struct r600_pipe_context *rctx) +void *evergreen_create_db_flush_dsa(struct r600_context *rctx) { struct pipe_depth_stencil_alpha_state dsa; struct r600_pipe_state *rstate; @@ -2485,7 +2485,7 @@ void *evergreen_create_db_flush_dsa(struct r600_pipe_context *rctx) return rstate; } -void evergreen_pipe_init_buffer_resource(struct r600_pipe_context *rctx, +void evergreen_pipe_init_buffer_resource(struct r600_context *rctx, struct r600_pipe_resource_state *rstate) { rstate->id = R600_PIPE_STATE_RESOURCE; diff --git a/src/gallium/drivers/r600/r600.h b/src/gallium/drivers/r600/r600.h index 8614bea5888..a32c3b1e8db 100644 --- a/src/gallium/drivers/r600/r600.h +++ b/src/gallium/drivers/r600/r600.h @@ -198,53 +198,6 @@ struct r600_so_target { #define R600_CONTEXT_DST_CACHES_DIRTY (1 << 1) #define R600_CONTEXT_CHECK_EVENT_FLUSH (1 << 2) -struct r600_context { - struct r600_screen *screen; - struct radeon_winsys *ws; - struct radeon_winsys_cs *cs; - struct pipe_context *pipe; - - void (*flush)(void *pipe, unsigned flags); - - struct r600_range *range; - unsigned nblocks; - struct r600_block **blocks; - struct list_head dirty; - struct list_head resource_dirty; - struct list_head enable_list; - unsigned pm4_dirty_cdwords; - unsigned ctx_pm4_ndwords; - unsigned init_dwords; - - unsigned creloc; - struct r600_resource **bo; - - uint32_t *pm4; - unsigned pm4_cdwords; - - /* The list of active queries. Only one query of each type can be active. */ - struct list_head active_query_list; - unsigned num_cs_dw_queries_suspend; - unsigned num_cs_dw_streamout_end; - - unsigned backend_mask; - unsigned max_db; /* for OQ */ - unsigned num_dest_buffers; - unsigned flags; - boolean predicate_drawing; - struct r600_range ps_resources; - struct r600_range vs_resources; - struct r600_range fs_resources; - int num_ps_resources, num_vs_resources, num_fs_resources; - boolean have_depth_texture, have_depth_fb; - - unsigned num_so_targets; - struct r600_so_target *so_targets[PIPE_MAX_SO_BUFFERS]; - boolean streamout_start; - unsigned streamout_append_bitmask; - unsigned *vs_so_stride_in_dw; -}; - struct r600_draw { uint32_t vgt_num_indices; uint32_t vgt_num_instances; @@ -256,6 +209,9 @@ struct r600_draw { struct r600_resource *indices; }; +struct r600_context; +struct r600_screen; + void r600_get_backend_mask(struct r600_context *ctx); int r600_context_init(struct r600_context *ctx, struct r600_screen *screen); void r600_context_fini(struct r600_context *ctx); @@ -309,7 +265,7 @@ void r600_pipe_state_add_reg_noblock(struct r600_pipe_state *state, struct r600_resource *bo, enum radeon_bo_usage usage); -#define r600_pipe_state_add_reg(state, offset, value, bo, usage) _r600_pipe_state_add_reg(&rctx->ctx, state, offset, value, CTX_RANGE_ID(offset), CTX_BLOCK_ID(offset), bo, usage) +#define r600_pipe_state_add_reg(state, offset, value, bo, usage) _r600_pipe_state_add_reg(rctx, state, offset, value, CTX_RANGE_ID(offset), CTX_BLOCK_ID(offset), bo, usage) static inline void r600_pipe_state_mod_reg(struct r600_pipe_state *state, uint32_t value) diff --git a/src/gallium/drivers/r600/r600_asm.c b/src/gallium/drivers/r600/r600_asm.c index c690c9bccff..567f2048f5c 100644 --- a/src/gallium/drivers/r600/r600_asm.c +++ b/src/gallium/drivers/r600/r600_asm.c @@ -2702,7 +2702,7 @@ out_unknown: R600_ERR("unsupported vertex format %s\n", util_format_name(pformat)); } -int r600_vertex_elements_build_fetch_shader(struct r600_pipe_context *rctx, struct r600_vertex_element *ve) +int r600_vertex_elements_build_fetch_shader(struct r600_context *rctx, struct r600_vertex_element *ve) { static int dump_shaders = -1; @@ -2818,7 +2818,7 @@ int r600_vertex_elements_build_fetch_shader(struct r600_pipe_context *rctx, stru return -ENOMEM; } - bytecode = rctx->ws->buffer_map(ve->fetch_shader->buf, rctx->ctx.cs, PIPE_TRANSFER_WRITE); + bytecode = rctx->ws->buffer_map(ve->fetch_shader->buf, rctx->cs, PIPE_TRANSFER_WRITE); if (bytecode == NULL) { r600_bytecode_clear(&bc); pipe_resource_reference((struct pipe_resource**)&ve->fetch_shader, NULL); diff --git a/src/gallium/drivers/r600/r600_asm.h b/src/gallium/drivers/r600/r600_asm.h index 3d6544b2e39..f4308523491 100644 --- a/src/gallium/drivers/r600/r600_asm.h +++ b/src/gallium/drivers/r600/r600_asm.h @@ -24,7 +24,7 @@ #define R600_ASM_H struct r600_vertex_element; -struct r600_pipe_context; +struct r600_context; struct r600_bytecode_alu_src { unsigned sel; @@ -223,7 +223,7 @@ void r600_bytecode_dump(struct r600_bytecode *bc); int cm_bytecode_add_cf_end(struct r600_bytecode *bc); -int r600_vertex_elements_build_fetch_shader(struct r600_pipe_context *rctx, struct r600_vertex_element *ve); +int r600_vertex_elements_build_fetch_shader(struct r600_context *rctx, struct r600_vertex_element *ve); /* r700_asm.c */ void r700_bytecode_cf_vtx_build(uint32_t *bytecode, const struct r600_bytecode_cf *cf); diff --git a/src/gallium/drivers/r600/r600_blit.c b/src/gallium/drivers/r600/r600_blit.c index 6947c99c2ee..93df1a2911d 100644 --- a/src/gallium/drivers/r600/r600_blit.c +++ b/src/gallium/drivers/r600/r600_blit.c @@ -43,9 +43,9 @@ enum r600_blitter_op /* bitmask */ static void r600_blitter_begin(struct pipe_context *ctx, enum r600_blitter_op op) { - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_context *rctx = (struct r600_context *)ctx; - r600_context_queries_suspend(&rctx->ctx); + r600_context_queries_suspend(rctx); util_blitter_save_blend(rctx->blitter, rctx->states[R600_PIPE_STATE_BLEND]); util_blitter_save_depth_stencil_alpha(rctx->blitter, rctx->states[R600_PIPE_STATE_DSA]); @@ -62,8 +62,8 @@ static void r600_blitter_begin(struct pipe_context *ctx, enum r600_blitter_op op util_blitter_save_vertex_buffers(rctx->blitter, rctx->vbuf_mgr->nr_vertex_buffers, rctx->vbuf_mgr->vertex_buffer); - util_blitter_save_so_targets(rctx->blitter, rctx->ctx.num_so_targets, - (struct pipe_stream_output_target**)rctx->ctx.so_targets); + util_blitter_save_so_targets(rctx->blitter, rctx->num_so_targets, + (struct pipe_stream_output_target**)rctx->so_targets); if (op & R600_SAVE_FRAMEBUFFER) util_blitter_save_framebuffer(rctx->blitter, &rctx->framebuffer); @@ -88,14 +88,14 @@ static void r600_blitter_begin(struct pipe_context *ctx, enum r600_blitter_op op static void r600_blitter_end(struct pipe_context *ctx) { - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_context *rctx = (struct r600_context *)ctx; if (rctx->saved_render_cond) { rctx->context.render_condition(&rctx->context, rctx->saved_render_cond, rctx->saved_render_cond_mode); rctx->saved_render_cond = NULL; } - r600_context_queries_resume(&rctx->ctx); + r600_context_queries_resume(rctx); } static unsigned u_num_layers(struct pipe_resource *r, unsigned level) @@ -116,7 +116,7 @@ static unsigned u_num_layers(struct pipe_resource *r, unsigned level) void r600_blit_uncompress_depth(struct pipe_context *ctx, struct r600_resource_texture *texture) { - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_context *rctx = (struct r600_context *)ctx; unsigned layer, level; float depth = 1.0f; @@ -158,7 +158,7 @@ void r600_blit_uncompress_depth(struct pipe_context *ctx, struct r600_resource_t texture->dirty_db = FALSE; } -void r600_flush_depth_textures(struct r600_pipe_context *rctx) +void r600_flush_depth_textures(struct r600_context *rctx) { unsigned int i; @@ -200,7 +200,7 @@ static void r600_clear(struct pipe_context *ctx, unsigned buffers, const union pipe_color_union *color, double depth, unsigned stencil) { - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_context *rctx = (struct r600_context *)ctx; struct pipe_framebuffer_state *fb = &rctx->framebuffer; r600_blitter_begin(ctx, R600_CLEAR); @@ -216,7 +216,7 @@ static void r600_clear_render_target(struct pipe_context *ctx, unsigned dstx, unsigned dsty, unsigned width, unsigned height) { - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_context *rctx = (struct r600_context *)ctx; r600_blitter_begin(ctx, R600_CLEAR_SURFACE); util_blitter_clear_render_target(rctx->blitter, dst, color, @@ -232,7 +232,7 @@ static void r600_clear_depth_stencil(struct pipe_context *ctx, unsigned dstx, unsigned dsty, unsigned width, unsigned height) { - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_context *rctx = (struct r600_context *)ctx; r600_blitter_begin(ctx, R600_CLEAR_SURFACE); util_blitter_clear_depth_stencil(rctx->blitter, dst, clear_flags, depth, stencil, @@ -251,7 +251,7 @@ static void r600_hw_copy_region(struct pipe_context *ctx, unsigned src_level, const struct pipe_box *src_box) { - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_context *rctx = (struct r600_context *)ctx; r600_blitter_begin(ctx, R600_COPY); util_blitter_copy_texture(rctx->blitter, dst, dst_level, dstx, dsty, dstz, @@ -358,7 +358,7 @@ static void r600_resource_copy_region(struct pipe_context *ctx, r600_reset_blittable_to_compressed(dst, &orig_info[1]); } -void r600_init_blit_functions(struct r600_pipe_context *rctx) +void r600_init_blit_functions(struct r600_context *rctx) { rctx->context.clear = r600_clear; rctx->context.clear_render_target = r600_clear_render_target; diff --git a/src/gallium/drivers/r600/r600_buffer.c b/src/gallium/drivers/r600/r600_buffer.c index 4511a94bce5..2fc93e806b6 100644 --- a/src/gallium/drivers/r600/r600_buffer.c +++ b/src/gallium/drivers/r600/r600_buffer.c @@ -52,7 +52,7 @@ static struct pipe_transfer *r600_get_transfer(struct pipe_context *ctx, unsigned usage, const struct pipe_box *box) { - struct r600_pipe_context *rctx = (struct r600_pipe_context*)ctx; + struct r600_context *rctx = (struct r600_context*)ctx; struct pipe_transfer *transfer = util_slab_alloc(&rctx->pool_transfers); transfer->resource = resource; @@ -73,13 +73,13 @@ static void *r600_buffer_transfer_map(struct pipe_context *pipe, struct pipe_transfer *transfer) { struct r600_resource *rbuffer = r600_resource(transfer->resource); - struct r600_pipe_context *rctx = (struct r600_pipe_context*)pipe; + struct r600_context *rctx = (struct r600_context*)pipe; uint8_t *data; if (rbuffer->b.user_ptr) return (uint8_t*)rbuffer->b.user_ptr + transfer->box.x; - data = rctx->ws->buffer_map(rbuffer->buf, rctx->ctx.cs, transfer->usage); + data = rctx->ws->buffer_map(rbuffer->buf, rctx->cs, transfer->usage); if (!data) return NULL; @@ -90,7 +90,7 @@ static void r600_buffer_transfer_unmap(struct pipe_context *pipe, struct pipe_transfer *transfer) { struct r600_resource *rbuffer = r600_resource(transfer->resource); - struct r600_pipe_context *rctx = (struct r600_pipe_context*)pipe; + struct r600_context *rctx = (struct r600_context*)pipe; if (rbuffer->b.user_ptr) return; @@ -107,7 +107,7 @@ static void r600_buffer_transfer_flush_region(struct pipe_context *pipe, static void r600_transfer_destroy(struct pipe_context *ctx, struct pipe_transfer *transfer) { - struct r600_pipe_context *rctx = (struct r600_pipe_context*)ctx; + struct r600_context *rctx = (struct r600_context*)ctx; util_slab_free(&rctx->pool_transfers, transfer); } @@ -120,13 +120,13 @@ static void r600_buffer_transfer_inline_write(struct pipe_context *pipe, unsigned stride, unsigned layer_stride) { - struct r600_pipe_context *rctx = (struct r600_pipe_context*)pipe; + struct r600_context *rctx = (struct r600_context*)pipe; struct r600_resource *rbuffer = r600_resource(resource); uint8_t *map = NULL; assert(rbuffer->b.user_ptr == NULL); - map = rctx->ws->buffer_map(rbuffer->buf, rctx->ctx.cs, + map = rctx->ws->buffer_map(rbuffer->buf, rctx->cs, PIPE_TRANSFER_WRITE | PIPE_TRANSFER_DISCARD_RANGE | usage); memcpy(map + box->x, data, box->width); @@ -237,7 +237,7 @@ struct pipe_resource *r600_user_buffer_create(struct pipe_screen *screen, return &rbuffer->b.b.b; } -void r600_upload_index_buffer(struct r600_pipe_context *rctx, +void r600_upload_index_buffer(struct r600_context *rctx, struct pipe_index_buffer *ib, unsigned count) { struct r600_resource *rbuffer = r600_resource(ib->buffer); @@ -246,7 +246,7 @@ void r600_upload_index_buffer(struct r600_pipe_context *rctx, rbuffer->b.user_ptr, &ib->offset, &ib->buffer); } -void r600_upload_const_buffer(struct r600_pipe_context *rctx, struct r600_resource **rbuffer, +void r600_upload_const_buffer(struct r600_context *rctx, struct r600_resource **rbuffer, uint32_t *const_offset) { if ((*rbuffer)->b.user_ptr) { diff --git a/src/gallium/drivers/r600/r600_hw_context.c b/src/gallium/drivers/r600/r600_hw_context.c index bb9d8fc3efc..b25006d2240 100644 --- a/src/gallium/drivers/r600/r600_hw_context.c +++ b/src/gallium/drivers/r600/r600_hw_context.c @@ -778,8 +778,6 @@ void r600_context_fini(struct r600_context *ctx) free(ctx->blocks); free(ctx->bo); ctx->ws->cs_destroy(ctx->cs); - - memset(ctx, 0, sizeof(struct r600_context)); } static void r600_add_resource_block(struct r600_context *ctx, struct r600_range *range, int num_blocks, int *index) @@ -833,7 +831,6 @@ int r600_context_init(struct r600_context *ctx, struct r600_screen *screen) { int r; - memset(ctx, 0, sizeof(struct r600_context)); ctx->screen = screen; ctx->ws = screen->ws; diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c index 1123557a5ec..9f86f4a8a08 100644 --- a/src/gallium/drivers/r600/r600_pipe.c +++ b/src/gallium/drivers/r600/r600_pipe.c @@ -51,9 +51,9 @@ /* * pipe_context */ -static struct r600_fence *r600_create_fence(struct r600_pipe_context *ctx) +static struct r600_fence *r600_create_fence(struct r600_context *rctx) { - struct r600_screen *rscreen = ctx->screen; + struct r600_screen *rscreen = rctx->screen; struct r600_fence *fence = NULL; pipe_mutex_lock(rscreen->fences.mutex); @@ -67,8 +67,8 @@ static struct r600_fence *r600_create_fence(struct r600_pipe_context *ctx) R600_ERR("r600: failed to create bo for fence objects\n"); goto out; } - rscreen->fences.data = ctx->ws->buffer_map(rscreen->fences.bo->buf, - ctx->ctx.cs, + rscreen->fences.data = rctx->ws->buffer_map(rscreen->fences.bo->buf, + rctx->cs, PIPE_TRANSFER_READ_WRITE); } @@ -115,7 +115,7 @@ static struct r600_fence *r600_create_fence(struct r600_pipe_context *ctx) pipe_reference_init(&fence->reference, 1); rscreen->fences.data[fence->index] = 0; - r600_context_emit_fence(&ctx->ctx, rscreen->fences.bo, fence->index, 1); + r600_context_emit_fence(rctx, rscreen->fences.bo, fence->index, 1); out: pipe_mutex_unlock(rscreen->fences.mutex); return fence; @@ -125,7 +125,7 @@ out: void r600_flush(struct pipe_context *ctx, struct pipe_fence_handle **fence, unsigned flags) { - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_context *rctx = (struct r600_context *)ctx; struct r600_fence **rfence = (struct r600_fence**)fence; struct pipe_query *render_cond = NULL; unsigned render_cond_mode = 0; @@ -140,7 +140,7 @@ void r600_flush(struct pipe_context *ctx, struct pipe_fence_handle **fence, ctx->render_condition(ctx, NULL, 0); } - r600_context_flush(&rctx->ctx, flags); + r600_context_flush(rctx, flags); /* Re-enable render condition. */ if (render_cond) { @@ -180,12 +180,12 @@ static void r600_update_num_contexts(struct r600_screen *rscreen, int diff) static void r600_destroy_context(struct pipe_context *context) { - struct r600_pipe_context *rctx = (struct r600_pipe_context *)context; + struct r600_context *rctx = (struct r600_context *)context; rctx->context.delete_depth_stencil_alpha_state(&rctx->context, rctx->custom_dsa_flush); util_unreference_framebuffer_state(&rctx->framebuffer); - r600_context_fini(&rctx->ctx); + r600_context_fini(rctx); util_blitter_destroy(rctx->blitter); @@ -203,7 +203,7 @@ static void r600_destroy_context(struct pipe_context *context) static struct pipe_context *r600_create_context(struct pipe_screen *screen, void *priv) { - struct r600_pipe_context *rctx = CALLOC_STRUCT(r600_pipe_context); + struct r600_context *rctx = CALLOC_STRUCT(r600_context); struct r600_screen* rscreen = (struct r600_screen *)screen; if (rctx == NULL) @@ -236,7 +236,7 @@ static struct pipe_context *r600_create_context(struct pipe_screen *screen, void case R600: case R700: r600_init_state_functions(rctx); - if (r600_context_init(&rctx->ctx, rctx->screen)) { + if (r600_context_init(rctx, rctx->screen)) { r600_destroy_context(&rctx->context); return NULL; } @@ -246,7 +246,7 @@ static struct pipe_context *r600_create_context(struct pipe_screen *screen, void case EVERGREEN: case CAYMAN: evergreen_init_state_functions(rctx); - if (evergreen_context_init(&rctx->ctx, rctx->screen)) { + if (evergreen_context_init(rctx, rctx->screen)) { r600_destroy_context(&rctx->context); return NULL; } @@ -259,9 +259,9 @@ static struct pipe_context *r600_create_context(struct pipe_screen *screen, void return NULL; } - rctx->ctx.pipe = &rctx->context; - rctx->ctx.flush = r600_flush_from_winsys; - rctx->ws->cs_set_flush_callback(rctx->ctx.cs, r600_flush_from_winsys, rctx); + rctx->pipe = &rctx->context; + rctx->flush = r600_flush_from_winsys; + rctx->ws->cs_set_flush_callback(rctx->cs, r600_flush_from_winsys, rctx); util_slab_create(&rctx->pool_transfers, sizeof(struct pipe_transfer), 64, @@ -284,7 +284,7 @@ static struct pipe_context *r600_create_context(struct pipe_screen *screen, void return NULL; } - r600_get_backend_mask(&rctx->ctx); /* this emits commands and must be last */ + r600_get_backend_mask(rctx); /* this emits commands and must be last */ return &rctx->context; } diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h index e1fa01fc177..41ea38d86fa 100644 --- a/src/gallium/drivers/r600/r600_pipe.h +++ b/src/gallium/drivers/r600/r600_pipe.h @@ -199,7 +199,7 @@ struct r600_stencil_ref ubyte writemask[2]; }; -struct r600_pipe_context { +struct r600_context { struct pipe_context context; struct blitter_context *blitter; enum radeon_family family; @@ -209,7 +209,6 @@ struct r600_pipe_context { struct r600_screen *screen; struct radeon_winsys *ws; struct r600_pipe_state *states[R600_PIPE_NSTATES]; - struct r600_context ctx; struct r600_vertex_element *vertex_elements; struct r600_pipe_resource_state fs_resource[PIPE_MAX_ATTRIBS]; struct pipe_framebuffer_state framebuffer; @@ -251,17 +250,61 @@ struct r600_pipe_context { boolean have_depth_texture, have_depth_fb; unsigned default_ps_gprs, default_vs_gprs; + + /* Below are variables from the old r600_context. + */ + struct radeon_winsys_cs *cs; + struct pipe_context *pipe; + + void (*flush)(void *pipe, unsigned flags); + + struct r600_range *range; + unsigned nblocks; + struct r600_block **blocks; + struct list_head dirty; + struct list_head resource_dirty; + struct list_head enable_list; + unsigned pm4_dirty_cdwords; + unsigned ctx_pm4_ndwords; + unsigned init_dwords; + + unsigned creloc; + struct r600_resource **bo; + + uint32_t *pm4; + unsigned pm4_cdwords; + + /* The list of active queries. Only one query of each type can be active. */ + struct list_head active_query_list; + unsigned num_cs_dw_queries_suspend; + unsigned num_cs_dw_streamout_end; + + unsigned backend_mask; + unsigned max_db; /* for OQ */ + unsigned num_dest_buffers; + unsigned flags; + boolean predicate_drawing; + struct r600_range ps_resources; + struct r600_range vs_resources; + struct r600_range fs_resources; + int num_ps_resources, num_vs_resources, num_fs_resources; + + unsigned num_so_targets; + struct r600_so_target *so_targets[PIPE_MAX_SO_BUFFERS]; + boolean streamout_start; + unsigned streamout_append_bitmask; + unsigned *vs_so_stride_in_dw; }; /* evergreen_state.c */ -void evergreen_init_state_functions(struct r600_pipe_context *rctx); -void evergreen_init_config(struct r600_pipe_context *rctx); +void evergreen_init_state_functions(struct r600_context *rctx); +void evergreen_init_config(struct r600_context *rctx); void evergreen_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shader *shader); void evergreen_pipe_shader_vs(struct pipe_context *ctx, struct r600_pipe_shader *shader); void evergreen_fetch_shader(struct pipe_context *ctx, struct r600_vertex_element *ve); -void *evergreen_create_db_flush_dsa(struct r600_pipe_context *rctx); -void evergreen_polygon_offset_update(struct r600_pipe_context *rctx); -void evergreen_pipe_init_buffer_resource(struct r600_pipe_context *rctx, +void *evergreen_create_db_flush_dsa(struct r600_context *rctx); +void evergreen_polygon_offset_update(struct r600_context *rctx); +void evergreen_pipe_init_buffer_resource(struct r600_context *rctx, struct r600_pipe_resource_state *rstate); void evergreen_pipe_mod_buffer_resource(struct pipe_context *ctx, struct r600_pipe_resource_state *rstate, @@ -275,10 +318,10 @@ boolean evergreen_is_format_supported(struct pipe_screen *screen, unsigned usage); /* r600_blit.c */ -void r600_init_blit_functions(struct r600_pipe_context *rctx); +void r600_init_blit_functions(struct r600_context *rctx); void r600_blit_uncompress_depth(struct pipe_context *ctx, struct r600_resource_texture *texture); void r600_blit_push_depth(struct pipe_context *ctx, struct r600_resource_texture *texture); -void r600_flush_depth_textures(struct r600_pipe_context *rctx); +void r600_flush_depth_textures(struct r600_context *rctx); /* r600_buffer.c */ bool r600_init_resource(struct r600_screen *rscreen, @@ -290,7 +333,7 @@ struct pipe_resource *r600_buffer_create(struct pipe_screen *screen, struct pipe_resource *r600_user_buffer_create(struct pipe_screen *screen, void *ptr, unsigned bytes, unsigned bind); -void r600_upload_index_buffer(struct r600_pipe_context *rctx, +void r600_upload_index_buffer(struct r600_context *rctx, struct pipe_index_buffer *ib, unsigned count); @@ -299,10 +342,10 @@ void r600_flush(struct pipe_context *ctx, struct pipe_fence_handle **fence, unsigned flags); /* r600_query.c */ -void r600_init_query_functions(struct r600_pipe_context *rctx); +void r600_init_query_functions(struct r600_context *rctx); /* r600_resource.c */ -void r600_init_context_resource_functions(struct r600_pipe_context *r600); +void r600_init_context_resource_functions(struct r600_context *r600); /* r600_shader.c */ int r600_pipe_shader_create(struct pipe_context *ctx, struct r600_pipe_shader *shader); @@ -311,21 +354,21 @@ int r600_find_vs_semantic_index(struct r600_shader *vs, struct r600_shader *ps, int id); /* r600_state.c */ -void r600_update_sampler_states(struct r600_pipe_context *rctx); -void r600_init_state_functions(struct r600_pipe_context *rctx); -void r600_init_config(struct r600_pipe_context *rctx); +void r600_update_sampler_states(struct r600_context *rctx); +void r600_init_state_functions(struct r600_context *rctx); +void r600_init_config(struct r600_context *rctx); void r600_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shader *shader); void r600_pipe_shader_vs(struct pipe_context *ctx, struct r600_pipe_shader *shader); void r600_fetch_shader(struct pipe_context *ctx, struct r600_vertex_element *ve); -void *r600_create_db_flush_dsa(struct r600_pipe_context *rctx); -void r600_polygon_offset_update(struct r600_pipe_context *rctx); -void r600_pipe_init_buffer_resource(struct r600_pipe_context *rctx, +void *r600_create_db_flush_dsa(struct r600_context *rctx); +void r600_polygon_offset_update(struct r600_context *rctx); +void r600_pipe_init_buffer_resource(struct r600_context *rctx, struct r600_pipe_resource_state *rstate); void r600_pipe_mod_buffer_resource(struct r600_pipe_resource_state *rstate, struct r600_resource *rbuffer, unsigned offset, unsigned stride, enum radeon_bo_usage usage); -void r600_adjust_gprs(struct r600_pipe_context *rctx); +void r600_adjust_gprs(struct r600_context *rctx); boolean r600_is_format_supported(struct pipe_screen *screen, enum pipe_format format, enum pipe_texture_target target, @@ -334,7 +377,7 @@ boolean r600_is_format_supported(struct pipe_screen *screen, /* r600_texture.c */ void r600_init_screen_texture_functions(struct pipe_screen *screen); -void r600_init_surface_functions(struct r600_pipe_context *r600); +void r600_init_surface_functions(struct r600_context *r600); uint32_t r600_translate_texformat(struct pipe_screen *screen, enum pipe_format format, const unsigned char *swizzle_view, uint32_t *word4_p, uint32_t *yuv_format_p); @@ -342,7 +385,7 @@ unsigned r600_texture_get_offset(struct r600_resource_texture *rtex, unsigned level, unsigned layer); /* r600_translate.c */ -void r600_translate_index_buffer(struct r600_pipe_context *r600, +void r600_translate_index_buffer(struct r600_context *r600, struct pipe_index_buffer *ib, unsigned count); diff --git a/src/gallium/drivers/r600/r600_query.c b/src/gallium/drivers/r600/r600_query.c index ee2d04b3684..faec99c6a80 100644 --- a/src/gallium/drivers/r600/r600_query.c +++ b/src/gallium/drivers/r600/r600_query.c @@ -25,35 +25,35 @@ static struct pipe_query *r600_create_query(struct pipe_context *ctx, unsigned query_type) { - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_context *rctx = (struct r600_context *)ctx; - return (struct pipe_query*)r600_context_query_create(&rctx->ctx, query_type); + return (struct pipe_query*)r600_context_query_create(rctx, query_type); } static void r600_destroy_query(struct pipe_context *ctx, struct pipe_query *query) { - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_context *rctx = (struct r600_context *)ctx; - r600_context_query_destroy(&rctx->ctx, (struct r600_query *)query); + r600_context_query_destroy(rctx, (struct r600_query *)query); } static void r600_begin_query(struct pipe_context *ctx, struct pipe_query *query) { - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_context *rctx = (struct r600_context *)ctx; struct r600_query *rquery = (struct r600_query *)query; memset(&rquery->result, 0, sizeof(rquery->result)); rquery->results_start = rquery->results_end; - r600_query_begin(&rctx->ctx, (struct r600_query *)query); - LIST_ADDTAIL(&rquery->list, &rctx->ctx.active_query_list); + r600_query_begin(rctx, (struct r600_query *)query); + LIST_ADDTAIL(&rquery->list, &rctx->active_query_list); } static void r600_end_query(struct pipe_context *ctx, struct pipe_query *query) { - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_context *rctx = (struct r600_context *)ctx; struct r600_query *rquery = (struct r600_query *)query; - r600_query_end(&rctx->ctx, rquery); + r600_query_end(rctx, rquery); LIST_DELINIT(&rquery->list); } @@ -61,17 +61,17 @@ static boolean r600_get_query_result(struct pipe_context *ctx, struct pipe_query *query, boolean wait, void *vresult) { - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_context *rctx = (struct r600_context *)ctx; struct r600_query *rquery = (struct r600_query *)query; - return r600_context_query_result(&rctx->ctx, rquery, wait, vresult); + return r600_context_query_result(rctx, rquery, wait, vresult); } static void r600_render_condition(struct pipe_context *ctx, struct pipe_query *query, uint mode) { - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_context *rctx = (struct r600_context *)ctx; struct r600_query *rquery = (struct r600_query *)query; int wait_flag = 0; @@ -87,9 +87,9 @@ static void r600_render_condition(struct pipe_context *ctx, rctx->current_render_cond_mode = mode; if (query == NULL) { - if (rctx->ctx.predicate_drawing) { - rctx->ctx.predicate_drawing = false; - r600_query_predication(&rctx->ctx, NULL, PREDICATION_OP_CLEAR, 1); + if (rctx->predicate_drawing) { + rctx->predicate_drawing = false; + r600_query_predication(rctx, NULL, PREDICATION_OP_CLEAR, 1); } return; } @@ -99,25 +99,25 @@ static void r600_render_condition(struct pipe_context *ctx, wait_flag = 1; } - rctx->ctx.predicate_drawing = true; + rctx->predicate_drawing = true; switch (rquery->type) { case PIPE_QUERY_OCCLUSION_COUNTER: case PIPE_QUERY_OCCLUSION_PREDICATE: - r600_query_predication(&rctx->ctx, rquery, PREDICATION_OP_ZPASS, wait_flag); + r600_query_predication(rctx, rquery, PREDICATION_OP_ZPASS, wait_flag); break; case PIPE_QUERY_PRIMITIVES_EMITTED: case PIPE_QUERY_PRIMITIVES_GENERATED: case PIPE_QUERY_SO_STATISTICS: case PIPE_QUERY_SO_OVERFLOW_PREDICATE: - r600_query_predication(&rctx->ctx, rquery, PREDICATION_OP_PRIMCOUNT, wait_flag); + r600_query_predication(rctx, rquery, PREDICATION_OP_PRIMCOUNT, wait_flag); break; default: assert(0); } } -void r600_init_query_functions(struct r600_pipe_context *rctx) +void r600_init_query_functions(struct r600_context *rctx) { rctx->context.create_query = r600_create_query; rctx->context.destroy_query = r600_destroy_query; diff --git a/src/gallium/drivers/r600/r600_resource.c b/src/gallium/drivers/r600/r600_resource.c index 01db97ad42c..1dc63e927a9 100644 --- a/src/gallium/drivers/r600/r600_resource.c +++ b/src/gallium/drivers/r600/r600_resource.c @@ -53,7 +53,7 @@ void r600_init_screen_resource_functions(struct pipe_screen *screen) screen->user_buffer_create = r600_user_buffer_create; } -void r600_init_context_resource_functions(struct r600_pipe_context *r600) +void r600_init_context_resource_functions(struct r600_context *r600) { r600->context.get_transfer = u_get_transfer_vtbl; r600->context.transfer_map = u_transfer_map_vtbl; diff --git a/src/gallium/drivers/r600/r600_resource.h b/src/gallium/drivers/r600/r600_resource.h index f39ac55e877..1a32c056dd4 100644 --- a/src/gallium/drivers/r600/r600_resource.h +++ b/src/gallium/drivers/r600/r600_resource.h @@ -98,9 +98,9 @@ void* r600_texture_transfer_map(struct pipe_context *ctx, void r600_texture_transfer_unmap(struct pipe_context *ctx, struct pipe_transfer* transfer); -struct r600_pipe_context; +struct r600_context; -void r600_upload_const_buffer(struct r600_pipe_context *rctx, struct r600_resource **rbuffer, uint32_t *offset); +void r600_upload_const_buffer(struct r600_context *rctx, struct r600_resource **rbuffer, uint32_t *offset); uint64_t r600_resource_va(struct pipe_screen *screen, struct pipe_resource *resource); diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 109830decd9..5b145e6f1dc 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -59,7 +59,7 @@ The compiler must issue the source argument to slots z, y, and x static int r600_pipe_shader(struct pipe_context *ctx, struct r600_pipe_shader *shader) { - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_context *rctx = (struct r600_context *)ctx; struct r600_shader *rshader = &shader->shader; uint32_t *ptr; int i; @@ -71,7 +71,7 @@ static int r600_pipe_shader(struct pipe_context *ctx, struct r600_pipe_shader *s if (shader->bo == NULL) { return -ENOMEM; } - ptr = (uint32_t*)rctx->ws->buffer_map(shader->bo->buf, rctx->ctx.cs, PIPE_TRANSFER_WRITE); + ptr = (uint32_t*)rctx->ws->buffer_map(shader->bo->buf, rctx->cs, PIPE_TRANSFER_WRITE); if (R600_BIG_ENDIAN) { for (i = 0; i < rshader->bc.ndw; ++i) { ptr[i] = bswap_32(rshader->bc.bytecode[i]); @@ -103,12 +103,12 @@ static int r600_pipe_shader(struct pipe_context *ctx, struct r600_pipe_shader *s return 0; } -static int r600_shader_from_tgsi(struct r600_pipe_context * rctx, struct r600_pipe_shader *pipeshader); +static int r600_shader_from_tgsi(struct r600_context * rctx, struct r600_pipe_shader *pipeshader); int r600_pipe_shader_create(struct pipe_context *ctx, struct r600_pipe_shader *shader) { static int dump_shaders = -1; - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_context *rctx = (struct r600_context *)ctx; int r; /* Would like some magic "get_bool_option_once" routine. @@ -806,7 +806,7 @@ static int process_twoside_color_inputs(struct r600_shader_ctx *ctx) return 0; } -static int r600_shader_from_tgsi(struct r600_pipe_context * rctx, struct r600_pipe_shader *pipeshader) +static int r600_shader_from_tgsi(struct r600_context * rctx, struct r600_pipe_shader *pipeshader) { struct r600_shader *shader = &pipeshader->shader; struct tgsi_token *tokens = pipeshader->tokens; diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index f349541d5ff..f2e0bfc537c 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -699,7 +699,7 @@ boolean r600_is_format_supported(struct pipe_screen *screen, return retval == usage; } -void r600_polygon_offset_update(struct r600_pipe_context *rctx) +void r600_polygon_offset_update(struct r600_context *rctx) { struct r600_pipe_state state; @@ -745,14 +745,14 @@ void r600_polygon_offset_update(struct r600_pipe_context *rctx) r600_pipe_state_add_reg(&state, R_028DF8_PA_SU_POLY_OFFSET_DB_FMT_CNTL, offset_db_fmt_cntl, NULL, 0); - r600_context_pipe_state_set(&rctx->ctx, &state); + r600_context_pipe_state_set(rctx, &state); } } static void r600_set_blend_color(struct pipe_context *ctx, const struct pipe_blend_color *state) { - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_context *rctx = (struct r600_context *)ctx; struct r600_pipe_state *rstate = CALLOC_STRUCT(r600_pipe_state); if (rstate == NULL) @@ -765,13 +765,13 @@ static void r600_set_blend_color(struct pipe_context *ctx, r600_pipe_state_add_reg(rstate, R_028420_CB_BLEND_ALPHA, fui(state->color[3]), NULL, 0); free(rctx->states[R600_PIPE_STATE_BLEND_COLOR]); rctx->states[R600_PIPE_STATE_BLEND_COLOR] = rstate; - r600_context_pipe_state_set(&rctx->ctx, rstate); + r600_context_pipe_state_set(rctx, rstate); } static void *r600_create_blend_state(struct pipe_context *ctx, const struct pipe_blend_state *state) { - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_context *rctx = (struct r600_context *)ctx; struct r600_pipe_blend *blend = CALLOC_STRUCT(r600_pipe_blend); struct r600_pipe_state *rstate; uint32_t color_control = 0, target_mask; @@ -851,7 +851,7 @@ static void *r600_create_blend_state(struct pipe_context *ctx, static void *r600_create_dsa_state(struct pipe_context *ctx, const struct pipe_depth_stencil_alpha_state *state) { - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_context *rctx = (struct r600_context *)ctx; struct r600_pipe_dsa *dsa = CALLOC_STRUCT(r600_pipe_dsa); unsigned db_depth_control, alpha_test_control, alpha_ref; unsigned db_render_override, db_render_control; @@ -928,7 +928,7 @@ static void *r600_create_dsa_state(struct pipe_context *ctx, static void *r600_create_rs_state(struct pipe_context *ctx, const struct pipe_rasterizer_state *state) { - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_context *rctx = (struct r600_context *)ctx; struct r600_pipe_rasterizer *rs = CALLOC_STRUCT(r600_pipe_rasterizer); struct r600_pipe_state *rstate; unsigned tmp; @@ -1167,7 +1167,7 @@ static struct pipe_sampler_view *r600_create_sampler_view(struct pipe_context *c return &view->base; } -static void r600_set_sampler_views(struct r600_pipe_context *rctx, +static void r600_set_sampler_views(struct r600_context *rctx, struct r600_textures_info *dst, unsigned count, struct pipe_sampler_view **views, @@ -1186,9 +1186,9 @@ static void r600_set_sampler_views(struct r600_pipe_context *rctx, rviews[i]->base.texture->target == PIPE_TEXTURE_2D_ARRAY) != dst->is_array_sampler[i]) dst->samplers_dirty = true; - set_resource(&rctx->ctx, &rviews[i]->state, i + R600_MAX_CONST_BUFFERS); + set_resource(rctx, &rviews[i]->state, i + R600_MAX_CONST_BUFFERS); } else { - set_resource(&rctx->ctx, NULL, i + R600_MAX_CONST_BUFFERS); + set_resource(rctx, NULL, i + R600_MAX_CONST_BUFFERS); } pipe_sampler_view_reference( @@ -1198,7 +1198,7 @@ static void r600_set_sampler_views(struct r600_pipe_context *rctx, for (i = count; i < dst->n_views; i++) { if (dst->views[i]) { - set_resource(&rctx->ctx, NULL, i + R600_MAX_CONST_BUFFERS); + set_resource(rctx, NULL, i + R600_MAX_CONST_BUFFERS); pipe_sampler_view_reference((struct pipe_sampler_view **)&dst->views[i], NULL); } } @@ -1209,7 +1209,7 @@ static void r600_set_sampler_views(struct r600_pipe_context *rctx, static void r600_set_vs_sampler_views(struct pipe_context *ctx, unsigned count, struct pipe_sampler_view **views) { - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_context *rctx = (struct r600_context *)ctx; r600_set_sampler_views(rctx, &rctx->vs_samplers, count, views, r600_context_pipe_state_set_vs_resource); } @@ -1217,12 +1217,12 @@ static void r600_set_vs_sampler_views(struct pipe_context *ctx, unsigned count, static void r600_set_ps_sampler_views(struct pipe_context *ctx, unsigned count, struct pipe_sampler_view **views) { - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_context *rctx = (struct r600_context *)ctx; r600_set_sampler_views(rctx, &rctx->ps_samplers, count, views, r600_context_pipe_state_set_ps_resource); } -static void r600_set_seamless_cubemap(struct r600_pipe_context *rctx, boolean enable) +static void r600_set_seamless_cubemap(struct r600_context *rctx, boolean enable) { struct r600_pipe_state *rstate = CALLOC_STRUCT(r600_pipe_state); if (rstate == NULL) @@ -1239,10 +1239,10 @@ static void r600_set_seamless_cubemap(struct r600_pipe_context *rctx, boolean en free(rctx->states[R600_PIPE_STATE_SEAMLESS_CUBEMAP]); rctx->states[R600_PIPE_STATE_SEAMLESS_CUBEMAP] = rstate; - r600_context_pipe_state_set(&rctx->ctx, rstate); + r600_context_pipe_state_set(rctx, rstate); } -static void r600_bind_samplers(struct r600_pipe_context *rctx, +static void r600_bind_samplers(struct r600_context *rctx, struct r600_textures_info *dst, unsigned count, void **states) { @@ -1253,17 +1253,17 @@ static void r600_bind_samplers(struct r600_pipe_context *rctx, static void r600_bind_vs_samplers(struct pipe_context *ctx, unsigned count, void **states) { - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_context *rctx = (struct r600_context *)ctx; r600_bind_samplers(rctx, &rctx->vs_samplers, count, states); } static void r600_bind_ps_samplers(struct pipe_context *ctx, unsigned count, void **states) { - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_context *rctx = (struct r600_context *)ctx; r600_bind_samplers(rctx, &rctx->ps_samplers, count, states); } -static void r600_update_samplers(struct r600_pipe_context *rctx, +static void r600_update_samplers(struct r600_context *rctx, struct r600_textures_info *tex, void (*set_sampler)(struct r600_context*, struct r600_pipe_state*, unsigned)) { @@ -1289,7 +1289,7 @@ static void r600_update_samplers(struct r600_pipe_context *rctx, } } - set_sampler(&rctx->ctx, &tex->samplers[i]->rstate, i); + set_sampler(rctx, &tex->samplers[i]->rstate, i); if (tex->samplers[i]) seamless = tex->samplers[i]->seamless_cube_map; @@ -1302,7 +1302,7 @@ static void r600_update_samplers(struct r600_pipe_context *rctx, } } -void r600_update_sampler_states(struct r600_pipe_context *rctx) +void r600_update_sampler_states(struct r600_context *rctx) { r600_update_samplers(rctx, &rctx->vs_samplers, r600_context_pipe_state_set_vs_sampler); @@ -1313,7 +1313,7 @@ void r600_update_sampler_states(struct r600_pipe_context *rctx) static void r600_set_clip_state(struct pipe_context *ctx, const struct pipe_clip_state *state) { - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_context *rctx = (struct r600_context *)ctx; struct r600_pipe_state *rstate = CALLOC_STRUCT(r600_pipe_state); struct pipe_resource * cbuf; @@ -1339,7 +1339,7 @@ static void r600_set_clip_state(struct pipe_context *ctx, free(rctx->states[R600_PIPE_STATE_CLIP]); rctx->states[R600_PIPE_STATE_CLIP] = rstate; - r600_context_pipe_state_set(&rctx->ctx, rstate); + r600_context_pipe_state_set(rctx, rstate); cbuf = pipe_user_buffer_create(ctx->screen, state->ucp, @@ -1361,7 +1361,7 @@ static void r600_set_sample_mask(struct pipe_context *pipe, unsigned sample_mask static void r600_set_scissor_state(struct pipe_context *ctx, const struct pipe_scissor_state *state) { - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_context *rctx = (struct r600_context *)ctx; struct r600_pipe_state *rstate = CALLOC_STRUCT(r600_pipe_state); uint32_t tl, br; @@ -1398,13 +1398,13 @@ static void r600_set_scissor_state(struct pipe_context *ctx, free(rctx->states[R600_PIPE_STATE_SCISSOR]); rctx->states[R600_PIPE_STATE_SCISSOR] = rstate; - r600_context_pipe_state_set(&rctx->ctx, rstate); + r600_context_pipe_state_set(rctx, rstate); } static void r600_set_viewport_state(struct pipe_context *ctx, const struct pipe_viewport_state *state) { - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_context *rctx = (struct r600_context *)ctx; struct r600_pipe_state *rstate = CALLOC_STRUCT(r600_pipe_state); if (rstate == NULL) @@ -1424,10 +1424,10 @@ static void r600_set_viewport_state(struct pipe_context *ctx, free(rctx->states[R600_PIPE_STATE_VIEWPORT]); rctx->states[R600_PIPE_STATE_VIEWPORT] = rstate; - r600_context_pipe_state_set(&rctx->ctx, rstate); + r600_context_pipe_state_set(rctx, rstate); } -static void r600_cb(struct r600_pipe_context *rctx, struct r600_pipe_state *rstate, +static void r600_cb(struct r600_context *rctx, struct r600_pipe_state *rstate, const struct pipe_framebuffer_state *state, int cb) { struct r600_resource_texture *rtex; @@ -1561,7 +1561,7 @@ static void r600_cb(struct r600_pipe_context *rctx, struct r600_pipe_state *rsta 0x00000000, NULL, 0); } -static void r600_db(struct r600_pipe_context *rctx, struct r600_pipe_state *rstate, +static void r600_db(struct r600_context *rctx, struct r600_pipe_state *rstate, const struct pipe_framebuffer_state *state) { struct r600_resource_texture *rtex; @@ -1603,15 +1603,15 @@ static void r600_db(struct r600_pipe_context *rctx, struct r600_pipe_state *rsta static void r600_set_framebuffer_state(struct pipe_context *ctx, const struct pipe_framebuffer_state *state) { - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_context *rctx = (struct r600_context *)ctx; struct r600_pipe_state *rstate = CALLOC_STRUCT(r600_pipe_state); uint32_t shader_mask, tl, br, shader_control; if (rstate == NULL) return; - r600_context_flush_dest_caches(&rctx->ctx); - rctx->ctx.num_dest_buffers = state->nr_cbufs; + r600_context_flush_dest_caches(rctx); + rctx->num_dest_buffers = state->nr_cbufs; /* unreference old buffer and reference new one */ rstate->id = R600_PIPE_STATE_FRAMEBUFFER; @@ -1625,7 +1625,7 @@ static void r600_set_framebuffer_state(struct pipe_context *ctx, } if (state->zsbuf) { r600_db(rctx, rstate, state); - rctx->ctx.num_dest_buffers++; + rctx->num_dest_buffers++; } shader_mask = 0; @@ -1693,7 +1693,7 @@ static void r600_set_framebuffer_state(struct pipe_context *ctx, free(rctx->states[R600_PIPE_STATE_FRAMEBUFFER]); rctx->states[R600_PIPE_STATE_FRAMEBUFFER] = rstate; - r600_context_pipe_state_set(&rctx->ctx, rstate); + r600_context_pipe_state_set(rctx, rstate); if (state->zsbuf) { r600_polygon_offset_update(rctx); @@ -1702,16 +1702,16 @@ static void r600_set_framebuffer_state(struct pipe_context *ctx, static void r600_texture_barrier(struct pipe_context *ctx) { - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_context *rctx = (struct r600_context *)ctx; - r600_context_flush_all(&rctx->ctx, S_0085F0_TC_ACTION_ENA(1) | S_0085F0_CB_ACTION_ENA(1) | + r600_context_flush_all(rctx, S_0085F0_TC_ACTION_ENA(1) | S_0085F0_CB_ACTION_ENA(1) | S_0085F0_CB0_DEST_BASE_ENA(1) | S_0085F0_CB1_DEST_BASE_ENA(1) | S_0085F0_CB2_DEST_BASE_ENA(1) | S_0085F0_CB3_DEST_BASE_ENA(1) | S_0085F0_CB4_DEST_BASE_ENA(1) | S_0085F0_CB5_DEST_BASE_ENA(1) | S_0085F0_CB6_DEST_BASE_ENA(1) | S_0085F0_CB7_DEST_BASE_ENA(1)); } -void r600_init_state_functions(struct r600_pipe_context *rctx) +void r600_init_state_functions(struct r600_context *rctx) { rctx->context.create_blend_state = r600_create_blend_state; rctx->context.create_depth_stencil_alpha_state = r600_create_dsa_state; @@ -1757,7 +1757,7 @@ void r600_init_state_functions(struct r600_pipe_context *rctx) rctx->context.set_stream_output_targets = r600_set_so_targets; } -void r600_adjust_gprs(struct r600_pipe_context *rctx) +void r600_adjust_gprs(struct r600_context *rctx) { struct r600_pipe_state rstate; unsigned num_ps_gprs = rctx->default_ps_gprs; @@ -1792,10 +1792,10 @@ void r600_adjust_gprs(struct r600_pipe_context *rctx) rstate.nregs = 0; r600_pipe_state_add_reg(&rstate, R_008C04_SQ_GPR_RESOURCE_MGMT_1, tmp, NULL, 0); - r600_context_pipe_state_set(&rctx->ctx, &rstate); + r600_context_pipe_state_set(rctx, &rstate); } -void r600_init_config(struct r600_pipe_context *rctx) +void r600_init_config(struct r600_context *rctx) { int ps_prio; int vs_prio; @@ -2043,14 +2043,14 @@ void r600_init_config(struct r600_pipe_context *rctx) r600_pipe_state_add_reg(rstate, R_028A94_VGT_MULTI_PRIM_IB_RESET_EN, 0x00000000, NULL, 0); r600_pipe_state_add_reg(rstate, R_028AA0_VGT_INSTANCE_STEP_RATE_0, 0x00000000, NULL, 0); r600_pipe_state_add_reg(rstate, R_028AA4_VGT_INSTANCE_STEP_RATE_1, 0x00000000, NULL, 0); - r600_context_pipe_state_set(&rctx->ctx, rstate); + r600_context_pipe_state_set(rctx, rstate); r600_set_seamless_cubemap(rctx, FALSE); } void r600_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shader *shader) { - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_context *rctx = (struct r600_context *)ctx; struct r600_pipe_state *rstate = &shader->rstate; struct r600_shader *rshader = &shader->shader; unsigned i, exports_ps, num_cout, spi_ps_in_control_0, spi_input_z, spi_ps_in_control_1, db_shader_control; @@ -2175,7 +2175,7 @@ void r600_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shader *shad void r600_pipe_shader_vs(struct pipe_context *ctx, struct r600_pipe_shader *shader) { - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_context *rctx = (struct r600_context *)ctx; struct r600_pipe_state *rstate = &shader->rstate; struct r600_shader *rshader = &shader->shader; unsigned spi_vs_out_id[10] = {}; @@ -2236,7 +2236,7 @@ void r600_fetch_shader(struct pipe_context *ctx, struct r600_vertex_element *ve) { struct r600_pipe_state *rstate; - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_context *rctx = (struct r600_context *)ctx; rstate = &ve->rstate; rstate->id = R600_PIPE_STATE_FETCH_SHADER; @@ -2250,7 +2250,7 @@ void r600_fetch_shader(struct pipe_context *ctx, ve->fetch_shader, RADEON_USAGE_READ); } -void *r600_create_db_flush_dsa(struct r600_pipe_context *rctx) +void *r600_create_db_flush_dsa(struct r600_context *rctx) { struct pipe_depth_stencil_alpha_state dsa; struct r600_pipe_state *rstate; @@ -2289,7 +2289,7 @@ void *r600_create_db_flush_dsa(struct r600_pipe_context *rctx) return rstate; } -void r600_pipe_init_buffer_resource(struct r600_pipe_context *rctx, +void r600_pipe_init_buffer_resource(struct r600_context *rctx, struct r600_pipe_resource_state *rstate) { rstate->id = R600_PIPE_STATE_RESOURCE; diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c index 7d7daafea82..4c551402c8f 100644 --- a/src/gallium/drivers/r600/r600_state_common.c +++ b/src/gallium/drivers/r600/r600_state_common.c @@ -64,7 +64,7 @@ static bool r600_conv_pipe_prim(unsigned pprim, unsigned *prim) /* common state between evergreen and r600 */ void r600_bind_blend_state(struct pipe_context *ctx, void *state) { - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_context *rctx = (struct r600_context *)ctx; struct r600_pipe_blend *blend = (struct r600_pipe_blend *)state; struct r600_pipe_state *rstate; @@ -78,13 +78,13 @@ void r600_bind_blend_state(struct pipe_context *ctx, void *state) rctx->cb_color_control &= ~C_028808_MULTIWRITE_ENABLE; rctx->cb_color_control |= blend->cb_color_control & C_028808_MULTIWRITE_ENABLE; - r600_context_pipe_state_set(&rctx->ctx, rstate); + r600_context_pipe_state_set(rctx, rstate); } static void r600_set_stencil_ref(struct pipe_context *ctx, const struct r600_stencil_ref *state) { - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_context *rctx = (struct r600_context *)ctx; struct r600_pipe_state *rstate = CALLOC_STRUCT(r600_pipe_state); if (rstate == NULL) @@ -106,13 +106,13 @@ static void r600_set_stencil_ref(struct pipe_context *ctx, free(rctx->states[R600_PIPE_STATE_STENCIL_REF]); rctx->states[R600_PIPE_STATE_STENCIL_REF] = rstate; - r600_context_pipe_state_set(&rctx->ctx, rstate); + r600_context_pipe_state_set(rctx, rstate); } void r600_set_pipe_stencil_ref(struct pipe_context *ctx, const struct pipe_stencil_ref *state) { - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_context *rctx = (struct r600_context *)ctx; struct r600_pipe_dsa *dsa = (struct r600_pipe_dsa*)rctx->states[R600_PIPE_STATE_DSA]; struct r600_stencil_ref ref; @@ -133,7 +133,7 @@ void r600_set_pipe_stencil_ref(struct pipe_context *ctx, void r600_bind_dsa_state(struct pipe_context *ctx, void *state) { - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_context *rctx = (struct r600_context *)ctx; struct r600_pipe_dsa *dsa = state; struct r600_pipe_state *rstate; struct r600_stencil_ref ref; @@ -144,7 +144,7 @@ void r600_bind_dsa_state(struct pipe_context *ctx, void *state) rctx->states[rstate->id] = rstate; rctx->alpha_ref = dsa->alpha_ref; rctx->alpha_ref_dirty = true; - r600_context_pipe_state_set(&rctx->ctx, rstate); + r600_context_pipe_state_set(rctx, rstate); ref.ref_value[0] = rctx->stencil_ref.ref_value[0]; ref.ref_value[1] = rctx->stencil_ref.ref_value[1]; @@ -159,7 +159,7 @@ void r600_bind_dsa_state(struct pipe_context *ctx, void *state) void r600_bind_rs_state(struct pipe_context *ctx, void *state) { struct r600_pipe_rasterizer *rs = (struct r600_pipe_rasterizer *)state; - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_context *rctx = (struct r600_context *)ctx; if (state == NULL) return; @@ -173,7 +173,7 @@ void r600_bind_rs_state(struct pipe_context *ctx, void *state) rctx->rasterizer = rs; rctx->states[rs->rstate.id] = &rs->rstate; - r600_context_pipe_state_set(&rctx->ctx, &rs->rstate); + r600_context_pipe_state_set(rctx, &rs->rstate); if (rctx->chip_class >= EVERGREEN) { evergreen_polygon_offset_update(rctx); @@ -184,7 +184,7 @@ void r600_bind_rs_state(struct pipe_context *ctx, void *state) void r600_delete_rs_state(struct pipe_context *ctx, void *state) { - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_context *rctx = (struct r600_context *)ctx; struct r600_pipe_rasterizer *rs = (struct r600_pipe_rasterizer *)state; if (rctx->rasterizer == rs) { @@ -207,7 +207,7 @@ void r600_sampler_view_destroy(struct pipe_context *ctx, void r600_delete_state(struct pipe_context *ctx, void *state) { - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_context *rctx = (struct r600_context *)ctx; struct r600_pipe_state *rstate = (struct r600_pipe_state *)state; if (rctx->states[rstate->id] == rstate) { @@ -221,7 +221,7 @@ void r600_delete_state(struct pipe_context *ctx, void *state) void r600_bind_vertex_elements(struct pipe_context *ctx, void *state) { - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_context *rctx = (struct r600_context *)ctx; struct r600_vertex_element *v = (struct r600_vertex_element*)state; rctx->vertex_elements = v; @@ -230,13 +230,13 @@ void r600_bind_vertex_elements(struct pipe_context *ctx, void *state) v->vmgr_elements); rctx->states[v->rstate.id] = &v->rstate; - r600_context_pipe_state_set(&rctx->ctx, &v->rstate); + r600_context_pipe_state_set(rctx, &v->rstate); } } void r600_delete_vertex_element(struct pipe_context *ctx, void *state) { - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_context *rctx = (struct r600_context *)ctx; struct r600_vertex_element *v = (struct r600_vertex_element*)state; if (rctx->states[v->rstate.id] == &v->rstate) { @@ -254,7 +254,7 @@ void r600_delete_vertex_element(struct pipe_context *ctx, void *state) void r600_set_index_buffer(struct pipe_context *ctx, const struct pipe_index_buffer *ib) { - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_context *rctx = (struct r600_context *)ctx; u_vbuf_set_index_buffer(rctx->vbuf_mgr, ib); } @@ -262,24 +262,24 @@ void r600_set_index_buffer(struct pipe_context *ctx, void r600_set_vertex_buffers(struct pipe_context *ctx, unsigned count, const struct pipe_vertex_buffer *buffers) { - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_context *rctx = (struct r600_context *)ctx; int i; /* Zero states. */ for (i = 0; i < count; i++) { if (!buffers[i].buffer) { if (rctx->chip_class >= EVERGREEN) { - evergreen_context_pipe_state_set_fs_resource(&rctx->ctx, NULL, i); + evergreen_context_pipe_state_set_fs_resource(rctx, NULL, i); } else { - r600_context_pipe_state_set_fs_resource(&rctx->ctx, NULL, i); + r600_context_pipe_state_set_fs_resource(rctx, NULL, i); } } } for (; i < rctx->vbuf_mgr->nr_real_vertex_buffers; i++) { if (rctx->chip_class >= EVERGREEN) { - evergreen_context_pipe_state_set_fs_resource(&rctx->ctx, NULL, i); + evergreen_context_pipe_state_set_fs_resource(rctx, NULL, i); } else { - r600_context_pipe_state_set_fs_resource(&rctx->ctx, NULL, i); + r600_context_pipe_state_set_fs_resource(rctx, NULL, i); } } @@ -290,7 +290,7 @@ void *r600_create_vertex_elements(struct pipe_context *ctx, unsigned count, const struct pipe_vertex_element *elements) { - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_context *rctx = (struct r600_context *)ctx; struct r600_vertex_element *v = CALLOC_STRUCT(r600_vertex_element); assert(count < 32); @@ -328,12 +328,12 @@ void *r600_create_shader_state(struct pipe_context *ctx, void r600_bind_ps_shader(struct pipe_context *ctx, void *state) { - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_context *rctx = (struct r600_context *)ctx; /* TODO delete old shader */ rctx->ps_shader = (struct r600_pipe_shader *)state; if (state) { - r600_context_pipe_state_set(&rctx->ctx, &rctx->ps_shader->rstate); + r600_context_pipe_state_set(rctx, &rctx->ps_shader->rstate); rctx->cb_color_control &= C_028808_MULTIWRITE_ENABLE; rctx->cb_color_control |= S_028808_MULTIWRITE_ENABLE(!!rctx->ps_shader->shader.fs_write_all); @@ -345,12 +345,12 @@ void r600_bind_ps_shader(struct pipe_context *ctx, void *state) void r600_bind_vs_shader(struct pipe_context *ctx, void *state) { - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_context *rctx = (struct r600_context *)ctx; /* TODO delete old shader */ rctx->vs_shader = (struct r600_pipe_shader *)state; if (state) { - r600_context_pipe_state_set(&rctx->ctx, &rctx->vs_shader->rstate); + r600_context_pipe_state_set(rctx, &rctx->vs_shader->rstate); } if (rctx->ps_shader && rctx->vs_shader) { r600_adjust_gprs(rctx); @@ -359,7 +359,7 @@ void r600_bind_vs_shader(struct pipe_context *ctx, void *state) void r600_delete_ps_shader(struct pipe_context *ctx, void *state) { - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_context *rctx = (struct r600_context *)ctx; struct r600_pipe_shader *shader = (struct r600_pipe_shader *)state; if (rctx->ps_shader == shader) { @@ -373,7 +373,7 @@ void r600_delete_ps_shader(struct pipe_context *ctx, void *state) void r600_delete_vs_shader(struct pipe_context *ctx, void *state) { - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_context *rctx = (struct r600_context *)ctx; struct r600_pipe_shader *shader = (struct r600_pipe_shader *)state; if (rctx->vs_shader == shader) { @@ -385,7 +385,7 @@ void r600_delete_vs_shader(struct pipe_context *ctx, void *state) free(shader); } -static void r600_update_alpha_ref(struct r600_pipe_context *rctx) +static void r600_update_alpha_ref(struct r600_context *rctx) { unsigned alpha_ref; struct r600_pipe_state rstate; @@ -396,14 +396,14 @@ static void r600_update_alpha_ref(struct r600_pipe_context *rctx) alpha_ref &= ~0x1FFF; r600_pipe_state_add_reg(&rstate, R_028438_SX_ALPHA_REF, alpha_ref, NULL, 0); - r600_context_pipe_state_set(&rctx->ctx, &rstate); + r600_context_pipe_state_set(rctx, &rstate); rctx->alpha_ref_dirty = false; } void r600_set_constant_buffer(struct pipe_context *ctx, uint shader, uint index, struct pipe_resource *buffer) { - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_context *rctx = (struct r600_context *)ctx; struct r600_resource *rbuffer = r600_resource(buffer); struct r600_pipe_resource_state *rstate; uint64_t va_offset; @@ -431,7 +431,7 @@ void r600_set_constant_buffer(struct pipe_context *ctx, uint shader, uint index, r600_pipe_state_add_reg(&rctx->vs_const_buffer, R_028980_ALU_CONST_CACHE_VS_0 + index * 4, va_offset, rbuffer, RADEON_USAGE_READ); - r600_context_pipe_state_set(&rctx->ctx, &rctx->vs_const_buffer); + r600_context_pipe_state_set(rctx, &rctx->vs_const_buffer); rstate = &rctx->vs_const_buffer_resource[index]; if (!rstate->id) { @@ -444,10 +444,10 @@ void r600_set_constant_buffer(struct pipe_context *ctx, uint shader, uint index, if (rctx->chip_class >= EVERGREEN) { evergreen_pipe_mod_buffer_resource(ctx, rstate, rbuffer, offset, 16, RADEON_USAGE_READ); - evergreen_context_pipe_state_set_vs_resource(&rctx->ctx, rstate, index); + evergreen_context_pipe_state_set_vs_resource(rctx, rstate, index); } else { r600_pipe_mod_buffer_resource(rstate, rbuffer, offset, 16, RADEON_USAGE_READ); - r600_context_pipe_state_set_vs_resource(&rctx->ctx, rstate, index); + r600_context_pipe_state_set_vs_resource(rctx, rstate, index); } break; case PIPE_SHADER_FRAGMENT: @@ -459,7 +459,7 @@ void r600_set_constant_buffer(struct pipe_context *ctx, uint shader, uint index, r600_pipe_state_add_reg(&rctx->ps_const_buffer, R_028940_ALU_CONST_CACHE_PS_0, va_offset, rbuffer, RADEON_USAGE_READ); - r600_context_pipe_state_set(&rctx->ctx, &rctx->ps_const_buffer); + r600_context_pipe_state_set(rctx, &rctx->ps_const_buffer); rstate = &rctx->ps_const_buffer_resource[index]; if (!rstate->id) { @@ -471,10 +471,10 @@ void r600_set_constant_buffer(struct pipe_context *ctx, uint shader, uint index, } if (rctx->chip_class >= EVERGREEN) { evergreen_pipe_mod_buffer_resource(ctx, rstate, rbuffer, offset, 16, RADEON_USAGE_READ); - evergreen_context_pipe_state_set_ps_resource(&rctx->ctx, rstate, index); + evergreen_context_pipe_state_set_ps_resource(rctx, rstate, index); } else { r600_pipe_mod_buffer_resource(rstate, rbuffer, offset, 16, RADEON_USAGE_READ); - r600_context_pipe_state_set_ps_resource(&rctx->ctx, rstate, index); + r600_context_pipe_state_set_ps_resource(rctx, rstate, index); } break; default: @@ -492,7 +492,7 @@ r600_create_so_target(struct pipe_context *ctx, unsigned buffer_offset, unsigned buffer_size) { - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_context *rctx = (struct r600_context *)ctx; struct r600_so_target *t; void *ptr; @@ -509,7 +509,7 @@ r600_create_so_target(struct pipe_context *ctx, t->filled_size = (struct r600_resource*) pipe_buffer_create(ctx->screen, PIPE_BIND_CUSTOM, PIPE_USAGE_STATIC, 4); - ptr = rctx->ws->buffer_map(t->filled_size->buf, rctx->ctx.cs, PIPE_TRANSFER_WRITE); + ptr = rctx->ws->buffer_map(t->filled_size->buf, rctx->cs, PIPE_TRANSFER_WRITE); memset(ptr, 0, t->filled_size->buf->size); rctx->ws->buffer_unmap(t->filled_size->buf); @@ -530,28 +530,28 @@ void r600_set_so_targets(struct pipe_context *ctx, struct pipe_stream_output_target **targets, unsigned append_bitmask) { - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_context *rctx = (struct r600_context *)ctx; unsigned i; /* Stop streamout. */ - if (rctx->ctx.num_so_targets) { - r600_context_streamout_end(&rctx->ctx); + if (rctx->num_so_targets) { + r600_context_streamout_end(rctx); } /* Set the new targets. */ for (i = 0; i < num_targets; i++) { - pipe_so_target_reference((struct pipe_stream_output_target**)&rctx->ctx.so_targets[i], targets[i]); + pipe_so_target_reference((struct pipe_stream_output_target**)&rctx->so_targets[i], targets[i]); } - for (; i < rctx->ctx.num_so_targets; i++) { - pipe_so_target_reference((struct pipe_stream_output_target**)&rctx->ctx.so_targets[i], NULL); + for (; i < rctx->num_so_targets; i++) { + pipe_so_target_reference((struct pipe_stream_output_target**)&rctx->so_targets[i], NULL); } - rctx->ctx.num_so_targets = num_targets; - rctx->ctx.streamout_start = num_targets != 0; - rctx->ctx.streamout_append_bitmask = append_bitmask; + rctx->num_so_targets = num_targets; + rctx->streamout_start = num_targets != 0; + rctx->streamout_append_bitmask = append_bitmask; } -static void r600_vertex_buffer_update(struct r600_pipe_context *rctx) +static void r600_vertex_buffer_update(struct r600_context *rctx) { struct r600_pipe_resource_state *rstate; struct r600_resource *rbuffer; @@ -596,17 +596,17 @@ static void r600_vertex_buffer_update(struct r600_pipe_context *rctx) if (rctx->chip_class >= EVERGREEN) { evergreen_pipe_mod_buffer_resource(&rctx->context, rstate, rbuffer, offset, vertex_buffer->stride, RADEON_USAGE_READ); - evergreen_context_pipe_state_set_fs_resource(&rctx->ctx, rstate, i); + evergreen_context_pipe_state_set_fs_resource(rctx, rstate, i); } else { r600_pipe_mod_buffer_resource(rstate, rbuffer, offset, vertex_buffer->stride, RADEON_USAGE_READ); - r600_context_pipe_state_set_fs_resource(&rctx->ctx, rstate, i); + r600_context_pipe_state_set_fs_resource(rctx, rstate, i); } } } static int r600_shader_rebuild(struct pipe_context * ctx, struct r600_pipe_shader * shader) { - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_context *rctx = (struct r600_context *)ctx; int r; r600_pipe_shader_destroy(ctx, shader); @@ -614,12 +614,12 @@ static int r600_shader_rebuild(struct pipe_context * ctx, struct r600_pipe_shade if (r) { return r; } - r600_context_pipe_state_set(&rctx->ctx, &shader->rstate); + r600_context_pipe_state_set(rctx, &shader->rstate); return 0; } -static void r600_update_derived_state(struct r600_pipe_context *rctx) +static void r600_update_derived_state(struct r600_context *rctx) { struct pipe_context * ctx = (struct pipe_context*)rctx; struct r600_pipe_state rstate; @@ -627,7 +627,7 @@ static void r600_update_derived_state(struct r600_pipe_context *rctx) rstate.nregs = 0; if (rstate.nregs) - r600_context_pipe_state_set(&rctx->ctx, &rstate); + r600_context_pipe_state_set(rctx, &rstate); if (!rctx->blitter->running) { if (rctx->have_depth_fb || rctx->have_depth_texture) @@ -657,14 +657,14 @@ static void r600_update_derived_state(struct r600_pipe_context *rctx) else r600_pipe_shader_ps(ctx, rctx->ps_shader); - r600_context_pipe_state_set(&rctx->ctx, &rctx->ps_shader->rstate); + r600_context_pipe_state_set(rctx, &rctx->ps_shader->rstate); } } void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *dinfo) { - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_context *rctx = (struct r600_context *)ctx; struct r600_pipe_dsa *dsa = (struct r600_pipe_dsa*)rctx->states[R600_PIPE_STATE_DSA]; struct pipe_draw_info info = *dinfo; struct r600_draw rdraw = {}; @@ -718,11 +718,11 @@ void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *dinfo) if (info.count_from_stream_output) { rdraw.vgt_draw_initiator |= S_0287F0_USE_OPAQUE(1); - r600_context_draw_opaque_count(&rctx->ctx, (struct r600_so_target*)info.count_from_stream_output); + r600_context_draw_opaque_count(rctx, (struct r600_so_target*)info.count_from_stream_output); } } - rctx->ctx.vs_so_stride_in_dw = rctx->vs_shader->so.stride; + rctx->vs_so_stride_in_dw = rctx->vs_shader->so.stride; mask = (1ULL << ((unsigned)rctx->framebuffer.nr_cbufs * 4)) - 1; @@ -779,15 +779,15 @@ void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *dinfo) rctx->vs_shader->shader.vs_prohibit_ucps ? 0 : rctx->rasterizer->clip_plane_enable & 0x3F)); - r600_context_pipe_state_set(&rctx->ctx, &rctx->vgt); + r600_context_pipe_state_set(rctx, &rctx->vgt); rdraw.db_render_override = dsa->db_render_override; rdraw.db_render_control = dsa->db_render_control; if (rctx->chip_class >= EVERGREEN) { - evergreen_context_draw(&rctx->ctx, &rdraw); + evergreen_context_draw(rctx, &rdraw); } else { - r600_context_draw(&rctx->ctx, &rdraw); + r600_context_draw(rctx, &rdraw); } if (rctx->framebuffer.zsbuf) diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c index 6692aa6bb54..47b440d7027 100644 --- a/src/gallium/drivers/r600/r600_texture.c +++ b/src/gallium/drivers/r600/r600_texture.c @@ -759,7 +759,7 @@ void r600_texture_transfer_destroy(struct pipe_context *ctx, void* r600_texture_transfer_map(struct pipe_context *ctx, struct pipe_transfer* transfer) { - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_context *rctx = (struct r600_context *)ctx; struct r600_transfer *rtransfer = (struct r600_transfer*)transfer; struct pb_buffer *buf; enum pipe_format format = transfer->resource->format; @@ -781,7 +781,7 @@ void* r600_texture_transfer_map(struct pipe_context *ctx, transfer->box.x / util_format_get_blockwidth(format) * util_format_get_blocksize(format); } - if (!(map = rctx->ws->buffer_map(buf, rctx->ctx.cs, transfer->usage))) { + if (!(map = rctx->ws->buffer_map(buf, rctx->cs, transfer->usage))) { return NULL; } @@ -792,7 +792,7 @@ void r600_texture_transfer_unmap(struct pipe_context *ctx, struct pipe_transfer* transfer) { struct r600_transfer *rtransfer = (struct r600_transfer*)transfer; - struct r600_pipe_context *rctx = (struct r600_pipe_context*)ctx; + struct r600_context *rctx = (struct r600_context*)ctx; struct pb_buffer *buf; if (rtransfer->staging_texture) { @@ -809,7 +809,7 @@ void r600_texture_transfer_unmap(struct pipe_context *ctx, rctx->ws->buffer_unmap(buf); } -void r600_init_surface_functions(struct r600_pipe_context *r600) +void r600_init_surface_functions(struct r600_context *r600) { r600->context.create_surface = r600_create_surface; r600->context.surface_destroy = r600_surface_destroy; diff --git a/src/gallium/drivers/r600/r600_translate.c b/src/gallium/drivers/r600/r600_translate.c index 94497077cba..fd415be6b6d 100644 --- a/src/gallium/drivers/r600/r600_translate.c +++ b/src/gallium/drivers/r600/r600_translate.c @@ -29,7 +29,7 @@ #include "r600_pipe.h" -void r600_translate_index_buffer(struct r600_pipe_context *r600, +void r600_translate_index_buffer(struct r600_context *r600, struct pipe_index_buffer *ib, unsigned count) { |