Commit 7df9769f authored by Dan Ellis's avatar Dan Ellis
Browse files

Added pollidle handling for INKEY (OS_Byte 129)

Detail:
  Taskwindow sits of BYTEV and waits for n*2 Vsyncs when INKEY(n) is called.
This isn't quite correct as VSyncs aren't a reliable timing source, however,
leaving that aside for the moment, what Taskwindow was doing was sitting on
Null events until it read that enough Vsyncs had passed, thus eating up CPU
time.

  The new behaviour is to call Wimp_PollIdle instead, which should also
correct the amount of time waited for.  This behaviour can be toggled with
the build switch PollIdleHandling.

Admin:
  Lightly tested on a RPC.  Using AppStat, no call were made to the
taskwindow during and INKEY, whereas they were previously.


Version 0.66. Tagged as 'TaskWindow-0_66'
parent b09c7ea0
......@@ -11,14 +11,14 @@
GBLS Module_HelpVersion
GBLS Module_ComponentName
GBLS Module_ComponentPath
Module_MajorVersion SETS "0.65"
Module_Version SETA 65
Module_MajorVersion SETS "0.66"
Module_Version SETA 66
Module_MinorVersion SETS ""
Module_Date SETS "15 May 2001"
Module_ApplicationDate2 SETS "15-May-01"
Module_ApplicationDate4 SETS "15-May-2001"
Module_Date SETS "30 Jul 2001"
Module_ApplicationDate2 SETS "30-Jul-01"
Module_ApplicationDate4 SETS "30-Jul-2001"
Module_ComponentName SETS "TaskWindow"
Module_ComponentPath SETS "RiscOS/Sources/Desktop/TaskWindow"
Module_FullVersion SETS "0.65"
Module_HelpVersion SETS "0.65 (15 May 2001)"
Module_FullVersion SETS "0.66"
Module_HelpVersion SETS "0.66 (30 Jul 2001)"
END
/* (0.65)
/* (0.66)
*
* This file is automatically maintained by srccommit, do not edit manually.
*
*/
#define Module_MajorVersion_CMHG 0.65
#define Module_MajorVersion_CMHG 0.66
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 15 May 2001
#define Module_Date_CMHG 30 Jul 2001
#define Module_MajorVersion "0.65"
#define Module_Version 65
#define Module_MajorVersion "0.66"
#define Module_Version 66
#define Module_MinorVersion ""
#define Module_Date "15 May 2001"
#define Module_Date "30 Jul 2001"
#define Module_ApplicationDate2 "15-May-01"
#define Module_ApplicationDate4 "15-May-2001"
#define Module_ApplicationDate2 "30-Jul-01"
#define Module_ApplicationDate4 "30-Jul-2001"
#define Module_ComponentName "TaskWindow"
#define Module_ComponentPath "RiscOS/Sources/Desktop/TaskWindow"
#define Module_FullVersion "0.65"
#define Module_HelpVersion "0.65 (15 May 2001)"
#define Module_FullVersion "0.66"
#define Module_HelpVersion "0.66 (30 Jul 2001)"
......@@ -229,6 +229,9 @@ UseInCallBack SETL {FALSE}
GBLL UseGotCallBack
UseGotCallBack SETL {FALSE}
GBLL PollIdleHandling
PollIdleHandling SETL {TRUE}
GBLA WimpVersion
WimpVersion SETA 300
......@@ -1370,6 +1373,7 @@ Code_StartEntry ROUT
; call Wimp_Poll till we get a null event, in the interests of multi-taskingness
;
06 MOV r0, #0 ; we want null events
MOV r2, #0 ; no delay
MOV r3, #0 ; no poll word
BL PollWimpFn ; deals with messages if necessary
BVS %f07
......@@ -1987,6 +1991,9 @@ GetParentTask ROUT
BL SendNewTaskMessage ; ask !Edit for a task window
04
MOVVC r0, #pollwordfast_enable ; Allow nulls, and high priority poll word
[ PollIdleHandling
MOVVC r2, #0 ; no wait
]
ADRVCL r3, ParentTask ; poll word = parent task handle
BLVC PollWimpFn ; poll the wimp
BVS %f05
......@@ -2013,6 +2020,9 @@ GetParentTask ROUT
MOVVC r0, #pollwordfast_enable ; Allow nulls, and high priority poll word
ADRVCL r3, ParentTask ; poll word = parent task handle
[ PollIdleHandling
MOVVC r2, #0 ; no wait
]
BLVC PollWimpFn ; poll the wimp
BVS %f05
......@@ -2782,6 +2792,9 @@ notcontrol
; Then poll wimp to allow other coroutines a chance
;
MOV r0, #0 ; Allow nulls
[ PollIdleHandling
MOV r2, #0 ; no wait
]
MOV r3, #0
BL PollWimpFn ; poll the wimp
10
......@@ -2999,6 +3012,9 @@ MyUpCallV ROUT
MOVEQ r0, #pollword_enable ; pollword_enable
ORREQ r0, r0, #null_bit ; mask nulls
20
[ PollIdleHandling
MOV r2, #0 ; no wait
]
BL PollWimpFn ; poll the wimp, dealing with events
MOV r14, #0
STR r14, PollWord
......@@ -3173,6 +3189,9 @@ MyRdchV ROUT
;
20
MOV r0, #1 ; Disallow nulls
[ PollIdleHandling
MOV r2, #0 ; no wait
]
MOV r3, #0 ; no poll word
BL PollWimpFn ; poll the wimp
;
......@@ -3371,6 +3390,12 @@ MyByteV ROUT
; Then poll wimp to allow other coroutines a chance
;
15
[ PollIdleHandling
SWI XOS_ReadMonotonicTime
LDR r2, InkeyCount
ADD r2, r0, r2, LSL#1
]
MOV r0, #0 ; Allow nulls (else we never time out!)
MOV r3, #0
BL PollWimpFn ; poll the wimp
......@@ -3719,6 +3744,9 @@ Code_CallBackHandler ROUT
; Then poll wimp to allow other coroutines a chance
;
MOV r0, #0 ; Allow nulls
[ PollIdleHandling
MOV r2, #0 ; no wait
]
MOV r3, #0
BL PollWimpFn ; poll the wimp
......@@ -4178,6 +4206,7 @@ PollWimpFn ROUT
; r13 = stack pointer
; r0 = additional mask to determine if null events allowed
; 0 => allowed, 1 => not allowed
; r2 = time to return
; r3 = address of poll word (0 => none)
;
; Exit:- r0 - r4, r14 corrupt
......@@ -4239,22 +4268,23 @@ PollWimp ROUT
; r13 = stack pointer
; r0 = additional mask to determine if null events allowed
; also used to enable poll word checking
; r2 = time to return
; r3 = address of poll word (0 if none)
;
; Exit:- r0 - r4, r14 corrupt
; All other registers preserved
;
Push "r0,r3,lr"
Push "r0-r3,lr"
Push "lr"
10 ; sometimes we come back here!
Pull "lr" ; grotbag routines expect just lr on stack
LDMIA sp, {r0,r3}
LDMIA sp, {r0-r3}
BL grotpollwimp
STRVS r0, [sp]
Pull "r0,r3,pc"
Pull "r0-r3,pc"
grotpollwimp
Push "r3,lr"
Push "r2, r3,lr"
LDR r1, ReceivePending
TEQ r1, #0
......@@ -4289,9 +4319,10 @@ grotpollwimp
STMIA r0, {r1-r3}
]
;
; recover poll word address
; recover poll word address and time
;
Pull "r3"
Pull "r2, r3"
MOV r5, r2 ; save wait for later
[ DebugWimp
BL FindPages
......@@ -4325,7 +4356,14 @@ grotpollwimp
LDMIA r2!, {r10-r12} ; Set up user r10-r12 in case an error occurs
LDR r14, [r2, #8] ; And user r14
]
[ PollIdleHandling
MOV r2, r5
TEQ r2, #0
SWIEQ XWimp_Poll
SWINE XWimp_PollIdle
|
SWI XWimp_Poll
]
[ FPErrorHandling
Pull "r12" ; My r12 back
;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment