summaryrefslogtreecommitdiff
path: root/tools/intel_stepping.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2011-02-10 11:20:20 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2011-02-10 11:20:20 +0000
commitd75f2632c11b4f694447c464690e52c37c7c0573 (patch)
treea268aa45faa9dc83dbb4df8b56148a6bd7577f66 /tools/intel_stepping.c
parent592b1a51ffa8944da1673e844bfccd0c40cf0a20 (diff)
intel_stepping: Include clocks in summary
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'tools/intel_stepping.c')
-rw-r--r--tools/intel_stepping.c134
1 files changed, 134 insertions, 0 deletions
diff --git a/tools/intel_stepping.c b/tools/intel_stepping.c
index 2eb44c7e..ea8eecbb 100644
--- a/tools/intel_stepping.c
+++ b/tools/intel_stepping.c
@@ -32,6 +32,137 @@
#include <pciaccess.h>
#include <err.h>
#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;
}