i915g: Remove the i915_context->saved_* stuff.
authorStéphane Marchesin <marcheu@chromium.org>
Fri, 5 Oct 2012 00:37:37 +0000 (17:37 -0700)
committerStéphane Marchesin <marcheu@chromium.org>
Fri, 5 Oct 2012 19:45:01 +0000 (12:45 -0700)
When using u_blitter, the state was being saved from saved_*, but we
don't use that. So after u_blitter resumed we got some corrupted
state in.

So let's just remove the saved_* stuff. I thought it was weird but
harmless, it's actually broken.

src/gallium/drivers/i915/i915_context.h
src/gallium/drivers/i915/i915_state.c
src/gallium/drivers/i915/i915_surface.c

index 4141a3d4cf3e917e41bd38d5ac2b3eb0fa0ca27a..719a0e87308b6200fbf51947eda0e6f2ff7fcfb3 100644 (file)
@@ -234,6 +234,12 @@ struct i915_context {
 
    struct i915_fragment_shader *fs;
 
+   void *vs;
+
+   struct i915_velems_state *velems;
+   unsigned nr_vertex_buffers;
+   struct pipe_vertex_buffer vertex_buffers[PIPE_MAX_ATTRIBS];
+
    struct pipe_blend_color blend_color;
    struct pipe_stencil_ref stencil_ref;
    struct pipe_clip_state clip;
@@ -285,19 +291,9 @@ struct i915_context {
    struct blitter_context* blitter;
 
    /** State tracking needed by u_blitter for save/restore. */
-   void *saved_fs;
    void (*saved_bind_fs_state)(struct pipe_context *pipe, void *shader);
-   void *saved_vs;
-   struct pipe_clip_state saved_clip;
-   struct i915_velems_state *saved_velems;
-   unsigned saved_nr_vertex_buffers;
-   struct pipe_vertex_buffer saved_vertex_buffers[PIPE_MAX_ATTRIBS];
-   unsigned saved_nr_samplers;
-   void *saved_samplers[PIPE_MAX_SAMPLERS];
    void (*saved_bind_sampler_states)(struct pipe_context *pipe,
                                      unsigned num, void **sampler);
-   unsigned saved_nr_sampler_views;
-   struct pipe_sampler_view *saved_sampler_views[PIPE_MAX_SAMPLERS];
    void (*saved_set_sampler_views)(struct pipe_context *pipe,
                                    unsigned num, struct pipe_sampler_view **views);
 };
index 410615f212a121a959b5744c1d7720f0d2371eac..d3e62c941a59da7326af809eda97060f82a526ee 100644 (file)
@@ -296,9 +296,6 @@ static void i915_fixup_bind_sampler_states(struct pipe_context *pipe,
 {
    struct i915_context *i915 = i915_context(pipe);
 
-   i915->saved_nr_samplers = num;
-   memcpy(&i915->saved_samplers, sampler, sizeof(void *) * num);
-
    i915->saved_bind_sampler_states(pipe, num, sampler);
 }
 
@@ -586,11 +583,6 @@ i915_fixup_bind_fs_state(struct pipe_context *pipe, void *shader)
 {
    struct i915_context *i915 = i915_context(pipe);
 
-   if (i915->saved_fs == shader)
-      return;
-
-   i915->saved_fs = shader;
-
    i915->saved_bind_fs_state(pipe, shader);
 }
 
@@ -645,10 +637,10 @@ static void i915_bind_vs_state(struct pipe_context *pipe, void *shader)
 {
    struct i915_context *i915 = i915_context(pipe);
 
-   if (i915->saved_vs == shader)
+   if (i915->vs == shader)
       return;
 
-   i915->saved_vs = shader;
+   i915->vs = shader;
 
    /* just pass-through to draw module */
    draw_bind_vertex_shader(i915->draw, (struct draw_vertex_shader *) shader);
@@ -726,17 +718,6 @@ i915_fixup_set_fragment_sampler_views(struct pipe_context *pipe,
                                       struct pipe_sampler_view **views)
 {
    struct i915_context *i915 = i915_context(pipe);
-   int i;
-
-   for (i = 0; i < num; i++)
-      pipe_sampler_view_reference(&i915->saved_sampler_views[i],
-                                  views[i]);
-
-   for (i = num; i < i915->saved_nr_sampler_views; i++)
-      pipe_sampler_view_reference(&i915->saved_sampler_views[i],
-                                  NULL);
-
-   i915->saved_nr_sampler_views = num;
 
    i915->saved_set_sampler_views(pipe, num, views);
 }
@@ -842,7 +823,7 @@ static void i915_set_framebuffer_state(struct pipe_context *pipe,
    }
    pipe_surface_reference(&i915->framebuffer.zsbuf, fb->zsbuf);
 
-   i915->dirty |= I915_NEW_FRAMEBUFFER;
+   i915->dirty |= I915_NEW_FRAMEBUFFER | I915_NEW_FS;
 }
 
 
@@ -852,7 +833,7 @@ static void i915_set_clip_state( struct pipe_context *pipe,
 {
    struct i915_context *i915 = i915_context(pipe);
 
-   i915->saved_clip = *clip;
+   i915->clip = *clip;
 
    draw_set_clip_state(i915->draw, clip);
 
@@ -978,8 +959,8 @@ static void i915_set_vertex_buffers(struct pipe_context *pipe,
    struct draw_context *draw = i915->draw;
    int i;
 
-   util_copy_vertex_buffers(i915->saved_vertex_buffers,
-                            &i915->saved_nr_vertex_buffers,
+   util_copy_vertex_buffers(i915->vertex_buffers,
+                            &i915->nr_vertex_buffers,
                             buffers, count);
 #if 0
    /* XXX doesn't look like this is needed */
@@ -1023,10 +1004,10 @@ i915_bind_vertex_elements_state(struct pipe_context *pipe,
    struct i915_context *i915 = i915_context(pipe);
    struct i915_velems_state *i915_velems = (struct i915_velems_state *) velems;
 
-   if (i915->saved_velems == velems)
+   if (i915->velems == velems)
       return;
 
-   i915->saved_velems = velems;
+   i915->velems = velems;
 
    /* pass-through to draw module */
    if (i915_velems) {
index 4bb5f4800cf717af61be469224663b1f1d7a6a21..6f5a654069f8d7b9f170f355cad266a1ec75d871 100644 (file)
@@ -50,22 +50,22 @@ i915_util_blitter_save_states(struct i915_context *i915)
    util_blitter_save_depth_stencil_alpha(i915->blitter, (void *)i915->depth_stencil);
    util_blitter_save_stencil_ref(i915->blitter, &i915->stencil_ref);
    util_blitter_save_rasterizer(i915->blitter, (void *)i915->rasterizer);
-   util_blitter_save_fragment_shader(i915->blitter, i915->saved_fs);
-   util_blitter_save_vertex_shader(i915->blitter, i915->saved_vs);
+   util_blitter_save_fragment_shader(i915->blitter, i915->fs);
+   util_blitter_save_vertex_shader(i915->blitter, i915->vs);
    util_blitter_save_viewport(i915->blitter, &i915->viewport);
    util_blitter_save_scissor(i915->blitter, &i915->scissor);
-   util_blitter_save_vertex_elements(i915->blitter, i915->saved_velems);
-   util_blitter_save_vertex_buffers(i915->blitter, i915->saved_nr_vertex_buffers,
-                                    i915->saved_vertex_buffers);
+   util_blitter_save_vertex_elements(i915->blitter, i915->velems);
+   util_blitter_save_vertex_buffers(i915->blitter, i915->nr_vertex_buffers,
+                                    i915->vertex_buffers);
 
    util_blitter_save_framebuffer(i915->blitter, &i915->framebuffer);
 
    util_blitter_save_fragment_sampler_states(i915->blitter,
-                                             i915->saved_nr_samplers,
-                                             i915->saved_samplers);
+                                             i915->num_samplers,
+                                             i915->sampler);
    util_blitter_save_fragment_sampler_views(i915->blitter,
-                                            i915->saved_nr_sampler_views,
-                                            i915->saved_sampler_views);
+                                            i915->num_fragment_sampler_views,
+                                            i915->fragment_sampler_views);
 }
 
 static void