dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Grazvydas Ignotas <notasas@gmail.com>
To: dri-devel@lists.freedesktop.org
Subject: [PATCH 3/4] drm/radeon: refactor register check loop
Date: Sun, 23 Aug 2015 03:57:37 +0300	[thread overview]
Message-ID: <1440291458-11602-4-git-send-email-notasas@gmail.com> (raw)
In-Reply-To: <1440291458-11602-1-git-send-email-notasas@gmail.com>

After this patch the register check loop does the same thing as before,
except that now gcc does better job optimizing it: it now sees that
end_reg was already checked against PACKET3_SET_CONTEXT_REG_END and can
optimize REG_SAFE_BM_SIZE comparison out of evergreen_is_safe_reg()
as (PACKET3_SET_CONTEXT_REG_END >> 7) < REG_SAFE_BM_SIZE.

Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
---
 drivers/gpu/drm/radeon/evergreen_cs.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/radeon/evergreen_cs.c b/drivers/gpu/drm/radeon/evergreen_cs.c
index 4453799..e31076e 100644
--- a/drivers/gpu/drm/radeon/evergreen_cs.c
+++ b/drivers/gpu/drm/radeon/evergreen_cs.c
@@ -2299,11 +2299,10 @@ static int evergreen_packet3_check(struct radeon_cs_parser *p,
 			DRM_ERROR("bad PACKET3_SET_CONFIG_REG\n");
 			return -EINVAL;
 		}
-		for (i = 0; i < pkt->count; i++) {
-			reg = start_reg + (4 * i);
+		for (reg = start_reg, idx++; reg <= end_reg; reg += 4, idx++) {
 			if (evergreen_is_safe_reg(p, reg))
 				continue;
-			r = evergreen_cs_handle_reg(p, reg, idx + 1 + i);
+			r = evergreen_cs_handle_reg(p, reg, idx);
 			if (r)
 				return r;
 		}
@@ -2317,11 +2316,10 @@ static int evergreen_packet3_check(struct radeon_cs_parser *p,
 			DRM_ERROR("bad PACKET3_SET_CONTEXT_REG\n");
 			return -EINVAL;
 		}
-		for (i = 0; i < pkt->count; i++) {
-			reg = start_reg + (4 * i);
+		for (reg = start_reg, idx++; reg <= end_reg; reg += 4, idx++) {
 			if (evergreen_is_safe_reg(p, reg))
 				continue;
-			r = evergreen_cs_handle_reg(p, reg, idx + 1 + i);
+			r = evergreen_cs_handle_reg(p, reg, idx);
 			if (r)
 				return r;
 		}
-- 
1.9.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2015-08-23  0:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-23  0:57 [PATCH 0/4] some optimization for evergreen cs Grazvydas Ignotas
2015-08-23  0:57 ` [PATCH 1/4] drm/radeon: simplify register checker Grazvydas Ignotas
2015-08-23  0:57 ` [PATCH 2/4] drm/radeon: split evergreen_cs_check_reg Grazvydas Ignotas
2015-08-23  0:57 ` Grazvydas Ignotas [this message]
2015-08-23  0:57 ` [PATCH 4/4] drm/radeon: remove volatile qualifier Grazvydas Ignotas
2015-09-22 23:03 ` [PATCH 0/4] some optimization for evergreen cs Grazvydas Ignotas
2015-09-23  6:59   ` Dave Airlie
2015-09-23 21:54     ` Alex Deucher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1440291458-11602-4-git-send-email-notasas@gmail.com \
    --to=notasas@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox