freemint / fvdi

fVDI fork with additional fixes and drivers.
https://fvdi.sourceforge.io
7 stars 6 forks source link

mouse artifacts with bitplane.sys driver #1

Closed mfro0 closed 3 years ago

mfro0 commented 4 years ago

There are (apparently random) mouse artifacts when moving AES windows or browsing through menus

vinriviere commented 4 years ago

I suspect a race condition between the mouse interrupt and main VDI code. But absolutely no clue.

th-otto commented 4 years ago

I can reproduce that too, using Hatari, and the bitplane driver with 16 colors. I'm not entire sure whether that is only mouse related, as there sometimes seem to be some other random garbage:

Screenshot_20200516_130738

Also it seems to be an old bug, happens both with the old and new versions.

th-otto commented 4 years ago

There is denfinitely something strange going on there. Attached is an animated gif, where i switch in gemini from the console to a file window, and back. Look at the prompt in the console window... Peek 2020-05-17 19-32

vinriviere commented 4 years ago

Idea of animated GIF for bug reports is really brilliant 👍

mfro0 commented 4 years ago

these artifacts are also observeable on the FireBee, but a lot less prominent. You really need to make an effort to create them (just browsing through a menu is definitely not enough most of the time).

fVDI appears to disable interrupts when calling functions with "special stack". https://github.com/freemint/fvdi/blob/cfb8c689a943d7977fd5f86335b5003c17a4dbf0/fvdi/include/macros.gnu#L87 Depending on how long these functions run, it might well be the cause for all kinds of strangeness.

(and yes, animated gifs are nice ;) )

Hmmm, no. This macro does not seem to be used anywhere.

vinriviere commented 4 years ago

My Amiga drivers (UAEGFX and SAGA) based on the 16-bit driver also exhibit mouse artifacts, occasionally. I suspect a race condition between the mouse interrupt and the main code (to be proved).

th-otto commented 4 years ago

The saga driver has gotten a new flag for accelerated mouse drawing. That should use the hardware mouse capabilities of the card, maybe that works better.

th-otto commented 4 years ago

Some findings so far:

The other pixel garbage from text output seem to be unrelated to this, and maybe cause by other bugs in the text drawing functions.

vinriviere commented 4 years ago

Note that, when working on my drivers derived from Falcon 16-bit, I noticed that there was no mouse support for 16-bit modes. I guess that oldmouse was useful in that case (on Falcon). In other words, use fVDI implementation on Falcon for anything except the mouse. As a result, I needed to invent new fVDI mouse routines for 16-bit modes, when the underlying TOS has no support for those modes.

th-otto commented 4 years ago

I needed to invent new fVDI mouse routines for 16-bit modes, when the underlying TOS has no >support for those modes.

But these were only used for the uaegfx/saga drivers. In the meantime however, similar routines have also been implemented for the generic 16_bit driver. So if i'm not wrong, all supported drivers have now "accelerated" versions. That means, you still have the choice to turn them off for a particular driver using the accelerated option, which should have the same effect and call the TOS functions.

vinriviere commented 4 years ago

There are actually 3 possible implementations for mouse :

th-otto commented 4 years ago

For hardware sprites, there is already an additional flag hwmouse for the saga driver (the only one that supports it currently).

th-otto commented 4 years ago

Some more findings (maybe not related to the bugs, but still strange):

th-otto commented 4 years ago

I can usually rather quickly produce some artifacts with Hatari, when moving the mouse from one menu title to another: Screenshot_20200613_141653 Strangely, i cannot reproduce the same using StonX.

mfro0 commented 4 years ago

I don't think that's specific to Hatari, I can (although a lot more difficult) reproduce the problem on the FireBee as well.

th-otto commented 4 years ago

While further looking at the code, i'm currently in the mood of rewriting that whole stuff about mouse management. There are so many variables and states currently, that it is difficult to maintain. Amongst others, that are:

There are some other srange things that need to investigated. Eg. when opening a (physical) workstation, VEX_CURV and VEX_TIMV are hooked, but VEX_MOTV and VEX_BUTV aren't, these are redirected to TOS instead.

mfro0 commented 3 years ago

I'm not sure, but bitplane.sys mouse artifacts didn't happen anymore for me in recent tests?

@th-otto : did you change anything related to this, did they vanish "magically" or is it just my flaky testing?

th-otto commented 3 years ago

On Mittwoch, 6. Januar 2021 08:39:10 CET Markus wrote:

I'm not sure, but bitplane.sys mouse artifacts didn't happen anymore for me in recent tests?

@th-otto : did you change anything related to this, did they vanish "magically" or is it just my flaky testing?

Yes, i changed this to redraw the mouse during the VBL interrupt, instead using a custom timer, just like TOS and EmuTOS does. It now also honors the corresponding flags in the line-A variables. That whole thing made those artifacts disappear. The commit is https://github.com/freemint/fvdi/commit/ c36b7169d921f9607d6425b40ec59e3c1c24b2ee

mfro0 commented 3 years ago

Ah, thank you, great! Then I didn't just dream it ;)

I'd suggest we could close this issue now?

mfro0 commented 3 years ago

closed with c36b716