The sc_right and sc_bottom registers are inclusive for the r128 but
exclusive for the r100.

Tested and validated against a Rage 128 Pro Ultra (PCI 1002:5446) and
Radeon QY (RV100) (PCI 1002:5159).

Signed-off-by: Chad Jablonski <[email protected]>
---
 hw/display/ati_2d.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/hw/display/ati_2d.c b/hw/display/ati_2d.c
index 7a4a115aee..3b27917bf4 100644
--- a/hw/display/ati_2d.c
+++ b/hw/display/ati_2d.c
@@ -106,8 +106,14 @@ static void setup_2d_blt_ctx(ATIVGAState *s, ATI2DCtx *ctx)
     ctx->frgd_clr = s->regs.dp_brush_frgd_clr;
     ctx->dst_offset = s->regs.dst_offset;
 
-    ctx->scissor.width = s->regs.sc_right - s->regs.sc_left + 1;
-    ctx->scissor.height = s->regs.sc_bottom - s->regs.sc_top + 1;
+    if (s->dev_id == PCI_DEVICE_ID_ATI_RAGE128_PF) {
+        /* r128 scissor values are inclusive */
+        ctx->scissor.width = s->regs.sc_right - s->regs.sc_left + 1;
+        ctx->scissor.height = s->regs.sc_bottom - s->regs.sc_top + 1;
+    } else {
+        ctx->scissor.width = s->regs.sc_right - s->regs.sc_left;
+        ctx->scissor.height = s->regs.sc_bottom - s->regs.sc_top;
+    }
     ctx->scissor.x = s->regs.sc_left;
     ctx->scissor.y = s->regs.sc_top;
 
-- 
2.54.0


Reply via email to