aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/ilo/ilo_resource.h
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2014-01-14 14:51:51 +0800
committerChia-I Wu <[email protected]>2014-01-14 15:43:20 +0800
commit7fdab3b201bd2a011e8e0b0b15aca7b7fb5a7aa5 (patch)
treed95b9eb1481ae53350082bf1db87b6b58d359ad9 /src/gallium/drivers/ilo/ilo_resource.h
parent18645d1533032e0ee64714731977e12ee16d959b (diff)
ilo: disable HiZ for misaligned levels
We need to disable HiZ for non-8x4 aligned levels, except for level 0, layer 0. For the very first layer we can adjust Width and Height fields of 3DSTATE_DEPTH_BUFFER to make it aligned. Specifically, add ILO_TEXTURE_HIZ and set the flag only for properly aligned levels. ilo_texture_can_enable_hiz() is updated to check for the flag. In tex_layout_validate(), align the depth bo to 8x4 so that we can adjust Width/Height of 3DSTATE_DEPTH_BUFFER without introducing out-of-bound access. Finally in rectlist blitter, add the ability to adjust 3DSTATE_DEPTH_BUFFER.
Diffstat (limited to 'src/gallium/drivers/ilo/ilo_resource.h')
-rw-r--r--src/gallium/drivers/ilo/ilo_resource.h24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/gallium/drivers/ilo/ilo_resource.h b/src/gallium/drivers/ilo/ilo_resource.h
index 125535a2771..fb4fde77d08 100644
--- a/src/gallium/drivers/ilo/ilo_resource.h
+++ b/src/gallium/drivers/ilo/ilo_resource.h
@@ -31,6 +31,7 @@
#include "intel_winsys.h"
#include "ilo_common.h"
+#include "ilo_screen.h"
enum ilo_texture_flags {
ILO_TEXTURE_RENDER_WRITE = 1 << 0,
@@ -40,10 +41,9 @@ enum ilo_texture_flags {
ILO_TEXTURE_BLT_READ = 1 << 4,
ILO_TEXTURE_CPU_READ = 1 << 5,
ILO_TEXTURE_CLEAR = 1 << 6,
+ ILO_TEXTURE_HIZ = 1 << 7,
};
-struct ilo_screen;
-
struct ilo_buffer {
struct pipe_resource base;
@@ -161,7 +161,25 @@ static inline bool
ilo_texture_can_enable_hiz(const struct ilo_texture *tex, unsigned level,
unsigned first_slice, unsigned num_slices)
{
- return (tex->hiz.bo != NULL);
+ const struct ilo_screen *is = ilo_screen(tex->base.screen);
+ const struct ilo_texture_slice *slice =
+ ilo_texture_get_slice(tex, level, first_slice);
+
+ if (!tex->hiz.bo)
+ return false;
+
+ /* we can adjust 3DSTATE_DEPTH_BUFFER for the first slice */
+ if (level == 0 && first_slice == 0 && num_slices == 1)
+ return true;
+
+ /* HiZ is non-mipmapped and non-array on GEN6 */
+ assert(is->dev.gen > ILO_GEN(6));
+
+ /*
+ * Either all or none of the slices in the same level have ILO_TEXTURE_HIZ
+ * set. It suffices to check only the first slice.
+ */
+ return (slice->flags & ILO_TEXTURE_HIZ);
}
#endif /* ILO_RESOURCE_H */