All of lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t 0/3] Add GEM_MMAP_OFFSET support in IGT.
@ 2019-11-25 10:09 Zbigniew Kempczyński
  2019-11-25 10:09 ` [igt-dev] [PATCH i-g-t 1/3] include/drm-uapi/i915_drm: Add local defs for mmap_offset Zbigniew Kempczyński
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Zbigniew Kempczyński @ 2019-11-25 10:09 UTC (permalink / raw)
  To: igt-dev

Enable GEM_MMAP_OFFSET uAPI.

Series comes from split 'LMEM enabling in IGT'.
Mmap_offset will land before memory region so add support for it.

Cc: Lukasz Kalamarz <lukasz.kalamarz@intel.com>
Cc: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Vanshidhar Konda <vanshidhar.r.konda@intel.com>

Lukasz Kalamarz (2):
  lib/i915/gem_mman: add mmap_offset support
  tests/i915/gem_mmap_offset: Add new API test for gem_mmap_offset

Zbigniew Kempczyński (1):
  include/drm-uapi/i915_drm: Add local defs for mmap_offset

 include/drm-uapi/i915_drm.h  |  33 ++++++
 lib/i915/gem_mman.c          | 223 +++++++++++++++++++++++++++++------
 lib/i915/gem_mman.h          |  16 ++-
 tests/Makefile.sources       |   3 +
 tests/i915/gem_mmap_offset.c | 127 ++++++++++++++++++++
 tests/meson.build            |   1 +
 6 files changed, 363 insertions(+), 40 deletions(-)
 create mode 100644 tests/i915/gem_mmap_offset.c

-- 
2.23.0

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

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

* [igt-dev] [PATCH i-g-t 1/3] include/drm-uapi/i915_drm: Add local defs for mmap_offset
  2019-11-25 10:09 [igt-dev] [PATCH i-g-t 0/3] Add GEM_MMAP_OFFSET support in IGT Zbigniew Kempczyński
@ 2019-11-25 10:09 ` Zbigniew Kempczyński
  2019-11-25 12:43   ` Petri Latvala
  2019-11-25 10:09 ` [igt-dev] [PATCH i-g-t 2/3] lib/i915/gem_mman: add mmap_offset support Zbigniew Kempczyński
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 9+ messages in thread
From: Zbigniew Kempczyński @ 2019-11-25 10:09 UTC (permalink / raw)
  To: igt-dev

Contains local definitions and structures for GEM_MMAP_OFFSET.
To be removed on upstream merge.

Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
---
 include/drm-uapi/i915_drm.h | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/include/drm-uapi/i915_drm.h b/include/drm-uapi/i915_drm.h
index ab899abb..154e07ce 100644
--- a/include/drm-uapi/i915_drm.h
+++ b/include/drm-uapi/i915_drm.h
@@ -2245,6 +2245,39 @@ struct drm_i915_query_perf_config {
 	__u8 data[];
 };
 
+/*
+ * Local structures and definitions to be removed on upstream merge
+ */
+struct local_i915_gem_mmap_offset {
+	/** Handle for the object being mapped. */
+	__u32 handle;
+	__u32 pad;
+	/**
+	 * Fake offset to use for subsequent mmap call
+	 *
+	 * This is a fixed-size type for 32/64 compatibility.
+	 */
+	__u64 offset;
+	/**
+	 * Flags for extended behaviour.
+	 *
+	 * It is mandatory that either one of the _WC/_WB flags
+	 * should be passed here.
+	 */
+	__u64 flags;
+
+#define LOCAL_I915_MMAP_OFFSET_GTT 0
+#define LOCAL_I915_MMAP_OFFSET_WC  1
+#define LOCAL_I915_MMAP_OFFSET_WB  2
+#define LOCAL_I915_MMAP_OFFSET_UC  3
+
+	__u64 extensions;
+};
+
+#define LOCAL_I915_GEM_MMAP_OFFSET       DRM_I915_GEM_MMAP_GTT
+#define LOCAL_IOCTL_I915_GEM_MMAP_OFFSET         DRM_IOWR(DRM_COMMAND_BASE + \
+	LOCAL_I915_GEM_MMAP_OFFSET, struct local_i915_gem_mmap_offset)
+
 #if defined(__cplusplus)
 }
 #endif
-- 
2.23.0

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

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

* [igt-dev] [PATCH i-g-t 2/3] lib/i915/gem_mman: add mmap_offset support
  2019-11-25 10:09 [igt-dev] [PATCH i-g-t 0/3] Add GEM_MMAP_OFFSET support in IGT Zbigniew Kempczyński
  2019-11-25 10:09 ` [igt-dev] [PATCH i-g-t 1/3] include/drm-uapi/i915_drm: Add local defs for mmap_offset Zbigniew Kempczyński
@ 2019-11-25 10:09 ` Zbigniew Kempczyński
  2019-11-25 10:09 ` [igt-dev] [PATCH i-g-t 3/3] tests/i915/gem_mmap_offset: Add new API test for gem_mmap_offset Zbigniew Kempczyński
  2019-11-25 11:33 ` [igt-dev] ✗ Fi.CI.BAT: failure for Add GEM_MMAP_OFFSET support in IGT Patchwork
  3 siblings, 0 replies; 9+ messages in thread
From: Zbigniew Kempczyński @ 2019-11-25 10:09 UTC (permalink / raw)
  To: igt-dev

From: Lukasz Kalamarz <lukasz.kalamarz@intel.com>

With introduction of LMEM concept new IOCTL call were implemented
- gem_mmap_offset. This patch add support in IGT for it.

Signed-off-by: Lukasz Kalamarz <lukasz.kalamarz@intel.com>
Signed-off-by: Antonio Argenziano <antonio.argenziano@intel.com>
Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Vanshidhar Konda <vanshidhar.r.konda@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 lib/i915/gem_mman.c | 223 ++++++++++++++++++++++++++++++++++++--------
 lib/i915/gem_mman.h |  16 +++-
 2 files changed, 199 insertions(+), 40 deletions(-)

diff --git a/lib/i915/gem_mman.c b/lib/i915/gem_mman.c
index 6256627b..fa860c61 100644
--- a/lib/i915/gem_mman.c
+++ b/lib/i915/gem_mman.c
@@ -40,6 +40,31 @@
 #define VG(x) do {} while (0)
 #endif
 
+static int gem_mmap_gtt_version(int fd)
+{
+	struct drm_i915_getparam gp;
+	int gtt_version = -1;
+
+	memset(&gp, 0, sizeof(gp));
+	gp.param = I915_PARAM_MMAP_GTT_VERSION;
+	gp.value = &gtt_version;
+	ioctl(fd, DRM_IOCTL_I915_GETPARAM, &gp);
+
+	return gtt_version;
+}
+
+static bool gem_has_mmap_offset(int fd)
+{
+	int gtt_version = gem_mmap_gtt_version(fd);
+
+	return gtt_version >= 4;
+}
+
+void gem_require_mmap_offset(int i915)
+{
+	igt_require(gem_has_mmap_offset(i915));
+}
+
 /**
  * __gem_mmap__gtt:
  * @fd: open i915 drm file descriptor
@@ -101,46 +126,60 @@ int gem_munmap(void *ptr, uint64_t size)
 	return ret;
 }
 
-bool gem_mmap__has_wc(int fd)
+bool __gem_mmap__has_wc(int fd)
 {
-	static int has_wc = -1;
-
-	if (has_wc == -1) {
-		struct drm_i915_getparam gp;
-		int mmap_version = -1;
-		int gtt_version = -1;
-
-		has_wc = 0;
-
-		memset(&gp, 0, sizeof(gp));
-		gp.param = I915_PARAM_MMAP_GTT_VERSION;
-		gp.value = &gtt_version;
-		ioctl(fd, DRM_IOCTL_I915_GETPARAM, &gp);
-
-		memset(&gp, 0, sizeof(gp));
-		gp.param = I915_PARAM_MMAP_VERSION;
-		gp.value = &mmap_version;
-		ioctl(fd, DRM_IOCTL_I915_GETPARAM, &gp);
-
-		/* Do we have the new mmap_ioctl with DOMAIN_WC? */
-		if (mmap_version >= 1 && gtt_version >= 2) {
-			struct drm_i915_gem_mmap arg;
-
-			/* Does this device support wc-mmaps ? */
-			memset(&arg, 0, sizeof(arg));
-			arg.handle = gem_create(fd, 4096);
-			arg.offset = 0;
-			arg.size = 4096;
-			arg.flags = I915_MMAP_WC;
-			has_wc = igt_ioctl(fd, DRM_IOCTL_I915_GEM_MMAP, &arg) == 0;
-			gem_close(fd, arg.handle);
-		}
-		errno = 0;
+	int has_wc = 0;
+
+	struct drm_i915_getparam gp;
+	int mmap_version = -1;
+
+	memset(&gp, 0, sizeof(gp));
+	gp.param = I915_PARAM_MMAP_VERSION;
+	gp.value = &mmap_version;
+	ioctl(fd, DRM_IOCTL_I915_GETPARAM, &gp);
+
+	/* Do we have the mmap_ioctl with DOMAIN_WC? */
+	if (mmap_version >= 1 && gem_mmap_gtt_version(fd) >= 2) {
+		struct drm_i915_gem_mmap arg;
+
+		/* Does this device support wc-mmaps ? */
+		memset(&arg, 0, sizeof(arg));
+		arg.handle = gem_create(fd, 4096);
+		arg.offset = 0;
+		arg.size = 4096;
+		arg.flags = I915_MMAP_WC;
+		has_wc = igt_ioctl(fd, DRM_IOCTL_I915_GEM_MMAP, &arg) == 0;
+		gem_close(fd, arg.handle);
 	}
