i965: Change intel_batchbuffer_reloc() into brw_emit_reloc().

This renames intel_batchbuffer_reloc to brw_emit_reloc and changes the
parameter naming and ordering to match drm_intel_bo_emit_reloc().

For now, it's a trivial wrapper that accesses batch->bo.  When we
rework relocations, it will start doing actual work.

target_offset should be expanded to a uint64_t to match the kernel,
but for now we leave it as its original 32-bit type.

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
This commit is contained in:
Kenneth Graunke 2017-03-28 15:03:49 -07:00
parent fbb3297165
commit eadd5d1b51
3 changed files with 18 additions and 22 deletions

View file

@ -55,10 +55,10 @@ blorp_emit_reloc(struct blorp_batch *batch,
struct brw_context *brw = batch->driver_batch; struct brw_context *brw = batch->driver_batch;
uint32_t offset = (char *)location - (char *)brw->batch.map; uint32_t offset = (char *)location - (char *)brw->batch.map;
return intel_batchbuffer_reloc(&brw->batch, address.buffer, offset, return brw_emit_reloc(&brw->batch, offset,
address.read_domains, address.buffer, address.offset + delta,
address.write_domain, address.read_domains,
address.offset + delta); address.write_domain);
} }
static void static void

View file

@ -580,16 +580,15 @@ _intel_batchbuffer_flush_fence(struct brw_context *brw,
/* This is the only way buffers get added to the validate list. /* This is the only way buffers get added to the validate list.
*/ */
uint64_t uint64_t
intel_batchbuffer_reloc(struct intel_batchbuffer *batch, brw_emit_reloc(struct intel_batchbuffer *batch, uint32_t batch_offset,
drm_bacon_bo *buffer, uint32_t offset, drm_bacon_bo *target, uint32_t target_offset,
uint32_t read_domains, uint32_t write_domain, uint32_t read_domains, uint32_t write_domain)
uint32_t delta)
{ {
int ret; int ret;
ret = drm_bacon_bo_emit_reloc(batch->bo, offset, ret = drm_bacon_bo_emit_reloc(batch->bo, batch_offset,
buffer, delta, target, target_offset,
read_domains, write_domain); read_domains, write_domain);
assert(ret == 0); assert(ret == 0);
(void)ret; (void)ret;
@ -597,7 +596,7 @@ intel_batchbuffer_reloc(struct intel_batchbuffer *batch,
* case the buffer doesn't move and we can short-circuit the relocation * case the buffer doesn't move and we can short-circuit the relocation
* processing in the kernel * processing in the kernel
*/ */
return buffer->offset64 + delta; return target->offset64 + target_offset;
} }
void void

View file

@ -65,12 +65,9 @@ void intel_batchbuffer_data(struct brw_context *brw,
const void *data, GLuint bytes, const void *data, GLuint bytes,
enum brw_gpu_ring ring); enum brw_gpu_ring ring);
uint64_t intel_batchbuffer_reloc(struct intel_batchbuffer *batch, uint64_t brw_emit_reloc(struct intel_batchbuffer *batch, uint32_t batch_offset,
drm_bacon_bo *buffer, drm_bacon_bo *target, uint32_t target_offset,
uint32_t offset, uint32_t read_domains, uint32_t write_domain);
uint32_t read_domains,
uint32_t write_domain,
uint32_t delta);
#define USED_BATCH(batch) ((uintptr_t)((batch).map_next - (batch).map)) #define USED_BATCH(batch) ((uintptr_t)((batch).map_next - (batch).map))
@ -159,8 +156,8 @@ intel_batchbuffer_advance(struct brw_context *brw)
#define OUT_RELOC(buf, read_domains, write_domain, delta) do { \ #define OUT_RELOC(buf, read_domains, write_domain, delta) do { \
uint32_t __offset = (__map - brw->batch.map) * 4; \ uint32_t __offset = (__map - brw->batch.map) * 4; \
uint32_t reloc = \ uint32_t reloc = \
intel_batchbuffer_reloc(&brw->batch, (buf), __offset, \ brw_emit_reloc(&brw->batch, __offset, (buf), (delta), \
(read_domains), (write_domain), (delta)); \ (read_domains), (write_domain)); \
OUT_BATCH(reloc); \ OUT_BATCH(reloc); \
} while (0) } while (0)
@ -168,8 +165,8 @@ intel_batchbuffer_advance(struct brw_context *brw)
#define OUT_RELOC64(buf, read_domains, write_domain, delta) do { \ #define OUT_RELOC64(buf, read_domains, write_domain, delta) do { \
uint32_t __offset = (__map - brw->batch.map) * 4; \ uint32_t __offset = (__map - brw->batch.map) * 4; \
uint64_t reloc64 = \ uint64_t reloc64 = \
intel_batchbuffer_reloc(&brw->batch, (buf), __offset, \ brw_emit_reloc(&brw->batch, __offset, (buf), (delta), \
(read_domains), (write_domain), (delta)); \ (read_domains), (write_domain)); \
OUT_BATCH(reloc64); \ OUT_BATCH(reloc64); \
OUT_BATCH(reloc64 >> 32); \ OUT_BATCH(reloc64 >> 32); \
} while (0) } while (0)