Mesa (master): r300g: fix revoking hyperz access
Marek Olšák
mareko at kemper.freedesktop.org
Sat Dec 1 20:43:50 UTC 2012
Module: Mesa
Branch: master
Commit: 3e3a586236815970b5eab36697e221e9a72542d6
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=3e3a586236815970b5eab36697e221e9a72542d6
Author: Marek Olšák <maraeo at gmail.com>
Date: Sat Dec 1 21:18:59 2012 +0100
r300g: fix revoking hyperz access
The bug was uncovered by 67c8e96f5ace67f9c17556934ee9532877d3a00.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=57763
---
src/gallium/drivers/r300/r300_flush.c | 42 +++++++++++++++++---------------
1 files changed, 22 insertions(+), 20 deletions(-)
diff --git a/src/gallium/drivers/r300/r300_flush.c b/src/gallium/drivers/r300/r300_flush.c
index 2383ba1..732529a 100644
--- a/src/gallium/drivers/r300/r300_flush.c
+++ b/src/gallium/drivers/r300/r300_flush.c
@@ -105,30 +105,32 @@ void r300_flush(struct pipe_context *pipe,
}
/* Update Hyper-Z status. */
- if (r300->num_z_clears) {
- r300->hyperz_time_of_last_flush = os_time_get();
- } else if (r300->hyperz_time_of_last_flush > 2000000) {
- /* 2 seconds without a Z clear pretty much means a dead context
- * for HyperZ. */
-
- r300->hiz_in_use = FALSE;
-
- /* Decompress Z buffer. */
- if (r300->zmask_in_use) {
- if (r300->locked_zbuffer) {
- r300_decompress_zmask_locked(r300);
- } else {
- r300_decompress_zmask(r300);
+ if (r300->hyperz_enabled) {
+ /* If there was a Z clear, keep Hyper-Z access. */
+ if (r300->num_z_clears) {
+ r300->hyperz_time_of_last_flush = os_time_get();
+ r300->num_z_clears = 0;
+ } else if (r300->hyperz_time_of_last_flush - os_time_get() > 2000000) {
+ /* If there hasn't been a Z clear for 2 seconds, revoke Hyper-Z access. */
+ r300->hiz_in_use = FALSE;
+
+ /* Decompress the Z buffer. */
+ if (r300->zmask_in_use) {
+ if (r300->locked_zbuffer) {
+ r300_decompress_zmask_locked(r300);
+ } else {
+ r300_decompress_zmask(r300);
+ }
+
+ r300_flush_and_cleanup(r300, flags);
}
- r300_flush_and_cleanup(r300, flags);
+ /* Revoke Hyper-Z access, so that some other process can take it. */
+ r300->rws->cs_request_feature(r300->cs, RADEON_FID_R300_HYPERZ_ACCESS,
+ FALSE);
+ r300->hyperz_enabled = FALSE;
}
-
- /* Release HyperZ. */
- r300->rws->cs_request_feature(r300->cs, RADEON_FID_R300_HYPERZ_ACCESS,
- FALSE);
}
- r300->num_z_clears = 0;
}
static void r300_flush_wrapped(struct pipe_context *pipe,
More information about the mesa-commit
mailing list