summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Olšák <maraeo@gmail.com>2012-12-02 16:06:49 (GMT)
committerMarek Olšák <maraeo@gmail.com>2012-12-02 17:07:26 (GMT)
commit12dcbd5954676ee32604d82cacbf9a4259967e13 (patch)
tree4a5fa1aa119b6f39e7b1aff1e513032e05276998
parent0222b2bd4107b9e5cabfbc06c1a6ca3eaec3cf0d (diff)
r300g: enable Hyper-Z by default on r500
I fixed the only known bugs on r500 with 0222b2bd4107b9e5cabfbc06c1a6ca3eae. Now there are no piglit regressions with Hyper-Z and all apps I tested seem to work. To summarize how it works: - Only one process can use it at a time. This is a hardware limitation. - The first process to clear a zbuffer gets the exclusive access to use Hyper-Z. - Compositors don't use any zbuffer, so they won't steal it, but some web browsers do, so make sure there's no web browser running if you want your game to use Hyper-Z. - There's no need to restart an app which couldn't get the access to Hyper-Z. Just quit the app which took it, the driver can turn it on for the other app in the middle of rendering. - If an app gets the access to Hyper-Z, it prints "radeon: Acquired Hyper-Z" to stdout. r300-r400: Hyper-Z will be enabled by default on r300-r400 once sufficient testing is done with piglit and Lightsmark at least. Be sure to set the env var RADEON_HYPERZ and run piglit with parameters: -c 0
-rw-r--r--src/gallium/drivers/r300/r300_blit.c5
-rw-r--r--src/gallium/winsys/radeon/drm/radeon_drm_winsys.c18
2 files changed, 13 insertions, 10 deletions
diff --git a/src/gallium/drivers/r300/r300_blit.c b/src/gallium/drivers/r300/r300_blit.c
index 651ea85..4f9d7c9 100644
--- a/src/gallium/drivers/r300/r300_blit.c
+++ b/src/gallium/drivers/r300/r300_blit.c
@@ -173,6 +173,8 @@ static uint32_t r300_hiz_clear_value(double depth)
return r | (r << 8) | (r << 16) | (r << 24);
}
+DEBUG_GET_ONCE_BOOL_OPTION(hyperz, "RADEON_HYPERZ", FALSE)
+
/* Clear currently bound buffers. */
static void r300_clear(struct pipe_context* pipe,
unsigned buffers,
@@ -246,7 +248,8 @@ static void r300_clear(struct pipe_context* pipe,
r300->num_z_clears++;
/* Try to obtain the access to Hyper-Z buffers if we don't have one. */
- if (!r300->hyperz_enabled) {
+ if (!r300->hyperz_enabled &&
+ (r300->screen->caps.is_r500 || debug_get_option_hyperz())) {
r300->hyperz_enabled =
r300->rws->cs_request_feature(r300->cs,
RADEON_FID_R300_HYPERZ_ACCESS,
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
index 33451ab..91710fc 100644
--- a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
+++ b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
@@ -136,13 +136,17 @@ static boolean radeon_set_fd_access(struct radeon_drm_cs *applier,
if (enable) {
if (value) {
*owner = applier;
- fprintf(stderr, "radeon: Acquired Hyper-Z.\n");
+ if (request == RADEON_INFO_WANT_HYPERZ) {
+ printf("radeon: Acquired Hyper-Z.\n");
+ }
pipe_mutex_unlock(*mutex);
return TRUE;
}
} else {
*owner = NULL;
- fprintf(stderr, "radeon: Released Hyper-Z.\n");
+ if (request == RADEON_INFO_WANT_HYPERZ) {
+ printf("radeon: Released Hyper-Z.\n");
+ }
}
pipe_mutex_unlock(*mutex);
@@ -352,13 +356,9 @@ static boolean radeon_cs_request_feature(struct radeon_winsys_cs *rcs,
switch (fid) {
case RADEON_FID_R300_HYPERZ_ACCESS:
- if (debug_get_bool_option("RADEON_HYPERZ", FALSE)) {
- return radeon_set_fd_access(cs, &cs->ws->hyperz_owner,
- &cs->ws->hyperz_owner_mutex,
- RADEON_INFO_WANT_HYPERZ, enable);
- } else {
- return FALSE;
- }
+ return radeon_set_fd_access(cs, &cs->ws->hyperz_owner,
+ &cs->ws->hyperz_owner_mutex,
+ RADEON_INFO_WANT_HYPERZ, enable);
case RADEON_FID_R300_CMASK_ACCESS:
if (debug_get_bool_option("RADEON_CMASK", FALSE)) {