diff options
author | Alan Hourihane <alanh@tungstengraphics.com> | 2008-02-20 19:54:36 +0000 |
---|---|---|
committer | Alan Hourihane <alanh@tungstengraphics.com> | 2008-02-20 19:55:14 +0000 |
commit | 88cb873045b76bf947f45fb127baa96f055ad32c (patch) | |
tree | e84ed9d7913447f8f3e516cf999d0dcf39f1afb4 /tests | |
parent | 66cd6bd66667433f56feecdcc94a2bb228d5a7ca (diff) |
minor test fixes
Diffstat (limited to 'tests')
-rw-r--r-- | tests/modedemo/demo.c | 45 | ||||
-rw-r--r-- | tests/modefb/demo.c | 14 | ||||
-rw-r--r-- | tests/modehotplug/demo.c | 2 |
3 files changed, 51 insertions, 10 deletions
diff --git a/tests/modedemo/demo.c b/tests/modedemo/demo.c index 474f04a5..db51cd66 100644 --- a/tests/modedemo/demo.c +++ b/tests/modedemo/demo.c @@ -16,6 +16,12 @@ #include <stdint.h> #include <unistd.h> #include <string.h> +#ifdef CLEAN_FBDEV +#include <errno.h> +#include <fcntl.h> +#include <sys/ioctl.h> +#include <linux/fb.h> +#endif #include "xf86drm.h" #include "xf86drmMode.h" @@ -26,6 +32,11 @@ void testCursor(int fd, uint32_t crtc); void prettyColors(int fd, unsigned int handle); void prettyCursor(int fd, unsigned int handle, unsigned int color); +#ifdef CLEAN_FBDEV +struct fb_var_screeninfo var; +struct fb_fix_screeninfo fix; +#endif + /* structs for the demo_driver */ struct demo_driver; @@ -101,6 +112,20 @@ int main(int argc, char **argv) int num; int i; +#ifdef CLEAN_FBDEV + int fbdev_fd; + + fbdev_fd = open("/dev/fb0", O_RDWR); + + memset(&var, 0, sizeof(struct fb_var_screeninfo)); + memset(&fix, 0, sizeof(struct fb_fix_screeninfo)); + + if (ioctl(fbdev_fd, FBIOGET_VSCREENINFO, &var)) + printf("var %s\n", strerror(errno)); + if (ioctl(fbdev_fd, FBIOGET_FSCREENINFO, &fix)) + printf("fix %s\n", strerror(errno)); +#endif + printf("starting demo\n"); driver = demoCreateDriver(); @@ -155,10 +180,12 @@ int main(int argc, char **argv) #ifdef CLEAN_FBDEV if (ioctl(fbdev_fd, FBIOPUT_VSCREENINFO, &var)) printf("var %s\n", strerror(errno)); + + close(fbdev_fd); #endif - printf("ok\n"); - return 0; + printf("ok\n"); + return 0; } int demoCreateScreens(struct demo_driver *driver) @@ -296,8 +323,20 @@ void demoTakeDownScreen(struct demo_screen *screen) int i; drmBO bo; +#if 0 + /* This can bust the fbdev arrangement as it basically unhooks + * the outputs and the fbdev backend doesn't know how to put things + * back on track. Realistically, it's up to the crtc owner to restore + * things..... + * + * So if you are mixing API's make sure the modesetting owner puts + * back the original CRTC arrangement so fbdev can continue... + * + * Ho-hum.. + */ if (screen->crtc) drmModeSetCrtc(fd, screen->crtc->crtc_id, 0, 0, 0, 0, 0, 0); +#endif if (screen->fb) drmModeRmFB(fd, screen->fb->buffer_id); @@ -354,7 +393,7 @@ struct demo_driver* demoCreateDriver(void) memset(driver, 0, sizeof(struct demo_driver)); - driver->fd = drmOpenControl(0); + driver->fd = drmOpen("i915",NULL); if (driver->fd < 0) { printf("Failed to open the card fb\n"); diff --git a/tests/modefb/demo.c b/tests/modefb/demo.c index 7fa3b93f..b6d1f65b 100644 --- a/tests/modefb/demo.c +++ b/tests/modefb/demo.c @@ -26,7 +26,12 @@ int main(int argc, char **argv) char name[100]; int i,d; int fd; - int drmfd = drmOpenControl(0); + int drmfd = drmOpen("i915", NULL); + + if (drmfd < 0) { + printf("drmOpenControl failed\n"); + return 1; + } /* try four devices */ for (d = 0; d < 4; d++) { @@ -38,11 +43,6 @@ int main(int argc, char **argv) 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)); @@ -79,6 +79,8 @@ int main(int argc, char **argv) printf("cursor (may show up on wrong CRTC - fixme)\n"); cursor(fd, drmfd); + + close(fd); } return 0; } diff --git a/tests/modehotplug/demo.c b/tests/modehotplug/demo.c index 1518e84c..4ef2e386 100644 --- a/tests/modehotplug/demo.c +++ b/tests/modehotplug/demo.c @@ -123,7 +123,7 @@ struct demo_driver* demoCreateDriver(void) memset(driver, 0, sizeof(struct demo_driver)); - driver->fd = drmOpenControl(0); + driver->fd = drmOpen("i915", NULL); if (driver->fd < 0) { printf("Failed to open the card fb\n"); |