}
static unsigned
-decode_get_state_size(void *v_brw, uint32_t offset_from_dsba)
+decode_get_state_size(void *v_brw, uint64_t address, uint64_t base_address)
{
struct brw_context *brw = v_brw;
struct intel_batchbuffer *batch = &brw->batch;
- struct hash_entry *entry =
- _mesa_hash_table_search(batch->state_batch_sizes,
- (void *) (uintptr_t) offset_from_dsba);
- return entry ? (uintptr_t) entry->data : 0;
-}
-
-static bool
-uint_key_compare(const void *a, const void *b)
-{
- return a == b;
-}
-
-static uint32_t
-uint_key_hash(const void *key)
-{
- return (uintptr_t) key;
+ unsigned size = (uintptr_t)
+ _mesa_hash_table_u64_search(batch->state_batch_sizes,
+ address - base_address);
+ return size;
}
static void
struct intel_batchbuffer *batch = &brw->batch;
const struct gen_device_info *devinfo = &screen->devinfo;
- batch->use_shadow_copy = !devinfo->has_llc;
+ if (unlikely(INTEL_DEBUG & DEBUG_BATCH)) {
+ /* The shadow doesn't get relocs written so state decode fails. */
+ batch->use_shadow_copy = false;
+ } else
+ batch->use_shadow_copy = !devinfo->has_llc;
init_reloc_list(&batch->batch_relocs, 250);
init_reloc_list(&batch->state_relocs, 250);
if (INTEL_DEBUG & DEBUG_BATCH) {
batch->state_batch_sizes =
- _mesa_hash_table_create(NULL, uint_key_hash, uint_key_compare);
+ _mesa_hash_table_u64_create(NULL);
const unsigned decode_flags =
GEN_BATCH_DECODE_FULL |
batch->state_base_address_emitted = false;
if (batch->state_batch_sizes)
- _mesa_hash_table_clear(batch->state_batch_sizes, NULL);
+ _mesa_hash_table_u64_clear(batch->state_batch_sizes, NULL);
}
static void
brw_bo_unreference(batch->batch.bo);
brw_bo_unreference(batch->state.bo);
if (batch->state_batch_sizes) {
- _mesa_hash_table_destroy(batch->state_batch_sizes, NULL);
+ _mesa_hash_table_u64_destroy(batch->state_batch_sizes, NULL);
gen_batch_decode_ctx_finish(&batch->decoder);
}
}
*/
if (INTEL_DEBUG & DEBUG_SHADER_TIME)
brw_collect_and_report_shader_time(brw);
+
+ intel_batchbuffer_maybe_noop(brw);
}
/**
}
if (brw->need_flush_throttle) {
- __DRIscreen *dri_screen = brw->screen->driScrnPriv;
- drmCommandNone(dri_screen->fd, DRM_I915_GEM_THROTTLE);
+ drmCommandNone(brw->screen->fd, DRM_I915_GEM_THROTTLE);
brw->need_flush_throttle = false;
}
}
static int
submit_batch(struct brw_context *brw, int in_fence_fd, int *out_fence_fd)
{
- __DRIscreen *dri_screen = brw->screen->driScrnPriv;
struct intel_batchbuffer *batch = &brw->batch;
int ret = 0;
batch->exec_bos[index] = tmp_bo;
}
- ret = execbuffer(dri_screen->fd, batch, brw->hw_ctx,
+ ret = execbuffer(brw->screen->fd, batch, brw->hw_ctx,
4 * USED_BATCH(*batch),
in_fence_fd, out_fence_fd, flags);
return ret;
}
+void
+intel_batchbuffer_maybe_noop(struct brw_context *brw)
+{
+ if (!brw->frontend_noop || USED_BATCH(brw->batch) != 0)
+ return;
+
+ BEGIN_BATCH(1);
+ OUT_BATCH(MI_BATCH_BUFFER_END);
+ ADVANCE_BATCH();
+}
+
bool
brw_batch_references(struct intel_batchbuffer *batch, struct brw_bo *bo)
{
}
if (unlikely(INTEL_DEBUG & DEBUG_BATCH)) {
- _mesa_hash_table_insert(batch->state_batch_sizes,
- (void *) (uintptr_t) offset,
- (void *) (uintptr_t) size);
+ _mesa_hash_table_u64_insert(batch->state_batch_sizes,
+ offset, (void *) (uintptr_t) size);
}
batch->state_used = offset + size;