Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion src/asahi/lib/agx_tilebuffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -889,12 +889,33 @@ agx_tilebuffer_compact(const struct agx_tilebuffer_layout *src,
if (!src || !dst)
return 0;

/* Fast path for already-compact layouts (e.g. RT0 only or RT0..k-1
* contiguous): avoid copying the struct twice and zeroing arrays. */
unsigned count = 0;
bool compact = true;
for (unsigned rt = 0; rt < AGX_MAX_RENDER_TARGETS; ++rt) {
if (src->logical_format[rt] != PIPE_FORMAT_NONE) {
if (rt != count) {
compact = false;
break;
}
if (map)
map[count] = rt;
++count;
}
}
if (compact) {
if (dst != src)
*dst = *src;
return count;
}

const struct agx_tilebuffer_layout original = *src;
*dst = original;
memset(dst->logical_format, 0, sizeof(dst->logical_format));
memset(dst->spilled, 0, sizeof(dst->spilled));
memset(dst->_offset_B, 0, sizeof(dst->_offset_B));
unsigned count = 0;
count = 0;
for (unsigned rt = 0; rt < AGX_MAX_RENDER_TARGETS; ++rt) {
if (original.logical_format[rt] == PIPE_FORMAT_NONE)
continue;
Expand Down
Loading