summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/ilo/ilo_render_gen6.c
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2014-09-25 12:02:33 +0800
committerChia-I Wu <[email protected]>2014-09-26 21:15:55 +0800
commit8f284343e08bffa798c99763e4a3c234da6ab4d3 (patch)
tree05a0a5ad428dbb77008981bb910567a29737f0fa /src/gallium/drivers/ilo/ilo_render_gen6.c
parenta05ce904aabcc3733df1338472348c636fce2341 (diff)
ilo: make ilo_render_emit_draw() direct
Remove emit_draw() and ILO_RENDER_DRAW indirections. With all emit functions being direct now, ilo_render_estimate_size() and more can also be removed. Signed-off-by: Chia-I Wu <[email protected]>
Diffstat (limited to 'src/gallium/drivers/ilo/ilo_render_gen6.c')
-rw-r--r--src/gallium/drivers/ilo/ilo_render_gen6.c141
1 files changed, 18 insertions, 123 deletions
diff --git a/src/gallium/drivers/ilo/ilo_render_gen6.c b/src/gallium/drivers/ilo/ilo_render_gen6.c
index 2173746c83b..f2b876cf046 100644
--- a/src/gallium/drivers/ilo/ilo_render_gen6.c
+++ b/src/gallium/drivers/ilo/ilo_render_gen6.c
@@ -834,11 +834,13 @@ gen6_draw_wm_raster(struct ilo_render *r,
#undef DIRTY
-static void
-gen6_draw_commands(struct ilo_render *render,
- const struct ilo_state_vector *vec,
- struct gen6_draw_session *session)
+void
+ilo_render_emit_draw_commands_gen6(struct ilo_render *render,
+ const struct ilo_state_vector *vec,
+ struct gen6_draw_session *session)
{
+ ILO_DEV_ASSERT(render->dev, 6, 6);
+
/*
* We try to keep the order of the commands match, as closely as possible,
* that of the classic i965 driver. It allows us to compare the command
@@ -866,83 +868,6 @@ gen6_draw_commands(struct ilo_render *render,
gen6_draw_vf_draw(render, vec, session);
}
-void
-gen6_draw_prepare(struct ilo_render *render,
- const struct ilo_state_vector *vec,
- struct gen6_draw_session *session)
-{
- memset(session, 0, sizeof(*session));
- session->pipe_dirty = vec->dirty;
- session->reduced_prim = u_reduced_prim(vec->draw->mode);
-
- if (render->hw_ctx_changed) {
- /* these should be enough to make everything uploaded */
- render->batch_bo_changed = true;
- render->state_bo_changed = true;
- render->instruction_bo_changed = true;
-
- session->prim_changed = true;
- session->primitive_restart_changed = true;
- } else {
- session->prim_changed =
- (render->state.reduced_prim != session->reduced_prim);
- session->primitive_restart_changed =
- (render->state.primitive_restart != vec->draw->primitive_restart);
- }
-}
-
-void
-gen6_draw_emit(struct ilo_render *render,
- const struct ilo_state_vector *vec,
- struct gen6_draw_session *session)
-{
- /* force all states to be uploaded if the state bo changed */
- if (render->state_bo_changed)
- session->pipe_dirty = ILO_DIRTY_ALL;
- else
- session->pipe_dirty = vec->dirty;
-
- ilo_render_emit_draw_dynamic_states(render, vec, session);
- ilo_render_emit_draw_surface_states(render, vec, session);
-
- /* force all commands to be uploaded if the HW context changed */
- if (render->hw_ctx_changed)
- session->pipe_dirty = ILO_DIRTY_ALL;
- else
- session->pipe_dirty = vec->dirty;
-
- session->emit_draw_commands(render, vec, session);
-}
-
-void
-gen6_draw_end(struct ilo_render *render,
- const struct ilo_state_vector *vec,
- struct gen6_draw_session *session)
-{
- render->hw_ctx_changed = false;
-
- render->batch_bo_changed = false;
- render->state_bo_changed = false;
- render->instruction_bo_changed = false;
-
- render->state.reduced_prim = session->reduced_prim;
- render->state.primitive_restart = vec->draw->primitive_restart;
-}
-
-static void
-ilo_render_emit_draw_gen6(struct ilo_render *render,
- const struct ilo_state_vector *vec)
-{
- struct gen6_draw_session session;
-
- gen6_draw_prepare(render, vec, &session);
-
- session.emit_draw_commands = gen6_draw_commands;
-
- gen6_draw_emit(render, vec, &session);
- gen6_draw_end(render, vec, &session);
-}
-
static void
gen6_rectlist_vs_to_sf(struct ilo_render *r,
const struct ilo_blitter *blitter)
@@ -1085,17 +1010,20 @@ ilo_render_emit_rectlist_commands_gen6(struct ilo_render *r,
gen6_3DPRIMITIVE(r->builder, &blitter->draw, NULL);
}
-static int
-gen6_render_max_command_size(const struct ilo_render *render)
+int
+ilo_render_get_draw_commands_len_gen6(const struct ilo_render *render,
+ const struct ilo_state_vector *vec)
{
- static int size;
+ static int len;
+
+ ILO_DEV_ASSERT(render->dev, 6, 6);
- if (!size) {
- size += GEN6_3DSTATE_CONSTANT_ANY__SIZE * 3;
- size += GEN6_3DSTATE_GS_SVB_INDEX__SIZE * 4;
- size += GEN6_PIPE_CONTROL__SIZE * 5;
+ if (!len) {
+ len += GEN6_3DSTATE_CONSTANT_ANY__SIZE * 3;
+ len += GEN6_3DSTATE_GS_SVB_INDEX__SIZE * 4;
+ len += GEN6_PIPE_CONTROL__SIZE * 5;
- size +=
+ len +=
GEN6_STATE_BASE_ADDRESS__SIZE +
GEN6_STATE_SIP__SIZE +
GEN6_3DSTATE_VF_STATISTICS__SIZE +
@@ -1128,38 +1056,5 @@ gen6_render_max_command_size(const struct ilo_render *render)
GEN6_3DPRIMITIVE__SIZE;
}
- return size;
-}
-
-static int
-ilo_render_estimate_size_gen6(struct ilo_render *render,
- enum ilo_render_action action,
- const void *arg)
-{
- int size;
-
- switch (action) {
- case ILO_RENDER_DRAW:
- {
- const struct ilo_state_vector *vec = arg;
-
- size = gen6_render_max_command_size(render) +
- ilo_render_get_draw_dynamic_states_len(render, vec) +
- ilo_render_get_draw_surface_states_len(render, vec);
- }
- break;
- default:
- assert(!"unknown render action");
- size = 0;
- break;
- }
-
- return size;
-}
-
-void
-ilo_render_init_gen6(struct ilo_render *render)
-{
- render->estimate_size = ilo_render_estimate_size_gen6;
- render->emit_draw = ilo_render_emit_draw_gen6;
+ return len;
}