diff options
Diffstat (limited to 'drivers/gpu/drm/i915/i915_gem_context.c')
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem_context.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c index 3ffe308d5893..a5ddf3bce9c3 100644 --- a/drivers/gpu/drm/i915/i915_gem_context.c +++ b/drivers/gpu/drm/i915/i915_gem_context.c | |||
@@ -598,6 +598,7 @@ static int do_switch(struct intel_engine_cs *ring, | |||
598 | struct intel_context *from = ring->last_context; | 598 | struct intel_context *from = ring->last_context; |
599 | struct i915_hw_ppgtt *ppgtt = ctx_to_ppgtt(to); | 599 | struct i915_hw_ppgtt *ppgtt = ctx_to_ppgtt(to); |
600 | u32 hw_flags = 0; | 600 | u32 hw_flags = 0; |
601 | bool uninitialized = false; | ||
601 | int ret, i; | 602 | int ret, i; |
602 | 603 | ||
603 | if (from != NULL && ring == &dev_priv->ring[RCS]) { | 604 | if (from != NULL && ring == &dev_priv->ring[RCS]) { |
@@ -696,19 +697,20 @@ static int do_switch(struct intel_engine_cs *ring, | |||
696 | i915_gem_context_unreference(from); | 697 | i915_gem_context_unreference(from); |
697 | } | 698 | } |
698 | 699 | ||
700 | uninitialized = !to->is_initialized && from == NULL; | ||
701 | to->is_initialized = true; | ||
702 | |||
699 | done: | 703 | done: |
700 | i915_gem_context_reference(to); | 704 | i915_gem_context_reference(to); |
701 | ring->last_context = to; | 705 | ring->last_context = to; |
702 | to->last_ring = ring; | 706 | to->last_ring = ring; |
703 | 707 | ||
704 | if (ring->id == RCS && !to->is_initialized && from == NULL) { | 708 | if (uninitialized) { |
705 | ret = i915_gem_render_state_init(ring); | 709 | ret = i915_gem_render_state_init(ring); |
706 | if (ret) | 710 | if (ret) |
707 | DRM_ERROR("init render state: %d\n", ret); | 711 | DRM_ERROR("init render state: %d\n", ret); |
708 | } | 712 | } |
709 | 713 | ||
710 | to->is_initialized = true; | ||
711 | |||
712 | return 0; | 714 | return 0; |
713 | 715 | ||
714 | unpin_out: | 716 | unpin_out: |