Commit a6c5e2ae authored by Chris Wilson's avatar Chris Wilson
Browse files

drm/i915: Skip over MI_NOOP when parsing



Though less likely in practice, igt uses MI_NOOP frequently to pad out
its batch buffers. The lookup and valiation of so many MI_NOOP command
descriptions is noticeable, though the side-effect of poisoning the
last-validated-command cache is more likely to impact upon real CS.

Testcase: igt/gen9_exec_parse/bb-large
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: default avatarJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201001102632.18789-1-chris@chris-wilson.co.uk
parent b0573472
Loading
Loading
Loading
Loading
+33 −34
Original line number Diff line number Diff line
@@ -1452,12 +1452,10 @@ int intel_engine_cmd_parser(struct intel_engine_cs *engine,
	 * space. Parsing should be faster in some cases this way.
	 */
	batch_end = cmd + batch_length / sizeof(*batch_end);
	do {
		u32 length;

		if (*cmd == MI_BATCH_BUFFER_END)
			break;
	while (*cmd != MI_BATCH_BUFFER_END) {
		u32 length = 1;

		if (*cmd != MI_NOOP) { /* MI_NOOP == 0 */
			desc = find_cmd(engine, *cmd, desc, &default_desc);
			if (!desc) {
				DRM_DEBUG("CMD: Unrecognized command: 0x%08X\n", *cmd);
@@ -1490,6 +1488,7 @@ int intel_engine_cmd_parser(struct intel_engine_cs *engine,
						    jump_whitelist);
				break;
			}
		}

		if (!IS_ERR_OR_NULL(jump_whitelist))
			__set_bit(offset, jump_whitelist);
@@ -1501,7 +1500,7 @@ int intel_engine_cmd_parser(struct intel_engine_cs *engine,
			ret = -EINVAL;
			break;
		}
	} while (1);
	}

	if (trampoline) {
		/*