On 12/29/2010 01:20 PM, Lionel Landwerlin wrote:
Le mercredi 29 décembre 2010 à 12:41 +0100, Krzysztof Sachanowicz a
écrit :
I am using DirectFB 1.4.3 compiled with multiple application core.
I have many processes, each can have one or more off-screen surfaces and
a compositor, which must have access to these surfaces and does the
composition to the primary surface. There is also a dedicated IPC
mechanism to pass ints/pointers.
I tried creating surfaces with DSCAPS_SHARED as is explained in this post:
http://mail.directfb.org/pipermail/directfb-dev/2009-November/005356.html
but IDirectFBSurface pointer returned is not created in shared memory.
Looking into the sources, it is allocated by DIRECT_ALLOCATE_INTERFACE.
However the structure contains a pointer to CoreSurface allocated by
dfb_core_create_surface() in shared memory pool.
Corresponding part from log:
(-) [ NO NAME 2.084] ( 3302) Fusion/Object: == Surface Pool ==
(-) [ NO NAME 2.085] ( 3302) Fusion/Object: -> added
0x20018400 with ref [0x8]
(-) [ NO NAME 2.100] ( 3302) Core/Surface: -> 1920x1080
(-) [ NO NAME 2.102] ( 3302) Core/Surface: -> RGB16
(-) [Main Thread 2.024] ( 3304) Core/SurfBuffer: -> LAYER 0 READ
(-) [ NO NAME 2.107] ( 3302) Core/Surface: -> caps
0x00100000
I suspect addresses starting from 0x20000000 are in shared memory.
So the question is: How to create a surface in another process
referencing given CoreSurface? Or is there any other way to have
surfaces accessed by multiple processes?
I don't think it's possible with surfaces. However you can do it with
windows. Create a Window (with same properties as your buffer, ie single
buffered, etc...), then get the window ID with the GetID method, and
pass it to the second process, and finally use GetWindowByResourceID on
the layer in the second process retrieve the same window. At this point
you should be able to manipulate the window's buffer on both side.
When using windows 2 questions arise:
1. Is there any standard way of having a hidden (off-screen) window?
AFAIK there is no function to show/hide a window.
2. When creating only hidden windows on the same display layer as my
process is doing compositing, is it going to work? I don't know how
directfb renders windows but IMHO it might want to clear the primary
surface or display some background, thus interfering with my drawing.
I also looked at another approach, to use CreateWindow and in other
process window::GetSurface. I am not sure it will work when actually I
have my own window compositing. It seems a bit overcomplicated.
Thanks,
Krzysztof Sachanowicz
_______________________________________________
directfb-dev mailing list
directfb-dev@directfb.org
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev