summaryrefslogtreecommitdiff
path: root/tools/intel_gpu_top.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2010-04-08 11:56:57 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2010-04-08 12:17:31 +0100
commit95374225e865da3a30153f73e8bb536700d15459 (patch)
treeab8797a6f255a0d76e5d8e7439b8fe4a9b34ca90 /tools/intel_gpu_top.c
parentcd64e193299be4b9733a5e804cedd99e2072830f (diff)
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>
Diffstat (limited to 'tools/intel_gpu_top.c')
-rw-r--r--tools/intel_gpu_top.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/tools/intel_gpu_top.c b/tools/intel_gpu_top.c
index 3ddbd387..b82a9bd8 100644
--- a/tools/intel_gpu_top.c
+++ b/tools/intel_gpu_top.c
@@ -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);