Lines Matching refs:ctx

137 	struct i915_hw_context *ctx = container_of(ctx_ref,
140 drm_gem_object_unreference(&ctx->obj->base);
141 kfree(ctx, sizeof(*ctx));
149 struct i915_hw_context *ctx;
152 ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
153 if (ctx == NULL)
156 kref_init(&ctx->ref);
157 ctx->obj = i915_gem_alloc_object(dev, dev_priv->hw_context_size);
158 if (ctx->obj == NULL) {
159 kfree(ctx, sizeof(*ctx));
165 ret = i915_gem_object_set_cache_level(ctx->obj,
175 ctx->ring = &dev_priv->ring[RCS];
179 return ctx;
189 ret = idr_get_new_above(&file_priv->context_idr, ctx,
191 ctx->file_priv = file_priv;
193 ctx->id = id;
200 return ctx;
203 i915_gem_context_unreference(ctx);
207 static inline bool is_default_context(struct i915_hw_context *ctx)
209 return (ctx == ctx->ring->default_context);
219 struct i915_hw_context *ctx;
224 ctx = create_hw_context(dev_priv->dev, NULL);
225 if (ctx == NULL)
234 dev_priv->ring[RCS].default_context = ctx;
235 ret = i915_gem_object_pin(ctx->obj, CONTEXT_ALIGN, false, false);
241 ret = do_switch(ctx);
251 i915_gem_object_unpin(ctx->obj);
253 i915_gem_context_unreference(ctx);
316 struct i915_hw_context *ctx = p;
320 i915_gem_context_unreference(ctx);
548 struct i915_hw_context *ctx;
561 ctx = create_hw_context(dev, file_priv);
563 if (ctx == NULL)
566 args->ctx_id = ctx->id;
576 struct i915_hw_context *ctx;
586 ctx = i915_gem_context_get(file_priv, args->ctx_id);
587 if (!ctx) {
592 idr_remove(&ctx->file_priv->context_idr, ctx->id);
593 i915_gem_context_unreference(ctx);
600 void i915_gem_context_reference(struct i915_hw_context *ctx)
602 kref_get(&ctx->ref);
605 void i915_gem_context_unreference(struct i915_hw_context *ctx)
607 kref_put(&ctx->ref, i915_gem_context_free);