kdrive: add OS/platform callback for screen enable/disable

New OS/platform callbacks that are called when screens are enabled
or disabled. This allows individual Kdrive implementations to take
specific action, eg. configure/reset graphics hardware.

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
stefan11111
2025-07-06 17:16:44 +03:00
committed by Enrico Weigelt
parent 889dc612cf
commit b75dfe3d58
2 changed files with 8 additions and 2 deletions

View File

@@ -154,6 +154,8 @@ static void
KdDisableScreens(void)
{
KdSuspend();
if (kdEnabled && (kdOsFuncs->Disable))
kdOsFuncs->Disable();
kdEnabled = FALSE;
}
@@ -604,6 +606,8 @@ Bool KdCloseScreen(ScreenPtr pScreen)
* Clean up OS when last card is closed
*/
if (card == kdCardInfo) {
if (kdEnabled && (kdOsFuncs->Disable))
kdOsFuncs->Disable();
kdEnabled = FALSE;
}
}
@@ -818,6 +822,8 @@ KdScreenInit(ScreenPtr pScreen, int argc, char **argv)
/*
* Enable the hardware
*/
if ((!kdEnabled) && (kdOsFuncs->Enable))
kdOsFuncs->Enable();
kdEnabled = TRUE;
if (screen->mynum == card->selected) {

View File

@@ -280,9 +280,9 @@ void KdRemoveKeyboard(KdKeyboardInfo * ki);
typedef struct _KdOsFuncs {
int (*Init) (void); /* Only called when the X server is started, when serverGeneration == 1 */
void (*Enable) (void);
void (*Enable) (void); /* called when screen is enabled */
void (*Disable) (void); /* called when screen is disabled */
Bool (*SpecialKey) (KeySym);
void (*Disable) (void);
void (*Fini) (void);
void (*pollEvents) (void);
void (*Bell) (int, int, int); /* if not NULL called instead of the keyboard driver's function */