Re: [Intel-gfx] [PATCH igt 4/4] tools/intel_poller: Add a new tool that will poll various display registers
On Wed, Jun 11, 2014 at 07:41:20PM +0300, ville.syrj...@linux.intel.com wrote: From: Ville Syrjälä ville.syrj...@linux.intel.com intel_poller can be used to poll various display registers (IIR,scanline/pixel/flip/frame counter, live address, etc.). It can be used to determine eg. at which scanline or pixel count certain events occur. Signed-off-by: Ville Syrjälä ville.syrj...@linux.intel.com --- Ideas for a better name are welcome! intel_display_poller maybe since the use-case is display specific. But not really important imo. -Daniel lib/intel_reg.h| 22 +- tools/Makefile.sources |1 + tools/intel_poller.c | 1471 3 files changed, 1491 insertions(+), 3 deletions(-) create mode 100644 tools/intel_poller.c diff --git a/lib/intel_reg.h b/lib/intel_reg.h index 84e05e4..87a14c9 100644 --- a/lib/intel_reg.h +++ b/lib/intel_reg.h @@ -2248,7 +2248,11 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #define PIPE_PIXEL_MASK 0x00ff #define PIPE_PIXEL_SHIFT 0 - +/* + * g4x+ frame/flip counters + */ +#define PIPEAFRMCOUNT_G4X0x70040 +#define PIPEAFLIPCOUNT_G4X 0x70044 /* * Computing GMCH M and N values. * @@ -2296,20 +2300,24 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define PIPEBSTAT0x71024 #define PIPEBFRAMEHIGH 0x71040 #define PIPEBFRAMEPIXEL 0x71044 +#define PIPEBFRMCOUNT_G4X0x71040 +#define PIPEBFLIPCOUNT_G4X 0x71044 #define PIPEB_GMCH_DATA_M0x71050 #define PIPEB_GMCH_DATA_N0x71054 #define PIPEB_DP_LINK_M 0x71060 #define PIPEB_DP_LINK_N 0x71064 +#define PIPEC_DSL0x72000 + #define PIPECCONF0x72008 #define PIPECGCMAXRED0x72010 #define PIPECGCMAXGREEN 0x72014 #define PIPECGCMAXBLUE 0x72018 #define PIPECSTAT0x72024 -#define PIPECFRAMEHIGH 0x72040 -#define PIPECFRAMEPIXEL 0x72044 +#define PIPECFRMCOUNT_G4X0x72040 +#define PIPECFLIPCOUNT_G4X 0x72044 #define PIPEC_GMCH_DATA_M0x72050 #define PIPEC_GMCH_DATA_N0x72054 @@ -2370,12 +2378,15 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define DSPASURF 0x7019C #define DSPATILEOFF 0x701A4 +#define DSPASURFLIVE 0x701AC #define DSPBSURF 0x7119C #define DSPBTILEOFF 0x711A4 +#define DSPBSURFLIVE 0x711AC #define DSPCSURF 0x7219C #define DSPCTILEOFF 0x721A4 +#define DSPCSURFLIVE 0x721AC #define VGACNTRL 0x71400 # define VGA_DISP_DISABLE(1 31) @@ -2879,6 +2890,11 @@ typedef enum { #define DEIIR0x44008 #define DEIER0x4400c +#define GEN8_DE_PIPE_ISR(pipe) (0x44400 + 0x10 * (pipe)) +#define GEN8_DE_PIPE_IMR(pipe) (0x44404 + 0x10 * (pipe)) +#define GEN8_DE_PIPE_IIR(pipe) (0x44408 + 0x10 * (pipe)) +#define GEN8_DE_PIPE_IER(pipe) (0x4440c + 0x10 * (pipe)) + /* GT interrupt */ #define GT_SYNC_STATUS (1 2) #define GT_USER_INTERRUPT(1 0) diff --git a/tools/Makefile.sources b/tools/Makefile.sources index c2535e7..6f6ca4a 100644 --- a/tools/Makefile.sources +++ b/tools/Makefile.sources @@ -12,6 +12,7 @@ bin_PROGRAMS = \ intel_iosf_sb_write \ intel_opregion_decode \ intel_perf_counters \ + intel_poller\ intel_stepping \ intel_reg_checker \ intel_reg_dumper\ diff --git a/tools/intel_poller.c b/tools/intel_poller.c new file mode 100644 index 000..ebc594a --- /dev/null +++ b/tools/intel_poller.c @@ -0,0 +1,1471 @@ +/* + * Copyright © 2014 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,
[Intel-gfx] [PATCH igt 4/4] tools/intel_poller: Add a new tool that will poll various display registers
From: Ville Syrjälä ville.syrj...@linux.intel.com intel_poller can be used to poll various display registers (IIR,scanline/pixel/flip/frame counter, live address, etc.). It can be used to determine eg. at which scanline or pixel count certain events occur. Signed-off-by: Ville Syrjälä ville.syrj...@linux.intel.com --- Ideas for a better name are welcome! lib/intel_reg.h| 22 +- tools/Makefile.sources |1 + tools/intel_poller.c | 1471 3 files changed, 1491 insertions(+), 3 deletions(-) create mode 100644 tools/intel_poller.c diff --git a/lib/intel_reg.h b/lib/intel_reg.h index 84e05e4..87a14c9 100644 --- a/lib/intel_reg.h +++ b/lib/intel_reg.h @@ -2248,7 +2248,11 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #define PIPE_PIXEL_MASK0x00ff #define PIPE_PIXEL_SHIFT 0 - +/* + * g4x+ frame/flip counters + */ +#define PIPEAFRMCOUNT_G4X 0x70040 +#define PIPEAFLIPCOUNT_G4X 0x70044 /* * Computing GMCH M and N values. * @@ -2296,20 +2300,24 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define PIPEBSTAT 0x71024 #define PIPEBFRAMEHIGH 0x71040 #define PIPEBFRAMEPIXEL0x71044 +#define PIPEBFRMCOUNT_G4X 0x71040 +#define PIPEBFLIPCOUNT_G4X 0x71044 #define PIPEB_GMCH_DATA_M 0x71050 #define PIPEB_GMCH_DATA_N 0x71054 #define PIPEB_DP_LINK_M0x71060 #define PIPEB_DP_LINK_N0x71064 +#define PIPEC_DSL 0x72000 + #define PIPECCONF 0x72008 #define PIPECGCMAXRED 0x72010 #define PIPECGCMAXGREEN0x72014 #define PIPECGCMAXBLUE 0x72018 #define PIPECSTAT 0x72024 -#define PIPECFRAMEHIGH 0x72040 -#define PIPECFRAMEPIXEL0x72044 +#define PIPECFRMCOUNT_G4X 0x72040 +#define PIPECFLIPCOUNT_G4X 0x72044 #define PIPEC_GMCH_DATA_M 0x72050 #define PIPEC_GMCH_DATA_N 0x72054 @@ -2370,12 +2378,15 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define DSPASURF 0x7019C #define DSPATILEOFF0x701A4 +#define DSPASURFLIVE 0x701AC #define DSPBSURF 0x7119C #define DSPBTILEOFF0x711A4 +#define DSPBSURFLIVE 0x711AC #define DSPCSURF 0x7219C #define DSPCTILEOFF0x721A4 +#define DSPCSURFLIVE 0x721AC #define VGACNTRL 0x71400 # define VGA_DISP_DISABLE (1 31) @@ -2879,6 +2890,11 @@ typedef enum { #define DEIIR 0x44008 #define DEIER 0x4400c +#define GEN8_DE_PIPE_ISR(pipe) (0x44400 + 0x10 * (pipe)) +#define GEN8_DE_PIPE_IMR(pipe) (0x44404 + 0x10 * (pipe)) +#define GEN8_DE_PIPE_IIR(pipe) (0x44408 + 0x10 * (pipe)) +#define GEN8_DE_PIPE_IER(pipe) (0x4440c + 0x10 * (pipe)) + /* GT interrupt */ #define GT_SYNC_STATUS (1 2) #define GT_USER_INTERRUPT (1 0) diff --git a/tools/Makefile.sources b/tools/Makefile.sources index c2535e7..6f6ca4a 100644 --- a/tools/Makefile.sources +++ b/tools/Makefile.sources @@ -12,6 +12,7 @@ bin_PROGRAMS =\ intel_iosf_sb_write \ intel_opregion_decode \ intel_perf_counters \ + intel_poller\ intel_stepping \ intel_reg_checker \ intel_reg_dumper\ diff --git a/tools/intel_poller.c b/tools/intel_poller.c new file mode 100644 index 000..ebc594a --- /dev/null +++ b/tools/intel_poller.c @@ -0,0 +1,1471 @@ +/* + * Copyright © 2014 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. + * + */ + +#include assert.h +#include fcntl.h +#include getopt.h +#include unistd.h +#include signal.h +#include stdbool.h +#include stdlib.h +#include stdio.h +#include