mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2026-08-11 16:32:58 +00:00
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:
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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 *);
|
||||
|
||||
Reference in New Issue
Block a user