Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
79 user(s) are online (64 user(s) are browsing Forums)

Members: 0
Guests: 79

more...

Support us!

Headlines

 
  Register To Post  

« 1 ... 40 41 42 (43) 44 45 46 ... 74 »
Re: SDL2
Home away from home
Home away from home


See User information
@Capehill

I checked the "Texture" output (that one introduced for SDL2 only on DOSBox patch I use for SDL2), and yes, autoscaling works. So probably that it by logic.

But they're definitely something wrong. I experience a big slowdown, random lockups, and all that stuff if I just use "texture" output. It can be of course and SDL2 code related to the "SCREEN_TEXTURE" case in the DosBOX's code itself, but it somehow .. somehow like the same slowdown when used with "OpenGL" output...

Maybe you can notice something very wrong in SCREEN_TEXTURE ifdef there: http://kas1e.mikendezign.com/aos4/dosbox/sdlmain.cpp ?

It just like earth and sky in comparison with "software" output, which is fast and good. But once I use "texture", it's the same slow as I use "OpenGL", and the same freezes often. And does not matter if I use "compositing" or "software" renderer.


EDIT: yeah strange things happen. If I just set: output=surface in DOSBox, then when I run it all works fine and stable.

But, once I set output "texture", and "render" be "compositing", or "software" - does not matter, then bad things start happens. Like often freezes and slowness.

But what difference between using software output (which uses compositing renderer automatically in sdl2, right? or not?), and texture output with renderer set to compositing and/or software?

I mean isn't it the same when output=surface and when output=texture + render=software? Or like when output=surface and output=texture+compositing? Just when only "texture" is involved, everything start to be bad. But seeing code of DOSBox in case SCREEN_TEXTURE it surely different in compare with plain case SCREEN_SURFACE.

Sadly that with Texture it only freezes on me most of time without any crashlog, so cant' even see where/what.


EDIT2: I found that to have the same speed as with "output=surface" but with "output=texture" and "renderer=compositing" is to hit few times "enter" in dosbox window, then make window be inactive, and then again active, and speed back.

And it freezes really randomly. But only when "texture" is used. Probably something weird in the DOSBox's SDL2 code in terms of SCREEN_TEXTURE handling, maybe it didn't free resources as need it, and for each run trash memory..


Edited by kas1e on 2020/2/12 6:56:58
Edited by kas1e on 2020/2/12 7:00:16
Edited by kas1e on 2020/2/12 7:01:45
Edited by kas1e on 2020/2/12 8:55:16
Edited by kas1e on 2020/2/12 8:57:31
Edited by kas1e on 2020/2/12 9:02:36
Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: SDL2
Just can't stay away
Just can't stay away


See User information
@kas1e

Just to clarify that by freeze you mean a total system lockup? Does it happen with window, fullscreen or both?

DB calls SDL_LockTexture in one function and SDL_UnlockTexture in another and draws in-between those. If DB happens to log something (printf) something between Lock/Unlock calls then it would explain the freeze, _except_ not in SW mode where the texture bitmap is UserPrivate and doesn't require locking so it doesn't seem to be that cause.

DB seems to use some kind of clipping calculations. If there is some issue, it might write outside the bitmap and potentially over some system structures.

Go to top
Re: SDL2
Home away from home
Home away from home


See User information
@Capehill
Quote:

Just to clarify that by freeze you mean a total system lockup?


Yes, no crash, nothing on serial about problems, just usual debug output.

Quote:

Does it happen with window, fullscreen or both?


It may happen at any time anywhere. Usually, it happens when I just start to do something. Pure running almost never freezes, but it can when I do some alt+enter switches, another time it will survive 20 alt+enters, and then still works, and lockup later.

Should to add that old DOSBox (sdl1 version) lockup on me quite often too, while others say that it works for them fine, need to investigate wtf.


Edited by kas1e on 2020/2/13 12:06:30
Edited by kas1e on 2020/2/13 12:07:40
Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: SDL2
Home away from home
Home away from home


See User information
@Capehill
Omg, i was able to install on fresh partition public x5000 iso, and then tried step by step to find out why old SDL1 version of dosbox fail on me now (this time i check SDL1, as freezes there happens right away, just once i run anything with even pure surface usage).

So, firstly checked with all default libs: all fine. It works. Then, i just replaced sobjs:libsdl_1.2.so from x5000 iso, on latest one from repo : bah! freezes starts!

