diff options
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/drivers/r600/evergreen_state.c | 16 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_pipe.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_pipe.h | 23 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_state.c | 16 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_texture.c | 12 | ||||
-rw-r--r-- | src/gallium/drivers/radeon/r600_pipe_common.h | 10 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/r600_texture.c | 20 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_state.c | 13 |
8 files changed, 61 insertions, 51 deletions
diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index ca835e3af1b..754c265c8c5 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -3739,13 +3739,13 @@ static void evergreen_dma_copy_tile(struct r600_context *rctx, } } -boolean evergreen_dma_blit(struct pipe_context *ctx, - struct pipe_resource *dst, - unsigned dst_level, - unsigned dst_x, unsigned dst_y, unsigned dst_z, - struct pipe_resource *src, - unsigned src_level, - const struct pipe_box *src_box) +static boolean evergreen_dma_blit(struct pipe_context *ctx, + struct pipe_resource *dst, + unsigned dst_level, + unsigned dst_x, unsigned dst_y, unsigned dst_z, + struct pipe_resource *src, + unsigned src_level, + const struct pipe_box *src_box) { struct r600_context *rctx = (struct r600_context *)ctx; struct r600_texture *rsrc = (struct r600_texture*)src; @@ -3904,5 +3904,7 @@ void evergreen_init_state_functions(struct r600_context *rctx) rctx->b.b.get_sample_position = evergreen_get_sample_position; else rctx->b.b.get_sample_position = cayman_get_sample_position; + rctx->b.dma_copy = evergreen_dma_blit; + evergreen_init_compute_state_functions(rctx); } diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c index dfe78b93a71..d9f2ed2dc01 100644 --- a/src/gallium/drivers/r600/r600_pipe.c +++ b/src/gallium/drivers/r600/r600_pipe.c @@ -1290,10 +1290,8 @@ struct pipe_screen *r600_screen_create(struct radeon_winsys *ws) if (rscreen->b.chip_class >= EVERGREEN) { rscreen->b.b.is_format_supported = evergreen_is_format_supported; - rscreen->dma_blit = &evergreen_dma_blit; } else { rscreen->b.b.is_format_supported = r600_is_format_supported; - rscreen->dma_blit = &r600_dma_blit; } rscreen->b.b.context_create = r600_create_context; rscreen->b.b.fence_reference = r600_fence_reference; diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h index fc138605e8c..f41c0b58088 100644 --- a/src/gallium/drivers/r600/r600_pipe.h +++ b/src/gallium/drivers/r600/r600_pipe.h @@ -201,14 +201,6 @@ struct r600_pipe_fences { pipe_mutex mutex; }; -typedef boolean (*r600g_dma_blit_t)(struct pipe_context *ctx, - struct pipe_resource *dst, - unsigned dst_level, - unsigned dst_x, unsigned dst_y, unsigned dst_z, - struct pipe_resource *src, - unsigned src_level, - const struct pipe_box *src_box); - /* logging */ #define DBG_TEX_DEPTH (1 << 0) #define DBG_COMPUTE (1 << 1) @@ -260,7 +252,6 @@ struct r600_screen { struct r600_resource *trace_bo; uint32_t *trace_ptr; unsigned cs_count; - r600g_dma_blit_t dma_blit; /* Auxiliary context. Mainly used to initialize resources. * It must be locked prior to using and flushed before unlocking. */ @@ -739,13 +730,6 @@ void r600_dma_copy(struct r600_context *rctx, uint64_t dst_offset, uint64_t src_offset, uint64_t size); -boolean r600_dma_blit(struct pipe_context *ctx, - struct pipe_resource *dst, - unsigned dst_level, - unsigned dst_x, unsigned dst_y, unsigned dst_z, - struct pipe_resource *src, - unsigned src_level, - const struct pipe_box *src_box); void r600_flag_resource_cache_flush(struct r600_context *rctx, struct pipe_resource *res); @@ -758,13 +742,6 @@ void evergreen_dma_copy(struct r600_context *rctx, uint64_t dst_offset, uint64_t src_offset, uint64_t size); -boolean evergreen_dma_blit(struct pipe_context *ctx, - struct pipe_resource *dst, - unsigned dst_level, - unsigned dst_x, unsigned dst_y, unsigned dst_z, - struct pipe_resource *src, - unsigned src_level, - const struct pipe_box *src_box); /* r600_state_common.c */ void r600_init_common_state_functions(struct r600_context *rctx); diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index 5411f743a63..36ceb8336e2 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -3119,13 +3119,13 @@ static boolean r600_dma_copy_tile(struct r600_context *rctx, return TRUE; } -boolean r600_dma_blit(struct pipe_context *ctx, - struct pipe_resource *dst, - unsigned dst_level, - unsigned dst_x, unsigned dst_y, unsigned dst_z, - struct pipe_resource *src, - unsigned src_level, - const struct pipe_box *src_box) +static boolean r600_dma_blit(struct pipe_context *ctx, + struct pipe_resource *dst, + unsigned dst_level, + unsigned dst_x, unsigned dst_y, unsigned dst_z, + struct pipe_resource *src, + unsigned src_level, + const struct pipe_box *src_box) { struct r600_context *rctx = (struct r600_context *)ctx; struct r600_texture *rsrc = (struct r600_texture*)src; @@ -3263,7 +3263,7 @@ void r600_init_state_functions(struct r600_context *rctx) rctx->b.b.set_framebuffer_state = r600_set_framebuffer_state; rctx->b.b.set_polygon_stipple = r600_set_polygon_stipple; rctx->b.b.set_scissor_states = r600_set_scissor_states; - rctx->b.b.get_sample_position = r600_get_sample_position; + rctx->b.dma_copy = r600_dma_blit; } /* this function must be last */ diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c index a86e4c91be8..508340826e7 100644 --- a/src/gallium/drivers/r600/r600_texture.c +++ b/src/gallium/drivers/r600/r600_texture.c @@ -81,9 +81,9 @@ static void r600_copy_to_staging_texture(struct pipe_context *ctx, struct r600_t return; } - if (!rctx->screen->dma_blit(ctx, dst, 0, 0, 0, 0, - src, transfer->level, - &transfer->box)) { + if (!rctx->b.dma_copy(ctx, dst, 0, 0, 0, 0, + src, transfer->level, + &transfer->box)) { ctx->resource_copy_region(ctx, dst, 0, 0, 0, 0, src, transfer->level, &transfer->box); } @@ -107,9 +107,9 @@ static void r600_copy_from_staging_texture(struct pipe_context *ctx, struct r600 return; } - if (!rctx->screen->dma_blit(ctx, dst, transfer->level, - transfer->box.x, transfer->box.y, transfer->box.z, - src, 0, &sbox)) { + if (!rctx->b.dma_copy(ctx, dst, transfer->level, + transfer->box.x, transfer->box.y, transfer->box.z, + src, 0, &sbox)) { ctx->resource_copy_region(ctx, dst, transfer->level, transfer->box.x, transfer->box.y, transfer->box.z, src, 0, &sbox); diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h b/src/gallium/drivers/radeon/r600_pipe_common.h index 63439655fd2..d83876df824 100644 --- a/src/gallium/drivers/radeon/r600_pipe_common.h +++ b/src/gallium/drivers/radeon/r600_pipe_common.h @@ -203,6 +203,16 @@ struct r600_common_context { /* Additional context states. */ unsigned flags; /* flush flags */ + + /* Copy one resource to another using async DMA. + * False is returned if the copy couldn't be done. */ + boolean (*dma_copy)(struct pipe_context *ctx, + struct pipe_resource *dst, + unsigned dst_level, + unsigned dst_x, unsigned dst_y, unsigned dst_z, + struct pipe_resource *src, + unsigned src_level, + const struct pipe_box *src_box); }; /* r600_common_pipe.c */ diff --git a/src/gallium/drivers/radeonsi/r600_texture.c b/src/gallium/drivers/radeonsi/r600_texture.c index 9a2f7101850..69ca892b5f8 100644 --- a/src/gallium/drivers/radeonsi/r600_texture.c +++ b/src/gallium/drivers/radeonsi/r600_texture.c @@ -73,6 +73,7 @@ static void r600_copy_region_with_blit(struct pipe_context *pipe, /* Copy from a full GPU texture to a transfer's staging one. */ static void r600_copy_to_staging_texture(struct pipe_context *ctx, struct r600_transfer *rtransfer) { + struct r600_context *rctx = (struct r600_context*)ctx; struct pipe_transfer *transfer = (struct pipe_transfer*)rtransfer; struct pipe_resource *dst = &rtransfer->staging->b.b; struct pipe_resource *src = transfer->resource; @@ -83,13 +84,18 @@ static void r600_copy_to_staging_texture(struct pipe_context *ctx, struct r600_t return; } - ctx->resource_copy_region(ctx, dst, 0, 0, 0, 0, - src, transfer->level, &transfer->box); + if (!rctx->b.dma_copy(ctx, dst, 0, 0, 0, 0, + src, transfer->level, + &transfer->box)) { + ctx->resource_copy_region(ctx, dst, 0, 0, 0, 0, + src, transfer->level, &transfer->box); + } } /* Copy from a transfer's staging texture to a full GPU one. */ static void r600_copy_from_staging_texture(struct pipe_context *ctx, struct r600_transfer *rtransfer) { + struct r600_context *rctx = (struct r600_context*)ctx; struct pipe_transfer *transfer = (struct pipe_transfer*)rtransfer; struct pipe_resource *dst = transfer->resource; struct pipe_resource *src = &rtransfer->staging->b.b; @@ -104,9 +110,13 @@ static void r600_copy_from_staging_texture(struct pipe_context *ctx, struct r600 return; } - ctx->resource_copy_region(ctx, dst, transfer->level, - transfer->box.x, transfer->box.y, transfer->box.z, - src, 0, &sbox); + if (!rctx->b.dma_copy(ctx, dst, transfer->level, + transfer->box.x, transfer->box.y, transfer->box.z, + src, 0, &sbox)) { + ctx->resource_copy_region(ctx, dst, transfer->level, + transfer->box.x, transfer->box.y, transfer->box.z, + src, 0, &sbox); + } } static unsigned r600_texture_get_offset(struct r600_texture *rtex, unsigned level, diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c index 400d947376d..5f60045f77d 100644 --- a/src/gallium/drivers/radeonsi/si_state.c +++ b/src/gallium/drivers/radeonsi/si_state.c @@ -2955,6 +2955,18 @@ static void r600_surface_destroy(struct pipe_context *pipe, FREE(surface); } +static boolean si_dma_copy(struct pipe_context *ctx, + struct pipe_resource *dst, + unsigned dst_level, + unsigned dst_x, unsigned dst_y, unsigned dst_z, + struct pipe_resource *src, + unsigned src_level, + const struct pipe_box *src_box) +{ + /* XXX implement this or share evergreen_dma_blit with r600g */ + return FALSE; +} + void si_init_state_functions(struct r600_context *rctx) { int i; @@ -3018,6 +3030,7 @@ void si_init_state_functions(struct r600_context *rctx) rctx->b.b.set_polygon_stipple = si_set_polygon_stipple; rctx->b.b.create_surface = r600_create_surface; rctx->b.b.surface_destroy = r600_surface_destroy; + rctx->b.dma_copy = si_dma_copy; rctx->b.b.draw_vbo = si_draw_vbo; } |