Example #1
0
struct pipe_context *
fd2_context_create(struct pipe_screen *pscreen, void *priv)
{
	struct fd2_context *fd2_ctx = CALLOC_STRUCT(fd2_context);
	struct pipe_context *pctx;

	if (!fd2_ctx)
		return NULL;

	pctx = &fd2_ctx->base.base;

	pctx->destroy = fd2_context_destroy;
	pctx->create_blend_state = fd2_blend_state_create;
	pctx->create_rasterizer_state = fd2_rasterizer_state_create;
	pctx->create_depth_stencil_alpha_state = fd2_zsa_state_create;

	fd2_draw_init(pctx);
	fd2_gmem_init(pctx);
	fd2_texture_init(pctx);
	fd2_prog_init(pctx);

	pctx = fd_context_init(&fd2_ctx->base, pscreen, priv);
	if (!pctx)
		return NULL;

	/* construct vertex state used for solid ops (clear, and gmem<->mem) */
	fd2_ctx->solid_vertexbuf = create_solid_vertexbuf(pctx);

	fd2_emit_setup(&fd2_ctx->base);

	return pctx;
}
Example #2
0
struct pipe_context *
fd4_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags)
{
	struct fd_screen *screen = fd_screen(pscreen);
	struct fd4_context *fd4_ctx = CALLOC_STRUCT(fd4_context);
	struct pipe_context *pctx;

	if (!fd4_ctx)
		return NULL;

	pctx = &fd4_ctx->base.base;

	fd4_ctx->base.dev = fd_device_ref(screen->dev);
	fd4_ctx->base.screen = fd_screen(pscreen);

	pctx->destroy = fd4_context_destroy;
	pctx->create_blend_state = fd4_blend_state_create;
	pctx->create_rasterizer_state = fd4_rasterizer_state_create;
	pctx->create_depth_stencil_alpha_state = fd4_zsa_state_create;

	fd4_draw_init(pctx);
	fd4_gmem_init(pctx);
	fd4_texture_init(pctx);
	fd4_prog_init(pctx);
	fd4_emit_init(pctx);

	pctx = fd_context_init(&fd4_ctx->base, pscreen, primtypes, priv);
	if (!pctx)
		return NULL;

	util_dynarray_init(&fd4_ctx->rbrc_patches);

	fd4_ctx->vs_pvt_mem = fd_bo_new(screen->dev, 0x2000,
			DRM_FREEDRENO_GEM_TYPE_KMEM);

	fd4_ctx->fs_pvt_mem = fd_bo_new(screen->dev, 0x2000,
			DRM_FREEDRENO_GEM_TYPE_KMEM);

	fd4_ctx->vsc_size_mem = fd_bo_new(screen->dev, 0x1000,
			DRM_FREEDRENO_GEM_TYPE_KMEM);

	fd4_ctx->solid_vbuf = create_solid_vertexbuf(pctx);
	fd4_ctx->blit_texcoord_vbuf = create_blit_texcoord_vertexbuf(pctx);

	/* setup solid_vbuf_state: */
	fd4_ctx->solid_vbuf_state.vtx = pctx->create_vertex_elements_state(
			pctx, 1, (struct pipe_vertex_element[]){{
				.vertex_buffer_index = 0,
				.src_offset = 0,
				.src_format = PIPE_FORMAT_R32G32B32_FLOAT,
			}});
Example #3
0
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;
}
void
fd_context_setup_common_vbos(struct fd_context *ctx)
{
	struct pipe_context *pctx = &ctx->base;

	ctx->solid_vbuf = create_solid_vertexbuf(pctx);
	ctx->blit_texcoord_vbuf = create_blit_texcoord_vertexbuf(pctx);

	/* setup solid_vbuf_state: */
	ctx->solid_vbuf_state.vtx = pctx->create_vertex_elements_state(
			pctx, 1, (struct pipe_vertex_element[]){{
				.vertex_buffer_index = 0,
				.src_offset = 0,
				.src_format = PIPE_FORMAT_R32G32B32_FLOAT,
			}});
Example #5
0
struct pipe_context *
fd3_context_create(struct pipe_screen *pscreen, void *priv)
{
	struct fd_screen *screen = fd_screen(pscreen);
	struct fd3_context *fd3_ctx = CALLOC_STRUCT(fd3_context);
	struct pipe_context *pctx;

	if (!fd3_ctx)
		return NULL;

	pctx = &fd3_ctx->base.base;

	fd3_ctx->base.dev = fd_device_ref(screen->dev);
	fd3_ctx->base.screen = fd_screen(pscreen);

	pctx->destroy = fd3_context_destroy;
	pctx->create_blend_state = fd3_blend_state_create;
	pctx->create_rasterizer_state = fd3_rasterizer_state_create;
	pctx->create_depth_stencil_alpha_state = fd3_zsa_state_create;

	fd3_draw_init(pctx);
	fd3_gmem_init(pctx);
	fd3_texture_init(pctx);
	fd3_prog_init(pctx);

	pctx = fd_context_init(&fd3_ctx->base, pscreen, primtypes, priv);
	if (!pctx)
		return NULL;

	util_dynarray_init(&fd3_ctx->rbrc_patches);

	fd3_ctx->vs_pvt_mem = fd_bo_new(screen->dev, 0x2000,
			DRM_FREEDRENO_GEM_TYPE_KMEM);

	fd3_ctx->fs_pvt_mem = fd_bo_new(screen->dev, 0x2000,
			DRM_FREEDRENO_GEM_TYPE_KMEM);

	fd3_ctx->vsc_size_mem = fd_bo_new(screen->dev, 0x1000,
			DRM_FREEDRENO_GEM_TYPE_KMEM);

	fd3_ctx->solid_vbuf = create_solid_vertexbuf(pctx);
	fd3_ctx->blit_texcoord_vbuf = create_blit_texcoord_vertexbuf(pctx);

	return pctx;
}
Example #6
0
struct pipe_context *
fd2_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags)
{
	struct fd_screen *screen = fd_screen(pscreen);
	struct fd2_context *fd2_ctx = CALLOC_STRUCT(fd2_context);
	struct pipe_context *pctx;

	if (!fd2_ctx)
		return NULL;

	pctx = &fd2_ctx->base.base;
	pctx->screen = pscreen;

	fd2_ctx->base.dev = fd_device_ref(screen->dev);
	fd2_ctx->base.screen = fd_screen(pscreen);

	pctx->destroy = fd2_context_destroy;
	pctx->create_blend_state = fd2_blend_state_create;
	pctx->create_rasterizer_state = fd2_rasterizer_state_create;
	pctx->create_depth_stencil_alpha_state = fd2_zsa_state_create;

	fd2_draw_init(pctx);
	fd2_gmem_init(pctx);
	fd2_texture_init(pctx);
	fd2_prog_init(pctx);
	fd2_emit_init(pctx);

	pctx = fd_context_init(&fd2_ctx->base, pscreen,
			(screen->gpu_id >= 220) ? a22x_primtypes : a20x_primtypes,
			priv, flags);
	if (!pctx)
		return NULL;

	/* construct vertex state used for solid ops (clear, and gmem<->mem) */
	fd2_ctx->solid_vertexbuf = create_solid_vertexbuf(pctx);

	fd2_query_context_init(pctx);

	return pctx;
}