asahi: Compute segment list length

Quiesces agxdecode error introduced in previous commit.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16512>
This commit is contained in:
Alyssa Rosenzweig 2022-04-02 22:23:57 -04:00
parent 1e42e4a390
commit 8da2fdc889
1 changed files with 8 additions and 1 deletions

View File

@ -277,10 +277,17 @@ demo_cmdbuf(uint64_t *buf, size_t size,
static struct agx_map_header
demo_map_header(uint64_t cmdbuf_id, uint64_t encoder_id, unsigned cmdbuf_size, unsigned count)
{
/* Structure: header followed by resource groups. For now, we use a single
* resource group for every resource. This could be optimized.
*/
unsigned length = sizeof(struct agx_map_header);
length += count * sizeof(struct agx_map_entry);
assert(length < 0x10000);
return (struct agx_map_header) {
.cmdbuf_id = cmdbuf_id,
.segment_count = 1,
.length = 0x130,
.length = length,
.encoder_id = encoder_id,
.kernel_commands_start_offset = 0,
.kernel_commands_end_offset = cmdbuf_size,