Revert "drm/i915: Skip over MI_NOOP when parsing"

This reverts a6c5e2aea7 ("drm/i915: Skip over MI_NOOP when parsing").
It complicates the batch parsing code a bit and increases indentation
for no reason other than fast-skipping a command that userspace uses
only rarely.  Sure, there may be IGT tests that fill batches with NOOPs
but that's not a case we should optimize for in the kernel.  We should
optimize for code clarity instead.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Jon Bloomfield <jon.bloomfield@intel.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20210714193419.1459723-6-jason@jlekstrand.net
This commit is contained in:
Jason Ekstrand 2021-07-14 14:34:19 -05:00 committed by Daniel Vetter
parent dc194184d0
commit 0c6609bb20

View file

@ -1470,10 +1470,12 @@ 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);
while (*cmd != MI_BATCH_BUFFER_END) {
u32 length = 1;
do {
u32 length;
if (*cmd == MI_BATCH_BUFFER_END)
break;
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);
@ -1506,7 +1508,6 @@ 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);
@ -1518,7 +1519,7 @@ int intel_engine_cmd_parser(struct intel_engine_cs *engine,
ret = -EINVAL;
break;
}
}
} while (1);
if (trampoline) {
/*