@@ -180,6 +180,43 @@ id_out:
return ret;
}
+static void logical_context_fini(struct drm_i915_gem_context *ctx)
+{
+
+}
+
+static int logical_context_free(struct drm_file *file, uint32_t id)
+{
+ struct drm_i915_gem_context *ctx;
+
+ if (WARN_ON(id == DEFAULT_CONTEXT_ID))
+ return 0;
+
+ /* ref and pin the object */
+ ctx = i915_get_context(file, id);
+ if (!ctx) {
+ DRM_ERROR("Couldn't find context %d", id);
+ return -EINVAL;
+ }
+
+ i915_release_context(ctx);
+
+ mutex_lock(&ctx->dev->struct_mutex);
+
+ logical_context_fini(ctx);
+ drm_gem_object_unreference(&ctx->obj->base);
+
+ mutex_unlock(&ctx->dev->struct_mutex);
+
+ context_destroy_id(ctx);
+
+ ctx->file = NULL;
+ ctx->dev = NULL;
+ kfree(ctx);
+
+ return 0;
+}
+
/**
* i915_context_create_ioctl() - not yet supported
*/