From 4017b5ab8140ec7e1eaded9ef39d68ecb1319150 Mon Sep 17 00:00:00 2001 From: Siarhei Siamashka Date: Tue, 16 Sep 2014 00:41:41 +0300 Subject: [PATCH] lima-memtester: Actively prevent screen from blanking The commit 6d7fac197dfa4caaa45ea5fc7009dc40e8fde187 removed screen blanking prevention from the lima driver. This was needed for the lima-memspeed program (sometimes we want to keep the screen blanked for memory bandwidth measurements). Now we introduce screen blanking prevention in lima-memtester back, because it is needed for the visual feedback (glowing red background when the errors are found). The visual feedback is needed for the users, who can't see the log messages on the console. Signed-off-by: Siarhei Siamashka --- lima-memtester.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/lima-memtester.c b/lima-memtester.c index 8b2da5b..8d33c39 100644 --- a/lima-memtester.c +++ b/lima-memtester.c @@ -22,15 +22,35 @@ */ #include +#include #include #include #include #include +#include +#include #include "load_mali_kernel_module.h" int textured_cube_main(void); int memtester_main(int argc, char *argv[]); +void *fb_unblank_thread(void *data) +{ + int fd, ret; + + fd = open("/dev/fb0", O_RDWR); + assert(fd != -1); + + while (1) { + ret = ioctl(fd, FBIOBLANK, FB_BLANK_UNBLANK); + assert(!ret); + sleep(1); + } + + close(fd); + return 0; +} + static void *lima_thread(void *threadid) { textured_cube_main(); @@ -41,10 +61,11 @@ static void *lima_thread(void *threadid) static void start_lima_thread(void) { - pthread_t th; + pthread_t th1, th2; load_mali_kernel_module(); - pthread_create(&th, NULL, lima_thread, NULL); + pthread_create(&th1, NULL, lima_thread, NULL); + pthread_create(&th2, NULL, fb_unblank_thread, NULL); /* Wait a bit and let lima stop spamming to the console */ usleep(300000);