[Beignet] [PATCH] intel: Check that we can reserve the zero-offset
Chris Wilson
chris at chris-wilson.co.uk
Mon Nov 14 13:35:12 UTC 2016
commit ff57cee0519d ("ocl20/runtime: take the first 64KB page table
entries") tries to allocate a bo at 0 offset, but failed to take into
account that something may already be allocated there that it is not
allowed to evict (particularly when not using full-ppgtt separation).
Failure to do so causes all execution to subsequentally fail with
"drm_intel_gem_bo_context_exec() failed: Device or resource busy"
Reported-by: Kenneth Johansson <ken at kenjo.org>
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=98647
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
src/intel/intel_driver.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/intel/intel_driver.c b/src/intel/intel_driver.c
index 363e018..a6074ae 100644
--- a/src/intel/intel_driver.c
+++ b/src/intel/intel_driver.c
@@ -143,10 +143,14 @@ intel_driver_context_init(intel_driver_t *driver)
#ifdef HAS_BO_SET_SOFTPIN
drm_intel_bo *bo = dri_bo_alloc(driver->bufmgr, "null_bo", 64*1024, 4096);
drm_intel_bo_set_softpin_offset(bo, 0);
- // don't reuse it, that would make two bo trying to bind to same address,
- // which is un-reasonable.
- drm_intel_bo_disable_reuse(bo);
- driver->null_bo = bo;
+ drm_intel_bo_map(bo, true);
+ *(uint32_t *)bo->virtual = MI_BATCH_BUFFER_END;
+ if (drm_intel_gem_bo_context_exec(bo, driver->ctx, 0, 0) == 0) {
+ drm_intel_bo_map(bo, true);
+ driver->null_bo = memset(bo->virtual, 0, 64*1024);
+ } else {
+ drm_intel_bo_unreference(bo);
+ }
#endif
}
--
2.10.2
More information about the Beignet
mailing list