All of lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t 0/2] tests/kms_prime: Sharing BO with smem as placement
@ 2021-09-07 16:00 Ramalingam C
  2021-09-07 16:00 ` [igt-dev] [PATCH i-g-t 1/2] lib/ioctl_wrappers: wrapper for mmap ptr for gem obj Ramalingam C
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Ramalingam C @ 2021-09-07 16:00 UTC (permalink / raw)
  To: igt-dev
  Cc: Chris Wilson, Chris_intel_ID, Dixit Ashutosh, Michael Ruhl, Ramalingam C

Create the sharing obj with smem as second placement option through
gem_create.

Ramalingam C (2):
  lib/ioctl_wrappers: wrapper for mmap ptr for gem obj
  tests/kms_prime: Create the exporting BO with smem placement

 lib/ioctl_wrappers.c | 69 +++++++++++++++++---------------------------
 lib/ioctl_wrappers.h |  1 +
 tests/kms_prime.c    | 22 +++++++-------
 3 files changed, 38 insertions(+), 54 deletions(-)

-- 
2.20.1

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

* [igt-dev] [PATCH i-g-t 1/2] lib/ioctl_wrappers: wrapper for mmap ptr for gem obj
  2021-09-07 16:00 [igt-dev] [PATCH i-g-t 0/2] tests/kms_prime: Sharing BO with smem as placement Ramalingam C
@ 2021-09-07 16:00 ` Ramalingam C
  2021-09-07 16:00 ` [igt-dev] [PATCH i-g-t 2/2] tests/kms_prime: Create the exporting BO with smem placement Ramalingam C
  2021-09-07 17:00 ` [igt-dev] ✗ Fi.CI.BAT: failure for tests/kms_prime: Sharing BO with smem as placement Patchwork
  2 siblings, 0 replies; 4+ messages in thread
From: Ramalingam C @ 2021-09-07 16:00 UTC (permalink / raw)
  To: igt-dev
  Cc: Chris Wilson, Chris_intel_ID, Dixit Ashutosh, Michael Ruhl, Ramalingam C

Refactoring the code for abstracting a wrapper for the mmaped pointer
for a gem object.

Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
---
 lib/ioctl_wrappers.c | 69 +++++++++++++++++---------------------------
 lib/ioctl_wrappers.h |  1 +
 2 files changed, 28 insertions(+), 42 deletions(-)

diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c
index 09eb3ce7b57b..d585b4f33210 100644
--- a/lib/ioctl_wrappers.c
+++ b/lib/ioctl_wrappers.c
@@ -331,13 +331,13 @@ static bool is_cache_coherent(int fd, uint32_t handle)
 	return gem_get_caching(fd, handle) != I915_CACHING_NONE;
 }
 
-static void mmap_write(int fd, uint32_t handle, uint64_t offset,
-		       const void *buf, uint64_t length)
+void *gem_mmap_ptr(int fd, uint32_t handle, uint64_t offset, uint64_t length,
+		   unsigned prot)
 {
 	void *map = NULL;
 
 	if (!length)
-		return;
+		return map;
 
 	if (gem_has_lmem(fd)) {
 		/*
@@ -346,66 +346,51 @@ static void mmap_write(int fd, uint32_t handle, uint64_t offset,
 		 */
 		map = gem_mmap_offset__fixed(fd, handle, 0,
 					     offset + length,
-					     PROT_READ | PROT_WRITE);
+					     prot);
 		igt_assert_eq(gem_wait(fd, handle, 0), 0);
+		if (map)
+			return map;
 	}
 
-	if (!map && is_cache_coherent(fd, handle)) {
+	if (!map && (prot & PROT_READ ? gem_has_llc(fd) : true ||
+	    is_cache_coherent(fd, handle))) {
 		/* offset arg for mmap functions must be 0 */
 		map = __gem_mmap__cpu_coherent(fd, handle, 0, offset + length,
-					       PROT_READ | PROT_WRITE);
-		if (map)
+					       prot);
+		if (map) {
 			gem_set_domain(fd, handle,
-				       I915_GEM_DOMAIN_CPU, I915_GEM_DOMAIN_CPU);
+				       I915_GEM_DOMAIN_CPU, prot & PROT_WRITE ?
+				       I915_GEM_DOMAIN_CPU : 0);
+			return map;
+		}
 	}
 
 	if (!map) {
 		map = __gem_mmap_offset__wc(fd, handle, 0, offset + length,
-					    PROT_READ | PROT_WRITE);
+					    prot);
 		if (!map)
 			map = gem_mmap__wc(fd, handle, 0, offset + length,
-					   PROT_READ | PROT_WRITE);
+					   prot);
 		gem_set_domain(fd, handle,
-			       I915_GEM_DOMAIN_WC, I915_GEM_DOMAIN_WC);
+			       I915_GEM_DOMAIN_WC, prot & PROT_WRITE ?
+			       I915_GEM_DOMAIN_WC : 0);
 	}
 
