[clutter] Sharing a stage with clutter_stage_set_xwindow_foreign

From: Tommi Höynälänmaa <tommi.hoynalanmaa@iki.fi>
Date: Thu Apr 12 2007 - 04:22:54 EDT

I'm trying to use same X window for two Clutter applications that are
run as different processes. The first application obtains the stage
window ID with clutter_stage_get_xwindow and prints it to the console.
The second application uses function clutter_stage_set_xwindow_foreign
to use the same X window for both applications. However, I don't get
this working. The second application gives the following error:
-----
X Error of failed request: BadAccess (attempt to access private
resource denied)
  Major opcode of failed request: 2 (X_ChangeWindowAttributes)
  Serial number of failed request: 33
  Current serial number in output stream: 37
-----

This error occurs in function clutter_stage_set_xwindow_foreign and
there in clutter-stage.c line 506:
-----
      glXMakeCurrent(clutter_xdisplay(), priv->xwin, priv->gl_context);
-----
I'm using Clutter version 0.2.2.

According to the GLX documentation [1] a BadAccess error occurs with
glXMakeContextCurrent if the context is current to some other thread.
AFAIK the windows and not the contexts are shared here (not completely
sure about this).

I have experimented by changing Clutter to use indirect rendering but it
did not help. I did this by changing the last argument in function call
in clutter-stage.c lines 495 - 498 from True to False:
-----
      priv->gl_context = glXCreateContext (clutter_xdisplay(),
                       priv->xvisinfo,
                       0,
                       False);
-----

So this problem occurs when OpenGL is used on the same X window by two
different processes. What is the correct way to use function
clutter_stage_set_xwindow_foreign?

References:

[1] http://www.opengl.org/documentation/specs/glx/glx1.4.pdf

-- 
Tommi Höynälänmaa
sähköposti / e-mail: tommi.hoynalanmaa@iki.fi
kotisivu / homepage: http://www.iki.fi/tohoyn/
-- 
To unsubscribe send a mail to clutter+unsubscribe@o-hand.com
Received on Thu, 12 Apr 2007 11:22:54 +0300

This archive was generated by hypermail 2.1.8 : Mon Apr 30 2007 - 08:01:16 EDT