drm/i915: support page flipping on ValleyView
Subsystems (2)
PATCH 1/3 drm/i915: support page flipping on ValleyView
And restructure the IRQ handling a little. We can use pipestat for most things, and make sure we don't affect pipe events when enabling and disabling vblank interupts.
We can leave vblank interrupts masked but enabled so we're not dependent on the first client to toggle the disable timer. We can also mask all render based interrupts, since the ring code will handle unmasking them for us.
v2: roll in vblank masking, remove unneeded variable (Daniel)
--- drivers/gpu/drm/i915/i915_irq.c | 97 +++++++++++++++++++-------------------- 1 file changed, 46 insertions(+), 51 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +46 -51
@@ -513,15 +513,10 @@ static irqreturn_t valleyview_irq_handler(DRM_IRQ_ARGS)unsigned long irqflags;int pipe;u32 pipe_stats[I915_MAX_PIPES ]; -u32 vblank_status; -int vblank =0 ;bool blc_event;atomic_inc (&dev_priv->irq_received); - vblank_status =PIPE_START_VBLANK_INTERRUPT_STATUS | -PIPE_VBLANK_INTERRUPT_STATUS ; -while (true) { iir =I915_READ (VLV_IIR ); gt_iir =I915_READ (GTIIR );
@@ -551,6 +546,16 @@ static irqreturn_t valleyview_irq_handler(DRM_IRQ_ARGS) }spin_unlock_irqrestore (&dev_priv->irq_lock, irqflags); +for_each_pipe (pipe) { +if (pipe_stats[pipe] &PIPE_VBLANK_INTERRUPT_STATUS ) +drm_handle_vblank (dev, pipe); + +if (pipe_stats[pipe] &PLANE_FLIPDONE_INT_STATUS_VLV ) { +intel_prepare_page_flip (dev, pipe); +intel_finish_page_flip (dev, pipe); + } + } +/* Consume port. Then clear IIR or we'll miss events */ if (iir &I915_DISPLAY_PORT_INTERRUPT ) {u32 hotplug_status =I915_READ (PORT_HOTPLUG_STAT );
@@ -565,19 +570,6 @@ static irqreturn_t valleyview_irq_handler(DRM_IRQ_ARGS)I915_READ (PORT_HOTPLUG_STAT ); } - -if (iir &I915_DISPLAY_PIPE_A_VBLANK_INTERRUPT ) { -drm_handle_vblank (dev,0 ); - vblank++; -intel_finish_page_flip (dev,0 ); - } - -if (iir &I915_DISPLAY_PIPE_B_VBLANK_INTERRUPT ) { -drm_handle_vblank (dev,1 ); - vblank++; -intel_finish_page_flip (dev,0 ); - } -if (pipe_stats[pipe] &PIPE_LEGACY_BLC_EVENT_STATUS ) blc_event = true;
@@ -1479,23 +1471,20 @@ static int valleyview_enable_vblank(struct drm_device *dev, int pipe) {drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;unsigned long irqflags; -u32 dpfl, imr; +u32 imr;if (!i915_pipe_enabled (dev, pipe))return -EINVAL ;spin_lock_irqsave (&dev_priv->irq_lock, irqflags); - dpfl =I915_READ (VLV_DPFLIPSTAT ); imr =I915_READ (VLV_IMR ); -if (pipe ==0 ) { - dpfl |=PIPEA_VBLANK_INT_EN ; +if (pipe ==0 ) imr &= ~I915_DISPLAY_PIPE_A_VBLANK_INTERRUPT ; - }else { - dpfl |=PIPEA_VBLANK_INT_EN ; +else imr &= ~I915_DISPLAY_PIPE_B_VBLANK_INTERRUPT ; - } -I915_WRITE (VLV_DPFLIPSTAT , dpfl);I915_WRITE (VLV_IMR , imr); +i915_enable_pipestat (dev_priv, pipe, +PIPE_START_VBLANK_INTERRUPT_ENABLE );spin_unlock_irqrestore (&dev_priv->irq_lock, irqflags);return 0 ;
@@ -1545,20 +1534,17 @@ static void valleyview_disable_vblank(struct drm_device *dev, int pipe) {drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;unsigned long irqflags; -u32 dpfl, imr; +u32 imr;spin_lock_irqsave (&dev_priv->irq_lock, irqflags); - dpfl =I915_READ (VLV_DPFLIPSTAT ); +i915_disable_pipestat (dev_priv, pipe, +PIPE_START_VBLANK_INTERRUPT_ENABLE ); imr =I915_READ (VLV_IMR ); -if (pipe ==0 ) { - dpfl &= ~PIPEA_VBLANK_INT_EN ; +if (pipe ==0 ) imr |=I915_DISPLAY_PIPE_A_VBLANK_INTERRUPT ; - }else { - dpfl &= ~PIPEB_VBLANK_INT_EN ; +else imr |=I915_DISPLAY_PIPE_B_VBLANK_INTERRUPT ; - }I915_WRITE (VLV_IMR , imr); -I915_WRITE (VLV_DPFLIPSTAT , dpfl);spin_unlock_irqrestore (&dev_priv->irq_lock, irqflags); }
@@ -1892,16 +1878,24 @@ static int ivybridge_irq_postinstall(struct drm_device *dev)static int valleyview_irq_postinstall (struct drm_device *dev) {drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; -u32 render_irqs;u32 enable_mask;u32 hotplug_en =I915_READ (PORT_HOTPLUG_EN ); +u32 pipestat_enable =PLANE_FLIP_DONE_INT_EN_VLV ;u16 msid; enable_mask =I915_DISPLAY_PORT_INTERRUPT ; - enable_mask |=I915_DISPLAY_PIPE_A_VBLANK_INTERRUPT | + enable_mask |=I915_DISPLAY_PIPE_A_EVENT_INTERRUPT | +I915_DISPLAY_PIPE_A_VBLANK_INTERRUPT | +I915_DISPLAY_PIPE_B_EVENT_INTERRUPT |I915_DISPLAY_PIPE_B_VBLANK_INTERRUPT ; - dev_priv->irq_mask = ~enable_mask; +/* +*Leave vblank interrupts masked initially. enable/disable will +* toggle them based on usage. +*/ + dev_priv->irq_mask = (~enable_mask) | +I915_DISPLAY_PIPE_A_VBLANK_INTERRUPT | +I915_DISPLAY_PIPE_B_VBLANK_INTERRUPT ; dev_priv->pipestat[0 ] =0 ; dev_priv->pipestat[1 ] =0 ;
@@ -1920,26 +1914,27 @@ static int valleyview_irq_postinstall(struct drm_device *dev)I915_WRITE (PIPESTAT (1 ),0xffff );POSTING_READ (VLV_IER ); +i915_enable_pipestat (dev_priv,0 , pipestat_enable); +i915_enable_pipestat (dev_priv,1 , pipestat_enable); +I915_WRITE (VLV_IIR ,0xffffffff );I915_WRITE (VLV_IIR ,0xffffffff ); - render_irqs =GT_GEN6_BLT_FLUSHDW_NOTIFY_INTERRUPT | -GT_GEN6_BLT_CS_ERROR_INTERRUPT | -GT_GEN6_BLT_USER_INTERRUPT | -GT_GEN6_BSD_USER_INTERRUPT | -GT_GEN6_BSD_CS_ERROR_INTERRUPT | -GT_GEN7_L3_PARITY_ERROR_INTERRUPT | -GT_PIPE_NOTIFY | -GT_RENDER_CS_ERROR_INTERRUPT | -GT_SYNC_STATUS | -GT_USER_INTERRUPT ; - - dev_priv->gt_irq_mask = ~render_irqs; + dev_priv->gt_irq_mask = ~0 ;I915_WRITE (GTIIR ,I915_READ (GTIIR ));I915_WRITE (GTIIR ,I915_READ (GTIIR )); -I915_WRITE (GTIMR ,0 ); -I915_WRITE (GTIER , render_irqs); +I915_WRITE (GTIMR , dev_priv->gt_irq_mask); +I915_WRITE (GTIER ,GT_GEN6_BLT_FLUSHDW_NOTIFY_INTERRUPT | +GT_GEN6_BLT_CS_ERROR_INTERRUPT | +GT_GEN6_BLT_USER_INTERRUPT | +GT_GEN6_BSD_USER_INTERRUPT | +GT_GEN6_BSD_CS_ERROR_INTERRUPT | +GT_GEN7_L3_PARITY_ERROR_INTERRUPT | +GT_PIPE_NOTIFY | +GT_RENDER_CS_ERROR_INTERRUPT | +GT_SYNC_STATUS | +GT_USER_INTERRUPT );POSTING_READ (GTIER );/* ack & enable invalid PTE error interrupts */
Signature · 1 line
1.7.9.5
PATCH 2/3 drm/i915: enable display messages to GT on ValleyView
Enable the on-chip messaging between the display engine and the GT.
v2: use bit definitions for DPFLIPSTAT reg
--- drivers/gpu/drm/i915/i915_reg.h | 4 ++-- drivers/gpu/drm/i915/intel_pm.c | 13 +++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +2 -2
@@ -2653,13 +2653,13 @@#define PIPESTAT (pipe) _PIPE(pipe, _PIPEASTAT, _PIPEBSTAT)#define VLV_DPFLIPSTAT 0x70028 -#define PIPEB_LINE_COMPARE_STATUS (1<<29) +#define PIPEB_LINE_COMPARE_INT_EN (1<<29)#define PIPEB_HLINE_INT_EN (1<<28)#define PIPEB_VBLANK_INT_EN (1<<27)#define SPRITED_FLIPDONE_INT_EN (1<<26)#define SPRITEC_FLIPDONE_INT_EN (1<<25)#define PLANEB_FLIPDONE_INT_EN (1<<24) -#define PIPEA_LINE_COMPARE_STATUS (1<<21) +#define PIPEA_LINE_COMPARE_INT_EN (1<<21)#define PIPEA_HLINE_INT_EN (1<<20)#define PIPEA_VBLANK_INT_EN (1<<19)#define SPRITEB_FLIPDONE_INT_EN (1<<18)
drivers/gpu/drm/i915/intel_pm.c +13 -0
@@ -3528,6 +3528,19 @@ static void valleyview_init_clock_gating(struct drm_device *dev)I915_WRITE (CACHE_MODE_1 ,_MASKED_BIT_ENABLE (PIXEL_SUBSPAN_COLLECT_OPT_DISABLE )); + +/* +* On ValleyView, the GUnit needs to signal the GT +* when flip and other events complete. So enable +* all the GUnit->GT interrupts here +*/ +I915_WRITE (VLV_DPFLIPSTAT ,PIPEB_LINE_COMPARE_INT_EN | +PIPEB_HLINE_INT_EN |PIPEB_VBLANK_INT_EN | +SPRITED_FLIPDONE_INT_EN |SPRITEC_FLIPDONE_INT_EN | +PLANEB_FLIPDONE_INT_EN |PIPEA_LINE_COMPARE_INT_EN | +PIPEA_HLINE_INT_EN |PIPEA_VBLANK_INT_EN | +SPRITEB_FLIPDONE_INT_EN |SPRITEA_FLIPDONE_INT_EN | +PLANEA_FLIPDONE_INT_EN ); }static void g4x_init_clock_gating (struct drm_device *dev)
Signature · 1 line
1.7.9.5
PATCH 3/3 drm/i915: bind driver to ValleyView chipsets
In reply to Jesse BarnesWith the code in place, we can bind the driver, should make bisect possible.
--- drivers/gpu/drm/i915/i915_drv.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/i915/i915_drv.c +3 -0
@@ -352,6 +352,9 @@ static const struct pci_device_id pciidlist[] = { /* aka */INTEL_VGA_DEVICE (0x0406 , &intel_haswell_m_info),/* GT1 mobile */ INTEL_VGA_DEVICE (0x0416 , &intel_haswell_m_info),/* GT2 mobile */ INTEL_VGA_DEVICE (0x0c16 , &intel_haswell_d_info),/* SDV */ +INTEL_VGA_DEVICE (0x0f30 , &intel_valleyview_m_info), +INTEL_VGA_DEVICE (0x0157 , &intel_valleyview_m_info), +INTEL_VGA_DEVICE (0x0155 , &intel_valleyview_d_info), {0, 0, 0} };
Signature · 1 line
1.7.9.5
Daniel Vetter
AppliedRe: [PATCH 3/3] drm/i915: bind driver to ValleyView chipsets
Quoted 3 lines · Jesse Barnes
With the code in place, we can bind the driver, should make bisect possible.
Signed-off-by Jesse Barnes <[email protected]>
Queued all three for -next, thanks for the respin. -Daniel
Signature · 3 lines
Daniel Vetter Mail: [email protected] Mobile: +41 (0)79 365 57 48
Re: [PATCH 3/3] drm/i915: bind driver to ValleyView chipsets
Quoted 5 lines · On Wed, 20 Jun 2012 22:53:56 +0200 Daniel Vetter <[email protected]> wrote:
Quoted 3 lines · Jesse Barnes
With the code in place, we can bind the driver, should make bisect possible.
Signed-off-by Jesse Barnes <[email protected]>Queued all three for -next, thanks for the respin.
Cool thanks. Sorry for the breakage to the read/write routines.
Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center