82 DRM_ERROR(
"Out of memory expanding drawable idr\n");
87 DRM_RESERVED_CONTEXTS, &new_id);
144 struct drm_file *file_priv)
147 struct drm_local_map *
map;
148 struct drm_map_list *
_entry;
160 if (_entry->map == map) {
162 (
void *)(
unsigned long)_entry->user_token;
188 struct drm_file *file_priv)
191 struct drm_local_map *
map =
NULL;
192 struct drm_map_list *r_list =
NULL;
197 && r_list->user_token == (
unsigned long) request->
handle)
233 static int drm_context_switch(
struct drm_device * dev,
int old,
int new)
236 DRM_ERROR(
"Reentering -- FIXME\n");
240 DRM_DEBUG(
"Context switch from %d to %d\n", old,
new);
242 if (
new == dev->last_context) {
261 static int drm_context_switch_complete(
struct drm_device *dev,
262 struct drm_file *file_priv,
int new)
264 dev->last_context =
new;
268 DRM_ERROR(
"Lock isn't held after context switch\n");
290 struct drm_file *file_priv)
296 if (res->
count >= DRM_RESERVED_CONTEXTS) {
297 memset(&ctx, 0,
sizeof(ctx));
298 for (i = 0; i < DRM_RESERVED_CONTEXTS; i++) {
304 res->
count = DRM_RESERVED_CONTEXTS;
321 struct drm_file *file_priv)
323 struct drm_ctx_list *ctx_entry;
326 ctx->
handle = drm_ctxbitmap_next(dev);
327 if (ctx->
handle == DRM_KERNEL_CONTEXT) {
329 ctx->
handle = drm_ctxbitmap_next(dev);
331 DRM_DEBUG(
"%d\n", ctx->
handle);
333 DRM_DEBUG(
"Not enough free contexts.\n");
340 DRM_DEBUG(
"out of memory\n");
344 INIT_LIST_HEAD(&ctx_entry->head);
345 ctx_entry->handle = ctx->
handle;
346 ctx_entry->tag = file_priv;
349 list_add(&ctx_entry->head, &dev->ctxlist);
393 struct drm_file *file_priv)
397 DRM_DEBUG(
"%d\n", ctx->
handle);
398 return drm_context_switch(dev, dev->last_context, ctx->
handle);
413 struct drm_file *file_priv)
417 DRM_DEBUG(
"%d\n", ctx->
handle);
418 drm_context_switch_complete(dev, file_priv, ctx->
handle);
435 struct drm_file *file_priv)
439 DRM_DEBUG(
"%d\n", ctx->
handle);
440 if (ctx->
handle != DRM_KERNEL_CONTEXT) {
441 if (dev->driver->context_dtor)
442 dev->driver->context_dtor(dev, ctx->
handle);
447 if (!list_empty(&dev->ctxlist)) {
448 struct drm_ctx_list *
pos, *
n;
451 if (pos->handle == ctx->
handle) {