From patchwork Mon Feb 27 12:57:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 1748705 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=Fl5Fxd6k; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PQLF86Bv6z1yX2 for ; Mon, 27 Feb 2023 23:59:56 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pWd5E-0003qY-9s; Mon, 27 Feb 2023 07:58:24 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pWd50-0003jv-WA; Mon, 27 Feb 2023 07:58:11 -0500 Received: from mail-ed1-x52c.google.com ([2a00:1450:4864:20::52c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pWd4z-00070Z-2e; Mon, 27 Feb 2023 07:58:10 -0500 Received: by mail-ed1-x52c.google.com with SMTP id o15so22893177edr.13; Mon, 27 Feb 2023 04:58:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=0Lqzv22KvYd26WZBONiwLPN2WCs4CWG7bM0JqgVXsno=; b=Fl5Fxd6kLAb54EvxG1nqNwfaKbDFJLFEBluuFT0stt/PxcbhHvEIPK0Rij8q5Wvh+s VPNfXsv5I6Qymg9DxRz+3s3GDoSuVTw76MMMl5c+Vs3ButpneCbxbt15Wx6Z2jiE1X5l uUFjM7+VK4lTjWD5O7LVnwsdKI8kFwfjsUQ1eJNY4JAHyq8xfAwn8K30te0EPcYXBO5q bCS2HmOq/f7zQclUu6ZxwtHSZRLxt2qwrWHFO/xtUI6pTnrtPwnKEcWI4Iq9w9krM+/B QKathiHF5P8dfRxLtOPpfo4AaEHtu8R7ClcZdYH5JnztNKiYwHcHW6c1d2dm6mUYl2RN rGQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0Lqzv22KvYd26WZBONiwLPN2WCs4CWG7bM0JqgVXsno=; b=WKe1Fjb5TqrdsQ3ChQo/9e5EWj9SUI+etYsAE7FicjGQ0tbBFhlmrMzwXHQeu8vYqW m2+pNQvfHNeWzx6F27BY9JnWEYlDetrTRq/kH8Y41QOfCtt8wWIaRSgH/Ng6RAj3FAQR ZUPn2U0QMjct4bfYK1g7GQsDzorYiXUFlQvaa64U1RBEqGJ9N1ZymquU96b5zzTAoPNU yaXWadn400xYeL2HK6GJnNanmmMe4wXeCIF8+K9rkTqcYXzyGL5k6gO73aqxmzMacvbW Ls1CwoGwbbnT4G9wHC2YJP/2tR2Q4qEvSr+1Gd9iHdQqjsiN6tkiSoGKtBKsCVd6SPW8 53Jg== X-Gm-Message-State: AO0yUKUMwfyWJV11TSLq9bUhlHkutMvrqsesqiel3sJfEHOh77QeUu7m qdu5VR45EgTqSlNPKe1HQjeVadpYNDc= X-Google-Smtp-Source: AK7set8tWl2Td1Fk3eBd2d1Mtd2rBNjzxyAIv6n6v1xEMgZ4tfN0MwQ5seKVV8YIl6cA7KEcdgcanA== X-Received: by 2002:a17:907:d407:b0:878:711d:9310 with SMTP id vi7-20020a170907d40700b00878711d9310mr32723012ejc.1.1677502685888; Mon, 27 Feb 2023 04:58:05 -0800 (PST) Received: from localhost.localdomain (dynamic-078-055-154-008.78.55.pool.telefonica.de. [78.55.154.8]) by smtp.gmail.com with ESMTPSA id bk4-20020a170906b0c400b008d7a8083dffsm3186414ejb.222.2023.02.27.04.58.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Feb 2023 04:58:05 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Huacai Chen , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , BALATON Zoltan , Jiaxun Yang , qemu-ppc@nongnu.org, Gerd Hoffmann , Rene Engel , Daniel Henrique Barboza Subject: [PATCH v4 1/7] hw/display/sm501: Implement more 2D raster operations Date: Mon, 27 Feb 2023 13:57:26 +0100 Message-Id: <20230227125732.20941-2-shentey@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230227125732.20941-1-shentey@gmail.com> References: <20230227125732.20941-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::52c; envelope-from=shentey@gmail.com; helo=mail-ed1-x52c.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, FREEMAIL_FROM=0.001, 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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: BALATON Zoltan Add simple implementation for two raster operations that are used by AmigaOS which fixes graphics problems in some programs using these. Signed-off-by: BALATON Zoltan Reported-by: Rene Engel Tested-by: Rene Engel Reviewed-by: Daniel Henrique Barboza Message-Id: <17ef3c59dc7868f75034e9ebe21e2999c8f718d4.1677445307.git.balaton@eik.bme.hu> --- hw/display/sm501.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/hw/display/sm501.c b/hw/display/sm501.c index e1d0591d36..58bc9701ee 100644 --- a/hw/display/sm501.c +++ b/hw/display/sm501.c @@ -753,7 +753,7 @@ static void sm501_2d_operation(SM501State *s) } if ((rop_mode && rop == 0x5) || (!rop_mode && rop == 0x55)) { - /* Invert dest, is there a way to do this with pixman? */ + /* DSTINVERT, is there a way to do this with pixman? */ unsigned int x, y, i; uint8_t *d = s->local_mem + dst_base; @@ -763,6 +763,34 @@ static void sm501_2d_operation(SM501State *s) stn_he_p(&d[i], bypp, ~ldn_he_p(&d[i], bypp)); } } + } else if (!rop_mode && rop == 0x99) { + /* DSxn, is there a way to do this with pixman? */ + unsigned int x, y, i, j; + uint8_t *sp = s->local_mem + src_base; + uint8_t *d = s->local_mem + dst_base; + + for (y = 0; y < height; y++) { + i = (dst_x + (dst_y + y) * dst_pitch) * bypp; + j = (src_x + (src_y + y) * src_pitch) * bypp; + for (x = 0; x < width; x++, i += bypp, j += bypp) { + stn_he_p(&d[i], bypp, + ~(ldn_he_p(&sp[j], bypp) ^ ldn_he_p(&d[i], bypp))); + } + } + } else if (!rop_mode && rop == 0xee) { + /* SRCPAINT, is there a way to do this with pixman? */ + unsigned int x, y, i, j; + uint8_t *sp = s->local_mem + src_base; + uint8_t *d = s->local_mem + dst_base; + + for (y = 0; y < height; y++) { + i = (dst_x + (dst_y + y) * dst_pitch) * bypp; + j = (src_x + (src_y + y) * src_pitch) * bypp; + for (x = 0; x < width; x++, i += bypp, j += bypp) { + stn_he_p(&d[i], bypp, + ldn_he_p(&sp[j], bypp) | ldn_he_p(&d[i], bypp)); + } + } } else { /* Do copy src for unimplemented ops, better than unpainted area */ if ((rop_mode && (rop != 0xc || rop2_source_is_pattern)) || From patchwork Mon Feb 27 12:57:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 1748707 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=kMElmYZz; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PQLFX3jBXz1yWw for ; Tue, 28 Feb 2023 00:00:16 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pWd5D-0003pT-5W; Mon, 27 Feb 2023 07:58:23 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pWd51-0003jw-17; Mon, 27 Feb 2023 07:58:11 -0500 Received: from mail-ed1-x536.google.com ([2a00:1450:4864:20::536]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pWd4z-00070q-6S; Mon, 27 Feb 2023 07:58:10 -0500 Received: by mail-ed1-x536.google.com with SMTP id h16so25328387edz.10; Mon, 27 Feb 2023 04:58:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=qhpe+xXQXqVggEkdge6NZga40k7yps9fWCoPkwYceTE=; b=kMElmYZzgkl97xMT3WgUs0OC0x4Wqx4bH2vot1Th2ormtYt12L8jSO1Y5e3aFiuiz8 6ePdW921JmZgGKNtWG1YtfXzxmoaQJHl4dB7jJMREu4OU+k01e+RCQoQIFdzn7KBcEfp 3GyqpBOd6NODSascPimNNM7fADhRjCV6Go0AL6xr8n5NFJG3wkFpAJboY7NDJqXHLBNe 9WXYiqm1VuADw9JzT8mDcf/zYpaYhB0Cv4Xng2i9g/bW5i0PLoQx3D6EgoxeIk2LT1+k bH/PBsNcEU/uXxkGN2BxtIJhuWDryzX+x4SqwJwvoG5xFQ+9URZNhnYlZEQaMSFdGy+y tU6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qhpe+xXQXqVggEkdge6NZga40k7yps9fWCoPkwYceTE=; b=AqsJjbcB0ENEAG3nhKNuzUyFMO+/W+MAPnpmzT4N7Gw1TeU2dLFUN4Kg2t8b5xYTlm BDPN8n2sb0YtmNGmrjXe92SGqv3zJ8Aywg/TkEe5ZGxVx04xULhZ7DvpWswxrRDk5Xot KJd2OaAlZZb2xOlkRQ4z7j7NF7pcH7vB9a9bRdVfAU+49OzSqUT8YDjW7e25qNPMJLO5 IaHd/hhqM5hKNJuEGLb8ZbnQifX1El8KQ5S6pye72outybwoj1huxuEFU/N/eYB65ILN vthP66VkEskDy8f3L5Vb6Pqd6O9632KdZj03Rof2tYhK4fXyl74PgFcnEQ76vjNJZq+a NQow== X-Gm-Message-State: AO0yUKWzmnrg1XbNcitiu+shGtxzg6O2P13P220XD+F4vrAFKKymEqRx Aif13cCg3nDPA4yabnHX23Ib/8qSm6M= X-Google-Smtp-Source: AK7set/inonx7tGCnqRkro1CQInLjItYtaOqF2P63AVmE/DHEKWEUTQhtpQCgOYuooAYKj7NLoK0vA== X-Received: by 2002:a17:906:55d2:b0:878:7a0e:5730 with SMTP id z18-20020a17090655d200b008787a0e5730mr34912816ejp.56.1677502686800; Mon, 27 Feb 2023 04:58:06 -0800 (PST) Received: from localhost.localdomain (dynamic-078-055-154-008.78.55.pool.telefonica.de. [78.55.154.8]) by smtp.gmail.com with ESMTPSA id bk4-20020a170906b0c400b008d7a8083dffsm3186414ejb.222.2023.02.27.04.58.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Feb 2023 04:58:06 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Huacai Chen , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , BALATON Zoltan , Jiaxun Yang , qemu-ppc@nongnu.org, Gerd Hoffmann , Rene Engel Subject: [PATCH v4 2/7] hw/display/sm501: Add fallbacks to pixman routines Date: Mon, 27 Feb 2023 13:57:27 +0100 Message-Id: <20230227125732.20941-3-shentey@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230227125732.20941-1-shentey@gmail.com> References: <20230227125732.20941-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::536; envelope-from=shentey@gmail.com; helo=mail-ed1-x536.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, FREEMAIL_FROM=0.001, 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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: BALATON Zoltan Pixman may return false if it does not have a suitable implementation. Add fallbacks to handle such cases. Signed-off-by: BALATON Zoltan Reported-by: Rene Engel Tested-by: Rene Engel Message-Id: <20ed9442a0146238254ccc340c0d1efa226c6356.1677445307.git.balaton@eik.bme.hu> --- hw/display/sm501.c | 75 ++++++++++++++++++++++++++++++++-------------- 1 file changed, 52 insertions(+), 23 deletions(-) diff --git a/hw/display/sm501.c b/hw/display/sm501.c index 58bc9701ee..23c4418e19 100644 --- a/hw/display/sm501.c +++ b/hw/display/sm501.c @@ -691,7 +691,7 @@ static void sm501_2d_operation(SM501State *s) unsigned int dst_pitch = (s->twoD_pitch >> 16) & 0x1FFF; int crt = (s->dc_crt_control & SM501_DC_CRT_CONTROL_SEL) ? 1 : 0; int fb_len = get_width(s, crt) * get_height(s, crt) * get_bpp(s, crt); - bool overlap = false; + bool overlap = false, fallback = false; if ((s->twoD_stretch >> 16) & 0xF) { qemu_log_mask(LOG_UNIMP, "sm501: only XY addressing is supported.\n"); @@ -834,25 +834,48 @@ static void sm501_2d_operation(SM501State *s) if (tmp_stride * sizeof(uint32_t) * height > sizeof(tmp_buf)) { tmp = g_malloc(tmp_stride * sizeof(uint32_t) * height); } - pixman_blt((uint32_t *)&s->local_mem[src_base], tmp, - src_pitch * bypp / sizeof(uint32_t), - tmp_stride, 8 * bypp, 8 * bypp, - src_x, src_y, 0, 0, width, height); - pixman_blt(tmp, (uint32_t *)&s->local_mem[dst_base], - tmp_stride, - dst_pitch * bypp / sizeof(uint32_t), - 8 * bypp, 8 * bypp, - 0, 0, dst_x, dst_y, width, height); + fallback = !pixman_blt((uint32_t *)&s->local_mem[src_base], + tmp, + src_pitch * bypp / sizeof(uint32_t), + tmp_stride, + 8 * bypp, 8 * bypp, + src_x, src_y, 0, 0, width, height); + if (!fallback) { + fallback = !pixman_blt(tmp, + (uint32_t *)&s->local_mem[dst_base], + tmp_stride, + dst_pitch * bypp / sizeof(uint32_t), + 8 * bypp, 8 * bypp, + 0, 0, dst_x, dst_y, width, height); + } if (tmp != tmp_buf) { g_free(tmp); } } else { - pixman_blt((uint32_t *)&s->local_mem[src_base], - (uint32_t *)&s->local_mem[dst_base], - src_pitch * bypp / sizeof(uint32_t), - dst_pitch * bypp / sizeof(uint32_t), - 8 * bypp, 8 * bypp, - src_x, src_y, dst_x, dst_y, width, height); + fallback = !pixman_blt((uint32_t *)&s->local_mem[src_base], + (uint32_t *)&s->local_mem[dst_base], + src_pitch * bypp / sizeof(uint32_t), + dst_pitch * bypp / sizeof(uint32_t), + 8 * bypp, 8 * bypp, src_x, src_y, + dst_x, dst_y, width, height); + } + if (fallback) { + uint8_t *sp = s->local_mem + src_base; + uint8_t *d = s->local_mem + dst_base; + unsigned int y, i, j; + for (y = 0; y < height; y++) { + if (overlap) { /* overlap also means rtl */ + i = (dst_y + height - 1 - y) * dst_pitch; + i = (dst_x + i) * bypp; + j = (src_y + height - 1 - y) * src_pitch; + j = (src_x + j) * bypp; + memmove(&d[i], &sp[j], width * bypp); + } else { + i = (dst_x + (dst_y + y) * dst_pitch) * bypp; + j = (src_x + (src_y + y) * src_pitch) * bypp; + memcpy(&d[i], &sp[j], width * bypp); + } + } } } break; @@ -867,13 +890,19 @@ static void sm501_2d_operation(SM501State *s) color = cpu_to_le16(color); } - if (width == 1 && height == 1) { - unsigned int i = (dst_x + dst_y * dst_pitch) * bypp; - stn_he_p(&s->local_mem[dst_base + i], bypp, color); - } else { - pixman_fill((uint32_t *)&s->local_mem[dst_base], - dst_pitch * bypp / sizeof(uint32_t), - 8 * bypp, dst_x, dst_y, width, height, color); + if ((width == 1 && height == 1) || + !pixman_fill((uint32_t *)&s->local_mem[dst_base], + dst_pitch * bypp / sizeof(uint32_t), 8 * bypp, + dst_x, dst_y, width, height, color)) { + /* fallback when pixman failed or we don't want to call it */ + uint8_t *d = s->local_mem + dst_base; + unsigned int x, y, i; + for (y = 0; y < height; y++, i += dst_pitch * bypp) { + i = (dst_x + (dst_y + y) * dst_pitch) * bypp; + for (x = 0; x < width; x++, i += bypp) { + stn_he_p(&d[i], bypp, color); + } + } } break; } From patchwork Mon Feb 27 12:57:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 1748703 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=TTdEbUtd; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PQLCQ1RnJz1yX2 for ; Mon, 27 Feb 2023 23:58:26 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pWd5C-0003op-SH; Mon, 27 Feb 2023 07:58:22 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pWd52-0003lD-Ui; Mon, 27 Feb 2023 07:58:13 -0500 Received: from mail-ed1-x52e.google.com ([2a00:1450:4864:20::52e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pWd4z-00070z-SF; Mon, 27 Feb 2023 07:58:12 -0500 Received: by mail-ed1-x52e.google.com with SMTP id cq23so25508719edb.1; Mon, 27 Feb 2023 04:58:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=NyrcxGf0uGzTYvYyLp610kYB0kT0EhYYjluHCkpVk6Q=; b=TTdEbUtdZ+aqyeU8IKPaWJuW2m1oXG1RATzhElelhBTeZL1SkFAqFJwj7wqRibuzWf qO4+GrfylAF1EGIqHEUPAMH4Rhe7UZ5lN7nUYnQEGNp2RfwJOG9FnaQCtnAQJm9x0am8 ama4M7ZY4XE8foWBeEKNE3iXhs2DaKyKGhaec1qQ1rrdg8s0EVhgXrR7lLqCwX8sxry4 /VXTxgUUVLYZ1Wz9BNY2TxWfLeJAZglCXtvne7qK2bV9eyLCujWkF42g17ygn6EPjOno Aah0uBQL5YNbssDGL3P7G8wBTM+u7aksXYwFxWcnYzpJ8Pwj36MgIrYQbY8uSLmIqiPx PodA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NyrcxGf0uGzTYvYyLp610kYB0kT0EhYYjluHCkpVk6Q=; b=KETENmNbhgOM0FRTd0ILjnT1v5aVl3nG4mAFgcnd9aCVE/SmuGCCmYp8sys8AwY/17 LabStfn1I5FEr+tTRmLIOMVefioFZ8hTUTr9GDAWjjtZlqOVhuCqdUl7UpMtJZF8Qmo4 BZMnE7DrE2akLMdc7Nv8Ehz4hbdEupK4707AbNaggR18SddBPXsXcjmXfjEoYg2T6wv2 kB2xOmFIj1YYDuMjRZN/+e5wM9U6YWIHMq3QCn/f8YU6VjQY5L7eC2VE4xYMcw/KzExf FzYlMzde62niVyu0VDBM+zDkXk6lWNLNANpPIDjSQibsuJtLaYwHx72bQNxL63Hf9JWn MGxQ== X-Gm-Message-State: AO0yUKUqCEUaThkFKFgw8cfeFZxZYokRNchfRTq0eRqmeEfbJXSytyVO jtKRbZIvCMpbfAXy3xqkl0wFk8VEEt0= X-Google-Smtp-Source: AK7set+wjtwBaGZx5DqcXt6+i+++ETUPkQuAFlWLEsxeFHA3sJ4wAi9WWfuchsL8R12ZirHmoC0wxg== X-Received: by 2002:a17:907:6d97:b0:8ea:825:a5d8 with SMTP id sb23-20020a1709076d9700b008ea0825a5d8mr23843235ejc.17.1677502687753; Mon, 27 Feb 2023 04:58:07 -0800 (PST) Received: from localhost.localdomain (dynamic-078-055-154-008.78.55.pool.telefonica.de. [78.55.154.8]) by smtp.gmail.com with ESMTPSA id bk4-20020a170906b0c400b008d7a8083dffsm3186414ejb.222.2023.02.27.04.58.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Feb 2023 04:58:07 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Huacai Chen , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , BALATON Zoltan , Jiaxun Yang , qemu-ppc@nongnu.org, Gerd Hoffmann Subject: [PATCH v4 3/7] hw/display/sm501: Add debug property to control pixman usage Date: Mon, 27 Feb 2023 13:57:28 +0100 Message-Id: <20230227125732.20941-4-shentey@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230227125732.20941-1-shentey@gmail.com> References: <20230227125732.20941-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::52e; envelope-from=shentey@gmail.com; helo=mail-ed1-x52e.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, FREEMAIL_FROM=0.001, 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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: BALATON Zoltan Add a property to allow disabling pixman and always use the fallbacks for different operations which is useful for testing different drawing methods or debugging pixman related issues. Signed-off-by: BALATON Zoltan Message-Id: --- hw/display/sm501.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/hw/display/sm501.c b/hw/display/sm501.c index 23c4418e19..f2f7f26751 100644 --- a/hw/display/sm501.c +++ b/hw/display/sm501.c @@ -464,6 +464,7 @@ typedef struct SM501State { uint32_t last_width; uint32_t last_height; bool do_full_update; /* perform a full update next time */ + uint8_t use_pixman; I2CBus *i2c_bus; /* mmio registers */ @@ -826,7 +827,7 @@ static void sm501_2d_operation(SM501State *s) de = db + (width + (height - 1) * dst_pitch) * bypp; overlap = (db < se && sb < de); } - if (overlap) { + if (overlap && (s->use_pixman & BIT(2))) { /* pixman can't do reverse blit: copy via temporary */ int tmp_stride = DIV_ROUND_UP(width * bypp, sizeof(uint32_t)); uint32_t *tmp = tmp_buf; @@ -851,13 +852,15 @@ static void sm501_2d_operation(SM501State *s) if (tmp != tmp_buf) { g_free(tmp); } - } else { + } else if (!overlap && (s->use_pixman & BIT(1))) { fallback = !pixman_blt((uint32_t *)&s->local_mem[src_base], (uint32_t *)&s->local_mem[dst_base], src_pitch * bypp / sizeof(uint32_t), dst_pitch * bypp / sizeof(uint32_t), 8 * bypp, 8 * bypp, src_x, src_y, dst_x, dst_y, width, height); + } else { + fallback = true; } if (fallback) { uint8_t *sp = s->local_mem + src_base; @@ -890,7 +893,7 @@ static void sm501_2d_operation(SM501State *s) color = cpu_to_le16(color); } - if ((width == 1 && height == 1) || + if (!(s->use_pixman & BIT(0)) || (width == 1 && height == 1) || !pixman_fill((uint32_t *)&s->local_mem[dst_base], dst_pitch * bypp / sizeof(uint32_t), 8 * bypp, dst_x, dst_y, width, height, color)) { @@ -2039,6 +2042,7 @@ static void sm501_realize_sysbus(DeviceState *dev, Error **errp) static Property sm501_sysbus_properties[] = { DEFINE_PROP_UINT32("vram-size", SM501SysBusState, vram_size, 0), DEFINE_PROP_UINT32("base", SM501SysBusState, base, 0), + DEFINE_PROP_UINT8("x-pixman", SM501SysBusState, state.use_pixman, 7), DEFINE_PROP_END_OF_LIST(), }; @@ -2122,6 +2126,7 @@ static void sm501_realize_pci(PCIDevice *dev, Error **errp) static Property sm501_pci_properties[] = { DEFINE_PROP_UINT32("vram-size", SM501PCIState, vram_size, 64 * MiB), + DEFINE_PROP_UINT8("x-pixman", SM501PCIState, state.use_pixman, 7), DEFINE_PROP_END_OF_LIST(), }; @@ -2162,11 +2167,18 @@ static void sm501_pci_class_init(ObjectClass *klass, void *data) dc->vmsd = &vmstate_sm501_pci; } +static void sm501_pci_init(Object *o) +{ + object_property_set_description(o, "x-pixman", "Use pixman for: " + "1: fill, 2: blit, 4: overlap blit"); +} + static const TypeInfo sm501_pci_info = { .name = TYPE_PCI_SM501, .parent = TYPE_PCI_DEVICE, .instance_size = sizeof(SM501PCIState), .class_init = sm501_pci_class_init, + .instance_init = sm501_pci_init, .interfaces = (InterfaceInfo[]) { { INTERFACE_CONVENTIONAL_PCI_DEVICE }, { },