[vbox-dev] Clutter mutiple stage problem in vbox

Tian, Jun J jun.j.tian at intel.com
Tue Feb 23 19:17:16 PST 2010

There is a problem when running multiple clutter programs in vbox with OpenGL. This is a simple testing case:

#include <clutter/clutter.h>
#include <stdlib.h>

int main(int argc, char **argv)
    ClutterActor *stage1;
    ClutterActor *stage2;
    ClutterActor *stage3;

    clutter_init (&argc, &argv); // Create a default stage here

    stage1 = clutter_stage_get_default (); // Get the default stage
    clutter_stage_set_title(CLUTTER_STAGE(stage1), "Clutter test stage1");

    stage2 = clutter_stage_new (); // Create a new stage
    clutter_stage_set_title(CLUTTER_STAGE(stage2), "Clutter test stage2");

    stage3 = clutter_stage_new ();
    clutter_stage_set_title(CLUTTER_STAGE(stage3), "Clutter test stage3");

    clutter_actor_show_all (stage1);
    clutter_actor_show_all (stage2);
    clutter_actor_show_all (stage3);


Compile clutter program:
gcc -Wall -g example.c -o example `pkg-config clutter-1.0 --cflags  --libs`

If we use only one default stage in the clutter program, it works fine. But if create a new stage,
the program will assert fail like this:

if (window->spuWindow == -1){
     window->spuWindow = stub.spu->dispatch_table.WindowCreate( window->dpyName, context->visBits );
     context->pOwnWindow = window;
OpenGL Error: Assertion failed: !context->pOwnWindow, file /home/tianjun/Intel/emulation/vbox/VirtualBox-3.1.2_OSE/src/VBox/Additions/common/crOpenGL/context.c, line 910

According to the source code of GL implementaion in virtualbox. It seems that each GL context only including one drawable(which represented by WindowInfo in vbox) and can process only one WindowInfo by Chromium SPU. But clutter program with multiple stage have two GL drawable(each stage is a drawable) binding to a single GL context. It means rebinding context to another window and causes assert fail in MakeCurrent. However, I have tried to process one stage by SPU and other stages by native, but it makes segment fault in vbox. 

Whether vbox can process multiple GL drawable in one GL context? 

More information about the vbox-dev mailing list