From: Chad Jablonski <[email protected]> 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 <[email protected]> Reviewed-by: BALATON Zoltan <[email protected]> [balaton: Fix build without pixman] Signed-off-by: BALATON Zoltan <[email protected]> --- 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 a83cf14a4a..0475fcb585 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); + } } -- 2.41.3
