v3d: save only required states in blitter
Some blitter operations, like clear, doesn't require to save all the states. This is particular important because, besides saving time, the blitter operation restores the state required for the operation, and if we saved more states than those, these ones won't be restored and will be leak. So this also fixes some leaks when running CTS tests. CC: mesa-stable Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com> Reviewed-by: Iago Toral Quiroga <itoral@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16837>
This commit is contained in:
committed by
Marge Bot
parent
92474951a3
commit
695f66cecd
@@ -29,8 +29,15 @@
|
||||
#include "broadcom/common/v3d_tiling.h"
|
||||
#include "broadcom/common/v3d_tfu.h"
|
||||
|
||||
/**
|
||||
* The param @op_blit is used to tell if we are saving state for blitter_blit
|
||||
* (if true) or blitter_clear (if false). If other blitter functions are used
|
||||
* that require different state we may need something more elaborated than
|
||||
* this.
|
||||
*/
|
||||
|
||||
void
|
||||
v3d_blitter_save(struct v3d_context *v3d)
|
||||
v3d_blitter_save(struct v3d_context *v3d, bool op_blit)
|
||||
{
|
||||
util_blitter_save_fragment_constant_buffer_slot(v3d->blitter,
|
||||
v3d->constbuf[PIPE_SHADER_FRAGMENT].cb);
|
||||
@@ -42,21 +49,24 @@ v3d_blitter_save(struct v3d_context *v3d)
|
||||
v3d->streamout.targets);
|
||||
util_blitter_save_rasterizer(v3d->blitter, v3d->rasterizer);
|
||||
util_blitter_save_viewport(v3d->blitter, &v3d->viewport);
|
||||
util_blitter_save_scissor(v3d->blitter, &v3d->scissor);
|
||||
util_blitter_save_fragment_shader(v3d->blitter, v3d->prog.bind_fs);
|
||||
util_blitter_save_blend(v3d->blitter, v3d->blend);
|
||||
util_blitter_save_depth_stencil_alpha(v3d->blitter, v3d->zsa);
|
||||
util_blitter_save_stencil_ref(v3d->blitter, &v3d->stencil_ref);
|
||||
util_blitter_save_sample_mask(v3d->blitter, v3d->sample_mask, 0);
|
||||
util_blitter_save_framebuffer(v3d->blitter, &v3d->framebuffer);
|
||||
util_blitter_save_fragment_sampler_states(v3d->blitter,
|
||||
v3d->tex[PIPE_SHADER_FRAGMENT].num_samplers,
|
||||
(void **)v3d->tex[PIPE_SHADER_FRAGMENT].samplers);
|
||||
util_blitter_save_fragment_sampler_views(v3d->blitter,
|
||||
v3d->tex[PIPE_SHADER_FRAGMENT].num_textures,
|
||||
v3d->tex[PIPE_SHADER_FRAGMENT].textures);
|
||||
util_blitter_save_so_targets(v3d->blitter, v3d->streamout.num_targets,
|
||||
v3d->streamout.targets);
|
||||
|
||||
if (op_blit) {
|
||||
util_blitter_save_scissor(v3d->blitter, &v3d->scissor);
|
||||
util_blitter_save_framebuffer(v3d->blitter, &v3d->framebuffer);
|
||||
util_blitter_save_fragment_sampler_states(v3d->blitter,
|
||||
v3d->tex[PIPE_SHADER_FRAGMENT].num_samplers,
|
||||
(void **)v3d->tex[PIPE_SHADER_FRAGMENT].samplers);
|
||||
util_blitter_save_fragment_sampler_views(v3d->blitter,
|
||||
v3d->tex[PIPE_SHADER_FRAGMENT].num_textures,
|
||||
v3d->tex[PIPE_SHADER_FRAGMENT].textures);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -110,7 +120,7 @@ v3d_render_blit(struct pipe_context *ctx, struct pipe_blit_info *info)
|
||||
return;
|
||||
}
|
||||
|
||||
v3d_blitter_save(v3d);
|
||||
v3d_blitter_save(v3d, true);
|
||||
util_blitter_blit(v3d->blitter, info);
|
||||
|
||||
pipe_resource_reference(&tiled, NULL);
|
||||
@@ -178,7 +188,7 @@ v3d_stencil_blit(struct pipe_context *ctx, struct pipe_blit_info *info)
|
||||
struct pipe_sampler_view *src_view =
|
||||
ctx->create_sampler_view(ctx, &src->base, &src_tmpl);
|
||||
|
||||
v3d_blitter_save(v3d);
|
||||
v3d_blitter_save(v3d, true);
|
||||
util_blitter_blit_generic(v3d->blitter, dst_surf, &info->dst.box,
|
||||
src_view, &info->src.box,
|
||||
src->base.width0, src->base.height0,
|
||||
@@ -761,7 +771,7 @@ v3d_sand8_blit(struct pipe_context *pctx, struct pipe_blit_info *info)
|
||||
assert(info->src.box.width == info->dst.box.width);
|
||||
assert(info->src.box.height == info->dst.box.height);
|
||||
|
||||
v3d_blitter_save(v3d);
|
||||
v3d_blitter_save(v3d, true);
|
||||
|
||||
struct pipe_surface dst_tmpl;
|
||||
util_blitter_default_dst_texture(&dst_tmpl, info->dst.resource,
|
||||
|
||||
@@ -767,7 +767,7 @@ bool v3d_format_supports_tlb_msaa_resolve(const struct v3d_device_info *devinfo,
|
||||
|
||||
void v3d_init_query_functions(struct v3d_context *v3d);
|
||||
void v3d_blit(struct pipe_context *pctx, const struct pipe_blit_info *blit_info);
|
||||
void v3d_blitter_save(struct v3d_context *v3d);
|
||||
void v3d_blitter_save(struct v3d_context *v3d, bool op_blit);
|
||||
bool v3d_generate_mipmap(struct pipe_context *pctx,
|
||||
struct pipe_resource *prsc,
|
||||
enum pipe_format format,
|
||||
|
||||
@@ -1549,7 +1549,7 @@ v3d_draw_clear(struct v3d_context *v3d,
|
||||
if (!color)
|
||||
color = &dummy_color;
|
||||
|
||||
v3d_blitter_save(v3d);
|
||||
v3d_blitter_save(v3d, false);
|
||||
util_blitter_clear(v3d->blitter,
|
||||
v3d->framebuffer.width,
|
||||
v3d->framebuffer.height,
|
||||
|
||||
Reference in New Issue
Block a user