From nobody Wed Nov 19 00:13:59 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 ARC-Seal: i=1; a=rsa-sha256; t=1613385413; cv=none; d=zohomail.com; s=zohoarc; b=U4GwLUoCkmSIkmRIXSJ1vEulTbTgX3bLZXg2Z7l45EjGkGu1wW/Vm7oHdAD45XIi3O0JbhtFB7gkCaYNh5SL0vTxs0bRhoLmZQ1ZzEe4ue9dHCOYdcGNVjVJY/quckUPcPc/9cMYFya+YksyIeNXkWKxIjpWZVBEviuv+FMS3NM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613385413; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Cx3fiU7zu1QDtVZpKIEUVyibRzjoCZZNp5x6BZT/qW4=; b=Bdqx/WNsUd256i8uUdghbQQpPLVXWCnt/+38Fz6epHVOjhXvfPwuqUarRvNVTmyAhSPjssVPlshhBqYp7G4zSkiXPLCG1kB0FAwoPoIe7imxbVn6l5k613x51YE/9H8DohQScllWeohwNvTDwy7B1t8rQJc/B//DmU83eyBKYwo= ARC-Authentication-Results: i=1; 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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1613385412963621.4746104802349; Mon, 15 Feb 2021 02:36:52 -0800 (PST) Received: from localhost ([::1]:39386 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lBbFL-0000dv-SU for importer@patchew.org; Mon, 15 Feb 2021 05:36:51 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:50224) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lBbBA-0004To-Gu for qemu-devel@nongnu.org; Mon, 15 Feb 2021 05:32:32 -0500 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]:39397) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lBbB3-0001jC-0s for qemu-devel@nongnu.org; Mon, 15 Feb 2021 05:32:32 -0500 Received: by mail-wr1-x431.google.com with SMTP id v1so8243700wrd.6 for ; Mon, 15 Feb 2021 02:32:24 -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.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Feb 2021 02:32:23 -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=Cx3fiU7zu1QDtVZpKIEUVyibRzjoCZZNp5x6BZT/qW4=; b=NIvl9vfy+TFDAsLhU36L74hmZHLJQas2gyRDUvqSyKVu9KDSJWYkLK2khMJovCmRHj cmMuzmO3SNIxlMaUVV8B2/Yt/k81vL0D/llLGk7V1NsgQMvQ1XVkJgKXmARCT5R+i5Rh lCHOj4xJKFMhHzMmwbuP/3Hi/cwaNISxXb7xIlR5WbmHxaX1F7t/tgVFmNDzWDVOhx2y NEac/8RGKMbhpe/eMQLEX2gh3W3phd5jn+VZ/AKJduNldrLR83015sA0h4fEeNQv8DEQ hW88La1ll7qnqwdLR08RObROGivkzYSLgd8UpEb4CsfKm7VwsXe5vGvhY87GVbyoi7Zm iD7g== 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=Cx3fiU7zu1QDtVZpKIEUVyibRzjoCZZNp5x6BZT/qW4=; b=jy+IzzjVjyMOkVYRHFMpc9QYiI5NR5P16EQTZdKlm32Byivz+E64bd9isqNeCJlJOo Zf4wC5W5UsGZaoE96YHDqBZHHDFm++ZxV6gDvfynb9lS+6UiZLUntTInVvgPxzWH7qzy SAyc8tMJz7D6VxhAbD+05AkZru/6IXfBafeWBja4z/M26+zoFBBbouiKT6O6x4ruDhap gtVz4rfjo0yVNZh7HOszYp2wwJ08u2H73yk23WMiOIiraJhY7Z9CEFamRNNXGT9JR5Ir O9g+9JTBjvdAlFYpuy1uOrW8Bg7mmLJf6Ss3uuV7jFDKKW2pc2Z8Me4EAYRXP6LtQVGG Lbjg== X-Gm-Message-State: AOAM533CogSeEq3iKhrUfz/FH8yZ3hLribIxIkN8+KNZMy8Z04uNy47O mVrpifezcP0RwEJEjA6wY/nWJg== X-Google-Smtp-Source: ABdhPJzVDRwlY3m+3wzrPvCD92pgcEfiK3cH47CjWzrOjr6GIET6x14VFxekjIVn5JcQ6HVA2FjCLQ== X-Received: by 2002:adf:d4d0:: with SMTP id w16mr17953789wrk.262.1613385143780; Mon, 15 Feb 2021 02:32:23 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 8/9] hw/display/omap_lcdc: Inline template header into C file Date: Mon, 15 Feb 2021 10:32:14 +0000 Message-Id: <20210215103215.4944-9-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::431; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x431.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=ham 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" We only include the template header once, so just inline it into the source file for the device. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/display/omap_lcd_template.h | 154 --------------------------------- hw/display/omap_lcdc.c | 127 ++++++++++++++++++++++++++- 2 files changed, 125 insertions(+), 156 deletions(-) delete mode 100644 hw/display/omap_lcd_template.h diff --git a/hw/display/omap_lcd_template.h b/hw/display/omap_lcd_template.h deleted file mode 100644 index a2f86eee3c8..00000000000 --- a/hw/display/omap_lcd_template.h +++ /dev/null @@ -1,154 +0,0 @@ -/* - * QEMU OMAP LCD Emulator templates - * - * Copyright (c) 2006 Andrzej Zaborowski - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * 2-bit colour - */ -static void draw_line2_32(void *opaque, uint8_t *d, const uint8_t *s, - int width, int deststep) -{ - uint16_t *pal =3D opaque; - uint8_t v, r, g, b; - - do { - v =3D ldub_p((void *) s); - r =3D (pal[v & 3] >> 4) & 0xf0; - g =3D pal[v & 3] & 0xf0; - b =3D (pal[v & 3] << 4) & 0xf0; - ((uint32_t *) d)[0] =3D rgb_to_pixel32(r, g, b); - d +=3D 4; - v >>=3D 2; - r =3D (pal[v & 3] >> 4) & 0xf0; - g =3D pal[v & 3] & 0xf0; - b =3D (pal[v & 3] << 4) & 0xf0; - ((uint32_t *) d)[0] =3D rgb_to_pixel32(r, g, b); - d +=3D 4; - v >>=3D 2; - r =3D (pal[v & 3] >> 4) & 0xf0; - g =3D pal[v & 3] & 0xf0; - b =3D (pal[v & 3] << 4) & 0xf0; - ((uint32_t *) d)[0] =3D rgb_to_pixel32(r, g, b); - d +=3D 4; - v >>=3D 2; - r =3D (pal[v & 3] >> 4) & 0xf0; - g =3D pal[v & 3] & 0xf0; - b =3D (pal[v & 3] << 4) & 0xf0; - ((uint32_t *) d)[0] =3D rgb_to_pixel32(r, g, b); - d +=3D 4; - s++; - width -=3D 4; - } while (width > 0); -} - -/* - * 4-bit colour - */ -static void draw_line4_32(void *opaque, uint8_t *d, const uint8_t *s, - int width, int deststep) -{ - uint16_t *pal =3D opaque; - uint8_t v, r, g, b; - - do { - v =3D ldub_p((void *) s); - r =3D (pal[v & 0xf] >> 4) & 0xf0; - g =3D pal[v & 0xf] & 0xf0; - b =3D (pal[v & 0xf] << 4) & 0xf0; - ((uint32_t *) d)[0] =3D rgb_to_pixel32(r, g, b); - d +=3D 4; - v >>=3D 4; - r =3D (pal[v & 0xf] >> 4) & 0xf0; - g =3D pal[v & 0xf] & 0xf0; - b =3D (pal[v & 0xf] << 4) & 0xf0; - ((uint32_t *) d)[0] =3D rgb_to_pixel32(r, g, b); - d +=3D 4; - s++; - width -=3D 2; - } while (width > 0); -} - -/* - * 8-bit colour - */ -static void draw_line8_32(void *opaque, uint8_t *d, const uint8_t *s, - int width, int deststep) -{ - uint16_t *pal =3D opaque; - uint8_t v, r, g, b; - - do { - v =3D ldub_p((void *) s); - r =3D (pal[v] >> 4) & 0xf0; - g =3D pal[v] & 0xf0; - b =3D (pal[v] << 4) & 0xf0; - ((uint32_t *) d)[0] =3D rgb_to_pixel32(r, g, b); - s++; - d +=3D 4; - } while (-- width !=3D 0); -} - -/* - * 12-bit colour - */ -static void draw_line12_32(void *opaque, uint8_t *d, const uint8_t *s, - int width, int deststep) -{ - uint16_t v; - uint8_t r, g, b; - - do { - v =3D lduw_le_p((void *) s); - r =3D (v >> 4) & 0xf0; - g =3D v & 0xf0; - b =3D (v << 4) & 0xf0; - ((uint32_t *) d)[0] =3D rgb_to_pixel32(r, g, b); - s +=3D 2; - d +=3D 4; - } while (-- width !=3D 0); -} - -/* - * 16-bit colour - */ -static void draw_line16_32(void *opaque, uint8_t *d, const uint8_t *s, - int width, int deststep) -{ - uint16_t v; - uint8_t r, g, b; - - do { - v =3D lduw_le_p((void *) s); - r =3D (v >> 8) & 0xf8; - g =3D (v >> 3) & 0xfc; - b =3D (v << 3) & 0xf8; - ((uint32_t *) d)[0] =3D rgb_to_pixel32(r, g, b); - s +=3D 2; - d +=3D 4; - } while (-- width !=3D 0); -} diff --git a/hw/display/omap_lcdc.c b/hw/display/omap_lcdc.c index 58e659c94ff..2db04fad2fc 100644 --- a/hw/display/omap_lcdc.c +++ b/hw/display/omap_lcdc.c @@ -72,8 +72,131 @@ static void omap_lcd_interrupts(struct omap_lcd_panel_s= *s) =20 #define draw_line_func drawfn =20 -#define DEPTH 32 -#include "omap_lcd_template.h" +/* + * 2-bit colour + */ +static void draw_line2_32(void *opaque, uint8_t *d, const uint8_t *s, + int width, int deststep) +{ + uint16_t *pal =3D opaque; + uint8_t v, r, g, b; + + do { + v =3D ldub_p((void *) s); + r =3D (pal[v & 3] >> 4) & 0xf0; + g =3D pal[v & 3] & 0xf0; + b =3D (pal[v & 3] << 4) & 0xf0; + ((uint32_t *) d)[0] =3D rgb_to_pixel32(r, g, b); + d +=3D 4; + v >>=3D 2; + r =3D (pal[v & 3] >> 4) & 0xf0; + g =3D pal[v & 3] & 0xf0; + b =3D (pal[v & 3] << 4) & 0xf0; + ((uint32_t *) d)[0] =3D rgb_to_pixel32(r, g, b); + d +=3D 4; + v >>=3D 2; + r =3D (pal[v & 3] >> 4) & 0xf0; + g =3D pal[v & 3] & 0xf0; + b =3D (pal[v & 3] << 4) & 0xf0; + ((uint32_t *) d)[0] =3D rgb_to_pixel32(r, g, b); + d +=3D 4; + v >>=3D 2; + r =3D (pal[v & 3] >> 4) & 0xf0; + g =3D pal[v & 3] & 0xf0; + b =3D (pal[v & 3] << 4) & 0xf0; + ((uint32_t *) d)[0] =3D rgb_to_pixel32(r, g, b); + d +=3D 4; + s++; + width -=3D 4; + } while (width > 0); +} + +/* + * 4-bit colour + */ +static void draw_line4_32(void *opaque, uint8_t *d, const uint8_t *s, + int width, int deststep) +{ + uint16_t *pal =3D opaque; + uint8_t v, r, g, b; + + do { + v =3D ldub_p((void *) s); + r =3D (pal[v & 0xf] >> 4) & 0xf0; + g =3D pal[v & 0xf] & 0xf0; + b =3D (pal[v & 0xf] << 4) & 0xf0; + ((uint32_t *) d)[0] =3D rgb_to_pixel32(r, g, b); + d +=3D 4; + v >>=3D 4; + r =3D (pal[v & 0xf] >> 4) & 0xf0; + g =3D pal[v & 0xf] & 0xf0; + b =3D (pal[v & 0xf] << 4) & 0xf0; + ((uint32_t *) d)[0] =3D rgb_to_pixel32(r, g, b); + d +=3D 4; + s++; + width -=3D 2; + } while (width > 0); +} + +/* + * 8-bit colour + */ +static void draw_line8_32(void *opaque, uint8_t *d, const uint8_t *s, + int width, int deststep) +{ + uint16_t *pal =3D opaque; + uint8_t v, r, g, b; + + do { + v =3D ldub_p((void *) s); + r =3D (pal[v] >> 4) & 0xf0; + g =3D pal[v] & 0xf0; + b =3D (pal[v] << 4) & 0xf0; + ((uint32_t *) d)[0] =3D rgb_to_pixel32(r, g, b); + s++; + d +=3D 4; + } while (-- width !=3D 0); +} + +/* + * 12-bit colour + */ +static void draw_line12_32(void *opaque, uint8_t *d, const uint8_t *s, + int width, int deststep) +{ + uint16_t v; + uint8_t r, g, b; + + do { + v =3D lduw_le_p((void *) s); + r =3D (v >> 4) & 0xf0; + g =3D v & 0xf0; + b =3D (v << 4) & 0xf0; + ((uint32_t *) d)[0] =3D rgb_to_pixel32(r, g, b); + s +=3D 2; + d +=3D 4; + } while (-- width !=3D 0); +} + +/* + * 16-bit colour + */ +static void draw_line16_32(void *opaque, uint8_t *d, const uint8_t *s, + int width, int deststep) +{ + uint16_t v; + uint8_t r, g, b; + + do { + v =3D lduw_le_p((void *) s); + r =3D (v >> 8) & 0xf8; + g =3D (v >> 3) & 0xfc; + b =3D (v << 3) & 0xf8; + ((uint32_t *) d)[0] =3D rgb_to_pixel32(r, g, b); + s +=3D 2; + d +=3D 4; + } while (-- width !=3D 0); +} =20 static void omap_update_display(void *opaque) { --=20 2.20.1