From 9855477e903e00f7457adb15594048416444b992 Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Sun, 9 Feb 2014 23:25:06 +0100 Subject: r600g,radeonsi: consolidate create_surface and surface_destroy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Michel Dänzer --- src/gallium/drivers/radeonsi/si_blit.c | 5 ++++- src/gallium/drivers/radeonsi/si_state.c | 37 --------------------------------- 2 files changed, 4 insertions(+), 38 deletions(-) (limited to 'src/gallium/drivers/radeonsi') diff --git a/src/gallium/drivers/radeonsi/si_blit.c b/src/gallium/drivers/radeonsi/si_blit.c index 07396e79a1e..9975b4417f2 100644 --- a/src/gallium/drivers/radeonsi/si_blit.c +++ b/src/gallium/drivers/radeonsi/si_blit.c @@ -483,6 +483,7 @@ static void si_resource_copy_region(struct pipe_context *ctx, const struct pipe_box *src_box) { struct si_context *sctx = (struct si_context *)ctx; + struct r600_texture *rdst = (struct r600_texture*)dst; struct pipe_surface *dst_view, dst_templ; struct pipe_sampler_view src_templ, *src_view; struct texture_orig_info orig_info[2]; @@ -566,7 +567,9 @@ static void si_resource_copy_region(struct pipe_context *ctx, /* Initialize the surface. */ util_blitter_default_dst_texture(&dst_templ, dst, dst_level, dstz); - dst_view = ctx->create_surface(ctx, dst, &dst_templ); + dst_view = r600_create_surface_custom(ctx, dst, &dst_templ, + rdst->surface.level[dst_level].npix_x, + rdst->surface.level[dst_level].npix_y); /* Initialize the sampler view. */ util_blitter_default_src_texture(&src_templ, src, src_level); diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c index 6642c7be9c6..00b0e64e33d 100644 --- a/src/gallium/drivers/radeonsi/si_state.c +++ b/src/gallium/drivers/radeonsi/si_state.c @@ -3100,41 +3100,6 @@ static void *si_create_blend_custom(struct si_context *sctx, unsigned mode) return si_create_blend_state_mode(&sctx->b.b, &blend, mode); } -static struct pipe_surface *r600_create_surface(struct pipe_context *pipe, - struct pipe_resource *texture, - const struct pipe_surface *surf_tmpl) -{ - struct r600_texture *rtex = (struct r600_texture*)texture; - struct r600_surface *surface = CALLOC_STRUCT(r600_surface); - unsigned level = surf_tmpl->u.tex.level; - - if (surface == NULL) - return NULL; - - assert(surf_tmpl->u.tex.first_layer <= util_max_layer(texture, surf_tmpl->u.tex.level)); - assert(surf_tmpl->u.tex.last_layer <= util_max_layer(texture, surf_tmpl->u.tex.level)); - - pipe_reference_init(&surface->base.reference, 1); - pipe_resource_reference(&surface->base.texture, texture); - surface->base.context = pipe; - surface->base.format = surf_tmpl->format; - surface->base.width = rtex->surface.level[level].npix_x; - surface->base.height = rtex->surface.level[level].npix_y; - surface->base.texture = texture; - surface->base.u.tex.first_layer = surf_tmpl->u.tex.first_layer; - surface->base.u.tex.last_layer = surf_tmpl->u.tex.last_layer; - surface->base.u.tex.level = level; - - return &surface->base; -} - -static void r600_surface_destroy(struct pipe_context *pipe, - struct pipe_surface *surface) -{ - pipe_resource_reference(&surface->texture, NULL); - FREE(surface); -} - static boolean si_dma_copy(struct pipe_context *ctx, struct pipe_resource *dst, unsigned dst_level, @@ -3224,8 +3189,6 @@ void si_init_state_functions(struct si_context *sctx) sctx->b.b.texture_barrier = si_texture_barrier; sctx->b.b.set_polygon_stipple = si_set_polygon_stipple; - sctx->b.b.create_surface = r600_create_surface; - sctx->b.b.surface_destroy = r600_surface_destroy; sctx->b.dma_copy = si_dma_copy; sctx->b.set_occlusion_query_state = si_set_occlusion_query_state; sctx->b.need_gfx_cs_space = si_need_gfx_cs_space; -- cgit v1.2.3