-int video_init(void)
-{
- memset(&fbinf, 0, sizeof fbinf);
- fbinf.phys_width = fbinf.virt_width = 1024;
- fbinf.phys_height = fbinf.virt_height = 600;
- fbinf.depth = 32;
- fbinf.x = fbinf.y = 0;
-
- mbox_write(1, MEM_BUS_COHERENT(&fbinf));
- if(mbox_read(1) != 0) {
- ser_printstr("Failed to initialize display\n");
+ rpi_prop_send();
+
+ while((prop = rpi_prop_next())) {
+ switch(prop->id) {
+ case RPI_TAG_SETFBPHYS:
+ printf(" setfbphys");
+ fb_width = prop->data[0];
+ fb_height = prop->data[1];
+ break;
+
+ case RPI_TAG_SETFBVIRT:
+ printf(" setfbvirt");
+ scr_width = prop->data[0];
+ scr_height = prop->data[1];
+ break;
+
+ case RPI_TAG_SETFBDEPTH:
+ printf(" setfbdepth");
+ fb_depth = prop->data[0];
+ break;
+
+ case RPI_TAG_ALLOCFB:
+ printf(" allocfb");
+ fb_pixels = (void*)(prop->data[0] & 0x3fffffff);
+ fb_size = prop->data[1];
+ break;
+
+ default:
+ printf(" tag %x", prop->id);
+ break;
+ }
+
+ printf(" %08x (%u bytes):", prop->res, prop->size);
+ for(i=0; i<prop->size / 4; i++) {
+ printf(" %u", prop->data[i]);
+ }
+ putchar('\n');
+ }
+
+ if(!fb_pixels) {
+ rpi_prop(RPI_TAG_ALLOCFB, 16);
+ if(rpi_prop_send() == -1 || !(prop = rpi_prop_find(RPI_TAG_ALLOCFB))) {
+ printf("Failed to allocate framebuffer\n");
+ return -1;
+ }
+ fb_pixels = (void*)(prop->data[0] & 0x3fffffff);
+ fb_size = prop->data[1];
+ }
+
+ rpi_prop(RPI_TAG_GETFBPITCH);
+ rpi_prop(RPI_TAG_GETFBOFFS);
+ rpi_prop_send();
+ /*
+ if(rpi_prop_send() == -1) {
+ printf("Failed to get pitch\n");