intel: Add a function for the new register read ioctl.
authorEric Anholt <eric@anholt.net>
Wed, 1 Aug 2012 23:43:16 +0000 (16:43 -0700)
committerEric Anholt <eric@anholt.net>
Fri, 10 Aug 2012 16:48:07 +0000 (09:48 -0700)
Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
intel/intel_bufmgr.h
intel/intel_bufmgr_gem.c

index 2167e43bbe6bb1700c2aaf4bcd9519d8b3f62d3f..8d7f2390d246f34978b74ae690027248bbb6e122 100644 (file)
@@ -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_*
index ec64e0a3584d80f978cb54a979030ce4cd0dee7c..0ea6260d7d9888091c9ef3d4985eb94bf91a8606 100644 (file)
@@ -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, &reg_read);
+
+       *result = reg_read.val;
+       return ret;
+}
+
 
 /**
  * Annotate the given bo for use in aub dumping.