Lines Matching refs:task
86 WARN_ON(ipp->task); in exynos_drm_ipp_unregister()
260 struct exynos_drm_ipp_task *task; in exynos_drm_ipp_task_alloc() local
262 task = kzalloc(sizeof(*task), GFP_KERNEL); in exynos_drm_ipp_task_alloc()
263 if (!task) in exynos_drm_ipp_task_alloc()
266 task->dev = ipp->dev; in exynos_drm_ipp_task_alloc()
267 task->ipp = ipp; in exynos_drm_ipp_task_alloc()
270 task->src.rect.w = task->dst.rect.w = UINT_MAX; in exynos_drm_ipp_task_alloc()
271 task->src.rect.h = task->dst.rect.h = UINT_MAX; in exynos_drm_ipp_task_alloc()
272 task->transform.rotation = DRM_MODE_ROTATE_0; in exynos_drm_ipp_task_alloc()
274 DRM_DEV_DEBUG_DRIVER(task->dev, "Allocated task %pK\n", task); in exynos_drm_ipp_task_alloc()
276 return task; in exynos_drm_ipp_task_alloc()
313 static int exynos_drm_ipp_task_set(struct exynos_drm_ipp_task *task, in exynos_drm_ipp_task_set() argument
333 if (copy_from_user((void *)task + map[i].offset, params, in exynos_drm_ipp_task_set()
341 DRM_DEV_DEBUG_DRIVER(task->dev, in exynos_drm_ipp_task_set()
343 task); in exynos_drm_ipp_task_set()
395 struct exynos_drm_ipp_task *task) in exynos_drm_ipp_task_free() argument
397 DRM_DEV_DEBUG_DRIVER(task->dev, "Freeing task %pK\n", task); in exynos_drm_ipp_task_free()
399 exynos_drm_ipp_task_release_buf(&task->src); in exynos_drm_ipp_task_free()
400 exynos_drm_ipp_task_release_buf(&task->dst); in exynos_drm_ipp_task_free()
401 if (task->event) in exynos_drm_ipp_task_free()
402 drm_event_cancel_free(ipp->drm_dev, &task->event->base); in exynos_drm_ipp_task_free()
403 kfree(task); in exynos_drm_ipp_task_free()
548 static int exynos_drm_ipp_check_format(struct exynos_drm_ipp_task *task, in exynos_drm_ipp_check_format() argument
557 fmt = __ipp_format_get(task->ipp, buf->buf.fourcc, buf->buf.modifier, in exynos_drm_ipp_check_format()
561 DRM_DEV_DEBUG_DRIVER(task->dev, in exynos_drm_ipp_check_format()
563 task, buf == src ? "src" : "dst"); in exynos_drm_ipp_check_format()
602 static int exynos_drm_ipp_task_check(struct exynos_drm_ipp_task *task) in exynos_drm_ipp_task_check() argument
604 struct exynos_drm_ipp *ipp = task->ipp; in exynos_drm_ipp_task_check()
605 struct exynos_drm_ipp_buffer *src = &task->src, *dst = &task->dst; in exynos_drm_ipp_task_check()
606 unsigned int rotation = task->transform.rotation; in exynos_drm_ipp_task_check()
612 DRM_DEV_DEBUG_DRIVER(task->dev, "Checking task %pK\n", task); in exynos_drm_ipp_task_check()
627 DRM_DEV_DEBUG_DRIVER(task->dev, in exynos_drm_ipp_task_check()
629 task); in exynos_drm_ipp_task_check()
645 DRM_DEV_DEBUG_DRIVER(task->dev, "Task %pK: hw capabilities exceeded\n", in exynos_drm_ipp_task_check()
646 task); in exynos_drm_ipp_task_check()
650 ret = exynos_drm_ipp_check_format(task, src, src, dst, rotate, swap); in exynos_drm_ipp_task_check()
654 ret = exynos_drm_ipp_check_format(task, dst, src, dst, false, swap); in exynos_drm_ipp_task_check()
659 task); in exynos_drm_ipp_task_check()
664 static int exynos_drm_ipp_task_setup_buffers(struct exynos_drm_ipp_task *task, in exynos_drm_ipp_task_setup_buffers() argument
667 struct exynos_drm_ipp_buffer *src = &task->src, *dst = &task->dst; in exynos_drm_ipp_task_setup_buffers()
670 DRM_DEV_DEBUG_DRIVER(task->dev, "Setting buffer for task %pK\n", in exynos_drm_ipp_task_setup_buffers()
671 task); in exynos_drm_ipp_task_setup_buffers()
675 DRM_DEV_DEBUG_DRIVER(task->dev, in exynos_drm_ipp_task_setup_buffers()
677 task); in exynos_drm_ipp_task_setup_buffers()
682 DRM_DEV_DEBUG_DRIVER(task->dev, in exynos_drm_ipp_task_setup_buffers()
684 task); in exynos_drm_ipp_task_setup_buffers()
688 DRM_DEV_DEBUG_DRIVER(task->dev, "Task %pK: buffers prepared.\n", in exynos_drm_ipp_task_setup_buffers()
689 task); in exynos_drm_ipp_task_setup_buffers()
695 static int exynos_drm_ipp_event_create(struct exynos_drm_ipp_task *task, in exynos_drm_ipp_event_create() argument
709 ret = drm_event_reserve_init(task->ipp->drm_dev, file_priv, &e->base, in exynos_drm_ipp_event_create()
714 task->event = e; in exynos_drm_ipp_event_create()
721 static void exynos_drm_ipp_event_send(struct exynos_drm_ipp_task *task) in exynos_drm_ipp_event_send() argument
726 task->event->event.tv_sec = now.tv_sec; in exynos_drm_ipp_event_send()
727 task->event->event.tv_usec = now.tv_nsec / NSEC_PER_USEC; in exynos_drm_ipp_event_send()
728 task->event->event.sequence = atomic_inc_return(&task->ipp->sequence); in exynos_drm_ipp_event_send()
730 drm_send_event(task->ipp->drm_dev, &task->event->base); in exynos_drm_ipp_event_send()
733 static int exynos_drm_ipp_task_cleanup(struct exynos_drm_ipp_task *task) in exynos_drm_ipp_task_cleanup() argument
735 int ret = task->ret; in exynos_drm_ipp_task_cleanup()
737 if (ret == 0 && task->event) { in exynos_drm_ipp_task_cleanup()
738 exynos_drm_ipp_event_send(task); in exynos_drm_ipp_task_cleanup()
740 task->event = NULL; in exynos_drm_ipp_task_cleanup()
743 exynos_drm_ipp_task_free(task->ipp, task); in exynos_drm_ipp_task_cleanup()
749 struct exynos_drm_ipp_task *task = container_of(work, in exynos_drm_ipp_cleanup_work() local
752 exynos_drm_ipp_task_cleanup(task); in exynos_drm_ipp_cleanup_work()
762 void exynos_drm_ipp_task_done(struct exynos_drm_ipp_task *task, int ret) in exynos_drm_ipp_task_done() argument
764 struct exynos_drm_ipp *ipp = task->ipp; in exynos_drm_ipp_task_done()
767 DRM_DEV_DEBUG_DRIVER(task->dev, "ipp: %d, task %pK done: %d\n", in exynos_drm_ipp_task_done()
768 ipp->id, task, ret); in exynos_drm_ipp_task_done()
771 if (ipp->task == task) in exynos_drm_ipp_task_done()
772 ipp->task = NULL; in exynos_drm_ipp_task_done()
773 task->flags |= DRM_EXYNOS_IPP_TASK_DONE; in exynos_drm_ipp_task_done()
774 task->ret = ret; in exynos_drm_ipp_task_done()
780 if (task->flags & DRM_EXYNOS_IPP_TASK_ASYNC) { in exynos_drm_ipp_task_done()
781 INIT_WORK(&task->cleanup_work, exynos_drm_ipp_cleanup_work); in exynos_drm_ipp_task_done()
782 schedule_work(&task->cleanup_work); in exynos_drm_ipp_task_done()
788 struct exynos_drm_ipp_task *task; in exynos_drm_ipp_next_task() local
797 if (ipp->task || list_empty(&ipp->todo_list)) { in exynos_drm_ipp_next_task()
802 task = list_first_entry(&ipp->todo_list, struct exynos_drm_ipp_task, in exynos_drm_ipp_next_task()
804 list_del_init(&task->head); in exynos_drm_ipp_next_task()
805 ipp->task = task; in exynos_drm_ipp_next_task()
811 task); in exynos_drm_ipp_next_task()
813 ret = ipp->funcs->commit(ipp, task); in exynos_drm_ipp_next_task()
815 exynos_drm_ipp_task_done(task, ret); in exynos_drm_ipp_next_task()
819 struct exynos_drm_ipp_task *task) in exynos_drm_ipp_schedule_task() argument
824 list_add(&task->head, &ipp->todo_list); in exynos_drm_ipp_schedule_task()
831 struct exynos_drm_ipp_task *task) in exynos_drm_ipp_task_abort() argument
836 if (task->flags & DRM_EXYNOS_IPP_TASK_DONE) { in exynos_drm_ipp_task_abort()
838 exynos_drm_ipp_task_cleanup(task); in exynos_drm_ipp_task_abort()
839 } else if (ipp->task != task) { in exynos_drm_ipp_task_abort()
841 list_del_init(&task->head); in exynos_drm_ipp_task_abort()
842 exynos_drm_ipp_task_cleanup(task); in exynos_drm_ipp_task_abort()
848 task->flags |= DRM_EXYNOS_IPP_TASK_ASYNC; in exynos_drm_ipp_task_abort()
851 ipp->funcs->abort(ipp, task); in exynos_drm_ipp_task_abort()
876 struct exynos_drm_ipp_task *task; in exynos_drm_ipp_commit_ioctl() local
891 task = exynos_drm_ipp_task_alloc(ipp); in exynos_drm_ipp_commit_ioctl()
892 if (!task) in exynos_drm_ipp_commit_ioctl()
895 ret = exynos_drm_ipp_task_set(task, arg); in exynos_drm_ipp_commit_ioctl()
899 ret = exynos_drm_ipp_task_check(task); in exynos_drm_ipp_commit_ioctl()
903 ret = exynos_drm_ipp_task_setup_buffers(task, file_priv); in exynos_drm_ipp_commit_ioctl()
908 ret = exynos_drm_ipp_event_create(task, file_priv, in exynos_drm_ipp_commit_ioctl()
921 ipp->id, task); in exynos_drm_ipp_commit_ioctl()
923 task->flags |= DRM_EXYNOS_IPP_TASK_ASYNC; in exynos_drm_ipp_commit_ioctl()
924 exynos_drm_ipp_schedule_task(task->ipp, task); in exynos_drm_ipp_commit_ioctl()
928 ipp->id, task); in exynos_drm_ipp_commit_ioctl()
929 exynos_drm_ipp_schedule_task(ipp, task); in exynos_drm_ipp_commit_ioctl()
931 task->flags & DRM_EXYNOS_IPP_TASK_DONE); in exynos_drm_ipp_commit_ioctl()
933 exynos_drm_ipp_task_abort(ipp, task); in exynos_drm_ipp_commit_ioctl()
935 ret = exynos_drm_ipp_task_cleanup(task); in exynos_drm_ipp_commit_ioctl()
939 exynos_drm_ipp_task_free(ipp, task); in exynos_drm_ipp_commit_ioctl()