aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorLionel Landwerlin <[email protected]>2018-06-08 17:51:33 +0100
committerLionel Landwerlin <[email protected]>2019-04-17 14:10:42 +0100
commit2be07fc7517c624b0048e512f50280696e3f069c (patch)
treecb1575d492e6e8d4d7498d1b51e567b573d56ab1 /src/mesa
parent41b54b5faf27632d1a70145880b474fbaeabbb2d (diff)
i965: move brw_timebase_scale to device info
Signed-off-by: Lionel Landwerlin <[email protected]> Reviewed-by: Mark Janes <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/i965/brw_context.h1
-rw-r--r--src/mesa/drivers/dri/i965/brw_performance_query.c8
-rw-r--r--src/mesa/drivers/dri/i965/brw_performance_query_mdapi.c6
-rw-r--r--src/mesa/drivers/dri/i965/brw_queryobj.c15
-rw-r--r--src/mesa/drivers/dri/i965/gen6_queryobj.c4
5 files changed, 15 insertions, 19 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index 23048428f3e..46791c7d2c8 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -1333,7 +1333,6 @@ void brw_emit_query_begin(struct brw_context *brw);
void brw_emit_query_end(struct brw_context *brw);
void brw_query_counter(struct gl_context *ctx, struct gl_query_object *q);
bool brw_is_query_pipelined(struct brw_query_object *query);
-uint64_t brw_timebase_scale(struct brw_context *brw, uint64_t gpu_timestamp);
uint64_t brw_raw_timestamp_delta(struct brw_context *brw,
uint64_t time0, uint64_t time1);
diff --git a/src/mesa/drivers/dri/i965/brw_performance_query.c b/src/mesa/drivers/dri/i965/brw_performance_query.c
index d3ae3c114f8..b3b34a82da7 100644
--- a/src/mesa/drivers/dri/i965/brw_performance_query.c
+++ b/src/mesa/drivers/dri/i965/brw_performance_query.c
@@ -786,14 +786,18 @@ accumulate_oa_reports(struct brw_context *brw,
/* Ignore reports that come before the start marker.
* (Note: takes care to allow overflow of 32bit timestamps)
*/
- if (brw_timebase_scale(brw, report[1] - start[1]) > 5000000000)
+ if (gen_device_info_timebase_scale(devinfo,
+ report[1] - start[1]) > 5000000000) {
continue;
+ }
/* Ignore reports that come after the end marker.
* (Note: takes care to allow overflow of 32bit timestamps)
*/
- if (brw_timebase_scale(brw, report[1] - end[1]) <= 5000000000)
+ if (gen_device_info_timebase_scale(devinfo,
+ report[1] - end[1]) <= 5000000000) {
goto end;
+ }
/* For Gen8+ since the counters continue while other
* contexts are running we need to discount any unrelated
diff --git a/src/mesa/drivers/dri/i965/brw_performance_query_mdapi.c b/src/mesa/drivers/dri/i965/brw_performance_query_mdapi.c
index 159f31441c5..919069f9e39 100644
--- a/src/mesa/drivers/dri/i965/brw_performance_query_mdapi.c
+++ b/src/mesa/drivers/dri/i965/brw_performance_query_mdapi.c
@@ -54,7 +54,7 @@ brw_perf_query_get_mdapi_oa_data(struct brw_context *brw,
}
mdapi_data->ReportsCount = result->reports_accumulated;
- mdapi_data->TotalTime = brw_timebase_scale(brw, result->accumulator[0]);
+ mdapi_data->TotalTime = gen_device_info_timebase_scale(devinfo, result->accumulator[0]);
mdapi_data->CoreFrequency = obj->oa.gt_frequency[1];
mdapi_data->CoreFrequencyChanged = obj->oa.gt_frequency[0] != obj->oa.gt_frequency[1];
return sizeof(*mdapi_data);
@@ -74,7 +74,7 @@ brw_perf_query_get_mdapi_oa_data(struct brw_context *brw,
mdapi_data->ReportId = result->hw_id;
mdapi_data->ReportsCount = result->reports_accumulated;
- mdapi_data->TotalTime = brw_timebase_scale(brw, result->accumulator[0]);
+ mdapi_data->TotalTime = gen_device_info_timebase_scale(devinfo, result->accumulator[0]);
mdapi_data->GPUTicks = result->accumulator[1];
mdapi_data->CoreFrequency = obj->oa.gt_frequency[1];
mdapi_data->CoreFrequencyChanged = obj->oa.gt_frequency[0] != obj->oa.gt_frequency[1];
@@ -100,7 +100,7 @@ brw_perf_query_get_mdapi_oa_data(struct brw_context *brw,
mdapi_data->ReportId = result->hw_id;
mdapi_data->ReportsCount = result->reports_accumulated;
- mdapi_data->TotalTime = brw_timebase_scale(brw, result->accumulator[0]);
+ mdapi_data->TotalTime = gen_device_info_timebase_scale(devinfo, result->accumulator[0]);
mdapi_data->GPUTicks = result->accumulator[1];
mdapi_data->CoreFrequency = obj->oa.gt_frequency[1];
mdapi_data->CoreFrequencyChanged = obj->oa.gt_frequency[0] != obj->oa.gt_frequency[1];
diff --git a/src/mesa/drivers/dri/i965/brw_queryobj.c b/src/mesa/drivers/dri/i965/brw_queryobj.c
index bc4b8c43e7b..1fb809cab8f 100644
--- a/src/mesa/drivers/dri/i965/brw_queryobj.c
+++ b/src/mesa/drivers/dri/i965/brw_queryobj.c
@@ -42,14 +42,6 @@
#include "brw_state.h"
#include "intel_batchbuffer.h"
-uint64_t
-brw_timebase_scale(struct brw_context *brw, uint64_t gpu_timestamp)
-{
- const struct gen_device_info *devinfo = &brw->screen->devinfo;
-
- return (1000000000ull * gpu_timestamp) / devinfo->timestamp_frequency;
-}
-
/* As best we know currently, the Gen HW timestamps are 36bits across
* all platforms, which we need to account for when calculating a
* delta to measure elapsed time.
@@ -164,12 +156,12 @@ brw_queryobj_get_results(struct gl_context *ctx,
* Subtract the two and convert to nanoseconds.
*/
query->Base.Result = brw_raw_timestamp_delta(brw, results[0], results[1]);
- query->Base.Result = brw_timebase_scale(brw, query->Base.Result);
+ query->Base.Result = gen_device_info_timebase_scale(devinfo, query->Base.Result);
break;
case GL_TIMESTAMP:
/* The query BO contains a single timestamp value in results[0]. */
- query->Base.Result = brw_timebase_scale(brw, results[0]);
+ query->Base.Result = gen_device_info_timebase_scale(devinfo, results[0]);
/* Ensure the scaled timestamp overflows according to
* GL_QUERY_COUNTER_BITS
@@ -547,6 +539,7 @@ static uint64_t
brw_get_timestamp(struct gl_context *ctx)
{
struct brw_context *brw = brw_context(ctx);
+ const struct gen_device_info *devinfo = &brw->screen->devinfo;
uint64_t result = 0;
switch (brw->screen->hw_has_timestamp) {
@@ -563,7 +556,7 @@ brw_get_timestamp(struct gl_context *ctx)
}
/* Scale to nanosecond units */
- result = brw_timebase_scale(brw, result);
+ result = gen_device_info_timebase_scale(devinfo, result);
/* Ensure the scaled timestamp overflows according to
* GL_QUERY_COUNTER_BITS. Technically this isn't required if
diff --git a/src/mesa/drivers/dri/i965/gen6_queryobj.c b/src/mesa/drivers/dri/i965/gen6_queryobj.c
index ce9bb474e18..ada28a4a824 100644
--- a/src/mesa/drivers/dri/i965/gen6_queryobj.c
+++ b/src/mesa/drivers/dri/i965/gen6_queryobj.c
@@ -236,12 +236,12 @@ gen6_queryobj_get_results(struct gl_context *ctx,
* Subtract the two and convert to nanoseconds.
*/
query->Base.Result = brw_raw_timestamp_delta(brw, results[0], results[1]);
- query->Base.Result = brw_timebase_scale(brw, query->Base.Result);
+ query->Base.Result = gen_device_info_timebase_scale(devinfo, query->Base.Result);
break;
case GL_TIMESTAMP:
/* The query BO contains a single timestamp value in results[0]. */
- query->Base.Result = brw_timebase_scale(brw, results[0]);
+ query->Base.Result = gen_device_info_timebase_scale(devinfo, results[0]);
/* Ensure the scaled timestamp overflows according to
* GL_QUERY_COUNTER_BITS