diff options
author | Eric Anholt <eric@anholt.net> | 2009-06-04 14:38:17 +0000 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2009-06-04 14:39:41 +0000 |
commit | 114763f4190260e326cf4e82806fc07c7022d934 (patch) | |
tree | 12246669b72c5e54d59d3d11e408afad42e5d26a /tools/intel_gpu_top.c | |
parent | 5e13b98da1e7e31cffba84fd257002357d5f2682 (diff) |
intel_gpu_top: Print GPU clock information, which seems interesting.
Diffstat (limited to 'tools/intel_gpu_top.c')
-rw-r--r-- | tools/intel_gpu_top.c | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/tools/intel_gpu_top.c b/tools/intel_gpu_top.c index 66e61c4c..21fa844f 100644 --- a/tools/intel_gpu_top.c +++ b/tools/intel_gpu_top.c @@ -86,6 +86,98 @@ add_instdone_bit(uint32_t bit, char *name) num_top_bits++; } +static void +print_clock(char *name, int clock) { + if (clock == -1) + printf("%s clock: unknown", name); + else + printf("%s clock: %d Mhz", name, clock); +} + +static int +print_clock_info(void) +{ + uint16_t gcfgc; + + if (IS_GM45(devid)) { + int core_clock = -1; + + pci_device_cfg_read_u16(pci_dev, &gcfgc, I915_GCFGC); + + switch (gcfgc & 0xf) { + case 8: core_clock = 266; + case 9: core_clock = 320; + case 11: core_clock = 400; + case 13: core_clock = 533; + } + print_clock("core", core_clock); + } else if (IS_965(devid) && IS_MOBILE(devid)) { + int render_clock = -1, sampler_clock = -1; + + pci_device_cfg_read_u16(pci_dev, &gcfgc, I915_GCFGC); + + switch (gcfgc & 0xf) { + case 2: render_clock = 250; sampler_clock = 267; + case 3: render_clock = 320; sampler_clock = 333; + case 4: render_clock = 400; sampler_clock = 444; + case 5: render_clock = 500; sampler_clock = 533; + } + + print_clock("render", render_clock); + printf(" "); + print_clock("sampler", sampler_clock); + } else if (IS_945(devid) && IS_MOBILE(devid)) { + int render_clock = -1, display_clock = -1; + + pci_device_cfg_read_u16(pci_dev, &gcfgc, I915_GCFGC); + + switch (gcfgc & 0x7) { + case 0: render_clock = 166; + case 1: render_clock = 200; + case 3: render_clock = 250; + case 5: render_clock = 400; + } + + switch (gcfgc & 0x70) { + case 0: display_clock = 200; + case 4: display_clock = 320; + } + if (gcfgc & (1 << 7)) + display_clock = 133; + + print_clock("render", render_clock); + printf(" "); + print_clock("display", display_clock); + } else if (IS_915(devid) && IS_MOBILE(devid)) { + int render_clock = -1, display_clock = -1; + + pci_device_cfg_read_u16(pci_dev, &gcfgc, I915_GCFGC); + + switch (gcfgc & 0x7) { + case 0: render_clock = 160; + case 1: render_clock = 190; + case 4: render_clock = 333; + } + if (gcfgc & (1 << 13)) + render_clock = 133; + + switch (gcfgc & 0x70) { + case 0: display_clock = 190; + case 4: display_clock = 333; + } + if (gcfgc & (1 << 7)) + display_clock = 133; + + print_clock("render", render_clock); + printf(" "); + print_clock("display", display_clock); + } + + + printf("\n"); + return -1; +} + int main(int argc, char **argv) { intel_get_mmio(); @@ -194,6 +286,9 @@ int main(int argc, char **argv) top_bits_sort); printf(clear_screen); + + print_clock_info(); + printf("ring idle: %3d%% ring space: %d/%d (%d%%)\n", ring_idle, total_ring_full / 100, ring_size, |