Skip to contentSkip to conversation

tests/i915/gem_userptr_blits: Added XY_FAST_COPY_BLT Command for MTL

PATCH Superseded Vikas Srivastava 3 participants 3 messages Nov 23, 2022 – Dec 5, 2022

v5 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

PATCH v5 1/1 tests/i915/gem_userptr_blits: Added XY_FAST_COPY_BLT Command for MTL

From: Arjun Melkaveri <[email protected]>

Test case uses legacy command which is not supported on MTL. Modified test to use XY_FAST_COPY_BLT.

---
 tests/i915/gem_userptr_blits.c | 139 ++++++++++++++++++++++-----------
 1 file changed, 92 insertions(+), 47 deletions(-)
tests/i915/gem_userptr_blits.c +92 -47
index 698508669..7ed7ce046 100644
@@ -99,8 +99,9 @@ static int copy(int fd, uint32_t dst, uint32_t src)
 	struct drm_i915_gem_relocation_entry reloc[2];
 	struct drm_i915_gem_exec_object2 obj[3];
 	struct drm_i915_gem_execbuffer2 exec;
+	uint32_t devid;
 	uint32_t handle;
-	int ret, i=0;
+	int ret, i = 0;
 	uint64_t dst_offset, src_offset, bb_offset;
 	bool has_relocs = gem_has_relocations(fd);
 
@@ -108,29 +109,48 @@ static int copy(int fd, uint32_t dst, uint32_t src)
 	dst_offset = bb_offset + 4096;
 	src_offset = dst_offset + WIDTH * HEIGHT * sizeof(uint32_t) * (src != dst);
 
-	batch[i++] = XY_SRC_COPY_BLT_CMD |
-		  XY_SRC_COPY_BLT_WRITE_ALPHA |
-		  XY_SRC_COPY_BLT_WRITE_RGB;
-	if (intel_gen(intel_get_drm_devid(fd)) >= 8)
-		batch[i - 1] |= 8;
-	else
-		batch[i - 1] |= 6;
-
-	batch[i++] = (3 << 24) | /* 32 bits */
-		  (0xcc << 16) | /* copy ROP */
-		  WIDTH*4;
-	batch[i++] = 0; /* dst x1,y1 */
-	batch[i++] = (HEIGHT << 16) | WIDTH; /* dst x2,y2 */
-	batch[i++] = dst_offset; /* dst reloc */
-	if (intel_gen(intel_get_drm_devid(fd)) >= 8)
-		batch[i++] = dst_offset >> 32;
-	batch[i++] = 0; /* src x1,y1 */
-	batch[i++] = WIDTH*4;
-	batch[i++] = src_offset; /* src reloc */
-	if (intel_gen(intel_get_drm_devid(fd)) >= 8)
-		batch[i++] = src_offset >> 32;
-	batch[i++] = MI_BATCH_BUFFER_END;
-	batch[i++] = MI_NOOP;
+	devid = intel_get_drm_devid(fd);
+
+	if (intel_graphics_ver(devid) >= IP_VER(12, 60)) {
+		batch[i++] = XY_FAST_COPY_BLT;
+		batch[i++] = XY_FAST_COPY_COLOR_DEPTH_32 | WIDTH*4;
+		batch[i++] = 0;/* dst x1,y1 */
+		batch[i++] = (HEIGHT << 16) | WIDTH;/* dst x2,y2 */
+		batch[i++] = lower_32_bits(CANONICAL(dst_offset));/* dst address */
+		batch[i++] = upper_32_bits(CANONICAL(dst_offset));
+		batch[i++] = 0;/* src x1,y1 */
+		batch[i++] = WIDTH*4;/* src pitch */
+		batch[i++] = lower_32_bits(CANONICAL(src_offset));/* src address */
+		batch[i++] = upper_32_bits(CANONICAL(src_offset));
+		batch[i++] = MI_BATCH_BUFFER_END;
+		batch[i++] = MI_NOOP;
+	} else {
+		batch[i++] = XY_SRC_COPY_BLT_CMD |
+			     XY_SRC_COPY_BLT_WRITE_ALPHA |
+			     XY_SRC_COPY_BLT_WRITE_RGB;
+		if (intel_gen(intel_get_drm_devid(fd)) >= 8)
+			batch[i - 1] |= 8;
+		else
+			batch[i - 1] |= 6;
+
+		batch[i++] = (3 << 24) | /* 32 bits */
+			     (0xcc << 16) | /* copy ROP */
+			     WIDTH*4;
+		batch[i++] = 0; /* dst x1,y1 */
+		batch[i++] = (HEIGHT << 16) | WIDTH; /* dst x2,y2 */
+		batch[i++] = lower_32_bits(CANONICAL(dst_offset));/*dst reloc*/
+		batch[i++] = upper_32_bits(CANONICAL(dst_offset));
+		if (intel_gen(intel_get_drm_devid(fd)) >= 8)
+			batch[i++] = dst_offset >> 32;
+		batch[i++] = 0; /* src x1,y1 */
+		batch[i++] = WIDTH*4;
+		batch[i++] = lower_32_bits(CANONICAL(src_offset)); /* src reloc */
+		batch[i++] = upper_32_bits(CANONICAL(src_offset));
+		if (intel_gen(intel_get_drm_devid(fd)) >= 8)
+			batch[i++] = src_offset >> 32;
+		batch[i++] = MI_BATCH_BUFFER_END;
+		batch[i++] = MI_NOOP;
+	}
 
 	handle = gem_create(fd, 4096);
 	gem_write(fd, handle, 0, batch, sizeof(batch));
