On Fri, 27 Feb 2026, Chad Jablonski wrote:
ati_2d_blt remains the public interface to the blitter but the bulk of
the implementation is moved down into ati_2d_do_blt which is passed an
ATI2DCtx.

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

diff --git a/hw/display/ati_2d.c b/hw/display/ati_2d.c
index ebcec07334..a93a267465 100644
--- a/hw/display/ati_2d.c
+++ b/hw/display/ati_2d.c
@@ -123,15 +123,12 @@ static void setup_2d_blt_ctx(const ATIVGAState *s, 
ATI2DCtx *ctx)
            (ctx->top_to_bottom ? 'v' : '^'));
}

-void ati_2d_blt(ATIVGAState *s)
+static void ati_2d_do_blt(ATIVGAState *s, ATI2DCtx *ctx)
{
    /* FIXME it is probably more complex than this and may need to be */
    /* rewritten but for now as a start just to get some output: */
    bool use_pixman_fill = s->use_pixman & BIT(0);
    bool use_pixman_blt = s->use_pixman & BIT(1);
-    ATI2DCtx ctx_;
-    ATI2DCtx *ctx = &ctx_;
-    setup_2d_blt_ctx(s, ctx);
    if (!ctx->bpp) {
        qemu_log_mask(LOG_GUEST_ERROR, "Invalid bpp\n");
        return;
@@ -264,8 +261,13 @@ void ati_2d_blt(ATIVGAState *s)
    default:
        qemu_log_mask(LOG_UNIMP, "Unimplemented ati_2d blt op %x\n",
                      ctx->rop3 >> 16);
-        return;
    }
+}

-    ati_set_dirty(&s->vga, ctx);
+void ati_2d_blt(ATIVGAState *s)
+{
+    ATI2DCtx ctx;
+    setup_2d_blt_ctx(s, &ctx);
+    ati_2d_do_blt(s, &ctx);
+    ati_set_dirty(&s->vga, &ctx);
}

I've noticed that if ati_2d_do_blt returns early due to failing a check (e.g. blt outside vram is not implemented that I see with MorphOS TVPaint after clicking on OK in the initial requester that changes resolution; I did not investigate why this happens but it seems to still use old resolution for some values for some reason) after this patch it will still call ati_set_dirty unnecessarily. So either the set dirty may need to stay in do_blt or ati_2d_do_blt should return a bool to say if it changed the frame buffer so the caller should call set_dirty.

Regards,
BALATON Zoltan

Reply via email to