From nobody Fri Nov 14 20:44:36 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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 ARC-Seal: i=1; a=rsa-sha256; t=1589984593; cv=none; d=zohomail.com; s=zohoarc; b=PiWvSFHUN7Q59NXc5tlnYvHRUELWRDW3SpY6IZfO+tAx3ehevtOUQ++rEgPu5+Bl2EP6MRpKiuOvzXw1GuiLpJBQXP5/4xEgVW6t2T1XIO1/dWZupbt4Se0e4UDHe7xtEspaV5sNDsIKAk188Sn9wdcllKfByNFtB02rWcWRAcU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1589984593; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=yIAYXfCN5IeCxzhKmjF0tYnopRMC2mkht2U88lpV95k=; b=GphkOYhnLFSLuoPXz8KAQ5+Qt5czCRd+yi3AeFLElhwDAGNZFuq5Z5q4Dkuhf6+7B8jCpmOUL9dV0k4KkuNwLRPfL5OTZiLmo7iIxqSp0EcUWva2ca6msQkjGOUkC4rPTcQM/XfygUY41JAL30nMQInJfH1GxBKcUbz3NGn4axI= ARC-Authentication-Results: i=1; mx.zohomail.com; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1589984593442600.7155559834587; Wed, 20 May 2020 07:23:13 -0700 (PDT) Received: from localhost ([::1]:39816 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jbPcm-0006Ek-4W for importer@patchew.org; Wed, 20 May 2020 10:23:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57116) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jbPXm-0004vk-Co for qemu-devel@nongnu.org; Wed, 20 May 2020 10:18:02 -0400 Received: from zero.eik.bme.hu ([152.66.115.2]:49721) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jbPXk-0004Pv-Al for qemu-devel@nongnu.org; Wed, 20 May 2020 10:18:01 -0400 Received: from zero.eik.bme.hu (blah.eik.bme.hu [152.66.115.182]) by localhost (Postfix) with SMTP id 882B2748DD1; Wed, 20 May 2020 16:17:49 +0200 (CEST) Received: by zero.eik.bme.hu (Postfix, from userid 432) id 408FD748DD8; Wed, 20 May 2020 16:17:49 +0200 (CEST) Message-Id: In-Reply-To: References: From: BALATON Zoltan Subject: [PATCH 4/6] sm501: Clean up local variables in sm501_2d_operation Date: Wed, 20 May 2020 15:39:50 +0200 To: qemu-devel@nongnu.org X-Spam-Probability: 8% 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=152.66.115.2; envelope-from=balaton@eik.bme.hu; helo=zero.eik.bme.hu X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/20 10:17:49 X-ACL-Warn: Detected OS = FreeBSD 9.x or newer [fuzzy] X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN 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: Peter Maydell , Sebastian Bauer , Magnus Damm , Gerd Hoffmann , Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Make variables local to the block they are used in to make it clearer which operation they are needed for. Signed-off-by: BALATON Zoltan Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/display/sm501.c | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/hw/display/sm501.c b/hw/display/sm501.c index 97660090bb..5ed57703d8 100644 --- a/hw/display/sm501.c +++ b/hw/display/sm501.c @@ -699,28 +699,19 @@ static inline void hwc_invalidate(SM501State *s, int = crt) =20 static void sm501_2d_operation(SM501State *s) { - /* obtain operation parameters */ int cmd =3D (s->twoD_control >> 16) & 0x1F; int rtl =3D s->twoD_control & BIT(27); - int src_x =3D (s->twoD_source >> 16) & 0x01FFF; - int src_y =3D s->twoD_source & 0xFFFF; - int dst_x =3D (s->twoD_destination >> 16) & 0x01FFF; - int dst_y =3D s->twoD_destination & 0xFFFF; - int width =3D (s->twoD_dimension >> 16) & 0x1FFF; - int height =3D s->twoD_dimension & 0xFFFF; - uint32_t color =3D s->twoD_foreground; int format =3D (s->twoD_stretch >> 20) & 0x3; int rop_mode =3D (s->twoD_control >> 15) & 0x1; /* 1 for rop2, else ro= p3 */ /* 1 if rop2 source is the pattern, otherwise the source is the bitmap= */ int rop2_source_is_pattern =3D (s->twoD_control >> 14) & 0x1; int rop =3D s->twoD_control & 0xFF; - uint32_t src_base =3D s->twoD_source_base & 0x03FFFFFF; + int dst_x =3D (s->twoD_destination >> 16) & 0x01FFF; + int dst_y =3D s->twoD_destination & 0xFFFF; + int width =3D (s->twoD_dimension >> 16) & 0x1FFF; + int height =3D s->twoD_dimension & 0xFFFF; uint32_t dst_base =3D s->twoD_destination_base & 0x03FFFFFF; - - /* get frame buffer info */ - uint8_t *src =3D s->local_mem + src_base; uint8_t *dst =3D s->local_mem + dst_base; - int src_pitch =3D s->twoD_pitch & 0x1FFF; int dst_pitch =3D (s->twoD_pitch >> 16) & 0x1FFF; int crt =3D (s->dc_crt_control & SM501_DC_CRT_CONTROL_SEL) ? 1 : 0; int fb_len =3D get_width(s, crt) * get_height(s, crt) * get_bpp(s, crt= ); @@ -758,6 +749,13 @@ static void sm501_2d_operation(SM501State *s) =20 switch (cmd) { case 0x00: /* copy area */ + { + int src_x =3D (s->twoD_source >> 16) & 0x01FFF; + int src_y =3D s->twoD_source & 0xFFFF; + uint32_t src_base =3D s->twoD_source_base & 0x03FFFFFF; + uint8_t *src =3D s->local_mem + src_base; + int src_pitch =3D s->twoD_pitch & 0x1FFF; + #define COPY_AREA(_bpp, _pixel_type, rtl) { = \ int y, x, index_d, index_s; = \ for (y =3D 0; y < height; y++) { \ @@ -793,8 +791,11 @@ static void sm501_2d_operation(SM501State *s) break; } break; - + } case 0x01: /* fill rectangle */ + { + uint32_t color =3D s->twoD_foreground; + #define FILL_RECT(_bpp, _pixel_type) { = \ int y, x; = \ for (y =3D 0; y < height; y++) { \ @@ -819,7 +820,7 @@ static void sm501_2d_operation(SM501State *s) break; } break; - + } default: qemu_log_mask(LOG_UNIMP, "sm501: not implemented 2D operation: %d\= n", cmd); --=20 2.21.3