Skip to content

Commit

Permalink
lima-memtester: Actively prevent screen from blanking
Browse files Browse the repository at this point in the history
The commit 6d7fac1 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 <[email protected]>
  • Loading branch information
ssvb committed Sep 15, 2014
1 parent 5a6fb91 commit 4017b5a
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions lima-memtester.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,35 @@
*/

#include <pthread.h>
#include <assert.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <linux/fb.h>
#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();
Expand All @@ -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);
Expand Down

0 comments on commit 4017b5a

Please sign in to comment.