Lines Matching refs:task

85 	WARN_ON(ipp->task);  in exynos_drm_ipp_unregister()
259 struct exynos_drm_ipp_task *task; in exynos_drm_ipp_task_alloc() local
261 task = kzalloc(sizeof(*task), GFP_KERNEL); in exynos_drm_ipp_task_alloc()
262 if (!task) in exynos_drm_ipp_task_alloc()
265 task->dev = ipp->dev; in exynos_drm_ipp_task_alloc()
266 task->ipp = ipp; in exynos_drm_ipp_task_alloc()
269 task->src.rect.w = task->dst.rect.w = UINT_MAX; in exynos_drm_ipp_task_alloc()
270 task->src.rect.h = task->dst.rect.h = UINT_MAX; in exynos_drm_ipp_task_alloc()
271 task->transform.rotation = DRM_MODE_ROTATE_0; in exynos_drm_ipp_task_alloc()
273 DRM_DEV_DEBUG_DRIVER(task->dev, "Allocated task %pK\n", task); in exynos_drm_ipp_task_alloc()
275 return task; in exynos_drm_ipp_task_alloc()
312 static int exynos_drm_ipp_task_set(struct exynos_drm_ipp_task *task, in exynos_drm_ipp_task_set() argument
332 if (copy_from_user((void *)task + map[i].offset, params, in exynos_drm_ipp_task_set()
340 DRM_DEV_DEBUG_DRIVER(task->dev, in exynos_drm_ipp_task_set()
342 task); in exynos_drm_ipp_task_set()
394 struct exynos_drm_ipp_task *task) in exynos_drm_ipp_task_free() argument
396 DRM_DEV_DEBUG_DRIVER(task->dev, "Freeing task %pK\n", task); in exynos_drm_ipp_task_free()
398 exynos_drm_ipp_task_release_buf(&task->src); in exynos_drm_ipp_task_free()
399 exynos_drm_ipp_task_release_buf(&task->dst); in exynos_drm_ipp_task_free()
400 if (task->event) in exynos_drm_ipp_task_free()
401 drm_event_cancel_free(ipp->drm_dev, &task->event->base); in exynos_drm_ipp_task_free()
402 kfree(task); in exynos_drm_ipp_task_free()
547 static int exynos_drm_ipp_check_format(struct exynos_drm_ipp_task *task, in exynos_drm_ipp_check_format() argument
556 fmt = __ipp_format_get(task->ipp, buf->buf.fourcc, buf->buf.modifier, in exynos_drm_ipp_check_format()
560 DRM_DEV_DEBUG_DRIVER(task->dev, in exynos_drm_ipp_check_format()
562 task, buf == src ? "src" : "dst"); in exynos_drm_ipp_check_format()
601 static int exynos_drm_ipp_task_check(struct exynos_drm_ipp_task *task) in exynos_drm_ipp_task_check() argument
603 struct exynos_drm_ipp *ipp = task->ipp; in exynos_drm_ipp_task_check()
604 struct exynos_drm_ipp_buffer *src = &task->src, *dst = &task->dst; in exynos_drm_ipp_task_check()
605 unsigned int rotation = task->transform.rotation; in exynos_drm_ipp_task_check()
611 DRM_DEV_DEBUG_DRIVER(task->dev, "Checking task %pK\n", task); in exynos_drm_ipp_task_check()
626 DRM_DEV_DEBUG_DRIVER(task->dev, in exynos_drm_ipp_task_check()
628 task); in exynos_drm_ipp_task_check()
644 DRM_DEV_DEBUG_DRIVER(task->dev, "Task %pK: hw capabilities exceeded\n", in exynos_drm_ipp_task_check()
645 task); in exynos_drm_ipp_task_check()
649 ret = exynos_drm_ipp_check_format(task, src, src, dst, rotate, swap); in exynos_drm_ipp_task_check()
653 ret = exynos_drm_ipp_check_format(task, dst, src, dst, false, swap); in exynos_drm_ipp_task_check()
658 task); in exynos_drm_ipp_task_check()
663 static int exynos_drm_ipp_task_setup_buffers(struct exynos_drm_ipp_task *task, in exynos_drm_ipp_task_setup_buffers() argument
666 struct exynos_drm_ipp_buffer *src = &task->src, *dst = &task->dst; in exynos_drm_ipp_task_setup_buffers()
669 DRM_DEV_DEBUG_DRIVER(task->dev, "Setting buffer for task %pK\n", in exynos_drm_ipp_task_setup_buffers()
670 task); in exynos_drm_ipp_task_setup_buffers()
674 DRM_DEV_DEBUG_DRIVER(task->dev, in exynos_drm_ipp_task_setup_buffers()
676 task); in exynos_drm_ipp_task_setup_buffers()
681 DRM_DEV_DEBUG_DRIVER(task->dev, in exynos_drm_ipp_task_setup_buffers()
683 task); in exynos_drm_ipp_task_setup_buffers()
687 DRM_DEV_DEBUG_DRIVER(task->dev, "Task %pK: buffers prepared.\n", in exynos_drm_ipp_task_setup_buffers()
688 task); in exynos_drm_ipp_task_setup_buffers()
694 static int exynos_drm_ipp_event_create(struct exynos_drm_ipp_task *task, in exynos_drm_ipp_event_create() argument
708 ret = drm_event_reserve_init(task->ipp->drm_dev, file_priv, &e->base, in exynos_drm_ipp_event_create()
713 task->event = e; in exynos_drm_ipp_event_create()
720 static void exynos_drm_ipp_event_send(struct exynos_drm_ipp_task *task) in exynos_drm_ipp_event_send() argument
725 task->event->event.tv_sec = now.tv_sec; in exynos_drm_ipp_event_send()
726 task->event->event.tv_usec = now.tv_nsec / NSEC_PER_USEC; in exynos_drm_ipp_event_send()
727 task->event->event.sequence = atomic_inc_return(&task->ipp->sequence); in exynos_drm_ipp_event_send()
729 drm_send_event(task->ipp->drm_dev, &task->event->base); in exynos_drm_ipp_event_send()
732 static int exynos_drm_ipp_task_cleanup(struct exynos_drm_ipp_task *task) in exynos_drm_ipp_task_cleanup() argument
734 int ret = task->ret; in exynos_drm_ipp_task_cleanup()
736 if (ret == 0 && task->event) { in exynos_drm_ipp_task_cleanup()
737 exynos_drm_ipp_event_send(task); in exynos_drm_ipp_task_cleanup()
739 task->event = NULL; in exynos_drm_ipp_task_cleanup()
742 exynos_drm_ipp_task_free(task->ipp, task); in exynos_drm_ipp_task_cleanup()
748 struct exynos_drm_ipp_task *task = container_of(work, in exynos_drm_ipp_cleanup_work() local
751 exynos_drm_ipp_task_cleanup(task); in exynos_drm_ipp_cleanup_work()
761 void exynos_drm_ipp_task_done(struct exynos_drm_ipp_task *task, int ret) in exynos_drm_ipp_task_done() argument
763 struct exynos_drm_ipp *ipp = task->ipp; in exynos_drm_ipp_task_done()
766 DRM_DEV_DEBUG_DRIVER(task->dev, "ipp: %d, task %pK done: %d\n", in exynos_drm_ipp_task_done()
767 ipp->id, task, ret); in exynos_drm_ipp_task_done()
770 if (ipp->task == task) in exynos_drm_ipp_task_done()
771 ipp->task = NULL; in exynos_drm_ipp_task_done()
772 task->flags |= DRM_EXYNOS_IPP_TASK_DONE; in exynos_drm_ipp_task_done()
773 task->ret = ret; in exynos_drm_ipp_task_done()
779 if (task->flags & DRM_EXYNOS_IPP_TASK_ASYNC) { in exynos_drm_ipp_task_done()
780 INIT_WORK(&task->cleanup_work, exynos_drm_ipp_cleanup_work); in exynos_drm_ipp_task_done()
781 schedule_work(&task->cleanup_work); in exynos_drm_ipp_task_done()
787 struct exynos_drm_ipp_task *task; in exynos_drm_ipp_next_task() local
796 if (ipp->task || list_empty(&ipp->todo_list)) { in exynos_drm_ipp_next_task()
801 task = list_first_entry(&ipp->todo_list, struct exynos_drm_ipp_task, in exynos_drm_ipp_next_task()
803 list_del_init(&task->head); in exynos_drm_ipp_next_task()
804 ipp->task = task; in exynos_drm_ipp_next_task()
810 task); in exynos_drm_ipp_next_task()
812 ret = ipp->funcs->commit(ipp, task); in exynos_drm_ipp_next_task()
814 exynos_drm_ipp_task_done(task, ret); in exynos_drm_ipp_next_task()
818 struct exynos_drm_ipp_task *task) in exynos_drm_ipp_schedule_task() argument
823 list_add(&task->head, &ipp->todo_list); in exynos_drm_ipp_schedule_task()
830 struct exynos_drm_ipp_task *task) in exynos_drm_ipp_task_abort() argument
835 if (task->flags & DRM_EXYNOS_IPP_TASK_DONE) { in exynos_drm_ipp_task_abort()
837 exynos_drm_ipp_task_cleanup(task); in exynos_drm_ipp_task_abort()
838 } else if (ipp->task != task) { in exynos_drm_ipp_task_abort()
840 list_del_init(&task->head); in exynos_drm_ipp_task_abort()
841 exynos_drm_ipp_task_cleanup(task); in exynos_drm_ipp_task_abort()
847 task->flags |= DRM_EXYNOS_IPP_TASK_ASYNC; in exynos_drm_ipp_task_abort()
850 ipp->funcs->abort(ipp, task); in exynos_drm_ipp_task_abort()
875 struct exynos_drm_ipp_task *task; in exynos_drm_ipp_commit_ioctl() local
890 task = exynos_drm_ipp_task_alloc(ipp); in exynos_drm_ipp_commit_ioctl()
891 if (!task) in exynos_drm_ipp_commit_ioctl()
894 ret = exynos_drm_ipp_task_set(task, arg); in exynos_drm_ipp_commit_ioctl()
898 ret = exynos_drm_ipp_task_check(task); in exynos_drm_ipp_commit_ioctl()
902 ret = exynos_drm_ipp_task_setup_buffers(task, file_priv); in exynos_drm_ipp_commit_ioctl()
907 ret = exynos_drm_ipp_event_create(task, file_priv, in exynos_drm_ipp_commit_ioctl()
920 ipp->id, task); in exynos_drm_ipp_commit_ioctl()
922 task->flags |= DRM_EXYNOS_IPP_TASK_ASYNC; in exynos_drm_ipp_commit_ioctl()
923 exynos_drm_ipp_schedule_task(task->ipp, task); in exynos_drm_ipp_commit_ioctl()
927 ipp->id, task); in exynos_drm_ipp_commit_ioctl()
928 exynos_drm_ipp_schedule_task(ipp, task); in exynos_drm_ipp_commit_ioctl()
930 task->flags & DRM_EXYNOS_IPP_TASK_DONE); in exynos_drm_ipp_commit_ioctl()
932 exynos_drm_ipp_task_abort(ipp, task); in exynos_drm_ipp_commit_ioctl()
934 ret = exynos_drm_ipp_task_cleanup(task); in exynos_drm_ipp_commit_ioctl()
938 exynos_drm_ipp_task_free(ipp, task); in exynos_drm_ipp_commit_ioctl()