From: Chris Wilson Date: Thu, 10 Feb 2011 11:20:20 +0000 (+0000) Subject: intel_stepping: Include clocks in summary X-Git-Tag: 1.1~235 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d75f2632c11b4f694447c464690e52c37c7c0573;p=profile%2Fextras%2Fintel-gpu-tools.git intel_stepping: Include clocks in summary Signed-off-by: Chris Wilson --- diff --git a/tools/intel_stepping.c b/tools/intel_stepping.c index 2eb44c7..ea8eecb 100644 --- a/tools/intel_stepping.c +++ b/tools/intel_stepping.c @@ -32,6 +32,137 @@ #include #include #include "intel_chipset.h" +#include "intel_gpu_tools.h" + +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(struct pci_device *pci_dev) +{ + uint32_t devid = pci_dev->device_id; + 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; + break; + case 9: + core_clock = 320; + break; + case 11: + core_clock = 400; + break; + case 13: + core_clock = 533; + break; + } + 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; + break; + case 3: + render_clock = 320; sampler_clock = 333; + break; + case 4: + render_clock = 400; sampler_clock = 444; + break; + case 5: + render_clock = 500; sampler_clock = 533; + break; + } + + 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; + break; + case 1: + render_clock = 200; + break; + case 3: + render_clock = 250; + break; + case 5: + render_clock = 400; + break; + } + + switch (gcfgc & 0x70) { + case 0: + display_clock = 200; + break; + case 4: + display_clock = 320; + break; + } + 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; + break; + case 1: + render_clock = 190; + break; + case 4: + render_clock = 333; + break; + } + if (gcfgc & (1 << 13)) + render_clock = 133; + + switch (gcfgc & 0x70) { + case 0: + display_clock = 190; + break; + case 4: + display_clock = 333; + break; + } + 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) { @@ -156,5 +287,8 @@ int main(int argc, char **argv) dev->device_id, stepping, step_desc); + + print_clock_info(dev); + return 0; }