RE: Is there any way to let compositor set the data in client space and then return back to client?

2014-02-09 Thread Wang, Quanxian
Thanks pq. It is helpful for me. I will have a try with your idea. :)

-Original Message-
From: Pekka Paalanen [mailto:ppaala...@gmail.com] 
Sent: Saturday, February 08, 2014 5:56 PM
To: Wang, Quanxian
Cc: wayland-devel@lists.freedesktop.org
Subject: Re: Is there any way to let compositor set the data in client space 
and then return back to client?

On Sat, 8 Feb 2014 08:19:06 +
Wang, Quanxian quanxian.w...@intel.com wrote:

 Hi, All
 
 I want to allocate some space in client, and let compositor set some 
 data in this space and then return back to client.
 
 It seems like user data mechanism.
 
 Any way to implement that?

Not really, it's nothing like user data.

You have to make the client bind to a new protocol interface you designed, and 
then use events to pass the data to the client.

If you need to pass significant amounts of data, you can use a mechanism 
similar to passing XKB keymaps, see wl_keyboard.keymap event. There the 
compositor creates the shm file. If you want the shm file created by the 
client, you pass the file descriptor in the other direction, similar to 
wl_shm.create_pool, have the server fill out the memory, and then send an event 
to say it's done or rely on a wl_display.sync roundtrip.


Thanks,
pq
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


RE: Is there any way to let compositor set the data in client space and then return back to client?

2014-02-09 Thread Wang, Quanxian


From: magc...@gmail.com [mailto:magc...@gmail.com] On Behalf Of Jasper St. 
Pierre
Sent: Sunday, February 09, 2014 12:23 AM
To: Wang, Quanxian
Cc: wayland-devel@lists.freedesktop.org
Subject: Re: Is there any way to let compositor set the data in client space 
and then return back to client?

Well, there's not really anything that allows process A to arbitrarily modify 
process B's memory. The only thing that's close is memory-mapped files, and 
that's already what we use to share image data between the client and the 
compositor.
There's also memfd, which is more secure than a memory-mapped tmpfile, simply 
because it allows sealing the fd, so you can be sure it will never change as 
you try to read from it. But memfd isn't a public API yet.

What exactly are you trying to do here?
[Wang, Quanxian] I want to create a protocol to get the output data from 
compositor, I don't know where to put it for client.  So shared memory should 
be a good way to do that. Anyway,  I need to check it how to make it happen. 
Thanks for your idea.

On Sat, Feb 8, 2014 at 3:19 AM, Wang, Quanxian 
quanxian.w...@intel.commailto:quanxian.w...@intel.com wrote:
Hi, All

I want to allocate some space in client, and let compositor set some data in 
this space and then return back to client.

It seems like user data mechanism.

Any way to implement that?

Thanks

Regards

Quanxian Wang


___
wayland-devel mailing list
wayland-devel@lists.freedesktop.orgmailto:wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel



--
  Jasper
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Is there any way to let compositor set the data in client space and then return back to client?

2014-02-08 Thread Wang, Quanxian
Hi, All

I want to allocate some space in client, and let compositor set some data in 
this space and then return back to client.

It seems like user data mechanism.

Any way to implement that?

Thanks

Regards

Quanxian Wang

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: Is there any way to let compositor set the data in client space and then return back to client?

2014-02-08 Thread Pekka Paalanen
On Sat, 8 Feb 2014 08:19:06 +
Wang, Quanxian quanxian.w...@intel.com wrote:

 Hi, All
 
 I want to allocate some space in client, and let compositor set
 some data in this space and then return back to client.
 
 It seems like user data mechanism.
 
 Any way to implement that?

Not really, it's nothing like user data.

You have to make the client bind to a new protocol interface you
designed, and then use events to pass the data to the client.

If you need to pass significant amounts of data, you can use a
mechanism similar to passing XKB keymaps, see wl_keyboard.keymap
event. There the compositor creates the shm file. If you want the
shm file created by the client, you pass the file descriptor in the
other direction, similar to wl_shm.create_pool, have the server
fill out the memory, and then send an event to say it's done or
rely on a wl_display.sync roundtrip.


Thanks,
pq
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: Is there any way to let compositor set the data in client space and then return back to client?

2014-02-08 Thread Jasper St. Pierre
Well, there's not really anything that allows process A to arbitrarily
modify process B's memory. The only thing that's close is memory-mapped
files, and that's already what we use to share image data between the
client and the compositor.

There's also memfd, which is more secure than a memory-mapped tmpfile,
simply because it allows sealing the fd, so you can be sure it will never
change as you try to read from it. But memfd isn't a public API yet.

What exactly are you trying to do here?


On Sat, Feb 8, 2014 at 3:19 AM, Wang, Quanxian quanxian.w...@intel.comwrote:

  Hi, All

 I want to allocate some space in client, and let compositor set some data
 in this space and then return back to client.

 It seems like user data mechanism.

 Any way to implement that?

 Thanks

 Regards

 Quanxian Wang


 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel




-- 
  Jasper
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel