diff options
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/gpu/drm/i915/intel_lrc.c | 45 |
1 files changed, 28 insertions, 17 deletions
diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c index 8aa8a4862543..9155cc675924 100644 --- a/drivers/gpu/drm/i915/intel_lrc.c +++ b/drivers/gpu/drm/i915/intel_lrc.c | |||
| @@ -1173,6 +1173,24 @@ static int __context_pin(struct i915_gem_context *ctx, struct i915_vma *vma) | |||
| 1173 | return i915_vma_pin(vma, 0, 0, flags); | 1173 | return i915_vma_pin(vma, 0, 0, flags); |
| 1174 | } | 1174 | } |
| 1175 | 1175 | ||
| 1176 | static u32 make_rpcs(struct drm_i915_private *dev_priv); | ||
| 1177 | |||
| 1178 | static void | ||
| 1179 | __execlists_update_reg_state(struct intel_engine_cs *engine, | ||
| 1180 | struct intel_context *ce) | ||
| 1181 | { | ||
| 1182 | u32 *regs = ce->lrc_reg_state; | ||
| 1183 | struct intel_ring *ring = ce->ring; | ||
| 1184 | |||
| 1185 | regs[CTX_RING_BUFFER_START + 1] = i915_ggtt_offset(ring->vma); | ||
| 1186 | regs[CTX_RING_HEAD + 1] = ring->head; | ||
| 1187 | regs[CTX_RING_TAIL + 1] = ring->tail; | ||
| 1188 | |||
| 1189 | /* RPCS */ | ||
| 1190 | if (engine->class == RENDER_CLASS) | ||
| 1191 | regs[CTX_R_PWR_CLK_STATE + 1] = make_rpcs(engine->i915); | ||
| 1192 | } | ||
| 1193 | |||
| 1176 | static struct intel_context * | 1194 | static struct intel_context * |
| 1177 | __execlists_context_pin(struct intel_engine_cs *engine, | 1195 | __execlists_context_pin(struct intel_engine_cs *engine, |
| 1178 | struct i915_gem_context *ctx, | 1196 | struct i915_gem_context *ctx, |
| @@ -1211,10 +1229,8 @@ __execlists_context_pin(struct intel_engine_cs *engine, | |||
| 1211 | GEM_BUG_ON(!intel_ring_offset_valid(ce->ring, ce->ring->head)); | 1229 | GEM_BUG_ON(!intel_ring_offset_valid(ce->ring, ce->ring->head)); |
| 1212 | 1230 | ||
| 1213 | ce->lrc_reg_state = vaddr + LRC_STATE_PN * PAGE_SIZE; | 1231 | ce->lrc_reg_state = vaddr + LRC_STATE_PN * PAGE_SIZE; |
| 1214 | ce->lrc_reg_state[CTX_RING_BUFFER_START+1] = | 1232 | |
| 1215 | i915_ggtt_offset(ce->ring->vma); | 1233 | __execlists_update_reg_state(engine, ce); |
| 1216 | ce->lrc_reg_state[CTX_RING_HEAD + 1] = ce->ring->head; | ||
| 1217 | ce->lrc_reg_state[CTX_RING_TAIL + 1] = ce->ring->tail; | ||
| 1218 | 1234 | ||
| 1219 | ce->state->obj->pin_global++; | 1235 | ce->state->obj->pin_global++; |
| 1220 | i915_gem_context_get(ctx); | 1236 | i915_gem_context_get(ctx); |
| @@ -1838,14 +1854,14 @@ static void execlists_reset(struct intel_engine_cs *engine, | |||
| 1838 | engine->pinned_default_state + LRC_STATE_PN * PAGE_SIZE, | 1854 | engine->pinned_default_state + LRC_STATE_PN * PAGE_SIZE, |
| 1839 | engine->context_size - PAGE_SIZE); | 1855 | engine->context_size - PAGE_SIZE); |
| 1840 | } | 1856 | } |
| 1841 | execlists_init_reg_state(regs, | ||
| 1842 | request->gem_context, engine, request->ring); | ||
| 1843 | 1857 | ||
| 1844 | /* Move the RING_HEAD onto the breadcrumb, past the hanging batch */ | 1858 | /* Move the RING_HEAD onto the breadcrumb, past the hanging batch */ |
| 1845 | regs[CTX_RING_BUFFER_START + 1] = i915_ggtt_offset(request->ring->vma); | ||
| 1846 | |||
| 1847 | request->ring->head = intel_ring_wrap(request->ring, request->postfix); | 1859 | request->ring->head = intel_ring_wrap(request->ring, request->postfix); |
| 1848 | regs[CTX_RING_HEAD + 1] = request->ring->head; | 1860 | |
| 1861 | execlists_init_reg_state(regs, request->gem_context, engine, | ||
| 1862 | request->ring); | ||
| 1863 | |||
| 1864 | __execlists_update_reg_state(engine, request->hw_context); | ||
| 1849 | 1865 | ||
| 1850 | intel_ring_update_space(request->ring); | 1866 | intel_ring_update_space(request->ring); |
| 1851 | 1867 | ||
| @@ -2534,8 +2550,7 @@ static void execlists_init_reg_state(u32 *regs, | |||
| 2534 | 2550 | ||
| 2535 | if (rcs) { | 2551 | if (rcs) { |
| 2536 | regs[CTX_LRI_HEADER_2] = MI_LOAD_REGISTER_IMM(1); | 2552 | regs[CTX_LRI_HEADER_2] = MI_LOAD_REGISTER_IMM(1); |
| 2537 | CTX_REG(regs, CTX_R_PWR_CLK_STATE, GEN8_R_PWR_CLK_STATE, | 2553 | CTX_REG(regs, CTX_R_PWR_CLK_STATE, GEN8_R_PWR_CLK_STATE, 0); |
| 2538 | make_rpcs(dev_priv)); | ||
| 2539 | 2554 | ||
| 2540 | i915_oa_init_reg_state(engine, ctx, regs); | 2555 | i915_oa_init_reg_state(engine, ctx, regs); |
| 2541 | } | 2556 | } |
| @@ -2696,12 +2711,8 @@ void intel_lr_context_resume(struct drm_i915_private *i915) | |||
| 2696 | 2711 | ||
| 2697 | intel_ring_reset(ce->ring, 0); | 2712 | intel_ring_reset(ce->ring, 0); |
| 2698 | 2713 | ||
| 2699 | if (ce->pin_count) { /* otherwise done in context_pin */ | 2714 | if (ce->pin_count) /* otherwise done in context_pin */ |
| 2700 | u32 *regs = ce->lrc_reg_state; | 2715 | __execlists_update_reg_state(engine, ce); |
| 2701 | |||
| 2702 | regs[CTX_RING_HEAD + 1] = ce->ring->head; | ||
| 2703 | regs[CTX_RING_TAIL + 1] = ce->ring->tail; | ||
| 2704 | } | ||
| 2705 | } | 2716 | } |
| 2706 | } | 2717 | } |
| 2707 | } | 2718 | } |
