* [PATCH] hw/display/sm501: Implement more 2D raster operations
@ 2023-02-16 14:40 BALATON Zoltan
2023-02-24 16:55 ` Daniel Henrique Barboza
2023-02-26 22:02 ` Philippe Mathieu-Daudé
0 siblings, 2 replies; 4+ messages in thread
From: BALATON Zoltan @ 2023-02-16 14:40 UTC (permalink / raw)
To: qemu-devel, qemu-ppc
Cc: Peter Maydell, Gerd Hoffmann, Daniel Henrique Barboza,
Sebastian Bauer
Add simple implementation for two raster operations that are used by
AmigaOS which fixes graphics problems in some progtams using these.
Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
---
For definitions of these see:
https://learn.microsoft.com/en-us/windows/win32/gdi/ternary-raster-operations
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.30.7
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] hw/display/sm501: Implement more 2D raster operations
2023-02-16 14:40 [PATCH] hw/display/sm501: Implement more 2D raster operations BALATON Zoltan
@ 2023-02-24 16:55 ` Daniel Henrique Barboza
2023-02-26 22:02 ` Philippe Mathieu-Daudé
1 sibling, 0 replies; 4+ messages in thread
From: Daniel Henrique Barboza @ 2023-02-24 16:55 UTC (permalink / raw)
To: BALATON Zoltan, qemu-devel, qemu-ppc
Cc: Peter Maydell, Gerd Hoffmann, Sebastian Bauer
On 2/16/23 11:40, BALATON Zoltan wrote:
> Add simple implementation for two raster operations that are used by
> AmigaOS which fixes graphics problems in some progtams using these.
>
> Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
> ---
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
And queued in ppc-next. Thanks,
Daniel
> For definitions of these see:
> https://learn.microsoft.com/en-us/windows/win32/gdi/ternary-raster-operations
>
> 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)) ||
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] hw/display/sm501: Implement more 2D raster operations
2023-02-16 14:40 [PATCH] hw/display/sm501: Implement more 2D raster operations BALATON Zoltan
2023-02-24 16:55 ` Daniel Henrique Barboza
@ 2023-02-26 22:02 ` Philippe Mathieu-Daudé
2023-02-26 22:16 ` BALATON Zoltan
1 sibling, 1 reply; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-02-26 22:02 UTC (permalink / raw)
To: BALATON Zoltan, qemu-devel, qemu-ppc
Cc: Peter Maydell, Gerd Hoffmann, Daniel Henrique Barboza,
Sebastian Bauer
On 16/2/23 15:40, BALATON Zoltan wrote:
> Add simple implementation for two raster operations that are used by
> AmigaOS which fixes graphics problems in some progtams using these.
Typo "programs".
> Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
> ---
> For definitions of these see:
> https://learn.microsoft.com/en-us/windows/win32/gdi/ternary-raster-operations
Comment worth being in the commit description IMO.
> hw/display/sm501.c | 30 +++++++++++++++++++++++++++++-
> 1 file changed, 29 insertions(+), 1 deletion(-)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] hw/display/sm501: Implement more 2D raster operations
2023-02-26 22:02 ` Philippe Mathieu-Daudé
@ 2023-02-26 22:16 ` BALATON Zoltan
0 siblings, 0 replies; 4+ messages in thread
From: BALATON Zoltan @ 2023-02-26 22:16 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: qemu-devel, qemu-ppc, Peter Maydell, Gerd Hoffmann,
Daniel Henrique Barboza, Sebastian Bauer
[-- Attachment #1: Type: text/plain, Size: 827 bytes --]
On Sun, 26 Feb 2023, Philippe Mathieu-Daudé wrote:
> On 16/2/23 15:40, BALATON Zoltan wrote:
>> Add simple implementation for two raster operations that are used by
>> AmigaOS which fixes graphics problems in some progtams using these.
>
> Typo "programs".
Fixed in v3 (was just in time for that :-) ).
>> Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
>> ---
>> For definitions of these see:
>> https://learn.microsoft.com/en-us/windows/win32/gdi/ternary-raster-operations
>
> Comment worth being in the commit description IMO.
I don't think adding URLs to the source that can remain the same for years
while URLs can go away is a good idea. It's only here to help review.
Regards,
BALATON Zoltan
>> hw/display/sm501.c | 30 +++++++++++++++++++++++++++++-
>> 1 file changed, 29 insertions(+), 1 deletion(-)
>
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-02-26 22:16 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-16 14:40 [PATCH] hw/display/sm501: Implement more 2D raster operations BALATON Zoltan
2023-02-24 16:55 ` Daniel Henrique Barboza
2023-02-26 22:02 ` Philippe Mathieu-Daudé
2023-02-26 22:16 ` BALATON Zoltan
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).