static void svga_clear_depth_stencil(struct pipe_context *pipe, struct pipe_surface *dst, unsigned clear_flags, double depth, unsigned stencil, unsigned dstx, unsigned dsty, unsigned width, unsigned height, bool render_condition_enabled) { struct svga_context *svga = svga_context( pipe ); svga_toggle_render_condition(svga, render_condition_enabled, FALSE); /* Use software fallback */ begin_blit(svga); util_blitter_save_framebuffer(svga->blitter, &svga->curr.framebuffer); util_blitter_clear_depth_stencil(svga->blitter, dst, clear_flags, depth, stencil, dstx, dsty, width, height); svga_toggle_render_condition(svga, render_condition_enabled, TRUE); }
/** * \brief Clear render target pipe callback * * \param pipe[in] The pipe context * \param dst[in] The surface to clear * \param color[in] Clear color * \param dstx[in] Clear region left * \param dsty[in] Clear region top * \param width[in] Clear region width * \param height[in] Clear region height * \param render_condition_enabled[in] Whether to use conditional rendering * to clear (if elsewhere enabled). */ static void svga_clear_render_target(struct pipe_context *pipe, struct pipe_surface *dst, const union pipe_color_union *color, unsigned dstx, unsigned dsty, unsigned width, unsigned height, bool render_condition_enabled) { struct svga_context *svga = svga_context( pipe ); svga_toggle_render_condition(svga, render_condition_enabled, FALSE); if (!svga_have_vgpu10(svga) || dstx != 0 || dsty != 0 || width != dst->width || height != dst->height) { svga_blitter_clear_render_target(svga, dst, color, dstx, dsty, width, height); } else { enum pipe_error ret; ret = svga_try_clear_render_target(svga, dst, color); if (ret == PIPE_ERROR_OUT_OF_MEMORY) { svga_context_flush( svga, NULL ); ret = svga_try_clear_render_target(svga, dst, color); } assert (ret == PIPE_OK); } svga_toggle_render_condition(svga, render_condition_enabled, TRUE); }
/** * Try region copy using one of the region copy commands */ static bool try_copy_region(struct svga_context *svga, const struct pipe_blit_info *blit) { unsigned src_layer_face, src_z, dst_layer_face, dst_z; if (!can_blit_via_svga_copy_region(svga, blit)) return false; adjust_z_layer(blit->src.resource->target, blit->src.box.z, &src_layer_face, &src_z); adjust_z_layer(blit->dst.resource->target, blit->dst.box.z, &dst_layer_face, &dst_z); if (can_blit_via_copy_region_vgpu10(svga, blit)) { svga_toggle_render_condition(svga, blit->render_condition_enable, FALSE); copy_region_vgpu10(svga, blit->src.resource, blit->src.box.x, blit->src.box.y, src_z, blit->src.level, src_layer_face, blit->dst.resource, blit->dst.box.x, blit->dst.box.y, dst_z, blit->dst.level, dst_layer_face, blit->src.box.width, blit->src.box.height, blit->src.box.depth); svga_toggle_render_condition(svga, blit->render_condition_enable, TRUE); return true; } if (can_blit_via_surface_copy(svga, blit)) { struct svga_texture *stex = svga_texture(blit->src.resource); struct svga_texture *dtex = svga_texture(blit->dst.resource); svga_surfaces_flush(svga); svga_texture_copy_handle(svga, stex->handle, blit->src.box.x, blit->src.box.y, src_z, blit->src.level, src_layer_face, dtex->handle, blit->dst.box.x, blit->dst.box.y, dst_z, blit->dst.level, dst_layer_face, blit->src.box.width, blit->src.box.height, blit->src.box.depth); svga_define_texture_level(dtex, dst_layer_face, blit->dst.level); svga_set_texture_rendered_to(dtex, dst_layer_face, blit->dst.level); return true; } if (can_blit_via_intra_surface_copy(svga, blit)) { intra_surface_copy(svga, blit->src.resource, blit->src.box.x, blit->src.box.y, src_z, blit->src.level, src_layer_face, blit->dst.box.x, blit->dst.box.y, dst_z, blit->src.box.width, blit->src.box.height, blit->src.box.depth); return true; } return false; }