[Mesa-dev] [PATCH] svga: Check vs and fs pointer when updating states.

Brian Paul brianp at vmware.com
Fri Mar 9 07:19:02 PST 2012


On 03/08/2012 08:16 AM, Vic Lee wrote:
> Hi Brian,
>
> Please the the gdb backtrace if I only add vs check. Maybe you have a
> better idea on this issue. I am using the git 8.0 branch.
>
> ********************************
> vic at debian:~/mesa/src/gallium$ git diff
> diff --git a/src/gallium/drivers/svga/svga_state_need_swtnl.c
> b/src/gallium/drivers/svga/svga_state_need_swtnl.c
> index 8c39a4b..3b193c0 100644
> --- a/src/gallium/drivers/svga/svga_state_need_swtnl.c
> +++ b/src/gallium/drivers/svga/svga_state_need_swtnl.c
> @@ -136,7 +136,7 @@ update_need_pipeline( struct svga_context *svga,
>
> /* EDGEFLAGS
> */
> - if (vs->base.info.writes_edgeflag) {
> + if (vs && vs->base.info.writes_edgeflag) {
> SVGA_DBG(DEBUG_SWTNL, "%s: edgeflags\n", __FUNCTION__);
> need_pipeline = TRUE;
> }
> vic at debian:~/mesa/src/gallium$ gdb ./test
> GNU gdb (GDB) 7.4-debian
> Copyright (C) 2012 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later
> <http://gnu.org/licenses/gpl.html>
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law. Type "show copying"
> and "show warranty" for details.
> This GDB was configured as "x86_64-linux-gnu".
> For bug reporting instructions, please see:
> <http://www.gnu.org/software/gdb/bugs/>...
> Reading symbols from /home/vic/mesa/src/gallium/test...done.
> (gdb) r
> Starting program: /home/vic/mesa/src/gallium/test
> [Thread debugging using libthread_db enabled]
> Using host libthread_db library
> "/lib/x86_64-linux-gnu/libthread_db.so.1".
>
> Program received signal SIGSEGV, Segmentation fault.
> 0x00000000004476e0 in update_need_pipeline (svga=0x124eed0,
> dirty=4294967295) at svga_state_need_swtnl.c:148
> 148 unsigned generic_inputs = svga->curr.fs->generic_inputs;

Vic, it looks like your code is slightly out of date.  In current 
git/master, line 148 reads:

       unsigned generic_inputs =
          svga->curr.fs ? svga->curr.fs->generic_inputs : 0;

Zack added the null ptr check in January with commit cff0eac702

I'll make a patch with your null vs check though.  You should be all 
set then if you grab the latest code from git.

-Brian


More information about the mesa-dev mailing list