diff options
author | Vasily Khoruzhick <anarsoul@gmail.com> | 2020-03-03 22:05:52 -0800 |
---|---|---|
committer | Marge Bot <eric+marge@anholt.net> | 2020-03-10 02:41:27 +0000 |
commit | 251c6991a3a3b6f25239ef746f786e91a7553798 (patch) | |
tree | a67ec86684ce7509160390fb0f427e21e1232fa1 /src/gallium/drivers/lima/lima_draw.c | |
parent | 53d6bb9fc633a4d0ad99c25ac4a9ca09f12d87bf (diff) | |
download | mesa-251c6991a3a3b6f25239ef746f786e91a7553798.tar.gz |
lima: enable minmax cache for index buffers
Re-use minmax cache for index buffers from panfrost.
Reviewed-by: Andreas Baierl <ichgeh@imkreisrum.de>
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4051>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4051>
Diffstat (limited to 'src/gallium/drivers/lima/lima_draw.c')
-rw-r--r-- | src/gallium/drivers/lima/lima_draw.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/gallium/drivers/lima/lima_draw.c b/src/gallium/drivers/lima/lima_draw.c index 12059cb1c62..637d5ec59d0 100644 --- a/src/gallium/drivers/lima/lima_draw.c +++ b/src/gallium/drivers/lima/lima_draw.c @@ -45,6 +45,8 @@ #include "lima_util.h" #include "lima_gpu.h" +#include "pan_minmax_cache.h" + #include <drm-uapi/lima_drm.h> static bool @@ -1007,14 +1009,14 @@ lima_draw_vbo_indexed(struct pipe_context *pctx, struct lima_context *ctx = lima_context(pctx); struct lima_job *job = lima_job_get(ctx); struct pipe_resource *indexbuf = NULL; + bool needs_indices = true; /* Mali Utgard GPU always need min/max index info for index draw, * compute it if upper layer does not do for us */ - if (info->max_index == ~0u) - u_vbuf_get_minmax_index(pctx, info, &ctx->min_index, &ctx->max_index); - else { + if (info->max_index != ~0u) { ctx->min_index = info->min_index; ctx->max_index = info->max_index; + needs_indices = false; } if (info->has_user_indices) { @@ -1024,6 +1026,15 @@ lima_draw_vbo_indexed(struct pipe_context *pctx, else { ctx->index_res = lima_resource(info->index.resource); ctx->index_offset = 0; + needs_indices = !panfrost_minmax_cache_get(ctx->index_res->index_cache, info->start, + info->count, &ctx->min_index, &ctx->max_index); + } + + if (needs_indices) { + u_vbuf_get_minmax_index(pctx, info, &ctx->min_index, &ctx->max_index); + if (!info->has_user_indices) + panfrost_minmax_cache_add(ctx->index_res->index_cache, info->start, info->count, + ctx->min_index, ctx->max_index); } lima_job_add_bo(job, LIMA_PIPE_GP, ctx->index_res->bo, LIMA_SUBMIT_BO_READ); |