vmware: Fix build warnings

Due to following commit in xserver there were
build warnings, as variables now declared const.

d89b42bda46d36fc0879611cc3b3566957ce36d0
e1e01d2e33c632e395d7e396f73fba8ae606b15a

Added a compat header file.

Signed-off-by: Deepak Rawat <drawat@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>:q
This commit is contained in:
Deepak Singh Rawat
2017-08-07 15:57:56 -07:00
committed by Sinclair Yeh
parent ed0fd2f282
commit d8c2f85013
6 changed files with 32 additions and 15 deletions

View File

@@ -2,7 +2,7 @@
if BUILD_VMWGFX
noinst_LTLIBRARIES = libsaa.la
libsaa_la_CFLAGS = $(CWARNFLAGS) $(XORG_CFLAGS)
libsaa_la_CFLAGS = $(CWARNFLAGS) $(XORG_CFLAGS) -I$(top_srcdir)/src
libsaa_la_LDFLAGS = -static
libsaa_la_SOURCES = \
saa.c \

View File

@@ -59,14 +59,15 @@
#include "glyphstr.h"
#endif
#include "damage.h"
#include "common_compat.h"
#define SAA_INVALID_ADDRESS \
((void *) ((unsigned long) 0xFFFFFFFF - 1024*1024))
struct saa_gc_priv {
/* GC values from the layer below. */
GCOps *saved_ops;
GCFuncs *saved_funcs;
CONST_ABI_18_0 GCOps *saved_ops;
CONST_ABI_18_0 GCFuncs *saved_funcs;
};
struct saa_screen_priv {
@@ -127,7 +128,7 @@ do { \
}
#define saa_swap(priv, real, mem) {\
void *tmp = (priv)->saved_##mem; \
CONST_ABI_18_0 void *tmp = (priv)->saved_##mem; \
(priv)->saved_##mem = (real)->mem; \
(real)->mem = tmp; \
}

11
src/common_compat.h Normal file
View File

@@ -0,0 +1,11 @@
#ifndef _COMMON_COMPAT_H_
#define _COMMOM_COMPAT_H_
#if (GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 18)
#define CONST_ABI_18_0 const
#else
#define CONST_ABI_18_0
#endif
#endif

View File

@@ -36,6 +36,7 @@ char rcsId_vmware[] =
#include "svga_modes.h"
#include "vmware_bootstrap.h"
#include "vmware_common.h"
#include "common_compat.h"
#ifndef HAVE_XORG_SERVER_1_5_0
#include <xf86_ansic.h>
@@ -1222,12 +1223,14 @@ VMWAREAddDisplayMode(ScrnInfoPtr pScrn,
int height)
{
DisplayModeRec *mode;
char * modeName;
mode = malloc(sizeof(DisplayModeRec));
memset(mode, 0, sizeof *mode);
mode->name = malloc(strlen(name) + 1);
strcpy(mode->name, name);
modeName = malloc(strlen(name) + 1);
strcpy(modeName, name);
mode->name = modeName;
mode->status = MODE_OK;
mode->type = M_T_DEFAULT;
mode->HDisplay = width;
@@ -1324,7 +1327,7 @@ VMWAREScreenInit(SCREEN_INIT_ARGS_DECL)
if (useXinerama && xf86IsOptionSet(options, OPTION_GUI_LAYOUT)) {
char *topology = xf86GetOptValString(options, OPTION_GUI_LAYOUT);
CONST_ABI_18_0 char *topology = xf86GetOptValString(options, OPTION_GUI_LAYOUT);
if (topology) {
pVMWARE->xineramaState =
VMWAREParseTopologyString(pScrn, topology,
@@ -1332,11 +1335,11 @@ VMWAREScreenInit(SCREEN_INIT_ARGS_DECL)
pVMWARE->xineramaStatic = pVMWARE->xineramaState != NULL;
free(topology);
free((void *)topology);
}
} else if (useXinerama &&
xf86IsOptionSet(options, OPTION_STATIC_XINERAMA)) {
char *topology = xf86GetOptValString(options, OPTION_STATIC_XINERAMA);
CONST_ABI_18_0 char *topology = xf86GetOptValString(options, OPTION_STATIC_XINERAMA);
if (topology) {
pVMWARE->xineramaState =
VMWAREParseTopologyString(pScrn, topology,
@@ -1345,7 +1348,7 @@ VMWAREScreenInit(SCREEN_INIT_ARGS_DECL)
pVMWARE->xineramaStatic = pVMWARE->xineramaState != NULL;
free(topology);
free((void *)topology);
}
}

View File

@@ -40,6 +40,7 @@
#endif
#include "vm_basic_types.h"
#include "vmware.h"
#include "common_compat.h"
#ifndef M_T_DRIVER
# define M_T_DRIVER 0x40 /* Supplied by the driver (EDID, etc) */
@@ -83,7 +84,7 @@ vmwareAddDefaultMode(ScrnInfoPtr pScrn, uint32 dwidth, uint32 dheight)
DisplayModeRec dynamic =
{ MODEPREFIX, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, MODESUFFIX };
unsigned dispModeCount = 0;
char **dispModeList;
CONST_ABI_18_0 char **dispModeList;
char *dynModeName;
char name[80];
VMWAREPtr pVMWARE = VMWAREPTR(pScrn);

View File

@@ -68,6 +68,7 @@
#include "../src/vmware_bootstrap.h"
#include "../src/vmware_common.h"
#include "vmwgfx_hosted.h"
#include "common_compat.h"
/*
* We can't incude svga_types.h due to conflicting types for Bool.
@@ -410,23 +411,23 @@ vmwgfx_pre_init_mode(ScrnInfoPtr pScrn, int flags)
}
if (xf86IsOptionSet(ms->Options, OPTION_GUI_LAYOUT)) {
char *topology =
CONST_ABI_18_0 char *topology =
xf86GetOptValString(ms->Options, OPTION_GUI_LAYOUT);
ret = FALSE;
if (topology) {
ret = vmwgfx_set_topology(pScrn, topology, "gui");
free(topology);
free((void *)topology);
}
} else if (xf86IsOptionSet(ms->Options, OPTION_STATIC_XINERAMA)) {
char *topology =
CONST_ABI_18_0 char *topology =
xf86GetOptValString(ms->Options, OPTION_STATIC_XINERAMA);
ret = FALSE;
if (topology) {
ret = vmwgfx_set_topology(pScrn, topology, "static Xinerama");
free(topology);
free((void *)topology);
}
}