+	errno = 0;
+
+	return has_wc > 0;
+}
+
+bool __gem_mmap_offset__has_wc(int fd)
+{
+	int has_wc = 0;
+	struct local_i915_gem_mmap_offset arg;
+
+	/* Does this device support wc-mmaps ? */
+	memset(&arg, 0, sizeof(arg));
+	arg.handle = gem_create(fd, 4096);
+	arg.offset = 0;
+	arg.flags = LOCAL_I915_MMAP_OFFSET_WC;
+	has_wc = igt_ioctl(fd, LOCAL_IOCTL_I915_GEM_MMAP_OFFSET,
+			   &arg) == 0;
+	gem_close(fd, arg.handle);
+
+	errno = 0;
 
 	return has_wc > 0;
 }
 
+bool gem_mmap__has_wc(int fd)
+{
+	return __gem_mmap_offset__has_wc(fd) || __gem_mmap__has_wc(fd);
+}
+
 /**
  * __gem_mmap:
  * @fd: open i915 drm file descriptor
@@ -157,11 +196,13 @@ bool gem_mmap__has_wc(int fd)
  *
  * Returns: A pointer to the created memory mapping, NULL on failure.
  */
-static void
-*__gem_mmap(int fd, uint32_t handle, uint64_t offset, uint64_t size, unsigned int prot, uint64_t flags)
+void *__gem_mmap(int fd, uint32_t handle, uint64_t offset, uint64_t size,
+		 unsigned int prot, uint64_t flags)
 {
 	struct drm_i915_gem_mmap arg;
 
+	igt_assert(offset == 0);
+
 	memset(&arg, 0, sizeof(arg));
 	arg.handle = handle;
 	arg.offset = offset;
@@ -177,6 +218,47 @@ static void
 	return from_user_pointer(arg.addr_ptr);
 }
 
+/**
+ * __gem_mmap_offset:
+ * @fd: open i915 drm file descriptor
+ * @handle: gem buffer object handle
+ * @offset: offset in the gem buffer of the mmap arena
+ * @size: size of the mmap arena
+ * @prot: memory protection bits as used by mmap()
+ * @flags: flags used to determine caching
+ *
+ * Mmap the gem buffer memory on offset returned in GEM_MMAP_OFFSET ioctl.
+ * Offset argument passed in function call must be 0. In the future
+ * when driver will allow slice mapping of buffer object this restriction
+ * will be removed.
+ *
+ * Returns: A pointer to the created memory mapping, NULL on failure.
+ */
+void *__gem_mmap_offset(int fd, uint32_t handle, uint64_t offset, uint64_t size,
+			unsigned int prot, uint64_t flags)
+{
+	struct local_i915_gem_mmap_offset arg;
+	void *ptr;
+
+	igt_assert(offset == 0);
+
+	memset(&arg, 0, sizeof(arg));
+	arg.handle = handle;
+	arg.flags = flags;
+
+	if (igt_ioctl(fd, LOCAL_IOCTL_I915_GEM_MMAP_OFFSET, &arg))
+		return NULL;
+
+	ptr = mmap64(0, size, prot, MAP_SHARED, fd, arg.offset + offset);
+
+	if (ptr == MAP_FAILED)
+		ptr = NULL;
+	else
+		errno = 0;
+
+	return ptr;
+}
+
 /**
  * __gem_mmap__wc:
  * @fd: open i915 drm file descriptor
@@ -194,7 +276,12 @@ static void
  */
 void *__gem_mmap__wc(int fd, uint32_t handle, uint64_t offset, uint64_t size, unsigned prot)
 {
-	return __gem_mmap(fd, handle, offset, size, prot, I915_MMAP_WC);
+	void *ptr = __gem_mmap_offset(fd, handle, offset, size, prot,
+				      LOCAL_I915_MMAP_OFFSET_WC);
+	if (!ptr)
+		ptr = __gem_mmap(fd, handle, offset, size, prot, I915_MMAP_WC);
+
+	return ptr;
 }
 
 /**
@@ -205,17 +292,71 @@ void *__gem_mmap__wc(int fd, uint32_t handle, uint64_t offset, uint64_t size, un
  * @size: size of the mmap arena
  * @prot: memory protection bits as used by mmap()
  *
- * Like __gem_mmap__wc() except we assert on failure.
+ * Try to __gem_mmap__wc(). Assert on failure.
  *
  * Returns: A pointer to the created memory mapping
  */
 void *gem_mmap__wc(int fd, uint32_t handle, uint64_t offset, uint64_t size, unsigned prot)
 {
 	void *ptr = __gem_mmap__wc(fd, handle, offset, size, prot);
+
 	igt_assert(ptr);
 	return ptr;
 }
 
+/**
+ * __gem_mmap__device_coherent:
+ * @fd: open i915 drm file descriptor
+ * @handle: gem buffer object handle
+ * @offset: offset in the gem buffer of the mmap arena
+ * @size: size of the mmap arena
+ * @prot: memory protection bits as used by mmap()
+ *
+ * Returns: A pointer to a block of linear device memory mapped into the
+ * process with WC semantics. When no WC is available try to mmap using GGTT.
+ */
+void *__gem_mmap__device_coherent(int fd, uint32_t handle, uint64_t offset,
+				  uint64_t size, unsigned prot)
+{
+	void *ptr = __gem_mmap_offset(fd, handle, offset, size, prot,
+				      LOCAL_I915_MMAP_OFFSET_WC);
+	if (!ptr)
+		ptr = __gem_mmap__wc(fd, handle, offset, size, prot);
+
+	if (!ptr)
+		ptr = __gem_mmap__gtt(fd, handle, size, prot);
+
+	return ptr;
+}
+
+/**
+ * gem_mmap__device_coherent:
+ * @fd: open i915 drm file descriptor
+ * @handle: gem buffer object handle
+ * @offset: offset in the gem buffer of the mmap arena
+ * @size: size of the mmap arena
+ * @prot: memory protection bits as used by mmap()
+ *
+ * Call __gem_mmap__device__coherent(), asserts on fail.
+ * Offset argument passed in function call must be 0. In the future
+ * when driver will allow slice mapping of buffer object this restriction
+ * will be removed.
+ *
+ * Returns: A pointer to the created memory mapping.
+ */
+void *gem_mmap__device_coherent(int fd, uint32_t handle, uint64_t offset,
+				uint64_t size, unsigned prot)
+{
+	void *ptr;
+
+	igt_assert(offset == 0);
+
+	ptr = gem_mmap__device_coherent(fd, handle, offset, size, prot);
+	igt_assert(ptr);
+
+	return ptr;
+}
+
 /**
  * __gem_mmap__cpu:
  * @fd: open i915 drm file descriptor
@@ -248,7 +389,11 @@ void *__gem_mmap__cpu(int fd, uint32_t handle, uint64_t offset, uint64_t size, u
  */
 void *gem_mmap__cpu(int fd, uint32_t handle, uint64_t offset, uint64_t size, unsigned prot)
 {
-	void *ptr = __gem_mmap__cpu(fd, handle, offset, size, prot);
+	void *ptr = __gem_mmap_offset(fd, handle, offset, size, prot,
+				      LOCAL_I915_MMAP_OFFSET_WB);
+	if (!ptr)
+		ptr = __gem_mmap__cpu(fd, handle, offset, size, prot);
+
 	igt_assert(ptr);
 	return ptr;
 }
