+ if (buffers & PIPE_CLEAR_COLOR && rctx->b.chip_class >= EVERGREEN) {
+ evergreen_do_fast_color_clear(&rctx->b, fb, &rctx->framebuffer.atom,
+ &buffers, NULL, color);
+ if (!buffers)
+ return; /* all buffers have been fast cleared */
+ }
+
+ if (buffers & PIPE_CLEAR_COLOR) {
+ int i;
+
+ /* These buffers cannot use fast clear, make sure to disable expansion. */
+ for (i = 0; i < fb->nr_cbufs; i++) {
+ struct r600_texture *tex;
+
+ /* If not clearing this buffer, skip. */
+ if (!(buffers & (PIPE_CLEAR_COLOR0 << i)))
+ continue;
+
+ if (!fb->cbufs[i])
+ continue;
+
+ tex = (struct r600_texture *)fb->cbufs[i]->texture;
+ if (tex->fmask.size == 0)
+ tex->dirty_level_mask &= ~(1 << fb->cbufs[i]->u.tex.level);
+ }
+ }
+
+ /* if hyperz enabled just clear hyperz */
+ if (fb->zsbuf && (buffers & PIPE_CLEAR_DEPTH)) {
+ struct r600_texture *rtex;
+ unsigned level = fb->zsbuf->u.tex.level;
+
+ rtex = (struct r600_texture*)fb->zsbuf->texture;
+
+ /* We can't use hyperz fast clear if each slice of a texture
+ * array are clear to different value. To simplify code just
+ * disable fast clear for texture array.
+ */
+ /* Only use htile for first level */
+ if (rtex->htile_buffer && !level &&
+ fb->zsbuf->u.tex.first_layer == 0 &&
+ fb->zsbuf->u.tex.last_layer == util_max_layer(&rtex->resource.b.b, level)) {
+ if (rtex->depth_clear_value != depth) {
+ rtex->depth_clear_value = depth;
+ r600_mark_atom_dirty(rctx, &rctx->db_state.atom);
+ }
+ rctx->db_misc_state.htile_clear = true;
+ r600_mark_atom_dirty(rctx, &rctx->db_misc_state.atom);
+ }
+ }
+