From 18aad17ce254ec52414a00fc7c9ddcfa0da7c449 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Sat, 23 Jul 2016 12:46:10 -0700 Subject: [PATCH] i965/blorp: Pull the guts of resolve_color into a miptree-agnostic helper Reviewed-by: Topi Pohjolainen --- src/mesa/drivers/dri/i965/brw_blorp_clear.cpp | 43 +++++++++++-------- 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp b/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp index 2508dab4728..bffbec5e35c 100644 --- a/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp +++ b/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp @@ -304,33 +304,21 @@ brw_blorp_clear_color(struct brw_context *brw, struct gl_framebuffer *fb, return true; } -void -brw_blorp_resolve_color(struct brw_context *brw, struct intel_mipmap_tree *mt) +static void +brw_blorp_ccs_resolve(struct brw_context *brw, struct brw_blorp_surf *surf, + enum isl_format format) { - DBG("%s to mt %p\n", __FUNCTION__, mt); - - const mesa_format format = _mesa_get_srgb_format_linear(mt->format); - - intel_miptree_check_level_layer(mt, 0 /* level */, 0 /* layer */); - intel_miptree_used_for_rendering(mt); - struct brw_blorp_params params; brw_blorp_params_init(¶ms); - struct isl_surf isl_tmp[2]; - struct brw_blorp_surf surf; - unsigned level = 0; - brw_blorp_surf_for_miptree(brw, &surf, mt, true, &level, isl_tmp); - brw_blorp_surface_info_init(brw, ¶ms.dst, &surf, - 0 /* level */, 0 /* layer */, - brw_blorp_to_isl_format(brw, format, true), - true); + brw_blorp_surface_info_init(brw, ¶ms.dst, surf, + 0 /* level */, 0 /* layer */, format, true); brw_get_ccs_resolve_rect(&brw->isl_dev, ¶ms.dst.aux_surf, ¶ms.x0, ¶ms.y0, ¶ms.x1, ¶ms.y1); - if (intel_miptree_is_lossless_compressed(brw, mt)) + if (params.dst.aux_usage == ISL_AUX_USAGE_CCS_E) params.resolve_type = GEN9_PS_RENDER_TARGET_RESOLVE_FULL; else params.resolve_type = GEN7_PS_RENDER_TARGET_RESOLVE_ENABLE; @@ -344,6 +332,25 @@ brw_blorp_resolve_color(struct brw_context *brw, struct intel_mipmap_tree *mt) brw_blorp_params_get_clear_kernel(brw, ¶ms, true); brw_blorp_exec(brw, ¶ms); +} + +void +brw_blorp_resolve_color(struct brw_context *brw, struct intel_mipmap_tree *mt) +{ + DBG("%s to mt %p\n", __FUNCTION__, mt); + + const mesa_format format = _mesa_get_srgb_format_linear(mt->format); + + intel_miptree_check_level_layer(mt, 0 /* level */, 0 /* layer */); + intel_miptree_used_for_rendering(mt); + + struct isl_surf isl_tmp[2]; + struct brw_blorp_surf surf; + unsigned level = 0; + brw_blorp_surf_for_miptree(brw, &surf, mt, true, &level, isl_tmp); + + brw_blorp_ccs_resolve(brw, &surf, brw_blorp_to_isl_format(brw, format, true)); + mt->fast_clear_state = INTEL_FAST_CLEAR_STATE_RESOLVED; } -- 2.30.2