venus: avoid over-caching sfb cmds
For most runtime usages, e.g. apitrace via zink on venus, the sfb cmds normally don't exceed 3. So a limit of 5 cmds would be enough. This would avoid that dEQP-VK.synchronization.basic.timeline_semaphore.chain can easily leave 700+ free cmds in the cache. Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31035>
This commit is contained in:
@@ -1931,6 +1931,7 @@ vn_semaphore_get_feedback_cmd(struct vn_device *dev, struct vn_semaphore *sem)
|
||||
sfb_cmd = list_first_entry(&sem->feedback.free_cmds,
|
||||
struct vn_semaphore_feedback_cmd, head);
|
||||
list_move_to(&sfb_cmd->head, &sem->feedback.pending_cmds);
|
||||
sem->feedback.free_cmd_count--;
|
||||
}
|
||||
simple_mtx_unlock(&sem->feedback.cmd_mtx);
|
||||
|
||||
@@ -2132,8 +2133,16 @@ vn_GetSemaphoreCounterValue(VkDevice device,
|
||||
simple_mtx_lock(&sem->feedback.cmd_mtx);
|
||||
list_for_each_entry_safe(struct vn_semaphore_feedback_cmd, sfb_cmd,
|
||||
&sem->feedback.pending_cmds, head) {
|
||||
if (counter >= vn_feedback_get_counter(sfb_cmd->src_slot))
|
||||
list_move_to(&sfb_cmd->head, &sem->feedback.free_cmds);
|
||||
if (counter >= vn_feedback_get_counter(sfb_cmd->src_slot)) {
|
||||
/* avoid over-caching more than normal runtime usage */
|
||||
if (sem->feedback.free_cmd_count > 5) {
|
||||
list_del(&sfb_cmd->head);
|
||||
vn_semaphore_feedback_cmd_free(dev, sfb_cmd);
|
||||
} else {
|
||||
list_move_to(&sfb_cmd->head, &sem->feedback.free_cmds);
|
||||
sem->feedback.free_cmd_count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
simple_mtx_unlock(&sem->feedback.cmd_mtx);
|
||||
|
||||
|
@@ -112,6 +112,7 @@ struct vn_semaphore {
|
||||
*/
|
||||
struct list_head pending_cmds;
|
||||
struct list_head free_cmds;
|
||||
uint32_t free_cmd_count;
|
||||
|
||||
/* Lock for accessing free/pending sfb cmds */
|
||||
simple_mtx_t cmd_mtx;
|
||||
|
Reference in New Issue
Block a user