diff options
author | Olivier Fourdan <ofourdan@redhat.com> | 2016-02-05 09:48:20 +0100 |
---|---|---|
committer | Adam Jackson <ajax@redhat.com> | 2016-02-29 16:28:55 -0500 |
commit | e29a64de662112b8ebcd3f20c89df0e8c51890ef (patch) | |
tree | 3a0bb8c1d1c5f863fd59655013302f0868586881 | |
parent | b7962ade5265a21ac7c60da6cc07ece15ef7e648 (diff) |
vidmode: remove mode access from public API
The mode access functions (namely VidModeCreateMode(),
VidModeCopyMode(), VidModeGetModeValue() and VidModeSetModeValue()) are
used only in xf86VidMode code and do not need to be available anywhere
else.
Remove these functions from the public VidMode API and move them as
static where they are used.
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
-rw-r--r-- | hw/xfree86/common/vidmodeproc.h | 4 | ||||
-rw-r--r-- | hw/xfree86/common/xf86VidMode.c | 106 | ||||
-rw-r--r-- | hw/xfree86/common/xf86vmode.c | 109 |
3 files changed, 108 insertions, 111 deletions
diff --git a/hw/xfree86/common/vidmodeproc.h b/hw/xfree86/common/vidmodeproc.h index 3cc8fc17d..3919a0c34 100644 --- a/hw/xfree86/common/vidmodeproc.h +++ b/hw/xfree86/common/vidmodeproc.h @@ -67,10 +67,6 @@ extern Bool VidModeSetGamma(ScreenPtr pScreen, float red, float green, float blue); extern Bool VidModeGetGamma(ScreenPtr pScreen, float *red, float *green, float *blue); -extern DisplayModePtr VidModeCreateMode(void); -extern void VidModeCopyMode(DisplayModePtr modefrom, DisplayModePtr modeto); -extern int VidModeGetModeValue(DisplayModePtr mode, int valtyp); -extern void VidModeSetModeValue(DisplayModePtr mode, int valtyp, int val); extern vidMonitorValue VidModeGetMonitorValue(ScreenPtr pScreen, int valtyp, int indx); extern Bool VidModeSetGammaRamp(ScreenPtr, int, CARD16 *, CARD16 *, diff --git a/hw/xfree86/common/xf86VidMode.c b/hw/xfree86/common/xf86VidMode.c index 5f596b5af..2d87daabd 100644 --- a/hw/xfree86/common/xf86VidMode.c +++ b/hw/xfree86/common/xf86VidMode.c @@ -456,112 +456,6 @@ VidModeGetGammaRampSize(ScreenPtr pScreen) return xf86GetGammaRampSize(pScreen); } -DisplayModePtr -VidModeCreateMode(void) -{ - DisplayModePtr mode; - - mode = malloc(sizeof(DisplayModeRec)); - if (mode != NULL) { - mode->name = ""; - mode->VScan = 1; /* divides refresh rate. default = 1 */ - mode->Private = NULL; - mode->next = mode; - mode->prev = mode; - } - return mode; -} - -void -VidModeCopyMode(DisplayModePtr modefrom, DisplayModePtr modeto) -{ - memcpy(modeto, modefrom, sizeof(DisplayModeRec)); -} - -int -VidModeGetModeValue(DisplayModePtr mode, int valtyp) -{ - int ret = 0; - - switch (valtyp) { - case VIDMODE_H_DISPLAY: - ret = mode->HDisplay; - break; - case VIDMODE_H_SYNCSTART: - ret = mode->HSyncStart; - break; - case VIDMODE_H_SYNCEND: - ret = mode->HSyncEnd; - break; - case VIDMODE_H_TOTAL: - ret = mode->HTotal; - break; - case VIDMODE_H_SKEW: - ret = mode->HSkew; - break; - case VIDMODE_V_DISPLAY: - ret = mode->VDisplay; - break; - case VIDMODE_V_SYNCSTART: - ret = mode->VSyncStart; - break; - case VIDMODE_V_SYNCEND: - ret = mode->VSyncEnd; - break; - case VIDMODE_V_TOTAL: - ret = mode->VTotal; - break; - case VIDMODE_FLAGS: - ret = mode->Flags; - break; - case VIDMODE_CLOCK: - ret = mode->Clock; - break; - } - return ret; -} - -void -VidModeSetModeValue(DisplayModePtr mode, int valtyp, int val) -{ - switch (valtyp) { - case VIDMODE_H_DISPLAY: - mode->HDisplay = val; - break; - case VIDMODE_H_SYNCSTART: - mode->HSyncStart = val; - break; - case VIDMODE_H_SYNCEND: - mode->HSyncEnd = val; - break; - case VIDMODE_H_TOTAL: - mode->HTotal = val; - break; - case VIDMODE_H_SKEW: - mode->HSkew = val; - break; - case VIDMODE_V_DISPLAY: - mode->VDisplay = val; - break; - case VIDMODE_V_SYNCSTART: - mode->VSyncStart = val; - break; - case VIDMODE_V_SYNCEND: - mode->VSyncEnd = val; - break; - case VIDMODE_V_TOTAL: - mode->VTotal = val; - break; - case VIDMODE_FLAGS: - mode->Flags = val; - break; - case VIDMODE_CLOCK: - mode->Clock = val; - break; - } - return; -} - vidMonitorValue VidModeGetMonitorValue(ScreenPtr pScreen, int valtyp, int indx) { diff --git a/hw/xfree86/common/xf86vmode.c b/hw/xfree86/common/xf86vmode.c index b74ec6e35..90216cc06 100644 --- a/hw/xfree86/common/xf86vmode.c +++ b/hw/xfree86/common/xf86vmode.c @@ -76,7 +76,114 @@ static unsigned char XF86VidModeReqCode = 0; #else #define DEBUG_P(x) /**/ #endif - static int + +static DisplayModePtr +VidModeCreateMode(void) +{ + DisplayModePtr mode; + + mode = malloc(sizeof(DisplayModeRec)); + if (mode != NULL) { + mode->name = ""; + mode->VScan = 1; /* divides refresh rate. default = 1 */ + mode->Private = NULL; + mode->next = mode; + mode->prev = mode; + } + return mode; +} + +static void +VidModeCopyMode(DisplayModePtr modefrom, DisplayModePtr modeto) +{ + memcpy(modeto, modefrom, sizeof(DisplayModeRec)); +} + +static int +VidModeGetModeValue(DisplayModePtr mode, int valtyp) +{ + int ret = 0; + + switch (valtyp) { + case VIDMODE_H_DISPLAY: + ret = mode->HDisplay; + break; + case VIDMODE_H_SYNCSTART: + ret = mode->HSyncStart; + break; + case VIDMODE_H_SYNCEND: + ret = mode->HSyncEnd; + break; + case VIDMODE_H_TOTAL: + ret = mode->HTotal; + break; + case VIDMODE_H_SKEW: + ret = mode->HSkew; + break; + case VIDMODE_V_DISPLAY: + ret = mode->VDisplay; + break; + case VIDMODE_V_SYNCSTART: + ret = mode->VSyncStart; + break; + case VIDMODE_V_SYNCEND: + ret = mode->VSyncEnd; + break; + case VIDMODE_V_TOTAL: + ret = mode->VTotal; + break; + case VIDMODE_FLAGS: + ret = mode->Flags; + break; + case VIDMODE_CLOCK: + ret = mode->Clock; + break; + } + return ret; +} + +static void +VidModeSetModeValue(DisplayModePtr mode, int valtyp, int val) +{ + switch (valtyp) { + case VIDMODE_H_DISPLAY: + mode->HDisplay = val; + break; + case VIDMODE_H_SYNCSTART: + mode->HSyncStart = val; + break; + case VIDMODE_H_SYNCEND: + mode->HSyncEnd = val; + break; + case VIDMODE_H_TOTAL: + mode->HTotal = val; + break; + case VIDMODE_H_SKEW: + mode->HSkew = val; + break; + case VIDMODE_V_DISPLAY: + mode->VDisplay = val; + break; + case VIDMODE_V_SYNCSTART: + mode->VSyncStart = val; + break; + case VIDMODE_V_SYNCEND: + mode->VSyncEnd = val; + break; + case VIDMODE_V_TOTAL: + mode->VTotal = val; + break; + case VIDMODE_FLAGS: + mode->Flags = val; + break; + case VIDMODE_CLOCK: + mode->Clock = val; + break; + } + return; +} + +static int ClientMajorVersion(ClientPtr client) { VidModePrivPtr pPriv; |