The Icon Bar: Programming: Disabling screen caching on a StrongARM
|
Disabling screen caching on a StrongARM |
|
sirbod (21:45 16/8/2013) Phlamethrower (00:47 17/8/2013) sirbod (06:48 17/8/2013) Phlamethrower (08:39 17/8/2013) sirbod (10:05 17/8/2013)
|
|
Jon Abbott |
Message #122546, posted by sirbod at 21:45, 16/8/2013 |
Member
Posts: 563
|
I'm trying to disable screen caching via OS_Memory 0 on RO3.71, but it doesn't seem to work, caching seems to remain active. Does my code look correct?
Code, which is triggered by Service_ModeChange is as follows:
MOV R0, #2 SWI XOS_ReadDynamicArea MOV R3, R0 ;R3=start of screen ADD R4, R0, R1 ;R4=end of screen
MOV R0, #8 ORR R0, R0, #2 << 8 ;get VRAM page size SWI XOS_Memory MOV R5, R2 ;R5=page size
MOV R0, #(2 << 14) + (1 << 9) ;logical address, disable caching ADR R1, memmap_entry MOV R2, #1 .L1 STR R3, [R1, #4] ;page SWI XOS_Memory
ADD R3, R3, R5 CMP R3, R4 BLT L1
PRM5a-65 states "cacheability is accumulated for each page", so I presume I also need to enable caching in Service_PreModeChange.
Why the screen is being cached in the first place is somewhat confusing, I didn't think screen caching was added until RO4, or have I misunderstood?
[Edited by sirbod at 11:02, 17/8/2013] |
|
[ Log in to reply ] |
|
Jeffrey Lee |
Message #122547, posted by Phlamethrower at 00:47, 17/8/2013, in reply to message #122546 |
Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot stuff
Posts: 15100
|
Why the screen is being cached in the first place is somewhat confusing, I didn't think screen caching was added until RO4, or have I misunderstood? You have indeed misunderstood. Screen caching is currently only supported by RISC OS 4 & 6. However some software does implement its own screen caching code to boost performance (Peter Teichmann's !Comanche demo, for one) |
|
[ Log in to reply ] |
|
Jon Abbott |
Message #122548, posted by sirbod at 06:48, 17/8/2013, in reply to message #122547 |
Member
Posts: 563
|
You have indeed misunderstood. Screen caching is currently only supported by RISC OS 4 & 6. However some software does implement its own screen caching code to boost performance (Peter Teichmann's !Comanche demo, for one) So my code is good then?
What I'm seeing looks identical to screen caching, where game screens are missing multiple words of the screen, which gradually fill in independent of the game updating the screen. It must be a StrongARM quirk as its happening on a Shift-booted RO3.7x.
Enabling caching on RO3.7x at the desktop, I see exactly the same effect, so I'm certain caching is somehow being turned on.
Will XOS_SetMemMapEntries affect caching as pages are moved around? I can try calling XOS_Memory call after the pages are remapped to see if there's any difference.
I suppose a last resort is to flush the cache on VSync, which is particularly nasty due to the overhead, but worth a go I suppose. |
|
[ Log in to reply ] |
|
Jeffrey Lee |
Message #122549, posted by Phlamethrower at 08:39, 17/8/2013, in reply to message #122548 |
Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot stuff
Posts: 15100
|
You have indeed misunderstood. Screen caching is currently only supported by RISC OS 4 & 6. However some software does implement its own screen caching code to boost performance (Peter Teichmann's !Comanche demo, for one) So my code is good then? Nope. You need to use (2 << 14) to disable caching; (3 << 14) will enable it.
What I'm seeing looks identical to screen caching, where game screens are missing multiple words of the screen, which gradually fill in independent of the game updating the screen. It must be a StrongARM quirk as its happening on a Shift-booted RO3.7x. Are you using your own code to remap screen memory? Are you sure that's not enabling caching somehow?
Will XOS_SetMemMapEntries affect caching as pages are moved around? Yes. OS_SetMemMapEntries resets the page flags to the values specified in the map request block. But prior to RISC OS 5 it looks like there's a bug/limitation which means that it only pays attention to the bottom two bits (the access priviliges). So there's no way of specifying that the pages should be noncacheable/nonbufferable. |
|
[ Log in to reply ] |
|
Jon Abbott |
Message #122550, posted by sirbod at 10:05, 17/8/2013, in reply to message #122549 |
Member
Posts: 563
|
Nope. You need to use (2 << 14) to disable caching; (3 << 14) will enable it. Typo, it is 2 in the actual code.
Are you using your own code to remap screen memory? Are you sure that's not enabling caching somehow?
Will XOS_SetMemMapEntries affect caching as pages are moved around? Yes. OS_SetMemMapEntries resets the page flags to the values specified in the map request block. But prior to RISC OS 5 it looks like there's a bug/limitation which means that it only pays attention to the bottom two bits (the access priviliges). So there's no way of specifying that the pages should be noncacheable/nonbufferable. Yes, my own code. If OS_SetMemMapEntries resets the flags, that will be it. Issuing XOS_Memory immediately after OS_SetMemMapEntries should hopefully resolve the problem.
EDIT: That fix the problem, thanks for your help in pinning that down.
[Edited by sirbod at 11:15, 17/8/2013] |
|
[ Log in to reply ] |
|
|
The Icon Bar: Programming: Disabling screen caching on a StrongARM |