/* failure is expected in some cases.. */
}
+ if (prsc->target == PIPE_BUFFER) {
+ assert(rsc->layout.tiling == AIL_TILING_LINEAR);
+ util_range_init(&rsc->valid_buffer_range);
+ }
+
return prsc;
}
ail_make_miptree(&nresource->layout);
+ if (templ->target == PIPE_BUFFER) {
+ assert(nresource->layout.tiling == AIL_TILING_LINEAR);
+ util_range_init(&nresource->valid_buffer_range);
+ }
+
if (dev->ro && (templ->bind & PIPE_BIND_SCANOUT)) {
struct winsys_handle handle;
assert(util_format_get_blockwidth(templ->format) == 1);
struct agx_resource *rsrc = (struct agx_resource *)prsrc;
struct agx_screen *agx_screen = (struct agx_screen *)screen;
+ if (prsrc->target == PIPE_BUFFER)
+ util_range_destroy(&rsrc->valid_buffer_range);
+
if (rsrc->dt) {
/* display target */
struct sw_winsys *winsys = agx_screen->winsys;
if (!(usage & PIPE_MAP_WRITE))
return;
+ /* If the range being written is uninitialized, we do not need to sync. */
+ if (rsrc->base.target == PIPE_BUFFER && !(rsrc->bo->flags & AGX_BO_SHARED) &&
+ !util_ranges_intersect(&rsrc->valid_buffer_range, box->x,
+ box->x + box->width))
+ return;
+
/* If there are no readers, we're done. We check at the start to
* avoid expensive shadowing paths or duplicated checks in this hapyp path.
*/
agx_prepare_for_map(ctx, rsrc, level, usage, box);
+ /* Track the written buffer range */
+ if (resource->target == PIPE_BUFFER) {
+ /* Note the ordering: DISCARD|WRITE is valid, so clear before adding. */
+ if (usage & PIPE_MAP_DISCARD_WHOLE_RESOURCE)
+ util_range_set_empty(&rsrc->valid_buffer_range);
+ if (usage & PIPE_MAP_WRITE) {
+ util_range_add(resource, &rsrc->valid_buffer_range, box->x,
+ box->x + box->width);
+ }
+ }
+
struct agx_transfer *transfer = CALLOC_STRUCT(agx_transfer);
transfer->base.level = level;
transfer->base.usage = usage;
#include "util/bitset.h"
#include "util/disk_cache.h"
#include "util/hash_table.h"
+#include "util/u_range.h"
#include "agx_meta.h"
struct agx_streamout_target {
* resources.
*/
struct agx_resource *separate_stencil;
+
+ /* Valid buffer range tracking, to optimize buffer appends */
+ struct util_range valid_buffer_range;
};
static inline struct agx_resource *