qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Bernhard Beschow <shentey@gmail.com>
To: qemu-devel@nongnu.org
Cc: "BALATON Zoltan" <balaton@eik.bme.hu>,
	"Huacai Chen" <chenhuacai@kernel.org>,
	"Gerd Hoffmann" <kraxel@redhat.com>,
	"Jiaxun Yang" <jiaxun.yang@flygoat.com>,
	qemu-ppc@nongnu.org, "Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Rene Engel" <ReneEngel80@emailn.de>,
	"Daniel Henrique Barboza" <danielhb413@gmail.com>
Subject: [PATCH v4 1/7] hw/display/sm501: Implement more 2D raster operations
Date: Mon, 27 Feb 2023 14:33:19 +0100	[thread overview]
Message-ID: <20230227133325.22023-2-shentey@gmail.com> (raw)
In-Reply-To: <20230227133325.22023-1-shentey@gmail.com>

From: BALATON Zoltan <balaton@eik.bme.hu>

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 <balaton@eik.bme.hu>
Reported-by: Rene Engel <ReneEngel80@emailn.de>
Tested-by: Rene Engel <ReneEngel80@emailn.de>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
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)) ||
-- 
2.39.2



  reply	other threads:[~2023-02-27 13:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-27 13:33 [PATCH v4 0/7] [RESEND] Pegasos2 fixes and audio output support Bernhard Beschow
2023-02-27 13:33 ` Bernhard Beschow [this message]
2023-02-27 13:33 ` [PATCH v4 2/7] hw/display/sm501: Add fallbacks to pixman routines Bernhard Beschow
2023-02-27 13:33 ` [PATCH v4 3/7] hw/display/sm501: Add debug property to control pixman usage Bernhard Beschow
2023-02-27 13:33 ` [PATCH v4 4/7] hw/isa/vt82c686: Declare gpio inputs so it can be connected in board code Bernhard Beschow
2023-02-27 13:33 ` [PATCH v4 5/7] hw/ppc/pegasos2: Fix PCI interrupt routing Bernhard Beschow
2023-02-27 13:33 ` [PATCH v4 6/7] hw/audio/ac97: Split off some definitions to a header Bernhard Beschow
2023-02-27 13:33 ` [PATCH v4 7/7] hw/audio/via-ac97: Basic implementation of audio playback Bernhard Beschow
  -- strict thread matches above, loose matches on Subject: below --
2023-02-27 12:57 [PATCH v4 0/7] Pegasos2 fixes and audio output support Bernhard Beschow
2023-02-27 12:57 ` [PATCH v4 1/7] hw/display/sm501: Implement more 2D raster operations Bernhard Beschow

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230227133325.22023-2-shentey@gmail.com \
    --to=shentey@gmail.com \
    --cc=ReneEngel80@emailn.de \
    --cc=balaton@eik.bme.hu \
    --cc=chenhuacai@kernel.org \
    --cc=danielhb413@gmail.com \
    --cc=jiaxun.yang@flygoat.com \
    --cc=kraxel@redhat.com \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).