diff options
author | Tvrtko Ursulin <tvrtko.ursulin@intel.com> | 2017-11-24 17:16:18 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2017-11-24 21:38:26 +0000 |
commit | 4c57ff468fa48707777184b3da56432602f967af (patch) | |
tree | 34f2f956a28ca50a151090c4dd8ebb8688e72eae /overlay/rc6.c | |
parent | c6577473df7117b7a6e030605df1e28cd0e55708 (diff) |
intel/pmu: Catch-up with i915 RC6 aggregation changes
Since i915 PMU is removing separate RC6 counters and now aggregates all
under a single one, catch up the test and intel-gpu-overlay with those
changes.
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'overlay/rc6.c')
-rw-r--r-- | overlay/rc6.c | 45 |
1 files changed, 7 insertions, 38 deletions
diff --git a/overlay/rc6.c b/overlay/rc6.c index 8977f099..b5286f0c 100644 --- a/overlay/rc6.c +++ b/overlay/rc6.c @@ -35,34 +35,12 @@ #include "rc6.h" -#define RC6 (1<<0) -#define RC6p (1<<1) -#define RC6pp (1<<2) - -static int perf_open(unsigned *flags) -{ - int fd; - - fd = perf_i915_open_group(I915_PMU_RC6_RESIDENCY, -1); - if (fd < 0) - return -1; - - *flags |= RC6; - if (perf_i915_open_group(I915_PMU_RC6p_RESIDENCY, fd) >= 0) - *flags |= RC6p; - - if (perf_i915_open_group(I915_PMU_RC6pp_RESIDENCY, fd) >= 0) - *flags |= RC6pp; - - return fd; -} - int rc6_init(struct rc6 *rc6) { memset(rc6, 0, sizeof(*rc6)); - rc6->fd = perf_open(&rc6->flags); - if (rc6->fd == -1) { + rc6->fd = perf_i915_open(I915_PMU_RC6_RESIDENCY); + if (rc6->fd < 0) { struct stat st; if (stat("/sys/class/drm/card0/power", &st) < 0) return rc6->error = errno; @@ -110,7 +88,7 @@ int rc6_update(struct rc6 *rc6) if (rc6->error) return rc6->error; - if (rc6->fd == -1) { + if (rc6->fd < 0) { struct stat st; if (stat("/sys/class/drm/card0/power/rc6_residency_ms", &st) < 0) @@ -121,22 +99,13 @@ int rc6_update(struct rc6 *rc6) s->rc6pp_residency = file_to_u64("/sys/class/drm/card0/power/rc6pp_residency_ms"); s->timestamp = clock_ms_to_u64(); } else { - uint64_t data[5]; - int len; + uint64_t data[2]; - len = read(rc6->fd, data, sizeof(data)); - if (len < 0) + if (read(rc6->fd, data, sizeof(data)) < sizeof(data)) return rc6->error = errno; - s->timestamp = data[1] / (1000*1000); - - len = 2; - if (rc6->flags & RC6) - s->rc6_residency = data[len++] / 1e6; - if (rc6->flags & RC6p) - s->rc6p_residency = data[len++] / 1e6; - if (rc6->flags & RC6pp) - s->rc6pp_residency = data[len++] / 1e6; + s->timestamp = data[1] / 1e6; + s->rc6_residency = data[0] / 1e6; } if (rc6->count == 1) |