anv: Properly initialize device->slice_hash.
authorRafael Antognolli <rafael.antognolli@intel.com>
Wed, 14 Aug 2019 22:13:55 +0000 (15:13 -0700)
committerRafael Antognolli <rafael.antognolli@intel.com>
Thu, 15 Aug 2019 16:42:48 +0000 (09:42 -0700)
When subslices_delta == 0 and we take the early return,
device->slice_hash is not initialized on GEN11. It then causes a
segfault when going through anv_DestroyDevice, if compiled with
valgrind.

Fixes: 7bc022b4bbc ("anv/gen11: Emit SLICE_HASH_TABLE when pipes are
                    unbalanced.)

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/intel/vulkan/genX_state.c

index de8b753dd34b306e5dee66dd7e67d6bbe4548648..3bf4890b4a4c9e9fc20cbfc2103bd0d89d2dc20b 100644 (file)
@@ -92,6 +92,8 @@ static void
 genX(emit_slice_hashing_state)(struct anv_device *device,
                                struct anv_batch *batch)
 {
+   device->slice_hash = (struct anv_state) { 0 };
+
 #if GEN_GEN == 11
    const unsigned *ppipe_subslices = device->info.ppipe_subslices;
    int subslices_delta = ppipe_subslices[0] - ppipe_subslices[1];
@@ -156,8 +158,6 @@ genX(emit_slice_hashing_state)(struct anv_device *device,
    anv_batch_emit(batch, GENX(3DSTATE_3D_MODE), mode) {
       mode.SliceHashingTableEnable = true;
    }
-#else
-   device->slice_hash = (struct anv_state) { 0 };
 #endif
 }