[GRASS5] PNG driver problem

> [max res. PPM image dump from NVIZ]

..

> After the image dump, it would render the hi-res polygon ok, but
> the low res movement 'Grid' has disappeared, then after a few
> seconds of playing with that:
>
> Final Assembled Image will be 2048 x 1995
> Writing Tile 1 of 4
> Writing Tile 2 of 4
> Writing Tile 3 of 4
> Writing Tile 4 of 4
> Assembling Tiles
> Destroy Pixmap and GLXPixmap
> global-exag = 3.000000
> recalculating normals...
> 100
> 200
> 300
> global-exag = 3.000000
> recalculating normals...
> 100
> 200
> X Error of failed request: GLXBadContextTag
> Major opcode of failed request: 144 (GLX)
> Minor opcode of failed request: 1 (X_GLXRender)
> Serial number of failed request: 3736
> Current serial number in output stream: 3737

I can't reproduce this with 5.3, and I don't have an up-to-date 5.7
built right now. Can you see if it happens for you with 5.3?

Happens both with the latest 5.3 and 5.7.

Just after it finishes writting the PPM, the low-res 'grid' is drawn,
but the southern 10-15% is missing. When you change the view angle you
are looking at a blank screen, when you finish it redraws the hi-res
'polygon' version ok.

-> Resizing the viewing window causes the above error (& crash).

Hamish

On Wed, Aug 25, 2004 at 09:14:43AM -0700, David Piasecki wrote:

Should I
be looking for the latest CVS snapshot of 5.7? I tried, but I wasn't
able to find it, though I'm still somewhat new to CVS.

The snapshots are made available here (every saturday renewed):

http://grass.itc.it/download.html#g57
-> CVS source code snapshot

It often feels
like a guessing game when trying to figure out what's available.

It's documented here:
http://grass.itc.it/grasscvs.html#access
-> CVS commits mailing list: We have established a "GRASS CVS commit" mailing list. This mailing list distributes "commit messages" from the CVS system. After subscription you will receive a message about every change in GRASS CVS repository along with the related comment.
  -> Archive

Hope this helps,

Markus

Hamish wrote:

> > X Error of failed request: GLXBadContextTag
> > Major opcode of failed request: 144 (GLX)
> > Minor opcode of failed request: 1 (X_GLXRender)
> > Serial number of failed request: 3736
> > Current serial number in output stream: 3737
>
> I can't reproduce this with 5.3, and I don't have an up-to-date 5.7
> built right now. Can you see if it happens for you with 5.3?

Happens both with the latest 5.3 and 5.7.

Just after it finishes writting the PPM, the low-res 'grid' is drawn,
but the southern 10-15% is missing. When you change the view angle you
are looking at a blank screen, when you finish it redraws the hi-res
'polygon' version ok.

-> Resizing the viewing window causes the above error (& crash).

I can't reproduce this.

However try moving the Destroy_OS_Ctx() call in do_zoom.c to *before*
the point where it tries to redraw everything, i.e.:
      
#if defined(HAVE_PBUFFERS) || defined(HAVE_PIXMAPS)
    Destroy_OS_Ctx();
#endif

/* Done */
/* Reset viewport and draw orinanl view */
    GS_set_viewport(a_orig, c_orig, b_orig, d_orig);
    Ndraw_all_cmd(data, interp, argc, argv);

--
Glynn Clements <glynn.clements@virgin.net>

Glynn Clements wrote:

> > > X Error of failed request: GLXBadContextTag
> > > Major opcode of failed request: 144 (GLX)
> > > Minor opcode of failed request: 1 (X_GLXRender)
> > > Serial number of failed request: 3736
> > > Current serial number in output stream: 3737
> >
> > I can't reproduce this with 5.3, and I don't have an up-to-date 5.7
> > built right now. Can you see if it happens for you with 5.3?
>
> Happens both with the latest 5.3 and 5.7.
>
> Just after it finishes writting the PPM, the low-res 'grid' is drawn,
> but the southern 10-15% is missing. When you change the view angle you
> are looking at a blank screen, when you finish it redraws the hi-res
> 'polygon' version ok.
>
> -> Resizing the viewing window causes the above error (& crash).

I can't reproduce this.

However try moving the Destroy_OS_Ctx() call in do_zoom.c to *before*
the point where it tries to redraw everything, i.e.:
      
#if defined(HAVE_PBUFFERS) || defined(HAVE_PIXMAPS)
    Destroy_OS_Ctx();
#endif

/* Done */
/* Reset viewport and draw orinanl view */
    GS_set_viewport(a_orig, c_orig, b_orig, d_orig);
    Ndraw_all_cmd(data, interp, argc, argv);

