Sharing Graphics memory accross android processes

95 views
Skip to first unread message

NimeshChanchani

unread,
May 11, 2012, 7:41:06 AM5/11/12
to android-porting
Hi Guys,

Im using a pandaboard , and I have ubuntu chrooted from android.

i have a framebuffer that i want to overlay on the android side ,
which is being produced on the ubuntu side.

to share memory , I know i can use "ashmem" or "ion_alloc" , but i
dont want to use them as it would involve a

buffer copy, before passing it to the to the Display Subsystem for
overlay,

What I want to do is, use "IMG_native_handle_t" in "hal_public.h"

at : http://androidxref.com/source/xref/hardware/ti/omap4xxx/hwc/hal_public.h

the comment above "fd" field says that:

/* The `fd' field is used to "export" a meminfo to another process.
67 * Therefore, it is allocated by alloc_device_t, and consumed
by
68 * gralloc_module_t. The framebuffer_device_t does not need a
handle,
69 * and the special value IMG_FRAMEBUFFER_FD is used instead.
70 */
71 int fd[MAX_SUB_ALLOCS];


but i couldn't get much info or sample code on how to "export" fd to
another process?

can anyone help?

Regards,
Nimesh

Nitin Mahajan

unread,
May 11, 2012, 11:51:03 AM5/11/12
to android-porting
Hi!
If your problem is just, to share the with another process, then just
pass it over binder communication.
The binder driver internally takes care of duplicating it.

regards
-Nitin
>
> can anyone help?
>
> Regards,
> Nimesh
>
> --
> unsubscribe: android-porti...@googlegroups.com
> website: http://groups.google.com/group/android-porting

NimeshChanchani

unread,
May 11, 2012, 2:30:43 PM5/11/12
to android-porting
The binder does it for ashmem, but are u sure it does it for buffer
also?

zoli_k

unread,
May 14, 2012, 11:36:14 PM5/14/12
to android...@googlegroups.com
Hi,

you can use the MemoryHeapBase and pass it trough a binder. 

frameworks/base/include/binder/MemoryHeapBase.h

Alternatively, you can also pass a file descriptor using writeFileDescriptor 
in a Parcel, if this is what you need.

What do you mean under "produced framebuffer"? Is it a Linux Kernel framebuffer
or a user space graphical buffer? You may consider to setup a virtual framebuffer
on Kernel level.

NimeshChanchani

unread,
May 24, 2012, 1:53:12 PM5/24/12
to android-porting
thx for your answer...

i'm trying to share graphics buffer from chrooted , ubuntu side .

so i want to allocate a buffer and pass it to the process that runs on
chrooted ubuntu.

i figured out , android-pandaboard doesn't support /dev/ion yet . so
i've abandoned my abovementioned plan.

however i still need to pass a file descriptor , using non-binder
methods , as the chrooted ubuntu doesn't use binder.

sockets accross android and chrooted ubuntu work.


i've tried my hand at passing the fd through sendmsg() and recvmsg() ,
but no luck there....
Reply all
Reply to author
Forward
0 new messages