db: use PageFlipHandler
[android/external-libkmsxx.git] / tests / testpat.cpp
index 27c1bc35c5277fcdd60fc461a6d32bbfba3e9f58..02f195ac1243598b3f2de355f71fe4a3add7208d 100644 (file)
@@ -2,7 +2,6 @@
 #include <algorithm>
 
 #include "kms++.h"
-#include "utils/testpat.h"
 
 #include "test.h"
 
@@ -18,44 +17,32 @@ int main()
 
        //card.print_short();
 
-       auto connectors = card.get_connectors();
+       auto pipes = card.get_connected_pipelines();
 
        vector<Framebuffer*> fbs;
-       vector<Crtc*> used_crtcs;
 
-       for (auto conn : connectors)
+       for (auto pipe : pipes)
        {
-               if (conn->connected() == false)
-                       continue;
-
-               Crtc* crtc = conn->get_current_crtc();
-               if (!crtc) {
-                       vector<Crtc*> list = conn->get_possible_crtcs();
-                       for (auto c : list) {
-                               if (find(used_crtcs.begin(), used_crtcs.end(), c) == used_crtcs.end()) {
-                                       crtc = c;
-                                       break;
-                               }
-                       }
-               }
-               used_crtcs.push_back(crtc);
-
-               ASSERT(crtc);
-
-               int r;
+               auto conn = pipe.connector;
+               auto crtc = pipe.crtc;
 
                // RG16 XR24 UYVY YUYV NV12
 
                auto mode = conn->get_default_mode();
 
-               auto fb = new Framebuffer(card, mode.hdisplay, mode.vdisplay, "XR24");
+               auto fb = new DumbFramebuffer(card, mode.hdisplay, mode.vdisplay, "XR24");
                draw_test_pattern(*fb);
                fbs.push_back(fb);
 
-               r = crtc->set_mode(conn, *fb, mode);
-               ASSERT(r == 0);
+               printf("conn %u, crtc %u, fb %u\n", conn->id(), crtc->id(), fb->id());
 
+               int r = crtc->set_mode(conn, *fb, mode);
+               ASSERT(r == 0);
+       }
 
+       for (auto pipe: pipes)
+       {
+               auto crtc = pipe.crtc;
 
                Plane* plane = 0;
 
@@ -67,11 +54,11 @@ int main()
                }
 
                if (plane) {
-                       auto planefb = new Framebuffer(card, 400, 400, "YUYV");
+                       auto planefb = new DumbFramebuffer(card, 400, 400, "YUYV");
                        draw_test_pattern(*planefb);
                        fbs.push_back(planefb);
 
-                       r = crtc->set_plane(plane, *planefb,
+                       int r = crtc->set_plane(plane, *planefb,
                                            0, 0, planefb->width(), planefb->height(),
                                            0, 0, planefb->width(), planefb->height());