On Sun, May 8, 2016 at 6:11 PM, Nicolai Hähnle <nhaeh...@gmail.com> wrote: > On 04.05.2016 18:43, Marek Olšák wrote: >> >> From: Marek Olšák <marek.ol...@amd.com> >> >> this is more robust and probably fixes some bugs already >> --- >> src/gallium/drivers/r600/evergreen_state.c | 10 ++--- >> src/gallium/drivers/r600/r600_state.c | 5 ++- >> src/gallium/drivers/radeon/r600_pipe_common.h | 7 ++++ >> src/gallium/drivers/radeon/r600_texture.c | 55 >> +++++++++++++++++++++++++++ >> src/gallium/drivers/radeonsi/cik_sdma.c | 14 +------ >> src/gallium/drivers/radeonsi/si_dma.c | 13 ++----- >> 6 files changed, 73 insertions(+), 31 deletions(-) >> >> diff --git a/src/gallium/drivers/r600/evergreen_state.c >> b/src/gallium/drivers/r600/evergreen_state.c >> index 5224e42..672ddd4 100644 >> --- a/src/gallium/drivers/r600/evergreen_state.c >> +++ b/src/gallium/drivers/r600/evergreen_state.c >> @@ -3497,14 +3497,10 @@ static void evergreen_dma_copy(struct pipe_context >> *ctx, >> return; >> } >> >> - if (src->format != dst->format || src_box->depth > 1 || >> - (rdst->dirty_level_mask | rdst->stencil_dirty_level_mask) & (1 >> << dst_level)) { >> + if (src_box->depth > 1 || >> + !r600_prepare_for_dma_blit(&rctx->b, rdst, dst_level, dstx, >> dsty, >> + dstz, rsrc, src_level, src_box)) >> goto fallback; >> - } >> - >> - if (rsrc->dirty_level_mask & (1 << src_level)) { >> - ctx->flush_resource(ctx, src); >> - } >> >> src_x = util_format_get_nblocksx(src->format, src_box->x); >> dst_x = util_format_get_nblocksx(src->format, dst_x); >> diff --git a/src/gallium/drivers/r600/r600_state.c >> b/src/gallium/drivers/r600/r600_state.c >> index 2291096..48e3663 100644 >> --- a/src/gallium/drivers/r600/r600_state.c >> +++ b/src/gallium/drivers/r600/r600_state.c >> @@ -2972,9 +2972,10 @@ static void r600_dma_copy(struct pipe_context *ctx, >> return; >> } >> >> - if (src->format != dst->format || src_box->depth > 1) { >> + if (src_box->depth > 1 || >> + !r600_prepare_for_dma_blit(&rctx->b, rdst, dst_level, dstx, >> dsty, >> + dstz, rsrc, src_level, src_box)) >> goto fallback; >> - } >> >> src_x = util_format_get_nblocksx(src->format, src_box->x); >> dst_x = util_format_get_nblocksx(src->format, dst_x); >> diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h >> b/src/gallium/drivers/radeon/r600_pipe_common.h >> index 74eefbb..803c89c 100644 >> --- a/src/gallium/drivers/radeon/r600_pipe_common.h >> +++ b/src/gallium/drivers/radeon/r600_pipe_common.h >> @@ -623,6 +623,13 @@ void r600_update_prims_generated_query_state(struct >> r600_common_context *rctx, >> void r600_streamout_init(struct r600_common_context *rctx); >> >> /* r600_texture.c */ >> +bool r600_prepare_for_dma_blit(struct r600_common_context *rctx, >> + struct r600_texture *rdst, >> + unsigned dst_level, unsigned dstx, >> + unsigned dsty, unsigned dstz, >> + struct r600_texture *rsrc, >> + unsigned src_level, >> + const struct pipe_box *src_box); >> void r600_texture_get_fmask_info(struct r600_common_screen *rscreen, >> struct r600_texture *rtex, >> unsigned nr_samples, >> diff --git a/src/gallium/drivers/radeon/r600_texture.c >> b/src/gallium/drivers/radeon/r600_texture.c >> index ac11380..0dba045 100644 >> --- a/src/gallium/drivers/radeon/r600_texture.c >> +++ b/src/gallium/drivers/radeon/r600_texture.c >> @@ -32,6 +32,61 @@ >> #include <errno.h> >> #include <inttypes.h> >> >> +bool r600_prepare_for_dma_blit(struct r600_common_context *rctx, >> + struct r600_texture *rdst, >> + unsigned dst_level, unsigned dstx, >> + unsigned dsty, unsigned dstz, >> + struct r600_texture *rsrc, >> + unsigned src_level, >> + const struct pipe_box *src_box) >> +{ >> + if (!rctx->dma.cs) >> + return false; >> + >> + if (util_format_get_blocksizebits(rdst->resource.b.b.format) != >> + util_format_get_blocksizebits(rsrc->resource.b.b.format)) >> + return false; > > > I don't think that's enough. What if src is RGBA and dst is BGRA or > something like that?
It has the same semantics as resource_copy_region, which doesn't care about the format, but bpp must be the same. Here it's just sanity checking. Marek _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev