Revision history for ioForceDisplayUpdate
Additions:
See iPhone
For the CALayer version we have to make a memory copy of the Display because the multi-core aspect of os-x machines and the lazy use of memory for CGImages showed the actual draw could happen some time after the ioForceDisplayUpdate finished, which allowed the VM to redraw the image resulting in tearing.
For the CALayer version we have to make a memory copy of the Display because the multi-core aspect of os-x machines and the lazy use of memory for CGImages showed the actual draw could happen some time after the ioForceDisplayUpdate finished, which allowed the VM to redraw the image resulting in tearing.
Additions:
Choose between the CALayer implementation, or the open/GL implementation.
The Open/GL logic on os-x is quite different than on the iPhone, but the general objective is the same. Upload a texture and do the glFlush() at
the right point. This results in a solution that is about 3x faster than the CALayer code.
(a) CALayer the displayioShowDisplay marks which CALayer tile is dirty. We now run thru the matrix of tiles looking for dirty ones, when found we create a CGImage from the interpreterProxy->displayObject() using the tile information to indicate which subsection of the Display needs drawing. Then we assign the CGImage to the CALayer tile. This causes the CALayer tile to be redrawn. So calling ioForceDisplayUpdate might cause the drawing of zero to all 16 tiles depending on how much of the view was altered from the last ioForceDisplayUpdate.
We run a squeakUIFlushPrimaryDeferNMilliseconds of a second NSTimer to see if the time now - lastFlushTime is > squeakUIFlushPrimaryDeferNMilliseconds, if so we trigger a ioForceDisplayUpdate via ioProcessEvents() This ensures Morphic code that fails to call ioForceDisplayUpdate will have the bits shown in a timely manner.
(b)
The Open/GL logic on os-x is quite different than on the iPhone, but the general objective is the same. Upload a texture and do the glFlush() at
the right point. This results in a solution that is about 3x faster than the CALayer code.
(a) CALayer the displayioShowDisplay marks which CALayer tile is dirty. We now run thru the matrix of tiles looking for dirty ones, when found we create a CGImage from the interpreterProxy->displayObject() using the tile information to indicate which subsection of the Display needs drawing. Then we assign the CGImage to the CALayer tile. This causes the CALayer tile to be redrawn. So calling ioForceDisplayUpdate might cause the drawing of zero to all 16 tiles depending on how much of the view was altered from the last ioForceDisplayUpdate.
We run a squeakUIFlushPrimaryDeferNMilliseconds of a second NSTimer to see if the time now - lastFlushTime is > squeakUIFlushPrimaryDeferNMilliseconds, if so we trigger a ioForceDisplayUpdate via ioProcessEvents() This ensures Morphic code that fails to call ioForceDisplayUpdate will have the bits shown in a timely manner.
(b)
Deletions:
The iPhone logic takes the queued screen updates and bundles them as a unioned update for the drawing cycle.