static void fd_context_next_rb(struct pipe_context *pctx) { struct fd_context *ctx = fd_context(pctx); struct fd_ringbuffer *ring; fd_ringmarker_del(ctx->draw_start); fd_ringmarker_del(ctx->draw_end); ring = next_rb(ctx); ctx->draw_start = fd_ringmarker_new(ring); ctx->draw_end = fd_ringmarker_new(ring); fd_ringbuffer_set_parent(ring, NULL); ctx->ring = ring; fd_ringmarker_del(ctx->binning_start); fd_ringmarker_del(ctx->binning_end); ring = next_rb(ctx); ctx->binning_start = fd_ringmarker_new(ring); ctx->binning_end = fd_ringmarker_new(ring); fd_ringbuffer_set_parent(ring, ctx->ring); ctx->binning_ring = ring; }
struct pipe_context * fd_context_create(struct pipe_screen *pscreen, void *priv) { struct fd_screen *screen = fd_screen(pscreen); struct fd_context *ctx = CALLOC_STRUCT(fd_context); struct pipe_context *pctx; if (!ctx) return NULL; DBG(""); ctx->screen = screen; ctx->ring = fd_ringbuffer_new(screen->pipe, 0x100000); ctx->draw_start = fd_ringmarker_new(ctx->ring); ctx->draw_end = fd_ringmarker_new(ctx->ring); pctx = &ctx->base; pctx->screen = pscreen; pctx->priv = priv; pctx->flush = fd_context_flush; pctx->destroy = fd_context_destroy; util_slab_create(&ctx->transfer_pool, sizeof(struct pipe_transfer), 16, UTIL_SLAB_SINGLETHREADED); fd_vbo_init(pctx); fd_blend_init(pctx); fd_rasterizer_init(pctx); fd_zsa_init(pctx); fd_state_init(pctx); fd_resource_context_init(pctx); fd_clear_init(pctx); fd_prog_init(pctx); fd_texture_init(pctx); ctx->blitter = util_blitter_create(pctx); if (!ctx->blitter) { fd_context_destroy(pctx); return NULL; } /* construct vertex state used for solid ops (clear, and gmem<->mem) */ ctx->solid_vertexbuf = create_solid_vertexbuf(pctx); fd_state_emit_setup(pctx); return pctx; }
struct pipe_context * fd_context_init(struct fd_context *ctx, struct pipe_screen *pscreen, void *priv) { struct fd_screen *screen = fd_screen(pscreen); struct pipe_context *pctx; ctx->screen = screen; /* need some sane default in case state tracker doesn't * set some state: */ ctx->sample_mask = 0xffff; pctx = &ctx->base; pctx->screen = pscreen; pctx->priv = priv; pctx->flush = fd_context_flush; ctx->ring = fd_ringbuffer_new(screen->pipe, 0x100000); if (!ctx->ring) goto fail; ctx->draw_start = fd_ringmarker_new(ctx->ring); ctx->draw_end = fd_ringmarker_new(ctx->ring); util_slab_create(&ctx->transfer_pool, sizeof(struct pipe_transfer), 16, UTIL_SLAB_SINGLETHREADED); fd_draw_init(pctx); fd_resource_context_init(pctx); fd_texture_init(pctx); fd_state_init(pctx); ctx->blitter = util_blitter_create(pctx); if (!ctx->blitter) goto fail; return pctx; fail: pctx->destroy(pctx); return NULL; }