1 /* 2 * Copyright 2009 Marek Olk <maraeo (at) gmail.com> 3 * 4 * Permission is hereby granted, free of charge, to any person obtaining a 5 * copy of this software and associated documentation files (the "Software"), 6 * to deal in the Software without restriction, including without limitation 7 * on the rights to use, copy, modify, merge, publish, distribute, sub 8 * license, and/or sell copies of the Software, and to permit persons to whom 9 * the Software is furnished to do so, subject to the following conditions: 10 * 11 * The above copyright notice and this permission notice (including the next 12 * paragraph) shall be included in all copies or substantial portions of the 13 * Software. 14 * 15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL 18 * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, 19 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 20 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 21 * USE OR OTHER DEALINGS IN THE SOFTWARE. */ 22 23 #include "r300_context.h" 24 #include "r300_emit.h" 25 #include "r300_texture.h" 26 27 #include "util/u_format.h" 28 #include "util/u_pack_color.h" 29 #include "util/u_surface.h" 30 31 enum r300_blitter_op /* bitmask */ 32 { 33 R300_STOP_QUERY = 1, 34 R300_SAVE_TEXTURES = 2, 35 R300_SAVE_FRAMEBUFFER = 4, 36 R300_IGNORE_RENDER_COND = 8, 37 38 R300_CLEAR = R300_STOP_QUERY, 39 40 R300_CLEAR_SURFACE = R300_STOP_QUERY | R300_SAVE_FRAMEBUFFER, 41 42 R300_COPY = R300_STOP_QUERY | R300_SAVE_FRAMEBUFFER | 43 R300_SAVE_TEXTURES | R300_IGNORE_RENDER_COND, 44 45 R300_DECOMPRESS = R300_STOP_QUERY | R300_IGNORE_RENDER_COND, 46 }; 47 48 static void r300_blitter_begin(struct r300_context* r300, enum r300_blitter_op op) 49 { 50 if ((op & R300_STOP_QUERY) && r300->query_current) { 51 r300->blitter_saved_query = r300->query_current; 52 r300_stop_query(r300); 53 } 54 55 /* Yeah we have to save all those states to ensure the blitter operation 56 * is really transparent. The states will be restored by the blitter once 57 * copying is done. */ 58 util_blitter_save_blend(r300->blitter, r300->blend_state.state); 59 util_blitter_save_depth_stencil_alpha(r300->blitter, r300->dsa_state.state); 60 util_blitter_save_stencil_ref(r300->blitter, &(r300->stencil_ref)); 61 util_blitter_save_rasterizer(r300->blitter, r300->rs_state.state); 62 util_blitter_save_fragment_shader(r300->blitter, r300->fs.state); 63 util_blitter_save_vertex_shader(r300->blitter, r300->vs_state.state); 64 util_blitter_save_viewport(r300->blitter, &r300->viewport); 65 util_blitter_save_vertex_buffers(r300->blitter, r300->nr_vertex_buffers, 66 r300->vertex_buffer); 67 util_blitter_save_vertex_elements(r300->blitter, r300->velems); 68 69 if (op & R300_SAVE_FRAMEBUFFER) { 70 util_blitter_save_framebuffer(r300->blitter, r300->fb_state.state); 71 } 72 73 if (op & R300_SAVE_TEXTURES) { 74 struct r300_textures_state* state = 75 (struct r300_textures_state*)r300->textures_state.state; 76 77 util_blitter_save_fragment_sampler_states( 78 r300->blitter, state->sampler_state_count, 79 (void**)state->sampler_states); 80 81 util_blitter_save_fragment_sampler_views( 82 r300->blitter, state->sampler_view_count, 83 (struct pipe_sampler_view**)state->sampler_views); 84 } 85 86 if (op & R300_IGNORE_RENDER_COND) { 87 /* Save the flag. */ 88 r300->blitter_saved_skip_rendering = r300->skip_rendering+1; 89 r300->skip_rendering = FALSE; 90 } else { 91 r300->blitter_saved_skip_rendering = 0; 92 } 93 } 94 95 static void r300_blitter_end(struct r300_context *r300) 96 { 97 if (r300->blitter_saved_query) { 98 r300_resume_query(r300, r300->blitter_saved_query); 99 r300->blitter_saved_query = NULL; 100 } 101 102 if (r300->blitter_saved_skip_rendering) { 103 /* Restore the flag. */ 104 r300->skip_rendering = r300->blitter_saved_skip_rendering-1; 105 } 106 } 107 108 static uint32_t r300_depth_clear_cb_value(enum pipe_format format, 109 const float* rgba) 110 { 111 union util_color uc; 112 util_pack_color(rgba, format, &uc); 113 114 if (util_format_get_blocksizebits(format) == 32) 115 return uc.ui; 116 else 117 return uc.us | (uc.us << 16); 118 } 119 120 static boolean r300_cbzb_clear_allowed(struct r300_context *r300, 121 unsigned clear_buffers) 122 { 123 struct pipe_framebuffer_state *fb = 124 (struct pipe_framebuffer_state*)r300->fb_state.state; 125 126 /* Only color clear allowed, and only one colorbuffer. */ 127 if (clear_buffers != PIPE_CLEAR_COLOR || fb->nr_cbufs != 1) 128 return FALSE; 129 130 return r300_surface(fb->cbufs[0])->cbzb_allowed; 131 } 132 133 static boolean r300_fast_zclear_allowed(struct r300_context *r300) 134 { 135 struct pipe_framebuffer_state *fb = 136 (struct pipe_framebuffer_state*)r300->fb_state.state; 137 138 return r300_resource(fb->zsbuf->texture)->tex.zmask_dwords[fb->zsbuf->u.tex.level] != 0; 139 } 140 141 static boolean r300_hiz_clear_allowed(struct r300_context *r300) 142 { 143 struct pipe_framebuffer_state *fb = 144 (struct pipe_framebuffer_state*)r300->fb_state.state; 145 146 return r300_resource(fb->zsbuf->texture)->tex.hiz_dwords[fb->zsbuf->u.tex.level] != 0; 147 } 148 149 static uint32_t r300_depth_clear_value(enum pipe_format format, 150 double depth, unsigned stencil) 151 { 152 switch (format) { 153 case PIPE_FORMAT_Z16_UNORM: 154 case PIPE_FORMAT_X8Z24_UNORM: 155 return util_pack_z(format, depth); 156 157 case PIPE_FORMAT_S8_UINT_Z24_UNORM: 158 return util_pack_z_stencil(format, depth, stencil); 159 160 default: 161 assert(0); 162 return 0; 163 } 164 } 165 166 static uint32_t r300_hiz_clear_value(double depth) 167 { 168 uint32_t r = (uint32_t)(CLAMP(depth, 0, 1) * 255.5); 169 assert(r <= 255); 170 return r | (r << 8) | (r << 16) | (r << 24); 171 } 172 173 /* Clear currently bound buffers. */ 174 static void r300_clear(struct pipe_context* pipe, 175 unsigned buffers, 176 const union pipe_color_union *color, 177 double depth, 178 unsigned stencil) 179 { 180 /* My notes about Zbuffer compression: 181 * 182 * 1) The zbuffer must be micro-tiled and whole microtiles must be 183 * written if compression is enabled. If microtiling is disabled, 184 * it locks up. 185 * 186 * 2) There is ZMASK RAM which contains a compressed zbuffer. 187 * Each dword of the Z Mask contains compression information 188 * for 16 4x4 pixel tiles, that is 2 bits for each tile. 189 * On chips with 2 Z pipes, every other dword maps to a different 190 * pipe. On newer chipsets, there is a new compression mode 191 * with 8x8 pixel tiles per 2 bits. 192 * 193 * 3) The FASTFILL bit has nothing to do with filling. It only tells hw 194 * it should look in the ZMASK RAM first before fetching from a real 195 * zbuffer. 196 * 197 * 4) If a pixel is in a cleared state, ZB_DEPTHCLEARVALUE is returned 198 * during zbuffer reads instead of the value that is actually stored 199 * in the zbuffer memory. A pixel is in a cleared state when its ZMASK 200 * is equal to 0. Therefore, if you clear ZMASK with zeros, you may 201 * leave the zbuffer memory uninitialized, but then you must enable 202 * compression, so that the ZMASK RAM is actually used. 203 * 204 * 5) Each 4x4 (or 8x8) tile is automatically decompressed and recompressed 205 * during zbuffer updates. A special decompressing operation should be 206 * used to fully decompress a zbuffer, which basically just stores all 207 * compressed tiles in ZMASK to the zbuffer memory. 208 * 209 * 6) For a 16-bit zbuffer, compression causes a hung with one or 210 * two samples and should not be used. 211 * 212 * 7) FORCE_COMPRESSED_STENCIL_VALUE should be enabled for stencil clears 213 * to avoid needless decompression. 214 * 215 * 8) Fastfill must not be used if reading of compressed Z data is disabled 216 * and writing of compressed Z data is enabled (RD/WR_COMP_ENABLE), 217 * i.e. it cannot be used to compress the zbuffer. 218 * 219 * 9) ZB_CB_CLEAR does not interact with zbuffer compression in any way. 220 * 221 * - Marek 222 */ 223 224 struct r300_context* r300 = r300_context(pipe); 225 struct pipe_framebuffer_state *fb = 226 (struct pipe_framebuffer_state*)r300->fb_state.state; 227 struct r300_hyperz_state *hyperz = 228 (struct r300_hyperz_state*)r300->hyperz_state.state; 229 uint32_t width = fb->width; 230 uint32_t height = fb->height; 231 uint32_t hyperz_dcv = hyperz->zb_depthclearvalue; 232 233 /* Enable fast Z clear. 234 * The zbuffer must be in micro-tiled mode, otherwise it locks up. */ 235 if (buffers & PIPE_CLEAR_DEPTHSTENCIL) { 236 boolean zmask_clear, hiz_clear; 237 238 zmask_clear = r300_fast_zclear_allowed(r300); 239 hiz_clear = r300_hiz_clear_allowed(r300); 240 241 /* If we need Hyper-Z. */ 242 if (zmask_clear || hiz_clear) { 243 r300->num_z_clears++; 244 245 /* Try to obtain the access to Hyper-Z buffers if we don't have one. */ 246 if (!r300->hyperz_enabled) { 247 r300->hyperz_enabled = 248 r300->rws->cs_request_feature(r300->cs, 249 RADEON_FID_R300_HYPERZ_ACCESS, 250 TRUE); 251 if (r300->hyperz_enabled) { 252 /* Need to emit HyperZ buffer regs for the first time. */ 253 r300_mark_fb_state_dirty(r300, R300_CHANGED_HYPERZ_FLAG); 254 } 255 } 256 257 /* Setup Hyper-Z clears. */ 258 if (r300->hyperz_enabled) { 259 DBG(r300, DBG_HYPERZ, "r300: Clear memory: %s%s\n", 260 zmask_clear ? "ZMASK " : "", hiz_clear ? "HIZ" : ""); 261 262 if (zmask_clear) { 263 hyperz_dcv = hyperz->zb_depthclearvalue = 264 r300_depth_clear_value(fb->zsbuf->format, depth, stencil); 265 266 r300_mark_atom_dirty(r300, &r300->zmask_clear); 267 buffers &= ~PIPE_CLEAR_DEPTHSTENCIL; 268 } 269 270 if (hiz_clear) { 271 r300->hiz_clear_value = r300_hiz_clear_value(depth); 272 r300_mark_atom_dirty(r300, &r300->hiz_clear); 273 } 274 } 275 } 276 } 277 278 /* Enable CBZB clear. */ 279 if (r300_cbzb_clear_allowed(r300, buffers)) { 280 struct r300_surface *surf = r300_surface(fb->cbufs[0]); 281 282 hyperz->zb_depthclearvalue = 283 r300_depth_clear_cb_value(surf->base.format, color->f); 284 285 width = surf->cbzb_width; 286 height = surf->cbzb_height; 287 288 r300->cbzb_clear = TRUE; 289 r300_mark_fb_state_dirty(r300, R300_CHANGED_HYPERZ_FLAG); 290 } 291 292 /* Clear. */ 293 if (buffers) { 294 enum pipe_format cformat = fb->nr_cbufs ? fb->cbufs[0]->format : PIPE_FORMAT_NONE; 295 /* Clear using the blitter. */ 296 r300_blitter_begin(r300, R300_CLEAR); 297 util_blitter_clear(r300->blitter, 298 width, 299 height, 300 fb->nr_cbufs, 301 buffers, cformat, color, depth, stencil); 302 r300_blitter_end(r300); 303 } else if (r300->zmask_clear.dirty || r300->hiz_clear.dirty) { 304 /* Just clear zmask and hiz now, this does not use the standard draw 305 * procedure. */ 306 /* Calculate zmask_clear and hiz_clear atom sizes. */ 307 unsigned dwords = 308 (r300->zmask_clear.dirty ? r300->zmask_clear.size : 0) + 309 (r300->hiz_clear.dirty ? r300->hiz_clear.size : 0) + 310 r300_get_num_cs_end_dwords(r300); 311 312 /* Reserve CS space. */ 313 if (dwords > (RADEON_MAX_CMDBUF_DWORDS - r300->cs->cdw)) { 314 r300_flush(&r300->context, RADEON_FLUSH_ASYNC, NULL); 315 } 316 317 /* Emit clear packets. */ 318 if (r300->zmask_clear.dirty) { 319 r300_emit_zmask_clear(r300, r300->zmask_clear.size, 320 r300->zmask_clear.state); 321 r300->zmask_clear.dirty = FALSE; 322 } 323 if (r300->hiz_clear.dirty) { 324 r300_emit_hiz_clear(r300, r300->hiz_clear.size, 325 r300->hiz_clear.state); 326 r300->hiz_clear.dirty = FALSE; 327 } 328 } else { 329 assert(0); 330 } 331 332 /* Disable CBZB clear. */ 333 if (r300->cbzb_clear) { 334 r300->cbzb_clear = FALSE; 335 hyperz->zb_depthclearvalue = hyperz_dcv; 336 r300_mark_fb_state_dirty(r300, R300_CHANGED_HYPERZ_FLAG); 337 } 338 339 /* Enable fastfill and/or hiz. 340 * 341 * If we cleared zmask/hiz, it's in use now. The Hyper-Z state update 342 * looks if zmask/hiz is in use and programs hardware accordingly. */ 343 if (r300->zmask_in_use || r300->hiz_in_use) { 344 r300_mark_atom_dirty(r300, &r300->hyperz_state); 345 } 346 } 347 348 /* Clear a region of a color surface to a constant value. */ 349 static void r300_clear_render_target(struct pipe_context *pipe, 350 struct pipe_surface *dst, 351 const union pipe_color_union *color, 352 unsigned dstx, unsigned dsty, 353 unsigned width, unsigned height) 354 { 355 struct r300_context *r300 = r300_context(pipe); 356 357 r300_blitter_begin(r300, R300_CLEAR_SURFACE); 358 util_blitter_clear_render_target(r300->blitter, dst, color, 359 dstx, dsty, width, height); 360 r300_blitter_end(r300); 361 } 362 363 /* Clear a region of a depth stencil surface. */ 364 static void r300_clear_depth_stencil(struct pipe_context *pipe, 365 struct pipe_surface *dst, 366 unsigned clear_flags, 367 double depth, 368 unsigned stencil, 369 unsigned dstx, unsigned dsty, 370 unsigned width, unsigned height) 371 { 372 struct r300_context *r300 = r300_context(pipe); 373 struct pipe_framebuffer_state *fb = 374 (struct pipe_framebuffer_state*)r300->fb_state.state; 375 376 if (r300->zmask_in_use && !r300->locked_zbuffer) { 377 if (fb->zsbuf->texture == dst->texture) { 378 r300_decompress_zmask(r300); 379 } 380 } 381 382 /* XXX Do not decompress ZMask of the currently-set zbuffer. */ 383 r300_blitter_begin(r300, R300_CLEAR_SURFACE); 384 util_blitter_clear_depth_stencil(r300->blitter, dst, clear_flags, depth, stencil, 385 dstx, dsty, width, height); 386 r300_blitter_end(r300); 387 } 388 389 void r300_decompress_zmask(struct r300_context *r300) 390 { 391 struct pipe_framebuffer_state *fb = 392 (struct pipe_framebuffer_state*)r300->fb_state.state; 393 394 if (!r300->zmask_in_use || r300->locked_zbuffer) 395 return; 396 397 r300->zmask_decompress = TRUE; 398 r300_mark_atom_dirty(r300, &r300->hyperz_state); 399 400 r300_blitter_begin(r300, R300_DECOMPRESS); 401 util_blitter_custom_clear_depth(r300->blitter, fb->width, fb->height, 0, 402 r300->dsa_decompress_zmask); 403 r300_blitter_end(r300); 404 405 r300->zmask_decompress = FALSE; 406 r300->zmask_in_use = FALSE; 407 r300_mark_atom_dirty(r300, &r300->hyperz_state); 408 } 409 410 void r300_decompress_zmask_locked_unsafe(struct r300_context *r300) 411 { 412 struct pipe_framebuffer_state fb; 413 414 memset(&fb, 0, sizeof(fb)); 415 fb.width = r300->locked_zbuffer->width; 416 fb.height = r300->locked_zbuffer->height; 417 fb.zsbuf = r300->locked_zbuffer; 418 419 r300->context.set_framebuffer_state(&r300->context, &fb); 420 r300_decompress_zmask(r300); 421 } 422 423 void r300_decompress_zmask_locked(struct r300_context *r300) 424 { 425 struct pipe_framebuffer_state saved_fb; 426 427 memset(&saved_fb, 0, sizeof(saved_fb)); 428 util_copy_framebuffer_state(&saved_fb, r300->fb_state.state); 429 r300_decompress_zmask_locked_unsafe(r300); 430 r300->context.set_framebuffer_state(&r300->context, &saved_fb); 431 util_unreference_framebuffer_state(&saved_fb); 432 433 pipe_surface_reference(&r300->locked_zbuffer, NULL); 434 } 435 436 bool r300_is_blit_supported(enum pipe_format format) 437 { 438 const struct util_format_description *desc = 439 util_format_description(format); 440 441 return desc->layout == UTIL_FORMAT_LAYOUT_PLAIN || 442 desc->layout == UTIL_FORMAT_LAYOUT_S3TC || 443 desc->layout == UTIL_FORMAT_LAYOUT_RGTC; 444 } 445 446 /* Copy a block of pixels from one surface to another. */ 447 static void r300_resource_copy_region(struct pipe_context *pipe, 448 struct pipe_resource *dst, 449 unsigned dst_level, 450 unsigned dstx, unsigned dsty, unsigned dstz, 451 struct pipe_resource *src, 452 unsigned src_level, 453 const struct pipe_box *src_box) 454 { 455 struct pipe_screen *screen = pipe->screen; 456 struct r300_context *r300 = r300_context(pipe); 457 struct pipe_framebuffer_state *fb = 458 (struct pipe_framebuffer_state*)r300->fb_state.state; 459 unsigned src_width0 = r300_resource(src)->tex.width0; 460 unsigned src_height0 = r300_resource(src)->tex.height0; 461 unsigned dst_width0 = r300_resource(dst)->tex.width0; 462 unsigned dst_height0 = r300_resource(dst)->tex.height0; 463 unsigned layout; 464 struct pipe_box box; 465 struct pipe_sampler_view src_templ, *src_view; 466 struct pipe_surface dst_templ, *dst_view; 467 468 /* Fallback for buffers. */ 469 if ((dst->target == PIPE_BUFFER && src->target == PIPE_BUFFER) || 470 !r300_is_blit_supported(dst->format)) { 471 util_resource_copy_region(pipe, dst, dst_level, dstx, dsty, dstz, 472 src, src_level, src_box); 473 return; 474 } 475 476 /* The code below changes the texture format so that the copy can be done 477 * on hardware. E.g. depth-stencil surfaces are copied as RGBA 478 * colorbuffers. */ 479 480 util_blitter_default_dst_texture(&dst_templ, dst, dst_level, dstz, src_box); 481 util_blitter_default_src_texture(&src_templ, src, src_level); 482 483 layout = util_format_description(dst_templ.format)->layout; 484 485 /* Handle non-renderable plain formats. */ 486 if (layout == UTIL_FORMAT_LAYOUT_PLAIN && 487 (!screen->is_format_supported(screen, src_templ.format, src->target, 488 src->nr_samples, 489 PIPE_BIND_SAMPLER_VIEW) || 490 !screen->is_format_supported(screen, dst_templ.format, dst->target, 491 dst->nr_samples, 492 PIPE_BIND_RENDER_TARGET))) { 493 switch (util_format_get_blocksize(dst_templ.format)) { 494 case 1: 495 dst_templ.format = PIPE_FORMAT_I8_UNORM; 496 break; 497 case 2: 498 dst_templ.format = PIPE_FORMAT_B4G4R4A4_UNORM; 499 break; 500 case 4: 501 dst_templ.format = PIPE_FORMAT_B8G8R8A8_UNORM; 502 break; 503 case 8: 504 dst_templ.format = PIPE_FORMAT_R16G16B16A16_UNORM; 505 break; 506 default: 507 debug_printf("r300: copy_region: Unhandled format: %s. Falling back to software.\n" 508 "r300: copy_region: Software fallback doesn't work for tiled textures.\n", 509 util_format_short_name(dst_templ.format)); 510 } 511 src_templ.format = dst_templ.format; 512 } 513 514 /* Handle compressed formats. */ 515 if (layout == UTIL_FORMAT_LAYOUT_S3TC || 516 layout == UTIL_FORMAT_LAYOUT_RGTC) { 517 assert(src_templ.format == dst_templ.format); 518 519 box = *src_box; 520 src_box = &box; 521 522 dst_width0 = align(dst_width0, 4); 523 dst_height0 = align(dst_height0, 4); 524 src_width0 = align(src_width0, 4); 525 src_height0 = align(src_height0, 4); 526 box.width = align(box.width, 4); 527 box.height = align(box.height, 4); 528 529 switch (util_format_get_blocksize(dst_templ.format)) { 530 case 8: 531 /* one 4x4 pixel block has 8 bytes. 532 * we set 1 pixel = 4 bytes ===> 1 block corrensponds to 2 pixels. */ 533 dst_templ.format = PIPE_FORMAT_R8G8B8A8_UNORM; 534 dst_width0 = dst_width0 / 2; 535 src_width0 = src_width0 / 2; 536 dstx /= 2; 537 box.x /= 2; 538 box.width /= 2; 539 break; 540 case 16: 541 /* one 4x4 pixel block has 16 bytes. 542 * we set 1 pixel = 4 bytes ===> 1 block corresponds to 4 pixels. */ 543 dst_templ.format = PIPE_FORMAT_R8G8B8A8_UNORM; 544 break; 545 } 546 src_templ.format = dst_templ.format; 547 548 dst_height0 = dst_height0 / 4; 549 src_height0 = src_height0 / 4; 550 dsty /= 4; 551 box.y /= 4; 552 box.height /= 4; 553 } 554 555 /* Fallback for textures. */ 556 if (!screen->is_format_supported(screen, dst_templ.format, 557 dst->target, dst->nr_samples, 558 PIPE_BIND_RENDER_TARGET) || 559 !screen->is_format_supported(screen, src_templ.format, 560 src->target, src->nr_samples, 561 PIPE_BIND_SAMPLER_VIEW)) { 562 assert(0 && "this shouldn't happen, update r300_is_blit_supported"); 563 util_resource_copy_region(pipe, dst, dst_level, dstx, dsty, dstz, 564 src, src_level, src_box); 565 return; 566 } 567 568 /* Decompress ZMASK. */ 569 if (r300->zmask_in_use && !r300->locked_zbuffer) { 570 if (fb->zsbuf->texture == src || 571 fb->zsbuf->texture == dst) { 572 r300_decompress_zmask(r300); 573 } 574 } 575 576 dst_view = r300_create_surface_custom(pipe, dst, &dst_templ, dst_width0, dst_height0); 577 src_view = r300_create_sampler_view_custom(pipe, src, &src_templ, src_width0, src_height0); 578 579 r300_blitter_begin(r300, R300_COPY); 580 util_blitter_copy_texture_view(r300->blitter, dst_view, ~0, dstx, dsty, 581 src_view, 0, src_box, 582 src_width0, src_height0, PIPE_MASK_RGBAZS); 583 r300_blitter_end(r300); 584 585 pipe_surface_reference(&dst_view, NULL); 586 pipe_sampler_view_reference(&src_view, NULL); 587 } 588 589 void r300_init_blit_functions(struct r300_context *r300) 590 { 591 r300->context.clear = r300_clear; 592 r300->context.clear_render_target = r300_clear_render_target; 593 r300->context.clear_depth_stencil = r300_clear_depth_stencil; 594 r300->context.resource_copy_region = r300_resource_copy_region; 595 } 596