From acf55e73252e46fa51378ef4b23c94a89902ae1c Mon Sep 17 00:00:00 2001 From: Niels Ole Salscheider Date: Mon, 17 Mar 2014 18:48:05 +0100 Subject: radeon: Move r600_need_dma_space to common code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Niels Ole Salscheider Signed-off-by: Marek Olšák --- src/gallium/drivers/r600/evergreen_hw_context.c | 2 +- src/gallium/drivers/r600/evergreen_state.c | 2 +- src/gallium/drivers/r600/r600_hw_context.c | 12 +----------- src/gallium/drivers/r600/r600_pipe.h | 1 - src/gallium/drivers/r600/r600_state.c | 2 +- src/gallium/drivers/radeon/r600_pipe_common.c | 10 ++++++++++ src/gallium/drivers/radeon/r600_pipe_common.h | 1 + 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/gallium/drivers/r600/evergreen_hw_context.c b/src/gallium/drivers/r600/evergreen_hw_context.c index 083b6978c5e..a4338764eed 100644 --- a/src/gallium/drivers/r600/evergreen_hw_context.c +++ b/src/gallium/drivers/r600/evergreen_hw_context.c @@ -62,7 +62,7 @@ void evergreen_dma_copy(struct r600_context *rctx, } ncopy = (size / 0x000fffff) + !!(size % 0x000fffff); - r600_need_dma_space(rctx, ncopy * 5); + r600_need_dma_space(&rctx->b, ncopy * 5); for (i = 0; i < ncopy; i++) { csize = size < 0x000fffff ? size : 0x000fffff; /* emit reloc before writting cs so that cs is always in consistent state */ diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 05cc3ef4cc2..b929f178351 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -3295,7 +3295,7 @@ static void evergreen_dma_copy_tile(struct r600_context *rctx, size = (copy_height * pitch) >> 2; ncopy = (size / 0x000fffff) + !!(size % 0x000fffff); - r600_need_dma_space(rctx, ncopy * 9); + r600_need_dma_space(&rctx->b, ncopy * 9); for (i = 0; i < ncopy; i++) { cheight = copy_height; diff --git a/src/gallium/drivers/r600/r600_hw_context.c b/src/gallium/drivers/r600/r600_hw_context.c index 3a3b3d58c15..75723be598f 100644 --- a/src/gallium/drivers/r600/r600_hw_context.c +++ b/src/gallium/drivers/r600/r600_hw_context.c @@ -440,16 +440,6 @@ void r600_cp_dma_copy_buffer(struct r600_context *rctx, R600_CONTEXT_INV_TEX_CACHE; } -void r600_need_dma_space(struct r600_context *ctx, unsigned num_dw) -{ - /* The number of dwords we already used in the DMA so far. */ - num_dw += ctx->b.rings.dma.cs->cdw; - /* Flush if there's not enough space. */ - if (num_dw > RADEON_MAX_CMDBUF_DWORDS) { - ctx->b.rings.dma.flush(ctx, RADEON_FLUSH_ASYNC); - } -} - void r600_dma_copy(struct r600_context *rctx, struct pipe_resource *dst, struct pipe_resource *src, @@ -475,7 +465,7 @@ void r600_dma_copy(struct r600_context *rctx, shift = 2; ncopy = (size / 0xffff) + !!(size % 0xffff); - r600_need_dma_space(rctx, ncopy * 5); + r600_need_dma_space(&rctx->b, ncopy * 5); for (i = 0; i < ncopy; i++) { csize = size < 0xffff ? size : 0xffff; /* emit reloc before writting cs so that cs is always in consistent state */ diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h index a3827e3ceea..0472eaa7d04 100644 --- a/src/gallium/drivers/r600/r600_pipe.h +++ b/src/gallium/drivers/r600/r600_pipe.h @@ -586,7 +586,6 @@ void r600_context_flush(struct r600_context *ctx, unsigned flags); void r600_begin_new_cs(struct r600_context *ctx); void r600_flush_emit(struct r600_context *ctx); void r600_need_cs_space(struct r600_context *ctx, unsigned num_dw, boolean count_draw_in); -void r600_need_dma_space(struct r600_context *ctx, unsigned num_dw); void r600_cp_dma_copy_buffer(struct r600_context *rctx, struct pipe_resource *dst, uint64_t dst_offset, struct pipe_resource *src, uint64_t src_offset, diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index 39e38f4dd0d..6c8222b90af 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -2856,7 +2856,7 @@ static boolean r600_dma_copy_tile(struct r600_context *rctx, */ cheight = ((0x0000ffff << 2) / pitch) & 0xfffffff8; ncopy = (copy_height / cheight) + !!(copy_height % cheight); - r600_need_dma_space(rctx, ncopy * 7); + r600_need_dma_space(&rctx->b, ncopy * 7); for (i = 0; i < ncopy; i++) { cheight = cheight > copy_height ? copy_height : cheight; diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c index 05ada1c4bb4..a5c140ab6aa 100644 --- a/src/gallium/drivers/radeon/r600_pipe_common.c +++ b/src/gallium/drivers/radeon/r600_pipe_common.c @@ -39,6 +39,16 @@ * pipe_context */ +void r600_need_dma_space(struct r600_common_context *ctx, unsigned num_dw) +{ + /* The number of dwords we already used in the DMA so far. */ + num_dw += ctx->rings.dma.cs->cdw; + /* Flush if there's not enough space. */ + if (num_dw > RADEON_MAX_CMDBUF_DWORDS) { + ctx->rings.dma.flush(ctx, RADEON_FLUSH_ASYNC); + } +} + static void r600_memory_barrier(struct pipe_context *ctx, unsigned flags) { } diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h b/src/gallium/drivers/radeon/r600_pipe_common.h index 92883a05e6a..1815ff6003a 100644 --- a/src/gallium/drivers/radeon/r600_pipe_common.h +++ b/src/gallium/drivers/radeon/r600_pipe_common.h @@ -409,6 +409,7 @@ void r600_screen_clear_buffer(struct r600_common_screen *rscreen, struct pipe_re struct pipe_resource *r600_resource_create_common(struct pipe_screen *screen, const struct pipe_resource *templ); const char *r600_get_llvm_processor_name(enum radeon_family family); +void r600_need_dma_space(struct r600_common_context *ctx, unsigned num_dw); /* r600_query.c */ void r600_query_init(struct r600_common_context *rctx); -- cgit v1.2.3