Commit e4a8bac2 authored by Jeffrey Lee's avatar Jeffrey Lee Committed by ROOL
Browse files

Be more forgiving of GraphicsV init failures

* Update OS_ScreenMode 11's handling of drivers which fail to
initialise. If there was no previous driver, then instead of trying to
restore that nonexistant driver, stick with the new one. This is mainly
to help with the case where the kernel's built in modes aren't accepted
by the driver, and valid modes only become available once an MDF is
loaded (this can happen with early OMAP3 chip revisions, which have very
tight sync & porch limits, causing 90% of the kernel's modes to be
rejected). If the kernel was to revert to the "no driver" state, then
loading the MDF would still leave you with no video output.
* Since we can now end up in a state where a driver is selected but
hasn't been programmed yet, update OS_Byte 19 to detect this (via the
magic ScreenBlankDPMSState value of 255) and avoid waiting for VSync
* Update RemovePages & InsertRemovePagesExit (screen DA handlers) to
avoid infinite loops if the screen DA gets shrunk to zero size (was seen
while attempting to complete the !Boot sequence while no driver was
active)

Version 6.33. Tagged as 'Kernel-6_33'
parent 830bc852
......@@ -9,12 +9,12 @@
GBLS Module_ApplicationDate
GBLS Module_HelpVersion
GBLS Module_ComponentName
Module_MajorVersion SETS "6.32"
Module_Version SETA 632
Module_MajorVersion SETS "6.33"
Module_Version SETA 633
Module_MinorVersion SETS ""
Module_Date SETS "19 Jan 2020"
Module_ApplicationDate SETS "19-Jan-20"
Module_Date SETS "12 Feb 2020"
Module_ApplicationDate SETS "12-Feb-20"
Module_ComponentName SETS "Kernel"
Module_FullVersion SETS "6.32"
Module_HelpVersion SETS "6.32 (19 Jan 2020)"
Module_FullVersion SETS "6.33"
Module_HelpVersion SETS "6.33 (12 Feb 2020)"
END
/* (6.32)
/* (6.33)
*
* This file is automatically maintained by srccommit, do not edit manually.
*
*/
#define Module_MajorVersion_CMHG 6.32
#define Module_MajorVersion_CMHG 6.33
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 19 Jan 2020
#define Module_Date_CMHG 12 Feb 2020
#define Module_MajorVersion "6.32"
#define Module_Version 632
#define Module_MajorVersion "6.33"
#define Module_Version 633
#define Module_MinorVersion ""
#define Module_Date "19 Jan 2020"
#define Module_Date "12 Feb 2020"
#define Module_ApplicationDate "19-Jan-20"
#define Module_ApplicationDate "12-Feb-20"
#define Module_ComponentName "Kernel"
#define Module_FullVersion "6.32"
#define Module_HelpVersion "6.32 (19 Jan 2020)"
#define Module_LibraryVersionInfo "6:32"
#define Module_FullVersion "6.33"
#define Module_HelpVersion "6.33 (12 Feb 2020)"
#define Module_LibraryVersionInfo "6:33"
......@@ -804,6 +804,7 @@ ScreenBlankDPMSState # 1 ; 0 => just blank video
; 1 => blank to stand-by (hsync off)
; 2 => blank to suspend (vsync off)
; 3 => blank to off (H+V off)
; 255 => no mode programmed yet
ASSERT ScreenBlankDPMSState = Legacy_ScreenBlankDPMSState
ASSERT ?ScreenBlankDPMSState = ?Legacy_ScreenBlankDPMSState
......
......@@ -563,9 +563,11 @@ Osbyte13 ROUT
TSTNE R1, #3 ; NE => blanked and DPMS turned off HSync or VSync
MyOsbyte NE ; if true exit immediately
; Also, exit now if we don't have a driver active
; Also, exit now if we don't have a driver active, or there's no
; mode programmed
LDR R0, [LR,#CurrentGraphicsVDriver]
CMP R0, #GraphicsVInvalid
CMPEQ R1, #255
MyOsbyte EQ
; It is actually better to call Idle with interrupts disabled as it stops the interrupt
......
......@@ -106,9 +106,9 @@ VduInit ROUT
ASSERT (ZeroPage :AND: 255) = 0
STRB R0, [R0, #OsbyteVars + :INDEX: VDUqueueItems] ;purge queue
STRB R0, [WsPtr, #ScreenBlankFlag] ; not blanked
[ ZeroPage <> 0
MOV R0, #255
STRB R0, [WsPtr, #ScreenBlankDPMSState] ; however, no mode programmed yet
MOV R0, #0
]
STR R0, [WsPtr, #CursorCounter]
STR R0, [WsPtr, #CursorDesiredState]
STR R0, [WsPtr, #VduStatus]
......
......@@ -1064,6 +1064,7 @@ PV_BlankScreen ROUT
AND r0, r0, #1
STRB r0, [WsPtr, #ScreenBlankFlag] ; update new state
LDRB r1, [WsPtr, #ScreenBlankDPMSState]
AND r1, r1, #3
LDR r4, [WsPtr, #CurrentGraphicsVDriver]
MOV r4, r4, LSL #24
......
......@@ -1273,6 +1273,10 @@ RemovePages ROUT
; display starts in pages that remain
CMP R4, #0 ; if we've somehow shrunk to zero,
MOVEQ R5, R14 ; then DisplayStart = ScreenEndAddr,
BEQ %FT06 ; and avoid the infinite loop below!
SUB R5, R3, R0 ; new DisplayStart
05
......@@ -1280,6 +1284,7 @@ RemovePages ROUT
SUBCS R5, R5, R4 ; then repeatedly subtract off new size
BCS %BT05 ; until in range
06
Push "R0-R2"
MOV R0, R5 ; put new display start in r0
BL SetVinit ; this updates DisplayStart
......@@ -1302,10 +1307,15 @@ InsertRemovePagesExit
LDR R4, [WsPtr, #DisplayScreenStart]
SUB R0, R4, R0
LDR R3, [WsPtr, #TotalScreenSize]
CMP R3, #0
MOVEQ R0, R14
BEQ %FT26
25
CMP R0, R14 ; ensure displayscreenstart in range too
SUBCS R0, R0, R3
BCS %BT25
26
BL NewScreenStart
30
BL SetVendDefault
......@@ -2063,6 +2073,10 @@ ScreenMode_SelectDevice ROUT
MOV r1, #Service_DisplayChanged
MOV r3, #DisplayChangedSub_ModeChanged
IssueService
; Flag that VSync probably isn't working
; (will be cleared by HardwareModeChange)
MOV r0, #255
STRB r0, [WsPtr, #ScreenBlankDPMSState]
; Update current driver VDU var
STR r2, [WsPtr, #CurrentGraphicsVDriver]
; Issue service call to indicate change is coming
......@@ -2071,28 +2085,47 @@ ScreenMode_SelectDevice ROUT
; Call InitialiseMode to select a mode to use for this new driver
CMP r2, #GraphicsVInvalid
BLNE InitialiseMode
BVS %FT15
; Success!
MOV r0, #DisplayChanged_Changed
IssueService
MOV r1, r5
EXIT
15
; Something went wrong trying to activate the new driver
; Try and restore the old one
BVC %FT15
; Something went wrong trying to activate the new driver.
; Make sure the VSync flag is still set.
MOV lr, #255
STRB lr, [WsPtr, #ScreenBlankDPMSState]
; Do we have an old driver we can try and switch back to?
;
; If we don't have an old driver, just stick with this new
; one, under the assumption that the failure was because we
; couldn't find a valid mode to switch to (which is generally
; the only way in which InitialiseMode will fail). For such a
; situation, there's a reasonable chance that things will start
; working later on during the boot sequence, e.g. once an MDF
; is loaded. And for such a case, temporarily having a broken
; driver active is much better than restoring the "no driver"
; state, since we currently don't have any kind of watchdog which
; will kick the video system into life once the MDF does get
; loaded.
CMP r5, #GraphicsVInvalid
BEQ %FT15
STR r0, [sp] ; Return the error to the caller
STR r5, [WsPtr, #CurrentGraphicsVDriver]
MOV r0, #DisplayChanged_Changing
MOV r2, r5
IssueService
CMP r5, #GraphicsVInvalid
BLNE InitialiseMode
BL InitialiseMode
MOVVS lr, #255
STRVSB lr, [WsPtr, #ScreenBlankDPMSState]
; TODO - Try harder if this 2nd call fails (e.g. try all drivers in turn)
MOV r0, #DisplayChanged_Changed
IssueService
MOV r1, r5
SETV
EXIT
15
; Success!
MOV r0, #DisplayChanged_Changed
IssueService
MOV r1, r5
EXIT
20
PullEnv
ADR r0, ErrorBlock_BadGDriver
......
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