Paul Berry <stereotype...@gmail.com> writes: > On 22 May 2013 12:30, Ian Romanick <i...@freedesktop.org> wrote: > >> On 05/21/2013 04:52 PM, Paul Berry wrote: >> >>> Since we defer allocation of the MCS miptree until the time of the >>> fast clear operation, this patch also implements creation of the MCS >>> miptree. >>> >>> In addition, this patch adds the field >>> intel_mipmap_tree::fast_clear_**color_value, which holds the most recent >>> fast color clear value, if any. We use it to set the SURFACE_STATE's >>> clear color for render targets. >>> --- >>> src/mesa/drivers/dri/i965/brw_**blorp.cpp | 1 + >>> src/mesa/drivers/dri/i965/brw_**blorp.h | 11 +- >>> src/mesa/drivers/dri/i965/brw_**blorp_clear.cpp | 143 >>> +++++++++++++++++++++- >>> src/mesa/drivers/dri/i965/brw_**clear.c | 2 +- >>> src/mesa/drivers/dri/i965/brw_**defines.h | 2 + >>> src/mesa/drivers/dri/i965/**gen7_blorp.cpp | 18 ++- >>> src/mesa/drivers/dri/i965/**gen7_wm_surface_state.c | 10 +- >>> src/mesa/drivers/dri/intel/**intel_mipmap_tree.c | 47 +++++++ >>> src/mesa/drivers/dri/intel/**intel_mipmap_tree.h | 13 ++ >>> 9 files changed, 233 insertions(+), 14 deletions(-) >>> >>> diff --git a/src/mesa/drivers/dri/i965/**brw_blorp.cpp >>> b/src/mesa/drivers/dri/i965/**brw_blorp.cpp >>> index 20f7153..c6019d1 100644 >>> --- a/src/mesa/drivers/dri/i965/**brw_blorp.cpp >>> +++ b/src/mesa/drivers/dri/i965/**brw_blorp.cpp >>> @@ -147,6 +147,7 @@ brw_blorp_params::brw_blorp_**params() >>> y1(0), >>> depth_format(0), >>> hiz_op(GEN6_HIZ_OP_NONE), >>> + fast_clear_op(GEN7_FAST_CLEAR_**OP_NONE), >>> num_samples(0), >>> use_wm_prog(false) >>> { >>> diff --git a/src/mesa/drivers/dri/i965/**brw_blorp.h >>> b/src/mesa/drivers/dri/i965/**brw_blorp.h >>> index 6360a62..687d7eb 100644 >>> --- a/src/mesa/drivers/dri/i965/**brw_blorp.h >>> +++ b/src/mesa/drivers/dri/i965/**brw_blorp.h >>> @@ -46,7 +46,8 @@ brw_blorp_blit_miptrees(struct intel_context *intel, >>> bool mirror_x, bool mirror_y); >>> >>> bool >>> -brw_blorp_clear_color(struct intel_context *intel, struct gl_framebuffer >>> *fb); >>> +brw_blorp_clear_color(struct intel_context *intel, struct gl_framebuffer >>> *fb, >>> + bool partial_clear); >>> >>> #ifdef __cplusplus >>> } /* end extern "C" */ >>> @@ -195,6 +196,13 @@ struct brw_blorp_prog_data >>> bool persample_msaa_dispatch; >>> }; >>> >>> + >>> +enum gen7_fast_clear_op { >>> + GEN7_FAST_CLEAR_OP_NONE, >>> + GEN7_FAST_CLEAR_OP_FAST_CLEAR, >>> +}; >>> + >>> + >>> class brw_blorp_params >>> { >>> public: >>> @@ -212,6 +220,7 @@ public: >>> brw_blorp_surface_info src; >>> brw_blorp_surface_info dst; >>> enum gen6_hiz_op hiz_op; >>> + enum gen7_fast_clear_op fast_clear_op; >>> unsigned num_samples; >>> bool use_wm_prog; >>> brw_blorp_wm_push_constants wm_push_consts; >>> diff --git a/src/mesa/drivers/dri/i965/**brw_blorp_clear.cpp >>> b/src/mesa/drivers/dri/i965/**brw_blorp_clear.cpp >>> index 28d7ad0..675289b 100644 >>> --- a/src/mesa/drivers/dri/i965/**brw_blorp_clear.cpp >>> +++ b/src/mesa/drivers/dri/i965/**brw_blorp_clear.cpp >>> @@ -49,7 +49,8 @@ public: >>> brw_blorp_clear_params(struct brw_context *brw, >>> struct gl_framebuffer *fb, >>> struct gl_renderbuffer *rb, >>> - GLubyte *color_mask); >>> + GLubyte *color_mask, >>> + bool partial_clear); >>> >>> virtual uint32_t get_wm_prog(struct brw_context *brw, >>> brw_blorp_prog_data **prog_data) const; >>> @@ -105,10 +106,49 @@ brw_blorp_clear_program::~brw_** >>> blorp_clear_program() >>> ralloc_free(mem_ctx); >>> } >>> >>> + >>> +/** >>> + * Determine if fast color clear supports the given clear color. >>> + * >>> + * Fast color clear can only clear to color values of 1.0 or 0.0. At the >>> + * moment we only support floating point buffers. >>> + */ >>> +static bool >>> +is_color_fast_clear_**compatible(gl_format format, >>> + const union gl_color_union *color) >>> +{ >>> + if (_mesa_is_format_integer_**color(format)) >>> + return false; >>> + >>> + for (int i = 0; i < 4; i++) { >>> + if (color->f[i] != 0.0 && color->f[i] != 1.0) >>> + return false; >>> >> >> Should this generate a perf debug message? Eric may have an opinion about >> generating warnings for the non-fast path... > > > Sounds reasonable to me. We already have perf debug messages for other > things that can inhibit fast clears (e.g. scissor preventing fast depth > clear). I'll add it unless I hear an objection.
Thanks! I love getting this kind of information into our driver at the point that we're leaving some potential performance on the floor. Even when it doesn't seem important now (non-8x4 fast depth clears, sigh...).
pgpevKOaQD3j1.pgp
Description: PGP signature
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev