diff options
author | Tomi Valkeinen | 2016-12-20 03:12:39 -0600 |
---|---|---|
committer | Tomi Valkeinen | 2016-12-20 03:12:39 -0600 |
commit | 5da322dbf9573cd7ce9506541861f509eaea1bc7 (patch) | |
tree | 0b2bbfe227bc6a48c3ec100d013a13301a3e6ce2 /utils | |
parent | 6350d1b6e4bdecdee82601731a52323ec047b394 (diff) | |
download | external-libkmsxx-5da322dbf9573cd7ce9506541861f509eaea1bc7.tar.gz external-libkmsxx-5da322dbf9573cd7ce9506541861f509eaea1bc7.tar.xz external-libkmsxx-5da322dbf9573cd7ce9506541861f509eaea1bc7.zip |
kmstest: disable crtcs & planes before modeset
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'utils')
-rw-r--r-- | utils/kmstest.cpp | 59 |
1 files changed, 52 insertions, 7 deletions
diff --git a/utils/kmstest.cpp b/utils/kmstest.cpp index f12ed09..e949368 100644 --- a/utils/kmstest.cpp +++ b/utils/kmstest.cpp | |||
@@ -649,6 +649,14 @@ static void draw_test_patterns(const vector<OutputInfo>& outputs) | |||
649 | 649 | ||
650 | static void set_crtcs_n_planes_legacy(Card& card, const vector<OutputInfo>& outputs) | 650 | static void set_crtcs_n_planes_legacy(Card& card, const vector<OutputInfo>& outputs) |
651 | { | 651 | { |
652 | // Disable unused crtcs | ||
653 | for (Crtc* crtc : card.get_crtcs()) { | ||
654 | if (find_if(outputs.begin(), outputs.end(), [crtc](const OutputInfo& o) { return o.crtc == crtc; }) != outputs.end()) | ||
655 | continue; | ||
656 | |||
657 | crtc->disable_mode(); | ||
658 | } | ||
659 | |||
652 | for (const OutputInfo& o : outputs) { | 660 | for (const OutputInfo& o : outputs) { |
653 | auto conn = o.connector; | 661 | auto conn = o.connector; |
654 | auto crtc = o.crtc; | 662 | auto crtc = o.crtc; |
@@ -673,8 +681,42 @@ static void set_crtcs_n_planes_legacy(Card& card, const vector<OutputInfo>& outp | |||
673 | } | 681 | } |
674 | } | 682 | } |
675 | 683 | ||
676 | static void set_crtcs_n_planes(Card& card, const vector<OutputInfo>& outputs) | 684 | static void set_crtcs_n_planes_atomic(Card& card, const vector<OutputInfo>& outputs) |
677 | { | 685 | { |
686 | int r; | ||
687 | |||
688 | // XXX DRM framework doesn't allow moving an active plane from one crtc to another. | ||
689 | // See drm_atomic.c::plane_switching_crtc(). | ||
690 | // For the time being, disable all crtcs and planes here. | ||
691 | |||
692 | AtomicReq disable_req(card); | ||
693 | |||
694 | // Disable unused crtcs | ||
695 | for (Crtc* crtc : card.get_crtcs()) { | ||
696 | //if (find_if(outputs.begin(), outputs.end(), [crtc](const OutputInfo& o) { return o.crtc == crtc; }) != outputs.end()) | ||
697 | // continue; | ||
698 | |||
699 | disable_req.add(crtc, { | ||
700 | { "ACTIVE", 0 }, | ||
701 | }); | ||
702 | } | ||
703 | |||
704 | // Disable unused planes | ||
705 | for (Plane* plane : card.get_planes()) { | ||
706 | //if (find_if(outputs.begin(), outputs.end(), [plane](const OutputInfo& o) { return o.primary_plane == plane; }) != outputs.end()) | ||
707 | // continue; | ||
708 | |||
709 | disable_req.add(plane, { | ||
710 | { "FB_ID", 0 }, | ||
711 | { "CRTC_ID", 0 }, | ||
712 | }); | ||
713 | } | ||
714 | |||
715 | r = disable_req.commit_sync(true); | ||
716 | if (r) | ||
717 | EXIT("Atomic commit failed when disabling: %d\n", r); | ||
718 | |||
719 | |||
678 | // Keep blobs here so that we keep ref to them until we have committed the req | 720 | // Keep blobs here so that we keep ref to them until we have committed the req |
679 | vector<unique_ptr<Blob>> blobs; | 721 | vector<unique_ptr<Blob>> blobs; |
680 | 722 | ||
@@ -731,8 +773,6 @@ static void set_crtcs_n_planes(Card& card, const vector<OutputInfo>& outputs) | |||
731 | } | 773 | } |
732 | } | 774 | } |
733 | 775 | ||
734 | int r; | ||
735 | |||
736 | r = req.test(true); | 776 | r = req.test(true); |
737 | if (r) | 777 | if (r) |
738 | EXIT("Atomic test failed: %d\n", r); | 778 | EXIT("Atomic test failed: %d\n", r); |
@@ -742,6 +782,14 @@ static void set_crtcs_n_planes(Card& card, const vector<OutputInfo>& outputs) | |||
742 | EXIT("Atomic commit failed: %d\n", r); | 782 | EXIT("Atomic commit failed: %d\n", r); |
743 | } | 783 | } |
744 | 784 | ||
785 | static void set_crtcs_n_planes(Card& card, const vector<OutputInfo>& outputs) | ||
786 | { | ||
787 | if (card.has_atomic()) | ||
788 | set_crtcs_n_planes_atomic(card, outputs); | ||
789 | else | ||
790 | set_crtcs_n_planes_legacy(card, outputs); | ||
791 | } | ||
792 | |||
745 | class FlipState : private PageFlipHandlerBase | 793 | class FlipState : private PageFlipHandlerBase |
746 | { | 794 | { |
747 | public: | 795 | public: |
@@ -955,10 +1003,7 @@ int main(int argc, char **argv) | |||
955 | 1003 | ||
956 | print_outputs(outputs); | 1004 | print_outputs(outputs); |
957 | 1005 | ||
958 | if (card.has_atomic()) | 1006 | set_crtcs_n_planes(card, outputs); |
959 | set_crtcs_n_planes(card, outputs); | ||
960 | else | ||
961 | set_crtcs_n_planes_legacy(card, outputs); | ||
962 | 1007 | ||
963 | printf("press enter to exit\n"); | 1008 | printf("press enter to exit\n"); |
964 | 1009 | ||