[PATCH 06/12] vidmode: remove mode access from public API
Olivier Fourdan
ofourdan at redhat.com
Fri Feb 5 08:48:20 UTC 2016
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.
Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
---
hw/xfree86/common/vidmodeproc.h | 4 --
hw/xfree86/common/xf86VidMode.c | 106 --------------------------------------
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 3cc8fc1..3919a0c 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 5f596b5..2d87daa 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 b74ec6e..90216cc 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;
--
2.5.0
More information about the xorg-devel
mailing list