From patchwork Wed May 4 14:15:51 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 9014481 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 15BD59F1C1 for ; Wed, 4 May 2016 14:17:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2EDCE203AB for ; Wed, 4 May 2016 14:17:15 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1CA0D203A0 for ; Wed, 4 May 2016 14:17:14 +0000 (UTC) Received: from localhost ([::1]:48195 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1axxby-0007sc-2n for patchwork-qemu-devel@patchwork.kernel.org; Wed, 04 May 2016 10:17:10 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54155) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1axxbe-0007WL-11 for qemu-devel@nongnu.org; Wed, 04 May 2016 10:16:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1axxbS-00073F-02 for qemu-devel@nongnu.org; Wed, 04 May 2016 10:16:44 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:56723) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1axxb8-0006uU-Lh; Wed, 04 May 2016 10:16:18 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.84_2) (envelope-from ) id 1axxaj-0007ON-R4; Wed, 04 May 2016 15:15:53 +0100 From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Wed, 4 May 2016 15:15:51 +0100 Message-Id: <1462371352-21498-2-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1462371352-21498-1-git-send-email-peter.maydell@linaro.org> References: <1462371352-21498-1-git-send-email-peter.maydell@linaro.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:8b0:1d0::2 Subject: [Qemu-devel] [PATCH 1/2] hw/display/blizzard: Expand out macros 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: Gerd Hoffmann , Pooja Dhannawat , patches@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Now that we can assume that only depth 32 is possible, there's no need for the COPY_PIXEL1 and PIXEL_TYPE macros, and the SKIP_PIXEL, COPY_PIXEL and SWAP_WORDS macros aren't used at all. Expand out COPY_PIXEL1 and PIXEL_TYPE where they are used, delete the unused macro definitions, and expand out the uses of glue(name_prefix, DEPTH). Signed-off-by: Peter Maydell Reviewed-by: Eric Blake --- hw/display/blizzard_template.h | 55 +++++++++++++----------------------------- 1 file changed, 17 insertions(+), 38 deletions(-) diff --git a/hw/display/blizzard_template.h b/hw/display/blizzard_template.h index bc38d7a..ed96092 100644 --- a/hw/display/blizzard_template.h +++ b/hw/display/blizzard_template.h @@ -18,21 +18,8 @@ * with this program; if not, see . */ -#define SKIP_PIXEL(to) (to += deststep) -#if DEPTH == 32 -# define PIXEL_TYPE uint32_t -# define COPY_PIXEL(to, from) do { *to = from; SKIP_PIXEL(to); } while (0) -# define COPY_PIXEL1(to, from) (*to++ = from) -#else -# error unknown bit depth -#endif - -#ifdef HOST_WORDS_BIGENDIAN -# define SWAP_WORDS 1 -#endif - -static void glue(blizzard_draw_line16_, DEPTH)(PIXEL_TYPE *dest, - const uint16_t *src, unsigned int width) +static void blizzard_draw_line16_32(uint32_t *dest, + const uint16_t *src, unsigned int width) { uint16_t data; unsigned int r, g, b; @@ -45,12 +32,12 @@ static void glue(blizzard_draw_line16_, DEPTH)(PIXEL_TYPE *dest, data >>= 6; r = (data & 0x1f) << 3; data >>= 5; - COPY_PIXEL1(dest, glue(rgb_to_pixel, DEPTH)(r, g, b)); + *dest++ = rgb_to_pixel32(r, g, b); } } -static void glue(blizzard_draw_line24mode1_, DEPTH)(PIXEL_TYPE *dest, - const uint8_t *src, unsigned int width) +static void blizzard_draw_line24mode1_32(uint32_t *dest, + const uint8_t *src, unsigned int width) { /* TODO: check if SDL 24-bit planes are not in the same format and * if so, use memcpy */ @@ -61,15 +48,15 @@ static void glue(blizzard_draw_line24mode1_, DEPTH)(PIXEL_TYPE *dest, r[0] = *src ++; r[1] = *src ++; b[0] = *src ++; - COPY_PIXEL1(dest, glue(rgb_to_pixel, DEPTH)(r[0], g[0], b[0])); + *dest++ = rgb_to_pixel32(r[0], g[0], b[0]); b[1] = *src ++; g[1] = *src ++; - COPY_PIXEL1(dest, glue(rgb_to_pixel, DEPTH)(r[1], g[1], b[1])); + *dest++ = rgb_to_pixel32(r[1], g[1], b[1]); } } -static void glue(blizzard_draw_line24mode2_, DEPTH)(PIXEL_TYPE *dest, - const uint8_t *src, unsigned int width) +static void blizzard_draw_line24mode2_32(uint32_t *dest, + const uint8_t *src, unsigned int width) { unsigned int r, g, b; const uint8_t *end = src + width; @@ -78,24 +65,24 @@ static void glue(blizzard_draw_line24mode2_, DEPTH)(PIXEL_TYPE *dest, src ++; b = *src ++; g = *src ++; - COPY_PIXEL1(dest, glue(rgb_to_pixel, DEPTH)(r, g, b)); + *dest++ = rgb_to_pixel32(r, g, b); } } /* No rotation */ -static blizzard_fn_t glue(blizzard_draw_fn_, DEPTH)[0x10] = { +static blizzard_fn_t blizzard_draw_fn_32[0x10] = { NULL, /* RGB 5:6:5*/ - (blizzard_fn_t) glue(blizzard_draw_line16_, DEPTH), + (blizzard_fn_t) blizzard_draw_line16_32, /* RGB 6:6:6 mode 1 */ - (blizzard_fn_t) glue(blizzard_draw_line24mode1_, DEPTH), + (blizzard_fn_t) blizzard_draw_line24mode1_32, /* RGB 8:8:8 mode 1 */ - (blizzard_fn_t) glue(blizzard_draw_line24mode1_, DEPTH), + (blizzard_fn_t) blizzard_draw_line24mode1_32, NULL, NULL, /* RGB 6:6:6 mode 2 */ - (blizzard_fn_t) glue(blizzard_draw_line24mode2_, DEPTH), + (blizzard_fn_t) blizzard_draw_line24mode2_32, /* RGB 8:8:8 mode 2 */ - (blizzard_fn_t) glue(blizzard_draw_line24mode2_, DEPTH), + (blizzard_fn_t) blizzard_draw_line24mode2_32, /* YUV 4:2:2 */ NULL, /* YUV 4:2:0 */ @@ -104,15 +91,7 @@ static blizzard_fn_t glue(blizzard_draw_fn_, DEPTH)[0x10] = { }; /* 90deg, 180deg and 270deg rotation */ -static blizzard_fn_t glue(blizzard_draw_fn_r_, DEPTH)[0x10] = { +static blizzard_fn_t blizzard_draw_fn_r_32[0x10] = { /* TODO */ [0 ... 0xf] = NULL, }; - -#undef DEPTH -#undef SKIP_PIXEL -#undef COPY_PIXEL -#undef COPY_PIXEL1 -#undef PIXEL_TYPE - -#undef SWAP_WORDS