@@ -204,31 +224,56 @@ blit(int fd, uint32_t dst, uint32_t src, uint32_t *all_bo, int n_bo)
 	struct drm_i915_gem_relocation_entry reloc[2];
 	struct drm_i915_gem_exec_object2 *obj;
 	struct drm_i915_gem_execbuffer2 exec;
+	uint32_t devid;
 	uint32_t handle;
-	int n, ret, i=0;
+	int n, ret, i = 0;
+	uint64_t dst_offset, src_offset, bb_offset;
 
-	batch[i++] = XY_SRC_COPY_BLT_CMD |
-		  XY_SRC_COPY_BLT_WRITE_ALPHA |
-		  XY_SRC_COPY_BLT_WRITE_RGB;
-	if (intel_gen(intel_get_drm_devid(fd)) >= 8)
-		batch[i - 1] |= 8;
-	else
-		batch[i - 1] |= 6;
-	batch[i++] = (3 << 24) | /* 32 bits */
-		  (0xcc << 16) | /* copy ROP */
-		  WIDTH*4;
-	batch[i++] = 0; /* dst x1,y1 */
-	batch[i++] = (HEIGHT << 16) | WIDTH; /* dst x2,y2 */
-	batch[i++] = 0; /* dst reloc */
-	if (intel_gen(intel_get_drm_devid(fd)) >= 8)
-		batch[i++] = 0;
-	batch[i++] = 0; /* src x1,y1 */
-	batch[i++] = WIDTH*4;
-	batch[i++] = 0; /* src reloc */
-	if (intel_gen(intel_get_drm_devid(fd)) >= 8)
-		batch[i++] = 0;
-	batch[i++] = MI_BATCH_BUFFER_END;
-	batch[i++] = MI_NOOP;
+	bb_offset = 16 << 20;
+	dst_offset = bb_offset + 4096;
+	src_offset = dst_offset + WIDTH * HEIGHT * sizeof(uint32_t) * (src != dst);
+
+	devid = intel_get_drm_devid(fd);
+
+	if (intel_graphics_ver(devid) >= IP_VER(12, 60)) {
+		batch[i++] = XY_FAST_COPY_BLT;
+		batch[i++] = XY_FAST_COPY_COLOR_DEPTH_32 | WIDTH*4;
+		batch[i++] = 0;/* dst x1,y1 */
+		batch[i++] = (HEIGHT << 16) | WIDTH;/* dst x2,y2 */
+		batch[i++] = lower_32_bits(CANONICAL(dst_offset));/* dst address */
+		batch[i++] = upper_32_bits(CANONICAL(dst_offset));
+		batch[i++] = 0;/* src x1,y1 */
+		batch[i++] = WIDTH*4;/* src pitch */
+		batch[i++] = lower_32_bits(CANONICAL(src_offset));//src address
+		batch[i++] = upper_32_bits(CANONICAL(src_offset));
+		batch[i++] = MI_BATCH_BUFFER_END;
+		batch[i++] = MI_NOOP;
+	} else {
+		batch[i++] = XY_SRC_COPY_BLT_CMD |
+			     XY_SRC_COPY_BLT_WRITE_ALPHA |
+			     XY_SRC_COPY_BLT_WRITE_RGB;
+		if (intel_gen(intel_get_drm_devid(fd)) >= 8)
+			batch[i - 1] |= 8;
+		else
+			batch[i - 1] |= 6;
+		batch[i++] = (3 << 24) | /* 32 bits */
+			     (0xcc << 16) | /* copy ROP */
+			     WIDTH*4;
+		batch[i++] = 0; /* dst x1,y1 */
+		batch[i++] = (HEIGHT << 16) | WIDTH; /* dst x2,y2 */
+		batch[i++] = lower_32_bits(CANONICAL(dst_offset));/* dst reloc */
+		batch[i++] = upper_32_bits(CANONICAL(dst_offset));
+		if (intel_gen(intel_get_drm_devid(fd)) >= 8)
+			batch[i++] = 0;
+		batch[i++] = 0; /* src x1,y1 */
+		batch[i++] = WIDTH*4;
+		batch[i++] = lower_32_bits(CANONICAL(src_offset)); /* src reloc */
+		batch[i++] = upper_32_bits(CANONICAL(src_offset));
+		if (intel_gen(intel_get_drm_devid(fd)) >= 8)
+			batch[i++] = 0;
+		batch[i++] = MI_BATCH_BUFFER_END;
+		batch[i++] = MI_NOOP;
+	}
 
 	handle = gem_create(fd, 4096);
 	gem_write(fd, handle, 0, batch, sizeof(batch));
