Author Topic: Compiling a PM sample with GCC (2023)  (Read 6656 times)

Lars

  • Hero Member
  • *****
  • Posts: 1121
  • Karma: +57/-0
    • View Profile
Re: Compiling a PM sample with GCC (2023)
« Reply #150 on: June 05, 2023, 02:21:48 pm »
Try "DosSleep(1)" instead of "DosSleep(0)" in the drawing thread. That should already slow down things considerably.
DosSleep(0) will only yield the CPU if there is another thread of same or higher prio in the ready state (ready and waiting to be doing work).
DosSleep(1) will yield the CPU if there is another thread of any prio in the ready state. Since you typically have a bunch of daemons etc. running in the background that also schedule threads of idle (very low) prio, that should always trigger a yield.
And yielding means to give away your time slice and it takes the OS ages (in computer terms) to regain a time slice/next chance to execute the thread.
Might still not be enough on a multi-core system (where you have multiple CPUs that could do work ...).

Dave Yeo

  • Hero Member
  • *****
  • Posts: 4343
  • Karma: +84/-1
    • View Profile
Re: Compiling a PM sample with GCC (2023)
« Reply #151 on: June 05, 2023, 04:26:42 pm »
Yes, changing the DosSleep() to one at line 339 fixes the speed, about 33 frames/sec and can see the airplane on this 4 core I5.

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4176
  • Karma: +39/-1
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Compiling a PM sample with GCC (2023)
« Reply #152 on: June 05, 2023, 05:18:12 pm »
Thanks for the feedback

Dave, I have DIVE.DLL on the libpath. I had tried in two enviroments, the development VM and a Thinkpad L420 and in both I can not see any image on the window.

I'm attaching the "Query Caps" of the Thinkpad L420. should I can try putting the colors on 64K?
Update: Indeed, I changed it to 64K and now I can see the image (very fast)

I will check Lars' suggestion to see if it slows down.

Regards
« Last Edit: June 05, 2023, 05:22:18 pm by Martin Iturbide »
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4176
  • Karma: +39/-1
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Compiling a PM sample with GCC (2023)
« Reply #153 on: June 05, 2023, 11:02:59 pm »
Hello

Thanks for the feedback. The show sample (Jet) is working fine.
https://github.com/OS2World/DEV-SAMPLES-C-PM-DIVE-ShowJet

My only question remains, why it does not work on 16M Colors? Is some limitation there that I don't know? I always used to set the colors to 16M and didn't have any problems that I can notice, until working with this sample.

Regards
« Last Edit: June 06, 2023, 12:01:55 am by Martin Iturbide »
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Dave Yeo

  • Hero Member
  • *****
  • Posts: 4343
  • Karma: +84/-1
    • View Profile
Re: Compiling a PM sample with GCC (2023)
« Reply #154 on: June 06, 2023, 02:30:12 am »
Tested here with 16m colours, same results as you except one of the options, Dive Blitter I think it was, froze the system and after 10-15 seconds crashed,
Code: [Select]
06-05-2023  16:08:07  SYS3175  PID 0065  TID 0003  Slot 0080
H:\TMP\SHOW_DIVE_B1\SHOW.EXE
c0000005
1fe22505
P1=00000001  P2=00000000  P3=XXXXXXXX  P4=XXXXXXXX
EAX=02a83880  EBX=00000000  ECX=00000140  EDX=00000500
ESI=00000000  EDI=02a83880
DS=0053  DSACC=d0f3  DSLIM=9fffffff
ES=0053  ESACC=d0f3  ESLIM=9fffffff
FS=150b  FSACC=00f3  FSLIM=00000030
GS=0000  GSACC=****  GSLIM=********
CS:EIP=005b:1fe22505  CSACC=d0df  CSLIM=9fffffff
SS:ESP=0053:03271f20  SSACC=d0f3  SSLIM=9fffffff
EBP=03271ff4  FLG=00010202

LIBCN0.DLL 0001:00082505

Perhaps Lars has an idea.

Flashback

  • Newbie
  • *
  • Posts: 3
  • Karma: +1/-1
    • View Profile
Re: Compiling a PM sample with GCC (2023)
« Reply #155 on: June 06, 2023, 06:38:20 pm »
My only question remains, why it does not work on 16M Colors?
Because support for 32bits per pixel is not fully implemented in DIVE. You may want to try the attached patch...