[Mesa-dev] [PATCH 04/13] gallium/radeon: require both WRITE and FLUSH_EXPLICIT in buffer_flush_region

Marek Olšák maraeo at gmail.com
Wed May 10 22:45:37 UTC 2017


From: Marek Olšák <marek.olsak at amd.com>

spotted randomly.
---
 src/gallium/drivers/radeon/r600_buffer_common.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/radeon/r600_buffer_common.c b/src/gallium/drivers/radeon/r600_buffer_common.c
index b2289e2..6a4846a 100644
--- a/src/gallium/drivers/radeon/r600_buffer_common.c
+++ b/src/gallium/drivers/radeon/r600_buffer_common.c
@@ -475,22 +475,24 @@ static void r600_buffer_do_flush_region(struct pipe_context *ctx,
 	}
 
 	util_range_add(&rbuffer->valid_buffer_range, box->x,
 		       box->x + box->width);
 }
 
 static void r600_buffer_flush_region(struct pipe_context *ctx,
 				     struct pipe_transfer *transfer,
 				     const struct pipe_box *rel_box)
 {
-	if (transfer->usage & (PIPE_TRANSFER_WRITE |
-			       PIPE_TRANSFER_FLUSH_EXPLICIT)) {
+	unsigned required_usage = PIPE_TRANSFER_WRITE |
+				  PIPE_TRANSFER_FLUSH_EXPLICIT;
+
+	if ((transfer->usage & required_usage) == required_usage) {
 		struct pipe_box box;
 
 		u_box_1d(transfer->box.x + rel_box->x, rel_box->width, &box);
 		r600_buffer_do_flush_region(ctx, transfer, &box);
 	}
 }
 
 static void r600_buffer_transfer_unmap(struct pipe_context *ctx,
 				       struct pipe_transfer *transfer)
 {
-- 
2.7.4



More information about the mesa-dev mailing list