diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/ilo/core/ilo_image.c | 5 | ||||
-rw-r--r-- | src/gallium/drivers/ilo/core/ilo_image.h | 6 | ||||
-rw-r--r-- | src/gallium/drivers/ilo/core/ilo_state_3d_bottom.c | 5 | ||||
-rw-r--r-- | src/gallium/drivers/ilo/ilo_blit.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/ilo/ilo_blit.h | 4 | ||||
-rw-r--r-- | src/gallium/drivers/ilo/ilo_blitter_rectlist.c | 8 | ||||
-rw-r--r-- | src/gallium/drivers/ilo/ilo_resource.c | 20 | ||||
-rw-r--r-- | src/gallium/drivers/ilo/ilo_resource.h | 24 | ||||
-rw-r--r-- | src/gallium/drivers/ilo/ilo_transfer.c | 3 |
9 files changed, 27 insertions, 50 deletions
diff --git a/src/gallium/drivers/ilo/core/ilo_image.c b/src/gallium/drivers/ilo/core/ilo_image.c index 3a599bccc10..22c8ef2620a 100644 --- a/src/gallium/drivers/ilo/core/ilo_image.c +++ b/src/gallium/drivers/ilo/core/ilo_image.c @@ -878,9 +878,8 @@ img_align(struct ilo_image *img, struct ilo_image_params *params) align_h = MAX2(align_h, 2); /* - * Depth Buffer Clear/Resolve works in 8x4 sample blocks. In - * ilo_texture_can_enable_hiz(), we always return true for the first slice. - * To avoid out-of-bound access, we have to pad. + * Depth Buffer Clear/Resolve works in 8x4 sample blocks. Pad to allow HiZ + * for unaligned non-mipmapped and non-array images. */ if (img->aux.type == ILO_IMAGE_AUX_HIZ && templ->last_level == 0 && diff --git a/src/gallium/drivers/ilo/core/ilo_image.h b/src/gallium/drivers/ilo/core/ilo_image.h index e3c51005d19..4956bdae2ee 100644 --- a/src/gallium/drivers/ilo/core/ilo_image.h +++ b/src/gallium/drivers/ilo/core/ilo_image.h @@ -179,6 +179,12 @@ ilo_image_set_aux_bo(struct ilo_image *img, struct intel_bo *bo) img->aux.bo = intel_bo_ref(bo); } +static inline bool +ilo_image_can_enable_aux(const struct ilo_image *img, unsigned level) +{ + return (img->aux.bo && (img->aux.enables & (1 << level))); +} + /** * Convert from pixel position to 2D memory offset. */ diff --git a/src/gallium/drivers/ilo/core/ilo_state_3d_bottom.c b/src/gallium/drivers/ilo/core/ilo_state_3d_bottom.c index 91c9bd2197d..a3cbc523d26 100644 --- a/src/gallium/drivers/ilo/core/ilo_state_3d_bottom.c +++ b/src/gallium/drivers/ilo/core/ilo_state_3d_bottom.c @@ -974,8 +974,7 @@ zs_init_info(const struct ilo_dev *dev, * same value (enabled or disabled) as Hierarchical Depth Buffer * Enable." */ - separate_stencil = - ilo_texture_can_enable_hiz(tex, level, first_layer, num_layers); + separate_stencil = ilo_image_can_enable_aux(&tex->image, level); } /* @@ -1073,7 +1072,7 @@ zs_init_info(const struct ilo_dev *dev, } } - if (ilo_texture_can_enable_hiz(tex, level, first_layer, num_layers)) { + if (ilo_image_can_enable_aux(&tex->image, level)) { info->hiz.bo = tex->image.aux.bo; info->hiz.stride = tex->image.aux.bo_stride; diff --git a/src/gallium/drivers/ilo/ilo_blit.c b/src/gallium/drivers/ilo/ilo_blit.c index 42072c2fed0..f88f1e8dc92 100644 --- a/src/gallium/drivers/ilo/ilo_blit.c +++ b/src/gallium/drivers/ilo/ilo_blit.c @@ -166,7 +166,7 @@ ilo_blit_resolve_slices_for_hiz(struct ilo_context *ilo, unsigned i; assert(tex->base.target != PIPE_BUFFER && - ilo_texture_can_enable_hiz(tex, level, first_slice, num_slices)); + ilo_image_can_enable_aux(&tex->image, level)); if (resolve_flags & ILO_TEXTURE_RENDER_WRITE) { /* diff --git a/src/gallium/drivers/ilo/ilo_blit.h b/src/gallium/drivers/ilo/ilo_blit.h index fed8776e4be..da0bfe9c4c9 100644 --- a/src/gallium/drivers/ilo/ilo_blit.h +++ b/src/gallium/drivers/ilo/ilo_blit.h @@ -58,10 +58,10 @@ ilo_blit_resolve_slices(struct ilo_context *ilo, * As it is only used to resolve HiZ right now, return early when there is * no HiZ. */ - if (!ilo_texture_can_enable_hiz(tex, level, first_slice, num_slices)) + if (!ilo_image_can_enable_aux(&tex->image, level)) return; - if (ilo_texture_can_enable_hiz(tex, level, first_slice, num_slices)) { + if (ilo_image_can_enable_aux(&tex->image, level)) { ilo_blit_resolve_slices_for_hiz(ilo, res, level, first_slice, num_slices, resolve_flags); } diff --git a/src/gallium/drivers/ilo/ilo_blitter_rectlist.c b/src/gallium/drivers/ilo/ilo_blitter_rectlist.c index 02051299675..6d8afed9dca 100644 --- a/src/gallium/drivers/ilo/ilo_blitter_rectlist.c +++ b/src/gallium/drivers/ilo/ilo_blitter_rectlist.c @@ -331,9 +331,7 @@ ilo_blitter_rectlist_clear_zs(struct ilo_blitter *blitter, struct pipe_depth_stencil_alpha_state dsa_state; uint32_t uses, clear_value; - if (!ilo_texture_can_enable_hiz(tex, - zs->u.tex.level, zs->u.tex.first_layer, - zs->u.tex.last_layer - zs->u.tex.first_layer + 1)) + if (!ilo_image_can_enable_aux(&tex->image, zs->u.tex.level)) return false; if (!hiz_can_clear_zs(blitter, tex)) @@ -427,7 +425,7 @@ ilo_blitter_rectlist_resolve_z(struct ilo_blitter *blitter, const struct ilo_texture_slice *s = ilo_texture_get_slice(tex, level, slice); - if (!ilo_texture_can_enable_hiz(tex, level, slice, 1)) + if (!ilo_image_can_enable_aux(&tex->image, level)) return; /* @@ -462,7 +460,7 @@ ilo_blitter_rectlist_resolve_hiz(struct ilo_blitter *blitter, struct ilo_texture *tex = ilo_texture(res); struct pipe_depth_stencil_alpha_state dsa_state; - if (!ilo_texture_can_enable_hiz(tex, level, slice, 1)) + if (!ilo_image_can_enable_aux(&tex->image, level)) return; /* diff --git a/src/gallium/drivers/ilo/ilo_resource.c b/src/gallium/drivers/ilo/ilo_resource.c index 2aa85085559..ad4852278d0 100644 --- a/src/gallium/drivers/ilo/ilo_resource.c +++ b/src/gallium/drivers/ilo/ilo_resource.c @@ -217,7 +217,6 @@ tex_create_hiz(struct ilo_texture *tex) const struct pipe_resource *templ = &tex->base; struct ilo_screen *is = ilo_screen(tex->base.screen); struct intel_bo *bo; - unsigned lv; bo = intel_winsys_alloc_bo(is->dev.winsys, "hiz texture", tex->image.aux.bo_stride * tex->image.aux.bo_height, false); @@ -226,17 +225,18 @@ tex_create_hiz(struct ilo_texture *tex) ilo_image_set_aux_bo(&tex->image, bo); - for (lv = 0; lv <= templ->last_level; lv++) { - if (tex->image.aux.enables & (1 << lv)) { - const unsigned num_slices = (templ->target == PIPE_TEXTURE_3D) ? - u_minify(templ->depth0, lv) : templ->array_size; - unsigned flags = ILO_TEXTURE_HIZ; + if (tex->imported) { + unsigned lv; - /* this will trigger a HiZ resolve */ - if (tex->imported) - flags |= ILO_TEXTURE_CPU_WRITE; + for (lv = 0; lv <= templ->last_level; lv++) { + if (tex->image.aux.enables & (1 << lv)) { + const unsigned num_slices = (templ->target == PIPE_TEXTURE_3D) ? + u_minify(templ->depth0, lv) : templ->array_size; + /* this will trigger HiZ resolves */ + const unsigned flags = ILO_TEXTURE_CPU_WRITE; - ilo_texture_set_slice_flags(tex, lv, 0, num_slices, flags, flags); + ilo_texture_set_slice_flags(tex, lv, 0, num_slices, flags, flags); + } } } diff --git a/src/gallium/drivers/ilo/ilo_resource.h b/src/gallium/drivers/ilo/ilo_resource.h index 0a835d99210..d602e0cbf70 100644 --- a/src/gallium/drivers/ilo/ilo_resource.h +++ b/src/gallium/drivers/ilo/ilo_resource.h @@ -66,16 +66,6 @@ enum ilo_texture_flags { * flags, the slice has been cleared to ilo_texture_slice::clear_value. */ ILO_TEXTURE_CLEAR = 1 << 6, - - /* - * Set when HiZ can be enabled. - * - * It is never set in resolve flags. When set in slice flags, the slice - * can have HiZ enabled. It is to be noted that this bit is always set for - * either all or none of the slices in a level, allowing quick check in - * case of layered rendering. - */ - ILO_TEXTURE_HIZ = 1 << 7, }; /** @@ -189,18 +179,4 @@ ilo_texture_set_slice_clear_value(struct ilo_texture *tex, unsigned level, } } -static inline bool -ilo_texture_can_enable_hiz(const struct ilo_texture *tex, unsigned level, - unsigned first_slice, unsigned num_slices) -{ - /* - * Either all or none of the slices in the same level have ILO_TEXTURE_HIZ - * set. It suffices to check only the first slice. - */ - const struct ilo_texture_slice *slice = - ilo_texture_get_slice(tex, level, 0); - - return (tex->image.aux.bo && (slice->flags & ILO_TEXTURE_HIZ)); -} - #endif /* ILO_RESOURCE_H */ diff --git a/src/gallium/drivers/ilo/ilo_transfer.c b/src/gallium/drivers/ilo/ilo_transfer.c index 56e67870881..ec41473f94a 100644 --- a/src/gallium/drivers/ilo/ilo_transfer.c +++ b/src/gallium/drivers/ilo/ilo_transfer.c @@ -96,8 +96,7 @@ resource_get_transfer_method(struct pipe_resource *res, if (tex->image.tiling == GEN8_TILING_W || tex->separate_s8) { /* on GEN6, separate stencil is enabled only when HiZ is */ if (ilo_dev_gen(&is->dev) >= ILO_GEN(7) || - ilo_texture_can_enable_hiz(tex, transfer->level, - transfer->box.z, transfer->box.depth)) { + ilo_image_can_enable_aux(&tex->image, transfer->level)) { m = ILO_TRANSFER_MAP_SW_ZS; need_convert = true; } |