diff options
author | Marek Olšák <[email protected]> | 2012-09-12 23:37:17 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2012-09-30 18:57:56 +0200 |
commit | 0b0697e80dd442d7e7cb23641ad8f58f82df120d (patch) | |
tree | 3f842d9000c8c26fc3812f08276846af4772b579 /src/gallium/drivers | |
parent | 84d2f2295e8274c1b3676b59fedfc173836d378e (diff) |
gallium/u_blitter: add gallium blit implementation
The original blit function is extended and the otAher functions reuse it.
Tested-by: Michel Dänzer <[email protected]>
Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r-- | src/gallium/drivers/i915/i915_surface.c | 4 | ||||
-rw-r--r-- | src/gallium/drivers/r300/r300_blit.c | 8 | ||||
-rw-r--r-- | src/gallium/drivers/r300/r300_context.h | 3 | ||||
-rw-r--r-- | src/gallium/drivers/r300/r300_render.c | 3 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_blit.c | 38 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_pipe.h | 2 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_state_common.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/r600_blit.c | 4 |
8 files changed, 28 insertions, 36 deletions
diff --git a/src/gallium/drivers/i915/i915_surface.c b/src/gallium/drivers/i915/i915_surface.c index 5f0783f0305..99837fe7658 100644 --- a/src/gallium/drivers/i915/i915_surface.c +++ b/src/gallium/drivers/i915/i915_surface.c @@ -86,8 +86,8 @@ i915_surface_copy_render(struct pipe_context *pipe, i915->saved_nr_sampler_views, i915->saved_sampler_views); - util_blitter_copy_texture(i915->blitter, dst, dst_level, ~0, dstx, dsty, dstz, - src, src_level, 0, src_box); + util_blitter_copy_texture(i915->blitter, dst, dst_level, dstx, dsty, dstz, + src, src_level, src_box, PIPE_MASK_RGBAZS, TRUE); } static void diff --git a/src/gallium/drivers/r300/r300_blit.c b/src/gallium/drivers/r300/r300_blit.c index f2c67c0a113..3e8217622c5 100644 --- a/src/gallium/drivers/r300/r300_blit.c +++ b/src/gallium/drivers/r300/r300_blit.c @@ -577,9 +577,11 @@ static void r300_resource_copy_region(struct pipe_context *pipe, src_view = r300_create_sampler_view_custom(pipe, src, &src_templ, src_width0, src_height0); r300_blitter_begin(r300, R300_COPY); - util_blitter_copy_texture_view(r300->blitter, dst_view, ~0, dstx, dsty, - src_view, 0, src_box, - src_width0, src_height0, PIPE_MASK_RGBAZS); + util_blitter_blit_generic(r300->blitter, dst_view, dstx, dsty, + abs(src_box->width), abs(src_box->height), + src_view, src_box, + src_width0, src_height0, PIPE_MASK_RGBAZS, + PIPE_TEX_FILTER_NEAREST, NULL, FALSE); r300_blitter_end(r300); pipe_surface_reference(&dst_view, NULL); diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h index fe253089094..7d3b12d45d8 100644 --- a/src/gallium/drivers/r300/r300_context.h +++ b/src/gallium/drivers/r300/r300_context.h @@ -722,8 +722,7 @@ void r300_plug_in_stencil_ref_fallback(struct r300_context *r300); void r300_draw_flush_vbuf(struct r300_context *r300); void r500_emit_index_bias(struct r300_context *r300, int index_bias); void r300_blitter_draw_rectangle(struct blitter_context *blitter, - unsigned x1, unsigned y1, - unsigned x2, unsigned y2, + int x1, int y1, int x2, int y2, float depth, enum blitter_attrib_type type, const union pipe_color_union *attrib); diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c index ceda1269707..e388260894c 100644 --- a/src/gallium/drivers/r300/r300_render.c +++ b/src/gallium/drivers/r300/r300_render.c @@ -1172,8 +1172,7 @@ void r300_draw_flush_vbuf(struct r300_context *r300) * would be computed and stored twice, which makes the clear/copy codepaths * somewhat inefficient. Instead we use a rectangular point sprite. */ void r300_blitter_draw_rectangle(struct blitter_context *blitter, - unsigned x1, unsigned y1, - unsigned x2, unsigned y2, + int x1, int y1, int x2, int y2, float depth, enum blitter_attrib_type type, const union pipe_color_union *attrib) diff --git a/src/gallium/drivers/r600/r600_blit.c b/src/gallium/drivers/r600/r600_blit.c index 3da583c5d09..536b2a19bde 100644 --- a/src/gallium/drivers/r600/r600_blit.c +++ b/src/gallium/drivers/r600/r600_blit.c @@ -379,10 +379,11 @@ static void r600_copy_first_sample(struct pipe_context *ctx, /* Copy the first sample into dst. */ r600_blitter_begin(ctx, R600_COPY_TEXTURE); - util_blitter_copy_texture_view(rctx->blitter, dst_view, ~0, info->dst.x0, - info->dst.y0, src_view, 0, &box, - info->src.res->width0, info->src.res->height0, - info->mask); + util_blitter_blit_generic(rctx->blitter, dst_view, info->dst.x0, + info->dst.y0, abs(box.width), abs(box.height), + src_view, &box, + info->src.res->width0, info->src.res->height0, + info->mask, PIPE_TEX_FILTER_NEAREST, NULL, FALSE); r600_blitter_end(ctx); pipe_surface_reference(&dst_view, NULL); @@ -460,8 +461,8 @@ static void r600_color_resolve(struct pipe_context *ctx, r600_blitter_begin(ctx, R600_COPY_TEXTURE); util_blitter_copy_texture(rctx->blitter, info->dst.res, info->dst.level, - ~0, info->dst.x0, info->dst.y0, info->dst.layer, - tmp, 0, 0, &box); + info->dst.x0, info->dst.y0, info->dst.layer, + tmp, 0, &box, PIPE_MASK_RGBAZS, FALSE); r600_blitter_end(ctx); pipe_resource_reference(&tmp, NULL); @@ -678,7 +679,6 @@ static void r600_resource_copy_region(struct pipe_context *ctx, struct pipe_box sbox; const struct pipe_box *psbox = src_box; boolean restore_orig[2]; - unsigned last_sample, i; memset(orig_info, 0, sizeof(orig_info)); @@ -689,7 +689,6 @@ static void r600_resource_copy_region(struct pipe_context *ctx, } assert(u_max_sample(dst) == u_max_sample(src)); - last_sample = u_max_sample(dst); /* The driver doesn't decompress resources automatically while * u_blitter is rendering. */ @@ -756,21 +755,14 @@ static void r600_resource_copy_region(struct pipe_context *ctx, restore_orig[1] = TRUE; } - /* XXX Properly implement multisample textures on Cayman. In the meantime, - * copy only the first sample (which is the only one that doesn't return garbage). */ - if (rctx->chip_class == CAYMAN) { - r600_blitter_begin(ctx, R600_COPY_TEXTURE); - util_blitter_copy_texture(rctx->blitter, dst, dst_level, ~0, dstx, dsty, dstz, - src, src_level, 0, psbox); - r600_blitter_end(ctx); - } else { - for (i = 0; i <= last_sample; i++) { - r600_blitter_begin(ctx, R600_COPY_TEXTURE); - util_blitter_copy_texture(rctx->blitter, dst, dst_level, 1 << i, dstx, dsty, dstz, - src, src_level, i, psbox); - r600_blitter_end(ctx); - } - } + /* XXX Multisample texturing is unimplemented on Cayman. In the meantime, + * copy only the first sample (which is the only one that is uncompressed + * and therefore doesn't return garbage). */ + r600_blitter_begin(ctx, R600_COPY_TEXTURE); + util_blitter_copy_texture(rctx->blitter, dst, dst_level, dstx, dsty, dstz, + src, src_level, psbox, PIPE_MASK_RGBAZS, + rctx->chip_class != CAYMAN); + r600_blitter_end(ctx); if (restore_orig[0]) r600_reset_blittable_to_orig(src, src_level, &orig_info[0]); diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h index e66766a9844..315253ac730 100644 --- a/src/gallium/drivers/r600/r600_pipe.h +++ b/src/gallium/drivers/r600/r600_pipe.h @@ -643,7 +643,7 @@ void r600_sampler_states_dirty(struct r600_context *rctx, void r600_set_max_scissor(struct r600_context *rctx); void r600_constant_buffers_dirty(struct r600_context *rctx, struct r600_constbuf_state *state); void r600_draw_rectangle(struct blitter_context *blitter, - unsigned x1, unsigned y1, unsigned x2, unsigned y2, float depth, + int x1, int y1, int x2, int y2, float depth, enum blitter_attrib_type type, const union pipe_color_union *attrib); uint32_t r600_translate_stencil_op(int s_op); uint32_t r600_translate_fill(uint32_t func); diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c index 95beaa1cc7e..b1a0f66d2ef 100644 --- a/src/gallium/drivers/r600/r600_state_common.c +++ b/src/gallium/drivers/r600/r600_state_common.c @@ -1343,7 +1343,7 @@ static void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info } void r600_draw_rectangle(struct blitter_context *blitter, - unsigned x1, unsigned y1, unsigned x2, unsigned y2, float depth, + int x1, int y1, int x2, int y2, float depth, enum blitter_attrib_type type, const union pipe_color_union *attrib) { struct r600_context *rctx = (struct r600_context*)util_blitter_get_pipe(blitter); diff --git a/src/gallium/drivers/radeonsi/r600_blit.c b/src/gallium/drivers/radeonsi/r600_blit.c index 4406204b512..e599deb8647 100644 --- a/src/gallium/drivers/radeonsi/r600_blit.c +++ b/src/gallium/drivers/radeonsi/r600_blit.c @@ -249,8 +249,8 @@ static void r600_hw_copy_region(struct pipe_context *ctx, struct r600_context *rctx = (struct r600_context *)ctx; r600_blitter_begin(ctx, R600_COPY); - util_blitter_copy_texture(rctx->blitter, dst, dst_level, ~0, dstx, dsty, dstz, - src, src_level, 0, src_box); + util_blitter_copy_texture(rctx->blitter, dst, dst_level, dstx, dsty, dstz, + src, src_level, src_box, PIPE_MASK_RGBAZS, TRUE); r600_blitter_end(ctx); } |