From 4066a2ff2715be7a012200a31b6cc1008e4f5b9a Mon Sep 17 00:00:00 2001 From: Chad Jablonski Date: Mon, 9 Mar 2026 02:47:48 +0100 Subject: [PATCH] ati-vga: Split ati_2d_do_blt from ati_2d_blt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. ati_2d_do_blt returns a bool that is true when the blit succeeded, which means that a screen region will need to be set dirty. Otherwise false is returned. Signed-off-by: Chad Jablonski Reviewed-by: BALATON Zoltan [balaton: Fix build without pixman] Signed-off-by: BALATON Zoltan Message-ID: <367949c50ca140a2d18ae66234dafbbc586b553c.1773020351.git.balaton@eik.bme.hu> Signed-off-by: Philippe Mathieu-Daudé --- hw/display/ati_2d.c | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/hw/display/ati_2d.c b/hw/display/ati_2d.c index ef4d2e21b5..aa2e540a51 100644 --- a/hw/display/ati_2d.c +++ b/hw/display/ati_2d.c @@ -123,24 +123,21 @@ static void setup_2d_blt_ctx(const ATIVGAState *s, ATI2DCtx *ctx) (ctx->top_to_bottom ? 'v' : '^')); } -void ati_2d_blt(ATIVGAState *s) +static bool ati_2d_do_blt(ATIVGAState *s, ATI2DCtx *ctx) { - ATI2DCtx ctx_; - ATI2DCtx *ctx = &ctx_; - setup_2d_blt_ctx(s, ctx); if (!ctx->bpp) { qemu_log_mask(LOG_GUEST_ERROR, "Invalid bpp\n"); - return; + return false; } if (!ctx->dst_stride) { qemu_log_mask(LOG_GUEST_ERROR, "Zero dest pitch\n"); - return; + return false; } if (ctx->dst.x > 0x3fff || ctx->dst.y > 0x3fff || ctx->dst_bits >= ctx->vram_end || ctx->dst_bits + ctx->dst.x + (ctx->dst.y + ctx->dst.height) * ctx->dst_stride >= ctx->vram_end) { qemu_log_mask(LOG_UNIMP, "blt outside vram not implemented\n"); - return; + return false; } switch (ctx->rop3) { case ROP3_SRCCOPY: @@ -148,14 +145,14 @@ void ati_2d_blt(ATIVGAState *s) bool fallback = false; if (!ctx->src_stride) { qemu_log_mask(LOG_GUEST_ERROR, "Zero source pitch\n"); - return; + return false; } if (ctx->src.x > 0x3fff || ctx->src.y > 0x3fff || ctx->src_bits >= ctx->vram_end || ctx->src_bits + ctx->src.x + (ctx->src.y + ctx->dst.height) * ctx->src_stride >= ctx->vram_end) { qemu_log_mask(LOG_UNIMP, "blt outside vram not implemented\n"); - return; + return false; } DPRINTF("pixman_blt(%p, %p, %ld, %ld, %d, %d, %d, %d, %d, %d, %d, %d)\n", @@ -265,8 +262,17 @@ void ati_2d_blt(ATIVGAState *s) default: qemu_log_mask(LOG_UNIMP, "Unimplemented ati_2d blt op %x\n", ctx->rop3 >> 16); - return; + return false; } - ati_set_dirty(&s->vga, ctx); + return true; +} + +void ati_2d_blt(ATIVGAState *s) +{ + ATI2DCtx ctx; + setup_2d_blt_ctx(s, &ctx); + if (ati_2d_do_blt(s, &ctx)) { + ati_set_dirty(&s->vga, &ctx); + } }