Skip to contentSkip to conversation

intel: Use I915_EXEC_HANDLE_LUT when available

PATCH In review Kristian Høgsberg 5 participants 23 messages Jan 17, 2015 – May 5, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 intel: Use I915_EXEC_HANDLE_LUT when available

In userspace we can track which buffer a relocation refers to in constant time. However, the kernel has to look up the per-fd gem handle for each relocation. Using the I915_EXEC_HANDLE_LUT flag lets us use the the bos validation list index instead of the gem handle in the relocation entries. This allows the kernel to look up the bo for a reloc in constant time.

---
 intel/intel_bufmgr_gem.c | 33 +++++++++++++++++++++++++++++++--
 1 file changed, 31 insertions(+), 2 deletions(-)
intel/intel_bufmgr_gem.c +31 -2
index cf85bb8..8a51cea 100644
@@ -130,6 +130,7 @@ typedef struct _drm_intel_bufmgr_gem {
 	unsigned int bo_reuse : 1;
 	unsigned int no_exec : 1;
 	unsigned int has_vebox : 1;
+	unsigned int has_handle_lut : 1;
 	bool fenced_relocs;
 
 	char *aub_filename;
@@ -399,11 +400,12 @@ drm_intel_gem_dump_validation_list(drm_intel_bufmgr_gem *bufmgr_gem)
 			    (drm_intel_bo_gem *) target_bo;
 
 			DBG("%2d: %d (%s)@0x%08llx -> "
-			    "%d (%s)@0x%08lx + 0x%08x\n",
+			    "%d (#%d) (%s)@0x%08lx + 0x%08x\n",
 			    i,
 			    bo_gem->gem_handle, bo_gem->name,
 			    (unsigned long long)bo_gem->relocs[j].offset,
 			    target_gem->gem_handle,
+			    bo_gem->relocs[j].target_handle,
 			    target_gem->name,
 			    target_bo->offset64,
 			    bo_gem->relocs[j].delta);
@@ -470,7 +472,7 @@ drm_intel_add_validate_buffer2(drm_intel_bo *bo, int need_fence)
 {
 	drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *)bo->bufmgr;
 	drm_intel_bo_gem *bo_gem = (drm_intel_bo_gem *)bo;
-	int index;
+	int i, index;
 
 	if (bo_gem->validate_index != -1) {
 		if (need_fence)
@@ -512,6 +514,26 @@ drm_intel_add_validate_buffer2(drm_intel_bo *bo, int need_fence)
 			EXEC_OBJECT_NEEDS_FENCE;
 	}
 	bufmgr_gem->exec_count++;
+
+	if (bufmgr_gem->has_handle_lut) {
+		/* If the kernel supports I915_EXEC_HANDLE_LUT, we can
+		 * use validate_index instead of the gem handle in
+		 * target_handle in the reloc entry.  This allows the
+		 * kernel to do a simple constant time lookup instead
+		 * of looking up the gem handle for each reloc.
+		 *
+		 * We have to fix up the relocs here, since the bo_gem
+		 * needs to have a valid validate_index in case there
+		 * are self-relocs in the reloc list.
+		 */
+		for (i = 0; i < bo_gem->reloc_count; i++) {
+			drm_intel_bo_gem *target_bo_gem = (drm_intel_bo_gem *)
+				bo_gem->reloc_target_info[i].bo;
+
+			bo_gem->relocs[i].target_handle =
+				target_bo_gem->validate_index;
+		}
+	}
 }
 
 #define RELOC_BUF_SIZE(x) ((I915_RELOC_HEADER + x * I915_RELOC0_STRIDE) * \
@@ -2447,6 +2469,9 @@ do_exec2(drm_intel_bo *bo, int used, drm_intel_context *ctx,
 	if (bufmgr_gem->no_exec)
 		goto skip_execution;
 
+	if (bufmgr_gem->has_handle_lut)
+		execbuf.flags |= I915_EXEC_HANDLE_LUT;
+
 	ret = drmIoctl(bufmgr_gem->fd,
 		       DRM_IOCTL_I915_GEM_EXECBUFFER2,
 		       &execbuf);
@@ -3569,6 +3594,10 @@ drm_intel_bufmgr_gem_init(int fd, int batch_size)
 		}
 	}
 
+	gp.param = I915_PARAM_HAS_EXEC_HANDLE_LUT;
+	ret = drmIoctl(bufmgr_gem->fd, DRM_IOCTL_I915_GETPARAM, &gp);
+	bufmgr_gem->has_handle_lut = ret == 0;
+
 	/* Let's go with one relocation per every 2 dwords (but round down a bit
 	 * since a power of two will mean an extra page allocation for the reloc
 	 * buffer).
Signature · 6 lines
2.2.1

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

PATCH 2/2 intel: Use I915_EXEC_NO_RELOC when available

The I915_EXEC_NO_RELOC flag lets us tell the kernel that the offset we provide in the validate list entry is what we've used in all relocations to the bo in question. If the bo hasn't moved, the kernel can skip relocations completely.

---
 intel/intel_bufmgr_gem.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
intel/intel_bufmgr_gem.c +16 -1
index 8a51cea..a657a4d 100644
@@ -131,6 +131,7 @@ typedef struct _drm_intel_bufmgr_gem {
 	unsigned int no_exec : 1;
 	unsigned int has_vebox : 1;
 	unsigned int has_handle_lut : 1;
+	unsigned int has_no_reloc : 1;
 	bool fenced_relocs;
 
 	char *aub_filename;
@@ -504,7 +505,15 @@ drm_intel_add_validate_buffer2(drm_intel_bo *bo, int need_fence)
 	bufmgr_gem->exec2_objects[index].relocation_count = bo_gem->reloc_count;
 	bufmgr_gem->exec2_objects[index].relocs_ptr = (uintptr_t)bo_gem->relocs;
 	bufmgr_gem->exec2_objects[index].alignment = 0;
-	bufmgr_gem->exec2_objects[index].offset = 0;
+
+	/* If the kernel supports I915_EXEC_NO_RELOC, it will compare
+	 * offset in struct drm_i915_gem_exec_object2 against the bos
+	 * current offset and if all bos haven't moved it will skip
+	 * relocation processing alltogether.  If I915_EXEC_NO_RELOC
+	 * is not supported, the kernel ignores the incoming value of
+	 * offset so we can set it either way.
+	 */
+	bufmgr_gem->exec2_objects[index].offset = bo->offset64;
 	bufmgr_gem->exec_bos[index] = bo;
 	bufmgr_gem->exec2_objects[index].flags = 0;
 	bufmgr_gem->exec2_objects[index].rsvd1 = 0;
