asahi: Add 1queue debug option

This is a hacky implementation but it's for debug only anyway.

Signed-off-by: Asahi Lina <lina@asahilina.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30382>
This commit is contained in:
Asahi Lina 2024-07-11 17:18:06 +09:00 committed by Marge Bot
parent d0424eb63b
commit 2c057cc4d9
2 changed files with 23 additions and 0 deletions

View file

@ -65,6 +65,7 @@ static const struct debug_named_value agx_debug_options[] = {
{"nomsaa", AGX_DBG_NOMSAA, "Force disable MSAA"},
{"noshadow", AGX_DBG_NOSHADOW, "Force disable resource shadowing"},
{"scratch", AGX_DBG_SCRATCH, "Debug scratch memory usage"},
{"1queue", AGX_DBG_1QUEUE, "Force usage of a single queue for multiple contexts"},
DEBUG_NAMED_VALUE_END
};
/* clang-format on */
@ -612,6 +613,16 @@ uint32_t
agx_create_command_queue(struct agx_device *dev, uint32_t caps,
uint32_t priority)
{
if (dev->debug & AGX_DBG_1QUEUE) {
// Abuse this lock for this, it's debug only anyway
simple_mtx_lock(&dev->vma_lock);
if (dev->queue_id) {
simple_mtx_unlock(&dev->vma_lock);
return dev->queue_id;
}
}
struct drm_asahi_queue_create queue_create = {
.vm_id = dev->vm_id,
.queue_caps = caps,
@ -626,12 +637,20 @@ agx_create_command_queue(struct agx_device *dev, uint32_t caps,
assert(0);
}
if (dev->debug & AGX_DBG_1QUEUE) {
dev->queue_id = queue_create.queue_id;
simple_mtx_unlock(&dev->vma_lock);
}
return queue_create.queue_id;
}
int
agx_destroy_command_queue(struct agx_device *dev, uint32_t queue_id)
{
if (dev->debug & AGX_DBG_1QUEUE)
return 0;
struct drm_asahi_queue_destroy queue_destroy = {
.queue_id = queue_id,
};

View file

@ -41,6 +41,7 @@ enum agx_dbg {
AGX_DBG_SCRATCH = BITFIELD_BIT(18),
AGX_DBG_COMPBLIT = BITFIELD_BIT(19),
AGX_DBG_FEEDBACK = BITFIELD_BIT(20),
AGX_DBG_1QUEUE = BITFIELD_BIT(21),
};
/* How many power-of-two levels in the BO cache do we want? 2^14 minimum chosen
@ -91,6 +92,9 @@ struct agx_device {
/* VM handle */
uint32_t vm_id;
/* Global queue handle */
uint32_t queue_id;
/* VMA heaps */
simple_mtx_t vma_lock;
uint64_t shader_base;