radeonsi: don't forget to add HTILE to the buffer list for texturing
authorMarek Olšák <marek.olsak@amd.com>
Wed, 18 Jan 2017 21:15:35 +0000 (22:15 +0100)
committerMarek Olšák <marek.olsak@amd.com>
Thu, 19 Jan 2017 15:38:37 +0000 (16:38 +0100)
This fixes VM faults. Discovered by Samuel Pitoiset.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98975
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99450

Cc: 17.0 13.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
src/gallium/drivers/radeonsi/si_descriptors.c

index df0905d897732f798a4a0267b7ee590802f35351..4a9fcd0dff232d4267ce6862433a4e845f499fd5 100644 (file)
@@ -320,14 +320,21 @@ static void si_sampler_view_add_buffer(struct si_context *sctx,
        if (resource->target == PIPE_BUFFER)
                return;
 
-       /* Now add separate DCC if it's present. */
+       /* Now add separate DCC or HTILE. */
        rtex = (struct r600_texture*)resource;
-       if (!rtex->dcc_separate_buffer)
-               return;
+       if (rtex->dcc_separate_buffer) {
+               radeon_add_to_buffer_list_check_mem(&sctx->b, &sctx->b.gfx,
+                                                   rtex->dcc_separate_buffer, usage,
+                                                   RADEON_PRIO_DCC, check_mem);
+       }
 
-       radeon_add_to_buffer_list_check_mem(&sctx->b, &sctx->b.gfx,
-                                           rtex->dcc_separate_buffer, usage,
-                                           RADEON_PRIO_DCC, check_mem);
+       if (rtex->htile_buffer &&
+           rtex->tc_compatible_htile &&
+           !is_stencil_sampler) {
+               radeon_add_to_buffer_list_check_mem(&sctx->b, &sctx->b.gfx,
+                                                   rtex->htile_buffer, usage,
+                                                   RADEON_PRIO_HTILE, check_mem);
+       }
 }
 
 static void si_sampler_views_begin_new_cs(struct si_context *sctx,