[Vm-dev] [OpenSmalltalk/opensmalltalk-vm] macOS --metal backwards compatibility regarding primitives 126, 127, 231 (Issue #627)

Marcel Taeumel notifications at github.com
Thu Apr 28 08:10:37 UTC 2022


As of https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/2d7105db755928fd90823d264fc64e17b1c57ad4, there can be flickering or invisible Morphic dragging if no image-side composition buffer is used.

In Squeak, that composition buffer is either already used or can be activated for older images by hand via:

```Smalltalk
PasteUpMorph disableDeferredUpdates: true.
Project allMorphicProjects do: [:ea | ea world canvas: nil].
```

Also see:
- http://lists.squeakfoundation.org/pipermail/vm-dev/2022-April/037907.html
- http://lists.squeakfoundation.org/pipermail/vm-dev/2022-April/037888.html
- http://lists.squeakfoundation.org/pipermail/vm-dev/2022-April/037891.html
- http://lists.squeakfoundation.org/pipermail/vm-dev/2022-April/037897.html

For the macOS `--metal` backend, one might actually implement that extra video buffer here:
https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/2d7105db755928fd90823d264fc64e17b1c57ad4/platforms/iOS/vm/OSX/sqSqueakOSXMetalView.m#L229

And then read from that buffer and **not** the `displayBits` here:
https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/2d7105db755928fd90823d264fc64e17b1c57ad4/platforms/iOS/vm/OSX/sqSqueakOSXMetalView.m#L271

...but **only if** the `deferDisplayUpdates` flag is `false` again.

**NOTE THAT** the old approach to always commit content from `displayBits` to the graphics backend entailed a *serious performance regression*  as it slows down the interpreter loop to a maximum of 60 FPS, regardless of other stuff waiting in the image side. That is, primitives 127 and 231 were awfully slow and blocking on macOS. At least that got better in https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/2d7105db755928fd90823d264fc64e17b1c57ad4

-------------

Another, more flexible, approach would be to fix **primitive 126** to actually *fail* if a certain graphics backend does not support deferred updates. This might work if platform-specific code would be able to let that primitive fail. See:
- `StackInterpreterPrimitives >> primitiveDeferDisplayUpdates` in VMMaker

This would work for recent versions of Cuis. However, the existing code in older Squeak images did not correctly invalidate the canvas and thus was not even able to flip between image-side and vm-side composition buffer for different results of primitive 126. Thus, such a fix would also only work from here on for future versions of Squeak and Cuis.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/627
You are receiving this because you are subscribed to this thread.

Message ID: <OpenSmalltalk/opensmalltalk-vm/issues/627 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20220428/0b0f84d4/attachment.html>


More information about the Vm-dev mailing list