Then, i got one from os4depot (so one which i didn't build myself, and which is in "release" mode) => same freeze.

I revert back then to original from x5000 iso (it is 1.2.13 1.4 (19.08.2012) : no freezes.

And those freezes looks exactly like ones i have with SDL2 build, when use "texture" output. It can be that some code shared between both SDLs which can cause that (maybe usage of new graphics.library functions or something..). Because as i see with SDL1 freezes , it happens or when something should start draws on screen, or when something stop draws on screen (like running some bench graphic tool (rare), or exit from(almost always) ).

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: SDL2
Home away from home
Home away from home


See User information
@Capehill
To track down issues, I made 2 versions of DOSBox for SDL1 and SDL2 to works over shared versions (so you can test it too with any libs or debug added) packed it up nicely (so you need nothing to install/change/etc, just unpack and run).

So, there SDL1 version (that one not my build, but 10 years old Corto's one, without jit, so not be surprised it will be a little slow):

http://kas1e.mikendezign.com/aos4/dos ... l_freezes/dosbox_sdl1.lha

And there is SDL2 version I build now, so with jit and stuff, and also use a shared version of SDL2:

http://kas1e.mikendezign.com/aos4/dos ... l_freezes/dosbox_sdl2.lha

All you need it's unpack those 2 archives to 2 different directories, then go inside of any of them you want to test, then type "DOSBox", and once it runs in DOSBox's window type "cd PCPBench" and then "PCPBench.exe"

Now, with the SDL1 version and our last SOBJ you will freeze 5-10% of times when you run a benchmark, and 70-80% of times when you will hit any key to exit from (with the original version from x5000 iso you will not have those freezes).

With the SDL2 version, I set up everything that goes through "Texture", so it will use "compositing" renderer, and it the same as with SDL1: you will freezes on Benchmark, or once you start it, or once you exit from. Or, sometime you will be able run/exit few times before freeze. Sometime you even will be able to do some alt+enter before freeze. But at least on my x5000 config, it's easier to reproduce that with the SDL1 version. Also if roots of freezes are the same, then with SDL1 version it can be easy to
debug maybe.

Interestingly that I have absolutely nothing on serial, not with SDL1, not with SDL2. I mean no crash log, nothing, just some usual debug output before it dies (and it always different too). Like for SDL2 version when I tried to run benchmark and freezes:

[OS4_CreateRenderer] Creating renderer for 'DOSBox SVN, CPU speed: 3000 cycles, Frameskip 0, Program: DOSBOX' (flags 0x2)
[OS4_CreateRenderer] VSYNC: off
[SDL_CreateMutex] Created mutex 0x6FFA9600
[OS4_ActivateRenderer] Allocating VRAM bitmap 1024*768*32 for renderer


Or for SDL1 version, when I able to run it, but once hit "ESC" to exit:

[os4video_CheckPointerInWindow] Pointer outside of window
[os4video_CheckPointerInWindow] Pointer outside of window
[os4video_CheckPointerInWindow] Pointer outside of window
[os4video_CheckPointerInWindow] Pointer inside window
[os4video_HandleEnterLeaveWindow] Pointer entered window


But probably, it all happens on the allocation/deallocation of video memory. Through can't be sure at the moment.

And, as I say, the same issue happens and on the latest beta, and on a public version of x5000 iso, just with swapped libSDL1 in SOBJs:

Once I use the old version of libSDL.so, I have no freezes in that test does not matter how hard I try. But it all can be because of the different sizes of .so, memory placing, etc, so need to confirm that you can reproduce it too.

SDL1 version freezes even with pure "surface", while SDL2 version freezes only when we use "texture". Maybe for SDL2 the surface part was fixed somehow in the process... Or maybe it 2 independent issues...

PS. I also expirience the same kind of "silent freeze" for some SDL2/Ogles2 game, so maybe it's all related. I just hope on your side you will have actual crashes. Maybe also those silent freezes I have in Diablo also can be related?

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: SDL2
Just can't stay away
Just can't stay away


See User information
@kas1e

Tested SDL2 build. As suspected earlier, it freezes after bitmap locking. So DosBox never unlocks bitmap. Something wrong happens between locking and unlocking the texture.

Lock was gained successfully, I added some debug into SDL2 to prove that.

On my serial:

Quote:

[OS4_UnlockTexture] Called
[OS4_LockTexture] Called text 0x647E86F0, rect 0x66F7F4A8, pix 0x66F7F4EC, pitch 0x66F7F4E8
[OS4_LockTexture] x 0, y 0, w 640, h 400
[OS4_LockTexture] pitch 2560, pixels 0x815E3100
[OS4_UnlockTexture] Called
[OS4_LockTexture] Called text 0x647E86F0, rect 0x66F7D368, pix 0x66F7D3AC, pitch 0x66F7D3A8
[OS4_LockTexture] x 0, y 0, w 640, h 400
[OS4_LockTexture] pitch 2560, pixels 0x815E3100
[OS4_UnlockTexture] Called
[OS4_LockTexture] Called text 0x647E86F0, rect 0x66F7D368, pix 0x66F7D3AC, pitch 0x66F7D3A8
[OS4_LockTexture] x 0, y 0, w 640, h 400
[OS4_LockTexture] pitch 2560, pixels 0x815E3100


You need to start adding serial debug to DB to see where the freeze happens exactly.

EDIT: did some more debugging:

Quote:

[OS4_LockTexture] Called text 0x635746F0, rect 0x67588368, pix 0x675883AC, pitch 0x675883A8
[OS4_LockTexture] x 0, y 0, w 640, h 400
[OS4_LockTexture] pitch 2816, pixels 0x8135B004
[OS4_PumpEvents] Here
[OS4_PumpEvents] Here
[OS4_PumpEvents] Here
[OS4_UnlockTexture] Called
[OS4_PumpEvents] Here
[OS4_PumpEvents] Here
[OS4_PumpEvents] Here
[OS4_PumpEvents] Here
[OS4_PumpEvents] Here
[OS4_LockTexture] Called text 0x635746F0, rect 0x67588368, pix 0x675883AC, pitch 0x675883A8
[OS4_LockTexture] x 0, y 0, w 640, h 400
[OS4_LockTexture] pitch 2816, pixels 0x8135B004
[OS4_PumpEvents] Here
[OS4_PumpEvents] Here
[OS4_PumpEvents] Here
[OS4_PumpEvents] Here
[OS4_PumpEvents] Here
[OS4_PumpEvents] Here


DB goes handling user events while holding the (texture) bitmap lock! Not good.

I think you can place some serial prints for these return statements:

Quote:

bool GFX_StartUpdate(Bit8u * & pixels,Bitu & pitch) {
#if SDL_VERSION_ATLEAST(2,0,0)
if (!sdl.update_display_contents)
return false;
#endif
if (!sdl.active || sdl.updating)
return false;


and

Quote:


void GFX_EndUpdate( const Bit16u *changedLines ) {
#if C_DDRAW
int ret;
#endif
#if SDL_VERSION_ATLEAST(2,0,0)
if (!sdl.update_display_contents)
return;
#endif
if (!sdl.updating)
return;
sdl.updating=false;


It might be that bitmap stays locked due to return in GFX_EndUpdate, or maybe DB main loop is written that way.


Edited by Capehill on 2020/2/13 16:50:19
Go to top
Re: SDL2
Home away from home
Home away from home


See User information
@Capehill
Added like this:

bool GFX_StartUpdate(Bit8u * & pixels,Bitu pitch) {
#if SDL_VERSION_ATLEAST(2,0,0)
    
if (!sdl.update_display_contents) {
        
dprintf("GFX_StartUpdate: if (!sdl.update_display_contents)\n");
        
IDOS->Delay(5);
        return 
false;
    }
#endif
    
if (!sdl.active || sdl.updating) {        
        
dprintf("GFX_StartUpdate: if (!sdl.active || sdl.updating) {\n");
        
IDOS->Delay(5);
        return 
false;
    }


And like this:

void GFX_EndUpdate( const Bit16u *changedLines ) {
#if C_DDRAW
    
int ret;
#endif
#if SDL_VERSION_ATLEAST(2,0,0)
    
if (!sdl.update_display_contents) {
        
dprintf("GFX_EndUpdate: if (!sdl.update_display_contents)\n");
        
IDOS->Delay(5);
        return;
    }
#endif
    
if (!sdl.updating) {
        
dprintf("GFX_EndUpdate: if (!sdl.updating)\n");
        
IDOS->Delay(5);
        return;
    }
    
sdl.updating=false;


And nothing have in output about when i crashes. I.e. that what i have when i run it :

[_OS4_INITIExec 0x021B28D4
[SDL_CreateMutexCreated mutex 0x6FFA9480
[OS4_InitThreadSubSystemMain task 0x6646D1A0
[OS4_InitThreadSubSystemChildren mutex 0x6FFA94A0waiters mutex 0x6FFA94C0
[OS4_OpenLibraryOpening 'dos.library' version 50 succeeded (address 0x6FEFE948)
[
OS4_GetInterfaceGetting interface for libbase 0x6FEFE948 succeeded (address 0x6F8E1740)
[
OS4_InitThreadSubSystemdosBase 0x6FEFE948iDos 0x6F8E1740
[OS4_InitTimerSubSystemCalled
[OS4_InitTimerSubSystemITimer 0x6FF9E400
[OS4_InitTimerSubSystemTimer frequency 24937500 Hz
[OS4_TimerCreateCreating timer 0x63201410 for task 0x6646D1A0
[SDL_CreateMutexCreated mutex 0x6FFA94E0
[SDL_CreateMutexCreated mutex 0x6FFA9500
[OS4_InitThreadSubSystemAlready initialized
[OS4_CreateDevice] *** SDL 2.0.11 video initialization starts ***
[
OS4_CreateDeviceBuild date12.2.2020
[OS4_AllocSystemResourcesCalled
[OS4_OpenLibrariesOpening libraries
[OS4_OpenLibraryOpening 'graphics.library' version 54 succeeded (address 0x6FFA3420)
[
OS4_OpenLibraryOpening 'layers.library' version 53 succeeded (address 0x6FFFE4F0)
[
OS4_OpenLibraryOpening 'intuition.library' version 51 succeeded (address 0x6FF5D4D0)
[
OS4_OpenLibraryOpening 'icon.library' version 51 succeeded (address 0x689700CC)
[
OS4_OpenLibraryOpening 'workbench.library' version 51 succeeded (address 0x6FF0F80C)
[
OS4_OpenLibraryOpening 'keymap.library' version 51 succeeded (address 0x6FF777A0)
[
OS4_OpenLibraryOpening 'textclip.library' version 51 succeeded (address 0x67B64CDC)
[
OS4_OpenLibraryOpening 'dos.library' version 51 succeeded (address 0x6FEFE948)
[
OS4_GetInterfaceGetting interface for libbase 0x6FFA3420 succeeded (address 0x6FFFF800)
[
OS4_GetInterfaceGetting interface for libbase 0x6FFFE4F0 succeeded (address 0x6FF51140)
[
OS4_GetInterfaceGetting interface for libbase 0x6FF5D4D0 succeeded (address 0x6FF08000)
[
OS4_GetInterfaceGetting interface for libbase 0x689700CC succeeded (address 0x689E7110)
[
OS4_GetInterfaceGetting interface for libbase 0x6FF0F80C succeeded (address 0x689E7A70)
[
OS4_GetInterfaceGetting interface for libbase 0x6FF777A0 succeeded (address 0x6FF9F3C0)
[
OS4_GetInterfaceGetting interface for libbase 0x67B64CDC succeeded (address 0x67DF98B0)
[
OS4_GetInterfaceGetting interface for libbase 0x6FEFE948 succeeded (address 0x6F8E1740)
[
OS4_OpenLibrariesAll library interfaces OK
[OS4_FindApplicationNameGetCliProgramName'dosbox'
[OS4_FindApplicationNameApplication name'dosbox'
[OS4_GetInterfaceGetting interface for libbase 0x6FF779EC succeeded (address 0x6FF8B9B0)
[
OS4_VideoInitCalled
[OS4_InitModesCalled
[OS4_LockPubScreenLocking public screen
[OS4_LockPubScreen] Public screen 0x67E67388 locked
[OS4_GetDisplayModeRTG mode 1342509824w=1920h=1080bits=24
[OS4_CreateDefaultCursor0x614D59F0
[OS4_CreateHiddenCursorCalled
[OS4_CreateCursorSurface 0x614D5A18cursor 0x614D5AF8hot_x 0hot_y 0
[OS4_CopyImageDataCopying cursor data 1*1 from surface 0x614D5A18 to buffer 0x614D5B20
[OS4_GetDoubleClickTimeInMillisDoubleclick time 1500 ms
[OS4_OpenAhiDeviceahi.device opened
[OS4_OpenAhiDeviceIO requests created
[OS4_OpenAhiDevicedeviceOpen 1
[OS4_CloseAhiDeviceClosing device
[OS4_CloseAhiDeviceFreeing I/O requests
[OS4_CloseAhiDeviceDeleting message port
[OS4_CloseAhiDeviceDevice closed
[OS4_AudioAvailableAHI is available
[SDL_CreateMutexCreated mutex 0x6FFA9520
[OS4_InitThreadSubSystemAlready initialized
[SDL_CreateMutexCreated mutex 0x6FFA9540
[OS4_InitThreadSubSystemAlready initialized
[AMIGAINPUT_OpenLibraryCalled
[OS4_OpenLibraryOpening 'AmigaInput.library' version 51 succeeded (address 0x64B1A4F8)
[
OS4_GetInterfaceGetting interface for libbase 0x64B1A4F8 succeeded (address 0x64941340)
[
AMIGAINPUT_EnumerateJoysticksENUMJOYid=1663045524type=1axes=2buttons=3
[AMIGAINPUT_EnumerateJoysticksENUMJOYid=1663045524type=3axes=0buttons=4
[AMIGAINPUT_EnumerateJoysticksJoystick 'PCI_GamePort' (AI ID=3328has no axes/buttons ignoring.
[
AMIGAINPUT_EnumerateJoysticksENUMJOYid=1663045524type=3axes=0buttons=8
[AMIGAINPUT_EnumerateJoysticksJoystick 'PCI_HornetGP' (AI ID=7936has no axes/buttons ignoring.
[
AMIGAINPUT_EnumerateJoysticksENUMJOYid=1663045524type=3axes=0buttons=4
[AMIGAINPUT_EnumerateJoysticksJoystick 'PCI_sblive' (AI ID=3840has no axes/buttons ignoring.
[
AMIGAINPUT_JoystickInitEnumDevices returned 0
[AMIGAINPUT_JoystickInitFound 0 joysticks
[OS4_GetIDCMPFlagsCalled
[OS4_GetWindowFlagsCalled
[OS4_GetScreenForWindowWindow mode (public screen)
[
OS4_CenterWindowX centered
[OS4_CenterWindowY centered
[OS4_CreateSystemWindowOpening window '(null)' at (640,340of size (640x400on screen 0x67E67388
[OS4_CreateSystemWindowWindow address 0x6F8766E8
[OS4_SetupWindowData'(null)' dimensions 640*400
[OS4_CreateIconifyGadgetCalled
[OS4_CreateIconifyGadgetImage 0x6F876AE4 for gadget created
[OS4_CreateIconifyGadgetGadget 0x6F876C54 created and added
[OS4_ShowWindowShowing window ''
[OS4_RefreshCursorStateMouse shown 1
[OS4_CreateWindowFramebufferNative format 6SDL format 372645892 (SDL_PIXELFORMAT_ARGB8888)
[
OS4_CreateWindowFramebufferAllocating 640*400*32 bitmap)
[
SDL_CreateMutexCreated mutex 0x6FFA9560
[OS4_OpenDevicehandle 0x00000000devname (null), iscapture 0
[OS4_OpenDevice] New format 0x9010
[OS4_OpenDeviceBuffer size 4096
[SDL_CreateSemaphoreCreated semaphore 0x60BF9660 with count 0
[SDL_SYS_CreateThreadNode 0x6493B080
[SDL_SYS_CreateThreadCreated new thread 'SDLAudioP2' (task 0x614AA0C0args 0x60BF9648)
[
OS4_RunThreadThis task 0x614AA0C0node 0x6493B080args 0x60BF9648
[OS4_TimerCreateCreating timer 0x6493B094 for task 0x614AA0C0
[SDL_SemPostSignalling task 0x6646D1A0 for semaphore 0x60BF9660
[SDL_SemPostSemaphore 0x60BF9660 value 1
[SDL_SYS_SetThreadPriorityChanged task 0x614AA0C0 priority from 0 to 10
[OS4_ThreadInitCalled
[OS4_OpenAhiDeviceahi.device opened
[OS4_OpenAhiDeviceIO requests created
[OS4_OpenAhiDevicedeviceOpen 1
[SDL_SemWaitTimeoutSemaphore 0x60BF9660 got signal 0x8000
[SDL_DestroySemaphoreDestroying semaphore 0x60BF9660
[OS4_InitThreadSubSystemAlready initialized
[SDL_CreateMutexCreated mutex 0x6FFA9580
[SDL_CreateMutexCreated mutex 0x6FFA95A0
[void GFX_EndUpdate(const Bit16u*)] GFX_EndUpdate: if (!sdl.updating)
[
OS4_HideWindowIgnore hide requestwindow 'DOSBox SVN, CPU speed:     3000 cycles, Frameskip  0, Program:   DOSBOX' is destroying
[OS4_SetWindowGrabPrivateWindow 0x6F8766E8 ('DOSBox SVN, CPU speed:     3000 cycles, Frameskip  0, Program:   DOSBOX'input was released
[OS4_DestroyWindowFramebufferFreeing bitmap 0x64956B98
[OS4_DestroyWindowCalled for 'DOSBox SVN, CPU speed:     3000 cycles, Frameskip  0, Program:   DOSBOX' (flags 0x8)
[
OS4_RemoveAppWindowRemoving AppWindow
[OS4_CloseSystemWindowClosing window 'DOSBox SVN, CPU speed:     3000 cycles, Frameskip  0, Program:   DOSBOX' (address 0x6F8766E8)
[
OS4_CloseScreen] Public screennot closing
[OS4_CloseWindowDisposing gadget 0x6F876C54
[OS4_CloseWindowDisposing gadget image 0x6F876AE4
[OS4_GetIDCMPFlagsCalled
[OS4_GetWindowFlagsCalled
[OS4_GetScreenForWindowWindow mode (public screen)
[
OS4_CenterWindowX centered
[OS4_CenterWindowY centered
[OS4_CreateSystemWindowOpening window '(null)' at (448,156of size (1024x768on screen 0x67E67388
[OS4_CreateSystemWindowWindow address 0x6F8766E8
[OS4_SetupWindowData'(null)' dimensions 1024*768
[OS4_CreateIconifyGadgetCalled
[OS4_CreateIconifyGadgetImage 0x6F876AE4 for gadget created
[OS4_CreateIconifyGadgetGadget 0x6F876C54 created and added
[OS4_ShowWindowShowing window ''
[OS4_RefreshCursorStateMouse shown 1
[OS4_CreateRendererCreating renderer for 'DOSBox SVN, CPU speed:     3000 cycles, Frameskip  0, Program:   DOSBOX' (flags 0x2)
[
OS4_CreateRendererVSYNCoff
[SDL_CreateMutexCreated mutex 0x6FFA95C0
[OS4_ActivateRendererAllocating VRAM bitmap 1024*768*32 for renderer
[OS4_WindowEventCalled with event 10
[OS4_WindowEventCalled with event 11


I only see there one time "[void GFX_EndUpdate(const Bit16u*)] GFX_EndUpdate: if (!sdl.updating)", and it happens when i run dosbox and do nothing.

Then, while i can operate in it, nothing new on serial. Then i run pcpbench, and crashes , and serial didn't bring me anything new :(

Also it interesting, why SDL1 version didn't freezes like this before, but start freezes with latest versions of SDL1.. But that one probabaly for later while didn't get wtf with SDL2 build..


EDIT: was lucky enough to not crash from first run, and then can see in log, that when i run bench and it didn't crashes, it show me "[void GFX_EndUpdate(const Bit16u*)] GFX_EndUpdate: if (!sdl.updating)". But i never have returns from startupdate() in those !checks.

Will try to put debugs everywhere in those 2 functions.


EDIT2: put printfs everywhere didn't help much, i.e:

#if SDL_VERSION_ATLEAST(2,0,0)
    
case SCREEN_TEXTURE:
    {
        
void texPixels;
        
int texPitch;

        
dprintf("before SDL_LockTexture\n");

        if (
SDL_LockTexture(sdl.texture.textureNULL, &texPixels, &texPitch) < 0) {
            
dprintf("we in case SCREEN_TEXTURE, if (SDL_LockTexture(sdl.texture.texture, NULL, &texPixels, &texPitch) < 0)\n");
            
IDOS->Delay(0);
            return 
false;
        }
        
        
dprintf("after SDL_LockTexture\n");
        
        
pixels = (Bit8u *)texPixels;
        
        
dprintf("after pixels = (Bit8u *)texPixels;\n");
        
        
pitch texPitch;
        
        
dprintf("after pitch = texPitch;\n");
        
        
sdl.updating=true;
        return 
true;
    }
#else    // !SDL_VERSION_ATLEAST(2,0,0)


And

#if SDL_VERSION_ATLEAST(2,0,0)
    
case SCREEN_TEXTURE:

        
dprintf("before SDL_UnlockTexture()\n");
    
        
SDL_UnlockTexture(sdl.texture.texture);

        
dprintf("after SDL_UnlockTexture()\n");

        
SDL_RenderClear(sdl.renderer);

        
dprintf("after SDL_RenderClear();\n");

        
SDL_RenderCopy(sdl.renderersdl.texture.textureNULL, &sdl.clip);

        
dprintf("after SDL_RenderCopy();\n");

        
SDL_RenderPresent(sdl.renderer);

        
dprintf("after SDL_RenderPresent()\n");


        break;
#else    // !SDL_VERSION_ATLEAST(2,0,0)


Show me on freeze that on serial:

Quote:

[void GFX_EndUpdate(const Bit16u*)] before SDL_UnlockTexture()
[void GFX_EndUpdate(const Bit16u*)] after SDL_UnlockTexture()
[void GFX_EndUpdate(const Bit16u*)] after SDL_RenderClear();
[void GFX_EndUpdate(const Bit16u*)] after SDL_RenderCopy();
[void GFX_EndUpdate(const Bit16u*)] after SDL_RenderPresent()
[bool GFX_StartUpdate(Bit8u*&, Bitu&)] before SDL_LockTexture
[bool GFX_StartUpdate(Bit8u*&, Bitu&)] after SDL_LockTexture
[bool GFX_StartUpdate(Bit8u*&, Bitu&)] after pixels = (Bit8u *)texPixels;
[bool GFX_StartUpdate(Bit8u*&, Bitu&)] after pitch = texPitch;
[void GFX_EndUpdate(const Bit16u*)] before SDL_UnlockTexture()
[void GFX_EndUpdate(const Bit16u*)] after SDL_UnlockTexture()
[void GFX_EndUpdate(const Bit16u*)] after SDL_RenderClear();
[void GFX_EndUpdate(const Bit16u*)] after SDL_RenderCopy();
[void GFX_EndUpdate(const Bit16u*)] after SDL_RenderPresent()
[bool GFX_StartUpdate(Bit8u*&, Bitu&)] before SDL_LockTexture
[bool GFX_StartUpdate(Bit8u*&, Bitu&)] after SDL_LockTexture
[bool GFX_StartUpdate(Bit8u*&, Bitu&)] after pixels = (Bit8u *)texPixels;
[bool GFX_StartUpdate(Bit8u*&, Bitu&)] after pitch = texPitch;


Like, it do return true; after locking texture, and die somewhere after, but before unlocking part. Maybe it SDL_LockTexture() itself, just die a bit later.


Edited by kas1e on 2020/2/13 21:31:49
Edited by kas1e on 2020/2/13 21:37:28
Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: SDL2
Home away from home
Home away from home


See User information
@Capehill
Maybe will be easer to debug SDL1 version, so where it freezes only with usage of pure surface ? That pure SDL1 version:

https://sourceforge.net/p/dosbox/code- ... trunk/src/gui/sdlmain.cpp

I in meantime may try for example build version-by-version since working one to find commit when things start to be bad and maybe it will point us on some direction with sdl2 version too ?

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: SDL2
Just can't stay away
Just can't stay away


See User information
@kas1e

DosBox tries to set window title while holding the bitmap lock. That's the reason for dead-lock. Try putting debug prints before/after:

https://github.com/dreamer/dosbox-stag ... /src/gui/sdlmain.cpp#L345

Workaround possibilities:

1) SDL1: never use HWSURFACE, this avoids locking them and eventually deadlock.

2) SDL2: let DB use a surface, and just before rendering the frame upload it to texture. In other words, remove using of Lock/Unlock texture.

3) Common: if setting the window title is the only cause for deadlock, then it would be possible postpone it so that title will be updated after DB has unlocked the bitmap. Store the string, set some flag, and if flag set, then update when it's safe.

SDL1 didn't support HWSURFACE in window mode until March 13th 2018. That's the likely reason it works with older SDL1 because SWSURFACEs don't require locking.

Go to top
Re: SDL2
Home away from home
Home away from home


See User information
@Capehill
Commenting out "SDL_SetWindowTitle(sdl.window,title);" in GFX_SetTitle() show that freezes gone in SDL2 version when "texture" output is used. Yeah!

Question is: is it bug in DOSBox then? Or it is specific to our OS and how it handle HW surfaces? I mean, why our OS is the first one that catches issues because of calling that after locking? Should it be reported to DOSBox authors, so they can fix it?

I didn't check SDL1 version at moment, but probably that it as well.


Next things i want to understand, is : are the environment SDL_RENDER_DRIVER have higher priority that SDL_Hint from code?

What i mean, is that if i do set SDL_RENDER_DRIVER to opengles2, then option to set renderer from dosbox didn't works, and "opengles2" still used as set in environment.


Edited by kas1e on 2020/2/14 15:27:03
Edited by kas1e on 2020/2/14 15:28:32
Edited by kas1e on 2020/2/14 15:29:16
Edited by kas1e on 2020/2/14 15:38:53
Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: SDL2
Just can't stay away
Just can't stay away


See User information
@kas1e

I don't know enough about DosBox regarding what is normal and intended. It's possibly not a bug to change window title and "AmigaOS rules" are "AmigaOS rules".

But I find it odd that when DB promises to start updating texture by locking it, then afterwards it calls at least SDL_GetTicks, SDL_PollEvent and SDL_SetWindowTitle. GetTicks and PollEvent could have something todo with emulation parts but SetWindowTitle clearly doesn't.

You can ask DB team is behaviour OK. If it is, then fine, we can work around it many ways.

Regarding env vs. hints: https://github.com/AmigaPorts/SDL/blob/master/src/SDL_hints.c#L113

https://wiki.libsdl.org/SDL_SetHint

ENV overrides hints.

Go to top
Re: SDL2
Home away from home
Home away from home


See User information
@Capehill
Aha ok, will ask them.

Now, probabaly last issue is white screen when used opengl. In the archive i upload for sdl2 version, you may change in dosbox.conf:

output=texture
renderer=opengl

Then run dosbox and will see all white. But everything still works (so you still can close it, through that fix about removing context not here, so will bring you that watchog_timeout), but while all works all white, etc.

renderer=opengles2 works fine in that terms, just all blue as you know (was it issue in warp3dnova or in ogles2 ?).

with renderer=opengl all white not only when i use minigl, but also if i build my own sdl2 with replaced minigl on gl4es. So its something about opengl code in whole.


EDIT: damn, it freezes even with disable SetWindow_Tittle() :( Just not in pcpbench, and much rare, but still.

EDIT2: Also what worry me, is that i have the same deadlock-freezes with latest Diablo compiled for SDL2 too.


Edited by kas1e on 2020/2/14 19:28:40
Edited by kas1e on 2020/2/14 20:32:24
Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: SDL2
Home away from home
Home away from home


See User information
@capehill
On of devs says that yep, work between lock/unlock should be minimized, but he also says that maybe even better to not use lock/unlock texture, but use SDL_updatetexture() and give that link: https://forums.libsdl.org/viewtopic.php?t=9728

But then, I do not know if on our side updatetexture() will not do internal locking, as in the case with SDL1 and HW_SURFACE.

EDIT: found for example this:
https://gist.github.com/CoryBloyd/6725bb78323bb1157ff8d4175d42d789

While SDL_SetWindowTitle there surely out of main lock/unlock, SDL_GetTicks surely between them. And probably "Events" too.


Edited by kas1e on 2020/2/15 8:07:47
Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: SDL2
Just can't stay away
Just can't stay away


See User information
@kas1e

Quote:

EDIT: damn, it freezes even with disable SetWindow_Tittle() :( Just not in pcpbench, and much rare, but still.


Tough luck. It means DB does something else that causes deadlock like calls printf randomly while holding the lock.

EDIT: one thing I forgot that at least the staging repo calls SDL_SetWindowTitle from multiple places. Worth checking.

EDIT2: or it could have something todo with window re-creation during fullscreen toggle.

It would be simplest and safest to start use SDL_UpdateTexture so we don't need to do more debugging.

Quote:

EDIT2: Also what worry me, is that i have the same deadlock-freezes with latest Diablo compiled for SDL2 too.


Devilution doesn't lock texture as far as I can see. It's something different.


Edited by Capehill on 2020/2/15 9:12:39
Go to top
Re: SDL2
Just can't stay away
Just can't stay away


See User information
@kas1e

Quote:

I do not know if on our side updatetexture() will not do internal locking, as in the case with SDL1 and HW_SURFACE.


Of course graphics.library shall lock the bitmap internally but the point is that DB cannot do random things _during_ SDL_UpdateTexture is called. So there cannot be deadlock.

Go to top
Re: SDL2
Home away from home
Home away from home


See User information
@Capehill
In meantime do some more debugging (while is not clear if they will rewrite it now to SDL_UpdateTexture way), so far commented out all SDL_SetWindowTitle() calls as well as all calls to function which call that call :) and deadlock still here.

Its even not necessary to switch to fullscreen. It just deadlocks even in window, just now more rare.


Also interesting is why SDL1 version deadlocks on new sdl1 almost right after you run dosbox, but SDL2, when using pure surface are not. But for pure surface SDL2 also use SurfaceLock as SDL1 , and it probabaly the same HW_SURFACE?. Or for SDL2 there is no SW/HW surface anymore, and if one use surface in SDL2 it mean "SW" surface ? If so that can explain why SDL2 version with pure surface didnt' deadlocks

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: SDL2
Just can't stay away
Just can't stay away


See User information
@kas1e

Quote:

while is not clear if they will rewrite it now to SDL_UpdateTexture way


We don't have to wait for them.

1) Create SDL_Surface similar (width, height, format) to SDL_Texture
2) Remove SDL_LockTexture, give DB pixels and pitch to the surface
3) Remove SDL_UnlockTexture, call SDL_UpdateTexture instead of
4) When SDL_Texture is destroyed, remember to destroy SDL_Surface too




Go to top
Re: SDL2
Home away from home
Home away from home


See User information
@Capehill
Not sure if i do it right:

Declared at top SDL_Surface *surface_test;

Then :

#if SDL_VERSION_ATLEAST(2,0,0)
    
case SCREEN_TEXTURE:
    {
        
void texPixels;
        
int texPitch;

        
//if (SDL_LockTexture(sdl.texture.texture, NULL, &texPixels, &texPitch) < 0)
        //    return false;
        //pixels = (Bit8u *)texPixels;
        //pitch = texPitch;

        
        
surface_test SDL_CreateRGBSurface(0sdl.draw.widthsdl.draw.height320000);
        
pixels=(Bit8u *)surface_test->pixels;
        
pitch surface_test->pitch;


        
sdl.updating=true;
        return 
true;
    }
#else    // !SDL_VERSION_ATLEAST(2,0,0)


And

#if SDL_VERSION_ATLEAST(2,0,0)
    
case SCREEN_TEXTURE:

        
//SDL_UnlockTexture(sdl.texture.texture);
    
        
SDL_UpdateTexture(sdl.texture.textureNULL /* update whole texture */surface_test->pixelssdl.draw.width 4);
        
        
//SDL_RenderClear(sdl.renderer);
        
SDL_RenderCopy(sdl.renderersdl.texture.textureNULL, &sdl.clip);
        
SDL_RenderPresent(sdl.renderer);
        break;
#else    // !SDL_VERSION_ATLEAST(2,0,0)


So it runs (didn't crashes at least), but each frame ends in black color. I.e. i can see how frames shown, then ends with black color. Then if i hit enter, i again can see it, but then end with black color.

I through was able to run pcpbench, and it also renders fine, but offten black areas shows there and there.

But i surely do something wrong :)

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: SDL2
Just can't stay away
Just can't stay away


See User information
@kas1e

Create SDL_Surface in function where SDL_Texture was created.

For "pitch" parameter in SDL_UpdateTexture you should use the pitch got from the surface.

Go to top
Re: SDL2
Home away from home
Home away from home


See User information
@Capehill
Yeah, that one works:

at top: SDL_Surface *surface_test;

then:

/* SDL_PIXELFORMAT_ARGB8888 is possible with most
        rendering drivers, "opengles" being a notable exception */
        
sdl.texture.texture SDL_CreateTexture(sdl.rendererSDL_PIXELFORMAT_ARGB8888,
                                                
SDL_TEXTUREACCESS_STREAMINGwidthheight);

#ifdef __amigaos4__
        
surface_test SDL_CreateRGBSurface(0widthheight320000);
#endif

        /* SDL_PIXELFORMAT_ABGR8888 (not RGB) is the
        only supported format for the "opengles" driver */
        
if (!sdl.texture.texture) {
            if (
flags GFX_RGBONLY) goto dosurface;
            
sdl.texture.texture SDL_CreateTexture(sdl.rendererSDL_PIXELFORMAT_ABGR8888,
                                                    
SDL_TEXTUREACCESS_STREAMINGwidthheight);
        }


And :

#if SDL_VERSION_ATLEAST(2,0,0)
    
case SCREEN_TEXTURE:
    {
        
void texPixels;
        
int texPitch;

        
//if (SDL_LockTexture(sdl.texture.texture, NULL, &texPixels, &texPitch) < 0)
        //    return false;
        //pixels = (Bit8u *)texPixels;
        //pitch = texPitch;
        
        
pixels=(Bit8u *)surface_test->pixels;
        
pitch surface_test->pitch;

        
sdl.updating=true;
        return 
true;
    }


And:

#if SDL_VERSION_ATLEAST(2,0,0)
    
case SCREEN_TEXTURE:

        
//SDL_UnlockTexture(sdl.texture.texture);
    
        
SDL_UpdateTexture(sdl.texture.textureNULL /* update whole texture */surface_test->pixelssurface_test->pitch);        
        
SDL_RenderClear(sdl.renderer);
        
SDL_RenderCopy(sdl.renderersdl.texture.textureNULL, &sdl.clip);
        
SDL_RenderPresent(sdl.renderer);
        break;
#else    // !SDL_VERSION_ATLEAST(2,0,0)



Now all renders fine.

Speed (at least in PCPBench) surely not slower.

Will try to reproduce deadlocks now.

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top

  Register To Post
« 1 ... 40 41 42 (43) 44 45 46 ... 74 »

 




Currently Active Users Viewing This Thread: 1 ( 0 members and 1 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2024 The XOOPS Project