mirror of
https://github.com/X11Libre/xserver.git
synced 2026-11-15 05:23:40 +00:00
Xext: dpms: refactor entrypoints for DIX/DDX
Refactor the entry pointer header, add documentation and move it to a more suitable place. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
parent
29cc25065b
commit
6cbd9ee388
15 changed files with 162 additions and 46 deletions
|
|
@ -39,6 +39,7 @@ Equipment Corporation.
|
|||
#include "miext/extinit_priv.h"
|
||||
#include "os/screensaver.h"
|
||||
#include "os/osdep.h"
|
||||
#include "Xext/dpms/dpms_priv.h"
|
||||
#include "Xext/geext_priv.h"
|
||||
|
||||
#include "misc.h"
|
||||
|
|
@ -46,7 +47,6 @@ Equipment Corporation.
|
|||
#include "dixstruct.h"
|
||||
#include "extnsionst.h"
|
||||
#include "opaque.h"
|
||||
#include "dpmsproc.h"
|
||||
#include "scrnintstr.h"
|
||||
#include "windowstr.h"
|
||||
#include "protocol-versions.h"
|
||||
|
|
|
|||
122
Xext/dpms/dpms_priv.h
Normal file
122
Xext/dpms/dpms_priv.h
Normal file
|
|
@ -0,0 +1,122 @@
|
|||
/* SPDX-License-Identifier: MIT OR X11 OR AGPL-3.0-or-later
|
||||
*
|
||||
* DPMS (Display Power Management Signaling) — interface between the
|
||||
* DPMS extension and other parts (DIX, DDX, OS).
|
||||
*
|
||||
* Copyright © 2026 Enrico Weigelt, metux IT consult <info@metux.net>
|
||||
*
|
||||
* This header is NOT part of the driver API. Drivers must NOT
|
||||
* include it. It is for use by the extension, DIX, and DDX only.
|
||||
*
|
||||
* DDX is assumed to provide entry point via ScreenRec->DPMS() and set
|
||||
* several variables (eg. DPMSStandbyTime, DPMSDisabledSwitch, etc)
|
||||
* on startup.
|
||||
*
|
||||
* Timeout variables (DPMSStandbyTime, DPMSSuspendTime, DPMSOffTime)
|
||||
* are in milliseconds. They are initialised to ~0 (UINT32_MAX) in
|
||||
* Xext/dpms.c, which the extension treats as "use ScreenSaverTime".
|
||||
* The DDX may override them during InitOutput (e.g. xf86Config.c
|
||||
* reads them from the command line / config file and converts from
|
||||
* minutes to milliseconds).
|
||||
*
|
||||
* Power levels are defined in <X11/extensions/dpmsconst.h>:
|
||||
* DPMSModeOn 0 full power
|
||||
* DPMSModeStandby 1 minimal signal, fast resume
|
||||
* DPMSModeSuspend 2 deeper sleep, slower resume
|
||||
* DPMSModeOff 3 most power saving
|
||||
*/
|
||||
|
||||
#ifndef _DPMS_PRIV_H_
|
||||
#define _DPMS_PRIV_H_
|
||||
|
||||
#include <dix-config.h>
|
||||
|
||||
#include "dixstruct.h"
|
||||
|
||||
/**
|
||||
* Set a new DPMS power level for every screen.
|
||||
*
|
||||
* Called by:
|
||||
* - WaitFor.c (timer-driven automatic transitions)
|
||||
* - mieq.c (any input event wakes the displays)
|
||||
* - xf86Init.c (abort path — restore video before dying)
|
||||
* - xf86Events.c(VT switch — restore before leaving VT)
|
||||
* - dpms.c (Disable, ForceLevel, CloseDown)
|
||||
*
|
||||
* Implementation:
|
||||
* Saves old DPMSPowerLevel, updates it to @level, co-ordinates
|
||||
* with the screen saver (blank/unblank if needed), then calls
|
||||
* walkScreen->DPMS(walkScreen, level) for every screen whose
|
||||
* DPMS callback is non-NULL.
|
||||
*
|
||||
* @client the client requesting the change (may be serverClient)
|
||||
* @level one of DPMSModeOn/Standby/Suspend/Off
|
||||
* @return Success on success, or a dixSaveScreens error code.
|
||||
*/
|
||||
extern int DPMSSet(ClientPtr client, int level);
|
||||
|
||||
/**
|
||||
* Query whether DPMS is supported by any screen.
|
||||
*
|
||||
* Returns TRUE if at least one screen (or GPU screen) has a non-NULL
|
||||
* DPMS function pointer. Called during DPMSExtensionInit to decide
|
||||
* whether to register the extension at all, and by the Info request
|
||||
* to report the DPMS state.
|
||||
*/
|
||||
extern Bool DPMSSupported(void);
|
||||
|
||||
/**
|
||||
* Standby timeout in milliseconds.
|
||||
*
|
||||
* The idle time after which the server transitions to DPMS standby
|
||||
* mode. -1 (UINT32_MAX) at init; DPMSExtensionInit falls back to
|
||||
* ScreenSaverTime. The DDX may set this via configuration
|
||||
* (e.g. xf86Config reads the "StandbyTime" option).
|
||||
*/
|
||||
extern CARD32 DPMSStandbyTime;
|
||||
|
||||
/**
|
||||
* Suspend timeout in milliseconds.
|
||||
*
|
||||
* The idle time after which the server transitions to DPMS suspend
|
||||
* mode. Semantics match DPMSStandbyTime.
|
||||
*/
|
||||
extern CARD32 DPMSSuspendTime;
|
||||
|
||||
/**
|
||||
* Off timeout in milliseconds.
|
||||
*
|
||||
* The idle time after which the server transitions to DPMS off
|
||||
* mode. Semantics match DPMSStandbyTime.
|
||||
*/
|
||||
extern CARD32 DPMSOffTime;
|
||||
|
||||
/**
|
||||
* Current DPMS power level.
|
||||
*
|
||||
* One of DPMSModeOn (0), DPMSModeStandby (1), DPMSModeSuspend (2),
|
||||
* or DPMSModeOff (3). Modified by DPMSSet() and queried by
|
||||
* WaitFor.c (for timeout scheduling), mieq.c (wake on input),
|
||||
* Xext/saver.c (coexistence with screen saver), xf86Init.c and
|
||||
* xf86Events.c (restore before abort/VT switch).
|
||||
*/
|
||||
extern CARD16 DPMSPowerLevel;
|
||||
|
||||
/**
|
||||
* Whether the DPMS extension is currently enabled.
|
||||
*
|
||||
* Set to DPMSSupported() during DPMSExtensionInit. May be toggled
|
||||
* by the DPMS Enable/Disable protocol requests. When FALSE, the
|
||||
* timeout machinery in WaitFor.c skips DPMS transitions entirely.
|
||||
*/
|
||||
extern Bool DPMSEnabled;
|
||||
|
||||
/**
|
||||
* Set TRUE when the "-dpms" command-line flag is used.
|
||||
*
|
||||
* Checked by the DDX (xf86DPMSInit) to suppress DPMS initialisation
|
||||
* even when the config file requests it. Set by ddxProcessArgument().
|
||||
*/
|
||||
extern Bool DPMSDisabledSwitch;
|
||||
|
||||
#endif
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
/* Prototypes for functions that the DDX must provide */
|
||||
|
||||
#ifndef _DPMSPROC_H_
|
||||
#define _DPMSPROC_H_
|
||||
|
||||
#include <dix-config.h>
|
||||
|
||||
#include "dixstruct.h"
|
||||
|
||||
extern int DPMSSet(ClientPtr client, int level);
|
||||
extern Bool DPMSSupported(void);
|
||||
|
||||
extern CARD32 DPMSStandbyTime;
|
||||
extern CARD32 DPMSSuspendTime;
|
||||
extern CARD32 DPMSOffTime;
|
||||
extern CARD16 DPMSPowerLevel;
|
||||
extern Bool DPMSEnabled;
|
||||
extern Bool DPMSDisabledSwitch;
|
||||
|
||||
#endif
|
||||
|
|
@ -44,6 +44,9 @@ in this Software without prior written authorization from the X Consortium.
|
|||
#include "miext/extinit_priv.h"
|
||||
#include "os/osdep.h"
|
||||
#include "os/screensaver.h"
|
||||
#ifdef DPMSExtension
|
||||
#include "Xext/dpms/dpms_priv.h"
|
||||
#endif
|
||||
#include "Xext/panoramiX.h"
|
||||
#include "Xext/panoramiXsrv.h"
|
||||
|
||||
|
|
@ -61,7 +64,6 @@ in this Software without prior written authorization from the X Consortium.
|
|||
#include "inputstr.h"
|
||||
#ifdef DPMSExtension
|
||||
#include <X11/extensions/dpmsconst.h>
|
||||
#include "dpmsproc.h"
|
||||
#endif
|
||||
#include "protocol-versions.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -104,6 +104,9 @@ Equipment Corporation.
|
|||
#include "os/osdep.h"
|
||||
#include "os/screensaver.h"
|
||||
#include "os/serverlock.h"
|
||||
#ifdef DPMSExtension
|
||||
#include "Xext/dpms/dpms_priv.h"
|
||||
#endif
|
||||
#include "Xext/panoramiXsrv.h"
|
||||
|
||||
#include "scrnintstr.h"
|
||||
|
|
@ -123,7 +126,6 @@ Equipment Corporation.
|
|||
|
||||
#ifdef DPMSExtension
|
||||
#include <X11/extensions/dpmsconst.h>
|
||||
#include "dpmsproc.h"
|
||||
#endif
|
||||
|
||||
extern void Dispatch(void);
|
||||
|
|
|
|||
|
|
@ -32,6 +32,9 @@
|
|||
#include "os/cmdline.h"
|
||||
#include "os/ddx_priv.h"
|
||||
#include "os/osdep.h"
|
||||
#ifdef DPMSExtension
|
||||
#include "Xext/dpms/dpms_priv.h"
|
||||
#endif
|
||||
|
||||
#include "kdrive.h"
|
||||
#include <dixstruct.h>
|
||||
|
|
@ -49,10 +52,6 @@
|
|||
#include "kxv.h"
|
||||
#endif
|
||||
|
||||
#ifdef DPMSExtension
|
||||
#include "dpmsproc.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_EXECINFO_H
|
||||
#include <execinfo.h>
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -55,6 +55,9 @@
|
|||
#include "os/log_priv.h"
|
||||
#include "os/osdep.h"
|
||||
#include "xkb/xkbsrv_priv.h"
|
||||
#ifdef DPMSExtension
|
||||
#include "Xext/dpms/dpms_priv.h"
|
||||
#endif
|
||||
|
||||
#include "xf86_priv.h"
|
||||
#include "xf86Modes.h"
|
||||
|
|
@ -72,9 +75,6 @@
|
|||
#include "xf86Xinput_priv.h"
|
||||
|
||||
#include "picture.h"
|
||||
#ifdef DPMSExtension
|
||||
#include "dpmsproc.h"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* These paths define the way the config file search is done. The escape
|
||||
|
|
|
|||
|
|
@ -36,10 +36,15 @@
|
|||
#include "xf86.h"
|
||||
#include "xf86Priv.h"
|
||||
#include "xf86Opt_priv.h"
|
||||
|
||||
#ifdef DPMSExtension
|
||||
#include <X11/extensions/dpmsconst.h>
|
||||
#include "dpmsproc.h"
|
||||
#endif
|
||||
|
||||
#ifdef DPMSExtension
|
||||
#include "Xext/dpms/dpms_priv.h"
|
||||
#endif
|
||||
|
||||
#include "xf86VGAarbiter_priv.h"
|
||||
|
||||
#ifdef DPMSExtension
|
||||
|
|
|
|||
|
|
@ -64,6 +64,9 @@
|
|||
#include "hw/xfree86/common/action_priv.h"
|
||||
#include "mi/mi_priv.h"
|
||||
#include "os/log_priv.h"
|
||||
#ifdef DPMSExtension
|
||||
#include "Xext/dpms/dpms_priv.h"
|
||||
#endif
|
||||
|
||||
#include "misc.h"
|
||||
#include "xf86_priv.h"
|
||||
|
|
@ -85,7 +88,6 @@
|
|||
|
||||
#ifdef DPMSExtension
|
||||
#include <X11/extensions/dpmsconst.h>
|
||||
#include "dpmsproc.h"
|
||||
#endif
|
||||
|
||||
#include "../os-support/linux/systemd-logind.h"
|
||||
|
|
|
|||
|
|
@ -60,6 +60,9 @@
|
|||
#include "os/log_priv.h"
|
||||
#include "os/osdep.h"
|
||||
#include "randr/randrstr_priv.h"
|
||||
#ifdef DPMSExtension
|
||||
#include "Xext/dpms/dpms_priv.h"
|
||||
#endif
|
||||
|
||||
#include "servermd.h"
|
||||
#include "windowstr.h"
|
||||
|
|
@ -89,7 +92,6 @@
|
|||
|
||||
#ifdef DPMSExtension
|
||||
#include <X11/extensions/dpmsconst.h>
|
||||
#include "dpmsproc.h"
|
||||
#endif
|
||||
|
||||
#ifdef __linux__
|
||||
|
|
|
|||
|
|
@ -26,6 +26,9 @@ is" without express or implied warranty.
|
|||
#include "os/ddx_priv.h"
|
||||
#include "os/log_priv.h"
|
||||
#include "os/osdep.h"
|
||||
#ifdef DPMSExtension
|
||||
#include "Xext/dpms/dpms_priv.h"
|
||||
#endif
|
||||
|
||||
#include "screenint.h"
|
||||
#include "input.h"
|
||||
|
|
@ -47,9 +50,6 @@ is" without express or implied warranty.
|
|||
#include "Drawable.h"
|
||||
#include "XNGC.h"
|
||||
#include "XNFont.h"
|
||||
#ifdef DPMSExtension
|
||||
#include "dpmsproc.h"
|
||||
#endif
|
||||
|
||||
Bool xnestDoFullGeneration = TRUE;
|
||||
|
||||
|
|
|
|||
|
|
@ -39,13 +39,13 @@ from The Open Group.
|
|||
#include "os/log_priv.h"
|
||||
#include "os/osdep.h"
|
||||
#include "xkb/xkbsrv_priv.h"
|
||||
#ifdef DPMSExtension
|
||||
#include "Xext/dpms/dpms_priv.h"
|
||||
#endif
|
||||
|
||||
#include "winmsg.h"
|
||||
#include "winconfig.h"
|
||||
#include "winprefs.h"
|
||||
#ifdef DPMSExtension
|
||||
#include "dpmsproc.h"
|
||||
#endif
|
||||
#ifdef __CYGWIN__
|
||||
#include <mntent.h>
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -49,9 +49,12 @@ in this Software without prior written authorization from The Open Group.
|
|||
#include "mi/mi_priv.h"
|
||||
#include "mi/mipointer_priv.h"
|
||||
#include "os/bug_priv.h"
|
||||
#include "os/screensaver.h"
|
||||
#include "os/screensaver.h"
|
||||
#ifdef DPMSExtension
|
||||
#include "Xext/dpms/dpms_priv.h"
|
||||
#endif
|
||||
|
||||
#include "misc.h"
|
||||
#include "misc.h"
|
||||
#include "windowstr.h"
|
||||
#include "pixmapstr.h"
|
||||
#include "inputstr.h"
|
||||
|
|
@ -60,7 +63,6 @@ in this Software without prior written authorization from The Open Group.
|
|||
#include "eventstr.h"
|
||||
|
||||
#ifdef DPMSExtension
|
||||
#include "dpmsproc.h"
|
||||
#include <X11/extensions/dpmsconst.h>
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -68,14 +68,14 @@ SOFTWARE.
|
|||
#include "os/client_priv.h"
|
||||
#include "os/ossock.h"
|
||||
#include "os/screensaver.h"
|
||||
#ifdef DPMSExtension
|
||||
#include "Xext/dpms/dpms_priv.h"
|
||||
#endif
|
||||
|
||||
#include "misc.h"
|
||||
#include "osdep.h"
|
||||
#include "dixstruct_priv.h"
|
||||
#include "globals.h"
|
||||
#ifdef DPMSExtension
|
||||
#include "dpmsproc.h"
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
/* Error codes from windows sockets differ from fileio error codes */
|
||||
|
|
|
|||
|
|
@ -118,6 +118,7 @@ __stdcall unsigned long GetTickCount(void);
|
|||
#include "os/serverlock.h"
|
||||
#include "os/xhostname.h"
|
||||
#include "present/present_priv.h"
|
||||
#include "Xext/dpms/dpms_priv.h"
|
||||
#include "Xext/xf86bigfontsrv.h" /* XF86BigfontCleanup() */
|
||||
#include "xkb/xkbsrv_priv.h"
|
||||
|
||||
|
|
@ -125,7 +126,6 @@ __stdcall unsigned long GetTickCount(void);
|
|||
#include "picture.h"
|
||||
#include "miinitext.h"
|
||||
#include "dixstruct_priv.h"
|
||||
#include "dpmsproc.h"
|
||||
|
||||
#define X_INCLUDE_NETDB_H
|
||||
#include <X11/Xos_r.h>
|
||||
|
|
|
|||
Loading…
Reference in a new issue