Skip to content

Commit

Permalink
Add minimal support for qemu emulation
Browse files Browse the repository at this point in the history
Unlike a real Raspberry Pi, qemu doesn't return framebuffer size on boot in
response to a mailbox query. If the size comes back as 0, assume qemu and
set 640x480
  • Loading branch information
brianwiddas committed Jan 12, 2013
1 parent 2ce836b commit 5697a1a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions framebuffer.c
Expand Up @@ -88,6 +88,16 @@ void fb_init(void)
fb_x = mailbuffer[5];
fb_y = mailbuffer[6];

/* If both fb_x and fb_y are both zero, assume we're running on the
* qemu Raspberry Pi emulation (which doesn't return a screen size
* at this point), and request a 640x480 screen
*/
if(fb_x==0 && fb_y==0)
{
fb_x = 640;
fb_y = 480;
}

if(fb_x==0 || fb_y==0)
fb_fail(FBFAIL_GOT_INVALID_RESOLUTION);

Expand Down

0 comments on commit 5697a1a

Please sign in to comment.