venus: add VN_RELAX_BASE_SLEEP_US env var for tuning cpu utils
Cap the minimum to the current base sleep us 10. Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16256>
This commit is contained in:
parent
f3fb1d6632
commit
84a53de76c
|
@ -19,6 +19,8 @@
|
|||
#include "venus-protocol/vn_protocol_driver_info.h"
|
||||
#include "vk_enum_to_str.h"
|
||||
|
||||
#define VN_RELAX_MIN_BASE_SLEEP_US (10)
|
||||
|
||||
static const struct debug_control vn_debug_options[] = {
|
||||
{ "init", VN_DEBUG_INIT },
|
||||
{ "result", VN_DEBUG_RESULT },
|
||||
|
@ -48,6 +50,10 @@ vn_env_init_once(void)
|
|||
debug_get_num_option("VN_DRAW_CMD_BATCH_LIMIT", UINT32_MAX);
|
||||
if (!vn_env.draw_cmd_batch_limit)
|
||||
vn_env.draw_cmd_batch_limit = UINT32_MAX;
|
||||
vn_env.relax_base_sleep_us = debug_get_num_option(
|
||||
"VN_RELAX_BASE_SLEEP_US", VN_RELAX_MIN_BASE_SLEEP_US);
|
||||
vn_env.relax_base_sleep_us =
|
||||
MAX2(vn_env.relax_base_sleep_us, VN_RELAX_MIN_BASE_SLEEP_US);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -101,7 +107,7 @@ vn_relax(uint32_t *iter, const char *reason)
|
|||
* keep doubling both sleep length and count.
|
||||
*/
|
||||
const uint32_t busy_wait_order = 4;
|
||||
const uint32_t base_sleep_us = 10;
|
||||
const uint32_t base_sleep_us = vn_env.relax_base_sleep_us;
|
||||
const uint32_t warn_order = 12;
|
||||
const uint32_t abort_order = 14;
|
||||
|
||||
|
|
|
@ -183,6 +183,7 @@ struct vn_env {
|
|||
uint64_t perf;
|
||||
/* zero will be overridden to UINT32_MAX as no limit */
|
||||
uint32_t draw_cmd_batch_limit;
|
||||
uint32_t relax_base_sleep_us;
|
||||
};
|
||||
extern struct vn_env vn_env;
|
||||
|
||||
|
|
Loading…
Reference in New Issue