All of lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t v5 0/8] Make gpgpu fill tests libdrm independent
@ 2020-05-19 18:16 Zbigniew Kempczyński
  2020-05-19 18:16 ` [igt-dev] [PATCH i-g-t v5 1/8] lib/intel_bufops: Add bufops reference and adapt stride requirement Zbigniew Kempczyński
                   ` (8 more replies)
  0 siblings, 9 replies; 12+ messages in thread
From: Zbigniew Kempczyński @ 2020-05-19 18:16 UTC (permalink / raw)
  To: igt-dev

I've introduced intel_bb which is very simplified version of libdrm
powered intel_batchbuffer. Currently it supports simple relocation
but it is enough to cover all gpgpu fill needs. Other (fenced) 
relocation will be added when I will have to face with such pipelines /
batchbuffers.

As commands created in gpu_cmds.c are coupled more than I thought on 
the beginning (media fill also use them) "_v2" suffix was introduced.
When all tests will be rewritten to "_v2" old functions can be removed
and "_v2" can be deleted.

v2: changes according to the review:
    - make intel_bb api more consistent and universal
    - add intel_bb api documentation
    - add alignment field in buf_ops buffer initalization for linear
      buffers
v3: changes:
    - add all gens pipelines
    - fix compiling issues on non-x86 archs
    - add ctx (suggested by knr)

v4: changes:
    - add indexing tree and render target write flag

v5: changes:
    - randomizing addresses to avoid relocations
    - fixing bug in gen8+ pipeline setup (Chris)

Zbigniew Kempczyński (8):
  lib/intel_bufops: Add bufops reference and adapt stride requirement
  lib/rendercopy_bufmgr: Pass alignment during buffer initialization
  lib/intel_batchbuffer: Introduce intel_bb
  lib/gpu_cmds: Add gpgpu pipeline functions based on intel_bb
  lib/gpgpu_fill: libdrm-free gpgpu pipeline creation
  lib/intel_batchbuffer: Introduce temporary igt_fillfunc_v2_t
  tests/gem_gpgpu_fill: Remove libdrm dependency
  HAX: run gpgpu_fill in BAT only

 lib/gpgpu_fill.c                      | 187 +++++++++
 lib/gpgpu_fill.h                      |  34 ++
 lib/gpu_cmds.c                        | 563 ++++++++++++++++++++++++++
 lib/gpu_cmds.h                        |  54 +++
 lib/intel_batchbuffer.c               | 503 +++++++++++++++++++++++
 lib/intel_batchbuffer.h               | 109 +++++
 lib/intel_bufops.c                    |  55 ++-
 lib/intel_bufops.h                    |   7 +-
 lib/rendercopy_bufmgr.c               |   4 +-
 tests/i915/gem_gpgpu_fill.c           | 126 ++++--
 tests/intel-ci/fast-feedback.testlist | 161 +-------
 11 files changed, 1602 insertions(+), 201 deletions(-)

-- 
2.26.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [igt-dev] [PATCH i-g-t v5 1/8] lib/intel_bufops: Add bufops reference and adapt stride requirement
  2020-05-19 18:16 [igt-dev] [PATCH i-g-t v5 0/8] Make gpgpu fill tests libdrm independent Zbigniew Kempczyński
@ 2020-05-19 18:16 ` Zbigniew Kempczyński
  2020-05-19 18:16 ` [igt-dev] [PATCH i-g-t v5 2/8] lib/rendercopy_bufmgr: Pass alignment during buffer initialization Zbigniew Kempczyński
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: Zbigniew Kempczyński @ 2020-05-19 18:16 UTC (permalink / raw)
  To: igt-dev; +Cc: Chris Wilson

Add bufops reference to intel_buf to allow acquire drm fd against which
buffer was created.

Change stride limitation for intel_buf for non-tiled buffers.

Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
---
 lib/intel_bufops.c | 55 +++++++++++++++++++++++++++++++++++++---------
 lib/intel_bufops.h |  7 ++++--
 2 files changed, 50 insertions(+), 12 deletions(-)

diff --git a/lib/intel_bufops.c b/lib/intel_bufops.c
index 804b2a0a..0337b638 100644
--- a/lib/intel_bufops.c
+++ b/lib/intel_bufops.c
@@ -52,7 +52,7 @@
  * struct intel_buf ibuf;
  * ...
  * bops = buf_ops_create(fd);
- * intel_buf_init(bops, &ibuf, 512, 512, 32, I915_TILING_X, false);
+ * intel_buf_init(bops, &ibuf, 512, 512, 32, 64, I915_TILING_X, false);
  * ...
  * linear_to_intel_buf(bops, &ibuf, linear);
  * ...
