From 2607dad20b8dffce96608103def75d26ea0e42b2 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 1 Aug 2012 16:43:16 -0700 Subject: [PATCH] intel: Add a function for the new register read ioctl. Reviewed-by: Ben Widawsky --- intel/intel_bufmgr.h | 3 +++ intel/intel_bufmgr_gem.c | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/intel/intel_bufmgr.h b/intel/intel_bufmgr.h index 2167e43..8d7f239 100644 --- a/intel/intel_bufmgr.h +++ b/intel/intel_bufmgr.h @@ -241,6 +241,9 @@ void drm_intel_decode_set_head_tail(struct drm_intel_decode *ctx, void drm_intel_decode_set_output_file(struct drm_intel_decode *ctx, FILE *out); void drm_intel_decode(struct drm_intel_decode *ctx); +int drm_intel_reg_read(drm_intel_bufmgr *bufmgr, + uint32_t offset, + uint64_t *result); /** @{ Compatibility defines to keep old code building despite the symbol rename * from dri_* to drm_intel_* diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c index ec64e0a..0ea6260 100644 --- a/intel/intel_bufmgr_gem.c +++ b/intel/intel_bufmgr_gem.c @@ -2947,6 +2947,24 @@ drm_intel_gem_context_destroy(drm_intel_context *ctx) free(ctx); } +int +drm_intel_reg_read(drm_intel_bufmgr *bufmgr, + uint32_t offset, + uint64_t *result) +{ + drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *)bufmgr; + struct drm_i915_reg_read reg_read; + int ret; + + VG_CLEAR(reg_read); + reg_read.offset = offset; + + ret = drmIoctl(bufmgr_gem->fd, DRM_IOCTL_I915_REG_READ, ®_read); + + *result = reg_read.val; + return ret; +} + /** * Annotate the given bo for use in aub dumping. -- 2.7.4