summaryrefslogtreecommitdiff
path: root/tests/kmsview.cpp
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2016-05-23 09:54:08 +0300
committerTomi Valkeinen <tomi.valkeinen@ti.com>2016-05-23 09:54:08 +0300
commita5c28bcb2ead34e921617711ebf94ffcb5d72878 (patch)
treee2f93259f63407357c70b06a7d59c24fde5a3901 /tests/kmsview.cpp
parent0bc5bbd6766949d651f98e12981d79c86ce0bf99 (diff)
File/dir renames
Diffstat (limited to 'tests/kmsview.cpp')
-rw-r--r--tests/kmsview.cpp92
1 files changed, 0 insertions, 92 deletions
diff --git a/tests/kmsview.cpp b/tests/kmsview.cpp
deleted file mode 100644
index aae7e80..0000000
--- a/tests/kmsview.cpp
+++ /dev/null
@@ -1,92 +0,0 @@
-#include <cstdio>
-#include <fstream>
-#include <unistd.h>
-
-#include "kms++.h"
-
-#include "test.h"
-
-using namespace std;
-using namespace kms;
-
-static void read_frame(ifstream& is, DumbFramebuffer* fb, Crtc* crtc, Plane* plane)
-{
- for (unsigned i = 0; i < fb->num_planes(); ++i)
- is.read((char*)fb->map(i), fb->size(i));
-
- unsigned w = min(crtc->width(), fb->width());
- unsigned h = min(crtc->height(), fb->height());
-
- int r = crtc->set_plane(plane, *fb,
- 0, 0, w, h,
- 0, 0, fb->width(), fb->height());
-
- ASSERT(r == 0);
-}
-
-int main(int argc, char** argv)
-{
- if (argc != 5) {
- printf("Usage: %s <file> <width> <height> <fourcc>\n", argv[0]);
- return -1;
- }
-
- string filename = argv[1];
- uint32_t w = stoi(argv[2]);
- uint32_t h = stoi(argv[3]);
- string modestr = argv[4];
-
- auto pixfmt = FourCCToPixelFormat(modestr);
-
-
- ifstream is(filename, ifstream::binary);
-
- is.seekg(0, std::ios::end);
- unsigned fsize = is.tellg();
- is.seekg(0);
-
-
- Card card;
-
- auto conn = card.get_first_connected_connector();
- auto crtc = conn->get_current_crtc();
-
- auto fb = new DumbFramebuffer(card, w, h, pixfmt);
-
- Plane* plane = 0;
-
- for (Plane* p : crtc->get_possible_planes()) {
- if (p->plane_type() != PlaneType::Overlay)
- continue;
-
- if (!p->supports_format(pixfmt))
- continue;
-
- plane = p;
- break;
- }
-
- FAIL_IF(!plane, "available plane not found");
-
-
- unsigned frame_size = 0;
- for (unsigned i = 0; i < fb->num_planes(); ++i)
- frame_size += fb->size(i);
-
- unsigned num_frames = fsize / frame_size;
- printf("file size %u, frame size %u, frames %u\n", fsize, frame_size, num_frames);
-
- for (unsigned i = 0; i < num_frames; ++i) {
- printf("frame %d\n", i);
- read_frame(is, fb, crtc, plane);
- usleep(1000*50);
- }
-
- printf("press enter to exit\n");
-
- is.close();
-
- getchar();
-
- delete fb;
-}