[info-performer] Still have paging problem in terrain visualisation

Date view Thread view Subject view Author view

Andreas.Lenz++at++esg.de
Date: 08/08/2003 06:21:13


Hi,

I still have some problems with pagin in my visual simulation for a flight
simulator: The paging process
is designed to load about 12-15 tiles (of 8000 altogether) to the rendering
process. Each tile (the *.pfb file)
has a size o the order 4 MByte.
After a while of runnig "top" shows that my database process uses nearly
100 % of one CPU on my dual-cpu
machine. And moving on with the eypoint, loading of new tiles slows down.
It looks like the system gets stuck
in one call and doesn't start my database function again.

I also checked the ref-count of the nodes before deleting them, and ref was
always 1, which seems to be reasonable.

Just to make sure there is no error within my dbase function here is what
it looks like:

#include <Performer/pf/pfBuffer.h>
#include <Performer/pf/pfGroup.h>
#include <Performer/pf/pfDCS.h>
#include <Performer/pf/pfScene.h>

#define MAX_TILES 10000

t_vis_tile Tile_List[MAX_TILES]; // structure for describing a tile (
isPaged, coordinates,..)

pfNode *Tiles[MAX_TILES];

/*********************************************************/
void myDBaseFunc (void)
/*********************************************************/
{
      static int init = 1;
      static int page_cnt = 0;
      static pfBuffer *Buffer = NULL;
      static pfGroup *Root = NULL; // ?? Do i need a pfGroup ??
      static long inside = 0; // number of tiles in paging area
      int k;
      char file[200];

      // Init on first call of function
      if (Buffer == NULL)
      {
            Buffer = new pfBuffer;
            Buffer->select();
      }
      if(init)
      {
            init = 0;
            init_terrain_files(); // scan dir for all *.pfb's and get the
coordinates
                                    // of the related tiles
            Root = new pfGroup; // Is this needed ?
      }

      // get aircraft position lat, lon
      // and calculate paging area
      Page_Area[...] = rectangle around lat, lon .....

      // Loop over all tiles to see which tiles is inside paging area
      inside = 0;
      for(k=0; k < ViewState->num_tiles; k++)
      {
            if(tile_inside_page_area (&Tile_List[k]))
            {
                  if(Tile_List[k].state != TILE_STATE_PAGED // Tile is
visible an not yet paged
                  Tile_List[k].action = TILE_ACTION_LOAD; // mark tile to
be loaded later
                  inside ++;
            }
            else
            {
                  Tile_List[k].action = TILE_ACTION_DELETE; // mark tile to
be deleted no matter if it is paged
            }
      }

      // Loop over all tiles, looking for paged tiles which have
      // to be deleted and remove them from scene and buffer
      for(k=0; k < ViewState->num_tiles; k++)
      {
            if ( (Tile_List[k].action == TILE_ACTION_DELETE) &&
(Tile_List[k].state == TILE_STATE_PAGED) )
            {
                  Buffer->remove(ViewState->scene, Tiles[k]);
                  pfAsyncDelete( Tiles[k] );

                  Tile_List[k].state = TILE_STATE_NOT_PAGED;
            }
      }

      // Loop over all tiles, searching for tiles to be loaded
      for(k=0; k < ViewState->num_tiles; k++)
      {
            if ( (Tile_List[k].action == TILE_ACTION_LOAD) &&
(Tile_List[k].state == TILE_STATE_NOT_PAGED) )
            {
                  // get filename belonging to tile ....
                  strcpy (file, filename);

                  Tiles[k] = pfdLoadFile(file);

                  Buffer->add(ViewState->scene, Tiles[k]);

                  Tile_List[k].state = TILE_STATE_PAGED;
            }
      }

      if ( something was changed... )
      {
            // merging of scene buffer
            Buffer->merge();
      }

      pfDBase();
}

Maybe someone could check to make sure paging should be done correctly by
this code.

Thanks Andreas Lenz

------------------------------------------------------------
Andreas Lenz ESG GmbH
Einsteinstrasse 174 D-81675 München
Tel.: ++49-89-9216-2167
Fax.: ++49-89-9216-2632
Mail: Andreas.Lenz++at++esg.de
------------------------------------------------------------

Hello Andreas !

I'll try to guess where the problem is:

pfAsyncDelete queues delete requests of objects without checking their
ref-count. Performer tries to delete the objects in a DBASE process. If the
object ref-count isn't zero, it remains on the AsyncDelete queue until its
ref-count is zero. The following code bloats the AsyncDelete list out of
control:

    while (1)
    {
             pfGroup *group = new pfGroup;
             group -> ref(); // bump ref-count.
             pfAsyncDelete(group); // group will never be deleted
(ref-count > 0).

        ...

        pfFrame();
    }

I suggest that you check the ref-count of your objects before calling
pfAsyncDelete (pfMemory::getRef). Make sure that either the ref-count is
zero
before calling pfAsyncDelete or it becomes zero shortly after the call to
pfAsyncDelete.

Note:

o Adding a node as a child of another node increases the child's ref-count.
o New nodes have zero ref-count.

-yair

> I'm trying to build an application for terrain visualisation used in
flight
> simulation. As i have to cover a large area,
> the database is made up of several (together about 8000) tiles. I started
> from perfly code, added a database function
> in a separate process which should handle the paging of the tiles.
> Loading the tiles works fine, but deleting the tiles with an
pfAsyncDelete
> () consumes increasing time. As a result old tiles
> are not deleted fast enough and the new tiles, which should become
visible
> are not loaded.
>
> My hardware is a dual pentium with 2x2GHz and GeForce4 4600Ti Graphics
> Card, running Suse Linux 7.3 with XFree 4.2
> and latest NVidia drivers. Performer is installed as evaluation copy.
>
> On a similar hardware with nearly identical system (but licensed
> performer), just slower processor, everything works fine.
>
> Is there some restriction to the evalutaion version running without
license
> ?
>
> Ore are there any other hints, maybe some code examples for building and
> running a multithreaded application with paging ??
>
> Any help is welcome
>
> ------------------------------------------------------------
> Andreas Lenz ESG GmbH
> Einsteinstrasse 174 D-81675 München
> Tel.: ++49-89-9216-2167
> Fax.: ++49-89-9216-2632
> Mail: Andreas.Lenz++at++esg.de
> ------------------------------------------------------------
>
>
>
> -----------------------------------------------------------------------
> List Archives, Info, FAQ: http://www.sgi.com/software/performer/
> Open Development Project: http://oss.sgi.com/projects/performer/
> Submissions: info-performer++at++sgi.com
> Admin. requests: info-performer-request++at++sgi.com
> -----------------------------------------------------------------------
> SIGGRAPH 2003 Friends of Performer Meeting:
> Wednesday July 30 6:00pm San Diego Hilton Hotel Santa Rosa Room
> -----------------------------------------------------------------------
>

--
\_________  \_____  \__    \__  \_____
\_________  \_____   \__   \__  \_____         Yair Kurzion
       \__     \__   \____\__      \__         yair++at++sgi.com
       \__          \__  \__                  (650) 933-6502
       \__          \__   \__
       \__          \__    \__


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Fri Aug 08 2003 - 06:22:27 PDT