2 * Copyright (C) 2009 Maciej Cencora <m.cencora@gmail.com>
6 * Permission is hereby granted, free of charge, to any person obtaining
7 * a copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sublicense, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial
16 * portions of the Software.
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
21 * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
22 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28 #include "radeon_common.h"
29 #include "r200_context.h"
30 #include "r200_blit.h"
33 static inline uint32_t cmdpacket0(struct radeon_screen
*rscrn
,
37 return CP_PACKET0(reg
, count
- 1);
41 /* common formats supported as both textures and render targets */
42 unsigned r200_check_blit(mesa_format mesa_format
, uint32_t dst_pitch
)
45 switch (mesa_format
) {
46 #if UTIL_ARCH_LITTLE_ENDIAN
47 case MESA_FORMAT_B8G8R8A8_UNORM
:
48 case MESA_FORMAT_B8G8R8X8_UNORM
:
49 case MESA_FORMAT_B5G6R5_UNORM
:
50 case MESA_FORMAT_B4G4R4A4_UNORM
:
51 case MESA_FORMAT_B5G5R5A1_UNORM
:
53 case MESA_FORMAT_A8R8G8B8_UNORM
:
54 case MESA_FORMAT_X8R8G8B8_UNORM
:
55 case MESA_FORMAT_R5G6B5_UNORM
:
56 case MESA_FORMAT_A4R4G4B4_UNORM
:
57 case MESA_FORMAT_A1R5G5B5_UNORM
:
59 case MESA_FORMAT_A_UNORM8
:
60 case MESA_FORMAT_L_UNORM8
:
61 case MESA_FORMAT_I_UNORM8
:
62 /* swizzled - probably can't happen with the disabled Choose8888TexFormat code */
63 case MESA_FORMAT_A8B8G8R8_UNORM
:
64 case MESA_FORMAT_R8G8B8A8_UNORM
:
70 /* Rendering to small buffer doesn't work.
71 * Looks like a hw limitation.
77 if (_mesa_get_format_bits(mesa_format
, GL_DEPTH_BITS
) > 0)
83 static inline void emit_vtx_state(struct r200_context
*r200
)
85 BATCH_LOCALS(&r200
->radeon
);
88 if (r200
->radeon
.radeonScreen
->chip_flags
& RADEON_CHIPSET_TCL
) {
89 OUT_BATCH_REGVAL(R200_SE_VAP_CNTL_STATUS
, 0);
91 OUT_BATCH_REGVAL(R200_SE_VAP_CNTL_STATUS
, RADEON_TCL_BYPASS
);
93 OUT_BATCH_REGVAL(R200_SE_VAP_CNTL
, (R200_VAP_FORCE_W_TO_ONE
|
94 (9 << R200_VAP_VF_MAX_VTX_NUM__SHIFT
)));
95 OUT_BATCH_REGVAL(R200_SE_VTX_STATE_CNTL
, 0);
96 OUT_BATCH_REGVAL(R200_SE_VTE_CNTL
, 0);
97 OUT_BATCH_REGVAL(R200_SE_VTX_FMT_0
, R200_VTX_XY
);
98 OUT_BATCH_REGVAL(R200_SE_VTX_FMT_1
, (2 << R200_VTX_TEX0_COMP_CNT_SHIFT
));
99 OUT_BATCH_REGVAL(RADEON_SE_CNTL
, (RADEON_DIFFUSE_SHADE_GOURAUD
|
102 RADEON_VTX_PIX_CENTER_OGL
|
103 RADEON_ROUND_MODE_ROUND
|
104 RADEON_ROUND_PREC_4TH_PIX
));
108 static void inline emit_tx_setup(struct r200_context
*r200
,
109 mesa_format src_mesa_format
,
110 mesa_format dst_mesa_format
,
111 struct radeon_bo
*bo
,
117 uint32_t txformat
= R200_TXFORMAT_NON_POWER2
;
118 BATCH_LOCALS(&r200
->radeon
);
120 assert(width
<= 2048);
121 assert(height
<= 2048);
122 assert(offset
% 32 == 0);
124 #if UTIL_ARCH_LITTLE_ENDIAN
125 txformat
|= tx_table_le
[src_mesa_format
].format
;
127 txformat
|= tx_table_be
[src_mesa_format
].format
;
130 if (bo
->flags
& RADEON_BO_FLAGS_MACRO_TILE
)
131 offset
|= R200_TXO_MACRO_TILE
;
132 if (bo
->flags
& RADEON_BO_FLAGS_MICRO_TILE
)
133 offset
|= R200_TXO_MICRO_TILE
;
135 switch (dst_mesa_format
) {
137 case MESA_FORMAT_B8G8R8A8_UNORM
:
138 case MESA_FORMAT_B8G8R8X8_UNORM
:
139 case MESA_FORMAT_B5G6R5_UNORM
:
140 case MESA_FORMAT_B4G4R4A4_UNORM
:
141 case MESA_FORMAT_B5G5R5A1_UNORM
:
143 case MESA_FORMAT_A8R8G8B8_UNORM
:
144 case MESA_FORMAT_X8R8G8B8_UNORM
:
145 case MESA_FORMAT_R5G6B5_UNORM
:
146 case MESA_FORMAT_A4R4G4B4_UNORM
:
147 case MESA_FORMAT_A1R5G5B5_UNORM
:
149 case MESA_FORMAT_A_UNORM8
:
150 case MESA_FORMAT_L_UNORM8
:
151 case MESA_FORMAT_I_UNORM8
:
153 /* no swizzle required */
155 OUT_BATCH_REGVAL(RADEON_PP_CNTL
, (RADEON_TEX_0_ENABLE
|
156 RADEON_TEX_BLEND_0_ENABLE
));
157 OUT_BATCH_REGVAL(R200_PP_TXCBLEND_0
, (R200_TXC_ARG_A_ZERO
|
158 R200_TXC_ARG_B_ZERO
|
159 R200_TXC_ARG_C_R0_COLOR
|
161 OUT_BATCH_REGVAL(R200_PP_TXCBLEND2_0
, (R200_TXC_CLAMP_0_1
|
162 R200_TXC_OUTPUT_REG_R0
));
163 OUT_BATCH_REGVAL(R200_PP_TXABLEND_0
, (R200_TXA_ARG_A_ZERO
|
164 R200_TXA_ARG_B_ZERO
|
165 R200_TXA_ARG_C_R0_ALPHA
|
167 OUT_BATCH_REGVAL(R200_PP_TXABLEND2_0
, (R200_TXA_CLAMP_0_1
|
168 R200_TXA_OUTPUT_REG_R0
));
171 case MESA_FORMAT_A8B8G8R8_UNORM
:
172 case MESA_FORMAT_R8G8B8A8_UNORM
:
173 #if UTIL_ARCH_LITTLE_ENDIAN
174 if (dst_mesa_format
== MESA_FORMAT_A8B8G8R8_UNORM
) {
176 if (dst_mesa_format
== MESA_FORMAT_R8G8B8A8_UNORM
) {
179 OUT_BATCH_REGVAL(RADEON_PP_CNTL
, (RADEON_TEX_0_ENABLE
|
180 RADEON_TEX_BLEND_0_ENABLE
));
181 OUT_BATCH_REGVAL(R200_PP_TXCBLEND_0
, (R200_TXC_ARG_A_ZERO
|
182 R200_TXC_ARG_B_ZERO
|
183 R200_TXC_ARG_C_R0_COLOR
|
185 /* XXX I don't think this can work. This is output rotation, and alpha contains
186 * red, not alpha (we'd write gbrr). */
187 OUT_BATCH_REGVAL(R200_PP_TXCBLEND2_0
, (R200_TXC_CLAMP_0_1
|
188 R200_TXC_OUTPUT_ROTATE_GBA
|
189 R200_TXC_OUTPUT_REG_R0
));
190 OUT_BATCH_REGVAL(R200_PP_TXABLEND_0
, (R200_TXA_ARG_A_ZERO
|
191 R200_TXA_ARG_B_ZERO
|
192 R200_TXA_ARG_C_R0_ALPHA
|
194 OUT_BATCH_REGVAL(R200_PP_TXABLEND2_0
, (R200_TXA_CLAMP_0_1
|
195 (R200_TXA_REPL_RED
<< R200_TXA_REPL_ARG_C_SHIFT
) |
196 R200_TXA_OUTPUT_REG_R0
));
200 /* XXX pretty sure could do this with just 2 instead of 4 instructions.
202 * 1st: use RGA output rotation, rgb arg replicate b, a arg r, write mask rb.
203 * That's just one instruction in fact but I'm not entirely sure it works
204 * if some of those incoming r0 components are never written (due to mask)
205 * in the shader itself to r0.
206 * In any case this case (and the one above) may not be reachable with
207 * disabled Choose8888TexFormat code. */
209 OUT_BATCH_REGVAL(RADEON_PP_CNTL
, (RADEON_TEX_0_ENABLE
|
210 RADEON_TEX_BLEND_0_ENABLE
|
211 RADEON_TEX_BLEND_1_ENABLE
|
212 RADEON_TEX_BLEND_2_ENABLE
|
213 RADEON_TEX_BLEND_3_ENABLE
));
215 OUT_BATCH_REGVAL(R200_PP_TXCBLEND_0
, (R200_TXC_ARG_A_ZERO
|
216 R200_TXC_ARG_B_ZERO
|
217 R200_TXC_ARG_C_R0_COLOR
|
219 OUT_BATCH_REGVAL(R200_PP_TXCBLEND2_0
, (R200_TXC_CLAMP_0_1
|
220 R200_TXC_OUTPUT_MASK_R
|
221 (R200_TXC_REPL_BLUE
<< R200_TXC_REPL_ARG_C_SHIFT
) |
222 R200_TXC_OUTPUT_REG_R1
));
224 OUT_BATCH_REGVAL(R200_PP_TXABLEND_0
, (R200_TXA_ARG_A_ZERO
|
225 R200_TXA_ARG_B_ZERO
|
226 R200_TXA_ARG_C_R0_ALPHA
|
228 OUT_BATCH_REGVAL(R200_PP_TXABLEND2_0
, (R200_TXA_CLAMP_0_1
|
229 R200_TXA_OUTPUT_REG_R1
));
231 OUT_BATCH_REGVAL(R200_PP_TXCBLEND_1
, (R200_TXC_ARG_A_ZERO
|
232 R200_TXC_ARG_B_ZERO
|
233 R200_TXC_ARG_C_R0_COLOR
|
235 OUT_BATCH_REGVAL(R200_PP_TXCBLEND2_1
, (R200_TXC_CLAMP_0_1
|
236 R200_TXC_OUTPUT_MASK_G
|
237 (R200_TXC_REPL_GREEN
<< R200_TXC_REPL_ARG_C_SHIFT
) |
238 R200_TXC_OUTPUT_REG_R1
));
240 OUT_BATCH_REGVAL(R200_PP_TXABLEND_1
, (R200_TXA_ARG_A_ZERO
|
241 R200_TXA_ARG_B_ZERO
|
242 R200_TXA_ARG_C_R0_ALPHA
|
244 OUT_BATCH_REGVAL(R200_PP_TXABLEND2_1
, (R200_TXA_CLAMP_0_1
|
245 R200_TXA_OUTPUT_REG_R1
));
247 OUT_BATCH_REGVAL(R200_PP_TXCBLEND_2
, (R200_TXC_ARG_A_ZERO
|
248 R200_TXC_ARG_B_ZERO
|
249 R200_TXC_ARG_C_R0_COLOR
|
251 OUT_BATCH_REGVAL(R200_PP_TXCBLEND2_2
, (R200_TXC_CLAMP_0_1
|
252 R200_TXC_OUTPUT_MASK_B
|
253 (R200_TXC_REPL_RED
<< R200_TXC_REPL_ARG_C_SHIFT
) |
254 R200_TXC_OUTPUT_REG_R1
));
256 OUT_BATCH_REGVAL(R200_PP_TXABLEND_2
, (R200_TXA_ARG_A_ZERO
|
257 R200_TXA_ARG_B_ZERO
|
258 R200_TXA_ARG_C_R0_ALPHA
|
260 OUT_BATCH_REGVAL(R200_PP_TXABLEND2_2
, (R200_TXA_CLAMP_0_1
|
261 R200_TXA_OUTPUT_REG_R1
));
262 /* r0.rgb = r1.rgb */
263 OUT_BATCH_REGVAL(R200_PP_TXCBLEND_3
, (R200_TXC_ARG_A_ZERO
|
264 R200_TXC_ARG_B_ZERO
|
265 R200_TXC_ARG_C_R1_COLOR
|
267 OUT_BATCH_REGVAL(R200_PP_TXCBLEND2_3
, (R200_TXC_CLAMP_0_1
|
268 R200_TXC_OUTPUT_REG_R0
));
270 OUT_BATCH_REGVAL(R200_PP_TXABLEND_3
, (R200_TXA_ARG_A_ZERO
|
271 R200_TXA_ARG_B_ZERO
|
272 R200_TXA_ARG_C_R1_ALPHA
|
274 OUT_BATCH_REGVAL(R200_PP_TXABLEND2_3
, (R200_TXA_CLAMP_0_1
|
275 R200_TXA_OUTPUT_REG_R0
));
282 OUT_BATCH_REGVAL(R200_PP_CNTL_X
, 0);
283 OUT_BATCH_REGVAL(R200_PP_TXMULTI_CTL_0
, 0);
284 OUT_BATCH_REGVAL(R200_PP_TXFILTER_0
, (R200_CLAMP_S_CLAMP_LAST
|
285 R200_CLAMP_T_CLAMP_LAST
|
286 R200_MAG_FILTER_NEAREST
|
287 R200_MIN_FILTER_NEAREST
));
288 OUT_BATCH_REGVAL(R200_PP_TXFORMAT_0
, txformat
);
289 OUT_BATCH_REGVAL(R200_PP_TXFORMAT_X_0
, 0);
290 OUT_BATCH_REGVAL(R200_PP_TXSIZE_0
, ((width
- 1) |
291 ((height
- 1) << RADEON_TEX_VSIZE_SHIFT
)));
292 OUT_BATCH_REGVAL(R200_PP_TXPITCH_0
, pitch
* _mesa_get_format_bytes(src_mesa_format
) - 32);
294 OUT_BATCH_REGSEQ(R200_PP_TXOFFSET_0
, 1);
295 OUT_BATCH_RELOC(bo
, offset
, RADEON_GEM_DOMAIN_GTT
|RADEON_GEM_DOMAIN_VRAM
, 0, 0);
300 static inline void emit_cb_setup(struct r200_context
*r200
,
301 struct radeon_bo
*bo
,
303 mesa_format mesa_format
,
308 uint32_t dst_pitch
= pitch
;
309 uint32_t dst_format
= 0;
310 BATCH_LOCALS(&r200
->radeon
);
312 switch (mesa_format
) {
313 /* The first of each pair is for little, the second for big endian */
314 case MESA_FORMAT_B8G8R8A8_UNORM
:
315 case MESA_FORMAT_A8R8G8B8_UNORM
:
316 case MESA_FORMAT_B8G8R8X8_UNORM
:
317 case MESA_FORMAT_X8R8G8B8_UNORM
:
318 /* These two are valid both for little and big endian (swizzled) */
319 case MESA_FORMAT_A8B8G8R8_UNORM
:
320 case MESA_FORMAT_R8G8B8A8_UNORM
:
321 dst_format
= RADEON_COLOR_FORMAT_ARGB8888
;
323 case MESA_FORMAT_B5G6R5_UNORM
:
324 case MESA_FORMAT_R5G6B5_UNORM
:
325 dst_format
= RADEON_COLOR_FORMAT_RGB565
;
327 case MESA_FORMAT_B4G4R4A4_UNORM
:
328 case MESA_FORMAT_A4R4G4B4_UNORM
:
329 dst_format
= RADEON_COLOR_FORMAT_ARGB4444
;
331 case MESA_FORMAT_B5G5R5A1_UNORM
:
332 case MESA_FORMAT_A1R5G5B5_UNORM
:
333 dst_format
= RADEON_COLOR_FORMAT_ARGB1555
;
335 case MESA_FORMAT_A_UNORM8
:
336 case MESA_FORMAT_L_UNORM8
:
337 case MESA_FORMAT_I_UNORM8
:
338 dst_format
= RADEON_COLOR_FORMAT_RGB8
;
344 if (bo
->flags
& RADEON_BO_FLAGS_MACRO_TILE
)
345 dst_pitch
|= R200_COLOR_TILE_ENABLE
;
346 if (bo
->flags
& RADEON_BO_FLAGS_MICRO_TILE
)
347 dst_pitch
|= R200_COLOR_MICROTILE_ENABLE
;
350 OUT_BATCH_REGVAL(R200_RE_AUX_SCISSOR_CNTL
, 0);
351 OUT_BATCH_REGVAL(R200_RE_CNTL
, 0);
352 OUT_BATCH_REGVAL(RADEON_RE_TOP_LEFT
, 0);
353 OUT_BATCH_REGVAL(RADEON_RE_WIDTH_HEIGHT
, (((width
- 1) << RADEON_RE_WIDTH_SHIFT
) |
354 ((height
- 1) << RADEON_RE_HEIGHT_SHIFT
)));
355 OUT_BATCH_REGVAL(RADEON_RB3D_PLANEMASK
, 0xffffffff);
356 OUT_BATCH_REGVAL(RADEON_RB3D_BLENDCNTL
, RADEON_SRC_BLEND_GL_ONE
| RADEON_DST_BLEND_GL_ZERO
);
357 OUT_BATCH_REGVAL(RADEON_RB3D_CNTL
, dst_format
);
359 OUT_BATCH_REGSEQ(RADEON_RB3D_COLOROFFSET
, 1);
360 OUT_BATCH_RELOC(bo
, offset
, 0, RADEON_GEM_DOMAIN_GTT
|RADEON_GEM_DOMAIN_VRAM
, 0);
361 OUT_BATCH_REGSEQ(RADEON_RB3D_COLORPITCH
, 1);
362 OUT_BATCH_RELOC(bo
, dst_pitch
, 0, RADEON_GEM_DOMAIN_GTT
|RADEON_GEM_DOMAIN_VRAM
, 0);
367 static GLboolean
validate_buffers(struct r200_context
*r200
,
368 struct radeon_bo
*src_bo
,
369 struct radeon_bo
*dst_bo
)
373 radeon_cs_space_reset_bos(r200
->radeon
.cmdbuf
.cs
);
375 ret
= radeon_cs_space_check_with_bo(r200
->radeon
.cmdbuf
.cs
,
376 src_bo
, RADEON_GEM_DOMAIN_VRAM
| RADEON_GEM_DOMAIN_GTT
, 0);
380 ret
= radeon_cs_space_check_with_bo(r200
->radeon
.cmdbuf
.cs
,
381 dst_bo
, 0, RADEON_GEM_DOMAIN_VRAM
| RADEON_GEM_DOMAIN_GTT
);
389 * Calculate texcoords for given image region.
390 * Output values are [minx, maxx, miny, maxy]
392 static inline void calc_tex_coords(float img_width
, float img_height
,
394 float reg_width
, float reg_height
,
395 unsigned flip_y
, float *buf
)
397 buf
[0] = x
/ img_width
;
398 buf
[1] = buf
[0] + reg_width
/ img_width
;
399 buf
[2] = y
/ img_height
;
400 buf
[3] = buf
[2] + reg_height
/ img_height
;
403 buf
[2] = 1.0 - buf
[2];
404 buf
[3] = 1.0 - buf
[3];
408 static inline void emit_draw_packet(struct r200_context
*r200
,
409 unsigned src_width
, unsigned src_height
,
410 unsigned src_x_offset
, unsigned src_y_offset
,
411 unsigned dst_x_offset
, unsigned dst_y_offset
,
412 unsigned reg_width
, unsigned reg_height
,
417 BATCH_LOCALS(&r200
->radeon
);
419 calc_tex_coords(src_width
, src_height
,
420 src_x_offset
, src_y_offset
,
421 reg_width
, reg_height
,
424 verts
[0] = dst_x_offset
;
425 verts
[1] = dst_y_offset
+ reg_height
;
426 verts
[2] = texcoords
[0];
427 verts
[3] = texcoords
[3];
429 verts
[4] = dst_x_offset
+ reg_width
;
430 verts
[5] = dst_y_offset
+ reg_height
;
431 verts
[6] = texcoords
[1];
432 verts
[7] = texcoords
[3];
434 verts
[8] = dst_x_offset
+ reg_width
;
435 verts
[9] = dst_y_offset
;
436 verts
[10] = texcoords
[1];
437 verts
[11] = texcoords
[2];
440 OUT_BATCH(R200_CP_CMD_3D_DRAW_IMMD_2
| (12 << 16));
441 OUT_BATCH(RADEON_CP_VC_CNTL_PRIM_WALK_RING
|
442 RADEON_CP_VC_CNTL_PRIM_TYPE_RECT_LIST
|
444 OUT_BATCH_TABLE(verts
, 12);
449 * Copy a region of [@a width x @a height] pixels from source buffer
450 * to destination buffer.
451 * @param[in] r200 r200 context
452 * @param[in] src_bo source radeon buffer object
453 * @param[in] src_offset offset of the source image in the @a src_bo
454 * @param[in] src_mesaformat source image format
455 * @param[in] src_pitch aligned source image width
456 * @param[in] src_width source image width
457 * @param[in] src_height source image height
458 * @param[in] src_x_offset x offset in the source image
459 * @param[in] src_y_offset y offset in the source image
460 * @param[in] dst_bo destination radeon buffer object
461 * @param[in] dst_offset offset of the destination image in the @a dst_bo
462 * @param[in] dst_mesaformat destination image format
463 * @param[in] dst_pitch aligned destination image width
464 * @param[in] dst_width destination image width
465 * @param[in] dst_height destination image height
466 * @param[in] dst_x_offset x offset in the destination image
467 * @param[in] dst_y_offset y offset in the destination image
468 * @param[in] width region width
469 * @param[in] height region height
470 * @param[in] flip_y set if y coords of the source image need to be flipped
472 unsigned r200_blit(struct gl_context
*ctx
,
473 struct radeon_bo
*src_bo
,
475 mesa_format src_mesaformat
,
479 unsigned src_x_offset
,
480 unsigned src_y_offset
,
481 struct radeon_bo
*dst_bo
,
483 mesa_format dst_mesaformat
,
487 unsigned dst_x_offset
,
488 unsigned dst_y_offset
,
493 struct r200_context
*r200
= R200_CONTEXT(ctx
);
495 if (!r200_check_blit(dst_mesaformat
, dst_pitch
))
498 /* Make sure that colorbuffer has even width - hw limitation */
499 if (dst_pitch
% 2 > 0)
502 /* Need to clamp the region size to make sure
503 * we don't read outside of the source buffer
504 * or write outside of the destination buffer.
506 if (reg_width
+ src_x_offset
> src_width
)
507 reg_width
= src_width
- src_x_offset
;
508 if (reg_height
+ src_y_offset
> src_height
)
509 reg_height
= src_height
- src_y_offset
;
510 if (reg_width
+ dst_x_offset
> dst_width
)
511 reg_width
= dst_width
- dst_x_offset
;
512 if (reg_height
+ dst_y_offset
> dst_height
)
513 reg_height
= dst_height
- dst_y_offset
;
515 if (src_bo
== dst_bo
) {
519 if (src_offset
% 32 || dst_offset
% 32) {
524 fprintf(stderr
, "src: size [%d x %d], pitch %d, "
525 "offset [%d x %d], format %s, bo %p\n",
526 src_width
, src_height
, src_pitch
,
527 src_x_offset
, src_y_offset
,
528 _mesa_get_format_name(src_mesaformat
),
530 fprintf(stderr
, "dst: pitch %d, offset[%d x %d], format %s, bo %p\n",
531 dst_pitch
, dst_x_offset
, dst_y_offset
,
532 _mesa_get_format_name(dst_mesaformat
), dst_bo
);
533 fprintf(stderr
, "region: %d x %d\n", reg_width
, reg_height
);
536 /* Flush is needed to make sure that source buffer has correct data */
537 radeonFlush(&r200
->radeon
.glCtx
);
539 rcommonEnsureCmdBufSpace(&r200
->radeon
, 102, __func__
);
541 if (!validate_buffers(r200
, src_bo
, dst_bo
))
545 emit_vtx_state(r200
);
547 emit_tx_setup(r200
, src_mesaformat
, dst_mesaformat
, src_bo
, src_offset
, src_width
, src_height
, src_pitch
);
549 emit_cb_setup(r200
, dst_bo
, dst_offset
, dst_mesaformat
, dst_pitch
, dst_width
, dst_height
);
551 emit_draw_packet(r200
, src_width
, src_height
,
552 src_x_offset
, src_y_offset
,
553 dst_x_offset
, dst_y_offset
,
554 reg_width
, reg_height
,
559 /* We submitted those packets outside our state atom mechanism. Thus
560 * make sure the atoms are resubmitted the next time. */
561 r200
->hw
.cst
.dirty
= GL_TRUE
;
562 r200
->hw
.ctx
.dirty
= GL_TRUE
;
563 r200
->hw
.vap
.dirty
= GL_TRUE
;
564 r200
->hw
.msk
.dirty
= GL_TRUE
;
565 r200
->hw
.pix
[0].dirty
= GL_TRUE
;
566 r200
->hw
.pix
[1].dirty
= GL_TRUE
;
567 r200
->hw
.pix
[2].dirty
= GL_TRUE
;
568 r200
->hw
.pix
[3].dirty
= GL_TRUE
;
569 r200
->hw
.sci
.dirty
= GL_TRUE
;
570 r200
->hw
.set
.dirty
= GL_TRUE
;
571 r200
->hw
.tex
[0].dirty
= GL_TRUE
;
572 r200
->hw
.vte
.dirty
= GL_TRUE
;
573 r200
->hw
.vtx
.dirty
= GL_TRUE
;