[Mesa-dev] [PATCH 2/2] i965/fs: Don't segfault when debug-logging a null program

Kenneth Graunke kenneth at whitecape.org
Mon Sep 1 10:34:52 PDT 2014


On Monday, September 01, 2014 01:36:16 AM Jason Ekstrand wrote:
> ---
>  src/mesa/drivers/dri/i965/brw_fs.cpp | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
> index 43aee66..8b76c3e 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
> @@ -3046,7 +3046,7 @@ fs_visitor::run()
>        if (unlikely(INTEL_DEBUG & DEBUG_OPTIMIZER) && this_progress) {      \
>           char filename[64];                                                \
>           snprintf(filename, 64, "fs%d-%04d-%02d-%02d-" #pass,              \
> -                  dispatch_width, shader_prog->Name, iteration, pass_num); \
> +                  dispatch_width, shader_prog ? shader_prog->Name : 0, iteration, pass_num); \
>                                                                             \
>           backend_visitor::dump_instructions(filename);                     \
>        }                                                                    \
> @@ -3057,7 +3057,7 @@ fs_visitor::run()
>        if (unlikely(INTEL_DEBUG & DEBUG_OPTIMIZER)) {
>           char filename[64];
>           snprintf(filename, 64, "fs%d-%04d-00-start",
> -                  dispatch_width, shader_prog->Name);
> +                  dispatch_width, shader_prog ? shader_prog->Name : 0);
>  
>           backend_visitor::dump_instructions(filename);
>        }
> 

Bah.

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
Cc: "10.3" <mesa-stable at lists.freedesktop.org>

(while I don't usually bother to backport debugging features to stable branches, these are trivial fixes and prevent it from crashing, so...may as well)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140901/f3a50669/attachment.sig>


More information about the mesa-dev mailing list