From a9ae7635b77fc4fd9f4614fead63fefa6ff74f4e Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Wed, 22 Jan 2014 00:58:12 +0100 Subject: r600g,radeonsi: consolidate the contents of r600_resource.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Michel Dänzer Reviewed-by: Tom Stellard --- src/gallium/drivers/r600/Makefile.sources | 1 - src/gallium/drivers/r600/r600_pipe.c | 13 +++++- src/gallium/drivers/r600/r600_pipe.h | 3 -- src/gallium/drivers/r600/r600_resource.c | 76 ------------------------------- src/gallium/drivers/r600/r600_resource.h | 3 -- 5 files changed, 11 insertions(+), 85 deletions(-) delete mode 100644 src/gallium/drivers/r600/r600_resource.c (limited to 'src/gallium/drivers/r600') diff --git a/src/gallium/drivers/r600/Makefile.sources b/src/gallium/drivers/r600/Makefile.sources index f04e156d086..82560fce423 100644 --- a/src/gallium/drivers/r600/Makefile.sources +++ b/src/gallium/drivers/r600/Makefile.sources @@ -4,7 +4,6 @@ C_SOURCES = \ r600_hw_context.c \ r600_isa.c \ r600_pipe.c \ - r600_resource.c \ r600_shader.c \ r600_state.c \ r700_asm.c \ diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c index e217be5abae..abc25b29efe 100644 --- a/src/gallium/drivers/r600/r600_pipe.c +++ b/src/gallium/drivers/r600/r600_pipe.c @@ -211,7 +211,6 @@ static struct pipe_context *r600_create_context(struct pipe_screen *screen, void rctx->keep_tiling_flags = rscreen->b.info.drm_minor >= 12; r600_init_blit_functions(rctx); - r600_init_context_resource_functions(rctx); if (rscreen->b.info.has_uvd) { rctx->b.b.create_video_codec = r600_uvd_create_decoder; @@ -826,6 +825,16 @@ static int r600_get_driver_query_info(struct pipe_screen *screen, return 1; } +static struct pipe_resource *r600_resource_create(struct pipe_screen *screen, + const struct pipe_resource *templ) +{ + if (templ->target == PIPE_BUFFER && + (templ->bind & PIPE_BIND_GLOBAL)) + return r600_compute_global_buffer_create(screen, templ); + + return r600_resource_create_common(screen, templ); +} + struct pipe_screen *r600_screen_create(struct radeon_winsys *ws) { struct r600_screen *rscreen = CALLOC_STRUCT(r600_screen); @@ -859,7 +868,7 @@ struct pipe_screen *r600_screen_create(struct radeon_winsys *ws) rscreen->b.b.get_video_param = r600_get_video_param; rscreen->b.b.is_video_format_supported = vl_video_buffer_is_format_supported; } - r600_init_screen_resource_functions(&rscreen->b.b); + rscreen->b.b.resource_create = r600_resource_create; if (!r600_common_screen_init(&rscreen->b, ws)) { FREE(rscreen); diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h index 85bebc3bbf8..101d7405ee1 100644 --- a/src/gallium/drivers/r600/r600_pipe.h +++ b/src/gallium/drivers/r600/r600_pipe.h @@ -535,9 +535,6 @@ void r600_decompress_color_textures(struct r600_context *rctx, /* r600_pipe.c */ const char * r600_llvm_gpu_string(enum radeon_family family); -/* r600_resource.c */ -void r600_init_context_resource_functions(struct r600_context *r600); - /* r600_shader.c */ int r600_pipe_shader_create(struct pipe_context *ctx, struct r600_pipe_shader *shader, diff --git a/src/gallium/drivers/r600/r600_resource.c b/src/gallium/drivers/r600/r600_resource.c deleted file mode 100644 index a8fa357b133..00000000000 --- a/src/gallium/drivers/r600/r600_resource.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright 2010 Marek Olšák target == PIPE_BUFFER) { - if (templ->bind & PIPE_BIND_GLOBAL) { - return r600_compute_global_buffer_create(screen, templ); - } - else { - return r600_buffer_create(screen, templ, 4096); - } - } else { - return r600_texture_create(screen, templ); - } -} - -static struct pipe_resource *r600_resource_from_handle(struct pipe_screen * screen, - const struct pipe_resource *templ, - struct winsys_handle *whandle) -{ - if (templ->target == PIPE_BUFFER) { - return NULL; - } else { - return r600_texture_from_handle(screen, templ, whandle); - } -} - -void r600_resource_destroy(struct pipe_screen *screen, struct pipe_resource *res) -{ - if (res->target == PIPE_BUFFER && (res->bind & PIPE_BIND_GLOBAL)) { - r600_compute_global_buffer_destroy(screen, res); - } else { - u_resource_destroy_vtbl(screen, res); - } -} - -void r600_init_screen_resource_functions(struct pipe_screen *screen) -{ - screen->resource_create = r600_resource_create; - screen->resource_from_handle = r600_resource_from_handle; - screen->resource_get_handle = u_resource_get_handle_vtbl; - screen->resource_destroy = r600_resource_destroy; -} - -void r600_init_context_resource_functions(struct r600_context *r600) -{ - r600->b.b.transfer_map = u_transfer_map_vtbl; - r600->b.b.transfer_flush_region = u_default_transfer_flush_region; - r600->b.b.transfer_unmap = u_transfer_unmap_vtbl; - r600->b.b.transfer_inline_write = u_default_transfer_inline_write; -} diff --git a/src/gallium/drivers/r600/r600_resource.h b/src/gallium/drivers/r600/r600_resource.h index 96fea9afe0e..db88c9a5f00 100644 --- a/src/gallium/drivers/r600/r600_resource.h +++ b/src/gallium/drivers/r600/r600_resource.h @@ -86,7 +86,4 @@ static INLINE bool r600_can_read_depth(struct r600_texture *rtex) rtex->resource.b.b.format == PIPE_FORMAT_Z32_FLOAT); } -void r600_resource_destroy(struct pipe_screen *screen, struct pipe_resource *res); -void r600_init_screen_resource_functions(struct pipe_screen *screen); - #endif -- cgit v1.2.3