summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2012-12-01 21:18:59 +0100
committerMarek Olšák <[email protected]>2012-12-01 21:43:17 +0100
commit3e3a586236815970b5eab36697e221e9a72542d6 (patch)
tree59cae7d582d136f7d2da4da227b3dce7443bea24
parent587bd16d0d8ceb7313eaf0604b98797e140a386d (diff)
r300g: fix revoking hyperz access
The bug was uncovered by 67c8e96f5ace67f9c17556934ee9532877d3a00. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=57763
-rw-r--r--src/gallium/drivers/r300/r300_flush.c42
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 2383ba1bb4a..732529a317e 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,