Index: rpi_machdep.c
===================================================================
RCS file: /cvsroot/src/sys/arch/evbarm/rpi/rpi_machdep.c,v
retrieving revision 1.55
diff -u -r1.55 rpi_machdep.c
--- rpi_machdep.c 7 Oct 2014 08:37:18 -0000 1.55
+++ rpi_machdep.c 7 Oct 2014 09:20:20 -0000
@@ -386,6 +386,7 @@
static int rpi_video_on = WSDISPLAYIO_VIDEO_ON;
#if defined(RPI_HWCURSOR)
+#define RPI_FWREV_HWCURSOR 1390809622
#define CURSOR_BITMAP_SIZE (64 * 8)
#define CURSOR_ARGB_SIZE (64 * 64 * 4)
static uint32_t hcursor = 0;
@@ -831,40 +832,43 @@
}
#if defined(RPI_HWCURSOR)
- struct amba_attach_args *aaa = aux;
- bus_space_handle_t hc;
+ if (vb.vbt_fwrev.rev >= RPI_FWREV_HWCURSOR) {
- hcursor = rpi_alloc_mem(CURSOR_ARGB_SIZE, PAGE_SIZE,
- MEM_FLAG_L1_NONALLOCATING | MEM_FLAG_HINT_PERMALOCK);
- pcursor = rpi_lock_mem(hcursor);
+ struct amba_attach_args *aaa = aux;
+ bus_space_handle_t hc;
+
+ hcursor = rpi_alloc_mem(CURSOR_ARGB_SIZE, PAGE_SIZE,
+ MEM_FLAG_L1_NONALLOCATING | MEM_FLAG_HINT_PERMALOCK);
+ pcursor = rpi_lock_mem(hcursor);
#ifdef RPI_IOCTL_DEBUG
- printf("hcursor: %08x\n", hcursor);
- printf("pcursor: %08x\n", (uint32_t)pcursor);
- printf("fb: %08x\n", (uint32_t)vb_setfb.vbt_allocbuf.address);
-#endif
- if (bus_space_map(aaa->aaa_iot, pcursor, CURSOR_ARGB_SIZE,
- BUS_SPACE_MAP_LINEAR|BUS_SPACE_MAP_PREFETCHABLE, &hc) != 0) {
- printf("couldn't map cursor memory\n");
- } else {
- int i, j, k;
-
- cmem = bus_space_vaddr(aaa->aaa_iot, hc);
- k = 0;
- for (j = 0; j < 64; j++) {
- for (i = 0; i < 64; i++) {
- cmem[i + k] =
- ((i & 8) ^ (j & 8)) ? 0xa0ff0000 : 0xa000ff00;
+ printf("hcursor: %08x\n", hcursor);
+ printf("pcursor: %08x\n", (uint32_t)pcursor);
+ printf("fb: %08x\n", (uint32_t)vb_setfb.vbt_allocbuf.address);
+#endif
+ if (bus_space_map(aaa->aaa_iot, pcursor, CURSOR_ARGB_SIZE,
+ BUS_SPACE_MAP_LINEAR|BUS_SPACE_MAP_PREFETCHABLE, &hc) != 0) {
+ printf("couldn't map cursor memory\n");
+ } else {
+ int i, j, k;
+
+ cmem = bus_space_vaddr(aaa->aaa_iot, hc);
+ k = 0;
+ for (j = 0; j < 64; j++) {
+ for (i = 0; i < 64; i++) {
+ cmem[i + k] =
+ ((i & 8) ^ (j & 8)) ? 0xa0ff0000 : 0xa000ff00;
+ }
+ k += 64;
}
- k += 64;
- }
- cpu_dcache_wb_range((vaddr_t)cmem, CURSOR_ARGB_SIZE);
- rpi_fb_initcursor(pcursor, 0, 0);
+ cpu_dcache_wb_range((vaddr_t)cmem, CURSOR_ARGB_SIZE);
+ rpi_fb_initcursor(pcursor, 0, 0);
#ifdef RPI_IOCTL_DEBUG
- rpi_fb_movecursor(600, 400, 1);
+ rpi_fb_movecursor(600, 400, 1);
#else
- rpi_fb_movecursor(cursor_x, cursor_y, cursor_on);
+ rpi_fb_movecursor(cursor_x, cursor_y, cursor_on);
#endif
- }
+ }
+ }
#endif
return true;
@@ -956,8 +960,9 @@
rpi_video_on = d;
rpi_fb_set_video(d);
#if defined(RPI_HWCURSOR)
- rpi_fb_movecursor(cursor_x, cursor_y,
- d ? cursor_on : 0);
+ if (hcursor)
+ rpi_fb_movecursor(cursor_x, cursor_y,
+ d ? cursor_on : 0);
#endif
}
return 0;
@@ -969,6 +974,9 @@
{
struct wsdisplay_curpos *cp = (void *)data;
+ if (hcursor == 0)
+ return ENODEV;
+
cp->x = cursor_x;
cp->y = cursor_y;
}
@@ -977,6 +985,9 @@
{
struct wsdisplay_curpos *cp = (void *)data;
+ if (hcursor == 0)
+ return ENODEV;
+
cursor_x = cp->x;
cursor_y = cp->y;
rpi_fb_movecursor(cursor_x, cursor_y, cursor_on);
@@ -986,6 +997,9 @@
{
struct wsdisplay_curpos *cp = (void *)data;
+ if (hcursor == 0)
+ return ENODEV;
+
cp->x = 64;
cp->y = 64;
}
@@ -994,6 +1008,9 @@
{
struct wsdisplay_cursor *cursor = (void *)data;
+ if (hcursor == 0)
+ return ENODEV;
+
return rpi_fb_do_cursor(cursor);
}
#endif