radv/geom: check if esgs and gsvs ring exists before filling geom rings
authorDave Airlie <airlied@redhat.com>
Tue, 31 Jan 2017 00:37:25 +0000 (10:37 +1000)
committerDave Airlie <airlied@redhat.com>
Tue, 31 Jan 2017 01:13:15 +0000 (11:13 +1000)
There are some corner cases where you end up with an esgs ring, but no
gsvs ring, test for both before dereferencing.

Fixes:
dEQP-VK.geometry.emit.points_emit_0_end_0

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
src/amd/vulkan/radv_device.c

index 2014ce23b8c20ea03be08bc64055e5e91242f92b..da67b65ef43260d2ff70e9e7149f6a9c108b008f 100644 (file)
@@ -1058,11 +1058,14 @@ fill_geom_rings(struct radv_queue *queue,
                uint32_t gsvs_ring_size,
                struct radeon_winsys_bo *gsvs_ring_bo)
 {
-       uint64_t esgs_va, gsvs_va;
-       esgs_va = queue->device->ws->buffer_get_va(esgs_ring_bo);
-       gsvs_va = queue->device->ws->buffer_get_va(gsvs_ring_bo);
+       uint64_t esgs_va = 0, gsvs_va = 0;
        uint32_t *desc = &map[4];
 
+       if (esgs_ring_bo)
+               esgs_va = queue->device->ws->buffer_get_va(esgs_ring_bo);
+       if (gsvs_ring_bo)
+               gsvs_va = queue->device->ws->buffer_get_va(gsvs_ring_bo);
+
        /* stride 0, num records - size, add tid, swizzle, elsize4,
           index stride 64 */
        desc[0] = esgs_va;