Skip to contentSkip to conversation

lib/igt_draw: Change MOCS settings for MTL

PATCH In review Jeevan B 3 participants 6 messages Jan 13, 2023 Library code

lore
Share & tools
lore

Jeevan B

author
#0 lore raw

cover lib/igt_draw: Change MOCS settings for MTL

On MTL, we want the table entry labelled "UC (GO:Mem)" which has index 5. This means that the MOCS value is 10.

v2: Add define for MOCS settings. (Lucas)
v3: Extending get_mocs_index and using get_mocs_index
to get mocs val. (Zbigniew)
v4: Spliting the patches as Fix and MTL changes.

Jeevan B (2):
lib/igt_draw: Use intel_get_uc_mocs to get MOCS value lib/igt_draw: Add MOCS values for MTL

 lib/i915/intel_mocs.c | 12 ++++++++----
 lib/igt_draw.c        |  2 +-
 2 files changed, 9 insertions(+), 5 deletions(-)
Signature · 1 line
2.19.1
author
#1 lore raw

PATCH 1/2 lib/igt_draw: Use intel_get_uc_mocs to get MOCS value

Use intel_get_uc_mocs instead of hardcoding to get table entry.

---
 lib/igt_draw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/igt_draw.c +1 -1
index 975d65cd..d8f4596a 100644
@@ -703,7 +703,7 @@ static void draw_rect_blt(int fd, struct cmd_data *cmd_data,
 
 		intel_bb_out(ibb, XY_FAST_COLOR_BLT | blt_cmd_depth);
 		/* DG2 MOCS entry 2 is "UC - Non-Coherent; GO:Memory" */
-		intel_bb_out(ibb, blt_cmd_tiling | 2 << 21 | (pitch-1));
+		intel_bb_out(ibb, blt_cmd_tiling | intel_get_uc_mocs(fd) << 21 | (pitch-1));
 		intel_bb_out(ibb, (rect->y << 16) | rect->x);
 		intel_bb_out(ibb, ((rect->y + rect->h) << 16) | (rect->x + rect->w));
 		intel_bb_emit_reloc_fenced(ibb, dst->handle, 0,
Signature · 1 line
2.19.1
Reviewed-by on v1 1/2
#2 lore raw

Re: [igt-dev] [PATCH i-g-t 1/2] lib/igt_draw: Use intel_get_uc_mocs to get MOCS value

Quoted 3 lines · Jeevan B

Use intel_get_uc_mocs instead of hardcoding to get table entry.

Lucas De Marchi

Quoted 20 lines

---
lib/igt_draw.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
lib/igt_draw.c +1 -1
index 975d65cd..d8f4596a 100644
@@ -703,7 +703,7 @@ static void draw_rect_blt(int fd, struct cmd_data *cmd_data,
 
 		intel_bb_out(ibb, XY_FAST_COLOR_BLT | blt_cmd_depth);
 		/* DG2 MOCS entry 2 is "UC - Non-Coherent; GO:Memory" */
-		intel_bb_out(ibb, blt_cmd_tiling | 2 << 21 | (pitch-1));
+		intel_bb_out(ibb, blt_cmd_tiling | intel_get_uc_mocs(fd) << 21 | (pitch-1));
 		intel_bb_out(ibb, (rect->y << 16) | rect->x);
 		intel_bb_out(ibb, ((rect->y + rect->h) << 16) | (rect->x + rect->w));
 		intel_bb_emit_reloc_fenced(ibb, dst->handle, 0,
Signature · 1 line
2.19.1
author
#3 lore raw

PATCH 2/2 lib/igt_draw: Add MOCS values for MTL

In reply to Jeevan B

On MTL, we want the table entry labelled "UC (GO:Mem)" which has index 5. This means that the MOCS value is 10.

---
 lib/i915/intel_mocs.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
lib/i915/intel_mocs.c +8 -4
index df541ab0..95f0fbde 100644
@@ -11,6 +11,8 @@
 #define DG1_MOCS_WB_IDX				5
 #define DG2_MOCS_UC_IDX				1
 #define DG2_MOCS_WB_IDX				3
+#define MTL_MOCS_UC_IDX				5
+#define MTL_MOCS_WB_IDX				10
 #define GEN12_MOCS_UC_IDX			3
 #define GEN12_MOCS_WB_IDX			2
 #define XY_BLOCK_COPY_BLT_MOCS_SHIFT		21
@@ -32,13 +34,15 @@ static void get_mocs_index(int fd, struct drm_i915_mocs_index *mocs)
 	 * This helper function is providing current UC as well
 	 * as WB MOCS index based on platform.
 	 */
-	if (IS_DG1(devid)) {
-		mocs->uc_index = DG1_MOCS_UC_IDX;
-		mocs->wb_index = DG1_MOCS_WB_IDX;
+	if (IS_METEORLAKE(devid)) {
+		mocs->uc_index = MTL_MOCS_UC_IDX;
+		mocs->wb_index = MTL_MOCS_WB_IDX;
 	} else if (IS_DG2(devid)) {
 		mocs->uc_index = DG2_MOCS_UC_IDX;
 		mocs->wb_index = DG2_MOCS_WB_IDX;
-
+	} else if (IS_DG1(devid)) {
+		mocs->uc_index = DG1_MOCS_UC_IDX;
+		mocs->wb_index = DG1_MOCS_WB_IDX;
 	} else if (IS_GEN12(devid)) {
 		mocs->uc_index = GEN12_MOCS_UC_IDX;
 		mocs->wb_index = GEN12_MOCS_WB_IDX;
Signature · 1 line
2.19.1
#5 lore raw

[igt-dev] ✗ Fi.CI.BUILD: failure for lib/igt_draw: Change MOCS settings for MTL (rev8)

In reply to Jeevan B
== Series Details ==

== Series Details ==

Series: lib/igt_draw: Change MOCS settings for MTL (rev8)
URL : https://patchwork.freedesktop.org/series/111958/
State : failure

== Summary ==

IGT patchset build failed on latest successful build 1e6d24e6dfa42b22f950f7d5e436b8f9acf8747f Update NEWS, bump version to 1.27

ninja: Entering directory `/opt/igt/build'
[1/788] Generating version.h with a custom command.
[2/785] Linking static target lib/libigt-i915_intel_decode_c.a.
[3/785] Linking static target lib/libigt-igt_device_scan_c.a.
[4/785] Linking static target lib/libigt-intel_batchbuffer_c.a.
[5/785] Linking static target lib/libigt-intel_bufops_c.a.
[6/785] Linking static target lib/libigt-rendercopy_gen6_c.a.
[7/785] Linking static target lib/libigt-rendercopy_gen7_c.a.
[8/785] Linking static target lib/libigt-rendercopy_gen8_c.a.
[9/785] Linking static target lib/libigt-rendercopy_gen9_c.a.
[10/785] Compiling C object 'lib/76b5a35@@igt-igt_draw_c@sta/igt_draw.c.o'.
FAILED: lib/76b5a35@@igt-igt_draw_c@sta/igt_draw.c.o
cc -Ilib/76b5a35@@igt-igt_draw_c@sta -Ilib -I../../../usr/src/igt-gpu-tools/lib -I../../../usr/src/igt-gpu-tools/include/drm-uapi -I../../../usr/src/igt-gpu-tools/include/linux-uapi -I../../../usr/src/igt-gpu-tools/lib/stubs/syscalls -I. -I../../../usr/src/igt-gpu-tools/ -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/libdrm -I/usr/include/x86_64-linux-gnu -I/usr/include/valgrind -I/usr/include -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=gnu11 -O2 -g -D_GNU_SOURCE -include config.h -D_FORTIFY_SOURCE=2 -Wbad-function-cast -Wdeclaration-after-statement -Wformat=2 -Wimplicit-fallthrough=0 -Wlogical-op -Wmissing-declarations -Wmissing-format-attribute -Wmissing-noreturn -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpointer-arith -Wredundant-decls -Wshadow -Wstrict-prototypes -Wuninitialized -Wunused -Wno-clobbered -Wno-maybe-uninitialized -Wno-missing-field-initializers -Wno-pointer-arith -Wno-address-of-packed-member -Wno-sign-compare -Wno-type-limits -Wno-unused-parameter -Wno-unused-result -Werror=address -Werror=array-bounds -Werror=implicit -Werror=init-self -Werror=int-to-pointer-cast -Werror=main -Werror=missing-braces -Werror=nonnull -Werror=pointer-to-int-cast -Werror=return-type -Werror=sequence-point -Werror=trigraphs -Werror=write-strings -fno-builtin-malloc -fno-builtin-calloc -fcommon -fPIC -pthread '-DIGT_DATADIR="/opt/igt/share/igt-gpu-tools"' '-DIGT_SRCDIR="/usr/src/igt-gpu-tools/tests"' '-DIGT_LOG_DOMAIN="igt_draw"' -MD -MQ 'lib/76b5a35@@igt-igt_draw_c@sta/igt_draw.c.o' -MF 'lib/76b5a35@@igt-igt_draw_c@sta/igt_draw.c.o.d' -o 'lib/76b5a35@@igt-igt_draw_c@sta/igt_draw.c.o' -c ../../../usr/src/igt-gpu-tools/lib/igt_draw.c ../../../usr/src/igt-gpu-tools/lib/igt_draw.c: In function ‘draw_rect_blt’:
../../../usr/src/igt-gpu-tools/lib/igt_draw.c:706:38: error: implicit declaration of function ‘intel_get_uc_mocs’; did you mean ‘intel_get_pci_device’? [-Werror=implicit-function-declaration]

  706 |   intel_bb_out(ibb, blt_cmd_tiling | intel_get_uc_mocs(fd) << 21 | (pitch-1));
      |                                      ^~~~~~~~~~~~~~~~~
      |                                      intel_get_pci_device

../../../usr/src/igt-gpu-tools/lib/igt_draw.c:706:38: warning: nested extern declaration of ‘intel_get_uc_mocs’ [-Wnested-externs]
cc1: some warnings being treated as errors
ninja: build stopped: subcommand failed.