CRC support for non-ivb
Subsystems (2)
cover CRC support for non-ivb
Hi all,
I've stitched together basic CRC support for non-ivb platforms. Still need to do a bit more testing on this, but ignoring bugs this should be it. We also need to pimp the igt testcase a bit so that it falls back to the new PIPE source if the PLANE1 source isn't available.
Review and comments highly welcome.
Cheers, Daniel
Daniel Vetter (16):
drm/i915: extract display_pipe_crc_update drm/i915: add CRC #defines for ilk/snb
drm/i915: wire up CRC interrupt for ilk/snb drm/i915: use ->get_vblank_counter for the crc frame counter drm/i915: wait one vblank when disabling CRCs drm/i915: fix CRC debugfs setup
drm/i915: crc support for hsw
drm/i915: Adjust CRC capture for pre-gen5/vlv drm/i915: CRC source selection #defines for gmch/vlv chips drm/i915: Wire up CRC interrupts for pre-gen5/vlv drm/i915: Enable CRC interrupts on pre-gen5/vlv drm/i915: Fix PIPE_CRC_CTL for vlv
drm/i915: Add new CRC sources
drm/i915: Wire up CRC support for gen3/4
drm/i915: Wire up gen2 CRC support
drm/i915: Wire up CRC for vlv
drivers/gpu/drm/i915/i915_debugfs.c | 164 +++++++++++++++++++++++++++++++----- drivers/gpu/drm/i915/i915_drv.h | 6 ++ drivers/gpu/drm/i915/i915_irq.c | 151 +++++++++++++++++++++++++-------- drivers/gpu/drm/i915/i915_reg.h | 74 +++++++++++++--- 4 files changed, 328 insertions(+), 67 deletions(-)
Signature · 1 line
1.8.4.rc3
PATCH 1/16 drm/i915: extract display_pipe_crc_update
The ringbuffer update logic should always be the same, but different platforms have different amounts of CRC registers. Hence extract it.
--- drivers/gpu/drm/i915/i915_irq.c | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +23 -7
@@ -1190,7 +1190,10 @@ static void dp_aux_irq_handler(struct drm_device *dev) }#if defined(CONFIG_DEBUG_FS ) -static void ivb_pipe_crc_update (struct drm_device *dev,enum pipe pipe) +static void display_pipe_crc_update (struct drm_device *dev,enum pipe pipe, +uint32_t crc0,uint32_t crc1, +uint32_t crc2,uint32_t crc3, +uint32_t crc4,uint32_t frame) {struct drm_i915_private *dev_priv = dev->dev_private;struct intel_pipe_crc *pipe_crc = &dev_priv->pipe_crc[pipe];
@@ -1212,18 +1215,31 @@ static void ivb_pipe_crc_update(struct drm_device *dev, enum pipe pipe) entry = &pipe_crc->entries[head]; - entry->frame =I915_READ (PIPEFRAME (pipe)); - entry->crc[0 ] =I915_READ (PIPE_CRC_RES_1_IVB (pipe)); - entry->crc[1 ] =I915_READ (PIPE_CRC_RES_2_IVB (pipe)); - entry->crc[2 ] =I915_READ (PIPE_CRC_RES_3_IVB (pipe)); - entry->crc[3 ] =I915_READ (PIPE_CRC_RES_4_IVB (pipe)); - entry->crc[4 ] =I915_READ (PIPE_CRC_RES_5_IVB (pipe)); + entry->frame = frame; + entry->crc[0 ] = crc0; + entry->crc[1 ] = crc1; + entry->crc[2 ] = crc2; + entry->crc[3 ] = crc3; + entry->crc[4 ] = crc4; head = (head +1 ) & (INTEL_PIPE_CRC_ENTRIES_NR -1 );atomic_set (&pipe_crc->head, head); wake_up_interruptible(&pipe_crc->wq); } + +static void ivb_pipe_crc_update (struct drm_device *dev,enum pipe pipe) +{ +struct drm_i915_private *dev_priv = dev->dev_private; + +display_pipe_crc_update (dev, pipe, +I915_READ (PIPE_CRC_RES_1_IVB (pipe)), +I915_READ (PIPE_CRC_RES_2_IVB (pipe)), +I915_READ (PIPE_CRC_RES_3_IVB (pipe)), +I915_READ (PIPE_CRC_RES_4_IVB (pipe)), +I915_READ (PIPE_CRC_RES_5_IVB (pipe)), +I915_READ (PIPEFRAME (pipe))); +}#else static inline void ivb_pipe_crc_update (struct drm_device *dev,int pipe) {}#endif
Signature · 1 line
1.8.4.rc3
PATCH 2/16 drm/i915: add CRC #defines for ilk/snb
In reply to Daniel VetterAlso add a new _PIPE_INC macro which takes an base plus increment. Much less likely to botch the job by missing an s/A/B/ somewhere.
v2: They've moved the bitfield. Argh!
--- drivers/gpu/drm/i915/i915_reg.h | 46 +++++++++++++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 11 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +35 -11
@@ -26,6 +26,7 @@#define _I915_REG_H_#define _PIPE (pipe, a, b) ((a) + (pipe)*((b)-(a))) +#define _PIPE_INC (pipe, base, inc) ((base) + (pipe)*(inc))#define _TRANSCODER (tran, a, b) ((a) + (tran)*((b)-(a)))#define _PORT (port, a, b) ((a) + (port)*((b)-(a)))
@@ -1844,19 +1845,31 @@#define PIPE_CRC_SOURCE_PRIMARY_IVB (0 << 29)#define PIPE_CRC_SOURCE_SPRITE_IVB (1 << 29)#define PIPE_CRC_SOURCE_PF_IVB (2 << 29) -#define _PIPE_CRC_RES_1_A_IVB (dev_priv->info->display_mmio_offset + 0x60064) -#define _PIPE_CRC_RES_2_A_IVB (dev_priv->info->display_mmio_offset + 0x60068) -#define _PIPE_CRC_RES_3_A_IVB (dev_priv->info->display_mmio_offset + 0x6006c) -#define _PIPE_CRC_RES_4_A_IVB (dev_priv->info->display_mmio_offset + 0x60070) -#define _PIPE_CRC_RES_5_A_IVB (dev_priv->info->display_mmio_offset + 0x60074) +#define PIPE_CRC_SOURCE_PRIMARY_ILK (0 << 28) +#define PIPE_CRC_SOURCE_SPRITE_ILK (1 << 28) +#define PIPE_CRC_SOURCE_PIPE_ILK (2 << 28) +/* embedded DP port on the north display block, reserved on ivb */ +#define PIPE_CRC_SOURCE_PORT_A_ILK (4 << 28) +#define PIPE_CRC_SOURCE_FDI_ILK (5 << 28)/* reserved on ivb */ +#define _PIPE_CRC_RES_1_A_IVB 0x60064 +#define _PIPE_CRC_RES_2_A_IVB 0x60068 +#define _PIPE_CRC_RES_3_A_IVB 0x6006c +#define _PIPE_CRC_RES_4_A_IVB 0x60070 +#define _PIPE_CRC_RES_5_A_IVB 0x60074 + +#define _PIPE_CRC_RES_RED_A_ILK 0x60060 +#define _PIPE_CRC_RES_GREEN_A_ILK 0x60064 +#define _PIPE_CRC_RES_BLUE_A_ILK 0x60068 +#define _PIPE_CRC_RES_RES1_A_ILK 0x6006c +#define _PIPE_CRC_RES_RES2_A_ILK 0x60080/* Pipe B CRC regs */ -#define _PIPE_CRC_CTL_B (dev_priv->info->display_mmio_offset + 0x61050) -#define _PIPE_CRC_RES_1_B_IVB (dev_priv->info->display_mmio_offset + 0x61064) -#define _PIPE_CRC_RES_2_B_IVB (dev_priv->info->display_mmio_offset + 0x61068) -#define _PIPE_CRC_RES_3_B_IVB (dev_priv->info->display_mmio_offset + 0x6106c) -#define _PIPE_CRC_RES_4_B_IVB (dev_priv->info->display_mmio_offset + 0x61070) -#define _PIPE_CRC_RES_5_B_IVB (dev_priv->info->display_mmio_offset + 0x61074) +#define _PIPE_CRC_CTL_B 0x61050 +#define _PIPE_CRC_RES_1_B_IVB 0x61064 +#define _PIPE_CRC_RES_2_B_IVB 0x61068 +#define _PIPE_CRC_RES_3_B_IVB 0x6106c +#define _PIPE_CRC_RES_4_B_IVB 0x61070 +#define _PIPE_CRC_RES_5_B_IVB 0x61074#define PIPE_CRC_CTL (pipe) _PIPE(pipe, _PIPE_CRC_CTL_A, _PIPE_CRC_CTL_B)#define PIPE_CRC_RES_1_IVB (pipe) \
@@ -1870,6 +1883,17 @@#define PIPE_CRC_RES_5_IVB (pipe) \ _PIPE(pipe, _PIPE_CRC_RES_5_A_IVB, _PIPE_CRC_RES_5_B_IVB) +#define PIPE_CRC_RES_RED_ILK (pipe) \ + _PIPE_INC(pipe, _PIPE_CRC_RES_RED_A_ILK, 0x01000) +#define PIPE_CRC_RES_GREEN_ILK (pipe) \ + _PIPE_INC(pipe, _PIPE_CRC_RES_GREEN_A_ILK, 0x01000) +#define PIPE_CRC_RES_BLUE_ILK (pipe) \ + _PIPE_INC(pipe, _PIPE_CRC_RES_BLUE_A_ILK, 0x01000) +#define PIPE_CRC_RES_RES1_ILK (pipe) \ + _PIPE_INC(pipe, _PIPE_CRC_RES_RES1_A_ILK, 0x01000) +#define PIPE_CRC_RES_RES2_ILK (pipe) \ + _PIPE_INC(pipe, _PIPE_CRC_RES_RES2_A_ILK, 0x01000) +/* Pipe A timing regs */ #define _HTOTAL_A (dev_priv->info->display_mmio_offset + 0x60000)#define _HBLANK_A (dev_priv->info->display_mmio_offset + 0x60004)
Signature · 1 line
1.8.4.rc3
PATCH 3/16 drm/i915: wire up CRC interrupt for ilk/snb
In reply to Daniel VetterWe enable the interrupt unconditionally and only control it through the enable bit in the CRC control register.
v2: Extract per-platform helpers to compute the register values.
--- drivers/gpu/drm/i915/i915_debugfs.c | 74 ++++++++++++++++++++++++++++--------- drivers/gpu/drm/i915/i915_drv.h | 1 + drivers/gpu/drm/i915/i915_irq.c | 26 ++++++++++++- drivers/gpu/drm/i915/i915_reg.h | 2 + 4 files changed, 84 insertions(+), 19 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +57 -17
@@ -1914,6 +1914,7 @@ static const char * const pipe_crc_sources[] = {"plane1" ,"plane2" ,"pf" , + "pipe", };static const char *pipe_crc_source_name (enum intel_pipe_crc_source source)
@@ -1942,14 +1943,61 @@ static int display_crc_ctl_open(struct inode *inode, struct file *file)return single_open (file, display_crc_ctl_show, dev); } +static int ilk_pipe_crc_ctl_reg (enum intel_pipe_crc_source source, +uint32_t *val) +{ +switch (source) { +case INTEL_PIPE_CRC_SOURCE_PLANE1 : + *val =PIPE_CRC_ENABLE |PIPE_CRC_SOURCE_PRIMARY_ILK ; +break ; +case INTEL_PIPE_CRC_SOURCE_PLANE2 : + *val =PIPE_CRC_ENABLE |PIPE_CRC_SOURCE_SPRITE_ILK ; +break ; +case INTEL_PIPE_CRC_SOURCE_PF : +return -EINVAL ; +case INTEL_PIPE_CRC_SOURCE_PIPE : + *val =PIPE_CRC_ENABLE |PIPE_CRC_SOURCE_PIPE_ILK ; +break ; +default : + *val =0 ; +break ; + } + +return 0 ; +} + +static int ivb_pipe_crc_ctl_reg (enum intel_pipe_crc_source source, +uint32_t *val) +{ +switch (source) { +case INTEL_PIPE_CRC_SOURCE_PLANE1 : + *val =PIPE_CRC_ENABLE |PIPE_CRC_SOURCE_PRIMARY_IVB ; +break ; +case INTEL_PIPE_CRC_SOURCE_PLANE2 : + *val =PIPE_CRC_ENABLE |PIPE_CRC_SOURCE_SPRITE_IVB ; +break ; +case INTEL_PIPE_CRC_SOURCE_PF : + *val =PIPE_CRC_ENABLE |PIPE_CRC_SOURCE_PF_IVB ; +break ; +case INTEL_PIPE_CRC_SOURCE_PIPE : +return -EINVAL ; +default : + *val =0 ; +break ; + } + +return 0 ; +} +static int pipe_crc_set_source (struct drm_device *dev,enum pipe pipe,enum intel_pipe_crc_source source) {struct drm_i915_private *dev_priv = dev->dev_private;struct intel_pipe_crc *pipe_crc = &dev_priv->pipe_crc[pipe];u32 val; +int ret; -if (!IS_IVYBRIDGE (dev)) +if (!(IS_IVYBRIDGE (dev) ||IS_GEN5 (dev) ||IS_GEN6 (dev)))return -ENODEV ;if (pipe_crc->source == source)
@@ -1959,6 +2007,14 @@ static int pipe_crc_set_source(struct drm_device *dev, enum pipe pipe,if (pipe_crc->source && source)return -EINVAL ; +if (IS_GEN5 (dev) ||IS_GEN6 (dev)) + ret =ilk_pipe_crc_ctl_reg (source, &val); +else + ret =ivb_pipe_crc_ctl_reg (source, &val); + +if (ret !=0 ) +return ret; +/* none -> real source transition */ if (source) { DRM_DEBUG_DRIVER("collecting CRCs for pipe %c, %s\n",
@@ -1976,22 +2032,6 @@ static int pipe_crc_set_source(struct drm_device *dev, enum pipe pipe, pipe_crc->source = source; -switch (source) { -case INTEL_PIPE_CRC_SOURCE_PLANE1 : - val =PIPE_CRC_ENABLE |PIPE_CRC_SOURCE_PRIMARY_IVB ; -break ; -case INTEL_PIPE_CRC_SOURCE_PLANE2 : - val =PIPE_CRC_ENABLE |PIPE_CRC_SOURCE_SPRITE_IVB ; -break ; -case INTEL_PIPE_CRC_SOURCE_PF : - val =PIPE_CRC_ENABLE |PIPE_CRC_SOURCE_PF_IVB ; -break ; -case INTEL_PIPE_CRC_SOURCE_NONE : -default : - val =0 ; -break ; - } -I915_WRITE (PIPE_CRC_CTL (pipe), val);POSTING_READ (PIPE_CRC_CTL (pipe));
drivers/gpu/drm/i915/i915_drv.h +1 -0
@@ -1222,6 +1222,7 @@ enum intel_pipe_crc_source {INTEL_PIPE_CRC_SOURCE_PLANE1 ,INTEL_PIPE_CRC_SOURCE_PLANE2 ,INTEL_PIPE_CRC_SOURCE_PF , +INTEL_PIPE_CRC_SOURCE_PIPE , INTEL_PIPE_CRC_SOURCE_MAX, };
drivers/gpu/drm/i915/i915_irq.c +24 -2
@@ -1240,8 +1240,22 @@ static void ivb_pipe_crc_update(struct drm_device *dev, enum pipe pipe)I915_READ (PIPE_CRC_RES_5_IVB (pipe)), I915_READ(PIPEFRAME(pipe))); } + +static void ilk_pipe_crc_update (struct drm_device *dev,enum pipe pipe) +{ +struct drm_i915_private *dev_priv = dev->dev_private; + +display_pipe_crc_update (dev, pipe, +I915_READ (PIPE_CRC_RES_RED_ILK (pipe)), +I915_READ (PIPE_CRC_RES_GREEN_ILK (pipe)), +I915_READ (PIPE_CRC_RES_BLUE_ILK (pipe)), +I915_READ (PIPE_CRC_RES_RES1_ILK (pipe)), +I915_READ (PIPE_CRC_RES_RES2_ILK (pipe)), +I915_READ (PIPEFRAME (pipe))); +}#else static inline void ivb_pipe_crc_update (struct drm_device *dev,int pipe) {} +static inline void ilk_pipe_crc_update (struct drm_device *dev,int pipe) {}#endif /* The RPS events need forcewake, so we add them to a work queue and mask their
@@ -1524,6 +1538,12 @@ static void ilk_display_irq_handler(struct drm_device *dev, u32 de_iir)if (intel_set_cpu_fifo_underrun_reporting (dev,PIPE_B , false))DRM_DEBUG_DRIVER ("Pipe B FIFO underrun\n" ); +if (de_iir &DE_PIPEA_CRC_DONE ) +ilk_pipe_crc_update (dev,PIPE_A ); + +if (de_iir &DE_PIPEB_CRC_DONE ) +ilk_pipe_crc_update (dev,PIPE_B ); +if (de_iir &DE_PLANEA_FLIP_DONE ) {intel_prepare_page_flip (dev,0 );intel_finish_page_flip_plane (dev,0 );
@@ -2500,8 +2520,10 @@ static int ironlake_irq_postinstall(struct drm_device *dev) }else { display_mask = (DE_MASTER_IRQ_CONTROL |DE_GSE |DE_PCH_EVENT |DE_PLANEA_FLIP_DONE |DE_PLANEB_FLIP_DONE | -DE_AUX_CHANNEL_A |DE_PIPEB_FIFO_UNDERRUN | -DE_PIPEA_FIFO_UNDERRUN |DE_POISON ); +DE_AUX_CHANNEL_A | +DE_PIPEB_FIFO_UNDERRUN |DE_PIPEA_FIFO_UNDERRUN | +DE_PIPEB_CRC_DONE |DE_PIPEA_CRC_DONE | +DE_POISON ); extra_mask =DE_PIPEA_VBLANK |DE_PIPEB_VBLANK |DE_PCU_EVENT ; }
drivers/gpu/drm/i915/i915_reg.h +2 -0
@@ -3918,12 +3918,14 @@#define DE_PIPEB_ODD_FIELD (1 << 13)#define DE_PIPEB_LINE_COMPARE (1 << 12)#define DE_PIPEB_VSYNC (1 << 11) +#define DE_PIPEB_CRC_DONE (1 << 10)#define DE_PIPEB_FIFO_UNDERRUN (1 << 8)#define DE_PIPEA_VBLANK (1 << 7)#define DE_PIPEA_EVEN_FIELD (1 << 6)#define DE_PIPEA_ODD_FIELD (1 << 5)#define DE_PIPEA_LINE_COMPARE (1 << 4)#define DE_PIPEA_VSYNC (1 << 3) +#define DE_PIPEA_CRC_DONE (1 << 2)#define DE_PIPEA_FIFO_UNDERRUN (1 << 0)/* More Ivybridge lolz */
Signature · 1 line
1.8.4.rc3
PATCH 4/16 drm/i915: use ->get_vblank_counter for the crc frame counter
In reply to Daniel VetterSuggested by Ville.
--- drivers/gpu/drm/i915/i915_irq.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +4 -6
@@ -1193,7 +1193,7 @@ static void dp_aux_irq_handler(struct drm_device *dev)static void display_pipe_crc_update (struct drm_device *dev,enum pipe pipe,uint32_t crc0,uint32_t crc1,uint32_t crc2,uint32_t crc3, -uint32_t crc4,uint32_t frame) +uint32_t crc4) {struct drm_i915_private *dev_priv = dev->dev_private;struct intel_pipe_crc *pipe_crc = &dev_priv->pipe_crc[pipe];
@@ -1215,7 +1215,7 @@ static void display_pipe_crc_update(struct drm_device *dev, enum pipe pipe, entry = &pipe_crc->entries[head]; - entry->frame = frame; + entry->frame = dev->driver->get_vblank_counter (dev, pipe); entry->crc[0 ] = crc0; entry->crc[1 ] = crc1; entry->crc[2 ] = crc2;
@@ -1237,8 +1237,7 @@ static void ivb_pipe_crc_update(struct drm_device *dev, enum pipe pipe)I915_READ (PIPE_CRC_RES_2_IVB (pipe)),I915_READ (PIPE_CRC_RES_3_IVB (pipe)),I915_READ (PIPE_CRC_RES_4_IVB (pipe)), -I915_READ (PIPE_CRC_RES_5_IVB (pipe)), - I915_READ(PIPEFRAME(pipe))); + I915_READ(PIPE_CRC_RES_5_IVB(pipe))); }static void ilk_pipe_crc_update (struct drm_device *dev,enum pipe pipe)
@@ -1250,8 +1249,7 @@ static void ilk_pipe_crc_update(struct drm_device *dev, enum pipe pipe)I915_READ (PIPE_CRC_RES_GREEN_ILK (pipe)),I915_READ (PIPE_CRC_RES_BLUE_ILK (pipe)),I915_READ (PIPE_CRC_RES_RES1_ILK (pipe)), -I915_READ (PIPE_CRC_RES_RES2_ILK (pipe)), - I915_READ(PIPEFRAME(pipe))); + I915_READ(PIPE_CRC_RES_RES2_ILK(pipe))); }#else static inline void ivb_pipe_crc_update (struct drm_device *dev,int pipe) {}
Signature · 6 lines
1.8.4.rc3 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 5/16 drm/i915: wait one vblank when disabling CRCs
In reply to Daniel VetterThis avoids a spurious spurious interrupt warning.
--- drivers/gpu/drm/i915/i915_debugfs.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/i915/i915_debugfs.c +2 -0
@@ -2040,6 +2040,8 @@ static int pipe_crc_set_source(struct drm_device *dev, enum pipe pipe,DRM_DEBUG_DRIVER ("stopping CRCs for pipe %c\n" ,pipe_name (pipe)); +intel_wait_for_vblank (dev, pipe); +kfree (pipe_crc->entries); pipe_crc->entries =NULL ; }
Signature · 1 line
1.8.4.rc3
PATCH 6/16 drm/i915: fix CRC debugfs setup
In reply to Daniel VetterWe've set up all files, but removed only those for which we have a pipe. Which leaves the one for pipe C on machines with less than 2 pipes, breaking module reload.
v2: We can't get at the drm device this early (wtf), so just register all the files and also remove them all again.
--- drivers/gpu/drm/i915/i915_debugfs.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +1 -2
@@ -2772,7 +2772,6 @@ int i915_debugfs_init(struct drm_minor *minor)void i915_debugfs_cleanup (struct drm_minor *minor) { -struct drm_device *dev = minor->dev;int i; drm_debugfs_remove_files(i915_debugfs_list,
@@ -2781,7 +2780,7 @@ void i915_debugfs_cleanup(struct drm_minor *minor)drm_debugfs_remove_files ((struct drm_info_list *) &i915_forcewake_fops,1 , minor); -for (i =0 ; i <INTEL_INFO (dev)->num_pipes; i++) { +for (i =0 ; i <ARRAY_SIZE (i915_pipe_crc_data); i++) {struct drm_info_list *info_list = (struct drm_info_list *)&i915_pipe_crc_data[i];
Signature · 1 line
1.8.4.rc3
PATCH 7/16 drm/i915: crc support for hsw
In reply to Daniel Vetterhw designers decided to change the CRC registers and coalesce them all into one. Otherwise nothing changed. I've opted for a new hsw_ version to grab the crc sample since hsw+1 will have the same crc registers, but different interrupt source registers. So this little helper function will come handy there.
Also refactor the display error handler with a neat pipe loop.
v2: Use for_each_pipe.
--- drivers/gpu/drm/i915/i915_debugfs.c | 2 +- drivers/gpu/drm/i915/i915_irq.c | 44 +++++++++++++++++++++---------------- drivers/gpu/drm/i915/i915_reg.h | 1 + 3 files changed, 27 insertions(+), 20 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +1 -1
@@ -1997,7 +1997,7 @@ static int pipe_crc_set_source(struct drm_device *dev, enum pipe pipe,u32 val;int ret; -if (!(IS_IVYBRIDGE (dev) ||IS_GEN5 (dev) ||IS_GEN6 (dev))) +if (!(INTEL_INFO (dev)->gen >=5 && !IS_VALLEYVIEW (dev)))return -ENODEV ;if (pipe_crc->source == source)
drivers/gpu/drm/i915/i915_irq.c +25 -19
67 lines not on this page · raw message
drivers/gpu/drm/i915/i915_reg.h +1 -0
@@ -728,6 +728,7 @@#define ERR_INT_PIPE_CRC_DONE_B (1<<5)#define ERR_INT_FIFO_UNDERRUN_B (1<<3)#define ERR_INT_PIPE_CRC_DONE_A (1<<2) +#define ERR_INT_PIPE_CRC_DONE (pipe) (1<<(2 + pipe*3))#define ERR_INT_FIFO_UNDERRUN_A (1<<0)#define ERR_INT_FIFO_UNDERRUN (pipe) (1<<(pipe*3))
Signature · 1 line
1.8.4.rc3
Re: [PATCH 07/16] drm/i915: crc support for hsw
Quoted 11 lines · Daniel Vetter
hw designers decided to change the CRC registers and coalesce them all into one. Otherwise nothing changed. I've opted for a new
hsw_version to grab the crc sample since hsw+1 will have the same crc registers, but different interrupt source registers. So this little helper function will come handy there.Also refactor the display error handler with a neat pipe loop.
v2: Use
for_each_pipe.Signed-off-by Daniel Vetter <[email protected]>
Patches 1-7 are:
Signature · 1 line
Damien
Re: [PATCH 07/16] drm/i915: crc support for hsw
Quoted 9 lines · Damien Lespiau
Quoted 8 lines · Daniel Vetter
hw designers decided to change the CRC registers and coalesce them all into one. Otherwise nothing changed. I've opted for a new
hsw_version to grab the crc sample since hsw+1 will have the same crc registers, but different interrupt source registers. So this little helper function will come handy there.Also refactor the display error handler with a neat pipe loop.
Quoted 7 lines
Quoted 3 lines
v2: Use
for_each_pipe.Signed-off-by Daniel Vetter <[email protected]>Patches 1-7 are:
Reviewed-by Damien Lespiau <[email protected]>
Thanks for the review, I've merged the patches thus far. -Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
PATCH 8/16 drm/i915: Adjust CRC capture for pre-gen5/vlv
In reply to Daniel VetterShould work down to gen2. The #defines for the interrupt sources are already there in PIPESTAT and are the same on all gmch platforms for gen2 up to vlv.
--- drivers/gpu/drm/i915/i915_irq.c | 28 +++++++++++++++++++--------- drivers/gpu/drm/i915/i915_reg.h | 30 +++++++++++++++--------------- 2 files changed, 34 insertions(+), 24 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +19 -9
@@ -1249,21 +1249,31 @@ static void ivb_pipe_crc_update(struct drm_device *dev, enum pipe pipe) I915_READ(PIPE_CRC_RES_5_IVB(pipe))); } -static void ilk_pipe_crc_update (struct drm_device *dev,enum pipe pipe) +static void i9xx_pipe_crc_update (struct drm_device *dev,enum pipe pipe) {struct drm_i915_private *dev_priv = dev->dev_private; +uint32_t res1, res2; + +if (INTEL_INFO (dev)->gen >=3 ) + res1 =I915_READ (PIPE_CRC_RES_RES1_I915 (pipe)); +else + res1 =0 ; + +if (INTEL_INFO (dev)->gen >=5 ||IS_G4X (dev)) + res2 =I915_READ (PIPE_CRC_RES_RES2_G4X (pipe)); +else + res2 =0 ;display_pipe_crc_update (dev, pipe, -I915_READ (PIPE_CRC_RES_RED_ILK (pipe)), -I915_READ (PIPE_CRC_RES_GREEN_ILK (pipe)), -I915_READ (PIPE_CRC_RES_BLUE_ILK (pipe)), -I915_READ (PIPE_CRC_RES_RES1_ILK (pipe)), -I915_READ (PIPE_CRC_RES_RES2_ILK (pipe))); +I915_READ (PIPE_CRC_RES_RED (pipe)), +I915_READ (PIPE_CRC_RES_GREEN (pipe)), +I915_READ (PIPE_CRC_RES_BLUE (pipe)), + res1, res2); }#else static inline void hsw_pipe_crc_update (struct drm_device *dev,int pipe) {}static inline void ivb_pipe_crc_update (struct drm_device *dev,int pipe) {} -static inline void ilk_pipe_crc_update (struct drm_device *dev,int pipe) {} +static inline void i9xx_pipe_crc_update (struct drm_device *dev,int pipe) {}#endif /* The RPS events need forcewake, so we add them to a work queue and mask their
@@ -1543,10 +1553,10 @@ static void ilk_display_irq_handler(struct drm_device *dev, u32 de_iir)DRM_DEBUG_DRIVER ("Pipe B FIFO underrun\n" );if (de_iir &DE_PIPEA_CRC_DONE ) -ilk_pipe_crc_update (dev,PIPE_A ); +i9xx_pipe_crc_update (dev,PIPE_A );if (de_iir &DE_PIPEB_CRC_DONE ) -ilk_pipe_crc_update (dev,PIPE_B ); +i9xx_pipe_crc_update (dev,PIPE_B );if (de_iir &DE_PLANEA_FLIP_DONE ) {intel_prepare_page_flip (dev,0 );
drivers/gpu/drm/i915/i915_reg.h +15 -15
@@ -1858,11 +1858,11 @@#define _PIPE_CRC_RES_4_A_IVB 0x60070#define _PIPE_CRC_RES_5_A_IVB 0x60074 -#define _PIPE_CRC_RES_RED_A_ILK 0x60060 -#define _PIPE_CRC_RES_GREEN_A_ILK 0x60064 -#define _PIPE_CRC_RES_BLUE_A_ILK 0x60068 -#define _PIPE_CRC_RES_RES1_A_ILK 0x6006c -#define _PIPE_CRC_RES_RES2_A_ILK 0x60080 +#define _PIPE_CRC_RES_RED_A (dev_priv->info->display_mmio_offset + 0x60060) +#define _PIPE_CRC_RES_GREEN_A (dev_priv->info->display_mmio_offset + 0x60064) +#define _PIPE_CRC_RES_BLUE_A (dev_priv->info->display_mmio_offset + 0x60068) +#define _PIPE_CRC_RES_RES1_A_I915 (dev_priv->info->display_mmio_offset + 0x6006c) +#define _PIPE_CRC_RES_RES2_A_G4X (dev_priv->info->display_mmio_offset + 0x60080)/* Pipe B CRC regs */ #define _PIPE_CRC_CTL_B 0x61050
@@ -1884,16 +1884,16 @@#define PIPE_CRC_RES_5_IVB (pipe) \ _PIPE(pipe, _PIPE_CRC_RES_5_A_IVB, _PIPE_CRC_RES_5_B_IVB) -#define PIPE_CRC_RES_RED_ILK (pipe) \ - _PIPE_INC(pipe, _PIPE_CRC_RES_RED_A_ILK, 0x01000) -#define PIPE_CRC_RES_GREEN_ILK (pipe) \ - _PIPE_INC(pipe, _PIPE_CRC_RES_GREEN_A_ILK, 0x01000) -#define PIPE_CRC_RES_BLUE_ILK (pipe) \ - _PIPE_INC(pipe, _PIPE_CRC_RES_BLUE_A_ILK, 0x01000) -#define PIPE_CRC_RES_RES1_ILK (pipe) \ - _PIPE_INC(pipe, _PIPE_CRC_RES_RES1_A_ILK, 0x01000) -#define PIPE_CRC_RES_RES2_ILK (pipe) \ - _PIPE_INC(pipe, _PIPE_CRC_RES_RES2_A_ILK, 0x01000) +#define PIPE_CRC_RES_RED (pipe) \ + _PIPE_INC(pipe, _PIPE_CRC_RES_RED_A, 0x01000) +#define PIPE_CRC_RES_GREEN (pipe) \ + _PIPE_INC(pipe, _PIPE_CRC_RES_GREEN_A, 0x01000) +#define PIPE_CRC_RES_BLUE (pipe) \ + _PIPE_INC(pipe, _PIPE_CRC_RES_BLUE_A, 0x01000) +#define PIPE_CRC_RES_RES1_I915 (pipe) \ + _PIPE_INC(pipe, _PIPE_CRC_RES_RES1_A_I915, 0x01000) +#define PIPE_CRC_RES_RES2_G4X (pipe) \ + _PIPE_INC(pipe, _PIPE_CRC_RES_RES2_A_G4X, 0x01000)/* Pipe A timing regs */ #define _HTOTAL_A (dev_priv->info->display_mmio_offset + 0x60000)
Signature · 1 line
1.8.4.rc3
PATCH 9/16 drm/i915: CRC source selection #defines for gmch/vlv chips
In reply to Daniel VetterA bit a mess, since with DP/TV outputs we can't use the pipe CRC. Also, no plane CRCs, so we need to update the basic testcases.
--- drivers/gpu/drm/i915/i915_reg.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +22 -0
@@ -1843,15 +1843,37 @@/* Pipe A CRC regs */ #define _PIPE_CRC_CTL_A (dev_priv->info->display_mmio_offset + 0x60050)#define PIPE_CRC_ENABLE (1 << 31) +/* ivb+ source selection */ #define PIPE_CRC_SOURCE_PRIMARY_IVB (0 << 29)#define PIPE_CRC_SOURCE_SPRITE_IVB (1 << 29)#define PIPE_CRC_SOURCE_PF_IVB (2 << 29) +/* ilk+ source selection */ #define PIPE_CRC_SOURCE_PRIMARY_ILK (0 << 28)#define PIPE_CRC_SOURCE_SPRITE_ILK (1 << 28)#define PIPE_CRC_SOURCE_PIPE_ILK (2 << 28)/* embedded DP port on the north display block, reserved on ivb */ #define PIPE_CRC_SOURCE_PORT_A_ILK (4 << 28)#define PIPE_CRC_SOURCE_FDI_ILK (5 << 28)/* reserved on ivb */ +/* vlv source selection */ +#define PIPE_CRC_SOURCE_PIPE_VLV (0 << 27) +#define PIPE_CRC_SOURCE_HDMIB_VLV (1 << 27) +#define PIPE_CRC_SOURCE_HDMIC_VLV (2 << 27) +/* with DP port the pipe source is invalid */ +#define PIPE_CRC_SOURCE_DP_D_VLV (3 << 27) +#define PIPE_CRC_SOURCE_DP_B_VLV (6 << 27) +#define PIPE_CRC_SOURCE_DP_C_VLV (7 << 27) +/* gen3+ source selection */ +#define PIPE_CRC_SOURCE_PIPE_I9XX (0 << 28) +#define PIPE_CRC_SOURCE_SDVOB_I9XX (1 << 28) +#define PIPE_CRC_SOURCE_SDVOC_I9XX (2 << 28) +/* with DP/TV port the pipe source is invalid */ +#define PIPE_CRC_SOURCE_DP_D_G4X (3 << 28) +#define PIPE_CRC_SOURCE_TV_PRE (4 << 28) +#define PIPE_CRC_SOURCE_TV_POST (5 << 28) +#define PIPE_CRC_SOURCE_DP_B_G4X (6 << 28) +#define PIPE_CRC_SOURCE_DP_C_G4X (7 << 28) +/* gen2 doesn't have source selection bits */ +#define _PIPE_CRC_RES_1_A_IVB 0x60064#define _PIPE_CRC_RES_2_A_IVB 0x60068#define _PIPE_CRC_RES_3_A_IVB 0x6006c
Signature · 1 line
1.8.4.rc3
PATCH 10/16 drm/i915: Wire up CRC interrupts for pre-gen5/vlv
In reply to Daniel VetterAnd throw in a tiny for_each_pipe refactoring for gen2.
--- drivers/gpu/drm/i915/i915_irq.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +16 -6
@@ -1350,6 +1350,9 @@ static irqreturn_t valleyview_irq_handler(int irq, void *arg)intel_prepare_page_flip (dev, pipe);intel_finish_page_flip (dev, pipe); } + +if (pipe_stats[pipe] &PIPE_CRC_DONE_INTERRUPT_STATUS ) +i9xx_pipe_crc_update (dev, pipe); }/* Consume port. Then clear IIR or we'll miss events */
@@ -2800,13 +2803,14 @@ static irqreturn_t i8xx_irq_handler(int irq, void *arg)if (iir &I915_USER_INTERRUPT )notify_ring (dev, &dev_priv->ring[RCS ]); -if (pipe_stats[0 ] &PIPE_VBLANK_INTERRUPT_STATUS && -i8xx_handle_vblank (dev,0 , iir)) - flip_mask &= ~DISPLAY_PLANE_FLIP_PENDING (0 ); +for_each_pipe (pipe) { +if (pipe_stats[pipe] &PIPE_VBLANK_INTERRUPT_STATUS && +i8xx_handle_vblank (dev, pipe, iir)) + flip_mask &= ~DISPLAY_PLANE_FLIP_PENDING (pipe); -if (pipe_stats[1 ] &PIPE_VBLANK_INTERRUPT_STATUS && -i8xx_handle_vblank (dev,1 , iir)) - flip_mask &= ~DISPLAY_PLANE_FLIP_PENDING (1 ); +if (pipe_stats[pipe] &PIPE_CRC_DONE_INTERRUPT_STATUS ) +i9xx_pipe_crc_update (dev, pipe); + } iir = new_iir; }
@@ -2999,6 +3003,9 @@ static irqreturn_t i915_irq_handler(int irq, void *arg)if (pipe_stats[pipe] &PIPE_LEGACY_BLC_EVENT_STATUS ) blc_event = true; + +if (pipe_stats[pipe] &PIPE_CRC_DONE_INTERRUPT_STATUS ) +i9xx_pipe_crc_update (dev, pipe); }if (blc_event || (iir &I915_ASLE_INTERRUPT ))
@@ -3243,6 +3250,9 @@ static irqreturn_t i965_irq_handler(int irq, void *arg)if (pipe_stats[pipe] &PIPE_LEGACY_BLC_EVENT_STATUS ) blc_event = true; + +if (pipe_stats[pipe] &PIPE_CRC_DONE_INTERRUPT_STATUS ) +i9xx_pipe_crc_update (dev, pipe); }
Signature · 1 line
1.8.4.rc3
PATCH 11/16 drm/i915: Enable CRC interrupts on pre-gen5/vlv
In reply to Daniel Vetter--- drivers/gpu/drm/i915/i915_irq.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_irq.c +20 -1
@@ -2574,7 +2574,8 @@ static int valleyview_irq_postinstall(struct drm_device *dev) {drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;u32 enable_mask; -u32 pipestat_enable =PLANE_FLIP_DONE_INT_EN_VLV ; +u32 pipestat_enable =PLANE_FLIP_DONE_INT_EN_VLV | +PIPE_CRC_DONE_ENABLE ;unsigned long irqflags; enable_mask =I915_DISPLAY_PORT_INTERRUPT ;
@@ -2697,6 +2698,7 @@ static void i8xx_irq_preinstall(struct drm_device * dev)static int i8xx_irq_postinstall (struct drm_device *dev) {drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; +unsigned long irqflags;I915_WRITE16 (EMR , ~(I915_ERROR_PAGE_TABLE |I915_ERROR_MEMORY_REFRESH ));
@@ -2717,6 +2719,13 @@ static int i8xx_irq_postinstall(struct drm_device *dev) I915_USER_INTERRUPT);POSTING_READ16 (IER ); +/* Interrupt setup is already guaranteed to be single-threaded, this is +* just to make the assert_spin_locked check happy. */ +spin_lock_irqsave (&dev_priv->irq_lock, irqflags); +i915_enable_pipestat (dev_priv,0 ,PIPE_CRC_DONE_ENABLE ); +i915_enable_pipestat (dev_priv,1 ,PIPE_CRC_DONE_ENABLE ); +spin_unlock_irqrestore (&dev_priv->irq_lock, irqflags); +return 0 ; }
@@ -2857,6 +2866,7 @@ static int i915_irq_postinstall(struct drm_device *dev) {drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;u32 enable_mask; +unsigned long irqflags;I915_WRITE (EMR , ~(I915_ERROR_PAGE_TABLE |I915_ERROR_MEMORY_REFRESH ));
@@ -2892,6 +2902,13 @@ static int i915_irq_postinstall(struct drm_device *dev)i915_enable_asle_pipestat (dev); +/* Interrupt setup is already guaranteed to be single-threaded, this is +* just to make the assert_spin_locked check happy. */ +spin_lock_irqsave (&dev_priv->irq_lock, irqflags); +i915_enable_pipestat (dev_priv,0 ,PIPE_CRC_DONE_ENABLE ); +i915_enable_pipestat (dev_priv,1 ,PIPE_CRC_DONE_ENABLE ); +spin_unlock_irqrestore (&dev_priv->irq_lock, irqflags); +return 0 ; }
@@ -3105,6 +3122,8 @@ static int i965_irq_postinstall(struct drm_device *dev)* just to make the assert_spin_locked check happy. */ spin_lock_irqsave (&dev_priv->irq_lock, irqflags);i915_enable_pipestat (dev_priv,0 ,PIPE_GMBUS_EVENT_ENABLE ); +i915_enable_pipestat (dev_priv,0 ,PIPE_CRC_DONE_ENABLE ); +i915_enable_pipestat (dev_priv,1 ,PIPE_CRC_DONE_ENABLE );spin_unlock_irqrestore (&dev_priv->irq_lock, irqflags);/*
Signature · 1 line
1.8.4.rc3
Re: [PATCH 11/16] drm/i915: Enable CRC interrupts on pre-gen5/vlv
Quoted 28 lines · Daniel Vetter
Signed-off-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/i915/i915_irq.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/i915_irq.c +3
-1@@ -2574,7 +2574,8 @@ static int valleyview_irq_postinstall(struct drm_device *dev) {drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;u32 enable_mask; -u32 pipestat_enable =PLANE_FLIP_DONE_INT_EN_VLV ; +u32 pipestat_enable =PLANE_FLIP_DONE_INT_EN_VLV | +PIPE_CRC_DONE_ENABLE ;unsigned long irqflags; enable_mask =I915_DISPLAY_PORT_INTERRUPT ;@@ -2697,6 +2698,7 @@ static void i8xx_irq_preinstall(struct drm_device * dev)static int i8xx_irq_postinstall (struct drm_device *dev) {drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; +unsigned long irqflags;I915_WRITE16 (EMR , ~(I915_ERROR_PAGE_TABLE |I915_ERROR_MEMORY_REFRESH ));
drivers/gpu/drm/i915/i915_irq.c static int i8xx_irq_postinstall(struct drm_device *dev) · line 2726
Quoted 8 lines
drivers/gpu/drm/i915/i915_irq.c +5
-0@@ -2717,6 +2719,13 @@ static int i8xx_irq_postinstall(struct drm_device *dev) I915_USER_INTERRUPT);POSTING_READ16 (IER ); +/* Interrupt setup is already guaranteed to be single-threaded, this is +* just to make the assert_spin_locked check happy. */ +spin_lock_irqsave (&dev_priv->irq_lock, irqflags); +i915_enable_pipestat (dev_priv,0 ,PIPE_CRC_DONE_ENABLE ); +i915_enable_pipestat (dev_priv,1 ,PIPE_CRC_DONE_ENABLE );
Could use PIPE_A/B instead of raw numbers. Maybe a separate patch to fix it all up since we're already using raw numbers in some other places in i915_irq.c.
Quoted 43 lines
drivers/gpu/drm/i915/i915_irq.c +12
-0+spin_unlock_irqrestore (&dev_priv->irq_lock, irqflags); +return 0 ; }@@ -2857,6 +2866,7 @@ static int i915_irq_postinstall(struct drm_device *dev) {drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;u32 enable_mask; +unsigned long irqflags;I915_WRITE (EMR , ~(I915_ERROR_PAGE_TABLE |I915_ERROR_MEMORY_REFRESH ));@@ -2892,6 +2902,13 @@ static int i915_irq_postinstall(struct drm_device *dev)i915_enable_asle_pipestat (dev); +/* Interrupt setup is already guaranteed to be single-threaded, this is +* just to make the assert_spin_locked check happy. */ +spin_lock_irqsave (&dev_priv->irq_lock, irqflags); +i915_enable_pipestat (dev_priv,0 ,PIPE_CRC_DONE_ENABLE ); +i915_enable_pipestat (dev_priv,1 ,PIPE_CRC_DONE_ENABLE ); +spin_unlock_irqrestore (&dev_priv->irq_lock, irqflags); +return 0 ; }@@ -3105,6 +3122,8 @@ static int i965_irq_postinstall(struct drm_device *dev)* just to make the assert_spin_locked check happy. */ spin_lock_irqsave (&dev_priv->irq_lock, irqflags);i915_enable_pipestat (dev_priv,0 ,PIPE_GMBUS_EVENT_ENABLE ); +i915_enable_pipestat (dev_priv,0 ,PIPE_CRC_DONE_ENABLE ); +i915_enable_pipestat (dev_priv,1 ,PIPE_CRC_DONE_ENABLE );spin_unlock_irqrestore (&dev_priv->irq_lock, irqflags);/* Signature · 6 lines
1.8.4.rc3 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Ville Syrjälä Intel OTC
Re: [PATCH 11/16] drm/i915: Enable CRC interrupts on pre-gen5/vlv
Quoted 32 lines · Ville Syrjälä
Quoted 31 lines · Daniel Vetter
Signed-off-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/i915/i915_irq.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/i915_irq.c +3
-1@@ -2574,7 +2574,8 @@ static int valleyview_irq_postinstall(struct drm_device *dev) {drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;u32 enable_mask; -u32 pipestat_enable =PLANE_FLIP_DONE_INT_EN_VLV ; +u32 pipestat_enable =PLANE_FLIP_DONE_INT_EN_VLV | +PIPE_CRC_DONE_ENABLE ;unsigned long irqflags; enable_mask =I915_DISPLAY_PORT_INTERRUPT ;@@ -2697,6 +2698,7 @@ static void i8xx_irq_preinstall(struct drm_device * dev)static int i8xx_irq_postinstall (struct drm_device *dev) {drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; +unsigned long irqflags;I915_WRITE16 (EMR , ~(I915_ERROR_PAGE_TABLE |I915_ERROR_MEMORY_REFRESH ));@@ -2717,6 +2719,13 @@ static int i8xx_irq_postinstall(struct drm_device *dev) I915_USER_INTERRUPT);POSTING_READ16 (IER );
Quoted 9 lines
drivers/gpu/drm/i915/i915_irq.c static int i8xx_irq_postinstall(struct drm_device *dev) · line 2726
Quoted 5 lines
drivers/gpu/drm/i915/i915_irq.c +5
-0+/* Interrupt setup is already guaranteed to be single-threaded, this is +* just to make the assert_spin_locked check happy. */ +spin_lock_irqsave (&dev_priv->irq_lock, irqflags); +i915_enable_pipestat (dev_priv,0 ,PIPE_CRC_DONE_ENABLE ); +i915_enable_pipestat (dev_priv,1 ,PIPE_CRC_DONE_ENABLE );Could use PIPE_A/B instead of raw numbers. Maybe a separate patch to fix it all up since we're already using raw numbers in some other places in
i915_irq.c.
Yeah, this is just for consistency. I'll do a follow-up patch to sprinkle nice enums over i915_irq.c. There's also 1-2 places that would benefit from a for_each_pipe loop.
-Daniel
Quoted 48 lines
Quoted 44 lines
drivers/gpu/drm/i915/i915_irq.c +12
-0+spin_unlock_irqrestore (&dev_priv->irq_lock, irqflags); +return 0 ; }@@ -2857,6 +2866,7 @@ static int i915_irq_postinstall(struct drm_device *dev) {drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;u32 enable_mask; +unsigned long irqflags;I915_WRITE (EMR , ~(I915_ERROR_PAGE_TABLE |I915_ERROR_MEMORY_REFRESH ));@@ -2892,6 +2902,13 @@ static int i915_irq_postinstall(struct drm_device *dev)i915_enable_asle_pipestat (dev); +/* Interrupt setup is already guaranteed to be single-threaded, this is +* just to make the assert_spin_locked check happy. */ +spin_lock_irqsave (&dev_priv->irq_lock, irqflags); +i915_enable_pipestat (dev_priv,0 ,PIPE_CRC_DONE_ENABLE ); +i915_enable_pipestat (dev_priv,1 ,PIPE_CRC_DONE_ENABLE ); +spin_unlock_irqrestore (&dev_priv->irq_lock, irqflags); +return 0 ; }@@ -3105,6 +3122,8 @@ static int i965_irq_postinstall(struct drm_device *dev)* just to make the assert_spin_locked check happy. */ spin_lock_irqsave (&dev_priv->irq_lock, irqflags);i915_enable_pipestat (dev_priv,0 ,PIPE_GMBUS_EVENT_ENABLE ); +i915_enable_pipestat (dev_priv,0 ,PIPE_CRC_DONE_ENABLE ); +i915_enable_pipestat (dev_priv,1 ,PIPE_CRC_DONE_ENABLE );spin_unlock_irqrestore (&dev_priv->irq_lock, irqflags);/* Signature · 6 lines
1.8.4.rc3 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfxSignature · 2 lines
Ville Syrjälä Intel OTC
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
PATCH 12/16 drm/i915: Fix PIPE_CRC_CTL for vlv
In reply to Daniel VetterThe PIPE_B #define was missing the display mmio offset. Use the _PIPE_INC macro instead, it's simpler.
--- drivers/gpu/drm/i915/i915_reg.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +1 -2
@@ -1887,14 +1887,13 @@#define _PIPE_CRC_RES_RES2_A_G4X (dev_priv->info->display_mmio_offset + 0x60080)/* Pipe B CRC regs */ -#define _PIPE_CRC_CTL_B 0x61050#define _PIPE_CRC_RES_1_B_IVB 0x61064#define _PIPE_CRC_RES_2_B_IVB 0x61068#define _PIPE_CRC_RES_3_B_IVB 0x6106c#define _PIPE_CRC_RES_4_B_IVB 0x61070#define _PIPE_CRC_RES_5_B_IVB 0x61074 -#define PIPE_CRC_CTL (pipe) _PIPE(pipe, _PIPE_CRC_CTL_A, _PIPE_CRC_CTL_B) +#define PIPE_CRC_CTL (pipe) _PIPE_INC(pipe, _PIPE_CRC_CTL_A, 0x01000)#define PIPE_CRC_RES_1_IVB (pipe) \ _PIPE(pipe, _PIPE_CRC_RES_1_A_IVB, _PIPE_CRC_RES_1_B_IVB)#define PIPE_CRC_RES_2_IVB (pipe) \
Signature · 1 line
1.8.4.rc3
Re: [PATCH 12/16] drm/i915: Fix PIPE_CRC_CTL for vlv
Quoted 13 lines · Daniel Vetter
The
PIPE_B#define was missing the display mmio offset. Use the_PIPE_INCmacro instead, it's simpler.Signed-off-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/i915/i915_reg.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/gpu/drm/i915/i915_reg.h +0
-0
drivers/gpu/drm/i915/i915_reg.h line 1894
Quoted 9 lines
drivers/gpu/drm/i915/i915_reg.h +0
-1@@ -1887,14 +1887,13 @@#define _PIPE_CRC_RES_RES2_A_G4X (dev_priv->info->display_mmio_offset + 0x60080)/* Pipe B CRC regs */ -#define _PIPE_CRC_CTL_B 0x61050#define _PIPE_CRC_RES_1_B_IVB 0x61064#define _PIPE_CRC_RES_2_B_IVB 0x61068#define _PIPE_CRC_RES_3_B_IVB 0x6106c#define _PIPE_CRC_RES_4_B_IVB 0x61070#define _PIPE_CRC_RES_5_B_IVB 0x61074
Maybe use _PIPE_INC() for these IVB regs as well. They're the only CRC regs left using _PIPE(), so they feel a bit out of place.
Quoted 13 lines
drivers/gpu/drm/i915/i915_reg.h +1
-1-#define PIPE_CRC_CTL (pipe) _PIPE(pipe, _PIPE_CRC_CTL_A, _PIPE_CRC_CTL_B) +#define PIPE_CRC_CTL (pipe) _PIPE_INC(pipe, _PIPE_CRC_CTL_A, 0x01000)#define PIPE_CRC_RES_1_IVB (pipe) \ _PIPE(pipe, _PIPE_CRC_RES_1_A_IVB, _PIPE_CRC_RES_1_B_IVB)#define PIPE_CRC_RES_2_IVB (pipe) \Signature · 6 lines
1.8.4.rc3 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Ville Syrjälä Intel OTC
Re: [PATCH 12/16] drm/i915: Fix PIPE_CRC_CTL for vlv
Quoted 16 lines · Ville Syrjälä
Quoted 15 lines · Daniel Vetter
The
PIPE_B#define was missing the display mmio offset. Use the_PIPE_INCmacro instead, it's simpler.Signed-off-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/i915/i915_reg.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/gpu/drm/i915/i915_reg.h +0
-0@@ -1887,14 +1887,13 @@#define _PIPE_CRC_RES_RES2_A_G4X (dev_priv->info->display_mmio_offset + 0x60080)
Quoted 10 lines
drivers/gpu/drm/i915/i915_reg.h line 1894
Quoted 7 lines
drivers/gpu/drm/i915/i915_reg.h +0
-1/* Pipe B CRC regs */ -#define _PIPE_CRC_CTL_B 0x61050#define _PIPE_CRC_RES_1_B_IVB 0x61064#define _PIPE_CRC_RES_2_B_IVB 0x61068#define _PIPE_CRC_RES_3_B_IVB 0x6106c#define _PIPE_CRC_RES_4_B_IVB 0x61070#define _PIPE_CRC_RES_5_B_IVB 0x61074Maybe use
_PIPE_INC()for these IVB regs as well. They're the only CRC regs left using_PIPE(), so they feel a bit out of place.
The _PIPE_INC stuff is essentially just a "throw stuff at the wall and see whether it sticks" test. The idea is that with the doc rework registers for new platforms are already tightly grouped, so the base+increment is easier to review. If people like it we could do a mass conversion (and decently cut down the size of i915_reg.h). That would also help to make the odd cases like vlv+1 stick out more.
-Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
PATCH 13/16 drm/i915: Add new CRC sources
In reply to Daniel VetterOn pre-gen5 and vlv we can't use the pipe source when TV-out or a DP port is connected to the pipe. Hence we need to expose new CRC sources.
Also simplify the existing pipe source platform code a bit by rejecting all unhandled sources by default.
--- drivers/gpu/drm/i915/i915_debugfs.c | 16 ++++++++++------ drivers/gpu/drm/i915/i915_drv.h | 5 +++++ 2 files changed, 15 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +10 -6
@@ -1915,6 +1915,10 @@ static const char * const pipe_crc_sources[] = {"plane2" ,"pf" ,"pipe" , +"TV" , +"DP-B" , +"DP-C" , + "DP-D", };static const char *pipe_crc_source_name (enum intel_pipe_crc_source source)
@@ -1953,14 +1957,14 @@ static int ilk_pipe_crc_ctl_reg(enum intel_pipe_crc_source source,case INTEL_PIPE_CRC_SOURCE_PLANE2 : *val =PIPE_CRC_ENABLE |PIPE_CRC_SOURCE_SPRITE_ILK ;break ; -case INTEL_PIPE_CRC_SOURCE_PF : -return -EINVAL ;case INTEL_PIPE_CRC_SOURCE_PIPE : *val =PIPE_CRC_ENABLE |PIPE_CRC_SOURCE_PIPE_ILK ;break ; -default : +case INTEL_PIPE_CRC_SOURCE_NONE : *val =0 ;break ; +default : +return -EINVAL ; }return 0 ;
@@ -1979,11 +1983,11 @@ static int ivb_pipe_crc_ctl_reg(enum intel_pipe_crc_source source,case INTEL_PIPE_CRC_SOURCE_PF : *val =PIPE_CRC_ENABLE |PIPE_CRC_SOURCE_PF_IVB ;break ; -case INTEL_PIPE_CRC_SOURCE_PIPE : -return -EINVAL ; -default : +case INTEL_PIPE_CRC_SOURCE_NONE : *val =0 ;break ; +default : +return -EINVAL ; }return 0 ;
drivers/gpu/drm/i915/i915_drv.h +5 -0
@@ -1223,6 +1223,11 @@ enum intel_pipe_crc_source {INTEL_PIPE_CRC_SOURCE_PLANE2 ,INTEL_PIPE_CRC_SOURCE_PF ,INTEL_PIPE_CRC_SOURCE_PIPE , +/* TV/DP on pre-gen5/vlv can't use the pipe source. */ +INTEL_PIPE_CRC_SOURCE_TV , +INTEL_PIPE_CRC_SOURCE_DP_B , +INTEL_PIPE_CRC_SOURCE_DP_C , +INTEL_PIPE_CRC_SOURCE_DP_D , INTEL_PIPE_CRC_SOURCE_MAX, };
Signature · 1 line
1.8.4.rc3
PATCH 14/16 drm/i915: Wire up CRC support for gen3/4
In reply to Daniel Vetter--- drivers/gpu/drm/i915/i915_debugfs.c | 44 +++++++++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +42 -2
@@ -1947,6 +1947,44 @@ static int display_crc_ctl_open(struct inode *inode, struct file *file)return single_open (file, display_crc_ctl_show, dev); } +static int i9xx_pipe_crc_ctl_reg (struct drm_device *dev, +enum intel_pipe_crc_source source, +uint32_t *val) +{ +switch (source) { +case INTEL_PIPE_CRC_SOURCE_PIPE : + *val =PIPE_CRC_ENABLE |PIPE_CRC_SOURCE_PIPE_I9XX ; +break ; +case INTEL_PIPE_CRC_SOURCE_TV : +if (!SUPPORTS_TV (dev)) +return -EINVAL ; + *val =PIPE_CRC_ENABLE |PIPE_CRC_SOURCE_TV_PRE ; +break ; +case INTEL_PIPE_CRC_SOURCE_DP_B : +if (!IS_G4X (dev)) +return -EINVAL ; + *val =PIPE_CRC_ENABLE |PIPE_CRC_SOURCE_DP_B_G4X ; +break ; +case INTEL_PIPE_CRC_SOURCE_DP_C : +if (!IS_G4X (dev)) +return -EINVAL ; + *val =PIPE_CRC_ENABLE |PIPE_CRC_SOURCE_DP_C_G4X ; +break ; +case INTEL_PIPE_CRC_SOURCE_DP_D : +if (!IS_G4X (dev)) +return -EINVAL ; + *val =PIPE_CRC_ENABLE |PIPE_CRC_SOURCE_DP_D_G4X ; +break ; +case INTEL_PIPE_CRC_SOURCE_NONE : + *val =0 ; +break ; +default : +return -EINVAL ; + } + +return 0 ; +} +static int ilk_pipe_crc_ctl_reg (enum intel_pipe_crc_source source,uint32_t *val) {
@@ -2001,7 +2039,7 @@ static int pipe_crc_set_source(struct drm_device *dev, enum pipe pipe,u32 val;int ret; -if (!(INTEL_INFO (dev)->gen >=5 && !IS_VALLEYVIEW (dev))) +if (!(INTEL_INFO (dev)->gen >=3 && !IS_VALLEYVIEW (dev)))return -ENODEV ;if (pipe_crc->source == source)
@@ -2011,7 +2049,9 @@ static int pipe_crc_set_source(struct drm_device *dev, enum pipe pipe,if (pipe_crc->source && source)return -EINVAL ; -if (IS_GEN5 (dev) ||IS_GEN6 (dev)) +if (INTEL_INFO (dev)->gen <5 ) + ret =i9xx_pipe_crc_ctl_reg (dev, source, &val); +else if (IS_GEN5 (dev) ||IS_GEN6 (dev)) ret =ilk_pipe_crc_ctl_reg (source, &val);else ret =ivb_pipe_crc_ctl_reg (source, &val);
Signature · 1 line
1.8.4.rc3
PATCH 15/16 drm/i915: Wire up gen2 CRC support
In reply to Daniel VetterReally simple, and we don't even have working frame numbers.
--- drivers/gpu/drm/i915/i915_debugfs.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_debugfs.c +17 -1
@@ -1947,6 +1947,20 @@ static int display_crc_ctl_open(struct inode *inode, struct file *file)return single_open (file, display_crc_ctl_show, dev); } +static int i8xx_pipe_crc_ctl_reg (enum intel_pipe_crc_source source, +uint32_t *val) +{ +switch (source) { +case INTEL_PIPE_CRC_SOURCE_PIPE : + *val =PIPE_CRC_ENABLE ; +break ; +default : +return -EINVAL ; + } + +return 0 ; +} +static int i9xx_pipe_crc_ctl_reg (struct drm_device *dev,enum intel_pipe_crc_source source,uint32_t *val)
@@ -2049,7 +2063,9 @@ static int pipe_crc_set_source(struct drm_device *dev, enum pipe pipe,if (pipe_crc->source && source)return -EINVAL ; -if (INTEL_INFO (dev)->gen <5 ) +if (IS_GEN2 (dev)) + ret =i8xx_pipe_crc_ctl_reg (source, &val); +else if (INTEL_INFO (dev)->gen <5 ) ret =i9xx_pipe_crc_ctl_reg (dev, source, &val);else if (IS_GEN5 (dev) ||IS_GEN6 (dev)) ret =ilk_pipe_crc_ctl_reg (source, &val);
Signature · 1 line
1.8.4.rc3
PATCH 16/16 drm/i915: Wire up CRC for vlv
In reply to Daniel Vetter--- drivers/gpu/drm/i915/i915_debugfs.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
drivers/gpu/drm/i915/i915_debugfs.c +25 -0
@@ -1961,6 +1961,29 @@ static int i8xx_pipe_crc_ctl_reg(enum intel_pipe_crc_source source,return 0 ; } +static int vlv_pipe_crc_ctl_reg (enum intel_pipe_crc_source source, +uint32_t *val) +{ +switch (source) { +case INTEL_PIPE_CRC_SOURCE_PIPE : + *val =PIPE_CRC_ENABLE |PIPE_CRC_SOURCE_PIPE_VLV ; +break ; +case INTEL_PIPE_CRC_SOURCE_DP_B : + *val =PIPE_CRC_ENABLE |PIPE_CRC_SOURCE_DP_B_VLV ; +break ; +case INTEL_PIPE_CRC_SOURCE_DP_C : + *val =PIPE_CRC_ENABLE |PIPE_CRC_SOURCE_DP_C_VLV ; +break ; +case INTEL_PIPE_CRC_SOURCE_NONE : + *val =0 ; +break ; +default : +return -EINVAL ; + } + +return 0 ; +} +static int i9xx_pipe_crc_ctl_reg (struct drm_device *dev,enum intel_pipe_crc_source source,uint32_t *val)
@@ -2067,6 +2090,8 @@ static int pipe_crc_set_source(struct drm_device *dev, enum pipe pipe, ret =i8xx_pipe_crc_ctl_reg (source, &val); else if (INTEL_INFO(dev)->gen < 5) ret =i9xx_pipe_crc_ctl_reg (dev, source, &val); + else if (IS_VALLEYVIEW(dev)) + ret =vlv_pipe_crc_ctl_reg (source, &val); else if (IS_GEN5(dev) || IS_GEN6(dev)) ret =ilk_pipe_crc_ctl_reg (source, &val); else
Signature · 1 line
1.8.4.rc3
PATCH 1/3 drm/i915: Wire up gen2 CRC support
Really simple, and we don't even have working frame numbers.
v2: Actually enable it ...
--- drivers/gpu/drm/i915/i915_debugfs.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +18 -2
@@ -1947,6 +1947,20 @@ static int display_crc_ctl_open(struct inode *inode, struct file *file)return single_open (file, display_crc_ctl_show, dev); } +static int i8xx_pipe_crc_ctl_reg (enum intel_pipe_crc_source source, +uint32_t *val) +{ +switch (source) { +case INTEL_PIPE_CRC_SOURCE_PIPE : + *val =PIPE_CRC_ENABLE ; +break ; +default : +return -EINVAL ; + } + +return 0 ; +} +static int i9xx_pipe_crc_ctl_reg (struct drm_device *dev,enum intel_pipe_crc_source source,uint32_t *val)
@@ -2039,7 +2053,7 @@ static int pipe_crc_set_source(struct drm_device *dev, enum pipe pipe,u32 val;int ret; -if (!(INTEL_INFO (dev)->gen >=3 && !IS_VALLEYVIEW (dev))) +if (IS_VALLEYVIEW (dev))return -ENODEV ;if (pipe_crc->source == source)
@@ -2049,7 +2063,9 @@ static int pipe_crc_set_source(struct drm_device *dev, enum pipe pipe,if (pipe_crc->source && source)return -EINVAL ; -if (INTEL_INFO (dev)->gen <5 ) +if (IS_GEN2 (dev)) + ret =i8xx_pipe_crc_ctl_reg (source, &val); +else if (INTEL_INFO (dev)->gen <5 ) ret =i9xx_pipe_crc_ctl_reg (dev, source, &val);else if (IS_GEN5 (dev) ||IS_GEN6 (dev)) ret =ilk_pipe_crc_ctl_reg (source, &val);
Signature · 1 line
1.8.4.rc3
PATCH 2/3 drm/i915: Wire up CRC for vlv
v2: Actually enable it.
--- drivers/gpu/drm/i915/i915_debugfs.c | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +25 -3
@@ -1961,6 +1961,29 @@ static int i8xx_pipe_crc_ctl_reg(enum intel_pipe_crc_source source,return 0 ; } +static int vlv_pipe_crc_ctl_reg (enum intel_pipe_crc_source source, +uint32_t *val) +{ +switch (source) { +case INTEL_PIPE_CRC_SOURCE_PIPE : + *val =PIPE_CRC_ENABLE |PIPE_CRC_SOURCE_PIPE_VLV ; +break ; +case INTEL_PIPE_CRC_SOURCE_DP_B : + *val =PIPE_CRC_ENABLE |PIPE_CRC_SOURCE_DP_B_VLV ; +break ; +case INTEL_PIPE_CRC_SOURCE_DP_C : + *val =PIPE_CRC_ENABLE |PIPE_CRC_SOURCE_DP_C_VLV ; +break ; +case INTEL_PIPE_CRC_SOURCE_NONE : + *val =0 ; +break ; +default : +return -EINVAL ; + } + +return 0 ; +} +static int i9xx_pipe_crc_ctl_reg (struct drm_device *dev,enum intel_pipe_crc_source source,uint32_t *val)
@@ -2053,9 +2076,6 @@ static int pipe_crc_set_source(struct drm_device *dev, enum pipe pipe,u32 val;int ret; -if (IS_VALLEYVIEW (dev)) -return -ENODEV ; -if (pipe_crc->source == source)return 0 ;
@@ -2067,6 +2087,8 @@ static int pipe_crc_set_source(struct drm_device *dev, enum pipe pipe, ret =i8xx_pipe_crc_ctl_reg (source, &val); else if (INTEL_INFO(dev)->gen < 5) ret =i9xx_pipe_crc_ctl_reg (dev, source, &val); + else if (IS_VALLEYVIEW(dev)) + ret =vlv_pipe_crc_ctl_reg (source, &val); else if (IS_GEN5(dev) || IS_GEN6(dev)) ret =ilk_pipe_crc_ctl_reg (source, &val); else
Signature · 1 line
1.8.4.rc3
PATCH 3/3 drm/i915: bikeshed the pipe CRC irq functions a bit
In reply to Daniel Vetter- Give them an _irq_handler postfix, like all the other irq stuff.
- Shuffle the DEBUG_FS=n dummy functions around a bit. This is prep work to extract all the crc debug stuff into intel_display_testing.c
--- drivers/gpu/drm/i915/i915_irq.c | 71 +++++++++++++++++++++-------------------- 1 file changed, 37 insertions(+), 34 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +37 -34
@@ -1190,10 +1190,10 @@ static void dp_aux_irq_handler(struct drm_device *dev) }#if defined(CONFIG_DEBUG_FS ) -static void display_pipe_crc_update (struct drm_device *dev,enum pipe pipe, -uint32_t crc0,uint32_t crc1, -uint32_t crc2,uint32_t crc3, -uint32_t crc4) +static void display_pipe_crc_irq_handler (struct drm_device *dev,enum pipe pipe, +uint32_t crc0,uint32_t crc1, +uint32_t crc2,uint32_t crc3, +uint32_t crc4) {struct drm_i915_private *dev_priv = dev->dev_private;struct intel_pipe_crc *pipe_crc = &dev_priv->pipe_crc[pipe];
@@ -1227,29 +1227,37 @@ static void display_pipe_crc_update(struct drm_device *dev, enum pipe pipe,wake_up_interruptible (&pipe_crc->wq); } +#else +static inline void +display_pipe_crc_irq_handler (struct drm_device *dev,enum pipe pipe, +uint32_t crc0,uint32_t crc1, +uint32_t crc2,uint32_t crc3, +uint32_t crc4) {} +#endif + -static void hsw_pipe_crc_update (struct drm_device *dev,enum pipe pipe) +static void hsw_pipe_crc_irq_handler (struct drm_device *dev,enum pipe pipe) {struct drm_i915_private *dev_priv = dev->dev_private; -display_pipe_crc_update (dev, pipe, -I915_READ (PIPE_CRC_RES_1_IVB (pipe)), -0 ,0 ,0 ,0 ); +display_pipe_crc_irq_handler (dev, pipe, +I915_READ (PIPE_CRC_RES_1_IVB (pipe)), +0 ,0 ,0 ,0 ); } -static void ivb_pipe_crc_update (struct drm_device *dev,enum pipe pipe) +static void ivb_pipe_crc_irq_handler (struct drm_device *dev,enum pipe pipe) {struct drm_i915_private *dev_priv = dev->dev_private; -display_pipe_crc_update (dev, pipe, -I915_READ (PIPE_CRC_RES_1_IVB (pipe)), -I915_READ (PIPE_CRC_RES_2_IVB (pipe)), -I915_READ (PIPE_CRC_RES_3_IVB (pipe)), -I915_READ (PIPE_CRC_RES_4_IVB (pipe)), -I915_READ (PIPE_CRC_RES_5_IVB (pipe))); +display_pipe_crc_irq_handler (dev, pipe, +I915_READ (PIPE_CRC_RES_1_IVB (pipe)), +I915_READ (PIPE_CRC_RES_2_IVB (pipe)), +I915_READ (PIPE_CRC_RES_3_IVB (pipe)), +I915_READ (PIPE_CRC_RES_4_IVB (pipe)), +I915_READ (PIPE_CRC_RES_5_IVB (pipe))); } -static void i9xx_pipe_crc_update (struct drm_device *dev,enum pipe pipe) +static void i9xx_pipe_crc_irq_handler (struct drm_device *dev,enum pipe pipe) {struct drm_i915_private *dev_priv = dev->dev_private;uint32_t res1, res2;
@@ -1264,17 +1272,12 @@ static void i9xx_pipe_crc_update(struct drm_device *dev, enum pipe pipe)else res2 =0 ; -display_pipe_crc_update (dev, pipe, -I915_READ (PIPE_CRC_RES_RED (pipe)), -I915_READ (PIPE_CRC_RES_GREEN (pipe)), -I915_READ (PIPE_CRC_RES_BLUE (pipe)), - res1, res2); +display_pipe_crc_irq_handler (dev, pipe, +I915_READ (PIPE_CRC_RES_RED (pipe)), +I915_READ (PIPE_CRC_RES_GREEN (pipe)), +I915_READ (PIPE_CRC_RES_BLUE (pipe)), + res1, res2); } -#else -static inline void hsw_pipe_crc_update (struct drm_device *dev,int pipe) {} -static inline void ivb_pipe_crc_update (struct drm_device *dev,int pipe) {} -static inline void i9xx_pipe_crc_update (struct drm_device *dev,int pipe) {} -#endif /* The RPS events need forcewake, so we add them to a work queue and mask their * IMR bits until the work is done. Other interrupts can be processed without
@@ -1352,7 +1355,7 @@ static irqreturn_t valleyview_irq_handler(int irq, void *arg) }if (pipe_stats[pipe] &PIPE_CRC_DONE_INTERRUPT_STATUS ) -i9xx_pipe_crc_update (dev, pipe); +i9xx_pipe_crc_irq_handler (dev, pipe); }/* Consume port. Then clear IIR or we'll miss events */
@@ -1456,9 +1459,9 @@ static void ivb_err_int_handler(struct drm_device *dev)if (err_int &ERR_INT_PIPE_CRC_DONE (pipe)) {if (IS_IVYBRIDGE (dev)) -ivb_pipe_crc_update (dev, pipe); +ivb_pipe_crc_irq_handler (dev, pipe);else -hsw_pipe_crc_update (dev, pipe); +hsw_pipe_crc_irq_handler (dev, pipe); } }
@@ -1556,10 +1559,10 @@ static void ilk_display_irq_handler(struct drm_device *dev, u32 de_iir)DRM_DEBUG_DRIVER ("Pipe B FIFO underrun\n" );if (de_iir &DE_PIPEA_CRC_DONE ) -i9xx_pipe_crc_update (dev,PIPE_A ); +i9xx_pipe_crc_irq_handler (dev,PIPE_A );if (de_iir &DE_PIPEB_CRC_DONE ) -i9xx_pipe_crc_update (dev,PIPE_B ); +i9xx_pipe_crc_irq_handler (dev,PIPE_B );if (de_iir &DE_PLANEA_FLIP_DONE ) {intel_prepare_page_flip (dev,0 );
@@ -2818,7 +2821,7 @@ static irqreturn_t i8xx_irq_handler(int irq, void *arg) flip_mask &= ~DISPLAY_PLANE_FLIP_PENDING (pipe);if (pipe_stats[pipe] &PIPE_CRC_DONE_INTERRUPT_STATUS ) -i9xx_pipe_crc_update (dev, pipe); +i9xx_pipe_crc_irq_handler (dev, pipe); } iir = new_iir;
@@ -3022,7 +3025,7 @@ static irqreturn_t i915_irq_handler(int irq, void *arg) blc_event = true;if (pipe_stats[pipe] &PIPE_CRC_DONE_INTERRUPT_STATUS ) -i9xx_pipe_crc_update (dev, pipe); +i9xx_pipe_crc_irq_handler (dev, pipe); }if (blc_event || (iir &I915_ASLE_INTERRUPT ))
@@ -3271,7 +3274,7 @@ static irqreturn_t i965_irq_handler(int irq, void *arg) blc_event = true;if (pipe_stats[pipe] &PIPE_CRC_DONE_INTERRUPT_STATUS ) -i9xx_pipe_crc_update (dev, pipe); +i9xx_pipe_crc_irq_handler (dev, pipe); }
Signature · 1 line
1.8.4.rc3
Re: [PATCH 1/3] drm/i915: Wire up gen2 CRC support
In reply to Daniel VetterQuoted 14 lines · Daniel Vetter
Really simple, and we don't even have working frame numbers.
v2: Actually enable it ...
Signed-off-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/i915/i915_debugfs.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-)drivers/gpu/drm/i915/i915_debugfs.c +0
-0
drivers/gpu/drm/i915/i915_debugfs.c static int display_crc_ctl_open(struct inode *inode, struct file *file) · line 1955
Quoted 9 lines
drivers/gpu/drm/i915/i915_debugfs.c +6
-0@@ -1947,6 +1947,20 @@ static int display_crc_ctl_open(struct inode *inode, struct file *file)return single_open (file, display_crc_ctl_show, dev); } +static int i8xx_pipe_crc_ctl_reg (enum intel_pipe_crc_source source, +uint32_t *val) +{ +switch (source) { +case INTEL_PIPE_CRC_SOURCE_PIPE : + *val =PIPE_CRC_ENABLE ;
On gen3+ the border is always included in the crc. Maybe we should always include it on gen2 as well?
Quoted 38 lines
drivers/gpu/drm/i915/i915_debugfs.c +12
-2+break ; +default : +return -EINVAL ; + } + +return 0 ; +} +static int i9xx_pipe_crc_ctl_reg (struct drm_device *dev,enum intel_pipe_crc_source source,uint32_t *val)@@ -2039,7 +2053,7 @@ static int pipe_crc_set_source(struct drm_device *dev, enum pipe pipe,u32 val;int ret; -if (!(INTEL_INFO (dev)->gen >=3 && !IS_VALLEYVIEW (dev))) +if (IS_VALLEYVIEW (dev))return -ENODEV ;if (pipe_crc->source == source)@@ -2049,7 +2063,9 @@ static int pipe_crc_set_source(struct drm_device *dev, enum pipe pipe,if (pipe_crc->source && source)return -EINVAL ; -if (INTEL_INFO (dev)->gen <5 ) +if (IS_GEN2 (dev)) + ret =i8xx_pipe_crc_ctl_reg (source, &val); +else if (INTEL_INFO (dev)->gen <5 ) ret =i9xx_pipe_crc_ctl_reg (dev, source, &val);else if (IS_GEN5 (dev) ||IS_GEN6 (dev)) ret =ilk_pipe_crc_ctl_reg (source, &val);Signature · 6 lines
1.8.4.rc3 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Ville Syrjälä Intel OTC
Re: [PATCH 1/3] drm/i915: Wire up gen2 CRC support
Quoted 18 lines · Ville Syrjälä
Quoted 17 lines · Daniel Vetter
Really simple, and we don't even have working frame numbers.
v2: Actually enable it ...
Signed-off-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/i915/i915_debugfs.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-)drivers/gpu/drm/i915/i915_debugfs.c +0
-0@@ -1947,6 +1947,20 @@ static int display_crc_ctl_open(struct inode *inode, struct file *file)return single_open (file, display_crc_ctl_show, dev); }
Quoted 9 lines
drivers/gpu/drm/i915/i915_debugfs.c static int display_crc_ctl_open(struct inode *inode, struct file *file) · line 1955
Quoted 6 lines
drivers/gpu/drm/i915/i915_debugfs.c +6
-0+static int i8xx_pipe_crc_ctl_reg (enum intel_pipe_crc_source source, +uint32_t *val) +{ +switch (source) { +case INTEL_PIPE_CRC_SOURCE_PIPE : + *val =PIPE_CRC_ENABLE ;On gen3+ the border is always included in the crc. Maybe we should always include it on gen2 as well?
I've considered but decided to go meh. But you're right, for consistency we should enable the border on gen2, too. I'll resend. -Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
PATCH 1/1 drm/i915: Wire up gen2 CRC support
Really simple, and we don't even have working frame numbers.
v2: Actually enable it ...
v3: Review from Ville:
- Unconditionally enable the border in the CRC checksum for consistency with gen3+.
- Handle the "none" source to be able to disable the CRC machinery again.
--- drivers/gpu/drm/i915/i915_debugfs.c | 23 +++++++++++++++++++++-- drivers/gpu/drm/i915/i915_reg.h | 1 + 2 files changed, 22 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +21 -2
@@ -1947,6 +1947,23 @@ static int display_crc_ctl_open(struct inode *inode, struct file *file)return single_open (file, display_crc_ctl_show, dev); } +static int i8xx_pipe_crc_ctl_reg (enum intel_pipe_crc_source source, +uint32_t *val) +{ +switch (source) { +case INTEL_PIPE_CRC_SOURCE_PIPE : + *val =PIPE_CRC_ENABLE |PIPE_CRC_INCLUDE_BORDER_I8XX ; +break ; +case INTEL_PIPE_CRC_SOURCE_NONE : + *val =0 ; +break ; +default : +return -EINVAL ; + } + +return 0 ; +} +static int i9xx_pipe_crc_ctl_reg (struct drm_device *dev,enum intel_pipe_crc_source source,uint32_t *val)
@@ -2039,7 +2056,7 @@ static int pipe_crc_set_source(struct drm_device *dev, enum pipe pipe,u32 val;int ret; -if (!(INTEL_INFO (dev)->gen >=3 && !IS_VALLEYVIEW (dev))) +if (IS_VALLEYVIEW (dev))return -ENODEV ;if (pipe_crc->source == source)
@@ -2049,7 +2066,9 @@ static int pipe_crc_set_source(struct drm_device *dev, enum pipe pipe,if (pipe_crc->source && source)return -EINVAL ; -if (INTEL_INFO (dev)->gen <5 ) +if (IS_GEN2 (dev)) + ret =i8xx_pipe_crc_ctl_reg (source, &val); +else if (INTEL_INFO (dev)->gen <5 ) ret =i9xx_pipe_crc_ctl_reg (dev, source, &val);else if (IS_GEN5 (dev) ||IS_GEN6 (dev)) ret =ilk_pipe_crc_ctl_reg (source, &val);
drivers/gpu/drm/i915/i915_reg.h +1 -0
@@ -1873,6 +1873,7 @@#define PIPE_CRC_SOURCE_DP_B_G4X (6 << 28)#define PIPE_CRC_SOURCE_DP_C_G4X (7 << 28)/* gen2 doesn't have source selection bits */ +#define PIPE_CRC_INCLUDE_BORDER_I8XX (1 << 30)#define _PIPE_CRC_RES_1_A_IVB 0x60064#define _PIPE_CRC_RES_2_A_IVB 0x60068
Signature · 6 lines
1.8.4.rc3 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH] drm/i915: Wire up gen2 CRC support
Quoted 4 lines · Daniel Vetter
Really simple, and we don't even have working frame numbers.
v2: Actually enable it ...
Quoted 8 lines
v3: Review from Ville:
- Unconditionally enable the border in the CRC checksum for consistency with gen3+.
- Handle the "none" source to be able to disable the CRC machinery again.Cc Ville Syrjälä <[email protected]>Signed-off-by Daniel Vetter <[email protected]>
Quoted 67 lines
--- drivers/gpu/drm/i915/i915_debugfs.c | 23 +++++++++++++++++++++-- drivers/gpu/drm/i915/i915_reg.h | 1 + 2 files changed, 22 insertions(+), 2 deletions(-)drivers/gpu/drm/i915/i915_debugfs.c +21
-2@@ -1947,6 +1947,23 @@ static int display_crc_ctl_open(struct inode *inode, struct file *file)return single_open (file, display_crc_ctl_show, dev); } +static int i8xx_pipe_crc_ctl_reg (enum intel_pipe_crc_source source, +uint32_t *val) +{ +switch (source) { +case INTEL_PIPE_CRC_SOURCE_PIPE : + *val =PIPE_CRC_ENABLE |PIPE_CRC_INCLUDE_BORDER_I8XX ; +break ; +case INTEL_PIPE_CRC_SOURCE_NONE : + *val =0 ; +break ; +default : +return -EINVAL ; + } + +return 0 ; +} +static int i9xx_pipe_crc_ctl_reg (struct drm_device *dev,enum intel_pipe_crc_source source,uint32_t *val)@@ -2039,7 +2056,7 @@ static int pipe_crc_set_source(struct drm_device *dev, enum pipe pipe,u32 val;int ret; -if (!(INTEL_INFO (dev)->gen >=3 && !IS_VALLEYVIEW (dev))) +if (IS_VALLEYVIEW (dev))return -ENODEV ;if (pipe_crc->source == source)@@ -2049,7 +2066,9 @@ static int pipe_crc_set_source(struct drm_device *dev, enum pipe pipe,if (pipe_crc->source && source)return -EINVAL ; -if (INTEL_INFO (dev)->gen <5 ) +if (IS_GEN2 (dev)) + ret =i8xx_pipe_crc_ctl_reg (source, &val); +else if (INTEL_INFO (dev)->gen <5 ) ret =i9xx_pipe_crc_ctl_reg (dev, source, &val);else if (IS_GEN5 (dev) ||IS_GEN6 (dev)) ret =ilk_pipe_crc_ctl_reg (source, &val);drivers/gpu/drm/i915/i915_reg.h +1
-0@@ -1873,6 +1873,7 @@#define PIPE_CRC_SOURCE_DP_B_G4X (6 << 28)#define PIPE_CRC_SOURCE_DP_C_G4X (7 << 28)/* gen2 doesn't have source selection bits */ +#define PIPE_CRC_INCLUDE_BORDER_I8XX (1 << 30)#define _PIPE_CRC_RES_1_A_IVB 0x60064#define _PIPE_CRC_RES_2_A_IVB 0x60068Signature · 1 line
1.8.4.rc3
Signature · 2 lines
Ville Syrjälä Intel OTC
Re: [PATCH] drm/i915: Wire up gen2 CRC support
Quoted 11 lines · Ville Syrjälä
Quoted 10 lines · Daniel Vetter
Really simple, and we don't even have working frame numbers.
v2: Actually enable it ...
v3: Review from Ville:
- Unconditionally enable the border in the CRC checksum for consistency with gen3+.
- Handle the "none" source to be able to disable the CRC machinery again.
Quoted 4 lines
Quoted 2 lines
Cc Ville Syrjälä <[email protected]>Signed-off-by Daniel Vetter <[email protected]>Reviewed-by Ville Syrjälä <[email protected]>
Thanks for your review, I've merged all the patches to dinq. -Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
Quoted 8 lines · Daniel Vetter
Hi all,
I've stitched together basic CRC support for non-ivb platforms. Still need to do a bit more testing on this, but ignoring bugs this should be it. We also need to pimp the igt testcase a bit so that it falls back to the new PIPE source if the PLANE1 source isn't available.
Review and comments highly welcome.
Apart from the three minor things I commented on, I couldn't find any real problems with the series. So the remainder of the series is:
Quoted 34 lines
Cheers, Daniel
Daniel Vetter (16):
drm/i915: extractdisplay_pipe_crc_updatedrm/i915: add CRC #defines for ilk/snb
drm/i915: wire up CRC interrupt for ilk/snb drm/i915: use ->get_vblank_counter for the crc frame counter drm/i915: wait one vblank when disabling CRCs drm/i915: fix CRC debugfs setup
drm/i915: crc support for hsw
drm/i915: Adjust CRC capture for pre-gen5/vlv drm/i915: CRC source selection #defines for gmch/vlv chips drm/i915: Wire up CRC interrupts for pre-gen5/vlv drm/i915: Enable CRC interrupts on pre-gen5/vlv drm/i915: FixPIPE_CRC_CTLfor vlv
drm/i915: Add new CRC sources
drm/i915: Wire up CRC support for gen3/4
drm/i915: Wire up gen2 CRC support
drm/i915: Wire up CRC for vlvdrivers/gpu/drm/i915/i915_debugfs.c | 164 +++++++++++++++++++++++++++++++----- drivers/gpu/drm/i915/i915_drv.h | 6 ++ drivers/gpu/drm/i915/i915_irq.c | 151 +++++++++++++++++++++++++-------- drivers/gpu/drm/i915/i915_reg.h | 74 +++++++++++++--- 4 files changed, 328 insertions(+), 67 deletions(-)Signature · 6 lines
1.8.4.rc3 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Ville Syrjälä Intel OTC