Unlikely (but not impossible) that there's memory corruption in the module. There are no kmalloc() calls, for example, everything's statically allocated.
The SDL crash happens without the c64 kernel module loaded, too (wrote a very simple test app. to verify that).
Guess I'll have to get the sources from GIT and see for myself then. For now I am opening /dev/fb0 in addition to SDL (without omapdss) so I can use vsync. I can probably get access to the scaler that way, too ?!
I think I tried at least one of the dma_sync_single*() functions (sry did not mention that, it is commented out in the CMEM module, guess they found issues with it, too).
And hey, after seeing the heavy ARM CPU usage even when it was just waiting for the DSP, I just sat down and implemented support for select/poll
(was not that hard after all and I learnt something new).
So, CPU usage is now down to ~5-8% (from ~50% in my last release with the usleep() calls, changed that to pthread_yield() in the meantime but still saw ~25% usage). The only disadvantage is that the synthetic RPC benchmark is now ~5 times slower but if I really wanted I could still get back the original speed by polling read()s. The fastcall RPCs are still fast (no surprise here).
I also went back to the CMA config, of course. The graphics test is now running for ~10 minutes and I'll leave it on for a while and get some food (and beer, for later
).
Before I forget: I tried setting the DSS GFX_BA0/1 registers directly (and I used the right register, could see that after SDL_SetVideoMode() the content changed). For some reason that did not really work. The register contained the right address but the DISPC did not read it at the next frame start (edit: during one test run it did but I do not know why it fails most of the time). Well, the proper solution would be to add a Pandora-specific IOCTL to the FB driver that allows to do such things. The ioctl could then also check if the address is in the CMA area.
And another thing: I was a bit puzzled to see that SDL apps require root privileges. That should not be necessary. Fixing the permission of the /dev/fb* devices would probably do the trick (that's at least better than allowing each app. root access to everything. I would not want an app. to kill my filesystem because of a programming mistake (I am not even talking about bad intent here, I hope no Pandora dev would even think about that
).
EDIT: about your suggestion in regards to the DSP directly rendering into the regular FB memory: I did that a few years back. It works. I did not know that userspace apps can query the physical address of the FB, though. Back then (2008) I wrote a "magic" byte sequence into the FB, then searched the entire memory for that sequence to find the physical address (ugly hack, eh? it was just testcode, anyway).
EDIT#2: My original intention today was to disable all interrupts while the cacheflush is running. I am suspecting that the function is not re-entrant -- maybe some IRQ handler calls it, too. That could explain why the invalidate() crashes are so random. Notaz, do you by any chance know the easiest way to disable/enable all interrupts in Linux ? (remember, I'm a kernel newbie)