From nobody Sat Nov 15 03:34:31 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=1589984899; cv=none; d=zohomail.com; s=zohoarc; b=WmScj5m21wxwDhtcp0J8+YxHpe+CHWlU/wad3XAnuSWiT6vVoj8xsaP/c+pgeYv6oJw0NbJD6ptIHCmHSUhO7Kj0aBcob9aQq95z2iV+Ap+uYQAgb/iC4CLkaKlQFPa4IA2GBaW+behJtGrUIYZO9p1TubGZw1Hf7GXFWuKe9AQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1589984899; 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=/ewEhEJynpf/wbKcUM21TgNNWiW1sj1s6qeCVhBTV4w=; b=B41lR2phF0HWGf764slLfT6RS9L8atiUoYXyr2RAqljL8i5kw4H9mFgX+ly0y+nnLsH+a+ZCyYOcdht1kRS/yI0DnBPWLNVjNT9Z9XOgx2RW6w3yUqRpLRLbhDJXbwt0G2HCnBtzLJV5TmgbTBT6bM5FjKDiODSgoN69Ap/Xnz8= 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 1589984899523655.1240058953856; Wed, 20 May 2020 07:28:19 -0700 (PDT) Received: from localhost ([::1]:60164 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jbPhi-0006ua-Ah for importer@patchew.org; Wed, 20 May 2020 10:28:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57134) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jbPXo-00052M-Pj for qemu-devel@nongnu.org; Wed, 20 May 2020 10:18:04 -0400 Received: from zero.eik.bme.hu ([152.66.115.2]:49756) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jbPXm-0004T2-NG for qemu-devel@nongnu.org; Wed, 20 May 2020 10:18:04 -0400 Received: from zero.eik.bme.hu (blah.eik.bme.hu [152.66.115.182]) by localhost (Postfix) with SMTP id BC8F8748DDE; Wed, 20 May 2020 16:17:49 +0200 (CEST) Received: by zero.eik.bme.hu (Postfix, from userid 432) id 38915748DC8; Wed, 20 May 2020 16:17:49 +0200 (CEST) Message-Id: <57104c20bf2838fef58623349b1c8ee7554be7b5.1589981990.git.balaton@eik.bme.hu> In-Reply-To: References: From: BALATON Zoltan Subject: [PATCH 2/6] sm501: Shorten long variable names 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" This increases readability and cleans up some confusing naming. Signed-off-by: BALATON Zoltan --- hw/display/sm501.c | 45 ++++++++++++++++++++++----------------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/hw/display/sm501.c b/hw/display/sm501.c index bd3ccfe311..f42d05e1e4 100644 --- a/hw/display/sm501.c +++ b/hw/display/sm501.c @@ -700,17 +700,16 @@ static inline void hwc_invalidate(SM501State *s, int = crt) static void sm501_2d_operation(SM501State *s) { /* obtain operation parameters */ - int operation =3D (s->twoD_control >> 16) & 0x1f; + int cmd =3D (s->twoD_control >> 16) & 0x1F; int rtl =3D s->twoD_control & 0x8000000; 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 operation_width =3D (s->twoD_dimension >> 16) & 0x1FFF; - int operation_height =3D s->twoD_dimension & 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_flags =3D (s->twoD_stretch >> 20) & 0x3; - int addressing =3D (s->twoD_stretch >> 16) & 0xF; + 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; @@ -721,12 +720,12 @@ static void sm501_2d_operation(SM501State *s) /* get frame buffer info */ uint8_t *src =3D s->local_mem + src_base; uint8_t *dst =3D s->local_mem + dst_base; - int src_width =3D s->twoD_pitch & 0x1FFF; - int dst_width =3D (s->twoD_pitch >> 16) & 0x1FFF; + 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= ); =20 - if (addressing !=3D 0x0) { + if ((s->twoD_stretch >> 16) & 0xF) { qemu_log_mask(LOG_UNIMP, "sm501: only XY addressing is supported.\= n"); return; } @@ -758,20 +757,20 @@ static void sm501_2d_operation(SM501State *s) return; } =20 - switch (operation) { + switch (cmd) { case 0x00: /* copy area */ #define COPY_AREA(_bpp, _pixel_type, rtl) { = \ int y, x, index_d, index_s; = \ - for (y =3D 0; y < operation_height; y++) { = \ - for (x =3D 0; x < operation_width; x++) { = \ + for (y =3D 0; y < height; y++) { \ + for (x =3D 0; x < width; x++) { \ _pixel_type val; = \ = \ if (rtl) { = \ - index_s =3D ((src_y - y) * src_width + src_x - x) * _b= pp; \ - index_d =3D ((dst_y - y) * dst_width + dst_x - x) * _b= pp; \ + index_s =3D ((src_y - y) * src_pitch + src_x - x) * _b= pp; \ + index_d =3D ((dst_y - y) * dst_pitch + dst_x - x) * _b= pp; \ } else { = \ - index_s =3D ((src_y + y) * src_width + src_x + x) * _b= pp; \ - index_d =3D ((dst_y + y) * dst_width + dst_x + x) * _b= pp; \ + index_s =3D ((src_y + y) * src_pitch + src_x + x) * _b= pp; \ + index_d =3D ((dst_y + y) * dst_pitch + dst_x + x) * _b= pp; \ } = \ if (rop_mode =3D=3D 1 && rop =3D=3D 5) { = \ /* Invert dest */ = \ @@ -783,7 +782,7 @@ static void sm501_2d_operation(SM501State *s) } = \ } = \ } - switch (format_flags) { + switch (format) { case 0: COPY_AREA(1, uint8_t, rtl); break; @@ -799,15 +798,15 @@ static void sm501_2d_operation(SM501State *s) case 0x01: /* fill rectangle */ #define FILL_RECT(_bpp, _pixel_type) { = \ int y, x; = \ - for (y =3D 0; y < operation_height; y++) { = \ - for (x =3D 0; x < operation_width; x++) { = \ - int index =3D ((dst_y + y) * dst_width + dst_x + x) * _bpp= ; \ + for (y =3D 0; y < height; y++) { \ + for (x =3D 0; x < width; x++) { \ + int index =3D ((dst_y + y) * dst_pitch + dst_x + x) * _bpp= ; \ *(_pixel_type *)&dst[index] =3D (_pixel_type)color; = \ } = \ } = \ } =20 - switch (format_flags) { + switch (format) { case 0: FILL_RECT(1, uint8_t); break; @@ -824,14 +823,14 @@ static void sm501_2d_operation(SM501State *s) =20 default: qemu_log_mask(LOG_UNIMP, "sm501: not implemented 2D operation: %d\= n", - operation); + cmd); return; } =20 if (dst_base >=3D get_fb_addr(s, crt) && dst_base <=3D get_fb_addr(s, crt) + fb_len) { - int dst_len =3D MIN(fb_len, ((dst_y + operation_height - 1) * dst_= width + - dst_x + operation_width) * (1 << format_flags)); + int dst_len =3D MIN(fb_len, ((dst_y + height - 1) * dst_pitch + + dst_x + width) * (1 << format)); if (dst_len) { memory_region_set_dirty(&s->local_mem_region, dst_base, dst_le= n); } --=20 2.21.3