10 /* needs to by 16-byte aligned, because the address we send over the mailbox
11 * interface, will have its 4 least significant bits masked off and taken over
14 static char propbuf[256] __attribute__((aligned(16)));
16 static void *fb_pixels;
17 static int fb_width, fb_height, fb_depth, fb_size;
22 struct rpi_prop_header *hdr = (struct rpi_prop_header*)propbuf;
23 struct rpi_prop *prop = (struct rpi_prop*)(hdr + 1);
25 hdr->size = sizeof propbuf;
32 prop->id = RPI_TAG_SETFBPHYS;
35 prop->data[0] = fb_width;
36 prop->data[1] = fb_height;
37 prop = RPI_PROP_NEXT(prop);
39 prop->id = RPI_TAG_SETFBVIRT;
42 prop->data[0] = fb_width;
43 prop->data[1] = fb_height;
44 prop = RPI_PROP_NEXT(prop);
46 prop->id = RPI_TAG_SETFBDEPTH;
49 prop->data[0] = fb_depth;
50 prop = RPI_PROP_NEXT(prop);
52 prop->id = RPI_TAG_ALLOCFB;
55 prop->data[0] = 4; /* alignment */
56 prop = RPI_PROP_NEXT(prop);
61 prop = RPI_PROP_NEXT(prop);
63 printf("Requesting video mode: %dx%d (%d bpp)\n", fb_width, fb_height, fb_depth);
65 rpi_mbox_send(RPI_MBOX_PROP, RPI_MEM_BUS_COHERENT(propbuf));
66 while(rpi_mbox_recv(RPI_MBOX_PROP) != RPI_MEM_BUS_COHERENT(propbuf));
68 hexdump(propbuf, sizeof propbuf);
70 if(hdr->res != 0x80000000) {
71 printf("Request failed, error: %x\n", hdr->res);
75 prop = (struct rpi_prop*)(hdr + 1);
77 prop->size = prop->res & 0x7fffffff;
80 case RPI_TAG_SETFBPHYS:
84 case RPI_TAG_SETFBVIRT:
86 fb_width = prop->data[0];
87 fb_height = prop->data[1];
90 case RPI_TAG_SETFBDEPTH:
92 fb_depth = prop->data[0];
97 fb_pixels = (void*)prop->data[0];
98 fb_size = prop->data[1];
102 printf("tag %x", prop->id);
106 printf(" %08x (%u bytes):", prop->res, prop->size);
107 for(i=0; i<prop->size / 4; i++) {
108 printf(" %u", prop->data[i]);
111 prop = RPI_PROP_NEXT(prop);
114 printf("Got video mode: %dx%d (%d bpp) at %p (%d bytes)\n", fb_width, fb_height,
115 fb_depth, fb_pixels, fb_size);
117 memset(fb_pixels, 0, fb_size);