Lines Matching defs:to

4  * Permission is hereby granted, free of charge, to any person obtaining a
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
47 * context's state is never restored to help prevent programming errors. This
49 * The default context only exists to give the GPU some offset to load as the
50 * current to invoke a save of the context we actually care about. In fact, the
51 * code could likely be constructed, albeit in a more complicated fashion, to
52 * never use the default context, though that limits the driver's ability to
56 * store GPU state, and thus allow GPU clients to not re-emit state (and
86 * offset, but it will on the next context switch. The only way to avoid this
87 * is to do a GPU reset.
90 * on the active list waiting for the next context switch to occur. Until this
92 * possible to destroy a context, but it is still active.
101 * I've seen in a spec to date, and that was a workaround for a non-shipping
102 * part. It should be safe to decrease this, but it's more future proof as is.
108 static int do_switch(struct i915_hw_context *to);
172 * object tracking code. We give an initial ring value simple to pass an
213 * The default context needs to exist per ring that uses contexts. It stores the
228 /* We may need to do things with the shrinker which require us to
229 * immediately switch back to the default context. This can cause a
297 /* The only known way to stop the gpu from accessing the hw context is
298 * to reset it. Do this as the very last operation to avoid confusing
299 * other code, leading to spurious errors. */
304 /* When default context is created and switched to, base object refcount
307 * to default context. So we need to unreference the base object once
308 * to offset the do_switch part, so that i915_gem_context_unreference()
331 struct i915_hw_context *to;
345 to = i915_gem_context_get(file->driver_priv, id);
346 if (to == NULL)
349 return &to->hang_stats;
376 * invalidation prior to MI_SET_CONTEXT. On GEN6 we don't set the value
416 static int do_switch(struct i915_hw_context *to)
418 struct intel_ring_buffer *ring = to->ring;
425 if (from == to)
428 ret = i915_gem_object_pin(to->obj, CONTEXT_ALIGN, false, false);
433 * that thanks to write = false in this call and us not setting any gpu
436 * XXX: We need a real interface to do this instead of trickery. */
437 ret = i915_gem_object_set_to_gtt_domain(to->obj, false);
439 i915_gem_object_unpin(to->obj);
443 if (!to->obj->has_global_gtt_mapping)
444 i915_gem_gtt_bind_object(to->obj, to->obj->cache_level);
446 if (!to->is_initialized || is_default_context(to))
448 else if (from == to) {
451 WARN_ON(from == to);
454 ret = mi_set_context(ring, to, hw_flags);
456 i915_gem_object_unpin(to->obj);
460 /* The backing object for the context is done after switching to the
470 * whole damn pipeline, we don't need to explicitly mark the
473 * able to defer doing this until we know the object would be
474 * swapped, but there is no way to do that yet.
482 * Try to undo the change so that the hw state is
494 i915_gem_context_reference(to);
495 ring->last_context = to;
496 to->is_initialized = true;
506 * @seqno: sequence number by which the new context will be switched to
511 * it will have a refoucnt > 1. This allows us to destroy the context abstract
519 struct i915_hw_context *to;
530 to = ring->default_context;
535 to = i915_gem_context_get(file->driver_priv, to_id);
536 if (to == NULL)
540 return do_switch(to);