Virtualized 3D

More investigation of 3D virtualization

Tao3D ran all night

While Tao3D seems to be a bit unstable when I do things like clicking in menus or resizing the window, it seems otherwise stable. It ran overnight with a small simple animation, and still only uses 38MB (by comparison, gnome-software takes 108MB).

FPS is at 180 FPS for my animation:

1486715893.850;1;179.000;0;2;0;5;0;5;0;0;0;1
1486715894.852;1;177.000;0;3;0;5;0;6;0;0;0;1
1486715895.853;1;182.200;0;3;0;4;0;6;0;0;0;1
1486715896.855;1;184.200;0;3;0;4;0;6;0;0;0;1
1486715897.864;1;187.600;0;3;0;5;0;6;0;0;0;1
1486715898.865;1;183.200;0;3;0;5;0;6;0;0;0;1
1486715899.865;1;195.400;0;2;0;5;0;4;0;0;0;1
1486715900.874;1;192.200;0;2;0;6;0;5;0;0;0;1
1486715901.886;1;185.600;0;2;0;6;0;5;0;0;0;0
1486715902.888;1;185.200;0;2;0;7;0;5;0;0;0;4
1486715903.892;1;183.200;0;3;0;7;0;5;0;0;0;4
1486715904.892;1;175.000;0;3;0;7;0;5;0;0;0;4
1486715905.893;1;181.000;0;4;0;7;0;5;0;0;0;4
1486715906.896;1;182.200;0;4;0;7;0;5;0;0;0;4

This is interesting, because in that specific configuration, glxgears seems to top at 60 FPS:

Running synchronized to the vertical refresh.  The framerate should be
approximately the same as the monitor refresh rate.
300 frames in 5.0 seconds = 59.975 FPS
300 frames in 5.0 seconds = 59.820 FPS
299 frames in 5.0 seconds = 59.794 FPS
300 frames in 5.0 seconds = 59.801 FPS
300 frames in 5.0 seconds = 59.997 FPS
301 frames in 5.0 seconds = 60.005 FPS

(This was not the case with my last experiment where I had 1500FPS).

I verified that on the Tao3D code, I have “Enable VSync” set. So in theory, we should sync with vertical refresh.

Totally unscientific benchmark

Out of curiosity, I ran the same little test both inside the VM and 0utside of it. The test document is this:

import BrightRectanglesTheme
theme "BrightRectangles"
picture_slide "Hello world",
    light 0 
    light_position 100, 100, 100 
    light_diffuse "pink" 
    light 1 
    light_position -100, 100, 100 
    light_diffuse "cyan" 

    color "yellow" 
    sphere 100, 100, -300, 50 

    color "white" 
    rotate_y 70 * sin time 
    rotate_x 30 * cos ctime 
    ctime -> 0.3 * time 
    text_box 0, 0, 1200, 800, 
        align 50%
        vertical_align 50%
        extrude_depth 50 
        font "Arial", 120 
        text "Tao3D Hello"

The document creates two lights 100 pixels in front of the screen, one on the left, one on the right, a sphere 300 pixels behind the screen, and a text box with some extruded text that moves. In Tao3D coordinates are in X, Y, Z order, with X positive towards the right of the screen, Y positive towards the top of the screen, Z positive pointing out of the screen, and (0, 0, 0) in the center of the screen.

Below is what it looks like. It’s not designed to be pretty. Rather, it pushes a medium number of polygons (5857 edges as reported by Tao3D’s -tpolycount option) with basic illumination and shading. Nothing really fancy.Screen Shot 2017-02-10 at 15.00.18.png

The interesting is that, taking advantage of the fact that vertical sync is not working, I get practically the same performance native and virtualized. So this is rather good:

fps-comparison

There were clearly flukes either way in the measurement. But overall, during the “stable” period, the numbers look similar. One thing I noticed, though, is that there seems to be a slow decrease over time in virtualized numbers. I need to confirm that. I’ve seen it go as low as 40 FPS by waiting a long time.

Another surprising effect is that the non-3D elements don’t have the same appearance virtualized and non-virtualized. There are some issues with transparency. Part of the menu shows as transparent in the virtualized case, but not in the native case. And the initial dialog boxes do not look exactly the same. Finally, in the native case, the window initial size used by Tao for drawing the widget seems wrong, but it goes away as soon as you resize the window (looks like a resize event that we get out of order).

Native case, before resizing: Notice the transparent window content, and the Tao3D picture shown in the upper left corner, very small. The update dialog has a bland white box.

Screen Shot 2017-02-10 at 15.07.31.pngNative case, after resizing: After forcing a full-screen resize and back, the screen looks like what it should:Screen Shot 2017-02-10 at 15.08.25.png

Virtualized case, with or without resizing: In this case, I have a transparent menu (???) and the dialog box looks redesigned (this does not look like some random accident, but rather some design change):

Screen Shot 2017-02-10 at 15.09.37.png

The appearance change is not a result of a change in the Qt version (5.7-1-1 in both cases). Most likely a result of me having installed tons of weird GUI packages on the host.

Bugs

Beyond reporting a bug, should I work on trackpad behavior?

Advertisements

Author: Christophe de Dinechin

I try to change the world, but that's work in progress. If you want to know me, google "Christophe de Dinechin". Keywords: concept programming, virtualization, OS design, programming languages, video games, 3D, modern physics. Some stuff I did that I'm proud of: the first "true" 3D game for the PC, HP's big iron virtualization, real-time test systems for car electronics, some of the best games for the HP48 calculator, a theory of physics that makes sense (at least to me).

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s