mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-06 11:00:11 +01:00
lima: limit number of draws per job
Otherwise we may hit tile heap size limit if an app issues too many draws per job. Reviewed-by: Erico Nunes <nunes.erico@gmail.com> Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10121>
This commit is contained in:
parent
c8e80c24d4
commit
77fdabdfa5
3 changed files with 18 additions and 2 deletions
|
|
@ -1183,6 +1183,17 @@ lima_draw_vbo(struct pipe_context *pctx,
|
|||
lima_draw_vbo_indexed(pctx, info, &draws[0]);
|
||||
else
|
||||
lima_draw_vbo_count(pctx, info, &draws[0]);
|
||||
|
||||
job->draws++;
|
||||
/* Flush job if we hit the limit of draws per job otherwise we may
|
||||
* hit tile heap size limit */
|
||||
if (job->draws > MAX_DRAWS_PER_JOB) {
|
||||
unsigned resolve = job->resolve;
|
||||
lima_do_job(job);
|
||||
job = lima_job_get(ctx);
|
||||
/* Subsequent job will need to resolve the same buffers */
|
||||
lima_update_job_wb(ctx, resolve);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -99,6 +99,7 @@ lima_job_create(struct lima_context *ctx)
|
|||
|
||||
s->damage_rect.minx = s->damage_rect.miny = 0xffff;
|
||||
s->damage_rect.maxx = s->damage_rect.maxy = 0;
|
||||
s->draws = 0;
|
||||
|
||||
s->clear.depth = 0x00ffffff;
|
||||
|
||||
|
|
@ -301,7 +302,7 @@ lima_job_get_damage(struct lima_job *job)
|
|||
static bool
|
||||
lima_fb_cbuf_needs_reload(struct lima_job *job)
|
||||
{
|
||||
if (!(job->key.cbuf && (job->resolve & PIPE_CLEAR_COLOR0)))
|
||||
if (!job->key.cbuf)
|
||||
return false;
|
||||
|
||||
struct lima_surface *surf = lima_surface(job->key.cbuf);
|
||||
|
|
@ -323,7 +324,7 @@ lima_fb_cbuf_needs_reload(struct lima_job *job)
|
|||
static bool
|
||||
lima_fb_zsbuf_needs_reload(struct lima_job *job)
|
||||
{
|
||||
if (!(job->key.zsbuf && (job->resolve & (PIPE_CLEAR_DEPTH | PIPE_CLEAR_STENCIL))))
|
||||
if (!job->key.zsbuf)
|
||||
return false;
|
||||
|
||||
struct lima_surface *surf = lima_surface(job->key.zsbuf);
|
||||
|
|
|
|||
|
|
@ -31,6 +31,8 @@
|
|||
|
||||
#include <pipe/p_state.h>
|
||||
|
||||
#define MAX_DRAWS_PER_JOB 2500
|
||||
|
||||
struct lima_context;
|
||||
struct lima_bo;
|
||||
struct lima_dump;
|
||||
|
|
@ -80,6 +82,8 @@ struct lima_job {
|
|||
|
||||
struct lima_job_fb_info fb;
|
||||
|
||||
int draws;
|
||||
|
||||
/* for dump command stream */
|
||||
struct lima_dump *dump;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue