From patchwork Thu Apr 4 07:28:49 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 233662 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 4C66D2C0176 for ; Thu, 4 Apr 2013 18:36:42 +1100 (EST) Received: from localhost ([::1]:37711 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UNeit-0000Jn-Q3 for incoming@patchwork.ozlabs.org; Thu, 04 Apr 2013 03:36:39 -0400 Received: from eggs.gnu.org ([208.118.235.92]:42826) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UNebm-0007JA-W4 for qemu-devel@nongnu.org; Thu, 04 Apr 2013 03:29:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UNebe-0004te-SP for qemu-devel@nongnu.org; Thu, 04 Apr 2013 03:29:18 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59304) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UNebe-0004tF-KN for qemu-devel@nongnu.org; Thu, 04 Apr 2013 03:29:10 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r347TAjn014347 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 4 Apr 2013 03:29:10 -0400 Received: from rincewind.home.kraxel.org (ovpn-116-57.ams2.redhat.com [10.36.116.57]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r347T9Dk007456; Thu, 4 Apr 2013 03:29:09 -0400 Received: by rincewind.home.kraxel.org (Postfix, from userid 500) id 279BF40E90; Thu, 4 Apr 2013 09:29:07 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Thu, 4 Apr 2013 09:28:49 +0200 Message-Id: <1365060546-24638-8-git-send-email-kraxel@redhat.com> In-Reply-To: <1365060546-24638-1-git-send-email-kraxel@redhat.com> References: <1365060546-24638-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Anthony Liguori , Gerd Hoffmann Subject: [Qemu-devel] [PATCH 07/24] console: use pixman for fill+blit X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Zap homegrown pixel shuffeling code, use pixman calls instead. Signed-off-by: Gerd Hoffmann --- ui/console.c | 65 +++++++++------------------------------------------------- 1 file changed, 10 insertions(+), 55 deletions(-) diff --git a/ui/console.c b/ui/console.c index e84ba8b..b641c35 100644 --- a/ui/console.c +++ b/ui/console.c @@ -213,36 +213,14 @@ static void vga_fill_rect(QemuConsole *con, uint32_t color) { DisplaySurface *surface = qemu_console_surface(con); - uint8_t *d, *d1; - int x, y, bpp; + pixman_rectangle16_t rect = { + .x = posx, .y = posy, .width = width, .height = height + }; + pixman_color_t pcolor; - bpp = surface_bytes_per_pixel(surface); - d1 = surface_data(surface) + - surface_stride(surface) * posy + bpp * posx; - for (y = 0; y < height; y++) { - d = d1; - switch(bpp) { - case 1: - for (x = 0; x < width; x++) { - *((uint8_t *)d) = color; - d++; - } - break; - case 2: - for (x = 0; x < width; x++) { - *((uint16_t *)d) = color; - d += 2; - } - break; - case 4: - for (x = 0; x < width; x++) { - *((uint32_t *)d) = color; - d += 4; - } - break; - } - d1 += surface_stride(surface); - } + pcolor = qemu_pixman_color(&surface->pf, color); + pixman_image_fill_rectangles(PIXMAN_OP_SRC, surface->image, + &pcolor, 1, &rect); } /* copy from (xs, ys) to (xd, yd) a rectangle of size (w, h) */ @@ -250,33 +228,10 @@ static void vga_bitblt(QemuConsole *con, int xs, int ys, int xd, int yd, int w, int h) { DisplaySurface *surface = qemu_console_surface(con); - const uint8_t *s; - uint8_t *d; - int wb, y, bpp; - bpp = surface_bytes_per_pixel(surface); - wb = w * bpp; - if (yd <= ys) { - s = surface_data(surface) + - surface_stride(surface) * ys + bpp * xs; - d = surface_data(surface) + - surface_stride(surface) * yd + bpp * xd; - for (y = 0; y < h; y++) { - memmove(d, s, wb); - d += surface_stride(surface); - s += surface_stride(surface); - } - } else { - s = surface_data(surface) + - surface_stride(surface) * (ys + h - 1) + bpp * xs; - d = surface_data(surface) + - surface_stride(surface) * (yd + h - 1) + bpp * xd; - for (y = 0; y < h; y++) { - memmove(d, s, wb); - d -= surface_stride(surface); - s -= surface_stride(surface); - } - } + pixman_image_composite(PIXMAN_OP_SRC, + surface->image, NULL, surface->image, + xs, ys, 0, 0, xd, yd, w, h); } /***********************************************************/