etnaviv: split adding resource to context flush set into own function
It is needed in a few more places, so split it into a separate function to make it reusable. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20012>
This commit is contained in:
@@ -52,6 +52,7 @@
|
||||
#include "util/u_blitter.h"
|
||||
#include "util/u_draw.h"
|
||||
#include "util/u_helpers.h"
|
||||
#include "util/u_inlines.h"
|
||||
#include "util/u_memory.h"
|
||||
#include "util/u_prim.h"
|
||||
#include "util/u_upload_mgr.h"
|
||||
@@ -546,6 +547,18 @@ etna_context_force_flush(struct etna_cmd_stream *stream, void *priv)
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
etna_context_add_flush_resource(struct etna_context *ctx,
|
||||
struct pipe_resource *rsc)
|
||||
{
|
||||
bool found;
|
||||
|
||||
_mesa_set_search_or_add(ctx->flush_resources, rsc, &found);
|
||||
|
||||
if (!found)
|
||||
pipe_reference(NULL, &rsc->reference);
|
||||
}
|
||||
|
||||
static void
|
||||
etna_set_debug_callback(struct pipe_context *pctx,
|
||||
const struct util_debug_callback *cb)
|
||||
|
@@ -216,4 +216,8 @@ etna_transfer(struct pipe_transfer *p)
|
||||
struct pipe_context *
|
||||
etna_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags);
|
||||
|
||||
void
|
||||
etna_context_add_flush_resource(struct etna_context *ctx,
|
||||
struct pipe_resource *rsc);
|
||||
|
||||
#endif
|
||||
|
@@ -803,14 +803,8 @@ etna_record_flush_resources(struct etna_context *ctx)
|
||||
if (fb->nr_cbufs > 0) {
|
||||
struct etna_surface *surf = etna_surface(fb->cbufs[0]);
|
||||
|
||||
if (!etna_resource(surf->prsc)->explicit_flush) {
|
||||
bool found;
|
||||
|
||||
_mesa_set_search_or_add(ctx->flush_resources, surf->prsc, &found);
|
||||
|
||||
if (!found)
|
||||
pipe_reference(NULL, &surf->prsc->reference);
|
||||
}
|
||||
if (!etna_resource(surf->prsc)->explicit_flush)
|
||||
etna_context_add_flush_resource(ctx, surf->prsc);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user