diff options
author | David 'Digit' Turner <digit@android.com> | 2011-01-20 02:46:33 +0100 |
---|---|---|
committer | David 'Digit' Turner <digit@android.com> | 2011-01-20 02:46:33 +0100 |
commit | 94702b0dc4a9729b234c6f0265a9e43c72ef79ad (patch) | |
tree | f0a51ef09af88cbb95899a90057bd5f53e4e5bb6 /console.c | |
parent | a9edc435e6592fcc001e21e150391a84bde114a6 (diff) | |
download | external_qemu-94702b0dc4a9729b234c6f0265a9e43c72ef79ad.zip external_qemu-94702b0dc4a9729b234c6f0265a9e43c72ef79ad.tar.gz external_qemu-94702b0dc4a9729b234c6f0265a9e43c72ef79ad.tar.bz2 |
Fix ui/core display depth mismatch.
This patch fixes a problem where the core's framebuffer was
incorrectly initialized to a pitch of width*4 by default
(instead of width*2 when using a 16-bit framebuffer).
The reason for this was complex, but essentially, when the
machine initialization was moved before the display one in
vl-android.c, this changed the way the DisplayState was
initialized.
Also get rid of the useless and confusing "display_state"
global in vl-android.c (not the same than "display_state" in
console.c)
Change-Id: If8e2b8baf7ccaeedcb66da0174cc529521d67a60
Diffstat (limited to 'console.c')
-rw-r--r-- | console.c | 26 |
1 files changed, 21 insertions, 5 deletions
@@ -1734,11 +1734,27 @@ PixelFormat qemu_default_pixelformat(int bpp) #ifdef CONFIG_ANDROID void -android_display_init_from(int width, int height, int rotation, int bpp) +android_display_reset(DisplayState* ds, int width, int height, int bitspp) { - DisplayState *ds = qemu_mallocz(sizeof(DisplayState)); - ds->allocator = &default_allocator; - ds->surface = qemu_create_displaysurface(ds, width, height); - register_displaystate(ds); + DisplaySurface* surface; + int bytespp = (bitspp+7)/8; + int pitch = (bytespp*width + 3) & ~3; + + qemu_free_displaysurface(ds); + + surface = (DisplaySurface*) qemu_mallocz(sizeof(DisplaySurface)); + + surface->width = width; + surface->height = height; + surface->linesize = pitch; + surface->pf = qemu_default_pixelformat(bitspp); + surface->data = (uint8_t*) qemu_malloc(surface->linesize * surface->height); +#ifdef HOST_WORDS_BIGENDIAN + surface->flags = QEMU_ALLOCATED_FLAG | QEMU_BIG_ENDIAN_FLAG; +#else + surface->flags = QEMU_ALLOCATED_FLAG; +#endif + + ds->surface = surface; } #endif |