Duh. No, that won't work; the "makecurrent" operation has to occur
first.

Essentially, those lines need to be removed, and an Ndraw_all added to
the Tcl code after the makecurrent operation.

--
Glynn Clements <glynn.clements@virgin.net>

Glynn Clements wrote:

> > > X Error of failed request: GLXBadContextTag
> > > Major opcode of failed request: 144 (GLX)
> > > Minor opcode of failed request: 1 (X_GLXRender)
> > > Serial number of failed request: 3736
> > > Current serial number in output stream: 3737
> >
> > I can't reproduce this with 5.3, and I don't have an up-to-date 5.7
> > built right now. Can you see if it happens for you with 5.3?
>
> Happens both with the latest 5.3 and 5.7.
>
> Just after it finishes writting the PPM, the low-res 'grid' is drawn,
> but the southern 10-15% is missing. When you change the view angle you
> are looking at a blank screen, when you finish it redraws the hi-res
> 'polygon' version ok.
>
> -> Resizing the viewing window causes the above error (& crash).

I can't reproduce this.

However, I have re-discovered something which could cause problems:

  # Set the cancel function for drawing
  Nset_cancel_func update

Essentially, this means that Tk's event-processing code will be called
repeatedly throughout the drawing process. If this results in the Togl
widget receiving configure/expose/etc events, Togl will reinstate the
original (on-screen) GLX context, with unpredictable results.

Try commenting out the above line (in nviz2.2_script), and see if the
problems still occur.

The reason for the above is so that the UI doesn't "freeze" while
time-consuming operations in progress. However, it also introduces
serious reliability issues; any code which calls GS_check_cancel
(which includes the drawing code) has to allow for the fact that it
can result in arbitrary changes to the program's state (e.g. the GLX
context suddenly changing, windows being moved/resized/deleted, etc).

Essentially, it's one of those things which probably seemed like a
good idea at the time (to someone who hadn't actually considered the
consequences), but isn't.

--
Glynn Clements <glynn.clements@virgin.net>

> > > > X Error of failed request: GLXBadContextTag
> > > > Major opcode of failed request: 144 (GLX)
> > > > Minor opcode of failed request: 1 (X_GLXRender)
> > > > Serial number of failed request: 3736
> > > > Current serial number in output stream: 3737
> > >
> > > I can't reproduce this with 5.3, and I don't have an up-to-date
> > > 5.7 built right now. Can you see if it happens for you with 5.3?
> >
> > Happens both with the latest 5.3 and 5.7.
> >
> > Just after it finishes writting the PPM, the low-res 'grid' is
> > drawn, but the southern 10-15% is missing. When you change the
> > view angle you are looking at a blank screen, when you finish it
> > redraws the hi-res'polygon' version ok.
> >
> > -> Resizing the viewing window causes the above error (& crash).
>
> I can't reproduce this.

However, I have re-discovered something which could cause problems:

  # Set the cancel function for drawing
  Nset_cancel_func update

Essentially, this means that Tk's event-processing code will be called
repeatedly throughout the drawing process. If this results in the Togl
widget receiving configure/expose/etc events, Togl will reinstate the
original (on-screen) GLX context, with unpredictable results.

Try commenting out the above line (in nviz2.2_script), and see if the
problems still occur.

Still occurs after commenting..

(also that change has latency issues, cutting into usability badly for me)

Hamish

Hamish wrote:

> > I can't reproduce this.
>
> However, I have re-discovered something which could cause problems:
>
> # Set the cancel function for drawing
> Nset_cancel_func update
>
> Essentially, this means that Tk's event-processing code will be called
> repeatedly throughout the drawing process. If this results in the Togl
> widget receiving configure/expose/etc events, Togl will reinstate the
> original (on-screen) GLX context, with unpredictable results.
>
> Try commenting out the above line (in nviz2.2_script), and see if the
> problems still occur.

Still occurs after commenting..

Can you tell whether Tcl/Tk is using multiple threads? That could
cause problems (unless the OpenGL code is all being run within the
same thread, it will cause problems, as each thread will have its own
current GLX context.

One possible solution is to undefine both HAVE_PBUFFERS and
HAVE_PIXMAPS in config.h. In that case, do_zoom.c will just use the
existing window (and its associated GLX context).

Other than that, unless someone who can actually reproduce the error
is willing and able to debug it, it's likely to remain broken.

(also that change has latency issues, cutting into usability badly for me)

There isn't any solution to that, other than to expend a great deal of
effort re-writing NVIZ (and possibly OGSF) so that it can actually
cope with arbitrary events being handled in the middle of rendering.

--
Glynn Clements <glynn.clements@virgin.net>