iris: magic number 36 -> #define
authorKenneth Graunke <kenneth@whitecape.org>
Sat, 29 Sep 2018 08:47:01 +0000 (10:47 +0200)
committerKenneth Graunke <kenneth@whitecape.org>
Thu, 21 Feb 2019 18:26:08 +0000 (10:26 -0800)
src/gallium/drivers/iris/iris_query.c
src/gallium/drivers/iris/iris_screen.c

index 6e7b00578173637884e264e58bb036fb7711c025..b9a7823afe913d79ac4dc1065f4f597cd0147b75 100644 (file)
@@ -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:
index ca670dc8a335ac2092cecf2d3cce06e2391f48d2..af0790e5edfe64c354dae29c5dea801022a4744d 100644 (file)
@@ -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;
 }