+ info->src.box.height == dst_height &&
+ /* Dst must be tiled. If it's not, we have to use a temporary
+ * resource which is tiled. */
+ dst_tile_mode >= RADEON_SURF_MODE_1D;
+}
+
+static void r600_clear_buffer(struct pipe_context *ctx, struct pipe_resource *dst,
+ unsigned offset, unsigned size, unsigned char value);
+
+static void evergreen_set_clear_color(struct pipe_surface *cbuf,
+ const union pipe_color_union *color)
+{
+ unsigned *clear_value = ((struct r600_texture *)cbuf->texture)->color_clear_value;
+ union util_color uc;
+
+ memset(&uc, 0, sizeof(uc));
+
+ if (util_format_is_pure_uint(cbuf->format)) {
+ util_format_write_4ui(cbuf->format, color->ui, 0, &uc, 0, 0, 0, 1, 1);
+ } else if (util_format_is_pure_sint(cbuf->format)) {
+ util_format_write_4i(cbuf->format, color->i, 0, &uc, 0, 0, 0, 1, 1);
+ } else {
+ util_pack_color(color->f, cbuf->format, &uc);
+ }
+
+ memcpy(clear_value, &uc, 2 * sizeof(uint32_t));
+}
+
+static bool can_fast_clear_color(struct pipe_context *ctx)
+{
+ struct r600_context *rctx = (struct r600_context *)ctx;
+ struct pipe_framebuffer_state *fb = &rctx->framebuffer.state;
+ int i;
+
+ if (rctx->b.chip_class < EVERGREEN) {
+ return false;
+ }
+
+ for (i = 0; i < fb->nr_cbufs; i++) {
+ struct r600_texture *tex = (struct r600_texture *)fb->cbufs[i]->texture;
+
+ if (tex->cmask_size == 0) {
+ return false;
+ }
+
+ /* 128-bit formats are unuspported */
+ if (util_format_get_blocksizebits(fb->cbufs[i]->format) > 64) {
+ return false;
+ }
+
+ /* the clear is allowed if all layers are bound */
+ if (fb->cbufs[i]->u.tex.first_layer != 0 ||
+ fb->cbufs[i]->u.tex.last_layer != util_max_layer(&tex->resource.b.b, 0)) {
+ return false;
+ }
+ }
+
+ return true;