r600g: atomize stencil ref state
[mesa.git] / src / gallium / drivers / r600 / r600_pipe.c
index 77adeaef8bc9b671c79dd13be980f76b7e167817..658e9a94a262537d3a851f31ad903d56b7983e67 100644 (file)
@@ -156,6 +156,9 @@ static void r600_destroy_context(struct pipe_context *context)
 {
        struct r600_context *rctx = (struct r600_context *)context;
 
+       pipe_resource_reference((struct pipe_resource**)&rctx->dummy_cmask, NULL);
+       pipe_resource_reference((struct pipe_resource**)&rctx->dummy_fmask, NULL);
+
        if (rctx->no_blend) {
                rctx->context.delete_blend_state(&rctx->context, rctx->no_blend);
        }
@@ -221,7 +224,6 @@ static struct pipe_context *r600_create_context(struct pipe_screen *screen, void
        rctx->family = rscreen->family;
        rctx->chip_class = rscreen->chip_class;
 
-       LIST_INITHEAD(&rctx->dirty_states);
        LIST_INITHEAD(&rctx->active_timer_queries);
        LIST_INITHEAD(&rctx->active_nontimer_queries);
        LIST_INITHEAD(&rctx->dirty);
@@ -235,12 +237,12 @@ static struct pipe_context *r600_create_context(struct pipe_screen *screen, void
        r600_init_query_functions(rctx);
        r600_init_context_resource_functions(rctx);
        r600_init_surface_functions(rctx);
-       rctx->context.draw_vbo = r600_draw_vbo;
+
 
        rctx->context.create_video_decoder = vl_create_decoder;
        rctx->context.create_video_buffer = vl_video_buffer_create;
 
-       r600_init_common_atoms(rctx);
+       r600_init_common_state_functions(rctx);
 
        switch (rctx->chip_class) {
        case R600:
@@ -250,7 +252,8 @@ static struct pipe_context *r600_create_context(struct pipe_screen *screen, void
                if (r600_context_init(rctx))
                        goto fail;
                rctx->custom_dsa_flush = r600_create_db_flush_dsa(rctx);
-               rctx->custom_blend_resolve = r600_create_resolve_blend(rctx);
+               rctx->custom_blend_resolve = rctx->chip_class == R700 ? r700_create_resolve_blend(rctx)
+                                                                     : r600_create_resolve_blend(rctx);
                rctx->custom_blend_decompress = r600_create_decompress_blend(rctx);
                rctx->has_vertex_cache = !(rctx->family == CHIP_RV610 ||
                                           rctx->family == CHIP_RV620 ||
@@ -283,7 +286,6 @@ static struct pipe_context *r600_create_context(struct pipe_screen *screen, void
 
        rctx->cs = rctx->ws->cs_create(rctx->ws);
        rctx->ws->cs_set_flush_callback(rctx->cs, r600_flush_from_winsys, rctx);
-       r600_emit_atom(rctx, &rctx->start_cs_cmd.atom);
 
         rctx->uploader = u_upload_create(&rctx->context, 1024 * 1024, 256,
                                          PIPE_BIND_INDEX_BUFFER |
@@ -296,6 +298,7 @@ static struct pipe_context *r600_create_context(struct pipe_screen *screen, void
                goto fail;
        rctx->blitter->draw_rectangle = r600_draw_rectangle;
 
+       r600_begin_new_cs(rctx);
        r600_get_backend_mask(rctx); /* this emits commands and must be last */
 
        if (rctx->chip_class == R600)
@@ -930,14 +933,12 @@ struct pipe_screen *r600_screen_create(struct radeon_winsys *ws)
        switch (rscreen->chip_class) {
        case R600:
        case EVERGREEN:
+       case CAYMAN:
                rscreen->has_streamout = rscreen->info.drm_minor >= 14;
                break;
        case R700:
                rscreen->has_streamout = rscreen->info.drm_minor >= 17;
                break;
-       /* TODO: Cayman */
-       default:
-               rscreen->has_streamout = debug_get_bool_option("R600_STREAMOUT", FALSE);
        }
 
        if (r600_init_tiling(rscreen)) {