[Mesa-dev] [PATCH 4/9] i965: Set annotation_info's mem_ctx.

Pohjolainen, Topi topi.pohjolainen at intel.com
Mon Oct 26 05:02:38 PDT 2015


On Wed, Oct 21, 2015 at 03:58:12PM -0700, Matt Turner wrote:
> It was being memset to 0 previously.
> ---
>  src/mesa/drivers/dri/i965/brw_fs_generator.cpp   | 2 +-
>  src/mesa/drivers/dri/i965/brw_vec4_generator.cpp | 2 +-
>  src/mesa/drivers/dri/i965/intel_asm_annotation.c | 3 +++
>  3 files changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
> index aed4adb..8ab57f7 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
> @@ -2187,7 +2187,7 @@ fs_generator::generate_code(const cfg_t *cfg, int dispatch_width)
>  
>        dump_assembly(p->store, annotation.ann_count, annotation.ann,
>                      p->devinfo);
> -      ralloc_free(annotation.ann);
> +      ralloc_free(annotation.mem_ctx);

I had to check how "annotation.ann" gets allocated - that is by reralloc()
against "annotation.mem_ctx".

Reviewed-by: Topi Pohjolainen <topi.pohjolainen at intel.com>

>     }
>  
>     compiler->shader_debug_log(log_data,
> diff --git a/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp b/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp
> index a84f6c4..6ac8591 100644
> --- a/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp
> @@ -1659,7 +1659,7 @@ vec4_generator::generate_code(const cfg_t *cfg, const nir_shader *nir)
>  
>        dump_assembly(p->store, annotation.ann_count, annotation.ann,
>                      p->devinfo);
> -      ralloc_free(annotation.ann);
> +      ralloc_free(annotation.mem_ctx);
>     }
>  
>     compiler->shader_debug_log(log_data,
> diff --git a/src/mesa/drivers/dri/i965/intel_asm_annotation.c b/src/mesa/drivers/dri/i965/intel_asm_annotation.c
> index b3d6324..f87a9bb 100644
> --- a/src/mesa/drivers/dri/i965/intel_asm_annotation.c
> +++ b/src/mesa/drivers/dri/i965/intel_asm_annotation.c
> @@ -86,6 +86,9 @@ void annotate(const struct brw_device_info *devinfo,
>                struct annotation_info *annotation, const struct cfg_t *cfg,
>                struct backend_instruction *inst, unsigned offset)
>  {
> +   if (annotation->mem_ctx == NULL)
> +      annotation->mem_ctx = ralloc_context(NULL);
> +
>     if (annotation->ann_size <= annotation->ann_count) {
>        int old_size = annotation->ann_size;
>        annotation->ann_size = MAX2(1024, annotation->ann_size * 2);
> -- 
> 2.4.9
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list