iris: magic number 36 -> #define

This commit is contained in:
Kenneth Graunke 2018-09-29 10:47:01 +02:00
parent 57f8a623c5
commit 0395eba20f
2 changed files with 5 additions and 6 deletions

View 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:

View 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;
}