From a2254c5a9670a3e865f0eb5acd46e905c9b146ce Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Mon, 28 Jan 2008 03:12:29 +0100 Subject: Added cursor support --- tests/modefb/Makefile | 14 +++++ tests/modefb/demo.c | 150 ++++++++++++++++++++++++++++++++++++++++++++++++++ tests/modefb/test | 1 + 3 files changed, 165 insertions(+) create mode 100644 tests/modefb/Makefile create mode 100644 tests/modefb/demo.c create mode 100755 tests/modefb/test (limited to 'tests/modefb') diff --git a/tests/modefb/Makefile b/tests/modefb/Makefile new file mode 100644 index 00000000..84c6c86a --- /dev/null +++ b/tests/modefb/Makefile @@ -0,0 +1,14 @@ + +all: app + +#CFLAGS = -g -ansi -pedantic -DPOSIX_C_SOURCE=199309L \ +# -D_POSIX_SOURCE -D_XOPEN_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE \ + +app: demo.c + @gcc $(CFLAGS) -o app -Wall demo.c + +clean: + @rm -f app + +run: app + sudo ./test diff --git a/tests/modefb/demo.c b/tests/modefb/demo.c new file mode 100644 index 00000000..0dbf01c7 --- /dev/null +++ b/tests/modefb/demo.c @@ -0,0 +1,150 @@ +#include +#include +#include +#include +#include +#include "linux/fb.h" +#include "sys/ioctl.h" + + +void setMode(struct fb_var_screeninfo *var); +void pan(int fd, struct fb_var_screeninfo *var, int x, int y); +void cursor(int fd); + +int main(int argc, char **argv) +{ + struct fb_var_screeninfo var; + struct fb_fix_screeninfo fix; + const char* name = "/dev/fb0"; + + int fd = open(name, O_RDONLY); + + if (fd == -1) { + printf("open %s : %s\n", name, strerror(errno)); + 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); + 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); + return 0; +} + +void pan(int fd, struct fb_var_screeninfo *var, int x, int y) +{ + var->xoffset = x; + var->yoffset = y; + + var->activate = FB_ACTIVATE_NOW; + + if (ioctl(fd, FBIOPUT_VSCREENINFO, var)) + printf("pan error: %s\n", strerror(errno)); +} + +/* + * Currently isn't supported in the driver + */ +void cursor(int fd) +{ + struct fb_cursor cur; + void *data = malloc(64 * 64 * 4); + memset(&cur, 0, sizeof(cur)); + + cur.set = FB_CUR_SETIMAGE | FB_CUR_SETPOS | FB_CUR_SETSIZE; + cur.enable = 1; + cur.image.dx = 1; + cur.image.dy = 1; + cur.image.width = 2; + cur.image.height = 2; + cur.image.depth = 32; + cur.image.data = data; + + if (ioctl(fd, FBIO_CURSOR, &cur)) + printf("cursor error: %s\n", strerror(errno)); + + sleep(2); + + memset(&cur, 0, sizeof(cur)); + cur.set = FB_CUR_SETPOS; + cur.enable = 0; + cur.image.dx = 100; + cur.image.dy = 100; + + if (ioctl(fd, FBIO_CURSOR, &cur)) + printf("cursor error: %s\n", strerror(errno)); + + free(data); +} + +struct drm_mode +{ + int clock; + int hdisplay; + int hsync_start; + int hsync_end; + int htotal; + int hskew; + int vdisplay; + int vsync_start; + int vsync_end; + int vtotal; + int vscan; + int vrefresh; + int flags; +}; + +struct drm_mode mode = +{ + .clock = 25200, + .hdisplay = 640, + .hsync_start = 656, + .hsync_end = 752, + .htotal = 800, + .hskew = 0, + .vdisplay = 480, + .vsync_start = 490, + .vsync_end = 492, + .vtotal = 525, + .vscan = 0, + .vrefresh = 60000, /* vertical refresh * 1000 */ + .flags = 10, +}; + +void setMode(struct fb_var_screeninfo *var) { + var->activate = FB_ACTIVATE_NOW; + var->xres = mode.hdisplay; + var->right_margin = mode.hsync_start - mode.hdisplay; + var->hsync_len = mode.hsync_end - mode.hsync_start; + var->left_margin = mode.htotal - mode.hsync_end; + var->yres = mode.vdisplay; + var->lower_margin = mode.vsync_start - mode.vdisplay; + var->vsync_len = mode.vsync_end - mode.vsync_start; + var->upper_margin = mode.vtotal - mode.vsync_end; + var->pixclock = 10000000 / mode.htotal * 1000 / mode.vtotal * 100; + /* avoid overflow */ + var->pixclock = var->pixclock * 1000 / mode.vrefresh; +} diff --git a/tests/modefb/test b/tests/modefb/test new file mode 100755 index 00000000..f98e3708 --- /dev/null +++ b/tests/modefb/test @@ -0,0 +1 @@ +LD_PRELOAD=../../libdrm/.libs/libdrm.so ./app -- cgit v1.2.3 From 841ef9eb8da8058d6495e9f8e1b14af2709dfaa1 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Wed, 30 Jan 2008 15:47:26 +0100 Subject: ModeFB demo now display cursor --- tests/modefb/Makefile | 2 +- tests/modefb/demo.c | 82 +++++++++++++++++++++++++++++++++------------------ 2 files changed, 55 insertions(+), 29 deletions(-) (limited to 'tests/modefb') diff --git a/tests/modefb/Makefile b/tests/modefb/Makefile index 84c6c86a..467fb11a 100644 --- a/tests/modefb/Makefile +++ b/tests/modefb/Makefile @@ -5,7 +5,7 @@ all: app # -D_POSIX_SOURCE -D_XOPEN_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE \ app: demo.c - @gcc $(CFLAGS) -o app -Wall demo.c + @gcc $(CFLAGS) -o app -Wall -I../../libdrm -I../../shared-core -L../../libdrm/.libs -ldrm demo.c clean: @rm -f app diff --git a/tests/modefb/demo.c b/tests/modefb/demo.c index 0dbf01c7..9af369c2 100644 --- a/tests/modefb/demo.c +++ b/tests/modefb/demo.c @@ -5,25 +5,37 @@ #include #include "linux/fb.h" #include "sys/ioctl.h" +#include "xf86drm.h" +#include "xf86drmMode.h" - +void pretty(int fd); void setMode(struct fb_var_screeninfo *var); void pan(int fd, struct fb_var_screeninfo *var, int x, int y); -void cursor(int fd); +void cursor(int fd, int drmfd); +void prettyCursor(int fd, unsigned int handle, unsigned int color); + +extern void sleep(int); int main(int argc, char **argv) { struct fb_var_screeninfo var; struct fb_fix_screeninfo fix; + const char* driver = "i915"; const char* name = "/dev/fb0"; int fd = open(name, O_RDONLY); + int drmfd = drmOpen(driver, NULL); if (fd == -1) { printf("open %s : %s\n", name, strerror(errno)); return 1; } + if (drmfd < 0) { + printf("drmOpen failed\n"); + return 1; + } + memset(&var, 0, sizeof(struct fb_var_screeninfo)); memset(&fix, 0, sizeof(struct fb_fix_screeninfo)); @@ -50,7 +62,7 @@ int main(int argc, char **argv) sleep(2); printf("cursor\n"); - cursor(fd); + cursor(fd, drmfd); return 0; } @@ -66,38 +78,52 @@ void pan(int fd, struct fb_var_screeninfo *var, int x, int y) } /* - * Currently isn't supported in the driver + * Cursor support removed from the fb kernel interface + * using drm instead. */ -void cursor(int fd) +void cursor(int fd, int drmfd) { - struct fb_cursor cur; - void *data = malloc(64 * 64 * 4); - memset(&cur, 0, sizeof(cur)); - - cur.set = FB_CUR_SETIMAGE | FB_CUR_SETPOS | FB_CUR_SETSIZE; - cur.enable = 1; - cur.image.dx = 1; - cur.image.dy = 1; - cur.image.width = 2; - cur.image.height = 2; - cur.image.depth = 32; - cur.image.data = data; - - if (ioctl(fd, FBIO_CURSOR, &cur)) - printf("cursor error: %s\n", strerror(errno)); + drmModeResPtr res = drmModeGetResources(drmfd); + uint32_t crtc = res->crtcs[1]; /* select crtc here */ + drmBO bo; + int ret; + ret = drmBOCreate(drmfd, 64 * 64 * 4, 0, 0, + DRM_BO_FLAG_READ | + DRM_BO_FLAG_WRITE | + DRM_BO_FLAG_MEM_VRAM | + DRM_BO_FLAG_NO_EVICT, + DRM_BO_HINT_DONT_FENCE, &bo); + + if (ret) { + printf("failed to create buffer: %s\n", strerror(ret)); + return; + } + prettyCursor(drmfd, bo.handle, 0xFFFF00FF); + drmModeSetCursor(drmfd, crtc, &bo, 64, 64); + drmModeMoveCursor(drmfd, crtc, 0, 0); + sleep(2); + drmModeMoveCursor(drmfd, crtc, 40, 40); + prettyCursor(drmfd, bo.handle, 0xFFFF0000); sleep(2); + drmModeSetCursor(drmfd, crtc, 0, 0, 0); + drmBOUnreference(drmfd, &bo); +} + +void prettyCursor(int drmfd, unsigned int handle, unsigned int color) +{ + drmBO bo; + unsigned int *ptr; + int i; - memset(&cur, 0, sizeof(cur)); - cur.set = FB_CUR_SETPOS; - cur.enable = 0; - cur.image.dx = 100; - cur.image.dy = 100; + drmBOReference(drmfd, handle, &bo); + drmBOMap(drmfd, &bo, DRM_BO_FLAG_READ | DRM_BO_FLAG_WRITE, 0, (void**)&ptr); - if (ioctl(fd, FBIO_CURSOR, &cur)) - printf("cursor error: %s\n", strerror(errno)); + for (i = 0; i < (64 * 64); i++) + ptr[i] = color; - free(data); + drmBOUnmap(drmfd, &bo); + drmBOUnreference(drmfd, &bo); } struct drm_mode -- cgit v1.2.3 From 936e32b08c05c9658cc51cd8fe118e0342733a79 Mon Sep 17 00:00:00 2001 From: Alan Hourihane Date: Tue, 5 Feb 2008 15:18:05 +0000 Subject: make modefb/modedemo match each others test output. --- tests/modefb/demo.c | 83 +++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 68 insertions(+), 15 deletions(-) (limited to 'tests/modefb') diff --git a/tests/modefb/demo.c b/tests/modefb/demo.c index 9af369c2..f80753cf 100644 --- a/tests/modefb/demo.c +++ b/tests/modefb/demo.c @@ -4,6 +4,7 @@ #include #include #include "linux/fb.h" +#include #include "sys/ioctl.h" #include "xf86drm.h" #include "xf86drmMode.h" @@ -12,19 +13,20 @@ void pretty(int fd); void setMode(struct fb_var_screeninfo *var); void pan(int fd, struct fb_var_screeninfo *var, int x, int y); void cursor(int fd, int drmfd); +void prettyColors(int fd); void prettyCursor(int fd, unsigned int handle, unsigned int color); extern void sleep(int); +struct fb_var_screeninfo var; +struct fb_fix_screeninfo fix; + int main(int argc, char **argv) { - struct fb_var_screeninfo var; - struct fb_fix_screeninfo fix; - const char* driver = "i915"; - const char* name = "/dev/fb0"; - - int fd = open(name, O_RDONLY); - int drmfd = drmOpen(driver, NULL); + const char* name = "/dev/fb1"; + int i; + int fd = open(name, O_RDWR); + int drmfd = drmOpenControl(0); if (fd == -1) { printf("open %s : %s\n", name, strerror(errno)); @@ -32,7 +34,7 @@ int main(int argc, char **argv) } if (drmfd < 0) { - printf("drmOpen failed\n"); + printf("drmOpenControl failed\n"); return 1; } @@ -45,6 +47,15 @@ int main(int argc, char **argv) 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); @@ -71,12 +82,51 @@ void pan(int fd, struct fb_var_screeninfo *var, int x, int y) var->xoffset = x; var->yoffset = y; - var->activate = FB_ACTIVATE_NOW; - - if (ioctl(fd, FBIOPUT_VSCREENINFO, var)) + if (ioctl(fd, FBIOPAN_DISPLAY, var)) printf("pan error: %s\n", strerror(errno)); } +void draw(unsigned int x, unsigned int y, unsigned int w, unsigned int h, unsigned int v, unsigned int *ptr) +{ + int i, j; + + for (i = x; i < x + w; i++) + for(j = y; j < y + h; j++) + ptr[(i * var.xres_virtual) + j] = v; +} + +void prettyColors(int fd) +{ + unsigned int *ptr, *newptr; + int i,w,h; + int size = var.xres * var.yres * var.bits_per_pixel; + + ptr = (unsigned int *)mmap(NULL, size, + PROT_READ|PROT_WRITE, MAP_SHARED, fd, + 0); + if (ptr < 0) { + printf("FAILED MMAP %d\n",errno); + exit(1); + } + + newptr = ptr; + for (h = 0; h < var.yres; h++) { + for (w = 0; w < var.xres; w++) { + newptr[w] = 0xFFFFFFFF; + } + newptr += var.xres_virtual; + } + + for (i = 0; i < 8; i++) + draw(i * 40, i * 40, 40, 40, 0, ptr); + + + draw(200, 100, 40, 40, 0xff00ff, ptr); + draw(100, 200, 40, 40, 0xff00ff, ptr); + + munmap(ptr, size); +} + /* * Cursor support removed from the fb kernel interface * using drm instead. @@ -102,11 +152,13 @@ void cursor(int fd, int drmfd) prettyCursor(drmfd, bo.handle, 0xFFFF00FF); drmModeSetCursor(drmfd, crtc, &bo, 64, 64); drmModeMoveCursor(drmfd, crtc, 0, 0); - sleep(2); - drmModeMoveCursor(drmfd, crtc, 40, 40); + sleep(1); prettyCursor(drmfd, bo.handle, 0xFFFF0000); - sleep(2); - drmModeSetCursor(drmfd, crtc, 0, 0, 0); + drmModeMoveCursor(drmfd, crtc, 40, 40); + sleep(1); + drmModeMoveCursor(drmfd, crtc, 100, 100); + sleep(1); + drmModeSetCursor(drmfd, crtc, NULL, 0, 0); drmBOUnreference(drmfd, &bo); } @@ -173,4 +225,5 @@ void setMode(struct fb_var_screeninfo *var) { var->pixclock = 10000000 / mode.htotal * 1000 / mode.vtotal * 100; /* avoid overflow */ var->pixclock = var->pixclock * 1000 / mode.vrefresh; + var->bits_per_pixel = 32; } -- cgit v1.2.3 From 127cb1ff9a7bbb7af73cc418a7adc30d68c454d2 Mon Sep 17 00:00:00 2001 From: Alan Hourihane Date: Tue, 5 Feb 2008 15:24:29 +0000 Subject: tweak it --- tests/modefb/demo.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'tests/modefb') diff --git a/tests/modefb/demo.c b/tests/modefb/demo.c index f80753cf..ef2b6585 100644 --- a/tests/modefb/demo.c +++ b/tests/modefb/demo.c @@ -97,8 +97,8 @@ void draw(unsigned int x, unsigned int y, unsigned int w, unsigned int h, unsign void prettyColors(int fd) { - unsigned int *ptr, *newptr; - int i,w,h; + unsigned int *ptr; + int i; int size = var.xres * var.yres * var.bits_per_pixel; ptr = (unsigned int *)mmap(NULL, size, @@ -109,13 +109,7 @@ void prettyColors(int fd) exit(1); } - newptr = ptr; - for (h = 0; h < var.yres; h++) { - for (w = 0; w < var.xres; w++) { - newptr[w] = 0xFFFFFFFF; - } - newptr += var.xres_virtual; - } + memset(ptr, 0xFF, size); for (i = 0; i < 8; i++) draw(i * 40, i * 40, 40, 40, 0, ptr); -- cgit v1.2.3 From 516c7a7b28ebf4bba797eaa718450b51aa772c6e Mon Sep 17 00:00:00 2001 From: Alan Hourihane Date: Tue, 5 Feb 2008 15:30:28 +0000 Subject: update app to cycle through 4 fbdev's --- tests/modefb/demo.c | 102 +++++++++++++++++++++++++++------------------------- 1 file changed, 54 insertions(+), 48 deletions(-) (limited to 'tests/modefb') 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; } -- cgit v1.2.3 From f51dc37d75b0b1b8e5636f8f2c201e29986517ea Mon Sep 17 00:00:00 2001 From: Alan Hourihane Date: Thu, 7 Feb 2008 22:21:50 +0000 Subject: After the previous revert fix libdrm to start at minor 1 and fixup the demos --- tests/modefb/demo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/modefb') diff --git a/tests/modefb/demo.c b/tests/modefb/demo.c index 7fa3b93f..4d81e511 100644 --- a/tests/modefb/demo.c +++ b/tests/modefb/demo.c @@ -26,7 +26,7 @@ int main(int argc, char **argv) char name[100]; int i,d; int fd; - int drmfd = drmOpenControl(0); + int drmfd = drmOpen("i915", NULL); /* try four devices */ for (d = 0; d < 4; d++) { -- cgit v1.2.3 From db85ed25afc616acfaadb21facf6066354f9d490 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 13 Feb 2008 12:20:02 +1000 Subject: Revert "After the previous revert fix libdrm to start at minor 1" This reverts commit f51dc37d75b0b1b8e5636f8f2c201e29986517ea. Conflicts: tests/modedemo/demo.c --- tests/modefb/demo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/modefb') diff --git a/tests/modefb/demo.c b/tests/modefb/demo.c index 4d81e511..7fa3b93f 100644 --- a/tests/modefb/demo.c +++ b/tests/modefb/demo.c @@ -26,7 +26,7 @@ int main(int argc, char **argv) char name[100]; int i,d; int fd; - int drmfd = drmOpen("i915", NULL); + int drmfd = drmOpenControl(0); /* try four devices */ for (d = 0; d < 4; d++) { -- cgit v1.2.3 From 88cb873045b76bf947f45fb127baa96f055ad32c Mon Sep 17 00:00:00 2001 From: Alan Hourihane Date: Wed, 20 Feb 2008 19:54:36 +0000 Subject: minor test fixes --- tests/modefb/demo.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'tests/modefb') 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; } -- cgit v1.2.3 From 7317e774b5cddb7218c1416fa4d9ee98756e4890 Mon Sep 17 00:00:00 2001 From: Alan Hourihane Date: Fri, 9 May 2008 09:26:17 +0100 Subject: Fix test applications for recent DRM changes --- tests/modefb/demo.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'tests/modefb') diff --git a/tests/modefb/demo.c b/tests/modefb/demo.c index b6d1f65b..ead53334 100644 --- a/tests/modefb/demo.c +++ b/tests/modefb/demo.c @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -16,8 +17,6 @@ void cursor(int fd, int drmfd); void prettyColors(int fd); void prettyCursor(int fd, unsigned int handle, unsigned int color); -extern void sleep(int); - struct fb_var_screeninfo var; struct fb_fix_screeninfo fix; @@ -152,7 +151,7 @@ void cursor(int fd, int drmfd) } prettyCursor(drmfd, bo.handle, 0xFFFF00FF); - drmModeSetCursor(drmfd, crtc, &bo, 64, 64); + drmModeSetCursor(drmfd, crtc, bo.handle, 64, 64); drmModeMoveCursor(drmfd, crtc, 0, 0); sleep(1); prettyCursor(drmfd, bo.handle, 0xFFFF0000); @@ -160,7 +159,7 @@ void cursor(int fd, int drmfd) sleep(1); drmModeMoveCursor(drmfd, crtc, 100, 100); sleep(1); - drmModeSetCursor(drmfd, crtc, NULL, 0, 0); + drmModeSetCursor(drmfd, crtc, 0, 0, 0); drmBOUnreference(drmfd, &bo); } -- cgit v1.2.3