ilo: set I915_EXEC_NO_RELOC when available
authorChia-I Wu <olvaffe@gmail.com>
Mon, 10 Mar 2014 04:11:33 +0000 (12:11 +0800)
committerChia-I Wu <olvaffe@gmail.com>
Mon, 10 Mar 2014 08:42:42 +0000 (16:42 +0800)
The winsys makes it clear that the pipe drivers should write presumed offsets.
We can always set I915_EXEC_NO_RELOC when the kernel supports it.

src/gallium/winsys/intel/drm/intel_drm_winsys.c
src/gallium/winsys/intel/intel_winsys.h

index 1dc9b1c..364f221 100644 (file)
@@ -48,6 +48,7 @@ struct intel_winsys {
    int fd;
    drm_intel_bufmgr *bufmgr;
    struct intel_winsys_info info;
+   unsigned long exec_flags;
 
    struct drm_intel_decode *decode;
 };
@@ -108,7 +109,7 @@ test_reg_read(struct intel_winsys *winsys, uint32_t reg)
 }
 
 static bool
-init_info(struct intel_winsys *winsys)
+probe_winsys(struct intel_winsys *winsys)
 {
    struct intel_winsys_info *info = &winsys->info;
    int val;
@@ -147,6 +148,14 @@ init_info(struct intel_winsys *winsys)
    get_param(winsys, I915_PARAM_HAS_GEN7_SOL_RESET, &val);
    info->has_gen7_sol_reset = val;
 
+   /*
+    * pipe drivers are expected to write the presumed offsets after adding
+    * reloc entries
+    */
+   get_param(winsys, I915_PARAM_HAS_EXEC_NO_RELOC, &val);
+   if (val)
+      winsys->exec_flags |= I915_EXEC_NO_RELOC;
+
    return true;
 }
 
@@ -168,7 +177,7 @@ intel_winsys_create_for_fd(int fd)
       return NULL;
    }
 
-   if (!init_info(winsys)) {
+   if (!probe_winsys(winsys)) {
       drm_intel_bufmgr_destroy(winsys->bufmgr);
       FREE(winsys);
       return NULL;
@@ -384,7 +393,8 @@ intel_winsys_submit_bo(struct intel_winsys *winsys,
                        struct intel_context *ctx,
                        unsigned long flags)
 {
-   const unsigned long exec_flags = (unsigned long) ring | flags;
+   const unsigned long exec_flags =
+      winsys->exec_flags | (unsigned long) ring | flags;
 
    /* logical contexts are only available for the render ring */
    if (ring != INTEL_RING_RENDER)
index c37fa11..8140588 100644 (file)
@@ -264,6 +264,8 @@ intel_bo_pread(struct intel_bo *bo, unsigned long offset,
  * When \p bo is submitted for execution, and if \p target_bo has moved,
  * the kernel will patch \p bo at \p offset to \p target_bo->offset plus
  * \p target_offset.
+ *
+ * \p presumed_offset should be written to \p bo at \p offset.
  */
 int
 intel_bo_add_reloc(struct intel_bo *bo, uint32_t offset,