From patchwork Mon Feb 27 14:01:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 657097 Delivered-To: patch@linaro.org Received: by 2002:adf:a3c6:0:0:0:0:0 with SMTP id m6csp2385310wrb; Mon, 27 Feb 2023 06:36:28 -0800 (PST) X-Google-Smtp-Source: AK7set/NLXxkBiEDRZCVxXf5rtUJ6Ay6dM/xBNxzY4uW9raATJZLRHEySZV1kAt31oP74N0ojher X-Received: by 2002:ac8:5f94:0:b0:3bf:d9a4:fda7 with SMTP id j20-20020ac85f94000000b003bfd9a4fda7mr6030597qta.19.1677508588639; Mon, 27 Feb 2023 06:36:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677508588; cv=none; d=google.com; s=arc-20160816; b=Bdw2Joe+Kozf5egZ22lsyDa+EaDcJ4hInfxSKdXsSn7l9xGM1JXW8PoJDTAAtkD4uh JDE/JJsU//+bMTFUfRgxjC8xNT46C23CaONufk1jglpvvrhjywj6xWuhq8NuEbGCldDj KZARq1zTHs3CCvvbPgc/qfQtvX4T6nNrzICxpER2//R0v5tMqvF3nZrqcl4C8aaCbp0N I9+V6xTUhAUT5Bza/MWMzTK/EpIl/VETrzB5IOqeLC0C6I02bMJLn83JWyN+q5XQfiHI QRvv26SnMQFjiOBY7VO2/F/hwI1g8PfFbtzAMNnqcKTlgd9SjaahhSy2TU9KHbczxNHX X+1Q== 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=yE2nb8UtCPTjefeNFrKNR+9dA7QDwYIIYJDcNWKRaRc=; b=ZfB3IBhYlv2aP3xF3083+8n61HxXiN4It7ZUAjygBeKhFkAB6jATHdaWAKrNS1NciG eQCY4K22NqSM9bhipRfmPkVusLLwX9MYnUK3n+Zb/bb1B9ZnaklRXOOE/G7zTCBZ3O0P pnWVF+rvZK+gOiJRUBBYq/u+ZRsAFCCKg8wFgGZarLqsoPVQmq9BFJ/jBxf27atrbalm 6z/bFQ2MwH48qw3+X2e4WoRSR/0t7o0aaVkIJSZJP9uBdgSDfsTK3EuBtGGtOjguhEL4 R7dZEgjws9Ji2Z2vw82dfBY/g4UbMt6NNdK2xQqYrdLu4Dju850W4uXhaXNuAAsTRFe+ CAlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Qxd6mSI8; 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 e20-20020a05622a111400b003b9a3ab548fsi6258944qty.646.2023.02.27.06.36.28 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 27 Feb 2023 06:36:28 -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=Qxd6mSI8; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pWeCO-0005Tx-Sr; Mon, 27 Feb 2023 09:09:53 -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 1pWeCF-0004zz-6G for qemu-devel@nongnu.org; Mon, 27 Feb 2023 09:09:43 -0500 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pWeCC-0000br-VX for qemu-devel@nongnu.org; Mon, 27 Feb 2023 09:09:42 -0500 Received: by mail-wr1-x433.google.com with SMTP id t15so6362265wrz.7 for ; Mon, 27 Feb 2023 06:09:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=yE2nb8UtCPTjefeNFrKNR+9dA7QDwYIIYJDcNWKRaRc=; b=Qxd6mSI8PfnxwEuSgz51RKkghZdjCBeZQC3wAM6N6dCpgZ0Ifu7kTaSVCnyvjTpusx BgqKFRfMoUNN+mHo0YnwBJ2cPZKBzQCtT0uOj9JSQKBc2blFI6RktQfM5gPLvTbsupOE JACB6iJo00APgbFDHcmPkm5Ddeh/50ivD5afXkl3xRAEcxLeLZuwy1WJCU24QkPUGTb/ Tle9WUxuftYhofoQB5GB4iScN7IDj8mrtsoQXVARC1VkAZLOQ6NHi9IySBPG17qZAA6h 4DrOtzM5Nxw/eb6tUCy/E5ZgU7+gN2hQGSkdwwa7Tcf3CnWkMeT3KeyKO90QCvq1/JlB c/Ww== 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:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yE2nb8UtCPTjefeNFrKNR+9dA7QDwYIIYJDcNWKRaRc=; b=UCm/L5PUOfXTKhBKlU9N6VfIcl+cJvZiuJL136AYYnpnQh0OysBDCXMvtWpQFtO/3E qEHKnywJxAA+VXp1cXNXA+i+3qmKK/3BuVdNekWuWet1IUl8AHCipBSU+prJOjKopbf5 oGWyu16qESe3lGikDhQc7WmcvdvDerNTU2QsQQisd4PlbALIcnp7d6X1nvjCX0fni9/1 4rktMCbWprwp6vVqNNRh0Dy7I+scyx64C7qADZUWr0NEgmJk2kk1VUq9vGFHm1F0oACu HLTii5qjnIbQv/HdMIBvyVmpoxJbkGWvdHy6/98OJ61zrbUT8uik88gUWbEFUyL5dPbu Ju9Q== X-Gm-Message-State: AO0yUKUqb0SpWbL3Ukghe4bCcgoRCSiQ29FGM+cghghRORYU+oiO79uV xTWY2/obenvT60U2rRoaqbeSjsIoOFYmx4b3 X-Received: by 2002:adf:ea07:0:b0:2c7:420:5d52 with SMTP id q7-20020adfea07000000b002c704205d52mr18813200wrm.62.1677506979400; Mon, 27 Feb 2023 06:09:39 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id n7-20020adfe787000000b002c573778432sm7157810wrm.102.2023.02.27.06.09.38 for (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 27 Feb 2023 06:09:39 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL 091/126] hw/display/sm501: Implement more 2D raster operations Date: Mon, 27 Feb 2023 15:01:38 +0100 Message-Id: <20230227140213.35084-82-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230227140213.35084-1-philmd@linaro.org> References: <20230227140213.35084-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::433; envelope-from=philmd@linaro.org; helo=mail-wr1-x433.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.29 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-bounces+patch=linaro.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> Signed-off-by: Philippe Mathieu-Daudé --- 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 bb53499dff..c4c567d977 100644 --- a/hw/display/sm501.c +++ b/hw/display/sm501.c @@ -754,7 +754,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; @@ -764,6 +764,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)) ||