summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/r600/r600_blit.c
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2013-09-22 21:45:23 +0200
committerMarek Olšák <[email protected]>2013-09-29 15:18:09 +0200
commit68f6dec32ed5eede361f76c8dbdf897652659baf (patch)
treecb05d89cd004f259765188c76ed151d4f77eb615 /src/gallium/drivers/r600/r600_blit.c
parent0cb9de1dd078395d541c32c0de81ea4f05147baa (diff)
r600g: move aux_context and r600_screen_clear_buffer to drivers/radeon
This will be used in the next commit.
Diffstat (limited to 'src/gallium/drivers/r600/r600_blit.c')
-rw-r--r--src/gallium/drivers/r600/r600_blit.c30
1 files changed, 10 insertions, 20 deletions
diff --git a/src/gallium/drivers/r600/r600_blit.c b/src/gallium/drivers/r600/r600_blit.c
index 4bb9bf5e09e..d240c292f12 100644
--- a/src/gallium/drivers/r600/r600_blit.c
+++ b/src/gallium/drivers/r600/r600_blit.c
@@ -413,7 +413,7 @@ static boolean is_simple_msaa_resolve(const struct pipe_blit_info *info)
}
static void r600_clear_buffer(struct pipe_context *ctx, struct pipe_resource *dst,
- unsigned offset, unsigned size, unsigned char value);
+ unsigned offset, unsigned size, unsigned value);
static void evergreen_set_clear_color(struct pipe_surface *cbuf,
const union pipe_color_union *color)
@@ -627,21 +627,17 @@ void r600_copy_buffer(struct pipe_context *ctx, struct pipe_resource *dst, unsig
}
static void r600_clear_buffer(struct pipe_context *ctx, struct pipe_resource *dst,
- unsigned offset, unsigned size, unsigned char value)
+ unsigned offset, unsigned size, unsigned value)
{
struct r600_context *rctx = (struct r600_context*)ctx;
- uint32_t v = value;
if (rctx->screen->has_cp_dma &&
rctx->b.chip_class >= EVERGREEN &&
offset % 4 == 0 && size % 4 == 0) {
- uint32_t clear_value = v | (v << 8) | (v << 16) | (v << 24);
-
- evergreen_cp_dma_clear_buffer(rctx, dst, offset, size, clear_value);
+ evergreen_cp_dma_clear_buffer(rctx, dst, offset, size, value);
} else if (rctx->screen->has_streamout && offset % 4 == 0 && size % 4 == 0) {
union pipe_color_union clear_value;
-
- clear_value.ui[0] = v | (v << 8) | (v << 16) | (v << 24);
+ clear_value.ui[0] = value;
r600_flag_resource_cache_flush(rctx, dst);
@@ -653,21 +649,14 @@ static void r600_clear_buffer(struct pipe_context *ctx, struct pipe_resource *ds
/* Flush again in case the 3D engine has been prefetching the resource. */
r600_flag_resource_cache_flush(rctx, dst);
} else {
- char *map = r600_buffer_mmap_sync_with_rings(rctx, r600_resource(dst),
- PIPE_TRANSFER_WRITE);
- memset(map + offset, value, size);
+ uint32_t *map = r600_buffer_mmap_sync_with_rings(rctx, r600_resource(dst),
+ PIPE_TRANSFER_WRITE);
+ size /= 4;
+ for (unsigned i = 0; i < size; i++)
+ *map++ = value;
}
}
-void r600_screen_clear_buffer(struct r600_screen *rscreen, struct pipe_resource *dst,
- unsigned offset, unsigned size, unsigned char value)
-{
- pipe_mutex_lock(rscreen->aux_context_lock);
- r600_clear_buffer(rscreen->aux_context, dst, offset, size, value);
- rscreen->aux_context->flush(rscreen->aux_context, NULL, 0);
- pipe_mutex_unlock(rscreen->aux_context_lock);
-}
-
static bool util_format_is_subsampled_2x1_32bpp(enum pipe_format format)
{
const struct util_format_description *desc = util_format_description(format);
@@ -965,4 +954,5 @@ void r600_init_blit_functions(struct r600_context *rctx)
rctx->b.b.resource_copy_region = r600_resource_copy_region;
rctx->b.b.blit = r600_blit;
rctx->b.b.flush_resource = r600_flush_resource;
+ rctx->b.clear_buffer = r600_clear_buffer;
}