From nobody Tue Feb 10 11:33:37 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1492763942609908.7418765263353; Fri, 21 Apr 2017 01:39:02 -0700 (PDT) Received: from localhost ([::1]:57897 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d1U5l-0007CL-1g for importer@patchew.org; Fri, 21 Apr 2017 04:39:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55316) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d1U00-0002iK-Qm for qemu-devel@nongnu.org; Fri, 21 Apr 2017 04:33:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d1Tzy-0002q5-NU for qemu-devel@nongnu.org; Fri, 21 Apr 2017 04:33:04 -0400 Received: from chuckie.co.uk ([82.165.15.123]:50207 helo=s16892447.onlinehome-server.info) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d1Tzy-0002pk-Gf for qemu-devel@nongnu.org; Fri, 21 Apr 2017 04:33:02 -0400 Received: from host86-191-119-77.range86-191.btcentralplus.com ([86.191.119.77] helo=kentang.home) by s16892447.onlinehome-server.info with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1d1TwW-0002g4-Ah; Fri, 21 Apr 2017 09:29:29 +0100 From: Mark Cave-Ayland To: qemu-devel@nongnu.org, kraxel@redhat.com Date: Fri, 21 Apr 2017 09:28:45 +0100 Message-Id: <1492763327-12742-12-git-send-email-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1492763327-12742-1-git-send-email-mark.cave-ayland@ilande.co.uk> References: <1492763327-12742-1-git-send-email-mark.cave-ayland@ilande.co.uk> X-SA-Exim-Connect-IP: 86.191.119.77 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk X-SA-Exim-Version: 4.2.1 (built Sun, 08 Jan 2012 02:45:44 +0000) X-SA-Exim-Scanned: Yes (on s16892447.onlinehome-server.info) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 82.165.15.123 Subject: [Qemu-devel] [PATCH v2 11/13] tcx: remove primitives for non-32-bit surfaces X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Cave-Ayland Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" As all surfaces in QEMU are now either shared or 32-bit ARGB regardless of the guest depth, remove all non-32-bit primitives from tcx_update_display() and consequence their implementation which are no longer required. Signed-off-by: Mark Cave-Ayland Reviewed-by: Gerd Hoffmann --- hw/display/tcx.c | 126 ++++----------------------------------------------= ---- 1 file changed, 8 insertions(+), 118 deletions(-) diff --git a/hw/display/tcx.c b/hw/display/tcx.c index 0dd007e..6da6dfb 100644 --- a/hw/display/tcx.c +++ b/hw/display/tcx.c @@ -140,25 +140,12 @@ static void update_palette_entries(TCXState *s, int s= tart, int end) int i; =20 for (i =3D start; i < end; i++) { - switch (surface_bits_per_pixel(surface)) { - default: - case 8: - s->palette[i] =3D rgb_to_pixel8(s->r[i], s->g[i], s->b[i]); - break; - case 15: - s->palette[i] =3D rgb_to_pixel15(s->r[i], s->g[i], s->b[i]); - break; - case 16: - s->palette[i] =3D rgb_to_pixel16(s->r[i], s->g[i], s->b[i]); - break; - case 32: - if (is_surface_bgr(surface)) { - s->palette[i] =3D rgb_to_pixel32bgr(s->r[i], s->g[i], s->b= [i]); - } else { - s->palette[i] =3D rgb_to_pixel32(s->r[i], s->g[i], s->b[i]= ); - } - break; + if (is_surface_bgr(surface)) { + s->palette[i] =3D rgb_to_pixel32bgr(s->r[i], s->g[i], s->b[i]); + } else { + s->palette[i] =3D rgb_to_pixel32(s->r[i], s->g[i], s->b[i]); } + break; } tcx_set_dirty(s, 0, memory_region_size(&s->vram_mem)); } @@ -176,31 +163,6 @@ static void tcx_draw_line32(TCXState *s1, uint8_t *d, } } =20 -static void tcx_draw_line16(TCXState *s1, uint8_t *d, - const uint8_t *s, int width) -{ - int x; - uint8_t val; - uint16_t *p =3D (uint16_t *)d; - - for (x =3D 0; x < width; x++) { - val =3D *s++; - *p++ =3D s1->palette[val]; - } -} - -static void tcx_draw_line8(TCXState *s1, uint8_t *d, - const uint8_t *s, int width) -{ - int x; - uint8_t val; - - for(x =3D 0; x < width; x++) { - val =3D *s++; - *d++ =3D s1->palette[val]; - } -} - static void tcx_draw_cursor32(TCXState *s1, uint8_t *d, int y, int width) { @@ -227,57 +189,6 @@ static void tcx_draw_cursor32(TCXState *s1, uint8_t *d, } } =20 -static void tcx_draw_cursor16(TCXState *s1, uint8_t *d, - int y, int width) -{ - int x, len; - uint32_t mask, bits; - uint16_t *p =3D (uint16_t *)d; - - y =3D y - s1->cursy; - mask =3D s1->cursmask[y]; - bits =3D s1->cursbits[y]; - len =3D MIN(width - s1->cursx, 32); - p =3D &p[s1->cursx]; - for (x =3D 0; x < len; x++) { - if (mask & 0x80000000) { - if (bits & 0x80000000) { - *p =3D s1->palette[259]; - } else { - *p =3D s1->palette[258]; - } - } - p++; - mask <<=3D 1; - bits <<=3D 1; - } -} - -static void tcx_draw_cursor8(TCXState *s1, uint8_t *d, - int y, int width) -{ - int x, len; - uint32_t mask, bits; - - y =3D y - s1->cursy; - mask =3D s1->cursmask[y]; - bits =3D s1->cursbits[y]; - len =3D MIN(width - s1->cursx, 32); - d =3D &d[s1->cursx]; - for (x =3D 0; x < len; x++) { - if (mask & 0x80000000) { - if (bits & 0x80000000) { - *d =3D s1->palette[259]; - } else { - *d =3D s1->palette[258]; - } - } - d++; - mask <<=3D 1; - bits <<=3D 1; - } -} - /* XXX Could be much more optimal: * detect if line/page/whole screen is in 24 bit mode @@ -326,10 +237,8 @@ static void tcx_update_display(void *opaque) ram_addr_t page, page_min, page_max; int y, y_start, dd, ds; uint8_t *d, *s; - void (*f)(TCXState *s1, uint8_t *dst, const uint8_t *src, int width); - void (*fc)(TCXState *s1, uint8_t *dst, int y, int width); =20 - if (surface_bits_per_pixel(surface) =3D=3D 0) { + if (surface_bits_per_pixel(surface) !=3D 32) { return; } =20 @@ -342,25 +251,6 @@ static void tcx_update_display(void *opaque) dd =3D surface_stride(surface); ds =3D 1024; =20 - switch (surface_bits_per_pixel(surface)) { - case 32: - f =3D tcx_draw_line32; - fc =3D tcx_draw_cursor32; - break; - case 15: - case 16: - f =3D tcx_draw_line16; - fc =3D tcx_draw_cursor16; - break; - default: - case 8: - f =3D tcx_draw_line8; - fc =3D tcx_draw_cursor8; - break; - case 0: - return; - } - memory_region_sync_dirty_bitmap(&ts->vram_mem); for (y =3D 0; y < ts->height; y++, page +=3D ds) { if (tcx_check_dirty(ts, page, ds)) { @@ -371,9 +261,9 @@ static void tcx_update_display(void *opaque) if (page > page_max) page_max =3D page; =20 - f(ts, d, s, ts->width); + tcx_draw_line32(ts, d, s, ts->width); if (y >=3D ts->cursy && y < ts->cursy + 32 && ts->cursx < ts->= width) { - fc(ts, d, y, ts->width); + tcx_draw_cursor32(ts, d, y, ts->width); } } else { if (y_start >=3D 0) { --=20 1.7.10.4