diff options
author | Christian König <christian.koenig@amd.com> | 2016-07-05 10:47:54 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2016-07-29 14:37:03 -0400 |
commit | 8de190c9f44204810440e26ac09913a1fa40aa36 (patch) | |
tree | 5a72066fce7e5cdbeff34ea31a54bb02fda44e92 | |
parent | ebff485e9314f8c53f6b22eba0dfbec7228ab268 (diff) |
drm/amdgpu: move UVD IB test into common code v2
Since we now raise the clocks from begin_use() we don't need
a separate function for each hw generation any more.
v2: remove unintentional lowering of the UVD clocks, fix typos for CIK hw.
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 35 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.h | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c | 45 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c | 45 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | 39 |
5 files changed, 40 insertions, 125 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c index bfb3c274d7f0..ef5342bd6968 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | |||
@@ -1127,3 +1127,38 @@ void amdgpu_uvd_ring_end_use(struct amdgpu_ring *ring) | |||
1127 | { | 1127 | { |
1128 | schedule_delayed_work(&ring->adev->uvd.idle_work, UVD_IDLE_TIMEOUT); | 1128 | schedule_delayed_work(&ring->adev->uvd.idle_work, UVD_IDLE_TIMEOUT); |
1129 | } | 1129 | } |
1130 | |||
1131 | /** | ||
1132 | * amdgpu_uvd_ring_test_ib - test ib execution | ||
1133 | * | ||
1134 | * @ring: amdgpu_ring pointer | ||
1135 | * | ||
1136 | * Test if we can successfully execute an IB | ||
1137 | */ | ||
1138 | int amdgpu_uvd_ring_test_ib(struct amdgpu_ring *ring) | ||
1139 | { | ||
1140 | struct fence *fence = NULL; | ||
1141 | int r; | ||
1142 | |||
1143 | r = amdgpu_uvd_get_create_msg(ring, 1, NULL); | ||
1144 | if (r) { | ||
1145 | DRM_ERROR("amdgpu: failed to get create msg (%d).\n", r); | ||
1146 | goto error; | ||
1147 | } | ||
1148 | |||
1149 | r = amdgpu_uvd_get_destroy_msg(ring, 1, true, &fence); | ||
1150 | if (r) { | ||
1151 | DRM_ERROR("amdgpu: failed to get destroy ib (%d).\n", r); | ||
1152 | goto error; | ||
1153 | } | ||
1154 | |||
1155 | r = fence_wait(fence, false); | ||
1156 | if (r) { | ||
1157 | DRM_ERROR("amdgpu: fence wait failed (%d).\n", r); | ||
1158 | goto error; | ||
1159 | } | ||
1160 | DRM_INFO("ib test on ring %d succeeded\n", ring->idx); | ||
1161 | error: | ||
1162 | fence_put(fence); | ||
1163 | return r; | ||
1164 | } | ||
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.h index 5bad3712a56e..224359e4d0b4 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.h | |||
@@ -37,5 +37,6 @@ void amdgpu_uvd_free_handles(struct amdgpu_device *adev, | |||
37 | int amdgpu_uvd_ring_parse_cs(struct amdgpu_cs_parser *parser, uint32_t ib_idx); | 37 | int amdgpu_uvd_ring_parse_cs(struct amdgpu_cs_parser *parser, uint32_t ib_idx); |
38 | void amdgpu_uvd_ring_begin_use(struct amdgpu_ring *ring); | 38 | void amdgpu_uvd_ring_begin_use(struct amdgpu_ring *ring); |
39 | void amdgpu_uvd_ring_end_use(struct amdgpu_ring *ring); | 39 | void amdgpu_uvd_ring_end_use(struct amdgpu_ring *ring); |
40 | int amdgpu_uvd_ring_test_ib(struct amdgpu_ring *ring); | ||
40 | 41 | ||
41 | #endif | 42 | #endif |
diff --git a/drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c b/drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c index 862d6cf89c1a..132e613ed674 100644 --- a/drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +++ b/drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c | |||
@@ -527,49 +527,6 @@ static void uvd_v4_2_ring_emit_ib(struct amdgpu_ring *ring, | |||
527 | } | 527 | } |
528 | 528 | ||
529 | /** | 529 | /** |
530 | * uvd_v4_2_ring_test_ib - test ib execution | ||
531 | * | ||
532 | * @ring: amdgpu_ring pointer | ||
533 | * | ||
534 | * Test if we can successfully execute an IB | ||
535 | */ | ||
536 | static int uvd_v4_2_ring_test_ib(struct amdgpu_ring *ring) | ||
537 | { | ||
538 | struct amdgpu_device *adev = ring->adev; | ||
539 | struct fence *fence = NULL; | ||
540 | int r; | ||
541 | |||
542 | r = amdgpu_asic_set_uvd_clocks(adev, 53300, 40000); | ||
543 | if (r) { | ||
544 | DRM_ERROR("amdgpu: failed to raise UVD clocks (%d).\n", r); | ||
545 | return r; | ||
546 | } | ||
547 | |||
548 | r = amdgpu_uvd_get_create_msg(ring, 1, NULL); | ||
549 | if (r) { | ||
550 | DRM_ERROR("amdgpu: failed to get create msg (%d).\n", r); | ||
551 | goto error; | ||
552 | } | ||
553 | |||
554 | r = amdgpu_uvd_get_destroy_msg(ring, 1, true, &fence); | ||
555 | if (r) { | ||
556 | DRM_ERROR("amdgpu: failed to get destroy ib (%d).\n", r); | ||
557 | goto error; | ||
558 | } | ||
559 | |||
560 | r = fence_wait(fence, false); | ||
561 | if (r) { | ||
562 | DRM_ERROR("amdgpu: fence wait failed (%d).\n", r); | ||
563 | goto error; | ||
564 | } | ||
565 | DRM_INFO("ib test on ring %d succeeded\n", ring->idx); | ||
566 | error: | ||
567 | fence_put(fence); | ||
568 | amdgpu_asic_set_uvd_clocks(adev, 0, 0); | ||
569 | return r; | ||
570 | } | ||
571 | |||
572 | /** | ||
573 | * uvd_v4_2_mc_resume - memory controller programming | 530 | * uvd_v4_2_mc_resume - memory controller programming |
574 | * | 531 | * |
575 | * @adev: amdgpu_device pointer | 532 | * @adev: amdgpu_device pointer |
@@ -794,7 +751,7 @@ static const struct amdgpu_ring_funcs uvd_v4_2_ring_funcs = { | |||
794 | .emit_hdp_flush = uvd_v4_2_ring_emit_hdp_flush, | 751 | .emit_hdp_flush = uvd_v4_2_ring_emit_hdp_flush, |
795 | .emit_hdp_invalidate = uvd_v4_2_ring_emit_hdp_invalidate, | 752 | .emit_hdp_invalidate = uvd_v4_2_ring_emit_hdp_invalidate, |
796 | .test_ring = uvd_v4_2_ring_test_ring, | 753 | .test_ring = uvd_v4_2_ring_test_ring, |
797 | .test_ib = uvd_v4_2_ring_test_ib, | 754 | .test_ib = amdgpu_uvd_ring_test_ib, |
798 | .insert_nop = amdgpu_ring_insert_nop, | 755 | .insert_nop = amdgpu_ring_insert_nop, |
799 | .pad_ib = amdgpu_ring_generic_pad_ib, | 756 | .pad_ib = amdgpu_ring_generic_pad_ib, |
800 | .begin_use = amdgpu_uvd_ring_begin_use, | 757 | .begin_use = amdgpu_uvd_ring_begin_use, |
diff --git a/drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c b/drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c index f585247a356f..101de136ba63 100644 --- a/drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c +++ b/drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c | |||
@@ -577,49 +577,6 @@ static void uvd_v5_0_ring_emit_ib(struct amdgpu_ring *ring, | |||
577 | amdgpu_ring_write(ring, ib->length_dw); | 577 | amdgpu_ring_write(ring, ib->length_dw); |
578 | } | 578 | } |
579 | 579 | ||
580 | /** | ||
581 | * uvd_v5_0_ring_test_ib - test ib execution | ||
582 | * | ||
583 | * @ring: amdgpu_ring pointer | ||
584 | * | ||
585 | * Test if we can successfully execute an IB | ||
586 | */ | ||
587 | static int uvd_v5_0_ring_test_ib(struct amdgpu_ring *ring) | ||
588 | { | ||
589 | struct amdgpu_device *adev = ring->adev; | ||
590 | struct fence *fence = NULL; | ||
591 | int r; | ||
592 | |||
593 | r = amdgpu_asic_set_uvd_clocks(adev, 53300, 40000); | ||
594 | if (r) { | ||
595 | DRM_ERROR("amdgpu: failed to raise UVD clocks (%d).\n", r); | ||
596 | return r; | ||
597 | } | ||
598 | |||
599 | r = amdgpu_uvd_get_create_msg(ring, 1, NULL); | ||
600 | if (r) { | ||
601 | DRM_ERROR("amdgpu: failed to get create msg (%d).\n", r); | ||
602 | goto error; | ||
603 | } | ||
604 | |||
605 | r = amdgpu_uvd_get_destroy_msg(ring, 1, true, &fence); | ||
606 | if (r) { | ||
607 | DRM_ERROR("amdgpu: failed to get destroy ib (%d).\n", r); | ||
608 | goto error; | ||
609 | } | ||
610 | |||
611 | r = fence_wait(fence, false); | ||
612 | if (r) { | ||
613 | DRM_ERROR("amdgpu: fence wait failed (%d).\n", r); | ||
614 | goto error; | ||
615 | } | ||
616 | DRM_INFO("ib test on ring %d succeeded\n", ring->idx); | ||
617 | error: | ||
618 | fence_put(fence); | ||
619 | amdgpu_asic_set_uvd_clocks(adev, 0, 0); | ||
620 | return r; | ||
621 | } | ||
622 | |||
623 | static bool uvd_v5_0_is_idle(void *handle) | 580 | static bool uvd_v5_0_is_idle(void *handle) |
624 | { | 581 | { |
625 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; | 582 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; |
@@ -845,7 +802,7 @@ static const struct amdgpu_ring_funcs uvd_v5_0_ring_funcs = { | |||
845 | .emit_hdp_flush = uvd_v5_0_ring_emit_hdp_flush, | 802 | .emit_hdp_flush = uvd_v5_0_ring_emit_hdp_flush, |
846 | .emit_hdp_invalidate = uvd_v5_0_ring_emit_hdp_invalidate, | 803 | .emit_hdp_invalidate = uvd_v5_0_ring_emit_hdp_invalidate, |
847 | .test_ring = uvd_v5_0_ring_test_ring, | 804 | .test_ring = uvd_v5_0_ring_test_ring, |
848 | .test_ib = uvd_v5_0_ring_test_ib, | 805 | .test_ib = amdgpu_uvd_ring_test_ib, |
849 | .insert_nop = amdgpu_ring_insert_nop, | 806 | .insert_nop = amdgpu_ring_insert_nop, |
850 | .pad_ib = amdgpu_ring_generic_pad_ib, | 807 | .pad_ib = amdgpu_ring_generic_pad_ib, |
851 | .begin_use = amdgpu_uvd_ring_begin_use, | 808 | .begin_use = amdgpu_uvd_ring_begin_use, |
diff --git a/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c b/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c index 8e985de62780..1791566aae9d 100644 --- a/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +++ b/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | |||
@@ -684,41 +684,6 @@ static void uvd_v6_0_ring_emit_ib(struct amdgpu_ring *ring, | |||
684 | amdgpu_ring_write(ring, ib->length_dw); | 684 | amdgpu_ring_write(ring, ib->length_dw); |
685 | } | 685 | } |
686 | 686 | ||
687 | /** | ||
688 | * uvd_v6_0_ring_test_ib - test ib execution | ||
689 | * | ||
690 | * @ring: amdgpu_ring pointer | ||
691 | * | ||
692 | * Test if we can successfully execute an IB | ||
693 | */ | ||
694 | static int uvd_v6_0_ring_test_ib(struct amdgpu_ring *ring) | ||
695 | { | ||
696 | struct fence *fence = NULL; | ||
697 | int r; | ||
698 | |||
699 | r = amdgpu_uvd_get_create_msg(ring, 1, NULL); | ||
700 | if (r) { | ||
701 | DRM_ERROR("amdgpu: failed to get create msg (%d).\n", r); | ||
702 | goto error; | ||
703 | } | ||
704 | |||
705 | r = amdgpu_uvd_get_destroy_msg(ring, 1, true, &fence); | ||
706 | if (r) { | ||
707 | DRM_ERROR("amdgpu: failed to get destroy ib (%d).\n", r); | ||
708 | goto error; | ||
709 | } | ||
710 | |||
711 | r = fence_wait(fence, false); | ||
712 | if (r) { | ||
713 | DRM_ERROR("amdgpu: fence wait failed (%d).\n", r); | ||
714 | goto error; | ||
715 | } | ||
716 | DRM_INFO("ib test on ring %d succeeded\n", ring->idx); | ||
717 | error: | ||
718 | fence_put(fence); | ||
719 | return r; | ||
720 | } | ||
721 | |||
722 | static void uvd_v6_0_ring_emit_vm_flush(struct amdgpu_ring *ring, | 687 | static void uvd_v6_0_ring_emit_vm_flush(struct amdgpu_ring *ring, |
723 | unsigned vm_id, uint64_t pd_addr) | 688 | unsigned vm_id, uint64_t pd_addr) |
724 | { | 689 | { |
@@ -1016,7 +981,7 @@ static const struct amdgpu_ring_funcs uvd_v6_0_ring_phys_funcs = { | |||
1016 | .emit_hdp_flush = uvd_v6_0_ring_emit_hdp_flush, | 981 | .emit_hdp_flush = uvd_v6_0_ring_emit_hdp_flush, |
1017 | .emit_hdp_invalidate = uvd_v6_0_ring_emit_hdp_invalidate, | 982 | .emit_hdp_invalidate = uvd_v6_0_ring_emit_hdp_invalidate, |
1018 | .test_ring = uvd_v6_0_ring_test_ring, | 983 | .test_ring = uvd_v6_0_ring_test_ring, |
1019 | .test_ib = uvd_v6_0_ring_test_ib, | 984 | .test_ib = amdgpu_uvd_ring_test_ib, |
1020 | .insert_nop = amdgpu_ring_insert_nop, | 985 | .insert_nop = amdgpu_ring_insert_nop, |
1021 | .pad_ib = amdgpu_ring_generic_pad_ib, | 986 | .pad_ib = amdgpu_ring_generic_pad_ib, |
1022 | .begin_use = amdgpu_uvd_ring_begin_use, | 987 | .begin_use = amdgpu_uvd_ring_begin_use, |
@@ -1035,7 +1000,7 @@ static const struct amdgpu_ring_funcs uvd_v6_0_ring_vm_funcs = { | |||
1035 | .emit_hdp_flush = uvd_v6_0_ring_emit_hdp_flush, | 1000 | .emit_hdp_flush = uvd_v6_0_ring_emit_hdp_flush, |
1036 | .emit_hdp_invalidate = uvd_v6_0_ring_emit_hdp_invalidate, | 1001 | .emit_hdp_invalidate = uvd_v6_0_ring_emit_hdp_invalidate, |
1037 | .test_ring = uvd_v6_0_ring_test_ring, | 1002 | .test_ring = uvd_v6_0_ring_test_ring, |
1038 | .test_ib = uvd_v6_0_ring_test_ib, | 1003 | .test_ib = amdgpu_uvd_ring_test_ib, |
1039 | .insert_nop = amdgpu_ring_insert_nop, | 1004 | .insert_nop = amdgpu_ring_insert_nop, |
1040 | .pad_ib = amdgpu_ring_generic_pad_ib, | 1005 | .pad_ib = amdgpu_ring_generic_pad_ib, |
1041 | .begin_use = amdgpu_uvd_ring_begin_use, | 1006 | .begin_use = amdgpu_uvd_ring_begin_use, |