Browse Source

ati-vga: Split ati_2d_do_blt from ati_2d_blt

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 <chad@jablonski.xyz>
Reviewed-by: BALATON Zoltan <balaton@eik.bme.hu>
[balaton: Fix build without pixman]
Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Message-ID: <367949c50ca140a2d18ae66234dafbbc586b553c.1773020351.git.balaton@eik.bme.hu>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
staging^2
Chad Jablonski 3 weeks ago
committed by Philippe Mathieu-Daudé
parent
commit
4066a2ff27
  1. 28
      hw/display/ati_2d.c

28
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);
}
}

Loading…
Cancel
Save