[GRASS5] RE: [bug #4140] (grass) Nviz doesn't start either from GUI or CLI

Maciek,

Perhaps there's another clue here; when I run nviz from CLI, I get:

GRASS 6.1.cvs (Cheticamp):~ > nviz elevation=Cheticamp98.5.ave.fill
Loading Data
Update elev null mask
Loading Data
translating colors from fp
*Segmentation fault*
(my emphasis)

Same error occurs with different rasters.

Hmmm....g.region -p gives:

GRASS 6.1.cvs (Cheticamp):~ > g.region -p
projection: 1 (UTM)
zone: 20
datum: ** unknown (default: WGS84) **
ellipsoid: wgs84
north: 5176119.54768
south: 5166572.33329
west: 628593.997416
east: 652873.00618
nsres: 9.92433928
ewres: 10.10362412
rows: 962
cols: 2403

Nothing too unusual here?

~ Eric.

-----Original Message-----
From: Maciek Sieczka via RT
To: epatton@nrcan.gc.ca
Sent: 3/6/2006 11:54 AM
Subject: [bug #4140] (grass) Nviz doesn't start either from GUI

On Mon, 6 Mar 2006 15:18:49 +0100
Markus Neteler <neteler@itc.it> wrote:

On Mon, Mar 06, 2006 at 01:08:36PM +0100, Request Tracker wrote:
> this bug's URL: http://intevation.de/rt/webrt?serial_num=4140
>

------------------------------------------------------------------------
-

>
> Subject: Nviz doesn't start either from GUI or command line in
> 6.1cvs generic binary snapshot
>
> Platform: GNU/Linux/x86
> grass obtained from: Trento Italy site
> grass binary for platform: Downloaded precompiled Binaries
> GRASS Version: 6.1cvs binary 2006-03-04
>
> Upon typing nviz on command line and selecting an elevation raster
> in the nviz GUI, the green status bar builds to 100% but nothing
> happens afterward. The message box area of the nviz GUI reads:
>
> Update elev null mask
> Loading Data
> translating colors from fp
>
> but no other errors are indicated. The exact same behavior is
> observed if nviz is run from the display manager GUI.

Eric,

can you please post the related
g.region -p
?

Also please try running your NVIZ command from the CLI and see what
happens. I just suppose there might be a segfault, which will be not
visible in the GUI output.

Maciek

---------------------

On Mon, 6 Mar 2006 14:06:45 -0400
"Patton, Eric" <epatton@nrcan.gc.ca> wrote:

Maciek,

Perhaps there's another clue here; when I run nviz from CLI, I get:

GRASS 6.1.cvs (Cheticamp):~ > nviz elevation=Cheticamp98.5.ave.fill
Loading Data
Update elev null mask
Loading Data
translating colors from fp
*Segmentation fault*
(my emphasis)

A segfault. I suppose devs would not mind it if you could provide a
stacktrace. See here for guiding if you don't mind doing this (for this
purpose, it would be good if your Grass was not built with any
optimisations nor stripping).
http://www.qgis.org/index.php?option=com_content&task=view&id=74&Itemid=58

Same error occurs with different rasters.

Hmmm....g.region -p gives:

GRASS 6.1.cvs (Cheticamp):~ > g.region -p
projection: 1 (UTM)
zone: 20
datum: ** unknown (default: WGS84) **
ellipsoid: wgs84
north: 5176119.54768
south: 5166572.33329
west: 628593.997416
east: 652873.00618
nsres: 9.92433928
ewres: 10.10362412
rows: 962
cols: 2403

Nothing too unusual here?

Right. What if you set your region extent and res to integer values?
Maight be a silly idea, though try it. And what does g.region -3 say?

Maciek

---------------------
http://www.visanen.pl/ - Zapakujemy wszystko!
Produkcja i dystrybucja torby foliowe, papierowe, reklam?wki, opakowania kartonowe, ekskluzywne pude?ka

Hi,

could you send more detailed information with:

from CLI

ddd nviz
> r elevation=Cheticamp98.5.ave.fill
(ddd or dbx or aother debugger)
.
after Seg fault type:

> where
cut&paste result of the stack

please control all linked libraries using command ldd of the nviz and related loaded shared object.

sometimes nviz doens't start when 3d support driver is not loaded... please check if correct Graphic Card Driver is loaded... las saturday, nvidia drivers whas't able to be loaded due to a flag in xorg.conf when PC was using a particular projector...

bye by Ginetto
www.riade.net
www.acsys.it

Patton, Eric wrote:

Maciek,

Perhaps there's another clue here; when I run nviz from CLI, I get:

GRASS 6.1.cvs (Cheticamp):~ > nviz elevation=Cheticamp98.5.ave.fill
Loading Data
Update elev null mask
Loading Data
translating colors from fp
*Segmentation fault*
(my emphasis)

Same error occurs with different rasters.

Hmmm....g.region -p gives:

GRASS 6.1.cvs (Cheticamp):~ > g.region -p
projection: 1 (UTM)
zone: 20
datum: ** unknown (default: WGS84) **
ellipsoid: wgs84
north: 5176119.54768
south: 5166572.33329
west: 628593.997416
east: 652873.00618
nsres: 9.92433928
ewres: 10.10362412
rows: 962
cols: 2403

Nothing too unusual here?

~ Eric.

-----Original Message-----
From: Maciek Sieczka via RT
To: epatton@nrcan.gc.ca
Sent: 3/6/2006 11:54 AM
Subject: [bug #4140] (grass) Nviz doesn't start either from GUI

On Mon, 6 Mar 2006 15:18:49 +0100
Markus Neteler <neteler@itc.it> wrote:

On Mon, Mar 06, 2006 at 01:08:36PM +0100, Request Tracker wrote:

this bug's URL: http://intevation.de/rt/webrt?serial_num=4140

------------------------------------------------------------------------
-

Subject: Nviz doesn't start either from GUI or command line in
6.1cvs generic binary snapshot

Platform: GNU/Linux/x86
grass obtained from: Trento Italy site
grass binary for platform: Downloaded precompiled Binaries
GRASS Version: 6.1cvs binary 2006-03-04

Upon typing nviz on command line and selecting an elevation raster
in the nviz GUI, the green status bar builds to 100% but nothing
happens afterward. The message box area of the nviz GUI reads:

Update elev null mask
Loading Data
translating colors from fp

but no other errors are indicated. The exact same behavior is
observed if nviz is run from the display manager GUI.

Eric,

can you please post the related
g.region -p
?

Also please try running your NVIZ command from the CLI and see what
happens. I just suppose there might be a segfault, which will be not
visible in the GUI output.

Maciek

---------------------

_______________________________________________
grass5 mailing list
grass5@grass.itc.it
http://grass.itc.it/mailman/listinfo/grass5

> Perhaps there's another clue here; when I run nviz from CLI, I get:
>
> GRASS 6.1.cvs (Cheticamp):~ > nviz elevation=Cheticamp98.5.ave.fill
> Loading Data
> Update elev null mask
> Loading Data
> translating colors from fp
> *Segmentation fault*
> (my emphasis)

A segfault. I suppose devs would not mind it if you could provide a
stacktrace. See here for guiding if you don't mind doing this (for
this purpose, it would be good if your Grass was not built with any
optimisations nor stripping).
http://www.qgis.org/index.php?option=com_content&task=view&id=74&Itemid=58

This is not so easy for NVIZ. Or at least it wasn't -- nviz used to be a
script which called a C binary which ran a hybrid TclTk module. Getting
it to run in the debugger was a real chore of setting up the correct
environment. When this bug first cropped up I spent a fair bit of time
trying to track it down without any luck.

My best guess to the cause was a threading issue somewhere in the code
(debian tcl8.4 uses threading while 8.3 doesn't). ???

Bob has since changed things a bit and `which nviz` now calls the binary
directly. Maybe it is time to try again....

configure with:
CFLAGS="-ggdb -Wall" ./configure

.. and recompile using tcl8.4-dev and tk8.4-dev.

I use kdbg as a gdb frontend. Others use ddd, etc

G61 > kdbg `which nviz`

Execution->Arguments
Run with these arguments: elev=elevation

"Program received signal SIGFPE, Arithmetic exception."

Not much use, just tells me it fails somewhere in the Tk_main() call.

Let's try gdb directly:

G61> gdb `which nviz`
GNU gdb 6.3-debian
[...]
This GDB was configured as "i386-linux"...Using host libthread_db library "/lib/libthread_db.so.1".

(gdb) run elev=elevation.dem
Starting program: /usr/local/src/grass/grass61/dist.i686-pc-linux-gnu/bin/nviz elevation.dem
[Thread debugging using libthread_db enabled]
[New Thread 16384 (LWP 7550)]
[New Thread 32769 (LWP 7551)]
[New Thread 16386 (LWP 7552)]
Loading Data
Update elev null mask
Loading Data
translating colors
  99%
Program received signal SIGFPE, Arithmetic exception.
[Switching to Thread 16384 (LWP 7550)]
0x42126ae0 in __driUtilCreateScreen () from /usr/X11R6/lib/modules/dri/r200_dri.so

(gdb) l
29 *----------------------------------------------------------------------
30 */
31
32 int main(int argc, /* Number of command-line arguments. */
33 char **argv /* Values of command-line arguments. */
34 )
35 {
36 int i;
37
38 Tcl_FindExecutable(argv[0]);

### HB: this is visualization/nviz/src/nvizMain.c

(gdb) bt
#0 0x42126ae0 in __driUtilCreateScreen () from /usr/X11R6/lib/modules/dri/r200_dri.so
#1 0x4212667b in __driUtilCreateScreen () from /usr/X11R6/lib/modules/dri/r200_dri.so
#2 0x421267bf in __driUtilCreateScreen () from /usr/X11R6/lib/modules/dri/r200_dri.so
#3 0x420942b2 in __driUtilCreateScreen () from /usr/X11R6/lib/modules/dri/r200_dri.so
#4 0x420942d9 in __driUtilCreateScreen () from /usr/X11R6/lib/modules/dri/r200_dri.so
#5 0x42011c5a in __driUtilCreateScreen () from /usr/X11R6/lib/modules/dri/r200_dri.so
#6 0x42013d7c in __driUtilCreateScreen () from /usr/X11R6/lib/modules/dri/r200_dri.so
#7 0x420141e8 in __driUtilCreateScreen () from /usr/X11R6/lib/modules/dri/r200_dri.so
#8 0x4212b1bc in __driUtilCreateScreen () from /usr/X11R6/lib/modules/dri/r200_dri.so
#9 0x41ffd35d in __driUtilUpdateDrawableInfo () from /usr/X11R6/lib/modules/dri/r200_dri.so
#10 0x40853195 in _glthread_SetTSD () from /usr/X11R6/lib/libGL.so.1
#11 0x408532ec in glXCreateContext () from /usr/X11R6/lib/libGL.so.1
#12 0x080628d7 in Togl_MakeWindowExist (togl=0x81b1898) at togl.c:1451
#13 0x0806172f in Togl_Configure (interp=0x807bfb0, togl=0x81b1898, argc=6, argv=0xbfffe778, flags=0)
    at togl.c:905
#14 0x08061e7f in Togl_Cmd (clientData=0x808c6e0, interp=0x807bfb0, argc=8, argv=0xbfffe770)
    at togl.c:1103
#15 0x406fc66f in TclInvokeStringCommand () from /usr/lib/libtcl8.4.so.0
#16 0x406fd6a4 in TclEvalObjvInternal () from /usr/lib/libtcl8.4.so.0
#17 0x407249c8 in TclCompEvalObj () from /usr/lib/libtcl8.4.so.0
#18 0x40723f0b in TclCompEvalObj () from /usr/lib/libtcl8.4.so.0
#19 0x40757147 in TclObjInterpProc () from /usr/lib/libtcl8.4.so.0
#20 0x406fd6a4 in TclEvalObjvInternal () from /usr/lib/libtcl8.4.so.0
#21 0x406fe254 in Tcl_EvalEx () from /usr/lib/libtcl8.4.so.0
#22 0x40740a24 in Tcl_FSEvalFile () from /usr/lib/libtcl8.4.so.0
#23 0x4070b5ff in Tcl_SourceObjCmd () from /usr/lib/libtcl8.4.so.0
#24 0x406fd6a4 in TclEvalObjvInternal () from /usr/lib/libtcl8.4.so.0
#25 0x406fe254 in Tcl_EvalEx () from /usr/lib/libtcl8.4.so.0
#26 0x406fe6eb in Tcl_Eval () from /usr/lib/libtcl8.4.so.0
#27 0x0805bfac in Ninit (interp=0x807bfb0, w=0x0) at nviz_init.c:459
#28 0x08051884 in NVIZ_AppInit (interp=0x807bfb0) at nvizAppInit.c:130
#29 0x40633f94 in Tk_MainEx () from /usr/lib/libtk8.4.so.0
#30 0x08060f66 in main (argc=3, argv=0xbffff6f4) at nvizMain.c:50

(it failed last year before I was using the radeon card & had dri going...)

still not telling me much. Peppering the C code with printf() and the
Tcl code with puts, I see that it segfaults while in
visualization/nviz/scripts/nviz2.2_script

it helped to turn on debug messages (at the top of nviz2.2_script)
set DEBUG 1

  segfaults in
proc Nv_force_panel
  on this line:
set Nv_($path) [mk$name\Panel $path]

debug output:
$path=.middle.panelarea.panels.surf
$name=surf

This is called from the Nv_mkPanelMenu proc, "surf" is the first $i
of $Nv_(panels).

changing that line to
set Nv_($path) {mk$name\Panel $path}

gets past that SegFault, but then crashes later on. No idea if {that's}
a correct approach, but it got past the segfault..

Next one: (still in nviz2.2_script)
it gets to
proc Nv_mapPanel

and segfaults on this line:
    #insert update to fix KDE wm problem
    update

If I comment out "update", it gets past it, but then segaults again a
few lines later on "pack $name -side top -fill x -expand no -anchor n",
or at least a puts after that line never gets displayed.

But on it runs. A window flashes up, I get the "%" prompt on the
terminal, I get past Ninit() and NVIZ_AppInit(), but lose the
scent after nviz2.2_script's init_graphics and Nv_expose procs
finish successfully. (not sure what calls Nv_expose, as it's a bind)

further than I got last time anyway.

Hamish

Hamish wrote:

(gdb) bt
#0 0x42126ae0 in __driUtilCreateScreen () from /usr/X11R6/lib/modules/dri/r200_dri.so
#1 0x4212667b in __driUtilCreateScreen () from /usr/X11R6/lib/modules/dri/r200_dri.so
#2 0x421267bf in __driUtilCreateScreen () from /usr/X11R6/lib/modules/dri/r200_dri.so
#3 0x420942b2 in __driUtilCreateScreen () from /usr/X11R6/lib/modules/dri/r200_dri.so
#4 0x420942d9 in __driUtilCreateScreen () from /usr/X11R6/lib/modules/dri/r200_dri.so
#5 0x42011c5a in __driUtilCreateScreen () from /usr/X11R6/lib/modules/dri/r200_dri.so
#6 0x42013d7c in __driUtilCreateScreen () from /usr/X11R6/lib/modules/dri/r200_dri.so
#7 0x420141e8 in __driUtilCreateScreen () from /usr/X11R6/lib/modules/dri/r200_dri.so
#8 0x4212b1bc in __driUtilCreateScreen () from /usr/X11R6/lib/modules/dri/r200_dri.so
#9 0x41ffd35d in __driUtilUpdateDrawableInfo () from /usr/X11R6/lib/modules/dri/r200_dri.so
#10 0x40853195 in _glthread_SetTSD () from /usr/X11R6/lib/libGL.so.1
#11 0x408532ec in glXCreateContext () from /usr/X11R6/lib/libGL.so.1
#12 0x080628d7 in Togl_MakeWindowExist (togl=0x81b1898) at togl.c:1451 <-----------------------------!!!!!
#13 0x0806172f in Togl_Configure (interp=0x807bfb0, togl=0x81b1898, argc=6, argv=0xbfffe778, flags=0)
    at togl.c:905
#14 0x08061e7f in Togl_Cmd (clientData=0x808c6e0, interp=0x807bfb0, argc=8, argv=0xbfffe770)
    at togl.c:1103
#15 0x406fc66f in TclInvokeStringCommand () from /usr/lib/libtcl8.4.so.0
(it failed last year before I was using the radeon card & had dri going...)

seems a problem/setting with Graphic Card o its driver, but....

visualization/nviz/scripts/nviz2.2_script

it helped to turn on debug messages (at the top of nviz2.2_script)
set DEBUG 1

  segfaults in
proc Nv_force_panel
  on this line:
set Nv_($path) [mk$name\Panel $path]

debug output:
$path=.middle.panelarea.panels.surf
$name=surf

This is called from the Nv_mkPanelMenu proc, "surf" is the first $i
of $Nv_(panels).

we had similar problem creating our panels... I hope tomorrow to give you more info when my collegue Massimo Cuomo back to office.

changing that line to
set Nv_($path) {mk$name\Panel $path}

NO!... don't change it... you should investigate inside the mksurfPanel module taht you can find in the script directory

i found it in the <grass install path>/etc/nviz2.2/scripts/panel_surf.tcl

investigate inside this tcl code, but...

I thing it's bettere to investigate on driver setting in /etc/X11R6

bye ginetto
www.riade.net
www.acsys.it

Hamish,

I dug back into some of my old archives from when I had looked into
going back to an nviz start-up script.

I had got most of the way there, but I think there is still some
problems. For example calling nviz with no arguments will not start the
GUI.

The original issue came about from trying to run nviz in the backgound
(nviz -q &). The update that I have attached gets around this.

Anyway I have attached a tar file with the modifications that I had
made. The script "nviz" could probably use some improving.

Anyway, take a look and see what else could be done to improve this.

Hope it helps.

--
Bob

On Wed, 2006-03-08 at 20:55 +1300, Hamish wrote:

> > Perhaps there's another clue here; when I run nviz from CLI, I get:
> >
> > GRASS 6.1.cvs (Cheticamp):~ > nviz elevation=Cheticamp98.5.ave.fill
> > Loading Data
> > Update elev null mask
> > Loading Data
> > translating colors from fp
> > *Segmentation fault*
> > (my emphasis)
>
> A segfault. I suppose devs would not mind it if you could provide a
> stacktrace. See here for guiding if you don't mind doing this (for
> this purpose, it would be good if your Grass was not built with any
> optimisations nor stripping).
> http://www.qgis.org/index.php?option=com_content&task=view&id=74&Itemid=58

This is not so easy for NVIZ. Or at least it wasn't -- nviz used to be a
script which called a C binary which ran a hybrid TclTk module. Getting
it to run in the debugger was a real chore of setting up the correct
environment. When this bug first cropped up I spent a fair bit of time
trying to track it down without any luck.

My best guess to the cause was a threading issue somewhere in the code
(debian tcl8.4 uses threading while 8.3 doesn't). ???

Bob has since changed things a bit and `which nviz` now calls the binary
directly. Maybe it is time to try again....

configure with:
CFLAGS="-ggdb -Wall" ./configure

.. and recompile using tcl8.4-dev and tk8.4-dev.

I use kdbg as a gdb frontend. Others use ddd, etc

G61 > kdbg `which nviz`

Execution->Arguments
Run with these arguments: elev=elevation

"Program received signal SIGFPE, Arithmetic exception."

Not much use, just tells me it fails somewhere in the Tk_main() call.

Let's try gdb directly:

G61> gdb `which nviz`
GNU gdb 6.3-debian
[...]
This GDB was configured as "i386-linux"...Using host libthread_db library "/lib/libthread_db.so.1".

(gdb) run elev=elevation.dem
Starting program: /usr/local/src/grass/grass61/dist.i686-pc-linux-gnu/bin/nviz elevation.dem
[Thread debugging using libthread_db enabled]
[New Thread 16384 (LWP 7550)]
[New Thread 32769 (LWP 7551)]
[New Thread 16386 (LWP 7552)]
Loading Data
Update elev null mask
Loading Data
translating colors
  99%
Program received signal SIGFPE, Arithmetic exception.
[Switching to Thread 16384 (LWP 7550)]
0x42126ae0 in __driUtilCreateScreen () from /usr/X11R6/lib/modules/dri/r200_dri.so

(gdb) l
29 *----------------------------------------------------------------------
30 */
31
32 int main(int argc, /* Number of command-line arguments. */
33 char **argv /* Values of command-line arguments. */
34 )
35 {
36 int i;
37
38 Tcl_FindExecutable(argv[0]);

### HB: this is visualization/nviz/src/nvizMain.c

(gdb) bt
#0 0x42126ae0 in __driUtilCreateScreen () from /usr/X11R6/lib/modules/dri/r200_dri.so
#1 0x4212667b in __driUtilCreateScreen () from /usr/X11R6/lib/modules/dri/r200_dri.so
#2 0x421267bf in __driUtilCreateScreen () from /usr/X11R6/lib/modules/dri/r200_dri.so
#3 0x420942b2 in __driUtilCreateScreen () from /usr/X11R6/lib/modules/dri/r200_dri.so
#4 0x420942d9 in __driUtilCreateScreen () from /usr/X11R6/lib/modules/dri/r200_dri.so
#5 0x42011c5a in __driUtilCreateScreen () from /usr/X11R6/lib/modules/dri/r200_dri.so
#6 0x42013d7c in __driUtilCreateScreen () from /usr/X11R6/lib/modules/dri/r200_dri.so
#7 0x420141e8 in __driUtilCreateScreen () from /usr/X11R6/lib/modules/dri/r200_dri.so
#8 0x4212b1bc in __driUtilCreateScreen () from /usr/X11R6/lib/modules/dri/r200_dri.so
#9 0x41ffd35d in __driUtilUpdateDrawableInfo () from /usr/X11R6/lib/modules/dri/r200_dri.so
#10 0x40853195 in _glthread_SetTSD () from /usr/X11R6/lib/libGL.so.1
#11 0x408532ec in glXCreateContext () from /usr/X11R6/lib/libGL.so.1
#12 0x080628d7 in Togl_MakeWindowExist (togl=0x81b1898) at togl.c:1451
#13 0x0806172f in Togl_Configure (interp=0x807bfb0, togl=0x81b1898, argc=6, argv=0xbfffe778, flags=0)
    at togl.c:905
#14 0x08061e7f in Togl_Cmd (clientData=0x808c6e0, interp=0x807bfb0, argc=8, argv=0xbfffe770)
    at togl.c:1103
#15 0x406fc66f in TclInvokeStringCommand () from /usr/lib/libtcl8.4.so.0
#16 0x406fd6a4 in TclEvalObjvInternal () from /usr/lib/libtcl8.4.so.0
#17 0x407249c8 in TclCompEvalObj () from /usr/lib/libtcl8.4.so.0
#18 0x40723f0b in TclCompEvalObj () from /usr/lib/libtcl8.4.so.0
#19 0x40757147 in TclObjInterpProc () from /usr/lib/libtcl8.4.so.0
#20 0x406fd6a4 in TclEvalObjvInternal () from /usr/lib/libtcl8.4.so.0
#21 0x406fe254 in Tcl_EvalEx () from /usr/lib/libtcl8.4.so.0
#22 0x40740a24 in Tcl_FSEvalFile () from /usr/lib/libtcl8.4.so.0
#23 0x4070b5ff in Tcl_SourceObjCmd () from /usr/lib/libtcl8.4.so.0
#24 0x406fd6a4 in TclEvalObjvInternal () from /usr/lib/libtcl8.4.so.0
#25 0x406fe254 in Tcl_EvalEx () from /usr/lib/libtcl8.4.so.0
#26 0x406fe6eb in Tcl_Eval () from /usr/lib/libtcl8.4.so.0
#27 0x0805bfac in Ninit (interp=0x807bfb0, w=0x0) at nviz_init.c:459
#28 0x08051884 in NVIZ_AppInit (interp=0x807bfb0) at nvizAppInit.c:130
#29 0x40633f94 in Tk_MainEx () from /usr/lib/libtk8.4.so.0
#30 0x08060f66 in main (argc=3, argv=0xbffff6f4) at nvizMain.c:50

(it failed last year before I was using the radeon card & had dri going...)

still not telling me much. Peppering the C code with printf() and the
Tcl code with puts, I see that it segfaults while in
visualization/nviz/scripts/nviz2.2_script

it helped to turn on debug messages (at the top of nviz2.2_script)
set DEBUG 1

  segfaults in
proc Nv_force_panel
  on this line:
set Nv_($path) [mk$name\Panel $path]

debug output:
$path=.middle.panelarea.panels.surf
$name=surf

This is called from the Nv_mkPanelMenu proc, "surf" is the first $i
of $Nv_(panels).

changing that line to
set Nv_($path) {mk$name\Panel $path}

gets past that SegFault, but then crashes later on. No idea if {that's}
a correct approach, but it got past the segfault..

Next one: (still in nviz2.2_script)
it gets to
proc Nv_mapPanel

and segfaults on this line:
    #insert update to fix KDE wm problem
    update

If I comment out "update", it gets past it, but then segaults again a
few lines later on "pack $name -side top -fill x -expand no -anchor n",
or at least a puts after that line never gets displayed.

But on it runs. A window flashes up, I get the "%" prompt on the
terminal, I get past Ninit() and NVIZ_AppInit(), but lose the
scent after nviz2.2_script's init_graphics and Nv_expose procs
finish successfully. (not sure what calls Nv_expose, as it's a bind)

further than I got last time anyway.

Hamish

_______________________________________________
grass5 mailing list
grass5@grass.itc.it
http://grass.itc.it/mailman/listinfo/grass5

(attachments)

nv_script.tar (30 KB)

Hi, thanks for the help. I can just stumble my way through TclTk by feel
and don't really know what I'm doing.

> (gdb) bt
> #0 0x42126ae0 in __driUtilCreateScreen () from /usr/X11R6/lib/modules/dri/r200_dri.so
> #1 0x4212667b in __driUtilCreateScreen () from /usr/X11R6/lib/modules/dri/r200_dri.so
> #2 0x421267bf in __driUtilCreateScreen () from /usr/X11R6/lib/modules/dri/r200_dri.so
> #3 0x420942b2 in __driUtilCreateScreen () from /usr/X11R6/lib/modules/dri/r200_dri.so
> #4 0x420942d9 in __driUtilCreateScreen () from /usr/X11R6/lib/modules/dri/r200_dri.so
> #5 0x42011c5a in __driUtilCreateScreen () from /usr/X11R6/lib/modules/dri/r200_dri.so
> #6 0x42013d7c in __driUtilCreateScreen () from /usr/X11R6/lib/modules/dri/r200_dri.so
> #7 0x420141e8 in __driUtilCreateScreen () from /usr/X11R6/lib/modules/dri/r200_dri.so
> #8 0x4212b1bc in __driUtilCreateScreen () from /usr/X11R6/lib/modules/dri/r200_dri.so
> #9 0x41ffd35d in __driUtilUpdateDrawableInfo () from /usr/X11R6/lib/modules/dri/r200_dri.so
> #10 0x40853195 in _glthread_SetTSD () from /usr/X11R6/lib/libGL.so.1
> #11 0x408532ec in glXCreateContext () from /usr/X11R6/lib/libGL.so.1
> #12 0x080628d7 in Togl_MakeWindowExist (togl=0x81b1898) at togl.c:1451 <-----------------------------!!!!!
> #13 0x0806172f in Togl_Configure (interp=0x807bfb0, togl=0x81b1898, argc=6, argv=0xbfffe778, flags=0)
> at togl.c:905
> #14 0x08061e7f in Togl_Cmd (clientData=0x808c6e0, interp=0x807bfb0, argc=8, argv=0xbfffe770)
> at togl.c:1103
> #15 0x406fc66f in TclInvokeStringCommand () from /usr/lib/libtcl8.4.so.0
> (it failed last year before I was using the radeon card & had dri going...)

seems a problem/setting with Graphic Card o its driver, but....

I can't deny that's where it looks like it happens, but I'm still not
totally convinced the threading isn't confusing that. If I put printf()s
around the beginning and end of Togl_MakeWindowExist(), I see it go in
and out cleanly, once. AFAIK NVIZ+Tcl8.4 doesn't work for anyone on
Debian. I would be very interested to hear otherwise. Full backtrace
at end of this email.

> visualization/nviz/scripts/nviz2.2_script
>
> it helped to turn on debug messages (at the top of nviz2.2_script)
> set DEBUG 1
>
> segfaults in
> proc Nv_force_panel
> on this line:
> set Nv_($path) [mk$name\Panel $path]
>
> debug output:
> $path=.middle.panelarea.panels.surf
> $name=surf
>
> This is called from the Nv_mkPanelMenu proc, "surf" is the first $i
> of $Nv_(panels).

we had similar problem creating our panels... I hope tomorrow to give
you more info when my collegue Massimo Cuomo back to office.

I look forward to it.

> changing that line to
> set Nv_($path) {mk$name\Panel $path}

NO!... don't change it... you should investigate inside the mksurfPanel
module taht you can find in the script directory

i found it in the <grass install path>/etc/nviz2.2/scripts/panel_surf.tcl

Ok, I can understand that.

so:
It heads into panel_surf.tcl and mksurfPanel{}, gets all the way through
that proc to the set_display_from_curr at the end, and heads into there.

in proc set_display_from_curr{} (still panel_surf.tcl), it gets as far as
set L [Nsurf$curr get_res both]

for me $curr = 110658 so the line it breaks on looks like:
set L [Nsurf110658 get_res both]

???

investigate inside this tcl code, but...
I thing it's bettere to investigate on driver setting in /etc/X11R6

I am using the stock radeon driver from Debian's X 4.3.0 with a
ATI 9200SE. No special options turned on, dri is enabled & working.
Not sure where further to look?

Hamish

(gdb) bt f
#0 0x42142ae0 in __driUtilCreateScreen () from /usr/X11R6/lib/modules/dri/r200_dri.so
No symbol table info available.
#1 0x4214267b in __driUtilCreateScreen () from /usr/X11R6/lib/modules/dri/r200_dri.so
No symbol table info available.
#2 0x421427bf in __driUtilCreateScreen () from /usr/X11R6/lib/modules/dri/r200_dri.so
No symbol table info available.
#3 0x420b02b2 in __driUtilCreateScreen () from /usr/X11R6/lib/modules/dri/r200_dri.so
No symbol table info available.
#4 0x420b02d9 in __driUtilCreateScreen () from /usr/X11R6/lib/modules/dri/r200_dri.so
No symbol table info available.
#5 0x4202dc5a in __driUtilCreateScreen () from /usr/X11R6/lib/modules/dri/r200_dri.so
No symbol table info available.
#6 0x4202fd7c in __driUtilCreateScreen () from /usr/X11R6/lib/modules/dri/r200_dri.so
No symbol table info available.
#7 0x420301e8 in __driUtilCreateScreen () from /usr/X11R6/lib/modules/dri/r200_dri.so
No symbol table info available.
#8 0x421471bc in __driUtilCreateScreen () from /usr/X11R6/lib/modules/dri/r200_dri.so
No symbol table info available.
#9 0x4201935d in __driUtilUpdateDrawableInfo () from /usr/X11R6/lib/modules/dri/r200_dri.so
No symbol table info available.
#10 0x40853195 in _glthread_SetTSD () from /usr/X11R6/lib/libGL.so.1
No symbol table info available.
#11 0x408532ec in glXCreateContext () from /usr/X11R6/lib/libGL.so.1
No symbol table info available.
#12 0x080629fb in Togl_MakeWindowExist (togl=0x81b1980) at togl.c:1451
        visinfo = (XVisualInfo *) 0x81afbc8
        dpy = (Display *) 0x809ec28
        dummy = 77
        attrib_list = {1, 4, 8, 1, 9, 1, 10, 1, 12, 1, 5, 0, 1081616800, -1073752048,
  136395990, 8, 1, -1073751272, 1, 3, -1073749536, 136408592, 57, -1073751248, -1073751952,
  6, 0, 1, 1, -1073751304, 671088944, 1081480524, 1, 0, 185, 1081643644, -1073751584,
  -1073751588, -1073751800, 1081384660, -1073752048, -1073751224, -1073752088, 1081480524,
  136377053, 136327912, 3, -1073752048, -1073751588, 134731728, 0, 134731728, -1073751520,
  -1073749536, -1073751576, 1081190633, -1073751824, -1073751812, 136379022, 0, -1073751520,
  -1073751520, -1073752008, 1081413681, -1073752036, 0, 200, 136323328, 1081616800,
  1097682843, 136379022, 0, -1073751520, -1073751520, -1073751960, 1081413521, -1073751520,
  6, -1073751944, 1081418073, 1097682843, 1097706752, -1073751960, 1097682416, 1081643644,
  136379037, -1073751928, 1081541372, 0, -1073751928, 1088534557, 4, 1081643644, 1081643644,
  -1073751880, 1081461900, 136411176, 1, 12, -1073751900, -1073749536, -1073749500,
  -1073751848, 1081370553, -1073749536, 136115440, -1073751864, 1081089717, 12, 183,
  136406596, 1081643644, 49, 136411184, -1073751704, 1081369652, -1073749536, 136411184, 49,
  1081282900, -1073751588, 134791584, 0, 136411184, 0, 0, -1073751704, 1081385732, 134731824,
  -1073751588, 241, 49, -1640140815, 136115440, 134729884, -1073751728, 136379050, 0,
  -1073751744, 1081479921, 134731728, 0, 2, 1081480524, -1073751588, 1081623276, 1081623276,
  1081643644, 19, 0, -1073750968, 1081188643, -1073751600, 118, 19, 6, -1073751376, 2, 24, 0,
  -1073751520, -1073751376, -1073751608, 1081412466, 118, -1073751600, 8, 183, 19, 2, 0, 0,
  136379050, 136395995, 1739, 118, -1073751588, 0, 200, 1937011968, 0, 136379022, 0,
  1081643644, -1073751408, -1073751520, -1073751464, 1081411970, -1073751520, 0, 200, 0,
  134247529, 640, -1073751496, -1073751352, -1073751408, 9, 136379022, 1...}
        attrib_count = 12
        winPtr = (TkWindow *) 0x82188b0
        winPtr2 = (TkWindow *) 0xbfffe1e0
        parent = 5
        cmap = 1081643644
        swa = {background_pixmap = 136373503, background_pixel = 1097682843,
  border_pixmap = 1089632384, border_pixel = 3221214916, bit_gravity = 1097682808,
  win_gravity = -1073752360, backing_store = 1088534557, backing_planes = 1191182340,
  backing_pixel = 136327760, save_under = 1, event_mask = -1073752312,
  do_not_propagate_mask = 1081195603, override_redirect = 136379023, colormap = 136327784,
  cursor = 5}
        hPtr = (Tcl_HashEntry *) 0x4078927c
        new_flag = -1073752376
        scrnum = 1081643644
        attempt = 0
        directCtx = 1
        ci_depths = {8, 4, 2, 1, 12, 16, 8, 4, 2, 1, 12, 16}
        dbl_flags = {0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1}
#13 0x08061853 in Togl_Configure (interp=0x807cfd0, togl=0x81b1980, argc=6, argv=0xbfffe7a8,
    flags=0) at togl.c:905
        oldRgbaFlag = 1
        oldRgbaRed = 1
        oldRgbaGreen = 1
        oldRgbaBlue = 1
        oldDoubleFlag = 0
        oldDepthFlag = 0
        oldDepthSize = 1
        oldAccumFlag = 0
        oldAccumRed = 1
        oldAccumGreen = 1
        oldAccumBlue = 1
        oldAccumAlpha = 1
        oldAlphaFlag = 0
        oldAlphaSize = 1
        oldStencilFlag = 0
        oldStencilSize = 1
        oldAuxNumber = 0
#14 0x08061fa3 in Togl_Cmd (clientData=0x808d700, interp=0x807cfd0, argc=8, argv=0xbfffe7a0)
    at togl.c:1103
        name = 0x81f3bd0 ".middle.draw.canvas"
        main = 0x808d700
        tkwin = 0x82188b0
        togl = (struct Togl *) 0x81b1980
#15 0x406fc66f in TclInvokeStringCommand () from /usr/lib/libtcl8.4.so.0
No symbol table info available.
#16 0x406fd6a4 in TclEvalObjvInternal () from /usr/lib/libtcl8.4.so.0
No symbol table info available.
#17 0x407249c8 in TclCompEvalObj () from /usr/lib/libtcl8.4.so.0
No symbol table info available.
#18 0x40723f0b in TclCompEvalObj () from /usr/lib/libtcl8.4.so.0
No symbol table info available.
#19 0x40757147 in TclObjInterpProc () from /usr/lib/libtcl8.4.so.0
No symbol table info available.
#20 0x406fd6a4 in TclEvalObjvInternal () from /usr/lib/libtcl8.4.so.0
No symbol table info available.
#21 0x406fe254 in Tcl_EvalEx () from /usr/lib/libtcl8.4.so.0
No symbol table info available.
#22 0x40740a24 in Tcl_FSEvalFile () from /usr/lib/libtcl8.4.so.0
No symbol table info available.
#23 0x4070b5ff in Tcl_SourceObjCmd () from /usr/lib/libtcl8.4.so.0
No symbol table info available.
#24 0x406fd6a4 in TclEvalObjvInternal () from /usr/lib/libtcl8.4.so.0
No symbol table info available.
#25 0x406fe254 in Tcl_EvalEx () from /usr/lib/libtcl8.4.so.0
No symbol table info available.
#26 0x406fe6eb in Tcl_Eval () from /usr/lib/libtcl8.4.so.0
No symbol table info available.
#27 0x0805c064 in Ninit (interp=0x807cfd0, w=0x0) at nviz_init.c:459
        data = {Zrange = 220000, XYrange = 44000, NumCplanes = 0, CurCplane = 0, Cp_on = {0,
    0, 0, 0, 0, 0}, Cp_trans = {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0,
      0}}, Cp_rot = {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}},
  light = {{id = 0, brt = 0, r = 0, g = 0, b = 0, ar = 0, ag = 0, ab = 0, x = 0, y = 0,
      z = 0, w = 0}, {id = 0, brt = 0, r = 0, g = 0, b = 0, ar = 0, ag = 0, ab = 0, x = 0,
      y = 0, z = 0, w = 0}, {id = 0, brt = 0, r = 0, g = 0, b = 0, ar = 0, ag = 0, ab = 0,
      x = 0, y = 0, z = 0, w = 0}}, BGcolor = 0}
        nviz_script = "source [exec g.gisenv GISBASE]/etc/nviz2.2/scripts/nviz2.2_script\n"
#28 0x080518b7 in NVIZ_AppInit (interp=0x807cfd0) at nvizAppInit.c:131
No locals.
#29 0x40633f94 in Tk_MainEx () from /usr/lib/libtk8.4.so.0
No symbol table info available.
#30 0x0806108a in main (argc=3, argv=0xbffff724) at nvizMain.c:50
        i = 0
(gdb) frame 12
#12 0x080629fb in Togl_MakeWindowExist (togl=0x81b1980) at togl.c:1451
1451 togl->GlCtx = glXCreateContext(dpy, visinfo, None, directCtx);
(gdb) l
1446 shareCtx = None;
1447 togl->GlCtx = glXCreateContext(dpy, visinfo, shareCtx, directCtx);
1448 }
1449 else {
1450 /* don't share display lists */
1451 togl->GlCtx = glXCreateContext(dpy, visinfo, None, directCtx);
1452 }
1453
1454 if (togl->GlCtx == NULL) {
1455 TCL_ERR(togl->Interp, "could not create rendering context");

I dug back into some of my old archives from when I had looked into
going back to an nviz start-up script.

what's the advantage of starting from a script? disadvantage?

The attached patch will change the NVIZ animation encoding codec from
MPEG-1 to the much nicer Xvid. It's a proof of concept hack, but
functional. Even with a 5x bitrate the Xvid file size isn't all that
much bigger than the MPEG-1 file, but the quality is way better. I don't
think the Ogg Theora is working, but I didn't really spend any time on
that. Also I know the Xvid codec has a "cartoon mode", but I couldn't
find where to assert that. It might be useful to try.

I think it's good to give the user the option to use a better codec than
MPEG-1, either by another Tcl radio button for Xvid or an arbitrary
codec taken from an environmental variable (or g.gisenv grass variable)
if given.

Which approach do you think is best?

Hamish

(attachments)

xvid_codec.diff (1.56 KB)

On Thu, 2006-03-16 at 14:36 +1300, Hamish wrote:

> I dug back into some of my old archives from when I had looked into
> going back to an nviz start-up script.

what's the advantage of starting from a script? disadvantage?

I had originally got rid of the script startup to take better advantage
of G_gisinit to handle command line options, etc. As an example with the
script, typing 'nviz -h' you would get a list of help options for wish.
The disadvantages of not using a script seem to be the reported problem
of running nviz in the background (nviz -q &), and also TCL related
errors are not reported to stderr, which is not very helpful for
tracking problems down. There are also advantages to starting nviz from
a script listed in the "wish" man page at
http://www.tcl.tk/man/tcl/UserCmd/wish.htm .

I am not a script expert, but we probably should go back to a script
startup making sure that everything is properly passed to the GRASS
parser (unless in script mode).

The attached patch will change the NVIZ animation encoding codec from
MPEG-1 to the much nicer Xvid. It's a proof of concept hack, but
functional. Even with a 5x bitrate the Xvid file size isn't all that
much bigger than the MPEG-1 file, but the quality is way better. I don't
think the Ogg Theora is working, but I didn't really spend any time on
that. Also I know the Xvid codec has a "cartoon mode", but I couldn't
find where to assert that. It might be useful to try.

I think it's good to give the user the option to use a better codec than
MPEG-1, either by another Tcl radio button for Xvid or an arbitrary
codec taken from an environmental variable (or g.gisenv grass variable)
if given.

Which approach do you think is best?

I had used the MPEG-1 codec because it comes with FFMPEG and does not
require additional packages. The problem with XVID is that support is
not built by default into FFMPEG. It rquires the xvidcore package. The
same applies for Theora (requires libtheora). If they are available, it
would be good to output a nicer animation.

What I had hoped was that we could eventually add a "Video Options"
where the user sets the output format, output codec and associated
options. Maybe these could be dynamically created from something like
(ffmpeg -formats) to get the list of available codes?

Hamish

--
Bob