50 Commits

Author SHA1 Message Date
Ville Syrjälä
1ecd91a8c6 Fix a bunch of printf types
igt_kms.c: In function ‘igt_crtc_set_background’:
igt_kms.c:1940:2: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 5 has type ‘uint64_t’ [-Wformat=]
  LOG(display, "%s.%d: crtc_set_background(%lu)\n",
  ^
intel_firmware_decode.c: In function ‘csr_open’:
intel_firmware_decode.c:169:2: warning: format ‘%zd’ expects argument of type ‘signed size_t’, but argument 3 has type ‘__off_t’ [-Wformat=]
  printf("Firmware: %s (%zd bytes)\n", filename, st.st_size);
  ^
intel_gpu_top.c: In function ‘main’:
intel_gpu_top.c:683:10: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘uint64_t’ [-Wformat=]
          stats[i] - last_stats[i]);
          ^
hsw_compute_wrpll.c: In function ‘main’:
hsw_compute_wrpll.c:644:3: warning: format ‘%li’ expects argument of type ‘long int’, but argument 7 has type ‘long long int’ [-Wformat=]
   igt_fail_on_f(ref->r2 != r2 || ref->n2 != n2 || ref->p != p,
   ^
gem_gtt_hog.c: In function ‘__real_main155’:
gem_gtt_hog.c:177:2: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘unsigned int’ [-Wformat=]
  igt_info("Time to execute %lu children:  %7.3fms\n",
  ^
kms_flip.c: In function ‘run_test_step’:
kms_flip.c:985:3: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 10 has type ‘__time_t’ [-Wformat=]
   igt_assert_f(end - start > 0.9 * frame_time(o) &&
   ^
kms_flip.c:985:3: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 11 has type ‘__suseconds_t’ [-Wformat=]
kms_frontbuffer_tracking.c: In function ‘setup_sink_crc’:
kms_frontbuffer_tracking.c:1364:3: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 4 has type ‘ssize_t’ [-Wformat=]
   igt_info("Unexpected sink CRC error, rc=:%ld errno:%d %s\n",
   ^
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2016-01-08 19:56:49 +02:00
Daniel Vetter
2d4656fb69 lib/intel_io: rename mmio setup functions
Makes their intent a bit clearer.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-22 22:23:04 +01:00
Daniel Vetter
c03c6ceb29 lib: rename intel_gpu_tools.h to intel_io.h
With the header cleanup we can now give this header a suitable name,
since it now really only contains register access and other I/O
functions and assorted definitions.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-22 21:34:29 +01:00
Daniel Vetter
6cfcd71589 lib: remove uncessary #includes from headers
Only include what the header itself needs. The big fish here is
intel-gpu-tools.h. More will follow.

One ugly thing removed here is the duplicated GEN6_TD_CTL #define, one
of which was broken.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-22 20:08:13 +01:00
Damien Lespiau
d8b1dee220 intel_reg: Renamed INST_DONE to INSTDONE
That's how the registers are named in the kernel defines.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-01-07 16:47:33 +00:00
Damien Lespiau
7ee278f176 build: Guard the inclusions of config.h with HAVE_CONFIG_H
autoconf can be configured to not generate a config.h but to give the
defines with command line arguments instead. In this case, there's no
config.h to include.

To work in both cases autoconf adds a HAVE_CONFIG_H define on the command
line to signal there's a config.h to include.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-03-04 15:45:34 +00:00
Ben Widawsky
bc62567b77 clang: Fix static analysis warnings from clang
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
2012-08-30 14:20:52 -07:00
Eugeni Dodonov
e6b264cce7 intel_gpu_top: allow to work on Gen7
Somehow nobody noticed this before, but we were missing blt and bsd6
initialization on Gen7.

Reported-by: Philippe Lecluse <philippe.lecluse@intel.com>
Signed-off-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
2012-05-16 10:14:55 -03:00
Chris Wilson
3928569eed intel_gpu_top: Trust the register access is safe
Fixes intel_gpu_top on gen3 which otherwise refuses to do mmio.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-03-19 14:25:13 +00:00
Alan Coopersmith
e61b917134 Move free(cmd) to after last use of cmd in intel_gpu_top
Error: Use after free (CWE 416)
   Use after free of pointer 'cmd' in call to fprintf
        at line 496 of tools/intel_gpu_top.c in function 'main'.
          Previously freed at line 491 with free.
[ This bug was found by the Parfait 0.4.2 bug checking tool.
  For more information see http://labs.oracle.com/projects/parfait/ ]

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2012-02-06 20:44:51 +01:00
Daniel Vetter
904bcab7ba tools/intel_gpu_top: fixup new warnings
Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2012-01-09 23:38:29 +01:00
Alan Coopersmith
f73dddc767 Solaris defines struct winsize in termios.h
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2012-01-08 21:49:03 +01:00
Eugeni Dodonov
31a4b13132 intel_gpu_top: use debugfs interface for forcewake
Using debugfs facilities for forcewake-related stuff.

Acked-by: Ben Widawsky <ben@bwidawsk.net>
Signed-off-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
2011-11-09 11:43:55 -02:00
Chris Wilson
e0b2645730 top: Avoid FPE by removing meaningless metric 2011-10-19 10:32:37 +01:00
Eugeni Dodonov
62c542fd4e Allow to output statistics to stdout.
This allows intel_gpu_top to run both in statistics-collecting mode
(collecting the per-ring statistics in gnuplot-friendly format) and
ncurses top-like mode at the same time.

It also allows to output the statistics directly to stdout, by using "-o
-", so the results can be parsed directly via a popen() parsing.

If you are using intel_gpu_top as previously (without any command-line
arguments), it should change nothing for you. If you were using its
logging facilities (e.g., the '-o file'), note that the logging will keep
running, but the detailed top-like interface will be on the screen at the
same time.

Signed-off-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
2011-10-14 16:01:52 -03:00
Eugeni Dodonov
15cb282187 intel_gpu_top: access hardware before running profiling command
Without this patch, intel_gpu_top will try to get access to the hardware
after running the profiling command in the background. In case such access
fails, the main process quits, but the background one will continue
running.

So let's move this test up, so it is done before we fork.

Signed-off-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
2011-09-05 20:04:17 -03:00
Eugeni Dodonov
8ad08546e5 intel_gpu_tools: describe -e option in usage screen
This patch adds a short description of '-e' option to the usage screen.

Signed-off-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
2011-09-05 19:59:40 -03:00
Eugeni Dodonov
b9d7c3a087 intel_gpu_top: adopt to kernel coding style
This patch fixes adopts the code to the kernel coding_style.
2011-09-05 19:50:52 -03:00
Eugeni Dodonov
a483c97d91 intel_gpu_top: support profiling user-specified commands
This patch adds support for running intel_gpu_top to profile specific
commands. The required command will be carried out in separate process,
and main intel_gpu_top will leave when the child process will exit.

Signed-off-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
2011-09-05 19:45:01 -03:00
Eugeni Dodonov
c2983f24e3 intel_gpu_top: support non-interactive mode
This patch adds support for non-interactive mode, invoked by running with
'-o output' switch. In this case, no interactive output is being
performed, but the execution statistics are being saved into the output
file.

The output file is generated in both human and gnuplot-readable format.

Unlike interactive mode, where non-supported pipes and non-active
registers are skipped, the content of such pipes and registers is recorded
into the log file to simplify parsing and standardize the list of columns.

Also, unlike interactive mode, the registers are not sorted according to
the usage - this way, their variation over time can be analysed offline.

Signed-off-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
2011-09-05 19:45:01 -03:00
Eugeni Dodonov
83047e9a5e This patch initializes the last_stats[] for registers prior to starting
the monitoring itself. This way, the first measure will already contain
the difference from the previous value instead of non-initialized value.

Signed-off-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
2011-09-05 19:35:44 -03:00
Eugeni Dodonov
f11f8d9aac Revert "intel_gpu_top: initialize monitoring statistics at startup"
This reverts commit 431fe7803d37f344275fdaceb57c1fbaeee8541c.

Will be replaced with more fine-grained commits.
2011-09-05 19:33:40 -03:00
Eugeni Dodonov
431fe7803d intel_gpu_top: initialize monitoring statistics at startup
This patch initializes the last_stats[] for registers prior to starting
the monitoring itself. This way, the first measure will already contain
the difference from the previous value instead of non-initialized value.

Signed-off-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
2011-09-05 19:13:58 -03:00
Eugeni Dodonov
4b0a15e45d intel_gpu_tool: initial support for non-screen output
This patch adds initial support for non-stdio output, to be used for
non-interactive monitoring.

Signed-off-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
2011-09-05 19:11:49 -03:00
Eugeni Dodonov
09e4b0cd26 intel_gpu_top: suport command line parameters and variable samples per
second

This patch adds support for getopt, and adds two default parameters to it:
-h to show usage notes; and -s to allow user to define number of samples
to acquire per second.

Manpage documentation is also adjusted accordingly.

Signed-off-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
2011-09-05 19:11:45 -03:00
Eugeni Dodonov
6194c75c8f intel_gpu_top: account for time spent in syscalls
This allows intel_gpu_top to properly account for time spent inside system
calls. Effectively, with previous implementation, intel_gpu_top could
spent longer than 1s between consecutive measures. This attempts to
minimize the extra time spent while polling for data.

Signed-off-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
2011-09-05 16:18:11 -03:00
Chris Wilson
3c5c8ba71c Search for the first Intel dri device.
This is vital in a multi-GPU system so that we only test the Intel card
and not the discrete GPUs.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-02-01 13:37:04 +00:00
Chris Wilson
afaf5ef27c gpu-top: Correct computation of ring size
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-01-09 14:48:03 +00:00
Chris Wilson
d9ec63b1a0 intel_gpu_top: Include BLT ring
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-01-07 19:59:00 +00:00
Chris Wilson
5503ac9e19 intel_gpu_top: Wake the GT power well to read gen6 ring registers
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-01-07 19:58:55 +00:00
Eric Anholt
19b412b37c intel_gpu_top: Print stats regs on Ironlake as well. 2010-12-16 16:47:03 -08:00
Chris Wilson
8a4fc850a8 intel_gpu_top: Sample BSD rings as well as render
Show how busy the GPU is when decoding video as well as rendering.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-10-01 22:23:16 +01:00
Eric Anholt
74c8c8d612 intel_gpu_top: Fix the "limit printing to terminal height" again. 2010-07-19 08:28:10 -07:00
Chris Wilson
95374225e8 Enable compilation on non-Intel, non-DRM systems.
A few of the tools can be performed post-mortem from a different system,
so it is useful to be able to compile those tools on those foreign
systems. Obviously, any program to interact with the PCI device or talk
to GEM will fail on a non-Intel system.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-04-08 12:17:31 +01:00
Eric Anholt
bcaea4da89 intel_gpu_top: Print stats lines even when there's no done bit on the line. 2010-02-25 12:48:00 -08:00
Eric Anholt
9271e2256d intel_gpu_top: Print the vertex/primitive statistics on gen4+.
This requires that the window be much wider.  I'm not sure how we
really want to lay out this interface usably, but so far giant windows
are working well enough for me.
2010-02-25 12:34:31 -08:00
Shuang He
7f63b95c06 intel_gpu_top: Fix broken clock reporting.
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-12-15 12:53:39 -08:00
Kenneth Graunke
b4b8aafc61 Limit printing to terminal height in intel_gpu_top.
When using intel_gpu_top in a small terminal, the most important
information (ring idle/busy units) scrolls off the top of the screen.
This patch limits the number of lines printed to the terminal height
so that the most idle units (at the bottom) are truncated instead.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
2009-12-10 14:02:25 -08:00
Eric Anholt
3904b7c6a2 intel_gpu_top: Move instdone bit definitions to lib to share with _dump. 2009-06-30 18:04:50 -07:00
Eric Anholt
a18af8ed43 Add more 965 INSTDONE bits.
This shows off the units that are stuck busy in the ut2004 hang.
2009-06-23 17:18:52 -07:00
Eric Anholt
49c564ec2f Make the precentage bars fit in 80 columns.
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-06-09 11:31:52 -07:00
Robert Bragg
8c7be93544 A pedantic addition of a format string to a printf call
The printf used to clear the screen didn't have a format string, this
adds one to avoid a compiler warning.

Signed-off-by: Eric Anholt <eric@anholt.net>
2009-06-09 11:31:37 -07:00
Robert Bragg
700e45a522 Adds unicode bars for quickly visualizing the busy percentages
It can be a bit easier to digest the percentages with bar graphs than by
scanning continually changing numbers.

Signed-off-by: Eric Anholt <eric@anholt.net>
2009-06-09 11:31:30 -07:00
Robert Bragg
2f0c0aa8ae Increases the sample frequency from 100/sec to 10,000/sec
For a typical vsync locked application running at 60fps, sampling at just
under twice a frame doesn't seem to give very stable lists of relevent hardware
units because there are a number of units involved that may not be sampled one
second to the next.

This bumps the sample rate to 10,000 instead which is ~ 170 samples per
frame so we tend to hit all the units involved.

It also changes the report threshold to a sample count >= 1, so you don't
see as many units with a percentage of 0.

Signed-off-by: Eric Anholt <eric@anholt.net>
2009-06-09 11:31:24 -07:00
Robert Bragg
2a50faae7e Revert "intel_gpu_top:print a visual clue on how big a certain use is"
This reverts commit 5e13b98da1e7e31cffba84fd257002357d5f2682.

We can print prettier graphs using unicode

Signed-off-by: Eric Anholt <eric@anholt.net>
2009-06-09 11:31:15 -07:00
Eric Anholt
114763f419 intel_gpu_top: Print GPU clock information, which seems interesting. 2009-06-04 14:39:41 +00:00
Arjan van de Ven
5e13b98da1 intel_gpu_top:print a visual clue on how big a certain use is
humans are pretty bad at reading percentages quicky; this patch adds a
histogram capability to make it more visually clear as to which lines are
big ticket items
2009-06-04 14:07:48 +00:00
Eric Anholt
7583e811a5 intel_gpu_top: Add ring information. 2009-04-27 09:39:05 -07:00
Eric Anholt
3ba49a9295 intel_gpu_top: Add more 965 bits. 2009-03-27 13:13:47 -07:00
Eric Anholt
fbbf124f8d Port intel_idle from 2D driver as intel_gpu_top with a better interface. 2009-03-27 12:27:55 -07:00