gnash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnash] plugin update


From: Michael Carlson
Subject: Re: [Gnash] plugin update
Date: Fri, 10 Feb 2006 22:45:10 +0800

On 2/10/06, Nicolas Cannasse <address@hidden> wrote:
> The problem with OpenGL is that it doesn't support multithreading. You
> need then to use some kind of system-wide lock when doing OGL
> operations.

The way you say this, you make it sound like multithreaded behavior in
OpenGL is undefined and unsupported. I don't believe this is true -
the behavior is well-defined, and supported. Multiple threads can
render in OpenGL simultaneously, but each one needs to use a different
rendering context (and thus render to a different window / target).
That's fine - we can just have one thread per flash file we need to
play, each with their own rendering context for the appropriate window
they're rendering to.

For multithreading in OpenGL, you call glxmakecurrent() (or an
appropriate call in the windows API) to set the rendering context for
the current thread. You can call it again from that same thread to
have the thread instead render to another context (which replaces the
current context), but you cannot attach two threads to the same
rendering context at the same time.

Because you can only have one opengl context per thread, it's a bad
idea to use the same thread as firefox, because you might have more
than one instance of your plugin opened, or some other reason
firefox's main thread is attached to a rendering context (another
plugin?). Opening a new thread per instance and using one rendering
context per thread should work without problems. You probably don't
want all your flash loading / rendering / etc. running in the same
thread as firefox anyways, for speed reasons.

> changing the PixelFormat for OpenGL (using SetPixelFormat, on Windows)
> was making a small but perceptive lag that was degrading user experience.

I don't know about this, but I can't imagine there is any reason we
would need to change the pixelformat, unless we someday provide the
user an option to set it manually (perhaps for color bit-depth
reasons?). We can initialize it to whatever we want, and keep it that
way for the entire time the flash file is being rendered.

The plugin is still being worked on, and obviously we don't have a
working plugin yet, so perhaps I'm not in the best position to speak
about all of this so confidently :) However, I see no good reason that
we can't make a multi-threaded, stable plugin using OpenGL.

- Mike




reply via email to

[Prev in Thread] Current Thread [Next in Thread]