Skip to content

Commit db47685

Browse files
yanzhao56zhenyw
authored andcommitted
drm/i915/gvt: add a fastpath for cmd parsing on MI_NOOP
MI_NOOP is a common command appearing in almost all command buffers, put it into a fastpath can improve perfomance, especially in command buffers contains lots of MI_NOOPs (0s). Take glmark2 as an example, 3% performance increase is observed after introduced this patch. Meanwhile, in case where abundant in MI_NOOPs, up to 12% performance increase is measured. v2: use lowercase for index of MI_NOOP in cmd_info (zhenyu wang) Signed-off-by: Li Weinan <weinan.z.li@intel.com> Signed-off-by: Zhao Yan <yan.y.zhao@intel.com> Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
1 parent 279ce5d commit db47685

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

‎drivers/gpu/drm/i915/gvt/cmd_parser.c‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1817,6 +1817,8 @@ static int cmd_handler_mi_batch_buffer_start(struct parser_exec_state *s)
18171817
return ret;
18181818
}
18191819

1820+
static int mi_noop_index;
1821+
18201822
static struct cmd_info cmd_info[] = {
18211823
{"MI_NOOP", OP_MI_NOOP, F_LEN_CONST, R_ALL, D_ALL, 0, 1, NULL},
18221824

@@ -2502,7 +2504,12 @@ static int cmd_parser_exec(struct parser_exec_state *s)
25022504

25032505
cmd = cmd_val(s, 0);
25042506

2505-
info = get_cmd_info(s->vgpu->gvt, cmd, s->ring_id);
2507+
/* fastpath for MI_NOOP */
2508+
if (cmd == MI_NOOP)
2509+
info = &cmd_info[mi_noop_index];
2510+
else
2511+
info = get_cmd_info(s->vgpu->gvt, cmd, s->ring_id);
2512+
25062513
if (info == NULL) {
25072514
gvt_vgpu_err("unknown cmd 0x%x, opcode=0x%x, addr_type=%s, ring %d, workload=%p\n",
25082515
cmd, get_opcode(cmd, s->ring_id),
@@ -2904,6 +2911,8 @@ static int init_cmd_table(struct intel_gvt *gvt)
29042911
info->name);
29052912
return -EEXIST;
29062913
}
2914+
if (cmd_info[i].opcode == OP_MI_NOOP)
2915+
mi_noop_index = i;
29072916

29082917
INIT_HLIST_NODE(&e->hlist);
29092918
add_cmd_entry(gvt, e);

0 commit comments

Comments
 (0)