Previous 2.6 on Debian - Black window

Started by wizard, September 16, 2022, 02:46:06 AM

Previous topic - Next topic

wizard

Was able to build Previous 2.6 on my Debian 11 machine. Window comes up, but it is just blank, nothing in the window. Any hints on what I could be missing?

andreas_g

These issues are always difficult to debug without a machine with the same OS. Unfortunately all I have is my Mac. Maybe someone with programming skills can try to fix the problem on an appropriate machine. The problem is most likely related to window and renderer initialization (SDL2) in fast_screen.c (Screen_Init() and repainter()).

wizard

Quote from: andreas_g on September 16, 2022, 02:56:02 AMThese issues are always difficult to debug without a machine with the same OS. Unfortunately all I have is my Mac. Maybe someone with programming skills can try to fix the problem on an appropriate machine. The problem is most likely related to window and renderer initialization (SDL2) in fast_screen.c (Screen_Init() and repainter()).



Ok, I'll dig into it later this evening. I had seen some people were saying they had built it sucessfully on Debian so I thought perhaps I was missing something. Then again, they said it compiled, not that it actually worked :-)

I can hear the emulator starting up. I think it is running its just that something is not right with the rendering. When you resize the window smaller you get repaints (in black) and then if you scale back to a larger size you stop getting repaints entirely.

pomosapien

I built the softfloat branch two days ago on a Pi 4 and I was getting good rendering.

@wizard how do you obtain the source code? I do

svn co https://svn.code.sf.net/p/previous/code/branches/branch_softfloat

pomosapien

Oops, softfloat r1170 will not build, same problem as I had on macOS (see other thread).
So, I built trunk r1156, that's fine.

@wizard when you run `Previous` from a terminal it prints messages, what do you get? Also, which desktop environment eg GNOME?

wizard

Quote from: pomosapien on September 17, 2022, 06:37:19 AMI built the softfloat branch two days ago on a Pi 4 and I was getting good rendering.

@wizard how do you obtain the source code? I do

svn co https://svn.code.sf.net/p/previous/code/branches/branch_softfloat

svn checkout https://svn.code.sf.net/p/previous/code/trunk previous-code


wizard

Quote from: pomosapien on September 17, 2022, 07:50:52 AM@wizard when you run `Previous` from a terminal it prints messages, what do you get? Also, which desktop environment eg GNOME?

I am running gnome, X windows server with latest Nvidia drivers

The terminal window starts with this:
SDL screen request: 1120 x 856 (windowed)
Init680x0() called
68040 MMU: TC=0000 enabled=0 page8k=0 PC=00000000
CPU cycleunit: 256 (0.500)
1872 CPU functions


I think the emulator is running, probably at the window for the menu. If I randomly press buttons, I here a beep and the loggin continues in the emulator. It's just the screen is black.

andreas_g

I read somewhere that the SDL renderer is not thread safe on all platforms, especially when using OpenGL. What happens if you replace the line
sdlRenderer = SDL_CreateRenderer(sdlWindow, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);with
sdlRenderer = SDL_CreateRenderer(sdlWindow, -1, SDL_RENDERER_SOFTWARE | SDL_RENDERER_PRESENTVSYNC);in fast_screen.c?

wizard

Quote from: andreas_g on September 22, 2022, 12:08:03 AMI read somewhere that the SDL renderer is not thread safe on all platforms, especially when using OpenGL. What happens if you replace the line
sdlRenderer = SDL_CreateRenderer(sdlWindow, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);with
sdlRenderer = SDL_CreateRenderer(sdlWindow, -1, SDL_RENDERER_SOFTWARE | SDL_RENDERER_PRESENTVSYNC);in fast_screen.c?

Window stays black, but now when you resize it crashes.
This is what the terminal says:
SDL screen request: 1120 x 856 (windowed)
Init680x0() called
68040 MMU: TC=0000 enabled=0 page8k=0 PC=00000000
CPU cycleunit: 256 (0.500)
1872 CPU functions
Previous: malloc.c:2379: sysmalloc: Assertion `(old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) == 0)' failed.




andreas_g

The crash is probably a bug in SDL or some routine of the OS. I'm afraid I have no idea why the screen is still black. As the emulator seems to run in the background it is most likely related to the screen drawing routine of SDL2/Linux.

Rob Blessin Black Hole

Does the resolution need to match NeXT hardwares odd Fixed Resolution 1120 by 832 at 92 DPI ?  As this may be the original NeXT Colorstation Chipset software driver  https://www.nextcomputers.org/NeXTfiles/Docs/Hardware/nextstation_color.pdf  It also appears to be the same 1120 by 832 at 92 dpi with NeXT Monostations which are 2 bit grey scale , Simon may know for sure. :)
Rob Blessin President computerpowwow ebay  [email protected] http://www.blackholeinc.com
303-741-9998 Serving the NeXT Community  since 2/9/93

andreas_g

@Rob Blessin Black Hole
Yes, Black hardware did only support 1120 by 832 pixels. Therefore this resolution is hardcoded in the OS. There is no way to change it on black hardware.

@wizard
Is the issue with the black window still open?

wizard

Quote from: andreas_g on October 24, 2022, 12:17:33 AM@wizard
Is the issue with the black window still open?

Yeah, just did a svn checkout https://svn.code.sf.net/p/previous/code/trunk previous-code
built fine.  I launched Previous from a terminal and it seems to start up and stop. But you get a black screen. If you hit control-c or attempt to close the window, the emulator seems to progress further with logging text and your hear the NeXT "beep" sound. It seems like the emulator is running but you have a black screen. CPU is being hit pretty hard too. This is on Debian with NVIDIA drivers. I have some other apps that run SDL 2.0 fine on this system.


andreas_g

Okay, this might be a multi-threading issue. It seems some platforms do not support to run the renderer in a secondary thread. The problem is, that running it on the main thread steals lots of performance from the emulation itself. Swapping main and secondary thread is not easy either. I have to think about a proper solution. Can you send me an e-mail so I can reply with a patch to confirm my theory? Or just PM me your e-mail address.

ramalhais

Quote from: andreas_g on October 31, 2022, 08:04:26 AMOkay, this might be a multi-threading issue. It seems some platforms do not support to run the renderer in a secondary thread. The problem is, that running it on the main thread steals lots of performance from the emulation itself. Swapping main and secondary thread is not easy either. I have to think about a proper solution. Can you send me an e-mail so I can reply with a patch to confirm my theory? Or just PM me your e-mail address.

I started having similar issues like, black screen, ctrl+c on console makes the emulator progress but still black screen, or even the window not displaying, but present on the taskbar.

This may be related to wayland, as i can use Previous successfuly by running:
env - DISPLAY=:0 ./Previous

Maybe SDL is trying to render using wayland instead of X11, and there may be some incompatibility.

BTW, the trunk and branch_softfloat trigger some weird issue in my attempt at a linux port, where the emulation hangs immediately after linux boots and shows the prompt (the cursor should be blinking, but it freezes), without any message in the console. This is probably something that needs to be fixed on the linux side, but it doesn't hang so easily on branch_filesharing.

Hope this helps.