From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35369) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VOuJm-0000f5-EY for qemu-devel@nongnu.org; Wed, 25 Sep 2013 15:00:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VOuJg-0008RT-4F for qemu-devel@nongnu.org; Wed, 25 Sep 2013 15:00:10 -0400 Received: from ssl.serverraum.org ([2a01:4f8:a0:1283::1:2]:46029) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VOuJf-0008Oh-SH for qemu-devel@nongnu.org; Wed, 25 Sep 2013 15:00:04 -0400 From: Michael Walle Date: Wed, 25 Sep 2013 20:59:27 +0200 Message-Id: <1380135572-25095-7-git-send-email-michael@walle.cc> In-Reply-To: <1380135572-25095-1-git-send-email-michael@walle.cc> References: <1380135572-25095-1-git-send-email-michael@walle.cc> Subject: [Qemu-devel] [PULL 06/11] milkymist-vgafb: swap pixel data in source buffer List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Michael Walle In commit fc97bb5ba3e7239c0b6d24095df6784868dfebbf the lduw_raw() call was eliminated. But we are reading from the target buffer a 16-bit value, which is in big-endian format. Therefore, swap the bytes if we are building for a little-endian host. Cc: Paolo Bonzini Signed-off-by: Michael Walle --- hw/display/milkymist-vgafb_template.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hw/display/milkymist-vgafb_template.h b/hw/display/milkymist-vgafb_template.h index e0036e1..5a906af 100644 --- a/hw/display/milkymist-vgafb_template.h +++ b/hw/display/milkymist-vgafb_template.h @@ -62,6 +62,9 @@ static void glue(draw_line_, BITS)(void *opaque, uint8_t *d, const uint8_t *s, while (width--) { memcpy(&rgb565, s, sizeof(rgb565)); +#ifndef HOST_WORDS_BIGENDIAN + rgb565 = bswap16(rgb565); +#endif r = ((rgb565 >> 11) & 0x1f) << 3; g = ((rgb565 >> 5) & 0x3f) << 2; b = ((rgb565 >> 0) & 0x1f) << 3; -- 1.7.10.4