1d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian/* 2d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian * Copyright (C) 2011 The Android Open Source Project 3d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian * 4d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian * Licensed under the Apache License, Version 2.0 (the "License"); 5d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian * you may not use this file except in compliance with the License. 6d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian * You may obtain a copy of the License at 7d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian * 8d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian * http://www.apache.org/licenses/LICENSE-2.0 9d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian * 10d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian * Unless required by applicable law or agreed to in writing, software 11d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian * distributed under the License is distributed on an "AS IS" BASIS, 12d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian * See the License for the specific language governing permissions and 14d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian * limitations under the License. 15d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian */ 16d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian 17d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian#include <stdint.h> 18d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian#include <sys/types.h> 19d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian 20d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian#include <fcntl.h> 21d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian#include <sys/ioctl.h> 22d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian#include <linux/fb.h> 23d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian#include <errno.h> 24d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian#include <string.h> 25d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian#include <stdio.h> 26d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian 27d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian#ifndef FBIO_WAITFORVSYNC 28d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian#define FBIO_WAITFORVSYNC _IOW('F', 0x20, __u32) 29d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian#endif 30d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian 31d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopianint main(int argc, char** argv) { 32d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian int fd = open("/dev/graphics/fb0", O_RDWR); 33d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian if (fd >= 0) { 34d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian do { 35d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian uint32_t crt = 0; 36d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian int err = ioctl(fd, FBIO_WAITFORVSYNC, &crt); 37d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian if (err < 0) { 38d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian printf("FBIO_WAITFORVSYNC error: %s\n", strerror(errno)); 39d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian break; 40d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian } 41d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian } while(1); 42d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian close(fd); 43d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian } 44d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian return 0; 45d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian} 46