mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2026-08-20 21:02:59 +00:00
Enable compilation on non-Intel, non-DRM systems.
A few of the tools can be performed post-mortem from a different system, so it is useful to be able to compile those tools on those foreign systems. Obviously, any program to interact with the PCI device or talk to GEM will fail on a non-Intel system. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
@@ -38,6 +38,7 @@
|
||||
#include <fcntl.h>
|
||||
#include <getopt.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include "intel_gpu_tools.h"
|
||||
|
||||
#define AUD_CONFIG 0x62000
|
||||
@@ -187,7 +188,8 @@ int main(int argc, char **argv)
|
||||
int i;
|
||||
|
||||
do_self_tests();
|
||||
intel_get_mmio();
|
||||
|
||||
intel_get_mmio(intel_get_pci_device());
|
||||
|
||||
/* printf("%-18s %8s %s\n\n", "register name", "raw value", "description"); */
|
||||
|
||||
|
||||
@@ -55,9 +55,15 @@
|
||||
#include "instdone.h"
|
||||
|
||||
static void
|
||||
print_instdone (unsigned int instdone, unsigned int instdone1)
|
||||
print_instdone (uint32_t devid, unsigned int instdone, unsigned int instdone1)
|
||||
{
|
||||
int i;
|
||||
static int once;
|
||||
|
||||
if (!once) {
|
||||
init_instdone_definitions(devid);
|
||||
once = 1;
|
||||
}
|
||||
|
||||
for (i = 0; i < num_instdone_bits; i++) {
|
||||
int busy = 0;
|
||||
@@ -190,11 +196,11 @@ read_data_file (const char * filename)
|
||||
|
||||
matched = sscanf (line, " INSTDONE: 0x%08x\n", ®);
|
||||
if (matched)
|
||||
print_instdone (reg, -1);
|
||||
print_instdone (devid, reg, -1);
|
||||
|
||||
matched = sscanf (line, " INSTDONE1: 0x%08x\n", ®);
|
||||
if (matched)
|
||||
print_instdone (-1, reg);
|
||||
print_instdone (devid, -1, reg);
|
||||
|
||||
continue;
|
||||
}
|
||||
@@ -247,8 +253,6 @@ main (int argc, char *argv[])
|
||||
return 1;
|
||||
}
|
||||
|
||||
init_instdone_definitions();
|
||||
|
||||
if (argc == 1) {
|
||||
path = "/debug/dri/0";
|
||||
err = stat (path, &st);
|
||||
|
||||
+10
-6
@@ -92,7 +92,7 @@ print_instdone (unsigned int instdone, unsigned int instdone1)
|
||||
* exit()).
|
||||
*/
|
||||
static void
|
||||
read_data_file (const char * filename, int is_batch)
|
||||
read_data_file (uint32_t devid, const char * filename, int is_batch)
|
||||
{
|
||||
FILE *file;
|
||||
uint32_t *data = NULL;
|
||||
@@ -250,7 +250,9 @@ main (int argc, char *argv[])
|
||||
const char *path;
|
||||
struct stat st;
|
||||
int err;
|
||||
uint32_t devid;
|
||||
uint32_t instdone, instdone1 = 0;
|
||||
struct pci_device *pci_dev;
|
||||
|
||||
if (argc > 2) {
|
||||
fprintf (stderr,
|
||||
@@ -271,8 +273,10 @@ main (int argc, char *argv[])
|
||||
return 1;
|
||||
}
|
||||
|
||||
intel_get_mmio();
|
||||
init_instdone_definitions();
|
||||
pci_dev = intel_get_pci_device();
|
||||
devid = pci_dev->device_id;
|
||||
intel_get_mmio(pci_dev);
|
||||
init_instdone_definitions(devid);
|
||||
|
||||
if (argc == 1) {
|
||||
path = "/debug/dri/0";
|
||||
@@ -352,7 +356,7 @@ main (int argc, char *argv[])
|
||||
|
||||
asprintf (&filename, "%s/i915_batchbuffers", path);
|
||||
intel_decode_context_set_head_tail(acthd, 0xffffffff);
|
||||
read_data_file (filename, 1);
|
||||
read_data_file (devid, filename, 1);
|
||||
free (filename);
|
||||
|
||||
asprintf (&filename, "%s/i915_ringbuffer_data", path);
|
||||
@@ -360,10 +364,10 @@ main (int argc, char *argv[])
|
||||
printf("Ringbuffer: ");
|
||||
printf("Reminder: head pointer is GPU read, tail pointer is CPU "
|
||||
"write\n");
|
||||
read_data_file (filename, 0);
|
||||
read_data_file (devid, filename, 0);
|
||||
free (filename);
|
||||
} else {
|
||||
read_data_file (path, 1);
|
||||
read_data_file (devid, path, 1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -65,7 +65,7 @@ int main(int argc, char **argv)
|
||||
static struct rusage rusage;
|
||||
int status;
|
||||
|
||||
intel_get_mmio();
|
||||
intel_get_mmio(intel_get_pci_device());
|
||||
|
||||
if (argc == 1) {
|
||||
fprintf(stderr, "usage: %s cmd [args...]\n", argv[0]);
|
||||
|
||||
+10
-4
@@ -137,8 +137,9 @@ print_clock(char *name, int clock) {
|
||||
}
|
||||
|
||||
static int
|
||||
print_clock_info(void)
|
||||
print_clock_info(struct pci_device *pci_dev)
|
||||
{
|
||||
uint32_t devid = pci_dev->device_id;
|
||||
uint16_t gcfgc;
|
||||
|
||||
if (IS_GM45(devid)) {
|
||||
@@ -284,11 +285,16 @@ print_percentage_bar(float percent, int cur_line_len)
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
intel_get_mmio();
|
||||
struct pci_device *pci_dev;
|
||||
uint32_t ring_size;
|
||||
uint32_t devid;
|
||||
int i;
|
||||
|
||||
init_instdone_definitions();
|
||||
pci_dev = intel_get_pci_device();
|
||||
devid = pci_dev->device_id;
|
||||
intel_get_mmio(pci_dev);
|
||||
init_instdone_definitions(devid);
|
||||
|
||||
for (i = 0; i < num_instdone_bits; i++) {
|
||||
top_bits[i].bit = &instdone_bits[i];
|
||||
top_bits[i].count = 0;
|
||||
@@ -362,7 +368,7 @@ int main(int argc, char **argv)
|
||||
|
||||
printf("%s", clear_screen);
|
||||
|
||||
print_clock_info();
|
||||
print_clock_info(pci_dev);
|
||||
|
||||
percent = ring_idle / SAMPLES_TO_PERCENT_RATIO;
|
||||
len = printf("%30s: %3d%%: ", "ring idle", percent);
|
||||
|
||||
+5
-1
@@ -42,10 +42,14 @@
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
struct pci_device *pci_dev;
|
||||
int start, aper_size;
|
||||
unsigned char *gtt;
|
||||
uint32_t devid;
|
||||
|
||||
intel_get_mmio();
|
||||
pci_dev = intel_get_pci_device();
|
||||
devid = pci_dev->device_id;
|
||||
intel_get_mmio(pci_dev);
|
||||
|
||||
if (!IS_9XX(devid)) {
|
||||
printf("Unsupported chipset for gtt dumper\n");
|
||||
|
||||
+1
-1
@@ -117,7 +117,7 @@ int main(int argc, char **argv)
|
||||
{
|
||||
int swf14, acpi_lid;
|
||||
|
||||
intel_get_mmio();
|
||||
intel_get_mmio(intel_get_pci_device());
|
||||
|
||||
while (1) {
|
||||
swf14 = INREG(SWF14);
|
||||
|
||||
@@ -33,6 +33,8 @@
|
||||
#include <err.h>
|
||||
#include "intel_gpu_tools.h"
|
||||
|
||||
static uint32_t devid;
|
||||
|
||||
#define DEBUGSTRING(func) static void func(char **result, int reg, uint32_t val)
|
||||
|
||||
DEBUGSTRING(i830_16bit_func)
|
||||
@@ -1658,10 +1660,15 @@ intel_dump_regs(void)
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
struct pci_device *pci_dev;
|
||||
|
||||
pci_dev = intel_get_pci_device();
|
||||
devid = pci_dev->device_id; /* XXX not true when mapping! */
|
||||
|
||||
if (argc == 2)
|
||||
intel_map_file(argv[1]);
|
||||
else
|
||||
intel_get_mmio();
|
||||
intel_get_mmio(pci_dev);
|
||||
|
||||
if (HAS_PCH_SPLIT(devid) || getenv("HAS_PCH_SPLIT"))
|
||||
ironlake_dump_regs();
|
||||
|
||||
@@ -53,7 +53,7 @@ int main(int argc, char** argv)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
intel_get_mmio();
|
||||
intel_get_mmio(intel_get_pci_device());
|
||||
|
||||
if (!strcmp(argv[1], "-f")) {
|
||||
dump_range(0x00000, 0x00fff); /* VGA registers */
|
||||
|
||||
@@ -29,9 +29,13 @@
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
struct pci_device *pci_dev;
|
||||
uint32_t devid;
|
||||
int mmio_bar;
|
||||
|
||||
intel_get_mmio();
|
||||
pci_dev = intel_get_pci_device();
|
||||
devid = pci_dev->device_id;
|
||||
intel_get_mmio(pci_dev);
|
||||
|
||||
if (IS_9XX(devid))
|
||||
mmio_bar = 0;
|
||||
|
||||
@@ -43,7 +43,7 @@ int main(int argc, char** argv)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
intel_get_mmio();
|
||||
intel_get_mmio(intel_get_pci_device());
|
||||
sscanf(argv[1], "0x%x", ®);
|
||||
sscanf(argv[2], "0x%x", &value);
|
||||
ptr = (volatile uint32_t *)((volatile char *)mmio + reg);
|
||||
|
||||
Reference in New Issue
Block a user