-static void
-panfrost_clear_sfbd(struct panfrost_context *ctx,
- bool clear_color,
- bool clear_depth,
- bool clear_stencil,
- uint32_t packed_color,
- double depth, unsigned stencil
- )
-{
- struct mali_single_framebuffer *sfbd = &ctx->fragment_sfbd;
-
- if (clear_color) {
- sfbd->clear_color_1 = packed_color;
- sfbd->clear_color_2 = packed_color;
- sfbd->clear_color_3 = packed_color;
- sfbd->clear_color_4 = packed_color;
- }
-
- if (clear_depth) {
- sfbd->clear_depth_1 = depth;
- sfbd->clear_depth_2 = depth;
- sfbd->clear_depth_3 = depth;
- sfbd->clear_depth_4 = depth;
- }
-
- if (clear_stencil) {
- sfbd->clear_stencil = stencil;
- }
-
- /* Setup buffers */
-
- if (clear_depth) {
- sfbd->depth_buffer = ctx->depth_stencil_buffer.gpu;
- sfbd->depth_buffer_enable = MALI_DEPTH_STENCIL_ENABLE;
- }
-
- if (clear_stencil) {
- sfbd->stencil_buffer = ctx->depth_stencil_buffer.gpu;
- sfbd->stencil_buffer_enable = MALI_DEPTH_STENCIL_ENABLE;
- }
-
- /* Set flags based on what has been cleared, for the SFBD case */
- /* XXX: What do these flags mean? */
- int clear_flags = 0x101100;
-
- if (clear_color && clear_depth && clear_stencil) {
- /* On a tiler like this, it's fastest to clear all three buffers at once */
-
- clear_flags |= MALI_CLEAR_FAST;
- } else {
- clear_flags |= MALI_CLEAR_SLOW;
-
- if (clear_stencil)
- clear_flags |= MALI_CLEAR_SLOW_STENCIL;
- }
-
- sfbd->clear_flags = clear_flags;
-}
-
-static void
-panfrost_clear_mfbd(struct panfrost_context *ctx,
- bool clear_color,
- bool clear_depth,
- bool clear_stencil,
- uint32_t packed_color,
- double depth, unsigned stencil
- )
-{
- struct bifrost_render_target *buffer_color = &ctx->fragment_rts[0];
- struct bifrost_framebuffer *buffer_ds = &ctx->fragment_mfbd;
-
- if (clear_color) {
- buffer_color->clear_color_1 = packed_color;
- buffer_color->clear_color_2 = packed_color;
- buffer_color->clear_color_3 = packed_color;
- buffer_color->clear_color_4 = packed_color;
- }
-
- if (clear_depth) {
- buffer_ds->clear_depth = depth;
- }
-
- if (clear_stencil) {
- buffer_ds->clear_stencil = stencil;
- }
-
- if (clear_depth || clear_stencil) {
- /* Setup combined 24/8 depth/stencil */
- ctx->fragment_mfbd.unk3 |= MALI_MFBD_EXTRA;
- //ctx->fragment_extra.unk = /*0x405*/0x404;
- ctx->fragment_extra.unk = 0x405;
- ctx->fragment_extra.ds_linear.depth = ctx->depth_stencil_buffer.gpu;
- ctx->fragment_extra.ds_linear.depth_stride = ctx->pipe_framebuffer.width * 4;
- }
-}
-