Lines Matching refs: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:
39 * context's state is never restored to help prevent programming errors. This
41 * The default context only exists to give the GPU some offset to load as the
42 * current to invoke a save of the context we actually care about. In fact, the
43 * code could likely be constructed, albeit in a more complicated fashion, to
44 * never use the default context, though that limits the driver's ability to
48 * store GPU state, and thus allow GPU clients to not re-emit state (and
78 * offset, but it will on the next context switch. The only way to avoid this
79 * is to do a GPU reset.
82 * on the active list waiting for the next context switch to occur. Until this
84 * possible to destroy a context, but it is still active.
96 * I've seen in a spec to date, and that was a workaround for a non-shipping
97 * part. It should be safe to decrease this, but it's more future proof as is.
103 static int do_switch(struct i915_hw_context *to);
176 * object tracking code. We give an initial ring value simple to pass an
214 * The default context needs to exist per ring that uses contexts. It stores the
229 /* We may need to do things with the shrinker which require us to
230 * immediately switch back to the default context. This can cause a
293 /* The only known way to stop the gpu from accessing the hw context is
294 * to reset it. Do this as the very last operation to avoid confusing
295 * other code, leading to spurious errors. */
300 /* When default context is created and switched to, base object refcount
303 * to default context. So we need to unreference the base object once
304 * to offset the do_switch part, so that i915_gem_context_unreference()
346 * invalidation prior to MI_SET_CONTEXT. On GEN6 we don't set the value
385 static int do_switch(struct i915_hw_context *to)
387 struct intel_ring_buffer *ring = to->ring;
395 if (from_obj == to->obj)
398 ret = i915_gem_object_pin(to->obj, CONTEXT_ALIGN, false, false);
403 * that thanks to write = false in this call and us not setting any gpu
406 * XXX: We need a real interface to do this instead of trickery. */
407 ret = i915_gem_object_set_to_gtt_domain(to->obj, false);
409 i915_gem_object_unpin(to->obj);
413 if (!to->obj->has_global_gtt_mapping)
414 i915_gem_gtt_bind_object(to->obj, to->obj->cache_level);
416 if (!to->is_initialized || is_default_context(to))
418 else if (from_obj == to->obj) /* not yet expected */
421 ret = mi_set_context(ring, to, hw_flags);
423 i915_gem_object_unpin(to->obj);
427 /* The backing object for the context is done after switching to the
437 * whole damn pipeline, we don't need to explicitly mark the
440 * able to defer doing this until we know the object would be
441 * swapped, but there is no way to do that yet.
450 drm_gem_object_reference(&to->obj->base);
451 ring->last_context_obj = to->obj;
452 to->is_initialized = true;
462 * @seqno: sequence number by which the new context will be switched to
467 * it will have a refoucnt > 1. This allows us to destroy the context abstract
475 struct i915_hw_context *to;
484 to = ring->default_context;
489 to = i915_gem_context_get(file->driver_priv, to_id);
490 if (to == NULL)
494 return do_switch(to);