[igt-dev] [PATCH i-g-t v14 14/33] lib/intel_aux_pgtable: Get addresses for aux table from an allocator
Zbigniew Kempczyński
zbigniew.kempczynski at intel.com
Thu Jan 14 12:22:14 UTC 2021
Use intel_buf which now allows passing expected alignment required
for aux table and acquire appropriate address from an allocator.
With simple allocator we try to use high offsets from default
to exercise canonizing/decanonizing is working properly.
Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
Cc: Dominik Grzegorzek <dominik.grzegorzek at intel.com>
Cc: Chris Wilson <chris at chris-wilson.co.uk>
---
lib/intel_aux_pgtable.c | 26 +++++++++++---------------
1 file changed, 11 insertions(+), 15 deletions(-)
diff --git a/lib/intel_aux_pgtable.c b/lib/intel_aux_pgtable.c
index c05d4511e..f29a30916 100644
--- a/lib/intel_aux_pgtable.c
+++ b/lib/intel_aux_pgtable.c
@@ -94,9 +94,9 @@ pgt_table_count(int address_bits, struct intel_buf **bufs, int buf_count)
/* We require bufs to be sorted. */
igt_assert(i == 0 ||
buf->addr.offset >= bufs[i - 1]->addr.offset +
- intel_buf_bo_size(bufs[i - 1]));
-
+ intel_buf_bo_size(bufs[i - 1]));
start = ALIGN_DOWN(buf->addr.offset, 1UL << address_bits);
+
/* Avoid double counting for overlapping aligned bufs. */
start = max(start, end);
@@ -346,10 +346,8 @@ pgt_populate_entries_for_buf(struct pgtable *pgt,
uint64_t top_table,
int surface_idx)
{
- uint64_t surface_addr = buf->addr.offset +
- buf->surface[surface_idx].offset;
- uint64_t surface_end = surface_addr +
- buf->surface[surface_idx].size;
+ uint64_t surface_addr = buf->addr.offset + buf->surface[surface_idx].offset;
+ uint64_t surface_end = surface_addr + buf->surface[surface_idx].size;
uint64_t aux_addr = buf->addr.offset + buf->ccs[surface_idx].offset;
uint64_t l1_flags = pgt_get_l1_flags(buf, surface_idx);
uint64_t lx_flags = pgt_get_lx_flags();
@@ -441,7 +439,6 @@ struct intel_buf *
intel_aux_pgtable_create(struct intel_bb *ibb,
struct intel_buf **bufs, int buf_count)
{
- struct drm_i915_gem_exec_object2 *obj;
static const struct pgtable_level_desc level_desc[] = {
{
.idx_shift = 16,
@@ -465,7 +462,6 @@ intel_aux_pgtable_create(struct intel_bb *ibb,
struct pgtable *pgt;
struct buf_ops *bops;
struct intel_buf *buf;
- uint64_t prev_alignment;
igt_assert(buf_count);
bops = bufs[0]->bops;
@@ -476,11 +472,8 @@ intel_aux_pgtable_create(struct intel_bb *ibb,
I915_COMPRESSION_NONE);
/* We need to use pgt->max_align for aux table */
- prev_alignment = intel_bb_set_default_object_alignment(ibb,
- pgt->max_align);
- obj = intel_bb_add_intel_buf(ibb, pgt->buf, false);
- intel_bb_set_default_object_alignment(ibb, prev_alignment);
- obj->alignment = pgt->max_align;
+ intel_bb_add_intel_buf_with_alignment(ibb, pgt->buf,
+ pgt->max_align, false);
pgt_map(ibb->i915, pgt);
pgt_populate_entries(pgt, bufs, buf_count);
@@ -498,9 +491,10 @@ aux_pgtable_reserve_buf_slot(struct intel_buf **bufs, int buf_count,
{
int i;
- for (i = 0; i < buf_count; i++)
+ for (i = 0; i < buf_count; i++) {
if (bufs[i]->addr.offset > new_buf->addr.offset)
break;
+ }
memmove(&bufs[i + 1], &bufs[i], sizeof(bufs[0]) * (buf_count - i));
@@ -606,8 +600,10 @@ gen12_aux_pgtable_cleanup(struct intel_bb *ibb, struct aux_pgtable_info *info)
igt_assert_eq_u64(addr, info->buf_pin_offsets[i]);
}
- if (info->pgtable_buf)
+ if (info->pgtable_buf) {
+ intel_bb_remove_intel_buf(ibb, info->pgtable_buf);
intel_buf_destroy(info->pgtable_buf);
+ }
}
uint32_t
--
2.26.0
More information about the igt-dev
mailing list