#include "util/format/u_format.h"
#include "util/half_float.h"
#include "util/u_drm.h"
+#include "util/u_gen_mipmap.h"
#include "util/u_inlines.h"
#include "util/u_memory.h"
#include "util/u_screen.h"
FREE(transfer);
}
+static bool
+agx_generate_mipmap(struct pipe_context *pctx, struct pipe_resource *prsrc,
+ enum pipe_format format, unsigned base_level,
+ unsigned last_level, unsigned first_layer,
+ unsigned last_layer)
+{
+ struct agx_resource *rsrc = agx_resource(prsrc);
+
+ /* Generating a mipmap invalidates the written levels. Make that
+ * explicit so we don't reload the previous contents.
+ */
+ for (unsigned l = base_level + 1; l <= last_level; ++l)
+ BITSET_CLEAR(rsrc->data_valid, l);
+
+ /* For now we use util_gen_mipmap, but this has way too much overhead */
+ perf_debug_ctx(agx_context(pctx), "Unoptimized mipmap generation");
+
+ return util_gen_mipmap(pctx, prsrc, format, base_level, last_level,
+ first_layer, last_layer, PIPE_TEX_FILTER_LINEAR);
+}
+
/*
* clear/copy
*/
pctx->clear = agx_clear;
pctx->resource_copy_region = util_resource_copy_region;
pctx->blit = agx_blit;
+ pctx->generate_mipmap = agx_generate_mipmap;
pctx->flush_resource = agx_flush_resource;
pctx->buffer_map = u_transfer_helper_transfer_map;
return 1;
case PIPE_CAP_OCCLUSION_QUERY:
+ case PIPE_CAP_GENERATE_MIPMAP:
case PIPE_CAP_PRIMITIVE_RESTART:
case PIPE_CAP_PRIMITIVE_RESTART_FIXED_INDEX:
case PIPE_CAP_ANISOTROPIC_FILTER: