From 0395eba20f1e370e584e99dd337b8560cd90ee5e Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Sat, 29 Sep 2018 10:47:01 +0200 Subject: [PATCH] iris: magic number 36 -> #define --- src/gallium/drivers/iris/iris_query.c | 8 +++----- src/gallium/drivers/iris/iris_screen.c | 3 ++- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/gallium/drivers/iris/iris_query.c b/src/gallium/drivers/iris/iris_query.c index 6e7b0057817..b9a7823afe9 100644 --- a/src/gallium/drivers/iris/iris_query.c +++ b/src/gallium/drivers/iris/iris_query.c @@ -88,7 +88,6 @@ #define MI_ALU2(op, x, y) \ ((MI_ALU_##op << 20) | (MI_ALU_##x << 10) | (MI_ALU_##y)) - struct iris_query { enum pipe_query_type type; int index; @@ -248,13 +247,12 @@ static uint64_t iris_raw_timestamp_delta(uint64_t time0, uint64_t time1) { if (time0 > time1) { - return (1ULL << 36) + time1 - time0; + return (1ULL << TIMESTAMP_BITS) + time1 - time0; } else { return time1 - time0; } } - static void calculate_result_on_cpu(const struct gen_device_info *devinfo, struct iris_query *q) @@ -268,12 +266,12 @@ calculate_result_on_cpu(const struct gen_device_info *devinfo, case PIPE_QUERY_TIMESTAMP_DISJOINT: /* The timestamp is the single starting snapshot. */ q->result = iris_timebase_scale(devinfo, q->map->start); - q->result &= (1ull << 36) - 1; + q->result &= (1ull << TIMESTAMP_BITS) - 1; break; case PIPE_QUERY_TIME_ELAPSED: q->result = iris_raw_timestamp_delta(q->map->start, q->map->end); q->result = iris_timebase_scale(devinfo, q->result); - q->result &= (1ull << 36) - 1; + q->result &= (1ull << TIMESTAMP_BITS) - 1; break; case PIPE_QUERY_OCCLUSION_COUNTER: case PIPE_QUERY_PRIMITIVES_GENERATED: diff --git a/src/gallium/drivers/iris/iris_screen.c b/src/gallium/drivers/iris/iris_screen.c index ca670dc8a33..af0790e5edf 100644 --- a/src/gallium/drivers/iris/iris_screen.c +++ b/src/gallium/drivers/iris/iris_screen.c @@ -43,6 +43,7 @@ #include "util/ralloc.h" #include "drm-uapi/i915_drm.h" #include "iris_context.h" +#include "iris_defines.h" #include "iris_pipe.h" #include "iris_resource.h" #include "iris_screen.h" @@ -381,7 +382,7 @@ iris_get_timestamp(struct pipe_screen *pscreen) iris_reg_read(screen->bufmgr, TIMESTAMP | 1, &result); result = iris_timebase_scale(&screen->devinfo, result); - result &= (1ull << 36) - 1; + result &= (1ull << TIMESTAMP_BITS) - 1; return result; } -- 2.30.2