@@ -673,19 +673,24 @@ void linear_to_intel_buf(struct buf_ops *bops, struct intel_buf *buf,
 static void __intel_buf_init(struct buf_ops *bops,
 			     uint32_t handle,
 			     struct intel_buf *buf,
-			     int width, int height, int bpp,
+			     int width, int height, int bpp, int alignment,
 			     uint32_t req_tiling, uint32_t compression)
 {
 	uint32_t tiling = req_tiling;
 	uint32_t size;
+	uint32_t devid;
+	int tile_width;
 
 	igt_assert(bops);
 	igt_assert(buf);
 	igt_assert(width > 0 && height > 0);
 	igt_assert(bpp == 8 || bpp == 16 || bpp == 32);
+	igt_assert(alignment % 4 == 0);
 
 	memset(buf, 0, sizeof(*buf));
 
+	buf->bops = bops;
+
 	if (compression) {
 		int aux_width, aux_height;
 
@@ -721,7 +726,22 @@ static void __intel_buf_init(struct buf_ops *bops,
 		size = buf->aux.offset + aux_width * aux_height;
 
 	} else {
-		buf->stride = ALIGN(width * (bpp / 8), 128);
+		if (buf->tiling) {
+			devid =  intel_get_drm_devid(bops->fd);
+
+			if (bops->intel_gen < 3)
+				tile_width = 128;
+			else if (IS_915GM(devid) || IS_915G(devid) ||
+				 buf->tiling == I915_TILING_X)
+				tile_width = 512;
+			else
+				tile_width = 128;
+
+			buf->stride = ALIGN(width * (bpp / 8), tile_width);
+		} else {
+			buf->stride = ALIGN(width * (bpp / 8), alignment ?: 4);
+		}
+
 		buf->size = buf->stride * height;
 		buf->tiling = tiling;
 		buf->bpp = bpp;
@@ -744,6 +764,7 @@ static void __intel_buf_init(struct buf_ops *bops,
  * @width: surface width
  * @height: surface height
  * @bpp: bits-per-pixel (8 / 16 / 32)
+ * @alignment: alignment of the stride for linear surfaces
  * @tiling: surface tiling
  * @compression: surface compression type
  *
@@ -754,11 +775,11 @@ static void __intel_buf_init(struct buf_ops *bops,
  */
 void intel_buf_init(struct buf_ops *bops,
 		    struct intel_buf *buf,
-		    int width, int height, int bpp,
+		    int width, int height, int bpp, int alignment,
 		    uint32_t tiling, uint32_t compression)
 {
-	__intel_buf_init(bops, 0, buf, width, height, bpp, tiling,
-			 compression);
+	__intel_buf_init(bops, 0, buf, width, height, bpp, alignment,
+			 tiling, compression);
 }
 
 /**
@@ -784,6 +805,7 @@ void intel_buf_close(struct buf_ops *bops, struct intel_buf *buf)
  * @width: surface width
  * @height: surface height
  * @bpp: bits-per-pixel (8 / 16 / 32)
+ * @alignment: alignment of the stride for linear surfaces
  * @tiling: surface tiling
  * @compression: surface compression type
  *
@@ -797,11 +819,11 @@ void intel_buf_close(struct buf_ops *bops, struct intel_buf *buf)
 void intel_buf_init_using_handle(struct buf_ops *bops,
 				 uint32_t handle,
 				 struct intel_buf *buf,
-				 int width, int height, int bpp,
+				 int width, int height, int bpp, int alignment,
 				 uint32_t req_tiling, uint32_t compression)
 {
-	__intel_buf_init(bops, handle, buf, width, height, bpp, req_tiling,
-			 compression);
+	__intel_buf_init(bops, handle, buf, width, height, bpp, alignment,
+			 req_tiling, compression);
 }
 
 #define DEFAULT_BUFOPS(__gen_start, __gen_end) \
@@ -908,7 +930,7 @@ static void idempotency_selftest(struct buf_ops *bops, uint32_t tiling)
 			  bool_str(software_tiling),
 			  bool_str(!software_tiling),
 			  tiling_str(tiling));
-		intel_buf_init(bops, &buf, width, height, bpp, tiling, false);
+		intel_buf_init(bops, &buf, width, height, bpp, 0, tiling, false);
 		buf_ops_set_software_tiling(bops, tiling, software_tiling);
 
 		linear_to_intel_buf(bops, &buf, (uint32_t *) linear_in);
@@ -1038,6 +1060,19 @@ void buf_ops_destroy(struct buf_ops *bops)
 	free(bops);
 }
 
+/**
+ * buf_ops_getfd
+ * @bops: pointer to buf_ops
+ *
+ * Returns: drm fd
+ */
+int buf_ops_getfd(struct buf_ops *bops)
+{
+	igt_assert(bops);
+
+	return bops->fd;
+}
+
 /**
  * buf_ops_set_software_tiling
  * @bops: pointer to buf_ops
diff --git a/lib/intel_bufops.h b/lib/intel_bufops.h
index f3d6aed8..3a4fae4e 100644
--- a/lib/intel_bufops.h
+++ b/lib/intel_bufops.h
@@ -2,10 +2,12 @@
 #define __INTEL_BUFOPS_H__
 
 #include <stdint.h>
+#include "igt_aux.h"
 
 struct buf_ops;
 
 struct intel_buf {
+	struct buf_ops *bops;
 	uint32_t handle;
 	uint32_t stride;
 	uint32_t tiling;
@@ -58,6 +60,7 @@ intel_buf_aux_height(int gen, const struct intel_buf *buf)
 
 struct buf_ops *buf_ops_create(int fd);
 void buf_ops_destroy(struct buf_ops *bops);
+int buf_ops_getfd(struct buf_ops *bops);
 
 bool buf_ops_set_software_tiling(struct buf_ops *bops,
 				 uint32_t tiling,
@@ -73,14 +76,14 @@ bool buf_ops_has_hw_fence(struct buf_ops *bops, uint32_t tiling);
 bool buf_ops_has_tiling_support(struct buf_ops *bops, uint32_t tiling);
 
 void intel_buf_init(struct buf_ops *bops, struct intel_buf *buf,
-		    int width, int height, int bpp,
+		    int width, int height, int bpp, int alignment,
 		    uint32_t tiling, uint32_t compression);
 void intel_buf_close(struct buf_ops *bops, struct intel_buf *buf);
 
 void intel_buf_init_using_handle(struct buf_ops *bops,
 				 uint32_t handle,
 				 struct intel_buf *buf,
-				 int width, int height, int bpp,
+				 int width, int height, int bpp, int alignment,
 				 uint32_t req_tiling, uint32_t compression);
 
 #endif
-- 
2.26.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [igt-dev] [PATCH i-g-t v5 2/8] lib/rendercopy_bufmgr: Pass alignment during buffer initialization
  2020-05-19 18:16 [igt-dev] [PATCH i-g-t v5 0/8] Make gpgpu fill tests libdrm independent Zbigniew Kempczyński
  2020-05-19 18:16 ` [igt-dev] [PATCH i-g-t v5 1/8] lib/intel_bufops: Add bufops reference and adapt stride requirement Zbigniew Kempczyński
@ 2020-05-19 18:16 ` Zbigniew Kempczyński
  2020-05-19 18:16 ` [igt-dev] [PATCH i-g-t v5 3/8] lib/intel_batchbuffer: Introduce intel_bb Zbigniew Kempczyński
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: Zbigniew Kempczyński @ 2020-05-19 18:16 UTC (permalink / raw)
  To: igt-dev; +Cc: Chris Wilson

For linear buffer buf_ops currently was extended to align the stride
so we need to update the call.

Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
---
 lib/rendercopy_bufmgr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/rendercopy_bufmgr.c b/lib/rendercopy_bufmgr.c
index 96603229..dc38d530 100644
--- a/lib/rendercopy_bufmgr.c
+++ b/lib/rendercopy_bufmgr.c
@@ -163,8 +163,8 @@ void igt_buf_init(struct rendercopy_bufmgr *bmgr, struct igt_buf *buf,
 	intel_buf_init_using_handle(bmgr->bops,
 				    buf->bo->handle,
 				    &ibuf,
-				    width, height, bpp, tiling,
-				    compression);
+				    width, height, bpp, 0,
+				    tiling, compression);
 
 	buf->ccs[0].offset = ibuf.aux.offset;
 	buf->ccs[0].stride = ibuf.aux.stride;
-- 
2.26.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [igt-dev] [PATCH i-g-t v5 3/8] lib/intel_batchbuffer: Introduce intel_bb
  2020-05-19 18:16 [igt-dev] [PATCH i-g-t v5 0/8] Make gpgpu fill tests libdrm independent Zbigniew Kempczyński
  2020-05-19 18:16 ` [igt-dev] [PATCH i-g-t v5 1/8] lib/intel_bufops: Add bufops reference and adapt stride requirement Zbigniew Kempczyński
  2020-05-19 18:16 ` [igt-dev] [PATCH i-g-t v5 2/8] lib/rendercopy_bufmgr: Pass alignment during buffer initialization Zbigniew Kempczyński
@ 2020-05-19 18:16 ` Zbigniew Kempczyński
  2020-05-19 18:50   ` Chris Wilson
  2020-05-19 18:16 ` [igt-dev] [PATCH i-g-t v5 4/8] lib/gpu_cmds: Add gpgpu pipeline functions based on intel_bb Zbigniew Kempczyński
                   ` (5 subsequent siblings)
  8 siblings, 1 reply; 12+ messages in thread
From: Zbigniew Kempczyński @ 2020-05-19 18:16 UTC (permalink / raw)
  To: igt-dev; +Cc: Chris Wilson

Simple batchbuffer facility which gathers and outputs relocations.

v2: make bb api more consistent and universal
v3: fix compiling issues on non-x86 arch
v4: add indexing tree and marking object as render target
v5: randomizing addresses to avoid relocations

Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
---
 lib/intel_batchbuffer.c | 476 ++++++++++++++++++++++++++++++++++++++++
 lib/intel_batchbuffer.h | 101 +++++++++
 2 files changed, 577 insertions(+)

diff --git a/lib/intel_batchbuffer.c b/lib/intel_batchbuffer.c
index f1a45b47..5ee95808 100644
--- a/lib/intel_batchbuffer.c
+++ b/lib/intel_batchbuffer.c
@@ -30,6 +30,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <assert.h>
+#include <search.h>
 
 #include "drm.h"
 #include "drmtest.h"
@@ -41,9 +42,11 @@
 #include "rendercopy.h"
 #include "media_fill.h"
 #include "ioctl_wrappers.h"
+#include "i915/gem_mman.h"
 #include "media_spin.h"
 #include "gpgpu_fill.h"
 #include "igt_aux.h"
+#include "igt_rand.h"
 #include "i830_reg.h"
 
 #include <i915_drm.h>
@@ -1171,3 +1174,476 @@ igt_media_spinfunc_t igt_get_media_spinfunc(int devid)
 
 	return spin;
 }
+
+/* Intel batchbuffer v2 */
+static bool intel_bb_debug_tree = false;
+
+/*
+ * __reallocate_objects:
+ * @ibb: pointer to intel_bb
+ *
+ * Increases number of objects if necessary.
+ */
+static void __reallocate_objects(struct intel_bb *ibb)
+{
+	uint32_t num;
+
+	if (ibb->num_objects == ibb->allocated_objects) {
+		num = 4096 / sizeof(*ibb->objects);
+		ibb->objects = realloc(ibb->objects,
+				       sizeof(*ibb->objects) * num);
+		igt_assert(ibb->objects);
+		ibb->allocated_objects += num;
+
+		memset(&ibb->objects[ibb->num_objects],	0,
+		       num * sizeof(*ibb->objects));
+	}
+}
+
+/**
+ * __intel_bb_create:
+ * @i915: drm fd
+ * @size: size of the batchbuffer
+ *
+ * Returns:
+ *
+ * Pointer the intel_bb, asserts on failure.
+ */
+struct intel_bb *intel_bb_create(int i915, uint32_t size)
+{
+	struct intel_bb *ibb = calloc(1, sizeof(*ibb));
+	uint64_t gtt_size;
+
+	igt_assert(ibb);
+
+	ibb->i915 = i915;
+	ibb->devid = intel_get_drm_devid(i915);
+	ibb->gen = intel_gen(ibb->devid);
+	ibb->handle = gem_create(i915, size);
+	ibb->size = size;
+	ibb->batch = calloc(1, size);
+	igt_assert(ibb->batch);
+	ibb->ptr = ibb->batch;
+	ibb->prng = (uint32_t) to_user_pointer(ibb);
+
+	gtt_size = gem_aperture_size(i915);
+	if (!gem_uses_full_ppgtt(i915))
+		gtt_size /= 2;
+	if ((gtt_size - 1) >> 32)
+		ibb->supports_48b_address = true;
+	ibb->gtt_size = gtt_size;
+
+	__reallocate_objects(ibb);
+	intel_bb_add_object(ibb, ibb->handle, 0, false);
+
+	return ibb;
+}
+
+/*
+ * tdestroy() calls free function for each node, but we spread tree
+ * on objects array, so do nothing.
+ */
+static void __do_nothing(void *node)
+{
+	(void) node;
+}
+
+/**
+ * intel_bb_destroy:
+ * @ibb: pointer to intel_bb
+ *
+ * Frees all relocations / objects allocated during filling the batch.
+ */
+void intel_bb_destroy(struct intel_bb *ibb)
+{
+	uint32_t i;
+
+	igt_assert(ibb);
+
+	/* Free relocations */
+	for (i = 0; i < ibb->num_objects; i++)
+		free(from_user_pointer(ibb->objects[i].relocs_ptr));
+
+	free(ibb->objects);
+	tdestroy(ibb->root, __do_nothing);
+
+	munmap(ibb->batch, ibb->size);
+	gem_close(ibb->i915, ibb->handle);
+
+	free(ibb);
+}
+
+/**
+ * intel_bb_set_debug:
+ * @ibb: pointer to intel_bb
+ * @debug: true / false
+ *
+ * Sets debug to true / false. Execbuf is then called synchronously and
+ * object/reloc arrays are printed after execution.
+ */
+void intel_bb_set_debug(struct intel_bb *ibb, bool debug)
+{
+	ibb->debug = debug;
+}
+
+static int __compare_objects(const void *p1, const void *p2)
+{
+	const struct drm_i915_gem_exec_object2 *o1 = p1, *o2 = p2;
+
+	return (int) ((int64_t) o1->handle - (int64_t) o2->handle);
+}
+
+/**
+ * intel_bb_add_object:
+ * @ibb: pointer to intel_bb
+ * @handle: which handle to add to objects array
+ * @offset: presumed offset of the object when I915_EXEC_NO_RELOC flag is
+ * used in execbuf call
+ * @write: does a handle is a render target
+ *
+ * Function adds or updates execobj slot in bb objects array and
+ * in the object tree. When object is a render target it has to
+ * be marked with EXEC_OBJECT_WRITE flag.
+ */
+struct drm_i915_gem_exec_object2 *
+intel_bb_add_object(struct intel_bb *ibb, uint32_t handle,
+		    uint64_t offset, bool write)
+{
+	struct drm_i915_gem_exec_object2 *object;
+	struct drm_i915_gem_exec_object2 **found;
+	uint32_t i;
+
+	__reallocate_objects(ibb);
+
+	i = ibb->num_objects;
+	object = &ibb->objects[i];
+	object->handle = handle;
+
+	found = tsearch((void *) object, &ibb->root, __compare_objects);
+
+	if (*found == object)
+		ibb->num_objects++;
+	else
+		object = *found;
+
+	/* Assign address once */
+	if (object->offset == 0) {
+		if (offset) {
+			object->offset = offset;
+		} else {
+			/* randomize the address, we try to avoid relocations */
+			offset = hars_petruska_f54_1_random64(&ibb->prng);
+			offset &= (ibb->gtt_size - 1);
+			offset &= ~(4096 - 1);
+			object->offset = offset;
+		}
+	}
+
+	if (write)
+		object->flags |= EXEC_OBJECT_WRITE;
+
+	if (ibb->supports_48b_address)
+		object->flags |= EXEC_OBJECT_SUPPORTS_48B_ADDRESS;
+
+	return object;
+}
+
+/*
+ * intel_bb_add_reloc:
+ * @ibb: pointer to intel_bb
+ * @handle: object handle which address will be taken to patch the bb
+ * @read_domains: gem domain bits for the relocation
+ * @write_domain: gem domain bit for the relocation
+ * @delta: delta value to add to @buffer's gpu address
+ * @offset: offset within bb to be patched
+ * @presumed_offset: address of the object in address space, important for
+ * I915_EXEC_NO_RELOC flag
+ *
+ * Function allocates additional relocation slot in reloc array for a handle.
+ * It also implicitly adds handle in the objects array if object doesn't
+ * exists but doesn't mark it as a render target.
+ */
+static uint64_t intel_bb_add_reloc(struct intel_bb *ibb,
+				   uint32_t handle,
+				   uint32_t read_domains,
+				   uint32_t write_domain,
+				   uint64_t delta,
+				   uint64_t offset,
+				   uint64_t presumed_offset)
+{
+	struct drm_i915_gem_relocation_entry *relocs;
+	struct drm_i915_gem_exec_object2 *object;
+	uint32_t i;
+
+	object = intel_bb_add_object(ibb, handle, presumed_offset, false);
+
+	relocs = ibb->relocs;
+	if (ibb->num_relocs == ibb->allocated_relocs) {
+		ibb->allocated_relocs += 4096 / sizeof(*relocs);
+		relocs = realloc(relocs, sizeof(*relocs) * ibb->allocated_relocs);
+		igt_assert(relocs);
+		ibb->relocs = relocs;
+	}
+
+	i = ibb->num_relocs++;
+	memset(&relocs[i], 0, sizeof(*relocs));
+	relocs[i].target_handle = handle;
+	relocs[i].read_domains = read_domains;
+	relocs[i].write_domain = write_domain;
+	relocs[i].delta = delta;
+	relocs[i].offset = offset;
+	relocs[i].presumed_offset = object->offset;
+
+	igt_debug("add reloc: handle: %u, r/w: 0x%x/0x%x, "
+		  "delta: 0x%" PRIx64 ", "
+		  "offset: 0x%" PRIx64 ", "
+		  "poffset: 0x%" PRIx64 "\n",
+		  handle, read_domains, write_domain,
+		  delta, offset, presumed_offset);
+
+	return object->offset;
+}
+
+/**
+ * intel_bb_emit_reloc:
+ * @ibb: pointer to intel_bb
+ * @handle: object handle which address will be taken to patch the bb
+ * @read_domains: gem domain bits for the relocation
+ * @write_domain: gem domain bit for the relocation
+ * @delta: delta value to add to @buffer's gpu address
+ * @presumed_offset: address of the object in address space, important for
+ * I915_EXEC_NO_RELOC flag
+ * @write: does a handle is a render target
+ *
+ * Function prepares relocation (execobj if required + reloc) and emits
+ * offset in bb. For I915_EXEC_NO_RELOC presumed_offset is a hint we already
+ * have object in valid place and relocation step can be skipped in this case.
+ *
+ * Note: delta is value added to address, mostly used when some instructions
+ * require modify-bit set to apply change. Which delta is valid depends
+ * on instruction (see instruction specification).
+ */
+uint64_t intel_bb_emit_reloc(struct intel_bb *ibb,
+			 uint32_t handle,
+			 uint32_t read_domains,
+			 uint32_t write_domain,
+			 uint64_t delta,
+			 uint64_t presumed_offset)
+{
+	uint64_t address;
+
+	igt_assert(ibb);
+
+	address = intel_bb_add_reloc(ibb, handle, read_domains, write_domain,
+				     delta, intel_bb_offset(ibb),
+				     presumed_offset);
+
+	intel_bb_out(ibb, delta + address);
+	if (ibb->gen >= 8)
+		intel_bb_out(ibb, address >> 32);
+
+	return address;
+}
+
+/**
+ * intel_bb_offset_reloc:
+ * @ibb: pointer to intel_bb
+ * @handle: object handle which address will be taken to patch the bb
+ * @read_domains: gem domain bits for the relocation
+ * @write_domain: gem domain bit for the relocation
+ * @offset: offset within bb to be patched
+ * @presumed_offset: address of the object in address space, important for
+ * I915_EXEC_NO_RELOC flag
+ *
+ * Function prepares relocation (execobj if required + reloc). It it used
+ * for editing batchbuffer via modifying structures. It means when we're
+ * preparing batchbuffer it is more descriptive to edit the structure
+ * than emitting dwords. But it require for some fields to point the
+ * relocation. For that case @offset is passed by the user and it points
+ * to the offset in bb where the relocation will be applied.
+ */
+uint64_t intel_bb_offset_reloc(struct intel_bb *ibb,
+			       uint32_t handle,
+			       uint32_t read_domains,
+			       uint32_t write_domain,
+			       uint32_t offset,
+			       uint64_t presumed_offset)
+{
+	igt_assert(ibb);
+
+	return intel_bb_add_reloc(ibb, handle, read_domains, write_domain,
+				  0, offset, presumed_offset);
+}
+
+static void intel_bb_dump_execbuf(struct drm_i915_gem_execbuffer2 *execbuf)
+{
+	struct drm_i915_gem_exec_object2 *objects;
+	struct drm_i915_gem_relocation_entry *relocs, *reloc;
+	int i, j;
+
+	igt_info("execbuf batch len: %u, start offset: 0x%x, "
+		 "DR1: 0x%x, DR4: 0x%x, "
+		 "num clip: %u, clipptr: 0x%llx, "
+		 "flags: 0x%llx, rsvd1: 0x%llx, rsvd2: 0x%llx\n",
+		 execbuf->batch_len, execbuf->batch_start_offset,
+		 execbuf->DR1, execbuf->DR4,
+		 execbuf->num_cliprects, execbuf->cliprects_ptr,
+		 execbuf->flags, execbuf->rsvd1, execbuf->rsvd2);
+
+	igt_info("execbuf buffer_count: %d\n", execbuf->buffer_count);
+	for (i = 0; i < execbuf->buffer_count; i++) {
+		objects = &((struct drm_i915_gem_exec_object2 *)
+			    from_user_pointer(execbuf->buffers_ptr))[i];
+		relocs = from_user_pointer(objects->relocs_ptr);
+		igt_info(" [%d] handle: %u, reloc_count: %d, reloc_ptr: %p, "
+			 "align: 0x%llx, offset: 0x%llx, flags: 0x%llx, "
+			 "rsvd1: 0x%llx, rsvd2: 0x%llx\n",
+			 i, objects->handle, objects->relocation_count,
+			 relocs,
+			 objects->alignment,
+			 objects->offset, objects->flags,
+			 objects->rsvd1, objects->rsvd2);
+		if (objects->relocation_count) {
+			igt_info("\texecbuf relocs:\n");
+			for (j = 0; j < objects->relocation_count; j++) {
+				reloc = &relocs[j];
+				igt_info("\t [%d] target handle: %u, "
+					 "offset: 0x%llx, delta: 0x%x, "
+					 "presumed_offset: 0x%llx, "
+					 "read_domains: 0x%x, "
+					 "write_domain: 0x%x\n",
+					 j, reloc->target_handle,
+					 reloc->offset, reloc->delta,
+					 reloc->presumed_offset,
+					 reloc->read_domains,
+					 reloc->write_domain);
+			}
+		}
+	}
+}
+
+static void print_node(const void *node, VISIT which, int depth)
+{
+	const struct drm_i915_gem_exec_object2 *object =
+			*(const struct drm_i915_gem_exec_object2 **) node;
+	(void) depth;
+
+	switch (which) {
+	case preorder:
+	case endorder:
+		break;
+
+	case postorder:
+	case leaf:
+		igt_info("\t handle: %u, offset: 0x%" PRIx64 "\n",
+			 object->handle, (uint64_t) object->offset);
+		break;
+	}
+}
+
+/*
+ * @__intel_bb_exec:
+ * @ibb: pointer to intel_bb
+ * @end_offset: offset of the last instruction in the bb
+ * @flags: flags passed directly to execbuf
+ * @ctx: context
+ * @sync: if true wait for execbuf completion, otherwise caller is responsible
+ * to wait for completion
+ *
+ * Returns: 0 on success, otherwise errno.
+ *
+ * Note: In this step execobj for bb is allocated and inserted to the objects
+ * array.
+*/
+int __intel_bb_exec(struct intel_bb *ibb, uint32_t end_offset,
+		    uint32_t ctx, uint64_t flags, bool sync)
+{
+	struct drm_i915_gem_execbuffer2 execbuf;
+	int ret;
+
+	ibb->objects[0].relocs_ptr = to_user_pointer(ibb->relocs);
+	ibb->objects[0].relocation_count = ibb->num_relocs;
+	ibb->objects[0].handle = ibb->handle;
+
+	gem_write(ibb->i915, ibb->handle, 0, ibb->batch, ibb->size);
+
+	memset(&execbuf, 0, sizeof(execbuf));
+	execbuf.buffers_ptr = (uintptr_t) ibb->objects;
+	execbuf.buffer_count = ibb->num_objects;
+	execbuf.batch_len = end_offset;
+	execbuf.rsvd1 = ctx;
+	execbuf.flags = flags | I915_EXEC_BATCH_FIRST;
+
+	ret = __gem_execbuf(ibb->i915, &execbuf);
+	if (ret)
+		return ret;
+
+	if (sync || ibb->debug)
+		gem_sync(ibb->i915, ibb->handle);
+
+	if (ibb->debug) {
+		intel_bb_dump_execbuf(&execbuf);
+		if (intel_bb_debug_tree) {
+			igt_info("\nTree:\n");
+			twalk(ibb->root, print_node);
+		}
+	}
+
+	return 0;
+}
+
+/**
+ * intel_bb_exec:
+ * @ibb: pointer to intel_bb
+ * @end_offset: offset of the last instruction in the bb
+ * @flags: flags passed directly to execbuf
+ * @sync: if true wait for execbuf completion, otherwise caller is responsible
+ * to wait for completion
+ *
+ * Do execbuf with default context. Asserts on failure.
+*/
+void intel_bb_exec(struct intel_bb *ibb, uint32_t end_offset,
+		   uint64_t flags, bool sync)
+{
+	igt_assert_eq(__intel_bb_exec(ibb, end_offset, 0, flags, sync), 0);
+}
+
+/*
+ * intel_bb_exec_with_context:
+ * @ibb: pointer to intel_bb
+ * @end_offset: offset of the last instruction in the bb
+ * @flags: flags passed directly to execbuf
+ * @ctx: context
+ * @sync: if true wait for execbuf completion, otherwise caller is responsible
+ * to wait for completion
+ *
+ * Do execbuf with context @context.
+*/
+void intel_bb_exec_with_context(struct intel_bb *ibb, uint32_t end_offset,
+				uint32_t ctx, uint64_t flags, bool sync)
+{
+	igt_assert_eq(__intel_bb_exec(ibb, end_offset, ctx, flags, sync), 0);
+}
+
+/**
+ * intel_bb_get_object_address:
+ * @ibb: pointer to intel_bb
+ * @handle: object handle
+ *
+ * When objects addresses are previously pinned and we don't want to relocate
+ * we need to acquire them from previous execbuf. Function returns previous
+ * object offset for @handle or 0 if object is not found.
+ */
+uint64_t intel_bb_get_object_offset(struct intel_bb *ibb, uint32_t handle)
+{
+	struct drm_i915_gem_exec_object2 object = { .handle = handle };
+	struct drm_i915_gem_exec_object2 **found;
+
+	igt_assert(ibb);
+
+	found = tfind((void *) &object, &ibb->root, __compare_objects);
+	if (!found)
+		return 0;
+
+	return (*found)->offset;
+}
diff --git a/lib/intel_batchbuffer.h b/lib/intel_batchbuffer.h
index 442f3a18..5f162546 100644
--- a/lib/intel_batchbuffer.h
+++ b/lib/intel_batchbuffer.h
@@ -7,6 +7,7 @@
 
 #include "igt_core.h"
 #include "intel_reg.h"
+#include "drmtest.h"
 
 #define BATCH_SZ 4096
 #define BATCH_RESERVED 16
@@ -422,4 +423,104 @@ typedef void (*igt_media_spinfunc_t)(struct intel_batchbuffer *batch,
 
 igt_media_spinfunc_t igt_get_media_spinfunc(int devid);
 
+
+/*
+ * Batchbuffer without libdrm dependency
+ */
+struct intel_bb {
+	int i915;
+	int gen;
+	bool debug;
+	uint32_t devid;
+	uint32_t handle;
+	uint32_t size;
+	uint32_t *batch;
+	uint32_t *ptr;
+
+	uint32_t prng;
+	uint64_t gtt_size;
+	bool supports_48b_address;
+
+	void *root;
+	struct drm_i915_gem_exec_object2 *objects;
+	uint32_t num_objects;
+	uint32_t allocated_objects;
+	uint64_t batch_offset;
+
+	struct drm_i915_gem_relocation_entry *relocs;
+	uint32_t num_relocs;
+	uint32_t allocated_relocs;
+};
+
+struct intel_bb *intel_bb_create(int i915, uint32_t size);
+
+void intel_bb_destroy(struct intel_bb *ibb);
+void intel_bb_set_debug(struct intel_bb *ibb, bool debug);
+
+static inline uint32_t intel_bb_offset(struct intel_bb *ibb)
+{
+	return (uint32_t) ((uint8_t *) ibb->ptr - (uint8_t *) ibb->batch);
+}
+
+static inline void intel_bb_ptr_set(struct intel_bb *ibb, uint32_t offset)
+{
+	ibb->ptr = (void *) ((uint8_t *) ibb->batch + offset);
+
+	igt_assert(intel_bb_offset(ibb) < ibb->size);
+}
+
+static inline void intel_bb_ptr_add(struct intel_bb *ibb, uint32_t offset)
+{
+	intel_bb_ptr_set(ibb, intel_bb_offset(ibb) + offset);
+}
+
+static inline void intel_bb_ptr_align(struct intel_bb *ibb,
+				      uint32_t alignment)
+{
+	intel_bb_ptr_set(ibb, ALIGN(intel_bb_offset(ibb), alignment));
+}
+
+static inline void *intel_bb_ptr(struct intel_bb *ibb)
+{
+	return (void *) ibb->ptr;
+}
+
+static inline void intel_bb_out(struct intel_bb *ibb, uint32_t dword)
+{
+	*ibb->ptr = dword;
+	ibb->ptr++;
+
+	igt_assert(intel_bb_offset(ibb) < ibb->size);
+}
+
+
+struct drm_i915_gem_exec_object2 *
+intel_bb_add_object(struct intel_bb *ibb, uint32_t handle,
+		    uint64_t offset, bool write);
+
+uint64_t intel_bb_emit_reloc(struct intel_bb *ibb,
+			 uint32_t handle,
+			 uint32_t read_domains,
+			 uint32_t write_domain,
+			 uint64_t delta,
+			 uint64_t presumed_offset);
+
+uint64_t intel_bb_offset_reloc(struct intel_bb *ibb,
+			       uint32_t handle,
+			       uint32_t read_domains,
+			       uint32_t write_domain,
+			       uint32_t offset,
+			       uint64_t presumed_offset);
+
+int __intel_bb_exec(struct intel_bb *ibb, uint32_t end_offset,
+		    uint32_t ctx, uint64_t flags, bool sync);
+
+void intel_bb_exec(struct intel_bb *ibb, uint32_t end_offset,
+		   uint64_t flags, bool sync);
+
+void intel_bb_exec_with_context(struct intel_bb *ibb, uint32_t end_offset,
+				uint32_t ctx, uint64_t flags, bool sync);
+
+uint64_t intel_bb_get_object_offset(struct intel_bb *ibb, uint32_t handle);
+
 #endif
-- 
2.26.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [igt-dev] [PATCH i-g-t v5 4/8] lib/gpu_cmds: Add gpgpu pipeline functions based on intel_bb
  2020-05-19 18:16 [igt-dev] [PATCH i-g-t v5 0/8] Make gpgpu fill tests libdrm independent Zbigniew Kempczyński
                   ` (2 preceding siblings ...)
  2020-05-19 18:16 ` [igt-dev] [PATCH i-g-t v5 3/8] lib/intel_batchbuffer: Introduce intel_bb Zbigniew Kempczyński
@ 2020-05-19 18:16 ` Zbigniew Kempczyński
  2020-05-19 18:16 ` [igt-dev] [PATCH i-g-t v5 5/8] lib/gpgpu_fill: libdrm-free gpgpu pipeline creation Zbigniew Kempczyński
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: Zbigniew Kempczyński @ 2020-05-19 18:16 UTC (permalink / raw)
  To: igt-dev; +Cc: Chris Wilson

Add no-libdrm functions which will replace libdrm version in the
final version.

v5: fix offset (Chris), emits addresses

Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
---
 lib/gpu_cmds.c | 563 +++++++++++++++++++++++++++++++++++++++++++++++++
 lib/gpu_cmds.h |  54 +++++
 2 files changed, 617 insertions(+)

diff --git a/lib/gpu_cmds.c b/lib/gpu_cmds.c
index dc0ae96c..788f2eb6 100644
--- a/lib/gpu_cmds.c
+++ b/lib/gpu_cmds.c
@@ -768,3 +768,566 @@ gen9_emit_state_base_address(struct intel_batchbuffer *batch)
 	OUT_BATCH(0);
 	OUT_BATCH(0xfffff000);
 }
+
+/*
+ * Here we start version of the gpgpu fill pipeline creation which is based
+ * on intel_bb.
+ */
+uint32_t
+gen7_fill_curbe_buffer_data_v2(struct intel_bb *ibb, uint8_t color)
+{
+	uint32_t *curbe_buffer;
+	uint32_t offset;
+
+	intel_bb_ptr_align(ibb, 64);
+	curbe_buffer = intel_bb_ptr(ibb);
+	offset = intel_bb_offset(ibb);
+
+	*curbe_buffer = color;
+	intel_bb_ptr_add(ibb, 32);
+
+	return offset;
+}
+
+static uint32_t
+gen7_fill_kernel_v2(struct intel_bb *ibb,
+		    const uint32_t kernel[][4],
+		    size_t size)
+{
+	uint32_t *kernel_dst;
+	uint32_t offset;
+
+	intel_bb_ptr_align(ibb, 64);
+	kernel_dst = intel_bb_ptr(ibb);
+	offset = intel_bb_offset(ibb);
+
+	memcpy(kernel_dst, kernel, size);
+
+	intel_bb_ptr_add(ibb, size);
+
+	return offset;
+}
+
+static uint32_t
+gen7_fill_surface_state_v2(struct intel_bb *ibb,
+			   struct intel_buf *buf,
+			   uint32_t format,
+			   int is_dst)
+{
+	struct gen7_surface_state *ss;
+	uint32_t write_domain, read_domain, offset;
+	uint64_t address;
+
+	if (is_dst) {
+		write_domain = read_domain = I915_GEM_DOMAIN_RENDER;
+	} else {
+		write_domain = 0;
+		read_domain = I915_GEM_DOMAIN_SAMPLER;
+	}
+
+	intel_bb_ptr_align(ibb, 64);
+	offset = intel_bb_offset(ibb);
+	ss = intel_bb_ptr(ibb);
+	intel_bb_ptr_add(ibb, 64);
+
+	ss->ss0.surface_type = SURFACE_2D;
+	ss->ss0.surface_format = format;
+	ss->ss0.render_cache_read_write = 1;
+
+	if (buf->tiling == I915_TILING_X)
+		ss->ss0.tiled_mode = 2;
+	else if (buf->tiling == I915_TILING_Y)
+		ss->ss0.tiled_mode = 3;
+
+	address = intel_bb_offset_reloc(ibb, buf->handle,
+					read_domain, write_domain,
+					offset + 4, 0x0);
+	igt_assert(address >> 32 == 0);
+
+	ss->ss1.base_addr = address;
+
+	ss->ss2.height = intel_buf_height(buf) - 1;
+	ss->ss2.width  = intel_buf_width(buf) - 1;
+	ss->ss3.pitch  = buf->stride - 1;
+
+	ss->ss7.shader_chanel_select_r = 4;
+	ss->ss7.shader_chanel_select_g = 5;
+	ss->ss7.shader_chanel_select_b = 6;
+	ss->ss7.shader_chanel_select_a = 7;
+
+	return offset;
+}
+
+static uint32_t
+gen8_fill_surface_state_v2(struct intel_bb *ibb,
+			   struct intel_buf *buf,
+			   uint32_t format,
+			   int is_dst)
+{
+	struct gen8_surface_state *ss;
+	uint32_t write_domain, read_domain, offset;
+	uint64_t address;
+
+	if (is_dst) {
+		write_domain = read_domain = I915_GEM_DOMAIN_RENDER;
+	} else {
+		write_domain = 0;
+		read_domain = I915_GEM_DOMAIN_SAMPLER;
+	}
+
+	intel_bb_ptr_align(ibb, 64);
+	offset = intel_bb_offset(ibb);
+	ss = intel_bb_ptr(ibb);
+	intel_bb_ptr_add(ibb, 64);
+
+	ss->ss0.surface_type = SURFACE_2D;
+	ss->ss0.surface_format = format;
+	ss->ss0.render_cache_read_write = 1;
+	ss->ss0.vertical_alignment = 1; /* align 4 */
+	ss->ss0.horizontal_alignment = 1; /* align 4 */
+
+	if (buf->tiling == I915_TILING_X)
+		ss->ss0.tiled_mode = 2;
+	else if (buf->tiling == I915_TILING_Y)
+		ss->ss0.tiled_mode = 3;
+
+	address = intel_bb_offset_reloc(ibb, buf->handle,
+					read_domain, write_domain,
+					offset + 4 * 8, 0x0);
+
+	ss->ss8.base_addr = (uint32_t) address;
+	ss->ss9.base_addr_hi = address >> 32;
+
+	ss->ss2.height = intel_buf_height(buf) - 1;
+	ss->ss2.width  = intel_buf_width(buf) - 1;
+	ss->ss3.pitch  = buf->stride - 1;
+
+	ss->ss7.shader_chanel_select_r = 4;
+	ss->ss7.shader_chanel_select_g = 5;
+	ss->ss7.shader_chanel_select_b = 6;
+	ss->ss7.shader_chanel_select_a = 7;
+
+	return offset;
+}
+
+static uint32_t
+gen7_fill_binding_table_v2(struct intel_bb *ibb,
+			   struct intel_buf *buf)
+{
+	uint32_t binding_table_offset;
+	uint32_t *binding_table;
+	uint32_t devid = intel_get_drm_devid(ibb->i915);
+
+	intel_bb_ptr_align(ibb, 64);
+	binding_table_offset = intel_bb_offset(ibb);
+	binding_table = intel_bb_ptr(ibb);
+	intel_bb_ptr_add(ibb, 64);
+
+	if (IS_GEN7(devid))
+		binding_table[0] = gen7_fill_surface_state_v2(ibb, buf,
+							      SURFACEFORMAT_R8_UNORM, 1);
+
+	else
+		binding_table[0] = gen8_fill_surface_state_v2(ibb, buf,
+							      SURFACEFORMAT_R8_UNORM, 1);
+
+	return binding_table_offset;
+}
+
+uint32_t
+gen7_fill_interface_descriptor_v2(struct intel_bb *ibb,
+				  struct intel_buf *buf,
+				  const uint32_t kernel[][4],
+				  size_t size)
+{
+	struct gen7_interface_descriptor_data *idd;
+	uint32_t offset;
+	uint32_t binding_table_offset, kernel_offset;
+
+	binding_table_offset = gen7_fill_binding_table_v2(ibb, buf);
+	kernel_offset = gen7_fill_kernel_v2(ibb, kernel, size);
+
+	intel_bb_ptr_align(ibb, 64);
+	idd = intel_bb_ptr(ibb);
+	offset = intel_bb_offset(ibb);
+
+	idd->desc0.kernel_start_pointer = (kernel_offset >> 6);
+
+	idd->desc1.single_program_flow = 1;
+	idd->desc1.floating_point_mode = GEN7_FLOATING_POINT_IEEE_754;
+
+	idd->desc2.sampler_count = 0;      /* 0 samplers used */
+	idd->desc2.sampler_state_pointer = 0;
+
+	idd->desc3.binding_table_entry_count = 0;
+	idd->desc3.binding_table_pointer = (binding_table_offset >> 5);
+
+	idd->desc4.constant_urb_entry_read_offset = 0;
+	idd->desc4.constant_urb_entry_read_length = 1; /* grf 1 */
+
+	intel_bb_ptr_add(ibb, sizeof(*idd));
+
+	return offset;
+}
+
+uint32_t
+gen8_fill_interface_descriptor_v2(struct intel_bb *ibb,
+				  struct intel_buf *buf,
+				  const uint32_t kernel[][4],
+				  size_t size)
+{
+	struct gen8_interface_descriptor_data *idd;
+	uint32_t offset;
+	uint32_t binding_table_offset, kernel_offset;
+
+	binding_table_offset = gen7_fill_binding_table_v2(ibb, buf);
+	kernel_offset = gen7_fill_kernel_v2(ibb, kernel, size);
+
+	intel_bb_ptr_align(ibb, 64);
+	idd = intel_bb_ptr(ibb);
+	offset = intel_bb_offset(ibb);
+
+	idd->desc0.kernel_start_pointer = (kernel_offset >> 6);
+
+	idd->desc2.single_program_flow = 1;
+	idd->desc2.floating_point_mode = GEN8_FLOATING_POINT_IEEE_754;
+
+	idd->desc3.sampler_count = 0;      /* 0 samplers used */
+	idd->desc3.sampler_state_pointer = 0;
+
+	idd->desc4.binding_table_entry_count = 0;
+	idd->desc4.binding_table_pointer = (binding_table_offset >> 5);
+
+	idd->desc5.constant_urb_entry_read_offset = 0;
+	idd->desc5.constant_urb_entry_read_length = 1; /* grf 1 */
+
+	idd->desc6.num_threads_in_tg = 1;
+
+	return offset;
+}
+
+void
+gen7_emit_state_base_address_v2(struct intel_bb *ibb)
+{
+	intel_bb_out(ibb, GEN7_STATE_BASE_ADDRESS | (10 - 2));
+
+	/* general */
+	intel_bb_out(ibb, 0);
+
+	/* surface */
+	intel_bb_emit_reloc(ibb, ibb->handle,
+			    I915_GEM_DOMAIN_INSTRUCTION, 0,
+			    BASE_ADDRESS_MODIFY, 0x0);
+
+	/* dynamic */
+	intel_bb_emit_reloc(ibb, ibb->handle,
+			    I915_GEM_DOMAIN_INSTRUCTION, 0,
+			    BASE_ADDRESS_MODIFY, 0x0);
+
+	/* indirect */
+	intel_bb_out(ibb, 0);
+
+	/* instruction */
+	intel_bb_emit_reloc(ibb, ibb->handle,
+			    I915_GEM_DOMAIN_INSTRUCTION, 0,
+			    BASE_ADDRESS_MODIFY, 0x0);
+
+	/* general/dynamic/indirect/instruction access Bound */
+	intel_bb_out(ibb, 0);
+	intel_bb_out(ibb, 0 | BASE_ADDRESS_MODIFY);
+	intel_bb_out(ibb, 0);
+	intel_bb_out(ibb, 0 | BASE_ADDRESS_MODIFY);
+}
+
+void
+gen8_emit_state_base_address_v2(struct intel_bb *ibb)
+{
+	intel_bb_out(ibb, GEN8_STATE_BASE_ADDRESS | (16 - 2));
+
+	/* general */
+	intel_bb_out(ibb, 0 | BASE_ADDRESS_MODIFY);
+	intel_bb_out(ibb, 0);
+
+	/* stateless data port */
+	intel_bb_out(ibb, 0 | BASE_ADDRESS_MODIFY);
+
+	/* surface */
+	intel_bb_emit_reloc(ibb, ibb->handle,
+			    I915_GEM_DOMAIN_SAMPLER, 0,
+			    BASE_ADDRESS_MODIFY, 0x0);
+
+	/* dynamic */
+	intel_bb_emit_reloc(ibb, ibb->handle,
+			    I915_GEM_DOMAIN_RENDER | I915_GEM_DOMAIN_INSTRUCTION,
+			    0,
+			    BASE_ADDRESS_MODIFY, 0x0);
+
+	/* indirect */
+	intel_bb_out(ibb, 0);
+	intel_bb_out(ibb, 0);
+
+	/* instruction */
+	intel_bb_emit_reloc(ibb, ibb->handle,
+			    I915_GEM_DOMAIN_INSTRUCTION,
+			    0,
+			    BASE_ADDRESS_MODIFY, 0x0);
+
+
+	/* general state buffer size */
+	intel_bb_out(ibb, 0xfffff000 | 1);
+	/* dynamic state buffer size */
+	intel_bb_out(ibb, 1 << 12 | 1);
+	/* indirect object buffer size */
+	intel_bb_out(ibb, 0xfffff000 | 1);
+	/* instruction buffer size, must set modify enable bit, otherwise it may
+	 * result in GPU hang
+	 */
+	intel_bb_out(ibb, 1 << 12 | 1);
+}
+
+
+void
+gen9_emit_state_base_address_v2(struct intel_bb *ibb)
+{
+	intel_bb_out(ibb, GEN8_STATE_BASE_ADDRESS | (19 - 2));
+
+	/* general */
+	intel_bb_out(ibb, 0 | BASE_ADDRESS_MODIFY);
+	intel_bb_out(ibb, 0);
+
+	/* stateless data port */
+	intel_bb_out(ibb, 0 | BASE_ADDRESS_MODIFY);
+
+	/* surface */
+	intel_bb_emit_reloc(ibb, ibb->handle,
+			    I915_GEM_DOMAIN_SAMPLER, 0,
+			    BASE_ADDRESS_MODIFY, 0x0);
+
+	/* dynamic */
+	intel_bb_emit_reloc(ibb, ibb->handle,
+			    I915_GEM_DOMAIN_RENDER | I915_GEM_DOMAIN_INSTRUCTION,
+			    0,
+			    BASE_ADDRESS_MODIFY, 0x0);
+
+	/* indirect */
+	intel_bb_out(ibb, 0);
+	intel_bb_out(ibb, 0);
+
+	/* instruction */
+	intel_bb_emit_reloc(ibb, ibb->handle,
+			    I915_GEM_DOMAIN_INSTRUCTION, 0,
+			    BASE_ADDRESS_MODIFY, 0x0);
+
+	/* general state buffer size */
+	intel_bb_out(ibb, 0xfffff000 | 1);
+	/* dynamic state buffer size */
+	intel_bb_out(ibb, 1 << 12 | 1);
+	/* indirect object buffer size */
+	intel_bb_out(ibb, 0xfffff000 | 1);
+	/* intruction buffer size, must set modify enable bit, otherwise it may
+	 * result in GPU hang
+	 */
+	intel_bb_out(ibb, 1 << 12 | 1);
+
+	/* Bindless surface state base address */
+	intel_bb_out(ibb, 0 | BASE_ADDRESS_MODIFY);
+	intel_bb_out(ibb, 0);
+	intel_bb_out(ibb, 0xfffff000);
+}
+
+void
+gen7_emit_vfe_state_v2(struct intel_bb *ibb, uint32_t threads,
+		       uint32_t urb_entries, uint32_t urb_size,
+		       uint32_t curbe_size, uint32_t mode)
+{
+	intel_bb_out(ibb, GEN7_MEDIA_VFE_STATE | (8 - 2));
+
+	/* scratch buffer */
+	intel_bb_out(ibb, 0);
+
+	/* number of threads & urb entries */
+	intel_bb_out(ibb, threads << 16 |
+		     urb_entries << 8 |
+		     mode << 2); /* GPGPU vs media mode */
+
+	intel_bb_out(ibb, 0);
+
+	/* urb entry size & curbe size */
+	intel_bb_out(ibb, urb_size << 16 |	/* in 256 bits unit */
+		     curbe_size);		/* in 256 bits unit */
+
+	/* scoreboard */
+	intel_bb_out(ibb, 0);
+	intel_bb_out(ibb, 0);
+	intel_bb_out(ibb, 0);
+}
+
+void
+gen8_emit_vfe_state_v2(struct intel_bb *ibb, uint32_t threads,
+		       uint32_t urb_entries, uint32_t urb_size,
+		       uint32_t curbe_size)
+{
+	intel_bb_out(ibb, GEN7_MEDIA_VFE_STATE | (9 - 2));
+
+	/* scratch buffer */
+	intel_bb_out(ibb, 0);
+	intel_bb_out(ibb, 0);
+
+	/* number of threads & urb entries */
+	intel_bb_out(ibb, threads << 16 | urb_entries << 8);
+
+	intel_bb_out(ibb, 0);
+
+	/* urb entry size & curbe size */
+	intel_bb_out(ibb, urb_size << 16 | curbe_size);
+
+	/* scoreboard */
+	intel_bb_out(ibb, 0);
+	intel_bb_out(ibb, 0);
+	intel_bb_out(ibb, 0);
+}
+
+void
+gen7_emit_curbe_load_v2(struct intel_bb *ibb, uint32_t curbe_buffer)
+{
+	intel_bb_out(ibb, GEN7_MEDIA_CURBE_LOAD | (4 - 2));
+	intel_bb_out(ibb, 0);
+	/* curbe total data length */
+	intel_bb_out(ibb, 64);
+	/* curbe data start address, is relative to the dynamics base address */
+	intel_bb_out(ibb, curbe_buffer);
+}
+
+void
+gen7_emit_interface_descriptor_load_v2(struct intel_bb *ibb,
+				       uint32_t interface_descriptor)
+{
+	intel_bb_out(ibb, GEN7_MEDIA_INTERFACE_DESCRIPTOR_LOAD | (4 - 2));
+	intel_bb_out(ibb, 0);
+	/* interface descriptor data length */
+	if (ibb->gen == 7)
+		intel_bb_out(ibb, sizeof(struct gen7_interface_descriptor_data));
+	else
+		intel_bb_out(ibb, sizeof(struct gen8_interface_descriptor_data));
+	/* interface descriptor address, is relative to the dynamics base
+	 * address
+	 */
+	intel_bb_out(ibb, interface_descriptor);
+}
+
+void
+gen7_emit_gpgpu_walk_v2(struct intel_bb *ibb,
+			unsigned int x, unsigned int y,
+			unsigned int width, unsigned int height)
+{
+	uint32_t x_dim, y_dim, tmp, right_mask;
+
+	/*
+	 * Simply do SIMD16 based dispatch, so every thread uses
+	 * SIMD16 channels.
+	 *
+	 * Define our own thread group size, e.g 16x1 for every group, then
+	 * will have 1 thread each group in SIMD16 dispatch. So thread
+	 * width/height/depth are all 1.
+	 *
+	 * Then thread group X = width / 16 (aligned to 16)
+	 * thread group Y = height;
+	 */
+	x_dim = (width + 15) / 16;
+	y_dim = height;
+
+	tmp = width & 15;
+	if (tmp == 0)
+		right_mask = (1 << 16) - 1;
+	else
+		right_mask = (1 << tmp) - 1;
+
+	intel_bb_out(ibb, GEN7_GPGPU_WALKER | 9);
+
+	/* interface descriptor offset */
+	intel_bb_out(ibb, 0);
+
+	/* SIMD size, thread w/h/d */
+	intel_bb_out(ibb, 1 << 30 | /* SIMD16 */
+		  0 << 16 | /* depth:1 */
+		  0 << 8 | /* height:1 */
+		  0); /* width:1 */
+
+	/* thread group X */
+	intel_bb_out(ibb, 0);
+	intel_bb_out(ibb, x_dim);
+
+	/* thread group Y */
+	intel_bb_out(ibb, 0);
+	intel_bb_out(ibb, y_dim);
+
+	/* thread group Z */
+	intel_bb_out(ibb, 0);
+	intel_bb_out(ibb, 1);
+
+	/* right mask */
+	intel_bb_out(ibb, right_mask);
+
+	/* bottom mask, height 1, always 0xffffffff */
+	intel_bb_out(ibb, 0xffffffff);
+}
+
+void
+gen8_emit_gpgpu_walk_v2(struct intel_bb *ibb,
+			unsigned int x, unsigned int y,
+			unsigned int width, unsigned int height)
+{
+	uint32_t x_dim, y_dim, tmp, right_mask;
+
+	/*
+	 * Simply do SIMD16 based dispatch, so every thread uses
+	 * SIMD16 channels.
+	 *
+	 * Define our own thread group size, e.g 16x1 for every group, then
+	 * will have 1 thread each group in SIMD16 dispatch. So thread
+	 * width/height/depth are all 1.
+	 *
+	 * Then thread group X = width / 16 (aligned to 16)
+	 * thread group Y = height;
+	 */
+	x_dim = (width + 15) / 16;
+	y_dim = height;
+
+	tmp = width & 15;
+	if (tmp == 0)
+		right_mask = (1 << 16) - 1;
+	else
+		right_mask = (1 << tmp) - 1;
+
+	intel_bb_out(ibb, GEN7_GPGPU_WALKER | 13);
+
+	intel_bb_out(ibb, 0); /* kernel offset */
+	intel_bb_out(ibb, 0); /* indirect data length */
+	intel_bb_out(ibb, 0); /* indirect data offset */
+
+	/* SIMD size, thread w/h/d */
+	intel_bb_out(ibb, 1 << 30 | /* SIMD16 */
+		     0 << 16 | /* depth:1 */
+		     0 << 8 | /* height:1 */
+		     0); /* width:1 */
+
+	/* thread group X */
+	intel_bb_out(ibb, 0);
+	intel_bb_out(ibb, 0);
+	intel_bb_out(ibb, x_dim);
+
+	/* thread group Y */
+	intel_bb_out(ibb, 0);
+	intel_bb_out(ibb, 0);
+	intel_bb_out(ibb, y_dim);
+
+	/* thread group Z */
+	intel_bb_out(ibb, 0);
+	intel_bb_out(ibb, 1);
+
+	/* right mask */
+	intel_bb_out(ibb, right_mask);
+
+	/* bottom mask, height 1, always 0xffffffff */
+	intel_bb_out(ibb, 0xffffffff);
+}
diff --git a/lib/gpu_cmds.h b/lib/gpu_cmds.h
index 1321af44..61aff153 100644
--- a/lib/gpu_cmds.h
+++ b/lib/gpu_cmds.h
@@ -35,6 +35,7 @@
 #include "drmtest.h"
 #include "intel_batchbuffer.h"
 #include "intel_chipset.h"
+#include "intel_bufops.h"
 #include <assert.h>
 
 void
@@ -148,4 +149,57 @@ gen_emit_media_object(struct intel_batchbuffer *batch, unsigned int xoffset,
 void
 gen9_emit_state_base_address(struct intel_batchbuffer *batch);
 
+
+/* No libdrm */
+uint32_t
+gen7_fill_curbe_buffer_data_v2(struct intel_bb *ibb,
+			       uint8_t color);
+
+uint32_t
+gen7_fill_interface_descriptor_v2(struct intel_bb *ibb,
+				  struct intel_buf *buf,
+				  const uint32_t kernel[][4],
+				  size_t size);
+
+uint32_t
+gen8_fill_interface_descriptor_v2(struct intel_bb *ibb,
+				  struct intel_buf *buf,
+				  const uint32_t kernel[][4],
+				  size_t size);
+
+void
+gen7_emit_state_base_address_v2(struct intel_bb *ibb);
+
+void
+gen8_emit_state_base_address_v2(struct intel_bb *ibb);
+
+void
+gen9_emit_state_base_address_v2(struct intel_bb *ibb);
+
+void
+gen7_emit_vfe_state_v2(struct intel_bb *ibb, uint32_t threads,
+		       uint32_t urb_entries, uint32_t urb_size,
+		       uint32_t curbe_size, uint32_t mode);
+
+void
+gen8_emit_vfe_state_v2(struct intel_bb *ibb, uint32_t threads,
+		       uint32_t urb_entries, uint32_t urb_size,
+		       uint32_t curbe_size);
+void
+gen7_emit_curbe_load_v2(struct intel_bb *ibb, uint32_t curbe_buffer);
+
+void
+gen7_emit_interface_descriptor_load_v2(struct intel_bb *ibb,
+				       uint32_t interface_descriptor);
+
+void
+gen7_emit_gpgpu_walk_v2(struct intel_bb *ibb,
+			unsigned int x, unsigned int y,
+			unsigned int width, unsigned int height);
+
+void
+gen8_emit_gpgpu_walk_v2(struct intel_bb *ibb,
+			unsigned int x, unsigned int y,
+			unsigned int width, unsigned int height);
+
 #endif /* GPU_CMDS_H */
-- 
2.26.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [igt-dev] [PATCH i-g-t v5 5/8] lib/gpgpu_fill: libdrm-free gpgpu pipeline creation
  2020-05-19 18:16 [igt-dev] [PATCH i-g-t v5 0/8] Make gpgpu fill tests libdrm independent Zbigniew Kempczyński
                   ` (3 preceding siblings ...)
  2020-05-19 18:16 ` [igt-dev] [PATCH i-g-t v5 4/8] lib/gpu_cmds: Add gpgpu pipeline functions based on intel_bb Zbigniew Kempczyński
@ 2020-05-19 18:16 ` Zbigniew Kempczyński
  2020-05-19 18:16 ` [igt-dev] [PATCH i-g-t v5 6/8] lib/intel_batchbuffer: Introduce temporary igt_fillfunc_v2_t Zbigniew Kempczyński
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: Zbigniew Kempczyński @ 2020-05-19 18:16 UTC (permalink / raw)
  To: igt-dev; +Cc: Chris Wilson

Provide "v2" pipeline for gpgpu fill for all gens.

Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
---
 lib/gpgpu_fill.c | 187 +++++++++++++++++++++++++++++++++++++++++++++++
 lib/gpgpu_fill.h |  34 +++++++++
 2 files changed, 221 insertions(+)

diff --git a/lib/gpgpu_fill.c b/lib/gpgpu_fill.c
index 5660d4c0..49988a36 100644
--- a/lib/gpgpu_fill.c
+++ b/lib/gpgpu_fill.c
@@ -120,6 +120,7 @@ static const uint32_t gen12_gpgpu_kernel[][4] = {
  *
  */
 
+#define PAGE_SIZE 4096
 #define BATCH_STATE_SPLIT 2048
 /* VFE STATE params */
 #define THREADS 1
@@ -178,6 +179,56 @@ gen7_gpgpu_fillfunc(struct intel_batchbuffer *batch,
 	intel_batchbuffer_reset(batch);
 }
 
+void
+gen7_gpgpu_fillfunc_v2(int i915,
+		       struct intel_buf *buf,
+		       unsigned x, unsigned y,
+		       unsigned width, unsigned height,
+		       uint8_t color)
+{
+	struct intel_bb *ibb;
+	uint32_t curbe_buffer, interface_descriptor;
+
+	ibb = intel_bb_create(i915, PAGE_SIZE);
+	intel_bb_add_object(ibb, buf->handle, 0, true);
+
+	intel_bb_ptr_set(ibb, BATCH_STATE_SPLIT);
+
+	/* Fill curbe buffer data */
+	curbe_buffer = gen7_fill_curbe_buffer_data_v2(ibb, color);
+
+	/*
+	 * const buffer needs to fill for every thread, but as we have just 1
+	 * thread per every group, so need only one curbe data.
+	 * For each thread, just use thread group ID for buffer offset.
+	 */
+	interface_descriptor =
+			gen7_fill_interface_descriptor_v2(ibb, buf,
+							  gen7_gpgpu_kernel,
+							  sizeof(gen7_gpgpu_kernel));
+
+	intel_bb_ptr_set(ibb, 0);
+
+	/* GPGPU pipeline */
+	intel_bb_out(ibb, GEN7_PIPELINE_SELECT | PIPELINE_SELECT_GPGPU);
+
+	gen7_emit_state_base_address_v2(ibb);
+	gen7_emit_vfe_state_v2(ibb, THREADS, GEN7_GPGPU_URB_ENTRIES,
+			       GPGPU_URB_SIZE, GPGPU_CURBE_SIZE,
+			       GEN7_VFE_STATE_GPGPU_MODE);
+	gen7_emit_curbe_load_v2(ibb, curbe_buffer);
+	gen7_emit_interface_descriptor_load_v2(ibb, interface_descriptor);
+	gen7_emit_gpgpu_walk_v2(ibb, x, y, width, height);
+
+	intel_bb_out(ibb, MI_BATCH_BUFFER_END);
+	intel_bb_ptr_align(ibb, 32);
+
+	intel_bb_exec(ibb, intel_bb_offset(ibb),
+		      I915_EXEC_DEFAULT | I915_EXEC_NO_RELOC, true);
+
+	intel_bb_destroy(ibb);
+}
+
 void
 gen8_gpgpu_fillfunc(struct intel_batchbuffer *batch,
 		    const struct igt_buf *dst,
@@ -226,6 +277,54 @@ gen8_gpgpu_fillfunc(struct intel_batchbuffer *batch,
 	intel_batchbuffer_reset(batch);
 }
 
+void
+gen8_gpgpu_fillfunc_v2(int i915,
+		       struct intel_buf *buf,
+		       unsigned x, unsigned y,
+		       unsigned width, unsigned height,
+		       uint8_t color)
+{
+	struct intel_bb *ibb;
+	uint32_t curbe_buffer, interface_descriptor;
+
+	ibb = intel_bb_create(i915, PAGE_SIZE);
+	intel_bb_add_object(ibb, buf->handle, 0, true);
+
+	intel_bb_ptr_set(ibb, BATCH_STATE_SPLIT);
+
+	/*
+	 * const buffer needs to fill for every thread, but as we have just 1
+	 * thread per every group, so need only one curbe data.
+	 * For each thread, just use thread group ID for buffer offset.
+	 */
+	curbe_buffer = gen7_fill_curbe_buffer_data_v2(ibb, color);
+
+	interface_descriptor = gen8_fill_interface_descriptor_v2(ibb, buf,
+				gen8_gpgpu_kernel, sizeof(gen8_gpgpu_kernel));
+
+	intel_bb_ptr_set(ibb, 0);
+
+	/* GPGPU pipeline */
+	intel_bb_out(ibb, GEN7_PIPELINE_SELECT | PIPELINE_SELECT_GPGPU);
+
+	gen8_emit_state_base_address_v2(ibb);
+	gen8_emit_vfe_state_v2(ibb, THREADS, GEN8_GPGPU_URB_ENTRIES,
+			       GPGPU_URB_SIZE, GPGPU_CURBE_SIZE);
+
+	gen7_emit_curbe_load_v2(ibb, curbe_buffer);
+	gen7_emit_interface_descriptor_load_v2(ibb, interface_descriptor);
+
+	gen8_emit_gpgpu_walk_v2(ibb, x, y, width, height);
+
+	intel_bb_out(ibb, MI_BATCH_BUFFER_END);
+	intel_bb_ptr_align(ibb, 32);
+
+	intel_bb_exec(ibb, intel_bb_offset(ibb),
+		      I915_EXEC_DEFAULT | I915_EXEC_NO_RELOC, true);
+
+	intel_bb_destroy(ibb);
+}
+
 static void
 __gen9_gpgpu_fillfunc(struct intel_batchbuffer *batch,
 		      const struct igt_buf *dst,
@@ -276,6 +375,60 @@ __gen9_gpgpu_fillfunc(struct intel_batchbuffer *batch,
 	intel_batchbuffer_reset(batch);
 }
 
+
+static void
+__gen9_gpgpu_fillfunc_v2(int i915,
+			 struct intel_buf *buf,
+			 unsigned x, unsigned y,
+			 unsigned width, unsigned height,
+			 uint8_t color,
+			 const uint32_t kernel[][4], size_t kernel_size)
+{
+	struct intel_bb *ibb;
+	uint32_t curbe_buffer, interface_descriptor;
+
+	ibb = intel_bb_create(i915, PAGE_SIZE);
+	intel_bb_add_object(ibb, buf->handle, 0, true);
+
+	intel_bb_ptr_set(ibb, BATCH_STATE_SPLIT);
+
+	/*
+	 * const buffer needs to fill for every thread, but as we have just 1
+	 * thread per every group, so need only one curbe data.
+	 * For each thread, just use thread group ID for buffer offset.
+	 */
+	/* Fill curbe buffer data */
+	curbe_buffer = gen7_fill_curbe_buffer_data_v2(ibb, color);
+
+	interface_descriptor = gen8_fill_interface_descriptor_v2(ibb, buf,
+								 kernel,
+								 kernel_size);
+
+	intel_bb_ptr_set(ibb, 0);
+
+	/* GPGPU pipeline */
+	intel_bb_out(ibb, GEN7_PIPELINE_SELECT | GEN9_PIPELINE_SELECTION_MASK |
+		     PIPELINE_SELECT_GPGPU);
+
+	gen9_emit_state_base_address_v2(ibb);
+
+	gen8_emit_vfe_state_v2(ibb, THREADS, GEN8_GPGPU_URB_ENTRIES,
+			       GPGPU_URB_SIZE, GPGPU_CURBE_SIZE);
+
+	gen7_emit_curbe_load_v2(ibb, curbe_buffer);
+	gen7_emit_interface_descriptor_load_v2(ibb, interface_descriptor);
+
+	gen8_emit_gpgpu_walk_v2(ibb, x, y, width, height);
+
+	intel_bb_out(ibb, MI_BATCH_BUFFER_END);
+	intel_bb_ptr_align(ibb, 32);
+
+	intel_bb_exec(ibb, intel_bb_offset(ibb),
+		      I915_EXEC_DEFAULT | I915_EXEC_NO_RELOC, true);
+
+	intel_bb_destroy(ibb);
+}
+
 void gen9_gpgpu_fillfunc(struct intel_batchbuffer *batch,
 			 const struct igt_buf *dst,
 			 unsigned int x, unsigned int y,
@@ -286,6 +439,18 @@ void gen9_gpgpu_fillfunc(struct intel_batchbuffer *batch,
 			      gen9_gpgpu_kernel, sizeof(gen9_gpgpu_kernel));
 }
 
+void gen9_gpgpu_fillfunc_v2(int i915,
+			    struct intel_buf *buf,
+			    unsigned x, unsigned y,
+			    unsigned width, unsigned height,
+			    uint8_t color)
+{
+	__gen9_gpgpu_fillfunc_v2(i915, buf, x, y, width, height, color,
+				 gen9_gpgpu_kernel,
+				 sizeof(gen9_gpgpu_kernel));
+}
+
+
 void gen11_gpgpu_fillfunc(struct intel_batchbuffer *batch,
 			  const struct igt_buf *dst,
 			  unsigned int x, unsigned int y,
@@ -296,6 +461,17 @@ void gen11_gpgpu_fillfunc(struct intel_batchbuffer *batch,
 			      gen11_gpgpu_kernel, sizeof(gen11_gpgpu_kernel));
 }
 
+void gen11_gpgpu_fillfunc_v2(int i915,
+			     struct intel_buf *buf,
+			     unsigned x, unsigned y,
+			     unsigned width, unsigned height,
+			     uint8_t color)
+{
+	__gen9_gpgpu_fillfunc_v2(i915, buf, x, y, width, height, color,
+				 gen11_gpgpu_kernel,
+				 sizeof(gen11_gpgpu_kernel));
+}
+
 void gen12_gpgpu_fillfunc(struct intel_batchbuffer *batch,
 			  const struct igt_buf *dst,
 			  unsigned int x, unsigned int y,
@@ -305,3 +481,14 @@ void gen12_gpgpu_fillfunc(struct intel_batchbuffer *batch,
 	__gen9_gpgpu_fillfunc(batch, dst, x, y, width, height, color,
 			      gen12_gpgpu_kernel, sizeof(gen12_gpgpu_kernel));
 }
+
+void gen12_gpgpu_fillfunc_v2(int i915,
+			     struct intel_buf *buf,
+			     unsigned x, unsigned y,
+			     unsigned width, unsigned height,
+			     uint8_t color)
+{
+	__gen9_gpgpu_fillfunc_v2(i915, buf, x, y, width, height, color,
+				 gen12_gpgpu_kernel,
+				 sizeof(gen12_gpgpu_kernel));
+}
diff --git a/lib/gpgpu_fill.h b/lib/gpgpu_fill.h
index da7d646f..a387732b 100644
--- a/lib/gpgpu_fill.h
+++ b/lib/gpgpu_fill.h
@@ -28,6 +28,7 @@
 #define GPGPU_FILL_H
 
 #include "intel_batchbuffer.h"
+#include "intel_bufops.h"
 
 void
 gen7_gpgpu_fillfunc(struct intel_batchbuffer *batch,
@@ -36,6 +37,13 @@ gen7_gpgpu_fillfunc(struct intel_batchbuffer *batch,
 		    unsigned int width, unsigned int height,
 		    uint8_t color);
 
+void
+gen7_gpgpu_fillfunc_v2(int i915,
+		       struct intel_buf *buf,
+		       unsigned x, unsigned y,
+		       unsigned width, unsigned height,
+		       uint8_t color);
+
 void
 gen8_gpgpu_fillfunc(struct intel_batchbuffer *batch,
 		    const struct igt_buf *dst,
@@ -43,6 +51,13 @@ gen8_gpgpu_fillfunc(struct intel_batchbuffer *batch,
 		    unsigned int width, unsigned int height,
 		    uint8_t color);
 
+void
+gen8_gpgpu_fillfunc_v2(int i915,
+		       struct intel_buf *buf,
+		       unsigned x, unsigned y,
+		       unsigned width, unsigned height,
+		       uint8_t color);
+
 void
 gen9_gpgpu_fillfunc(struct intel_batchbuffer *batch,
 		    const struct igt_buf *dst,
@@ -50,6 +65,12 @@ gen9_gpgpu_fillfunc(struct intel_batchbuffer *batch,
 		    unsigned int width, unsigned int height,
 		    uint8_t color);
 
+void gen9_gpgpu_fillfunc_v2(int i915,
+			    struct intel_buf *buf,
+			    unsigned x, unsigned y,
+			    unsigned width, unsigned height,
+			    uint8_t color);
+
 void
 gen11_gpgpu_fillfunc(struct intel_batchbuffer *batch,
 		     const struct igt_buf *dst,
@@ -57,6 +78,12 @@ gen11_gpgpu_fillfunc(struct intel_batchbuffer *batch,
 		     unsigned int width, unsigned int height,
 		     uint8_t color);
 
+void gen11_gpgpu_fillfunc_v2(int i915,
+			     struct intel_buf *buf,
+			     unsigned x, unsigned y,
+			     unsigned width, unsigned height,
+			     uint8_t color);
+
 void
 gen12_gpgpu_fillfunc(struct intel_batchbuffer *batch,
 		     const struct igt_buf *dst,
@@ -64,4 +91,11 @@ gen12_gpgpu_fillfunc(struct intel_batchbuffer *batch,
 		     unsigned int width, unsigned int height,
 		     uint8_t color);
 
+void
+gen12_gpgpu_fillfunc_v2(int i915,
+			struct intel_buf *buf,
+			unsigned x, unsigned y,
+			unsigned width, unsigned height,
+			uint8_t color);
+
 #endif /* GPGPU_FILL_H */
-- 
2.26.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [igt-dev] [PATCH i-g-t v5 6/8] lib/intel_batchbuffer: Introduce temporary igt_fillfunc_v2_t
  2020-05-19 18:16 [igt-dev] [PATCH i-g-t v5 0/8] Make gpgpu fill tests libdrm independent Zbigniew Kempczyński
                   ` (4 preceding siblings ...)
  2020-05-19 18:16 ` [igt-dev] [PATCH i-g-t v5 5/8] lib/gpgpu_fill: libdrm-free gpgpu pipeline creation Zbigniew Kempczyński
@ 2020-05-19 18:16 ` Zbigniew Kempczyński
  2020-05-19 18:16 ` [igt-dev] [PATCH i-g-t v5 7/8] tests/gem_gpgpu_fill: Remove libdrm dependency Zbigniew Kempczyński
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: Zbigniew Kempczyński @ 2020-05-19 18:16 UTC (permalink / raw)
  To: igt-dev; +Cc: Chris Wilson

gem_gpgpu_fill test is spread over different generations (gen >= 7)
so some transitional state is required until all gens will be
rewritten to new intel_bb code without libdrm dependency.

So, let's define new igt_fillfunc_v2_t to be new fill function.

Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
---
 lib/intel_batchbuffer.c | 27 +++++++++++++++++++++++++++
 lib/intel_batchbuffer.h |  8 ++++++++
 2 files changed, 35 insertions(+)

diff --git a/lib/intel_batchbuffer.c b/lib/intel_batchbuffer.c
index 5ee95808..0772ae24 100644
--- a/lib/intel_batchbuffer.c
+++ b/lib/intel_batchbuffer.c
@@ -1154,6 +1154,33 @@ igt_fillfunc_t igt_get_gpgpu_fillfunc(int devid)
 	return fill;
 }
 
+/**
+ * igt_get_gpgpu_fillfunc_v2:
+ * @devid: pci device id
+ *
+ * Returns:
+ *
+ * The platform-specific gpgpu fill function pointer for the device specified
+ * with @devid. Will return NULL when no gpgpu fill function is implemented.
+ */
+igt_fillfunc_v2_t igt_get_gpgpu_fillfunc_v2(int devid)
+{
+	igt_fillfunc_v2_t fill = NULL;
+
+	if (IS_GEN7(devid))
+		fill = gen7_gpgpu_fillfunc_v2;
+	else if (IS_BROADWELL(devid))
+		fill = gen8_gpgpu_fillfunc_v2;
+	else if (IS_GEN9(devid) || IS_GEN10(devid))
+		fill = gen9_gpgpu_fillfunc_v2;
+	else if (IS_GEN11(devid))
+		fill = gen11_gpgpu_fillfunc_v2;
+	else if (IS_GEN12(devid))
+		fill = gen12_gpgpu_fillfunc_v2;
+
+	return fill;
+}
+
 /**
  * igt_get_media_spinfunc:
  * @devid: pci device id
diff --git a/lib/intel_batchbuffer.h b/lib/intel_batchbuffer.h
index 5f162546..0d95427c 100644
--- a/lib/intel_batchbuffer.h
+++ b/lib/intel_batchbuffer.h
@@ -391,8 +391,16 @@ typedef void (*igt_fillfunc_t)(struct intel_batchbuffer *batch,
 			       unsigned width, unsigned height,
 			       uint8_t color);
 
+struct intel_buf;
+typedef void (*igt_fillfunc_v2_t)(int i915,
+				  struct intel_buf *buf,
+				  unsigned x, unsigned y,
+				  unsigned width, unsigned height,
+				  uint8_t color);
+
 igt_fillfunc_t igt_get_media_fillfunc(int devid);
 igt_fillfunc_t igt_get_gpgpu_fillfunc(int devid);
+igt_fillfunc_v2_t igt_get_gpgpu_fillfunc_v2(int devid);
 
 typedef void (*igt_vme_func_t)(struct intel_batchbuffer *batch,
 			       const struct igt_buf *src,
-- 
2.26.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [igt-dev] [PATCH i-g-t v5 7/8] tests/gem_gpgpu_fill: Remove libdrm dependency
  2020-05-19 18:16 [igt-dev] [PATCH i-g-t v5 0/8] Make gpgpu fill tests libdrm independent Zbigniew Kempczyński
                   ` (5 preceding siblings ...)
  2020-05-19 18:16 ` [igt-dev] [PATCH i-g-t v5 6/8] lib/intel_batchbuffer: Introduce temporary igt_fillfunc_v2_t Zbigniew Kempczyński
@ 2020-05-19 18:16 ` Zbigniew Kempczyński
  2020-05-19 18:39   ` Chris Wilson
  2020-05-19 18:16 ` [igt-dev] [PATCH i-g-t v5 8/8] HAX: run gpgpu_fill in BAT only Zbigniew Kempczyński
  2020-05-19 19:48 ` [igt-dev] ✗ Fi.CI.BAT: failure for Make gpgpu fill tests libdrm independent (rev5) Patchwork
  8 siblings, 1 reply; 12+ messages in thread
From: Zbigniew Kempczyński @ 2020-05-19 18:16 UTC (permalink / raw)
  To: igt-dev; +Cc: Chris Wilson

Gpgpu pipeline creation is a little bit coupled (some functions
are used in other gens) so providing "v2" version of the same
functions is necessary unless former will have full replacement
(media fill also uses same functions).

So gpgpu fill prefers now "newer" version of the same pipeline
creation which is libdrm-free.

Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
---
 tests/i915/gem_gpgpu_fill.c | 126 ++++++++++++++++++++++++++++--------
 1 file changed, 99 insertions(+), 27 deletions(-)

diff --git a/tests/i915/gem_gpgpu_fill.c b/tests/i915/gem_gpgpu_fill.c
index fb1758bd..24a2c834 100644
--- a/tests/i915/gem_gpgpu_fill.c
+++ b/tests/i915/gem_gpgpu_fill.c
@@ -46,6 +46,7 @@
 #include "i915/gem.h"
 #include "igt.h"
 #include "intel_bufmgr.h"
+#include "intel_bufops.h"
 
 #define WIDTH 64
 #define HEIGHT 64
@@ -60,6 +61,7 @@ typedef struct {
 	uint32_t devid;
 	drm_intel_bufmgr *bufmgr;
 	uint8_t linear[WIDTH * HEIGHT];
+	struct buf_ops *bops;
 } data_t;
 
 static void scratch_buf_init(data_t *data, struct igt_buf *buf,
@@ -83,6 +85,34 @@ static void scratch_buf_init(data_t *data, struct igt_buf *buf,
 	buf->bpp = 32;
 }
 
+static struct intel_buf *
+create_buf(data_t *data, int width, int height, uint8_t color)
+{
+	struct intel_buf *buf;
+	uint8_t *ptr;
+	int i;
+
+	buf = calloc(1, sizeof(*buf));
+	igt_assert(buf);
+
+	/*
+	 * Legacy code uses 32 bpp after buffer creation.
+	 * Let's do the same due to keep shader intact.
+	 */
+	intel_buf_init(data->bops, buf, width/4, height, 32, 0,
+		       I915_TILING_NONE, 0);
+
+	ptr = gem_mmap__cpu_coherent(data->drm_fd,
+				     buf->handle, 0, buf->size, PROT_WRITE);
+
+	for (i = 0; i < buf->size; i++)
+		ptr[i] = color;
+
+	munmap(ptr, buf->size);
+
+	return buf;
+}
+
 static void
 scratch_buf_check(data_t *data, struct igt_buf *buf, int x, int y,
 		uint8_t color)
@@ -97,47 +127,89 @@ scratch_buf_check(data_t *data, struct igt_buf *buf, int x, int y,
 		     color, val, x, y);
 }
 
-igt_simple_main
+static void buf_check(uint8_t *ptr, int x, int y, uint8_t color)
+{
+	uint8_t val;
+
+	val = ptr[y * WIDTH + x];
+	igt_assert_f(val == color,
+		     "Expected 0x%02x, found 0x%02x at (%d,%d)\n",
+		     color, val, x, y);
+}
+
+static void no_libdrm(data_t *data, igt_fillfunc_v2_t fill)
+{
+	struct intel_buf *buf;
+	uint8_t *ptr;
+	int i, j;
+
+	buf = create_buf(data, WIDTH, HEIGHT, COLOR_C4);
+	ptr = gem_mmap__cpu_coherent(data->drm_fd, buf->handle,
+				     0, buf->size, PROT_READ);
+	for (i = 0; i < WIDTH; i++)
+		for (j = 0; j < HEIGHT; j++)
+			buf_check(ptr, i, j, COLOR_C4);
+
+	fill(data->drm_fd, buf, 0, 0, WIDTH / 2, HEIGHT / 2, COLOR_4C);
+
+	for (i = 0; i < WIDTH; i++)
+		for (j = 0; j < HEIGHT; j++)
+			if (i < WIDTH / 2 && j < HEIGHT / 2)
+				buf_check(ptr, i, j, COLOR_4C);
+			else
+				buf_check(ptr, i, j, COLOR_C4);
+
+	munmap(ptr, buf->size);
+}
+
+static void with_libdrm(data_t *data, igt_fillfunc_t fill)
 {
-	data_t data = {0, };
 	struct intel_batchbuffer *batch = NULL;
 	struct igt_buf dst;
-	igt_fillfunc_t gpgpu_fill = NULL;
 	int i, j;
 
+	batch = intel_batchbuffer_alloc(data->bufmgr, data->devid);
+	igt_assert(batch);
+
+	scratch_buf_init(data, &dst, WIDTH, HEIGHT, STRIDE, COLOR_C4);
+
+	for (i = 0; i < WIDTH; i++)
+		for (j = 0; j < HEIGHT; j++)
+			scratch_buf_check(data, &dst, i, j, COLOR_C4);
+
+	fill(batch, &dst, 0, 0, WIDTH / 2, HEIGHT / 2, COLOR_4C);
+
+	for (i = 0; i < WIDTH; i++)
+		for (j = 0; j < HEIGHT; j++)
+			if (i < WIDTH / 2 && j < HEIGHT / 2)
+				scratch_buf_check(data, &dst, i, j, COLOR_4C);
+			else
+				scratch_buf_check(data, &dst, i, j, COLOR_C4);
+
+}
+
+igt_simple_main
+{
+	data_t data = {0, };
+	igt_fillfunc_t gpgpu_fill = NULL;
+	igt_fillfunc_v2_t gpgpu_fill_v2 = NULL;
+
 	data.drm_fd = drm_open_driver_render(DRIVER_INTEL);
 	data.devid = intel_get_drm_devid(data.drm_fd);
 	igt_require_gem(data.drm_fd);
+	data.bops = buf_ops_create(data.drm_fd);
 
 	data.bufmgr = drm_intel_bufmgr_gem_init(data.drm_fd, 4096);
 	igt_assert(data.bufmgr);
 
 	gpgpu_fill = igt_get_gpgpu_fillfunc(data.devid);
+	gpgpu_fill_v2 = igt_get_gpgpu_fillfunc_v2(data.devid);
 
-	igt_require_f(gpgpu_fill,
+	igt_require_f(gpgpu_fill || gpgpu_fill_v2,
 		      "no gpgpu-fill function\n");
 
-	batch = intel_batchbuffer_alloc(data.bufmgr, data.devid);
-	igt_assert(batch);
-
-	scratch_buf_init(&data, &dst, WIDTH, HEIGHT, STRIDE, COLOR_C4);
-
-	for (i = 0; i < WIDTH; i++) {
-		for (j = 0; j < HEIGHT; j++) {
-			scratch_buf_check(&data, &dst, i, j, COLOR_C4);
-		}
-	}
-
-	gpgpu_fill(batch,
-		   &dst, 0, 0, WIDTH / 2, HEIGHT / 2,
-		   COLOR_4C);
-
-	for (i = 0; i < WIDTH; i++) {
-		for (j = 0; j < HEIGHT; j++) {
-			if (i < WIDTH / 2 && j < HEIGHT / 2)
-				scratch_buf_check(&data, &dst, i, j, COLOR_4C);
-			else
-				scratch_buf_check(&data, &dst, i, j, COLOR_C4);
-		}
-	}
+	if (gpgpu_fill_v2)
+		no_libdrm(&data, gpgpu_fill_v2);
+	else
+		with_libdrm(&data, gpgpu_fill);
 }
-- 
2.26.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [igt-dev] [PATCH i-g-t v5 8/8] HAX: run gpgpu_fill in BAT only
  2020-05-19 18:16 [igt-dev] [PATCH i-g-t v5 0/8] Make gpgpu fill tests libdrm independent Zbigniew Kempczyński
                   ` (6 preceding siblings ...)
  2020-05-19 18:16 ` [igt-dev] [PATCH i-g-t v5 7/8] tests/gem_gpgpu_fill: Remove libdrm dependency Zbigniew Kempczyński
@ 2020-05-19 18:16 ` Zbigniew Kempczyński
  2020-05-19 19:48 ` [igt-dev] ✗ Fi.CI.BAT: failure for Make gpgpu fill tests libdrm independent (rev5) Patchwork
  8 siblings, 0 replies; 12+ messages in thread
From: Zbigniew Kempczyński @ 2020-05-19 18:16 UTC (permalink / raw)
  To: igt-dev

---
 tests/intel-ci/fast-feedback.testlist | 161 +-------------------------
 1 file changed, 1 insertion(+), 160 deletions(-)

diff --git a/tests/intel-ci/fast-feedback.testlist b/tests/intel-ci/fast-feedback.testlist
index 04f6affc..3546c2ff 100644
--- a/tests/intel-ci/fast-feedback.testlist
+++ b/tests/intel-ci/fast-feedback.testlist
@@ -1,162 +1,3 @@
 # Keep alphabetically sorted by default
 
-igt@core_auth@basic-auth
-igt@debugfs_test@read_all_entries
-igt@fbdev@mmap
-igt@gem_basic@bad-close
-igt@gem_basic@create-close
-igt@gem_basic@create-fd-close
-igt@gem_busy@busy@all
-igt@gem_close_race@basic-process
-igt@gem_close_race@basic-threads
-igt@gem_ctx_create@basic
-igt@gem_ctx_create@basic-files
-igt@gem_ctx_exec@basic
-igt@gem_exec_basic@basic
-igt@gem_exec_create@basic
-igt@gem_exec_fence@basic-busy
-igt@gem_exec_fence@basic-wait
-igt@gem_exec_fence@basic-await
-igt@gem_exec_fence@nb-await
-igt@gem_exec_gttfill@basic
-igt@gem_exec_parallel@engines
-igt@gem_exec_store@basic
-igt@gem_exec_suspend@basic-s0
-igt@gem_exec_suspend@basic-s3
-igt@gem_flink_basic@bad-flink
-igt@gem_flink_basic@bad-open
-igt@gem_flink_basic@basic
-igt@gem_flink_basic@double-flink
-igt@gem_flink_basic@flink-lifetime
-igt@gem_linear_blits@basic
-igt@gem_mmap@basic
-igt@gem_mmap_gtt@basic
-igt@gem_render_linear_blits@basic
-igt@gem_render_tiled_blits@basic
-igt@gem_ringfill@basic-all
-igt@gem_sync@basic-all
-igt@gem_sync@basic-each
-igt@gem_tiled_blits@basic
-igt@gem_tiled_fence_blits@basic
-igt@gem_tiled_pread_basic
-igt@gem_wait@busy@all
-igt@gem_wait@wait@all
-igt@i915_getparams_basic@basic-eu-total
-igt@i915_getparams_basic@basic-subslice-total
-igt@i915_hangman@error-state-basic
-igt@kms_addfb_basic@addfb25-bad-modifier
-igt@kms_addfb_basic@addfb25-framebuffer-vs-set-tiling
-igt@kms_addfb_basic@addfb25-modifier-no-flag
-igt@kms_addfb_basic@addfb25-x-tiled
-igt@kms_addfb_basic@addfb25-x-tiled-mismatch
-igt@kms_addfb_basic@addfb25-yf-tiled
-igt@kms_addfb_basic@addfb25-y-tiled
-igt@kms_addfb_basic@addfb25-y-tiled-small
-igt@kms_addfb_basic@bad-pitch-0
-igt@kms_addfb_basic@bad-pitch-1024
-igt@kms_addfb_basic@bad-pitch-128
-igt@kms_addfb_basic@bad-pitch-256
-igt@kms_addfb_basic@bad-pitch-32
-igt@kms_addfb_basic@bad-pitch-63
-igt@kms_addfb_basic@bad-pitch-65536
-igt@kms_addfb_basic@bad-pitch-999
-igt@kms_addfb_basic@basic
-igt@kms_addfb_basic@basic-x-tiled
-igt@kms_addfb_basic@basic-y-tiled
-igt@kms_addfb_basic@bo-too-small
-igt@kms_addfb_basic@bo-too-small-due-to-tiling
-igt@kms_addfb_basic@clobberred-modifier
-igt@kms_addfb_basic@framebuffer-vs-set-tiling
-igt@kms_addfb_basic@invalid-get-prop
-igt@kms_addfb_basic@invalid-get-prop-any
-igt@kms_addfb_basic@invalid-set-prop
-igt@kms_addfb_basic@invalid-set-prop-any
-igt@kms_addfb_basic@no-handle
-igt@kms_addfb_basic@size-max
-igt@kms_addfb_basic@small-bo
-igt@kms_addfb_basic@tile-pitch-mismatch
-igt@kms_addfb_basic@too-high
-igt@kms_addfb_basic@too-wide
-igt@kms_addfb_basic@unused-handle
-igt@kms_addfb_basic@unused-modifier
-igt@kms_addfb_basic@unused-offsets
-igt@kms_addfb_basic@unused-pitches
-igt@kms_busy@basic
-igt@kms_chamelium@dp-hpd-fast
-igt@kms_chamelium@dp-edid-read
-igt@kms_chamelium@dp-crc-fast
-igt@kms_chamelium@hdmi-hpd-fast
-igt@kms_chamelium@hdmi-edid-read
-igt@kms_chamelium@hdmi-crc-fast
-igt@kms_chamelium@vga-hpd-fast
-igt@kms_chamelium@vga-edid-read
-igt@kms_chamelium@common-hpd-after-suspend
-igt@kms_prop_blob@basic
-igt@kms_cursor_legacy@basic-busy-flip-before-cursor-atomic
-igt@kms_cursor_legacy@basic-busy-flip-before-cursor-legacy
-igt@kms_cursor_legacy@basic-flip-after-cursor-atomic
-igt@kms_cursor_legacy@basic-flip-after-cursor-legacy
-igt@kms_cursor_legacy@basic-flip-after-cursor-varying-size
-igt@kms_cursor_legacy@basic-flip-before-cursor-atomic
-igt@kms_cursor_legacy@basic-flip-before-cursor-legacy
-igt@kms_cursor_legacy@basic-flip-before-cursor-varying-size
-igt@kms_flip@basic-flip-vs-dpms
-igt@kms_flip@basic-flip-vs-modeset
-igt@kms_flip@basic-flip-vs-wf_vblank
-igt@kms_flip@basic-plain-flip
-igt@kms_force_connector_basic@force-connector-state
-igt@kms_force_connector_basic@force-edid
-igt@kms_force_connector_basic@force-load-detect
-igt@kms_force_connector_basic@prune-stale-modes
-igt@kms_frontbuffer_tracking@basic
-igt@kms_pipe_crc_basic@hang-read-crc-pipe-a
-igt@kms_pipe_crc_basic@nonblocking-crc-pipe-a
-igt@kms_pipe_crc_basic@nonblocking-crc-pipe-a-frame-sequence
-igt@kms_pipe_crc_basic@read-crc-pipe-a
-igt@kms_pipe_crc_basic@read-crc-pipe-b
-igt@kms_pipe_crc_basic@read-crc-pipe-c
-igt@kms_pipe_crc_basic@read-crc-pipe-a-frame-sequence
-igt@kms_pipe_crc_basic@suspend-read-crc-pipe-a
-igt@kms_psr@primary_page_flip
-igt@kms_psr@cursor_plane_move
-igt@kms_psr@sprite_plane_onoff
-igt@kms_psr@primary_mmap_gtt
-igt@kms_setmode@basic-clone-single-crtc
-igt@i915_pm_backlight@basic-brightness
-igt@i915_pm_rpm@basic-pci-d3-state
-igt@i915_pm_rpm@basic-rte
-igt@i915_pm_rps@basic-api
-igt@prime_self_import@basic-llseek-bad
-igt@prime_self_import@basic-llseek-size
-igt@prime_self_import@basic-with_fd_dup
-igt@prime_self_import@basic-with_one_bo
-igt@prime_self_import@basic-with_one_bo_two_files
-igt@prime_self_import@basic-with_two_bos
-igt@prime_vgem@basic-fence-flip
-igt@prime_vgem@basic-fence-mmap
-igt@prime_vgem@basic-fence-read
-igt@prime_vgem@basic-gtt
-igt@prime_vgem@basic-read
-igt@prime_vgem@basic-write
-igt@vgem_basic@setversion
-igt@vgem_basic@create
-igt@vgem_basic@debugfs
-igt@vgem_basic@dmabuf-export
-igt@vgem_basic@dmabuf-fence
-igt@vgem_basic@dmabuf-fence-before
-igt@vgem_basic@dmabuf-mmap
-igt@vgem_basic@mmap
-igt@vgem_basic@second-client
-igt@vgem_basic@sysfs
-
-# All tests that do module unloading and reloading are executed last.
-# They will sometimes reveal issues of earlier tests leaving the
-# driver in a broken state that is not otherwise noticed in that test.
-
-igt@vgem_basic@unload
-igt@i915_module_load@reload
-igt@i915_pm_rpm@module-reload
-
-# Kernel selftests
-igt@i915_selftest@live
-igt@dmabuf@all
+igt@gem_gpgpu_fill
-- 
2.26.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [igt-dev] [PATCH i-g-t v5 7/8] tests/gem_gpgpu_fill: Remove libdrm dependency
  2020-05-19 18:16 ` [igt-dev] [PATCH i-g-t v5 7/8] tests/gem_gpgpu_fill: Remove libdrm dependency Zbigniew Kempczyński
@ 2020-05-19 18:39   ` Chris Wilson
  0 siblings, 0 replies; 12+ messages in thread
From: Chris Wilson @ 2020-05-19 18:39 UTC (permalink / raw)
  To: zbigniew.kempczynski, igt-dev

Quoting Zbigniew Kempczyński (2020-05-19 19:16:13)
> +static void no_libdrm(data_t *data, igt_fillfunc_v2_t fill)
> +{
> +       struct intel_buf *buf;
> +       uint8_t *ptr;
> +       int i, j;
> +
> +       buf = create_buf(data, WIDTH, HEIGHT, COLOR_C4);
> +       ptr = gem_mmap__cpu_coherent(data->drm_fd, buf->handle,
> +                                    0, buf->size, PROT_READ);

I see, still testing the theory that you don't need coherency. :-p
-Chris
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [igt-dev] [PATCH i-g-t v5 3/8] lib/intel_batchbuffer: Introduce intel_bb
  2020-05-19 18:16 ` [igt-dev] [PATCH i-g-t v5 3/8] lib/intel_batchbuffer: Introduce intel_bb Zbigniew Kempczyński
@ 2020-05-19 18:50   ` Chris Wilson
  0 siblings, 0 replies; 12+ messages in thread
From: Chris Wilson @ 2020-05-19 18:50 UTC (permalink / raw)
  To: zbigniew.kempczynski, igt-dev

Quoting Zbigniew Kempczyński (2020-05-19 19:16:09)
> +static void __reallocate_objects(struct intel_bb *ibb)
> +{
> +       uint32_t num;
> +
> +       if (ibb->num_objects == ibb->allocated_objects) {
> +               num = 4096 / sizeof(*ibb->objects);
> +               ibb->objects = realloc(ibb->objects,
> +                                      sizeof(*ibb->objects) * num);

sizeof(*ibb->objects) * (num + ibb->allocated_objects)

> +               igt_assert(ibb->objects);
> +               ibb->allocated_objects += num;
> +
> +               memset(&ibb->objects[ibb->num_objects], 0,
> +                      num * sizeof(*ibb->objects));
> +       }
> +}
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [igt-dev] ✗ Fi.CI.BAT: failure for Make gpgpu fill tests libdrm independent (rev5)
  2020-05-19 18:16 [igt-dev] [PATCH i-g-t v5 0/8] Make gpgpu fill tests libdrm independent Zbigniew Kempczyński
                   ` (7 preceding siblings ...)
  2020-05-19 18:16 ` [igt-dev] [PATCH i-g-t v5 8/8] HAX: run gpgpu_fill in BAT only Zbigniew Kempczyński
@ 2020-05-19 19:48 ` Patchwork
  8 siblings, 0 replies; 12+ messages in thread
From: Patchwork @ 2020-05-19 19:48 UTC (permalink / raw)
  To: Zbigniew Kempczyński; +Cc: igt-dev

== Series Details ==

Series: Make gpgpu fill tests libdrm independent (rev5)
URL   : https://patchwork.freedesktop.org/series/77175/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_8506 -> IGTPW_4592
====================================================

Summary
-------

  **FAILURE**

  Serious unknown changes coming with IGTPW_4592 absolutely need to be
  verified manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in IGTPW_4592, please notify your bug team to allow them
  to document this new failure mode, which will reduce false positives in CI.

  External URL: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4592/index.html

Possible new issues
-------------------

  Here are the unknown changes that may have been introduced in IGTPW_4592:

### IGT changes ###

#### Possible regressions ####

  * igt@gem_gpgpu_fill:
    - fi-byt-j1900:       NOTRUN -> [FAIL][1]
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4592/fi-byt-j1900/igt@gem_gpgpu_fill.html
    - fi-byt-n2820:       NOTRUN -> [FAIL][2]
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4592/fi-byt-n2820/igt@gem_gpgpu_fill.html

  


Participating hosts (49 -> 43)
------------------------------

  Additional (1): fi-kbl-7560u 
  Missing    (7): fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-hsw-4770 fi-byt-clapper fi-bdw-samus 


Build changes
-------------

  * CI: CI-20190529 -> None
  * IGT: IGT_5661 -> IGTPW_4592

  CI-20190529: 20190529
  CI_DRM_8506: d6a73e9084ff6adfabbad014bc294d254484f304 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_4592: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4592/index.html
  IGT_5661: a772a7c7a761c6125bc0af5284ad603478107737 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4592/index.html
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2020-05-19 19:48 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-19 18:16 [igt-dev] [PATCH i-g-t v5 0/8] Make gpgpu fill tests libdrm independent Zbigniew Kempczyński
2020-05-19 18:16 ` [igt-dev] [PATCH i-g-t v5 1/8] lib/intel_bufops: Add bufops reference and adapt stride requirement Zbigniew Kempczyński
2020-05-19 18:16 ` [igt-dev] [PATCH i-g-t v5 2/8] lib/rendercopy_bufmgr: Pass alignment during buffer initialization Zbigniew Kempczyński
2020-05-19 18:16 ` [igt-dev] [PATCH i-g-t v5 3/8] lib/intel_batchbuffer: Introduce intel_bb Zbigniew Kempczyński
2020-05-19 18:50   ` Chris Wilson
2020-05-19 18:16 ` [igt-dev] [PATCH i-g-t v5 4/8] lib/gpu_cmds: Add gpgpu pipeline functions based on intel_bb Zbigniew Kempczyński
2020-05-19 18:16 ` [igt-dev] [PATCH i-g-t v5 5/8] lib/gpgpu_fill: libdrm-free gpgpu pipeline creation Zbigniew Kempczyński
2020-05-19 18:16 ` [igt-dev] [PATCH i-g-t v5 6/8] lib/intel_batchbuffer: Introduce temporary igt_fillfunc_v2_t Zbigniew Kempczyński
2020-05-19 18:16 ` [igt-dev] [PATCH i-g-t v5 7/8] tests/gem_gpgpu_fill: Remove libdrm dependency Zbigniew Kempczyński
2020-05-19 18:39   ` Chris Wilson
2020-05-19 18:16 ` [igt-dev] [PATCH i-g-t v5 8/8] HAX: run gpgpu_fill in BAT only Zbigniew Kempczyński
2020-05-19 19:48 ` [igt-dev] ✗ Fi.CI.BAT: failure for Make gpgpu fill tests libdrm independent (rev5) Patchwork

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.