ws->buffer_destroy(ws, queue->task_rings_bo);
if (queue->attr_ring_bo)
ws->buffer_destroy(ws, queue->attr_ring_bo);
- if (queue->gds_bo)
+ if (queue->gds_bo) {
+ ws->buffer_make_resident(ws, queue->gds_bo, false);
ws->buffer_destroy(ws, queue->gds_bo);
- if (queue->gds_oa_bo)
+ }
+ if (queue->gds_oa_bo) {
+ ws->buffer_make_resident(ws, queue->gds_oa_bo, false);
ws->buffer_destroy(ws, queue->gds_oa_bo);
+ }
if (queue->compute_scratch_bo)
ws->buffer_destroy(ws, queue->compute_scratch_bo);
}
RADV_BO_PRIORITY_SCRATCH, 0, &gds_bo);
if (result != VK_SUCCESS)
goto fail;
+
+ /* Add the GDS BO to our global BO list to prevent the kernel to emit a GDS switch and reset
+ * the state when a compute queue is used.
+ */
+ result = device->ws->buffer_make_resident(ws, gds_bo, true);
+ if (result != VK_SUCCESS)
+ goto fail;
}
if (!queue->ring_info.gds_oa && needs->gds_oa) {
RADV_BO_PRIORITY_SCRATCH, 0, &gds_oa_bo);
if (result != VK_SUCCESS)
goto fail;
+
+ /* Add the GDS OA BO to our global BO list to prevent the kernel to emit a GDS switch and
+ * reset the state when a compute queue is used.
+ */
+ result = device->ws->buffer_make_resident(ws, gds_oa_bo, true);
+ if (result != VK_SUCCESS)
+ goto fail;
}
/* Re-initialize the descriptor BO when any ring BOs changed.
break;
}
- if (gds_bo)
- radv_cs_add_buffer(ws, cs, gds_bo);
- if (gds_oa_bo)
- radv_cs_add_buffer(ws, cs, gds_oa_bo);
-
if (i < 2) {
/* The two initial preambles have a cache flush at the beginning. */
const enum amd_gfx_level gfx_level = device->physical_device->rad_info.gfx_level;
ws->buffer_destroy(ws, task_rings_bo);
if (attr_ring_bo && attr_ring_bo != queue->attr_ring_bo)
ws->buffer_destroy(ws, attr_ring_bo);
- if (gds_bo && gds_bo != queue->gds_bo)
+ if (gds_bo && gds_bo != queue->gds_bo) {
+ ws->buffer_make_resident(ws, queue->gds_bo, false);
ws->buffer_destroy(ws, gds_bo);
- if (gds_oa_bo && gds_oa_bo != queue->gds_oa_bo)
+ }
+ if (gds_oa_bo && gds_oa_bo != queue->gds_oa_bo) {
+ ws->buffer_make_resident(ws, queue->gds_oa_bo, false);
ws->buffer_destroy(ws, gds_oa_bo);
+ }
return vk_error(queue, result);
}