diff --git a/lib/i915/gem_mman.h b/lib/i915/gem_mman.h
index 096ff592..ea304dbf 100644
--- a/lib/i915/gem_mman.h
+++ b/lib/i915/gem_mman.h
@@ -25,12 +25,20 @@
 #ifndef GEM_MMAN_H
 #define GEM_MMAN_H
 
+#include <stdint.h>
+
+void gem_require_mmap_offset(int i915);
+bool gem_mmap_has_gtt(int fd);
+
 void *gem_mmap__gtt(int fd, uint32_t handle, uint64_t size, unsigned prot);
 void *gem_mmap__cpu(int fd, uint32_t handle, uint64_t offset, uint64_t size, unsigned prot);
 
+bool __gem_mmap__has_wc(int fd);
+bool __gem_mmap_offset__has_wc(int fd);
 bool gem_mmap__has_wc(int fd);
 void *gem_mmap__wc(int fd, uint32_t handle, uint64_t offset, uint64_t size, unsigned prot);
-
+void *gem_mmap__device_coherent(int fd, uint32_t handle, uint64_t offset,
+				uint64_t size, unsigned prot);
 #ifndef I915_GEM_DOMAIN_WC
 #define I915_GEM_DOMAIN_WC 0x80
 #endif
@@ -38,9 +46,15 @@ void *gem_mmap__wc(int fd, uint32_t handle, uint64_t offset, uint64_t size, unsi
 bool gem_has_mappable_ggtt(int i915);
 void gem_require_mappable_ggtt(int i915);
 
+void *__gem_mmap(int fd, uint32_t handle, uint64_t offset, uint64_t size,
+		 unsigned int prot, uint64_t flags);
+void *__gem_mmap_offset(int fd, uint32_t handle, uint64_t offset, uint64_t size,
+			unsigned int prot, uint64_t flags);
 void *__gem_mmap__gtt(int fd, uint32_t handle, uint64_t size, unsigned prot);
 void *__gem_mmap__cpu(int fd, uint32_t handle, uint64_t offset, uint64_t size, unsigned prot);
 void *__gem_mmap__wc(int fd, uint32_t handle, uint64_t offset, uint64_t size, unsigned prot);
+void *__gem_mmap__device_coherent(int fd, uint32_t handle, uint64_t offset,
+				  uint64_t size, unsigned prot);
 
 int gem_munmap(void *ptr, uint64_t size);
 
-- 
2.23.0

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

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

* [igt-dev] [PATCH i-g-t 3/3] tests/i915/gem_mmap_offset: Add new API test for gem_mmap_offset
  2019-11-25 10:09 [igt-dev] [PATCH i-g-t 0/3] Add GEM_MMAP_OFFSET support in IGT Zbigniew Kempczyński
  2019-11-25 10:09 ` [igt-dev] [PATCH i-g-t 1/3] include/drm-uapi/i915_drm: Add local defs for mmap_offset Zbigniew Kempczyński
  2019-11-25 10:09 ` [igt-dev] [PATCH i-g-t 2/3] lib/i915/gem_mman: add mmap_offset support Zbigniew Kempczyński
@ 2019-11-25 10:09 ` Zbigniew Kempczyński
  2019-11-25 10:23   ` Chris Wilson
  2019-11-25 11:33 ` [igt-dev] ✗ Fi.CI.BAT: failure for Add GEM_MMAP_OFFSET support in IGT Patchwork
  3 siblings, 1 reply; 9+ messages in thread
From: Zbigniew Kempczyński @ 2019-11-25 10:09 UTC (permalink / raw)
  To: igt-dev

From: Lukasz Kalamarz <lukasz.kalamarz@intel.com>

Few simple tests which tries to create / mmap buffer objects
using GEM_MMAP_OFFSET uAPI.

Signed-off-by: Lukasz Kalamarz <lukasz.kalamarz@intel.com>
Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Vanshidhar Konda <vanshidhar.r.konda@intel.com>
---
 tests/Makefile.sources       |   3 +
 tests/i915/gem_mmap_offset.c | 127 +++++++++++++++++++++++++++++++++++
 tests/meson.build            |   1 +
 3 files changed, 131 insertions(+)
 create mode 100644 tests/i915/gem_mmap_offset.c

diff --git a/tests/Makefile.sources b/tests/Makefile.sources
index 27801c89..9c6c3933 100644
--- a/tests/Makefile.sources
+++ b/tests/Makefile.sources
@@ -320,6 +320,9 @@ gem_mmap_SOURCES = i915/gem_mmap.c
 TESTS_progs += gem_mmap_gtt
 gem_mmap_gtt_SOURCES = i915/gem_mmap_gtt.c
 
+TESTS_progs += gem_mmap_offset
+gem_mmap_offset_SOURCES = i915/gem_mmap_offset.c
+
 TESTS_progs += gem_mmap_offset_exhaustion
 gem_mmap_offset_exhaustion_SOURCES = i915/gem_mmap_offset_exhaustion.c
 
diff --git a/tests/i915/gem_mmap_offset.c b/tests/i915/gem_mmap_offset.c
new file mode 100644
index 00000000..44dca831
--- /dev/null
+++ b/tests/i915/gem_mmap_offset.c
@@ -0,0 +1,127 @@
+/*
+ * Copyright © 2019 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.
+ */
+
+#include "igt.h"
+#include <errno.h>
+#include <sys/stat.h>
+#include <sys/ioctl.h>
+#include "drm.h"
+
+IGT_TEST_DESCRIPTION("Basic MMAP_OFFSET IOCTL tests for mem regions\n");
+
+static int mmap_offset_ioctl(int fd, struct local_i915_gem_mmap_offset *arg)
+{
+	int err = 0;
+
+	if (igt_ioctl(fd, LOCAL_IOCTL_I915_GEM_MMAP_OFFSET, arg))
+		err = -errno;
+
+	errno = 0;
+	return err;
+}
+
+static void mmap_offset_bad_object(int fd)
+{
+	uint32_t real_handle;
+	uint32_t handles[20];
+	int i = 0;
+
+	real_handle = gem_create(fd, 4096);
+
+	handles[i++] = 0xdeadbeef;
+	for (int bit = 0; bit < 16; bit++)
+		handles[i++] = real_handle | (1 << (bit + 16));
+	handles[i] = real_handle + 1;
+
+	for (; i >= 0; i--) {
+		struct local_i915_gem_mmap_offset arg = {
+			.handle = handles[i],
+			.flags = LOCAL_I915_MMAP_OFFSET_WC,
+		};
+
+		igt_debug("Trying MMAP IOCTL with handle %x\n",
+			  handles[i]);
+		igt_assert_eq(mmap_offset_ioctl(fd, &arg),
+			      -ENOENT);
+	}
+
+	gem_close(fd, real_handle);
+}
+
+static void mmap_offset_basic(int fd)
+{
+	uint64_t flags;
+	uint32_t handle, obj_size;
+	uint8_t *expected, *buf, *addr;
+
+	obj_size = 4096;
+	handle = gem_create(fd, obj_size);
+	flags = LOCAL_I915_MMAP_OFFSET_WC;
+	addr = __gem_mmap_offset(fd, handle, 0, obj_size,
+				 PROT_READ | PROT_WRITE,
+				 flags);
+	igt_assert(addr);
+
+	igt_debug("Testing contents of newly created object.\n");
+	expected = calloc(obj_size, sizeof(*expected));
+	igt_assert_eq(memcmp(addr, expected, obj_size), 0);
+	free(expected);
+
+	igt_debug("Testing coherency of writes and mmap reads.\n");
+	buf = calloc(obj_size, sizeof(*buf));
+	memset(buf + 1024, 0x01, 1024);
+	gem_write(fd, handle, 0, buf, obj_size);
+	igt_assert_eq(memcmp(buf, addr, obj_size), 0);
+
+	igt_debug("Testing that mapping stays after close\n");
+	gem_close(fd, handle);
+	igt_assert_eq(memcmp(buf, addr, obj_size), 0);
+	free(buf);
+
+	igt_debug("Testing unmapping\n");
+	munmap(addr, obj_size);
+}
+
+igt_main
+{
+	int fd;
+
+	igt_fixture {
+		fd = drm_open_driver(DRIVER_INTEL);
+		gem_require_mmap_offset(fd);
+		igt_require(gem_mmap__has_wc(fd));
+	}
+
+	igt_describe("Verify mapping to invalid gem objects won't be created");
+	igt_subtest_f("mmap-offset-bad-object")
+			mmap_offset_bad_object(fd);
+
+	igt_describe("Check buffer object mapping is coherent with "
+		     "data written by gem_write");
+	igt_subtest_f("mmap-offset-basic")
+			mmap_offset_basic(fd);
+
+	igt_fixture {
+		close(fd);
+	}
+}
diff --git a/tests/meson.build b/tests/meson.build
index 755fc9e6..644b5504 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -174,6 +174,7 @@ i915_progs = [
 	'gem_media_vme',
 	'gem_mmap',
 	'gem_mmap_gtt',
+	'gem_mmap_offset',
 	'gem_mmap_offset_exhaustion',
 	'gem_mmap_wc',
 	'gem_partial_pwrite_pread',
-- 
2.23.0

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

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

* Re: [igt-dev] [PATCH i-g-t 3/3] tests/i915/gem_mmap_offset: Add new API test for gem_mmap_offset
  2019-11-25 10:09 ` [igt-dev] [PATCH i-g-t 3/3] tests/i915/gem_mmap_offset: Add new API test for gem_mmap_offset Zbigniew Kempczyński
@ 2019-11-25 10:23   ` Chris Wilson
  2019-11-25 17:32     ` Vanshidhar Konda
  0 siblings, 1 reply; 9+ messages in thread
From: Chris Wilson @ 2019-11-25 10:23 UTC (permalink / raw)
  To: Zbigniew Kempczyński, igt-dev

Quoting Zbigniew Kempczyński (2019-11-25 10:09:57)
> From: Lukasz Kalamarz <lukasz.kalamarz@intel.com>
> 
> Few simple tests which tries to create / mmap buffer objects
> using GEM_MMAP_OFFSET uAPI.
> 
> Signed-off-by: Lukasz Kalamarz <lukasz.kalamarz@intel.com>
> Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Vanshidhar Konda <vanshidhar.r.konda@intel.com>
> ---
>  tests/Makefile.sources       |   3 +
>  tests/i915/gem_mmap_offset.c | 127 +++++++++++++++++++++++++++++++++++
>  tests/meson.build            |   1 +
>  3 files changed, 131 insertions(+)
>  create mode 100644 tests/i915/gem_mmap_offset.c
> 
> diff --git a/tests/Makefile.sources b/tests/Makefile.sources
> index 27801c89..9c6c3933 100644
> --- a/tests/Makefile.sources
> +++ b/tests/Makefile.sources
> @@ -320,6 +320,9 @@ gem_mmap_SOURCES = i915/gem_mmap.c
>  TESTS_progs += gem_mmap_gtt
>  gem_mmap_gtt_SOURCES = i915/gem_mmap_gtt.c
>  
> +TESTS_progs += gem_mmap_offset
> +gem_mmap_offset_SOURCES = i915/gem_mmap_offset.c
> +
>  TESTS_progs += gem_mmap_offset_exhaustion
>  gem_mmap_offset_exhaustion_SOURCES = i915/gem_mmap_offset_exhaustion.c
>  
> diff --git a/tests/i915/gem_mmap_offset.c b/tests/i915/gem_mmap_offset.c
> new file mode 100644
> index 00000000..44dca831
> --- /dev/null
> +++ b/tests/i915/gem_mmap_offset.c
> @@ -0,0 +1,127 @@
> +/*
> + * Copyright © 2019 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.
> + */
> +
> +#include "igt.h"
> +#include <errno.h>
> +#include <sys/stat.h>
> +#include <sys/ioctl.h>
> +#include "drm.h"
> +
> +IGT_TEST_DESCRIPTION("Basic MMAP_OFFSET IOCTL tests for mem regions\n");
> +
> +static int mmap_offset_ioctl(int fd, struct local_i915_gem_mmap_offset *arg)
> +{
> +       int err = 0;
> +
> +       if (igt_ioctl(fd, LOCAL_IOCTL_I915_GEM_MMAP_OFFSET, arg))
> +               err = -errno;
> +
> +       errno = 0;
> +       return err;
> +}
> +
> +static void mmap_offset_bad_object(int fd)
> +{
> +       uint32_t real_handle;
> +       uint32_t handles[20];
> +       int i = 0;
> +
> +       real_handle = gem_create(fd, 4096);
> +
> +       handles[i++] = 0xdeadbeef;
> +       for (int bit = 0; bit < 16; bit++)
> +               handles[i++] = real_handle | (1 << (bit + 16));
> +       handles[i] = real_handle + 1;
> +
> +       for (; i >= 0; i--) {
> +               struct local_i915_gem_mmap_offset arg = {
> +                       .handle = handles[i],
> +                       .flags = LOCAL_I915_MMAP_OFFSET_WC,

Hmm, WC isn't guaranteed on all platforms, neither is GTT, nor may be
WB, nor UC.

That's quite a conundrum. I would actually say use OFFSET_WB for basic
API correctness checks as that covers all platforms we have today, and
we'll cross that bridge when we come to it.
-Chris
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* [igt-dev] ✗ Fi.CI.BAT: failure for Add GEM_MMAP_OFFSET support in IGT.
  2019-11-25 10:09 [igt-dev] [PATCH i-g-t 0/3] Add GEM_MMAP_OFFSET support in IGT Zbigniew Kempczyński
                   ` (2 preceding siblings ...)
  2019-11-25 10:09 ` [igt-dev] [PATCH i-g-t 3/3] tests/i915/gem_mmap_offset: Add new API test for gem_mmap_offset Zbigniew Kempczyński
@ 2019-11-25 11:33 ` Patchwork
  3 siblings, 0 replies; 9+ messages in thread
From: Patchwork @ 2019-11-25 11:33 UTC (permalink / raw)
  To: Zbigniew Kempczyński; +Cc: igt-dev

== Series Details ==

Series: Add GEM_MMAP_OFFSET support in IGT.
URL   : https://patchwork.freedesktop.org/series/69973/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_7416 -> IGTPW_3752
====================================================

Summary
-------

  **FAILURE**

  Serious unknown changes coming with IGTPW_3752 absolutely need to be
  verified manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in IGTPW_3752, 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_3752/index.html

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

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

### IGT changes ###

#### Possible regressions ####

  * igt@gem_exec_gttfill@basic:
    - fi-bsw-kefka:       [PASS][1] -> [TIMEOUT][2]
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7416/fi-bsw-kefka/igt@gem_exec_gttfill@basic.html
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3752/fi-bsw-kefka/igt@gem_exec_gttfill@basic.html
    - fi-hsw-4770:        [PASS][3] -> [DMESG-FAIL][4]
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7416/fi-hsw-4770/igt@gem_exec_gttfill@basic.html
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3752/fi-hsw-4770/igt@gem_exec_gttfill@basic.html
    - fi-apl-guc:         [PASS][5] -> [TIMEOUT][6]
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7416/fi-apl-guc/igt@gem_exec_gttfill@basic.html
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3752/fi-apl-guc/igt@gem_exec_gttfill@basic.html
    - fi-byt-n2820:       [PASS][7] -> [TIMEOUT][8]
   [7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7416/fi-byt-n2820/igt@gem_exec_gttfill@basic.html
   [8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3752/fi-byt-n2820/igt@gem_exec_gttfill@basic.html
    - fi-hsw-4770r:       [PASS][9] -> [DMESG-FAIL][10]
   [9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7416/fi-hsw-4770r/igt@gem_exec_gttfill@basic.html
   [10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3752/fi-hsw-4770r/igt@gem_exec_gttfill@basic.html
    - fi-ilk-650:         [PASS][11] -> [DMESG-FAIL][12]
   [11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7416/fi-ilk-650/igt@gem_exec_gttfill@basic.html
   [12]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3752/fi-ilk-650/igt@gem_exec_gttfill@basic.html

  * igt@gem_mmap_gtt@basic-small-bo-tiledx:
    - fi-blb-e6850:       [PASS][13] -> [FAIL][14] +1 similar issue
   [13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7416/fi-blb-e6850/igt@gem_mmap_gtt@basic-small-bo-tiledx.html
   [14]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3752/fi-blb-e6850/igt@gem_mmap_gtt@basic-small-bo-tiledx.html
    - fi-snb-2520m:       [PASS][15] -> [FAIL][16] +1 similar issue
   [15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7416/fi-snb-2520m/igt@gem_mmap_gtt@basic-small-bo-tiledx.html
   [16]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3752/fi-snb-2520m/igt@gem_mmap_gtt@basic-small-bo-tiledx.html

  * igt@gem_mmap_gtt@basic-small-bo-tiledy:
    - fi-bwr-2160:        [PASS][17] -> [FAIL][18] +1 similar issue
   [17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7416/fi-bwr-2160/igt@gem_mmap_gtt@basic-small-bo-tiledy.html
   [18]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3752/fi-bwr-2160/igt@gem_mmap_gtt@basic-small-bo-tiledy.html
    - fi-kbl-guc:         [PASS][19] -> [FAIL][20]
   [19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7416/fi-kbl-guc/igt@gem_mmap_gtt@basic-small-bo-tiledy.html
   [20]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3752/fi-kbl-guc/igt@gem_mmap_gtt@basic-small-bo-tiledy.html
    - fi-bsw-nick:        [PASS][21] -> [FAIL][22]
   [21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7416/fi-bsw-nick/igt@gem_mmap_gtt@basic-small-bo-tiledy.html
   [22]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3752/fi-bsw-nick/igt@gem_mmap_gtt@basic-small-bo-tiledy.html
    - fi-kbl-r:           [PASS][23] -> [FAIL][24]
   [23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7416/fi-kbl-r/igt@gem_mmap_gtt@basic-small-bo-tiledy.html
   [24]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3752/fi-kbl-r/igt@gem_mmap_gtt@basic-small-bo-tiledy.html
    - fi-kbl-soraka:      [PASS][25] -> [FAIL][26]
   [25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7416/fi-kbl-soraka/igt@gem_mmap_gtt@basic-small-bo-tiledy.html
   [26]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3752/fi-kbl-soraka/igt@gem_mmap_gtt@basic-small-bo-tiledy.html
    - fi-icl-u3:          [PASS][27] -> [FAIL][28]
   [27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7416/fi-icl-u3/igt@gem_mmap_gtt@basic-small-bo-tiledy.html
   [28]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3752/fi-icl-u3/igt@gem_mmap_gtt@basic-small-bo-tiledy.html
    - fi-skl-6770hq:      [PASS][29] -> [FAIL][30]
   [29]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7416/fi-skl-6770hq/igt@gem_mmap_gtt@basic-small-bo-tiledy.html
   [30]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3752/fi-skl-6770hq/igt@gem_mmap_gtt@basic-small-bo-tiledy.html
    - fi-snb-2600:        [PASS][31] -> [FAIL][32] +1 similar issue
   [31]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7416/fi-snb-2600/igt@gem_mmap_gtt@basic-small-bo-tiledy.html
   [32]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3752/fi-snb-2600/igt@gem_mmap_gtt@basic-small-bo-tiledy.html
    - fi-cfl-guc:         [PASS][33] -> [FAIL][34]
   [33]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7416/fi-cfl-guc/igt@gem_mmap_gtt@basic-small-bo-tiledy.html
   [34]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3752/fi-cfl-guc/igt@gem_mmap_gtt@basic-small-bo-tiledy.html
    - fi-skl-lmem:        [PASS][35] -> [FAIL][36]
   [35]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7416/fi-skl-lmem/igt@gem_mmap_gtt@basic-small-bo-tiledy.html
   [36]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3752/fi-skl-lmem/igt@gem_mmap_gtt@basic-small-bo-tiledy.html
    - fi-byt-j1900:       [PASS][37] -> [FAIL][38]
   [37]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7416/fi-byt-j1900/igt@gem_mmap_gtt@basic-small-bo-tiledy.html
   [38]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3752/fi-byt-j1900/igt@gem_mmap_gtt@basic-small-bo-tiledy.html
    - fi-skl-6700k2:      [PASS][39] -> [FAIL][40]
   [39]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7416/fi-skl-6700k2/igt@gem_mmap_gtt@basic-small-bo-tiledy.html
   [40]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3752/fi-skl-6700k2/igt@gem_mmap_gtt@basic-small-bo-tiledy.html
    - fi-cfl-8700k:       [PASS][41] -> [FAIL][42]
   [41]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7416/fi-cfl-8700k/igt@gem_mmap_gtt@basic-small-bo-tiledy.html
   [42]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3752/fi-cfl-8700k/igt@gem_mmap_gtt@basic-small-bo-tiledy.html
    - fi-icl-dsi:         [PASS][43] -> [FAIL][44]
   [43]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7416/fi-icl-dsi/igt@gem_mmap_gtt@basic-small-bo-tiledy.html
   [44]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3752/fi-icl-dsi/igt@gem_mmap_gtt@basic-small-bo-tiledy.html
    - fi-bdw-5557u:       [PASS][45] -> [FAIL][46]
   [45]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7416/fi-bdw-5557u/igt@gem_mmap_gtt@basic-small-bo-tiledy.html
   [46]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3752/fi-bdw-5557u/igt@gem_mmap_gtt@basic-small-bo-tiledy.html
    - fi-pnv-d510:        [PASS][47] -> [FAIL][48]
   [47]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7416/fi-pnv-d510/igt@gem_mmap_gtt@basic-small-bo-tiledy.html
   [48]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3752/fi-pnv-d510/igt@gem_mmap_gtt@basic-small-bo-tiledy.html
    - fi-skl-6600u:       [PASS][49] -> [FAIL][50]
   [49]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7416/fi-skl-6600u/igt@gem_mmap_gtt@basic-small-bo-tiledy.html
   [50]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3752/fi-skl-6600u/igt@gem_mmap_gtt@basic-small-bo-tiledy.html
    - fi-skl-guc:         NOTRUN -> [FAIL][51]
   [51]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3752/fi-skl-guc/igt@gem_mmap_gtt@basic-small-bo-tiledy.html
    - fi-icl-y:           [PASS][52] -> [FAIL][53]
   [52]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7416/fi-icl-y/igt@gem_mmap_gtt@basic-small-bo-tiledy.html
   [53]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3752/fi-icl-y/igt@gem_mmap_gtt@basic-small-bo-tiledy.html
    - fi-kbl-7500u:       [PASS][54] -> [FAIL][55]
   [54]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7416/fi-kbl-7500u/igt@gem_mmap_gtt@basic-small-bo-tiledy.html
   [55]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3752/fi-kbl-7500u/igt@gem_mmap_gtt@basic-small-bo-tiledy.html
    - fi-hsw-peppy:       [PASS][56] -> [FAIL][57]
   [56]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7416/fi-hsw-peppy/igt@gem_mmap_gtt@basic-small-bo-tiledy.html
   [57]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3752/fi-hsw-peppy/igt@gem_mmap_gtt@basic-small-bo-tiledy.html
    - fi-kbl-8809g:       [PASS][58] -> [FAIL][59]
   [58]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7416/fi-kbl-8809g/igt@gem_mmap_gtt@basic-small-bo-tiledy.html
   [59]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3752/fi-kbl-8809g/igt@gem_mmap_gtt@basic-small-bo-tiledy.html
    - fi-glk-dsi:         [PASS][60] -> [FAIL][61]
   [60]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7416/fi-glk-dsi/igt@gem_mmap_gtt@basic-small-bo-tiledy.html
   [61]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3752/fi-glk-dsi/igt@gem_mmap_gtt@basic-small-bo-tiledy.html
    - fi-kbl-x1275:       [PASS][62] -> [FAIL][63]
   [62]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7416/fi-kbl-x1275/igt@gem_mmap_gtt@basic-small-bo-tiledy.html
   [63]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3752/fi-kbl-x1275/igt@gem_mmap_gtt@basic-small-bo-tiledy.html
    - fi-bsw-n3050:       [PASS][64] -> [FAIL][65]
   [64]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7416/fi-bsw-n3050/igt@gem_mmap_gtt@basic-small-bo-tiledy.html
   [65]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3752/fi-bsw-n3050/igt@gem_mmap_gtt@basic-small-bo-tiledy.html
    - fi-ivb-3770:        [PASS][66] -> [FAIL][67]
   [66]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7416/fi-ivb-3770/igt@gem_mmap_gtt@basic-small-bo-tiledy.html
   [67]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3752/fi-ivb-3770/igt@gem_mmap_gtt@basic-small-bo-tiledy.html
    - fi-cml-u2:          [PASS][68] -> [FAIL][69]
   [68]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7416/fi-cml-u2/igt@gem_mmap_gtt@basic-small-bo-tiledy.html
   [69]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3752/fi-cml-u2/igt@gem_mmap_gtt@basic-small-bo-tiledy.html
    - fi-icl-u2:          [PASS][70] -> [FAIL][71]
   [70]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7416/fi-icl-u2/igt@gem_mmap_gtt@basic-small-bo-tiledy.html
   [71]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3752/fi-icl-u2/igt@gem_mmap_gtt@basic-small-bo-tiledy.html
    - fi-bxt-dsi:         [PASS][72] -> [FAIL][73]
   [72]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7416/fi-bxt-dsi/igt@gem_mmap_gtt@basic-small-bo-tiledy.html
   [73]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3752/fi-bxt-dsi/igt@gem_mmap_gtt@basic-small-bo-tiledy.html
    - fi-whl-u:           [PASS][74] -> [FAIL][75]
   [74]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7416/fi-whl-u/igt@gem_mmap_gtt@basic-small-bo-tiledy.html
   [75]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3752/fi-whl-u/igt@gem_mmap_gtt@basic-small-bo-tiledy.html

  * igt@gem_workarounds@basic-read:
    - fi-icl-dsi:         [PASS][76] -> [TIMEOUT][77]
   [76]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7416/fi-icl-dsi/igt@gem_workarounds@basic-read.html
   [77]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3752/fi-icl-dsi/igt@gem_workarounds@basic-read.html
    - fi-cml-u2:          [PASS][78] -> [TIMEOUT][79]
   [78]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7416/fi-cml-u2/igt@gem_workarounds@basic-read.html
   [79]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3752/fi-cml-u2/igt@gem_workarounds@basic-read.html
    - fi-icl-y:           [PASS][80] -> [TIMEOUT][81]
   [80]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7416/fi-icl-y/igt@gem_workarounds@basic-read.html
   [81]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3752/fi-icl-y/igt@gem_workarounds@basic-read.html
    - fi-icl-u3:          [PASS][82] -> [TIMEOUT][83]
   [82]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7416/fi-icl-u3/igt@gem_workarounds@basic-read.html
   [83]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3752/fi-icl-u3/igt@gem_workarounds@basic-read.html
    - fi-glk-dsi:         [PASS][84] -> [CRASH][85] +1 similar issue
   [84]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7416/fi-glk-dsi/igt@gem_workarounds@basic-read.html
   [85]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3752/fi-glk-dsi/igt@gem_workarounds@basic-read.html
    - fi-icl-u2:          [PASS][86] -> [TIMEOUT][87]
   [86]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7416/fi-icl-u2/igt@gem_workarounds@basic-read.html
   [87]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3752/fi-icl-u2/igt@gem_workarounds@basic-read.html
    - fi-bsw-nick:        [PASS][88] -> [CRASH][89]
   [88]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7416/fi-bsw-nick/igt@gem_workarounds@basic-read.html
   [89]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3752/fi-bsw-nick/igt@gem_workarounds@basic-read.html
    - fi-bdw-5557u:       [PASS][90] -> [TIMEOUT][91]
   [90]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7416/fi-bdw-5557u/igt@gem_workarounds@basic-read.html
   [91]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3752/fi-bdw-5557u/igt@gem_workarounds@basic-read.html

  * igt@i915_selftest@live_workarounds:
    - fi-skl-guc:         NOTRUN -> [TIMEOUT][92]
   [92]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3752/fi-skl-guc/igt@i915_selftest@live_workarounds.html

  * igt@kms_frontbuffer_tracking@basic:
    - fi-icl-u3:          [PASS][93] -> [CRASH][94]
   [93]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7416/fi-icl-u3/igt@kms_frontbuffer_tracking@basic.html
   [94]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3752/fi-icl-u3/igt@kms_frontbuffer_tracking@basic.html
    - fi-bsw-n3050:       [PASS][95] -> [CRASH][96] +1 similar issue
   [95]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7416/fi-bsw-n3050/igt@kms_frontbuffer_tracking@basic.html
   [96]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3752/fi-bsw-n3050/igt@kms_frontbuffer_tracking@basic.html
    - fi-kbl-soraka:      [PASS][97] -> [CRASH][98]
   [97]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7416/fi-kbl-soraka/igt@kms_frontbuffer_tracking@basic.html
   [98]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3752/fi-kbl-soraka/igt@kms_frontbuffer_tracking@basic.html
    - fi-bxt-dsi:         [PASS][99] -> [CRASH][100] +1 similar issue
   [99]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7416/fi-bxt-dsi/igt@kms_frontbuffer_tracking@basic.html
   [100]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3752/fi-bxt-dsi/igt@kms_frontbuffer_tracking@basic.html
    - fi-ivb-3770:        [PASS][101] -> [CRASH][102]
   [101]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7416/fi-ivb-3770/igt@kms_frontbuffer_tracking@basic.html
   [102]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3752/fi-ivb-3770/igt@kms_frontbuffer_tracking@basic.html
    - fi-skl-6700k2:      [PASS][103] -> [CRASH][104]
   [103]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7416/fi-skl-6700k2/igt@kms_frontbuffer_tracking@basic.html
   [104]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3752/fi-skl-6700k2/igt@kms_frontbuffer_tracking@basic.html
    - fi-cml-u2:          [PASS][105] -> [CRASH][106]
   [105]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7416/fi-cml-u2/igt@kms_frontbuffer_tracking@basic.html
   [106]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3752/fi-cml-u2/igt@kms_frontbuffer_tracking@basic.html
    - fi-byt-j1900:       [PASS][107] -> [CRASH][108]
   [107]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7416/fi-byt-j1900/igt@kms_frontbuffer_tracking@basic.html
   [108]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3752/fi-byt-j1900/igt@kms_frontbuffer_tracking@basic.html
    - fi-skl-6600u:       [PASS][109] -> [CRASH][110]
   [109]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7416/fi-skl-6600u/igt@kms_frontbuffer_tracking@basic.html
   [110]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3752/fi-skl-6600u/igt@kms_frontbuffer_tracking@basic.html
    - fi-icl-dsi:         [PASS][111] -> [CRASH][112]
   [111]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7416/fi-icl-dsi/igt@kms_frontbuffer_tracking@basic.html
   [112]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3752/fi-icl-dsi/igt@kms_frontbuffer_tracking@basic.html
    - fi-bdw-5557u:       [PASS][113] -> [CRASH][114]
   [113]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7416/fi-bdw-5557u/igt@kms_frontbuffer_tracking@basic.html
   [114]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3752/fi-bdw-5557u/igt@kms_frontbuffer_tracking@basic.html
    - fi-kbl-r:           [PASS][115] -> [CRASH][116]
   [115]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7416/fi-kbl-r/igt@kms_frontbuffer_tracking@basic.html
   [116]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3752/fi-kbl-r/igt@kms_frontbuffer_tracking@basic.html
    - fi-icl-y:           [PASS][117] -> [CRASH][118]
   [117]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7416/fi-icl-y/igt@kms_frontbuffer_tracking@basic.html
   [118]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3752/fi-icl-y/igt@kms_frontbuffer_tracking@basic.html
    - fi-snb-2600:        [PASS][119] -> [CRASH][120]
   [119]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7416/fi-snb-2600/igt@kms_frontbuffer_tracking@basic.html
   [120]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3752/fi-snb-2600/igt@kms_frontbuffer_tracking@basic.html
    - fi-hsw-peppy:       [PASS][121] -> [CRASH][122]
   [121]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7416/fi-hsw-peppy/igt@kms_frontbuffer_tracking@basic.html
   [122]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3752/fi-hsw-peppy/igt@kms_frontbuffer_tracking@basic.html
    - fi-skl-6770hq:      [PASS][123] -> [CRASH][124]
   [123]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7416/fi-skl-6770hq/igt@kms_frontbuffer_tracking@basic.html
   [124]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3752/fi-skl-6770hq/igt@kms_frontbuffer_tracking@basic.html
    - fi-cfl-guc:         [PASS][125] -> [CRASH][126]
   [125]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7416/fi-cfl-guc/igt@kms_frontbuffer_tracking@basic.html
   [126]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3752/fi-cfl-guc/igt@kms_frontbuffer_tracking@basic.html
    - fi-skl-lmem:        [PASS][127] -> [CRASH][128]
   [127]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7416/fi-skl-lmem/igt@kms_frontbuffer_tracking@basic.html
   [128]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3752/fi-skl-lmem/igt@kms_frontbuffer_tracking@basic.html
    - fi-snb-2520m:       [PASS][129] -> [CRASH][130]
   [129]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7416/fi-snb-2520m/igt@kms_frontbuffer_tracking@basic.html
   [130]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3752/fi-snb-2520m/igt@kms_frontbuffer_tracking@basic.html
    - fi-whl-u:           [PASS][131] -> [CRASH][132]
   [131]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7416/fi-whl-u/igt@kms_frontbuffer_tracking@basic.html
   [132]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3752/fi-whl-u/igt@kms_frontbuffer_tracking@basic.html
    - fi-cfl-8700k:       [PASS][133] -> [CRASH][134]
   [133]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7416/fi-cfl-8700k/igt@kms_frontbuffer_tracking@basic.html
   [134]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3752/fi-cfl-8700k/igt@kms_frontbuffer_tracking@basic.html
    - fi-icl-u2:          [PASS][135] -> [CRASH][136]
   [135]: https://intel-gfx-ci

== Logs ==

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

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

* Re: [igt-dev] [PATCH i-g-t 1/3] include/drm-uapi/i915_drm: Add local defs for mmap_offset
  2019-11-25 10:09 ` [igt-dev] [PATCH i-g-t 1/3] include/drm-uapi/i915_drm: Add local defs for mmap_offset Zbigniew Kempczyński
@ 2019-11-25 12:43   ` Petri Latvala
  0 siblings, 0 replies; 9+ messages in thread
From: Petri Latvala @ 2019-11-25 12:43 UTC (permalink / raw)
  To: Zbigniew Kempczyński; +Cc: igt-dev

On Mon, Nov 25, 2019 at 11:09:55AM +0100, Zbigniew Kempczyński wrote:
> Contains local definitions and structures for GEM_MMAP_OFFSET.
> To be removed on upstream merge.
> 
> Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
> ---
>  include/drm-uapi/i915_drm.h | 33 +++++++++++++++++++++++++++++++++
>  1 file changed, 33 insertions(+)
> 
> diff --git a/include/drm-uapi/i915_drm.h b/include/drm-uapi/i915_drm.h
> index ab899abb..154e07ce 100644
> --- a/include/drm-uapi/i915_drm.h
> +++ b/include/drm-uapi/i915_drm.h
> @@ -2245,6 +2245,39 @@ struct drm_i915_query_perf_config {
>  	__u8 data[];
>  };
>  
> +/*
> + * Local structures and definitions to be removed on upstream merge
> + */
> +struct local_i915_gem_mmap_offset {
> +	/** Handle for the object being mapped. */
> +	__u32 handle;
> +	__u32 pad;
> +	/**
> +	 * Fake offset to use for subsequent mmap call
> +	 *
> +	 * This is a fixed-size type for 32/64 compatibility.
> +	 */
> +	__u64 offset;
> +	/**
> +	 * Flags for extended behaviour.
> +	 *
> +	 * It is mandatory that either one of the _WC/_WB flags
> +	 * should be passed here.
> +	 */
> +	__u64 flags;
> +
> +#define LOCAL_I915_MMAP_OFFSET_GTT 0
> +#define LOCAL_I915_MMAP_OFFSET_WC  1
> +#define LOCAL_I915_MMAP_OFFSET_WB  2
> +#define LOCAL_I915_MMAP_OFFSET_UC  3
> +
> +	__u64 extensions;
> +};
> +
> +#define LOCAL_I915_GEM_MMAP_OFFSET       DRM_I915_GEM_MMAP_GTT
> +#define LOCAL_IOCTL_I915_GEM_MMAP_OFFSET         DRM_IOWR(DRM_COMMAND_BASE + \
> +	LOCAL_I915_GEM_MMAP_OFFSET, struct local_i915_gem_mmap_offset)
> +


Please don't use local_* / LOCAL_* names, use real names. And please
don't hand-edit the drm-uapi files. Copy the files from the
in-development kernel series (and note in the commit message that it
has been done as such and the patch is not to be merged), to reduce
the required churn in the test code. When the kernel side has been
merged, the uapi files can get the actual copies.

I'm sure someone has commented on this before but I didn't spot it...


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

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

* Re: [igt-dev] [PATCH i-g-t 3/3] tests/i915/gem_mmap_offset: Add new API test for gem_mmap_offset
  2019-11-25 10:23   ` Chris Wilson
@ 2019-11-25 17:32     ` Vanshidhar Konda
  2019-11-25 17:33       ` Chris Wilson
  0 siblings, 1 reply; 9+ messages in thread
From: Vanshidhar Konda @ 2019-11-25 17:32 UTC (permalink / raw)
  To: Chris Wilson; +Cc: igt-dev

On Mon, Nov 25, 2019 at 10:23:09AM +0000, Chris Wilson wrote:
>Quoting Zbigniew Kempczyński (2019-11-25 10:09:57)
>> From: Lukasz Kalamarz <lukasz.kalamarz@intel.com>
>>
>> Few simple tests which tries to create / mmap buffer objects
>> using GEM_MMAP_OFFSET uAPI.
>>
>> Signed-off-by: Lukasz Kalamarz <lukasz.kalamarz@intel.com>
>> Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
>> Cc: Chris Wilson <chris@chris-wilson.co.uk>
>> Cc: Vanshidhar Konda <vanshidhar.r.konda@intel.com>
>> ---
>>  tests/Makefile.sources       |   3 +
>>  tests/i915/gem_mmap_offset.c | 127 +++++++++++++++++++++++++++++++++++
>>  tests/meson.build            |   1 +
>>  3 files changed, 131 insertions(+)
>>  create mode 100644 tests/i915/gem_mmap_offset.c
>>
>> diff --git a/tests/Makefile.sources b/tests/Makefile.sources
>> index 27801c89..9c6c3933 100644
>> --- a/tests/Makefile.sources
>> +++ b/tests/Makefile.sources
>> @@ -320,6 +320,9 @@ gem_mmap_SOURCES = i915/gem_mmap.c
>>  TESTS_progs += gem_mmap_gtt
>>  gem_mmap_gtt_SOURCES = i915/gem_mmap_gtt.c
>>
>> +TESTS_progs += gem_mmap_offset
>> +gem_mmap_offset_SOURCES = i915/gem_mmap_offset.c
>> +
>>  TESTS_progs += gem_mmap_offset_exhaustion
>>  gem_mmap_offset_exhaustion_SOURCES = i915/gem_mmap_offset_exhaustion.c
>>
>> diff --git a/tests/i915/gem_mmap_offset.c b/tests/i915/gem_mmap_offset.c
>> new file mode 100644
>> index 00000000..44dca831
>> --- /dev/null
>> +++ b/tests/i915/gem_mmap_offset.c
>> @@ -0,0 +1,127 @@
>> +/*
>> + * Copyright © 2019 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.
>> + */
>> +
>> +#include "igt.h"
>> +#include <errno.h>
>> +#include <sys/stat.h>
>> +#include <sys/ioctl.h>
>> +#include "drm.h"
>> +
>> +IGT_TEST_DESCRIPTION("Basic MMAP_OFFSET IOCTL tests for mem regions\n");
>> +
>> +static int mmap_offset_ioctl(int fd, struct local_i915_gem_mmap_offset *arg)
>> +{
>> +       int err = 0;
>> +
>> +       if (igt_ioctl(fd, LOCAL_IOCTL_I915_GEM_MMAP_OFFSET, arg))
>> +               err = -errno;
>> +
>> +       errno = 0;
>> +       return err;
>> +}
>> +
>> +static void mmap_offset_bad_object(int fd)
>> +{
>> +       uint32_t real_handle;
>> +       uint32_t handles[20];
>> +       int i = 0;
>> +
>> +       real_handle = gem_create(fd, 4096);
>> +
>> +       handles[i++] = 0xdeadbeef;
>> +       for (int bit = 0; bit < 16; bit++)
>> +               handles[i++] = real_handle | (1 << (bit + 16));
>> +       handles[i] = real_handle + 1;
>> +
>> +       for (; i >= 0; i--) {
>> +               struct local_i915_gem_mmap_offset arg = {
>> +                       .handle = handles[i],
>> +                       .flags = LOCAL_I915_MMAP_OFFSET_WC,
>
>Hmm, WC isn't guaranteed on all platforms, neither is GTT, nor may be
>WB, nor UC.
>
>That's quite a conundrum. I would actually say use OFFSET_WB for basic
>API correctness checks as that covers all platforms we have today, and
>we'll cross that bridge when we come to it.

Would doing UC not work across all platforms we have? Since, this code
path should not really be performance sensitive, I thought UC would have
been the safest fall back option.

Vanshi

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

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

* Re: [igt-dev] [PATCH i-g-t 3/3] tests/i915/gem_mmap_offset: Add new API test for gem_mmap_offset
  2019-11-25 17:32     ` Vanshidhar Konda
@ 2019-11-25 17:33       ` Chris Wilson
  0 siblings, 0 replies; 9+ messages in thread
From: Chris Wilson @ 2019-11-25 17:33 UTC (permalink / raw)
  To: Vanshidhar Konda; +Cc: igt-dev

Quoting Vanshidhar Konda (2019-11-25 17:32:10)
> On Mon, Nov 25, 2019 at 10:23:09AM +0000, Chris Wilson wrote:
> >Quoting Zbigniew Kempczyński (2019-11-25 10:09:57)
> >> From: Lukasz Kalamarz <lukasz.kalamarz@intel.com>
> >>
> >> Few simple tests which tries to create / mmap buffer objects
> >> using GEM_MMAP_OFFSET uAPI.
> >>
> >> Signed-off-by: Lukasz Kalamarz <lukasz.kalamarz@intel.com>
> >> Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
> >> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> >> Cc: Vanshidhar Konda <vanshidhar.r.konda@intel.com>
> >> ---
> >>  tests/Makefile.sources       |   3 +
> >>  tests/i915/gem_mmap_offset.c | 127 +++++++++++++++++++++++++++++++++++
> >>  tests/meson.build            |   1 +
> >>  3 files changed, 131 insertions(+)
> >>  create mode 100644 tests/i915/gem_mmap_offset.c
> >>
> >> diff --git a/tests/Makefile.sources b/tests/Makefile.sources
> >> index 27801c89..9c6c3933 100644
> >> --- a/tests/Makefile.sources
> >> +++ b/tests/Makefile.sources
> >> @@ -320,6 +320,9 @@ gem_mmap_SOURCES = i915/gem_mmap.c
> >>  TESTS_progs += gem_mmap_gtt
> >>  gem_mmap_gtt_SOURCES = i915/gem_mmap_gtt.c
> >>
> >> +TESTS_progs += gem_mmap_offset
> >> +gem_mmap_offset_SOURCES = i915/gem_mmap_offset.c
> >> +
> >>  TESTS_progs += gem_mmap_offset_exhaustion
> >>  gem_mmap_offset_exhaustion_SOURCES = i915/gem_mmap_offset_exhaustion.c
> >>
> >> diff --git a/tests/i915/gem_mmap_offset.c b/tests/i915/gem_mmap_offset.c
> >> new file mode 100644
> >> index 00000000..44dca831
> >> --- /dev/null
> >> +++ b/tests/i915/gem_mmap_offset.c
> >> @@ -0,0 +1,127 @@
> >> +/*
> >> + * Copyright © 2019 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.
> >> + */
> >> +
> >> +#include "igt.h"
> >> +#include <errno.h>
> >> +#include <sys/stat.h>
> >> +#include <sys/ioctl.h>
> >> +#include "drm.h"
> >> +
> >> +IGT_TEST_DESCRIPTION("Basic MMAP_OFFSET IOCTL tests for mem regions\n");
> >> +
> >> +static int mmap_offset_ioctl(int fd, struct local_i915_gem_mmap_offset *arg)
> >> +{
> >> +       int err = 0;
> >> +
> >> +       if (igt_ioctl(fd, LOCAL_IOCTL_I915_GEM_MMAP_OFFSET, arg))
> >> +               err = -errno;
> >> +
> >> +       errno = 0;
> >> +       return err;
> >> +}
> >> +
> >> +static void mmap_offset_bad_object(int fd)
> >> +{
> >> +       uint32_t real_handle;
> >> +       uint32_t handles[20];
> >> +       int i = 0;
> >> +
> >> +       real_handle = gem_create(fd, 4096);
> >> +
> >> +       handles[i++] = 0xdeadbeef;
> >> +       for (int bit = 0; bit < 16; bit++)
> >> +               handles[i++] = real_handle | (1 << (bit + 16));
> >> +       handles[i] = real_handle + 1;
> >> +
> >> +       for (; i >= 0; i--) {
> >> +               struct local_i915_gem_mmap_offset arg = {
> >> +                       .handle = handles[i],
> >> +                       .flags = LOCAL_I915_MMAP_OFFSET_WC,
> >
> >Hmm, WC isn't guaranteed on all platforms, neither is GTT, nor may be
> >WB, nor UC.
> >
> >That's quite a conundrum. I would actually say use OFFSET_WB for basic
> >API correctness checks as that covers all platforms we have today, and
> >we'll cross that bridge when we come to it.
> 
> Would doing UC not work across all platforms we have? Since, this code
> path should not really be performance sensitive, I thought UC would have
> been the safest fall back option.

No, UC also depends on PAT which not all platforms support.
-Chris
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

end of thread, other threads:[~2019-11-25 17:34 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-25 10:09 [igt-dev] [PATCH i-g-t 0/3] Add GEM_MMAP_OFFSET support in IGT Zbigniew Kempczyński
2019-11-25 10:09 ` [igt-dev] [PATCH i-g-t 1/3] include/drm-uapi/i915_drm: Add local defs for mmap_offset Zbigniew Kempczyński
2019-11-25 12:43   ` Petri Latvala
2019-11-25 10:09 ` [igt-dev] [PATCH i-g-t 2/3] lib/i915/gem_mman: add mmap_offset support Zbigniew Kempczyński
2019-11-25 10:09 ` [igt-dev] [PATCH i-g-t 3/3] tests/i915/gem_mmap_offset: Add new API test for gem_mmap_offset Zbigniew Kempczyński
2019-11-25 10:23   ` Chris Wilson
2019-11-25 17:32     ` Vanshidhar Konda
2019-11-25 17:33       ` Chris Wilson
2019-11-25 11:33 ` [igt-dev] ✗ Fi.CI.BAT: failure for Add GEM_MMAP_OFFSET support in IGT 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.