/*
*/
/*
* Copyright (c) 2009, 2013, Intel Corporation.
* All Rights Reserved.
*
* 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,
* 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:
* Keith Packard <keithp@keithp.com>
*
*/
#include "drmP.h"
#include "drm.h"
#include "i915_drm.h"
#include "i915_drv.h"
DRM_ERROR("Buffer size too small in %s (%d < %d)", \
(*failures)++; \
return count; \
}
struct instdone_bit {
const char *name;
};
int num_instdone_bits = 0;
static void
{
}
static void
{
}
static void
{
}
static void
{
}
static void
{
}
static void
{
}
static void
init_g965_instdone1(void)
{
}
static void
init_g4x_instdone1(void)
{
//gen4_instdone1_bit(G4X_GBLT_BUSY, "GBLT");
}
void
{
/* Now called INSTDONE_1 in the docs. */
/* Now called INSTDONE_2 in the docs. */
} else {
}
} else {
}
}
struct top_bit {
int count;
struct ring {
const char *name;
int idle;
};
enum stats_counts {
};
};
"vert fetch",
"prim fetch",
"VS invocations",
"GS invocations",
"GS prims",
"CL invocations",
"CL prims",
"PS invocations",
"PS depth pass",
};
static unsigned long
gettime(void)
{
struct timeval t;
do_gettimeofday(&t);
}
static int
top_bits_sort(const void *a, const void *b)
{
return 1;
return 0;
else
return -1;
}
static void
{
else
}
static void
if (clock == -1)
else
}
static void
{
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;
}
switch (gcfgc & 0xf) {
case 2:
break;
case 3:
break;
case 4:
break;
case 5:
break;
}
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;
}
display_clock = 133;
switch (gcfgc & 0x7) {
case 0:
render_clock = 160;
break;
case 1:
render_clock = 190;
break;
case 4:
render_clock = 333;
break;
}
render_clock = 133;
switch (gcfgc & 0x70) {
case 0:
display_clock = 190;
break;
case 4:
display_clock = 333;
break;
}
display_clock = 133;
}
}
{
int count;
return;
/* This will probably have undesirable side-effects upon the system. */
count = 0;
udelay(10);
count = 0;
udelay(10);
}
{
return;
I915_WRITE(FORCEWAKE, 0);
}
{
}
{
}
{
int full;
return;
if (full < 0)
}
{
/* Calculate current value of samples_to_percent_ratio */
return;
DRM_ERROR("%24s space: %d/%d (%d%%)",
}
{
.name = "render",
.mmio = 0x2030,
}, bsd_ring = {
.name = "bitstream",
.mmio = 0x4030,
}, bsd6_ring = {
.name = "bitstream",
.mmio = 0x12030,
}, blt_ring = {
.name = "blitter",
.mmio = 0x22030,
};
int i,j, k;
int percent;
for (i = 0; i < num_instdone_bits; i++) {
top_bits_sorted[i] = &top_bits[i];
}
}
/* Initialize GPU stats */
if (HAS_STATS_REGS(dev)) {
for (i = 0; i < STATS_COUNT; i++) {
do {
} while (stats_high != stats_high_2);
}
}
//start record
for (k = 0; k < 200000; k++) {
// t1 = gettime();
for (i = 0; i < samples_per_sec; i++) {
long interval;
long t_diff;
} else
for (j = 0; j < num_instdone_bits; j++)
update_idle_bit(&top_bits[j]);
if (t_diff >= 1000000) {
/* We are out of sync, bail out */
last_samples_per_sec = i+1;
break;
}
if (interval > 0)
}
if (HAS_STATS_REGS(dev)) {
for (i = 0; i < STATS_COUNT; i++) {
do {
} while (stats_high != stats_high_2);
}
}
//sort
// qsort(top_bits_sorted, num_instdone_bits,
// sizeof(struct top_bit *), top_bits_sort);
for (i = 0; i < num_instdone_bits; i++) {
for (j = i+1; j < num_instdone_bits; j++) {
}
}
}
//print info
max_lines = 15;
for (i = 0; i < max_lines; i++) {
if (top_bits_sorted[i]->count > 0) {
DRM_ERROR("%30s: %3d%%: ",
percent);
} else {
DRM_ERROR(" ");
}
stats_reg_names[i],
stats[i],
stats[i] - last_stats[i]);
last_stats[i] = stats[i];
} else {
if (!top_bits_sorted[i]->count)
break;
}
}
for (i = 0; i < num_instdone_bits; i++) {
top_bits_sorted[i]->count = 0;
if (i < STATS_COUNT)
last_stats[i] = stats[i];
}
udelay(4000000);
}
}
{
struct timeval t;
do_gettimeofday(&t);
/*
mod_timer(&dev_priv->gpu_top_timer,
jiffies + msecs_to_jiffies(5000));
*/
}
{
if (ring) {
/* dump ring infor*/
unsigned int *virt;
return;
for (int i = 0; i < 200; i++) {
}
}
}
{
int ret;
if (gpu_panic_on_hang) {
if (ret)
DRM_ERROR("failed to dump whole gtt");
panic("gpu hang");
}
}
{
DRM_ERROR("Blitter command stream:");
DRM_ERROR(" IPEIR: 0x%08x",
I915_READ(0x22064));
DRM_ERROR(" IPEHR: 0x%08x",
I915_READ(0x22068));
DRM_ERROR(" INSTDONE: 0x%08x",
I915_READ(0x2206C));
DRM_ERROR(" ACTHD: 0x%08x",
I915_READ(0x22074));
DRM_ERROR("Render command stream:");
DRM_ERROR(" IPEIR: 0x%08x",
DRM_ERROR(" IPEHR: 0x%08x",
DRM_ERROR(" INSTDONE: 0x%08x",
DRM_ERROR(" INSTPS: 0x%08x",
DRM_ERROR(" INSTDONE1: 0x%08x",
DRM_ERROR(" ACTHD: 0x%08x",
DRM_ERROR(" DMA_FADD_P: 0x%08x",
I915_READ(0x2078));
DRM_ERROR("Graphics Engine Fault 0x%lx",
I915_READ(0x04094));
DRM_ERROR("Media Engine Fault 0x%lx",
I915_READ(0x04194));
DRM_ERROR("Blitter Engine Fault 0x%lx",
I915_READ(0x04294));
}