@samitouri / QOSamiQemu / commits / 4066a2ff27

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>

Chad Jablonski committed Mar 9, 2026 at 02:47 UTC 4066a2ff2715be7a012200a31b6cc1008e4f5b9a
1 file changed +17 -11
hw/display/ati_2d.c
+17 -11
@@ -123,24 +123,21 @@ static void setup_2d_blt_ctx(const ATIVGAState *s, ATI2DCtx *ctx)
123 (ctx->top_to_bottom ? 'v' : '^'));
124 }
125
126 -void ati_2d_blt(ATIVGAState *s)
126 +static bool ati_2d_do_blt(ATIVGAState *s, ATI2DCtx *ctx)
127 {
128 - ATI2DCtx ctx_;
129 - ATI2DCtx *ctx = &ctx_;
130 - setup_2d_blt_ctx(s, ctx);
128 if (!ctx->bpp) {
129 qemu_log_mask(LOG_GUEST_ERROR, "Invalid bpp\n");
133 - return;
130 + return false;
131 }
132 if (!ctx->dst_stride) {
133 qemu_log_mask(LOG_GUEST_ERROR, "Zero dest pitch\n");
137 - return;
134 + return false;
135 }
136 if (ctx->dst.x > 0x3fff || ctx->dst.y > 0x3fff ||
137 ctx->dst_bits >= ctx->vram_end || ctx->dst_bits + ctx->dst.x +
138 (ctx->dst.y + ctx->dst.height) * ctx->dst_stride >= ctx->vram_end) {
139 qemu_log_mask(LOG_UNIMP, "blt outside vram not implemented\n");
143 - return;
140 + return false;
141 }
142 switch (ctx->rop3) {
143 case ROP3_SRCCOPY:
@@ -148,14 +145,14 @@ void ati_2d_blt(ATIVGAState *s)
145 bool fallback = false;
146 if (!ctx->src_stride) {
147 qemu_log_mask(LOG_GUEST_ERROR, "Zero source pitch\n");
151 - return;
148 + return false;
149 }
150 if (ctx->src.x > 0x3fff || ctx->src.y > 0x3fff ||
151 ctx->src_bits >= ctx->vram_end ||
152 ctx->src_bits + ctx->src.x + (ctx->src.y + ctx->dst.height) *
153 ctx->src_stride >= ctx->vram_end) {
154 qemu_log_mask(LOG_UNIMP, "blt outside vram not implemented\n");
158 - return;
155 + return false;
156 }
157
158 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)
262 default:
263 qemu_log_mask(LOG_UNIMP, "Unimplemented ati_2d blt op %x\n",
264 ctx->rop3 >> 16);
268 - return;
265 + return false;
266 }
267
271 - ati_set_dirty(&s->vga, ctx);
268 + return true;
269 +}
270 +
271 +void ati_2d_blt(ATIVGAState *s)
272 +{
273 + ATI2DCtx ctx;
274 + setup_2d_blt_ctx(s, &ctx);
275 + if (ati_2d_do_blt(s, &ctx)) {
276 + ati_set_dirty(&s->vga, &ctx);
277 + }
278 }