diff options
| -rw-r--r-- | drivers/gpu/drm/i915/intel_lrc.c | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c index 9b1f0e5211a0..d7fcbba8e982 100644 --- a/drivers/gpu/drm/i915/intel_lrc.c +++ b/drivers/gpu/drm/i915/intel_lrc.c | |||
| @@ -1338,11 +1338,13 @@ __execlists_context_pin(struct intel_engine_cs *engine, | |||
| 1338 | 1338 | ||
| 1339 | intel_lr_context_descriptor_update(ctx, engine, ce); | 1339 | intel_lr_context_descriptor_update(ctx, engine, ce); |
| 1340 | 1340 | ||
| 1341 | GEM_BUG_ON(!intel_ring_offset_valid(ce->ring, ce->ring->head)); | ||
| 1342 | |||
| 1341 | ce->lrc_reg_state = vaddr + LRC_STATE_PN * PAGE_SIZE; | 1343 | ce->lrc_reg_state = vaddr + LRC_STATE_PN * PAGE_SIZE; |
| 1342 | ce->lrc_reg_state[CTX_RING_BUFFER_START+1] = | 1344 | ce->lrc_reg_state[CTX_RING_BUFFER_START+1] = |
| 1343 | i915_ggtt_offset(ce->ring->vma); | 1345 | i915_ggtt_offset(ce->ring->vma); |
| 1344 | GEM_BUG_ON(!intel_ring_offset_valid(ce->ring, ce->ring->head)); | 1346 | ce->lrc_reg_state[CTX_RING_HEAD + 1] = ce->ring->head; |
| 1345 | ce->lrc_reg_state[CTX_RING_HEAD+1] = ce->ring->head; | 1347 | ce->lrc_reg_state[CTX_RING_TAIL + 1] = ce->ring->tail; |
| 1346 | 1348 | ||
| 1347 | ce->state->obj->pin_global++; | 1349 | ce->state->obj->pin_global++; |
| 1348 | i915_gem_context_get(ctx); | 1350 | i915_gem_context_get(ctx); |
| @@ -2841,13 +2843,14 @@ error_deref_obj: | |||
| 2841 | return ret; | 2843 | return ret; |
| 2842 | } | 2844 | } |
| 2843 | 2845 | ||
| 2844 | void intel_lr_context_resume(struct drm_i915_private *dev_priv) | 2846 | void intel_lr_context_resume(struct drm_i915_private *i915) |
| 2845 | { | 2847 | { |
| 2846 | struct intel_engine_cs *engine; | 2848 | struct intel_engine_cs *engine; |
| 2847 | struct i915_gem_context *ctx; | 2849 | struct i915_gem_context *ctx; |
| 2848 | enum intel_engine_id id; | 2850 | enum intel_engine_id id; |
| 2849 | 2851 | ||
| 2850 | /* Because we emit WA_TAIL_DWORDS there may be a disparity | 2852 | /* |
| 2853 | * Because we emit WA_TAIL_DWORDS there may be a disparity | ||
| 2851 | * between our bookkeeping in ce->ring->head and ce->ring->tail and | 2854 | * between our bookkeeping in ce->ring->head and ce->ring->tail and |
| 2852 | * that stored in context. As we only write new commands from | 2855 | * that stored in context. As we only write new commands from |
| 2853 | * ce->ring->tail onwards, everything before that is junk. If the GPU | 2856 | * ce->ring->tail onwards, everything before that is junk. If the GPU |
| @@ -2857,28 +2860,22 @@ void intel_lr_context_resume(struct drm_i915_private *dev_priv) | |||
| 2857 | * So to avoid that we reset the context images upon resume. For | 2860 | * So to avoid that we reset the context images upon resume. For |
| 2858 | * simplicity, we just zero everything out. | 2861 | * simplicity, we just zero everything out. |
| 2859 | */ | 2862 | */ |
| 2860 | list_for_each_entry(ctx, &dev_priv->contexts.list, link) { | 2863 | list_for_each_entry(ctx, &i915->contexts.list, link) { |
| 2861 | for_each_engine(engine, dev_priv, id) { | 2864 | for_each_engine(engine, i915, id) { |
| 2862 | struct intel_context *ce = | 2865 | struct intel_context *ce = |
| 2863 | to_intel_context(ctx, engine); | 2866 | to_intel_context(ctx, engine); |
| 2864 | u32 *reg; | ||
| 2865 | 2867 | ||
| 2866 | if (!ce->state) | 2868 | if (!ce->state) |
| 2867 | continue; | 2869 | continue; |
| 2868 | 2870 | ||
| 2869 | reg = i915_gem_object_pin_map(ce->state->obj, | 2871 | intel_ring_reset(ce->ring, 0); |
| 2870 | I915_MAP_WB); | ||
| 2871 | if (WARN_ON(IS_ERR(reg))) | ||
| 2872 | continue; | ||
| 2873 | |||
| 2874 | reg += LRC_STATE_PN * PAGE_SIZE / sizeof(*reg); | ||
| 2875 | reg[CTX_RING_HEAD+1] = 0; | ||
| 2876 | reg[CTX_RING_TAIL+1] = 0; | ||
| 2877 | 2872 | ||
| 2878 | ce->state->obj->mm.dirty = true; | 2873 | if (ce->pin_count) { /* otherwise done in context_pin */ |
| 2879 | i915_gem_object_unpin_map(ce->state->obj); | 2874 | u32 *regs = ce->lrc_reg_state; |
| 2880 | 2875 | ||
| 2881 | intel_ring_reset(ce->ring, 0); | 2876 | regs[CTX_RING_HEAD + 1] = ce->ring->head; |
| 2877 | regs[CTX_RING_TAIL + 1] = ce->ring->tail; | ||
| 2878 | } | ||
| 2882 | } | 2879 | } |
| 2883 | } | 2880 | } |
| 2884 | } | 2881 | } |
