2 * COPYRIGHT: See COPYING.ARM in the top level directory
3 * PROJECT: ReactOS UEFI Boot Library
4 * FILE: boot/environ/lib/platform/display.c
5 * PURPOSE: Boot Library Display Management Routines
6 * PROGRAMMER: Alex Ionescu (alex.ionescu@reactos.org)
9 /* INCLUDES ******************************************************************/
14 /* DATA VARIABLES ************************************************************/
16 typedef enum _BL_COLOR
34 } BL_COLOR
, *PBL_COLOR
;
36 typedef struct _BL_DISPLAY_STATE
43 } BL_DISPLAY_STATE
, *PBL_DISPLAY_STATE
;
45 typedef struct _BL_DISPLAY_MODE
50 } BL_DISPLAY_MODE
, *PBL_DISPLAY_MODE
;
52 struct _BL_TEXT_CONSOLE
;
55 (*PCONSOLE_DESTRUCT
) (
56 _In_
struct _BL_TEXT_CONSOLE
* Console
61 (*PCONSOLE_REINITIALIZE
) (
62 _In_
struct _BL_TEXT_CONSOLE
* Console
67 (*PCONSOLE_GET_TEXT_STATE
) (
68 _In_
struct _BL_TEXT_CONSOLE
* Console
,
69 _Out_ PBL_DISPLAY_STATE TextState
74 (*PCONSOLE_SET_TEXT_STATE
) (
75 _In_
struct _BL_TEXT_CONSOLE
* Console
,
77 _In_ PBL_DISPLAY_STATE TextState
82 (*PCONSOLE_GET_TEXT_RESOLUTION
) (
83 _In_
struct _BL_TEXT_CONSOLE
* Console
,
84 _Out_ PULONG TextResolution
89 (*PCONSOLE_SET_TEXT_RESOLUTION
) (
90 _In_
struct _BL_TEXT_CONSOLE
* Console
,
91 _In_ ULONG NewTextResolution
,
92 _Out_ PULONG OldTextResolution
97 (*PCONSOLE_CLEAR_TEXT
) (
98 _In_
struct _BL_TEXT_CONSOLE
* Console
,
105 (*PCONSOLE_WRITE_TEXT
) (
106 _In_
struct _BL_TEXT_CONSOLE
* Console
,
111 typedef struct _BL_TEXT_CONSOLE_VTABLE
113 PCONSOLE_DESTRUCT Destruct
;
114 PCONSOLE_REINITIALIZE Reinitialize
;
115 PCONSOLE_GET_TEXT_STATE GetTextState
;
116 PCONSOLE_SET_TEXT_STATE SetTextState
;
117 PCONSOLE_GET_TEXT_RESOLUTION GetTextResolution
;
118 PCONSOLE_SET_TEXT_RESOLUTION SetTextResolution
;
119 PCONSOLE_CLEAR_TEXT ClearText
;
120 PCONSOLE_WRITE_TEXT WriteText
;
121 } BL_TEXT_CONSOLE_VTABLE
, *PBL_TEXT_CONSOLE_VTABLE
;
123 typedef struct _BL_TEXT_CONSOLE
125 PBL_TEXT_CONSOLE_VTABLE Callbacks
;
126 BL_DISPLAY_STATE State
;
127 BL_DISPLAY_MODE DisplayMode
;
129 EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
* Protocol
;
131 EFI_SIMPLE_TEXT_OUTPUT_MODE OldMode
;
132 } BL_TEXT_CONSOLE
, *PBL_TEXT_CONSOLE
;
134 PVOID BfiCachedStrikeData
;
135 LIST_ENTRY BfiDeferredListHead
;
136 LIST_ENTRY BfiFontFileListHead
;
138 PVOID BfiGraphicsRectangle
;
140 ULONG ConsoleGraphicalResolutionListFlags
;
141 BL_DISPLAY_MODE ConsoleGraphicalResolutionList
[3] =
148 BL_DISPLAY_MODE ConsoleTextResolutionList
[1] =
154 ConsoleTextLocalDestruct (
155 _In_
struct _BL_TEXT_CONSOLE
* Console
159 ConsoleTextLocalReinitialize (
160 _In_
struct _BL_TEXT_CONSOLE
* Console
164 ConsoleTextBaseGetTextState (
165 _In_
struct _BL_TEXT_CONSOLE
* Console
,
166 _Out_ PBL_DISPLAY_STATE TextState
170 ConsoleTextLocalSetTextState (
171 _In_
struct _BL_TEXT_CONSOLE
* Console
,
173 _In_ PBL_DISPLAY_STATE TextState
177 ConsoleTextBaseGetTextResolution (
178 _In_
struct _BL_TEXT_CONSOLE
* Console
,
179 _Out_ PULONG TextResolution
183 ConsoleTextLocalSetTextResolution (
184 _In_
struct _BL_TEXT_CONSOLE
* Console
,
185 _In_ ULONG NewTextResolution
,
186 _Out_ PULONG OldTextResolution
190 ConsoleTextLocalClearText (
191 _In_
struct _BL_TEXT_CONSOLE
* Console
,
196 ConsoleTextLocalWriteText (
197 _In_
struct _BL_TEXT_CONSOLE
* Console
,
202 BL_TEXT_CONSOLE_VTABLE ConsoleTextLocalVtbl
=
204 ConsoleTextLocalDestruct
,
205 ConsoleTextLocalReinitialize
,
206 ConsoleTextBaseGetTextState
,
207 ConsoleTextLocalSetTextState
,
208 ConsoleTextBaseGetTextResolution
,
209 ConsoleTextLocalSetTextResolution
,
210 ConsoleTextLocalClearText
,
211 ConsoleTextLocalWriteText
214 PVOID DspRemoteInputConsole
;
215 PVOID DspTextConsole
;
216 PVOID DspGraphicalConsole
;
218 /* FUNCTIONS *****************************************************************/
221 ConsolepFindResolution (
222 _In_ PBL_DISPLAY_MODE Mode
,
223 _In_ PBL_DISPLAY_MODE List
,
227 PBL_DISPLAY_MODE ListEnd
;
229 /* Loop until we hit the maximum supported list index */
230 ListEnd
= &List
[MaxIndex
];
231 while (List
!= ListEnd
)
233 /* Does this resolution match? */
234 if ((Mode
->HRes
== List
->HRes
) && (Mode
->VRes
== List
->VRes
))
236 /* Yep -- we got a match */
245 /* No matches were found */
250 ConsoleEfiTextGetColorForeground (
251 _In_ UINT32 Attributes
254 /* Read the foreground color attribute and convert to CGA color index */
255 switch (Attributes
& 0x0F)
283 case EFI_LIGHTMAGENTA
:
294 ConsoleEfiTextGetColorBackground (
295 _In_ UINT32 Attributes
298 /* Read the background color attribute and convert to CGA color index */
299 switch (Attributes
& 0xF0)
301 case EFI_BACKGROUND_MAGENTA
:
303 case EFI_BACKGROUND_BROWN
:
305 case EFI_BACKGROUND_LIGHTGRAY
:
307 case EFI_BACKGROUND_BLACK
:
310 case EFI_BACKGROUND_RED
:
312 case EFI_BACKGROUND_GREEN
:
314 case EFI_BACKGROUND_CYAN
:
316 case EFI_BACKGROUND_BLUE
:
322 ConsoleEfiTextGetEfiColorBackground (
326 /* Convert the CGA color index into an EFI background attribute */
331 return EFI_BACKGROUND_BLUE
;
334 return EFI_BACKGROUND_GREEN
;
337 return EFI_BACKGROUND_CYAN
;
340 return EFI_BACKGROUND_RED
;
343 return EFI_BACKGROUND_MAGENTA
;
346 return EFI_BACKGROUND_BROWN
;
349 return EFI_BACKGROUND_LIGHTGRAY
;
353 return EFI_BACKGROUND_BLACK
;
358 ConsoleEfiTextGetEfiColorForeground (
362 /* Convert the CGA color index into an EFI foreground attribute */
380 return EFI_LIGHTGRAY
;
384 return EFI_LIGHTBLUE
;
386 return EFI_LIGHTGREEN
;
388 return EFI_LIGHTCYAN
;
392 return EFI_LIGHTMAGENTA
;
402 ConsoleEfiTextGetAttribute (
407 /* Convert each part and OR into a single attribute */
408 return ConsoleEfiTextGetEfiColorBackground(BgColor
) |
409 ConsoleEfiTextGetEfiColorForeground(FgColor
);
413 ConsoleEfiTextGetStateFromMode (
414 _In_ EFI_SIMPLE_TEXT_OUTPUT_MODE
*Mode
,
415 _Out_ PBL_DISPLAY_STATE State
419 ULONG TextWidth
, TextHeight
;
421 /* Get all the EFI data and convert it into our own structure */
422 BlDisplayGetTextCellResolution(&TextWidth
, &TextHeight
);
423 State
->FgColor
= ConsoleEfiTextGetColorForeground(Mode
->Attribute
);
424 State
->BgColor
= ConsoleEfiTextGetColorBackground(Mode
->Attribute
);
425 State
->XPos
= Mode
->CursorColumn
* TextWidth
;
426 State
->YPos
= Mode
->CursorRow
* TextHeight
;
427 State
->CursorVisible
= Mode
->CursorVisible
!= FALSE
;
431 ConsoleFirmwareTextSetState (
432 _In_ PBL_TEXT_CONSOLE TextConsole
,
434 _In_ PBL_DISPLAY_STATE State
438 ULONG FgColor
, BgColor
, Attribute
, XPos
, YPos
, TextHeight
, TextWidth
;
441 /* Check if foreground state is being set */
444 /* Check if there's a difference from current */
445 FgColor
= State
->FgColor
;
446 if (TextConsole
->State
.FgColor
!= FgColor
)
448 /* Ignore invalid color */
451 return STATUS_INVALID_PARAMETER
;
454 /* Convert from NT/CGA format to EFI, and then set the attribute */
455 Attribute
= ConsoleEfiTextGetAttribute(TextConsole
->State
.BgColor
,
457 Status
= EfiConOutSetAttribute(TextConsole
->Protocol
, Attribute
);
458 if (!NT_SUCCESS(Status
))
463 /* Update cached state */
464 TextConsole
->State
.FgColor
= FgColor
;
468 /* Check if background state is being set */
471 /* Check if there's a difference from current */
472 BgColor
= State
->BgColor
;
473 if (TextConsole
->State
.BgColor
!= BgColor
)
475 /* Ignore invalid color */
478 return STATUS_INVALID_PARAMETER
;
481 /* Convert from NT/CGA format to EFI, and then set the attribute */
482 Attribute
= ConsoleEfiTextGetAttribute(BgColor
,
483 TextConsole
->State
.FgColor
);
484 Status
= EfiConOutSetAttribute(TextConsole
->Protocol
, Attribute
);
486 if (!NT_SUCCESS(Status
))
491 /* Update cached state */
492 TextConsole
->State
.BgColor
= BgColor
;
496 /* Check if position state is being set */
499 /* Check if there's a difference from current */
502 if ((TextConsole
->State
.XPos
!= XPos
) ||
503 (TextConsole
->State
.YPos
!= YPos
))
505 /* Set the new cursor position */
506 BlDisplayGetTextCellResolution(&TextWidth
, &TextHeight
);
507 Status
= EfiConOutSetCursorPosition(TextConsole
->Protocol
,
510 if (!NT_SUCCESS(Status
))
515 /* Update cached state */
516 TextConsole
->State
.XPos
= XPos
;
517 TextConsole
->State
.YPos
= YPos
;
521 /* Check if cursor state is being set */
524 /* Check if there's a difference from current */
525 Visible
= State
->CursorVisible
;
526 if (TextConsole
->State
.CursorVisible
!= Visible
)
528 /* Ignore invalid state */
531 return STATUS_INVALID_PARAMETER
;
534 /* Set the new cursor state */
535 Status
= EfiConOutEnableCursor(TextConsole
->Protocol
, Visible
);
536 if (!NT_SUCCESS(Status
))
541 /* Update cached status */
542 TextConsole
->State
.CursorVisible
= Visible
;
547 return STATUS_SUCCESS
;
551 ConsoleEfiTextFindModeFromAllowed (
552 _In_ SIMPLE_TEXT_OUTPUT_INTERFACE
*TextProtocol
,
553 _In_ PBL_DISPLAY_MODE SupportedModes
,
555 _Out_ PULONG SupportedMode
558 EFI_SIMPLE_TEXT_OUTPUT_MODE ModeInfo
;
559 ULONG MaxMode
, MaxQueriedMode
, Mode
, i
, MatchingMode
;
561 ULONGLONG ModeListSize
;
562 PBL_DISPLAY_MODE ModeEntry
, ModeList
, SupportedModeEntry
;
565 /* Read information on the current mode */
566 EfiConOutReadCurrentMode(TextProtocol
, &ModeInfo
);
568 /* Figure out the max mode, and how many modes we'll have to read */
569 MaxMode
= ModeInfo
.MaxMode
;
570 ModeListSize
= sizeof(*ModeEntry
) * ModeInfo
.MaxMode
;
571 if (ModeListSize
> MAXULONG
)
573 return STATUS_INTEGER_OVERFLOW
;
576 /* Allocate a list for all the supported EFI modes */
577 ModeList
= BlMmAllocateHeap(ModeListSize
);
580 return STATUS_INSUFFICIENT_RESOURCES
;
583 /* Scan all the EFI modes */
584 EarlyPrint(L
"Scanning through %d modes\n", MaxMode
);
585 for (MaxQueriedMode
= 0, Mode
= 0; Mode
< MaxMode
; Mode
++)
587 /* Query information on this mode */
588 ModeEntry
= &ModeList
[MaxQueriedMode
];
589 if (NT_SUCCESS(EfiConOutQueryMode(TextProtocol
,
594 /* This mode was succesfully queried. Save the data */
595 EarlyPrint(L
"EFI Firmware Supported Mode %d is H: %d V: %d\n", Mode
, HRes
, VRes
);
596 ModeEntry
->HRes
= HRes
;
597 ModeEntry
->VRes
= VRes
;
598 ModeEntry
->HRes2
= HRes
;
599 MaxQueriedMode
= Mode
+ 1;
603 /* Loop all the supported mode entries */
604 for (i
= 0; i
< MaxIndex
; i
++)
606 /* Loop all the UEFI queried modes */
607 SupportedModeEntry
= &SupportedModes
[i
];
608 for (MatchingMode
= 0; MatchingMode
< MaxQueriedMode
; MatchingMode
++)
610 /* Check if the UEFI mode is compatible with our supported mode */
611 ModeEntry
= &ModeList
[MatchingMode
];
612 EarlyPrint(L
"H1: %d V1: %d - H2: %d - V2: %d\n", ModeEntry
->HRes
, ModeEntry
->VRes
, SupportedModeEntry
->HRes
, SupportedModeEntry
->VRes
);
613 if ((ModeEntry
->HRes
== SupportedModeEntry
->HRes
) &&
614 (ModeEntry
->VRes
== SupportedModeEntry
->VRes
))
616 /* Yep -- free the mode list and return this mode */
617 BlMmFreeHeap(ModeList
);
618 *SupportedMode
= MatchingMode
;
619 return STATUS_SUCCESS
;
624 /* We can't do anything -- there are no matching modes */
625 Status
= STATUS_UNSUCCESSFUL
;
626 BlMmFreeHeap(ModeList
);
631 ConsoleFirmwareTextClose (
632 _In_ PBL_TEXT_CONSOLE TextConsole
636 BL_DISPLAY_STATE DisplayState
;
638 /* Read the original mode, and see if it's different than the one now */
639 Mode
= TextConsole
->OldMode
.Mode
;
640 if (Mode
!= TextConsole
->Mode
)
642 /* Restore to the original mode */
643 EfiConOutSetMode(TextConsole
->Protocol
, Mode
);
646 /* Read the EFI settings for the original mode */
647 ConsoleEfiTextGetStateFromMode(&TextConsole
->OldMode
, &DisplayState
);
649 /* Set the original settings */
650 ConsoleFirmwareTextSetState(TextConsole
, 0xF, &DisplayState
);
654 ConsoleFirmwareTextOpen (
655 _In_ PBL_TEXT_CONSOLE TextConsole
658 BL_DISPLAY_MODE DisplayMode
;
659 EFI_SIMPLE_TEXT_OUTPUT_MODE CurrentMode
, NewMode
;
664 /* Read the current mode and its settings */
665 EfiConOutReadCurrentMode(EfiConOut
, &CurrentMode
);
666 Status
= EfiConOutQueryMode(EfiConOut
, CurrentMode
.Mode
, &HRes
, &VRes
);
667 if (!NT_SUCCESS(Status
))
672 /* Save the current mode and its settings */
673 NewMode
= CurrentMode
;
674 DisplayMode
.VRes
= VRes
;
675 DisplayMode
.HRes
= HRes
;
676 DisplayMode
.HRes2
= HRes
;
678 /* Check if the current mode is compatible with one of our modes */
679 if (!ConsolepFindResolution(&DisplayMode
, ConsoleTextResolutionList
, 1))
681 /* It isn't -- find a matching EFI mode for what we need */
682 EarlyPrint(L
"In incorrect mode, scanning for right one\n");
683 Status
= ConsoleEfiTextFindModeFromAllowed(EfiConOut
,
684 ConsoleTextResolutionList
,
687 if (!NT_SUCCESS(Status
))
689 EarlyPrint(L
"Failed to find mode: %lx\n", Status
);
693 /* Set the new EFI mode */
694 EarlyPrint(L
"Setting new mode: %d\n", Mode
);
695 Status
= EfiConOutSetMode(EfiConOut
, Mode
);
696 if (!NT_SUCCESS(Status
))
701 /* Read the current mode and its settings */
702 EfiConOutReadCurrentMode(EfiConOut
, &NewMode
);
703 Status
= EfiConOutQueryMode(EfiConOut
, Mode
, &HRes
, &VRes
);
704 if (!NT_SUCCESS(Status
))
706 EfiConOutSetMode(EfiConOut
, CurrentMode
.Mode
);
710 /* Save the current mode and its settings */
711 DisplayMode
.HRes
= HRes
;
712 DisplayMode
.VRes
= VRes
;
713 DisplayMode
.HRes2
= HRes
;
716 /* Capture all the current settings */
717 ConsoleEfiTextGetStateFromMode(&NewMode
, &TextConsole
->State
);
718 TextConsole
->Mode
= NewMode
.Mode
;
719 TextConsole
->DisplayMode
= DisplayMode
;
720 TextConsole
->Protocol
= EfiConOut
;
721 TextConsole
->OldMode
= CurrentMode
;
722 return STATUS_SUCCESS
;
726 ConsoleTextLocalDestruct (
727 _In_
struct _BL_TEXT_CONSOLE
* Console
730 return STATUS_NOT_IMPLEMENTED
;
734 ConsoleTextLocalReinitialize (
735 _In_
struct _BL_TEXT_CONSOLE
* Console
738 return STATUS_NOT_IMPLEMENTED
;
742 ConsoleTextBaseGetTextState (
743 _In_
struct _BL_TEXT_CONSOLE
* Console
,
744 _Out_ PBL_DISPLAY_STATE TextState
747 return STATUS_NOT_IMPLEMENTED
;
751 ConsoleTextLocalSetTextState (
752 _In_
struct _BL_TEXT_CONSOLE
* Console
,
754 _In_ PBL_DISPLAY_STATE TextState
757 return STATUS_NOT_IMPLEMENTED
;
761 ConsoleTextBaseGetTextResolution (
762 _In_
struct _BL_TEXT_CONSOLE
* Console
,
763 _Out_ PULONG TextResolution
766 return STATUS_NOT_IMPLEMENTED
;
770 ConsoleTextLocalSetTextResolution (
771 _In_
struct _BL_TEXT_CONSOLE
* Console
,
772 _In_ ULONG NewTextResolution
,
773 _Out_ PULONG OldTextResolution
776 return STATUS_NOT_IMPLEMENTED
;
780 ConsoleTextLocalClearText (
781 _In_
struct _BL_TEXT_CONSOLE
* Console
,
785 return STATUS_NOT_IMPLEMENTED
;
789 ConsoleTextLocalWriteText (
790 _In_
struct _BL_TEXT_CONSOLE
* Console
,
795 return STATUS_NOT_IMPLEMENTED
;
799 DsppGraphicsDisabledByBcd (
803 //EarlyPrint(L"Disabling graphics\n");
808 ConsoleTextLocalConstruct (
809 _In_ PBL_TEXT_CONSOLE TextConsole
,
810 _In_ BOOLEAN Activate
814 BL_DISPLAY_STATE TextState
;
816 /* Set our callbacks */
817 TextConsole
->Callbacks
= &ConsoleTextLocalVtbl
;
819 /* Are we activating this console? */
822 /* Call firmware to activate it */
823 Status
= ConsoleFirmwareTextOpen(TextConsole
);
824 if (!NT_SUCCESS(Status
))
826 EarlyPrint(L
"Failed to activate console: %lx\n", Status
);
831 /* Set default text state */
832 TextState
.BgColor
= 0;
835 TextState
.CursorVisible
= FALSE
;
836 TextState
.FgColor
= White
;
838 /* Are we activating? */
841 /* Call firmware to set it */
842 Status
= ConsoleFirmwareTextSetState(TextConsole
, 0xF, &TextState
);
843 if (!NT_SUCCESS(Status
))
845 /* We failed, back down */
846 EarlyPrint(L
"Failed to set console state: %lx\n", Status
);
847 ConsoleFirmwareTextClose(TextConsole
);
853 /* Just save the state for now, someone else can activate later */
854 TextConsole
->State
= TextState
;
857 /* Remember if we activated it */
858 TextConsole
->Active
= Activate
;
859 return STATUS_SUCCESS
;
867 BL_LIBRARY_PARAMETERS LibraryParameters
= BlpLibraryParameters
;
868 BOOLEAN NoGraphics
;// , HighestMode;
870 PBL_DISPLAY_MODE DisplayMode
;
871 //ULONG GraphicsResolution;
872 PVOID GraphicsConsole
;
873 // PVOID RemoteConsole;
874 PBL_TEXT_CONSOLE TextConsole
;
876 /* Initialize font data */
877 BfiCachedStrikeData
= 0;
878 InitializeListHead(&BfiDeferredListHead
);
879 InitializeListHead(&BfiFontFileListHead
);
881 /* Allocate the font rectangle */
882 // BfiGraphicsRectangle = BlMmAllocateHeap(0x5A);
883 //if (!BfiGraphicsRectangle)
885 //return STATUS_NO_MEMORY;
888 /* Display re-initialization not yet handled */
889 if (LibraryParameters
.LibraryFlags
& BL_LIBRARY_FLAG_REINITIALIZE_ALL
)
891 EarlyPrint(L
"Display path not handled\n");
892 return STATUS_NOT_SUPPORTED
;
895 /* Check if no graphics console is needed */
896 if ((Flags
& BL_LIBRARY_FLAG_NO_GRAPHICS_CONSOLE
) ||
897 (DsppGraphicsDisabledByBcd()))
904 /* No graphics -- remember this */
908 /* On first load, we always initialize a graphics display */
909 GraphicsConsole
= NULL
;
910 if (!(Flags
& BL_LIBRARY_FLAG_REINITIALIZE_ALL
) || !(NoGraphics
))
912 /* Default to mode 0 (1024x768) */
913 DisplayMode
= &ConsoleGraphicalResolutionList
[0];
915 /* Check what resolution to use*/
917 Status
= BlGetBootOptionInteger(BlpApplicationEntry
.BcdData
,
918 BcdLibraryInteger_GraphicsResolution
,
919 &GraphicsResolution
);
921 //GraphicsResolution = 0;
922 Status
= STATUS_NOT_FOUND
;
924 if (NT_SUCCESS(Status
))
926 EarlyPrint(L
"Display selection not yet handled\n");
927 return STATUS_NOT_IMPLEMENTED
;
930 /* Check if the highest mode should be forced */
932 Status
= BlGetBootOptionBoolean(BlpApplicationEntry
.BcdData
,
933 BcdLibraryBoolean_GraphicsForceHighestMode
,
937 Status
= STATUS_NOT_FOUND
;
939 if (NT_SUCCESS(Status
))
941 ConsoleGraphicalResolutionListFlags
|= 2;
944 /* Do we need graphics mode after all? */
947 EarlyPrint(L
"Display path not handled\n");
948 return STATUS_NOT_SUPPORTED
;
951 /* Are we using something else than the default mode? */
952 if (DisplayMode
!= &ConsoleGraphicalResolutionList
[0])
954 EarlyPrint(L
"Display path not handled\n");
955 return STATUS_NOT_SUPPORTED
;
958 /* Mask out all the flags now */
959 ConsoleGraphicalResolutionListFlags
&= ~3;
962 /* Do we have a graphics console? */
964 if (!GraphicsConsole
)
966 /* Nope -- go allocate a text console */
967 TextConsole
= BlMmAllocateHeap(sizeof(*TextConsole
));
971 Status
= ConsoleTextLocalConstruct(TextConsole
, TRUE
);
972 if (!NT_SUCCESS(Status
))
974 BlMmFreeHeap(TextConsole
);
980 /* Initialize all globals to NULL */
981 DspRemoteInputConsole
= NULL
;
982 DspTextConsole
= NULL
;
983 DspGraphicalConsole
= NULL
;
985 /* If we don't have a text console, go get a remote console */
986 //RemoteConsole = NULL;
989 EarlyPrint(L
"Display path not handled\n");
990 return STATUS_NOT_SUPPORTED
;
993 /* Do we have a remote console? */
994 if (!DspRemoteInputConsole
)
996 /* Nope -- what about a graphical one? */
999 /* Yes, use it for both graphics and text */
1000 DspGraphicalConsole
= GraphicsConsole
;
1001 DspTextConsole
= GraphicsConsole
;
1003 else if (TextConsole
)
1005 /* Nope, but we have a text console */
1006 DspTextConsole
= TextConsole
;
1009 /* Console has been setup */
1010 return STATUS_SUCCESS
;
1013 /* We have a remote console -- have to figure out how to use it*/
1014 EarlyPrint(L
"Display path not handled\n");
1015 return STATUS_NOT_SUPPORTED
;
1019 BlpDisplayInitialize (
1025 /* Are we resetting or initializing? */
1026 if (Flags
& BL_LIBRARY_FLAG_REINITIALIZE
)
1028 /* This is a reset */
1029 Status
= STATUS_NOT_IMPLEMENTED
;
1031 Status
= DsppReinitialize(Flags
);
1032 if (NT_SUCCESS(Status
))
1034 Status
= BlpDisplayReinitialize();
1040 /* Initialize the display */
1041 Status
= DsppInitialize(Flags
);
1044 /* Return display initailziation state */
1049 BlDisplayGetTextCellResolution (
1050 _Out_ PULONG TextWidth
,
1051 _Out_ PULONG TextHeight
1056 /* If the caller doesn't want anything, bail out */
1057 if (!(TextWidth
) || !(TextHeight
))
1062 /* Do we have a text console? */
1063 Status
= STATUS_UNSUCCESSFUL
;
1066 /* Do we have a graphics console? */
1067 if (DspGraphicalConsole
)
1069 /* Yep -- query it */
1070 EarlyPrint(L
"Not supported\n");
1071 Status
= STATUS_NOT_IMPLEMENTED
;
1075 /* Check if we failed to get it from the graphics console */
1076 if (!NT_SUCCESS(Status
))
1078 /* Set default text size */