[Spice-devel] spice BSD/OSX client
attila.sukosd at gmail.com
Thu Jun 24 08:24:40 PDT 2010
On Mon, May 31, 2010 at 10:59 AM, Alexander Larsson <alexl at redhat.com>wrote:
> On Sat, 2010-05-29 at 20:39 +0200, Attila Sukosd wrote:
> > Hi guys,
> > I have spent the last day or two doing some porting so that spicec
> > would use kqueue on bsd instead of epoll. I have disabled audio for
> > now, but once the current version works as it should, I will do a port
> > to CoreAudio aswell.
> For the client, i'm not sure using kqueue is the best way. It seems like
> a better idea to just move both linux and bsd to use regular poll. There
> is no way we'll have enough file descriptors on the client side to get
> any kind of scaling problems that epoll/kqueue are meant to solve, so we
> just get portability complexity for no gain.
> So, a better way forward is probably to drop both epoll and kqueue and
> switch to a normal poll or select.
> > I now have a working version, however I had to disable the shm stuff
> > in order to get it to work since I have been getting the following
> > error:
> > 1275161751 ERROR spice : x_error_handler: x error on display :0.0
> > error (code 10) BadAccess (attempt to access private resource denied)
> > major 139 minor 1 request 139
> > Since the major code (139) is outside the 125? which is the standard
> > codes in X, I guessed that 139 is an Xorg extension,
> > $ xdpyinfo -display :0 -queryExtensions |grep 139
> > MIT-SHM (opcode: 139, base event: 76, base error: 145)
> > So my wild guess is that it tries to write outside the available
> > buffer?
> > Any help would be much appriciated!
> No. A BadAccess is an xserver message is an error return from an X call,
> saying some argument was wrong in some way related to access rights. My
> immediate guess is that some access rights on the shared memory segment
> was wrong.
> To debug this, add a call to
> XSynchronize (x_display, True);
> in Platform::init() in client/x11/platform.cpp
> Then you'll get the error on the actual X message that caused it and you
> can figure out what happens in the debugger.
> Alexander Larsson Red Hat, Inc
> alexl at redhat.com alexander.larsson at gmail.com
> He's a one-legged day-dreaming barbarian on the run. She's an artistic
> bodyguard with an incredible destiny. They fight crime!
Thanks for your help! It turns out the issue was that shmctl(shminfo->shmid,
IPC_RMID, NULL) was called before XShmAttach() and apparently thats what
cause the issue. I moved it under XShmAttach in red_pixmap_cairo.cpp and now
it works almost perfectly.
Also, the kqueue implementation in OS X 10.6 seem to have been broken, so I
went with your suggestion and reimplemented the event handler using
select(). One thing I noticed though was that the epoll implementation
watched the fds for both read and write (add_to_poll()), but since it is
edge triggered, it only fires once per change, but my select()
implementation is level triggered, which meant it would never block and use
up 100% CPU (for example monitoring a File fd, it always triggers). After
playing a bit around with it, i decided to drop watching write for fds all
together, and the client seem to work fine. Is there a need to check it or
am I safe with monitoring only reads?
Now on to the audio, I have been implementing audio using CoreAudio
Framework for OS X (another idea could be OpenAL which is also
cross-platform?), which pulls in a lot of extra headers, including
MacTypes.h which unfortunately defines a "Rect" and "Point" struct which
causes issues with the definitions inside common/draw.h. I can hack around
it, but its not very nice, or I could rename the ones in spice, but that
would break any compatibility with my patches to the current upstream code.
And another thing I have noticed was that sometimes when I try to play back
video (local or youtube), the video picture does not get updated (however I
see that the event handler is handling all the incoming frames) and
sometimes a square in the middle of the video gets updated but not the rest.
And, if I scroll the page or move the window while watching the video, it
refreshes fine. So I have no idea what goes on there :)
Anyway, otherwise it seem to perform pretty well.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Spice-devel