summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2016-03-09 11:55:52 +0200
committerTomi Valkeinen <tomi.valkeinen@ti.com>2016-03-11 12:45:10 +0200
commit79394ef6686cd525471c20f9bda0b8c983b63010 (patch)
tree796c63622a80d44b6df6bed072ba1c46bfb24d76
parent2e29af9f076e32a9971046acd42fde7b7eec1e68 (diff)
kmsview: scale down to fit into screen
-rw-r--r--tests/kmsview.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/tests/kmsview.cpp b/tests/kmsview.cpp
index 07dc09a..aae7e80 100644
--- a/tests/kmsview.cpp
+++ b/tests/kmsview.cpp
@@ -14,8 +14,11 @@ static void read_frame(ifstream& is, DumbFramebuffer* fb, Crtc* crtc, Plane* pla
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, fb->width(), fb->height(),
+ 0, 0, w, h,
0, 0, fb->width(), fb->height());
ASSERT(r == 0);
@@ -71,7 +74,7 @@ int main(int argc, char** argv)
frame_size += fb->size(i);
unsigned num_frames = fsize / frame_size;
- printf("file size %u, frames %u\n", fsize, num_frames);
+ 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);