hk: add =batch perftest

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31532>
This commit is contained in:
Alyssa Rosenzweig
2024-09-28 20:44:17 -04:00
committed by Marge Bot
parent 13b50d709b
commit 0d9ac1299d
3 changed files with 13 additions and 9 deletions
+1
View File
@@ -39,6 +39,7 @@ static const struct debug_named_value hk_perf_options[] = {
{"notess", HK_PERF_NOTESS, "Skip draws with tessellation"},
{"noborder", HK_PERF_NOBORDER, "Disable custom border colour emulation"},
{"nobarrier", HK_PERF_NOBARRIER,"Ignore pipeline barriers"},
{"batch", HK_PERF_BATCH, "Batch submissions"},
DEBUG_NAMED_VALUE_END
};
/* clang-format on */
+1
View File
@@ -115,6 +115,7 @@ enum hk_perftest {
HK_PERF_NOTESS = BITFIELD_BIT(0),
HK_PERF_NOBORDER = BITFIELD_BIT(1),
HK_PERF_NOBARRIER = BITFIELD_BIT(2),
HK_PERF_BATCH = BITFIELD_BIT(3),
};
#define HK_PERF(dev, flag) unlikely((dev)->perftest &HK_PERF_##flag)
+11 -9
View File
@@ -264,10 +264,12 @@ union drm_asahi_cmd {
* on the CTS once lossless compression is enabled. This needs to be
* investigated before we can reenable this mechanism. We are likely missing a
* cache flush or barrier somewhere.
*
* TODO: I think the actual maximum is 64. Can we query from the kernel?
*/
#define MAX_COMMANDS_PER_SUBMIT (1)
static inline unsigned
max_commands_per_submit(struct hk_device *dev)
{
return HK_PERF(dev, BATCH) ? 64 : 1;
}
static VkResult
queue_submit_single(struct agx_device *dev, struct drm_asahi_submit *submit)
@@ -296,7 +298,7 @@ queue_submit_single(struct agx_device *dev, struct drm_asahi_submit *submit)
* bounds.
*/
static VkResult
queue_submit_looped(struct agx_device *dev, struct drm_asahi_submit *submit)
queue_submit_looped(struct hk_device *dev, struct drm_asahi_submit *submit)
{
struct drm_asahi_command *cmds = (void *)(uintptr_t)submit->commands;
unsigned commands_remaining = submit->command_count;
@@ -304,9 +306,9 @@ queue_submit_looped(struct agx_device *dev, struct drm_asahi_submit *submit)
while (commands_remaining) {
bool first = commands_remaining == submit->command_count;
bool last = commands_remaining <= MAX_COMMANDS_PER_SUBMIT;
bool last = commands_remaining <= max_commands_per_submit(dev);
unsigned count = MIN2(commands_remaining, MAX_COMMANDS_PER_SUBMIT);
unsigned count = MIN2(commands_remaining, max_commands_per_submit(dev));
commands_remaining -= count;
assert(!last || commands_remaining == 0);
@@ -346,7 +348,7 @@ queue_submit_looped(struct agx_device *dev, struct drm_asahi_submit *submit)
.out_sync_count = last ? submit->out_sync_count : 0,
};
VkResult result = queue_submit_single(dev, &submit_ioctl);
VkResult result = queue_submit_single(&dev->dev, &submit_ioctl);
if (result != VK_SUCCESS)
return result;
@@ -517,10 +519,10 @@ queue_submit(struct hk_device *dev, struct hk_queue *queue,
.commands = (uint64_t)(uintptr_t)(cmds),
};
if (command_count <= MAX_COMMANDS_PER_SUBMIT)
if (command_count <= max_commands_per_submit(dev))
return queue_submit_single(&dev->dev, &submit_ioctl);
else
return queue_submit_looped(&dev->dev, &submit_ioctl);
return queue_submit_looped(dev, &submit_ioctl);
}
static VkResult