From patchwork Fri Aug 12 15:07:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 9277257 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9ECAA600CB for ; Fri, 12 Aug 2016 15:07:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9132128A4B for ; Fri, 12 Aug 2016 15:07:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8624828A4E; Fri, 12 Aug 2016 15:07:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3DB5028A4B for ; Fri, 12 Aug 2016 15:07:50 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DB3C76EBD8; Fri, 12 Aug 2016 15:07:48 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wm0-x243.google.com (mail-wm0-x243.google.com [IPv6:2a00:1450:400c:c09::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id 089116EBD1 for ; Fri, 12 Aug 2016 15:07:45 +0000 (UTC) Received: by mail-wm0-x243.google.com with SMTP id o80so3399705wme.0 for ; Fri, 12 Aug 2016 08:07:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=HO7lkdpEN2Exx29MpuoPUl2pUgvE+gnrGTPipObv5kU=; b=ZXZXrg5US2VT9zCoZJEHhiqzUqrw4i+HZLzWotYyU4OC75J/BLheMSX94eUTvmAUiA M9YrkdMDn3LNB7rPdP5tFuHVU7hJJihnFW1BZleVPQp5Hk3xmN5au3sdNiKotwTyQfpK YYBFkuyzR7rJY1v4CWCBhvoMauVAN64dSHgkJu63S1uAaZgGoIl1c0O62ckBKsMoncM1 wpDpl//zoBvqBfxze59jqRrLYcHOJhhxDwom1BGFuMxxp8k7qK2psrdYTOQ7vpKXBjFf xlvC8Pi8h5T3tqCXoVTXvGOBo9MHtbtGi/Jwlii2ossVAtVFBj0RsTIk90+uN1tHnTfV cZqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=HO7lkdpEN2Exx29MpuoPUl2pUgvE+gnrGTPipObv5kU=; b=O9Ca38tVMnZGL3UI/Q8AlJXiGVa/uPt6WkVrXrE8FZnt6hiLlbuy7MA+ipsW13S6pG Okx+owrkBBED/3vE7hrbnrpAKyBoXQ0kHMHAbxg8DRjxPJ0CLLn0hOx5i2oTevEdStaR I0cARnrIDg+2IU3GSx/cWk3wEiZWoWRd0BF2VUV1JwuMnqe6uzsHAUxr+MXUpUbqXKj9 nTuUwVGhTbPbWzGUaHffZiqjeE/xqa2nmRPdKMvZaQFwuWT/BebCIJDP9jyqeWXOFQfh TueOoPtZtOn7NPjV37FNWmiVDcFZVaf1C/uQQVM7J7l48Pom08wBIPZr5l1y0+9+XgWD 1bGA== X-Gm-Message-State: AEkooutaXtT2LK21ZzosnRmqu1azz+lTrOg5JvFkWFko5GgB9+RJSzNj3nOxtk9tdUnecQ== X-Received: by 10.28.6.202 with SMTP id 193mr3792269wmg.53.1471014463648; Fri, 12 Aug 2016 08:07:43 -0700 (PDT) Received: from haswell.alporthouse.com ([78.156.65.138]) by smtp.gmail.com with ESMTPSA id w129sm2980299wmd.9.2016.08.12.08.07.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Aug 2016 08:07:42 -0700 (PDT) From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Fri, 12 Aug 2016 16:07:27 +0100 Message-Id: <1471014450-21020-7-git-send-email-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1471014450-21020-1-git-send-email-chris@chris-wilson.co.uk> References: <1471014450-21020-1-git-send-email-chris@chris-wilson.co.uk> Subject: [Intel-gfx] [PATCH 6/9] drm/i915/cmdparser: Compare against the previous command descriptor X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP On the blitter (and in test code), we see long sequences of repeated commands, e.g. XY_PIXEL_BLT, XY_SCANLINE_BLT, or XY_SRC_COPY. For these, we can skip the hashtable lookup by remembering the previous command descriptor and doing a straightforward compare of the command header. The corollary is that we need to do one extra comparison before lookup up new commands. Signed-off-by: Chris Wilson Reviewed-by: Matthew Auld --- drivers/gpu/drm/i915/i915_cmd_parser.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_cmd_parser.c b/drivers/gpu/drm/i915/i915_cmd_parser.c index 274f2136a846..3b1100a0e0cb 100644 --- a/drivers/gpu/drm/i915/i915_cmd_parser.c +++ b/drivers/gpu/drm/i915/i915_cmd_parser.c @@ -350,6 +350,9 @@ static const struct drm_i915_cmd_descriptor hsw_blt_cmds[] = { CMD( MI_LOAD_SCAN_LINES_EXCL, SMI, !F, 0x3F, R ), }; +static const struct drm_i915_cmd_descriptor noop_desc = + CMD(MI_NOOP, SMI, F, 1, S); + #undef CMD #undef SMI #undef S3D @@ -898,11 +901,14 @@ find_cmd_in_table(struct intel_engine_cs *engine, static const struct drm_i915_cmd_descriptor* find_cmd(struct intel_engine_cs *engine, u32 cmd_header, + const struct drm_i915_cmd_descriptor *desc, struct drm_i915_cmd_descriptor *default_desc) { - const struct drm_i915_cmd_descriptor *desc; u32 mask; + if (((cmd_header ^ desc->cmd.value) & desc->cmd.mask) == 0) + return desc; + desc = find_cmd_in_table(engine, cmd_header); if (desc) return desc; @@ -911,10 +917,10 @@ find_cmd(struct intel_engine_cs *engine, if (!mask) return NULL; - BUG_ON(!default_desc); - default_desc->flags = CMD_DESC_SKIP; + default_desc->cmd.value = cmd_header; + default_desc->cmd.mask = 0xffff0000; default_desc->length.mask = mask; - + default_desc->flags = CMD_DESC_SKIP; return default_desc; } @@ -1165,7 +1171,8 @@ int intel_engine_cmd_parser(struct intel_engine_cs *engine, bool is_master) { u32 *cmd, *batch_end; - struct drm_i915_cmd_descriptor default_desc = { 0 }; + struct drm_i915_cmd_descriptor default_desc = noop_desc; + const struct drm_i915_cmd_descriptor *desc = &default_desc; bool oacontrol_set = false; /* OACONTROL tracking. See check_cmd() */ bool needs_clflush_after = false; int ret = 0; @@ -1185,13 +1192,12 @@ int intel_engine_cmd_parser(struct intel_engine_cs *engine, */ batch_end = cmd + (batch_len / sizeof(*batch_end)); while (cmd < batch_end) { - const struct drm_i915_cmd_descriptor *desc; u32 length; if (*cmd == MI_BATCH_BUFFER_END) break; - desc = find_cmd(engine, *cmd, &default_desc); + desc = find_cmd(engine, *cmd, desc, &default_desc); if (!desc) { DRM_DEBUG_DRIVER("CMD: Unrecognized command: 0x%08X\n", *cmd);