diff options
Diffstat (limited to 'src/gallium/drivers/radeon')
-rw-r--r-- | src/gallium/drivers/radeon/r600_pipe_common.c | 19 | ||||
-rw-r--r-- | src/gallium/drivers/radeon/r600_pipe_common.h | 6 | ||||
-rw-r--r-- | src/gallium/drivers/radeon/r600_texture.c | 18 |
3 files changed, 34 insertions, 9 deletions
diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c index ad6dd253a1d..031f858dfe6 100644 --- a/src/gallium/drivers/radeon/r600_pipe_common.c +++ b/src/gallium/drivers/radeon/r600_pipe_common.c @@ -191,6 +191,16 @@ static bool r600_init_tiling(struct r600_common_screen *rscreen) } } +struct pipe_resource *r600_resource_create_common(struct pipe_screen *screen, + const struct pipe_resource *templ) +{ + if (templ->target == PIPE_BUFFER) { + return r600_buffer_create(screen, templ, 4096); + } else { + return r600_texture_create(screen, templ); + } +} + bool r600_common_screen_init(struct r600_common_screen *rscreen, struct radeon_winsys *ws) { @@ -199,6 +209,10 @@ bool r600_common_screen_init(struct r600_common_screen *rscreen, rscreen->b.fence_finish = r600_fence_finish; rscreen->b.fence_reference = r600_fence_reference; rscreen->b.fence_signalled = r600_fence_signalled; + rscreen->b.resource_create = r600_resource_create_common; + rscreen->b.resource_destroy = u_resource_destroy_vtbl; + + r600_init_texture_functions(rscreen); rscreen->ws = ws; rscreen->family = rscreen->info.family; @@ -234,6 +248,11 @@ bool r600_common_context_init(struct r600_common_context *rctx, rctx->chip_class = rscreen->chip_class; rctx->max_db = rscreen->chip_class >= EVERGREEN ? 8 : 4; + rctx->b.transfer_map = u_transfer_map_vtbl; + rctx->b.transfer_flush_region = u_default_transfer_flush_region; + rctx->b.transfer_unmap = u_transfer_unmap_vtbl; + rctx->b.transfer_inline_write = u_default_transfer_inline_write; + r600_streamout_init(rctx); r600_query_init(rctx); diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h b/src/gallium/drivers/radeon/r600_pipe_common.h index 48674c6e625..5496a12f2c1 100644 --- a/src/gallium/drivers/radeon/r600_pipe_common.h +++ b/src/gallium/drivers/radeon/r600_pipe_common.h @@ -333,6 +333,8 @@ bool r600_can_dump_shader(struct r600_common_screen *rscreen, const struct tgsi_token *tokens); void r600_screen_clear_buffer(struct r600_common_screen *rscreen, struct pipe_resource *dst, unsigned offset, unsigned size, unsigned value); +struct pipe_resource *r600_resource_create_common(struct pipe_screen *screen, + const struct pipe_resource *templ); /* r600_query.c */ void r600_query_init(struct r600_common_context *rctx); @@ -364,9 +366,7 @@ bool r600_init_flushed_depth_texture(struct pipe_context *ctx, struct r600_texture **staging); struct pipe_resource *r600_texture_create(struct pipe_screen *screen, const struct pipe_resource *templ); -struct pipe_resource *r600_texture_from_handle(struct pipe_screen *screen, - const struct pipe_resource *base, - struct winsys_handle *whandle); +void r600_init_texture_functions(struct r600_common_screen *rscreen); /* Inline helpers. */ diff --git a/src/gallium/drivers/radeon/r600_texture.c b/src/gallium/drivers/radeon/r600_texture.c index caf3743e72f..878b26f2093 100644 --- a/src/gallium/drivers/radeon/r600_texture.c +++ b/src/gallium/drivers/radeon/r600_texture.c @@ -236,8 +236,8 @@ static int r600_setup_surface(struct pipe_screen *screen, } static boolean r600_texture_get_handle(struct pipe_screen* screen, - struct pipe_resource *ptex, - struct winsys_handle *whandle) + struct pipe_resource *ptex, + struct winsys_handle *whandle) { struct r600_texture *rtex = (struct r600_texture*)ptex; struct r600_resource *resource = &rtex->resource; @@ -763,9 +763,9 @@ struct pipe_resource *r600_texture_create(struct pipe_screen *screen, 0, NULL, &surface); } -struct pipe_resource *r600_texture_from_handle(struct pipe_screen *screen, - const struct pipe_resource *templ, - struct winsys_handle *whandle) +static struct pipe_resource *r600_texture_from_handle(struct pipe_screen *screen, + const struct pipe_resource *templ, + struct winsys_handle *whandle) { struct r600_common_screen *rscreen = (struct r600_common_screen*)screen; struct pb_buffer *buf = NULL; @@ -1071,10 +1071,16 @@ static void r600_texture_transfer_unmap(struct pipe_context *ctx, static const struct u_resource_vtbl r600_texture_vtbl = { - r600_texture_get_handle, /* get_handle */ + NULL, /* get_handle */ r600_texture_destroy, /* resource_destroy */ r600_texture_transfer_map, /* transfer_map */ NULL, /* transfer_flush_region */ r600_texture_transfer_unmap, /* transfer_unmap */ NULL /* transfer_inline_write */ }; + +void r600_init_texture_functions(struct r600_common_screen *rscreen) +{ + rscreen->b.resource_from_handle = r600_texture_from_handle; + rscreen->b.resource_get_handle = r600_texture_get_handle; +} |