Lines Matching refs:context
31 static void tegra_drm_channel_context_close(struct tegra_drm_context *context) in tegra_drm_channel_context_close() argument
36 if (context->memory_context) in tegra_drm_channel_context_close()
37 host1x_memory_context_put(context->memory_context); in tegra_drm_channel_context_close()
39 xa_for_each(&context->mappings, id, mapping) in tegra_drm_channel_context_close()
42 xa_destroy(&context->mappings); in tegra_drm_channel_context_close()
44 host1x_channel_put(context->channel); in tegra_drm_channel_context_close()
46 kfree(context); in tegra_drm_channel_context_close()
51 struct tegra_drm_context *context; in tegra_drm_uapi_close_file() local
55 xa_for_each(&file->contexts, id, context) in tegra_drm_uapi_close_file()
56 tegra_drm_channel_context_close(context); in tegra_drm_uapi_close_file()
83 struct tegra_drm_context *context; in tegra_drm_ioctl_channel_open() local
89 context = kzalloc(sizeof(*context), GFP_KERNEL); in tegra_drm_ioctl_channel_open()
90 if (!context) in tegra_drm_ioctl_channel_open()
100 context->channel = host1x_channel_get(client->shared_channel); in tegra_drm_ioctl_channel_open()
102 context->channel = host1x_channel_request(&client->base); in tegra_drm_ioctl_channel_open()
103 if (!context->channel) { in tegra_drm_ioctl_channel_open()
118 context->memory_context = host1x_memory_context_alloc( in tegra_drm_ioctl_channel_open()
121 if (IS_ERR(context->memory_context)) { in tegra_drm_ioctl_channel_open()
122 if (PTR_ERR(context->memory_context) != -EOPNOTSUPP) { in tegra_drm_ioctl_channel_open()
123 err = PTR_ERR(context->memory_context); in tegra_drm_ioctl_channel_open()
130 context->memory_context = NULL; in tegra_drm_ioctl_channel_open()
135 err = xa_alloc(&fpriv->contexts, &args->context, context, XA_LIMIT(1, U32_MAX), in tegra_drm_ioctl_channel_open()
140 context->client = client; in tegra_drm_ioctl_channel_open()
141 xa_init_flags(&context->mappings, XA_FLAGS_ALLOC1); in tegra_drm_ioctl_channel_open()
152 if (context->memory_context) in tegra_drm_ioctl_channel_open()
153 host1x_memory_context_put(context->memory_context); in tegra_drm_ioctl_channel_open()
155 host1x_channel_put(context->channel); in tegra_drm_ioctl_channel_open()
157 kfree(context); in tegra_drm_ioctl_channel_open()
166 struct tegra_drm_context *context; in tegra_drm_ioctl_channel_close() local
170 context = xa_load(&fpriv->contexts, args->context); in tegra_drm_ioctl_channel_close()
171 if (!context) { in tegra_drm_ioctl_channel_close()
176 xa_erase(&fpriv->contexts, args->context); in tegra_drm_ioctl_channel_close()
180 tegra_drm_channel_context_close(context); in tegra_drm_ioctl_channel_close()
190 struct tegra_drm_context *context; in tegra_drm_ioctl_channel_map() local
200 context = xa_load(&fpriv->contexts, args->context); in tegra_drm_ioctl_channel_map()
201 if (!context) { in tegra_drm_ioctl_channel_map()
214 if (context->memory_context) in tegra_drm_ioctl_channel_map()
215 mapping_dev = &context->memory_context->dev; in tegra_drm_ioctl_channel_map()
217 mapping_dev = context->client->base.dev; in tegra_drm_ioctl_channel_map()
252 err = xa_alloc(&context->mappings, &args->mapping, mapping, XA_LIMIT(1, U32_MAX), in tegra_drm_ioctl_channel_map()
277 struct tegra_drm_context *context; in tegra_drm_ioctl_channel_unmap() local
281 context = xa_load(&fpriv->contexts, args->context); in tegra_drm_ioctl_channel_unmap()
282 if (!context) { in tegra_drm_ioctl_channel_unmap()
287 mapping = xa_erase(&context->mappings, args->mapping); in tegra_drm_ioctl_channel_unmap()