Lines Matching full:context

26 #define SUBMIT_ERR(context, fmt, ...) \  argument
27 dev_err_ratelimited(context->client->base.dev, \
146 tegra_drm_mapping_get(struct tegra_drm_context *context, u32 id) in tegra_drm_mapping_get() argument
150 xa_lock(&context->mappings); in tegra_drm_mapping_get()
152 mapping = xa_load(&context->mappings, id); in tegra_drm_mapping_get()
156 xa_unlock(&context->mappings); in tegra_drm_mapping_get()
180 struct tegra_drm_context *context, in submit_copy_gather_data() argument
187 SUBMIT_ERR(context, "gather_data_words cannot be zero"); in submit_copy_gather_data()
192 SUBMIT_ERR(context, "gather_data_words is too large"); in submit_copy_gather_data()
198 SUBMIT_ERR(context, "failed to allocate memory for bo info"); in submit_copy_gather_data()
209 SUBMIT_ERR(context, "failed to allocate memory for gather data"); in submit_copy_gather_data()
215 SUBMIT_ERR(context, "failed to copy gather data from userspace"); in submit_copy_gather_data()
228 static int submit_write_reloc(struct tegra_drm_context *context, struct gather_bo *bo, in submit_write_reloc() argument
243 SUBMIT_ERR(context, in submit_write_reloc()
257 static int submit_process_bufs(struct tegra_drm_context *context, struct gather_bo *bo, in submit_process_bufs() argument
269 SUBMIT_ERR(context, "failed to copy bufs array from userspace"); in submit_process_bufs()
275 SUBMIT_ERR(context, "failed to allocate memory for mapping info"); in submit_process_bufs()
285 SUBMIT_ERR(context, "invalid flag specified for buffer"); in submit_process_bufs()
290 mapping = tegra_drm_mapping_get(context, buf->mapping); in submit_process_bufs()
292 SUBMIT_ERR(context, "invalid mapping ID '%u' for buffer", buf->mapping); in submit_process_bufs()
297 err = submit_write_reloc(context, bo, buf, mapping); in submit_process_bufs()
327 static int submit_get_syncpt(struct tegra_drm_context *context, struct host1x_job *job, in submit_get_syncpt() argument
333 SUBMIT_ERR(context, "invalid flag specified for syncpt"); in submit_get_syncpt()
340 SUBMIT_ERR(context, "syncpoint specified in syncpt was not allocated"); in submit_get_syncpt()
350 static int submit_job_add_gather(struct host1x_job *job, struct tegra_drm_context *context, in submit_job_add_gather() argument
359 SUBMIT_ERR(context, "non-zero reserved field in GATHER_UPTR command"); in submit_job_add_gather()
365 SUBMIT_ERR(context, "too many words in GATHER_UPTR command"); in submit_job_add_gather()
370 SUBMIT_ERR(context, "too many total words in job"); in submit_job_add_gather()
375 SUBMIT_ERR(context, "GATHER_UPTR command overflows gather data"); in submit_job_add_gather()
379 if (tegra_drm_fw_validate(context->client, bo->gather_data, *offset, in submit_job_add_gather()
381 SUBMIT_ERR(context, "job was rejected by firewall"); in submit_job_add_gather()
393 submit_create_job(struct tegra_drm_context *context, struct gather_bo *bo, in submit_create_job() argument
403 class = context->client->base.class; in submit_create_job()
408 SUBMIT_ERR(context, "failed to copy cmds array from userspace"); in submit_create_job()
412 job = host1x_job_alloc(context->channel, args->num_cmds, 0, true); in submit_create_job()
414 SUBMIT_ERR(context, "failed to allocate memory for job"); in submit_create_job()
419 err = submit_get_syncpt(context, job, syncpoints, args); in submit_create_job()
423 job->client = &context->client->base; in submit_create_job()
424 job->class = context->client->base.class; in submit_create_job()
431 SUBMIT_ERR(context, "unknown flags given for cmd"); in submit_create_job()
437 err = submit_job_add_gather(job, context, &cmd->gather_uptr, bo, in submit_create_job()
443 SUBMIT_ERR(context, "non-zero reserved value"); in submit_create_job()
452 SUBMIT_ERR(context, "non-zero reserved value"); in submit_create_job()
458 SUBMIT_ERR(context, "syncpoint ID in CMD_WAIT_SYNCPT_RELATIVE is not used by the job"); in submit_create_job()
466 SUBMIT_ERR(context, "unknown cmd type"); in submit_create_job()
473 SUBMIT_ERR(context, "job must have at least one gather"); in submit_create_job()
516 struct tegra_drm_context *context; in tegra_drm_ioctl_channel_submit() local
524 context = xa_load(&fpriv->contexts, args->context); in tegra_drm_ioctl_channel_submit()
525 if (!context) { in tegra_drm_ioctl_channel_submit()
527 pr_err_ratelimited("%s: %s: invalid channel context '%#x'", __func__, in tegra_drm_ioctl_channel_submit()
528 current->comm, args->context); in tegra_drm_ioctl_channel_submit()
537 SUBMIT_ERR(context, "invalid syncobj_in '%#x'", args->syncobj_in); in tegra_drm_ioctl_channel_submit()
544 SUBMIT_ERR(context, "wait for syncobj_in timed out"); in tegra_drm_ioctl_channel_submit()
552 SUBMIT_ERR(context, "invalid syncobj_out '%#x'", args->syncobj_out); in tegra_drm_ioctl_channel_submit()
559 err = submit_copy_gather_data(&bo, drm->dev, context, args); in tegra_drm_ioctl_channel_submit()
565 SUBMIT_ERR(context, "failed to allocate memory for job data"); in tegra_drm_ioctl_channel_submit()
571 err = submit_process_bufs(context, bo, args, job_data); in tegra_drm_ioctl_channel_submit()
576 job = submit_create_job(context, bo, args, job_data, &fpriv->syncpoints); in tegra_drm_ioctl_channel_submit()
583 err = host1x_job_pin(job, context->client->base.dev); in tegra_drm_ioctl_channel_submit()
585 SUBMIT_ERR(context, "failed to pin job: %d", err); in tegra_drm_ioctl_channel_submit()
589 if (context->client->ops->get_streamid_offset) { in tegra_drm_ioctl_channel_submit()
590 err = context->client->ops->get_streamid_offset( in tegra_drm_ioctl_channel_submit()
591 context->client, &job->engine_streamid_offset); in tegra_drm_ioctl_channel_submit()
593 SUBMIT_ERR(context, "failed to get streamid offset: %d", err); in tegra_drm_ioctl_channel_submit()
598 if (context->memory_context && context->client->ops->can_use_memory_ctx) { in tegra_drm_ioctl_channel_submit()
601 err = context->client->ops->can_use_memory_ctx(context->client, &supported); in tegra_drm_ioctl_channel_submit()
603 SUBMIT_ERR(context, "failed to detect if engine can use memory context: %d", err); in tegra_drm_ioctl_channel_submit()
608 job->memory_context = context->memory_context; in tegra_drm_ioctl_channel_submit()
611 } else if (context->client->ops->get_streamid_offset) { in tegra_drm_ioctl_channel_submit()
616 if (!tegra_dev_iommu_get_stream_id(context->client->base.dev, in tegra_drm_ioctl_channel_submit()
622 err = pm_runtime_resume_and_get(context->client->base.dev); in tegra_drm_ioctl_channel_submit()
624 SUBMIT_ERR(context, "could not power up engine: %d", err); in tegra_drm_ioctl_channel_submit()
641 SUBMIT_ERR(context, "host1x job submission failed: %d", err); in tegra_drm_ioctl_channel_submit()
652 SUBMIT_ERR(context, "failed to create postfence: %d", err); in tegra_drm_ioctl_channel_submit()