Signature · 1 line
2.25.1
#1 lore raw

[igt-dev] ✓ Fi.CI.BAT: success for tests/i915/gem_userptr_blits: Added XY_FAST_COPY_BLT Command for MTL (rev5)

== Series Details ==

== Series Details ==

Series: tests/i915/gem_userptr_blits: Added XY_FAST_COPY_BLT Command for MTL (rev5)
URL : https://patchwork.freedesktop.org/series/111133/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_12422 -> IGTPW_8145
====================================================

Summary
-------

**SUCCESS**

No regressions found.

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

Participating hosts (39 -> 36)
------------------------------

Additional (3): fi-rkl-11600 bat-dg1-6 fi-pnv-d510
Missing (6): fi-ilk-m540 fi-hsw-4200u fi-ctg-p8600 bat-rpls-2 fi-bsw-nick fi-bdw-samus

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

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

### IGT changes ###

#### Issues hit ####

* igt@debugfs_test@basic-hwmon:
- fi-rkl-11600: NOTRUN -> [SKIP][1] ([i915#7456])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8145/fi-rkl-11600/igt@[email protected]

* igt@gem_huc_copy@huc-copy:
- fi-rkl-11600: NOTRUN -> [SKIP][2] ([i915#2190])
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8145/fi-rkl-11600/igt@[email protected]

* igt@gem_lmem_swapping@parallel-random-engines:
- fi-rkl-11600: NOTRUN -> [SKIP][3] ([i915#4613]) +3 similar issues
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8145/fi-rkl-11600/igt@[email protected]

* igt@gem_mmap@basic:
- bat-dg1-6: NOTRUN -> [SKIP][4] ([i915#4083])
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8145/bat-dg1-6/igt@[email protected]

* igt@gem_render_tiled_blits@basic:
- bat-dg1-6: NOTRUN -> [SKIP][5] ([i915#4079]) +1 similar issue
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8145/bat-dg1-6/igt@[email protected]

* igt@gem_tiled_fence_blits@basic:
- bat-dg1-6: NOTRUN -> [SKIP][6] ([i915#4077]) +2 similar issues
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8145/bat-dg1-6/igt@[email protected]

* igt@gem_tiled_pread_basic:
- fi-rkl-11600: NOTRUN -> [SKIP][7] ([i915#3282])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8145/fi-rkl-11600/igt@gem_tiled_pread_basic.html

* igt@i915_pm_backlight@basic-brightness:
- bat-dg1-6: NOTRUN -> [SKIP][8] ([i915#7561])
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8145/bat-dg1-6/igt@[email protected]
- fi-rkl-11600: NOTRUN -> [SKIP][9] ([i915#7561])
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8145/fi-rkl-11600/igt@[email protected]

* igt@i915_pm_rps@basic-api:
- bat-dg1-6: NOTRUN -> [SKIP][10] ([i915#6621])
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8145/bat-dg1-6/igt@[email protected]

* igt@i915_suspend@basic-s3-without-i915:
- fi-rkl-11600: NOTRUN -> [INCOMPLETE][11] ([i915#4817])
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8145/fi-rkl-11600/igt@[email protected]

* igt@kms_addfb_basic@basic-y-tiled-legacy:
- bat-dg1-6: NOTRUN -> [SKIP][12] ([i915#4215])
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8145/bat-dg1-6/igt@[email protected]

* igt@kms_addfb_basic@tile-pitch-mismatch:
- bat-dg1-6: NOTRUN -> [SKIP][13] ([i915#4212]) +7 similar issues
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8145/bat-dg1-6/igt@[email protected]

* igt@kms_chamelium@common-hpd-after-suspend:
- fi-hsw-4770: NOTRUN -> [SKIP][14] ([fdo#109271] / [fdo#111827])
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8145/fi-hsw-4770/igt@[email protected]

* igt@kms_chamelium@hdmi-crc-fast:
- bat-dg1-6: NOTRUN -> [SKIP][15] ([fdo#111827]) +8 similar issues
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8145/bat-dg1-6/igt@[email protected]

* igt@kms_chamelium@hdmi-hpd-fast:
- fi-rkl-11600: NOTRUN -> [SKIP][16] ([fdo#111827]) +7 similar issues
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8145/fi-rkl-11600/igt@[email protected]

* igt@kms_cursor_legacy@basic-busy-flip-before-cursor:
- fi-rkl-11600: NOTRUN -> [SKIP][17] ([i915#4103])
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8145/fi-rkl-11600/igt@[email protected]
- bat-dg1-6: NOTRUN -> [SKIP][18] ([i915#4103] / [i915#4213])
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8145/bat-dg1-6/igt@[email protected]

* igt@kms_force_connector_basic@force-load-detect:
- fi-rkl-11600: NOTRUN -> [SKIP][19] ([fdo#109285] / [i915#4098])
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8145/fi-rkl-11600/igt@[email protected]
- bat-dg1-6: NOTRUN -> [SKIP][20] ([fdo#109285])
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8145/bat-dg1-6/igt@[email protected]

* igt@kms_psr@primary_page_flip:
- fi-pnv-d510: NOTRUN -> [SKIP][21] ([fdo#109271]) +44 similar issues
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8145/fi-pnv-d510/igt@kms_psr@primary_page_flip.html

* igt@kms_psr@sprite_plane_onoff:
- bat-dg1-6: NOTRUN -> [SKIP][22] ([i915#1072] / [i915#4078]) +3 similar issues
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8145/bat-dg1-6/igt@kms_psr@sprite_plane_onoff.html
- fi-rkl-11600: NOTRUN -> [SKIP][23] ([i915#1072]) +3 similar issues
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8145/fi-rkl-11600/igt@kms_psr@sprite_plane_onoff.html

* igt@kms_setmode@basic-clone-single-crtc:
- bat-dg1-6: NOTRUN -> [SKIP][24] ([i915#3555])
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8145/bat-dg1-6/igt@[email protected]
- fi-rkl-11600: NOTRUN -> [SKIP][25] ([i915#3555] / [i915#4098])
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8145/fi-rkl-11600/igt@[email protected]

* igt@prime_vgem@basic-gtt:
- bat-dg1-6: NOTRUN -> [SKIP][26] ([i915#3708] / [i915#4077]) +1 similar issue
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8145/bat-dg1-6/igt@[email protected]

* igt@prime_vgem@basic-read:
- bat-dg1-6: NOTRUN -> [SKIP][27] ([i915#3708]) +3 similar issues
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8145/bat-dg1-6/igt@[email protected]
- fi-rkl-11600: NOTRUN -> [SKIP][28] ([fdo#109295] / [i915#3291] / [i915#3708]) +2 similar issues
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8145/fi-rkl-11600/igt@[email protected]

* igt@prime_vgem@basic-userptr:
- bat-dg1-6: NOTRUN -> [SKIP][29] ([i915#3708] / [i915#4873])
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8145/bat-dg1-6/igt@[email protected]
- fi-rkl-11600: NOTRUN -> [SKIP][30] ([fdo#109295] / [i915#3301] / [i915#3708])
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8145/fi-rkl-11600/igt@[email protected]

#### Possible fixes ####

* igt@i915_selftest@live@hangcheck:
- fi-hsw-4770: [INCOMPLETE][31] ([i915#4785]) -> [PASS][32]
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12422/fi-hsw-4770/igt@i915_selftest@[email protected]
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8145/fi-hsw-4770/igt@i915_selftest@[email protected]

* igt@kms_cursor_legacy@basic-busy-flip-before-cursor@atomic-transitions:
- fi-bsw-kefka: [FAIL][33] ([i915#6298]) -> [PASS][34]
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12422/fi-bsw-kefka/igt@kms_cursor_legacy@[email protected]
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8145/fi-bsw-kefka/igt@kms_cursor_legacy@[email protected]

{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#109285]: https://bugs.freedesktop.org/show_bug.cgi?id=109285
[fdo#109295]: https://bugs.freedesktop.org/show_bug.cgi?id=109295
[fdo#111827]: https://bugs.freedesktop.org/show_bug.cgi?id=111827
[i915#1072]: https://gitlab.freedesktop.org/drm/intel/issues/1072
[i915#2190]: https://gitlab.freedesktop.org/drm/intel/issues/2190
[i915#3282]: https://gitlab.freedesktop.org/drm/intel/issues/3282
[i915#3291]: https://gitlab.freedesktop.org/drm/intel/issues/3291
[i915#3301]: https://gitlab.freedesktop.org/drm/intel/issues/3301
[i915#3555]: https://gitlab.freedesktop.org/drm/intel/issues/3555
[i915#3708]: https://gitlab.freedesktop.org/drm/intel/issues/3708
[i915#4077]: https://gitlab.freedesktop.org/drm/intel/issues/4077
[i915#4078]: https://gitlab.freedesktop.org/drm/intel/issues/4078
[i915#4079]: https://gitlab.freedesktop.org/drm/intel/issues/4079
[i915#4083]: https://gitlab.freedesktop.org/drm/intel/issues/4083
[i915#4098]: https://gitlab.freedesktop.org/drm/intel/issues/4098
[i915#4103]: https://gitlab.freedesktop.org/drm/intel/issues/4103
[i915#4212]: https://gitlab.freedesktop.org/drm/intel/issues/4212
[i915#4213]: https://gitlab.freedesktop.org/drm/intel/issues/4213
[i915#4215]: https://gitlab.freedesktop.org/drm/intel/issues/4215
[i915#4258]: https://gitlab.freedesktop.org/drm/intel/issues/4258
[i915#4613]: https://gitlab.freedesktop.org/drm/intel/issues/4613
[i915#4785]: https://gitlab.freedesktop.org/drm/intel/issues/4785
[i915#4817]: https://gitlab.freedesktop.org/drm/intel/issues/4817
[i915#4873]: https://gitlab.freedesktop.org/drm/intel/issues/4873
[i915#4983]: https://gitlab.freedesktop.org/drm/intel/issues/4983
[i915#6298]: https://gitlab.freedesktop.org/drm/intel/issues/6298
[i915#6621]: https://gitlab.freedesktop.org/drm/intel/issues/6621
[i915#7456]: https://gitlab.freedesktop.org/drm/intel/issues/7456
[i915#7561]: https://gitlab.freedesktop.org/drm/intel/issues/7561

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

* CI: CI-20190529 -> None
* IGT: IGT_7072 -> IGTPW_8145

CI-20190529: 20190529
CI_DRM_12422: e9b111630cc3f1b8edfcc64040bb45c404a56be3 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_8145: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8145/index.html
IGT_7072: 69ba7163475925cdc69aebbdfa0e87453ae165c7 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git

== Logs ==

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

#2 lore raw
In reply to Vikas Srivastava

Hi Vikas,

I have small nit for subject, avoid using upper case letters in description words, use them only for proper names (like PVC, MTL or other HW/SW names), so
tests/i915/gem_userptr_blits: Added XY_FAST_COPY_BLT Command for MTL ---------------------------------------------------- ^ should be:
tests/i915/gem_userptr_blits: Added XY_FAST_COPY_BLT command for MTL

You can keep it now but please correct it in future patches.

Quoted 16 lines · Vikas Srivastava

From: Arjun Melkaveri <[email protected]>

Test case uses legacy command which is not supported on MTL. Modified test to use XY_FAST_COPY_BLT.

---
 tests/i915/gem_userptr_blits.c | 139 ++++++++++++++++++++++-----------
 1 file changed, 92 insertions(+), 47 deletions(-)
tests/i915/gem_userptr_blits.c +0 -0
index 698508669..7ed7ce046 100644

tests/i915/gem_userptr_blits.c static int copy(int fd, uint32_t dst, uint32_t src) · line 104

Quoted 7 lines
tests/i915/gem_userptr_blits.c +2 -1
@@ -99,8 +99,9 @@ static int copy(int fd, uint32_t dst, uint32_t src)
 	struct drm_i915_gem_relocation_entry reloc[2];
 	struct drm_i915_gem_exec_object2 obj[3];
 	struct drm_i915_gem_execbuffer2 exec;
+	uint32_t devid;
 	uint32_t handle;
-	int ret, i=0;
+	int ret, i = 0;

This can stay but try to avoid trivial fixes.

Quoted 26 lines
tests/i915/gem_userptr_blits.c +0 -19
 	uint64_t dst_offset, src_offset, bb_offset;
 	bool has_relocs = gem_has_relocations(fd);
 
@@ -108,29 +109,48 @@ static int copy(int fd, uint32_t dst, uint32_t src)
 	dst_offset = bb_offset + 4096;
 	src_offset = dst_offset + WIDTH * HEIGHT * sizeof(uint32_t) * (src != dst);
 
-	batch[i++] = XY_SRC_COPY_BLT_CMD |
-		  XY_SRC_COPY_BLT_WRITE_ALPHA |
-		  XY_SRC_COPY_BLT_WRITE_RGB;
-	if (intel_gen(intel_get_drm_devid(fd)) >= 8)
-		batch[i - 1] |= 8;
-	else
-		batch[i - 1] |= 6;
-
-	batch[i++] = (3 << 24) | /* 32 bits */
-		  (0xcc << 16) | /* copy ROP */
-		  WIDTH*4;
-	batch[i++] = 0; /* dst x1,y1 */
-	batch[i++] = (HEIGHT << 16) | WIDTH; /* dst x2,y2 */
-	batch[i++] = dst_offset; /* dst reloc */
-	if (intel_gen(intel_get_drm_devid(fd)) >= 8)
-		batch[i++] = dst_offset >> 32;
-	batch[i++] = 0; /* src x1,y1 */
-	batch[i++] = WIDTH*4;
-	batch[i++] = src_offset; /* src reloc */

tests/i915/gem_userptr_blits.c static int copy(int fd, uint32_t dst, uint32_t src) · line 117

Quoted 10 lines
tests/i915/gem_userptr_blits.c +6 -4
-	if (intel_gen(intel_get_drm_devid(fd)) >= 8)
-		batch[i++] = src_offset >> 32;
-	batch[i++] = MI_BATCH_BUFFER_END;
-	batch[i++] = MI_NOOP;
+	devid = intel_get_drm_devid(fd);
+
+	if (intel_graphics_ver(devid) >= IP_VER(12, 60)) {
+		batch[i++] = XY_FAST_COPY_BLT;
+		batch[i++] = XY_FAST_COPY_COLOR_DEPTH_32 | WIDTH*4;
+		batch[i++] = 0;/* dst x1,y1 */

------------------------------ ^
Put space before comment.

tests/i915/gem_userptr_blits.c static int copy(int fd, uint32_t dst, uint32_t src) · line 118

Quoted 1 line
tests/i915/gem_userptr_blits.c +1 -0
+		batch[i++] = (HEIGHT << 16) | WIDTH;/* dst x2,y2 */

--------------------------------------------------- ^ Put space before comment.

tests/i915/gem_userptr_blits.c static int copy(int fd, uint32_t dst, uint32_t src) · line 119

Quoted 1 line
tests/i915/gem_userptr_blits.c +1 -0
+		batch[i++] = lower_32_bits(CANONICAL(dst_offset));/* dst address */

------------------------------------------ ^ -------------------- ^ No need for CANONICAL here, it will only affect high bits. Put also space before comment:

		batch[i++] = lower_32_bits(dst_offset); /* dst address */

tests/i915/gem_userptr_blits.c static int copy(int fd, uint32_t dst, uint32_t src) · line 123

Quoted 4 lines
tests/i915/gem_userptr_blits.c +4 -0
+		batch[i++] = upper_32_bits(CANONICAL(dst_offset));
+		batch[i++] = 0;/* src x1,y1 */
+		batch[i++] = WIDTH*4;/* src pitch */
+		batch[i++] = lower_32_bits(CANONICAL(src_offset));/* src address */

------------------------------------------ ^ -------------------- ^ Same here.

Quoted 8 lines
tests/i915/gem_userptr_blits.c +8 -0
+		batch[i++] = upper_32_bits(CANONICAL(src_offset));
+		batch[i++] = MI_BATCH_BUFFER_END;
+		batch[i++] = MI_NOOP;
+	} else {
+		batch[i++] = XY_SRC_COPY_BLT_CMD |
+			     XY_SRC_COPY_BLT_WRITE_ALPHA |
+			     XY_SRC_COPY_BLT_WRITE_RGB;
+		if (intel_gen(intel_get_drm_devid(fd)) >= 8)

tests/i915/gem_userptr_blits.c static int copy(int fd, uint32_t dst, uint32_t src) · line 141

Quoted 10 lines
tests/i915/gem_userptr_blits.c +10 -0
+			batch[i - 1] |= 8;
+		else
+			batch[i - 1] |= 6;
+
+		batch[i++] = (3 << 24) | /* 32 bits */
+			     (0xcc << 16) | /* copy ROP */
+			     WIDTH*4;
+		batch[i++] = 0; /* dst x1,y1 */
+		batch[i++] = (HEIGHT << 16) | WIDTH; /* dst x2,y2 */
+		batch[i++] = lower_32_bits(CANONICAL(dst_offset));/*dst reloc*/

------------------------------------------ ^ -------------------- ^ Same here.

tests/i915/gem_userptr_blits.c static int copy(int fd, uint32_t dst, uint32_t src) · line 143

Quoted 2 lines
tests/i915/gem_userptr_blits.c +2 -0
+		batch[i++] = upper_32_bits(CANONICAL(dst_offset));
+		if (intel_gen(intel_get_drm_devid(fd)) >= 8)

----------------------------- ^
Reuse devid here, so

		if (intel_gen(devid)) >= 8)

tests/i915/gem_userptr_blits.c static int copy(int fd, uint32_t dst, uint32_t src) · line 147

Quoted 4 lines
tests/i915/gem_userptr_blits.c +4 -0
+			batch[i++] = dst_offset >> 32;
+		batch[i++] = 0; /* src x1,y1 */
+		batch[i++] = WIDTH*4;
+		batch[i++] = lower_32_bits(CANONICAL(src_offset)); /* src reloc */

------------------------------------------ ^
No need for CANONICAL here.

Quoted 41 lines
tests/i915/gem_userptr_blits.c +9 -23
+		batch[i++] = upper_32_bits(CANONICAL(src_offset));
+		if (intel_gen(intel_get_drm_devid(fd)) >= 8)
+			batch[i++] = src_offset >> 32;
+		batch[i++] = MI_BATCH_BUFFER_END;
+		batch[i++] = MI_NOOP;
+	}
 
 	handle = gem_create(fd, 4096);
 	gem_write(fd, handle, 0, batch, sizeof(batch));
@@ -204,31 +224,56 @@ blit(int fd, uint32_t dst, uint32_t src, uint32_t *all_bo, int n_bo)
 	struct drm_i915_gem_relocation_entry reloc[2];
 	struct drm_i915_gem_exec_object2 *obj;
 	struct drm_i915_gem_execbuffer2 exec;
+	uint32_t devid;
 	uint32_t handle;
-	int n, ret, i=0;
+	int n, ret, i = 0;
+	uint64_t dst_offset, src_offset, bb_offset;
 
-	batch[i++] = XY_SRC_COPY_BLT_CMD |
-		  XY_SRC_COPY_BLT_WRITE_ALPHA |
-		  XY_SRC_COPY_BLT_WRITE_RGB;
-	if (intel_gen(intel_get_drm_devid(fd)) >= 8)
-		batch[i - 1] |= 8;
-	else
-		batch[i - 1] |= 6;
-	batch[i++] = (3 << 24) | /* 32 bits */
-		  (0xcc << 16) | /* copy ROP */
-		  WIDTH*4;
-	batch[i++] = 0; /* dst x1,y1 */
-	batch[i++] = (HEIGHT << 16) | WIDTH; /* dst x2,y2 */
-	batch[i++] = 0; /* dst reloc */
-	if (intel_gen(intel_get_drm_devid(fd)) >= 8)
-		batch[i++] = 0;
-	batch[i++] = 0; /* src x1,y1 */
-	batch[i++] = WIDTH*4;
-	batch[i++] = 0; /* src reloc */
-	if (intel_gen(intel_get_drm_devid(fd)) >= 8)
-		batch[i++] = 0;
-	batch[i++] = MI_BATCH_BUFFER_END;
-	batch[i++] = MI_NOOP;

tests/i915/gem_userptr_blits.c blit(int fd, uint32_t dst, uint32_t src, uint32_t *all_bo, int n_bo) · line 241

Quoted 10 lines
tests/i915/gem_userptr_blits.c +10 -0
+	bb_offset = 16 << 20;
+	dst_offset = bb_offset + 4096;
+	src_offset = dst_offset + WIDTH * HEIGHT * sizeof(uint32_t) * (src != dst);
+
+	devid = intel_get_drm_devid(fd);
+
+	if (intel_graphics_ver(devid) >= IP_VER(12, 60)) {
+		batch[i++] = XY_FAST_COPY_BLT;
+		batch[i++] = XY_FAST_COPY_COLOR_DEPTH_32 | WIDTH*4;
+		batch[i++] = 0;/* dst x1,y1 */

------------------------------ ^
Same here.

tests/i915/gem_userptr_blits.c blit(int fd, uint32_t dst, uint32_t src, uint32_t *all_bo, int n_bo) · line 242

Quoted 1 line
tests/i915/gem_userptr_blits.c +1 -0
+		batch[i++] = (HEIGHT << 16) | WIDTH;/* dst x2,y2 */

--------------------------------------------------- ^

tests/i915/gem_userptr_blits.c blit(int fd, uint32_t dst, uint32_t src, uint32_t *all_bo, int n_bo) · line 243

Quoted 1 line
tests/i915/gem_userptr_blits.c +1 -0
+		batch[i++] = lower_32_bits(CANONICAL(dst_offset));/* dst address */

------------------------------------------ ^ -------------------- ^ Same here.

tests/i915/gem_userptr_blits.c blit(int fd, uint32_t dst, uint32_t src, uint32_t *all_bo, int n_bo) · line 245

Quoted 2 lines
tests/i915/gem_userptr_blits.c +2 -0
+		batch[i++] = upper_32_bits(CANONICAL(dst_offset));
+		batch[i++] = 0;/* src x1,y1 */

------------------------------ ^
Put space before comment.

tests/i915/gem_userptr_blits.c blit(int fd, uint32_t dst, uint32_t src, uint32_t *all_bo, int n_bo) · line 246

Quoted 1 line
tests/i915/gem_userptr_blits.c +1 -0
+		batch[i++] = WIDTH*4;/* src pitch */

------------------------------------ ^
Put space before comment.

tests/i915/gem_userptr_blits.c blit(int fd, uint32_t dst, uint32_t src, uint32_t *all_bo, int n_bo) · line 247

Quoted 1 line
tests/i915/gem_userptr_blits.c +1 -0
+		batch[i++] = lower_32_bits(CANONICAL(src_offset));//src address

------------------------------------------ ^ -------------------- ^ Same here, also please be consistent and use the same style for comments, so write /* src address */

Quoted 7 lines
tests/i915/gem_userptr_blits.c +7 -0
+		batch[i++] = upper_32_bits(CANONICAL(src_offset));
+		batch[i++] = MI_BATCH_BUFFER_END;
+		batch[i++] = MI_NOOP;
+	} else {
+		batch[i++] = XY_SRC_COPY_BLT_CMD |
+			     XY_SRC_COPY_BLT_WRITE_ALPHA |
+			     XY_SRC_COPY_BLT_WRITE_RGB;

tests/i915/gem_userptr_blits.c blit(int fd, uint32_t dst, uint32_t src, uint32_t *all_bo, int n_bo) · line 264

Quoted 10 lines
tests/i915/gem_userptr_blits.c +10 -0
+		if (intel_gen(intel_get_drm_devid(fd)) >= 8)
+			batch[i - 1] |= 8;
+		else
+			batch[i - 1] |= 6;
+		batch[i++] = (3 << 24) | /* 32 bits */
+			     (0xcc << 16) | /* copy ROP */
+			     WIDTH*4;
+		batch[i++] = 0; /* dst x1,y1 */
+		batch[i++] = (HEIGHT << 16) | WIDTH; /* dst x2,y2 */
+		batch[i++] = lower_32_bits(CANONICAL(dst_offset));/* dst reloc */

------------------------------------------ ^ -------------------- ^ Same here.

tests/i915/gem_userptr_blits.c blit(int fd, uint32_t dst, uint32_t src, uint32_t *all_bo, int n_bo) · line 266

Quoted 2 lines
tests/i915/gem_userptr_blits.c +2 -0
+		batch[i++] = upper_32_bits(CANONICAL(dst_offset));
+		if (intel_gen(intel_get_drm_devid(fd)) >= 8)

----------------------------- ^
Reuse devid you got above.

tests/i915/gem_userptr_blits.c blit(int fd, uint32_t dst, uint32_t src, uint32_t *all_bo, int n_bo) · line 270

Quoted 4 lines
tests/i915/gem_userptr_blits.c +4 -0
+			batch[i++] = 0;
+		batch[i++] = 0; /* src x1,y1 */
+		batch[i++] = WIDTH*4;
+		batch[i++] = lower_32_bits(CANONICAL(src_offset)); /* src reloc */

------------------------------------------ ^
Same here.

tests/i915/gem_userptr_blits.c blit(int fd, uint32_t dst, uint32_t src, uint32_t *all_bo, int n_bo) · line 272

Quoted 2 lines
tests/i915/gem_userptr_blits.c +2 -0
+		batch[i++] = upper_32_bits(CANONICAL(src_offset));
+		if (intel_gen(intel_get_drm_devid(fd)) >= 8)

----------------------------- ^
Reuse devid you got above.

Regards,
Kamil

Quoted 10 lines
tests/i915/gem_userptr_blits.c +4 -0
+			batch[i++] = 0;
+		batch[i++] = MI_BATCH_BUFFER_END;
+		batch[i++] = MI_NOOP;
+	}
 
 	handle = gem_create(fd, 4096);
 	gem_write(fd, handle, 0, batch, sizeof(batch));
Signature · 1 line
2.25.1