diff options
author | Grazvydas Ignotas <notasas@gmail.com> | 2015-08-23 03:57:37 +0300 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2015-10-02 23:08:29 +0300 |
commit | 7874d3901d752dc9ea31bbb32f519bc9a2c1b6aa (patch) | |
tree | 65848310ebfede783e44a96da8b210602c5da084 /drivers/gpu/drm/radeon | |
parent | e5b69da6badca8286a67c1d0d1c6634e65c7e669 (diff) | |
download | linux-7874d3901d752dc9ea31bbb32f519bc9a2c1b6aa.tar.xz |
drm/radeon: refactor register check loop
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.
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/radeon')
-rw-r--r-- | drivers/gpu/drm/radeon/evergreen_cs.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/gpu/drm/radeon/evergreen_cs.c b/drivers/gpu/drm/radeon/evergreen_cs.c index 4453799fb676..e31076eae73c 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; } |