Mouse,keyborad event handling collide with rendering #146

iqtao opened this Issue Nov 3, 2011 · 4 comments


None yet
3 participants

iqtao commented Nov 3, 2011

Although events generated by System::Tick are handled while the rendering thread is suspended, the MouseEvent, KeyboardEvent, and Net IO events handling can run parallelly with rendering thread, resulting in inaccordence with adobe flash player.


mgehre commented Nov 4, 2011

Especially, this means that DisplayObjects can change in the middle of rendering, which lead to noticable flicker and artifacts.
It also requires us to use a lot of locking between Render thread and VM thread.


alexp-sssup commented May 22, 2012

Actually DisplayObjects cannot change in the middle of rendering. The flickering comes from a different porblem. DisplayObjects are rendered from their CachedSurface which represent the OpenGL texture memory where it has been uploaded the last time. Since only the render thread itself can upload new data to the textures is pretty clear that the rendered state is not influenced by VM actions


mgehre commented May 22, 2012

But Display objects can change while they are written to the CachedSurface. Especially the display hierarchy can change while it is written to their CachedSurfaces.


alexp-sssup commented May 27, 2012

The cached surfaces are generated from a snapshot of the data taken from each invalidated object after the event being handled is completed. So the state is consistent. (This is actually not true for Bitmaps, since the BitmapData contents are not copied. I plan to fix this using a copy on write strategy). Still you are right that the display hierarchy can change and this is a bug. I think it's better to implement a sane COW strategy than completely synchronizing the render thread with the VM thread. Anyway I definitely think the flickering we can see is not caused by changes in the display list hierarchy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment