mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 00:58:05 +02:00
util/tc: add a util function for setting bytes_mapped_limit
tc drivers set this based on os_get_total_physical_memory()/divisor, which is going to be totally wrong for 32bit processes and explode the address space this util function can be used to handle per-platform clamping Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11853>
This commit is contained in:
parent
3db856689d
commit
671d579b46
2 changed files with 14 additions and 0 deletions
|
|
@ -4207,3 +4207,14 @@ fail:
|
|||
tc_destroy(&tc->base);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
threaded_context_init_bytes_mapped_limit(struct threaded_context *tc, unsigned divisor)
|
||||
{
|
||||
uint64_t total_ram;
|
||||
if (os_get_total_physical_memory(&total_ram)) {
|
||||
tc->bytes_mapped_limit = total_ram / divisor;
|
||||
if (sizeof(void*) == 4)
|
||||
tc->bytes_mapped_limit = MIN2(tc->bytes_mapped_limit, 512*1024*1024UL);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -504,6 +504,9 @@ threaded_context_create(struct pipe_context *pipe,
|
|||
bool driver_calls_flush_notify,
|
||||
struct threaded_context **out);
|
||||
|
||||
void
|
||||
threaded_context_init_bytes_mapped_limit(struct threaded_context *tc, unsigned divisor);
|
||||
|
||||
void
|
||||
threaded_context_flush(struct pipe_context *_pipe,
|
||||
struct tc_unflushed_batch_token *token,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue