drm/i915: pass status instead of enable flags to i915_enable_pipestat
Subsystems (2)
PATCH v2 1/3 drm/i915: pass status instead of enable flags to i915_enable_pipestat
There isn't any PSR interrupt enable bit for pipe A, so we couldn't enable it through the current API. Passing the corresponding status bits solves this and also makes the mapping between enable and status bits simpler on VLV (addressed in an upcoming patch).
Except of checking for invalid status bit arguments, no functional change.
v2: split out the low level parts of i915_enable_pipestat accepting
separate enabled and status masks, to make the non-standard mapping between those masks stand out more (added in the next patch) (Jesse,Daniel)
--- drivers/gpu/drm/i915/i915_drv.h | 6 ++- drivers/gpu/drm/i915/i915_irq.c | 82 ++++++++++++++++++++++++++++------------- drivers/gpu/drm/i915/i915_reg.h | 3 ++ drivers/gpu/drm/i915/intel_tv.c | 8 ++-- 4 files changed, 67 insertions(+), 32 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +4 -2
@@ -2012,10 +2012,12 @@ extern void intel_uncore_check_errors(struct drm_device *dev);extern void intel_uncore_fini (struct drm_device *dev);void -i915_enable_pipestat (drm_i915_private_t *dev_priv,enum pipe pipe,u32 mask); +i915_enable_pipestat (drm_i915_private_t *dev_priv,enum pipe pipe, +u32 status_mask);void -i915_disable_pipestat (drm_i915_private_t *dev_priv,enum pipe pipe,u32 mask); +i915_disable_pipestat (drm_i915_private_t *dev_priv,enum pipe pipe, +u32 status_mask);/* i915_gem.c */ int i915_gem_init_ioctl(struct drm_device *dev, void *data,
drivers/gpu/drm/i915/i915_irq.c +56 -26
176 lines not on this page · raw message
drivers/gpu/drm/i915/i915_reg.h +3 -0
@@ -3277,6 +3277,9 @@#define PIPE_VBLANK_INTERRUPT_STATUS (1UL<<1)#define PIPE_OVERLAY_UPDATED_STATUS (1UL<<0) +#define PIPESTAT_INT_ENABLE_MASK 0x7fff0000 +#define PIPESTAT_INT_STATUS_MASK 0x0000ffff +#define PIPE_A_OFFSET 0x70000#define PIPE_B_OFFSET 0x71000#define PIPE_C_OFFSET 0x72000
drivers/gpu/drm/i915/intel_tv.c +4 -4
@@ -1189,8 +1189,8 @@ intel_tv_detect_type(struct intel_tv *intel_tv,if (connector->polled &DRM_CONNECTOR_POLL_HPD ) {spin_lock_irqsave (&dev_priv->irq_lock, irqflags);i915_disable_pipestat (dev_priv,0 , -PIPE_HOTPLUG_INTERRUPT_ENABLE | -PIPE_HOTPLUG_TV_INTERRUPT_ENABLE ); +PIPE_HOTPLUG_INTERRUPT_STATUS | +PIPE_HOTPLUG_TV_INTERRUPT_STATUS );spin_unlock_irqrestore (&dev_priv->irq_lock, irqflags); }
@@ -1266,8 +1266,8 @@ intel_tv_detect_type(struct intel_tv *intel_tv,if (connector->polled &DRM_CONNECTOR_POLL_HPD ) {spin_lock_irqsave (&dev_priv->irq_lock, irqflags);i915_enable_pipestat (dev_priv,0 , -PIPE_HOTPLUG_INTERRUPT_ENABLE | -PIPE_HOTPLUG_TV_INTERRUPT_ENABLE ); +PIPE_HOTPLUG_INTERRUPT_STATUS | +PIPE_HOTPLUG_TV_INTERRUPT_STATUS );spin_unlock_irqrestore (&dev_priv->irq_lock, irqflags); }
Signature · 6 lines
1.8.4 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 2/3 drm/i915: vlv: fix mapping of pipestat enable to status bits
At least on VLV we can't get at the pipestat status bits by simply right shifting the corresponding enable bits. The mapping between enable and status bits for the sprite0,1 flip done and the PSR events don't follow this rule, so we need to map them separately.
The PSR enable for pipe A is DPFLIPSTAT[22], but I haven't added support for this, since there is no user of it atm. Until support is added WARN if someone tries to enable PSR interrupts, or tries to enable the same (1 << 6) bit on pipe B, which MBZ.
v2:
- inline the status->enable mask mapping (Ville)
- fix bogus use of status bits in enable mask (Ville)
--- drivers/gpu/drm/i915/i915_irq.c | 34 ++++++++++++++++++++++++++++++++-- drivers/gpu/drm/i915/i915_reg.h | 3 +++ 2 files changed, 35 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +32 -2
@@ -515,13 +515,39 @@ __i915_disable_pipestat(struct drm_i915_private *dev_priv, enum pipe pipe,POSTING_READ (reg); } +static u32 vlv_get_pipestat_enable_mask (struct drm_device *dev,u32 status_mask) +{ +u32 enable_mask = status_mask <<16 ; + +/* +* On pipe A we don't support the PSR interrupt yet, on pipe B the +* same bit MBZ. +*/ +if (WARN_ON_ONCE (status_mask &PIPE_A_PSR_STATUS_VLV )) +return 0 ; + + enable_mask &= ~(PIPE_FIFO_UNDERRUN_STATUS | +SPRITE0_FLIP_DONE_INT_EN_VLV | +SPRITE1_FLIP_DONE_INT_EN_VLV ); +if (status_mask &SPRITE0_FLIP_DONE_INT_STATUS_VLV ) + enable_mask |=SPRITE0_FLIP_DONE_INT_EN_VLV ; +if (status_mask &SPRITE1_FLIP_DONE_INT_STATUS_VLV ) + enable_mask |=SPRITE1_FLIP_DONE_INT_EN_VLV ; + +return enable_mask; +} +void i915_enable_pipestat (struct drm_i915_private *dev_priv,enum pipe pipe,u32 status_mask) {u32 enable_mask; - enable_mask = status_mask <<16 ; +if (IS_VALLEYVIEW (dev_priv->dev)) + enable_mask =vlv_get_pipestat_enable_mask (dev_priv->dev, + status_mask); +else + enable_mask = status_mask <<16 ;__i915_enable_pipestat (dev_priv, pipe, enable_mask, status_mask); }
@@ -531,7 +557,11 @@ i915_disable_pipestat(struct drm_i915_private *dev_priv, enum pipe pipe, {u32 enable_mask; - enable_mask = status_mask <<16 ; +if (IS_VALLEYVIEW (dev_priv->dev)) + enable_mask =vlv_get_pipestat_enable_mask (dev_priv->dev, + status_mask); +else + enable_mask = status_mask <<16 ;__i915_disable_pipestat (dev_priv, pipe, enable_mask, status_mask); }
drivers/gpu/drm/i915/i915_reg.h +3 -0
@@ -3254,6 +3254,7 @@#define PIPE_LEGACY_BLC_EVENT_ENABLE (1UL<<22)#define PIPE_ODD_FIELD_INTERRUPT_ENABLE (1UL<<21)#define PIPE_EVEN_FIELD_INTERRUPT_ENABLE (1UL<<20) +#define PIPE_B_PSR_INTERRUPT_ENABLE_VLV (1UL<<19)#define PIPE_HOTPLUG_TV_INTERRUPT_ENABLE (1UL<<18)/* pre-965 */ #define PIPE_START_VBLANK_INTERRUPT_ENABLE (1UL<<18)/* 965 or later */ #define PIPE_VBLANK_INTERRUPT_ENABLE (1UL<<17)
@@ -3270,8 +3271,10 @@#define PIPE_DISPLAY_LINE_COMPARE_STATUS (1UL<<8)#define PIPE_DPST_EVENT_STATUS (1UL<<7)#define PIPE_LEGACY_BLC_EVENT_STATUS (1UL<<6) +#define PIPE_A_PSR_STATUS_VLV (1UL<<6)#define PIPE_ODD_FIELD_INTERRUPT_STATUS (1UL<<5)#define PIPE_EVEN_FIELD_INTERRUPT_STATUS (1UL<<4) +#define PIPE_B_PSR_STATUS_VLV (1UL<<3)#define PIPE_HOTPLUG_TV_INTERRUPT_STATUS (1UL<<2)/* pre-965 */ #define PIPE_START_VBLANK_INTERRUPT_STATUS (1UL<<2)/* 965 or later */ #define PIPE_VBLANK_INTERRUPT_STATUS (1UL<<1)
Signature · 6 lines
1.8.4 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 3/3 drm/i915: vlv: handle only enabled pipestat interrupt events
In reply to Imre DeakAtm we call the handlers for pending pipestat interrupt events even if they aren't explicitly enabled by i915_enable_pipestat(). This isn't an issue for events other than the vblank start event, since those are always enabled anyways. Otoh, we enable the vblank start event on-demand, so we'll end up calling the vblank handler at times when they are disabled.
I haven't checked if this causes any real problem, but for consistency and to remove some overhead we should still fix this by clearing / handling only the enabled interrupt events. Also this is a dependency for the upcoming VLV power domain patchset where we need to disable all the pipestat interrupts whenever the display power well is off.
v2:
- inline the status->enable mask mapping (Ville)
- don't check for invalid PSR bit on platforms other than VLV (Ville)
--- drivers/gpu/drm/i915/i915_drv.h | 1 + drivers/gpu/drm/i915/i915_irq.c | 35 ++++++++++++++++++++++++++++++++--- drivers/gpu/drm/i915/i915_reg.h | 4 ++++ 3 files changed, 37 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +1 -0
@@ -1436,6 +1436,7 @@ typedef struct drm_i915_private { };u32 gt_irq_mask;u32 pm_irq_mask; +u32 pipestat_irq_mask[I915_MAX_PIPES ];struct work_struct hotplug_work;bool enable_hotplug_processing;
drivers/gpu/drm/i915/i915_irq.c +32 -3
@@ -419,6 +419,16 @@ done:return ret; } +static bool __cpu_fifo_underrun_reporting_enabled (struct drm_device *dev, +enum pipe pipe) +{ +struct drm_i915_private *dev_priv = dev->dev_private; +struct drm_crtc *crtc = dev_priv->pipe_to_crtc_mapping[pipe]; +struct intel_crtc *intel_crtc =to_intel_crtc (crtc); + +return !intel_crtc->cpu_fifo_underrun_disabled; +} +/** * intel_set_pch_fifo_underrun_reporting - enable/disable FIFO underrun messages * @dev: drm device
@@ -488,6 +498,8 @@ __i915_enable_pipestat(struct drm_i915_private *dev_priv, enum pipe pipe,if ((pipestat & enable_mask) == enable_mask)return ; + dev_priv->pipestat_irq_mask[pipe] |= status_mask; +/* Enable the interrupt, clear any pending status */ pipestat |= enable_mask | status_mask;I915_WRITE (reg, pipestat);
@@ -510,6 +522,8 @@ __i915_disable_pipestat(struct drm_i915_private *dev_priv, enum pipe pipe,if ((pipestat & enable_mask) ==0 )return ; + dev_priv->pipestat_irq_mask[pipe] &= ~status_mask; + pipestat &= ~enable_mask;I915_WRITE (reg, pipestat);POSTING_READ (reg);
@@ -1539,18 +1553,33 @@ static void gen6_rps_irq_handler(struct drm_i915_private *dev_priv, u32 pm_iir)static void valleyview_pipestat_irq_handler (struct drm_device *dev,u32 iir) {struct drm_i915_private *dev_priv = dev->dev_private; -u32 pipe_stats[I915_MAX_PIPES ]; +u32 pipe_stats[I915_MAX_PIPES ] = { };int pipe;spin_lock (&dev_priv->irq_lock);for_each_pipe (pipe) { -int reg =PIPESTAT (pipe); +int reg; +u32 mask; + +if (!dev_priv->pipestat_irq_mask[pipe] && + !__cpu_fifo_underrun_reporting_enabled (dev, pipe)) +continue ; + + reg =PIPESTAT (pipe); pipe_stats[pipe] =I915_READ (reg);/* * Clear the PIPE*STAT regs before the IIR */ -if (pipe_stats[pipe] &0x8000ffff ) + mask =PIPESTAT_INT_ENABLE_MASK ; +if (__cpu_fifo_underrun_reporting_enabled (dev, pipe)) + mask |=PIPE_FIFO_UNDERRUN_STATUS ; +if (iir &I915_DISPLAY_PIPE_EVENT_INTERRUPT (pipe)) + mask |= dev_priv->pipestat_irq_mask[pipe]; + pipe_stats[pipe] &= mask; + +if (pipe_stats[pipe] & (PIPE_FIFO_UNDERRUN_STATUS | +PIPESTAT_INT_STATUS_MASK ))I915_WRITE (reg, pipe_stats[pipe]); }spin_unlock (&dev_priv->irq_lock);
drivers/gpu/drm/i915/i915_reg.h +4 -0
@@ -997,6 +997,10 @@#define I915_DISPLAY_PIPE_A_EVENT_INTERRUPT (1<<6)#define I915_DISPLAY_PIPE_B_VBLANK_INTERRUPT (1<<5)#define I915_DISPLAY_PIPE_B_EVENT_INTERRUPT (1<<4) +#define I915_DISPLAY_PIPE_EVENT_INTERRUPT (pipe) \ + ((pipe) == PIPE_A ? I915_DISPLAY_PIPE_A_EVENT_INTERRUPT : \ + I915_DISPLAY_PIPE_B_EVENT_INTERRUPT) +#define I915_DEBUG_INTERRUPT (1<<2)#define I915_USER_INTERRUPT (1<<1)#define I915_ASLE_INTERRUPT (1<<0)
Signature · 6 lines
1.8.4 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx