summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>2021-04-02 11:08:46 -0400
committerMarge Bot <eric+marge@anholt.net>2021-04-05 22:45:52 +0000
commite4426d78285aac961e0f21e9992dd2ba5b2f62cd (patch)
tree4680c85cf37c4311b6bb438725021200063b0a29
parentc6244899689916e1ffad8f35b08847ef20d295e3 (diff)
zink: split total_mem off to total_video_mem, use total_mem for tc
tc needs the total host memory available, not the total video memory Reviewed-by: Dave Airlie <airlied@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10006>
-rw-r--r--src/gallium/drivers/zink/zink_context.c4
-rw-r--r--src/gallium/drivers/zink/zink_screen.c4
-rw-r--r--src/gallium/drivers/zink/zink_screen.h1
3 files changed, 6 insertions, 3 deletions
diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c
index e366376a4d7..d43635dfced 100644
--- a/src/gallium/drivers/zink/zink_context.c
+++ b/src/gallium/drivers/zink/zink_context.c
@@ -1984,10 +1984,10 @@ zink_maybe_flush_or_stall(struct zink_context *ctx)
{
struct zink_screen *screen = zink_screen(ctx->base.screen);
/* flush anytime our total batch memory usage is potentially >= 1/10 of total system memory */
- if (ctx->batch.state->resource_size >= screen->total_mem / 10)
+ if (ctx->batch.state->resource_size >= screen->total_video_mem / 10)
flush_batch(ctx, true);
- if (ctx->resource_size >= screen->total_mem / 10 || _mesa_hash_table_num_entries(&ctx->batch_states) > 10) {
+ if (ctx->resource_size >= screen->total_video_mem / 10 || _mesa_hash_table_num_entries(&ctx->batch_states) > 10) {
sync_flush(ctx, zink_batch_state(ctx->last_fence));
zink_vkfence_wait(screen, ctx->last_fence, PIPE_TIMEOUT_INFINITE);
zink_batch_reset_all(ctx);
diff --git a/src/gallium/drivers/zink/zink_screen.c b/src/gallium/drivers/zink/zink_screen.c
index 8566fa5c673..68b752bf8c2 100644
--- a/src/gallium/drivers/zink/zink_screen.c
+++ b/src/gallium/drivers/zink/zink_screen.c
@@ -1494,7 +1494,9 @@ zink_internal_create_screen(const struct pipe_screen_config *config)
screen->driconf.dual_color_blend_by_location = driQueryOptionb(config->options, "dual_color_blend_by_location");
#endif
- screen->total_mem = get_video_mem(screen);
+ screen->total_video_mem = get_video_mem(screen);
+ if (!os_get_total_physical_memory(&screen->total_mem))
+ goto fail;
simple_mtx_init(&screen->surface_mtx, mtx_plain);
simple_mtx_init(&screen->bufferview_mtx, mtx_plain);
diff --git a/src/gallium/drivers/zink/zink_screen.h b/src/gallium/drivers/zink/zink_screen.h
index 72fbeae8d0b..b14658cb5e3 100644
--- a/src/gallium/drivers/zink/zink_screen.h
+++ b/src/gallium/drivers/zink/zink_screen.h
@@ -76,6 +76,7 @@ struct zink_screen {
unsigned shader_id;
+ uint64_t total_video_mem;
uint64_t total_mem;
VkInstance instance;