mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-11 09:56:22 +00:00
intel_gtt: Add intel_gtt from the 2D driver.
We've used it several times in bringing up the AGP driver, so it seems useful to have aronud.
This commit is contained in:
parent
65f1f881b7
commit
a5846bff27
1
.gitignore
vendored
1
.gitignore
vendored
@ -51,6 +51,7 @@ tools/intel_decode
|
|||||||
tools/intel_gpu_dump
|
tools/intel_gpu_dump
|
||||||
tools/intel_gpu_time
|
tools/intel_gpu_time
|
||||||
tools/intel_gpu_top
|
tools/intel_gpu_top
|
||||||
|
tools/intel_gtt
|
||||||
tools/intel_reg_dumper
|
tools/intel_reg_dumper
|
||||||
tools/intel_reg_write
|
tools/intel_reg_write
|
||||||
tools/intel_stepping
|
tools/intel_stepping
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
dist_man1_MANS = \
|
dist_man1_MANS = \
|
||||||
intel_gpu_dump.1 \
|
intel_gpu_dump.1 \
|
||||||
intel_gpu_top.1 \
|
intel_gpu_top.1 \
|
||||||
|
intel_gtt.1 \
|
||||||
intel_reg_dumper.1 \
|
intel_reg_dumper.1 \
|
||||||
intel_reg_write.1 \
|
intel_reg_write.1 \
|
||||||
intel_stepping.1 \
|
intel_stepping.1 \
|
||||||
|
14
man/intel_gtt.1
Normal file
14
man/intel_gtt.1
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
emacs .\" shorthand for double quote that works everywhere.
|
||||||
|
.ds q \N'34'
|
||||||
|
.TH intel_gtt 1 "intel_gtt 1.0"
|
||||||
|
.SH NAME
|
||||||
|
intel_gtt \- Dump the contents of an Intel GPU's GTT
|
||||||
|
.SH SYNOPSIS
|
||||||
|
.B intel_gtt
|
||||||
|
.SH DESCRIPTION
|
||||||
|
.B intel_
|
||||||
|
is a tool to view the contents of the GTT on an Intel GPU. The GTT is
|
||||||
|
the page table that maps between GPU addresses and system memory.
|
||||||
|
This tool can be useful in debugging the Linux AGP driver
|
||||||
|
initialization of the chip or in debugging later overwriting of the
|
||||||
|
GTT with garbage data.
|
@ -4,6 +4,7 @@ bin_PROGRAMS = \
|
|||||||
intel_gpu_dump \
|
intel_gpu_dump \
|
||||||
intel_gpu_top \
|
intel_gpu_top \
|
||||||
intel_gpu_time \
|
intel_gpu_time \
|
||||||
|
intel_gtt \
|
||||||
intel_stepping \
|
intel_stepping \
|
||||||
intel_reg_dumper \
|
intel_reg_dumper \
|
||||||
intel_reg_write \
|
intel_reg_write \
|
||||||
|
117
tools/intel_gtt.c
Normal file
117
tools/intel_gtt.c
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2008 Intel Corporation
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
|
* to deal in the Software without restriction, including without limitation
|
||||||
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
* and/or sell copies of the Software, and to permit persons to whom the
|
||||||
|
* Software is furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice (including the next
|
||||||
|
* paragraph) shall be included in all copies or substantial portions of the
|
||||||
|
* Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
* DEALINGS IN THE SOFTWARE.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* Eric Anholt <eric@anholt.net>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <pciaccess.h>
|
||||||
|
#include <err.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include "intel_gpu_tools.h"
|
||||||
|
|
||||||
|
#define INGTT(offset) (*(volatile uint32_t *)(gtt + (offset) / (KB(4) / 4)))
|
||||||
|
|
||||||
|
#define KB(x) ((x) * 1024)
|
||||||
|
#define MB(x) ((x) * 1024 * 1024)
|
||||||
|
|
||||||
|
int main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
int start, aper_size;
|
||||||
|
unsigned char *gtt;
|
||||||
|
|
||||||
|
intel_get_mmio();
|
||||||
|
|
||||||
|
if (!IS_9XX(devid)) {
|
||||||
|
printf("Unsupported chipset for gtt dumper\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IS_G4X(devid) || IS_IRONLAKE(devid))
|
||||||
|
gtt = ((unsigned char *)mmio + MB(2));
|
||||||
|
else if (IS_965(devid))
|
||||||
|
gtt = ((unsigned char *)mmio + KB(512));
|
||||||
|
else {
|
||||||
|
/* 915/945 chips has GTT range in bar 3 */
|
||||||
|
int err;
|
||||||
|
err = pci_device_map_range(pci_dev,
|
||||||
|
pci_dev->regions[3].base_addr,
|
||||||
|
pci_dev->regions[3].size,
|
||||||
|
PCI_DEV_MAP_FLAG_WRITABLE,
|
||||||
|
(void **)>t);
|
||||||
|
if (err != 0) {
|
||||||
|
fprintf(stderr, "mapping GTT bar failed\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
aper_size = pci_dev->regions[2].size;
|
||||||
|
|
||||||
|
for (start = 0; start < aper_size; start += KB(4)) {
|
||||||
|
uint32_t start_pte = INGTT(start);
|
||||||
|
uint32_t end;
|
||||||
|
int constant_length = 0;
|
||||||
|
int linear_length = 0;
|
||||||
|
|
||||||
|
/* Check if it's a linear sequence */
|
||||||
|
for (end = start + KB(4); end < aper_size; end += KB(4)) {
|
||||||
|
uint32_t end_pte = INGTT(end);
|
||||||
|
if (end_pte == start_pte + (end - start))
|
||||||
|
linear_length++;
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (linear_length > 0) {
|
||||||
|
printf("0x%08x - 0x%08x: linear from "
|
||||||
|
"0x%08x to 0x%08x\n",
|
||||||
|
start, end - KB(4),
|
||||||
|
start_pte, start_pte + (end - start) - KB(4));
|
||||||
|
start = end - KB(4);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check if it's a constant sequence */
|
||||||
|
for (end = start + KB(4); end < aper_size; end += KB(4)) {
|
||||||
|
uint32_t end_pte = INGTT(end);
|
||||||
|
if (end_pte == start_pte)
|
||||||
|
constant_length++;
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (constant_length > 0) {
|
||||||
|
printf("0x%08x - 0x%08x: constant 0x%08x\n",
|
||||||
|
start, end - KB(4), start_pte);
|
||||||
|
start = end - KB(4);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("0x%08x: 0x%08x\n", start, start_pte);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user