From patchwork Fri Mar 5 17:14:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 393541 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp633501jai; Fri, 5 Mar 2021 09:50:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJwi4FOdjgew3T1CTPYoP0kC+9P8P03Xl68WCNsXX+zkcP7iQoK53EBBx48H4t38AirkK/EB X-Received: by 2002:a05:6e02:1a2d:: with SMTP id g13mr10045438ile.228.1614966607355; Fri, 05 Mar 2021 09:50:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614966607; cv=none; d=google.com; s=arc-20160816; b=WsUCBskQYVtbilQ90ZpbWciT28SXwy/zaGx7ugzeZ5l5Uk6kyMYNBVIC/XfLFi554g /L4uv2eAopUeWkfZWb+2qqzz99K3v8cAoS5ed0WfoLxIldJnllKwcTI0d9sQWD6m2jJM Zc7RdfQxnMqFm2lK1YH70o1sn9h/KqK4DIJe0U48DU2ppXSxhJGkWIKcOyRT68tLWnDi Er75LCVBPiXyu3oHiTQevTSKUiXY/hRu42Q/fh9sfHKqnjeCeBGcahZW8UXRcmbOpawy wUbr8MOSUTee04S7pnxvh1ZG8yLgUbe2gbameOs68ELIUvhCs7SmpKB6cCbdvYn66V/O Iujw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=pAmuR7nxH8NHLZiwiiRo5ekrk1B9gySro43FufZvwrs=; b=IGYMm/bzVkl6EBwos/kEcq7isQMpWzl/SRY/u/wWjLvM3/Wvyse/gwvUb/FC6FTaWC myi9f6+hGoA6O/5fUYczSmksCu/YieYqS7KmRY3w3GwZSU5rjJnzahgvHYY6VZ7/9LFG 4SOc1p09zMH+zeb3msbTPv21EEDefK5UDO+jh95/xOjHN0CpqGgySoEnAYhq6PmoC8DB 5s8+qp9e5IEsfSk1vK6eGuq604+/RNQw5o2boAhMcWjAFDauQ0uP6XI9K/wOVkRGrq6q pww0bZpoI6v1p3fPv/rDMSXSfoQVD/zSuR2YTA2u6bLbG97fMg5YRmIDeJnHcFxtMVyq 5QeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="SL/agL0r"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id q4si3152964jat.34.2021.03.05.09.50.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Mar 2021 09:50:07 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="SL/agL0r"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:48130 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lIEaU-0004ll-OI for patch@linaro.org; Fri, 05 Mar 2021 12:50:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:38302) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lIE3O-0006vL-Dk for qemu-devel@nongnu.org; Fri, 05 Mar 2021 12:15:54 -0500 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]:42643) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lIE30-0007WP-MC for qemu-devel@nongnu.org; Fri, 05 Mar 2021 12:15:54 -0500 Received: by mail-wr1-x42b.google.com with SMTP id j2so2881715wrx.9 for ; Fri, 05 Mar 2021 09:15:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=pAmuR7nxH8NHLZiwiiRo5ekrk1B9gySro43FufZvwrs=; b=SL/agL0rQBWS3iHyog/1Cm3U1S+HZJrKUG2qhAIXmzcct88Z2ATsND3wS7mM8nDys0 lfJST+TdPALzKTdgSslsBS739afWoUqsritpUikcrBv1ut2rIIAnLQZD6tuZxTzhtZTU DFDfNHiuPuYD3c0e7q/1q6dFmx8cl4xhlIFXfbNNMk7sPdHrLm9bBCLqssEzjynNyH5s XYDhtQ/Lw5HOURLho89CsuEJPSckfEewgAAovITCBSW/Mfp2MitR1y8mZD4t69qAcLmw 4PFh4K2LBqMp7lh6QEGj9b2yKJhbICNP/l9c4CkYTRAp9Lu1jQV3TKEdJr9aUBE7OG7+ G07A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pAmuR7nxH8NHLZiwiiRo5ekrk1B9gySro43FufZvwrs=; b=oIHX23af19cN/gpdZKnpvHW6x2yasy87Mrf8S/mIiWP52+zg7ykoWsBYPolguKWdXm frCv4SB3jwljXtT6pviSIjelyYn5DqkA22+/N/Gb0yL/VceYQ/MnTN/MEhtTpj/7FEM+ 5XMiZQaAazVHRp+gCyJKmvNPQjXFzNnYBuuXzbGKQSrbU4h6rOauBEayceTxinesUVH7 KvhnRPtU3T08W7stPmYu07F8Aa81T025ToIB8lG8WCKex4vb7McWx82K7yH+uuLORx0J 4DlJyj+0lH9XXo/g1cWmof3+5u8qXtkz8pac9blEt8e8lI16vpth3HI9mcpB/rr9IwfB mO9A== X-Gm-Message-State: AOAM5305NizSrB1GI0tCeysEcHFEbE+gyg6tsPOpMw0k+w7ht/0lwbyi psXp2XnE35wt7K+3RF6+XSQDG+93j3KyRg== X-Received: by 2002:a05:6000:181b:: with SMTP id m27mr10650095wrh.363.1614964529332; Fri, 05 Mar 2021 09:15:29 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id m132sm5942357wmf.45.2021.03.05.09.15.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Mar 2021 09:15:29 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 16/49] hw/arm/musicpal: Remove dead code for non-32-bit-RGB surfaces Date: Fri, 5 Mar 2021 17:14:42 +0000 Message-Id: <20210305171515.1038-17-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210305171515.1038-1-peter.maydell@linaro.org> References: <20210305171515.1038-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42b; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42b.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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" For a long time now the UI layer has guaranteed that the console surface is always 32 bits per pixel RGB. Remove the legacy dead code from the milkymist display device which was handling the possibility that the console surface was some other format. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20210215103215.4944-2-peter.maydell@linaro.org --- hw/arm/musicpal.c | 64 ++++++++++++++++++----------------------------- 1 file changed, 24 insertions(+), 40 deletions(-) -- 2.20.1 diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c index 6aec84aeed8..9cebece2de0 100644 --- a/hw/arm/musicpal.c +++ b/hw/arm/musicpal.c @@ -512,53 +512,37 @@ static uint8_t scale_lcd_color(musicpal_lcd_state *s, uint8_t col) } } -#define SET_LCD_PIXEL(depth, type) \ -static inline void glue(set_lcd_pixel, depth) \ - (musicpal_lcd_state *s, int x, int y, type col) \ -{ \ - int dx, dy; \ - DisplaySurface *surface = qemu_console_surface(s->con); \ - type *pixel = &((type *) surface_data(surface))[(y * 128 * 3 + x) * 3]; \ -\ - for (dy = 0; dy < 3; dy++, pixel += 127 * 3) \ - for (dx = 0; dx < 3; dx++, pixel++) \ - *pixel = col; \ +static inline void set_lcd_pixel32(musicpal_lcd_state *s, + int x, int y, uint32_t col) +{ + int dx, dy; + DisplaySurface *surface = qemu_console_surface(s->con); + uint32_t *pixel = + &((uint32_t *) surface_data(surface))[(y * 128 * 3 + x) * 3]; + + for (dy = 0; dy < 3; dy++, pixel += 127 * 3) { + for (dx = 0; dx < 3; dx++, pixel++) { + *pixel = col; + } + } } -SET_LCD_PIXEL(8, uint8_t) -SET_LCD_PIXEL(16, uint16_t) -SET_LCD_PIXEL(32, uint32_t) static void lcd_refresh(void *opaque) { musicpal_lcd_state *s = opaque; - DisplaySurface *surface = qemu_console_surface(s->con); int x, y, col; - switch (surface_bits_per_pixel(surface)) { - case 0: - return; -#define LCD_REFRESH(depth, func) \ - case depth: \ - col = func(scale_lcd_color(s, (MP_LCD_TEXTCOLOR >> 16) & 0xff), \ - scale_lcd_color(s, (MP_LCD_TEXTCOLOR >> 8) & 0xff), \ - scale_lcd_color(s, MP_LCD_TEXTCOLOR & 0xff)); \ - for (x = 0; x < 128; x++) { \ - for (y = 0; y < 64; y++) { \ - if (s->video_ram[x + (y/8)*128] & (1 << (y % 8))) { \ - glue(set_lcd_pixel, depth)(s, x, y, col); \ - } else { \ - glue(set_lcd_pixel, depth)(s, x, y, 0); \ - } \ - } \ - } \ - break; - LCD_REFRESH(8, rgb_to_pixel8) - LCD_REFRESH(16, rgb_to_pixel16) - LCD_REFRESH(32, (is_surface_bgr(surface) ? - rgb_to_pixel32bgr : rgb_to_pixel32)) - default: - hw_error("unsupported colour depth %i\n", - surface_bits_per_pixel(surface)); + col = rgb_to_pixel32(scale_lcd_color(s, (MP_LCD_TEXTCOLOR >> 16) & 0xff), + scale_lcd_color(s, (MP_LCD_TEXTCOLOR >> 8) & 0xff), + scale_lcd_color(s, MP_LCD_TEXTCOLOR & 0xff)); + for (x = 0; x < 128; x++) { + for (y = 0; y < 64; y++) { + if (s->video_ram[x + (y / 8) * 128] & (1 << (y % 8))) { + set_lcd_pixel32(s, x, y, col); + } else { + set_lcd_pixel32(s, x, y, 0); + } + } } dpy_gfx_update(s->con, 0, 0, 128*3, 64*3);