Or at least plug another gapping hole. Apparrently hw desingers only moved the bit field, but did not bother ot re-enumerate the planes when adding support for a 3rd pipe. Discovered by i-g-t/flip_test. This may or may not fix the reference bugzilla, because that one smells like we have still larger fish to fry. v2: Fixup the impossible case to catch programming errors, noticed by Chris Wilson.
Unified · Split
| @@ -210,6 +210,14 @@ · 209 unmodified lines | |||
| 210 | #define MI_DISPLAY_FLIP MI_INSTR(0x14, 2) | 210 | #define MI_DISPLAY_FLIP MI_INSTR(0x14, 2) |
| 211 | #define MI_DISPLAY_FLIP_I915 MI_INSTR(0x14, 1) | 211 | #define MI_DISPLAY_FLIP_I915 MI_INSTR(0x14, 1) |
| 212 | #define MI_DISPLAY_FLIP_PLANE(n) ((n) << 20) | 212 | #define MI_DISPLAY_FLIP_PLANE(n) ((n) << 20) |
| 213 | /* IVB has funny definitions for which plane to flip. */ | ||
| 214 | #define MI_DISPLAY_FLIP_IVB_PLANE_A (0 << 19) | ||
| 215 | #define MI_DISPLAY_FLIP_IVB_PLANE_B (1 << 19) | ||
| 216 | #define MI_DISPLAY_FLIP_IVB_SPRITE_A (2 << 19) | ||
| 217 | #define MI_DISPLAY_FLIP_IVB_SPRITE_B (3 << 19) | ||
| 218 | #define MI_DISPLAY_FLIP_IVB_PLANE_C (4 << 19) | ||
| 219 | #define MI_DISPLAY_FLIP_IVB_SPRITE_C (5 << 19) | ||
| 220 | |||
| 213 | #define MI_SET_CONTEXT MI_INSTR(0x18, 0) | 221 | #define MI_SET_CONTEXT MI_INSTR(0x18, 0) |
| 214 | #define MI_MM_SPACE_GTT (1<<8) | 222 | #define MI_MM_SPACE_GTT (1<<8) |
| 215 | #define MI_MM_SPACE_PHYSICAL (0<<8) | 223 | #define MI_MM_SPACE_PHYSICAL (0<<8) |
| @@ -6158,17 +6158,34 @@ static int intel_gen7_queue_flip(struct drm_device *dev, · 6157 unmodified lines | |||
| 6158 | struct drm_i915_private *dev_priv = dev->dev_private; | 6158 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 6159 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | 6159 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); |
| 6160 | struct intel_ring_buffer *ring = &dev_priv->ring[BCS]; | 6160 | struct intel_ring_buffer *ring = &dev_priv->ring[BCS]; |
| 6161 | uint32_t plane_bit = 0; | ||
| 6161 | int ret; | 6162 | int ret; |
| 6162 | 6163 | ||
| 6163 | ret = intel_pin_and_fence_fb_obj(dev, obj, ring); | 6164 | ret = intel_pin_and_fence_fb_obj(dev, obj, ring); |
| 6164 | if (ret) | 6165 | if (ret) |
| 6165 | goto err; | 6166 | goto err; |
| 6166 | 6167 | ||
| 6168 | switch(intel_crtc->plane) { | ||
| 6169 | case PLANE_A: | ||
| 6170 | plane_bit = MI_DISPLAY_FLIP_IVB_PLANE_A; | ||
| 6171 | break; | ||
| 6172 | case PLANE_B: | ||
| 6173 | plane_bit = MI_DISPLAY_FLIP_IVB_PLANE_B; | ||
| 6174 | break; | ||
| 6175 | case PLANE_C: | ||
| 6176 | plane_bit = MI_DISPLAY_FLIP_IVB_PLANE_C; | ||
| 6177 | break; | ||
| 6178 | default: | ||
| 6179 | WARN_ONCE(1, "unknown plane in flip command\n"); | ||
| 6180 | ret = -ENODEV; | ||
| 6181 | goto err; | ||
| 6182 | } | ||
| 6183 | |||
| 6167 | ret = intel_ring_begin(ring, 4); | 6184 | ret = intel_ring_begin(ring, 4); |
| 6168 | if (ret) | 6185 | if (ret) |
| 6169 | goto err_unpin; | 6186 | goto err_unpin; |
| 6170 | 6187 | ||
| 6171 | intel_ring_emit(ring, MI_DISPLAY_FLIP_I915 | (intel_crtc->plane << 19)); | 6188 | intel_ring_emit(ring, MI_DISPLAY_FLIP_I915 | plane_bit); |
| 6172 | intel_ring_emit(ring, (fb->pitches[0] | obj->tiling_mode)); | 6189 | intel_ring_emit(ring, (fb->pitches[0] | obj->tiling_mode)); |
| 6173 | intel_ring_emit(ring, (obj->gtt_offset)); | 6190 | intel_ring_emit(ring, (obj->gtt_offset)); |
| 6174 | intel_ring_emit(ring, (MI_NOOP)); | 6191 | intel_ring_emit(ring, (MI_NOOP)); |