| .. | .. |
|---|
| 16 | 16 | * all copies or substantial portions of the Software. |
|---|
| 17 | 17 | */ |
|---|
| 18 | 18 | |
|---|
| 19 | +#include <linux/uaccess.h> |
|---|
| 19 | 20 | |
|---|
| 20 | | -#include <drm/drmP.h> |
|---|
| 21 | +#include <drm/drm_file.h> |
|---|
| 22 | +#include <drm/drm_fourcc.h> |
|---|
| 21 | 23 | #include <drm/drm_mode.h> |
|---|
| 22 | | -#include <uapi/drm/exynos_drm.h> |
|---|
| 24 | +#include <drm/exynos_drm.h> |
|---|
| 23 | 25 | |
|---|
| 24 | 26 | #include "exynos_drm_drv.h" |
|---|
| 25 | 27 | #include "exynos_drm_gem.h" |
|---|
| .. | .. |
|---|
| 43 | 45 | * Returns: |
|---|
| 44 | 46 | * Zero on success, error code on failure. |
|---|
| 45 | 47 | */ |
|---|
| 46 | | -int exynos_drm_ipp_register(struct drm_device *dev, struct exynos_drm_ipp *ipp, |
|---|
| 48 | +int exynos_drm_ipp_register(struct device *dev, struct exynos_drm_ipp *ipp, |
|---|
| 47 | 49 | const struct exynos_drm_ipp_funcs *funcs, unsigned int caps, |
|---|
| 48 | 50 | const struct exynos_drm_ipp_formats *formats, |
|---|
| 49 | 51 | unsigned int num_formats, const char *name) |
|---|
| .. | .. |
|---|
| 67 | 69 | list_add_tail(&ipp->head, &ipp_list); |
|---|
| 68 | 70 | ipp->id = num_ipp++; |
|---|
| 69 | 71 | |
|---|
| 70 | | - DRM_DEBUG_DRIVER("Registered ipp %d\n", ipp->id); |
|---|
| 72 | + DRM_DEV_DEBUG_DRIVER(dev, "Registered ipp %d\n", ipp->id); |
|---|
| 71 | 73 | |
|---|
| 72 | 74 | return 0; |
|---|
| 73 | 75 | } |
|---|
| .. | .. |
|---|
| 77 | 79 | * @dev: DRM device |
|---|
| 78 | 80 | * @ipp: ipp module |
|---|
| 79 | 81 | */ |
|---|
| 80 | | -void exynos_drm_ipp_unregister(struct drm_device *dev, |
|---|
| 82 | +void exynos_drm_ipp_unregister(struct device *dev, |
|---|
| 81 | 83 | struct exynos_drm_ipp *ipp) |
|---|
| 82 | 84 | { |
|---|
| 83 | 85 | WARN_ON(ipp->task); |
|---|
| .. | .. |
|---|
| 268 | 270 | task->src.rect.h = task->dst.rect.h = UINT_MAX; |
|---|
| 269 | 271 | task->transform.rotation = DRM_MODE_ROTATE_0; |
|---|
| 270 | 272 | |
|---|
| 271 | | - DRM_DEBUG_DRIVER("Allocated task %pK\n", task); |
|---|
| 273 | + DRM_DEV_DEBUG_DRIVER(task->dev, "Allocated task %pK\n", task); |
|---|
| 272 | 274 | |
|---|
| 273 | 275 | return task; |
|---|
| 274 | 276 | } |
|---|
| .. | .. |
|---|
| 335 | 337 | size -= map[i].size; |
|---|
| 336 | 338 | } |
|---|
| 337 | 339 | |
|---|
| 338 | | - DRM_DEBUG_DRIVER("Got task %pK configuration from userspace\n", task); |
|---|
| 340 | + DRM_DEV_DEBUG_DRIVER(task->dev, |
|---|
| 341 | + "Got task %pK configuration from userspace\n", |
|---|
| 342 | + task); |
|---|
| 339 | 343 | return 0; |
|---|
| 340 | 344 | } |
|---|
| 341 | 345 | |
|---|
| .. | .. |
|---|
| 389 | 393 | static void exynos_drm_ipp_task_free(struct exynos_drm_ipp *ipp, |
|---|
| 390 | 394 | struct exynos_drm_ipp_task *task) |
|---|
| 391 | 395 | { |
|---|
| 392 | | - DRM_DEBUG_DRIVER("Freeing task %pK\n", task); |
|---|
| 396 | + DRM_DEV_DEBUG_DRIVER(task->dev, "Freeing task %pK\n", task); |
|---|
| 393 | 397 | |
|---|
| 394 | 398 | exynos_drm_ipp_task_release_buf(&task->src); |
|---|
| 395 | 399 | exynos_drm_ipp_task_release_buf(&task->dst); |
|---|
| 396 | 400 | if (task->event) |
|---|
| 397 | | - drm_event_cancel_free(ipp->dev, &task->event->base); |
|---|
| 401 | + drm_event_cancel_free(ipp->drm_dev, &task->event->base); |
|---|
| 398 | 402 | kfree(task); |
|---|
| 399 | 403 | } |
|---|
| 400 | 404 | |
|---|
| .. | .. |
|---|
| 553 | 557 | buf == src ? DRM_EXYNOS_IPP_FORMAT_SOURCE : |
|---|
| 554 | 558 | DRM_EXYNOS_IPP_FORMAT_DESTINATION); |
|---|
| 555 | 559 | if (!fmt) { |
|---|
| 556 | | - DRM_DEBUG_DRIVER("Task %pK: %s format not supported\n", task, |
|---|
| 557 | | - buf == src ? "src" : "dst"); |
|---|
| 560 | + DRM_DEV_DEBUG_DRIVER(task->dev, |
|---|
| 561 | + "Task %pK: %s format not supported\n", |
|---|
| 562 | + task, buf == src ? "src" : "dst"); |
|---|
| 558 | 563 | return -EINVAL; |
|---|
| 559 | 564 | } |
|---|
| 560 | 565 | |
|---|
| .. | .. |
|---|
| 603 | 608 | bool rotate = (rotation != DRM_MODE_ROTATE_0); |
|---|
| 604 | 609 | bool scale = false; |
|---|
| 605 | 610 | |
|---|
| 606 | | - DRM_DEBUG_DRIVER("Checking task %pK\n", task); |
|---|
| 611 | + DRM_DEV_DEBUG_DRIVER(task->dev, "Checking task %pK\n", task); |
|---|
| 607 | 612 | |
|---|
| 608 | 613 | if (src->rect.w == UINT_MAX) |
|---|
| 609 | 614 | src->rect.w = src->buf.width; |
|---|
| .. | .. |
|---|
| 618 | 623 | src->rect.y + src->rect.h > (src->buf.height) || |
|---|
| 619 | 624 | dst->rect.x + dst->rect.w > (dst->buf.width) || |
|---|
| 620 | 625 | dst->rect.y + dst->rect.h > (dst->buf.height)) { |
|---|
| 621 | | - DRM_DEBUG_DRIVER("Task %pK: defined area is outside provided buffers\n", |
|---|
| 622 | | - task); |
|---|
| 626 | + DRM_DEV_DEBUG_DRIVER(task->dev, |
|---|
| 627 | + "Task %pK: defined area is outside provided buffers\n", |
|---|
| 628 | + task); |
|---|
| 623 | 629 | return -EINVAL; |
|---|
| 624 | 630 | } |
|---|
| 625 | 631 | |
|---|
| .. | .. |
|---|
| 635 | 641 | (!(ipp->capabilities & DRM_EXYNOS_IPP_CAP_SCALE) && scale) || |
|---|
| 636 | 642 | (!(ipp->capabilities & DRM_EXYNOS_IPP_CAP_CONVERT) && |
|---|
| 637 | 643 | src->buf.fourcc != dst->buf.fourcc)) { |
|---|
| 638 | | - DRM_DEBUG_DRIVER("Task %pK: hw capabilities exceeded\n", task); |
|---|
| 644 | + DRM_DEV_DEBUG_DRIVER(task->dev, "Task %pK: hw capabilities exceeded\n", |
|---|
| 645 | + task); |
|---|
| 639 | 646 | return -EINVAL; |
|---|
| 640 | 647 | } |
|---|
| 641 | 648 | |
|---|
| .. | .. |
|---|
| 647 | 654 | if (ret) |
|---|
| 648 | 655 | return ret; |
|---|
| 649 | 656 | |
|---|
| 650 | | - DRM_DEBUG_DRIVER("Task %pK: all checks done.\n", task); |
|---|
| 657 | + DRM_DEV_DEBUG_DRIVER(ipp->dev, "Task %pK: all checks done.\n", |
|---|
| 658 | + task); |
|---|
| 651 | 659 | |
|---|
| 652 | 660 | return ret; |
|---|
| 653 | 661 | } |
|---|
| .. | .. |
|---|
| 658 | 666 | struct exynos_drm_ipp_buffer *src = &task->src, *dst = &task->dst; |
|---|
| 659 | 667 | int ret = 0; |
|---|
| 660 | 668 | |
|---|
| 661 | | - DRM_DEBUG_DRIVER("Setting buffer for task %pK\n", task); |
|---|
| 669 | + DRM_DEV_DEBUG_DRIVER(task->dev, "Setting buffer for task %pK\n", |
|---|
| 670 | + task); |
|---|
| 662 | 671 | |
|---|
| 663 | 672 | ret = exynos_drm_ipp_task_setup_buffer(src, filp); |
|---|
| 664 | 673 | if (ret) { |
|---|
| 665 | | - DRM_DEBUG_DRIVER("Task %pK: src buffer setup failed\n", task); |
|---|
| 674 | + DRM_DEV_DEBUG_DRIVER(task->dev, |
|---|
| 675 | + "Task %pK: src buffer setup failed\n", |
|---|
| 676 | + task); |
|---|
| 666 | 677 | return ret; |
|---|
| 667 | 678 | } |
|---|
| 668 | 679 | ret = exynos_drm_ipp_task_setup_buffer(dst, filp); |
|---|
| 669 | 680 | if (ret) { |
|---|
| 670 | | - DRM_DEBUG_DRIVER("Task %pK: dst buffer setup failed\n", task); |
|---|
| 681 | + DRM_DEV_DEBUG_DRIVER(task->dev, |
|---|
| 682 | + "Task %pK: dst buffer setup failed\n", |
|---|
| 683 | + task); |
|---|
| 671 | 684 | return ret; |
|---|
| 672 | 685 | } |
|---|
| 673 | 686 | |
|---|
| 674 | | - DRM_DEBUG_DRIVER("Task %pK: buffers prepared.\n", task); |
|---|
| 687 | + DRM_DEV_DEBUG_DRIVER(task->dev, "Task %pK: buffers prepared.\n", |
|---|
| 688 | + task); |
|---|
| 675 | 689 | |
|---|
| 676 | 690 | return ret; |
|---|
| 677 | 691 | } |
|---|
| .. | .. |
|---|
| 691 | 705 | e->event.base.length = sizeof(e->event); |
|---|
| 692 | 706 | e->event.user_data = user_data; |
|---|
| 693 | 707 | |
|---|
| 694 | | - ret = drm_event_reserve_init(task->dev, file_priv, &e->base, |
|---|
| 708 | + ret = drm_event_reserve_init(task->ipp->drm_dev, file_priv, &e->base, |
|---|
| 695 | 709 | &e->event.base); |
|---|
| 696 | 710 | if (ret) |
|---|
| 697 | 711 | goto free; |
|---|
| .. | .. |
|---|
| 712 | 726 | task->event->event.tv_usec = now.tv_nsec / NSEC_PER_USEC; |
|---|
| 713 | 727 | task->event->event.sequence = atomic_inc_return(&task->ipp->sequence); |
|---|
| 714 | 728 | |
|---|
| 715 | | - drm_send_event(task->dev, &task->event->base); |
|---|
| 729 | + drm_send_event(task->ipp->drm_dev, &task->event->base); |
|---|
| 716 | 730 | } |
|---|
| 717 | 731 | |
|---|
| 718 | 732 | static int exynos_drm_ipp_task_cleanup(struct exynos_drm_ipp_task *task) |
|---|
| .. | .. |
|---|
| 749 | 763 | struct exynos_drm_ipp *ipp = task->ipp; |
|---|
| 750 | 764 | unsigned long flags; |
|---|
| 751 | 765 | |
|---|
| 752 | | - DRM_DEBUG_DRIVER("ipp: %d, task %pK done: %d\n", ipp->id, task, ret); |
|---|
| 766 | + DRM_DEV_DEBUG_DRIVER(task->dev, "ipp: %d, task %pK done: %d\n", |
|---|
| 767 | + ipp->id, task, ret); |
|---|
| 753 | 768 | |
|---|
| 754 | 769 | spin_lock_irqsave(&ipp->lock, flags); |
|---|
| 755 | 770 | if (ipp->task == task) |
|---|
| .. | .. |
|---|
| 773 | 788 | unsigned long flags; |
|---|
| 774 | 789 | int ret; |
|---|
| 775 | 790 | |
|---|
| 776 | | - DRM_DEBUG_DRIVER("ipp: %d, try to run new task\n", ipp->id); |
|---|
| 791 | + DRM_DEV_DEBUG_DRIVER(ipp->dev, "ipp: %d, try to run new task\n", |
|---|
| 792 | + ipp->id); |
|---|
| 777 | 793 | |
|---|
| 778 | 794 | spin_lock_irqsave(&ipp->lock, flags); |
|---|
| 779 | 795 | |
|---|
| .. | .. |
|---|
| 789 | 805 | |
|---|
| 790 | 806 | spin_unlock_irqrestore(&ipp->lock, flags); |
|---|
| 791 | 807 | |
|---|
| 792 | | - DRM_DEBUG_DRIVER("ipp: %d, selected task %pK to run\n", ipp->id, task); |
|---|
| 808 | + DRM_DEV_DEBUG_DRIVER(ipp->dev, |
|---|
| 809 | + "ipp: %d, selected task %pK to run\n", ipp->id, |
|---|
| 810 | + task); |
|---|
| 793 | 811 | |
|---|
| 794 | 812 | ret = ipp->funcs->commit(ipp, task); |
|---|
| 795 | 813 | if (ret) |
|---|
| .. | .. |
|---|
| 897 | 915 | * then freed after exynos_drm_ipp_task_done() |
|---|
| 898 | 916 | */ |
|---|
| 899 | 917 | if (arg->flags & DRM_EXYNOS_IPP_FLAG_NONBLOCK) { |
|---|
| 900 | | - DRM_DEBUG_DRIVER("ipp: %d, nonblocking processing task %pK\n", |
|---|
| 901 | | - ipp->id, task); |
|---|
| 918 | + DRM_DEV_DEBUG_DRIVER(ipp->dev, |
|---|
| 919 | + "ipp: %d, nonblocking processing task %pK\n", |
|---|
| 920 | + ipp->id, task); |
|---|
| 902 | 921 | |
|---|
| 903 | 922 | task->flags |= DRM_EXYNOS_IPP_TASK_ASYNC; |
|---|
| 904 | 923 | exynos_drm_ipp_schedule_task(task->ipp, task); |
|---|
| 905 | 924 | ret = 0; |
|---|
| 906 | 925 | } else { |
|---|
| 907 | | - DRM_DEBUG_DRIVER("ipp: %d, processing task %pK\n", ipp->id, |
|---|
| 908 | | - task); |
|---|
| 926 | + DRM_DEV_DEBUG_DRIVER(ipp->dev, "ipp: %d, processing task %pK\n", |
|---|
| 927 | + ipp->id, task); |
|---|
| 909 | 928 | exynos_drm_ipp_schedule_task(ipp, task); |
|---|
| 910 | 929 | ret = wait_event_interruptible(ipp->done_wq, |
|---|
| 911 | 930 | task->flags & DRM_EXYNOS_IPP_TASK_DONE); |
|---|