RSS/Atom feed Twitter
Site is read-only, email is disabled

geglbuffer-add-image writes GeglBuffer to disk only after a gegl_buffer_flush()?

This discussion is connected to the gegl-developer-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

Giuseppe Rota
2009-06-03 21:45:13 UTC (almost 15 years ago)

geglbuffer-add-image writes GeglBuffer to disk only after a gegl_buffer_flush()?

Hi all,
I'm just starting to learn gegl, so please forgive my lack of knowledge. I started to read the autogenerated docs and the code from the "examples" subdir.
I got stuck with the geglbuffer-add-image example, though. I expected to find, after a successful run, a file (first argument) containing the serialization (or dump, if you will) of a GeglBuffer (I used data/surfer.png as input).
That did not happen so I inserted a gegl_buffer_flush(buffer); instruction before the 2 g_object_unref near the end of the main(). That did the trick, I now have a binary file with the serialization of a GeglBuffer (first 4 bytes are "GEGL"). This happens (on Linux) both with version 0.0.22 and with the HEAD svn version (both babl and gegl) (GIO enabled).

Can you please explain the rationale behind this behaviour?

On a unrelated note, what's the difference between gegl_buffer_load and gegl_buffer_open?

Øyvind Kolås
2009-06-04 00:28:31 UTC (almost 15 years ago)

geglbuffer-add-image writes GeglBuffer to disk only after a gegl_buffer_flush()?

On Wed, Jun 3, 2009 at 8:45 PM, Giuseppe Rota wrote:

I got stuck with the geglbuffer-add-image example, though. I expected to find, after a successful run, a file (first argument) containing the serialization (or dump, if you will) of a GeglBuffer (I used data/surfer.png as input).
That did not happen so I inserted a gegl_buffer_flush(buffer); instruction before the 2 g_object_unref near the end of the main(). That did the trick, I now have a binary file with the serialization of a GeglBuffer (first 4 bytes are "GEGL"). This happens (on Linux) both with version 0.0.22 and with the HEAD svn version (both babl and gegl) (GIO enabled).

Can you please explain the rationale behind this behaviour?

GeglBuffer currently lacks multi process support which it can (could?) be enabled by patching GIO to allow simultanous read/write access from different processes. With such extra tweaks I suspect that the example would produce the desired output as written, this should be changed.

GeglBuffer was developed againt GIO it would have been better, and will be better to mmap the file and share the tiles between processes in that manner instead.

On a unrelated note, what's the difference between gegl_buffer_load and gegl_buffer_open?

gegl_buffer_load loads a on disk buffer into RAM, swapping into the users swap directory for tiles that are not stored in memory. gegl_buffer_open opens an existing on disk GeglBuffer using the buffer itself for swapping.

/Øyvind K.

utkarsh shukla
2009-06-04 16:29:08 UTC (almost 15 years ago)

geglbuffer-add-image writes GeglBuffer to disk only after a gegl_buffer_flush()?

Hi,
I was busy these days with some other personal things, I have read some of the code on GEGL Buffer and the documentations, and i think I can startup the multiprocessor support patch. I just wanted if anyone can just find some time to explain me that how should I proceed and what would be the final objective i should keep in mind. Also It would be very great if Jerson can just tell me that how is he proceeding up with the problem and what solution has he formed in mind. I am not much clear about how should i proceed.

Thanks, Utkarsh Shukla

Jerson Michael Perpetua
2009-06-04 17:00:51 UTC (almost 15 years ago)

geglbuffer-add-image writes GeglBuffer to disk only after a gegl_buffer_flush()?

Hi Utkarsh,
I'm not an expert, but here's my take on this. You should probably start by examining GeglBufferIterators (gegl/gegl/buffer/gegl-buffer-iterator.c) and how they are used by GeglProcessors (gegl/gegl/process/processor.c). While you're at it, it would also help if you can study all graph-related constructs (gegl/gegl/graph/), especially the parts on GeglVisitors (gegl/gegl/graph/gegl-visitor.c) and GeglVisitables (gegl/gegl/graph/gegl-visitable.c) and their descendants (i.e. GeglNodes and GeglPads). I suspect that these are the parts where the bulk of multi-threading should be implemented.

As to your project's relation to my work, I'm currently looking into OpenGL thread-safety. One solution that I found is to create a hidden OpenGL context after initialization and create one shared OpenGL context per thread. The other (much more attractive) solution is to do all OpenGL operations in a single rendering thread. Threads that require OpenGL operations will 'enqueue' their operations on the rendering thread.

The latter solution is better, imho, because context switching is both costly and complex.

Regards,
Daerd

Jerson Michael Perpetua
2009-06-04 17:15:52 UTC (almost 15 years ago)

geglbuffer-add-image writes GeglBuffer to disk only after a gegl_buffer_flush()?

By the way, it would be awesome if we could see you in #gegl. We can discuss things there in real-time.

Regards, Daerd

utkarsh shukla
2009-06-04 19:41:26 UTC (almost 15 years ago)

geglbuffer-add-image writes GeglBuffer to disk only after a gegl_buffer_flush()?

Sure i would love to. Till now I was trying to settle things out...you know money and other stuff so I was mostly not online at a streach....Well now I will try to be there at the IRC :)

Thanks

On 6/4/09, Jerson Michael Perpetua wrote:

By the way, it would be awesome if we could see you in #gegl. We can discuss things there in real-time.

Regards, Daerd