~nch/phwip

4f02b2e4811644f484ff57a9b284126e5491e3d0 — nc 4 years ago d506ff5
rename
2 files changed, 21 insertions(+), 3 deletions(-)

M makefile
R fwip.c => phwip.c
M makefile => makefile +2 -2
@@ 1,2 1,2 @@
fwip: fwip.c
	gcc -g -o fwip fwip.c -ldrm -lgbm -lEGL -lGLESv2 -I/usr/include/libdrm
phwip: phwip.c
	gcc -o phwip phwip.c -ldrm -lgbm -lEGL -lGLESv2 -I/usr/include/libdrm

R fwip.c => phwip.c +19 -1
@@ 17,6 17,8 @@

#include <pthread.h>

#include <time.h>

#define EXIT(msg) { fputs (msg, stderr); exit (EXIT_FAILURE); }

static int device;


@@ 134,6 136,12 @@ void *handle_touch(void *path) {
	return NULL;
}

long get_ms() {
	struct timespec spec;
	clock_gettime(CLOCK_REALTIME, &spec);
	return ((long) spec.tv_sec * 1000) + spec.tv_nsec / 1.0e6;
}

int main () {
	pthread_t touch_thread;
	if(pthread_create(&touch_thread, NULL, handle_touch, "/dev/input/event1")) EXIT("Failed to create thread");


@@ 190,8 198,18 @@ int main () {
	printf("GL_RENDERER : %s\n", glGetString(GL_RENDERER) );

	int i;
	for (i = 0; i < 600; i++)
	int frames = 0;
	long begin = get_ms();

	for (i = 0; i < 600; i++) {
		draw (i / 600.0f);
		frames++;
		if(frames == 120) {
			printf("%f\n", ((float) frames) / ((float) (get_ms() - begin) / 1000));
			frames = 0;
			begin = get_ms();
		}
	}

	{ // cleanup
		// set the previous crtc