@@ -2471,6 +2480,8 @@ do_exec2(drm_intel_bo *bo, int used, drm_intel_context *ctx,
 
 	if (bufmgr_gem->has_handle_lut)
 		execbuf.flags |= I915_EXEC_HANDLE_LUT;
+	if (bufmgr_gem->has_no_reloc)
+		execbuf.flags |= I915_EXEC_NO_RELOC;
 
 	ret = drmIoctl(bufmgr_gem->fd,
 		       DRM_IOCTL_I915_GEM_EXECBUFFER2,
@@ -3598,6 +3609,10 @@ drm_intel_bufmgr_gem_init(int fd, int batch_size)
 	ret = drmIoctl(bufmgr_gem->fd, DRM_IOCTL_I915_GETPARAM, &gp);
 	bufmgr_gem->has_handle_lut = ret == 0;
 
+	gp.param = I915_PARAM_HAS_EXEC_NO_RELOC;
+	ret = drmIoctl(bufmgr_gem->fd, DRM_IOCTL_I915_GETPARAM, &gp);
+	bufmgr_gem->has_no_reloc = ret == 0;
+
 	/* Let's go with one relocation per every 2 dwords (but round down a bit
 	 * since a power of two will mean an extra page allocation for the reloc
 	 * buffer).
Signature · 6 lines
2.2.1

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw

Re: [PATCH 2/2] intel: Use I915_EXEC_NO_RELOC when available

Quoted 40 lines · Kristian Høgsberg

The I915_EXEC_NO_RELOC flag lets us tell the kernel that the offset we provide in the validate list entry is what we've used in all relocations to the bo in question. If the bo hasn't moved, the kernel can skip relocations completely.

---
 intel/intel_bufmgr_gem.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
intel/intel_bufmgr_gem.c +10 -1
index 8a51cea..a657a4d 100644
@@ -131,6 +131,7 @@ typedef struct _drm_intel_bufmgr_gem {
  unsigned int no_exec : 1;
  unsigned int has_vebox : 1;
  unsigned int has_handle_lut : 1;
+ unsigned int has_no_reloc : 1;
  bool fenced_relocs;
 
  char *aub_filename;
@@ -504,7 +505,15 @@ drm_intel_add_validate_buffer2(drm_intel_bo *bo, int need_fence)
  bufmgr_gem->exec2_objects[index].relocation_count = bo_gem->reloc_count;
  bufmgr_gem->exec2_objects[index].relocs_ptr = (uintptr_t)bo_gem->relocs;
  bufmgr_gem->exec2_objects[index].alignment = 0;
- bufmgr_gem->exec2_objects[index].offset = 0;
+
+ /* If the kernel supports I915_EXEC_NO_RELOC, it will compare
+ * offset in struct drm_i915_gem_exec_object2 against the bos
+ * current offset and if all bos haven't moved it will skip
+ * relocation processing alltogether.  If I915_EXEC_NO_RELOC
+ * is not supported, the kernel ignores the incoming value of
+ * offset so we can set it either way.
+ */
+ bufmgr_gem->exec2_objects[index].offset = bo->offset64;
  bufmgr_gem->exec_bos[index] = bo;
  bufmgr_gem->exec2_objects[index].flags = 0;
  bufmgr_gem->exec2_objects[index].rsvd1 = 0;

intel/intel_bufmgr_gem.c do_exec2(drm_intel_bo *bo, int used, drm_intel_context *ctx, · line 2484

Quoted 5 lines
intel/intel_bufmgr_gem.c +2 -0
@@ -2471,6 +2480,8 @@ do_exec2(drm_intel_bo *bo, int used, drm_intel_context *ctx,
 
  if (bufmgr_gem->has_handle_lut)
  execbuf.flags |= I915_EXEC_HANDLE_LUT;
+ if (bufmgr_gem->has_no_reloc)
+ execbuf.flags |= I915_EXEC_NO_RELOC;

You need some opt-in flag to not break existing userspace: Iirc both UXA and libva retain reloc trees partially, which means that we might have different presumed offsets for the same bo in different relocs.

This is only safe when you throw away and rebuild the reloc tree with all buffers completely each time around (like current mesa does afaik).

-Daniel

Quoted 21 lines
intel/intel_bufmgr_gem.c +4 -1
  ret = drmIoctl(bufmgr_gem->fd,
        DRM_IOCTL_I915_GEM_EXECBUFFER2,
@@ -3598,6 +3609,10 @@ drm_intel_bufmgr_gem_init(int fd, int batch_size)
  ret = drmIoctl(bufmgr_gem->fd, DRM_IOCTL_I915_GETPARAM, &gp);
  bufmgr_gem->has_handle_lut = ret == 0;
 
+ gp.param = I915_PARAM_HAS_EXEC_NO_RELOC;
+ ret = drmIoctl(bufmgr_gem->fd, DRM_IOCTL_I915_GETPARAM, &gp);
+ bufmgr_gem->has_no_reloc = ret == 0;
+
  /* Let's go with one relocation per every 2 dwords (but round down a bit
  * since a power of two will mean an extra page allocation for the reloc
  * buffer).
--

2.2.1

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw

Re: [PATCH 2/2] intel: Use I915_EXEC_NO_RELOC when available

Quoted 42 lines · Daniel Vetter
Quoted 41 lines · Kristian Høgsberg

The I915_EXEC_NO_RELOC flag lets us tell the kernel that the offset we provide in the validate list entry is what we've used in all relocations to the bo in question. If the bo hasn't moved, the kernel can skip relocations completely.

---
 intel/intel_bufmgr_gem.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
intel/intel_bufmgr_gem.c +10 -1
index 8a51cea..a657a4d 100644
@@ -131,6 +131,7 @@ typedef struct _drm_intel_bufmgr_gem {
  unsigned int no_exec : 1;
  unsigned int has_vebox : 1;
  unsigned int has_handle_lut : 1;
+ unsigned int has_no_reloc : 1;
  bool fenced_relocs;
 
  char *aub_filename;
@@ -504,7 +505,15 @@ drm_intel_add_validate_buffer2(drm_intel_bo *bo, int need_fence)
  bufmgr_gem->exec2_objects[index].relocation_count = bo_gem->reloc_count;
  bufmgr_gem->exec2_objects[index].relocs_ptr = (uintptr_t)bo_gem->relocs;
  bufmgr_gem->exec2_objects[index].alignment = 0;
- bufmgr_gem->exec2_objects[index].offset = 0;
+
+ /* If the kernel supports I915_EXEC_NO_RELOC, it will compare
+ * offset in struct drm_i915_gem_exec_object2 against the bos
+ * current offset and if all bos haven't moved it will skip
+ * relocation processing alltogether.  If I915_EXEC_NO_RELOC
+ * is not supported, the kernel ignores the incoming value of
+ * offset so we can set it either way.
+ */
+ bufmgr_gem->exec2_objects[index].offset = bo->offset64;
  bufmgr_gem->exec_bos[index] = bo;
  bufmgr_gem->exec2_objects[index].flags = 0;
  bufmgr_gem->exec2_objects[index].rsvd1 = 0;
@@ -2471,6 +2480,8 @@ do_exec2(drm_intel_bo *bo, int used, drm_intel_context *ctx,
 
Quoted 8 lines

intel/intel_bufmgr_gem.c do_exec2(drm_intel_bo *bo, int used, drm_intel_context *ctx, · line 2484

Quoted 4 lines
intel/intel_bufmgr_gem.c +2 -0
  if (bufmgr_gem->has_handle_lut)
  execbuf.flags |= I915_EXEC_HANDLE_LUT;
+ if (bufmgr_gem->has_no_reloc)
+ execbuf.flags |= I915_EXEC_NO_RELOC;

You need some opt-in flag to not break existing userspace: Iirc both UXA and libva retain reloc trees partially, which means that we might have different presumed offsets for the same bo in different relocs.

A bigger challenge is that you have to use execlist flags to indicate read/write domains (actually just read or write!), and a special flag for the SNB pipecontrol w/a. (This is because the kernel no longer even scans the relocation trees if the buffers haven't moved and so we don't have the chance to construct the read/write domains from the relocs.) -Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#4 lore raw

Re: [PATCH 2/2] intel: Use I915_EXEC_NO_RELOC when available

Quoted 52 lines · Chris Wilson
Quoted 42 lines · Daniel Vetter
Quoted 41 lines · Kristian Høgsberg

The I915_EXEC_NO_RELOC flag lets us tell the kernel that the offset we provide in the validate list entry is what we've used in all relocations to the bo in question. If the bo hasn't moved, the kernel can skip relocations completely.

---
 intel/intel_bufmgr_gem.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
intel/intel_bufmgr_gem.c +10 -1
index 8a51cea..a657a4d 100644
@@ -131,6 +131,7 @@ typedef struct _drm_intel_bufmgr_gem {
  unsigned int no_exec : 1;
  unsigned int has_vebox : 1;
  unsigned int has_handle_lut : 1;
+ unsigned int has_no_reloc : 1;
  bool fenced_relocs;
 
  char *aub_filename;
@@ -504,7 +505,15 @@ drm_intel_add_validate_buffer2(drm_intel_bo *bo, int need_fence)
  bufmgr_gem->exec2_objects[index].relocation_count = bo_gem->reloc_count;
  bufmgr_gem->exec2_objects[index].relocs_ptr = (uintptr_t)bo_gem->relocs;
  bufmgr_gem->exec2_objects[index].alignment = 0;
- bufmgr_gem->exec2_objects[index].offset = 0;
+
+ /* If the kernel supports I915_EXEC_NO_RELOC, it will compare
+ * offset in struct drm_i915_gem_exec_object2 against the bos
+ * current offset and if all bos haven't moved it will skip
+ * relocation processing alltogether.  If I915_EXEC_NO_RELOC
+ * is not supported, the kernel ignores the incoming value of
+ * offset so we can set it either way.
+ */
+ bufmgr_gem->exec2_objects[index].offset = bo->offset64;
  bufmgr_gem->exec_bos[index] = bo;
  bufmgr_gem->exec2_objects[index].flags = 0;
  bufmgr_gem->exec2_objects[index].rsvd1 = 0;
@@ -2471,6 +2480,8 @@ do_exec2(drm_intel_bo *bo, int used, drm_intel_context *ctx,
 
Quoted 8 lines

intel/intel_bufmgr_gem.c do_exec2(drm_intel_bo *bo, int used, drm_intel_context *ctx, · line 2484

Quoted 4 lines
intel/intel_bufmgr_gem.c +2 -0
  if (bufmgr_gem->has_handle_lut)
  execbuf.flags |= I915_EXEC_HANDLE_LUT;
+ if (bufmgr_gem->has_no_reloc)
+ execbuf.flags |= I915_EXEC_NO_RELOC;

You need some opt-in flag to not break existing userspace: Iirc both UXA and libva retain reloc trees partially, which means that we might have different presumed offsets for the same bo in different relocs.

Quoted 5 lines

A bigger challenge is that you have to use execlist flags to indicate read/write domains (actually just read or write!), and a special flag for the SNB pipecontrol w/a. (This is because the kernel no longer even scans the relocation trees if the buffers haven't moved and so we don't have the chance to construct the read/write domains from the relocs.)

You're referring to having to set the EXEC_OBJECT_WRITE flag for buffers that are in any write domain? That seems doable - we're already scanning all relocs before submitting. I didn't find anything in i915_drm.h about the SNB pipecontrol... can you elaborate?

thanks,
Kristian

Quoted 4 lines

-Chris

--
Chris Wilson, Intel Open Source Technology Centre

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#5 lore raw

Re: [PATCH 2/2] intel: Use I915_EXEC_NO_RELOC when available

Quoted 59 lines · Kristian Høgsberg
Quoted 52 lines · Chris Wilson
Quoted 42 lines · Daniel Vetter
Quoted 41 lines · Kristian Høgsberg

The I915_EXEC_NO_RELOC flag lets us tell the kernel that the offset we provide in the validate list entry is what we've used in all relocations to the bo in question. If the bo hasn't moved, the kernel can skip relocations completely.

---
 intel/intel_bufmgr_gem.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
intel/intel_bufmgr_gem.c +10 -1
index 8a51cea..a657a4d 100644
@@ -131,6 +131,7 @@ typedef struct _drm_intel_bufmgr_gem {
  unsigned int no_exec : 1;
  unsigned int has_vebox : 1;
  unsigned int has_handle_lut : 1;
+ unsigned int has_no_reloc : 1;
  bool fenced_relocs;
 
  char *aub_filename;
@@ -504,7 +505,15 @@ drm_intel_add_validate_buffer2(drm_intel_bo *bo, int need_fence)
  bufmgr_gem->exec2_objects[index].relocation_count = bo_gem->reloc_count;
  bufmgr_gem->exec2_objects[index].relocs_ptr = (uintptr_t)bo_gem->relocs;
  bufmgr_gem->exec2_objects[index].alignment = 0;
- bufmgr_gem->exec2_objects[index].offset = 0;
+
+ /* If the kernel supports I915_EXEC_NO_RELOC, it will compare
+ * offset in struct drm_i915_gem_exec_object2 against the bos
+ * current offset and if all bos haven't moved it will skip
+ * relocation processing alltogether.  If I915_EXEC_NO_RELOC
+ * is not supported, the kernel ignores the incoming value of
+ * offset so we can set it either way.
+ */
+ bufmgr_gem->exec2_objects[index].offset = bo->offset64;
  bufmgr_gem->exec_bos[index] = bo;
  bufmgr_gem->exec2_objects[index].flags = 0;
  bufmgr_gem->exec2_objects[index].rsvd1 = 0;
@@ -2471,6 +2480,8 @@ do_exec2(drm_intel_bo *bo, int used, drm_intel_context *ctx,
 
Quoted 8 lines

intel/intel_bufmgr_gem.c do_exec2(drm_intel_bo *bo, int used, drm_intel_context *ctx, · line 2484

Quoted 4 lines
intel/intel_bufmgr_gem.c +2 -0
  if (bufmgr_gem->has_handle_lut)
  execbuf.flags |= I915_EXEC_HANDLE_LUT;
+ if (bufmgr_gem->has_no_reloc)
+ execbuf.flags |= I915_EXEC_NO_RELOC;

You need some opt-in flag to not break existing userspace: Iirc both UXA and libva retain reloc trees partially, which means that we might have different presumed offsets for the same bo in different relocs.

Quoted 5 lines

A bigger challenge is that you have to use execlist flags to indicate read/write domains (actually just read or write!), and a special flag for the SNB pipecontrol w/a. (This is because the kernel no longer even scans the relocation trees if the buffers haven't moved and so we don't have the chance to construct the read/write domains from the relocs.)

Quoted 4 lines

You're referring to having to set the EXEC_OBJECT_WRITE flag for buffers that are in any write domain? That seems doable - we're already scanning all relocs before submitting. I didn't find anything in i915_drm.h about the SNB pipecontrol... can you elaborate?

On gen6 if you do a pipe_control write (as e.g. used for query objects or the nonzero flush wa) the kernel needs to apply a wa. For old w/a it does this by matching on relocs with write_domain = I915_GEM_DOMAIN_INSTRUCTION. With the no_reloc trick instead you need to set the per-obj EXEC_OBJECT_NEEDS_GTT flag. Note that this is only required on gen6, if you do it on gen7+ and have full ppgtt enabled the kernel will yell at you.

If you go with recovering the no_reloc semantics in libdrm then you could also recover this one (on top of checking presumed_offsets for all relocs).
-Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#6 lore raw

Re: [PATCH 2/2] intel: Use I915_EXEC_NO_RELOC when available

In reply to Daniel Vetter
Quoted 51 lines · Daniel Vetter
Quoted 40 lines · Kristian Høgsberg

The I915_EXEC_NO_RELOC flag lets us tell the kernel that the offset we provide in the validate list entry is what we've used in all relocations to the bo in question. If the bo hasn't moved, the kernel can skip relocations completely.

---
 intel/intel_bufmgr_gem.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
intel/intel_bufmgr_gem.c +10 -1
index 8a51cea..a657a4d 100644
@@ -131,6 +131,7 @@ typedef struct _drm_intel_bufmgr_gem {
  unsigned int no_exec : 1;
  unsigned int has_vebox : 1;
  unsigned int has_handle_lut : 1;
+ unsigned int has_no_reloc : 1;
  bool fenced_relocs;
 
  char *aub_filename;
@@ -504,7 +505,15 @@ drm_intel_add_validate_buffer2(drm_intel_bo *bo, int need_fence)
  bufmgr_gem->exec2_objects[index].relocation_count = bo_gem->reloc_count;
  bufmgr_gem->exec2_objects[index].relocs_ptr = (uintptr_t)bo_gem->relocs;
  bufmgr_gem->exec2_objects[index].alignment = 0;
- bufmgr_gem->exec2_objects[index].offset = 0;
+
+ /* If the kernel supports I915_EXEC_NO_RELOC, it will compare
+ * offset in struct drm_i915_gem_exec_object2 against the bos
+ * current offset and if all bos haven't moved it will skip
+ * relocation processing alltogether.  If I915_EXEC_NO_RELOC
+ * is not supported, the kernel ignores the incoming value of
+ * offset so we can set it either way.
+ */
+ bufmgr_gem->exec2_objects[index].offset = bo->offset64;
  bufmgr_gem->exec_bos[index] = bo;
  bufmgr_gem->exec2_objects[index].flags = 0;
  bufmgr_gem->exec2_objects[index].rsvd1 = 0;

intel/intel_bufmgr_gem.c do_exec2(drm_intel_bo *bo, int used, drm_intel_context *ctx, · line 2484

Quoted 5 lines
intel/intel_bufmgr_gem.c +2 -0
@@ -2471,6 +2480,8 @@ do_exec2(drm_intel_bo *bo, int used, drm_intel_context *ctx,
 
  if (bufmgr_gem->has_handle_lut)
  execbuf.flags |= I915_EXEC_HANDLE_LUT;
+ if (bufmgr_gem->has_no_reloc)
+ execbuf.flags |= I915_EXEC_NO_RELOC;

You need some opt-in flag to not break existing userspace: Iirc both UXA and libva retain reloc trees partially, which means that we might have different presumed offsets for the same bo in different relocs.

Quoted 2 lines

This is only safe when you throw away and rebuild the reloc tree with all buffers completely each time around (like current mesa does afaik).

And it turns out that even inside mesa we cannot guarantee this. In case of multiple threads sharing objects, thread A could be halfway in building up its batchbuffer when thread B does a execbuf ioctls and causes some objects to be moved. Thread A will then finish building its reloc list with different offsets for the objects that were moved and if we pass NO_RELOC in that case, nothing will fix up the wrong presumed_offsets for the first half.

We can just check that all presumed_offset of all relocs match bo->offset64, and pass NO_RELOC if they do for all bos. This will also work of UXA and libva and not require any opt-in.

Kristian

Quoted 19 lines

-Daniel

Quoted 17 lines
intel/intel_bufmgr_gem.c +4 -1
  ret = drmIoctl(bufmgr_gem->fd,
        DRM_IOCTL_I915_GEM_EXECBUFFER2,
@@ -3598,6 +3609,10 @@ drm_intel_bufmgr_gem_init(int fd, int batch_size)
  ret = drmIoctl(bufmgr_gem->fd, DRM_IOCTL_I915_GETPARAM, &gp);
  bufmgr_gem->has_handle_lut = ret == 0;
 
+ gp.param = I915_PARAM_HAS_EXEC_NO_RELOC;
+ ret = drmIoctl(bufmgr_gem->fd, DRM_IOCTL_I915_GETPARAM, &gp);
+ bufmgr_gem->has_no_reloc = ret == 0;
+
  /* Let's go with one relocation per every 2 dwords (but round down a bit
  * since a power of two will mean an extra page allocation for the reloc
  * buffer).
--

2.2.1

Quoted 9 lines
Quoted 4 lines

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#7 lore raw

Re: [PATCH 2/2] intel: Use I915_EXEC_NO_RELOC when available

Quoted 63 lines · Kristian Høgsberg
Quoted 51 lines · Daniel Vetter
Quoted 40 lines · Kristian Høgsberg

The I915_EXEC_NO_RELOC flag lets us tell the kernel that the offset we provide in the validate list entry is what we've used in all relocations to the bo in question. If the bo hasn't moved, the kernel can skip relocations completely.

---
 intel/intel_bufmgr_gem.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
intel/intel_bufmgr_gem.c +10 -1
index 8a51cea..a657a4d 100644
@@ -131,6 +131,7 @@ typedef struct _drm_intel_bufmgr_gem {
  unsigned int no_exec : 1;
  unsigned int has_vebox : 1;
  unsigned int has_handle_lut : 1;
+ unsigned int has_no_reloc : 1;
  bool fenced_relocs;
 
  char *aub_filename;
@@ -504,7 +505,15 @@ drm_intel_add_validate_buffer2(drm_intel_bo *bo, int need_fence)
  bufmgr_gem->exec2_objects[index].relocation_count = bo_gem->reloc_count;
  bufmgr_gem->exec2_objects[index].relocs_ptr = (uintptr_t)bo_gem->relocs;
  bufmgr_gem->exec2_objects[index].alignment = 0;
- bufmgr_gem->exec2_objects[index].offset = 0;
+
+ /* If the kernel supports I915_EXEC_NO_RELOC, it will compare
+ * offset in struct drm_i915_gem_exec_object2 against the bos
+ * current offset and if all bos haven't moved it will skip
+ * relocation processing alltogether.  If I915_EXEC_NO_RELOC
+ * is not supported, the kernel ignores the incoming value of
+ * offset so we can set it either way.
+ */
+ bufmgr_gem->exec2_objects[index].offset = bo->offset64;
  bufmgr_gem->exec_bos[index] = bo;
  bufmgr_gem->exec2_objects[index].flags = 0;
  bufmgr_gem->exec2_objects[index].rsvd1 = 0;

intel/intel_bufmgr_gem.c do_exec2(drm_intel_bo *bo, int used, drm_intel_context *ctx, · line 2484

Quoted 5 lines
intel/intel_bufmgr_gem.c +2 -0
@@ -2471,6 +2480,8 @@ do_exec2(drm_intel_bo *bo, int used, drm_intel_context *ctx,
 
  if (bufmgr_gem->has_handle_lut)
  execbuf.flags |= I915_EXEC_HANDLE_LUT;
+ if (bufmgr_gem->has_no_reloc)
+ execbuf.flags |= I915_EXEC_NO_RELOC;

You need some opt-in flag to not break existing userspace: Iirc both UXA and libva retain reloc trees partially, which means that we might have different presumed offsets for the same bo in different relocs.

Quoted 2 lines

This is only safe when you throw away and rebuild the reloc tree with all buffers completely each time around (like current mesa does afaik).

And it turns out that even inside mesa we cannot guarantee this. In case of multiple threads sharing objects, thread A could be halfway in building up its batchbuffer when thread B does a execbuf ioctls and causes some objects to be moved. Thread A will then finish building its reloc list with different offsets for the objects that were moved and if we pass NO_RELOC in that case, nothing will fix up the wrong presumed_offsets for the first half.

Quoted 3 lines

We can just check that all presumed_offset of all relocs match bo->offset64, and pass NO_RELOC if they do for all bos. This will also work of UXA and libva and not require any opt-in.

My idea for all this would have been to create a per-thread execbuf relocation context with a hashtab to map buffer pointers to execbuf index and a bunch of arrays to prepare the reloc entry tables. If you do it correctly all the per-reloc work should be a O(1) streaming writes to a few arrays plus the hashtab lookup. With no code run at execbuf time (except the ioctl ofc). Even the libdrm_bo->presumed_offset update after execbuf could be done lockless (as long as readers are careful to never reload it by using something similar to the kernel's READ_ONCE macro).

But that means a completely new reloc api, so a lot more work. Also I think it only makes sense do that for drivers that really care about the last bit of performance, and then do it within the driver so that there's no constraints about abi.
-Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#8 lore raw

Re: [PATCH 2/2] intel: Use I915_EXEC_NO_RELOC when available

Quoted 77 lines · Daniel Vetter
Quoted 63 lines · Kristian Høgsberg
Quoted 51 lines · Daniel Vetter
Quoted 40 lines · Kristian Høgsberg

The I915_EXEC_NO_RELOC flag lets us tell the kernel that the offset we provide in the validate list entry is what we've used in all relocations to the bo in question. If the bo hasn't moved, the kernel can skip relocations completely.

---
 intel/intel_bufmgr_gem.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
intel/intel_bufmgr_gem.c +10 -1
index 8a51cea..a657a4d 100644
@@ -131,6 +131,7 @@ typedef struct _drm_intel_bufmgr_gem {
  unsigned int no_exec : 1;
  unsigned int has_vebox : 1;
  unsigned int has_handle_lut : 1;
+ unsigned int has_no_reloc : 1;
  bool fenced_relocs;
 
  char *aub_filename;
@@ -504,7 +505,15 @@ drm_intel_add_validate_buffer2(drm_intel_bo *bo, int need_fence)
  bufmgr_gem->exec2_objects[index].relocation_count = bo_gem->reloc_count;
  bufmgr_gem->exec2_objects[index].relocs_ptr = (uintptr_t)bo_gem->relocs;
  bufmgr_gem->exec2_objects[index].alignment = 0;
- bufmgr_gem->exec2_objects[index].offset = 0;
+
+ /* If the kernel supports I915_EXEC_NO_RELOC, it will compare
+ * offset in struct drm_i915_gem_exec_object2 against the bos
+ * current offset and if all bos haven't moved it will skip
+ * relocation processing alltogether.  If I915_EXEC_NO_RELOC
+ * is not supported, the kernel ignores the incoming value of
+ * offset so we can set it either way.
+ */
+ bufmgr_gem->exec2_objects[index].offset = bo->offset64;
  bufmgr_gem->exec_bos[index] = bo;
  bufmgr_gem->exec2_objects[index].flags = 0;
  bufmgr_gem->exec2_objects[index].rsvd1 = 0;

intel/intel_bufmgr_gem.c do_exec2(drm_intel_bo *bo, int used, drm_intel_context *ctx, · line 2484

Quoted 5 lines
intel/intel_bufmgr_gem.c +2 -0
@@ -2471,6 +2480,8 @@ do_exec2(drm_intel_bo *bo, int used, drm_intel_context *ctx,
 
  if (bufmgr_gem->has_handle_lut)
  execbuf.flags |= I915_EXEC_HANDLE_LUT;
+ if (bufmgr_gem->has_no_reloc)
+ execbuf.flags |= I915_EXEC_NO_RELOC;

You need some opt-in flag to not break existing userspace: Iirc both UXA and libva retain reloc trees partially, which means that we might have different presumed offsets for the same bo in different relocs.

Quoted 2 lines

This is only safe when you throw away and rebuild the reloc tree with all buffers completely each time around (like current mesa does afaik).

And it turns out that even inside mesa we cannot guarantee this. In case of multiple threads sharing objects, thread A could be halfway in building up its batchbuffer when thread B does a execbuf ioctls and causes some objects to be moved. Thread A will then finish building its reloc list with different offsets for the objects that were moved and if we pass NO_RELOC in that case, nothing will fix up the wrong presumed_offsets for the first half.

Quoted 3 lines

We can just check that all presumed_offset of all relocs match bo->offset64, and pass NO_RELOC if they do for all bos. This will also work of UXA and libva and not require any opt-in.

My idea for all this would have been to create a per-thread execbuf relocation context with a hashtab to map buffer pointers to execbuf index and a bunch of arrays to prepare the reloc entry tables. If you do it correctly all the per-reloc work should be a O(1) streaming writes to a few arrays plus the hashtab lookup. With no code run at execbuf time (except the ioctl ofc). Even the libdrm_bo->presumed_offset update after execbuf could be done lockless (as long as readers are careful to never reload it by using something similar to the kernel's READ_ONCE macro).

Quoted 4 lines

But that means a completely new reloc api, so a lot more work. Also I think it only makes sense do that for drivers that really care about the last bit of performance, and then do it within the driver so that there's no constraints about abi.

Indeed, I moved it into mesa so I could rework that. bo_emit_reloc() is showing up in profiles. The patch below along with NO_RELOC and HANDLE_LUT flags gives me 5-10% improement on CPU bound benchmarks, so it's certainly worth it. I'm skeptical that a hashtable lookup per reloc emit is going to perform better than just fixing up the relocs at execbuf2 time though. It would be nice to not do any work at ioctl time, but for that you need a very fast way to map from bo to per-thread bo state as you go. Maybe a per-thread array mapping from gem handle to exec_object could work...

WIP Patch is here:

http://cgit.freedesktop.org/~krh/mesa/commit/?h=b0e4ce7bbce2a79ad37d6de460af88b9581ea1d7

it needs a couple of libdrm changes: expose exec_index in the public bo struct, the drm_bo_clear_idle() function and I need to get at the hw context id.

Kristian

Quoted 5 lines

-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#9 lore raw

Re: [PATCH 2/2] intel: Use I915_EXEC_NO_RELOC when available

Quoted 25 lines · Kristian Høgsberg
Quoted 9 lines · Daniel Vetter

My idea for all this would have been to create a per-thread execbuf relocation context with a hashtab to map buffer pointers to execbuf index and a bunch of arrays to prepare the reloc entry tables. If you do it correctly all the per-reloc work should be a O(1) streaming writes to a few arrays plus the hashtab lookup. With no code run at execbuf time (except the ioctl ofc). Even the libdrm_bo->presumed_offset update after execbuf could be done lockless (as long as readers are careful to never reload it by using something similar to the kernel's READ_ONCE macro).

Quoted 4 lines

But that means a completely new reloc api, so a lot more work. Also I think it only makes sense do that for drivers that really care about the last bit of performance, and then do it within the driver so that there's no constraints about abi.

Indeed, I moved it into mesa so I could rework that. bo_emit_reloc() is showing up in profiles. The patch below along with NO_RELOC and HANDLE_LUT flags gives me 5-10% improement on CPU bound benchmarks, so it's certainly worth it. I'm skeptical that a hashtable lookup per reloc emit is going to perform better than just fixing up the relocs at execbuf2 time though. It would be nice to not do any work at ioctl time, but for that you need a very fast way to map from bo to per-thread bo state as you go. Maybe a per-thread array mapping from gem handle to exec_object could work...

Quoted 3 lines

WIP Patch is here:

http://cgit.freedesktop.org/~krh/mesa/commit/?h=b0e4ce7bbce2a79ad37d6de460af88b9581ea1d7

Hmm, that is actually pretty neat. My idle thought was to create per-context batchmgr with its own view of the bo (to counter the multithreaded free-for-all). In your patch, you neatly demonstrate that you don't need per-context view of the bo, only of the relocations. And it will make drm_intel_bo_emit_reloc() fixed cost, which should produce most of your CPU overhead saving.

However, I think if you do take it a step further with a batchmgr_bo, you can make the drm_intel_bo_references() very cheap as well.

Looks good.
-Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#10 lore raw

Re: [PATCH 2/2] intel: Use I915_EXEC_NO_RELOC when available

Quoted 37 lines · Chris Wilson
Quoted 25 lines · Kristian Høgsberg
Quoted 9 lines · Daniel Vetter

My idea for all this would have been to create a per-thread execbuf relocation context with a hashtab to map buffer pointers to execbuf index and a bunch of arrays to prepare the reloc entry tables. If you do it correctly all the per-reloc work should be a O(1) streaming writes to a few arrays plus the hashtab lookup. With no code run at execbuf time (except the ioctl ofc). Even the libdrm_bo->presumed_offset update after execbuf could be done lockless (as long as readers are careful to never reload it by using something similar to the kernel's READ_ONCE macro).

Quoted 4 lines

But that means a completely new reloc api, so a lot more work. Also I think it only makes sense do that for drivers that really care about the last bit of performance, and then do it within the driver so that there's no constraints about abi.

Indeed, I moved it into mesa so I could rework that. bo_emit_reloc() is showing up in profiles. The patch below along with NO_RELOC and HANDLE_LUT flags gives me 5-10% improement on CPU bound benchmarks, so it's certainly worth it. I'm skeptical that a hashtable lookup per reloc emit is going to perform better than just fixing up the relocs at execbuf2 time though. It would be nice to not do any work at ioctl time, but for that you need a very fast way to map from bo to per-thread bo state as you go. Maybe a per-thread array mapping from gem handle to exec_object could work...

Quoted 3 lines

WIP Patch is here:

http://cgit.freedesktop.org/~krh/mesa/commit/?h=b0e4ce7bbce2a79ad37d6de460af88b9581ea1d7

Hmm, that is actually pretty neat. My idle thought was to create per-context batchmgr with its own view of the bo (to counter the multithreaded free-for-all). In your patch, you neatly demonstrate that you don't need per-context view of the bo, only of the relocations. And it will make drm_intel_bo_emit_reloc() fixed cost, which should produce most of your CPU overhead saving.

Quoted 2 lines

However, I think if you do take it a step further with a batchmgr_bo, you can make the drm_intel_bo_references() very cheap as well.

I did think about a per-thread/context bo wrapper that could track validation list index and presumed_offset, but the problem is that there's only one intel_mipmap_tree/intel_buffer_object struct to store it in. We'd have to a per-thread wrapper for those too, and I'm not sure that's feasible.

However, drm_intel_bo_reference/unreference() is showing up on the profiles now that relocations are cheaper, but I think the better way to make those cheaper is to move the ref count to the public struct and make the ref/unref inline functions (calling out to a destructor for the refcount==0 case, of course). On that note, do you know why drm_intel_gem_bo_unreference() is so convoluted? What's the deal with the atomic_add_unless?

Quoted 5 lines

Looks good.
-Chris

--
Chris Wilson, Intel Open Source Technology Centre

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#11 lore raw

Re: [PATCH 2/2] intel: Use I915_EXEC_NO_RELOC when available

Quoted 38 lines · Kristian Høgsberg
Quoted 37 lines · Chris Wilson
Quoted 25 lines · Kristian Høgsberg
Quoted 9 lines · Daniel Vetter

My idea for all this would have been to create a per-thread execbuf relocation context with a hashtab to map buffer pointers to execbuf index and a bunch of arrays to prepare the reloc entry tables. If you do it correctly all the per-reloc work should be a O(1) streaming writes to a few arrays plus the hashtab lookup. With no code run at execbuf time (except the ioctl ofc). Even the libdrm_bo->presumed_offset update after execbuf could be done lockless (as long as readers are careful to never reload it by using something similar to the kernel's READ_ONCE macro).

Quoted 4 lines

But that means a completely new reloc api, so a lot more work. Also I think it only makes sense do that for drivers that really care about the last bit of performance, and then do it within the driver so that there's no constraints about abi.

Indeed, I moved it into mesa so I could rework that. bo_emit_reloc() is showing up in profiles. The patch below along with NO_RELOC and HANDLE_LUT flags gives me 5-10% improement on CPU bound benchmarks, so it's certainly worth it. I'm skeptical that a hashtable lookup per reloc emit is going to perform better than just fixing up the relocs at execbuf2 time though. It would be nice to not do any work at ioctl time, but for that you need a very fast way to map from bo to per-thread bo state as you go. Maybe a per-thread array mapping from gem handle to exec_object could work...

Quoted 3 lines

WIP Patch is here:

http://cgit.freedesktop.org/~krh/mesa/commit/?h=b0e4ce7bbce2a79ad37d6de460af88b9581ea1d7

Hmm, that is actually pretty neat. My idle thought was to create per-context batchmgr with its own view of the bo (to counter the multithreaded free-for-all). In your patch, you neatly demonstrate that you don't need per-context view of the bo, only of the relocations. And it will make drm_intel_bo_emit_reloc() fixed cost, which should produce most of your CPU overhead saving.

Quoted 8 lines
Quoted 2 lines

However, I think if you do take it a step further with a batchmgr_bo, you can make the drm_intel_bo_references() very cheap as well.

I did think about a per-thread/context bo wrapper that could track validation list index and presumed_offset, but the problem is that there's only one intel_mipmap_tree/intel_buffer_object struct to store it in. We'd have to a per-thread wrapper for those too, and I'm not sure that's feasible.

Another thing to consider is that with full ppgtt reloc offset will be per context. So as soon as you have multiple contexts with some shared bo you most likely will always fallback to need_reloc=1 with your code. Not sure whether we care.

And I guess your obj->flags = 0 is just because it's WIP? You'd need something like

	if (relocs[i].write_domain)
		obj->flasg |= EXEC_OBJECT_WRITE;
	if (IS_GEN6 && relocs[i].write_domain == INSTRUCTION)
		obj->flasg |= EXEC_OBJECT_NEEDS_GTT;

before the continue.
-Daniel

Quoted 13 lines

However, drm_intel_bo_reference/unreference() is showing up on the profiles now that relocations are cheaper, but I think the better way to make those cheaper is to move the ref count to the public struct and make the ref/unref inline functions (calling out to a destructor for the refcount==0 case, of course). On that note, do you know why drm_intel_gem_bo_unreference() is so convoluted? What's the deal with the atomic_add_unless?

Quoted 5 lines

Looks good.
-Chris

--
Chris Wilson, Intel Open Source Technology Centre

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#12 lore raw

Re: [PATCH 2/2] intel: Use I915_EXEC_NO_RELOC when available

In reply to Kristian Høgsberg
Quoted 7 lines · Kristian Høgsberg

However, drm_intel_bo_reference/unreference() is showing up on the profiles now that relocations are cheaper, but I think the better way to make those cheaper is to move the ref count to the public struct and make the ref/unref inline functions (calling out to a destructor for the refcount==0 case, of course). On that note, do you know why drm_intel_gem_bo_unreference() is so convoluted? What's the deal with the atomic_add_unless?

Smells like the last reference can only be dropped with the mutex held, probably because someone is assuming that buffers don't go poof while holding the mutex. You should be able to drop this after some refcounting audit to make sure no one looks at a bo after the unref is done. -Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#13 lore raw

Re: [PATCH 2/2] intel: Use I915_EXEC_NO_RELOC when available

Quoted 9 lines · Daniel Vetter
Quoted 7 lines · Kristian Høgsberg

However, drm_intel_bo_reference/unreference() is showing up on the profiles now that relocations are cheaper, but I think the better way to make those cheaper is to move the ref count to the public struct and make the ref/unref inline functions (calling out to a destructor for the refcount==0 case, of course). On that note, do you know why drm_intel_gem_bo_unreference() is so convoluted? What's the deal with the atomic_add_unless?

Quoted 4 lines

Smells like the last reference can only be dropped with the mutex held, probably because someone is assuming that buffers don't go poof while holding the mutex. You should be able to drop this after some refcounting audit to make sure no one looks at a bo after the unref is done.

To elaborate: I think the reason here is that there's a bunch of weak references (i.e. pointers that don't actually hold a reference) in the various caches in libdrm (both bo cache and import cache). Those are only protected by the mutex, which means if someone could drop the refcount to 0 without holding the mutex they'd try to increase the refcount of a bo which is in the process of final destruction. Not great.

The approach the kernel uses is to have plain unlocked atomic_inc/dec for all cases where there's a strong references. For the weak ones you use atomic_in_unless_zero while holding a lock that the destructor also always needs. That gives you enough synchronization to reliable detect when your weak reference points at a zombie (in which case you just fail the lookup). That gives you a nice fastpath and shifts all the cost to the weak refcount lookup and final destruction (where you must grab the mutex and use more expensive atomic ops).

In drm there's a bunch of examples using kref_get_unless_zero as reading material.

Cheers, Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#14 lore raw

Re: [PATCH 2/2] intel: Use I915_EXEC_NO_RELOC when available

In reply to Kristian Høgsberg
Quoted 7 lines · Kristian Høgsberg

However, drm_intel_bo_reference/unreference() is showing up on the profiles now that relocations are cheaper, but I think the better way to make those cheaper is to move the ref count to the public struct and make the ref/unref inline functions (calling out to a destructor for the refcount==0 case, of course). On that note, do you know why drm_intel_gem_bo_unreference() is so convoluted? What's the deal with the atomic_add_unless?

Yeah, it's the optimised way to do an unref that then requires taking a mutex. Releasing the last reference to the object is only threadsafe under the mutex (otherwise another thread may preempt us, acquire the ref and release it all before the first thread processes the free and decouple it from the lists), but we want to avoid taking the mutex until necessary.
-Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 1/2
#15 lore raw
In reply to Kristian Høgsberg
Quoted 6 lines · Kristian Høgsberg

In userspace we can track which buffer a relocation refers to in constant time. However, the kernel has to look up the per-fd gem handle for each relocation. Using the I915_EXEC_HANDLE_LUT flag lets us use the the bos validation list index instead of the gem handle in the relocation entries. This allows the kernel to look up the bo for a reloc in constant time.

^near

Quoted 1 line

Ok, I thought libdrm_intel was doing something questionable with its cache of reloc trees, but that doesn't actually impact the execlist.

With the minor inline comment,

intel/intel_bufmgr_gem.c drm_intel_bufmgr_gem_init(int fd, int batch_size) · line 3599

Quoted 12 lines
---
 intel/intel_bufmgr_gem.c | 33 +++++++++++++++++++++++++++++++--
 1 file changed, 31 insertions(+), 2 deletions(-)
intel/intel_bufmgr_gem.c +3 -0
@@ -3569,6 +3594,10 @@ drm_intel_bufmgr_gem_init(int fd, int batch_size)
 		}
 	}
 
+	gp.param = I915_PARAM_HAS_EXEC_HANDLE_LUT;
+	ret = drmIoctl(bufmgr_gem->fd, DRM_IOCTL_I915_GETPARAM, &gp);
+	bufmgr_gem->has_handle_lut = ret == 0;

Better to use

val = 0;
gp.value = &val;
(void)drmIoctl(bufmgr_gem->fd, DRM_IOCTL_I915_GETPARAM, &gp); bufmgr_gem->has_handle_lut = val > 0;

for future proofing.
-Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#16 lore raw

RFC Fast batch and relocation handling for i965

In reply to Kristian Høgsberg

Relocation processing is a significant overhead of heavy batches. The kernel tries to make this as cheap as possible by avoiding as much work as possible, but to be truly lazy requires userspace to construct its batches and relocation trees in a convenient manner for processing.

Kristian made an attempt to enable libdrm_intel to supply its execbuffers in this format,

http://lists.freedesktop.org/archives/intel-gfx/2015-January/058550.html

This is my batchmgr concept from that thread.
-Chris

_______________________________________________
mesa-dev mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

#17 lore raw

PATCH 1/4 i965: Transplant PIPE_CONTROL routines to brw_pipe_control

Start trimming the fat from intel_batchbuffer.c. First by moving the set of routines for emitting PIPE_CONTROLS (along with the lore concerning hardware workarounds) to a separate brw_pipe_control.c

---
 src/mesa/drivers/dri/i965/Makefile.sources    |   1 +
 src/mesa/drivers/dri/i965/brw_context.h       |  12 +
 src/mesa/drivers/dri/i965/brw_pipe_control.c  | 335 ++++++++++++++++++++++++++
 src/mesa/drivers/dri/i965/intel_batchbuffer.c | 304 -----------------------
 src/mesa/drivers/dri/i965/intel_batchbuffer.h |  10 -
 5 files changed, 348 insertions(+), 314 deletions(-)
 create mode 100644 src/mesa/drivers/dri/i965/brw_pipe_control.c
src/mesa/drivers/dri/i965/Makefile.sources +1 -0
index 6d4659f..a9f9129 100644
@@ -82,6 +82,7 @@ i965_FILES = \
 	brw_object_purgeable.c \
 	brw_packed_float.c \
 	brw_performance_monitor.c \
+	brw_pipe_control.c \
 	brw_primitive_restart.c \
 	brw_program.c \
 	brw_program.h \
src/mesa/drivers/dri/i965/brw_context.h +12 -0
index e2f26f5..7241816 100644
@@ -1945,6 +1945,18 @@ gen6_upload_push_constants(struct brw_context *brw,
                            struct brw_stage_state *stage_state,
                            enum aub_state_struct_type type);
 
+/* brw_pipe_control.c */
+void brw_emit_pipe_control_flush(struct brw_context *brw, uint32_t flags);
+void brw_emit_pipe_control_write(struct brw_context *brw, uint32_t flags,
+                                 drm_intel_bo *bo, uint32_t offset,
+                                 uint32_t imm_lower, uint32_t imm_upper);
+void intel_batchbuffer_emit_mi_flush(struct brw_context *brw);
+void intel_emit_post_sync_nonzero_flush(struct brw_context *brw);
+void intel_emit_depth_stall_flushes(struct brw_context *brw);
+void gen7_emit_vs_workaround_flush(struct brw_context *brw);
+void gen7_emit_cs_stall_flush(struct brw_context *brw);
+
+
 #ifdef __cplusplus
 }
 #endif
src/mesa/drivers/dri/i965/brw_pipe_control.c new file +335 -0

335 lines not on this page · raw message

src/mesa/drivers/dri/i965/intel_batchbuffer.c +0 -304

310 lines not on this page · raw message

src/mesa/drivers/dri/i965/intel_batchbuffer.h +0 -10
index 7bdd836..ef8a6ff 100644
@@ -63,16 +63,6 @@ bool intel_batchbuffer_emit_reloc64(struct brw_context *brw,
                                     uint32_t read_domains,
                                     uint32_t write_domain,
                                     uint32_t offset);
-void brw_emit_pipe_control_flush(struct brw_context *brw, uint32_t flags);
-void brw_emit_pipe_control_write(struct brw_context *brw, uint32_t flags,
-                                 drm_intel_bo *bo, uint32_t offset,
-                                 uint32_t imm_lower, uint32_t imm_upper);
-void intel_batchbuffer_emit_mi_flush(struct brw_context *brw);
-void intel_emit_post_sync_nonzero_flush(struct brw_context *brw);
-void intel_emit_depth_stall_flushes(struct brw_context *brw);
-void gen7_emit_vs_workaround_flush(struct brw_context *brw);
-void gen7_emit_cs_stall_flush(struct brw_context *brw);
-
 static inline uint32_t float_as_int(float f)
 {
    union {
Signature · 6 lines
2.1.4

_______________________________________________
mesa-dev mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Reviewed-by on v1 1/4
#18 lore raw

Re: [PATCH 1/4] i965: Transplant PIPE_CONTROL routines to brw_pipe_control

Quoted 71 lines · Chris Wilson

Start trimming the fat from intel_batchbuffer.c. First by moving the set of routines for emitting PIPE_CONTROLS (along with the lore concerning hardware workarounds) to a separate brw_pipe_control.c

---
 src/mesa/drivers/dri/i965/Makefile.sources    |   1 +
 src/mesa/drivers/dri/i965/brw_context.h       |  12 +
 src/mesa/drivers/dri/i965/brw_pipe_control.c  | 335 ++++++++++++++++++++++++++
 src/mesa/drivers/dri/i965/intel_batchbuffer.c | 304 -----------------------
 src/mesa/drivers/dri/i965/intel_batchbuffer.h |  10 -
 5 files changed, 348 insertions(+), 314 deletions(-)
 create mode 100644 src/mesa/drivers/dri/i965/brw_pipe_control.c
src/mesa/drivers/dri/i965/Makefile.sources +1 -0
index 6d4659f..a9f9129 100644
@@ -82,6 +82,7 @@ i965_FILES = \
 	brw_object_purgeable.c \
 	brw_packed_float.c \
 	brw_performance_monitor.c \
+	brw_pipe_control.c \
 	brw_primitive_restart.c \
 	brw_program.c \
 	brw_program.h \
src/mesa/drivers/dri/i965/brw_context.h +12 -0
index e2f26f5..7241816 100644
@@ -1945,6 +1945,18 @@ gen6_upload_push_constants(struct brw_context *brw,
                            struct brw_stage_state *stage_state,
                            enum aub_state_struct_type type);
 
+/* brw_pipe_control.c */
+void brw_emit_pipe_control_flush(struct brw_context *brw, uint32_t flags);
+void brw_emit_pipe_control_write(struct brw_context *brw, uint32_t flags,
+                                 drm_intel_bo *bo, uint32_t offset,
+                                 uint32_t imm_lower, uint32_t imm_upper);
+void intel_batchbuffer_emit_mi_flush(struct brw_context *brw);
+void intel_emit_post_sync_nonzero_flush(struct brw_context *brw);
+void intel_emit_depth_stall_flushes(struct brw_context *brw);
+void gen7_emit_vs_workaround_flush(struct brw_context *brw);
+void gen7_emit_cs_stall_flush(struct brw_context *brw);
+
+
 #ifdef __cplusplus
 }
 #endif
src/mesa/drivers/dri/i965/brw_pipe_control.c new file +16 -0
new file mode 100644
index 0000000..c216f6d
@@ -0,0 +1,335 @@
+/**************************************************************************
+ *
+ * Copyright 2006 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.

src/mesa/drivers/dri/i965/brw_pipe_control.c line 26

Quoted 10 lines
src/mesa/drivers/dri/i965/brw_pipe_control.c new file +10 -0
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/

I did a bit of archaeology, and all of the Tungsten Graphics code appears to be long gone:

gen8_add_cs_stall_workaround_bits - me (2014) gen7_cs_stall_every_four_pipe_controls - me (2014) brw_emit_pipe_control_flush - me (2013) brw_emit_pipe_control_write - me (2013) intel_emit_post_sync_nonzero_flush - Eric (2011) intel_emit_depth_stall_flushes - me (2011) gen7_emit_vs_workaround_flush - me (2012) gen7_emit_cs_stall_flush - Paul (2013) intel_batchbuffer_emit_mi_flush - Zhenyu (2010), Eric, and I

So I'd use this copyright instead (with more typical formatting):

/*
* Copyright © 2010 Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/

I love that PIPE_CONTROL has its own source file now :D

Patches 1-2 are:

_______________________________________________
mesa-dev mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

#19 lore raw

PATCH 2/4 i915: Rename intel_emit* to reflect their new location in brw_pipe_control

In reply to Chris Wilson
---
 src/mesa/drivers/dri/i965/brw_blorp.cpp             | 4 ++--
 src/mesa/drivers/dri/i965/brw_clear.c               | 4 ++--
 src/mesa/drivers/dri/i965/brw_context.h             | 6 +++---
 src/mesa/drivers/dri/i965/brw_draw.c                | 4 ++--
 src/mesa/drivers/dri/i965/brw_meta_fast_clear.c     | 4 ++--
 src/mesa/drivers/dri/i965/brw_meta_stencil_blit.c   | 8 ++++----
 src/mesa/drivers/dri/i965/brw_meta_updownsample.c   | 4 ++--
 src/mesa/drivers/dri/i965/brw_misc_state.c          | 2 +-
 src/mesa/drivers/dri/i965/brw_performance_monitor.c | 8 ++++----
 src/mesa/drivers/dri/i965/brw_pipe_control.c        | 8 ++++----
 src/mesa/drivers/dri/i965/brw_state_upload.c        | 4 ++--
 src/mesa/drivers/dri/i965/gen6_blorp.cpp            | 6 +++---
 src/mesa/drivers/dri/i965/gen6_depth_state.c        | 2 +-
 src/mesa/drivers/dri/i965/gen6_queryobj.c           | 6 +++---
 src/mesa/drivers/dri/i965/gen6_sol.c                | 2 +-
 src/mesa/drivers/dri/i965/gen6_urb.c                | 2 +-
 src/mesa/drivers/dri/i965/gen7_blorp.cpp            | 4 ++--
 src/mesa/drivers/dri/i965/gen7_misc_state.c         | 2 +-
 src/mesa/drivers/dri/i965/gen7_sol_state.c          | 4 ++--
 src/mesa/drivers/dri/i965/gen8_depth_state.c        | 2 +-
 src/mesa/drivers/dri/i965/intel_blit.c              | 6 +++---
 src/mesa/drivers/dri/i965/intel_buffer_objects.c    | 4 ++--
 src/mesa/drivers/dri/i965/intel_extensions.c        | 6 +++---
 src/mesa/drivers/dri/i965/intel_fbo.c               | 2 +-
 src/mesa/drivers/dri/i965/intel_syncobj.c           | 2 +-
 25 files changed, 53 insertions(+), 53 deletions(-)
src/mesa/drivers/dri/i965/brw_blorp.cpp +2 -2
index b404869..2ccfae1 100644
@@ -220,7 +220,7 @@ brw_blorp_exec(struct brw_context *brw, const brw_blorp_params *params)
     * data with different formats, which blorp does for stencil and depth
     * data.
     */
-   intel_batchbuffer_emit_mi_flush(brw);
+   brw_emit_mi_flush(brw);
 
 retry:
    intel_batchbuffer_require_space(brw, estimated_max_batch_usage, RENDER_RING);
@@ -283,7 +283,7 @@ retry:
    /* Flush the sampler cache so any texturing from the destination is
     * coherent.
     */
-   intel_batchbuffer_emit_mi_flush(brw);
+   brw_emit_mi_flush(brw);
 }
 
 brw_hiz_op_params::brw_hiz_op_params(struct intel_mipmap_tree *mt,
src/mesa/drivers/dri/i965/brw_clear.c +2 -2
index 1231420..a6524aa 100644
@@ -183,7 +183,7 @@ brw_fast_clear_depth(struct gl_context *ctx)
     *      must be issued before the rectangle primitive used for the depth
     *      buffer clear operation.
     */
-   intel_batchbuffer_emit_mi_flush(brw);
+   brw_emit_mi_flush(brw);
 
    if (fb->MaxNumLayers > 0) {
       for (unsigned layer = 0; layer < depth_irb->layer_count; layer++) {
@@ -203,7 +203,7 @@ brw_fast_clear_depth(struct gl_context *ctx)
        *      by a PIPE_CONTROL command with DEPTH_STALL bit set and Then
        *      followed by Depth FLUSH'
       */
-      intel_batchbuffer_emit_mi_flush(brw);
+      brw_emit_mi_flush(brw);
    }
 
    /* Now, the HiZ buffer contains data that needs to be resolved to the depth
src/mesa/drivers/dri/i965/brw_context.h +3 -3
index 7241816..8269db0 100644
@@ -1950,9 +1950,9 @@ void brw_emit_pipe_control_flush(struct brw_context *brw, uint32_t flags);
 void brw_emit_pipe_control_write(struct brw_context *brw, uint32_t flags,
                                  drm_intel_bo *bo, uint32_t offset,
                                  uint32_t imm_lower, uint32_t imm_upper);
-void intel_batchbuffer_emit_mi_flush(struct brw_context *brw);
-void intel_emit_post_sync_nonzero_flush(struct brw_context *brw);
-void intel_emit_depth_stall_flushes(struct brw_context *brw);
+void brw_emit_mi_flush(struct brw_context *brw);
+void brw_emit_post_sync_nonzero_flush(struct brw_context *brw);
+void brw_emit_depth_stall_flushes(struct brw_context *brw);
 void gen7_emit_vs_workaround_flush(struct brw_context *brw);
 void gen7_emit_cs_stall_flush(struct brw_context *brw);
 
src/mesa/drivers/dri/i965/brw_draw.c +2 -2
index 96e2369..ac8daaf 100644
@@ -214,7 +214,7 @@ static void brw_emit_prim(struct brw_context *brw,
     * the besides the draw code.
     */
    if (brw->always_flush_cache) {
-      intel_batchbuffer_emit_mi_flush(brw);
+      brw_emit_mi_flush(brw);
    }
 
    /* If indirect, emit a bunch of loads from the indirect BO. */
@@ -277,7 +277,7 @@ static void brw_emit_prim(struct brw_context *brw,
    ADVANCE_BATCH();
 
    if (brw->always_flush_cache) {
-      intel_batchbuffer_emit_mi_flush(brw);
+      brw_emit_mi_flush(brw);
    }
 }
 
src/mesa/drivers/dri/i965/brw_meta_fast_clear.c +2 -2
index 06916e2..d5cec0d 100644
@@ -616,7 +616,7 @@ brw_meta_fast_clear(struct brw_context *brw, struct gl_framebuffer *fb,
     *     write-flush must be issued before sending any DRAW commands on that
     *     render target.
     */
-   intel_batchbuffer_emit_mi_flush(brw);
+   brw_emit_mi_flush(brw);
 
    /* If we had to fall back to plain clear for any buffers, clear those now
     * by calling into meta.
@@ -670,7 +670,7 @@ brw_meta_resolve_color(struct brw_context *brw,
    GLuint fbo, rbo;
    struct rect rect;
 
-   intel_batchbuffer_emit_mi_flush(brw);
+   brw_emit_mi_flush(brw);
 
    _mesa_meta_begin(ctx, MESA_META_ALL);
 
src/mesa/drivers/dri/i965/brw_meta_stencil_blit.c +4 -4
index fc7018d..84cfc05 100644
@@ -493,11 +493,11 @@ brw_meta_fbo_stencil_blit(struct brw_context *brw,
                              .mirror_x = mirror_x, .mirror_y = mirror_y };
    adjust_mip_level(dst_mt, dst_irb->mt_level, dst_irb->mt_layer, &dims);
 
-   intel_batchbuffer_emit_mi_flush(brw);
+   brw_emit_mi_flush(brw);
    _mesa_meta_begin(ctx, MESA_META_ALL);
    brw_meta_stencil_blit(brw,
                          dst_mt, dst_irb->mt_level, dst_irb->mt_layer, &dims);
-   intel_batchbuffer_emit_mi_flush(brw);
+   brw_emit_mi_flush(brw);
 }
 
 void
@@ -517,7 +517,7 @@ brw_meta_stencil_updownsample(struct brw_context *brw,
    if (dst->stencil_mt)
       dst = dst->stencil_mt;
 
-   intel_batchbuffer_emit_mi_flush(brw);
+   brw_emit_mi_flush(brw);
    _mesa_meta_begin(ctx, MESA_META_ALL);
 
    _mesa_GenFramebuffers(1, &fbo);
@@ -528,7 +528,7 @@ brw_meta_stencil_updownsample(struct brw_context *brw,
                                  GL_RENDERBUFFER, rbo);
 
    brw_meta_stencil_blit(brw, dst, 0, 0, &dims);
-   intel_batchbuffer_emit_mi_flush(brw);
+   brw_emit_mi_flush(brw);
 
    _mesa_DeleteRenderbuffers(1, &rbo);
    _mesa_DeleteFramebuffers(1, &fbo);
src/mesa/drivers/dri/i965/brw_meta_updownsample.c +2 -2
index 21507b1..f39d50a 100644
@@ -116,7 +116,7 @@ brw_meta_updownsample(struct brw_context *brw,
       blit_bit = GL_COLOR_BUFFER_BIT;
    }
 
-   intel_batchbuffer_emit_mi_flush(brw);
+   brw_emit_mi_flush(brw);
 
    _mesa_meta_begin(ctx, MESA_META_ALL);
    _mesa_GenFramebuffers(2, fbos);
@@ -147,5 +147,5 @@ brw_meta_updownsample(struct brw_context *brw,
 
    _mesa_meta_end(ctx);
 
-   intel_batchbuffer_emit_mi_flush(brw);
+   brw_emit_mi_flush(brw);
 }
src/mesa/drivers/dri/i965/brw_misc_state.c +1 -1
index 78a46cb..7357155 100644
@@ -577,7 +577,7 @@ brw_emit_depth_stencil_hiz(struct brw_context *brw,
     * non-pipelined state that will need the PIPE_CONTROL workaround.
     */
    if (brw->gen == 6) {
-      intel_emit_depth_stall_flushes(brw);
+      brw_emit_depth_stall_flushes(brw);
    }
 
    unsigned int len;
src/mesa/drivers/dri/i965/brw_performance_monitor.c +4 -4
index 2c8cd49..0a12375 100644
@@ -581,7 +581,7 @@ snapshot_statistics_registers(struct brw_context *brw,
    const int group = PIPELINE_STATS_COUNTERS;
    const int num_counters = ctx->PerfMonitor.Groups[group].NumCounters;
 
-   intel_batchbuffer_emit_mi_flush(brw);
+   brw_emit_mi_flush(brw);
 
    for (int i = 0; i < num_counters; i++) {
       if (BITSET_TEST(monitor->base.ActiveCounters[group], i)) {
@@ -687,7 +687,7 @@ stop_oa_counters(struct brw_context *brw)
  * The amount of batch space it takes to emit an MI_REPORT_PERF_COUNT snapshot,
  * including the required PIPE_CONTROL flushes.
  *
- * Sandybridge is the worst case scenario: intel_batchbuffer_emit_mi_flush
+ * Sandybridge is the worst case scenario: brw_emit_mi_flush
  * expands to three PIPE_CONTROLs which are 4 DWords each.  We have to flush
  * before and after MI_REPORT_PERF_COUNT, so multiply by two.  Finally, add
  * the 3 DWords for MI_REPORT_PERF_COUNT itself.
@@ -713,7 +713,7 @@ emit_mi_report_perf_count(struct brw_context *brw,
    int batch_used = brw->batch.used;
 
    /* Reports apparently don't always get written unless we flush first. */
-   intel_batchbuffer_emit_mi_flush(brw);
+   brw_emit_mi_flush(brw);
 
    if (brw->gen == 5) {
       /* Ironlake requires two MI_REPORT_PERF_COUNT commands to write all
@@ -751,7 +751,7 @@ emit_mi_report_perf_count(struct brw_context *brw,
    }
 
    /* Reports apparently don't always get written unless we flush after. */
-   intel_batchbuffer_emit_mi_flush(brw);
+   brw_emit_mi_flush(brw);
 
    (void) batch_used;
    assert(brw->batch.used - batch_used <= MI_REPORT_PERF_COUNT_BATCH_DWORDS * 4);
src/mesa/drivers/dri/i965/brw_pipe_control.c +4 -4
index c216f6d..dfef436 100644
@@ -193,7 +193,7 @@ brw_emit_pipe_control_write(struct brw_context *brw, uint32_t flags,
  * already flushed (e.g., via a preceding MI_FLUSH).
  */
 void
-intel_emit_depth_stall_flushes(struct brw_context *brw)
+brw_emit_depth_stall_flushes(struct brw_context *brw)
 {
    assert(brw->gen >= 6 && brw->gen <= 9);
 
@@ -274,7 +274,7 @@ gen7_emit_cs_stall_flush(struct brw_context *brw)
  * really our business.  That leaves only stall at scoreboard.
  */
 void
-intel_emit_post_sync_nonzero_flush(struct brw_context *brw)
+brw_emit_post_sync_nonzero_flush(struct brw_context *brw)
 {
    brw_emit_pipe_control_flush(brw,
                                PIPE_CONTROL_CS_STALL |
@@ -291,7 +291,7 @@ intel_emit_post_sync_nonzero_flush(struct brw_context *brw)
  * This is also used for the always_flush_cache driconf debug option.
  */
 void
-intel_batchbuffer_emit_mi_flush(struct brw_context *brw)
+brw_emit_mi_flush(struct brw_context *brw)
 {
    if (brw->batch.ring == BLT_RING && brw->gen >= 6) {
       BEGIN_BATCH_BLT(4);
@@ -325,7 +325,7 @@ intel_batchbuffer_emit_mi_flush(struct brw_context *brw)
              * Flush Enable =1, a PIPE_CONTROL with any non-zero
              * post-sync-op is required.
              */
-            intel_emit_post_sync_nonzero_flush(brw);
+            brw_emit_post_sync_nonzero_flush(brw);
          }
       }
       brw_emit_pipe_control_flush(brw, flags);
src/mesa/drivers/dri/i965/brw_state_upload.c +2 -2
index ab316bf..e7ef41c 100644
@@ -341,7 +341,7 @@ brw_upload_initial_gpu_state(struct brw_context *brw)
       return;
 
    if (brw->gen == 6)
-      intel_emit_post_sync_nonzero_flush(brw);
+      brw_emit_post_sync_nonzero_flush(brw);
 
    brw_upload_invariant_state(brw);
 
@@ -687,7 +687,7 @@ brw_upload_pipeline_state(struct brw_context *brw,
 
    /* Emit Sandybridge workaround flushes on every primitive, for safety. */
    if (brw->gen == 6)
-      intel_emit_post_sync_nonzero_flush(brw);
+      brw_emit_post_sync_nonzero_flush(brw);
 
    brw_upload_programs(brw, pipeline);
    merge_ctx_state(brw, &state);
src/mesa/drivers/dri/i965/gen6_blorp.cpp +3 -3
index b6a3d78..54c4a6d 100644
@@ -821,7 +821,7 @@ gen6_blorp_emit_depth_stencil_config(struct brw_context *brw,
 
    /* 3DSTATE_DEPTH_BUFFER */
    {
-      intel_emit_depth_stall_flushes(brw);
+      brw_emit_depth_stall_flushes(brw);
 
       BEGIN_BATCH(7);
       /* 3DSTATE_DEPTH_BUFFER dw0 */
@@ -896,7 +896,7 @@ static void
 gen6_blorp_emit_depth_disable(struct brw_context *brw,
                               const brw_blorp_params *params)
 {
-   intel_emit_depth_stall_flushes(brw);
+   brw_emit_depth_stall_flushes(brw);
 
    BEGIN_BATCH(7);
    OUT_BATCH(_3DSTATE_DEPTH_BUFFER << 16 | (7 - 2));
@@ -1021,7 +1021,7 @@ gen6_blorp_exec(struct brw_context *brw,
    uint32_t prog_offset = params->get_wm_prog(brw, &prog_data);
 
    /* Emit workaround flushes when we switch from drawing to blorping. */
-   intel_emit_post_sync_nonzero_flush(brw);
+   brw_emit_post_sync_nonzero_flush(brw);
 
    gen6_emit_3dstate_multisample(brw, params->dst.num_samples);
    gen6_emit_3dstate_sample_mask(brw,
src/mesa/drivers/dri/i965/gen6_depth_state.c +1 -1
index 1df0bd4..8f0d7dc 100644
@@ -65,7 +65,7 @@ gen6_emit_depth_stencil_hiz(struct brw_context *brw,
     */
    bool enable_hiz_ss = hiz || separate_stencil;
 
-   intel_emit_depth_stall_flushes(brw);
+   brw_emit_depth_stall_flushes(brw);
 
    irb = intel_get_renderbuffer(fb, BUFFER_DEPTH);
    if (!irb)
src/mesa/drivers/dri/i965/gen6_queryobj.c +3 -3
index 6431ed5..0092528 100644
@@ -86,7 +86,7 @@ static void
 write_primitives_generated(struct brw_context *brw,
                            drm_intel_bo *query_bo, int stream, int idx)
 {
-   intel_batchbuffer_emit_mi_flush(brw);
+   brw_emit_mi_flush(brw);
 
    if (brw->gen >= 7 && stream > 0) {
       brw_store_register_mem64(brw, query_bo,
@@ -100,7 +100,7 @@ static void
 write_xfb_primitives_written(struct brw_context *brw,
                              drm_intel_bo *bo, int stream, int idx)
 {
-   intel_batchbuffer_emit_mi_flush(brw);
+   brw_emit_mi_flush(brw);
 
    if (brw->gen >= 7) {
       brw_store_register_mem64(brw, bo, GEN7_SO_NUM_PRIMS_WRITTEN(stream), idx);
@@ -157,7 +157,7 @@ emit_pipeline_stat(struct brw_context *brw, drm_intel_bo *bo,
    /* Emit a flush to make sure various parts of the pipeline are complete and
     * we get an accurate value
     */
-   intel_batchbuffer_emit_mi_flush(brw);
+   brw_emit_mi_flush(brw);
 
    brw_store_register_mem64(brw, bo, reg, idx);
 }
src/mesa/drivers/dri/i965/gen6_sol.c +1 -1
index be80d7b..3899ce9 100644
@@ -292,5 +292,5 @@ brw_end_transform_feedback(struct gl_context *ctx,
     * simplicity, just do a full flush.
     */
    struct brw_context *brw = brw_context(ctx);
-   intel_batchbuffer_emit_mi_flush(brw);
+   brw_emit_mi_flush(brw);
 }
src/mesa/drivers/dri/i965/gen6_urb.c +1 -1
index 107a4f2..c7311fd 100644
@@ -120,7 +120,7 @@ gen6_upload_urb( struct brw_context *brw )
     * a workaround.
     */
    if (brw->urb.gs_present && !gs_present)
-      intel_batchbuffer_emit_mi_flush(brw);
+      brw_emit_mi_flush(brw);
    brw->urb.gs_present = gs_present;
 }
 
src/mesa/drivers/dri/i965/gen7_blorp.cpp +2 -2
index 2bdc82b..abace6d 100644
@@ -645,7 +645,7 @@ gen7_blorp_emit_depth_stencil_config(struct brw_context *brw,
 
    /* 3DSTATE_DEPTH_BUFFER */
    {
-      intel_emit_depth_stall_flushes(brw);
+      brw_emit_depth_stall_flushes(brw);
 
       BEGIN_BATCH(7);
       OUT_BATCH(GEN7_3DSTATE_DEPTH_BUFFER << 16 | (7 - 2));
@@ -696,7 +696,7 @@ gen7_blorp_emit_depth_stencil_config(struct brw_context *brw,
 static void
 gen7_blorp_emit_depth_disable(struct brw_context *brw)
 {
-   intel_emit_depth_stall_flushes(brw);
+   brw_emit_depth_stall_flushes(brw);
 
    BEGIN_BATCH(7);
    OUT_BATCH(GEN7_3DSTATE_DEPTH_BUFFER << 16 | (7 - 2));
src/mesa/drivers/dri/i965/gen7_misc_state.c +1 -1
index f4f6652..a14d4a0 100644
@@ -57,7 +57,7 @@ gen7_emit_depth_stencil_hiz(struct brw_context *brw,
       return;
    }
 
-   intel_emit_depth_stall_flushes(brw);
+   brw_emit_depth_stall_flushes(brw);
 
    irb = intel_get_renderbuffer(fb, BUFFER_DEPTH);
    if (!irb)
src/mesa/drivers/dri/i965/gen7_sol_state.c +2 -2
index aec4f44..41573a8 100644
@@ -365,7 +365,7 @@ gen7_save_primitives_written_counters(struct brw_context *brw,
    }
 
    /* Flush any drawing so that the counters have the right values. */
-   intel_batchbuffer_emit_mi_flush(brw);
+   brw_emit_mi_flush(brw);
 
    /* Emit MI_STORE_REGISTER_MEM commands to write the values. */
    for (int i = 0; i < streams; i++) {
@@ -502,7 +502,7 @@ gen7_pause_transform_feedback(struct gl_context *ctx,
       (struct brw_transform_feedback_object *) obj;
 
    /* Flush any drawing so that the counters have the right values. */
-   intel_batchbuffer_emit_mi_flush(brw);
+   brw_emit_mi_flush(brw);
 
    /* Save the SOL buffer offset register values. */
    if (brw->gen < 8) {
src/mesa/drivers/dri/i965/gen8_depth_state.c +1 -1
index b502650..c681b63 100644
@@ -57,7 +57,7 @@ emit_depth_packets(struct brw_context *brw,
       return;
    }
 
-   intel_emit_depth_stall_flushes(brw);
+   brw_emit_depth_stall_flushes(brw);
 
    /* _NEW_BUFFERS, _NEW_DEPTH, _NEW_STENCIL */
    BEGIN_BATCH(8);
src/mesa/drivers/dri/i965/intel_blit.c +3 -3
index 7680a40..9f44451 100644
@@ -432,7 +432,7 @@ intelEmitCopyBlit(struct brw_context *brw,
 
    ADVANCE_BATCH_TILED(dst_y_tiled, src_y_tiled);
 
-   intel_batchbuffer_emit_mi_flush(brw);
+   brw_emit_mi_flush(brw);
 
    return true;
 }
@@ -516,7 +516,7 @@ intelEmitImmediateColorExpandBlit(struct brw_context *brw,
 
    intel_batchbuffer_data(brw, src_bits, dwords * 4, BLT_RING);
 
-   intel_batchbuffer_emit_mi_flush(brw);
+   brw_emit_mi_flush(brw);
 
    return true;
 }
@@ -639,5 +639,5 @@ intel_miptree_set_alpha_to_one(struct brw_context *brw,
    OUT_BATCH(0xffffffff); /* white, but only alpha gets written */
    ADVANCE_BATCH_TILED(dst_y_tiled, false);
 
-   intel_batchbuffer_emit_mi_flush(brw);
+   brw_emit_mi_flush(brw);
 }
src/mesa/drivers/dri/i965/intel_buffer_objects.c +2 -2
index 627c487..ff05b5c 100644
@@ -560,7 +560,7 @@ brw_unmap_buffer(struct gl_context *ctx,
        * flush.  Once again, we wish for a domain tracker in libdrm to cover
        * usage inside of a batchbuffer.
        */
-      intel_batchbuffer_emit_mi_flush(brw);
+      brw_emit_mi_flush(brw);
 
       drm_intel_bo_unreference(intel_obj->range_map_bo[index]);
       intel_obj->range_map_bo[index] = NULL;
@@ -632,7 +632,7 @@ brw_copy_buffer_subdata(struct gl_context *ctx,
     * flush.  Once again, we wish for a domain tracker in libdrm to cover
     * usage inside of a batchbuffer.
     */
-   intel_batchbuffer_emit_mi_flush(brw);
+   brw_emit_mi_flush(brw);
 }
 
 void
src/mesa/drivers/dri/i965/intel_extensions.c +3 -3
index e650419..7cac56f 100644
@@ -76,7 +76,7 @@ can_do_pipelined_register_writes(struct brw_context *brw)
    OUT_BATCH(expected_value);
    ADVANCE_BATCH();
 
-   intel_batchbuffer_emit_mi_flush(brw);
+   brw_emit_mi_flush(brw);
 
    /* Save the register's value back to the buffer. */
    BEGIN_BATCH(3);
@@ -132,7 +132,7 @@ can_write_oacontrol(struct brw_context *brw)
    OUT_BATCH(expected_value);
    ADVANCE_BATCH();
 
-   intel_batchbuffer_emit_mi_flush(brw);
+   brw_emit_mi_flush(brw);
 
    /* Save the register's value back to the buffer. */
    BEGIN_BATCH(3);
@@ -143,7 +143,7 @@ can_write_oacontrol(struct brw_context *brw)
              offset * sizeof(uint32_t));
    ADVANCE_BATCH();
 
-   intel_batchbuffer_emit_mi_flush(brw);
+   brw_emit_mi_flush(brw);
 
    /* Set OACONTROL back to zero (everything off). */
    BEGIN_BATCH(3);
src/mesa/drivers/dri/i965/intel_fbo.c +1 -1
index aebed72..c6f447a 100644
@@ -1077,7 +1077,7 @@ brw_render_cache_set_check_flush(struct brw_context *brw, drm_intel_bo *bo)
    if (!_mesa_set_search(brw->render_cache, bo))
       return;
 
-   intel_batchbuffer_emit_mi_flush(brw);
+   brw_emit_mi_flush(brw);
 }
 
 /**
src/mesa/drivers/dri/i965/intel_syncobj.c +1 -1
index e500fa0..0432980 100644
@@ -71,7 +71,7 @@ intel_fence_sync(struct gl_context *ctx, struct gl_sync_object *s,
    struct intel_sync_object *sync = (struct intel_sync_object *)s;
 
    assert(condition == GL_SYNC_GPU_COMMANDS_COMPLETE);
-   intel_batchbuffer_emit_mi_flush(brw);
+   brw_emit_mi_flush(brw);
 
    sync->bo = brw->batch.bo;
    drm_intel_bo_reference(sync->bo);
Signature · 6 lines
2.1.4

_______________________________________________
mesa-dev mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-dev
#20 lore raw

PATCH 3/4 i965: Move pipecontrol workaround bo to brw_pipe_control

In reply to Chris Wilson

With the exception of gen8, the sole user of the workaround bo are for emitting pipe controls. More it out of the purview of the batchbuffer and into the pipecontrol.

---
 src/mesa/drivers/dri/i965/brw_context.c       |  7 +++++
 src/mesa/drivers/dri/i965/brw_context.h       | 13 +++++----
 src/mesa/drivers/dri/i965/brw_pipe_control.c  | 40 +++++++++++++++++++++++----
 src/mesa/drivers/dri/i965/gen8_depth_state.c  |  2 +-
 src/mesa/drivers/dri/i965/intel_batchbuffer.c | 12 --------
 src/mesa/drivers/dri/i965/intel_extensions.c  | 28 +++++++++----------
 6 files changed, 64 insertions(+), 38 deletions(-)
src/mesa/drivers/dri/i965/brw_context.c +7 -0
index 0f2f9ad..7be3f5c 100644
@@ -822,6 +822,12 @@ brwCreateContext(gl_api api,
       }
    }
 
+   if (brw_init_pipe_control(brw, devinfo)) {
+      *dri_ctx_error = __DRI_CTX_ERROR_NO_MEMORY;
+      intelDestroyContext(driContextPriv);
+      return false;
+   }
+
    brw_init_state(brw);
 
    intelInitExtensions(ctx);
@@ -940,6 +946,7 @@ intelDestroyContext(__DRIcontext * driContextPriv)
    if (ctx->swrast_context)
       _swrast_DestroyContext(&brw->ctx);
 
+   brw_fini_pipe_control(brw);
    intel_batchbuffer_free(brw);
 
    drm_intel_bo_unreference(brw->throttle_batch[1]);
src/mesa/drivers/dri/i965/brw_context.h +8 -5
index 8269db0..54f0dee 100644
@@ -867,8 +867,6 @@ struct intel_batchbuffer {
    drm_intel_bo *bo;
    /** Last BO submitted to the hardware.  Used for glFinish(). */
    drm_intel_bo *last_bo;
-   /** BO for post-sync nonzero writes for gen6 workaround. */
-   drm_intel_bo *workaround_bo;
 
    uint16_t emit, total;
    uint16_t used, reserved_space;
@@ -880,8 +878,6 @@ struct intel_batchbuffer {
    enum brw_gpu_ring ring;
    bool needs_sol_reset;
 
-   uint8_t pipe_controls_since_last_cs_stall;
-
    struct {
       uint16_t used;
       int reloc_count;
@@ -1017,6 +1013,10 @@ struct brw_context
 
    drm_intel_context *hw_ctx;
 
+   /** BO for post-sync nonzero writes for gen6 workaround. */
+   drm_intel_bo *workaround_bo;
+   uint8_t pipe_controls_since_last_cs_stall;
+
    /**
     * Set of drm_intel_bo * that have been rendered to within this batchbuffer
     * and would need flushing before being used from another cache domain that
@@ -1946,6 +1946,10 @@ gen6_upload_push_constants(struct brw_context *brw,
                            enum aub_state_struct_type type);
 
 /* brw_pipe_control.c */
+int brw_init_pipe_control(struct brw_context *brw,
+			  const struct brw_device_info *info);
+void brw_fini_pipe_control(struct brw_context *brw);
+
 void brw_emit_pipe_control_flush(struct brw_context *brw, uint32_t flags);
 void brw_emit_pipe_control_write(struct brw_context *brw, uint32_t flags,
                                  drm_intel_bo *bo, uint32_t offset,
@@ -1956,7 +1960,6 @@ void brw_emit_depth_stall_flushes(struct brw_context *brw);
 void gen7_emit_vs_workaround_flush(struct brw_context *brw);
 void gen7_emit_cs_stall_flush(struct brw_context *brw);
 
-
 #ifdef __cplusplus
 }
 #endif
src/mesa/drivers/dri/i965/brw_pipe_control.c +34 -6
index dfef436..37080bf 100644
@@ -76,13 +76,13 @@ gen7_cs_stall_every_four_pipe_controls(struct brw_context *brw, uint32_t flags)
    if (brw->gen == 7 && !brw->is_haswell) {
       if (flags & PIPE_CONTROL_CS_STALL) {
          /* If we're doing a CS stall, reset the counter and carry on. */
-         brw->batch.pipe_controls_since_last_cs_stall = 0;
+         brw->pipe_controls_since_last_cs_stall = 0;
          return 0;
       }
 
       /* If this is the fourth pipe control without a CS stall, do one now. */
-      if (++brw->batch.pipe_controls_since_last_cs_stall == 4) {
-         brw->batch.pipe_controls_since_last_cs_stall = 0;
+      if (++brw->pipe_controls_since_last_cs_stall == 4) {
+         brw->pipe_controls_since_last_cs_stall = 0;
          return PIPE_CONTROL_CS_STALL;
       }
    }
@@ -217,7 +217,7 @@ gen7_emit_vs_workaround_flush(struct brw_context *brw)
    brw_emit_pipe_control_write(brw,
                                PIPE_CONTROL_WRITE_IMMEDIATE
                                | PIPE_CONTROL_DEPTH_STALL,
-                               brw->batch.workaround_bo, 0,
+                               brw->workaround_bo, 0,
                                0, 0);
 }
 
@@ -231,7 +231,7 @@ gen7_emit_cs_stall_flush(struct brw_context *brw)
    brw_emit_pipe_control_write(brw,
                                PIPE_CONTROL_CS_STALL
                                | PIPE_CONTROL_WRITE_IMMEDIATE,
-                               brw->batch.workaround_bo, 0,
+                               brw->workaround_bo, 0,
                                0, 0);
 }
 
@@ -281,7 +281,7 @@ brw_emit_post_sync_nonzero_flush(struct brw_context *brw)
                                PIPE_CONTROL_STALL_AT_SCOREBOARD);
 
    brw_emit_pipe_control_write(brw, PIPE_CONTROL_WRITE_IMMEDIATE,
-                               brw->batch.workaround_bo, 0, 0, 0);
+                               brw->workaround_bo, 0, 0, 0);
 }
 
 /* Emit a pipelined flush to either flush render and texture cache for
@@ -333,3 +333,31 @@ brw_emit_mi_flush(struct brw_context *brw)
 
    brw_render_cache_set_clear(brw);
 }
+
+int
+brw_init_pipe_control(struct brw_context *brw,
+                      const struct brw_device_info *devinfo)
+{
+   if (devinfo->gen < 6)
+      return 0;
+
+   /* We can't just use brw_state_batch to get a chunk of space for
+    * the gen6 workaround because it involves actually writing to
+    * the buffer, and the kernel doesn't let us write to the batch.
+    */
+   brw->workaround_bo = drm_intel_bo_alloc(brw->bufmgr,
+                                           "pipe_control workaround",
+                                           4096, 4096);
+   if (brw->workaround_bo == NULL)
+      return -ENOMEM;
+
+   brw->pipe_controls_since_last_cs_stall = 0;
+
+   return 0;
+}
+
+void
+brw_fini_pipe_control(struct brw_context *brw)
+{
+   drm_intel_bo_unreference(brw->workaround_bo);
+}
src/mesa/drivers/dri/i965/gen8_depth_state.c +1 -1
index c681b63..ded2121 100644
@@ -489,7 +489,7 @@ gen8_hiz_exec(struct brw_context *brw, struct intel_mipmap_tree *mt,
     */
    brw_emit_pipe_control_write(brw,
                                PIPE_CONTROL_WRITE_IMMEDIATE,
-                               brw->batch.workaround_bo, 0, 0, 0);
+                               brw->workaround_bo, 0, 0, 0);
 
    /* Emit 3DSTATE_WM_HZ_OP again to disable the state overrides. */
    BEGIN_BATCH(5);
src/mesa/drivers/dri/i965/intel_batchbuffer.c +0 -12
index 6064117..fa3263d 100644
@@ -44,16 +44,6 @@ intel_batchbuffer_init(struct brw_context *brw)
 {
    intel_batchbuffer_reset(brw);
 
-   if (brw->gen >= 6) {
-      /* We can't just use brw_state_batch to get a chunk of space for
-       * the gen6 workaround because it involves actually writing to
-       * the buffer, and the kernel doesn't let us write to the batch.
-       */
-      brw->batch.workaround_bo = drm_intel_bo_alloc(brw->bufmgr,
-						      "pipe_control workaround",
-						      4096, 4096);
-   }
-
    if (!brw->has_llc) {
       brw->batch.cpu_map = malloc(BATCH_SZ);
       brw->batch.map = brw->batch.cpu_map;
@@ -82,7 +72,6 @@ intel_batchbuffer_reset(struct brw_context *brw)
    brw->batch.state_batch_offset = brw->batch.bo->size;
    brw->batch.used = 0;
    brw->batch.needs_sol_reset = false;
-   brw->batch.pipe_controls_since_last_cs_stall = 0;
 
    /* We don't know what ring the new batch will be sent to until we see the
     * first BEGIN_BATCH or BEGIN_BATCH_BLT.  Mark it as unknown.
@@ -114,7 +103,6 @@ intel_batchbuffer_free(struct brw_context *brw)
    free(brw->batch.cpu_map);
    drm_intel_bo_unreference(brw->batch.last_bo);
    drm_intel_bo_unreference(brw->batch.bo);
-   drm_intel_bo_unreference(brw->batch.workaround_bo);
 }
 
 static void
src/mesa/drivers/dri/i965/intel_extensions.c +14 -14
index 7cac56f..aa77a86 100644
@@ -64,10 +64,10 @@ can_do_pipelined_register_writes(struct brw_context *brw)
    /* Set a value in a BO to a known quantity.  The workaround BO already
     * exists and doesn't contain anything important, so we may as well use it.
     */
-   drm_intel_bo_map(brw->batch.workaround_bo, true);
-   data = brw->batch.workaround_bo->virtual;
+   drm_intel_bo_map(brw->workaround_bo, true);
+   data = brw->workaround_bo->virtual;
    data[offset] = 0xffffffff;
-   drm_intel_bo_unmap(brw->batch.workaround_bo);
+   drm_intel_bo_unmap(brw->workaround_bo);
 
    /* Write the register. */
    BEGIN_BATCH(3);
@@ -82,7 +82,7 @@ can_do_pipelined_register_writes(struct brw_context *brw)
    BEGIN_BATCH(3);
    OUT_BATCH(MI_STORE_REGISTER_MEM | (3 - 2));
    OUT_BATCH(reg);
-   OUT_RELOC(brw->batch.workaround_bo,
+   OUT_RELOC(brw->workaround_bo,
              I915_GEM_DOMAIN_INSTRUCTION, I915_GEM_DOMAIN_INSTRUCTION,
              offset * sizeof(uint32_t));
    ADVANCE_BATCH();
@@ -90,10 +90,10 @@ can_do_pipelined_register_writes(struct brw_context *brw)
    intel_batchbuffer_flush(brw);
 
    /* Check whether the value got written. */
-   drm_intel_bo_map(brw->batch.workaround_bo, false);
-   data = brw->batch.workaround_bo->virtual;
+   drm_intel_bo_map(brw->workaround_bo, false);
+   data = brw->workaround_bo->virtual;
    bool success = data[offset] == expected_value;
-   drm_intel_bo_unmap(brw->batch.workaround_bo);
+   drm_intel_bo_unmap(brw->workaround_bo);
 
    result = success;
 
@@ -120,10 +120,10 @@ can_write_oacontrol(struct brw_context *brw)
    /* Set a value in a BO to a known quantity.  The workaround BO already
     * exists and doesn't contain anything important, so we may as well use it.
     */
-   drm_intel_bo_map(brw->batch.workaround_bo, true);
-   data = brw->batch.workaround_bo->virtual;
+   drm_intel_bo_map(brw->workaround_bo, true);
+   data = brw->workaround_bo->virtual;
    data[offset] = 0xffffffff;
-   drm_intel_bo_unmap(brw->batch.workaround_bo);
+   drm_intel_bo_unmap(brw->workaround_bo);
 
    /* Write OACONTROL. */
    BEGIN_BATCH(3);
@@ -138,7 +138,7 @@ can_write_oacontrol(struct brw_context *brw)
    BEGIN_BATCH(3);
    OUT_BATCH(MI_STORE_REGISTER_MEM | (3 - 2));
    OUT_BATCH(OACONTROL);
-   OUT_RELOC(brw->batch.workaround_bo,
+   OUT_RELOC(brw->workaround_bo,
              I915_GEM_DOMAIN_INSTRUCTION, I915_GEM_DOMAIN_INSTRUCTION,
              offset * sizeof(uint32_t));
    ADVANCE_BATCH();
@@ -155,10 +155,10 @@ can_write_oacontrol(struct brw_context *brw)
    intel_batchbuffer_flush(brw);
 
    /* Check whether the value got written. */
-   drm_intel_bo_map(brw->batch.workaround_bo, false);
-   data = brw->batch.workaround_bo->virtual;
+   drm_intel_bo_map(brw->workaround_bo, false);
+   data = brw->workaround_bo->virtual;
    bool success = data[offset] == expected_value;
-   drm_intel_bo_unmap(brw->batch.workaround_bo);
+   drm_intel_bo_unmap(brw->workaround_bo);
 
    result = success;
 
Signature · 6 lines
2.1.4

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#21 lore raw

PATCH 4/4 i965: Introduce a context-local batch manager

In reply to Chris Wilson

When submitting commands to the GPU every cycle of latency counts; mutexes, spinlocks, even atomics quickly add to substantial overhead.

This "batch manager" acts as thread-local shim over the buffer manager (drm_intel_bufmgr_gem). As we are only ever used from within a single context, we can rely on the upper layers providing thread safety. This allows us to import buffers from the shared screen (sharing buffers between multiple contexts, threads and users) and wrap that handle in our own. Similarly, we will to share the buffer cache between all users on the file and so allocate from the global threadsafe buffer manager, will a very small and transient local cache of active buffers.

The batch manager provides a cheap way of busyness tracking and very efficient batch construction and kernel submission.

The restrictions over and above the generic submission engine in intel_bufmgr_gem are:
- not thread-safe
- flat relocations, only the batch buffer itself carries relocations. Relocations relative to auxiliary buffers must be performed via STATE_BASE
- direct mapping of the batch for writes, expect reads from the batch to be slow
- the batch is a fixed 64k in size
- access to the batch must be wrapped by brw_batch_begin/_end
- all relocations must be immediately written into the batch

The importance of the flat relocation tree with local offset handling is that it allows us to use the "relocation-less" execbuffer interfaces, dramatically reducing the overhead of batch submission.

ivb/bdw OglBatch7 improves by ~20% above and beyond the relocation
speedups in http://cgit.freedesktop.org/~ickle/linux-2.6/commit/?h=nightly&id=d664f006b340ad9b2b68c8b661aa396c0a72d0fb

ISSUES:
* add real kernel feature detection
* aub-annotation support (needs to expose the libdrm_intel aub writers)
* where is the doubly-linked circular list?
* shared mipmap trees between contexts - are they even legal?
* OglMultithread is nevertheless unhappy

==14653== Possible data race during read of size 4 at 0xBF930B4 by thread #2 ==14653== Locks held: none

==14653==    at 0x9FD5FC0: brw_bo_put (brw_batch.h:254)
==14653==    by 0x9FD5FC0: brw_merge_inputs (brw_draw.c:293)
==14653==    by 0x9FD635F: brw_try_draw_prims (brw_draw.c:426)
==14653==    by 0x9FD635F: brw_draw_prims (brw_draw.c:577)
==14653==    by 0x9DF748B: vbo_draw_arrays (vbo_exec_array.c:645)
==14653==    by 0x9E9B3D3: _mesa_meta_GenerateMipmap (meta_generate_mipmap.c:347)
==14653==    by 0x9D1F002: _mesa_generate_texture_mipmap (genmipmap.c:124)
==14653==    by 0x9D1F002: _mesa_GenerateMipmap (genmipmap.c:149)
==14653==    by 0x481FC1: TestHdrMultithread::WorkerThread::_RenderSingleLevelReflectionMaps(TestHdrMultithread::ReflTextureLevel, TestHdrMultithread::ReflTextureLevel, TestHdrMultithread::SphereLod) (in /usr/src/SynMark2_6/synmark2)
==14653==    by 0x4820B6: TestHdrMultithread::WorkerThread::Run() (in /usr/src/SynMark2_6/synmark2)
==14653==    by 0x49BDFC: (anonymous namespace)::_ThreadProc(void*) (in /usr/src/SynMark2_6/synmark2)
==14653==    by 0x4C2F056: mythread_wrapper (hg_intercepts.c:234)
==14653==    by 0x66C70A3: start_thread (pthread_create.c:309)
==14653==    by 0x69C204C: clone (clone.S:111)
==14653==
==14653== This conflicts with a previous write of size 4 by thread #3
==14653== Locks held: none
==14653==    at 0x9FD5FCE: brw_bo_put (brw_batch.h:255)
==14653==    by 0x9FD5FCE: brw_merge_inputs (brw_draw.c:293)
==14653==    by 0x9FD635F: brw_try_draw_prims (brw_draw.c:426)
==14653==    by 0x9FD635F: brw_draw_prims (brw_draw.c:577)
==14653==    by 0x9DF748B: vbo_draw_arrays (vbo_exec_array.c:645)
==14653==    by 0x445D53: OglHdrMultithread::_ThreadCommon::RenderSceneBackgroundFromView(OglHdrMultithread::_Effect&, OglHdrMultithread::_Vaos&, prmath::Matrix4x4<float> const&) const (in /usr/src/SynMark2_6/synmark2)
==14653==    by 0x446BE9: OglHdrMultithread::_WorkerThread::RenderSceneFromView(unsigned int, unsigned int, std::vector<ApiHdrMultithread::RenderObject, std::allocator<ApiHdrMultithread::RenderObject> > const&, std::vector<ApiHdrMultithread::RenderObject, std::allocator<ApiHdrMultithread::RenderObject> > const&, prmath::Vector3<float> const&, prmath::Matrix4x4<float> const&, prmath::Matrix4x4<float> const&, unsigned int, unsigned int, unsigned int) (in /usr/src/SynMark2_6/synmark2)
==14653==    by 0x481E6C: TestHdrMultithread::WorkerThread::_RenderSingleLevelReflectionMaps(TestHdrMultithread::ReflTextureLevel, TestHdrMultithread::ReflTextureLevel, TestHdrMultithread::SphereLod) (in /usr/src/SynMark2_6/synmark2)
==14653==    by 0x4820B6: TestHdrMultithread::WorkerThread::Run() (in /usr/src/SynMark2_6/synmark2)
==14653==    by 0x49BDFC: (anonymous namespace)::_ThreadProc(void*) (in /usr/src/SynMark2_6/synmark2)
==14653==  Address 0xbf930b4 is 68 bytes inside a block of size 144 alloc'd
==14653==    at 0x4C2A040: malloc (vg_replace_malloc.c:296)
==14653==    by 0x9FB2249: brw_bo_import (brw_batch.c:668)
==14653==    by 0x9FB2249: brw_bo_create (brw_batch.c:712)
==14653==    by 0xA0A744B: alloc_buffer_object (intel_buffer_objects.c:67)
==14653==    by 0xA0A744B: brw_buffer_data (intel_buffer_objects.c:173)
==14653==    by 0x9C2BF20: _mesa_buffer_data (bufferobj.c:1564)
==14653==    by 0x9C2BF20: _mesa_BufferData (bufferobj.c:1595)
==14653==    by 0x9E9B375: _mesa_meta_GenerateMipmap (meta_generate_mipmap.c:327)
==14653==    by 0x9D1F002: _mesa_generate_texture_mipmap (genmipmap.c:124)
==14653==    by 0x9D1F002: _mesa_GenerateMipmap (genmipmap.c:149)
==14653==    by 0x461648: (anonymous namespace)::_Gl30CreateTextureFromImage(unsigned int, Image const&, bool) (in /usr/src/SynMark2_6/synmark2)
==14653==    by 0x461824: OglTex::CreateTextureCubeMapFromFile(OglExt::VersionId, char const*, bool) (in /usr/src/SynMark2_6/synmark2)
==14653==    by 0x443759: OglHdrMultithread::LoadTexture(char const*) (in /usr/src/SynMark2_6/synmark2)
==14653==    by 0x46BB17: Test::InitializeAll(WndHandleSys const&, unsigned int, unsigned int, ApiTypes::ColorFormat, ApiTypes::DepthFormat, bool, bool) (in /usr/src/SynMark2_6/synmark2)
==14653==    by 0x416FF6: TestFramework::OnWindowCreate(WndHandleSys const&) (in /usr/src/SynMark2_6/synmark2)
==14653==    by 0x49985B: AppWindowSys::AppWindowSys(AppWindow::Parameters const&, AppWindow::Events&) (in /usr/src/SynMark2_6/synmark2)

==14653== Block was alloc'd by thread #1
==14653==

which implies that treating the entire context as atomic is an incorrect assumption

* Add full-ppgtt softpinning support (no more relocations, at least for the first 4G)
* polish and move to libdrm; though at the cost of sealing the structs?

Cc Daniel Vetter <[email protected]>
Cc Kristian Høgsberg <[email protected]>
Cc Kenneth Graunke <[email protected]>
Cc Jesse Barnes <[email protected]>
Cc Ian Romanick <[email protected]>
Cc Abdiel Janulgue <[email protected]>
Cc Eero Tamminen <[email protected]>
---
 src/mesa/drivers/dri/i965/Makefile.sources         |    4 +-
 src/mesa/drivers/dri/i965/brw_batch.c              | 1079 ++++++++++++++++++++
 src/mesa/drivers/dri/i965/brw_batch.h              |  309 ++++++
 src/mesa/drivers/dri/i965/brw_binding_tables.c     |    1 -
 src/mesa/drivers/dri/i965/brw_blorp.cpp            |   45 +-
 src/mesa/drivers/dri/i965/brw_cc.c                 |   16 +-
 src/mesa/drivers/dri/i965/brw_clear.c              |    1 -
 src/mesa/drivers/dri/i965/brw_clip.c               |    2 -
 src/mesa/drivers/dri/i965/brw_clip_line.c          |    2 -
 src/mesa/drivers/dri/i965/brw_clip_point.c         |    2 -
 src/mesa/drivers/dri/i965/brw_clip_state.c         |   14 +-
 src/mesa/drivers/dri/i965/brw_clip_tri.c           |    2 -
 src/mesa/drivers/dri/i965/brw_clip_unfilled.c      |    2 -
 src/mesa/drivers/dri/i965/brw_clip_util.c          |    2 -
 src/mesa/drivers/dri/i965/brw_context.c            |  196 ++--
 src/mesa/drivers/dri/i965/brw_context.h            |  138 +--
 src/mesa/drivers/dri/i965/brw_curbe.c              |    1 -
 src/mesa/drivers/dri/i965/brw_draw.c               |   66 +-
 src/mesa/drivers/dri/i965/brw_draw_upload.c        |   23 +-
 src/mesa/drivers/dri/i965/brw_ff_gs.c              |    2 -
 src/mesa/drivers/dri/i965/brw_ff_gs_emit.c         |    1 -
 src/mesa/drivers/dri/i965/brw_fs.cpp               |    5 +-
 src/mesa/drivers/dri/i965/brw_list.h               |  353 +++++++
 src/mesa/drivers/dri/i965/brw_meta_fast_clear.c    |    1 -
 src/mesa/drivers/dri/i965/brw_meta_stencil_blit.c  |    1 -
 src/mesa/drivers/dri/i965/brw_meta_updownsample.c  |    1 -
 src/mesa/drivers/dri/i965/brw_misc_state.c         |   10 +-
 src/mesa/drivers/dri/i965/brw_object_purgeable.c   |    8 +-
 .../drivers/dri/i965/brw_performance_monitor.c     |   74 +-
 src/mesa/drivers/dri/i965/brw_pipe_control.c       |   44 +-
 src/mesa/drivers/dri/i965/brw_primitive_restart.c  |    2 -
 src/mesa/drivers/dri/i965/brw_program.c            |   26 +-
 src/mesa/drivers/dri/i965/brw_queryobj.c           |   47 +-
 src/mesa/drivers/dri/i965/brw_reset.c              |   13 +-
 src/mesa/drivers/dri/i965/brw_sampler_state.c      |    8 +-
 src/mesa/drivers/dri/i965/brw_sf.c                 |    2 -
 src/mesa/drivers/dri/i965/brw_sf_emit.c            |    2 -
 src/mesa/drivers/dri/i965/brw_sf_state.c           |   21 +-
 src/mesa/drivers/dri/i965/brw_state.h              |    2 +-
 src/mesa/drivers/dri/i965/brw_state_batch.c        |   41 +-
 src/mesa/drivers/dri/i965/brw_state_cache.c        |   49 +-
 src/mesa/drivers/dri/i965/brw_state_dump.c         |   67 +-
 src/mesa/drivers/dri/i965/brw_state_upload.c       |   16 +-
 src/mesa/drivers/dri/i965/brw_structs.h            |   30 +-
 src/mesa/drivers/dri/i965/brw_urb.c                |    9 +-
 src/mesa/drivers/dri/i965/brw_vec4.cpp             |    5 +-
 src/mesa/drivers/dri/i965/brw_vs_state.c           |   29 +-
 src/mesa/drivers/dri/i965/brw_vs_surface_state.c   |    4 +-
 src/mesa/drivers/dri/i965/brw_wm_state.c           |   38 +-
 src/mesa/drivers/dri/i965/brw_wm_surface_state.c   |   84 +-
 src/mesa/drivers/dri/i965/gen6_blorp.cpp           |   17 +-
 src/mesa/drivers/dri/i965/gen6_cc.c                |    1 -
 src/mesa/drivers/dri/i965/gen6_clip_state.c        |    1 -
 src/mesa/drivers/dri/i965/gen6_depth_state.c       |    1 -
 src/mesa/drivers/dri/i965/gen6_depthstencil.c      |    1 -
 src/mesa/drivers/dri/i965/gen6_gs_state.c          |    1 -
 src/mesa/drivers/dri/i965/gen6_multisample_state.c |    1 -
 src/mesa/drivers/dri/i965/gen6_queryobj.c          |   48 +-
 src/mesa/drivers/dri/i965/gen6_sampler_state.c     |    1 -
 src/mesa/drivers/dri/i965/gen6_scissor_state.c     |    1 -
 src/mesa/drivers/dri/i965/gen6_sf_state.c          |    1 -
 src/mesa/drivers/dri/i965/gen6_sol.c               |    9 +-
 src/mesa/drivers/dri/i965/gen6_surface_state.c     |   15 +-
 src/mesa/drivers/dri/i965/gen6_urb.c               |    1 -
 src/mesa/drivers/dri/i965/gen6_viewport_state.c    |    1 -
 src/mesa/drivers/dri/i965/gen6_vs_state.c          |    2 +-
 src/mesa/drivers/dri/i965/gen6_wm_state.c          |    1 -
 src/mesa/drivers/dri/i965/gen7_blorp.cpp           |   16 +-
 src/mesa/drivers/dri/i965/gen7_disable.c           |    1 -
 src/mesa/drivers/dri/i965/gen7_gs_state.c          |    1 -
 src/mesa/drivers/dri/i965/gen7_misc_state.c        |    3 +-
 src/mesa/drivers/dri/i965/gen7_sf_state.c          |    1 -
 src/mesa/drivers/dri/i965/gen7_sol_state.c         |   19 +-
 src/mesa/drivers/dri/i965/gen7_urb.c               |    1 -
 src/mesa/drivers/dri/i965/gen7_viewport_state.c    |    1 -
 src/mesa/drivers/dri/i965/gen7_vs_state.c          |    1 -
 src/mesa/drivers/dri/i965/gen7_wm_state.c          |    1 -
 src/mesa/drivers/dri/i965/gen7_wm_surface_state.c  |   59 +-
 src/mesa/drivers/dri/i965/gen8_blend_state.c       |    1 -
 src/mesa/drivers/dri/i965/gen8_depth_state.c       |    7 +-
 src/mesa/drivers/dri/i965/gen8_disable.c           |    1 -
 src/mesa/drivers/dri/i965/gen8_draw_upload.c       |    1 -
 src/mesa/drivers/dri/i965/gen8_gs_state.c          |    1 -
 src/mesa/drivers/dri/i965/gen8_misc_state.c        |    1 -
 src/mesa/drivers/dri/i965/gen8_multisample_state.c |    1 -
 src/mesa/drivers/dri/i965/gen8_ps_state.c          |    1 -
 src/mesa/drivers/dri/i965/gen8_sf_state.c          |    1 -
 src/mesa/drivers/dri/i965/gen8_sol_state.c         |    3 +-
 src/mesa/drivers/dri/i965/gen8_surface_state.c     |   78 +-
 src/mesa/drivers/dri/i965/gen8_viewport_state.c    |    1 -
 src/mesa/drivers/dri/i965/gen8_vs_state.c          |    1 -
 src/mesa/drivers/dri/i965/gen8_wm_depth_stencil.c  |    1 -
 src/mesa/drivers/dri/i965/intel_batchbuffer.c      |  453 --------
 src/mesa/drivers/dri/i965/intel_batchbuffer.h      |  179 ----
 src/mesa/drivers/dri/i965/intel_blit.c             |   58 +-
 src/mesa/drivers/dri/i965/intel_blit.h             |   10 +-
 src/mesa/drivers/dri/i965/intel_buffer_objects.c   |  185 ++--
 src/mesa/drivers/dri/i965/intel_buffer_objects.h   |   18 +-
 src/mesa/drivers/dri/i965/intel_debug.c            |    4 +-
 src/mesa/drivers/dri/i965/intel_extensions.c       |   43 +-
 src/mesa/drivers/dri/i965/intel_fbo.c              |   46 +-
 src/mesa/drivers/dri/i965/intel_fbo.h              |    4 -
 src/mesa/drivers/dri/i965/intel_image.h            |    6 +-
 src/mesa/drivers/dri/i965/intel_mipmap_tree.c      |   81 +-
 src/mesa/drivers/dri/i965/intel_mipmap_tree.h      |   11 +-
 src/mesa/drivers/dri/i965/intel_pixel_bitmap.c     |    3 +-
 src/mesa/drivers/dri/i965/intel_pixel_copy.c       |    3 -
 src/mesa/drivers/dri/i965/intel_pixel_draw.c       |    2 +-
 src/mesa/drivers/dri/i965/intel_pixel_read.c       |   22 +-
 src/mesa/drivers/dri/i965/intel_screen.c           |   44 +-
 src/mesa/drivers/dri/i965/intel_screen.h           |   13 +-
 src/mesa/drivers/dri/i965/intel_syncobj.c          |   17 +-
 src/mesa/drivers/dri/i965/intel_tex.c              |    6 +-
 src/mesa/drivers/dri/i965/intel_tex_image.c        |   30 +-
 src/mesa/drivers/dri/i965/intel_tex_subimage.c     |   25 +-
 src/mesa/drivers/dri/i965/intel_upload.c           |   33 +-
 116 files changed, 2541 insertions(+), 1961 deletions(-)
 create mode 100644 src/mesa/drivers/dri/i965/brw_batch.c
 create mode 100644 src/mesa/drivers/dri/i965/brw_batch.h
 create mode 100644 src/mesa/drivers/dri/i965/brw_list.h
 delete mode 100644 src/mesa/drivers/dri/i965/intel_batchbuffer.c
 delete mode 100644 src/mesa/drivers/dri/i965/intel_batchbuffer.h
src/mesa/drivers/dri/i965/Makefile.sources +2 -2
index a9f9129..32bd552 100644
@@ -1,4 +1,6 @@
 i965_FILES = \
+	brw_batch.c \
+	brw_batch.h \
 	brw_binding_tables.c \
 	brw_blorp_blit.cpp \
 	brw_blorp_blit_eu.cpp \
@@ -180,8 +182,6 @@ i965_FILES = \
 	gen8_wm_depth_stencil.c \
 	intel_asm_annotation.c \
 	intel_asm_annotation.h \
-	intel_batchbuffer.c \
-	intel_batchbuffer.h \
 	intel_blit.c \
 	intel_blit.h \
 	intel_buffer_objects.c \
src/mesa/drivers/dri/i965/brw_batch.c new file +1079 -0

1,079 lines not on this page · raw message

src/mesa/drivers/dri/i965/brw_batch.h new file +309 -0

309 lines not on this page · raw message

src/mesa/drivers/dri/i965/brw_binding_tables.c +0 -1
index 98ff0dd..697b4c7 100644
@@ -42,7 +42,6 @@
 #include "brw_context.h"
 #include "brw_defines.h"
 #include "brw_state.h"
-#include "intel_batchbuffer.h"
 
 /**
  * Upload a shader stage's binding table as indirect state.
src/mesa/drivers/dri/i965/brw_blorp.cpp +7 -38

82 lines not on this page · raw message

src/mesa/drivers/dri/i965/brw_cc.c +6 -10
index 354c733..4f62b29 100644
@@ -36,7 +36,6 @@
 #include "brw_util.h"
 #include "main/macros.h"
 #include "main/stencil.h"
-#include "intel_batchbuffer.h"
 
 static void
 brw_upload_cc_vp(struct brw_context *brw)
@@ -227,17 +226,14 @@ static void upload_cc_unit(struct brw_context *brw)
       cc->cc5.statistics_enable = 1;
 
    /* BRW_NEW_CC_VP */
-   cc->cc4.cc_viewport_state_offset = (brw->batch.bo->offset64 +
-				       brw->cc.vp_offset) >> 5; /* reloc */
+   cc->cc4.cc_viewport_state_offset =
+      brw_batch_reloc(&brw->batch,
+		      (brw->cc.state_offset +
+		       offsetof(struct brw_cc_unit_state, cc4)),
+		      brw->batch.bo, brw->cc.vp_offset,
+		      I915_GEM_DOMAIN_INSTRUCTION, 0) >> 5;
 
    brw->ctx.NewDriverState |= BRW_NEW_GEN4_UNIT_STATE;
-
-   /* Emit CC viewport relocation */
-   drm_intel_bo_emit_reloc(brw->batch.bo,
-			   (brw->cc.state_offset +
-			    offsetof(struct brw_cc_unit_state, cc4)),
-			   brw->batch.bo, brw->cc.vp_offset,
-			   I915_GEM_DOMAIN_INSTRUCTION, 0);
 }
 
 const struct brw_tracked_state brw_cc_unit = {
src/mesa/drivers/dri/i965/brw_clear.c +0 -1
index a6524aa..ef146a7 100644
@@ -32,7 +32,6 @@
 #include "swrast/swrast.h"
 #include "drivers/common/meta.h"
 
-#include "intel_batchbuffer.h"
 #include "intel_blit.h"
 #include "intel_fbo.h"
 #include "intel_mipmap_tree.h"
src/mesa/drivers/dri/i965/brw_clip.c +0 -2
index 3a73c64..e044375 100644
@@ -33,8 +33,6 @@
 #include "main/macros.h"
 #include "main/enums.h"
 
-#include "intel_batchbuffer.h"
-
 #include "brw_defines.h"
 #include "brw_context.h"
 #include "brw_eu.h"
src/mesa/drivers/dri/i965/brw_clip_line.c +0 -2
index 8e34f7c..65db789 100644
@@ -34,8 +34,6 @@
 #include "main/enums.h"
 #include "program/program.h"
 
-#include "intel_batchbuffer.h"
-
 #include "brw_defines.h"
 #include "brw_context.h"
 #include "brw_eu.h"
src/mesa/drivers/dri/i965/brw_clip_point.c +0 -2
index 81487d3..9c886ff 100644
@@ -34,8 +34,6 @@
 #include "main/enums.h"
 #include "program/program.h"
 
-#include "intel_batchbuffer.h"
-
 #include "brw_defines.h"
 #include "brw_context.h"
 #include "brw_eu.h"
src/mesa/drivers/dri/i965/brw_clip_state.c +6 -8
index 3223834..3770213 100644
@@ -130,16 +130,14 @@ brw_upload_clip_unit(struct brw_context *brw)
        ctx->ViewportArray[0].Width == (float) fb->Width &&
        ctx->ViewportArray[0].Height == (float) fb->Height)
    {
+      /* emit clip viewport relocation */
       clip->clip5.guard_band_enable = 1;
       clip->clip6.clipper_viewport_state_ptr =
-         (brw->batch.bo->offset64 + brw->clip.vp_offset) >> 5;
-
-      /* emit clip viewport relocation */
-      drm_intel_bo_emit_reloc(brw->batch.bo,
-                              (brw->clip.state_offset +
-                               offsetof(struct brw_clip_unit_state, clip6)),
-                              brw->batch.bo, brw->clip.vp_offset,
-                              I915_GEM_DOMAIN_INSTRUCTION, 0);
+	 brw_batch_reloc(&brw->batch,
+			 (brw->clip.state_offset +
+			  offsetof(struct brw_clip_unit_state, clip6)),
+			 brw->batch.bo, brw->clip.vp_offset,
+			 I915_GEM_DOMAIN_INSTRUCTION, 0) >> 5;
    }
 
    /* _NEW_TRANSFORM */
src/mesa/drivers/dri/i965/brw_clip_tri.c +0 -2
index cca7eb1..64db7e4 100644
@@ -34,8 +34,6 @@
 #include "main/enums.h"
 #include "program/program.h"
 
-#include "intel_batchbuffer.h"
-
 #include "brw_defines.h"
 #include "brw_context.h"
 #include "brw_eu.h"
src/mesa/drivers/dri/i965/brw_clip_unfilled.c +0 -2
index 6baf620..48c2648 100644
@@ -34,8 +34,6 @@
 #include "main/enums.h"
 #include "program/program.h"
 
-#include "intel_batchbuffer.h"
-
 #include "brw_defines.h"
 #include "brw_context.h"
 #include "brw_eu.h"
src/mesa/drivers/dri/i965/brw_clip_util.c +0 -2
index 40ad144..7b953b2 100644
@@ -35,8 +35,6 @@
 #include "main/enums.h"
 #include "program/program.h"
 
-#include "intel_batchbuffer.h"
-
 #include "brw_defines.h"
 #include "brw_context.h"
 #include "brw_eu.h"
src/mesa/drivers/dri/i965/brw_context.c +126 -70

334 lines not on this page · raw message

src/mesa/drivers/dri/i965/brw_context.h +39 -99

323 lines not on this page · raw message

src/mesa/drivers/dri/i965/brw_curbe.c +0 -1
index befd7a9..29b75bc 100644
@@ -57,7 +57,6 @@
 #include "program/prog_parameter.h"
 #include "program/prog_print.h"
 #include "program/prog_statevars.h"
-#include "intel_batchbuffer.h"
 #include "intel_buffer_objects.h"
 #include "brw_context.h"
 #include "brw_defines.h"
src/mesa/drivers/dri/i965/brw_draw.c +19 -47

162 lines not on this page · raw message

src/mesa/drivers/dri/i965/brw_draw_upload.c +10 -13
index 320e40e..bc2e8fa 100644
@@ -37,7 +37,6 @@
 #include "brw_context.h"
 #include "brw_state.h"
 
-#include "intel_batchbuffer.h"
 #include "intel_buffer_objects.h"
 
 static GLuint double_types[5] = {
@@ -361,7 +360,7 @@ copy_array_to_vbo_array(struct brw_context *brw,
       intel_upload_data(brw, element->glarray->Ptr,
                         element->glarray->_ElementSize,
                         element->glarray->_ElementSize,
-			&buffer->bo, &buffer->offset);
+                        &buffer->bo, &buffer->offset);
 
       buffer->stride = 0;
       return;
@@ -480,9 +479,8 @@ brw_prepare_vertices(struct brw_context *brw)
                           glarray->_ElementSize);
                }
             }
-            buffer->bo = intel_bufferobj_buffer(brw, intel_buffer,
-                                                offset, size);
-            drm_intel_bo_reference(buffer->bo);
+            buffer->bo = brw_bo_get(intel_bufferobj_buffer(brw, intel_buffer,
+							   offset, size));
 
 	    input->buffer = j++;
 	    input->offset = 0;
@@ -596,7 +594,7 @@ brw_prepare_shader_draw_parameters(struct brw_context *brw)
    /* For non-indirect draws, upload gl_BaseVertex. */
    if (brw->vs.prog_data->uses_vertexid && brw->draw.draw_params_bo == NULL) {
       intel_upload_data(brw, &brw->draw.gl_basevertex, 4, 4,
-			&brw->draw.draw_params_bo,
+                        &brw->draw.draw_params_bo,
                         &brw->draw.draw_params_offset);
    }
 }
@@ -607,7 +605,7 @@ brw_prepare_shader_draw_parameters(struct brw_context *brw)
 static void
 emit_vertex_buffer_state(struct brw_context *brw,
                          unsigned buffer_nr,
-                         drm_intel_bo *bo,
+                         struct brw_bo *bo,
                          unsigned bo_ending_address,
                          unsigned bo_offset,
                          unsigned stride,
@@ -860,7 +858,7 @@ static void brw_upload_indices(struct brw_context *brw)
    struct gl_context *ctx = &brw->ctx;
    const struct _mesa_index_buffer *index_buffer = brw->ib.ib;
    GLuint ib_size;
-   drm_intel_bo *old_bo = brw->ib.bo;
+   struct brw_bo *old_bo = brw->ib.bo;
    struct gl_buffer_object *bufferobj;
    GLuint offset;
    GLuint ib_type_size;
@@ -878,7 +876,7 @@ static void brw_upload_indices(struct brw_context *brw)
       /* Get new bufferobj, offset:
        */
       intel_upload_data(brw, index_buffer->ptr, ib_size, ib_type_size,
-			&brw->ib.bo, &offset);
+                        &brw->ib.bo, &offset);
    } else {
       offset = (GLuint) (unsigned long) index_buffer->ptr;
 
@@ -901,13 +899,12 @@ static void brw_upload_indices(struct brw_context *brw)
 
          ctx->Driver.UnmapBuffer(ctx, bufferobj, MAP_INTERNAL);
       } else {
-         drm_intel_bo *bo =
+         struct brw_bo *bo =
             intel_bufferobj_buffer(brw, intel_buffer_object(bufferobj),
                                    offset, ib_size);
          if (bo != brw->ib.bo) {
-            drm_intel_bo_unreference(brw->ib.bo);
-            brw->ib.bo = bo;
-            drm_intel_bo_reference(bo);
+            brw_bo_put(brw->ib.bo);
+            brw->ib.bo = brw_bo_get(bo);
          }
       }
    }
src/mesa/drivers/dri/i965/brw_ff_gs.c +0 -2
index f72f37f..bd452c3 100644
@@ -34,8 +34,6 @@
 #include "main/enums.h"
 #include "main/transformfeedback.h"
 
-#include "intel_batchbuffer.h"
-
 #include "brw_defines.h"
 #include "brw_context.h"
 #include "brw_eu.h"
src/mesa/drivers/dri/i965/brw_ff_gs_emit.c +0 -1
index 50bda61..56a29b4 100644
@@ -35,7 +35,6 @@
 #include "main/enums.h"
 
 #include "program/program.h"
-#include "intel_batchbuffer.h"
 
 #include "brw_defines.h"
 #include "brw_context.h"
src/mesa/drivers/dri/i965/brw_fs.cpp +2 -3
index ed86e0b..9c3a265 100644
@@ -4126,8 +4126,7 @@ brw_wm_fs_emit(struct brw_context *brw,
    double start_time = 0;
 
    if (unlikely(brw->perf_debug)) {
-      start_busy = (brw->batch.last_bo &&
-                    drm_intel_bo_busy(brw->batch.last_bo));
+      start_busy = brw_batch_busy(&brw->batch);
       start_time = get_time();
    }
 
@@ -4206,7 +4205,7 @@ brw_wm_fs_emit(struct brw_context *brw,
          brw_wm_debug_recompile(brw, prog, key);
       shader->compiled_once = true;
 
-      if (start_busy && !drm_intel_bo_busy(brw->batch.last_bo)) {
+      if (start_busy && !brw_batch_busy(&brw->batch)) {
          perf_debug("FS compile took %.03f ms and stalled the GPU\n",
                     (get_time() - start_time) * 1000);
       }
src/mesa/drivers/dri/i965/brw_list.h new file +353 -0

353 lines not on this page · raw message

src/mesa/drivers/dri/i965/brw_meta_fast_clear.c +0 -1
index d5cec0d..eb57481 100644
@@ -49,7 +49,6 @@
 #include "brw_context.h"
 #include "brw_draw.h"
 #include "intel_fbo.h"
-#include "intel_batchbuffer.h"
 
 #include "brw_blorp.h"
 
src/mesa/drivers/dri/i965/brw_meta_stencil_blit.c +0 -1
index 84cfc05..c2114b9 100644
@@ -43,7 +43,6 @@
  */
 
 #include "brw_context.h"
-#include "intel_batchbuffer.h"
 #include "intel_fbo.h"
 
 #include "main/blit.h"
src/mesa/drivers/dri/i965/brw_meta_updownsample.c +0 -1
index f39d50a..37a0968 100644
@@ -22,7 +22,6 @@
  */
 
 #include "brw_context.h"
-#include "intel_batchbuffer.h"
 #include "intel_fbo.h"
 
 #include "main/blit.h"
src/mesa/drivers/dri/i965/brw_misc_state.c +5 -5
index 7357155..0fa4407 100644
@@ -31,9 +31,9 @@
 
 
 
-#include "intel_batchbuffer.h"
 #include "intel_fbo.h"
 #include "intel_mipmap_tree.h"
+#include "intel_reg.h"
 
 #include "brw_context.h"
 #include "brw_state.h"
@@ -540,10 +540,10 @@ brw_emit_depthbuffer(struct brw_context *brw)
       height = stencil_irb->Base.Base.Height;
    }
 
-   if (depth_mt)
-      brw_render_cache_set_check_flush(brw, depth_mt->bo);
-   if (stencil_mt)
-      brw_render_cache_set_check_flush(brw, stencil_mt->bo);
+   if (depth_mt && depth_mt->bo->dirty)
+      brw_emit_mi_flush(brw);
+   if (stencil_mt && stencil_mt->bo->dirty)
+      brw_emit_mi_flush(brw);
 
    brw->vtbl.emit_depth_stencil_hiz(brw, depth_mt, depth_offset,
                                     depthbuffer_format, depth_surface_type,
src/mesa/drivers/dri/i965/brw_object_purgeable.c +4 -4
index 20f66f2..3240ee3 100644
@@ -38,12 +38,12 @@
 #include "intel_mipmap_tree.h"
 
 static GLenum
-intel_buffer_purgeable(drm_intel_bo *buffer)
+intel_buffer_purgeable(struct brw_bo *buffer)
 {
    int retained = 0;
 
    if (buffer != NULL)
-      retained = drm_intel_bo_madvise(buffer, I915_MADV_DONTNEED);
+      retained = brw_bo_madvise(buffer, I915_MADV_DONTNEED);
 
    return retained ? GL_VOLATILE_APPLE : GL_RELEASED_APPLE;
 }
@@ -101,13 +101,13 @@ intel_render_object_purgeable(struct gl_context * ctx,
 }
 
 static GLenum
-intel_buffer_unpurgeable(drm_intel_bo *buffer)
+intel_buffer_unpurgeable(struct brw_bo *buffer)
 {
    int retained;
 
    retained = 0;
    if (buffer != NULL)
-      retained = drm_intel_bo_madvise(buffer, I915_MADV_WILLNEED);
+      retained = brw_bo_madvise(buffer, I915_MADV_WILLNEED);
 
    return retained ? GL_RETAINED_APPLE : GL_UNDEFINED_APPLE;
 }
src/mesa/drivers/dri/i965/brw_performance_monitor.c +27 -47

43 lines not on this page · raw message

src/mesa/drivers/dri/i965/brw_pipe_control.c +10 -34

44 lines not on this page · raw message

src/mesa/drivers/dri/i965/brw_primitive_restart.c +0 -2
index 2c7a7e8..163d8a2 100644

Lines of this file are not shown. View the raw message.

src/mesa/drivers/dri/i965/brw_program.c +12 -14
index 81a0c19..5c1bd8a 100644

Lines of this file are not shown. View the raw message.

src/mesa/drivers/dri/i965/brw_queryobj.c +17 -30

47 lines not on this page · raw message

src/mesa/drivers/dri/i965/brw_reset.c +10 -3
index e3182b1..5a38af1 100644

Lines of this file are not shown. View the raw message.

src/mesa/drivers/dri/i965/brw_sampler_state.c +3 -5
index 22ccbfe..a56356b 100644

Lines of this file are not shown. View the raw message.

src/mesa/drivers/dri/i965/brw_sf.c +0 -2
index 872464c..52deb57 100644

Lines of this file are not shown. View the raw message.

src/mesa/drivers/dri/i965/brw_sf_emit.c +0 -2
index b3ee5c1..28e2e56 100644

Lines of this file are not shown. View the raw message.

src/mesa/drivers/dri/i965/brw_sf_state.c +9 -12
index 014b434..d9d8abc 100644

Lines of this file are not shown. View the raw message.

src/mesa/drivers/dri/i965/brw_state.h +1 -1
index a2127d1..7ca4d0c 100644

Lines of this file are not shown. View the raw message.

src/mesa/drivers/dri/i965/brw_state_batch.c +13 -28

41 lines not on this page · raw message

src/mesa/drivers/dri/i965/brw_state_cache.c +12 -37

49 lines not on this page · raw message

src/mesa/drivers/dri/i965/brw_state_dump.c +33 -34

67 lines not on this page · raw message

src/mesa/drivers/dri/i965/brw_state_upload.c +12 -4
index e7ef41c..1ab7cc9 100644

Lines of this file are not shown. View the raw message.

src/mesa/drivers/dri/i965/brw_structs.h +18 -12
index 7c97a95..8b4ca20 100644

Lines of this file are not shown. View the raw message.

src/mesa/drivers/dri/i965/brw_urb.c +5 -4
index 6fcf1b0..fa79fba 100644

Lines of this file are not shown. View the raw message.

src/mesa/drivers/dri/i965/brw_vec4.cpp +2 -3
index 57b507d..9a7f1e6 100644

Lines of this file are not shown. View the raw message.

src/mesa/drivers/dri/i965/brw_vs_state.c +13 -16
index b9b97a7..6ad4153 100644

Lines of this file are not shown. View the raw message.

src/mesa/drivers/dri/i965/brw_vs_surface_state.c +2 -2
index f82a62b..c649b1a 100644

Lines of this file are not shown. View the raw message.

src/mesa/drivers/dri/i965/brw_wm_state.c +13 -25
index 0cd4390..1195f55 100644

Lines of this file are not shown. View the raw message.

src/mesa/drivers/dri/i965/brw_wm_surface_state.c +39 -45

84 lines not on this page · raw message

src/mesa/drivers/dri/i965/gen6_blorp.cpp +6 -11
index 54c4a6d..6aa772c 100644

Lines of this file are not shown. View the raw message.

src/mesa/drivers/dri/i965/gen6_cc.c +0 -1
index 2bfa271..446a07b 100644

Lines of this file are not shown. View the raw message.

src/mesa/drivers/dri/i965/gen6_clip_state.c +0 -1
index aaf90df..3622dc1 100644

Lines of this file are not shown. View the raw message.

src/mesa/drivers/dri/i965/gen6_depth_state.c +0 -1
index 8f0d7dc..b1a9dd1 100644

Lines of this file are not shown. View the raw message.

src/mesa/drivers/dri/i965/gen6_depthstencil.c +0 -1
index 2c625c9..ed731c5 100644

Lines of this file are not shown. View the raw message.

src/mesa/drivers/dri/i965/gen6_gs_state.c +0 -1
index eb4c586..3d4bb68 100644

Lines of this file are not shown. View the raw message.

src/mesa/drivers/dri/i965/gen6_multisample_state.c +0 -1
index ec46479..74f1478 100644

Lines of this file are not shown. View the raw message.

src/mesa/drivers/dri/i965/gen6_queryobj.c +11 -37

48 lines not on this page · raw message

src/mesa/drivers/dri/i965/gen6_sampler_state.c +0 -1
index 9e7da58..ecc6b21 100644

Lines of this file are not shown. View the raw message.

src/mesa/drivers/dri/i965/gen6_scissor_state.c +0 -1
index 0111f15..7809c1e 100644

Lines of this file are not shown. View the raw message.

src/mesa/drivers/dri/i965/gen6_sf_state.c +0 -1
index ea5c47a..c94ebb0 100644

Lines of this file are not shown. View the raw message.

src/mesa/drivers/dri/i965/gen6_sol.c +4 -5
index 3899ce9..4229ea9 100644

Lines of this file are not shown. View the raw message.

src/mesa/drivers/dri/i965/gen6_surface_state.c +6 -9
index 03e913a..9121b41 100644

Lines of this file are not shown. View the raw message.

src/mesa/drivers/dri/i965/gen6_urb.c +0 -1
index c7311fd..78cb973 100644

Lines of this file are not shown. View the raw message.

src/mesa/drivers/dri/i965/gen6_viewport_state.c +0 -1
index 0c63283..daa0c0f 100644

Lines of this file are not shown. View the raw message.

src/mesa/drivers/dri/i965/gen6_vs_state.c +1 -1
index 35d10ef..89bb426 100644

Lines of this file are not shown. View the raw message.

src/mesa/drivers/dri/i965/gen6_wm_state.c +0 -1
index 8e673a4..33d2be2 100644

Lines of this file are not shown. View the raw message.

src/mesa/drivers/dri/i965/gen7_blorp.cpp +5 -11
index abace6d..62d735e 100644

Lines of this file are not shown. View the raw message.

src/mesa/drivers/dri/i965/gen7_disable.c +0 -1
index 2c43cd7..6d0be45 100644

Lines of this file are not shown. View the raw message.

src/mesa/drivers/dri/i965/gen7_gs_state.c +0 -1
index e1c4f8b..abd5ee2 100644

Lines of this file are not shown. View the raw message.

src/mesa/drivers/dri/i965/gen7_misc_state.c +1 -2
index a14d4a0..fb20b22 100644

Lines of this file are not shown. View the raw message.

src/mesa/drivers/dri/i965/gen7_sf_state.c +0 -1
index 69853e6..fe6bc8c 100644

Lines of this file are not shown. View the raw message.

src/mesa/drivers/dri/i965/gen7_sol_state.c +6 -13
index 41573a8..7a64b41 100644

Lines of this file are not shown. View the raw message.

src/mesa/drivers/dri/i965/gen7_urb.c +0 -1
index d371c19..bc631b1 100644

Lines of this file are not shown. View the raw message.

src/mesa/drivers/dri/i965/gen7_viewport_state.c +0 -1
index eb59684..9d9144e 100644

Lines of this file are not shown. View the raw message.

src/mesa/drivers/dri/i965/gen7_vs_state.c +0 -1
index 278b3ec..6dde6c6 100644

Lines of this file are not shown. View the raw message.

src/mesa/drivers/dri/i965/gen7_wm_state.c +0 -1
index b918275..4eaf54f 100644

Lines of this file are not shown. View the raw message.

src/mesa/drivers/dri/i965/gen7_wm_surface_state.c +24 -35

59 lines not on this page · raw message

src/mesa/drivers/dri/i965/gen8_blend_state.c +0 -1
index 786c79a..31a3deb 100644

Lines of this file are not shown. View the raw message.

src/mesa/drivers/dri/i965/gen8_depth_state.c +2 -5
index ded2121..4b6c5d0 100644

Lines of this file are not shown. View the raw message.

src/mesa/drivers/dri/i965/gen8_disable.c +0 -1
index da0d4a5..ec86fee 100644

Lines of this file are not shown. View the raw message.

src/mesa/drivers/dri/i965/gen8_draw_upload.c +0 -1
index 1af90ec..dc5e915 100644

Lines of this file are not shown. View the raw message.

src/mesa/drivers/dri/i965/gen8_gs_state.c +0 -1
index 46b9713..1f2d87b 100644

Lines of this file are not shown. View the raw message.

src/mesa/drivers/dri/i965/gen8_misc_state.c +0 -1
index b20038e..83376cd 100644

Lines of this file are not shown. View the raw message.

src/mesa/drivers/dri/i965/gen8_multisample_state.c +0 -1
index 75cbe06..da5b32b 100644

Lines of this file are not shown. View the raw message.

src/mesa/drivers/dri/i965/gen8_ps_state.c +0 -1
index 85ad3b6..f9638d1 100644

Lines of this file are not shown. View the raw message.

src/mesa/drivers/dri/i965/gen8_sf_state.c +0 -1
index 52a21b6..8c29c25 100644

Lines of this file are not shown. View the raw message.

src/mesa/drivers/dri/i965/gen8_sol_state.c +1 -2
index 58ead68..07212ab 100644

Lines of this file are not shown. View the raw message.

src/mesa/drivers/dri/i965/gen8_surface_state.c +30 -48

78 lines not on this page · raw message

src/mesa/drivers/dri/i965/gen8_viewport_state.c +0 -1
index 322e466..1dde8f5 100644

Lines of this file are not shown. View the raw message.

src/mesa/drivers/dri/i965/gen8_vs_state.c +0 -1
index f92af55..6252fef 100644

Lines of this file are not shown. View the raw message.

src/mesa/drivers/dri/i965/gen8_wm_depth_stencil.c +0 -1
index 2c843b2..0f1128a 100644

Lines of this file are not shown. View the raw message.

src/mesa/drivers/dri/i965/intel_batchbuffer.c deleted +0 -453

453 lines not on this page · raw message

src/mesa/drivers/dri/i965/intel_batchbuffer.h deleted +0 -179

179 lines not on this page · raw message

src/mesa/drivers/dri/i965/intel_blit.c +15 -43

58 lines not on this page · raw message

src/mesa/drivers/dri/i965/intel_blit.h +5 -5
index f563939..70625c9 100644

Lines of this file are not shown. View the raw message.

src/mesa/drivers/dri/i965/intel_buffer_objects.c +59 -126

185 lines not on this page · raw message

src/mesa/drivers/dri/i965/intel_buffer_objects.h +8 -10
index 5eaf9dc..179c0576 100644

Lines of this file are not shown. View the raw message.

src/mesa/drivers/dri/i965/intel_debug.c +3 -1
index 19be464..42954e9 100644

Lines of this file are not shown. View the raw message.

src/mesa/drivers/dri/i965/intel_extensions.c +18 -25

43 lines not on this page · raw message

src/mesa/drivers/dri/i965/intel_fbo.c +4 -42

46 lines not on this page · raw message

src/mesa/drivers/dri/i965/intel_fbo.h +0 -4
index c7cc570..6c761e6 100644

Lines of this file are not shown. View the raw message.

src/mesa/drivers/dri/i965/intel_image.h +4 -2
index a82cf3b..c464a17 100644

Lines of this file are not shown. View the raw message.

src/mesa/drivers/dri/i965/intel_mipmap_tree.c +32 -49

81 lines not on this page · raw message

src/mesa/drivers/dri/i965/intel_mipmap_tree.h +5 -6
index 8b42e4a..09b9270 100644

Lines of this file are not shown. View the raw message.

src/mesa/drivers/dri/i965/intel_pixel_bitmap.c +1 -2
index 224dc65..bd40a92 100644

Lines of this file are not shown. View the raw message.

src/mesa/drivers/dri/i965/intel_pixel_copy.c +0 -3
index ce053ed..4313588 100644

Lines of this file are not shown. View the raw message.

src/mesa/drivers/dri/i965/intel_pixel_draw.c +1 -1
index 4ecefc8..d8e00f6 100644

Lines of this file are not shown. View the raw message.

src/mesa/drivers/dri/i965/intel_pixel_read.c +1 -21
index d3ca38b..51cf9f5 100644

Lines of this file are not shown. View the raw message.

src/mesa/drivers/dri/i965/intel_screen.c +28 -16

44 lines not on this page · raw message

src/mesa/drivers/dri/i965/intel_screen.h +10 -3
index 2f8faaf..f6f43fa 100644

Lines of this file are not shown. View the raw message.

src/mesa/drivers/dri/i965/intel_syncobj.c +7 -10
index 0432980..3250d9d 100644

Lines of this file are not shown. View the raw message.

src/mesa/drivers/dri/i965/intel_tex.c +3 -3
index 777a682..d4b270f 100644

Lines of this file are not shown. View the raw message.

src/mesa/drivers/dri/i965/intel_tex_image.c +7 -23
index 7952ee5..df85c8d 100644

Lines of this file are not shown. View the raw message.

src/mesa/drivers/dri/i965/intel_tex_subimage.c +3 -22
index 7507f76..8c4aa8a 100644

Lines of this file are not shown. View the raw message.

src/mesa/drivers/dri/i965/intel_upload.c +12 -21
index 870aabc..a5a3a7b 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 6 lines
2.1.4

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Part of the diff is not shown here. View the raw message.

#22 lore raw

Re: [Mesa-dev] [PATCH 4/4] i965: Introduce a context-local batch manager

Quoted 1 line · Chris Wilson

* where is the doubly-linked circular list?

IIRC there was some patches from Jason, that move the the gallium one to src/util/list.h [1]. Not sure on the status of it though. On a related note - would be great if one day we nuke the glsl one (exec_node) in favour of it :-)

Cheers
Emil

[1] http://patchwork.freedesktop.org/patch/48051/
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx