summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/ilo
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2015-01-25 18:04:25 +0800
committerChia-I Wu <[email protected]>2015-02-12 07:56:11 +0800
commitbfc8a726096c752f15b1e2f1043fe284f0effb18 (patch)
tree3e5fdc92f1e63a93415095603439abd6bc8e6215 /src/gallium/drivers/ilo
parenta7911620f61a10f6297155d58445ed146bbcb056 (diff)
ilo: add functions for Gen8 relocs
Extend ilo_builder_writer_reloc() for Gen8 memory addressing. Add new wrappers, ilo_builder_surface_reloc64(() and ilo_builder_batch_reloc64().
Diffstat (limited to 'src/gallium/drivers/ilo')
-rw-r--r--src/gallium/drivers/ilo/ilo_builder.h45
1 files changed, 39 insertions, 6 deletions
diff --git a/src/gallium/drivers/ilo/ilo_builder.h b/src/gallium/drivers/ilo/ilo_builder.h
index c11dba2d616..0de7b5dedc6 100644
--- a/src/gallium/drivers/ilo/ilo_builder.h
+++ b/src/gallium/drivers/ilo/ilo_builder.h
@@ -244,12 +244,18 @@ static inline void
ilo_builder_writer_reloc(struct ilo_builder *builder,
enum ilo_builder_writer_type which,
unsigned offset, struct intel_bo *bo,
- unsigned bo_offset, unsigned reloc_flags)
+ unsigned bo_offset, unsigned reloc_flags,
+ bool write_presumed_offset_hi)
{
struct ilo_builder_writer *writer = &builder->writers[which];
uint64_t presumed_offset;
int err;
+ if (write_presumed_offset_hi)
+ ILO_DEV_ASSERT(builder->dev, 8, 8);
+ else
+ ILO_DEV_ASSERT(builder->dev, 6, 7.5);
+
assert(offset + sizeof(uint32_t) <= writer->used ||
(offset >= writer->size - writer->stolen &&
offset + sizeof(uint32_t) <= writer->size));
@@ -259,9 +265,13 @@ ilo_builder_writer_reloc(struct ilo_builder *builder,
if (unlikely(err))
builder->unrecoverable_error = true;
- /* 32-bit addressing */
- assert(presumed_offset == (uint64_t) ((uint32_t) presumed_offset));
- *((uint32_t *) ((char *) writer->ptr + offset)) = presumed_offset;
+ if (write_presumed_offset_hi) {
+ *((uint64_t *) ((char *) writer->ptr + offset)) = presumed_offset;
+ } else {
+ /* 32-bit addressing */
+ assert(presumed_offset == (uint64_t) ((uint32_t) presumed_offset));
+ *((uint32_t *) ((char *) writer->ptr + offset)) = presumed_offset;
+ }
}
/**
@@ -369,7 +379,19 @@ ilo_builder_surface_reloc(struct ilo_builder *builder,
const enum ilo_builder_writer_type which = ILO_BUILDER_WRITER_BATCH;
ilo_builder_writer_reloc(builder, which, offset + (dw_index << 2),
- bo, bo_offset, reloc_flags);
+ bo, bo_offset, reloc_flags, false);
+}
+
+static inline void
+ilo_builder_surface_reloc64(struct ilo_builder *builder,
+ uint32_t offset, unsigned dw_index,
+ struct intel_bo *bo, unsigned bo_offset,
+ unsigned reloc_flags)
+{
+ const enum ilo_builder_writer_type which = ILO_BUILDER_WRITER_BATCH;
+
+ ilo_builder_writer_reloc(builder, which, offset + (dw_index << 2),
+ bo, bo_offset, reloc_flags, true);
}
static inline unsigned
@@ -470,7 +492,18 @@ ilo_builder_batch_reloc(struct ilo_builder *builder, unsigned pos,
const enum ilo_builder_writer_type which = ILO_BUILDER_WRITER_BATCH;
ilo_builder_writer_reloc(builder, which, pos << 2,
- bo, bo_offset, reloc_flags);
+ bo, bo_offset, reloc_flags, false);
+}
+
+static inline void
+ilo_builder_batch_reloc64(struct ilo_builder *builder, unsigned pos,
+ struct intel_bo *bo, unsigned bo_offset,
+ unsigned reloc_flags)
+{
+ const enum ilo_builder_writer_type which = ILO_BUILDER_WRITER_BATCH;
+
+ ilo_builder_writer_reloc(builder, which, pos << 2,
+ bo, bo_offset, reloc_flags, true);
}
static inline unsigned