summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Hourihane <alanh@tungstengraphics.com>2008-02-05 15:30:28 +0000
committerAlan Hourihane <alanh@tungstengraphics.com>2008-02-05 15:30:28 +0000
commit516c7a7b28ebf4bba797eaa718450b51aa772c6e (patch)
treefaf6d9b841358c7ebfe1d14ec09a8295cd035914
parent127cb1ff9a7bbb7af73cc418a7adc30d68c454d2 (diff)
update app to cycle through 4 fbdev's
-rw-r--r--tests/modefb/demo.c102
1 files changed, 54 insertions, 48 deletions
diff --git a/tests/modefb/demo.c b/tests/modefb/demo.c
index ef2b6585..7fa3b93f 100644
--- a/tests/modefb/demo.c
+++ b/tests/modefb/demo.c
@@ -23,57 +23,63 @@ struct fb_fix_screeninfo fix;
int main(int argc, char **argv)
{
- const char* name = "/dev/fb1";
- int i;
- int fd = open(name, O_RDWR);
+ char name[100];
+ int i,d;
+ int fd;
int drmfd = drmOpenControl(0);
- if (fd == -1) {
- printf("open %s : %s\n", name, strerror(errno));
- return 1;
- }
-
- if (drmfd < 0) {
- printf("drmOpenControl failed\n");
- return 1;
+ /* try four devices */
+ for (d = 0; d < 4; d++) {
+ snprintf(name, 100, "/dev/fb%d", d);
+ fd = open(name, O_RDWR);
+
+ if (fd == -1) {
+ printf("open %s : %s\n", name, strerror(errno));
+ return 1;
+ }
+
+ if (drmfd < 0) {
+ printf("drmOpenControl failed\n");
+ return 1;
+ }
+
+ memset(&var, 0, sizeof(struct fb_var_screeninfo));
+ memset(&fix, 0, sizeof(struct fb_fix_screeninfo));
+
+ if (ioctl(fd, FBIOGET_VSCREENINFO, &var))
+ printf("var %s\n", strerror(errno));
+ if (ioctl(fd, FBIOGET_FSCREENINFO, &fix))
+ printf("fix %s\n", strerror(errno));
+
+ setMode(&var);
+
+ if (ioctl(fd, FBIOPUT_VSCREENINFO, &var))
+ printf("var %s\n", strerror(errno));
+
+ for (i = 0; i < 1; i++) {
+ prettyColors(fd);
+ }
+ sleep(1);
+
+ printf("pan: 0, 0\n");
+ pan(fd, &var, 0, 0);
+ sleep(2);
+ printf("pan: 100, 0\n");
+ pan(fd, &var, 100, 0);
+ sleep(2);
+ printf("pan: 0, 100\n");
+ pan(fd, &var, 0, 100);
+ sleep(2);
+ printf("pan: 100, 100\n");
+ pan(fd, &var, 100, 100);
+ sleep(2);
+ printf("pan: 0, 0\n");
+ pan(fd, &var, 0, 0);
+ sleep(2);
+
+ printf("cursor (may show up on wrong CRTC - fixme)\n");
+ cursor(fd, drmfd);
}
-
- memset(&var, 0, sizeof(struct fb_var_screeninfo));
- memset(&fix, 0, sizeof(struct fb_fix_screeninfo));
-
- if (ioctl(fd, FBIOGET_VSCREENINFO, &var))
- printf("var %s\n", strerror(errno));
- if (ioctl(fd, FBIOGET_FSCREENINFO, &fix))
- printf("fix %s\n", strerror(errno));
-
- setMode(&var);
-
- if (ioctl(fd, FBIOPUT_VSCREENINFO, &var))
- printf("var %s\n", strerror(errno));
-
- for (i = 0; i < 1; i++) {
- prettyColors(fd);
- }
- sleep(1);
-
- printf("pan: 0, 0\n");
- pan(fd, &var, 0, 0);
- sleep(2);
- printf("pan: 100, 0\n");
- pan(fd, &var, 100, 0);
- sleep(2);
- printf("pan: 0, 100\n");
- pan(fd, &var, 0, 100);
- sleep(2);
- printf("pan: 100, 100\n");
- pan(fd, &var, 100, 100);
- sleep(2);
- printf("pan: 0, 0\n");
- pan(fd, &var, 0, 0);
- sleep(2);
-
- printf("cursor\n");
- cursor(fd, drmfd);
return 0;
}