Commit 90cc1d38 authored by Jeffrey Lee's avatar Jeffrey Lee
Browse files

Initial support for the ExtraBytes VIDC control list item

Detail:
  The ExtraBytes control list item can be used to add padding between framebuffer rows.
  When the kernel sees a VIDC list containing this item, it will now adjust the LineLength and ScreenSize mode variables accordingly, with the end result that the correct amount of memory will be allocated for the framebuffer and the OS will render into it correctly.
  Files changed:
  - hdr/KernelWS - Add DisplayLineLength variable to allow the correct LineLength value to be preserved when screen output is redirected to a sprite
  - s/vdu/vdudriver - Make ModeChangeSub initialise DisplayLineLength before calling SwitchOutputToSprite. Update PushModeInfo to take ExtraBytes into account when calculating LineLength and ScreenSize.
  - s/vdu/vdugrafl - Adjust SwitchOutputToSprite to use DisplayLineLength when restoring screen output
  - s/vdu/vduwrch - Fix full-screen CLS to not write to the padding bytes
Admin:
  Tested on Raspberry Pi 3


Version 5.82. Tagged as 'Kernel-5_82'
parent 954cd88c
......@@ -11,13 +11,13 @@
GBLS Module_HelpVersion
GBLS Module_ComponentName
GBLS Module_ComponentPath
Module_MajorVersion SETS "5.81"
Module_Version SETA 581
Module_MajorVersion SETS "5.82"
Module_Version SETA 582
Module_MinorVersion SETS ""
Module_Date SETS "03 Jun 2017"
Module_ApplicationDate SETS "03-Jun-17"
Module_Date SETS "07 Jun 2017"
Module_ApplicationDate SETS "07-Jun-17"
Module_ComponentName SETS "Kernel"
Module_ComponentPath SETS "castle/RiscOS/Sources/Kernel"
Module_FullVersion SETS "5.81"
Module_HelpVersion SETS "5.81 (03 Jun 2017)"
Module_FullVersion SETS "5.82"
Module_HelpVersion SETS "5.82 (07 Jun 2017)"
END
/* (5.81)
/* (5.82)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 5.81
#define Module_MajorVersion_CMHG 5.82
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 03 Jun 2017
#define Module_Date_CMHG 07 Jun 2017
#define Module_MajorVersion "5.81"
#define Module_Version 581
#define Module_MajorVersion "5.82"
#define Module_Version 582
#define Module_MinorVersion ""
#define Module_Date "03 Jun 2017"
#define Module_Date "07 Jun 2017"
#define Module_ApplicationDate "03-Jun-17"
#define Module_ApplicationDate "07-Jun-17"
#define Module_ComponentName "Kernel"
#define Module_ComponentPath "castle/RiscOS/Sources/Kernel"
#define Module_FullVersion "5.81"
#define Module_HelpVersion "5.81 (03 Jun 2017)"
#define Module_LibraryVersionInfo "5:81"
#define Module_FullVersion "5.82"
#define Module_HelpVersion "5.82 (07 Jun 2017)"
#define Module_LibraryVersionInfo "5:82"
......@@ -586,7 +586,7 @@ BitsPerPix # 4 ; Bits per pixel (1,2,4,8)
BytesPerChar # 4 ; Bytes per 8 pixels of character
; (same as BitsPerPix except in double pixel modes)
# 4 ; SPARE (avoiding changes of exported addresses for now)
DisplayLineLength # 4 ; LineLength of display. May include padding from ExtraBytes control list item, so needs manual preservation during screen redirection.
RowMult # 4 ; Row multiplier for text manipulation
......
......@@ -968,6 +968,11 @@ mchsub_3
SUBS R2, R2, #4 ; loop until all done
BNE %BT15
; initialise any values which SwitchOutput refers to
LDR R4, [R13, #wkLineLength]
STR R4, [WsPtr, #DisplayLineLength]
; now set up other mode variables by calling SwitchOutput
ADD R3, WsPtr, #VduSaveArea+InitFlag
......@@ -1313,17 +1318,36 @@ PushModeInfoCommonNoService
CMP r14, #-1
BEQ %FT58 ; didn't find the interlaced entry - not interlaced
TEQ r14, #ControlList_ExtraBytes
BNE %FT571
LDR r14, [r10, #-4]
; Adjust LineLength, ScreenSize by ExtraBytes
LDR r2, [r9, #wkModeFlags]
TST r2, #ModeFlag_Teletext
LDR r2, [r9, #wkLineLength]
ADD r2, r2, r14
STR r2, [r9, #wkLineLength]
LDR r2, [r9, #wkYWindLimit]
MLA r2, r14, r2, r14 ; (yWindLimit+1) * ExtraBytes
LDR r14, [r9, #wkScreenSize]
ADD r14, r14, r2
ADDNE r14, r14, r2 ; teletext ScreenSize is actually enough for two screens
STR r14, [r9, #wkScreenSize]
B %BT57
571
TEQ r14, #ControlList_Interlaced
BNE %BT57 ; check the next one then
LDR r14, [r10, #-4] ; read value
TEQ r14, #0
BEQ %FT58 ; if zero, not interlaced
BEQ %BT57 ; if zero, not interlaced
; it's interlaced
LDR r14, [r9, #wkModeFlags]
ORR r14, r14, #ModeFlag_InterlacedMode
STR r14, [r9, #wkModeFlags]
B %BT57 ; process remaining control list items
58
Push "r0-r2"
LDR r0, [WsPtr, #GraphicsVFeatures]
......
......@@ -159,14 +159,27 @@ SwitchOutputToMask ROUT
MOV R11, R13
TEQ R2, #0 ; if outputting to screen
LDREQ R5, [R11, #wkLineLength] ; then load up values
LDREQ R6, [R11, #wkYWindLimit] ; from mode table
; If we're switching output to screen, either find our values from the
; pushed mode info or from the saved DisplayXXX values.
; DisplayXXX is needed for any values which might differ from one
; display driver to another, but care is needed because ModeChangeSub
; actually calls us during the mode change to set up some of the
; variables (so need to make sure that any DisplayXXX values are set
; before we get called).
; Also note that we can't replace the above PushModeInfoAnyMonitor call
; with PushModeInfo (to get accurate values for the current display
; driver) because ScreenModes might not be running with the same MDF
; as when the original call was made.
TEQ R2, #0
LDREQ R5, [R12, #DisplayLineLength]
LDREQ R6, [R11, #wkYWindLimit]
LDREQ R7, [R11, #wkXWindLimit]
LDREQ R8, [R11, #wkScrRCol]
LDREQ R10, [R11, #wkScrBRow]
BEQ %FT30 ; and skip more sprite stuff
BEQ %FT30
; OK, we're switching to a sprite, so calculate the above values from
; the sprite header
ADD R5, R5, #1
MOV R5, R5, LSL #2 ; R5 = width in bytes
......
......@@ -419,6 +419,16 @@ FastCLS ROUT
TEQ R4, #GraphicsV_Complete
Pull PC, EQ
15
; If the framebuffer rows aren't contiguous then we must use SlowCLS
LDR R0, [WsPtr, #XWindLimit]
LDR R1, [WsPtr, #Log2BPP]
ADD R0, R0, #1
LDR R2, [WsPtr, #LineLength]
MOV R0, R0, LSL R1
CMP R0, R2, LSL #3
Pull "LR", NE
BNE SlowCLS
LDR R0, [WsPtr, #TextBgColour]
LDR R8, [WsPtr, #ScreenStart]
MOV R1, R0
......
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