summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/ilo/ilo_transfer.c
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2014-08-17 14:13:35 +0800
committerChia-I Wu <[email protected]>2014-08-19 19:53:37 +0800
commit17401896ddb6bdb670da0171ff4ba3705066f908 (patch)
tree6274ee2f2f5a8665f5c291e030493f53b854f983 /src/gallium/drivers/ilo/ilo_transfer.c
parent5b4fc5f156bff72e63e2f528004a48d008d3af6f (diff)
ilo: enable HiZ in more cases on GEN6
With layer offsetting killed, we no longer need to restrict HiZ to non-mipmapped and non-arary depth buffers.
Diffstat (limited to 'src/gallium/drivers/ilo/ilo_transfer.c')
-rw-r--r--src/gallium/drivers/ilo/ilo_transfer.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/gallium/drivers/ilo/ilo_transfer.c b/src/gallium/drivers/ilo/ilo_transfer.c
index d40dce8c541..a38708d88a6 100644
--- a/src/gallium/drivers/ilo/ilo_transfer.c
+++ b/src/gallium/drivers/ilo/ilo_transfer.c
@@ -77,10 +77,12 @@
* correctly block when the resource is busy.
*/
static bool
-resource_get_transfer_method(struct pipe_resource *res, unsigned usage,
+resource_get_transfer_method(struct pipe_resource *res,
+ const struct pipe_transfer *transfer,
enum ilo_transfer_map_method *method)
{
const struct ilo_screen *is = ilo_screen(res->screen);
+ const unsigned usage = transfer->usage;
enum ilo_transfer_map_method m;
bool tiled;
@@ -89,15 +91,21 @@ resource_get_transfer_method(struct pipe_resource *res, unsigned usage,
}
else {
struct ilo_texture *tex = ilo_texture(res);
- bool need_convert = true;
+ bool need_convert = false;
/* we may need to convert on the fly */
- if (tex->separate_s8 || tex->layout.format == PIPE_FORMAT_S8_UINT)
- m = ILO_TRANSFER_MAP_SW_ZS;
- else if (tex->layout.format != tex->base.format)
+ if (tex->separate_s8 || tex->layout.format == PIPE_FORMAT_S8_UINT) {
+ /* on GEN6, separate stencil is enabled only when HiZ is */
+ if (is->dev.gen >= ILO_GEN(7) ||
+ ilo_texture_can_enable_hiz(tex, transfer->level,
+ transfer->box.z, transfer->box.depth)) {
+ m = ILO_TRANSFER_MAP_SW_ZS;
+ need_convert = true;
+ }
+ } else if (tex->layout.format != tex->base.format) {
m = ILO_TRANSFER_MAP_SW_CONVERT;
- else
- need_convert = false;
+ need_convert = true;
+ }
if (need_convert) {
if (usage & (PIPE_TRANSFER_MAP_DIRECTLY | PIPE_TRANSFER_PERSISTENT))
@@ -1059,7 +1067,7 @@ choose_transfer_method(struct ilo_context *ilo, struct ilo_transfer *xfer)
struct pipe_resource *res = xfer->base.resource;
bool need_flush;
- if (!resource_get_transfer_method(res, xfer->base.usage, &xfer->method))
+ if (!resource_get_transfer_method(res, &xfer->base, &xfer->method))
return false;
/* see if we can avoid blocking */