diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2023-01-09 04:24:24 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2023-01-09 04:24:24 +0000 |
commit | 36a879c02b5b4aacedb3c0e3f5293a0bc9722fb8 (patch) | |
tree | 7e1618dd798114729b68424f491974a37c9199b5 /sys | |
parent | 0e54b9025f341712bbb240e12dacaba012b150cf (diff) |
drm/i915/migrate: Account for the reserved_space
From Chris Wilson
6e6d577cd90b27a98ce9f06ed96bca7b59d210f0 in linux-6.1.y/6.1.4
31a2e6cbe8a4eb0d1650fff4b77872b744e14a62 in mainline linux
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/pci/drm/i915/gt/intel_migrate.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/sys/dev/pci/drm/i915/gt/intel_migrate.c b/sys/dev/pci/drm/i915/gt/intel_migrate.c index aaaf1906026..ee072c7d62e 100644 --- a/sys/dev/pci/drm/i915/gt/intel_migrate.c +++ b/sys/dev/pci/drm/i915/gt/intel_migrate.c @@ -341,6 +341,16 @@ static int emit_no_arbitration(struct i915_request *rq) return 0; } +static int max_pte_pkt_size(struct i915_request *rq, int pkt) +{ + struct intel_ring *ring = rq->ring; + + pkt = min_t(int, pkt, (ring->space - rq->reserved_space) / sizeof(u32) + 5); + pkt = min_t(int, pkt, (ring->size - ring->emit) / sizeof(u32) + 5); + + return pkt; +} + static int emit_pte(struct i915_request *rq, struct sgt_dma *it, enum i915_cache_level cache_level, @@ -387,8 +397,7 @@ static int emit_pte(struct i915_request *rq, return PTR_ERR(cs); /* Pack as many PTE updates as possible into a single MI command */ - pkt = min_t(int, dword_length, ring->space / sizeof(u32) + 5); - pkt = min_t(int, pkt, (ring->size - ring->emit) / sizeof(u32) + 5); + pkt = max_pte_pkt_size(rq, dword_length); hdr = cs; *cs++ = MI_STORE_DATA_IMM | REG_BIT(21); /* as qword elements */ @@ -421,8 +430,7 @@ static int emit_pte(struct i915_request *rq, } } - pkt = min_t(int, dword_rem, ring->space / sizeof(u32) + 5); - pkt = min_t(int, pkt, (ring->size - ring->emit) / sizeof(u32) + 5); + pkt = max_pte_pkt_size(rq, dword_rem); hdr = cs; *cs++ = MI_STORE_DATA_IMM | REG_BIT(21); |