- if (!vc4->needs_flush)
- return;
-
- /* The RCL setup would choke if the draw bounds cause no drawing, so
- * just drop the drawing if that's the case.
- */
- if (vc4->draw_max_x <= vc4->draw_min_x ||
- vc4->draw_max_y <= vc4->draw_min_y) {
- vc4_job_reset(vc4);
- return;
- }
-
- /* Increment the semaphore indicating that binning is done and
- * unblocking the render thread. Note that this doesn't act until the
- * FLUSH completes.
- */
- cl_ensure_space(&vc4->bcl, 8);
- struct vc4_cl_out *bcl = cl_start(&vc4->bcl);
- cl_u8(&bcl, VC4_PACKET_INCREMENT_SEMAPHORE);
- /* The FLUSH caps all of our bin lists with a VC4_PACKET_RETURN. */
- cl_u8(&bcl, VC4_PACKET_FLUSH);
- cl_end(&vc4->bcl, bcl);
-
- vc4->msaa = false;
- if (cbuf && (vc4->resolve & PIPE_CLEAR_COLOR0)) {
- pipe_surface_reference(&vc4->color_write,
- cbuf->texture->nr_samples ? NULL : cbuf);
- pipe_surface_reference(&vc4->msaa_color_write,
- cbuf->texture->nr_samples ? cbuf : NULL);
-
- if (cbuf->texture->nr_samples)
- vc4->msaa = true;
-
- if (!(vc4->cleared & PIPE_CLEAR_COLOR0)) {
- pipe_surface_reference(&vc4->color_read, cbuf);
- } else {
- pipe_surface_reference(&vc4->color_read, NULL);
- }
-
- } else {
- pipe_surface_reference(&vc4->color_write, NULL);
- pipe_surface_reference(&vc4->color_read, NULL);
- pipe_surface_reference(&vc4->msaa_color_write, NULL);
- }
-
- if (vc4->framebuffer.zsbuf &&
- (vc4->resolve & (PIPE_CLEAR_DEPTH | PIPE_CLEAR_STENCIL))) {
- pipe_surface_reference(&vc4->zs_write,
- zsbuf->texture->nr_samples ?
- NULL : zsbuf);
- pipe_surface_reference(&vc4->msaa_zs_write,
- zsbuf->texture->nr_samples ?
- zsbuf : NULL);
-
- if (zsbuf->texture->nr_samples)
- vc4->msaa = true;
-
- if (!(vc4->cleared & (PIPE_CLEAR_DEPTH | PIPE_CLEAR_STENCIL))) {
- pipe_surface_reference(&vc4->zs_read, zsbuf);
- } else {
- pipe_surface_reference(&vc4->zs_read, NULL);
- }
- } else {
- pipe_surface_reference(&vc4->zs_write, NULL);
- pipe_surface_reference(&vc4->zs_read, NULL);
- pipe_surface_reference(&vc4->msaa_zs_write, NULL);