From 2993088500365405516663fa48b1764e8c8d1ffa Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Mon, 24 Dec 2018 00:27:09 -0800 Subject: [PATCH] iris: Export a copy_region helper that doesn't flush I'll want to use this for transfer maps, which already do their own flushing. This lets us avoid a double flush, and also gives us more control over the batch which is selected. --- src/gallium/drivers/iris/iris_blit.c | 56 ++++++++++++++++++------- src/gallium/drivers/iris/iris_context.h | 8 ++++ 2 files changed, 48 insertions(+), 16 deletions(-) diff --git a/src/gallium/drivers/iris/iris_blit.c b/src/gallium/drivers/iris/iris_blit.c index 6562c7b60ec..3fa2f07cabb 100644 --- a/src/gallium/drivers/iris/iris_blit.c +++ b/src/gallium/drivers/iris/iris_blit.c @@ -472,25 +472,27 @@ get_copy_region_aux_settings(const struct gen_device_info *devinfo, } /** - * The pipe->resource_copy_region() driver hook. + * Perform a GPU-based raw memory copy between compatible view classes. * - * This implements ARB_copy_image semantics - a raw memory copy between - * compatible view classes. + * Does not perform any flushing - the new data may still be left in the + * render cache, and old data may remain in other caches. + * + * Wraps blorp_copy() and blorp_buffer_copy(). */ -static void -iris_resource_copy_region(struct pipe_context *ctx, - struct pipe_resource *dst, - unsigned dst_level, - unsigned dstx, unsigned dsty, unsigned dstz, - struct pipe_resource *src, - unsigned src_level, - const struct pipe_box *src_box) +void +iris_copy_region(struct blorp_context *blorp, + struct iris_batch *batch, + struct pipe_resource *dst, + unsigned dst_level, + unsigned dstx, unsigned dsty, unsigned dstz, + struct pipe_resource *src, + unsigned src_level, + const struct pipe_box *src_box) { - struct iris_screen *screen = (void *) ctx->screen; - const struct gen_device_info *devinfo = &screen->devinfo; struct blorp_batch blorp_batch; - struct iris_context *ice = (void *) ctx; - struct iris_batch *batch = &ice->batches[IRIS_BATCH_RENDER]; + struct iris_context *ice = blorp->driver_ctx; + struct iris_screen *screen = (void *) ice->ctx.screen; + const struct gen_device_info *devinfo = &screen->devinfo; struct iris_resource *src_res = (void *) src; struct iris_resource *dst_res = (void *) dst; @@ -547,10 +549,32 @@ iris_resource_copy_region(struct pipe_context *ctx, iris_resource_finish_write(ice, dst_res, dst_level, dstz, src_box->depth, dst_aux_usage); - } } + +/** + * The pipe->resource_copy_region() driver hook. + * + * This implements ARB_copy_image semantics - a raw memory copy between + * compatible view classes. + */ +static void +iris_resource_copy_region(struct pipe_context *ctx, + struct pipe_resource *dst, + unsigned dst_level, + unsigned dstx, unsigned dsty, unsigned dstz, + struct pipe_resource *src, + unsigned src_level, + const struct pipe_box *src_box) +{ + struct iris_context *ice = (void *) ctx; + struct iris_batch *batch = &ice->batches[IRIS_BATCH_RENDER]; + + iris_copy_region(&ice->blorp, batch, dst, dst_level, dstx, dsty, dstz, + src, src_level, src_box); +} + void iris_init_blit_functions(struct pipe_context *ctx) { diff --git a/src/gallium/drivers/iris/iris_context.h b/src/gallium/drivers/iris/iris_context.h index 70a929178df..4a05a19c69e 100644 --- a/src/gallium/drivers/iris/iris_context.h +++ b/src/gallium/drivers/iris/iris_context.h @@ -666,6 +666,14 @@ void iris_blorp_surf_for_resource(struct iris_vtable *vtbl, enum isl_aux_usage aux_usage, unsigned level, bool is_render_target); +void iris_copy_region(struct blorp_context *blorp, + struct iris_batch *batch, + struct pipe_resource *dst, + unsigned dst_level, + unsigned dstx, unsigned dsty, unsigned dstz, + struct pipe_resource *src, + unsigned src_level, + const struct pipe_box *src_box); /* iris_draw.c */ -- 2.30.2