+	return map;
+}
+
+static void mmap_write(int fd, uint32_t handle, uint64_t offset,
+		       const void *buf, uint64_t length)
+{
+	void *map = gem_mmap_ptr(fd, handle, offset, length, PROT_READ | PROT_WRITE);
+
 	memcpy(map + offset, buf, length);
 	munmap(map, offset + length);
 }
 
 static void mmap_read(int fd, uint32_t handle, uint64_t offset, void *buf, uint64_t length)
 {
-	void *map = NULL;
-
-	if (!length)
-		return;
-
-	if (gem_has_lmem(fd)) {
-		/*
-		 * set/get_caching and set_domain are no longer supported on
-		 * discrete, also the only supported mmap mode is FIXED.
-		 */
-		map = gem_mmap_offset__fixed(fd, handle, 0,
-					     offset + length, PROT_READ);
-		igt_assert_eq(gem_wait(fd, handle, 0), 0);
-	}
-
-	if (!map && (gem_has_llc(fd) || is_cache_coherent(fd, handle))) {
-		/* offset arg for mmap functions must be 0 */
-		map = __gem_mmap__cpu_coherent(fd, handle, 0,
-					       offset + length, PROT_READ);
-		if (map)
-			gem_set_domain(fd, handle, I915_GEM_DOMAIN_CPU, 0);
-	}
-
-	if (!map) {
-		map = __gem_mmap_offset__wc(fd, handle, 0, offset + length,
-					    PROT_READ);
-		if (!map)
-			map = gem_mmap__wc(fd, handle, 0, offset + length,
-					   PROT_READ);
-		gem_set_domain(fd, handle, I915_GEM_DOMAIN_WC, 0);
-	}
+	void *map = gem_mmap_ptr(fd, handle, offset, length, PROT_READ);
 
 	igt_memcpy_from_wc(buf, map + offset, length);
 	munmap(map, offset + length);
diff --git a/lib/ioctl_wrappers.h b/lib/ioctl_wrappers.h
index 9a897fec2386..7284329d67b8 100644
--- a/lib/ioctl_wrappers.h
+++ b/lib/ioctl_wrappers.h
@@ -68,6 +68,7 @@ uint32_t gem_get_caching(int fd, uint32_t handle);
 uint32_t gem_flink(int fd, uint32_t handle);
 uint32_t gem_open(int fd, uint32_t name);
 void gem_close(int fd, uint32_t handle);
+void *gem_mmap_ptr(int fd, uint32_t handle, uint64_t offset, uint64_t length, unsigned prot);
 int __gem_write(int fd, uint32_t handle, uint64_t offset, const void *buf, uint64_t length);
 void gem_write(int fd, uint32_t handle, uint64_t offset,  const void *buf, uint64_t length);
 int __gem_read(int fd, uint32_t handle, uint64_t offset, void *buf, uint64_t length);
-- 
2.20.1

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

* [igt-dev] [PATCH i-g-t 2/2] tests/kms_prime: Create the exporting BO with smem placement
  2021-09-07 16:00 [igt-dev] [PATCH i-g-t 0/2] tests/kms_prime: Sharing BO with smem as placement Ramalingam C
  2021-09-07 16:00 ` [igt-dev] [PATCH i-g-t 1/2] lib/ioctl_wrappers: wrapper for mmap ptr for gem obj Ramalingam C
@ 2021-09-07 16:00 ` Ramalingam C
  2021-09-07 17:00 ` [igt-dev] ✗ Fi.CI.BAT: failure for tests/kms_prime: Sharing BO with smem as placement Patchwork
  2 siblings, 0 replies; 4+ messages in thread
From: Ramalingam C @ 2021-09-07 16:00 UTC (permalink / raw)
  To: igt-dev
  Cc: Chris Wilson, Chris_intel_ID, Dixit Ashutosh, Michael Ruhl, Ramalingam C

On i915, to use the dmabuf, we need the sharing object needs to
be migrated to smem. So shared object needs to have the smem as second
placement option.

Currently kms_prime sharing the dumb buffer between the devices.
But dumb buffer can't have the placements and resides at lmem for the
dgfx. Hence to meet the i915 expectation for dgfx, we create the BO
using the gem_create with smem as second placement option.

Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
---
 tests/kms_prime.c | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/tests/kms_prime.c b/tests/kms_prime.c
index 2e20c58bc16e..877774249e0f 100644
--- a/tests/kms_prime.c
+++ b/tests/kms_prime.c
@@ -100,18 +100,16 @@ static void prepare_scratch(int exporter_fd, struct dumb_bo *scratch,
 	scratch->height = mode->vdisplay;
 	scratch->bpp = 32;
 
-	scratch->handle = kmstest_dumb_create(exporter_fd,
-			ALIGN(scratch->width, 256),
-			scratch->height,
-			scratch->bpp,
-			&scratch->pitch,
-			&scratch->size);
-
-
-	ptr = kmstest_dumb_map_buffer(exporter_fd,
-				      scratch->handle,
-				      scratch->size,
-				      PROT_WRITE);
+	igt_calc_fb_size(exporter_fd, mode->hdisplay, mode->vdisplay, DRM_FORMAT_XRGB8888,
+			 DRM_FORMAT_MOD_NONE, &scratch->size, &scratch->pitch);
+	if (gem_has_lmem(exporter_fd))
+		scratch->handle = gem_create_in_memory_regions(exporter_fd, scratch->size,
+							       REGION_LMEM(0), REGION_SMEM);
+	else
+		scratch->handle = gem_create_in_memory_regions(exporter_fd, scratch->size,
+							       REGION_SMEM);
+
+	ptr = gem_mmap_ptr(exporter_fd, scratch->handle, 0, scratch->size, PROT_WRITE | PROT_READ);
 
 	for (size_t idx = 0; idx < scratch->size / sizeof(*ptr); ++idx)
 		ptr[idx] = color;
-- 
2.20.1

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

* [igt-dev] ✗ Fi.CI.BAT: failure for tests/kms_prime: Sharing BO with smem as placement
  2021-09-07 16:00 [igt-dev] [PATCH i-g-t 0/2] tests/kms_prime: Sharing BO with smem as placement Ramalingam C
  2021-09-07 16:00 ` [igt-dev] [PATCH i-g-t 1/2] lib/ioctl_wrappers: wrapper for mmap ptr for gem obj Ramalingam C
  2021-09-07 16:00 ` [igt-dev] [PATCH i-g-t 2/2] tests/kms_prime: Create the exporting BO with smem placement Ramalingam C
@ 2021-09-07 17:00 ` Patchwork
  2 siblings, 0 replies; 4+ messages in thread
From: Patchwork @ 2021-09-07 17:00 UTC (permalink / raw)
  To: Ramalingam C; +Cc: igt-dev

[-- Attachment #1: Type: text/plain, Size: 5250 bytes --]

== Series Details ==

Series: tests/kms_prime: Sharing BO with smem as placement
URL   : https://patchwork.freedesktop.org/series/94446/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_10557 -> IGTPW_6205
====================================================

Summary
-------

  **FAILURE**

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

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

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

### IGT changes ###

#### Possible regressions ####

  * igt@runner@aborted:
    - fi-tgl-y:           NOTRUN -> [FAIL][1]
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6205/fi-tgl-y/igt@runner@aborted.html

  
New tests
---------

  New tests have been introduced between CI_DRM_10557 and IGTPW_6205:

### New IGT tests (8) ###

  * igt@kms_flip@basic-flip-vs-dpms@d-dp1:
    - Statuses : 1 pass(s)
    - Exec time: [0.81] s

  * igt@kms_flip@basic-flip-vs-modeset@d-dp1:
    - Statuses : 1 pass(s)
    - Exec time: [0.78] s

  * igt@kms_flip@basic-flip-vs-wf_vblank@d-dp1:
    - Statuses : 1 pass(s)
    - Exec time: [1.03] s

  * igt@kms_flip@basic-plain-flip@d-dp1:
    - Statuses : 1 pass(s)
    - Exec time: [0.76] s

  * igt@kms_pipe_crc_basic@compare-crc-sanitycheck-pipe-a:
    - Statuses : 28 pass(s) 7 skip(s)
    - Exec time: [0.0, 1.61] s

  * igt@kms_pipe_crc_basic@compare-crc-sanitycheck-pipe-b:
    - Statuses : 28 pass(s) 7 skip(s)
    - Exec time: [0.0, 2.71] s

  * igt@kms_pipe_crc_basic@compare-crc-sanitycheck-pipe-c:
    - Statuses : 23 pass(s) 12 skip(s)
    - Exec time: [0.0, 2.74] s

  * igt@kms_pipe_crc_basic@compare-crc-sanitycheck-pipe-d:
    - Statuses : 3 pass(s) 32 skip(s)
    - Exec time: [0.0, 3.21] s

  

Known issues
------------

  Here are the changes found in IGTPW_6205 that come from known issues:

### IGT changes ###

#### Issues hit ####

  * igt@amdgpu/amd_prime@amd-to-i915:
    - fi-kbl-x1275:       NOTRUN -> [SKIP][2] ([fdo#109271]) +26 similar issues
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6205/fi-kbl-x1275/igt@amdgpu/amd_prime@amd-to-i915.html

  * igt@gem_huc_copy@huc-copy:
    - fi-kbl-x1275:       NOTRUN -> [SKIP][3] ([fdo#109271] / [i915#2190])
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6205/fi-kbl-x1275/igt@gem_huc_copy@huc-copy.html

  * igt@i915_selftest@live@gt_lrc:
    - fi-rkl-guc:         [PASS][4] -> [DMESG-WARN][5] ([i915#3958])
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10557/fi-rkl-guc/igt@i915_selftest@live@gt_lrc.html
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6205/fi-rkl-guc/igt@i915_selftest@live@gt_lrc.html

  * igt@i915_selftest@live@gt_pm:
    - fi-tgl-1115g4:      [PASS][6] -> [DMESG-FAIL][7] ([i915#3987])
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10557/fi-tgl-1115g4/igt@i915_selftest@live@gt_pm.html
   [7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6205/fi-tgl-1115g4/igt@i915_selftest@live@gt_pm.html

  * igt@kms_chamelium@hdmi-crc-fast:
    - fi-kbl-x1275:       NOTRUN -> [SKIP][8] ([fdo#109271] / [fdo#111827]) +8 similar issues
   [8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6205/fi-kbl-x1275/igt@kms_chamelium@hdmi-crc-fast.html

  * igt@kms_pipe_crc_basic@compare-crc-sanitycheck-pipe-d (NEW):
    - fi-kbl-x1275:       NOTRUN -> [SKIP][9] ([fdo#109271] / [i915#533])
   [9]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6205/fi-kbl-x1275/igt@kms_pipe_crc_basic@compare-crc-sanitycheck-pipe-d.html

  
  {name}: This element is suppressed. This means it is ignored when computing
          the status of the difference (SUCCESS, WARNING, or FAILURE).

  [fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
  [fdo#111827]: https://bugs.freedesktop.org/show_bug.cgi?id=111827
  [i915#1886]: https://gitlab.freedesktop.org/drm/intel/issues/1886
  [i915#2190]: https://gitlab.freedesktop.org/drm/intel/issues/2190
  [i915#3303]: https://gitlab.freedesktop.org/drm/intel/issues/3303
  [i915#3958]: https://gitlab.freedesktop.org/drm/intel/issues/3958
  [i915#3987]: https://gitlab.freedesktop.org/drm/intel/issues/3987
  [i915#533]: https://gitlab.freedesktop.org/drm/intel/issues/533


Participating hosts (47 -> 38)
------------------------------

  Additional (1): fi-kbl-x1275 
  Missing    (10): fi-kbl-soraka fi-ilk-m540 bat-adls-5 bat-dg1-6 fi-hsw-4200u fi-bsw-cyan bat-adlp-4 fi-ctg-p8600 fi-bsw-kefka fi-bdw-samus 


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

  * CI: CI-20190529 -> None
  * IGT: IGT_6198 -> IGTPW_6205

  CI-20190529: 20190529
  CI_DRM_10557: e8f764006582e44658833c07aef79c8c4b1a0758 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_6205: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6205/index.html
  IGT_6198: 0f17f38c3e5e2139e59f1458c149bb7a93c88bbf @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6205/index.html

[-- Attachment #2: Type: text/html, Size: 6344 bytes --]

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

end of thread, other threads:[~2021-09-07 17:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-07 16:00 [igt-dev] [PATCH i-g-t 0/2] tests/kms_prime: Sharing BO with smem as placement Ramalingam C
2021-09-07 16:00 ` [igt-dev] [PATCH i-g-t 1/2] lib/ioctl_wrappers: wrapper for mmap ptr for gem obj Ramalingam C
2021-09-07 16:00 ` [igt-dev] [PATCH i-g-t 2/2] tests/kms_prime: Create the exporting BO with smem placement Ramalingam C
2021-09-07 17:00 ` [igt-dev] ✗ Fi.CI.BAT: failure for tests/kms_prime: Sharing BO with smem as placement 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.