hw/display/sm501: Implement more 2D raster operations
PATCH 1/1 hw/display/sm501: Implement more 2D raster operations
Add simple implementation for two raster operations that are used by AmigaOS which fixes graphics problems in some progtams using these.
---
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(-)
hw/display/sm501.c +29 -1
@@ -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)) ||
Signature · 1 line
2.30.7
Quoted 5 lines · BALATON Zoltan
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 <[email protected]>---
And queued in ppc-next. Thanks,
Daniel
Quoted 54 lines
For definitions of these see:
https://learn.microsoft.com/en-us/windows/win32/gdi/ternary-raster-operationshw/display/sm501.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-)hw/display/sm501.c +29
-1@@ -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)) ||
Quoted 2 lines · BALATON Zoltan
Add simple implementation for two raster operations that are used by AmigaOS which fixes graphics problems in some progtams using these.
Typo "programs".
Quoted 4 lines
Signed-off-by BALATON Zoltan <[email protected]>---
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.
Quoted 2 lines
hw/display/sm501.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-)
Quoted 5 lines · Philippe Mathieu-Daudé
Quoted 2 lines · BALATON Zoltan
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 :-) ).
Quoted 6 lines
Quoted 4 lines
Signed-off-by BALATON Zoltan <[email protected]>---
For definitions of these see:
https://learn.microsoft.com/en-us/windows/win32/gdi/ternary-raster-operationsComment 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
Quoted 5 lines
Quoted 2 lines
hw/display/sm501.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-)