From nobody Wed Nov 19 00:14:01 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1613385301877517.3075555229351; Mon, 15 Feb 2021 02:35:01 -0800 (PST) Received: from localhost ([::1]:33756 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lBbDY-0006Z8-Qk for importer@patchew.org; Mon, 15 Feb 2021 05:35:00 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:50104) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lBbB6-0004Lm-PE for qemu-devel@nongnu.org; Mon, 15 Feb 2021 05:32:28 -0500 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]:42507) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lBbAz-0001i0-G8 for qemu-devel@nongnu.org; Mon, 15 Feb 2021 05:32:28 -0500 Received: by mail-wr1-x432.google.com with SMTP id r21so8219134wrr.9 for ; Mon, 15 Feb 2021 02:32:20 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id 36sm25196300wrj.97.2021.02.15.02.32.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Feb 2021 02:32:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8Pn0+fUrgN1cOJcpBnEN8VL4IjMtADYNe+/RkpTUxHU=; b=r5trOF4xH7tJBTDZ4+nVU57V0qVY5k0jgPOn+V34UGgaOIWA1ec6z3k4c1Txa9HIIk Yb5s0ANl6Xolqt+A9f8kzTTI/lCVY5OXv9dvawjLxo92YY5LRDcAS3CWEQUygUg60pI1 8PSOkg+bRUqO0T1fgl6N3WXnuRfUCqO3hm8s/l77HnplUkQOVdMIwwE7bwcnStb+oit4 Vj+Uxb2XAQJfN2qp1XeEhc3G990pi8Gz3TnYS27jVg8S4wapUUosVlWF5LCMMt0bO3Qi QtuqO8nk7BbJ00tfmhjIu6rh96uDRiJvwK1eroklgU/ySE9U5UKCtK19HusMytBJ69FP E4tA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8Pn0+fUrgN1cOJcpBnEN8VL4IjMtADYNe+/RkpTUxHU=; b=nj4QCKaSTu6Pi+8kSS7FB9sbinP5yutx+npgzFQplvOANhh4SjOlIQZJHVh+QIHdCa WEPUXXRNEvd6sj8JbTxNplV0QG34Xiv67IMeJbdW0VbOKw8zBkl1l/rcrJSghS4kPO0W E90xcMhIeM2irZJegsLKK12yotExdxBnFeIL+1jhN4SUVIqVWZ95JnXix018lekEmsZX DGvZu9z/M5NJszlNw/AVZZIozzQWn+fw2VVeuG9uGxdloLq8RTnoW1kmW7eVb7SDYMVi 8cUNAlHmI1UAUsC5UK4NlEEzOfl3jqXw8BI9m/wHcnnkMjTH3FgQNtVm/ymSvZh9rSmz +Y9g== X-Gm-Message-State: AOAM533z6E60+l7vtj09Q4Eg2vF2T837stDDgsjP1MYc2GAepCXeq62X TgmWtMRb7jCTwB2E475QHk3kAZAaEEiRxQ== X-Google-Smtp-Source: ABdhPJzmhcWnFYLRSkUqIeo7H7hE4kJ5Efdn/KTEdPycbCM5GH3Wxfbn10dzr6zozOmVA41DuExnZg== X-Received: by 2002:a5d:5705:: with SMTP id a5mr14769676wrv.333.1613385140064; Mon, 15 Feb 2021 02:32:20 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 3/9] hw/display/tc6393xb: Expand out macros in template header Date: Mon, 15 Feb 2021 10:32:09 +0000 Message-Id: <20210215103215.4944-4-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210215103215.4944-1-peter.maydell@linaro.org> References: <20210215103215.4944-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::432; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x432.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" Now the template header is included only for BITS=3D=3D32, expand out all the macros that depended on the BITS setting. Signed-off-by: Peter Maydell --- hw/display/tc6393xb_template.h | 35 ++++------------------------------ 1 file changed, 4 insertions(+), 31 deletions(-) diff --git a/hw/display/tc6393xb_template.h b/hw/display/tc6393xb_template.h index 78629c07f97..7789ffc4399 100644 --- a/hw/display/tc6393xb_template.h +++ b/hw/display/tc6393xb_template.h @@ -21,25 +21,7 @@ * with this program; if not, see . */ =20 -#if BITS =3D=3D 8 -# define SET_PIXEL(addr, color) (*(uint8_t *)addr =3D color) -#elif BITS =3D=3D 15 || BITS =3D=3D 16 -# define SET_PIXEL(addr, color) (*(uint16_t *)addr =3D color) -#elif BITS =3D=3D 24 -# define SET_PIXEL(addr, color) \ - do { \ - addr[0] =3D color; \ - addr[1] =3D (color) >> 8; \ - addr[2] =3D (color) >> 16; \ - } while (0) -#elif BITS =3D=3D 32 -# define SET_PIXEL(addr, color) (*(uint32_t *)addr =3D color) -#else -# error unknown bit depth -#endif - - -static void glue(tc6393xb_draw_graphic, BITS)(TC6393xbState *s) +static void tc6393xb_draw_graphic32(TC6393xbState *s) { DisplaySurface *surface =3D qemu_console_surface(s->con); int i; @@ -49,24 +31,15 @@ static void glue(tc6393xb_draw_graphic, BITS)(TC6393xbS= tate *s) data_buffer =3D s->vram_ptr; data_display =3D surface_data(surface); for(i =3D 0; i < s->scr_height; i++) { -#if (BITS =3D=3D 16) - memcpy(data_display, data_buffer, s->scr_width * 2); - data_buffer +=3D s->scr_width; - data_display +=3D surface_stride(surface); -#else int j; - for (j =3D 0; j < s->scr_width; j++, data_display +=3D BITS / 8, d= ata_buffer++) { + for (j =3D 0; j < s->scr_width; j++, data_display +=3D 4, data_buf= fer++) { uint16_t color =3D *data_buffer; - uint32_t dest_color =3D glue(rgb_to_pixel, BITS)( + uint32_t dest_color =3D rgb_to_pixel32( ((color & 0xf800) * 0x108) >> 11, ((color & 0x7e0) * 0x41) >> 9, ((color & 0x1f) * 0x21) >> 2 ); - SET_PIXEL(data_display, dest_color); + *(uint32_t *)data_display =3D dest_color; } -#endif } } - -#undef BITS -#undef SET_PIXEL --=20 2.20.1