diff options
author | Jakob Bornecrantz <jakob@tungstengraphics.com> | 2008-02-07 19:22:38 +0100 |
---|---|---|
committer | Jakob Bornecrantz <jakob@tungstengraphics.com> | 2008-02-07 19:22:38 +0100 |
commit | 87d5f9cb2d2812c1da726e38965f0eb78c2b8dfa (patch) | |
tree | 4c5dc008655c0ca6d5b2a47ff3fba301819b2940 /tests | |
parent | 516c7a7b28ebf4bba797eaa718450b51aa772c6e (diff) |
Small update to modedemo
Diffstat (limited to 'tests')
-rw-r--r-- | tests/modedemo/demo.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/tests/modedemo/demo.c b/tests/modedemo/demo.c index 48a4f1f1..0882fc91 100644 --- a/tests/modedemo/demo.c +++ b/tests/modedemo/demo.c @@ -201,12 +201,30 @@ int demoCreateScreens(struct demo_driver *driver) void demoTakeDownScreen(struct demo_screen *screen) { - /* TODO Unrefence the BO */ - /* TODO Destroy FB */ - /* TODO take down the mode */ + int fd = screen->driver->fd; + drmBO bo; + + if (screen->crtc) + drmModeSetCrtc(fd, screen->crtc->crtc_id, 0, 0, 0, 0, 0, 0); + + if (screen->fb) + drmModeRmFB(fd, screen->fb->buffer_id); + + /* maybe we should keep a pointer to the bo on the screen */ + if (screen->fb && !drmBOReference(fd, screen->fb->handle, &bo)) { + drmBOUnreference(fd, &bo); + drmBOUnreference(fd, &bo); + } else { + printf("bo error\n"); + } drmModeFreeOutput(screen->output); drmModeFreeCrtc(screen->crtc); + drmModeFreeFB(screen->fb); + + screen->output = NULL; + screen->crtc = NULL; + screen->fb = NULL; } drmModeCrtcPtr demoFindFreeCrtc(struct demo_driver *driver, drmModeOutputPtr output) |