summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@iki.fi>2015-09-28 17:59:52 +0300
committerTomi Valkeinen <tomi.valkeinen@iki.fi>2015-09-28 23:30:55 +0300
commit0bdc88a432d0b9581606e86e53d686b91def4002 (patch)
treec01c2fa346a648a6e6a73c100801effc2201baa5 /tests
parent205533cbeab897eec2a37411f0c9674ada9ee596 (diff)
Add Card::get_connected_pipelines()
Diffstat (limited to 'tests')
-rw-r--r--tests/db.cpp23
-rw-r--r--tests/testpat.cpp36
2 files changed, 15 insertions, 44 deletions
diff --git a/tests/db.cpp b/tests/db.cpp
index 576896e..5df104d 100644
--- a/tests/db.cpp
+++ b/tests/db.cpp
@@ -84,8 +84,6 @@ public:
}
}
- Crtc* crtc() const { return m_crtc; }
-
private:
Connector* m_connector;
Crtc* m_crtc;
@@ -106,28 +104,13 @@ int main()
vector<OutputFlipHandler*> outputs;
- for (auto conn : card.get_connectors())
+ for (auto pipe : card.get_connected_pipelines())
{
- if (conn->connected() == false)
- continue;
+ auto conn = pipe.connector;
+ auto crtc = pipe.crtc;
auto mode = conn->get_default_mode();
- Crtc* crtc = conn->get_current_crtc();
- if (!crtc) {
- for (auto c : conn->get_possible_crtcs()) {
- if (find_if(outputs.begin(), outputs.end(), [c](OutputFlipHandler* o) { return o->crtc() == c; }) == outputs.end()) {
- crtc = c;
- break;
- }
- }
- }
-
- if (!crtc) {
- printf("failed to find crtc\n");
- return -1;
- }
-
auto fb1 = new Framebuffer(card, mode.hdisplay, mode.vdisplay, "XR24");
auto fb2 = new Framebuffer(card, mode.hdisplay, mode.vdisplay, "XR24");
diff --git a/tests/testpat.cpp b/tests/testpat.cpp
index 27c1bc3..9980407 100644
--- a/tests/testpat.cpp
+++ b/tests/testpat.cpp
@@ -18,31 +18,14 @@ 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
@@ -52,10 +35,15 @@ int main()
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;
@@ -71,7 +59,7 @@ int main()
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());