From 206835f1b6d4a372a162c5572cd479c09e868299 Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Wed, 27 Feb 2013 16:00:16 -0500 Subject: [PATCH] r600g: align DMA packets to 8 dwords May fix hangs on some asics. Signed-off-by: Alex Deucher --- src/gallium/drivers/r600/evergreen_hw_context.c | 5 ++++- src/gallium/drivers/r600/evergreen_state.c | 9 ++++++++- src/gallium/drivers/r600/r600_hw_context.c | 5 ++++- src/gallium/drivers/r600/r600_state.c | 3 ++- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/r600/evergreen_hw_context.c b/src/gallium/drivers/r600/evergreen_hw_context.c index bb47530..a1f435f 100644 --- a/src/gallium/drivers/r600/evergreen_hw_context.c +++ b/src/gallium/drivers/r600/evergreen_hw_context.c @@ -268,7 +268,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, ncopy * 8); for (i = 0; i < ncopy; i++) { csize = size < 0x000fffff ? size : 0x000fffff; /* emit reloc before writting cs so that cs is always in consistent state */ @@ -279,6 +279,9 @@ void evergreen_dma_copy(struct r600_context *rctx, cs->buf[cs->cdw++] = src_offset & 0xffffffff; cs->buf[cs->cdw++] = (dst_offset >> 32UL) & 0xff; cs->buf[cs->cdw++] = (src_offset >> 32UL) & 0xff; + cs->buf[cs->cdw++] = DMA_PACKET(DMA_PACKET_NOP, 0, 0); + cs->buf[cs->cdw++] = DMA_PACKET(DMA_PACKET_NOP, 0, 0); + cs->buf[cs->cdw++] = DMA_PACKET(DMA_PACKET_NOP, 0, 0); dst_offset += csize << shift; src_offset += csize << shift; size -= csize; diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 4a91942..37af73d 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -3645,7 +3645,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, ncopy * 16); for (i = 0; i < ncopy; i++) { cheight = copy_height; @@ -3667,6 +3667,13 @@ static void evergreen_dma_copy_tile(struct r600_context *rctx, cs->buf[cs->cdw++] = (y << 0) | (tile_split << 21) | (nbanks << 25); cs->buf[cs->cdw++] = addr & 0xfffffffc; cs->buf[cs->cdw++] = (addr >> 32UL) & 0xff; + cs->buf[cs->cdw++] = DMA_PACKET(DMA_PACKET_NOP, 0, 0); + cs->buf[cs->cdw++] = DMA_PACKET(DMA_PACKET_NOP, 0, 0); + cs->buf[cs->cdw++] = DMA_PACKET(DMA_PACKET_NOP, 0, 0); + cs->buf[cs->cdw++] = DMA_PACKET(DMA_PACKET_NOP, 0, 0); + cs->buf[cs->cdw++] = DMA_PACKET(DMA_PACKET_NOP, 0, 0); + cs->buf[cs->cdw++] = DMA_PACKET(DMA_PACKET_NOP, 0, 0); + cs->buf[cs->cdw++] = DMA_PACKET(DMA_PACKET_NOP, 0, 0); copy_height -= cheight; addr += cheight * pitch; y += cheight; diff --git a/src/gallium/drivers/r600/r600_hw_context.c b/src/gallium/drivers/r600/r600_hw_context.c index ec098c1..6cfdb1f 100644 --- a/src/gallium/drivers/r600/r600_hw_context.c +++ b/src/gallium/drivers/r600/r600_hw_context.c @@ -1198,7 +1198,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, ncopy * 8); for (i = 0; i < ncopy; i++) { csize = size < 0xffff ? size : 0xffff; /* emit reloc before writting cs so that cs is always in consistent state */ @@ -1209,6 +1209,9 @@ void r600_dma_copy(struct r600_context *rctx, cs->buf[cs->cdw++] = src_offset & 0xfffffffc; cs->buf[cs->cdw++] = (dst_offset >> 32UL) & 0xff; cs->buf[cs->cdw++] = (src_offset >> 32UL) & 0xff; + cs->buf[cs->cdw++] = DMA_PACKET(DMA_PACKET_NOP, 0, 0, 0); + cs->buf[cs->cdw++] = DMA_PACKET(DMA_PACKET_NOP, 0, 0, 0); + cs->buf[cs->cdw++] = DMA_PACKET(DMA_PACKET_NOP, 0, 0, 0); dst_offset += csize << shift; src_offset += csize << shift; size -= csize; diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index c6559bb..e6152ac 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -3107,7 +3107,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, ncopy * 8); for (i = 0; i < ncopy; i++) { cheight = cheight > copy_height ? copy_height : cheight; @@ -3124,6 +3124,7 @@ static boolean r600_dma_copy_tile(struct r600_context *rctx, cs->buf[cs->cdw++] = (x << 3) | (y << 17); cs->buf[cs->cdw++] = addr & 0xfffffffc; cs->buf[cs->cdw++] = (addr >> 32UL) & 0xff; + cs->buf[cs->cdw++] = DMA_PACKET(DMA_PACKET_NOP, 0, 0, 0); copy_height -= cheight; addr += cheight * pitch; y += cheight; -- 1.7.7.5