intel_reg_dumper: Add support for reading register dumps from files

Also add intel_reg_snapshot for creating such snapshots, and relevant
documentation.

Signed-off-by: Adam Jackson <ajax@redhat.com>
This commit is contained in:
Adam Jackson
2010-03-31 17:25:23 -04:00
parent 2187ec2112
commit cd64e19329
7 changed files with 109 additions and 5 deletions
+27
View File
@@ -25,12 +25,17 @@
*
*/
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <err.h>
#include <assert.h>
#include <sys/ioctl.h>
#include <sys/fcntl.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include "intel_gpu_tools.h"
#include "i915_drm.h"
#include "intel_batchbuffer.h"
@@ -82,6 +87,28 @@ intel_get_pci_device(void)
devid = pci_dev->device_id;
}
void
intel_map_file(char *file)
{
int fd;
struct stat st;
fd = open(file, O_RDWR);
if (fd == -1) {
fprintf(stderr, "Couldn't open %s: %s\n", file,
strerror(errno));
exit(1);
}
fstat(fd, &st);
mmio = mmap(NULL, st.st_size, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0);
if (mmio == MAP_FAILED) {
fprintf(stderr, "Couldn't mmap %s: %s\n", file,
strerror(errno));
exit(1);
}
close(fd);
}
void
intel_get_mmio(void)
{
+1
View File
@@ -56,3 +56,4 @@ void intel_get_drm_devid(int fd);
void intel_copy_bo(struct intel_batchbuffer *batch,
drm_intel_bo *dst_bo, drm_intel_bo *src_bo,
int width, int height);
void intel_map_file(char *);