From a2caf952a150a8da395f4cf1fd30e8c867b0064e Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Marchesin?= Date: Thu, 9 Feb 2012 20:39:00 -0800 Subject: [PATCH] i915g: Remove useless draw calls. --- src/gallium/drivers/i915/i915_context.c | 5 ++-- src/gallium/drivers/i915/i915_flush.c | 2 -- src/gallium/drivers/i915/i915_state.c | 36 ------------------------- 3 files changed, 2 insertions(+), 41 deletions(-) diff --git a/src/gallium/drivers/i915/i915_context.c b/src/gallium/drivers/i915/i915_context.c index 394e1f38d7a..81976298f07 100644 --- a/src/gallium/drivers/i915/i915_context.c +++ b/src/gallium/drivers/i915/i915_context.c @@ -94,9 +94,8 @@ i915_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info) i915_cleanup_vertex_sampling(i915); /* - * TODO: Flush only when a user vertex/index buffer is present - * (or even better, modify draw module to do this - * internally when this condition is seen?) + * Instead of flushing on every state change, we flush once here + * when we fire the vbo. */ draw_flush(i915->draw); } diff --git a/src/gallium/drivers/i915/i915_flush.c b/src/gallium/drivers/i915/i915_flush.c index 0a0ca7885da..50d6642e5a3 100644 --- a/src/gallium/drivers/i915/i915_flush.c +++ b/src/gallium/drivers/i915/i915_flush.c @@ -43,8 +43,6 @@ static void i915_flush_pipe( struct pipe_context *pipe, { struct i915_context *i915 = i915_context(pipe); - draw_flush(i915->draw); - /* Only shortcut this if we have no fence, otherwise we must flush the * empty batchbuffer to get our fence back. */ diff --git a/src/gallium/drivers/i915/i915_state.c b/src/gallium/drivers/i915/i915_state.c index 02cb3eafa94..f7ebfcdb88b 100644 --- a/src/gallium/drivers/i915/i915_state.c +++ b/src/gallium/drivers/i915/i915_state.c @@ -181,8 +181,6 @@ static void i915_bind_blend_state(struct pipe_context *pipe, if (i915->blend == blend) return; - draw_flush(i915->draw); - i915->blend = (struct i915_blend_state*)blend; i915->dirty |= I915_NEW_BLEND; @@ -202,8 +200,6 @@ static void i915_set_blend_color( struct pipe_context *pipe, if (!blend_color) return; - draw_flush(i915->draw); - i915->blend_color = *blend_color; i915->dirty |= I915_NEW_BLEND; @@ -214,8 +210,6 @@ static void i915_set_stencil_ref( struct pipe_context *pipe, { struct i915_context *i915 = i915_context(pipe); - draw_flush(i915->draw); - i915->stencil_ref = *stencil_ref; i915->dirty |= I915_NEW_DEPTH_STENCIL; @@ -323,8 +317,6 @@ i915_bind_vertex_sampler_states(struct pipe_context *pipe, !memcmp(i915->vertex_samplers, samplers, num_samplers * sizeof(void *))) return; - draw_flush(i915->draw); - for (i = 0; i < num_samplers; ++i) i915->vertex_samplers[i] = samplers[i]; for (i = num_samplers; i < PIPE_MAX_VERTEX_SAMPLERS; ++i) @@ -350,8 +342,6 @@ static void i915_bind_fragment_sampler_states(struct pipe_context *pipe, !memcmp(i915->sampler, sampler, num * sizeof(void *))) return; - draw_flush(i915->draw); - for (i = 0; i < num; ++i) i915->sampler[i] = sampler[i]; for (i = num; i < PIPE_MAX_SAMPLERS; ++i) @@ -540,8 +530,6 @@ static void i915_bind_depth_stencil_state(struct pipe_context *pipe, if (i915->depth_stencil == depth_stencil) return; - draw_flush(i915->draw); - i915->depth_stencil = (const struct i915_depth_stencil_state *)depth_stencil; i915->dirty |= I915_NEW_DEPTH_STENCIL; @@ -559,8 +547,6 @@ static void i915_set_scissor_state( struct pipe_context *pipe, { struct i915_context *i915 = i915_context(pipe); - draw_flush(i915->draw); - memcpy( &i915->scissor, scissor, sizeof(*scissor) ); i915->dirty |= I915_NEW_SCISSOR; } @@ -569,9 +555,6 @@ static void i915_set_scissor_state( struct pipe_context *pipe, static void i915_set_polygon_stipple( struct pipe_context *pipe, const struct pipe_poly_stipple *stipple ) { - struct i915_context *i915 = i915_context(pipe); - - draw_flush(i915->draw); } @@ -604,8 +587,6 @@ i915_fixup_bind_fs_state(struct pipe_context *pipe, void *shader) if (i915->saved_fs == shader) return; - draw_flush(i915->draw); - i915->saved_fs = shader; i915->saved_bind_fs_state(pipe, shader); @@ -619,8 +600,6 @@ i915_bind_fs_state(struct pipe_context *pipe, void *shader) if (i915->fs == shader) return; - draw_flush(i915->draw); - i915->fs = (struct i915_fragment_shader*) shader; draw_bind_fragment_shader(i915->draw, (i915->fs ? i915->fs->draw_data : NULL)); @@ -722,12 +701,6 @@ static void i915_set_constant_buffer(struct pipe_context *pipe, diff = i915->current.num_user_constants[shader] != 0; } - /* - * flush before updateing the state. - */ - if (diff && shader == PIPE_SHADER_FRAGMENT) - draw_flush(i915->draw); - pipe_resource_reference(&i915->constants[shader], buf); i915->current.num_user_constants[shader] = new_num; @@ -771,9 +744,6 @@ static void i915_set_fragment_sampler_views(struct pipe_context *pipe, !memcmp(i915->fragment_sampler_views, views, num * sizeof(struct pipe_sampler_view *))) return; - /* Fixes wrong texture in texobj with VBUF */ - draw_flush(i915->draw); - for (i = 0; i < num; i++) pipe_sampler_view_reference(&i915->fragment_sampler_views[i], views[i]); @@ -803,8 +773,6 @@ i915_set_vertex_sampler_views(struct pipe_context *pipe, return; } - draw_flush(i915->draw); - for (i = 0; i < PIPE_MAX_VERTEX_SAMPLERS; i++) { struct pipe_sampler_view *view = i < num ? views[i] : NULL; @@ -853,8 +821,6 @@ static void i915_set_framebuffer_state(struct pipe_context *pipe, struct i915_context *i915 = i915_context(pipe); int i; - draw_flush(i915->draw); - i915->framebuffer.width = fb->width; i915->framebuffer.height = fb->height; i915->framebuffer.nr_cbufs = fb->nr_cbufs; @@ -874,8 +840,6 @@ static void i915_set_clip_state( struct pipe_context *pipe, { struct i915_context *i915 = i915_context(pipe); - draw_flush(i915->draw); - i915->saved_clip = *clip; draw_set_clip_state(i915->draw, clip); -- 2.30.2