diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2014-09-27 17:53:06 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2014-09-27 17:53:06 +0000 |
commit | 4a4018aabb79405f1b50809f76e4bff4d0ead33c (patch) | |
tree | bbe31c32ce7b90f7ca8124d215cd1bc28516a259 | |
parent | 340ecc70b63a19bbc23b3ffc950d5beb49220505 (diff) |
Update to xserver 1.16.1.
Tested by naddy@, jsg@ & kettenis@
692 files changed, 40202 insertions, 7848 deletions
diff --git a/xserver/Xext/Makefile.am b/xserver/Xext/Makefile.am index 8e31f1367..a9a446820 100644 --- a/xserver/Xext/Makefile.am +++ b/xserver/Xext/Makefile.am @@ -1,4 +1,4 @@ -noinst_LTLIBRARIES = libXext.la +noinst_LTLIBRARIES = libXext.la libXextdpmsstubs.la AM_CFLAGS = $(DIX_CFLAGS) @@ -96,6 +96,8 @@ endif libXext_la_SOURCES = $(BUILTIN_SRCS) libXext_la_LIBADD = $(BUILTIN_LIBS) +libXextdpmsstubs_la_SOURCES = dpmsstubs.c + EXTRA_DIST = \ $(MITSHM_SRCS) \ $(XV_SRCS) \ diff --git a/xserver/Xext/Makefile.in b/xserver/Xext/Makefile.in index 1184846cd..1582bb2a6 100644 --- a/xserver/Xext/Makefile.in +++ b/xserver/Xext/Makefile.in @@ -130,6 +130,9 @@ AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = +libXextdpmsstubs_la_LIBADD = +am_libXextdpmsstubs_la_OBJECTS = dpmsstubs.lo +libXextdpmsstubs_la_OBJECTS = $(am_libXextdpmsstubs_la_OBJECTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false @@ -164,8 +167,9 @@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = -SOURCES = $(libXext_la_SOURCES) -DIST_SOURCES = $(am__libXext_la_SOURCES_DIST) +SOURCES = $(libXext_la_SOURCES) $(libXextdpmsstubs_la_SOURCES) +DIST_SOURCES = $(am__libXext_la_SOURCES_DIST) \ + $(libXextdpmsstubs_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -243,6 +247,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -287,6 +293,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -389,7 +399,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -398,6 +411,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -464,6 +478,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ @@ -536,7 +554,7 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -noinst_LTLIBRARIES = libXext.la +noinst_LTLIBRARIES = libXext.la libXextdpmsstubs.la AM_CFLAGS = $(DIX_CFLAGS) @XORG_TRUE@sdk_HEADERS = xvdix.h xvmcext.h geext.h geint.h shmint.h \ @XORG_TRUE@ syncsdk.h $(am__append_6) $(am__append_8) @@ -586,6 +604,7 @@ DPMS_SRCS = dpms.c dpmsproc.h # Now take all of the above, mix well, bake for 10 minutes and get libXext*.la libXext_la_SOURCES = $(BUILTIN_SRCS) libXext_la_LIBADD = $(BUILTIN_LIBS) +libXextdpmsstubs_la_SOURCES = dpmsstubs.c EXTRA_DIST = \ $(MITSHM_SRCS) \ $(XV_SRCS) \ @@ -646,6 +665,8 @@ clean-noinstLTLIBRARIES: } libXext.la: $(libXext_la_OBJECTS) $(libXext_la_DEPENDENCIES) $(EXTRA_libXext_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(libXext_la_OBJECTS) $(libXext_la_LIBADD) $(LIBS) +libXextdpmsstubs.la: $(libXextdpmsstubs_la_OBJECTS) $(libXextdpmsstubs_la_DEPENDENCIES) $(EXTRA_libXextdpmsstubs_la_DEPENDENCIES) + $(AM_V_CCLD)$(LINK) $(libXextdpmsstubs_la_OBJECTS) $(libXextdpmsstubs_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -655,6 +676,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bigreq.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dpms.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dpmsstubs.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/geext.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hashtable.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/panoramiX.Plo@am__quote@ diff --git a/xserver/Xext/dpmsproc.h b/xserver/Xext/dpmsproc.h index 7494dfd6f..82dccbd67 100644 --- a/xserver/Xext/dpmsproc.h +++ b/xserver/Xext/dpmsproc.h @@ -9,7 +9,7 @@ #include "dixstruct.h" -int DPMSSet(ClientPtr client, int level); -Bool DPMSSupported(void); +int _X_EXPORT DPMSSet(ClientPtr client, int level); +Bool _X_EXPORT DPMSSupported(void); #endif diff --git a/xserver/Xext/geext.c b/xserver/Xext/geext.c index 1e5ae6f82..aee68c41d 100644 --- a/xserver/Xext/geext.c +++ b/xserver/Xext/geext.c @@ -150,7 +150,7 @@ SProcGEDispatch(ClientPtr client) * used in the furture for versioning support. */ static void -GEClientCallback(CallbackListPtr *list, pointer closure, pointer data) +GEClientCallback(CallbackListPtr *list, void *closure, void *data) { NewClientInfoRec *clientinfo = (NewClientInfoRec *) data; ClientPtr pClient = clientinfo->client; diff --git a/xserver/Xext/hashtable.c b/xserver/Xext/hashtable.c index 9d9ef8949..471ecca1c 100644 --- a/xserver/Xext/hashtable.c +++ b/xserver/Xext/hashtable.c @@ -23,7 +23,7 @@ struct HashTableRec { HashFunc hash; HashCompareFunc compare; - pointer cdata; + void *cdata; }; typedef struct { @@ -37,7 +37,7 @@ ht_create(int keySize, int dataSize, HashFunc hash, HashCompareFunc compare, - pointer cdata) + void *cdata) { int c; int numBuckets; @@ -117,8 +117,8 @@ double_size(HashTable ht) } } -pointer -ht_add(HashTable ht, pointer key) +void * +ht_add(HashTable ht, const void *key) { unsigned index = ht->hash(ht->cdata, key, ht->bucketBits); struct xorg_list *bucket = &ht->buckets[index]; @@ -164,7 +164,7 @@ ht_add(HashTable ht, pointer key) } void -ht_remove(HashTable ht, pointer key) +ht_remove(HashTable ht, const void *key) { unsigned index = ht->hash(ht->cdata, key, ht->bucketBits); struct xorg_list *bucket = &ht->buckets[index]; @@ -182,8 +182,8 @@ ht_remove(HashTable ht, pointer key) } } -pointer -ht_find(HashTable ht, pointer key) +void * +ht_find(HashTable ht, const void *key) { unsigned index = ht->hash(ht->cdata, key, ht->bucketBits); struct xorg_list *bucket = &ht->buckets[index]; diff --git a/xserver/Xext/hashtable.h b/xserver/Xext/hashtable.h index 5d1598425..a988af32c 100644 --- a/xserver/Xext/hashtable.h +++ b/xserver/Xext/hashtable.h @@ -55,7 +55,7 @@ extern _X_EXPORT HashTable ht_create(int keySize, int dataSize, HashFunc hash, HashCompareFunc compare, - pointer cdata); + void *cdata); /** @brief HtDestruct deinitializes the structure. It does not free the memory allocated to HashTableRec */ @@ -75,12 +75,12 @@ extern _X_EXPORT void ht_destroy(HashTable ht); to avoid returning NULL. Obviously the data pointed cannot be modified, as implied by dataSize being 0. */ -extern _X_EXPORT pointer ht_add(HashTable ht, pointer key); +extern _X_EXPORT void *ht_add(HashTable ht, const void *key); /** @brief Removes a key from the hash table along with its associated data, which will be free'd. */ -extern _X_EXPORT void ht_remove(HashTable ht, pointer key); +extern _X_EXPORT void ht_remove(HashTable ht, const void *key); /** @brief Finds the associated data of a key from the hash table. @@ -93,7 +93,7 @@ extern _X_EXPORT void ht_remove(HashTable ht, pointer key); use HtMember instead to determine if a key has been inserted. */ -extern _X_EXPORT pointer ht_find(HashTable ht, pointer key); +extern _X_EXPORT void *ht_find(HashTable ht, const void *key); /** @brief A generic hash function */ extern _X_EXPORT unsigned ht_generic_hash(void *cdata, diff --git a/xserver/Xext/panoramiX.c b/xserver/Xext/panoramiX.c index ce0d072da..4d79c4654 100644 --- a/xserver/Xext/panoramiX.c +++ b/xserver/Xext/panoramiX.c @@ -118,7 +118,7 @@ static DevPrivateKeyRec PanoramiXScreenKeyRec; typedef struct { DDXPointRec clipOrg; DDXPointRec patOrg; - GCFuncs *wrapFuncs; + const GCFuncs *wrapFuncs; } PanoramiXGCRec, *PanoramiXGCPtr; typedef struct { @@ -130,11 +130,11 @@ static void XineramaValidateGC(GCPtr, unsigned long, DrawablePtr); static void XineramaChangeGC(GCPtr, unsigned long); static void XineramaCopyGC(GCPtr, unsigned long, GCPtr); static void XineramaDestroyGC(GCPtr); -static void XineramaChangeClip(GCPtr, int, pointer, int); +static void XineramaChangeClip(GCPtr, int, void *, int); static void XineramaDestroyClip(GCPtr); static void XineramaCopyClip(GCPtr, GCPtr); -static GCFuncs XineramaGCFuncs = { +static const GCFuncs XineramaGCFuncs = { XineramaValidateGC, XineramaChangeGC, XineramaCopyGC, XineramaDestroyGC, XineramaChangeClip, XineramaDestroyClip, XineramaCopyClip }; @@ -160,7 +160,7 @@ XineramaCloseScreen(ScreenPtr pScreen) if (pScreen->myNum == 0) RegionUninit(&PanoramiXScreenRegion); - free((pointer) pScreenPriv); + free(pScreenPriv); return (*pScreen->CloseScreen) (pScreen); } @@ -294,7 +294,7 @@ XineramaCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst) } static void -XineramaChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects) +XineramaChangeClip(GCPtr pGC, int type, void *pvalue, int nrects) { Xinerama_GC_FUNC_PROLOGUE(pGC); (*pGC->funcs->ChangeClip) (pGC, type, pvalue, nrects); @@ -318,7 +318,7 @@ XineramaDestroyClip(GCPtr pGC) } int -XineramaDeleteResource(pointer data, XID id) +XineramaDeleteResource(void *data, XID id) { free(data); return 1; @@ -330,7 +330,7 @@ typedef struct { } PanoramiXSearchData; static Bool -XineramaFindIDByScrnum(pointer resource, XID id, pointer privdata) +XineramaFindIDByScrnum(void *resource, XID id, void *privdata) { PanoramiXRes *res = (PanoramiXRes *) resource; PanoramiXSearchData *data = (PanoramiXSearchData *) privdata; @@ -342,7 +342,7 @@ PanoramiXRes * PanoramiXFindIDByScrnum(RESTYPE type, XID id, int screen) { PanoramiXSearchData data; - pointer val; + void *val; if (!screen) { dixLookupResourceByType(&val, id, type, serverClient, DixReadAccess); @@ -691,9 +691,9 @@ PanoramiXCreateConnectionBlock(void) root->mmHeight *= height_mult; while (ConnectionCallbackList) { - pointer tmp; + void *tmp; - tmp = (pointer) ConnectionCallbackList; + tmp = (void *) ConnectionCallbackList; (*ConnectionCallbackList->func) (); ConnectionCallbackList = ConnectionCallbackList->next; free(tmp); diff --git a/xserver/Xext/panoramiXprocs.c b/xserver/Xext/panoramiXprocs.c index 576844cbf..83a2e0856 100644 --- a/xserver/Xext/panoramiXprocs.c +++ b/xserver/Xext/panoramiXprocs.c @@ -72,7 +72,7 @@ PanoramiXCreateWindow(ClientPtr client) if (Ones(stuff->mask) != len) return BadLength; - result = dixLookupResourceByType((pointer *) &parent, stuff->parent, + result = dixLookupResourceByType((void **) &parent, stuff->parent, XRT_WINDOW, client, DixWriteAccess); if (result != Success) return result; @@ -87,7 +87,7 @@ PanoramiXCreateWindow(ClientPtr client) pback_offset = Ones((Mask) stuff->mask & (CWBackPixmap - 1)); tmp = *((CARD32 *) &stuff[1] + pback_offset); if ((tmp != None) && (tmp != ParentRelative)) { - result = dixLookupResourceByType((pointer *) &backPix, tmp, + result = dixLookupResourceByType((void **) &backPix, tmp, XRT_PIXMAP, client, DixReadAccess); if (result != Success) return result; @@ -97,7 +97,7 @@ PanoramiXCreateWindow(ClientPtr client) pbord_offset = Ones((Mask) stuff->mask & (CWBorderPixmap - 1)); tmp = *((CARD32 *) &stuff[1] + pbord_offset); if (tmp != CopyFromParent) { - result = dixLookupResourceByType((pointer *) &bordPix, tmp, + result = dixLookupResourceByType((void **) &bordPix, tmp, XRT_PIXMAP, client, DixReadAccess); if (result != Success) return result; @@ -107,7 +107,7 @@ PanoramiXCreateWindow(ClientPtr client) cmap_offset = Ones((Mask) stuff->mask & (CWColormap - 1)); tmp = *((CARD32 *) &stuff[1] + cmap_offset); if ((tmp != CopyFromParent) && (tmp != None)) { - result = dixLookupResourceByType((pointer *) &cmap, tmp, + result = dixLookupResourceByType((void **) &cmap, tmp, XRT_COLORMAP, client, DixReadAccess); if (result != Success) @@ -178,7 +178,7 @@ PanoramiXChangeWindowAttributes(ClientPtr client) if (Ones(stuff->valueMask) != len) return BadLength; - result = dixLookupResourceByType((pointer *) &win, stuff->window, + result = dixLookupResourceByType((void **) &win, stuff->window, XRT_WINDOW, client, DixWriteAccess); if (result != Success) return result; @@ -191,7 +191,7 @@ PanoramiXChangeWindowAttributes(ClientPtr client) pback_offset = Ones((Mask) stuff->valueMask & (CWBackPixmap - 1)); tmp = *((CARD32 *) &stuff[1] + pback_offset); if ((tmp != None) && (tmp != ParentRelative)) { - result = dixLookupResourceByType((pointer *) &backPix, tmp, + result = dixLookupResourceByType((void **) &backPix, tmp, XRT_PIXMAP, client, DixReadAccess); if (result != Success) return result; @@ -201,7 +201,7 @@ PanoramiXChangeWindowAttributes(ClientPtr client) pbord_offset = Ones((Mask) stuff->valueMask & (CWBorderPixmap - 1)); tmp = *((CARD32 *) &stuff[1] + pbord_offset); if (tmp != CopyFromParent) { - result = dixLookupResourceByType((pointer *) &bordPix, tmp, + result = dixLookupResourceByType((void **) &bordPix, tmp, XRT_PIXMAP, client, DixReadAccess); if (result != Success) return result; @@ -211,7 +211,7 @@ PanoramiXChangeWindowAttributes(ClientPtr client) cmap_offset = Ones((Mask) stuff->valueMask & (CWColormap - 1)); tmp = *((CARD32 *) &stuff[1] + cmap_offset); if ((tmp != CopyFromParent) && (tmp != None)) { - result = dixLookupResourceByType((pointer *) &cmap, tmp, + result = dixLookupResourceByType((void **) &cmap, tmp, XRT_COLORMAP, client, DixReadAccess); if (result != Success) @@ -243,7 +243,7 @@ PanoramiXDestroyWindow(ClientPtr client) REQUEST_SIZE_MATCH(xResourceReq); - result = dixLookupResourceByType((pointer *) &win, stuff->id, XRT_WINDOW, + result = dixLookupResourceByType((void **) &win, stuff->id, XRT_WINDOW, client, DixDestroyAccess); if (result != Success) return result; @@ -271,7 +271,7 @@ PanoramiXDestroySubwindows(ClientPtr client) REQUEST_SIZE_MATCH(xResourceReq); - result = dixLookupResourceByType((pointer *) &win, stuff->id, XRT_WINDOW, + result = dixLookupResourceByType((void **) &win, stuff->id, XRT_WINDOW, client, DixDestroyAccess); if (result != Success) return result; @@ -299,7 +299,7 @@ PanoramiXChangeSaveSet(ClientPtr client) REQUEST_SIZE_MATCH(xChangeSaveSetReq); - result = dixLookupResourceByType((pointer *) &win, stuff->window, + result = dixLookupResourceByType((void **) &win, stuff->window, XRT_WINDOW, client, DixReadAccess); if (result != Success) return result; @@ -326,12 +326,12 @@ PanoramiXReparentWindow(ClientPtr client) REQUEST_SIZE_MATCH(xReparentWindowReq); - result = dixLookupResourceByType((pointer *) &win, stuff->window, + result = dixLookupResourceByType((void **) &win, stuff->window, XRT_WINDOW, client, DixWriteAccess); if (result != Success) return result; - result = dixLookupResourceByType((pointer *) &parent, stuff->parent, + result = dixLookupResourceByType((void **) &parent, stuff->parent, XRT_WINDOW, client, DixWriteAccess); if (result != Success) return result; @@ -365,7 +365,7 @@ PanoramiXMapWindow(ClientPtr client) REQUEST_SIZE_MATCH(xResourceReq); - result = dixLookupResourceByType((pointer *) &win, stuff->id, + result = dixLookupResourceByType((void **) &win, stuff->id, XRT_WINDOW, client, DixReadAccess); if (result != Success) return result; @@ -390,7 +390,7 @@ PanoramiXMapSubwindows(ClientPtr client) REQUEST_SIZE_MATCH(xResourceReq); - result = dixLookupResourceByType((pointer *) &win, stuff->id, + result = dixLookupResourceByType((void **) &win, stuff->id, XRT_WINDOW, client, DixReadAccess); if (result != Success) return result; @@ -415,7 +415,7 @@ PanoramiXUnmapWindow(ClientPtr client) REQUEST_SIZE_MATCH(xResourceReq); - result = dixLookupResourceByType((pointer *) &win, stuff->id, + result = dixLookupResourceByType((void **) &win, stuff->id, XRT_WINDOW, client, DixReadAccess); if (result != Success) return result; @@ -440,7 +440,7 @@ PanoramiXUnmapSubwindows(ClientPtr client) REQUEST_SIZE_MATCH(xResourceReq); - result = dixLookupResourceByType((pointer *) &win, stuff->id, + result = dixLookupResourceByType((void **) &win, stuff->id, XRT_WINDOW, client, DixReadAccess); if (result != Success) return result; @@ -474,12 +474,12 @@ PanoramiXConfigureWindow(ClientPtr client) return BadLength; /* because we need the parent */ - result = dixLookupResourceByType((pointer *) &pWin, stuff->window, + result = dixLookupResourceByType((void **) &pWin, stuff->window, RT_WINDOW, client, DixWriteAccess); if (result != Success) return result; - result = dixLookupResourceByType((pointer *) &win, stuff->window, + result = dixLookupResourceByType((void **) &win, stuff->window, XRT_WINDOW, client, DixWriteAccess); if (result != Success) return result; @@ -489,7 +489,7 @@ PanoramiXConfigureWindow(ClientPtr client) sib_offset = Ones((Mask) stuff->mask & (CWSibling - 1)); if ((tmp = *((CARD32 *) &stuff[1] + sib_offset))) { - result = dixLookupResourceByType((pointer *) &sib, tmp, XRT_WINDOW, + result = dixLookupResourceByType((void **) &sib, tmp, XRT_WINDOW, client, DixReadAccess); if (result != Success) return result; @@ -537,7 +537,7 @@ PanoramiXCirculateWindow(ClientPtr client) REQUEST_SIZE_MATCH(xCirculateWindowReq); - result = dixLookupResourceByType((pointer *) &win, stuff->window, + result = dixLookupResourceByType((void **) &win, stuff->window, XRT_WINDOW, client, DixWriteAccess); if (result != Success) return result; @@ -687,7 +687,7 @@ PanoramiXCreatePixmap(ClientPtr client) REQUEST_SIZE_MATCH(xCreatePixmapReq); client->errorValue = stuff->pid; - result = dixLookupResourceByClass((pointer *) &refDraw, stuff->drawable, + result = dixLookupResourceByClass((void **) &refDraw, stuff->drawable, XRC_DRAWABLE, client, DixReadAccess); if (result != Success) return (result == BadValue) ? BadDrawable : result; @@ -727,7 +727,7 @@ PanoramiXFreePixmap(ClientPtr client) client->errorValue = stuff->id; - result = dixLookupResourceByType((pointer *) &pix, stuff->id, XRT_PIXMAP, + result = dixLookupResourceByType((void **) &pix, stuff->id, XRT_PIXMAP, client, DixDestroyAccess); if (result != Success) return result; @@ -766,7 +766,7 @@ PanoramiXCreateGC(ClientPtr client) if (Ones(stuff->mask) != len) return BadLength; - result = dixLookupResourceByClass((pointer *) &refDraw, stuff->drawable, + result = dixLookupResourceByClass((void **) &refDraw, stuff->drawable, XRC_DRAWABLE, client, DixReadAccess); if (result != Success) return (result == BadValue) ? BadDrawable : result; @@ -774,7 +774,7 @@ PanoramiXCreateGC(ClientPtr client) if ((Mask) stuff->mask & GCTile) { tile_offset = Ones((Mask) stuff->mask & (GCTile - 1)); if ((tmp = *((CARD32 *) &stuff[1] + tile_offset))) { - result = dixLookupResourceByType((pointer *) &tile, tmp, XRT_PIXMAP, + result = dixLookupResourceByType((void **) &tile, tmp, XRT_PIXMAP, client, DixReadAccess); if (result != Success) return result; @@ -783,7 +783,7 @@ PanoramiXCreateGC(ClientPtr client) if ((Mask) stuff->mask & GCStipple) { stip_offset = Ones((Mask) stuff->mask & (GCStipple - 1)); if ((tmp = *((CARD32 *) &stuff[1] + stip_offset))) { - result = dixLookupResourceByType((pointer *) &stip, tmp, XRT_PIXMAP, + result = dixLookupResourceByType((void **) &stip, tmp, XRT_PIXMAP, client, DixReadAccess); if (result != Success) return result; @@ -792,7 +792,7 @@ PanoramiXCreateGC(ClientPtr client) if ((Mask) stuff->mask & GCClipMask) { clip_offset = Ones((Mask) stuff->mask & (GCClipMask - 1)); if ((tmp = *((CARD32 *) &stuff[1] + clip_offset))) { - result = dixLookupResourceByType((pointer *) &clip, tmp, XRT_PIXMAP, + result = dixLookupResourceByType((void **) &clip, tmp, XRT_PIXMAP, client, DixReadAccess); if (result != Success) return result; @@ -846,7 +846,7 @@ PanoramiXChangeGC(ClientPtr client) if (Ones(stuff->mask) != len) return BadLength; - result = dixLookupResourceByType((pointer *) &gc, stuff->gc, XRT_GC, + result = dixLookupResourceByType((void **) &gc, stuff->gc, XRT_GC, client, DixReadAccess); if (result != Success) return result; @@ -854,7 +854,7 @@ PanoramiXChangeGC(ClientPtr client) if ((Mask) stuff->mask & GCTile) { tile_offset = Ones((Mask) stuff->mask & (GCTile - 1)); if ((tmp = *((CARD32 *) &stuff[1] + tile_offset))) { - result = dixLookupResourceByType((pointer *) &tile, tmp, XRT_PIXMAP, + result = dixLookupResourceByType((void **) &tile, tmp, XRT_PIXMAP, client, DixReadAccess); if (result != Success) return result; @@ -863,7 +863,7 @@ PanoramiXChangeGC(ClientPtr client) if ((Mask) stuff->mask & GCStipple) { stip_offset = Ones((Mask) stuff->mask & (GCStipple - 1)); if ((tmp = *((CARD32 *) &stuff[1] + stip_offset))) { - result = dixLookupResourceByType((pointer *) &stip, tmp, XRT_PIXMAP, + result = dixLookupResourceByType((void **) &stip, tmp, XRT_PIXMAP, client, DixReadAccess); if (result != Success) return result; @@ -872,7 +872,7 @@ PanoramiXChangeGC(ClientPtr client) if ((Mask) stuff->mask & GCClipMask) { clip_offset = Ones((Mask) stuff->mask & (GCClipMask - 1)); if ((tmp = *((CARD32 *) &stuff[1] + clip_offset))) { - result = dixLookupResourceByType((pointer *) &clip, tmp, XRT_PIXMAP, + result = dixLookupResourceByType((void **) &clip, tmp, XRT_PIXMAP, client, DixReadAccess); if (result != Success) return result; @@ -905,12 +905,12 @@ PanoramiXCopyGC(ClientPtr client) REQUEST_SIZE_MATCH(xCopyGCReq); - result = dixLookupResourceByType((pointer *) &srcGC, stuff->srcGC, XRT_GC, + result = dixLookupResourceByType((void **) &srcGC, stuff->srcGC, XRT_GC, client, DixReadAccess); if (result != Success) return result; - result = dixLookupResourceByType((pointer *) &dstGC, stuff->dstGC, XRT_GC, + result = dixLookupResourceByType((void **) &dstGC, stuff->dstGC, XRT_GC, client, DixWriteAccess); if (result != Success) return result; @@ -936,7 +936,7 @@ PanoramiXSetDashes(ClientPtr client) REQUEST_FIXED_SIZE(xSetDashesReq, stuff->nDashes); - result = dixLookupResourceByType((pointer *) &gc, stuff->gc, XRT_GC, + result = dixLookupResourceByType((void **) &gc, stuff->gc, XRT_GC, client, DixWriteAccess); if (result != Success) return result; @@ -961,7 +961,7 @@ PanoramiXSetClipRectangles(ClientPtr client) REQUEST_AT_LEAST_SIZE(xSetClipRectanglesReq); - result = dixLookupResourceByType((pointer *) &gc, stuff->gc, XRT_GC, + result = dixLookupResourceByType((void **) &gc, stuff->gc, XRT_GC, client, DixWriteAccess); if (result != Success) return result; @@ -986,7 +986,7 @@ PanoramiXFreeGC(ClientPtr client) REQUEST_SIZE_MATCH(xResourceReq); - result = dixLookupResourceByType((pointer *) &gc, stuff->id, XRT_GC, + result = dixLookupResourceByType((void **) &gc, stuff->id, XRT_GC, client, DixDestroyAccess); if (result != Success) return result; @@ -1015,7 +1015,7 @@ PanoramiXClearToBackground(ClientPtr client) REQUEST_SIZE_MATCH(xClearAreaReq); - result = dixLookupResourceByType((pointer *) &win, stuff->window, + result = dixLookupResourceByType((void **) &win, stuff->window, XRT_WINDOW, client, DixWriteAccess); if (result != Success) return result; @@ -1060,14 +1060,14 @@ PanoramiXCopyArea(ClientPtr client) REQUEST_SIZE_MATCH(xCopyAreaReq); - result = dixLookupResourceByClass((pointer *) &src, stuff->srcDrawable, + result = dixLookupResourceByClass((void **) &src, stuff->srcDrawable, XRC_DRAWABLE, client, DixReadAccess); if (result != Success) return (result == BadValue) ? BadDrawable : result; srcShared = IS_SHARED_PIXMAP(src); - result = dixLookupResourceByClass((pointer *) &dst, stuff->dstDrawable, + result = dixLookupResourceByClass((void **) &dst, stuff->dstDrawable, XRC_DRAWABLE, client, DixWriteAccess); if (result != Success) return (result == BadValue) ? BadDrawable : result; @@ -1077,7 +1077,7 @@ PanoramiXCopyArea(ClientPtr client) if (dstShared && srcShared) return (*SavedProcVector[X_CopyArea]) (client); - result = dixLookupResourceByType((pointer *) &gc, stuff->gc, XRT_GC, + result = dixLookupResourceByType((void **) &gc, stuff->gc, XRT_GC, client, DixReadAccess); if (result != Success) return result; @@ -1219,14 +1219,14 @@ PanoramiXCopyPlane(ClientPtr client) REQUEST_SIZE_MATCH(xCopyPlaneReq); - rc = dixLookupResourceByClass((pointer *) &src, stuff->srcDrawable, + rc = dixLookupResourceByClass((void **) &src, stuff->srcDrawable, XRC_DRAWABLE, client, DixReadAccess); if (rc != Success) return (rc == BadValue) ? BadDrawable : rc; srcShared = IS_SHARED_PIXMAP(src); - rc = dixLookupResourceByClass((pointer *) &dst, stuff->dstDrawable, + rc = dixLookupResourceByClass((void **) &dst, stuff->dstDrawable, XRC_DRAWABLE, client, DixWriteAccess); if (rc != Success) return (rc == BadValue) ? BadDrawable : rc; @@ -1236,7 +1236,7 @@ PanoramiXCopyPlane(ClientPtr client) if (dstShared && srcShared) return (*SavedProcVector[X_CopyPlane]) (client); - rc = dixLookupResourceByType((pointer *) &gc, stuff->gc, XRT_GC, + rc = dixLookupResourceByType((void **) &gc, stuff->gc, XRT_GC, client, DixReadAccess); if (rc != Success) return rc; @@ -1327,7 +1327,7 @@ PanoramiXPolyPoint(ClientPtr client) REQUEST_AT_LEAST_SIZE(xPolyPointReq); - result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable, + result = dixLookupResourceByClass((void **) &draw, stuff->drawable, XRC_DRAWABLE, client, DixWriteAccess); if (result != Success) return (result == BadValue) ? BadDrawable : result; @@ -1335,7 +1335,7 @@ PanoramiXPolyPoint(ClientPtr client) if (IS_SHARED_PIXMAP(draw)) return (*SavedProcVector[X_PolyPoint]) (client); - result = dixLookupResourceByType((pointer *) &gc, stuff->gc, XRT_GC, + result = dixLookupResourceByType((void **) &gc, stuff->gc, XRT_GC, client, DixReadAccess); if (result != Success) return result; @@ -1392,7 +1392,7 @@ PanoramiXPolyLine(ClientPtr client) REQUEST_AT_LEAST_SIZE(xPolyLineReq); - result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable, + result = dixLookupResourceByClass((void **) &draw, stuff->drawable, XRC_DRAWABLE, client, DixWriteAccess); if (result != Success) return (result == BadValue) ? BadDrawable : result; @@ -1400,7 +1400,7 @@ PanoramiXPolyLine(ClientPtr client) if (IS_SHARED_PIXMAP(draw)) return (*SavedProcVector[X_PolyLine]) (client); - result = dixLookupResourceByType((pointer *) &gc, stuff->gc, XRT_GC, + result = dixLookupResourceByType((void **) &gc, stuff->gc, XRT_GC, client, DixReadAccess); if (result != Success) return result; @@ -1457,7 +1457,7 @@ PanoramiXPolySegment(ClientPtr client) REQUEST_AT_LEAST_SIZE(xPolySegmentReq); - result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable, + result = dixLookupResourceByClass((void **) &draw, stuff->drawable, XRC_DRAWABLE, client, DixWriteAccess); if (result != Success) return (result == BadValue) ? BadDrawable : result; @@ -1465,7 +1465,7 @@ PanoramiXPolySegment(ClientPtr client) if (IS_SHARED_PIXMAP(draw)) return (*SavedProcVector[X_PolySegment]) (client); - result = dixLookupResourceByType((pointer *) &gc, stuff->gc, XRT_GC, + result = dixLookupResourceByType((void **) &gc, stuff->gc, XRT_GC, client, DixReadAccess); if (result != Success) return result; @@ -1525,7 +1525,7 @@ PanoramiXPolyRectangle(ClientPtr client) REQUEST_AT_LEAST_SIZE(xPolyRectangleReq); - result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable, + result = dixLookupResourceByClass((void **) &draw, stuff->drawable, XRC_DRAWABLE, client, DixWriteAccess); if (result != Success) return (result == BadValue) ? BadDrawable : result; @@ -1533,7 +1533,7 @@ PanoramiXPolyRectangle(ClientPtr client) if (IS_SHARED_PIXMAP(draw)) return (*SavedProcVector[X_PolyRectangle]) (client); - result = dixLookupResourceByType((pointer *) &gc, stuff->gc, XRT_GC, + result = dixLookupResourceByType((void **) &gc, stuff->gc, XRT_GC, client, DixReadAccess); if (result != Success) return result; @@ -1592,7 +1592,7 @@ PanoramiXPolyArc(ClientPtr client) REQUEST_AT_LEAST_SIZE(xPolyArcReq); - result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable, + result = dixLookupResourceByClass((void **) &draw, stuff->drawable, XRC_DRAWABLE, client, DixWriteAccess); if (result != Success) return (result == BadValue) ? BadDrawable : result; @@ -1600,7 +1600,7 @@ PanoramiXPolyArc(ClientPtr client) if (IS_SHARED_PIXMAP(draw)) return (*SavedProcVector[X_PolyArc]) (client); - result = dixLookupResourceByType((pointer *) &gc, stuff->gc, XRT_GC, + result = dixLookupResourceByType((void **) &gc, stuff->gc, XRT_GC, client, DixReadAccess); if (result != Success) return result; @@ -1657,7 +1657,7 @@ PanoramiXFillPoly(ClientPtr client) REQUEST_AT_LEAST_SIZE(xFillPolyReq); - result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable, + result = dixLookupResourceByClass((void **) &draw, stuff->drawable, XRC_DRAWABLE, client, DixWriteAccess); if (result != Success) return (result == BadValue) ? BadDrawable : result; @@ -1665,7 +1665,7 @@ PanoramiXFillPoly(ClientPtr client) if (IS_SHARED_PIXMAP(draw)) return (*SavedProcVector[X_FillPoly]) (client); - result = dixLookupResourceByType((pointer *) &gc, stuff->gc, XRT_GC, + result = dixLookupResourceByType((void **) &gc, stuff->gc, XRT_GC, client, DixReadAccess); if (result != Success) return result; @@ -1723,7 +1723,7 @@ PanoramiXPolyFillRectangle(ClientPtr client) REQUEST_AT_LEAST_SIZE(xPolyFillRectangleReq); - result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable, + result = dixLookupResourceByClass((void **) &draw, stuff->drawable, XRC_DRAWABLE, client, DixWriteAccess); if (result != Success) return (result == BadValue) ? BadDrawable : result; @@ -1731,7 +1731,7 @@ PanoramiXPolyFillRectangle(ClientPtr client) if (IS_SHARED_PIXMAP(draw)) return (*SavedProcVector[X_PolyFillRectangle]) (client); - result = dixLookupResourceByType((pointer *) &gc, stuff->gc, XRT_GC, + result = dixLookupResourceByType((void **) &gc, stuff->gc, XRT_GC, client, DixReadAccess); if (result != Success) return result; @@ -1790,7 +1790,7 @@ PanoramiXPolyFillArc(ClientPtr client) REQUEST_AT_LEAST_SIZE(xPolyFillArcReq); - result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable, + result = dixLookupResourceByClass((void **) &draw, stuff->drawable, XRC_DRAWABLE, client, DixWriteAccess); if (result != Success) return (result == BadValue) ? BadDrawable : result; @@ -1798,7 +1798,7 @@ PanoramiXPolyFillArc(ClientPtr client) if (IS_SHARED_PIXMAP(draw)) return (*SavedProcVector[X_PolyFillArc]) (client); - result = dixLookupResourceByType((pointer *) &gc, stuff->gc, XRT_GC, + result = dixLookupResourceByType((void **) &gc, stuff->gc, XRT_GC, client, DixReadAccess); if (result != Success) return result; @@ -1855,7 +1855,7 @@ PanoramiXPutImage(ClientPtr client) REQUEST_AT_LEAST_SIZE(xPutImageReq); - result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable, + result = dixLookupResourceByClass((void **) &draw, stuff->drawable, XRC_DRAWABLE, client, DixWriteAccess); if (result != Success) return (result == BadValue) ? BadDrawable : result; @@ -1863,7 +1863,7 @@ PanoramiXPutImage(ClientPtr client) if (IS_SHARED_PIXMAP(draw)) return (*SavedProcVector[X_PutImage]) (client); - result = dixLookupResourceByType((pointer *) &gc, stuff->gc, XRT_GC, + result = dixLookupResourceByType((void **) &gc, stuff->gc, XRT_GC, client, DixReadAccess); if (result != Success) return result; @@ -1909,7 +1909,7 @@ PanoramiXGetImage(ClientPtr client) return BadValue; } - rc = dixLookupResourceByClass((pointer *) &draw, stuff->drawable, + rc = dixLookupResourceByClass((void **) &draw, stuff->drawable, XRC_DRAWABLE, client, DixWriteAccess); if (rc != Success) return (rc == BadValue) ? BadDrawable : rc; @@ -2055,7 +2055,7 @@ PanoramiXPolyText8(ClientPtr client) REQUEST_AT_LEAST_SIZE(xPolyTextReq); - result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable, + result = dixLookupResourceByClass((void **) &draw, stuff->drawable, XRC_DRAWABLE, client, DixWriteAccess); if (result != Success) return (result == BadValue) ? BadDrawable : result; @@ -2063,7 +2063,7 @@ PanoramiXPolyText8(ClientPtr client) if (IS_SHARED_PIXMAP(draw)) return (*SavedProcVector[X_PolyText8]) (client); - result = dixLookupResourceByType((pointer *) &gc, stuff->gc, XRT_GC, + result = dixLookupResourceByType((void **) &gc, stuff->gc, XRT_GC, client, DixReadAccess); if (result != Success) return result; @@ -2098,7 +2098,7 @@ PanoramiXPolyText16(ClientPtr client) REQUEST_AT_LEAST_SIZE(xPolyTextReq); - result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable, + result = dixLookupResourceByClass((void **) &draw, stuff->drawable, XRC_DRAWABLE, client, DixWriteAccess); if (result != Success) return (result == BadValue) ? BadDrawable : result; @@ -2106,7 +2106,7 @@ PanoramiXPolyText16(ClientPtr client) if (IS_SHARED_PIXMAP(draw)) return (*SavedProcVector[X_PolyText16]) (client); - result = dixLookupResourceByType((pointer *) &gc, stuff->gc, XRT_GC, + result = dixLookupResourceByType((void **) &gc, stuff->gc, XRT_GC, client, DixReadAccess); if (result != Success) return result; @@ -2141,7 +2141,7 @@ PanoramiXImageText8(ClientPtr client) REQUEST_FIXED_SIZE(xImageTextReq, stuff->nChars); - result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable, + result = dixLookupResourceByClass((void **) &draw, stuff->drawable, XRC_DRAWABLE, client, DixWriteAccess); if (result != Success) return (result == BadValue) ? BadDrawable : result; @@ -2149,7 +2149,7 @@ PanoramiXImageText8(ClientPtr client) if (IS_SHARED_PIXMAP(draw)) return (*SavedProcVector[X_ImageText8]) (client); - result = dixLookupResourceByType((pointer *) &gc, stuff->gc, XRT_GC, + result = dixLookupResourceByType((void **) &gc, stuff->gc, XRT_GC, client, DixReadAccess); if (result != Success) return result; @@ -2184,7 +2184,7 @@ PanoramiXImageText16(ClientPtr client) REQUEST_FIXED_SIZE(xImageTextReq, stuff->nChars << 1); - result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable, + result = dixLookupResourceByClass((void **) &draw, stuff->drawable, XRC_DRAWABLE, client, DixWriteAccess); if (result != Success) return (result == BadValue) ? BadDrawable : result; @@ -2192,7 +2192,7 @@ PanoramiXImageText16(ClientPtr client) if (IS_SHARED_PIXMAP(draw)) return (*SavedProcVector[X_ImageText16]) (client); - result = dixLookupResourceByType((pointer *) &gc, stuff->gc, XRT_GC, + result = dixLookupResourceByType((void **) &gc, stuff->gc, XRT_GC, client, DixReadAccess); if (result != Success) return result; @@ -2225,7 +2225,7 @@ PanoramiXCreateColormap(ClientPtr client) REQUEST_SIZE_MATCH(xCreateColormapReq); - result = dixLookupResourceByType((pointer *) &win, stuff->window, + result = dixLookupResourceByType((void **) &win, stuff->window, XRT_WINDOW, client, DixReadAccess); if (result != Success) return result; @@ -2266,7 +2266,7 @@ PanoramiXFreeColormap(ClientPtr client) client->errorValue = stuff->id; - result = dixLookupResourceByType((pointer *) &cmap, stuff->id, XRT_COLORMAP, + result = dixLookupResourceByType((void **) &cmap, stuff->id, XRT_COLORMAP, client, DixDestroyAccess); if (result != Success) return result; @@ -2296,7 +2296,7 @@ PanoramiXCopyColormapAndFree(ClientPtr client) client->errorValue = stuff->srcCmap; - result = dixLookupResourceByType((pointer *) &cmap, stuff->srcCmap, + result = dixLookupResourceByType((void **) &cmap, stuff->srcCmap, XRT_COLORMAP, client, DixReadAccess | DixWriteAccess); if (result != Success) @@ -2335,7 +2335,7 @@ PanoramiXInstallColormap(ClientPtr client) client->errorValue = stuff->id; - result = dixLookupResourceByType((pointer *) &cmap, stuff->id, XRT_COLORMAP, + result = dixLookupResourceByType((void **) &cmap, stuff->id, XRT_COLORMAP, client, DixReadAccess); if (result != Success) return result; @@ -2360,7 +2360,7 @@ PanoramiXUninstallColormap(ClientPtr client) client->errorValue = stuff->id; - result = dixLookupResourceByType((pointer *) &cmap, stuff->id, XRT_COLORMAP, + result = dixLookupResourceByType((void **) &cmap, stuff->id, XRT_COLORMAP, client, DixReadAccess); if (result != Success) return result; @@ -2386,7 +2386,7 @@ PanoramiXAllocColor(ClientPtr client) client->errorValue = stuff->cmap; - result = dixLookupResourceByType((pointer *) &cmap, stuff->cmap, + result = dixLookupResourceByType((void **) &cmap, stuff->cmap, XRT_COLORMAP, client, DixWriteAccess); if (result != Success) return result; @@ -2412,7 +2412,7 @@ PanoramiXAllocNamedColor(ClientPtr client) client->errorValue = stuff->cmap; - result = dixLookupResourceByType((pointer *) &cmap, stuff->cmap, + result = dixLookupResourceByType((void **) &cmap, stuff->cmap, XRT_COLORMAP, client, DixWriteAccess); if (result != Success) return result; @@ -2438,7 +2438,7 @@ PanoramiXAllocColorCells(ClientPtr client) client->errorValue = stuff->cmap; - result = dixLookupResourceByType((pointer *) &cmap, stuff->cmap, + result = dixLookupResourceByType((void **) &cmap, stuff->cmap, XRT_COLORMAP, client, DixWriteAccess); if (result != Success) return result; @@ -2464,7 +2464,7 @@ PanoramiXAllocColorPlanes(ClientPtr client) client->errorValue = stuff->cmap; - result = dixLookupResourceByType((pointer *) &cmap, stuff->cmap, + result = dixLookupResourceByType((void **) &cmap, stuff->cmap, XRT_COLORMAP, client, DixWriteAccess); if (result != Success) return result; @@ -2490,7 +2490,7 @@ PanoramiXFreeColors(ClientPtr client) client->errorValue = stuff->cmap; - result = dixLookupResourceByType((pointer *) &cmap, stuff->cmap, + result = dixLookupResourceByType((void **) &cmap, stuff->cmap, XRT_COLORMAP, client, DixWriteAccess); if (result != Success) return result; @@ -2514,7 +2514,7 @@ PanoramiXStoreColors(ClientPtr client) client->errorValue = stuff->cmap; - result = dixLookupResourceByType((pointer *) &cmap, stuff->cmap, + result = dixLookupResourceByType((void **) &cmap, stuff->cmap, XRT_COLORMAP, client, DixWriteAccess); if (result != Success) return result; @@ -2540,7 +2540,7 @@ PanoramiXStoreNamedColor(ClientPtr client) client->errorValue = stuff->cmap; - result = dixLookupResourceByType((pointer *) &cmap, stuff->cmap, + result = dixLookupResourceByType((void **) &cmap, stuff->cmap, XRT_COLORMAP, client, DixWriteAccess); if (result != Success) return result; diff --git a/xserver/Xext/panoramiXsrv.h b/xserver/Xext/panoramiXsrv.h index 0fcde4fd5..6d93eec2e 100644 --- a/xserver/Xext/panoramiXsrv.h +++ b/xserver/Xext/panoramiXsrv.h @@ -19,7 +19,7 @@ extern _X_EXPORT Bool PanoramiXCreateConnectionBlock(void); extern _X_EXPORT PanoramiXRes *PanoramiXFindIDByScrnum(RESTYPE, XID, int); extern _X_EXPORT Bool XineramaRegisterConnectionBlockCallback(void (*func) (void)); -extern _X_EXPORT int XineramaDeleteResource(pointer, XID); +extern _X_EXPORT int XineramaDeleteResource(void *, XID); extern _X_EXPORT void XineramaReinitData(void); diff --git a/xserver/Xext/saver.c b/xserver/Xext/saver.c index e06f40837..8e92fdf2f 100644 --- a/xserver/Xext/saver.c +++ b/xserver/Xext/saver.c @@ -107,9 +107,7 @@ typedef struct _ScreenSaverSuspension { int count; } ScreenSaverSuspensionRec; -static int ScreenSaverFreeSuspend(pointer /*value */ , - XID /* id */ - ); +static int ScreenSaverFreeSuspend(void *value, XID id); /* * each screen has a list of clients requesting @@ -131,18 +129,14 @@ typedef struct _ScreenSaverEvent { CARD32 mask; } ScreenSaverEventRec; -static int ScreenSaverFreeEvents(pointer /* value */ , - XID /* id */ - ); +static int ScreenSaverFreeEvents(void * value, XID id); -static Bool setEventMask(ScreenPtr /* pScreen */ , - ClientPtr /* client */ , - unsigned long /* mask */ - ); +static Bool setEventMask(ScreenPtr pScreen, + ClientPtr client, + unsigned long mask); -static unsigned long getEventMask(ScreenPtr /* pScreen */ , - ClientPtr /* client */ - ); +static unsigned long getEventMask(ScreenPtr pScreen, + ClientPtr client); /* * when a client sets the screen saver attributes, a resource is @@ -168,21 +162,16 @@ typedef struct _ScreenSaverAttr { unsigned long *values; } ScreenSaverAttrRec, *ScreenSaverAttrPtr; -static int ScreenSaverFreeAttr(pointer /* value */ , - XID /* id */ - ); +static int ScreenSaverFreeAttr(void *value, XID id); -static void FreeAttrs(ScreenSaverAttrPtr /* pAttr */ - ); +static void FreeAttrs(ScreenSaverAttrPtr pAttr); -static void FreeScreenAttr(ScreenSaverAttrPtr /* pAttr */ - ); +static void FreeScreenAttr(ScreenSaverAttrPtr pAttr); static void - SendScreenSaverNotify(ScreenPtr /* pScreen */ , - int /* state */ , - Bool /* forced */ - ); +SendScreenSaverNotify(ScreenPtr pScreen, + int state, + Bool forced); typedef struct _ScreenSaverScreenPrivate { ScreenSaverEventPtr events; @@ -191,8 +180,7 @@ typedef struct _ScreenSaverScreenPrivate { Colormap installedMap; } ScreenSaverScreenPrivateRec, *ScreenSaverScreenPrivatePtr; -static ScreenSaverScreenPrivatePtr MakeScreenPrivate(ScreenPtr /* pScreen */ - ); +static ScreenSaverScreenPrivatePtr MakeScreenPrivate(ScreenPtr pScreen); static DevPrivateKeyRec ScreenPrivateKeyRec; @@ -288,7 +276,7 @@ setEventMask(ScreenPtr pScreen, ClientPtr client, unsigned long mask) pEv->client = client; pEv->screen = pScreen; pEv->resource = FakeClientID(client->index); - if (!AddResource(pEv->resource, SaverEventType, (pointer) pEv)) + if (!AddResource(pEv->resource, SaverEventType, (void *) pEv)) return FALSE; } pEv->mask = mask; @@ -319,7 +307,7 @@ FreeScreenAttr(ScreenSaverAttrPtr pAttr) } static int -ScreenSaverFreeEvents(pointer value, XID id) +ScreenSaverFreeEvents(void *value, XID id) { ScreenSaverEventPtr pOld = (ScreenSaverEventPtr) value; ScreenPtr pScreen = pOld->screen; @@ -341,7 +329,7 @@ ScreenSaverFreeEvents(pointer value, XID id) } static int -ScreenSaverFreeAttr(pointer value, XID id) +ScreenSaverFreeAttr(void *value, XID id) { ScreenSaverAttrPtr pOldAttr = (ScreenSaverAttrPtr) value; ScreenPtr pScreen = pOldAttr->screen; @@ -363,7 +351,7 @@ ScreenSaverFreeAttr(pointer value, XID id) } static int -ScreenSaverFreeSuspend(pointer value, XID id) +ScreenSaverFreeSuspend(void *value, XID id) { ScreenSaverSuspensionPtr data = (ScreenSaverSuspensionPtr) value; ScreenSaverSuspensionPtr *prev, this; @@ -460,7 +448,7 @@ UninstallSaverColormap(ScreenPtr pScreen) int rc; if (pPriv && pPriv->installedMap != None) { - rc = dixLookupResourceByType((pointer *) &pCmap, pPriv->installedMap, + rc = dixLookupResourceByType((void **) &pCmap, pPriv->installedMap, RT_COLORMAP, serverClient, DixUninstallAccess); if (rc == Success) @@ -571,7 +559,7 @@ CreateSaverWindow(ScreenPtr pScreen) if (i < numInstalled) return TRUE; - result = dixLookupResourceByType((pointer *) &pCmap, wantMap, RT_COLORMAP, + result = dixLookupResourceByType((void **) &pCmap, wantMap, RT_COLORMAP, serverClient, DixInstallAccess); if (result != Success) return TRUE; @@ -923,7 +911,7 @@ ScreenSaverSetAttributes(ClientPtr client) } else { ret = - dixLookupResourceByType((pointer *) &pPixmap, pixID, + dixLookupResourceByType((void **) &pPixmap, pixID, RT_PIXMAP, client, DixReadAccess); if (ret == Success) { if ((pPixmap->drawable.depth != depth) || @@ -955,7 +943,7 @@ ScreenSaverSetAttributes(ClientPtr client) } else { ret = - dixLookupResourceByType((pointer *) &pPixmap, pixID, + dixLookupResourceByType((void **) &pPixmap, pixID, RT_PIXMAP, client, DixReadAccess); if (ret == Success) { if ((pPixmap->drawable.depth != depth) || @@ -1039,7 +1027,7 @@ ScreenSaverSetAttributes(ClientPtr client) break; case CWColormap: cmap = (Colormap) * pVlist; - ret = dixLookupResourceByType((pointer *) &pCmap, cmap, RT_COLORMAP, + ret = dixLookupResourceByType((void **) &pCmap, cmap, RT_COLORMAP, client, DixUseAccess); if (ret != Success) { client->errorValue = cmap; @@ -1058,7 +1046,7 @@ ScreenSaverSetAttributes(ClientPtr client) *values++ = None; } else { - ret = dixLookupResourceByType((pointer *) &pCursor, cursorID, + ret = dixLookupResourceByType((void **) &pCursor, cursorID, RT_CURSOR, client, DixUseAccess); if (ret != Success) { client->errorValue = cursorID; @@ -1079,7 +1067,7 @@ ScreenSaverSetAttributes(ClientPtr client) FreeScreenAttr(pPriv->attr); pPriv->attr = pAttr; pAttr->resource = FakeClientID(client->index); - if (!AddResource(pAttr->resource, AttrType, (pointer) pAttr)) + if (!AddResource(pAttr->resource, AttrType, (void *) pAttr)) return BadAlloc; return Success; PatchUp: @@ -1131,7 +1119,7 @@ ProcScreenSaverSetAttributes(ClientPtr client) REQUEST_AT_LEAST_SIZE(xScreenSaverSetAttributesReq); - status = dixLookupResourceByClass((pointer *) &draw, stuff->drawable, + status = dixLookupResourceByClass((void **) &draw, stuff->drawable, XRC_DRAWABLE, client, DixWriteAccess); if (status != Success) return (status == BadValue) ? BadDrawable : status; @@ -1146,7 +1134,7 @@ ProcScreenSaverSetAttributes(ClientPtr client) pback_offset = Ones((Mask) stuff->mask & (CWBackPixmap - 1)); tmp = *((CARD32 *) &stuff[1] + pback_offset); if ((tmp != None) && (tmp != ParentRelative)) { - status = dixLookupResourceByType((pointer *) &backPix, tmp, + status = dixLookupResourceByType((void **) &backPix, tmp, XRT_PIXMAP, client, DixReadAccess); if (status != Success) @@ -1158,7 +1146,7 @@ ProcScreenSaverSetAttributes(ClientPtr client) pbord_offset = Ones((Mask) stuff->mask & (CWBorderPixmap - 1)); tmp = *((CARD32 *) &stuff[1] + pbord_offset); if (tmp != CopyFromParent) { - status = dixLookupResourceByType((pointer *) &bordPix, tmp, + status = dixLookupResourceByType((void **) &bordPix, tmp, XRT_PIXMAP, client, DixReadAccess); if (status != Success) @@ -1170,7 +1158,7 @@ ProcScreenSaverSetAttributes(ClientPtr client) cmap_offset = Ones((Mask) stuff->mask & (CWColormap - 1)); tmp = *((CARD32 *) &stuff[1] + cmap_offset); if ((tmp != CopyFromParent) && (tmp != None)) { - status = dixLookupResourceByType((pointer *) &cmap, tmp, + status = dixLookupResourceByType((void **) &cmap, tmp, XRT_COLORMAP, client, DixReadAccess); if (status != Success) @@ -1211,7 +1199,7 @@ ProcScreenSaverUnsetAttributes(ClientPtr client) PanoramiXRes *draw; int rc, i; - rc = dixLookupResourceByClass((pointer *) &draw, stuff->drawable, + rc = dixLookupResourceByClass((void **) &draw, stuff->drawable, XRC_DRAWABLE, client, DixWriteAccess); if (rc != Success) return (rc == BadValue) ? BadDrawable : rc; @@ -1270,7 +1258,7 @@ ProcScreenSaverSuspend(ClientPtr client) this->count = 1; this->clientResource = FakeClientID(client->index); - if (!AddResource(this->clientResource, SuspendType, (pointer) this)) { + if (!AddResource(this->clientResource, SuspendType, (void *) this)) { free(this); return BadAlloc; } diff --git a/xserver/Xext/security.c b/xserver/Xext/security.c index 7bf6cc4b0..421b25201 100644 --- a/xserver/Xext/security.c +++ b/xserver/Xext/security.c @@ -167,7 +167,7 @@ SecurityLookupRequestName(ClientPtr client) */ static int -SecurityDeleteAuthorization(pointer value, XID id) +SecurityDeleteAuthorization(void *value, XID id) { SecurityAuthorizationPtr pAuth = (SecurityAuthorizationPtr) value; unsigned short name_len, data_len; @@ -221,7 +221,7 @@ SecurityDeleteAuthorization(pointer value, XID id) /* resource delete function for RTEventClient */ static int -SecurityDeleteAuthorizationEventClient(pointer value, XID id) +SecurityDeleteAuthorizationEventClient(void *value, XID id) { OtherClientsPtr pEventClient, prev = NULL; SecurityAuthorizationPtr pAuth = (SecurityAuthorizationPtr) value; @@ -294,7 +294,7 @@ SecurityComputeAuthorizationTimeout(SecurityAuthorizationPtr pAuth, */ static CARD32 -SecurityAuthorizationExpired(OsTimerPtr timer, CARD32 time, pointer pval) +SecurityAuthorizationExpired(OsTimerPtr timer, CARD32 time, void *pval) { SecurityAuthorizationPtr pAuth = (SecurityAuthorizationPtr) pval; @@ -382,7 +382,7 @@ SecurityEventSelectForAuthorization(SecurityAuthorizationPtr pAuth, pEventClient->mask = mask; pEventClient->resource = FakeClientID(client->index); pEventClient->next = pAuth->eventClients; - if (!AddResource(pEventClient->resource, RTEventClient, (pointer) pAuth)) { + if (!AddResource(pEventClient->resource, RTEventClient, (void *) pAuth)) { free(pEventClient); return BadAlloc; } @@ -454,7 +454,7 @@ ProcSecurityGenerateAuthorization(ClientPtr client) vgi.group = group; vgi.valid = FALSE; - CallCallbacks(&SecurityValidateGroupCallback, (pointer) &vgi); + CallCallbacks(&SecurityValidateGroupCallback, (void *) &vgi); /* if nobody said they recognized it, it's an error */ @@ -575,7 +575,7 @@ ProcSecurityRevokeAuthorization(ClientPtr client) REQUEST_SIZE_MATCH(xSecurityRevokeAuthorizationReq); - rc = dixLookupResourceByType((pointer *) &pAuth, stuff->authId, + rc = dixLookupResourceByType((void **) &pAuth, stuff->authId, SecurityAuthorizationResType, client, DixDestroyAccess); if (rc != Success) @@ -693,7 +693,7 @@ SwapSecurityAuthorizationRevokedEvent(xSecurityAuthorizationRevokedEvent * from, */ static void -SecurityDevice(CallbackListPtr *pcbl, pointer unused, pointer calldata) +SecurityDevice(CallbackListPtr *pcbl, void *unused, void *calldata) { XaceDeviceAccessRec *rec = calldata; SecurityStateRec *subj, *obj; @@ -737,7 +737,7 @@ SecurityDevice(CallbackListPtr *pcbl, pointer unused, pointer calldata) */ static void -SecurityResource(CallbackListPtr *pcbl, pointer unused, pointer calldata) +SecurityResource(CallbackListPtr *pcbl, void *unused, void *calldata) { XaceResourceAccessRec *rec = calldata; SecurityStateRec *subj, *obj; @@ -785,7 +785,7 @@ SecurityResource(CallbackListPtr *pcbl, pointer unused, pointer calldata) } static void -SecurityExtension(CallbackListPtr *pcbl, pointer unused, pointer calldata) +SecurityExtension(CallbackListPtr *pcbl, void *unused, void *calldata) { XaceExtAccessRec *rec = calldata; SecurityStateRec *subj; @@ -808,7 +808,7 @@ SecurityExtension(CallbackListPtr *pcbl, pointer unused, pointer calldata) } static void -SecurityServer(CallbackListPtr *pcbl, pointer unused, pointer calldata) +SecurityServer(CallbackListPtr *pcbl, void *unused, void *calldata) { XaceServerAccessRec *rec = calldata; SecurityStateRec *subj, *obj; @@ -827,7 +827,7 @@ SecurityServer(CallbackListPtr *pcbl, pointer unused, pointer calldata) } static void -SecurityClient(CallbackListPtr *pcbl, pointer unused, pointer calldata) +SecurityClient(CallbackListPtr *pcbl, void *unused, void *calldata) { XaceClientAccessRec *rec = calldata; SecurityStateRec *subj, *obj; @@ -846,7 +846,7 @@ SecurityClient(CallbackListPtr *pcbl, pointer unused, pointer calldata) } static void -SecurityProperty(CallbackListPtr *pcbl, pointer unused, pointer calldata) +SecurityProperty(CallbackListPtr *pcbl, void *unused, void *calldata) { XacePropertyAccessRec *rec = calldata; SecurityStateRec *subj, *obj; @@ -868,7 +868,7 @@ SecurityProperty(CallbackListPtr *pcbl, pointer unused, pointer calldata) } static void -SecuritySend(CallbackListPtr *pcbl, pointer unused, pointer calldata) +SecuritySend(CallbackListPtr *pcbl, void *unused, void *calldata) { XaceSendAccessRec *rec = calldata; SecurityStateRec *subj, *obj; @@ -900,7 +900,7 @@ SecuritySend(CallbackListPtr *pcbl, pointer unused, pointer calldata) } static void -SecurityReceive(CallbackListPtr *pcbl, pointer unused, pointer calldata) +SecurityReceive(CallbackListPtr *pcbl, void *unused, void *calldata) { XaceReceiveAccessRec *rec = calldata; SecurityStateRec *subj, *obj; @@ -941,7 +941,7 @@ SecurityReceive(CallbackListPtr *pcbl, pointer unused, pointer calldata) */ static void -SecurityClientState(CallbackListPtr *pcbl, pointer unused, pointer calldata) +SecurityClientState(CallbackListPtr *pcbl, void *unused, void *calldata) { NewClientInfoRec *pci = calldata; SecurityStateRec *state; @@ -960,7 +960,7 @@ SecurityClientState(CallbackListPtr *pcbl, pointer unused, pointer calldata) case ClientStateRunning: state->authId = AuthorizationIDOfClient(pci->client); - rc = dixLookupResourceByType((pointer *) &pAuth, state->authId, + rc = dixLookupResourceByType((void **) &pAuth, state->authId, SecurityAuthorizationResType, serverClient, DixGetAttrAccess); if (rc == Success) { @@ -976,7 +976,7 @@ SecurityClientState(CallbackListPtr *pcbl, pointer unused, pointer calldata) case ClientStateGone: case ClientStateRetained: - rc = dixLookupResourceByType((pointer *) &pAuth, state->authId, + rc = dixLookupResourceByType((void **) &pAuth, state->authId, SecurityAuthorizationResType, serverClient, DixGetAttrAccess); if (rc == Success && state->live) { diff --git a/xserver/Xext/shape.c b/xserver/Xext/shape.c index d36867cc8..bb479b159 100644 --- a/xserver/Xext/shape.c +++ b/xserver/Xext/shape.c @@ -50,11 +50,11 @@ in this Software without prior written authorization from The Open Group. typedef RegionPtr (*CreateDftPtr) (WindowPtr /* pWin */ ); -static int ShapeFreeClient(pointer /* data */ , - XID /* id */ +static int ShapeFreeClient(void * /* data */ , + XID /* id */ ); -static int ShapeFreeEvents(pointer /* data */ , - XID /* id */ +static int ShapeFreeEvents(void * /* data */ , + XID /* id */ ); static void SShapeNotifyEvent(xShapeNotifyEvent * /* from */ , xShapeNotifyEvent * /* to */ @@ -306,7 +306,7 @@ ProcPanoramiXShapeRectangles(ClientPtr client) REQUEST_AT_LEAST_SIZE(xShapeRectanglesReq); - result = dixLookupResourceByType((pointer *) &win, stuff->dest, XRT_WINDOW, + result = dixLookupResourceByType((void **) &win, stuff->dest, XRT_WINDOW, client, DixWriteAccess); if (result != Success) return result; @@ -361,7 +361,7 @@ ProcShapeMask(ClientPtr client) if (stuff->src == None) srcRgn = 0; else { - rc = dixLookupResourceByType((pointer *) &pPixmap, stuff->src, + rc = dixLookupResourceByType((void **) &pPixmap, stuff->src, RT_PIXMAP, client, DixReadAccess); if (rc != Success) return rc; @@ -404,13 +404,13 @@ ProcPanoramiXShapeMask(ClientPtr client) REQUEST_SIZE_MATCH(xShapeMaskReq); - result = dixLookupResourceByType((pointer *) &win, stuff->dest, XRT_WINDOW, + result = dixLookupResourceByType((void **) &win, stuff->dest, XRT_WINDOW, client, DixWriteAccess); if (result != Success) return result; if (stuff->src != None) { - result = dixLookupResourceByType((pointer *) &pmap, stuff->src, + result = dixLookupResourceByType((void **) &pmap, stuff->src, XRT_PIXMAP, client, DixReadAccess); if (result != Success) return result; @@ -532,12 +532,12 @@ ProcPanoramiXShapeCombine(ClientPtr client) REQUEST_AT_LEAST_SIZE(xShapeCombineReq); - result = dixLookupResourceByType((pointer *) &win, stuff->dest, XRT_WINDOW, + result = dixLookupResourceByType((void **) &win, stuff->dest, XRT_WINDOW, client, DixWriteAccess); if (result != Success) return result; - result = dixLookupResourceByType((pointer *) &win2, stuff->src, XRT_WINDOW, + result = dixLookupResourceByType((void **) &win2, stuff->src, XRT_WINDOW, client, DixReadAccess); if (result != Success) return result; @@ -603,7 +603,7 @@ ProcPanoramiXShapeOffset(ClientPtr client) REQUEST_AT_LEAST_SIZE(xShapeOffsetReq); - result = dixLookupResourceByType((pointer *) &win, stuff->dest, XRT_WINDOW, + result = dixLookupResourceByType((void **) &win, stuff->dest, XRT_WINDOW, client, DixWriteAccess); if (result != Success) return result; @@ -686,7 +686,7 @@ ProcShapeQueryExtents(ClientPtr client) } /*ARGSUSED*/ static int -ShapeFreeClient(pointer data, XID id) +ShapeFreeClient(void *data, XID id) { ShapeEventPtr pShapeEvent; WindowPtr pWin; @@ -695,7 +695,7 @@ ShapeFreeClient(pointer data, XID id) pShapeEvent = (ShapeEventPtr) data; pWin = pShapeEvent->window; - rc = dixLookupResourceByType((pointer *) &pHead, pWin->drawable.id, + rc = dixLookupResourceByType((void **) &pHead, pWin->drawable.id, ShapeEventType, serverClient, DixReadAccess); if (rc == Success) { pPrev = 0; @@ -708,12 +708,12 @@ ShapeFreeClient(pointer data, XID id) *pHead = pShapeEvent->next; } } - free((pointer) pShapeEvent); + free((void *) pShapeEvent); return 1; } /*ARGSUSED*/ static int -ShapeFreeEvents(pointer data, XID id) +ShapeFreeEvents(void *data, XID id) { ShapeEventPtr *pHead, pCur, pNext; @@ -721,9 +721,9 @@ ShapeFreeEvents(pointer data, XID id) for (pCur = *pHead; pCur; pCur = pNext) { pNext = pCur->next; FreeResource(pCur->clientResource, ClientType); - free((pointer) pCur); + free((void *) pCur); } - free((pointer) pHead); + free((void *) pHead); return 1; } @@ -740,7 +740,7 @@ ProcShapeSelectInput(ClientPtr client) rc = dixLookupWindow(&pWin, stuff->window, client, DixReceiveAccess); if (rc != Success) return rc; - rc = dixLookupResourceByType((pointer *) &pHead, pWin->drawable.id, + rc = dixLookupResourceByType((void **) &pHead, pWin->drawable.id, ShapeEventType, client, DixWriteAccess); if (rc != Success && rc != BadValue) return rc; @@ -770,10 +770,10 @@ ProcShapeSelectInput(ClientPtr client) */ clientResource = FakeClientID(client->index); pNewShapeEvent->clientResource = clientResource; - if (!AddResource(clientResource, ClientType, (pointer) pNewShapeEvent)) + if (!AddResource(clientResource, ClientType, (void *) pNewShapeEvent)) return BadAlloc; /* - * create a resource to contain a pointer to the list + * create a resource to contain a void *to the list * of clients selecting input. This must be indirect as * the list may be arbitrarily rearranged which cannot be * done through the resource database. @@ -782,7 +782,7 @@ ProcShapeSelectInput(ClientPtr client) pHead = malloc(sizeof(ShapeEventPtr)); if (!pHead || !AddResource(pWin->drawable.id, ShapeEventType, - (pointer) pHead)) { + (void *) pHead)) { FreeResource(clientResource, RT_NONE); return BadAlloc; } @@ -831,7 +831,7 @@ SendShapeNotify(WindowPtr pWin, int which) BYTE shaped; int rc; - rc = dixLookupResourceByType((pointer *) &pHead, pWin->drawable.id, + rc = dixLookupResourceByType((void **) &pHead, pWin->drawable.id, ShapeEventType, serverClient, DixReadAccess); if (rc != Success) return; @@ -910,7 +910,7 @@ ProcShapeInputSelected(ClientPtr client) rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); if (rc != Success) return rc; - rc = dixLookupResourceByType((pointer *) &pHead, pWin->drawable.id, + rc = dixLookupResourceByType((void **) &pHead, pWin->drawable.id, ShapeEventType, client, DixReadAccess); if (rc != Success && rc != BadValue) return rc; diff --git a/xserver/Xext/shm.c b/xserver/Xext/shm.c index 1957a9525..4dad8b6c6 100644 --- a/xserver/Xext/shm.c +++ b/xserver/Xext/shm.c @@ -99,14 +99,10 @@ typedef struct _ShmScrPrivateRec { } ShmScrPrivateRec; static PixmapPtr fbShmCreatePixmap(XSHM_CREATE_PIXMAP_ARGS); -static int ShmDetachSegment(pointer /* value */ , - XID /* shmseg */ - ); -static void ShmResetProc(ExtensionEntry * /* extEntry */ - ); -static void SShmCompletionEvent(xShmCompletionEvent * /* from */ , - xShmCompletionEvent * /* to */ - ); +static int ShmDetachSegment(void *value, XID shmseg); +static void ShmResetProc(ExtensionEntry *extEntry); +static void SShmCompletionEvent(xShmCompletionEvent *from, + xShmCompletionEvent *to); static Bool ShmDestroyPixmap(PixmapPtr pPixmap); @@ -130,7 +126,7 @@ static ShmFuncs fbFuncs = { fbShmCreatePixmap, NULL }; #define VERIFY_SHMSEG(shmseg,shmdesc,client) \ { \ int tmprc; \ - tmprc = dixLookupResourceByType((pointer *)&(shmdesc), shmseg, ShmSegType, \ + tmprc = dixLookupResourceByType((void **)&(shmdesc), shmseg, ShmSegType, \ client, DixReadAccess); \ if (tmprc != Success) \ return tmprc; \ @@ -260,7 +256,7 @@ ShmDestroyPixmap(PixmapPtr pPixmap) shmdesc = (ShmDescPtr) dixLookupPrivate(&pPixmap->devPrivates, shmPixmapPrivateKey); if (shmdesc) - ShmDetachSegment((pointer) shmdesc, pPixmap->drawable.id); + ShmDetachSegment((void *) shmdesc, pPixmap->drawable.id); } pScreen->DestroyPixmap = screen_priv->destroyPixmap; @@ -425,13 +421,13 @@ ProcShmAttach(ClientPtr client) shmdesc->next = Shmsegs; Shmsegs = shmdesc; } - if (!AddResource(stuff->shmseg, ShmSegType, (pointer) shmdesc)) + if (!AddResource(stuff->shmseg, ShmSegType, (void *) shmdesc)) return BadAlloc; return Success; } /*ARGSUSED*/ static int -ShmDetachSegment(pointer value, /* must conform to DeleteType */ +ShmDetachSegment(void *value, /* must conform to DeleteType */ XID shmseg) { ShmDescPtr shmdesc = (ShmDescPtr) value; @@ -729,12 +725,12 @@ ProcPanoramiXShmPutImage(ClientPtr client) REQUEST(xShmPutImageReq); REQUEST_SIZE_MATCH(xShmPutImageReq); - result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable, + result = dixLookupResourceByClass((void **) &draw, stuff->drawable, XRC_DRAWABLE, client, DixWriteAccess); if (result != Success) return (result == BadValue) ? BadDrawable : result; - result = dixLookupResourceByType((pointer *) &gc, stuff->gc, + result = dixLookupResourceByType((void **) &gc, stuff->gc, XRT_GC, client, DixReadAccess); if (result != Success) return result; @@ -783,7 +779,7 @@ ProcPanoramiXShmGetImage(ClientPtr client) return BadValue; } - rc = dixLookupResourceByClass((pointer *) &draw, stuff->drawable, + rc = dixLookupResourceByClass((void **) &draw, stuff->drawable, XRC_DRAWABLE, client, DixWriteAccess); if (rc != Success) return (rc == BadValue) ? BadDrawable : rc; @@ -980,7 +976,7 @@ ProcPanoramiXShmCreatePixmap(ClientPtr client) shmdesc->refcnt++; pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER; pMap->drawable.id = newPix->info[j].id; - if (!AddResource(newPix->info[j].id, RT_PIXMAP, (pointer) pMap)) { + if (!AddResource(newPix->info[j].id, RT_PIXMAP, (void *) pMap)) { result = BadAlloc; break; } @@ -1016,7 +1012,7 @@ fbShmCreatePixmap(ScreenPtr pScreen, if (!(*pScreen->ModifyPixmapHeader) (pPixmap, width, height, depth, BitsPerPixel(depth), PixmapBytePad(width, depth), - (pointer) addr)) { + (void *) addr)) { (*pScreen->DestroyPixmap) (pPixmap); return NullPixmap; } @@ -1095,7 +1091,7 @@ ProcShmCreatePixmap(ClientPtr client) shmdesc->refcnt++; pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER; pMap->drawable.id = stuff->pid; - if (AddResource(stuff->pid, RT_PIXMAP, (pointer) pMap)) { + if (AddResource(stuff->pid, RT_PIXMAP, (void *) pMap)) { return Success; } } @@ -1172,7 +1168,7 @@ ProcShmAttachFd(ClientPtr client) shmdesc->next = Shmsegs; Shmsegs = shmdesc; - if (!AddResource(stuff->shmseg, ShmSegType, (pointer) shmdesc)) + if (!AddResource(stuff->shmseg, ShmSegType, (void *) shmdesc)) return BadAlloc; return Success; } @@ -1263,7 +1259,7 @@ ProcShmCreateSegment(ClientPtr client) shmdesc->next = Shmsegs; Shmsegs = shmdesc; - if (!AddResource(stuff->shmseg, ShmSegType, (pointer) shmdesc)) { + if (!AddResource(stuff->shmseg, ShmSegType, (void *) shmdesc)) { close(fd); return BadAlloc; } diff --git a/xserver/Xext/sleepuntil.c b/xserver/Xext/sleepuntil.c index 52e22b4a6..993c028b8 100644 --- a/xserver/Xext/sleepuntil.c +++ b/xserver/Xext/sleepuntil.c @@ -46,10 +46,10 @@ typedef struct _Sertafied { ClientPtr pClient; XID id; void (*notifyFunc) (ClientPtr /* client */ , - pointer /* closure */ + void * /* closure */ ); - pointer closure; + void *closure; } SertafiedRec, *SertafiedPtr; static SertafiedPtr pPending; @@ -58,24 +58,24 @@ static Bool BlockHandlerRegistered; static int SertafiedGeneration; static void ClientAwaken(ClientPtr /* client */ , - pointer /* closure */ + void * /* closure */ ); -static int SertafiedDelete(pointer /* value */ , - XID /* id */ +static int SertafiedDelete(void * /* value */ , + XID /* id */ ); -static void SertafiedBlockHandler(pointer /* data */ , +static void SertafiedBlockHandler(void * /* data */ , OSTimePtr /* wt */ , - pointer /* LastSelectMask */ + void * /* LastSelectMask */ ); -static void SertafiedWakeupHandler(pointer /* data */ , - int /* i */ , - pointer /* LastSelectMask */ +static void SertafiedWakeupHandler(void * /* data */ , + int /* i */ , + void * /* LastSelectMask */ ); int ClientSleepUntil(ClientPtr client, TimeStamp *revive, - void (*notifyFunc) (ClientPtr, pointer), pointer closure) + void (*notifyFunc) (ClientPtr, void *), void *closure) { SertafiedPtr pRequest, pReq, pPrev; @@ -97,14 +97,14 @@ ClientSleepUntil(ClientPtr client, if (!BlockHandlerRegistered) { if (!RegisterBlockAndWakeupHandlers(SertafiedBlockHandler, SertafiedWakeupHandler, - (pointer) 0)) { + (void *) 0)) { free(pRequest); return FALSE; } BlockHandlerRegistered = TRUE; } pRequest->notifyFunc = 0; - if (!AddResource(pRequest->id, SertafiedResType, (pointer) pRequest)) + if (!AddResource(pRequest->id, SertafiedResType, (void *) pRequest)) return FALSE; if (!notifyFunc) notifyFunc = ClientAwaken; @@ -126,14 +126,14 @@ ClientSleepUntil(ClientPtr client, } static void -ClientAwaken(ClientPtr client, pointer closure) +ClientAwaken(ClientPtr client, void *closure) { if (!client->clientGone) AttendClient(client); } static int -SertafiedDelete(pointer value, XID id) +SertafiedDelete(void *value, XID id) { SertafiedPtr pRequest = (SertafiedPtr) value; SertafiedPtr pReq, pPrev; @@ -154,7 +154,7 @@ SertafiedDelete(pointer value, XID id) } static void -SertafiedBlockHandler(pointer data, OSTimePtr wt, pointer LastSelectMask) +SertafiedBlockHandler(void *data, OSTimePtr wt, void *LastSelectMask) { SertafiedPtr pReq, pNext; unsigned long delay; @@ -186,7 +186,7 @@ SertafiedBlockHandler(pointer data, OSTimePtr wt, pointer LastSelectMask) } static void -SertafiedWakeupHandler(pointer data, int i, pointer LastSelectMask) +SertafiedWakeupHandler(void *data, int i, void *LastSelectMask) { SertafiedPtr pReq, pNext; TimeStamp now; @@ -203,7 +203,7 @@ SertafiedWakeupHandler(pointer data, int i, pointer LastSelectMask) } if (!pPending) { RemoveBlockAndWakeupHandlers(SertafiedBlockHandler, - SertafiedWakeupHandler, (pointer) 0); + SertafiedWakeupHandler, (void *) 0); BlockHandlerRegistered = FALSE; } } diff --git a/xserver/Xext/sleepuntil.h b/xserver/Xext/sleepuntil.h index 5c7084842..e9b8388f9 100644 --- a/xserver/Xext/sleepuntil.h +++ b/xserver/Xext/sleepuntil.h @@ -36,7 +36,7 @@ extern int ClientSleepUntil(ClientPtr client, TimeStamp *revive, void (*notifyFunc) (ClientPtr /* client */ , - pointer /* closure */ - ), pointer Closure); + void * /* closure */ + ), void *Closure); #endif diff --git a/xserver/Xext/sync.c b/xserver/Xext/sync.c index c33b5b5bb..755ed94a1 100644 --- a/xserver/Xext/sync.c +++ b/xserver/Xext/sync.c @@ -324,7 +324,7 @@ SyncInitTrigger(ClientPtr client, SyncTrigger * pTrigger, XID syncObject, if (changes & XSyncCACounter) { if (syncObject == None) pSync = NULL; - else if (Success != (rc = dixLookupResourceByType((pointer *) &pSync, + else if (Success != (rc = dixLookupResourceByType((void **) &pSync, syncObject, resType, client, DixReadAccess))) { @@ -344,7 +344,7 @@ SyncInitTrigger(ClientPtr client, SyncTrigger * pTrigger, XID syncObject, pCounter = (SyncCounter *) pSync; if (IsSystemCounter(pCounter)) { - (*pCounter->pSysCounterInfo->QueryValue) ((pointer) pCounter, + (*pCounter->pSysCounterInfo->QueryValue) ((void *) pCounter, &pCounter->value); } } @@ -933,7 +933,7 @@ SyncCreateFenceFromFD(ClientPtr client, DrawablePtr pDraw, XID id, int fd, BOOL return status; } - if (!AddResource(id, RTFence, (pointer) pFence)) + if (!AddResource(id, RTFence, (void *) pFence)) return BadAlloc; return Success; @@ -963,7 +963,7 @@ SyncCreateCounter(ClientPtr client, XSyncCounter id, CARD64 initialvalue) pCounter->value = initialvalue; pCounter->pSysCounterInfo = NULL; - if (!AddResource(id, RTCounter, (pointer) pCounter)) + if (!AddResource(id, RTCounter, (void *) pCounter)) return NULL; return pCounter; @@ -1023,7 +1023,7 @@ SyncCreateSystemCounter(const char *name, } void -SyncDestroySystemCounter(pointer pSysCounter) +SyncDestroySystemCounter(void *pSysCounter) { SyncCounter *pCounter = (SyncCounter *) pSysCounter; @@ -1121,7 +1121,7 @@ SyncComputeBracketValues(SyncCounter * pCounter) } } /* end for each trigger */ - (*psci->BracketValues) ((pointer) pCounter, pnewltval, pnewgtval); + (*psci->BracketValues) ((void *) pCounter, pnewltval, pnewgtval); } @@ -1431,7 +1431,7 @@ ProcSyncSetCounter(ClientPtr client) REQUEST_SIZE_MATCH(xSyncSetCounterReq); - rc = dixLookupResourceByType((pointer *) &pCounter, stuff->cid, RTCounter, + rc = dixLookupResourceByType((void **) &pCounter, stuff->cid, RTCounter, client, DixWriteAccess); if (rc != Success) return rc; @@ -1460,7 +1460,7 @@ ProcSyncChangeCounter(ClientPtr client) REQUEST_SIZE_MATCH(xSyncChangeCounterReq); - rc = dixLookupResourceByType((pointer *) &pCounter, stuff->cid, RTCounter, + rc = dixLookupResourceByType((void **) &pCounter, stuff->cid, RTCounter, client, DixWriteAccess); if (rc != Success) return rc; @@ -1493,7 +1493,7 @@ ProcSyncDestroyCounter(ClientPtr client) REQUEST_SIZE_MATCH(xSyncDestroyCounterReq); - rc = dixLookupResourceByType((pointer *) &pCounter, stuff->counter, + rc = dixLookupResourceByType((void **) &pCounter, stuff->counter, RTCounter, client, DixDestroyAccess); if (rc != Success) return rc; @@ -1654,14 +1654,14 @@ ProcSyncQueryCounter(ClientPtr client) REQUEST_SIZE_MATCH(xSyncQueryCounterReq); - rc = dixLookupResourceByType((pointer *) &pCounter, stuff->counter, + rc = dixLookupResourceByType((void **) &pCounter, stuff->counter, RTCounter, client, DixReadAccess); if (rc != Success) return rc; /* if system counter, ask it what the current value is */ if (IsSystemCounter(pCounter)) { - (*pCounter->pSysCounterInfo->QueryValue) ((pointer) pCounter, + (*pCounter->pSysCounterInfo->QueryValue) ((void *) pCounter, &pCounter->value); } @@ -1780,7 +1780,7 @@ ProcSyncChangeAlarm(ClientPtr client) REQUEST_AT_LEAST_SIZE(xSyncChangeAlarmReq); - status = dixLookupResourceByType((pointer *) &pAlarm, stuff->alarm, RTAlarm, + status = dixLookupResourceByType((void **) &pAlarm, stuff->alarm, RTAlarm, client, DixWriteAccess); if (status != Success) return status; @@ -1821,7 +1821,7 @@ ProcSyncQueryAlarm(ClientPtr client) REQUEST_SIZE_MATCH(xSyncQueryAlarmReq); - rc = dixLookupResourceByType((pointer *) &pAlarm, stuff->alarm, RTAlarm, + rc = dixLookupResourceByType((void **) &pAlarm, stuff->alarm, RTAlarm, client, DixReadAccess); if (rc != Success) return rc; @@ -1879,7 +1879,7 @@ ProcSyncDestroyAlarm(ClientPtr client) REQUEST_SIZE_MATCH(xSyncDestroyAlarmReq); - rc = dixLookupResourceByType((pointer *) &pAlarm, stuff->alarm, RTAlarm, + rc = dixLookupResourceByType((void **) &pAlarm, stuff->alarm, RTAlarm, client, DixDestroyAccess); if (rc != Success) return rc; @@ -1909,7 +1909,7 @@ ProcSyncCreateFence(ClientPtr client) miSyncInitFence(pDraw->pScreen, pFence, stuff->initially_triggered); - if (!AddResource(stuff->fid, RTFence, (pointer) pFence)) + if (!AddResource(stuff->fid, RTFence, (void *) pFence)) return BadAlloc; return client->noClientException; @@ -1928,7 +1928,7 @@ FreeFence(void *obj, XID id) int SyncVerifyFence(SyncFence ** ppSyncFence, XID fid, ClientPtr client, Mask mode) { - int rc = dixLookupResourceByType((pointer *) ppSyncFence, fid, RTFence, + int rc = dixLookupResourceByType((void **) ppSyncFence, fid, RTFence, client, mode); if (rc != Success) @@ -1946,7 +1946,7 @@ ProcSyncTriggerFence(ClientPtr client) REQUEST_SIZE_MATCH(xSyncTriggerFenceReq); - rc = dixLookupResourceByType((pointer *) &pFence, stuff->fid, RTFence, + rc = dixLookupResourceByType((void **) &pFence, stuff->fid, RTFence, client, DixWriteAccess); if (rc != Success) return rc; @@ -1965,7 +1965,7 @@ ProcSyncResetFence(ClientPtr client) REQUEST_SIZE_MATCH(xSyncResetFenceReq); - rc = dixLookupResourceByType((pointer *) &pFence, stuff->fid, RTFence, + rc = dixLookupResourceByType((void **) &pFence, stuff->fid, RTFence, client, DixWriteAccess); if (rc != Success) return rc; @@ -1987,7 +1987,7 @@ ProcSyncDestroyFence(ClientPtr client) REQUEST_SIZE_MATCH(xSyncDestroyFenceReq); - rc = dixLookupResourceByType((pointer *) &pFence, stuff->fid, RTFence, + rc = dixLookupResourceByType((void **) &pFence, stuff->fid, RTFence, client, DixDestroyAccess); if (rc != Success) return rc; @@ -2006,7 +2006,7 @@ ProcSyncQueryFence(ClientPtr client) REQUEST_SIZE_MATCH(xSyncQueryFenceReq); - rc = dixLookupResourceByType((pointer *) &pFence, stuff->fid, + rc = dixLookupResourceByType((void **) &pFence, stuff->fid, RTFence, client, DixReadAccess); if (rc != Success) return rc; @@ -2555,7 +2555,7 @@ SyncExtensionInit(void) * ***** SERVERTIME implementation - should go in its own file in OS directory? */ -static pointer ServertimeCounter; +static void *ServertimeCounter; static XSyncValue Now; static XSyncValue *pnext_time; @@ -2656,7 +2656,7 @@ typedef struct { } IdleCounterPriv; static void -IdleTimeQueryValue(pointer pCounter, CARD64 * pValue_return) +IdleTimeQueryValue(void *pCounter, CARD64 * pValue_return) { int deviceid; CARD32 idle; @@ -2673,7 +2673,7 @@ IdleTimeQueryValue(pointer pCounter, CARD64 * pValue_return) } static void -IdleTimeBlockHandler(pointer pCounter, struct timeval **wt, pointer LastSelectMask) +IdleTimeBlockHandler(void *pCounter, struct timeval **wt, void *LastSelectMask) { SyncCounter *counter = pCounter; IdleCounterPriv *priv = SysCounterGetPrivate(counter); @@ -2766,7 +2766,7 @@ IdleTimeCheckBrackets(SyncCounter *counter, XSyncValue idle, XSyncValue *less, X } static void -IdleTimeWakeupHandler(pointer pCounter, int rc, pointer LastSelectMask) +IdleTimeWakeupHandler(void *pCounter, int rc, void *LastSelectMask) { SyncCounter *counter = pCounter; IdleCounterPriv *priv = SysCounterGetPrivate(counter); @@ -2800,7 +2800,7 @@ IdleTimeWakeupHandler(pointer pCounter, int rc, pointer LastSelectMask) } static void -IdleTimeBracketValues(pointer pCounter, CARD64 * pbracket_less, +IdleTimeBracketValues(void *pCounter, CARD64 * pbracket_less, CARD64 * pbracket_greater) { SyncCounter *counter = pCounter; diff --git a/xserver/Xext/syncsrv.h b/xserver/Xext/syncsrv.h index 45fca04da..8c2c00df0 100644 --- a/xserver/Xext/syncsrv.h +++ b/xserver/Xext/syncsrv.h @@ -66,10 +66,10 @@ typedef enum { XSyncCounterUnrestricted } SyncCounterType; -typedef void (*SyncSystemCounterQueryValue)(pointer counter, +typedef void (*SyncSystemCounterQueryValue)(void *counter, CARD64 *value_return ); -typedef void (*SyncSystemCounterBracketValues)(pointer counter, +typedef void (*SyncSystemCounterBracketValues)(void *counter, CARD64 *pbracket_less, CARD64 *pbracket_greater ); @@ -132,7 +132,7 @@ extern void SyncChangeCounter(SyncCounter *pCounter, CARD64 new_value ); -extern void SyncDestroySystemCounter(pointer pCounter); +extern void SyncDestroySystemCounter(void *pCounter); extern SyncCounter *SyncInitDeviceIdleTime(DeviceIntPtr dev); extern void SyncRemoveDeviceIdleTime(SyncCounter *counter); diff --git a/xserver/Xext/xace.c b/xserver/Xext/xace.c index 026d3c5cf..d77b3126a 100644 --- a/xserver/Xext/xace.c +++ b/xserver/Xext/xace.c @@ -122,9 +122,9 @@ XaceHook(int hook, ...) u.res.client = va_arg(ap, ClientPtr); u.res.id = va_arg(ap, XID); u.res.rtype = va_arg(ap, RESTYPE); - u.res.res = va_arg(ap, pointer); + u.res.res = va_arg(ap, void *); u.res.ptype = va_arg(ap, RESTYPE); - u.res.parent = va_arg(ap, pointer); + u.res.parent = va_arg(ap, void *); u.res.access_mode = va_arg(ap, Mask); u.res.status = Success; /* default allow */ @@ -288,7 +288,7 @@ XaceCensorImage(ClientPtr client, pPix = GetScratchPixmapHeader(pDraw->pScreen, w, h, depth, bitsPerPixel, - widthBytesLine, (pointer) pBuf); + widthBytesLine, (void *) pBuf); if (!pPix) { failed = TRUE; goto failSafe; diff --git a/xserver/Xext/xacestr.h b/xserver/Xext/xacestr.h index 989b0339f..6fe8eecc8 100644 --- a/xserver/Xext/xacestr.h +++ b/xserver/Xext/xacestr.h @@ -40,9 +40,9 @@ typedef struct { ClientPtr client; XID id; RESTYPE rtype; - pointer res; + void *res; RESTYPE ptype; - pointer parent; + void *parent; Mask access_mode; int status; } XaceResourceAccessRec; diff --git a/xserver/Xext/xres.c b/xserver/Xext/xres.c index 445abcab8..546b942a1 100644 --- a/xserver/Xext/xres.c +++ b/xserver/Xext/xres.c @@ -193,7 +193,6 @@ DestroyConstructResourceBytesCtx(ConstructResourceBytesCtx *ctx) static int ProcXResQueryVersion(ClientPtr client) { - REQUEST(xXResQueryVersionReq); xXResQueryVersionReply rep = { .type = X_Reply, .sequenceNumber = client->sequence, @@ -268,7 +267,7 @@ ProcXResQueryClients(ClientPtr client) } static void -ResFindAllRes(pointer value, XID id, RESTYPE type, pointer cdata) +ResFindAllRes(void *value, XID id, RESTYPE type, void *cdata) { int *counts = (int *) cdata; @@ -354,9 +353,9 @@ static unsigned long ResGetApproxPixmapBytes(PixmapPtr pix) { unsigned long nPixels; - int bytesPerPixel; + float bytesPerPixel; - bytesPerPixel = pix->drawable.bitsPerPixel >> 3; + bytesPerPixel = (float)pix->drawable.bitsPerPixel / 8.0; nPixels = pix->drawable.width * pix->drawable.height; /* Divide by refcnt as pixmap could be shared between clients, @@ -366,7 +365,7 @@ ResGetApproxPixmapBytes(PixmapPtr pix) } static void -ResFindResourcePixmaps(pointer value, XID id, RESTYPE type, pointer cdata) +ResFindResourcePixmaps(void *value, XID id, RESTYPE type, void *cdata) { SizeType sizeFunc = GetResourceTypeSizeFunc(type); ResourceSizeRec size = { 0, 0, 0 }; @@ -377,7 +376,7 @@ ResFindResourcePixmaps(pointer value, XID id, RESTYPE type, pointer cdata) } static void -ResFindPixmaps(pointer value, XID id, pointer cdata) +ResFindPixmaps(void *value, XID id, void *cdata) { unsigned long *bytes = (unsigned long *) cdata; PixmapPtr pix = (PixmapPtr) value; @@ -386,7 +385,7 @@ ResFindPixmaps(pointer value, XID id, pointer cdata) } static void -ResFindWindowPixmaps(pointer value, XID id, pointer cdata) +ResFindWindowPixmaps(void *value, XID id, void *cdata) { unsigned long *bytes = (unsigned long *) cdata; WindowPtr pWin = (WindowPtr) value; @@ -399,7 +398,7 @@ ResFindWindowPixmaps(pointer value, XID id, pointer cdata) } static void -ResFindGCPixmaps(pointer value, XID id, pointer cdata) +ResFindGCPixmaps(void *value, XID id, void *cdata) { unsigned long *bytes = (unsigned long *) cdata; GCPtr pGC = (GCPtr) value; @@ -412,7 +411,7 @@ ResFindGCPixmaps(pointer value, XID id, pointer cdata) } static void -ResFindPicturePixmaps(pointer value, XID id, pointer cdata) +ResFindPicturePixmaps(void *value, XID id, void *cdata) { #ifdef RENDER ResFindResourcePixmaps(value, id, PictureType, cdata); @@ -420,7 +419,7 @@ ResFindPicturePixmaps(pointer value, XID id, pointer cdata) } static void -ResFindCompositeClientWindowPixmaps (pointer value, XID id, pointer cdata) +ResFindCompositeClientWindowPixmaps (void *value, XID id, void *cdata) { #ifdef COMPOSITE ResFindResourcePixmaps(value, id, CompositeClientWindowType, cdata); @@ -447,32 +446,32 @@ ProcXResQueryClientPixmapBytes(ClientPtr client) bytes = 0; FindClientResourcesByType(clients[clientID], RT_PIXMAP, ResFindPixmaps, - (pointer) (&bytes)); + (void *) (&bytes)); /* * Make sure win background pixmaps also held to account. */ FindClientResourcesByType(clients[clientID], RT_WINDOW, - ResFindWindowPixmaps, (pointer) (&bytes)); + ResFindWindowPixmaps, (void *) (&bytes)); /* * GC Tile & Stipple pixmaps too. */ FindClientResourcesByType(clients[clientID], RT_GC, - ResFindGCPixmaps, (pointer) (&bytes)); + ResFindGCPixmaps, (void *) (&bytes)); #ifdef RENDER /* Render extension picture pixmaps. */ FindClientResourcesByType(clients[clientID], PictureType, ResFindPicturePixmaps, - (pointer)(&bytes)); + (void *)(&bytes)); #endif #ifdef COMPOSITE /* Composite extension client window pixmaps. */ FindClientResourcesByType(clients[clientID], CompositeClientWindowType, ResFindCompositeClientWindowPixmaps, - (pointer)(&bytes)); + (void *)(&bytes)); #endif rep = (xXResQueryClientPixmapBytesReply) { @@ -754,10 +753,10 @@ SwapXResQueryResourceBytes(struct xorg_list *response) FindRes */ static void -AddSubResourceSizeSpec(pointer value, +AddSubResourceSizeSpec(void *value, XID id, RESTYPE type, - pointer cdata) + void *cdata) { ConstructResourceBytesCtx *ctx = cdata; @@ -819,7 +818,7 @@ AddSubResourceSizeSpec(pointer value, FindRes */ static void -AddResourceSizeValue(pointer ptr, XID id, RESTYPE type, pointer cdata) +AddResourceSizeValue(void *ptr, XID id, RESTYPE type, void *cdata) { ConstructResourceBytesCtx *ctx = cdata; if (ctx->status == Success && @@ -889,7 +888,7 @@ AddResourceSizeValue(pointer ptr, XID id, RESTYPE type, pointer cdata) @param[in/out] cdata The context object that contains the resource type */ static void -AddResourceSizeValueWithResType(pointer ptr, XID id, pointer cdata) +AddResourceSizeValueWithResType(void *ptr, XID id, void *cdata) { ConstructResourceBytesCtx *ctx = cdata; AddResourceSizeValue(ptr, id, ctx->resType, cdata); @@ -907,7 +906,7 @@ AddResourceSizeValueWithResType(pointer ptr, XID id, pointer cdata) type FindAllRes */ static void -AddResourceSizeValueByResource(pointer ptr, XID id, RESTYPE type, pointer cdata) +AddResourceSizeValueByResource(void *ptr, XID id, RESTYPE type, void *cdata) { ConstructResourceBytesCtx *ctx = cdata; xXResResourceIdSpec *spec = ctx->curSpec; @@ -1103,7 +1102,6 @@ ProcResDispatch(ClientPtr client) static int SProcXResQueryVersion(ClientPtr client) { - REQUEST(xXResQueryVersionReq); REQUEST_SIZE_MATCH(xXResQueryVersionReq); return ProcXResQueryVersion(client); } diff --git a/xserver/Xext/xselinux_ext.c b/xserver/Xext/xselinux_ext.c index 3115f03ea..fb7b2d526 100644 --- a/xserver/Xext/xselinux_ext.c +++ b/xserver/Xext/xselinux_ext.c @@ -245,7 +245,7 @@ ProcSELinuxGetDrawableContext(ClientPtr client) } static int -ProcSELinuxGetPropertyContext(ClientPtr client, pointer privKey) +ProcSELinuxGetPropertyContext(ClientPtr client, void *privKey) { WindowPtr pWin; PropertyPtr pProp; @@ -269,7 +269,7 @@ ProcSELinuxGetPropertyContext(ClientPtr client, pointer privKey) } static int -ProcSELinuxGetSelectionContext(ClientPtr client, pointer privKey) +ProcSELinuxGetSelectionContext(ClientPtr client, void *privKey) { Selection *pSel; SELinuxObjectRec *obj; @@ -576,7 +576,7 @@ SProcSELinuxGetDrawableContext(ClientPtr client) } static int -SProcSELinuxGetPropertyContext(ClientPtr client, pointer privKey) +SProcSELinuxGetPropertyContext(ClientPtr client, void *privKey) { REQUEST(SELinuxGetPropertyContextReq); @@ -587,7 +587,7 @@ SProcSELinuxGetPropertyContext(ClientPtr client, pointer privKey) } static int -SProcSELinuxGetSelectionContext(ClientPtr client, pointer privKey) +SProcSELinuxGetSelectionContext(ClientPtr client, void *privKey) { REQUEST(SELinuxGetContextReq); diff --git a/xserver/Xext/xselinux_hooks.c b/xserver/Xext/xselinux_hooks.c index e9c7e93d7..48219a9e0 100644 --- a/xserver/Xext/xselinux_hooks.c +++ b/xserver/Xext/xselinux_hooks.c @@ -74,10 +74,10 @@ static Atom atom_client_ctx; static security_id_t unlabeled_sid; /* forward declarations */ -static void SELinuxScreen(CallbackListPtr *, pointer, pointer); +static void SELinuxScreen(CallbackListPtr *, void *, void *); /* "true" pointer value for use as callback data */ -static pointer truep = (pointer) 1; +static void *truep = (void *) 1; /* * Performs an SELinux permission check. @@ -147,7 +147,7 @@ SELinuxLabelClient(ClientPtr client) strncpy(subj->command, cmdname, COMMAND_LEN - 1); if (!cached) - free((void *) cmdname); /* const char * */ + free(cmdname); /* const char * */ } finish: @@ -171,7 +171,7 @@ SELinuxLabelInitial(void) SELinuxSubjectRec *subj; SELinuxObjectRec *obj; security_context_t ctx; - pointer unused; + void *unused; /* Do the serverClient */ subj = dixLookupPrivate(&serverClient->devPrivates, subjectKey); @@ -326,7 +326,7 @@ SELinuxLog(int type, const char *fmt, ...) */ static void -SELinuxDevice(CallbackListPtr *pcbl, pointer unused, pointer calldata) +SELinuxDevice(CallbackListPtr *pcbl, void *unused, void *calldata) { XaceDeviceAccessRec *rec = calldata; SELinuxSubjectRec *subj; @@ -363,7 +363,7 @@ SELinuxDevice(CallbackListPtr *pcbl, pointer unused, pointer calldata) } static void -SELinuxSend(CallbackListPtr *pcbl, pointer unused, pointer calldata) +SELinuxSend(CallbackListPtr *pcbl, void *unused, void *calldata) { XaceSendAccessRec *rec = calldata; SELinuxSubjectRec *subj; @@ -405,7 +405,7 @@ SELinuxSend(CallbackListPtr *pcbl, pointer unused, pointer calldata) } static void -SELinuxReceive(CallbackListPtr *pcbl, pointer unused, pointer calldata) +SELinuxReceive(CallbackListPtr *pcbl, void *unused, void *calldata) { XaceReceiveAccessRec *rec = calldata; SELinuxSubjectRec *subj; @@ -443,7 +443,7 @@ SELinuxReceive(CallbackListPtr *pcbl, pointer unused, pointer calldata) } static void -SELinuxExtension(CallbackListPtr *pcbl, pointer unused, pointer calldata) +SELinuxExtension(CallbackListPtr *pcbl, void *unused, void *calldata) { XaceExtAccessRec *rec = calldata; SELinuxSubjectRec *subj, *serv; @@ -484,7 +484,7 @@ SELinuxExtension(CallbackListPtr *pcbl, pointer unused, pointer calldata) } static void -SELinuxSelection(CallbackListPtr *pcbl, pointer unused, pointer calldata) +SELinuxSelection(CallbackListPtr *pcbl, void *unused, void *calldata) { XaceSelectionAccessRec *rec = calldata; SELinuxSubjectRec *subj; @@ -544,7 +544,7 @@ SELinuxSelection(CallbackListPtr *pcbl, pointer unused, pointer calldata) } static void -SELinuxProperty(CallbackListPtr *pcbl, pointer unused, pointer calldata) +SELinuxProperty(CallbackListPtr *pcbl, void *unused, void *calldata) { XacePropertyAccessRec *rec = calldata; SELinuxSubjectRec *subj; @@ -608,7 +608,7 @@ SELinuxProperty(CallbackListPtr *pcbl, pointer unused, pointer calldata) } static void -SELinuxResource(CallbackListPtr *pcbl, pointer unused, pointer calldata) +SELinuxResource(CallbackListPtr *pcbl, void *unused, void *calldata) { XaceResourceAccessRec *rec = calldata; SELinuxSubjectRec *subj; @@ -667,7 +667,7 @@ SELinuxResource(CallbackListPtr *pcbl, pointer unused, pointer calldata) } static void -SELinuxScreen(CallbackListPtr *pcbl, pointer is_saver, pointer calldata) +SELinuxScreen(CallbackListPtr *pcbl, void *is_saver, void *calldata) { XaceScreenAccessRec *rec = calldata; SELinuxSubjectRec *subj; @@ -699,7 +699,7 @@ SELinuxScreen(CallbackListPtr *pcbl, pointer is_saver, pointer calldata) } static void -SELinuxClient(CallbackListPtr *pcbl, pointer unused, pointer calldata) +SELinuxClient(CallbackListPtr *pcbl, void *unused, void *calldata) { XaceClientAccessRec *rec = calldata; SELinuxSubjectRec *subj; @@ -717,7 +717,7 @@ SELinuxClient(CallbackListPtr *pcbl, pointer unused, pointer calldata) } static void -SELinuxServer(CallbackListPtr *pcbl, pointer unused, pointer calldata) +SELinuxServer(CallbackListPtr *pcbl, void *unused, void *calldata) { XaceServerAccessRec *rec = calldata; SELinuxSubjectRec *subj; @@ -739,7 +739,7 @@ SELinuxServer(CallbackListPtr *pcbl, pointer unused, pointer calldata) */ static void -SELinuxClientState(CallbackListPtr *pcbl, pointer unused, pointer calldata) +SELinuxClientState(CallbackListPtr *pcbl, void *unused, void *calldata) { NewClientInfoRec *pci = calldata; @@ -754,7 +754,7 @@ SELinuxClientState(CallbackListPtr *pcbl, pointer unused, pointer calldata) } static void -SELinuxResourceState(CallbackListPtr *pcbl, pointer unused, pointer calldata) +SELinuxResourceState(CallbackListPtr *pcbl, void *unused, void *calldata) { ResourceStateInfoRec *rec = calldata; SELinuxSubjectRec *subj; @@ -812,9 +812,9 @@ SELinuxBlockHandler(void *data, struct timeval **tv, void *read_mask) } static void -SELinuxWakeupHandler(void *data, int err, void *read_mask) +SELinuxWakeupHandler(void *data, int num_fds, void *read_mask) { - if (FD_ISSET(netlink_fd, (fd_set *) read_mask)) + if (num_fds > 0 && FD_ISSET(netlink_fd, (fd_set *) read_mask)) avc_netlink_check_nb(); } diff --git a/xserver/Xext/xtest.c b/xserver/Xext/xtest.c index 0a854f39a..88df4433b 100644 --- a/xserver/Xext/xtest.c +++ b/xserver/Xext/xtest.c @@ -127,7 +127,7 @@ ProcXTestCompareCursor(ClientPtr client) else if (stuff->cursor == XTestCurrentCursor) pCursor = GetSpriteCursor(ptr); else { - rc = dixLookupResourceByType((pointer *) &pCursor, stuff->cursor, + rc = dixLookupResourceByType((void **) &pCursor, stuff->cursor, RT_CURSOR, client, DixReadAccess); if (rc != Success) { client->errorValue = stuff->cursor; diff --git a/xserver/Xext/xvdisp.c b/xserver/Xext/xvdisp.c index 613867a6b..f2d49a2b8 100644 --- a/xserver/Xext/xvdisp.c +++ b/xserver/Xext/xvdisp.c @@ -994,7 +994,7 @@ ProcXvShmPutImage(ClientPtr client) if (!pImage) return BadMatch; - status = dixLookupResourceByType((pointer *) &shmdesc, stuff->shmseg, + status = dixLookupResourceByType((void **) &shmdesc, stuff->shmseg, ShmSegType, serverClient, DixReadAccess); if (status != Success) return status; @@ -1512,12 +1512,12 @@ XineramaXvStopVideo(ClientPtr client) REQUEST(xvStopVideoReq); REQUEST_SIZE_MATCH(xvStopVideoReq); - result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable, + result = dixLookupResourceByClass((void **) &draw, stuff->drawable, XRC_DRAWABLE, client, DixWriteAccess); if (result != Success) return (result == BadValue) ? BadDrawable : result; - result = dixLookupResourceByType((pointer *) &port, stuff->port, + result = dixLookupResourceByType((void **) &port, stuff->port, XvXRTPort, client, DixReadAccess); if (result != Success) return result; @@ -1542,7 +1542,7 @@ XineramaXvSetPortAttribute(ClientPtr client) REQUEST_SIZE_MATCH(xvSetPortAttributeReq); - result = dixLookupResourceByType((pointer *) &port, stuff->port, + result = dixLookupResourceByType((void **) &port, stuff->port, XvXRTPort, client, DixReadAccess); if (result != Success) return result; @@ -1568,17 +1568,17 @@ XineramaXvShmPutImage(ClientPtr client) REQUEST_SIZE_MATCH(xvShmPutImageReq); - result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable, + result = dixLookupResourceByClass((void **) &draw, stuff->drawable, XRC_DRAWABLE, client, DixWriteAccess); if (result != Success) return (result == BadValue) ? BadDrawable : result; - result = dixLookupResourceByType((pointer *) &gc, stuff->gc, + result = dixLookupResourceByType((void **) &gc, stuff->gc, XRT_GC, client, DixReadAccess); if (result != Success) return result; - result = dixLookupResourceByType((pointer *) &port, stuff->port, + result = dixLookupResourceByType((void **) &port, stuff->port, XvXRTPort, client, DixReadAccess); if (result != Success) return result; @@ -1620,17 +1620,17 @@ XineramaXvPutImage(ClientPtr client) REQUEST_AT_LEAST_SIZE(xvPutImageReq); - result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable, + result = dixLookupResourceByClass((void **) &draw, stuff->drawable, XRC_DRAWABLE, client, DixWriteAccess); if (result != Success) return (result == BadValue) ? BadDrawable : result; - result = dixLookupResourceByType((pointer *) &gc, stuff->gc, + result = dixLookupResourceByType((void **) &gc, stuff->gc, XRT_GC, client, DixReadAccess); if (result != Success) return result; - result = dixLookupResourceByType((pointer *) &port, stuff->port, + result = dixLookupResourceByType((void **) &port, stuff->port, XvXRTPort, client, DixReadAccess); if (result != Success) return result; @@ -1668,17 +1668,17 @@ XineramaXvPutVideo(ClientPtr client) REQUEST_AT_LEAST_SIZE(xvPutVideoReq); - result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable, + result = dixLookupResourceByClass((void **) &draw, stuff->drawable, XRC_DRAWABLE, client, DixWriteAccess); if (result != Success) return (result == BadValue) ? BadDrawable : result; - result = dixLookupResourceByType((pointer *) &gc, stuff->gc, + result = dixLookupResourceByType((void **) &gc, stuff->gc, XRT_GC, client, DixReadAccess); if (result != Success) return result; - result = dixLookupResourceByType((pointer *) &port, stuff->port, + result = dixLookupResourceByType((void **) &port, stuff->port, XvXRTPort, client, DixReadAccess); if (result != Success) return result; @@ -1716,17 +1716,17 @@ XineramaXvPutStill(ClientPtr client) REQUEST_AT_LEAST_SIZE(xvPutImageReq); - result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable, + result = dixLookupResourceByClass((void **) &draw, stuff->drawable, XRC_DRAWABLE, client, DixWriteAccess); if (result != Success) return (result == BadValue) ? BadDrawable : result; - result = dixLookupResourceByType((pointer *) &gc, stuff->gc, + result = dixLookupResourceByType((void **) &gc, stuff->gc, XRT_GC, client, DixReadAccess); if (result != Success) return result; - result = dixLookupResourceByType((pointer *) &port, stuff->port, + result = dixLookupResourceByType((void **) &port, stuff->port, XvXRTPort, client, DixReadAccess); if (result != Success) return result; diff --git a/xserver/Xext/xvdix.h b/xserver/Xext/xvdix.h index 9c6160c3b..bb08cf4c7 100644 --- a/xserver/Xext/xvdix.h +++ b/xserver/Xext/xvdix.h @@ -200,7 +200,7 @@ typedef struct _XvPortRec { #define VALIDATE_XV_PORT(portID, pPort, mode)\ {\ - int rc = dixLookupResourceByType((pointer *)&(pPort), portID,\ + int rc = dixLookupResourceByType((void **)&(pPort), portID,\ XvRTPort, client, mode);\ if (rc != Success)\ return rc;\ diff --git a/xserver/Xext/xvmain.c b/xserver/Xext/xvmain.c index 0c5dc9bc1..00b5179bd 100644 --- a/xserver/Xext/xvmain.c +++ b/xserver/Xext/xvmain.c @@ -134,12 +134,12 @@ static Bool XvCloseScreen(ScreenPtr); static Bool XvDestroyPixmap(PixmapPtr); static Bool XvDestroyWindow(WindowPtr); static void XvResetProc(ExtensionEntry *); -static int XvdiDestroyGrab(pointer, XID); -static int XvdiDestroyEncoding(pointer, XID); -static int XvdiDestroyVideoNotify(pointer, XID); -static int XvdiDestroyPortNotify(pointer, XID); -static int XvdiDestroyVideoNotifyList(pointer, XID); -static int XvdiDestroyPort(pointer, XID); +static int XvdiDestroyGrab(void *, XID); +static int XvdiDestroyEncoding(void *, XID); +static int XvdiDestroyVideoNotify(void *, XID); +static int XvdiDestroyPortNotify(void *, XID); +static int XvdiDestroyVideoNotifyList(void *, XID); +static int XvdiDestroyPort(void *, XID); static int XvdiSendVideoNotify(XvPortPtr, DrawablePtr, int); /* @@ -450,20 +450,20 @@ XvdiVideoStopped(XvPortPtr pPort, int reason) } static int -XvdiDestroyPort(pointer pPort, XID id) +XvdiDestroyPort(void *pPort, XID id) { return (*((XvPortPtr) pPort)->pAdaptor->ddFreePort) (pPort); } static int -XvdiDestroyGrab(pointer pGrab, XID id) +XvdiDestroyGrab(void *pGrab, XID id) { ((XvGrabPtr) pGrab)->client = NULL; return Success; } static int -XvdiDestroyVideoNotify(pointer pn, XID id) +XvdiDestroyVideoNotify(void *pn, XID id) { /* JUST CLEAR OUT THE client POINTER FIELD */ @@ -472,7 +472,7 @@ XvdiDestroyVideoNotify(pointer pn, XID id) } static int -XvdiDestroyPortNotify(pointer pn, XID id) +XvdiDestroyPortNotify(void *pn, XID id) { /* JUST CLEAR OUT THE client POINTER FIELD */ @@ -481,7 +481,7 @@ XvdiDestroyPortNotify(pointer pn, XID id) } static int -XvdiDestroyVideoNotifyList(pointer pn, XID id) +XvdiDestroyVideoNotifyList(void *pn, XID id) { XvVideoNotifyPtr npn, cpn; @@ -500,7 +500,7 @@ XvdiDestroyVideoNotifyList(pointer pn, XID id) } static int -XvdiDestroyEncoding(pointer value, XID id) +XvdiDestroyEncoding(void *value, XID id) { return Success; } @@ -510,7 +510,7 @@ XvdiSendVideoNotify(XvPortPtr pPort, DrawablePtr pDraw, int reason) { XvVideoNotifyPtr pn; - dixLookupResourceByType((pointer *) &pn, pDraw->id, XvRTVideoNotifyList, + dixLookupResourceByType((void **) &pn, pDraw->id, XvRTVideoNotifyList, serverClient, DixReadAccess); while (pn) { @@ -843,7 +843,7 @@ XvdiSelectVideoNotify(ClientPtr client, DrawablePtr pDraw, BOOL onoff) /* FIND VideoNotify LIST */ - rc = dixLookupResourceByType((pointer *) &pn, pDraw->id, + rc = dixLookupResourceByType((void **) &pn, pDraw->id, XvRTVideoNotifyList, client, DixWriteAccess); if (rc != Success && rc != BadValue) return rc; diff --git a/xserver/Xext/xvmc.c b/xserver/Xext/xvmc.c index 5f0123b32..64eda922b 100644 --- a/xserver/Xext/xvmc.c +++ b/xserver/Xext/xvmc.c @@ -61,7 +61,7 @@ typedef struct { (XvMCScreenPtr)(dixLookupPrivate(&(pScreen)->devPrivates, XvMCScreenKey)) static int -XvMCDestroyContextRes(pointer data, XID id) +XvMCDestroyContextRes(void *data, XID id) { XvMCContextPtr pContext = (XvMCContextPtr) data; @@ -78,7 +78,7 @@ XvMCDestroyContextRes(pointer data, XID id) } static int -XvMCDestroySurfaceRes(pointer data, XID id) +XvMCDestroySurfaceRes(void *data, XID id) { XvMCSurfacePtr pSurface = (XvMCSurfacePtr) data; XvMCContextPtr pContext = pSurface->context; @@ -87,13 +87,13 @@ XvMCDestroySurfaceRes(pointer data, XID id) (*pScreenPriv->adaptors[pContext->adapt_num].DestroySurface) (pSurface); free(pSurface); - XvMCDestroyContextRes((pointer) pContext, pContext->context_id); + XvMCDestroyContextRes((void *) pContext, pContext->context_id); return Success; } static int -XvMCDestroySubpictureRes(pointer data, XID id) +XvMCDestroySubpictureRes(void *data, XID id) { XvMCSubpicturePtr pSubpict = (XvMCSubpicturePtr) data; XvMCContextPtr pContext = pSubpict->context; @@ -102,7 +102,7 @@ XvMCDestroySubpictureRes(pointer data, XID id) (*pScreenPriv->adaptors[pContext->adapt_num].DestroySubpicture) (pSubpict); free(pSubpict); - XvMCDestroyContextRes((pointer) pContext, pContext->context_id); + XvMCDestroyContextRes((void *) pContext, pContext->context_id); return Success; } @@ -276,7 +276,7 @@ ProcXvMCCreateContext(ClientPtr client) static int ProcXvMCDestroyContext(ClientPtr client) { - pointer val; + void *val; int rc; REQUEST(xvmcDestroyContextReq); @@ -306,7 +306,7 @@ ProcXvMCCreateSurface(ClientPtr client) REQUEST(xvmcCreateSurfaceReq); REQUEST_SIZE_MATCH(xvmcCreateSurfaceReq); - result = dixLookupResourceByType((pointer *) &pContext, stuff->context_id, + result = dixLookupResourceByType((void **) &pContext, stuff->context_id, XvMCRTContext, client, DixUseAccess); if (result != Success) return result; @@ -350,7 +350,7 @@ ProcXvMCCreateSurface(ClientPtr client) static int ProcXvMCDestroySurface(ClientPtr client) { - pointer val; + void *val; int rc; REQUEST(xvmcDestroySurfaceReq); @@ -382,7 +382,7 @@ ProcXvMCCreateSubpicture(ClientPtr client) REQUEST(xvmcCreateSubpictureReq); REQUEST_SIZE_MATCH(xvmcCreateSubpictureReq); - result = dixLookupResourceByType((pointer *) &pContext, stuff->context_id, + result = dixLookupResourceByType((void **) &pContext, stuff->context_id, XvMCRTContext, client, DixUseAccess); if (result != Success) return result; @@ -474,7 +474,7 @@ ProcXvMCCreateSubpicture(ClientPtr client) static int ProcXvMCDestroySubpicture(ClientPtr client) { - pointer val; + void *val; int rc; REQUEST(xvmcDestroySubpictureReq); @@ -800,8 +800,8 @@ XvMCFindXvImage(XvPortPtr pPort, CARD32 id) } int -xf86XvMCRegisterDRInfo(ScreenPtr pScreen, char *name, - char *busID, int major, int minor, int patchLevel) +xf86XvMCRegisterDRInfo(ScreenPtr pScreen, const char *name, + const char *busID, int major, int minor, int patchLevel) { XvMCScreenPtr pScreenPriv = XVMC_GET_PRIVATE(pScreen); diff --git a/xserver/Xext/xvmcext.h b/xserver/Xext/xvmcext.h index 2201d7b5b..e8a6dae47 100644 --- a/xserver/Xext/xvmcext.h +++ b/xserver/Xext/xvmcext.h @@ -31,15 +31,15 @@ typedef struct { unsigned short height; CARD32 flags; int refcnt; - pointer port_priv; - pointer driver_priv; + void *port_priv; + void *driver_priv; } XvMCContextRec, *XvMCContextPtr; typedef struct { XID surface_id; int surface_type_id; XvMCContextPtr context; - pointer driver_priv; + void *driver_priv; } XvMCSurfaceRec, *XvMCSurfacePtr; typedef struct { @@ -51,7 +51,7 @@ typedef struct { int entry_bytes; char component_order[4]; XvMCContextPtr context; - pointer driver_priv; + void *driver_priv; } XvMCSubpictureRec, *XvMCSubpicturePtr; typedef int (*XvMCCreateContextProcPtr) (XvPortPtr port, @@ -91,8 +91,8 @@ extern _X_EXPORT int XvMCScreenInit(ScreenPtr pScreen, extern _X_EXPORT XvImagePtr XvMCFindXvImage(XvPortPtr pPort, CARD32 id); -extern _X_EXPORT int xf86XvMCRegisterDRInfo(ScreenPtr pScreen, char *name, - char *busID, int major, int minor, +extern _X_EXPORT int xf86XvMCRegisterDRInfo(ScreenPtr pScreen, const char *name, + const char *busID, int major, int minor, int patchLevel); #endif /* _XVMC_H */ diff --git a/xserver/Xi/Makefile.am b/xserver/Xi/Makefile.am index af85bd049..6c456c4ac 100644 --- a/xserver/Xi/Makefile.am +++ b/xserver/Xi/Makefile.am @@ -1,4 +1,4 @@ -noinst_LTLIBRARIES = libXi.la +noinst_LTLIBRARIES = libXi.la libXistubs.la AM_CFLAGS = $(DIX_CFLAGS) @@ -107,4 +107,5 @@ libXi_la_SOURCES = \ xiwarppointer.c \ xiwarppointer.h -EXTRA_DIST = stubs.c +libXistubs_la_SOURCES = \ + stubs.c diff --git a/xserver/Xi/Makefile.in b/xserver/Xi/Makefile.in index fa329b042..4f78a59ff 100644 --- a/xserver/Xi/Makefile.in +++ b/xserver/Xi/Makefile.in @@ -91,6 +91,9 @@ AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = +libXistubs_la_LIBADD = +am_libXistubs_la_OBJECTS = stubs.lo +libXistubs_la_OBJECTS = $(am_libXistubs_la_OBJECTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false @@ -125,8 +128,8 @@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = -SOURCES = $(libXi_la_SOURCES) -DIST_SOURCES = $(libXi_la_SOURCES) +SOURCES = $(libXi_la_SOURCES) $(libXistubs_la_SOURCES) +DIST_SOURCES = $(libXi_la_SOURCES) $(libXistubs_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -173,6 +176,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -217,6 +222,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -319,7 +328,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -328,6 +340,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -394,6 +407,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ @@ -466,7 +483,7 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -noinst_LTLIBRARIES = libXi.la +noinst_LTLIBRARIES = libXi.la libXistubs.la AM_CFLAGS = $(DIX_CFLAGS) libXi_la_SOURCES = \ allowev.c \ @@ -573,7 +590,9 @@ libXi_la_SOURCES = \ xiwarppointer.c \ xiwarppointer.h -EXTRA_DIST = stubs.c +libXistubs_la_SOURCES = \ + stubs.c + all: all-am .SUFFIXES: @@ -621,6 +640,8 @@ clean-noinstLTLIBRARIES: } libXi.la: $(libXi_la_OBJECTS) $(libXi_la_DEPENDENCIES) $(EXTRA_libXi_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(libXi_la_OBJECTS) $(libXi_la_LIBADD) $(LIBS) +libXistubs.la: $(libXistubs_la_OBJECTS) $(libXistubs_la_DEPENDENCIES) $(EXTRA_libXistubs_la_DEPENDENCIES) + $(AM_V_CCLD)$(LINK) $(libXistubs_la_OBJECTS) $(libXistubs_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -662,6 +683,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/setfocus.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/setmmap.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/setmode.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stubs.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ungrdev.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ungrdevb.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ungrdevk.Plo@am__quote@ diff --git a/xserver/Xi/devbell.c b/xserver/Xi/devbell.c index 202c8de18..07865d270 100644 --- a/xserver/Xi/devbell.c +++ b/xserver/Xi/devbell.c @@ -91,7 +91,7 @@ ProcXDeviceBell(ClientPtr client) int rc, base; int newpercent; CARD8 class; - pointer ctrl; + void *ctrl; BellProcPtr proc; REQUEST(xDeviceBellReq); @@ -117,7 +117,7 @@ ProcXDeviceBell(ClientPtr client) } base = k->ctrl.bell; proc = k->BellProc; - ctrl = (pointer) &(k->ctrl); + ctrl = (void *) &(k->ctrl); class = KbdFeedbackClass; } else if (stuff->feedbackclass == BellFeedbackClass) { @@ -130,7 +130,7 @@ ProcXDeviceBell(ClientPtr client) } base = b->ctrl.percent; proc = b->BellProc; - ctrl = (pointer) &(b->ctrl); + ctrl = (void *) &(b->ctrl); class = BellFeedbackClass; } else { diff --git a/xserver/Xi/exevents.c b/xserver/Xi/exevents.c index 01bdea6df..b0bc47e6d 100644 --- a/xserver/Xi/exevents.c +++ b/xserver/Xi/exevents.c @@ -230,7 +230,7 @@ CopyKeyClass(DeviceIntPtr device, DeviceIntPtr master) mk->sourceid = device->id; - if (!XkbCopyDeviceKeymap(master, device)) + if (!XkbDeviceApplyKeymap(master, device->key->xkbInfo->desc)) FatalError("Couldn't pivot keymap from device to core!\n"); } @@ -1306,7 +1306,7 @@ RetrieveTouchDeliveryData(DeviceIntPtr dev, TouchPointInfoPtr ti, *mask = (*grab)->xi2mask; } else { - rc = dixLookupResourceByType((pointer *) win, listener->listener, + rc = dixLookupResourceByType((void **) win, listener->listener, listener->resource_type, serverClient, DixSendAccess); if (rc != Success) @@ -1473,7 +1473,7 @@ static void DeliverEmulatedMotionEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, InternalEvent *ev) { - InternalEvent motion; + DeviceEvent motion; if (ti->num_listeners) { ClientPtr client; @@ -1485,11 +1485,11 @@ DeliverEmulatedMotionEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, ti->listeners[0].type != LISTENER_POINTER_GRAB) return; - motion = *ev; - motion.any.type = ET_TouchUpdate; - motion.device_event.detail.button = 0; + motion = ev->device_event; + motion.type = ET_TouchUpdate; + motion.detail.button = 0; - if (!RetrieveTouchDeliveryData(dev, ti, &motion, + if (!RetrieveTouchDeliveryData(dev, ti, (InternalEvent*)&motion, &ti->listeners[0], &client, &win, &grab, &mask)) return; @@ -1504,18 +1504,18 @@ DeliverEmulatedMotionEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, } } - DeliverTouchEmulatedEvent(dev, ti, &motion, &ti->listeners[0], client, + DeliverTouchEmulatedEvent(dev, ti, (InternalEvent*)&motion, &ti->listeners[0], client, win, grab, mask); } else { InternalEvent button; int converted; - converted = TouchConvertToPointerEvent(ev, &motion, &button); + converted = TouchConvertToPointerEvent(ev, (InternalEvent*)&motion, &button); BUG_WARN(converted == 0); if (converted) - ProcessOtherEvent(&motion, dev); + ProcessOtherEvent((InternalEvent*)&motion, dev); } } @@ -1739,7 +1739,7 @@ ProcessDeviceEvent(InternalEvent *ev, DeviceIntPtr device) eventinfo.device = device; eventinfo.event = ev; - CallCallbacks(&DeviceEventCallback, (pointer) &eventinfo); + CallCallbacks(&DeviceEventCallback, (void *) &eventinfo); } grab = device->deviceGrab.grab; @@ -2226,7 +2226,7 @@ GrabButton(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr modifier_device, if (param->cursor == None) cursor = NullCursor; else { - rc = dixLookupResourceByType((pointer *) &cursor, param->cursor, + rc = dixLookupResourceByType((void **) &cursor, param->cursor, RT_CURSOR, client, DixUseAccess); if (rc != Success) { client->errorValue = param->cursor; @@ -2325,7 +2325,7 @@ GrabWindow(ClientPtr client, DeviceIntPtr dev, int type, if (param->cursor == None) cursor = NullCursor; else { - rc = dixLookupResourceByType((pointer *) &cursor, param->cursor, + rc = dixLookupResourceByType((void **) &cursor, param->cursor, RT_CURSOR, client, DixUseAccess); if (rc != Success) { client->errorValue = param->cursor; @@ -2468,7 +2468,7 @@ AddExtensionClient(WindowPtr pWin, ClientPtr client, Mask mask, int mskidx) others->resource = FakeClientID(client->index); others->next = pWin->optional->inputMasks->inputClients; pWin->optional->inputMasks->inputClients = others; - if (!AddResource(others->resource, RT_INPUTCLIENT, (pointer) pWin)) + if (!AddResource(others->resource, RT_INPUTCLIENT, (void *) pWin)) goto bail; return Success; @@ -2570,7 +2570,7 @@ InputClientGone(WindowPtr pWin, XID id) else { other->resource = FakeClientID(0); if (!AddResource(other->resource, RT_INPUTCLIENT, - (pointer) pWin)) + (void *) pWin)) return BadAlloc; } } diff --git a/xserver/Xi/extinit.c b/xserver/Xi/extinit.c index a49a42152..26c628cbd 100644 --- a/xserver/Xi/extinit.c +++ b/xserver/Xi/extinit.c @@ -381,7 +381,7 @@ DevPrivateKeyRec XIClientPrivateKeyRec; */ static void -XIClientCallback(CallbackListPtr *list, pointer closure, pointer data) +XIClientCallback(CallbackListPtr *list, void *closure, void *data) { NewClientInfoRec *clientinfo = (NewClientInfoRec *) data; ClientPtr pClient = clientinfo->client; diff --git a/xserver/Xi/grabdev.c b/xserver/Xi/grabdev.c index 9c6c429ed..090043814 100644 --- a/xserver/Xi/grabdev.c +++ b/xserver/Xi/grabdev.c @@ -191,7 +191,7 @@ CreateMaskFromList(ClientPtr client, XEventClass * list, int count, for (j = 0; j < ExtEventIndex; j++) if (EventInfo[j].type == (*list & 0xff)) { mask[device].mask |= EventInfo[j].mask; - mask[device].dev = (Pointer) tdev; + mask[device].dev = (void *) tdev; break; } } diff --git a/xserver/Xi/listdev.c b/xserver/Xi/listdev.c index 014c61db0..6a10091d0 100644 --- a/xserver/Xi/listdev.c +++ b/xserver/Xi/listdev.c @@ -119,9 +119,9 @@ SizeDeviceInfo(DeviceIntPtr d, int *namesize, int *size) */ static void -CopyDeviceName(char **namebuf, char *name) +CopyDeviceName(char **namebuf, const char *name) { - char *nameptr = (char *) *namebuf; + char *nameptr = *namebuf; if (name) { *nameptr++ = strlen(name); diff --git a/xserver/Xi/xibarriers.c b/xserver/Xi/xibarriers.c index 6732ce9dc..a8b92cc18 100644 --- a/xserver/Xi/xibarriers.c +++ b/xserver/Xi/xibarriers.c @@ -695,7 +695,7 @@ BarrierFreeBarrier(void *data, XID id) return Success; } -static void add_master_func(pointer res, XID id, pointer devid) +static void add_master_func(void *res, XID id, void *devid) { struct PointerBarrier *b; struct PointerBarrierClient *barrier; @@ -712,7 +712,7 @@ static void add_master_func(pointer res, XID id, pointer devid) xorg_list_add(&pbd->entry, &barrier->per_device); } -static void remove_master_func(pointer res, XID id, pointer devid) +static void remove_master_func(void *res, XID id, void *devid) { struct PointerBarrierDevice *pbd; struct PointerBarrierClient *barrier; diff --git a/xserver/Xi/xichangecursor.c b/xserver/Xi/xichangecursor.c index 0be6bc0d4..7a1bb7a0d 100644 --- a/xserver/Xi/xichangecursor.c +++ b/xserver/Xi/xichangecursor.c @@ -96,7 +96,7 @@ ProcXIChangeCursor(ClientPtr client) pCursor = (CursorPtr) None; } else { - rc = dixLookupResourceByType((pointer *) &pCursor, stuff->cursor, + rc = dixLookupResourceByType((void **) &pCursor, stuff->cursor, RT_CURSOR, client, DixUseAccess); if (rc != Success) return rc; diff --git a/xserver/Xi/xiproperty.c b/xserver/Xi/xiproperty.c index 796ba0948..463607d33 100644 --- a/xserver/Xi/xiproperty.c +++ b/xserver/Xi/xiproperty.c @@ -723,10 +723,10 @@ XIChangeDeviceProperty(DeviceIntPtr dev, Atom property, Atom type, total_len = prop_value->size + len; if (mode == PropModeReplace || len > 0) { - pointer new_data = NULL, old_data = NULL; + void *new_data = NULL, *old_data = NULL; total_size = total_len * size_in_bytes; - new_value.data = (pointer) malloc(total_size); + new_value.data = (void *) malloc(total_size); if (!new_value.data && total_size) { if (add) XIDestroyDeviceProperty(prop); @@ -742,13 +742,13 @@ XIChangeDeviceProperty(DeviceIntPtr dev, Atom property, Atom type, old_data = NULL; break; case PropModeAppend: - new_data = (pointer) (((char *) new_value.data) + + new_data = (void *) (((char *) new_value.data) + (prop_value->size * size_in_bytes)); old_data = new_value.data; break; case PropModePrepend: new_data = new_value.data; - old_data = (pointer) (((char *) new_value.data) + + old_data = (void *) (((char *) new_value.data) + (prop_value->size * size_in_bytes)); break; } diff --git a/xserver/composite/Makefile.in b/xserver/composite/Makefile.in index 5488d7a71..44947ab5c 100644 --- a/xserver/composite/Makefile.in +++ b/xserver/composite/Makefile.in @@ -194,6 +194,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -238,6 +240,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -340,7 +346,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -349,6 +358,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -415,6 +425,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/composite/compalloc.c b/xserver/composite/compalloc.c index b7d731e33..dfbff06ca 100644 --- a/xserver/composite/compalloc.c +++ b/xserver/composite/compalloc.c @@ -55,7 +55,7 @@ compScreenUpdate(ScreenPtr pScreen) } static void -compBlockHandler(ScreenPtr pScreen, pointer pTimeout, pointer pReadmask) +compBlockHandler(ScreenPtr pScreen, void *pTimeout, void *pReadmask) { CompScreenPtr cs = GetCompScreen(pScreen); diff --git a/xserver/composite/compext.c b/xserver/composite/compext.c index e4821c5fc..cadedbd37 100644 --- a/xserver/composite/compext.c +++ b/xserver/composite/compext.c @@ -67,7 +67,7 @@ typedef struct _CompositeClient { dixLookupPrivate(&(pClient)->devPrivates, CompositeClientPrivateKey)) static void -CompositeClientCallback(CallbackListPtr *list, pointer closure, pointer data) +CompositeClientCallback(CallbackListPtr *list, void *closure, void *data) { NewClientInfoRec *clientinfo = (NewClientInfoRec *) data; ClientPtr pClient = clientinfo->client; @@ -78,7 +78,7 @@ CompositeClientCallback(CallbackListPtr *list, pointer closure, pointer data) } static int -FreeCompositeClientWindow(pointer value, XID ccwid) +FreeCompositeClientWindow(void *value, XID ccwid) { WindowPtr pWin = value; @@ -87,7 +87,7 @@ FreeCompositeClientWindow(pointer value, XID ccwid) } static int -FreeCompositeClientSubwindows(pointer value, XID ccwid) +FreeCompositeClientSubwindows(void *value, XID ccwid) { WindowPtr pWin = value; @@ -96,7 +96,7 @@ FreeCompositeClientSubwindows(pointer value, XID ccwid) } static int -FreeCompositeClientOverlay(pointer value, XID ccwid) +FreeCompositeClientOverlay(void *value, XID ccwid) { CompOverlayClientPtr pOc = (CompOverlayClientPtr) value; @@ -140,7 +140,7 @@ ProcCompositeQueryVersion(ClientPtr client) #define VERIFY_WINDOW(pWindow, wid, client, mode) \ do { \ int err; \ - err = dixLookupResourceByType((pointer *) &pWindow, wid, \ + err = dixLookupResourceByType((void **) &pWindow, wid, \ RT_WINDOW, client, mode); \ if (err != Success) { \ client->errorValue = wid; \ @@ -227,7 +227,7 @@ ProcCompositeCreateRegionFromBorderClip(ClientPtr client) return BadAlloc; RegionTranslate(pRegion, -pWin->drawable.x, -pWin->drawable.y); - if (!AddResource(stuff->region, RegionResType, (pointer) pRegion)) + if (!AddResource(stuff->region, RegionResType, (void *) pRegion)) return BadAlloc; return Success; @@ -239,6 +239,7 @@ ProcCompositeNameWindowPixmap(ClientPtr client) WindowPtr pWin; CompWindowPtr cw; PixmapPtr pPixmap; + ScreenPtr pScreen; int rc; REQUEST(xCompositeNameWindowPixmapReq); @@ -246,6 +247,8 @@ ProcCompositeNameWindowPixmap(ClientPtr client) REQUEST_SIZE_MATCH(xCompositeNameWindowPixmapReq); VERIFY_WINDOW(pWin, stuff->window, client, DixGetAttrAccess); + pScreen = pWin->drawable.pScreen; + if (!pWin->viewable) return BadMatch; @@ -255,7 +258,7 @@ ProcCompositeNameWindowPixmap(ClientPtr client) if (!cw) return BadMatch; - pPixmap = (*pWin->drawable.pScreen->GetWindowPixmap) (pWin); + pPixmap = (*pScreen->GetWindowPixmap) (pWin); if (!pPixmap) return BadMatch; @@ -267,9 +270,17 @@ ProcCompositeNameWindowPixmap(ClientPtr client) ++pPixmap->refcnt; - if (!AddResource(stuff->pixmap, RT_PIXMAP, (pointer) pPixmap)) + if (!AddResource(stuff->pixmap, RT_PIXMAP, (void *) pPixmap)) return BadAlloc; + if (pScreen->NameWindowPixmap) { + rc = pScreen->NameWindowPixmap(pWin, pPixmap, stuff->pixmap); + if (rc != Success) { + FreeResource(stuff->pixmap, RT_NONE); + return rc; + } + } + return Success; } @@ -335,12 +346,10 @@ ProcCompositeReleaseOverlayWindow(ClientPtr client) { REQUEST(xCompositeReleaseOverlayWindowReq); WindowPtr pWin; - ScreenPtr pScreen; CompOverlayClientPtr pOc; REQUEST_SIZE_MATCH(xCompositeReleaseOverlayWindowReq); VERIFY_WINDOW(pWin, stuff->window, client, DixGetAttrAccess); - pScreen = pWin->drawable.pScreen; /* * Has client queried a reference to the overlay window @@ -502,7 +511,7 @@ SProcCompositeDispatch(ClientPtr client) /** @see GetDefaultBytes */ static void -GetCompositeClientWindowBytes(pointer value, XID id, ResourceSizePtr size) +GetCompositeClientWindowBytes(void *value, XID id, ResourceSizePtr size) { WindowPtr window = value; @@ -756,13 +765,13 @@ PanoramiXCompositeNameWindowPixmap(ClientPtr client) return BadMatch; } - if (!AddResource(newPix->info[i].id, RT_PIXMAP, (pointer) pPixmap)) + if (!AddResource(newPix->info[i].id, RT_PIXMAP, (void *) pPixmap)) return BadAlloc; ++pPixmap->refcnt; } - if (!AddResource(stuff->pixmap, XRT_PIXMAP, (pointer) newPix)) + if (!AddResource(stuff->pixmap, XRT_PIXMAP, (void *) newPix)) return BadAlloc; return Success; @@ -799,7 +808,7 @@ PanoramiXCompositeGetOverlayWindow(ClientPtr client) } FOR_NSCREENS_BACKWARD(i) { - rc = dixLookupResourceByType((pointer *) &pWin, win->info[i].id, + rc = dixLookupResourceByType((void **) &pWin, win->info[i].id, RT_WINDOW, client, DixGetAttrAccess); if (rc != Success) { client->errorValue = stuff->window; @@ -873,7 +882,6 @@ PanoramiXCompositeReleaseOverlayWindow(ClientPtr client) { REQUEST(xCompositeReleaseOverlayWindowReq); WindowPtr pWin; - ScreenPtr pScreen; CompOverlayClientPtr pOc; PanoramiXRes *win; int i, rc; @@ -893,7 +901,6 @@ PanoramiXCompositeReleaseOverlayWindow(ClientPtr client) client->errorValue = stuff->window; return rc; } - pScreen = pWin->drawable.pScreen; /* * Has client queried a reference to the overlay window diff --git a/xserver/composite/compinit.c b/xserver/composite/compinit.c index 3c910914e..48e938fac 100644 --- a/xserver/composite/compinit.c +++ b/xserver/composite/compinit.c @@ -119,7 +119,7 @@ compChangeWindowAttributes(WindowPtr pWin, unsigned long mask) pScreen->backingStoreSupport != NotUseful) { if (pWin->backingStore != NotUseful && !pWin->backStorage) { compRedirectWindow(serverClient, pWin, CompositeRedirectAutomatic); - pWin->backStorage = (pointer) (intptr_t) 1; + pWin->backStorage = (void *) (intptr_t) 1; } else if (pWin->backingStore == NotUseful && pWin->backStorage) { compUnredirectWindow(serverClient, pWin, @@ -229,6 +229,28 @@ CompositeRegisterAlternateVisuals(ScreenPtr pScreen, VisualID * vids, return compRegisterAlternateVisuals(cs, vids, nVisuals); } +Bool +CompositeRegisterImplicitRedirectionException(ScreenPtr pScreen, + VisualID parentVisual, + VisualID winVisual) +{ + CompScreenPtr cs = GetCompScreen(pScreen); + CompImplicitRedirectException *p; + + p = realloc(cs->implicitRedirectExceptions, + sizeof(p[0]) * (cs->numImplicitRedirectExceptions + 1)); + if (p == NULL) + return FALSE; + + p[cs->numImplicitRedirectExceptions].parentVisual = parentVisual; + p[cs->numImplicitRedirectExceptions].winVisual = winVisual; + + cs->implicitRedirectExceptions = p; + cs->numImplicitRedirectExceptions++; + + return TRUE; +} + typedef struct _alternateVisual { int depth; CARD32 format; @@ -349,6 +371,8 @@ compScreenInit(ScreenPtr pScreen) cs->numAlternateVisuals = 0; cs->alternateVisuals = NULL; + cs->numImplicitRedirectExceptions = 0; + cs->implicitRedirectExceptions = NULL; if (!compAddAlternateVisuals(pScreen, cs)) { free(cs); diff --git a/xserver/composite/compint.h b/xserver/composite/compint.h index 45b5824a9..56b76c540 100644 --- a/xserver/composite/compint.h +++ b/xserver/composite/compint.h @@ -119,6 +119,11 @@ typedef struct _CompOverlayClientRec { XID resource; } CompOverlayClientRec; +typedef struct _CompImplicitRedirectException { + XID parentVisual; + XID winVisual; +} CompImplicitRedirectException; + typedef struct _CompScreen { PositionWindowProcPtr PositionWindow; CopyWindowProcPtr CopyWindow; @@ -155,6 +160,8 @@ typedef struct _CompScreen { CloseScreenProcPtr CloseScreen; int numAlternateVisuals; VisualID *alternateVisuals; + int numImplicitRedirectExceptions; + CompImplicitRedirectException *implicitRedirectExceptions; WindowPtr pOverlayWin; Window overlayWid; @@ -319,7 +326,7 @@ WindowPtr CompositeRealChildHead(WindowPtr pWin); int - DeleteWindowNoInputDevices(pointer value, XID wid); + DeleteWindowNoInputDevices(void *value, XID wid); int diff --git a/xserver/composite/compositeext.h b/xserver/composite/compositeext.h index 0b148f029..b96cb1d68 100644 --- a/xserver/composite/compositeext.h +++ b/xserver/composite/compositeext.h @@ -35,6 +35,10 @@ extern _X_EXPORT Bool CompositeRegisterAlternateVisuals(ScreenPtr pScreen, VisualID * vids, int nVisuals); +extern _X_EXPORT Bool CompositeRegisterImplicitRedirectionException(ScreenPtr pScreen, + VisualID parentVisual, + VisualID winVisual); + extern _X_EXPORT RESTYPE CompositeClientWindowType; #endif /* _COMPOSITEEXT_H_ */ diff --git a/xserver/composite/compoverlay.c b/xserver/composite/compoverlay.c index bf5434ccb..7932dda8d 100644 --- a/xserver/composite/compoverlay.c +++ b/xserver/composite/compoverlay.c @@ -114,7 +114,7 @@ compCreateOverlayClient(ScreenPtr pScreen, ClientPtr pClient) * Create a resource for this element so it can be deleted * when the client goes away. */ - if (!AddResource(pOc->resource, CompositeClientOverlayType, (pointer) pOc)) + if (!AddResource(pOc->resource, CompositeClientOverlayType, (void *) pOc)) return NULL; return pOc; @@ -152,7 +152,7 @@ compCreateOverlayWindow(ScreenPtr pScreen) if (pWin == NULL) return FALSE; - if (!AddResource(pWin->drawable.id, RT_WINDOW, (pointer) pWin)) + if (!AddResource(pWin->drawable.id, RT_WINDOW, (void *) pWin)) return FALSE; MapWindow(pWin, serverClient); diff --git a/xserver/composite/compwindow.c b/xserver/composite/compwindow.c index 0be7a1b34..9a6b2dae8 100644 --- a/xserver/composite/compwindow.c +++ b/xserver/composite/compwindow.c @@ -53,7 +53,7 @@ #ifdef COMPOSITE_DEBUG static int -compCheckWindow(WindowPtr pWin, pointer data) +compCheckWindow(WindowPtr pWin, void *data) { ScreenPtr pScreen = pWin->drawable.pScreen; PixmapPtr pWinPixmap = (*pScreen->GetWindowPixmap) (pWin); @@ -92,7 +92,7 @@ typedef struct _compPixmapVisit { } CompPixmapVisitRec, *CompPixmapVisitPtr; static Bool -compRepaintBorder(ClientPtr pClient, pointer closure) +compRepaintBorder(ClientPtr pClient, void *closure) { WindowPtr pWindow; int rc = @@ -111,7 +111,7 @@ compRepaintBorder(ClientPtr pClient, pointer closure) } static int -compSetPixmapVisitWindow(WindowPtr pWindow, pointer data) +compSetPixmapVisitWindow(WindowPtr pWindow, void *data) { CompPixmapVisitPtr pVisit = (CompPixmapVisitPtr) data; ScreenPtr pScreen = pWindow->drawable.pScreen; @@ -128,7 +128,7 @@ compSetPixmapVisitWindow(WindowPtr pWindow, pointer data) SetBorderSize(pWindow); if (HasBorder(pWindow)) QueueWorkProc(compRepaintBorder, serverClient, - (pointer) (intptr_t) pWindow->drawable.id); + (void *) (intptr_t) pWindow->drawable.id); return WT_WALKCHILDREN; } @@ -139,7 +139,7 @@ compSetPixmap(WindowPtr pWindow, PixmapPtr pPixmap) visitRec.pWindow = pWindow; visitRec.pPixmap = pPixmap; - TraverseTree(pWindow, compSetPixmapVisitWindow, (pointer) &visitRec); + TraverseTree(pWindow, compSetPixmapVisitWindow, (void *) &visitRec); compCheckTree(pWindow->drawable.pScreen); } @@ -336,6 +336,21 @@ compIsAlternateVisual(ScreenPtr pScreen, XID visual) } static Bool +compIsImplicitRedirectException(ScreenPtr pScreen, + XID parentVisual, XID winVisual) +{ + CompScreenPtr cs = GetCompScreen(pScreen); + int i; + + for (i = 0; i < cs->numImplicitRedirectExceptions; i++) + if (cs->implicitRedirectExceptions[i].parentVisual == parentVisual && + cs->implicitRedirectExceptions[i].winVisual == winVisual) + return TRUE; + + return FALSE; +} + +static Bool compImplicitRedirect(WindowPtr pWin, WindowPtr pParent) { if (pParent) { @@ -343,6 +358,9 @@ compImplicitRedirect(WindowPtr pWin, WindowPtr pParent) XID winVisual = wVisual(pWin); XID parentVisual = wVisual(pParent); + if (compIsImplicitRedirectException(pScreen, parentVisual, winVisual)) + return FALSE; + if (winVisual != parentVisual && (compIsAlternateVisual(pScreen, winVisual) || compIsAlternateVisual(pScreen, parentVisual))) @@ -475,7 +493,6 @@ compCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) * need to be copied to pNewPixmap. */ RegionRec rgnDst; - PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWin); GCPtr pGC; dx = ptOldOrg.x - pWin->drawable.x; @@ -508,6 +525,7 @@ compCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) } FreeScratchGC(pGC); } + RegionUninit(&rgnDst); return; } dx = pPixmap->screen_x - cw->oldx; diff --git a/xserver/config/10-quirks.conf b/xserver/config/10-quirks.conf index c9b823ceb..47907d82d 100644 --- a/xserver/config/10-quirks.conf +++ b/xserver/config/10-quirks.conf @@ -19,22 +19,6 @@ Section "InputClass" Option "IgnoreRelativeAxes" "off" EndSection -# https://bugzilla.redhat.com/show_bug.cgi?id=612140 -# please make Evoluent VerticalMouse 3 work out of the box -# Button mapping on this mouse is quirky -Section "InputClass" - Identifier "Evoluent VerticalMouse 3" - MatchProduct "Evoluent VerticalMouse 3" - # Sets following configuration: - # top button: left - # middle button: middle - # bottom button: right - # wheel click: middle - # thumb button: 8 (back) - Option "ButtonMapping" "1 2 2 4 5 6 7 3 8" -EndSection - - # https://bugs.freedesktop.org/show_bug.cgi?id=55867 # Bug 55867 - Doesn't know how to tag XI_TRACKBALL Section "InputClass" diff --git a/xserver/config/Makefile.am b/xserver/config/Makefile.am index 327d07e7c..0e20e8b3d 100644 --- a/xserver/config/Makefile.am +++ b/xserver/config/Makefile.am @@ -2,12 +2,19 @@ AM_CFLAGS = $(DIX_CFLAGS) noinst_LTLIBRARIES = libconfig.la libconfig_la_SOURCES = config.c config-backends.h +libconfig_la_LIBADD = + +if NEED_DBUS +AM_CFLAGS += $(DBUS_CFLAGS) +libconfig_la_SOURCES += dbus-core.c +libconfig_la_LIBADD += $(DBUS_LIBS) +endif if CONFIG_UDEV AM_CFLAGS += $(UDEV_CFLAGS) libconfig_la_SOURCES += udev.c -libconfig_la_LIBADD = $(UDEV_LIBS) +libconfig_la_LIBADD += $(UDEV_LIBS) if XORG xorgconfddir = $(datadir)/X11/$(XF86CONFIGDIR) @@ -16,23 +23,10 @@ endif else -if CONFIG_NEED_DBUS -AM_CFLAGS += $(DBUS_CFLAGS) -libconfig_la_SOURCES += dbus-core.c -libconfig_la_LIBADD = $(DBUS_LIBS) - -if CONFIG_DBUS_API -dbusconfigdir = $(sysconfdir)/dbus-1/system.d -dbusconfig_DATA = xorg-server.conf - -libconfig_la_SOURCES += dbus.c -endif - if CONFIG_HAL AM_CFLAGS += $(HAL_CFLAGS) libconfig_la_SOURCES += hal.c libconfig_la_LIBADD += $(HAL_LIBS) -endif else @@ -40,8 +34,8 @@ if CONFIG_WSCONS libconfig_la_SOURCES += wscons.c endif # CONFIG_WSCONS -endif # CONFIG_NEED_DBUS +endif # !CONFIG_HAL endif # !CONFIG_UDEV -EXTRA_DIST = xorg-server.conf x11-input.fdi 10-evdev.conf non-seat0.conf.multi-seat fdi2iclass.py 10-quirks.conf +EXTRA_DIST = x11-input.fdi 10-evdev.conf fdi2iclass.py 10-quirks.conf diff --git a/xserver/config/Makefile.in b/xserver/config/Makefile.in index 5a2e0642f..6e2d1f45c 100644 --- a/xserver/config/Makefile.in +++ b/xserver/config/Makefile.in @@ -51,15 +51,16 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ -@CONFIG_UDEV_TRUE@am__append_1 = $(UDEV_CFLAGS) -@CONFIG_UDEV_TRUE@am__append_2 = udev.c -@CONFIG_NEED_DBUS_TRUE@@CONFIG_UDEV_FALSE@am__append_3 = $(DBUS_CFLAGS) -@CONFIG_NEED_DBUS_TRUE@@CONFIG_UDEV_FALSE@am__append_4 = dbus-core.c -@CONFIG_DBUS_API_TRUE@@CONFIG_NEED_DBUS_TRUE@@CONFIG_UDEV_FALSE@am__append_5 = dbus.c -@CONFIG_HAL_TRUE@@CONFIG_NEED_DBUS_TRUE@@CONFIG_UDEV_FALSE@am__append_6 = $(HAL_CFLAGS) -@CONFIG_HAL_TRUE@@CONFIG_NEED_DBUS_TRUE@@CONFIG_UDEV_FALSE@am__append_7 = hal.c -@CONFIG_HAL_TRUE@@CONFIG_NEED_DBUS_TRUE@@CONFIG_UDEV_FALSE@am__append_8 = $(HAL_LIBS) -@CONFIG_NEED_DBUS_FALSE@@CONFIG_UDEV_FALSE@@CONFIG_WSCONS_TRUE@am__append_9 = wscons.c +@NEED_DBUS_TRUE@am__append_1 = $(DBUS_CFLAGS) +@NEED_DBUS_TRUE@am__append_2 = dbus-core.c +@NEED_DBUS_TRUE@am__append_3 = $(DBUS_LIBS) +@CONFIG_UDEV_TRUE@am__append_4 = $(UDEV_CFLAGS) +@CONFIG_UDEV_TRUE@am__append_5 = udev.c +@CONFIG_UDEV_TRUE@am__append_6 = $(UDEV_LIBS) +@CONFIG_HAL_TRUE@@CONFIG_UDEV_FALSE@am__append_7 = $(HAL_CFLAGS) +@CONFIG_HAL_TRUE@@CONFIG_UDEV_FALSE@am__append_8 = hal.c +@CONFIG_HAL_TRUE@@CONFIG_UDEV_FALSE@am__append_9 = $(HAL_LIBS) +@CONFIG_HAL_FALSE@@CONFIG_UDEV_FALSE@@CONFIG_WSCONS_TRUE@am__append_10 = wscons.c subdir = config DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(top_srcdir)/depcomp @@ -84,21 +85,20 @@ CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) am__DEPENDENCIES_1 = -@CONFIG_HAL_TRUE@@CONFIG_NEED_DBUS_TRUE@@CONFIG_UDEV_FALSE@am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) -@CONFIG_NEED_DBUS_TRUE@@CONFIG_UDEV_FALSE@libconfig_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ -@CONFIG_NEED_DBUS_TRUE@@CONFIG_UDEV_FALSE@ $(am__DEPENDENCIES_2) -@CONFIG_UDEV_TRUE@libconfig_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ -@CONFIG_UDEV_TRUE@ $(am__DEPENDENCIES_2) -am__libconfig_la_SOURCES_DIST = config.c config-backends.h udev.c \ - dbus-core.c dbus.c hal.c wscons.c -@CONFIG_UDEV_TRUE@am__objects_1 = udev.lo -@CONFIG_NEED_DBUS_TRUE@@CONFIG_UDEV_FALSE@am__objects_2 = \ -@CONFIG_NEED_DBUS_TRUE@@CONFIG_UDEV_FALSE@ dbus-core.lo -@CONFIG_DBUS_API_TRUE@@CONFIG_NEED_DBUS_TRUE@@CONFIG_UDEV_FALSE@am__objects_3 = dbus.lo -@CONFIG_HAL_TRUE@@CONFIG_NEED_DBUS_TRUE@@CONFIG_UDEV_FALSE@am__objects_4 = hal.lo -@CONFIG_NEED_DBUS_FALSE@@CONFIG_UDEV_FALSE@@CONFIG_WSCONS_TRUE@am__objects_5 = wscons.lo +@NEED_DBUS_TRUE@am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) +@CONFIG_UDEV_TRUE@am__DEPENDENCIES_3 = $(am__DEPENDENCIES_1) +@CONFIG_HAL_TRUE@@CONFIG_UDEV_FALSE@am__DEPENDENCIES_4 = \ +@CONFIG_HAL_TRUE@@CONFIG_UDEV_FALSE@ $(am__DEPENDENCIES_1) +libconfig_la_DEPENDENCIES = $(am__DEPENDENCIES_2) \ + $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_4) +am__libconfig_la_SOURCES_DIST = config.c config-backends.h dbus-core.c \ + udev.c hal.c wscons.c +@NEED_DBUS_TRUE@am__objects_1 = dbus-core.lo +@CONFIG_UDEV_TRUE@am__objects_2 = udev.lo +@CONFIG_HAL_TRUE@@CONFIG_UDEV_FALSE@am__objects_3 = hal.lo +@CONFIG_HAL_FALSE@@CONFIG_UDEV_FALSE@@CONFIG_WSCONS_TRUE@am__objects_4 = wscons.lo am_libconfig_la_OBJECTS = config.lo $(am__objects_1) $(am__objects_2) \ - $(am__objects_3) $(am__objects_4) $(am__objects_5) + $(am__objects_3) $(am__objects_4) libconfig_la_OBJECTS = $(am_libconfig_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) @@ -172,9 +172,8 @@ am__uninstall_files_from_dir = { \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } -am__installdirs = "$(DESTDIR)$(dbusconfigdir)" \ - "$(DESTDIR)$(xorgconfddir)" -DATA = $(dbusconfig_DATA) $(xorgconfd_DATA) +am__installdirs = "$(DESTDIR)$(xorgconfddir)" +DATA = $(xorgconfd_DATA) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) @@ -216,6 +215,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -260,6 +261,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -362,7 +367,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -371,6 +379,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -437,6 +446,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ @@ -509,21 +522,15 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -AM_CFLAGS = $(DIX_CFLAGS) $(am__append_1) $(am__append_3) \ - $(am__append_6) +AM_CFLAGS = $(DIX_CFLAGS) $(am__append_1) $(am__append_4) \ + $(am__append_7) noinst_LTLIBRARIES = libconfig.la libconfig_la_SOURCES = config.c config-backends.h $(am__append_2) \ - $(am__append_4) $(am__append_5) $(am__append_7) \ - $(am__append_9) -@CONFIG_NEED_DBUS_TRUE@@CONFIG_UDEV_FALSE@libconfig_la_LIBADD = \ -@CONFIG_NEED_DBUS_TRUE@@CONFIG_UDEV_FALSE@ $(DBUS_LIBS) \ -@CONFIG_NEED_DBUS_TRUE@@CONFIG_UDEV_FALSE@ $(am__append_8) -@CONFIG_UDEV_TRUE@libconfig_la_LIBADD = $(UDEV_LIBS) $(am__append_8) + $(am__append_5) $(am__append_8) $(am__append_10) +libconfig_la_LIBADD = $(am__append_3) $(am__append_6) $(am__append_9) @CONFIG_UDEV_TRUE@@XORG_TRUE@xorgconfddir = $(datadir)/X11/$(XF86CONFIGDIR) @CONFIG_UDEV_TRUE@@XORG_TRUE@xorgconfd_DATA = 10-evdev.conf 10-quirks.conf -@CONFIG_DBUS_API_TRUE@@CONFIG_NEED_DBUS_TRUE@@CONFIG_UDEV_FALSE@dbusconfigdir = $(sysconfdir)/dbus-1/system.d -@CONFIG_DBUS_API_TRUE@@CONFIG_NEED_DBUS_TRUE@@CONFIG_UDEV_FALSE@dbusconfig_DATA = xorg-server.conf -EXTRA_DIST = xorg-server.conf x11-input.fdi 10-evdev.conf non-seat0.conf.multi-seat fdi2iclass.py 10-quirks.conf +EXTRA_DIST = x11-input.fdi 10-evdev.conf fdi2iclass.py 10-quirks.conf all: all-am .SUFFIXES: @@ -580,7 +587,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/config.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dbus-core.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dbus.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hal.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/udev.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wscons.Plo@am__quote@ @@ -611,27 +617,6 @@ mostlyclean-libtool: clean-libtool: -rm -rf .libs _libs -install-dbusconfigDATA: $(dbusconfig_DATA) - @$(NORMAL_INSTALL) - @list='$(dbusconfig_DATA)'; test -n "$(dbusconfigdir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(dbusconfigdir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(dbusconfigdir)" || exit 1; \ - fi; \ - for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - echo "$$d$$p"; \ - done | $(am__base_list) | \ - while read files; do \ - echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(dbusconfigdir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(dbusconfigdir)" || exit $$?; \ - done - -uninstall-dbusconfigDATA: - @$(NORMAL_UNINSTALL) - @list='$(dbusconfig_DATA)'; test -n "$(dbusconfigdir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - dir='$(DESTDIR)$(dbusconfigdir)'; $(am__uninstall_files_from_dir) install-xorgconfdDATA: $(xorgconfd_DATA) @$(NORMAL_INSTALL) @list='$(xorgconfd_DATA)'; test -n "$(xorgconfddir)" || list=; \ @@ -754,7 +739,7 @@ check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(DATA) installdirs: - for dir in "$(DESTDIR)$(dbusconfigdir)" "$(DESTDIR)$(xorgconfddir)"; do \ + for dir in "$(DESTDIR)$(xorgconfddir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am @@ -810,7 +795,7 @@ info: info-am info-am: -install-data-am: install-dbusconfigDATA install-xorgconfdDATA +install-data-am: install-xorgconfdDATA install-dvi: install-dvi-am @@ -856,7 +841,7 @@ ps: ps-am ps-am: -uninstall-am: uninstall-dbusconfigDATA uninstall-xorgconfdDATA +uninstall-am: uninstall-xorgconfdDATA .MAKE: install-am install-strip @@ -865,16 +850,14 @@ uninstall-am: uninstall-dbusconfigDATA uninstall-xorgconfdDATA distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ - install-data-am install-dbusconfigDATA install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am install-man \ - install-pdf install-pdf-am install-ps install-ps-am \ - install-strip install-xorgconfdDATA installcheck \ - installcheck-am installdirs maintainer-clean \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip install-xorgconfdDATA \ + installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags uninstall uninstall-am uninstall-dbusconfigDATA \ - uninstall-xorgconfdDATA + tags uninstall uninstall-am uninstall-xorgconfdDATA # Tell versions [3.59,3.63) of GNU make to not export all variables. diff --git a/xserver/config/config-backends.h b/xserver/config/config-backends.h index 6423701fc..5f07557b7 100644 --- a/xserver/config/config-backends.h +++ b/xserver/config/config-backends.h @@ -37,41 +37,10 @@ int config_udev_pre_init(void); int config_udev_init(void); void config_udev_fini(void); void config_udev_odev_probe(config_odev_probe_proc_ptr probe_callback); -#else - -#ifdef CONFIG_NEED_DBUS -#include <dbus/dbus.h> - -typedef void (*config_dbus_core_connect_hook) (DBusConnection * connection, - void *data); -typedef void (*config_dbus_core_disconnect_hook) (void *data); - -struct config_dbus_core_hook { - config_dbus_core_connect_hook connect; - config_dbus_core_disconnect_hook disconnect; - void *data; - - struct config_dbus_core_hook *next; -}; - -int config_dbus_core_init(void); -void config_dbus_core_fini(void); -int config_dbus_core_add_hook(struct config_dbus_core_hook *hook); -void config_dbus_core_remove_hook(struct config_dbus_core_hook *hook); -#endif - -#ifdef CONFIG_DBUS_API -int config_dbus_init(void); -void config_dbus_fini(void); -#endif - -#ifdef CONFIG_HAL +#elif defined(CONFIG_HAL) int config_hal_init(void); void config_hal_fini(void); -#endif -#endif - -#ifdef CONFIG_WSCONS +#elif defined(CONFIG_WSCONS) int config_wscons_init(void); void config_wscons_fini(void); #endif diff --git a/xserver/config/config.c b/xserver/config/config.c index d0889a394..a26d835e1 100644 --- a/xserver/config/config.c +++ b/xserver/config/config.c @@ -27,10 +27,12 @@ #include <dix-config.h> #endif +#include <unistd.h> #include "os.h" #include "inputstr.h" #include "hotplug.h" #include "config-backends.h" +#include "systemd-logind.h" void config_pre_init(void) @@ -47,20 +49,9 @@ config_init(void) #ifdef CONFIG_UDEV if (!config_udev_init()) ErrorF("[config] failed to initialise udev\n"); -#elif defined(CONFIG_NEED_DBUS) - if (config_dbus_core_init()) { -#ifdef CONFIG_DBUS_API - if (!config_dbus_init()) - ErrorF("[config] failed to initialise D-Bus API\n"); -#endif -#ifdef CONFIG_HAL - if (!config_hal_init()) - ErrorF("[config] failed to initialise HAL\n"); -#endif - } - else { - ErrorF("[config] failed to initialise D-Bus core\n"); - } +#elif defined(CONFIG_HAL) + if (!config_hal_init()) + ErrorF("[config] failed to initialise HAL\n"); #elif defined(CONFIG_WSCONS) if (!config_wscons_init()) ErrorF("[config] failed to initialise wscons\n"); @@ -72,14 +63,8 @@ config_fini(void) { #if defined(CONFIG_UDEV) config_udev_fini(); -#elif defined(CONFIG_NEED_DBUS) -#ifdef CONFIG_HAL +#elif defined(CONFIG_HAL) config_hal_fini(); -#endif -#ifdef CONFIG_DBUS_API - config_dbus_fini(); -#endif - config_dbus_core_fini(); #elif defined(CONFIG_WSCONS) config_wscons_fini(); #endif @@ -147,10 +132,7 @@ config_odev_allocate_attribute_list(void) { struct OdevAttributes *attriblist; - attriblist = malloc(sizeof(struct OdevAttributes)); - if (!attriblist) - return NULL; - + attriblist = XNFalloc(sizeof(struct OdevAttributes)); xorg_list_init(&attriblist->list); return attriblist; } @@ -162,30 +144,144 @@ config_odev_free_attribute_list(struct OdevAttributes *attribs) free(attribs); } +static struct OdevAttribute * +config_odev_find_attribute(struct OdevAttributes *attribs, int attrib_id) +{ + struct OdevAttribute *oa; + + xorg_list_for_each_entry(oa, &attribs->list, member) { + if (oa->attrib_id == attrib_id) + return oa; + } + return NULL; +} + +static struct OdevAttribute * +config_odev_find_or_add_attribute(struct OdevAttributes *attribs, int attrib) +{ + struct OdevAttribute *oa; + + oa = config_odev_find_attribute(attribs, attrib); + if (oa) + return oa; + + oa = XNFcalloc(sizeof(struct OdevAttribute)); + oa->attrib_id = attrib; + xorg_list_append(&oa->member, &attribs->list); + + return oa; +} + +static int config_odev_get_attribute_type(int attrib) +{ + switch (attrib) { + case ODEV_ATTRIB_PATH: + case ODEV_ATTRIB_SYSPATH: + case ODEV_ATTRIB_BUSID: + return ODEV_ATTRIB_STRING; + case ODEV_ATTRIB_FD: + case ODEV_ATTRIB_MAJOR: + case ODEV_ATTRIB_MINOR: + return ODEV_ATTRIB_INT; + case ODEV_ATTRIB_DRIVER: + return ODEV_ATTRIB_STRING; + default: + LogMessage(X_ERROR, "Error %s called for unknown attribute %d\n", + __func__, attrib); + return ODEV_ATTRIB_UNKNOWN; + } +} + Bool config_odev_add_attribute(struct OdevAttributes *attribs, int attrib, const char *attrib_name) { struct OdevAttribute *oa; - oa = malloc(sizeof(struct OdevAttribute)); - if (!oa) + if (config_odev_get_attribute_type(attrib) != ODEV_ATTRIB_STRING) { + LogMessage(X_ERROR, "Error %s called for non string attrib %d\n", + __func__, attrib); return FALSE; + } - oa->attrib_id = attrib; - oa->attrib_name = strdup(attrib_name); - xorg_list_append(&oa->member, &attribs->list); + oa = config_odev_find_or_add_attribute(attribs, attrib); + free(oa->attrib_name); + oa->attrib_name = XNFstrdup(attrib_name); + oa->attrib_type = ODEV_ATTRIB_STRING; return TRUE; } +Bool +config_odev_add_int_attribute(struct OdevAttributes *attribs, int attrib, + int attrib_value) +{ + struct OdevAttribute *oa; + + if (config_odev_get_attribute_type(attrib) != ODEV_ATTRIB_INT) { + LogMessage(X_ERROR, "Error %s called for non integer attrib %d\n", + __func__, attrib); + return FALSE; + } + + oa = config_odev_find_or_add_attribute(attribs, attrib); + oa->attrib_value = attrib_value; + oa->attrib_type = ODEV_ATTRIB_INT; + return TRUE; +} + +char * +config_odev_get_attribute(struct OdevAttributes *attribs, int attrib_id) +{ + struct OdevAttribute *oa; + + oa = config_odev_find_attribute(attribs, attrib_id); + if (!oa) + return NULL; + + if (oa->attrib_type != ODEV_ATTRIB_STRING) { + LogMessage(X_ERROR, "Error %s called for non string attrib %d\n", + __func__, attrib_id); + return NULL; + } + return oa->attrib_name; +} + +int +config_odev_get_int_attribute(struct OdevAttributes *attribs, int attrib_id, int def) +{ + struct OdevAttribute *oa; + + oa = config_odev_find_attribute(attribs, attrib_id); + if (!oa) + return def; + + if (oa->attrib_type != ODEV_ATTRIB_INT) { + LogMessage(X_ERROR, "Error %s called for non integer attrib %d\n", + __func__, attrib_id); + return def; + } + + return oa->attrib_value; +} + void config_odev_free_attributes(struct OdevAttributes *attribs) { struct OdevAttribute *iter, *safe; + int major = 0, minor = 0, fd = -1; xorg_list_for_each_entry_safe(iter, safe, &attribs->list, member) { + switch (iter->attrib_id) { + case ODEV_ATTRIB_MAJOR: major = iter->attrib_value; break; + case ODEV_ATTRIB_MINOR: minor = iter->attrib_value; break; + case ODEV_ATTRIB_FD: fd = iter->attrib_value; break; + } xorg_list_del(&iter->member); - free(iter->attrib_name); + if (iter->attrib_type == ODEV_ATTRIB_STRING) + free(iter->attrib_name); free(iter); } + + if (fd != -1) + systemd_logind_release_fd(major, minor, fd); } diff --git a/xserver/config/dbus-core.c b/xserver/config/dbus-core.c index 324258718..8351ea4b3 100644 --- a/xserver/config/dbus-core.c +++ b/xserver/config/dbus-core.c @@ -30,9 +30,9 @@ #include <dbus/dbus.h> #include <sys/select.h> -#include "config-backends.h" #include "dix.h" #include "os.h" +#include "dbus-core.h" /* How often to attempt reconnecting when we get booted off the bus. */ #define RECONNECT_DELAY (10 * 1000) /* in ms */ @@ -41,18 +41,18 @@ struct dbus_core_info { int fd; DBusConnection *connection; OsTimerPtr timer; - struct config_dbus_core_hook *hooks; + struct dbus_core_hook *hooks; }; static struct dbus_core_info bus_info; -static CARD32 reconnect_timer(OsTimerPtr timer, CARD32 time, pointer arg); +static CARD32 reconnect_timer(OsTimerPtr timer, CARD32 time, void *arg); static void -wakeup_handler(pointer data, int err, pointer read_mask) +wakeup_handler(void *data, int num_fds, void *read_mask) { struct dbus_core_info *info = data; - if (info->connection && FD_ISSET(info->fd, (fd_set *) read_mask)) { + if (info->connection && num_fds > 0 && FD_ISSET(info->fd, (fd_set *) read_mask)) { do { dbus_connection_read_write_dispatch(info->connection, 0); } while (info->connection && @@ -63,7 +63,7 @@ wakeup_handler(pointer data, int err, pointer read_mask) } static void -block_handler(pointer data, struct timeval **tv, pointer read_mask) +block_handler(void *data, struct timeval **tv, void *read_mask) { } @@ -74,7 +74,7 @@ block_handler(pointer data, struct timeval **tv, pointer read_mask) static void teardown(void) { - struct config_dbus_core_hook *hook; + struct dbus_core_hook *hook; if (bus_info.timer) { TimerFree(bus_info.timer); @@ -112,7 +112,7 @@ message_filter(DBusConnection * connection, DBusMessage * message, void *data) * reconnect immediately (assuming it's just a restart). The * connection isn't valid at this point, so throw it out immediately. */ if (dbus_message_is_signal(message, DBUS_INTERFACE_LOCAL, "Disconnected")) { - DebugF("[config/dbus-core] disconnected from bus\n"); + DebugF("[dbus-core] disconnected from bus\n"); bus_info.connection = NULL; teardown(); @@ -136,12 +136,12 @@ static int connect_to_bus(void) { DBusError error; - struct config_dbus_core_hook *hook; + struct dbus_core_hook *hook; dbus_error_init(&error); bus_info.connection = dbus_bus_get(DBUS_BUS_SYSTEM, &error); if (!bus_info.connection || dbus_error_is_set(&error)) { - DebugF("[config/dbus-core] error connecting to system bus: %s (%s)\n", + LogMessage(X_ERROR, "dbus-core: error connecting to system bus: %s (%s)\n", error.name, error.message); goto err_begin; } @@ -150,13 +150,13 @@ connect_to_bus(void) dbus_connection_set_exit_on_disconnect(bus_info.connection, FALSE); if (!dbus_connection_get_unix_fd(bus_info.connection, &bus_info.fd)) { - ErrorF("[config/dbus-core] couldn't get fd for system bus\n"); + ErrorF("[dbus-core] couldn't get fd for system bus\n"); goto err_unref; } if (!dbus_connection_add_filter(bus_info.connection, message_filter, &bus_info, NULL)) { - ErrorF("[config/dbus-core] couldn't add filter: %s (%s)\n", error.name, + ErrorF("[dbus-core] couldn't add filter: %s (%s)\n", error.name, error.message); goto err_fd; } @@ -185,7 +185,7 @@ connect_to_bus(void) } static CARD32 -reconnect_timer(OsTimerPtr timer, CARD32 time, pointer arg) +reconnect_timer(OsTimerPtr timer, CARD32 time, void *arg) { if (connect_to_bus()) { TimerFree(bus_info.timer); @@ -198,9 +198,9 @@ reconnect_timer(OsTimerPtr timer, CARD32 time, pointer arg) } int -config_dbus_core_add_hook(struct config_dbus_core_hook *hook) +dbus_core_add_hook(struct dbus_core_hook *hook) { - struct config_dbus_core_hook **prev; + struct dbus_core_hook **prev; for (prev = &bus_info.hooks; *prev; prev = &(*prev)->next); @@ -215,9 +215,9 @@ config_dbus_core_add_hook(struct config_dbus_core_hook *hook) } void -config_dbus_core_remove_hook(struct config_dbus_core_hook *hook) +dbus_core_remove_hook(struct dbus_core_hook *hook) { - struct config_dbus_core_hook **prev; + struct dbus_core_hook **prev; for (prev = &bus_info.hooks; *prev; prev = &(*prev)->next) { if (*prev == hook) { @@ -228,19 +228,19 @@ config_dbus_core_remove_hook(struct config_dbus_core_hook *hook) } int -config_dbus_core_init(void) +dbus_core_init(void) { memset(&bus_info, 0, sizeof(bus_info)); bus_info.fd = -1; bus_info.hooks = NULL; - bus_info.connection = NULL; - bus_info.timer = TimerSet(NULL, 0, 1, reconnect_timer, NULL); + if (!connect_to_bus()) + bus_info.timer = TimerSet(NULL, 0, 1, reconnect_timer, NULL); return 1; } void -config_dbus_core_fini(void) +dbus_core_fini(void) { teardown(); } diff --git a/xserver/config/dbus.c b/xserver/config/dbus.c deleted file mode 100644 index 99a1537e1..000000000 --- a/xserver/config/dbus.c +++ /dev/null @@ -1,407 +0,0 @@ -/* - * Copyright © 2006-2007 Daniel Stone - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Author: Daniel Stone <daniel@fooishbar.org> - */ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include <dbus/dbus.h> -#include <string.h> - -#include <X11/X.h> - -#include "config-backends.h" -#include "opaque.h" /* for 'display': there should be a better way. */ -#include "input.h" -#include "inputstr.h" - -#define API_VERSION 2 - -#define MATCH_RULE "type='method_call',interface='org.x.config.input'" - -#define MALFORMED_MSG "[config/dbus] malformed message, dropping" -#define MALFORMED_MESSAGE() { DebugF(MALFORMED_MSG "\n"); \ - ret = BadValue; \ - goto unwind; } -#define MALFORMED_MESSAGE_ERROR() { DebugF(MALFORMED_MSG ": %s, %s", \ - error->name, error->message); \ - ret = BadValue; \ - goto unwind; } - -struct connection_info { - char busobject[32]; - char busname[64]; - DBusConnection *connection; -}; - -static void -reset_info(struct connection_info *info) -{ - info->connection = NULL; - info->busname[0] = '\0'; - info->busobject[0] = '\0'; -} - -static int -add_device(DBusMessage * message, DBusMessage * reply, DBusError * error) -{ - DBusMessageIter iter, reply_iter, subiter; - InputOption *input_options = NULL; - int ret, err; - DeviceIntPtr dev = NULL; - - dbus_message_iter_init_append(reply, &reply_iter); - - if (!dbus_message_iter_init(message, &iter)) { - ErrorF("[config/dbus] couldn't initialise iterator\n"); - MALFORMED_MESSAGE(); - } - - input_options = input_option_new(input_options, "_source", "client/dbus"); - if (!input_options) { - ErrorF("[config/dbus] couldn't allocate first key/value pair\n"); - ret = BadAlloc; - goto unwind; - } - - /* signature should be [ss][ss]... */ - while (dbus_message_iter_get_arg_type(&iter) == DBUS_TYPE_ARRAY) { - char *key, *value; - - dbus_message_iter_recurse(&iter, &subiter); - - if (dbus_message_iter_get_arg_type(&subiter) != DBUS_TYPE_STRING) - MALFORMED_MESSAGE(); - - dbus_message_iter_get_basic(&subiter, &key); - if (!key) - MALFORMED_MESSAGE(); - /* The _ prefix refers to internal settings, and may not be given by - * the client. */ - if (key[0] == '_') { - ErrorF("[config/dbus] attempted subterfuge: option name %s given\n", - key); - MALFORMED_MESSAGE(); - } - - if (!dbus_message_iter_has_next(&subiter)) - MALFORMED_MESSAGE(); - dbus_message_iter_next(&subiter); - if (dbus_message_iter_get_arg_type(&subiter) != DBUS_TYPE_STRING) - MALFORMED_MESSAGE(); - - dbus_message_iter_get_basic(&subiter, &value); - if (!value) - MALFORMED_MESSAGE(); - - input_options = input_option_new(input_options, key, value); - - dbus_message_iter_next(&iter); - } - - ret = NewInputDeviceRequest(input_options, NULL, &dev); - if (ret != Success) { - DebugF("[config/dbus] NewInputDeviceRequest failed\n"); - goto unwind; - } - - if (!dev) { - DebugF("[config/dbus] NewInputDeviceRequest provided no device\n"); - ret = BadImplementation; - goto unwind; - } - - /* XXX: If we fail halfway through, we don't seem to have any way to - * empty the iterator, so you'll end up with some device IDs, - * plus an error. This seems to be a shortcoming in the D-Bus - * API. */ - for (; dev; dev = dev->next) { - if (!dbus_message_iter_append_basic(&reply_iter, DBUS_TYPE_INT32, - &dev->id)) { - ErrorF("[config/dbus] couldn't append to iterator\n"); - ret = BadAlloc; - goto unwind; - } - } - - unwind: - if (ret != Success) { - if (dev) - RemoveDevice(dev, TRUE); - - err = -ret; - dbus_message_iter_append_basic(&reply_iter, DBUS_TYPE_INT32, &err); - } - - input_option_free_list(&input_options); - - return ret; -} - -static int -remove_device(DBusMessage * message, DBusMessage * reply, DBusError * error) -{ - int deviceid, ret, err; - DeviceIntPtr dev; - DBusMessageIter iter, reply_iter; - - dbus_message_iter_init_append(reply, &reply_iter); - - if (!dbus_message_iter_init(message, &iter)) { - ErrorF("[config/dbus] failed to init iterator\n"); - MALFORMED_MESSAGE(); - } - - if (!dbus_message_get_args(message, error, DBUS_TYPE_UINT32, - &deviceid, DBUS_TYPE_INVALID)) { - MALFORMED_MESSAGE_ERROR(); - } - - dixLookupDevice(&dev, deviceid, serverClient, DixDestroyAccess); - if (!dev) { - DebugF("[config/dbus] bogus device id %d given\n", deviceid); - ret = BadMatch; - goto unwind; - } - - DebugF("[config/dbus] removing device %s (id %d)\n", dev->name, deviceid); - - /* Call PIE here so we don't try to dereference a device that's - * already been removed. */ - OsBlockSignals(); - ProcessInputEvents(); - DeleteInputDeviceRequest(dev); - OsReleaseSignals(); - - ret = Success; - - unwind: - err = (ret == Success) ? ret : -ret; - dbus_message_iter_append_basic(&reply_iter, DBUS_TYPE_INT32, &err); - - return ret; -} - -static int -list_devices(DBusMessage * message, DBusMessage * reply, DBusError * error) -{ - DeviceIntPtr dev; - DBusMessageIter iter, subiter; - - dbus_message_iter_init_append(reply, &iter); - - for (dev = inputInfo.devices; dev; dev = dev->next) { - if (!dbus_message_iter_open_container(&iter, DBUS_TYPE_STRUCT, NULL, - &subiter)) { - ErrorF("[config/dbus] couldn't init container\n"); - return BadAlloc; - } - if (!dbus_message_iter_append_basic(&subiter, DBUS_TYPE_UINT32, - &dev->id)) { - ErrorF("[config/dbus] couldn't append to iterator\n"); - return BadAlloc; - } - if (!dbus_message_iter_append_basic(&subiter, DBUS_TYPE_STRING, - &dev->name)) { - ErrorF("[config/dbus] couldn't append to iterator\n"); - return BadAlloc; - } - if (!dbus_message_iter_close_container(&iter, &subiter)) { - ErrorF("[config/dbus] couldn't close container\n"); - return BadAlloc; - } - } - - return Success; -} - -static int -get_version(DBusMessage * message, DBusMessage * reply, DBusError * error) -{ - DBusMessageIter iter; - unsigned int version = API_VERSION; - - dbus_message_iter_init_append(reply, &iter); - if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_UINT32, &version)) { - ErrorF("[config/dbus] couldn't append version\n"); - return BadAlloc; - } - - return Success; -} - -static DBusHandlerResult -message_handler(DBusConnection * connection, DBusMessage * message, void *data) -{ - DBusError error; - DBusMessage *reply; - struct connection_info *info = data; - - /* ret is the overall D-Bus handler result, whereas err is the internal - * X error from our individual functions. */ - int ret = DBUS_HANDLER_RESULT_NOT_YET_HANDLED; - int err; - - DebugF("[config/dbus] received a message for %s\n", - dbus_message_get_interface(message)); - - dbus_error_init(&error); - - reply = dbus_message_new_method_return(message); - if (!reply) { - ErrorF("[config/dbus] failed to create reply\n"); - ret = DBUS_HANDLER_RESULT_NEED_MEMORY; - goto err_start; - } - - if (strcmp(dbus_message_get_member(message), "add") == 0) - err = add_device(message, reply, &error); - else if (strcmp(dbus_message_get_member(message), "remove") == 0) - err = remove_device(message, reply, &error); - else if (strcmp(dbus_message_get_member(message), "listDevices") == 0) - err = list_devices(message, reply, &error); - else if (strcmp(dbus_message_get_member(message), "version") == 0) - err = get_version(message, reply, &error); - else - goto err_reply; - - /* Failure to allocate is a special case. */ - if (err == BadAlloc) { - ret = DBUS_HANDLER_RESULT_NEED_MEMORY; - goto err_reply; - } - - /* While failure here is always an OOM, we don't return that, - * since that would result in devices being double-added/removed. */ - if (dbus_connection_send(info->connection, reply, NULL)) - dbus_connection_flush(info->connection); - else - ErrorF("[config/dbus] failed to send reply\n"); - - ret = DBUS_HANDLER_RESULT_HANDLED; - - err_reply: - dbus_message_unref(reply); - err_start: - dbus_error_free(&error); - - return ret; -} - -static void -connect_hook(DBusConnection * connection, void *data) -{ - DBusError error; - DBusObjectPathVTable vtable = {.message_function = message_handler, }; - struct connection_info *info = data; - - info->connection = connection; - - dbus_error_init(&error); - - dbus_bus_request_name(info->connection, info->busname, 0, &error); - if (dbus_error_is_set(&error)) { - ErrorF("[config/dbus] couldn't take over org.x.config: %s (%s)\n", - error.name, error.message); - goto err_start; - } - - /* blocks until we get a reply. */ - dbus_bus_add_match(info->connection, MATCH_RULE, &error); - if (dbus_error_is_set(&error)) { - ErrorF("[config/dbus] couldn't add match: %s (%s)\n", error.name, - error.message); - goto err_name; - } - - if (!dbus_connection_register_object_path(info->connection, - info->busobject, &vtable, info)) { - ErrorF("[config/dbus] couldn't register object path\n"); - goto err_match; - } - - DebugF("[dbus] registered %s, %s\n", info->busname, info->busobject); - - dbus_error_free(&error); - - return; - - err_match: - dbus_bus_remove_match(info->connection, MATCH_RULE, &error); - err_name: - dbus_bus_release_name(info->connection, info->busname, &error); - err_start: - dbus_error_free(&error); - - reset_info(info); -} - -static void -disconnect_hook(void *data) -{ -} - -#if 0 -void -pre_disconnect_hook(void) -{ - DBusError error; - - dbus_error_init(&error); - dbus_connection_unregister_object_path(connection_data->connection, - connection_data->busobject); - dbus_bus_remove_match(connection_data->connection, MATCH_RULE, &error); - dbus_bus_release_name(connection_data->connection, - connection_data->busname, &error); - dbus_error_free(&error); -} -#endif - -static struct connection_info connection_data; - -static struct config_dbus_core_hook core_hook = { - .connect = connect_hook, - .disconnect = disconnect_hook, - .data = &connection_data, -}; - -int -config_dbus_init(void) -{ - snprintf(connection_data.busname, sizeof(connection_data.busname), - "org.x.config.display%d", atoi(display)); - snprintf(connection_data.busobject, sizeof(connection_data.busobject), - "/org/x/config/%d", atoi(display)); - - return config_dbus_core_add_hook(&core_hook); -} - -void -config_dbus_fini(void) -{ - config_dbus_core_remove_hook(&core_hook); - connection_data.busname[0] = '\0'; - connection_data.busobject[0] = '\0'; -} diff --git a/xserver/config/hal.c b/xserver/config/hal.c index d8e8db7c2..ea574ca52 100644 --- a/xserver/config/hal.c +++ b/xserver/config/hal.c @@ -33,6 +33,7 @@ #include <string.h> #include <sys/select.h> +#include "dbus-core.h" #include "input.h" #include "inputstr.h" #include "hotplug.h" @@ -641,7 +642,7 @@ connect_hook(DBusConnection * connection, void *data) static struct config_hal_info hal_info; -static struct config_dbus_core_hook hook = { +static struct dbus_core_hook hook = { .connect = connect_hook, .disconnect = disconnect_hook, .data = &hal_info, @@ -654,7 +655,7 @@ config_hal_init(void) hal_info.system_bus = NULL; hal_info.hal_ctx = NULL; - if (!config_dbus_core_add_hook(&hook)) { + if (!dbus_core_add_hook(&hook)) { LogMessage(X_ERROR, "config/hal: failed to add D-Bus hook\n"); return 0; } @@ -668,5 +669,5 @@ config_hal_init(void) void config_hal_fini(void) { - config_dbus_core_remove_hook(&hook); + dbus_core_remove_hook(&hook); } diff --git a/xserver/config/non-seat0.conf.multi-seat b/xserver/config/non-seat0.conf.multi-seat deleted file mode 100644 index 34008ce50..000000000 --- a/xserver/config/non-seat0.conf.multi-seat +++ /dev/null @@ -1,18 +0,0 @@ -# This is the default configuration for servers on seat-1 and above. -# -# Start the server with -config non-seat0.conf.multi-seat, or alternatively -# rename the file to end in .conf and put it in the standard config -# directory (though it will apply to _all_ seats!). -# -# * Disable VT switching with Ctrl-Alt-F1 -# * Force a grab on all input devices to detach them from the VT subsystem -# to avoid event leakage. - -Section "ServerFlags" - Option "DontVTSwitch" "on" -EndSection - -Section "InputClass" - Identifier "Force input devices to seat" - Option "GrabDevice" "on" -EndSection diff --git a/xserver/config/udev.c b/xserver/config/udev.c index bcafbd9d8..a1b72c13b 100644 --- a/xserver/config/udev.c +++ b/xserver/config/udev.c @@ -29,6 +29,7 @@ #include <libudev.h> #include <ctype.h> +#include <unistd.h> #include "input.h" #include "inputstr.h" @@ -36,6 +37,7 @@ #include "config-backends.h" #include "os.h" #include "globals.h" +#include "systemd-logind.h" #define UDEV_XKB_PROP_KEY "xkb" @@ -53,11 +55,20 @@ static struct udev_monitor *udev_monitor; #ifdef CONFIG_UDEV_KMS -static Bool +static void config_udev_odev_setup_attribs(const char *path, const char *syspath, + int major, int minor, config_odev_probe_proc_ptr probe_callback); #endif +static char itoa_buf[16]; + +static const char *itoa(int i) +{ + snprintf(itoa_buf, sizeof(itoa_buf), "%d", i); + return itoa_buf; +} + static void device_added(struct udev_device *udev_device) { @@ -73,6 +84,7 @@ device_added(struct udev_device *udev_device) struct udev_device *parent; int rc; const char *dev_seat; + dev_t devnum; path = udev_device_get_devnode(udev_device); @@ -91,6 +103,8 @@ device_added(struct udev_device *udev_device) if (!SeatId && strcmp(dev_seat, "seat0")) return; + devnum = udev_device_get_devnum(udev_device); + #ifdef CONFIG_UDEV_KMS if (!strcmp(udev_device_get_subsystem(udev_device), "drm")) { const char *sysname = udev_device_get_sysname(udev_device); @@ -98,9 +112,14 @@ device_added(struct udev_device *udev_device) if (strncmp(sysname, "card", 4) != 0) return; + /* Check for devices already added through xf86platformProbe() */ + if (xf86_find_platform_device_by_devnum(major(devnum), minor(devnum))) + return; + LogMessage(X_INFO, "config/udev: Adding drm device (%s)\n", path); - config_udev_odev_setup_attribs(path, syspath, NewGPUDeviceRequest); + config_udev_odev_setup_attribs(path, syspath, major(devnum), + minor(devnum), NewGPUDeviceRequest); return; } #endif @@ -133,11 +152,13 @@ device_added(struct udev_device *udev_device) /* construct USB ID in lowercase hex - "0000:ffff" */ if (product && sscanf(product, "%*x/%4x/%4x/%*x", &usb_vendor, &usb_model) == 2) { - if (asprintf(&attrs.usb_id, "%04x:%04x", usb_vendor, usb_model) + char *usb_id; + if (asprintf(&usb_id, "%04x:%04x", usb_vendor, usb_model) == -1) - attrs.usb_id = NULL; + usb_id = NULL; else LOG_PROPERTY(ppath, "PRODUCT", product); + attrs.usb_id = usb_id; } while (!pnp_id && (parent = udev_device_get_parent(parent))) { @@ -158,6 +179,8 @@ device_added(struct udev_device *udev_device) input_options = input_option_new(input_options, "name", name); input_options = input_option_new(input_options, "path", path); input_options = input_option_new(input_options, "device", path); + input_options = input_option_new(input_options, "major", itoa(major(devnum))); + input_options = input_option_new(input_options, "minor", itoa(minor(devnum))); if (path) attrs.device = strdup(path); @@ -275,6 +298,7 @@ device_removed(struct udev_device *device) if (!strcmp(udev_device_get_subsystem(device), "drm")) { const char *sysname = udev_device_get_sysname(device); const char *path = udev_device_get_devnode(device); + dev_t devnum = udev_device_get_devnum(device); if (strncmp(sysname,"card", 4) != 0) return; @@ -282,7 +306,10 @@ device_removed(struct udev_device *device) if (!path) return; - config_udev_odev_setup_attribs(path, syspath, DeleteGPUDeviceRequest); + config_udev_odev_setup_attribs(path, syspath, major(devnum), + minor(devnum), DeleteGPUDeviceRequest); + /* Retry vtenter after a drm node removal */ + systemd_logind_vtenter(); return; } #endif @@ -296,7 +323,7 @@ device_removed(struct udev_device *device) } static void -wakeup_handler(pointer data, int err, pointer read_mask) +wakeup_handler(void *data, int err, void *read_mask) { int udev_fd = udev_monitor_get_fd(udev_monitor); struct udev_device *udev_device; @@ -329,7 +356,7 @@ wakeup_handler(pointer data, int err, pointer read_mask) } static void -block_handler(pointer data, struct timeval **tv, pointer read_mask) +block_handler(void *data, struct timeval **tv, void *read_mask) { } @@ -430,31 +457,20 @@ config_udev_fini(void) #ifdef CONFIG_UDEV_KMS -static Bool +static void config_udev_odev_setup_attribs(const char *path, const char *syspath, + int major, int minor, config_odev_probe_proc_ptr probe_callback) { struct OdevAttributes *attribs = config_odev_allocate_attribute_list(); - int ret; - if (!attribs) - return FALSE; - - ret = config_odev_add_attribute(attribs, ODEV_ATTRIB_PATH, path); - if (ret == FALSE) - goto fail; - - ret = config_odev_add_attribute(attribs, ODEV_ATTRIB_SYSPATH, syspath); - if (ret == FALSE) - goto fail; + config_odev_add_attribute(attribs, ODEV_ATTRIB_PATH, path); + config_odev_add_attribute(attribs, ODEV_ATTRIB_SYSPATH, syspath); + config_odev_add_int_attribute(attribs, ODEV_ATTRIB_MAJOR, major); + config_odev_add_int_attribute(attribs, ODEV_ATTRIB_MINOR, minor); /* ownership of attribs is passed to probe layer */ probe_callback(attribs); - return TRUE; -fail: - config_odev_free_attributes(attribs); - free(attribs); - return FALSE; } void @@ -482,6 +498,7 @@ config_udev_odev_probe(config_odev_probe_proc_ptr probe_callback) struct udev_device *udev_device = udev_device_new_from_syspath(udev, syspath); const char *path = udev_device_get_devnode(udev_device); const char *sysname = udev_device_get_sysname(udev_device); + dev_t devnum = udev_device_get_devnum(udev_device); if (!path || !syspath) goto no_probe; @@ -490,8 +507,8 @@ config_udev_odev_probe(config_odev_probe_proc_ptr probe_callback) else if (strncmp(sysname, "card", 4) != 0) goto no_probe; - config_udev_odev_setup_attribs(path, syspath, probe_callback); - + config_udev_odev_setup_attribs(path, syspath, major(devnum), + minor(devnum), probe_callback); no_probe: udev_device_unref(udev_device); } diff --git a/xserver/config/wscons.c b/xserver/config/wscons.c index 7f5f85e3b..686d6026c 100644 --- a/xserver/config/wscons.c +++ b/xserver/config/wscons.c @@ -111,7 +111,7 @@ wscons_add_keyboard(void) close(fd); return; } - close (fd); + close(fd); input_options = input_option_new(input_options, "_source", "server/wscons"); if (input_options == NULL) @@ -219,13 +219,11 @@ wscons_add_pointers(void) /* Check pointing devices */ for (i = 0; i < 4; i++) { - snprintf(devname, sizeof(devname), "%s%d", - WSCONS_MOUSE_PREFIX, i); + snprintf(devname, sizeof(devname), "%s%d", WSCONS_MOUSE_PREFIX, i); LogMessageVerb(X_INFO, 10, "wsmouse: checking %s\n", devname); fd = priv_open_device(devname); if (fd == -1) { - LogMessageVerb(X_WARNING, 10, "%s: %s\n", devname, - strerror(errno)); + LogMessageVerb(X_WARNING, 10, "%s: %s\n", devname, strerror(errno)); continue; } if (ioctl(fd, WSMOUSEIO_GTYPE, &wsmouse_type) != 0) { diff --git a/xserver/config/xorg-server.conf b/xserver/config/xorg-server.conf deleted file mode 100644 index 47a9a7824..000000000 --- a/xserver/config/xorg-server.conf +++ /dev/null @@ -1,13 +0,0 @@ -<!DOCTYPE busconfig PUBLIC - "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN" - "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"> -<busconfig> - <policy context="default"> - <allow own="org.x.config.display0"/> - <allow send_destination="org.x.config.display0"/> - <allow send_interface="org.x.config.display0"/> - <allow own="org.x.config.display1"/> - <allow send_destination="org.x.config.display1"/> - <allow send_interface="org.x.config.display1"/> - </policy> -</busconfig> diff --git a/xserver/configure b/xserver/configure index 6f2217d2a..6fb362f3e 100644 --- a/xserver/configure +++ b/xserver/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for xorg-server 1.15.2. +# Generated by GNU Autoconf 2.69 for xorg-server 1.16.1. # # Report bugs to <https://bugs.freedesktop.org/enter_bug.cgi?product=xorg>. # @@ -651,8 +651,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='xorg-server' PACKAGE_TARNAME='xorg-server' -PACKAGE_VERSION='1.15.2' -PACKAGE_STRING='xorg-server 1.15.2' +PACKAGE_VERSION='1.16.1' +PACKAGE_STRING='xorg-server 1.16.1' PACKAGE_BUGREPORT='https://bugs.freedesktop.org/enter_bug.cgi?product=xorg' PACKAGE_URL='' @@ -700,7 +700,15 @@ DIX_CFLAGS BUILD_TIME BUILD_DATE RELEASE_DATE +SYSCONFDIR PROJECTROOT +WAYLAND_SCANNER +XWAYLAND_SYS_LIBS +XWAYLAND_LIBS +XWAYLAND_FALSE +XWAYLAND_TRUE +XWAYLANDMODULES_LIBS +XWAYLANDMODULES_CFLAGS XFAKESERVER_FALSE XFAKESERVER_TRUE BUILD_KDRIVEFBDEVLIB_FALSE @@ -774,6 +782,8 @@ OBJCFLAGS OBJCLINK OBJCCLD OBJC +PSEUDORAMIX_FALSE +PSEUDORAMIX_TRUE XPBPROXY_LIBS XPBPROXY_CFLAGS XQUARTZ_LIBS @@ -807,8 +817,14 @@ WINDOWSWM_CFLAGS XWINMODULES_LIBS XWINMODULES_CFLAGS WINDRES -DEFAULT_LOGDIR -SYSCONFDIR +GLAMOR_EGL_FALSE +GLAMOR_EGL_TRUE +GBM_LIBS +GBM_CFLAGS +GLAMOR_LIBS +GLAMOR_CFLAGS +GLAMOR_FALSE +GLAMOR_TRUE XORG_BUS_PLATFORM_FALSE XORG_BUS_PLATFORM_TRUE XF86VIDMODE_FALSE @@ -841,7 +857,10 @@ extdir sdkdir driverdir moduledir +DEFAULT_XDG_DATA_HOME_LOGDIR +DEFAULT_XDG_DATA_HOME DEFAULT_LOGPREFIX +DEFAULT_LOGDIR DEFAULT_LIBRARY_PATH DEFAULT_MODULE_PATH __XCONFIGDIR__ @@ -961,8 +980,6 @@ XLIB_LIBS XLIB_CFLAGS DRI2_AIGLX_FALSE DRI2_AIGLX_TRUE -LIBDRM_LIBS -LIBDRM_CFLAGS DRI3_FALSE DRI3_TRUE XSHMFENCE_FALSE @@ -999,14 +1016,19 @@ XV_FALSE XV_TRUE CONFIG_WSCONS_FALSE CONFIG_WSCONS_TRUE -CONFIG_NEED_DBUS_FALSE -CONFIG_NEED_DBUS_TRUE +NEED_DBUS_FALSE +NEED_DBUS_TRUE +SUID_WRAPPER_FALSE +SUID_WRAPPER_TRUE +SUID_WRAPPER_DIR +LIBDRM_LIBS +LIBDRM_CFLAGS +SYSTEMD_LOGIND_FALSE +SYSTEMD_LOGIND_TRUE CONFIG_HAL_FALSE CONFIG_HAL_TRUE HAL_LIBS HAL_CFLAGS -CONFIG_DBUS_API_FALSE -CONFIG_DBUS_API_TRUE HAVE_DBUS_FALSE HAVE_DBUS_TRUE DBUS_LIBS @@ -1017,6 +1039,10 @@ CONFIG_UDEV_FALSE CONFIG_UDEV_TRUE UDEV_LIBS UDEV_CFLAGS +HAVE_SYSTEMD_DAEMON_FALSE +HAVE_SYSTEMD_DAEMON_TRUE +SYSTEMD_DAEMON_LIBS +SYSTEMD_DAEMON_CFLAGS SDK_REQUIRED_MODULES PIXMAN_LIBS PIXMAN_CFLAGS @@ -1352,7 +1378,6 @@ enable_xf86bigfont enable_dpms enable_config_udev enable_config_udev_kms -enable_config_dbus enable_config_hal enable_config_wscons enable_xfree86_utils @@ -1365,13 +1390,17 @@ enable_clientids enable_pciaccess enable_linux_acpi enable_linux_apm +enable_systemd_logind +enable_suid_wrapper enable_xorg enable_dmx enable_xvfb enable_xnest enable_xquartz +enable_xwayland enable_standalone_xpbproxy enable_xwin +enable_glamor enable_kdrive enable_xephyr enable_xfake @@ -1386,6 +1415,7 @@ enable_tcp_transport enable_ipv6 enable_local_transport enable_secure_rpc +with_systemd_daemon with_shared_memory_dir enable_xtrans_send_fds with_xkb_bin_directory @@ -1415,20 +1445,22 @@ YACC YFLAGS PIXMAN_CFLAGS PIXMAN_LIBS +SYSTEMD_DAEMON_CFLAGS +SYSTEMD_DAEMON_LIBS UDEV_CFLAGS UDEV_LIBS DBUS_CFLAGS DBUS_LIBS HAL_CFLAGS HAL_LIBS +LIBDRM_CFLAGS +LIBDRM_LIBS DRI2PROTO_CFLAGS DRI2PROTO_LIBS DRI3PROTO_CFLAGS DRI3PROTO_LIBS XSHMFENCE_CFLAGS XSHMFENCE_LIBS -LIBDRM_CFLAGS -LIBDRM_LIBS XLIB_CFLAGS XLIB_LIBS GL_CFLAGS @@ -1457,6 +1489,10 @@ XF86VIDMODE_CFLAGS XF86VIDMODE_LIBS XORG_MODULES_CFLAGS XORG_MODULES_LIBS +GLAMOR_CFLAGS +GLAMOR_LIBS +GBM_CFLAGS +GBM_LIBS XWINMODULES_CFLAGS XWINMODULES_LIBS WINDOWSWM_CFLAGS @@ -1484,7 +1520,9 @@ X11EXAMPLES_DEP_LIBS TSLIB_CFLAGS TSLIB_LIBS XEPHYR_CFLAGS -XEPHYR_LIBS' +XEPHYR_LIBS +XWAYLANDMODULES_CFLAGS +XWAYLANDMODULES_LIBS' # Initialize some variables set by options. @@ -2025,7 +2063,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures xorg-server 1.15.2 to adapt to many kinds of systems. +\`configure' configures xorg-server 1.16.1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -2095,7 +2133,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of xorg-server 1.15.2:";; + short | recursive ) echo "Configuration of xorg-server 1.16.1:";; esac cat <<\_ACEOF @@ -2168,7 +2206,6 @@ Optional Features: --enable-config-udev Build udev support (default: auto) --enable-config-udev-kms Build udev kms support (default: auto) - --enable-config-dbus Build D-BUS API support (default: no) --disable-config-hal Build HAL support (default: auto) --enable-config-wscons Build wscons config support (default: auto) --enable-xfree86-utils Build xfree86 DDX utilities (default: enabled) @@ -2184,16 +2221,21 @@ Optional Features: available). --disable-linux-apm Disable building APM support on Linux (if available). + --enable-systemd-logind Build systemd-logind support (default: auto) + --enable-suid-wrapper Build suid-root wrapper for legacy driver support on + rootless xserver systems (default: no) --enable-xorg Build Xorg server (default: auto) - --enable-dmx Build DMX server (default: auto) + --enable-dmx Build DMX server (default: no) --enable-xvfb Build Xvfb server (default: yes) --enable-xnest Build Xnest server (default: auto) --enable-xquartz Build Xquartz server for OS-X (default: auto) + --enable-xwayland Build Xwayland server (default: auto) --enable-standalone-xpbproxy Build a standalone xpbproxy (in addition to the one integrated into Xquartz as a separate thread) (default: no) --enable-xwin Build XWin server (default: auto) + --enable-glamor Build glamor dix module (default: no) --enable-kdrive Build kdrive servers (default: no) --enable-xephyr Build the kdrive Xephyr server (default: auto) --enable-xfake Build the kdrive 'fake' server (default: auto) @@ -2289,12 +2331,14 @@ Optional Packages: --with-khronos-spec-dir=PATH Path to Khronos OpenGL registry database files (default: auto) + --with-systemd-daemon support systemd socket activation (default: auto) --with-shared-memory-dir=PATH Path to directory in a world-writable temporary directory for anonymous shared memory (default: auto) --with-xkb-bin-directory=DIR - Directory containing xkbcomp program + Directory containing xkbcomp program (default: + ${bindir}) --with-sha1=libc|libmd|libnettle|libgcrypt|libcrypto|libsha1|CommonCrypto|CryptoAPI choose SHA1 implementation @@ -2330,12 +2374,19 @@ Some influential environment variables: PIXMAN_CFLAGS C compiler flags for PIXMAN, overriding pkg-config PIXMAN_LIBS linker flags for PIXMAN, overriding pkg-config + SYSTEMD_DAEMON_CFLAGS + C compiler flags for SYSTEMD_DAEMON, overriding pkg-config + SYSTEMD_DAEMON_LIBS + linker flags for SYSTEMD_DAEMON, overriding pkg-config UDEV_CFLAGS C compiler flags for UDEV, overriding pkg-config UDEV_LIBS linker flags for UDEV, overriding pkg-config DBUS_CFLAGS C compiler flags for DBUS, overriding pkg-config DBUS_LIBS linker flags for DBUS, overriding pkg-config HAL_CFLAGS C compiler flags for HAL, overriding pkg-config HAL_LIBS linker flags for HAL, overriding pkg-config + LIBDRM_CFLAGS + C compiler flags for LIBDRM, overriding pkg-config + LIBDRM_LIBS linker flags for LIBDRM, overriding pkg-config DRI2PROTO_CFLAGS C compiler flags for DRI2PROTO, overriding pkg-config DRI2PROTO_LIBS @@ -2348,9 +2399,6 @@ Some influential environment variables: C compiler flags for XSHMFENCE, overriding pkg-config XSHMFENCE_LIBS linker flags for XSHMFENCE, overriding pkg-config - LIBDRM_CFLAGS - C compiler flags for LIBDRM, overriding pkg-config - LIBDRM_LIBS linker flags for LIBDRM, overriding pkg-config XLIB_CFLAGS C compiler flags for XLIB, overriding pkg-config XLIB_LIBS linker flags for XLIB, overriding pkg-config GL_CFLAGS C compiler flags for GL, overriding pkg-config @@ -2400,6 +2448,11 @@ Some influential environment variables: C compiler flags for XORG_MODULES, overriding pkg-config XORG_MODULES_LIBS linker flags for XORG_MODULES, overriding pkg-config + GLAMOR_CFLAGS + C compiler flags for GLAMOR, overriding pkg-config + GLAMOR_LIBS linker flags for GLAMOR, overriding pkg-config + GBM_CFLAGS C compiler flags for GBM, overriding pkg-config + GBM_LIBS linker flags for GBM, overriding pkg-config XWINMODULES_CFLAGS C compiler flags for XWINMODULES, overriding pkg-config XWINMODULES_LIBS @@ -2455,6 +2508,10 @@ Some influential environment variables: XEPHYR_CFLAGS C compiler flags for XEPHYR, overriding pkg-config XEPHYR_LIBS linker flags for XEPHYR, overriding pkg-config + XWAYLANDMODULES_CFLAGS + C compiler flags for XWAYLANDMODULES, overriding pkg-config + XWAYLANDMODULES_LIBS + linker flags for XWAYLANDMODULES, overriding pkg-config Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. @@ -2522,7 +2579,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -xorg-server configure 1.15.2 +xorg-server configure 1.16.1 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -3231,7 +3288,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by xorg-server $as_me 1.15.2, which was +It was created by xorg-server $as_me 1.16.1, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3579,8 +3636,9 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu -RELEASE_DATE="2014-06-27" -RELEASE_NAME="Malt Candy" +RELEASE_DATE="2014-09-21" +RELEASE_NAME="Marionberry Pie" + am__api_version='1.12' @@ -4058,7 +4116,7 @@ fi # Define the identity of the package. PACKAGE='xorg-server' - VERSION='1.15.2' + VERSION='1.16.1' cat >>confdefs.h <<_ACEOF @@ -12934,339 +12992,6 @@ else $as_echo "no, using $LN_S" >&6; } fi -enable_win32_dll=yes - -case $host in -*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args. -set dummy ${ac_tool_prefix}as; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_AS+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$AS"; then - ac_cv_prog_AS="$AS" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_AS="${ac_tool_prefix}as" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -AS=$ac_cv_prog_AS -if test -n "$AS"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AS" >&5 -$as_echo "$AS" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_AS"; then - ac_ct_AS=$AS - # Extract the first word of "as", so it can be a program name with args. -set dummy as; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_AS+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_AS"; then - ac_cv_prog_ac_ct_AS="$ac_ct_AS" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_AS="as" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_AS=$ac_cv_prog_ac_ct_AS -if test -n "$ac_ct_AS"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AS" >&5 -$as_echo "$ac_ct_AS" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_AS" = x; then - AS="false" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - AS=$ac_ct_AS - fi -else - AS="$ac_cv_prog_AS" -fi - - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. -set dummy ${ac_tool_prefix}dlltool; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_DLLTOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$DLLTOOL"; then - ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -DLLTOOL=$ac_cv_prog_DLLTOOL -if test -n "$DLLTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 -$as_echo "$DLLTOOL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_DLLTOOL"; then - ac_ct_DLLTOOL=$DLLTOOL - # Extract the first word of "dlltool", so it can be a program name with args. -set dummy dlltool; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_DLLTOOL"; then - ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_DLLTOOL="dlltool" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL -if test -n "$ac_ct_DLLTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 -$as_echo "$ac_ct_DLLTOOL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_DLLTOOL" = x; then - DLLTOOL="false" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - DLLTOOL=$ac_ct_DLLTOOL - fi -else - DLLTOOL="$ac_cv_prog_DLLTOOL" -fi - - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. -set dummy ${ac_tool_prefix}objdump; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_OBJDUMP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$OBJDUMP"; then - ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -OBJDUMP=$ac_cv_prog_OBJDUMP -if test -n "$OBJDUMP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 -$as_echo "$OBJDUMP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_OBJDUMP"; then - ac_ct_OBJDUMP=$OBJDUMP - # Extract the first word of "objdump", so it can be a program name with args. -set dummy objdump; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_OBJDUMP"; then - ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_OBJDUMP="objdump" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP -if test -n "$ac_ct_OBJDUMP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 -$as_echo "$ac_ct_OBJDUMP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_OBJDUMP" = x; then - OBJDUMP="false" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - OBJDUMP=$ac_ct_OBJDUMP - fi -else - OBJDUMP="$ac_cv_prog_OBJDUMP" -fi - - ;; -esac - -test -z "$AS" && AS=as - - - - - -test -z "$DLLTOOL" && DLLTOOL=dlltool - - - - - -test -z "$OBJDUMP" && OBJDUMP=objdump - - - - - - - -# Check whether --enable-static was given. -if test "${enable_static+set}" = set; then : - enableval=$enable_static; p=${PACKAGE-default} - case $enableval in - yes) enable_static=yes ;; - no) enable_static=no ;; - *) - enable_static=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_static=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac -else - enable_static=no -fi - - - - - - - - case `pwd` in *\ * | *\ *) @@ -16361,6 +16086,335 @@ done # Set options +# Check whether --enable-static was given. +if test "${enable_static+set}" = set; then : + enableval=$enable_static; p=${PACKAGE-default} + case $enableval in + yes) enable_static=yes ;; + no) enable_static=no ;; + *) + enable_static=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + enable_static=no +fi + + + + + + + +enable_win32_dll=yes + +case $host in +*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args. +set dummy ${ac_tool_prefix}as; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_AS+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$AS"; then + ac_cv_prog_AS="$AS" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AS="${ac_tool_prefix}as" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +AS=$ac_cv_prog_AS +if test -n "$AS"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AS" >&5 +$as_echo "$AS" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_AS"; then + ac_ct_AS=$AS + # Extract the first word of "as", so it can be a program name with args. +set dummy as; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_AS+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_AS"; then + ac_cv_prog_ac_ct_AS="$ac_ct_AS" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_AS="as" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_AS=$ac_cv_prog_ac_ct_AS +if test -n "$ac_ct_AS"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AS" >&5 +$as_echo "$ac_ct_AS" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_AS" = x; then + AS="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + AS=$ac_ct_AS + fi +else + AS="$ac_cv_prog_AS" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. +set dummy ${ac_tool_prefix}dlltool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_DLLTOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$DLLTOOL"; then + ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +DLLTOOL=$ac_cv_prog_DLLTOOL +if test -n "$DLLTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 +$as_echo "$DLLTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_DLLTOOL"; then + ac_ct_DLLTOOL=$DLLTOOL + # Extract the first word of "dlltool", so it can be a program name with args. +set dummy dlltool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_DLLTOOL"; then + ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_DLLTOOL="dlltool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL +if test -n "$ac_ct_DLLTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 +$as_echo "$ac_ct_DLLTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_DLLTOOL" = x; then + DLLTOOL="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + DLLTOOL=$ac_ct_DLLTOOL + fi +else + DLLTOOL="$ac_cv_prog_DLLTOOL" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. +set dummy ${ac_tool_prefix}objdump; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_OBJDUMP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$OBJDUMP"; then + ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +OBJDUMP=$ac_cv_prog_OBJDUMP +if test -n "$OBJDUMP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 +$as_echo "$OBJDUMP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OBJDUMP"; then + ac_ct_OBJDUMP=$OBJDUMP + # Extract the first word of "objdump", so it can be a program name with args. +set dummy objdump; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_OBJDUMP"; then + ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_OBJDUMP="objdump" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP +if test -n "$ac_ct_OBJDUMP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 +$as_echo "$ac_ct_OBJDUMP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_OBJDUMP" = x; then + OBJDUMP="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OBJDUMP=$ac_ct_OBJDUMP + fi +else + OBJDUMP="$ac_cv_prog_OBJDUMP" +fi + + ;; +esac + +test -z "$AS" && AS=as + + + + + +test -z "$DLLTOOL" && DLLTOOL=dlltool + + + + + +test -z "$OBJDUMP" && OBJDUMP=objdump + + + + @@ -21340,7 +21394,8 @@ $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi -for ac_header in fcntl.h stdlib.h string.h unistd.h dlfcn.h stropts.h fnmatch.h sys/utsname.h +for ac_header in fcntl.h stdlib.h string.h unistd.h dlfcn.h stropts.h \ + fnmatch.h sys/mkdev.h sys/utsname.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" @@ -22366,6 +22421,7 @@ $as_echo "#define USE_ALPHA_PIO 1" >>confdefs.h ;; arm*) ARM_VIDEO=yes + DEFAULT_INT10="stub" ;; i*86) I386_VIDEO=yes @@ -22610,8 +22666,6 @@ VENDOR_NAME="The X.Org Foundation" VENDOR_NAME_SHORT="X.Org" VENDOR_WEB="http://wiki.x.org" - - # Check whether --enable-werror was given. if test "${enable_werror+set}" = set; then : enableval=$enable_werror; as_fn_error $? "--enable-werror has been replaced by --enable-strict-compilation" "$LINENO" 5 @@ -22831,33 +22885,10 @@ $as_echo "${FONT100DPIDIR}" >&6; } DEFAULT_FONT_PATH="${FONTMISCDIR}/,${FONTTTFDIR}/,${FONTOTFDIR}/,${FONTTYPE1DIR}/,${FONT100DPIDIR}/,${FONT75DPIDIR}/" -if test "$cross_compiling" != yes; then - as_ac_File=`$as_echo "ac_cv_file_${sysconfdir}/X11/fontpath.d" | $as_tr_sh` -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${sysconfdir}/X11/fontpath.d" >&5 -$as_echo_n "checking for ${sysconfdir}/X11/fontpath.d... " >&6; } -if eval \${$as_ac_File+:} false; then : - $as_echo_n "(cached) " >&6 -else - test "$cross_compiling" = yes && - as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5 -if test -r "${sysconfdir}/X11/fontpath.d"; then - eval "$as_ac_File=yes" -else - eval "$as_ac_File=no" -fi -fi -eval ac_res=\$$as_ac_File - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -if eval test \"x\$"$as_ac_File"\" = x"yes"; then : - DEFAULT_FONT_PATH='catalogue:${sysconfdir}/X11/fontpath.d' -else - case $host_os in - darwin*) DEFAULT_FONT_PATH="${DEFAULT_FONT_PATH},/Library/Fonts,/System/Library/Fonts" ;; - esac -fi +case $host_os in + darwin*) DEFAULT_FONT_PATH="${DEFAULT_FONT_PATH},/Library/Fonts,/System/Library/Fonts" ;; +esac -fi # Check whether --with-default-font-path was given. if test "${with_default_font_path+set}" = set; then : @@ -23315,13 +23346,6 @@ else CONFIG_UDEV_KMS=auto fi -# Check whether --enable-config-dbus was given. -if test "${enable_config_dbus+set}" = set; then : - enableval=$enable_config_dbus; CONFIG_DBUS_API=$enableval -else - CONFIG_DBUS_API=no -fi - # Check whether --enable-config-hal was given. if test "${enable_config_hal+set}" = set; then : enableval=$enable_config_hal; CONFIG_HAL=$enableval @@ -23406,6 +23430,20 @@ else enable_linux_apm=yes fi +# Check whether --enable-systemd-logind was given. +if test "${enable_systemd_logind+set}" = set; then : + enableval=$enable_systemd_logind; SYSTEMD_LOGIND=$enableval +else + SYSTEMD_LOGIND=auto +fi + +# Check whether --enable-suid-wrapper was given. +if test "${enable_suid_wrapper+set}" = set; then : + enableval=$enable_suid_wrapper; SUID_WRAPPER=$enableval +else + SUID_WRAPPER=no +fi + # Check whether --enable-xorg was given. if test "${enable_xorg+set}" = set; then : @@ -23418,7 +23456,7 @@ fi if test "${enable_dmx+set}" = set; then : enableval=$enable_dmx; DMX=$enableval else - DMX=auto + DMX=no fi # Check whether --enable-xvfb was given. @@ -23442,6 +23480,13 @@ else XQUARTZ=auto fi +# Check whether --enable-xwayland was given. +if test "${enable_xwayland+set}" = set; then : + enableval=$enable_xwayland; XWAYLAND=$enableval +else + XWAYLAND=auto +fi + # Check whether --enable-standalone-xpbproxy was given. if test "${enable_standalone_xpbproxy+set}" = set; then : enableval=$enable_standalone_xpbproxy; STANDALONE_XPBPROXY=$enableval @@ -23456,6 +23501,13 @@ else XWIN=auto fi +# Check whether --enable-glamor was given. +if test "${enable_glamor+set}" = set; then : + enableval=$enable_glamor; GLAMOR=$enableval +else + GLAMOR=no +fi + # Check whether --enable-kdrive was given. if test "${enable_kdrive+set}" = set; then : enableval=$enable_kdrive; KDRIVE=$enableval @@ -24020,7 +24072,6 @@ fi case $host_os in cygwin* | mingw*) - CONFIG_DBUS_API=no CONFIG_HAL=no CONFIG_UDEV=no CONFIG_UDEV_KMS=no @@ -24090,6 +24141,7 @@ fi XQUARTZ=yes XVFB=no XNEST=no + XWAYLAND=no COMPOSITE=no DGA=no @@ -24121,24 +24173,26 @@ WINDOWSWMPROTO="windowswmproto" APPLEWMPROTO="applewmproto >= 1.4" XSHMFENCE="xshmfence >= 1.1" -XPROTO="xproto >= 7.0.22" +XPROTO="xproto >= 7.0.26" RANDRPROTO="randrproto >= 1.4.0" RENDERPROTO="renderproto >= 0.11" XEXTPROTO="xextproto >= 7.2.99.901" INPUTPROTO="inputproto >= 2.3" KBPROTO="kbproto >= 1.0.3" -FONTSPROTO="fontsproto" +FONTSPROTO="fontsproto >= 2.1.3" FIXESPROTO="fixesproto >= 5.0" DAMAGEPROTO="damageproto >= 1.1" XCMISCPROTO="xcmiscproto >= 1.2.0" BIGREQSPROTO="bigreqsproto >= 1.1.0" -XTRANS="xtrans >= 1.3.2" +XTRANS="xtrans >= 1.3.3" PRESENTPROTO="presentproto >= 1.0" LIBAPPLEWM="applewm >= 1.4" LIBDMX="dmx >= 1.0.99.1" LIBDRI="dri >= 7.8.0" LIBDRM="libdrm >= 2.3.0" +LIBEGL="egl" +LIBGBM="gbm >= 10.2.0" LIBGL="gl >= 7.1.0" LIBXEXT="xext >= 1.0.99.4" LIBXFONT="xfont >= 1.4.2" @@ -24249,9 +24303,108 @@ SDK_REQUIRED_MODULES="$XPROTO $RANDRPROTO $RENDERPROTO $XEXTPROTO $INPUTPROTO $K REQUIRED_MODULES="$FIXESPROTO $DAMAGEPROTO $XCMISCPROTO $XTRANS $BIGREQSPROTO $SDK_REQUIRED_MODULES" -if test "x$CONFIG_UDEV" = xyes && - { test "x$CONFIG_DBUS_API" = xyes || test "x$CONFIG_HAL" = xyes; }; then - as_fn_error $? "Hotplugging through both libudev and dbus/hal not allowed" "$LINENO" 5 + +# Check whether --with-systemd-daemon was given. +if test "${with_systemd_daemon+set}" = set; then : + withval=$with_systemd_daemon; WITH_SYSTEMD_DAEMON=$withval +else + WITH_SYSTEMD_DAEMON=auto +fi + + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SYSTEMD_DAEMON" >&5 +$as_echo_n "checking for SYSTEMD_DAEMON... " >&6; } + +if test -n "$SYSTEMD_DAEMON_CFLAGS"; then + pkg_cv_SYSTEMD_DAEMON_CFLAGS="$SYSTEMD_DAEMON_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libsystemd-daemon\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libsystemd-daemon") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_SYSTEMD_DAEMON_CFLAGS=`$PKG_CONFIG --cflags "libsystemd-daemon" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$SYSTEMD_DAEMON_LIBS"; then + pkg_cv_SYSTEMD_DAEMON_LIBS="$SYSTEMD_DAEMON_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libsystemd-daemon\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libsystemd-daemon") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_SYSTEMD_DAEMON_LIBS=`$PKG_CONFIG --libs "libsystemd-daemon" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + SYSTEMD_DAEMON_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libsystemd-daemon" 2>&1` + else + SYSTEMD_DAEMON_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libsystemd-daemon" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$SYSTEMD_DAEMON_PKG_ERRORS" >&5 + + HAVE_SYSTEMD_DAEMON=no +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + HAVE_SYSTEMD_DAEMON=no +else + SYSTEMD_DAEMON_CFLAGS=$pkg_cv_SYSTEMD_DAEMON_CFLAGS + SYSTEMD_DAEMON_LIBS=$pkg_cv_SYSTEMD_DAEMON_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + HAVE_SYSTEMD_DAEMON=yes +fi +if test "x$WITH_SYSTEMD_DAEMON" = xauto; then + WITH_SYSTEMD_DAEMON="$HAVE_SYSTEMD_DAEMON" +fi +if test "x$WITH_SYSTEMD_DAEMON" = xyes; then + if test "x$HAVE_SYSTEMD_DAEMON" = xno; then + as_fn_error $? "systemd support requested but no library has been found" "$LINENO" 5 + fi + +$as_echo "#define HAVE_SYSTEMD_DAEMON 1" >>confdefs.h + + REQUIRED_LIBS="$REQUIRED_LIBS libsystemd-daemon" +fi + if test "x$HAVE_SYSTEMD_DAEMON" = "xyes"; then + HAVE_SYSTEMD_DAEMON_TRUE= + HAVE_SYSTEMD_DAEMON_FALSE='#' +else + HAVE_SYSTEMD_DAEMON_TRUE='#' + HAVE_SYSTEMD_DAEMON_FALSE= +fi + + +if test "x$CONFIG_UDEV" = xyes && test "x$CONFIG_HAL" = xyes; then + as_fn_error $? "Hotplugging through both libudev and hal not allowed" "$LINENO" 5 fi @@ -24337,7 +24490,6 @@ else fi if test "x$CONFIG_UDEV" = xyes; then - CONFIG_DBUS_API=no CONFIG_HAL=no if test "x$CONFIG_UDEV_KMS" = xauto; then CONFIG_UDEV_KMS="$HAVE_LIBUDEV" @@ -24476,28 +24628,6 @@ else fi -if test "x$CONFIG_DBUS_API" = xauto; then - CONFIG_DBUS_API="$HAVE_DBUS" -fi -if test "x$CONFIG_DBUS_API" = xyes; then - if ! test "x$HAVE_DBUS" = xyes; then - as_fn_error $? "D-Bus configuration API requested, but D-Bus is not installed." "$LINENO" 5 - fi - - -$as_echo "#define CONFIG_DBUS_API 1" >>confdefs.h - - CONFIG_NEED_DBUS="yes" -fi - if test "x$CONFIG_DBUS_API" = xyes; then - CONFIG_DBUS_API_TRUE= - CONFIG_DBUS_API_FALSE='#' -else - CONFIG_DBUS_API_TRUE='#' - CONFIG_DBUS_API_FALSE= -fi - - pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for HAL" >&5 @@ -24580,7 +24710,7 @@ if test "x$CONFIG_HAL" = xyes; then $as_echo "#define CONFIG_HAL 1" >>confdefs.h - CONFIG_NEED_DBUS="yes" + NEED_DBUS="yes" fi if test "x$CONFIG_HAL" = xyes; then CONFIG_HAL_TRUE= @@ -24591,17 +24721,166 @@ else fi -if test "x$CONFIG_NEED_DBUS" = xyes; then +if test "x$SYSTEMD_LOGIND" = xauto; then + if test "x$HAVE_DBUS" = xyes -a "x$CONFIG_UDEV" = xyes ; then + SYSTEMD_LOGIND=yes + else + SYSTEMD_LOGIND=no + fi +fi +if test "x$SYSTEMD_LOGIND" = xyes; then + if ! test "x$HAVE_DBUS" = xyes; then + as_fn_error $? "systemd-logind requested, but D-Bus is not installed." "$LINENO" 5 + fi + if ! test "x$CONFIG_UDEV" = xyes ; then + as_fn_error $? "systemd-logind is only supported in combination with udev configuration." "$LINENO" 5 + fi + -$as_echo "#define CONFIG_NEED_DBUS 1" >>confdefs.h +$as_echo "#define SYSTEMD_LOGIND 1" >>confdefs.h + NEED_DBUS="yes" fi - if test "x$CONFIG_NEED_DBUS" = xyes; then - CONFIG_NEED_DBUS_TRUE= - CONFIG_NEED_DBUS_FALSE='#' + if test "x$SYSTEMD_LOGIND" = xyes; then + SYSTEMD_LOGIND_TRUE= + SYSTEMD_LOGIND_FALSE='#' else - CONFIG_NEED_DBUS_TRUE='#' - CONFIG_NEED_DBUS_FALSE= + SYSTEMD_LOGIND_TRUE='#' + SYSTEMD_LOGIND_FALSE= +fi + + +if test "x$SUID_WRAPPER" = xyes; then + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBDRM" >&5 +$as_echo_n "checking for LIBDRM... " >&6; } + +if test -n "$LIBDRM_CFLAGS"; then + pkg_cv_LIBDRM_CFLAGS="$LIBDRM_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"\$LIBDRM\""; } >&5 + ($PKG_CONFIG --exists --print-errors "$LIBDRM") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBDRM_CFLAGS=`$PKG_CONFIG --cflags "$LIBDRM" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$LIBDRM_LIBS"; then + pkg_cv_LIBDRM_LIBS="$LIBDRM_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"\$LIBDRM\""; } >&5 + ($PKG_CONFIG --exists --print-errors "$LIBDRM") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBDRM_LIBS=`$PKG_CONFIG --libs "$LIBDRM" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + LIBDRM_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$LIBDRM" 2>&1` + else + LIBDRM_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$LIBDRM" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$LIBDRM_PKG_ERRORS" >&5 + + as_fn_error $? "Package requirements ($LIBDRM) were not met: + +$LIBDRM_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables LIBDRM_CFLAGS +and LIBDRM_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details." "$LINENO" 5 +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables LIBDRM_CFLAGS +and LIBDRM_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see <http://pkg-config.freedesktop.org/>. +See \`config.log' for more details" "$LINENO" 5; } +else + LIBDRM_CFLAGS=$pkg_cv_LIBDRM_CFLAGS + LIBDRM_LIBS=$pkg_cv_LIBDRM_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +fi + + prefix_NONE= + exec_prefix_NONE= + test "x$prefix" = xNONE && prefix_NONE=yes && prefix=$ac_default_prefix + test "x$exec_prefix" = xNONE && exec_prefix_NONE=yes && exec_prefix=$prefix + eval ac_define_dir="\"$libexecdir\"" + eval ac_define_dir="\"$ac_define_dir\"" + SUID_WRAPPER_DIR="$ac_define_dir" + + +cat >>confdefs.h <<_ACEOF +#define SUID_WRAPPER_DIR "$ac_define_dir" +_ACEOF + + test "$prefix_NONE" && prefix=NONE + test "$exec_prefix_NONE" && exec_prefix=NONE + + SETUID="no" +fi + if test "x$SUID_WRAPPER" = xyes; then + SUID_WRAPPER_TRUE= + SUID_WRAPPER_FALSE='#' +else + SUID_WRAPPER_TRUE='#' + SUID_WRAPPER_FALSE= +fi + + +if test "x$NEED_DBUS" = xyes; then + +$as_echo "#define NEED_DBUS 1" >>confdefs.h + +fi + if test "x$NEED_DBUS" = xyes; then + NEED_DBUS_TRUE= + NEED_DBUS_FALSE='#' +else + NEED_DBUS_TRUE='#' + NEED_DBUS_FALSE= fi @@ -27626,7 +27905,8 @@ $as_echo_n "checking for symbol visibility support... " >&6; } CFLAGS="$CFLAGS $VISIBILITY_CFLAGS $proto_inc" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include <X11/Xfuncproto.h> + + #include <X11/Xfuncproto.h> extern _X_HIDDEN int hidden_int; extern _X_EXPORT int public_int; extern _X_HIDDEN int hidden_int_func(void); @@ -27755,7 +28035,7 @@ $as_echo "yes" >&6; } fi SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $LIBPCIACCESS" - XORG_SYS_LIBS="$XORG_SYS_LIBS $PCIACCESS_LIBS $GLX_SYS_LIBS $LIBDRM_LIBS" + XORG_SYS_LIBS="$XORG_SYS_LIBS $PCIACCESS_LIBS $LIBDRM_LIBS" XORG_CFLAGS="$XORG_CFLAGS $PCIACCESS_CFLAGS $LIBDRM_CFLAGS" @@ -28396,7 +28676,9 @@ fi XF86CONFIGDIR="xorg.conf.d" CONFIGFILE="$sysconfdir/$XF86CONFIGFILE" - LOGPREFIX="$logdir/Xorg." + LOGPREFIX="Xorg." + XDG_DATA_HOME=".local/share" + XDG_DATA_HOME_LOGDIR="xorg" $as_echo "#define XORG_SERVER 1" >>confdefs.h @@ -28510,6 +28792,23 @@ _ACEOF exec_prefix_NONE= test "x$prefix" = xNONE && prefix_NONE=yes && prefix=$ac_default_prefix test "x$exec_prefix" = xNONE && exec_prefix_NONE=yes && exec_prefix=$prefix + eval ac_define_dir="\"$logdir\"" + eval ac_define_dir="\"$ac_define_dir\"" + DEFAULT_LOGDIR="$ac_define_dir" + + +cat >>confdefs.h <<_ACEOF +#define DEFAULT_LOGDIR "$ac_define_dir" +_ACEOF + + test "$prefix_NONE" && prefix=NONE + test "$exec_prefix_NONE" && exec_prefix=NONE + + + prefix_NONE= + exec_prefix_NONE= + test "x$prefix" = xNONE && prefix_NONE=yes && prefix=$ac_default_prefix + test "x$exec_prefix" = xNONE && exec_prefix_NONE=yes && exec_prefix=$prefix eval ac_define_dir="\"$LOGPREFIX\"" eval ac_define_dir="\"$ac_define_dir\"" DEFAULT_LOGPREFIX="$ac_define_dir" @@ -28523,6 +28822,40 @@ _ACEOF test "$exec_prefix_NONE" && exec_prefix=NONE + prefix_NONE= + exec_prefix_NONE= + test "x$prefix" = xNONE && prefix_NONE=yes && prefix=$ac_default_prefix + test "x$exec_prefix" = xNONE && exec_prefix_NONE=yes && exec_prefix=$prefix + eval ac_define_dir="\"$XDG_DATA_HOME\"" + eval ac_define_dir="\"$ac_define_dir\"" + DEFAULT_XDG_DATA_HOME="$ac_define_dir" + + +cat >>confdefs.h <<_ACEOF +#define DEFAULT_XDG_DATA_HOME "$ac_define_dir" +_ACEOF + + test "$prefix_NONE" && prefix=NONE + test "$exec_prefix_NONE" && exec_prefix=NONE + + + prefix_NONE= + exec_prefix_NONE= + test "x$prefix" = xNONE && prefix_NONE=yes && prefix=$ac_default_prefix + test "x$exec_prefix" = xNONE && exec_prefix_NONE=yes && exec_prefix=$prefix + eval ac_define_dir="\"$XDG_DATA_HOME_LOGDIR\"" + eval ac_define_dir="\"$ac_define_dir\"" + DEFAULT_XDG_DATA_HOME_LOGDIR="$ac_define_dir" + + +cat >>confdefs.h <<_ACEOF +#define DEFAULT_XDG_DATA_HOME_LOGDIR "$ac_define_dir" +_ACEOF + + test "$prefix_NONE" && prefix=NONE + test "$exec_prefix_NONE" && exec_prefix=NONE + + cat >>confdefs.h <<_ACEOF #define __VENDORDWEBSUPPORT__ "$VENDOR_WEB" _ACEOF @@ -28646,6 +28979,198 @@ else fi + if test "x$GLAMOR" = xyes; then + GLAMOR_TRUE= + GLAMOR_FALSE='#' +else + GLAMOR_TRUE='#' + GLAMOR_FALSE= +fi + +if test "x$GLAMOR" = xyes; then + +$as_echo "#define GLAMOR 1" >>confdefs.h + + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GLAMOR" >&5 +$as_echo_n "checking for GLAMOR... " >&6; } + +if test -n "$GLAMOR_CFLAGS"; then + pkg_cv_GLAMOR_CFLAGS="$GLAMOR_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"epoxy\""; } >&5 + ($PKG_CONFIG --exists --print-errors "epoxy") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_GLAMOR_CFLAGS=`$PKG_CONFIG --cflags "epoxy" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$GLAMOR_LIBS"; then + pkg_cv_GLAMOR_LIBS="$GLAMOR_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"epoxy\""; } >&5 + ($PKG_CONFIG --exists --print-errors "epoxy") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_GLAMOR_LIBS=`$PKG_CONFIG --libs "epoxy" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + GLAMOR_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "epoxy" 2>&1` + else + GLAMOR_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "epoxy" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$GLAMOR_PKG_ERRORS" >&5 + + as_fn_error $? "Package requirements (epoxy) were not met: + +$GLAMOR_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables GLAMOR_CFLAGS +and GLAMOR_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details." "$LINENO" 5 +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables GLAMOR_CFLAGS +and GLAMOR_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see <http://pkg-config.freedesktop.org/>. +See \`config.log' for more details" "$LINENO" 5; } +else + GLAMOR_CFLAGS=$pkg_cv_GLAMOR_CFLAGS + GLAMOR_LIBS=$pkg_cv_GLAMOR_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +fi + + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GBM" >&5 +$as_echo_n "checking for GBM... " >&6; } + +if test -n "$GBM_CFLAGS"; then + pkg_cv_GBM_CFLAGS="$GBM_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"\"\$LIBGBM\"\""; } >&5 + ($PKG_CONFIG --exists --print-errors ""$LIBGBM"") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_GBM_CFLAGS=`$PKG_CONFIG --cflags ""$LIBGBM"" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$GBM_LIBS"; then + pkg_cv_GBM_LIBS="$GBM_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"\"\$LIBGBM\"\""; } >&5 + ($PKG_CONFIG --exists --print-errors ""$LIBGBM"") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_GBM_LIBS=`$PKG_CONFIG --libs ""$LIBGBM"" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + GBM_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs ""$LIBGBM"" 2>&1` + else + GBM_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs ""$LIBGBM"" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$GBM_PKG_ERRORS" >&5 + + GBM=no +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + GBM=no +else + GBM_CFLAGS=$pkg_cv_GBM_CFLAGS + GBM_LIBS=$pkg_cv_GBM_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + GBM=yes +fi + if test "x$GBM" = xyes; then + +$as_echo "#define GLAMOR_HAS_GBM 1" >>confdefs.h + + fi + +fi + if test "x$GBM" = xyes; then + GLAMOR_EGL_TRUE= + GLAMOR_EGL_FALSE='#' +else + GLAMOR_EGL_TRUE='#' + GLAMOR_EGL_FALSE= +fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build XWin DDX" >&5 $as_echo_n "checking whether to build XWin DDX... " >&6; } if test "x$XWIN" = xauto; then @@ -28664,23 +29189,6 @@ if test "x$XWIN" = xyes; then exec_prefix_NONE= test "x$prefix" = xNONE && prefix_NONE=yes && prefix=$ac_default_prefix test "x$exec_prefix" = xNONE && exec_prefix_NONE=yes && exec_prefix=$prefix - eval ac_define_dir="\"$sysconfdir\"" - eval ac_define_dir="\"$ac_define_dir\"" - SYSCONFDIR="$ac_define_dir" - - -cat >>confdefs.h <<_ACEOF -#define SYSCONFDIR "$ac_define_dir" -_ACEOF - - test "$prefix_NONE" && prefix=NONE - test "$exec_prefix_NONE" && exec_prefix=NONE - - - prefix_NONE= - exec_prefix_NONE= - test "x$prefix" = xNONE && prefix_NONE=yes && prefix=$ac_default_prefix - test "x$exec_prefix" = xNONE && exec_prefix_NONE=yes && exec_prefix=$prefix eval ac_define_dir="\"$logdir\"" eval ac_define_dir="\"$ac_define_dir\"" DEFAULT_LOGDIR="$ac_define_dir" @@ -29421,6 +29929,15 @@ $as_echo "#define STANDALONE_XPBPROXY 1" >>confdefs.h fi fi + if test "x$XQUARTZ" = xyes -o "x$XWIN" = xyes ; then + PSEUDORAMIX_TRUE= + PSEUDORAMIX_FALSE='#' +else + PSEUDORAMIX_TRUE='#' + PSEUDORAMIX_FALSE= +fi + + # Support for objc in autotools is minimal and not documented. OBJC='$(CC)' OBJCLD='$(CCLD)' @@ -30546,6 +31063,9 @@ $as_echo "#define KDRIVE_MOUSE 1" >>confdefs.h if test "x$DRI" = xyes && test "x$GLX" = xyes; then XEPHYR_REQUIRED_LIBS="$XEPHYR_REQUIRED_LIBS libdrm xcb-glx xcb-xf86dri > 1.6" fi + if test "x$GLAMOR" = xyes; then + XEPHYR_REQUIRED_LIBS="$XEPHYR_REQUIRED_LIBS x11-xcb" + fi if test "x$XEPHYR" = xauto; then @@ -30810,8 +31330,7 @@ fi fi ;; esac - KDRIVE_STUB_LIB='$(top_builddir)/hw/kdrive/src/libkdrivestubs.la' - KDRIVE_LOCAL_LIBS="$MAIN_LIB $DIX_LIB $KDRIVE_LIB $KDRIVE_STUB_LIB" + KDRIVE_LOCAL_LIBS="$MAIN_LIB $DIX_LIB $KDRIVE_LIB" KDRIVE_LOCAL_LIBS="$KDRIVE_LOCAL_LIBS $FB_LIB $MI_LIB $KDRIVE_PURE_LIBS" KDRIVE_LOCAL_LIBS="$KDRIVE_LOCAL_LIBS $KDRIVE_OS_LIB" KDRIVE_LIBS="$KDRIVE_LOCAL_LIBS $XSERVER_SYS_LIBS $GLX_SYS_LIBS $DLOPEN_LIBS $TSLIB_LIBS" @@ -30915,6 +31434,148 @@ fi + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for XWAYLANDMODULES" >&5 +$as_echo_n "checking for XWAYLANDMODULES... " >&6; } + +if test -n "$XWAYLANDMODULES_CFLAGS"; then + pkg_cv_XWAYLANDMODULES_CFLAGS="$XWAYLANDMODULES_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"wayland-client >= 1.3.0 libdrm epoxy\""; } >&5 + ($PKG_CONFIG --exists --print-errors "wayland-client >= 1.3.0 libdrm epoxy") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_XWAYLANDMODULES_CFLAGS=`$PKG_CONFIG --cflags "wayland-client >= 1.3.0 libdrm epoxy" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$XWAYLANDMODULES_LIBS"; then + pkg_cv_XWAYLANDMODULES_LIBS="$XWAYLANDMODULES_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"wayland-client >= 1.3.0 libdrm epoxy\""; } >&5 + ($PKG_CONFIG --exists --print-errors "wayland-client >= 1.3.0 libdrm epoxy") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_XWAYLANDMODULES_LIBS=`$PKG_CONFIG --libs "wayland-client >= 1.3.0 libdrm epoxy" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + XWAYLANDMODULES_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "wayland-client >= 1.3.0 libdrm epoxy" 2>&1` + else + XWAYLANDMODULES_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "wayland-client >= 1.3.0 libdrm epoxy" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$XWAYLANDMODULES_PKG_ERRORS" >&5 + + have_xwayland=no +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + have_xwayland=no +else + XWAYLANDMODULES_CFLAGS=$pkg_cv_XWAYLANDMODULES_CFLAGS + XWAYLANDMODULES_LIBS=$pkg_cv_XWAYLANDMODULES_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + have_xwayland=yes +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build Xwayland DDX" >&5 +$as_echo_n "checking whether to build Xwayland DDX... " >&6; } +if test "x$XWAYLAND" = xauto; then + XWAYLAND="$have_xwayland" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $XWAYLAND" >&5 +$as_echo "$XWAYLAND" >&6; } + if test "x$XWAYLAND" = xyes; then + XWAYLAND_TRUE= + XWAYLAND_FALSE='#' +else + XWAYLAND_TRUE='#' + XWAYLAND_FALSE= +fi + + +if test "x$XWAYLAND" = xyes; then + if test "x$have_xwayland" = xno; then + as_fn_error $? "Xwayland build explicitly requested, but required modules not found." "$LINENO" 5 + fi + + XWAYLAND_LIBS="$FB_LIB $FIXES_LIB $MI_LIB $XEXT_LIB $DBE_LIB $RECORD_LIB $GLX_LIBS $RANDR_LIB $RENDER_LIB $DAMAGE_LIB $DRI3_LIB $PRESENT_LIB $MIEXT_SYNC_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $MAIN_LIB $DIX_LIB $OS_LIB" + XWAYLAND_SYS_LIBS="$XWAYLANDMODULES_LIBS $GLX_SYS_LIBS" + + + + WAYLAND_PREFIX=`$PKG_CONFIG --variable=prefix wayland-client` + # Extract the first word of "wayland-scanner", so it can be a program name with args. +set dummy wayland-scanner; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_WAYLAND_SCANNER+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $WAYLAND_SCANNER in + [\\/]* | ?:[\\/]*) + ac_cv_path_WAYLAND_SCANNER="$WAYLAND_SCANNER" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in ${WAYLAND_PREFIX}/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_WAYLAND_SCANNER="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +WAYLAND_SCANNER=$ac_cv_path_WAYLAND_SCANNER +if test -n "$WAYLAND_SCANNER"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $WAYLAND_SCANNER" >&5 +$as_echo "$WAYLAND_SCANNER" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi + + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -30956,6 +31617,23 @@ _ACEOF test "$exec_prefix_NONE" && exec_prefix=NONE + prefix_NONE= + exec_prefix_NONE= + test "x$prefix" = xNONE && prefix_NONE=yes && prefix=$ac_default_prefix + test "x$exec_prefix" = xNONE && exec_prefix_NONE=yes && exec_prefix=$prefix + eval ac_define_dir="\"$sysconfdir\"" + eval ac_define_dir="\"$ac_define_dir\"" + SYSCONFDIR="$ac_define_dir" + + +cat >>confdefs.h <<_ACEOF +#define SYSCONFDIR "$ac_define_dir" +_ACEOF + + test "$prefix_NONE" && prefix=NONE + test "$exec_prefix_NONE" && exec_prefix=NONE + + BUILD_DATE="`date +'%Y%m%d'`" @@ -30986,7 +31664,7 @@ $as_echo "$as_me: WARNING: ***********************************************" >&2;} fi -ac_config_files="$ac_config_files Makefile glx/Makefile include/Makefile composite/Makefile damageext/Makefile dbe/Makefile dix/Makefile doc/Makefile doc/dtrace/Makefile man/Makefile fb/Makefile record/Makefile config/Makefile mi/Makefile miext/Makefile miext/sync/Makefile miext/damage/Makefile miext/shadow/Makefile miext/rootless/Makefile os/Makefile pseudoramiX/Makefile randr/Makefile render/Makefile xkb/Makefile Xext/Makefile Xi/Makefile xfixes/Makefile exa/Makefile dri3/Makefile present/Makefile hw/Makefile hw/xfree86/Makefile hw/xfree86/common/Makefile hw/xfree86/common/xf86Build.h hw/xfree86/ddc/Makefile hw/xfree86/dixmods/Makefile hw/xfree86/doc/Makefile hw/xfree86/dri/Makefile hw/xfree86/dri2/Makefile hw/xfree86/exa/Makefile hw/xfree86/exa/man/Makefile hw/xfree86/fbdevhw/Makefile hw/xfree86/fbdevhw/man/Makefile hw/xfree86/i2c/Makefile hw/xfree86/int10/Makefile hw/xfree86/loader/Makefile hw/xfree86/man/Makefile hw/xfree86/modes/Makefile hw/xfree86/os-support/Makefile hw/xfree86/os-support/bsd/Makefile hw/xfree86/os-support/bus/Makefile hw/xfree86/os-support/hurd/Makefile hw/xfree86/os-support/misc/Makefile hw/xfree86/os-support/linux/Makefile hw/xfree86/os-support/solaris/Makefile hw/xfree86/os-support/stub/Makefile hw/xfree86/parser/Makefile hw/xfree86/ramdac/Makefile hw/xfree86/shadowfb/Makefile hw/xfree86/vbe/Makefile hw/xfree86/vgahw/Makefile hw/xfree86/x86emu/Makefile hw/xfree86/utils/Makefile hw/xfree86/utils/man/Makefile hw/xfree86/utils/cvt/Makefile hw/xfree86/utils/gtf/Makefile hw/dmx/config/Makefile hw/dmx/config/man/Makefile hw/dmx/doc/Makefile hw/dmx/doxygen/doxygen.conf hw/dmx/doxygen/Makefile hw/dmx/examples/Makefile hw/dmx/input/Makefile hw/dmx/glxProxy/Makefile hw/dmx/Makefile hw/dmx/man/Makefile hw/vfb/Makefile hw/vfb/man/Makefile hw/xnest/Makefile hw/xnest/man/Makefile hw/xwin/Makefile hw/xwin/glx/Makefile hw/xwin/man/Makefile hw/xquartz/Makefile hw/xquartz/GL/Makefile hw/xquartz/bundle/Makefile hw/xquartz/man/Makefile hw/xquartz/mach-startup/Makefile hw/xquartz/pbproxy/Makefile hw/xquartz/xpr/Makefile hw/kdrive/Makefile hw/kdrive/ephyr/Makefile hw/kdrive/ephyr/man/Makefile hw/kdrive/fake/Makefile hw/kdrive/fbdev/Makefile hw/kdrive/linux/Makefile hw/kdrive/openbsd/Makefile hw/kdrive/src/Makefile hw/kdrive/wscons/Makefile test/Makefile test/xi2/Makefile xserver.ent xorg-server.pc" +ac_config_files="$ac_config_files Makefile glx/Makefile include/Makefile composite/Makefile damageext/Makefile dbe/Makefile dix/Makefile doc/Makefile doc/dtrace/Makefile man/Makefile fb/Makefile glamor/Makefile record/Makefile config/Makefile mi/Makefile miext/Makefile miext/sync/Makefile miext/damage/Makefile miext/shadow/Makefile miext/rootless/Makefile os/Makefile pseudoramiX/Makefile randr/Makefile render/Makefile xkb/Makefile Xext/Makefile Xi/Makefile xfixes/Makefile exa/Makefile dri3/Makefile present/Makefile hw/Makefile hw/xfree86/Makefile hw/xfree86/Xorg.sh hw/xfree86/common/Makefile hw/xfree86/common/xf86Build.h hw/xfree86/ddc/Makefile hw/xfree86/dixmods/Makefile hw/xfree86/doc/Makefile hw/xfree86/dri/Makefile hw/xfree86/dri2/Makefile hw/xfree86/exa/Makefile hw/xfree86/exa/man/Makefile hw/xfree86/fbdevhw/Makefile hw/xfree86/fbdevhw/man/Makefile hw/xfree86/glamor_egl/Makefile hw/xfree86/i2c/Makefile hw/xfree86/int10/Makefile hw/xfree86/loader/Makefile hw/xfree86/man/Makefile hw/xfree86/modes/Makefile hw/xfree86/os-support/Makefile hw/xfree86/os-support/bsd/Makefile hw/xfree86/os-support/bus/Makefile hw/xfree86/os-support/hurd/Makefile hw/xfree86/os-support/misc/Makefile hw/xfree86/os-support/linux/Makefile hw/xfree86/os-support/solaris/Makefile hw/xfree86/os-support/stub/Makefile hw/xfree86/parser/Makefile hw/xfree86/ramdac/Makefile hw/xfree86/shadowfb/Makefile hw/xfree86/vbe/Makefile hw/xfree86/vgahw/Makefile hw/xfree86/x86emu/Makefile hw/xfree86/utils/Makefile hw/xfree86/utils/man/Makefile hw/xfree86/utils/cvt/Makefile hw/xfree86/utils/gtf/Makefile hw/dmx/config/Makefile hw/dmx/config/man/Makefile hw/dmx/doc/Makefile hw/dmx/doxygen/doxygen.conf hw/dmx/doxygen/Makefile hw/dmx/examples/Makefile hw/dmx/input/Makefile hw/dmx/glxProxy/Makefile hw/dmx/Makefile hw/dmx/man/Makefile hw/vfb/Makefile hw/vfb/man/Makefile hw/xnest/Makefile hw/xnest/man/Makefile hw/xwin/Makefile hw/xwin/glx/Makefile hw/xwin/man/Makefile hw/xquartz/Makefile hw/xquartz/GL/Makefile hw/xquartz/bundle/Makefile hw/xquartz/man/Makefile hw/xquartz/mach-startup/Makefile hw/xquartz/pbproxy/Makefile hw/xquartz/xpr/Makefile hw/kdrive/Makefile hw/kdrive/ephyr/Makefile hw/kdrive/ephyr/man/Makefile hw/kdrive/fake/Makefile hw/kdrive/fbdev/Makefile hw/kdrive/linux/Makefile hw/kdrive/openbsd/Makefile hw/kdrive/src/Makefile hw/kdrive/wscons/Makefile hw/xwayland/Makefile test/Makefile test/xi2/Makefile xserver.ent xorg-server.pc" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -31262,6 +31940,10 @@ if test -z "${INSTALL_LIBXF86CONFIG_TRUE}" && test -z "${INSTALL_LIBXF86CONFIG_F as_fn_error $? "conditional \"INSTALL_LIBXF86CONFIG\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${HAVE_SYSTEMD_DAEMON_TRUE}" && test -z "${HAVE_SYSTEMD_DAEMON_FALSE}"; then + as_fn_error $? "conditional \"HAVE_SYSTEMD_DAEMON\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${CONFIG_UDEV_TRUE}" && test -z "${CONFIG_UDEV_FALSE}"; then as_fn_error $? "conditional \"CONFIG_UDEV\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -31274,16 +31956,20 @@ if test -z "${HAVE_DBUS_TRUE}" && test -z "${HAVE_DBUS_FALSE}"; then as_fn_error $? "conditional \"HAVE_DBUS\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -if test -z "${CONFIG_DBUS_API_TRUE}" && test -z "${CONFIG_DBUS_API_FALSE}"; then - as_fn_error $? "conditional \"CONFIG_DBUS_API\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi if test -z "${CONFIG_HAL_TRUE}" && test -z "${CONFIG_HAL_FALSE}"; then as_fn_error $? "conditional \"CONFIG_HAL\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -if test -z "${CONFIG_NEED_DBUS_TRUE}" && test -z "${CONFIG_NEED_DBUS_FALSE}"; then - as_fn_error $? "conditional \"CONFIG_NEED_DBUS\" was never defined. +if test -z "${SYSTEMD_LOGIND_TRUE}" && test -z "${SYSTEMD_LOGIND_FALSE}"; then + as_fn_error $? "conditional \"SYSTEMD_LOGIND\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${SUID_WRAPPER_TRUE}" && test -z "${SUID_WRAPPER_FALSE}"; then + as_fn_error $? "conditional \"SUID_WRAPPER\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${NEED_DBUS_TRUE}" && test -z "${NEED_DBUS_FALSE}"; then + as_fn_error $? "conditional \"NEED_DBUS\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${CONFIG_WSCONS_TRUE}" && test -z "${CONFIG_WSCONS_FALSE}"; then @@ -31482,6 +32168,14 @@ if test -z "${XORG_BUS_PLATFORM_TRUE}" && test -z "${XORG_BUS_PLATFORM_FALSE}"; as_fn_error $? "conditional \"XORG_BUS_PLATFORM\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${GLAMOR_TRUE}" && test -z "${GLAMOR_FALSE}"; then + as_fn_error $? "conditional \"GLAMOR\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${GLAMOR_EGL_TRUE}" && test -z "${GLAMOR_EGL_FALSE}"; then + as_fn_error $? "conditional \"GLAMOR_EGL\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${XWIN_TRUE}" && test -z "${XWIN_FALSE}"; then as_fn_error $? "conditional \"XWIN\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -31518,6 +32212,10 @@ if test -z "${XWIN_XV_TRUE}" && test -z "${XWIN_XV_FALSE}"; then as_fn_error $? "conditional \"XWIN_XV\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${PSEUDORAMIX_TRUE}" && test -z "${PSEUDORAMIX_FALSE}"; then + as_fn_error $? "conditional \"PSEUDORAMIX\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${am__fastdepOBJC_TRUE}" && test -z "${am__fastdepOBJC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepOBJC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -31594,6 +32292,10 @@ if test -z "${XFAKESERVER_TRUE}" && test -z "${XFAKESERVER_FALSE}"; then as_fn_error $? "conditional \"XFAKESERVER\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${XWAYLAND_TRUE}" && test -z "${XWAYLAND_FALSE}"; then + as_fn_error $? "conditional \"XWAYLAND\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 @@ -31991,7 +32693,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by xorg-server $as_me 1.15.2, which was +This file was extended by xorg-server $as_me 1.16.1, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -32057,7 +32759,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -xorg-server config.status 1.15.2 +xorg-server config.status 1.16.1 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" @@ -32186,12 +32888,12 @@ AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' +macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' +macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' +enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' AS='`$ECHO "$AS" | $SED "$delay_single_quote_subst"`' DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`' OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`' -enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' -macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' -macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' @@ -32487,6 +33189,7 @@ do "doc/dtrace/Makefile") CONFIG_FILES="$CONFIG_FILES doc/dtrace/Makefile" ;; "man/Makefile") CONFIG_FILES="$CONFIG_FILES man/Makefile" ;; "fb/Makefile") CONFIG_FILES="$CONFIG_FILES fb/Makefile" ;; + "glamor/Makefile") CONFIG_FILES="$CONFIG_FILES glamor/Makefile" ;; "record/Makefile") CONFIG_FILES="$CONFIG_FILES record/Makefile" ;; "config/Makefile") CONFIG_FILES="$CONFIG_FILES config/Makefile" ;; "mi/Makefile") CONFIG_FILES="$CONFIG_FILES mi/Makefile" ;; @@ -32508,6 +33211,7 @@ do "present/Makefile") CONFIG_FILES="$CONFIG_FILES present/Makefile" ;; "hw/Makefile") CONFIG_FILES="$CONFIG_FILES hw/Makefile" ;; "hw/xfree86/Makefile") CONFIG_FILES="$CONFIG_FILES hw/xfree86/Makefile" ;; + "hw/xfree86/Xorg.sh") CONFIG_FILES="$CONFIG_FILES hw/xfree86/Xorg.sh" ;; "hw/xfree86/common/Makefile") CONFIG_FILES="$CONFIG_FILES hw/xfree86/common/Makefile" ;; "hw/xfree86/common/xf86Build.h") CONFIG_FILES="$CONFIG_FILES hw/xfree86/common/xf86Build.h" ;; "hw/xfree86/ddc/Makefile") CONFIG_FILES="$CONFIG_FILES hw/xfree86/ddc/Makefile" ;; @@ -32519,6 +33223,7 @@ do "hw/xfree86/exa/man/Makefile") CONFIG_FILES="$CONFIG_FILES hw/xfree86/exa/man/Makefile" ;; "hw/xfree86/fbdevhw/Makefile") CONFIG_FILES="$CONFIG_FILES hw/xfree86/fbdevhw/Makefile" ;; "hw/xfree86/fbdevhw/man/Makefile") CONFIG_FILES="$CONFIG_FILES hw/xfree86/fbdevhw/man/Makefile" ;; + "hw/xfree86/glamor_egl/Makefile") CONFIG_FILES="$CONFIG_FILES hw/xfree86/glamor_egl/Makefile" ;; "hw/xfree86/i2c/Makefile") CONFIG_FILES="$CONFIG_FILES hw/xfree86/i2c/Makefile" ;; "hw/xfree86/int10/Makefile") CONFIG_FILES="$CONFIG_FILES hw/xfree86/int10/Makefile" ;; "hw/xfree86/loader/Makefile") CONFIG_FILES="$CONFIG_FILES hw/xfree86/loader/Makefile" ;; @@ -32575,6 +33280,7 @@ do "hw/kdrive/openbsd/Makefile") CONFIG_FILES="$CONFIG_FILES hw/kdrive/openbsd/Makefile" ;; "hw/kdrive/src/Makefile") CONFIG_FILES="$CONFIG_FILES hw/kdrive/src/Makefile" ;; "hw/kdrive/wscons/Makefile") CONFIG_FILES="$CONFIG_FILES hw/kdrive/wscons/Makefile" ;; + "hw/xwayland/Makefile") CONFIG_FILES="$CONFIG_FILES hw/xwayland/Makefile" ;; "test/Makefile") CONFIG_FILES="$CONFIG_FILES test/Makefile" ;; "test/xi2/Makefile") CONFIG_FILES="$CONFIG_FILES test/xi2/Makefile" ;; "xserver.ent") CONFIG_FILES="$CONFIG_FILES xserver.ent" ;; @@ -33321,6 +34027,13 @@ available_tags="" # ### BEGIN LIBTOOL CONFIG +# Which release of libtool.m4 was used? +macro_version=$macro_version +macro_revision=$macro_revision + +# Whether or not to build static libraries. +build_old_libs=$enable_static + # Assembler program. AS=$lt_AS @@ -33330,13 +34043,6 @@ DLLTOOL=$lt_DLLTOOL # Object dumper program. OBJDUMP=$lt_OBJDUMP -# Whether or not to build static libraries. -build_old_libs=$enable_static - -# Which release of libtool.m4 was used? -macro_version=$macro_version -macro_revision=$macro_revision - # Whether or not to build shared libraries. build_libtool_libs=$enable_shared diff --git a/xserver/configure.ac b/xserver/configure.ac index 334a47a3c..aadfb22db 100644 --- a/xserver/configure.ac +++ b/xserver/configure.ac @@ -26,10 +26,11 @@ dnl dnl Process this file with autoconf to create configure. AC_PREREQ(2.60) -AC_INIT([xorg-server], 1.15.2, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server) -RELEASE_DATE="2014-06-27" -RELEASE_NAME="Malt Candy" +AC_INIT([xorg-server], 1.16.1, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server) +RELEASE_DATE="2014-09-21" +RELEASE_NAME="Marionberry Pie" AC_CONFIG_SRCDIR([Makefile.am]) +AC_CONFIG_MACRO_DIR([m4]) AM_INIT_AUTOMAKE([foreign dist-bzip2]) AC_USE_SYSTEM_EXTENSIONS @@ -74,9 +75,8 @@ AC_CONFIG_HEADERS(include/version-config.h) AM_PROG_AS AC_PROG_LN_S -AC_LIBTOOL_WIN32_DLL -AC_DISABLE_STATIC -AC_PROG_LIBTOOL +LT_PREREQ([2.2]) +LT_INIT([disable-static win32-dll]) PKG_PROG_PKG_CONFIG AC_PROG_LEX AC_PROG_YACC @@ -133,7 +133,8 @@ AM_CONDITIONAL(SPECIAL_DTRACE_OBJECTS, [test "x$SPECIAL_DTRACE_OBJECTS" = "xyes" AC_HEADER_DIRENT AC_HEADER_STDC -AC_CHECK_HEADERS([fcntl.h stdlib.h string.h unistd.h dlfcn.h stropts.h fnmatch.h sys/utsname.h]) +AC_CHECK_HEADERS([fcntl.h stdlib.h string.h unistd.h dlfcn.h stropts.h \ + fnmatch.h sys/mkdev.h sys/utsname.h]) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST @@ -265,20 +266,20 @@ AM_CONDITIONAL(FREEBSD_KLDLOAD, [test "x$ac_cv_sys_linker_h" = xyes]) AC_CACHE_CHECK([for SYSV IPC], ac_cv_sysv_ipc, - [AC_TRY_LINK([ + [AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> #include <sys/ipc.h> #include <sys/shm.h> #include <sys/stat.h> -],[ +]],[[ { int id; id = shmget(IPC_PRIVATE, 512, S_IRUSR | S_IWUSR); if (id < 0) return -1; return shmctl(id, IPC_RMID, 0); -}], - [ac_cv_sysv_ipc=yes], - [ac_cv_sysv_ipc=no])]) +}]])], + [ac_cv_sysv_ipc=yes], + [ac_cv_sysv_ipc=no])]) if test "x$ac_cv_sysv_ipc" = xyes; then AC_DEFINE(HAVE_SYSV_IPC, 1, [Define to 1 if SYSV IPC is available]) fi @@ -325,6 +326,7 @@ case $host_cpu in ;; arm*) ARM_VIDEO=yes + DEFAULT_INT10="stub" ;; i*86) I386_VIDEO=yes @@ -465,8 +467,6 @@ VENDOR_NAME="The X.Org Foundation" VENDOR_NAME_SHORT="X.Org" VENDOR_WEB="http://wiki.x.org" -m4_ifdef([AS_HELP_STRING], , [m4_define([AS_HELP_STRING], m4_defn([AC_HELP_STRING]))]) - dnl Build options. AC_ARG_ENABLE(werror, AS_HELP_STRING([--enable-werror], [Obsolete - use --enable-strict-compilation instead]), @@ -521,17 +521,14 @@ XORG_FONTSUBDIR(FONTTYPE1DIR, fonttype1dir, Type1) XORG_FONTSUBDIR(FONT75DPIDIR, font75dpidir, 75dpi) XORG_FONTSUBDIR(FONT100DPIDIR, font100dpidir, 100dpi) -dnl Uses --default-font-path if set, otherwise checks for /etc/X11/fontpath.d, -dnl otherwise uses standard subdirectories of FONTROOTDIR. When cross -dnl compiling, assume default font path uses standard FONTROOTDIR directories. +dnl Uses --with-default-font-path if set, otherwise uses standard +dnl subdirectories of FONTROOTDIR. Some distros set the default font path to +dnl "catalogue:/etc/X11/fontpath.d,built-ins" DEFAULT_FONT_PATH="${FONTMISCDIR}/,${FONTTTFDIR}/,${FONTOTFDIR}/,${FONTTYPE1DIR}/,${FONT100DPIDIR}/,${FONT75DPIDIR}/" -if test "$cross_compiling" != yes; then - AC_CHECK_FILE([${sysconfdir}/X11/fontpath.d], - [DEFAULT_FONT_PATH='catalogue:${sysconfdir}/X11/fontpath.d'], - [case $host_os in - darwin*) DEFAULT_FONT_PATH="${DEFAULT_FONT_PATH},/Library/Fonts,/System/Library/Fonts" ;; - esac]) -fi +case $host_os in + darwin*) DEFAULT_FONT_PATH="${DEFAULT_FONT_PATH},/Library/Fonts,/System/Library/Fonts" ;; +esac + AC_ARG_WITH(default-font-path, AS_HELP_STRING([--with-default-font-path=PATH], [Comma separated list of font dirs]), [ FONTPATH="$withval" ], [ FONTPATH="${DEFAULT_FONT_PATH}" ]) @@ -593,7 +590,7 @@ AC_ARG_ENABLE(install-libxf86config, [Install libxf86config (default: disabled)]), [INSTALL_LIBXF86CONFIG=$enableval], [INSTALL_LIBXF86CONFIG=no]) -AC_ARG_ENABLE(visibility, AC_HELP_STRING([--enable-visibility], [Enable symbol visibility (default: auto)]), +AC_ARG_ENABLE(visibility, AS_HELP_STRING([--enable-visibility], [Enable symbol visibility (default: auto)]), [SYMBOL_VISIBILITY=$enableval], [SYMBOL_VISIBILITY=auto]) @@ -654,7 +651,6 @@ AC_ARG_ENABLE(xf86bigfont, AS_HELP_STRING([--enable-xf86bigfont], [Build XF86 AC_ARG_ENABLE(dpms, AS_HELP_STRING([--disable-dpms], [Build DPMS extension (default: enabled)]), [DPMSExtension=$enableval], [DPMSExtension=yes]) AC_ARG_ENABLE(config-udev, AS_HELP_STRING([--enable-config-udev], [Build udev support (default: auto)]), [CONFIG_UDEV=$enableval], [CONFIG_UDEV=auto]) AC_ARG_ENABLE(config-udev-kms, AS_HELP_STRING([--enable-config-udev-kms], [Build udev kms support (default: auto)]), [CONFIG_UDEV_KMS=$enableval], [CONFIG_UDEV_KMS=auto]) -AC_ARG_ENABLE(config-dbus, AS_HELP_STRING([--enable-config-dbus], [Build D-BUS API support (default: no)]), [CONFIG_DBUS_API=$enableval], [CONFIG_DBUS_API=no]) AC_ARG_ENABLE(config-hal, AS_HELP_STRING([--disable-config-hal], [Build HAL support (default: auto)]), [CONFIG_HAL=$enableval], [CONFIG_HAL=auto]) AC_ARG_ENABLE(config-wscons, AS_HELP_STRING([--enable-config-wscons], [Build wscons config support (default: auto)]), [CONFIG_WSCONS=$enableval], [CONFIG_WSCONS=auto]) AC_ARG_ENABLE(xfree86-utils, AS_HELP_STRING([--enable-xfree86-utils], [Build xfree86 DDX utilities (default: enabled)]), [XF86UTILS=$enableval], [XF86UTILS=yes]) @@ -665,17 +661,21 @@ AC_ARG_ENABLE(windowswm, AS_HELP_STRING([--enable-windowswm], [Build XWin w AC_ARG_ENABLE(libdrm, AS_HELP_STRING([--enable-libdrm], [Build Xorg with libdrm support (default: enabled)]), [DRM=$enableval],[DRM=yes]) AC_ARG_ENABLE(clientids, AS_HELP_STRING([--disable-clientids], [Build Xorg with client ID tracking (default: enabled)]), [CLIENTIDS=$enableval], [CLIENTIDS=yes]) AC_ARG_ENABLE(pciaccess, AS_HELP_STRING([--enable-pciaccess], [Build Xorg with pciaccess library (default: enabled)]), [PCI=$enableval], [PCI=yes]) -AC_ARG_ENABLE(linux_acpi, AC_HELP_STRING([--disable-linux-acpi], [Disable building ACPI support on Linux (if available).]), [enable_linux_acpi=$enableval], [enable_linux_acpi=yes]) -AC_ARG_ENABLE(linux_apm, AC_HELP_STRING([--disable-linux-apm], [Disable building APM support on Linux (if available).]), [enable_linux_apm=$enableval], [enable_linux_apm=yes]) +AC_ARG_ENABLE(linux_acpi, AS_HELP_STRING([--disable-linux-acpi], [Disable building ACPI support on Linux (if available).]), [enable_linux_acpi=$enableval], [enable_linux_acpi=yes]) +AC_ARG_ENABLE(linux_apm, AS_HELP_STRING([--disable-linux-apm], [Disable building APM support on Linux (if available).]), [enable_linux_apm=$enableval], [enable_linux_apm=yes]) +AC_ARG_ENABLE(systemd-logind, AS_HELP_STRING([--enable-systemd-logind], [Build systemd-logind support (default: auto)]), [SYSTEMD_LOGIND=$enableval], [SYSTEMD_LOGIND=auto]) +AC_ARG_ENABLE(suid-wrapper, AS_HELP_STRING([--enable-suid-wrapper], [Build suid-root wrapper for legacy driver support on rootless xserver systems (default: no)]), [SUID_WRAPPER=$enableval], [SUID_WRAPPER=no]) dnl DDXes. AC_ARG_ENABLE(xorg, AS_HELP_STRING([--enable-xorg], [Build Xorg server (default: auto)]), [XORG=$enableval], [XORG=auto]) -AC_ARG_ENABLE(dmx, AS_HELP_STRING([--enable-dmx], [Build DMX server (default: auto)]), [DMX=$enableval], [DMX=auto]) +AC_ARG_ENABLE(dmx, AS_HELP_STRING([--enable-dmx], [Build DMX server (default: no)]), [DMX=$enableval], [DMX=no]) AC_ARG_ENABLE(xvfb, AS_HELP_STRING([--enable-xvfb], [Build Xvfb server (default: yes)]), [XVFB=$enableval], [XVFB=yes]) AC_ARG_ENABLE(xnest, AS_HELP_STRING([--enable-xnest], [Build Xnest server (default: auto)]), [XNEST=$enableval], [XNEST=auto]) AC_ARG_ENABLE(xquartz, AS_HELP_STRING([--enable-xquartz], [Build Xquartz server for OS-X (default: auto)]), [XQUARTZ=$enableval], [XQUARTZ=auto]) +AC_ARG_ENABLE(xwayland, AS_HELP_STRING([--enable-xwayland], [Build Xwayland server (default: auto)]), [XWAYLAND=$enableval], [XWAYLAND=auto]) AC_ARG_ENABLE(standalone-xpbproxy, AS_HELP_STRING([--enable-standalone-xpbproxy], [Build a standalone xpbproxy (in addition to the one integrated into Xquartz as a separate thread) (default: no)]), [STANDALONE_XPBPROXY=$enableval], [STANDALONE_XPBPROXY=no]) AC_ARG_ENABLE(xwin, AS_HELP_STRING([--enable-xwin], [Build XWin server (default: auto)]), [XWIN=$enableval], [XWIN=auto]) +AC_ARG_ENABLE(glamor, AS_HELP_STRING([--enable-glamor], [Build glamor dix module (default: no)]), [GLAMOR=$enableval], [GLAMOR=no]) dnl kdrive and its subsystems AC_ARG_ENABLE(kdrive, AS_HELP_STRING([--enable-kdrive], [Build kdrive servers (default: no)]), [KDRIVE=$enableval], [KDRIVE=no]) AC_ARG_ENABLE(xephyr, AS_HELP_STRING([--enable-xephyr], [Build the kdrive Xephyr server (default: auto)]), [XEPHYR=$enableval], [XEPHYR=auto]) @@ -683,8 +683,8 @@ AC_ARG_ENABLE(xfake, AS_HELP_STRING([--enable-xfake], [Build the kdrive AC_ARG_ENABLE(xfbdev, AS_HELP_STRING([--enable-xfbdev], [Build the kdrive framebuffer device server (default: auto)]), [XFBDEV=$enableval], [XFBDEV=auto]) dnl kdrive options AC_ARG_ENABLE(kdrive-kbd, AS_HELP_STRING([--enable-kdrive-kbd], [Build kbd driver for kdrive (default: auto)]), [KDRIVE_KBD=$enableval], [KDRIVE_KBD=auto]) -AC_ARG_ENABLE(kdrive-mouse, AC_HELP_STRING([--enable-kdrive-mouse], [Build mouse driver for kdrive (default: auto)]), [KDRIVE_MOUSE=$enableval], [KDRIVE_MOUSE=auto]) -AC_ARG_ENABLE(kdrive-evdev, AC_HELP_STRING([--enable-kdrive-evdev], [Build evdev driver for kdrive (default: auto)]), [KDRIVE_EVDEV=$enableval], [KDRIVE_EVDEV=auto]) +AC_ARG_ENABLE(kdrive-mouse, AS_HELP_STRING([--enable-kdrive-mouse], [Build mouse driver for kdrive (default: auto)]), [KDRIVE_MOUSE=$enableval], [KDRIVE_MOUSE=auto]) +AC_ARG_ENABLE(kdrive-evdev, AS_HELP_STRING([--enable-kdrive-evdev], [Build evdev driver for kdrive (default: auto)]), [KDRIVE_EVDEV=$enableval], [KDRIVE_EVDEV=auto]) AC_ARG_ENABLE(libunwind, AS_HELP_STRING([--enable-libunwind], [Use libunwind for backtracing (default: auto)]), [LIBUNWIND="$enableval"], [LIBUNWIND="auto"]) @@ -742,7 +742,6 @@ dnl DDX Detection... Yes, it's ugly to have it here... but we need to dnl handle this early on so that we don't require unsupported extensions case $host_os in cygwin* | mingw*) - CONFIG_DBUS_API=no CONFIG_HAL=no CONFIG_UDEV=no CONFIG_UDEV_KMS=no @@ -792,6 +791,7 @@ case $host_os in XQUARTZ=yes XVFB=no XNEST=no + XWAYLAND=no COMPOSITE=no DGA=no @@ -828,18 +828,18 @@ APPLEWMPROTO="applewmproto >= 1.4" XSHMFENCE="xshmfence >= 1.1" dnl Required modules -XPROTO="xproto >= 7.0.22" +XPROTO="xproto >= 7.0.26" RANDRPROTO="randrproto >= 1.4.0" RENDERPROTO="renderproto >= 0.11" XEXTPROTO="xextproto >= 7.2.99.901" INPUTPROTO="inputproto >= 2.3" KBPROTO="kbproto >= 1.0.3" -FONTSPROTO="fontsproto" +FONTSPROTO="fontsproto >= 2.1.3" FIXESPROTO="fixesproto >= 5.0" DAMAGEPROTO="damageproto >= 1.1" XCMISCPROTO="xcmiscproto >= 1.2.0" BIGREQSPROTO="bigreqsproto >= 1.1.0" -XTRANS="xtrans >= 1.3.2" +XTRANS="xtrans >= 1.3.3" PRESENTPROTO="presentproto >= 1.0" dnl List of libraries that require a specific version @@ -847,6 +847,8 @@ LIBAPPLEWM="applewm >= 1.4" LIBDMX="dmx >= 1.0.99.1" LIBDRI="dri >= 7.8.0" LIBDRM="libdrm >= 2.3.0" +LIBEGL="egl" +LIBGBM="gbm >= 10.2.0" LIBGL="gl >= 7.1.0" LIBXEXT="xext >= 1.0.99.4" LIBXFONT="xfont >= 1.4.2" @@ -870,9 +872,28 @@ AC_SUBST(SDK_REQUIRED_MODULES) REQUIRED_MODULES="$FIXESPROTO $DAMAGEPROTO $XCMISCPROTO $XTRANS $BIGREQSPROTO $SDK_REQUIRED_MODULES" -if test "x$CONFIG_UDEV" = xyes && - { test "x$CONFIG_DBUS_API" = xyes || test "x$CONFIG_HAL" = xyes; }; then - AC_MSG_ERROR([Hotplugging through both libudev and dbus/hal not allowed]) +dnl systemd socket activation +dnl activate the code in libxtrans that grabs systemd's socket fds +AC_ARG_WITH([systemd-daemon], + AS_HELP_STRING([--with-systemd-daemon], + [support systemd socket activation (default: auto)]), + [WITH_SYSTEMD_DAEMON=$withval], [WITH_SYSTEMD_DAEMON=auto]) +PKG_CHECK_MODULES([SYSTEMD_DAEMON], [libsystemd-daemon], + [HAVE_SYSTEMD_DAEMON=yes], [HAVE_SYSTEMD_DAEMON=no]) +if test "x$WITH_SYSTEMD_DAEMON" = xauto; then + WITH_SYSTEMD_DAEMON="$HAVE_SYSTEMD_DAEMON" +fi +if test "x$WITH_SYSTEMD_DAEMON" = xyes; then + if test "x$HAVE_SYSTEMD_DAEMON" = xno; then + AC_MSG_ERROR([systemd support requested but no library has been found]) + fi + AC_DEFINE(HAVE_SYSTEMD_DAEMON, 1, [Define to 1 if libsystemd-daemon is available]) + REQUIRED_LIBS="$REQUIRED_LIBS libsystemd-daemon" +fi +AM_CONDITIONAL([HAVE_SYSTEMD_DAEMON], [test "x$HAVE_SYSTEMD_DAEMON" = "xyes"]) + +if test "x$CONFIG_UDEV" = xyes && test "x$CONFIG_HAL" = xyes; then + AC_MSG_ERROR([Hotplugging through both libudev and hal not allowed]) fi PKG_CHECK_MODULES(UDEV, $LIBUDEV, [HAVE_LIBUDEV=yes], [HAVE_LIBUDEV=no]) @@ -881,7 +902,6 @@ if test "x$CONFIG_UDEV" = xauto; then fi AM_CONDITIONAL(CONFIG_UDEV, [test "x$CONFIG_UDEV" = xyes]) if test "x$CONFIG_UDEV" = xyes; then - CONFIG_DBUS_API=no CONFIG_HAL=no if test "x$CONFIG_UDEV_KMS" = xauto; then CONFIG_UDEV_KMS="$HAVE_LIBUDEV" @@ -904,28 +924,12 @@ if test "x$CONFIG_UDEV" = xyes; then fi AM_CONDITIONAL(CONFIG_UDEV_KMS, [test "x$CONFIG_UDEV_KMS" = xyes]) -dnl HAVE_DBUS is true if we actually have the D-Bus library, whereas -dnl CONFIG_DBUS_API is true if we want to enable the D-Bus config -dnl API. PKG_CHECK_MODULES(DBUS, $LIBDBUS, [HAVE_DBUS=yes], [HAVE_DBUS=no]) if test "x$HAVE_DBUS" = xyes; then AC_DEFINE(HAVE_DBUS, 1, [Have D-Bus support]) fi AM_CONDITIONAL(HAVE_DBUS, [test "x$HAVE_DBUS" = xyes]) -if test "x$CONFIG_DBUS_API" = xauto; then - CONFIG_DBUS_API="$HAVE_DBUS" -fi -if test "x$CONFIG_DBUS_API" = xyes; then - if ! test "x$HAVE_DBUS" = xyes; then - AC_MSG_ERROR([D-Bus configuration API requested, but D-Bus is not installed.]) - fi - - AC_DEFINE(CONFIG_DBUS_API, 1, [Use the D-Bus input configuration API]) - CONFIG_NEED_DBUS="yes" -fi -AM_CONDITIONAL(CONFIG_DBUS_API, [test "x$CONFIG_DBUS_API" = xyes]) - PKG_CHECK_MODULES(HAL, hal, [HAVE_HAL=yes], [HAVE_HAL=no]) if test "x$CONFIG_HAL" = xauto; then CONFIG_HAL="$HAVE_HAL" @@ -936,14 +940,44 @@ if test "x$CONFIG_HAL" = xyes; then fi AC_DEFINE(CONFIG_HAL, 1, [Use the HAL hotplug API]) - CONFIG_NEED_DBUS="yes" + NEED_DBUS="yes" fi AM_CONDITIONAL(CONFIG_HAL, [test "x$CONFIG_HAL" = xyes]) -if test "x$CONFIG_NEED_DBUS" = xyes; then - AC_DEFINE(CONFIG_NEED_DBUS, 1, [Use D-Bus for input hotplug]) +if test "x$SYSTEMD_LOGIND" = xauto; then + if test "x$HAVE_DBUS" = xyes -a "x$CONFIG_UDEV" = xyes ; then + SYSTEMD_LOGIND=yes + else + SYSTEMD_LOGIND=no + fi +fi +if test "x$SYSTEMD_LOGIND" = xyes; then + if ! test "x$HAVE_DBUS" = xyes; then + AC_MSG_ERROR([systemd-logind requested, but D-Bus is not installed.]) + fi + if ! test "x$CONFIG_UDEV" = xyes ; then + AC_MSG_ERROR([systemd-logind is only supported in combination with udev configuration.]) + fi + + AC_DEFINE(SYSTEMD_LOGIND, 1, [Enable systemd-logind integration]) + NEED_DBUS="yes" +fi +AM_CONDITIONAL(SYSTEMD_LOGIND, [test "x$SYSTEMD_LOGIND" = xyes]) + +if test "x$SUID_WRAPPER" = xyes; then + dnl The wrapper uses libdrm headers, so ensure they are available + PKG_CHECK_MODULES([LIBDRM], $LIBDRM) + dnl This is a define so that if some platforms want to put the wrapper + dnl somewhere else this can be easily changed + AC_DEFINE_DIR(SUID_WRAPPER_DIR, libexecdir, [Where to install Xorg.bin and Xorg.wrap]) + SETUID="no" +fi +AM_CONDITIONAL(SUID_WRAPPER, [test "x$SUID_WRAPPER" = xyes]) + +if test "x$NEED_DBUS" = xyes; then + AC_DEFINE(NEED_DBUS, 1, [Enable D-Bus core]) fi -AM_CONDITIONAL(CONFIG_NEED_DBUS, [test "x$CONFIG_NEED_DBUS" = xyes]) +AM_CONDITIONAL(NEED_DBUS, [test "x$NEED_DBUS" = xyes]) if test "x$CONFIG_WSCONS" = xauto; then case $host_os in @@ -1315,12 +1349,12 @@ if test "x$GLX" = xyes; then GLX_LIBS='$(top_builddir)/glx/libglx.la' GLX_SYS_LIBS="$GLX_SYS_LIBS $GL_LIBS" else - GLX=no + GLX=no fi AM_CONDITIONAL(GLX, test "x$GLX" = xyes) if test "x$GLX" = xno; then - AIGLX=no + AIGLX=no fi if test "x$AIGLX" = xyes -a \( "x$DRI2" = xyes \); then @@ -1437,7 +1471,7 @@ AC_DEFINE(SHAPE, 1, [Support SHAPE extension]) AC_DEFINE_DIR(XKB_BASE_DIRECTORY, XKBPATH, [Path to XKB data]) AC_ARG_WITH(xkb-bin-directory, - AS_HELP_STRING([--with-xkb-bin-directory=DIR], [Directory containing xkbcomp program]), + AS_HELP_STRING([--with-xkb-bin-directory=DIR], [Directory containing xkbcomp program (default: ${bindir})]), [XKB_BIN_DIRECTORY="$withval"], [XKB_BIN_DIRECTORY="$bindir"]) @@ -1881,13 +1915,13 @@ if test "x$XORG" = xyes; then save_CFLAGS="$CFLAGS" proto_inc=`$PKG_CONFIG --cflags xproto` CFLAGS="$CFLAGS $VISIBILITY_CFLAGS $proto_inc" - AC_TRY_COMPILE( + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ [#include <X11/Xfuncproto.h> extern _X_HIDDEN int hidden_int; extern _X_EXPORT int public_int; extern _X_HIDDEN int hidden_int_func(void); - extern _X_EXPORT int public_int_func(void);], - [], + extern _X_EXPORT int public_int_func(void);]], + [])], have_visibility=yes, have_visibility=no) CFLAGS=$save_CFLAGS @@ -1913,7 +1947,7 @@ if test "x$XORG" = xyes; then if test "x$PCI" = xyes; then PKG_CHECK_MODULES([PCIACCESS], $LIBPCIACCESS) SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $LIBPCIACCESS" - XORG_SYS_LIBS="$XORG_SYS_LIBS $PCIACCESS_LIBS $GLX_SYS_LIBS $LIBDRM_LIBS" + XORG_SYS_LIBS="$XORG_SYS_LIBS $PCIACCESS_LIBS $LIBDRM_LIBS" XORG_CFLAGS="$XORG_CFLAGS $PCIACCESS_CFLAGS $LIBDRM_CFLAGS" AC_DEFINE(XSERVER_LIBPCIACCESS, 1, [Use libpciaccess for all pci manipulation]) @@ -2072,7 +2106,9 @@ if test "x$XORG" = xyes; then XF86CONFIGDIR="xorg.conf.d" AC_SUBST(XF86CONFIGDIR) CONFIGFILE="$sysconfdir/$XF86CONFIGFILE" - LOGPREFIX="$logdir/Xorg." + LOGPREFIX="Xorg." + XDG_DATA_HOME=".local/share" + XDG_DATA_HOME_LOGDIR="xorg" AC_DEFINE(XORG_SERVER, 1, [Building Xorg server]) AC_DEFINE(XORGSERVER, 1, [Building Xorg server]) AC_DEFINE(XFree86Server, 1, [Building XFree86 server]) @@ -2085,7 +2121,10 @@ if test "x$XORG" = xyes; then AC_DEFINE_DIR(__XCONFIGDIR__, XF86CONFIGDIR, [Name of configuration directory]) AC_DEFINE_DIR(DEFAULT_MODULE_PATH, moduledir, [Default module search path]) AC_DEFINE_DIR(DEFAULT_LIBRARY_PATH, libdir, [Default library install path]) - AC_DEFINE_DIR(DEFAULT_LOGPREFIX, LOGPREFIX, [Default log location]) + AC_DEFINE_DIR(DEFAULT_LOGDIR, logdir, [Default log location]) + AC_DEFINE_DIR(DEFAULT_LOGPREFIX, LOGPREFIX, [Default logfile prefix]) + AC_DEFINE_DIR(DEFAULT_XDG_DATA_HOME, XDG_DATA_HOME, [Default XDG_DATA dir under HOME]) + AC_DEFINE_DIR(DEFAULT_XDG_DATA_HOME_LOGDIR, XDG_DATA_HOME_LOGDIR, [Default log dir under XDG_DATA_HOME]) AC_DEFINE_UNQUOTED(__VENDORDWEBSUPPORT__, ["$VENDOR_WEB"], [Vendor web address for support]) if test "x$VGAHW" = xyes; then AC_DEFINE(WITH_VGAHW, 1, [Building vgahw module]) @@ -2126,6 +2165,22 @@ AM_CONDITIONAL([SOLARIS_VT], [test "x$solaris_vt" = xyes]) AM_CONDITIONAL([DGA], [test "x$DGA" = xyes]) AM_CONDITIONAL([XF86VIDMODE], [test "x$XF86VIDMODE" = xyes]) AM_CONDITIONAL([XORG_BUS_PLATFORM], [test "x$CONFIG_UDEV_KMS" = xyes]) + +dnl glamor +AM_CONDITIONAL([GLAMOR], [test "x$GLAMOR" = xyes]) +if test "x$GLAMOR" = xyes; then + AC_DEFINE(GLAMOR, 1, [Build glamor]) + PKG_CHECK_MODULES([GLAMOR], [epoxy]) + + PKG_CHECK_MODULES(GBM, "$LIBGBM", [GBM=yes], [GBM=no]) + if test "x$GBM" = xyes; then + AC_DEFINE(GLAMOR_HAS_GBM, 1, + [Build glamor with GBM-based EGL support]) + fi + +fi +AM_CONDITIONAL([GLAMOR_EGL], [test "x$GBM" = xyes]) + dnl XWin DDX AC_MSG_CHECKING([whether to build XWin DDX]) @@ -2139,7 +2194,6 @@ fi AC_MSG_RESULT([$XWIN]) if test "x$XWIN" = xyes; then - AC_DEFINE_DIR(SYSCONFDIR, sysconfdir, [Location of system.XWinrc]) AC_DEFINE_DIR(DEFAULT_LOGDIR, logdir, [Default log location]) AC_DEFINE_UNQUOTED(XORG_VERSION_CURRENT, [$VENDOR_RELEASE], [Current Xorg version]) AC_DEFINE_UNQUOTED(__VENDORDWEBSUPPORT__, ["$VENDOR_WEB"], [Vendor web address for support]) @@ -2237,6 +2291,8 @@ if test "x$XQUARTZ" = xyes; then fi fi +AM_CONDITIONAL(PSEUDORAMIX, [test "x$XQUARTZ" = xyes -o "x$XWIN" = xyes ]) + # Support for objc in autotools is minimal and not documented. OBJC='$(CC)' OBJCLD='$(CCLD)' @@ -2371,6 +2427,9 @@ if test "$KDRIVE" = yes; then if test "x$DRI" = xyes && test "x$GLX" = xyes; then XEPHYR_REQUIRED_LIBS="$XEPHYR_REQUIRED_LIBS libdrm xcb-glx xcb-xf86dri > 1.6" fi + if test "x$GLAMOR" = xyes; then + XEPHYR_REQUIRED_LIBS="$XEPHYR_REQUIRED_LIBS x11-xcb" + fi if test "x$XEPHYR" = xauto; then PKG_CHECK_MODULES(XEPHYR, $XEPHYR_REQUIRED_LIBS, [XEPHYR="yes"], [XEPHYR="no"]) @@ -2431,8 +2490,7 @@ if test "$KDRIVE" = yes; then fi ;; esac - KDRIVE_STUB_LIB='$(top_builddir)/hw/kdrive/src/libkdrivestubs.la' - KDRIVE_LOCAL_LIBS="$MAIN_LIB $DIX_LIB $KDRIVE_LIB $KDRIVE_STUB_LIB" + KDRIVE_LOCAL_LIBS="$MAIN_LIB $DIX_LIB $KDRIVE_LIB" KDRIVE_LOCAL_LIBS="$KDRIVE_LOCAL_LIBS $FB_LIB $MI_LIB $KDRIVE_PURE_LIBS" KDRIVE_LOCAL_LIBS="$KDRIVE_LOCAL_LIBS $KDRIVE_OS_LIB" KDRIVE_LIBS="$KDRIVE_LOCAL_LIBS $XSERVER_SYS_LIBS $GLX_SYS_LIBS $DLOPEN_LIBS $TSLIB_LIBS" @@ -2458,21 +2516,48 @@ AM_CONDITIONAL(XEPHYR, [test "x$KDRIVE" = xyes && test "x$XEPHYR" = xyes]) AM_CONDITIONAL(BUILD_KDRIVEFBDEVLIB, [test "x$KDRIVE" = xyes && test "x$KDRIVEFBDEVLIB" = xyes]) AM_CONDITIONAL(XFAKESERVER, [test "x$KDRIVE" = xyes && test "x$XFAKE" = xyes]) +dnl Xwayland DDX + +PKG_CHECK_MODULES(XWAYLANDMODULES, [wayland-client >= 1.3.0 libdrm epoxy], [have_xwayland=yes], [have_xwayland=no]) +AC_MSG_CHECKING([whether to build Xwayland DDX]) +if test "x$XWAYLAND" = xauto; then + XWAYLAND="$have_xwayland" +fi +AC_MSG_RESULT([$XWAYLAND]) +AM_CONDITIONAL(XWAYLAND, [test "x$XWAYLAND" = xyes]) + +if test "x$XWAYLAND" = xyes; then + if test "x$have_xwayland" = xno; then + AC_MSG_ERROR([Xwayland build explicitly requested, but required modules not found.]) + fi + + XWAYLAND_LIBS="$FB_LIB $FIXES_LIB $MI_LIB $XEXT_LIB $DBE_LIB $RECORD_LIB $GLX_LIBS $RANDR_LIB $RENDER_LIB $DAMAGE_LIB $DRI3_LIB $PRESENT_LIB $MIEXT_SYNC_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $MAIN_LIB $DIX_LIB $OS_LIB" + XWAYLAND_SYS_LIBS="$XWAYLANDMODULES_LIBS $GLX_SYS_LIBS" + AC_SUBST([XWAYLAND_LIBS]) + AC_SUBST([XWAYLAND_SYS_LIBS]) + + WAYLAND_PREFIX=`$PKG_CONFIG --variable=prefix wayland-client` + AC_PATH_PROG([WAYLAND_SCANNER], [wayland-scanner],, + [${WAYLAND_PREFIX}/bin$PATH_SEPARATOR$PATH]) +fi + + dnl and the rest of these are generic, so they're in config.h dnl dnl though, thanks to the passing of some significant amount of time, the dnl above is probably a complete fallacy, and you should not rely on it. dnl but this is still actually better than imake, honest. -daniels -AC_TRY_COMPILE([ +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <features.h> #ifndef __GLIBC__ #error not glibc #endif -], [], [AC_DEFINE(_GNU_SOURCE, 1, +]], [])], [AC_DEFINE(_GNU_SOURCE, 1, [ Enable GNU and other extensions to the C environment for glibc])]) AC_DEFINE_DIR(PROJECTROOT, prefix, [Overall prefix]) +AC_DEFINE_DIR(SYSCONFDIR, sysconfdir, [sysconfdir]) AC_SUBST([RELEASE_DATE]) BUILD_DATE="`date +'%Y%m%d'`" @@ -2491,7 +2576,7 @@ AC_SUBST([prefix]) AC_CONFIG_COMMANDS([sdksyms], [touch hw/xfree86/sdksyms.dep]) if test "x$CONFIG_HAL" = xno && test "x$CONFIG_UDEV" = xno; then - AC_WARN([ + AC_MSG_WARN([ *********************************************** Neither HAL nor udev backend will be enabled. Input device hotplugging will not be available! @@ -2510,6 +2595,7 @@ doc/Makefile doc/dtrace/Makefile man/Makefile fb/Makefile +glamor/Makefile record/Makefile config/Makefile mi/Makefile @@ -2531,6 +2617,7 @@ dri3/Makefile present/Makefile hw/Makefile hw/xfree86/Makefile +hw/xfree86/Xorg.sh hw/xfree86/common/Makefile hw/xfree86/common/xf86Build.h hw/xfree86/ddc/Makefile @@ -2542,6 +2629,7 @@ hw/xfree86/exa/Makefile hw/xfree86/exa/man/Makefile hw/xfree86/fbdevhw/Makefile hw/xfree86/fbdevhw/man/Makefile +hw/xfree86/glamor_egl/Makefile hw/xfree86/i2c/Makefile hw/xfree86/int10/Makefile hw/xfree86/loader/Makefile @@ -2598,6 +2686,7 @@ hw/kdrive/linux/Makefile hw/kdrive/openbsd/Makefile hw/kdrive/src/Makefile hw/kdrive/wscons/Makefile +hw/xwayland/Makefile test/Makefile test/xi2/Makefile xserver.ent diff --git a/xserver/damageext/Makefile.in b/xserver/damageext/Makefile.in index e1022b183..82caf6805 100644 --- a/xserver/damageext/Makefile.in +++ b/xserver/damageext/Makefile.in @@ -162,6 +162,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -206,6 +208,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -308,7 +314,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -317,6 +326,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -383,6 +393,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/damageext/damageext.c b/xserver/damageext/damageext.c index 5650953f2..886f56d9e 100644 --- a/xserver/damageext/damageext.c +++ b/xserver/damageext/damageext.c @@ -245,7 +245,7 @@ DamageExtCreate(DrawablePtr pDrawable, DamageReportLevel level, return NULL; } - if (!AddResource(id, DamageExtType, (pointer) pDamageExt)) + if (!AddResource(id, DamageExtType, (void *) pDamageExt)) return NULL; DamageExtRegister(pDrawable, pDamageExt->pDamage, @@ -569,7 +569,7 @@ SProcDamageDispatch(ClientPtr client) } static void -DamageClientCallback(CallbackListPtr *list, pointer closure, pointer data) +DamageClientCallback(CallbackListPtr *list, void *closure, void *data) { NewClientInfoRec *clientinfo = (NewClientInfoRec *) data; ClientPtr pClient = clientinfo->client; @@ -587,7 +587,7 @@ DamageResetProc(ExtensionEntry * extEntry) } static int -FreeDamageExt(pointer value, XID did) +FreeDamageExt(void *value, XID did) { DamageExtPtr pDamageExt = (DamageExtPtr) value; diff --git a/xserver/damageext/damageextint.h b/xserver/damageext/damageextint.h index e50149501..7a7096d27 100644 --- a/xserver/damageext/damageextint.h +++ b/xserver/damageext/damageextint.h @@ -58,7 +58,7 @@ typedef struct _DamageExt { } DamageExtRec, *DamageExtPtr; #define VERIFY_DAMAGEEXT(pDamageExt, rid, client, mode) { \ - int rc = dixLookupResourceByType((pointer *)&(pDamageExt), rid, \ + int rc = dixLookupResourceByType((void **)&(pDamageExt), rid, \ DamageExtType, client, mode); \ if (rc != Success) \ return rc; \ diff --git a/xserver/dbe/Makefile.in b/xserver/dbe/Makefile.in index ab83ac2f5..824c1e586 100644 --- a/xserver/dbe/Makefile.in +++ b/xserver/dbe/Makefile.in @@ -193,6 +193,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -237,6 +239,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -339,7 +345,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -348,6 +357,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -414,6 +424,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/dbe/dbe.c b/xserver/dbe/dbe.c index 5524615e2..8896720e7 100644 --- a/xserver/dbe/dbe.c +++ b/xserver/dbe/dbe.c @@ -322,7 +322,7 @@ ProcDbeAllocateBackBufferName(ClientPtr client) if (status == Success) { pDbeWindowPriv->IDs[add_index] = stuff->buffer; if (!AddResource(stuff->buffer, dbeWindowPrivResType, - (pointer) pDbeWindowPriv)) { + (void *) pDbeWindowPriv)) { pDbeWindowPriv->IDs[add_index] = DBE_FREE_ID_ELEMENT; if (pDbeWindowPriv->nBufferIDs == 0) { @@ -378,12 +378,12 @@ ProcDbeDeallocateBackBufferName(ClientPtr client) REQUEST(xDbeDeallocateBackBufferNameReq); DbeWindowPrivPtr pDbeWindowPriv; int rc, i; - pointer val; + void *val; REQUEST_SIZE_MATCH(xDbeDeallocateBackBufferNameReq); /* Buffer name must be valid */ - rc = dixLookupResourceByType((pointer *) &pDbeWindowPriv, stuff->buffer, + rc = dixLookupResourceByType((void **) &pDbeWindowPriv, stuff->buffer, dbeWindowPrivResType, client, DixDestroyAccess); if (rc != Success) @@ -726,7 +726,7 @@ ProcDbeGetBackBufferAttributes(ClientPtr client) REQUEST_SIZE_MATCH(xDbeGetBackBufferAttributesReq); - rc = dixLookupResourceByType((pointer *) &pDbeWindowPriv, stuff->buffer, + rc = dixLookupResourceByType((void **) &pDbeWindowPriv, stuff->buffer, dbeWindowPrivResType, client, DixGetAttrAccess); if (rc == Success) { @@ -1125,7 +1125,7 @@ DbeSetupBackgroundPainter(WindowPtr pWin, GCPtr pGC) * *****************************************************************************/ static int -DbeDrawableDelete(pointer pDrawable, XID id) +DbeDrawableDelete(void *pDrawable, XID id) { return Success; @@ -1143,7 +1143,7 @@ DbeDrawableDelete(pointer pDrawable, XID id) * *****************************************************************************/ static int -DbeWindowPrivDelete(pointer pDbeWinPriv, XID id) +DbeWindowPrivDelete(void *pDbeWinPriv, XID id) { DbeScreenPrivPtr pDbeScreenPriv; DbeWindowPrivPtr pDbeWindowPriv = (DbeWindowPrivPtr) pDbeWinPriv; diff --git a/xserver/dbe/midbe.c b/xserver/dbe/midbe.c index 3663fddcc..0479ecc5e 100644 --- a/xserver/dbe/midbe.c +++ b/xserver/dbe/midbe.c @@ -202,7 +202,7 @@ miDbeAllocBackBufferName(WindowPtr pWin, XID bufId, int swapAction) /* Associate the new ID with an existing pixmap. */ if (!AddResource(bufId, dbeDrawableResType, - (pointer) pDbeWindowPriv->pBackBuffer)) { + (void *) pDbeWindowPriv->pBackBuffer)) { return BadAlloc; } @@ -230,7 +230,7 @@ miDbeAliasBuffers(DbeWindowPrivPtr pDbeWindowPriv) for (i = 0; i < pDbeWindowPriv->nBufferIDs; i++) { ChangeResourceValue(pDbeWindowPriv->IDs[i], dbeDrawableResType, - (pointer) pDbeWindowPriv->pBackBuffer); + (void *) pDbeWindowPriv->pBackBuffer); } } /* miDbeAliasBuffers() */ diff --git a/xserver/dix/Makefile.in b/xserver/dix/Makefile.in index 5bcfe3f09..30aa663f4 100644 --- a/xserver/dix/Makefile.in +++ b/xserver/dix/Makefile.in @@ -208,6 +208,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -252,6 +254,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -354,7 +360,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -363,6 +372,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -429,6 +439,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/dix/colormap.c b/xserver/dix/colormap.c index 39fddc9b1..c1ff88e1a 100644 --- a/xserver/dix/colormap.c +++ b/xserver/dix/colormap.c @@ -367,7 +367,7 @@ CreateColormap(Colormap mid, ScreenPtr pScreen, VisualPtr pVisual, } pmap->flags |= BeingCreated; - if (!AddResource(mid, RT_COLORMAP, (pointer) pmap)) + if (!AddResource(mid, RT_COLORMAP, (void *) pmap)) return BadAlloc; /* @@ -397,7 +397,7 @@ CreateColormap(Colormap mid, ScreenPtr pScreen, VisualPtr pVisual, * \param value must conform to DeleteType */ int -FreeColormap(pointer value, XID mid) +FreeColormap(void *value, XID mid) { int i; EntryPtr pent; @@ -405,7 +405,7 @@ FreeColormap(pointer value, XID mid) if (CLIENT_ID(mid) != SERVER_ID) { (*pmap->pScreen->UninstallColormap) (pmap); - WalkTree(pmap->pScreen, (VisitWindowProcPtr) TellNoMap, (pointer) &mid); + WalkTree(pmap->pScreen, (VisitWindowProcPtr) TellNoMap, (void *) &mid); } /* This is the device's chance to undo anything it needs to, especially @@ -474,7 +474,7 @@ TellNoMap(WindowPtr pwin, Colormap * pmid) /* Tell window that pmid got uninstalled */ int -TellLostMap(WindowPtr pwin, pointer value) +TellLostMap(WindowPtr pwin, void *value) { Colormap *pmid = (Colormap *) value; @@ -499,7 +499,7 @@ TellLostMap(WindowPtr pwin, pointer value) /* Tell window that pmid got installed */ int -TellGainedMap(WindowPtr pwin, pointer value) +TellGainedMap(WindowPtr pwin, void *value) { Colormap *pmid = (Colormap *) value; @@ -845,7 +845,7 @@ AllocColor(ColormapPtr pmap, pmap->pVisual->vid == pmap->pScreen->rootVisual) { ColormapPtr prootmap; - dixLookupResourceByType((pointer *) &prootmap, + dixLookupResourceByType((void **) &prootmap, pmap->pScreen->defColormap, RT_COLORMAP, clients[client], DixReadAccess); @@ -863,7 +863,7 @@ AllocColor(ColormapPtr pmap, pmap->pVisual->vid == pmap->pScreen->rootVisual) { ColormapPtr prootmap; - dixLookupResourceByType((pointer *) &prootmap, + dixLookupResourceByType((void **) &prootmap, pmap->pScreen->defColormap, RT_COLORMAP, clients[client], DixReadAccess); @@ -917,7 +917,7 @@ AllocColor(ColormapPtr pmap, } pcr->mid = pmap->mid; pcr->client = client; - if (!AddResource(FakeClientID(client), RT_CMAPENTRY, (pointer) pcr)) + if (!AddResource(FakeClientID(client), RT_CMAPENTRY, (void *) pcr)) return BadAlloc; } return Success; @@ -1463,9 +1463,9 @@ FreePixels(ColormapPtr pmap, int client) * \unused fakeid */ int -FreeClientPixels(pointer value, XID fakeid) +FreeClientPixels(void *value, XID fakeid) { - pointer pmap; + void *pmap; colorResource *pcr = value; int rc; @@ -1532,7 +1532,7 @@ AllocColorCells(int client, ColormapPtr pmap, int colors, int planes, if ((ok == Success) && pcr) { pcr->mid = pmap->mid; pcr->client = client; - if (!AddResource(FakeClientID(client), RT_CMAPENTRY, (pointer) pcr)) + if (!AddResource(FakeClientID(client), RT_CMAPENTRY, (void *) pcr)) ok = BadAlloc; } else @@ -1614,7 +1614,7 @@ AllocColorPlanes(int client, ColormapPtr pmap, int colors, if ((ok == Success) && pcr) { pcr->mid = pmap->mid; pcr->client = client; - if (!AddResource(FakeClientID(client), RT_CMAPENTRY, (pointer) pcr)) + if (!AddResource(FakeClientID(client), RT_CMAPENTRY, (void *) pcr)) ok = BadAlloc; } else @@ -2492,7 +2492,7 @@ struct colormap_lookup_data { }; static void -_colormap_find_resource(pointer value, XID id, pointer cdata) +_colormap_find_resource(void *value, XID id, void *cdata) { struct colormap_lookup_data *cmap_data = cdata; VisualPtr visuals = cmap_data->visuals; diff --git a/xserver/dix/cursor.c b/xserver/dix/cursor.c index 8cc54bd1f..56c560640 100644 --- a/xserver/dix/cursor.c +++ b/xserver/dix/cursor.c @@ -104,7 +104,7 @@ FreeCursorBits(CursorBitsPtr bits) * \param value must conform to DeleteType */ int -FreeCursor(pointer value, XID cid) +FreeCursor(void *value, XID cid) { int nscr; CursorPtr pCurs = (CursorPtr) value; @@ -319,13 +319,13 @@ AllocGlyphCursor(Font source, unsigned sourceChar, Font mask, unsigned maskChar, CursorPtr pCurs; GlyphSharePtr pShare; - rc = dixLookupResourceByType((pointer *) &sourcefont, source, RT_FONT, + rc = dixLookupResourceByType((void **) &sourcefont, source, RT_FONT, client, DixUseAccess); if (rc != Success) { client->errorValue = source; return rc; } - rc = dixLookupResourceByType((pointer *) &maskfont, mask, RT_FONT, client, + rc = dixLookupResourceByType((void **) &maskfont, mask, RT_FONT, client, DixUseAccess); if (rc != Success && mask != None) { client->errorValue = mask; @@ -486,7 +486,7 @@ CreateRootCursor(char *unused1, unsigned int unused2) if (err != Success) return NullCursor; - err = dixLookupResourceByType((pointer *) &cursorfont, fontID, RT_FONT, + err = dixLookupResourceByType((void **) &cursorfont, fontID, RT_FONT, serverClient, DixReadAccess); if (err != Success) return NullCursor; @@ -494,7 +494,7 @@ CreateRootCursor(char *unused1, unsigned int unused2) &curs, serverClient, (XID) 0) != Success) return NullCursor; - if (!AddResource(FakeClientID(0), RT_CURSOR, (pointer) curs)) + if (!AddResource(FakeClientID(0), RT_CURSOR, (void *) curs)) return NullCursor; return curs; diff --git a/xserver/dix/devices.c b/xserver/dix/devices.c index 8b9f5dd93..7f079ffa1 100644 --- a/xserver/dix/devices.c +++ b/xserver/dix/devices.c @@ -386,7 +386,7 @@ EnableDevice(DeviceIntPtr dev, BOOL sendevent) } else { if (dev->coreEvents) - other = (IsPointerDevice(dev)) ? inputInfo.pointer : + other = (IsPointerDevice(dev)) ? inputInfo.pointer: inputInfo.keyboard; else other = NULL; /* auto-float non-core devices */ @@ -416,6 +416,8 @@ EnableDevice(DeviceIntPtr dev, BOOL sendevent) XISendDeviceHierarchyEvent(flags); } + if (!IsMaster(dev)) + XkbPushLockedStateToSlaves(GetMaster(dev, MASTER_KEYBOARD), 0, 0); RecalculateMasterButtons(dev); /* initialise an idle timer for this device*/ @@ -586,7 +588,7 @@ ActivateDevice(DeviceIntPtr dev, BOOL sendevent) * The actual task of ringing the bell is the job of the DDX. */ static void -CoreKeyboardBell(int volume, DeviceIntPtr pDev, pointer arg, int something) +CoreKeyboardBell(int volume, DeviceIntPtr pDev, void *arg, int something) { KeybdCtrl *ctrl = arg; @@ -750,7 +752,7 @@ InitAndStartDevices(void) * Free the given device class and reset the pointer to NULL. */ static void -FreeDeviceClass(int type, pointer *class) +FreeDeviceClass(int type, void **class) { if (!(*class)) return; @@ -818,7 +820,7 @@ FreeDeviceClass(int type, pointer *class) } static void -FreeFeedbackClass(int type, pointer *class) +FreeFeedbackClass(int type, void **class) { if (!(*class)) return; @@ -906,19 +908,19 @@ FreeAllDeviceClasses(ClassesPtr classes) if (!classes) return; - FreeDeviceClass(KeyClass, (pointer) &classes->key); - FreeDeviceClass(ValuatorClass, (pointer) &classes->valuator); - FreeDeviceClass(XITouchClass, (pointer) &classes->touch); - FreeDeviceClass(ButtonClass, (pointer) &classes->button); - FreeDeviceClass(FocusClass, (pointer) &classes->focus); - FreeDeviceClass(ProximityClass, (pointer) &classes->proximity); + FreeDeviceClass(KeyClass, (void *) &classes->key); + FreeDeviceClass(ValuatorClass, (void *) &classes->valuator); + FreeDeviceClass(XITouchClass, (void *) &classes->touch); + FreeDeviceClass(ButtonClass, (void *) &classes->button); + FreeDeviceClass(FocusClass, (void *) &classes->focus); + FreeDeviceClass(ProximityClass, (void *) &classes->proximity); - FreeFeedbackClass(KbdFeedbackClass, (pointer) &classes->kbdfeed); - FreeFeedbackClass(PtrFeedbackClass, (pointer) &classes->ptrfeed); - FreeFeedbackClass(IntegerFeedbackClass, (pointer) &classes->intfeed); - FreeFeedbackClass(StringFeedbackClass, (pointer) &classes->stringfeed); - FreeFeedbackClass(BellFeedbackClass, (pointer) &classes->bell); - FreeFeedbackClass(LedFeedbackClass, (pointer) &classes->leds); + FreeFeedbackClass(KbdFeedbackClass, (void *) &classes->kbdfeed); + FreeFeedbackClass(PtrFeedbackClass, (void *) &classes->ptrfeed); + FreeFeedbackClass(IntegerFeedbackClass, (void *) &classes->intfeed); + FreeFeedbackClass(StringFeedbackClass, (void *) &classes->stringfeed); + FreeFeedbackClass(BellFeedbackClass, (void *) &classes->bell); + FreeFeedbackClass(LedFeedbackClass, (void *) &classes->leds); } @@ -944,8 +946,9 @@ CloseDevice(DeviceIntPtr dev) if (dev->inited) (void) (*dev->deviceProc) (dev, DEVICE_CLOSE); - /* free sprite memory */ - if (IsMaster(dev) && dev->spriteInfo->sprite) + FreeSprite(dev); + + if (IsMaster(dev)) screen->DeviceCursorCleanup(dev, screen); /* free acceleration info */ @@ -966,8 +969,6 @@ CloseDevice(DeviceIntPtr dev) free(classes); } - FreeSprite(dev); - /* a client may have the device set as client pointer */ for (j = 0; j < currentMaxClients; j++) { if (clients[j] && clients[j]->clientPtr == dev) { @@ -1473,7 +1474,6 @@ InitPtrFeedbackClassDeviceStruct(DeviceIntPtr dev, PtrCtrlProcPtr controlProc) PtrFeedbackPtr feedc; BUG_RETURN_VAL(dev == NULL, FALSE); - BUG_RETURN_VAL(dev->ptrfeed != NULL, FALSE); feedc = malloc(sizeof(PtrFeedbackClassRec)); if (!feedc) @@ -1517,7 +1517,6 @@ InitStringFeedbackClassDeviceStruct(DeviceIntPtr dev, StringFeedbackPtr feedc; BUG_RETURN_VAL(dev == NULL, FALSE); - BUG_RETURN_VAL(dev->stringfeed != NULL, FALSE); feedc = malloc(sizeof(StringFeedbackClassRec)); if (!feedc) @@ -1554,7 +1553,6 @@ InitBellFeedbackClassDeviceStruct(DeviceIntPtr dev, BellProcPtr bellProc, BellFeedbackPtr feedc; BUG_RETURN_VAL(dev == NULL, FALSE); - BUG_RETURN_VAL(dev->bell != NULL, FALSE); feedc = malloc(sizeof(BellFeedbackClassRec)); if (!feedc) @@ -1576,7 +1574,6 @@ InitLedFeedbackClassDeviceStruct(DeviceIntPtr dev, LedCtrlProcPtr controlProc) LedFeedbackPtr feedc; BUG_RETURN_VAL(dev == NULL, FALSE); - BUG_RETURN_VAL(dev->leds != NULL, FALSE); feedc = malloc(sizeof(LedFeedbackClassRec)); if (!feedc) @@ -1599,7 +1596,6 @@ InitIntegerFeedbackClassDeviceStruct(DeviceIntPtr dev, IntegerFeedbackPtr feedc; BUG_RETURN_VAL(dev == NULL, FALSE); - BUG_RETURN_VAL(dev->intfeed != NULL, FALSE); feedc = malloc(sizeof(IntegerFeedbackClassRec)); if (!feedc) @@ -2649,6 +2645,7 @@ AttachDevice(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr master) dev->spriteInfo->paired = master; dev->spriteInfo->spriteOwner = FALSE; + XkbPushLockedStateToSlaves(GetMaster(dev, MASTER_KEYBOARD), 0, 0); RecalculateMasterButtons(master); } @@ -2736,6 +2733,7 @@ AllocDevicePair(ClientPtr client, const char *name, { DeviceIntPtr pointer; DeviceIntPtr keyboard; + char *dev_name; *ptr = *keybd = NULL; @@ -2746,12 +2744,12 @@ AllocDevicePair(ClientPtr client, const char *name, if (!pointer) return BadAlloc; - if (asprintf(&pointer->name, "%s pointer", name) == -1) { - pointer->name = NULL; + if (asprintf(&dev_name, "%s pointer", name) == -1) { RemoveDevice(pointer, FALSE); return BadAlloc; } + pointer->name = dev_name; pointer->public.processInputProc = ProcessOtherEvent; pointer->public.realInputProc = ProcessOtherEvent; @@ -2772,13 +2770,13 @@ AllocDevicePair(ClientPtr client, const char *name, return BadAlloc; } - if (asprintf(&keyboard->name, "%s keyboard", name) == -1) { - keyboard->name = NULL; + if (asprintf(&dev_name, "%s keyboard", name) == -1) { RemoveDevice(keyboard, FALSE); RemoveDevice(pointer, FALSE); return BadAlloc; } + keyboard->name = dev_name; keyboard->public.processInputProc = ProcessOtherEvent; keyboard->public.realInputProc = ProcessOtherEvent; diff --git a/xserver/dix/dispatch.c b/xserver/dix/dispatch.c index 8dcd9cbcf..4f830f7f4 100644 --- a/xserver/dix/dispatch.c +++ b/xserver/dix/dispatch.c @@ -260,12 +260,11 @@ SmartScheduleClient(int *clientReady, int nready) for (i = 0; i < nready; i++) { client = clientReady[i]; pClient = clients[client]; - /* Praise clients which are idle */ - if ((now - pClient->smart_check_tick) >= idle) { + /* Praise clients which haven't run in a while */ + if ((now - pClient->smart_stop_tick) >= idle) { if (pClient->smart_priority < 0) pClient->smart_priority++; } - pClient->smart_check_tick = now; /* check priority to select best client */ robin = @@ -470,7 +469,7 @@ Dispatch(void) } static int VendorRelease = VENDOR_RELEASE; -static char *VendorString = VENDOR_NAME; +static const char *VendorString = VENDOR_NAME; void SetVendorRelease(int release) @@ -479,9 +478,9 @@ SetVendorRelease(int release) } void -SetVendorString(char *string) +SetVendorString(const char *vendor) { - VendorString = string; + VendorString = vendor; } Bool @@ -652,7 +651,7 @@ ProcCreateWindow(ClientPtr client) Mask mask = pWin->eventMask; pWin->eventMask = 0; /* subterfuge in case AddResource fails */ - if (!AddResource(stuff->wid, RT_WINDOW, (pointer) pWin)) + if (!AddResource(stuff->wid, RT_WINDOW, (void *) pWin)) return BadAlloc; pWin->eventMask = mask; } @@ -1069,7 +1068,7 @@ ProcGrabServer(ClientPtr client) grabinfo.client = client; grabinfo.grabstate = SERVER_GRABBED; - CallCallbacks(&ServerGrabCallback, (pointer) &grabinfo); + CallCallbacks(&ServerGrabCallback, (void *) &grabinfo); } return Success; @@ -1096,7 +1095,7 @@ UngrabServer(ClientPtr client) grabinfo.client = client; grabinfo.grabstate = SERVER_UNGRABBED; - CallCallbacks(&ServerGrabCallback, (pointer) &grabinfo); + CallCallbacks(&ServerGrabCallback, (void *) &grabinfo); } } @@ -1208,7 +1207,7 @@ ProcCloseFont(ClientPtr client) REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); - rc = dixLookupResourceByType((pointer *) &pFont, stuff->id, RT_FONT, + rc = dixLookupResourceByType((void **) &pFont, stuff->id, RT_FONT, client, DixDestroyAccess); if (rc == Success) { FreeResource(stuff->id, RT_NONE); @@ -1335,7 +1334,7 @@ ProcListFontsWithInfo(ClientPtr client) * \param value must conform to DeleteType */ int -dixDestroyPixmap(pointer value, XID pid) +dixDestroyPixmap(void *value, XID pid) { PixmapPtr pPixmap = (PixmapPtr) value; @@ -1402,7 +1401,7 @@ ProcCreatePixmap(ClientPtr client) (*pDraw->pScreen->DestroyPixmap) (pMap); return rc; } - if (AddResource(stuff->pid, RT_PIXMAP, (pointer) pMap)) + if (AddResource(stuff->pid, RT_PIXMAP, (void *) pMap)) return Success; } return BadAlloc; @@ -1417,7 +1416,7 @@ ProcFreePixmap(ClientPtr client) REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); - rc = dixLookupResourceByType((pointer *) &pMap, stuff->id, RT_PIXMAP, + rc = dixLookupResourceByType((void **) &pMap, stuff->id, RT_PIXMAP, client, DixDestroyAccess); if (rc == Success) { FreeResource(stuff->id, RT_NONE); @@ -1454,7 +1453,7 @@ ProcCreateGC(ClientPtr client) stuff->gc, client); if (error != Success) return error; - if (!AddResource(stuff->gc, RT_GC, (pointer) pGC)) + if (!AddResource(stuff->gc, RT_GC, (void *) pGC)) return BadAlloc; return Success; } @@ -2121,7 +2120,7 @@ DoGetImage(ClientPtr client, int format, Drawable drawable, y + linesDone, width, nlines, - format, planemask, (pointer) pBuf); + format, planemask, (void *) pBuf); if (pVisibleRegion) XaceCensorImage(client, pVisibleRegion, widthBytesLine, pDraw, x, y + linesDone, width, @@ -2148,7 +2147,7 @@ DoGetImage(ClientPtr client, int format, Drawable drawable, y + linesDone, width, nlines, - format, plane, (pointer) pBuf); + format, plane, (void *) pBuf); if (pVisibleRegion) XaceCensorImage(client, pVisibleRegion, widthBytesLine, @@ -2308,7 +2307,7 @@ ProcFreeColormap(ClientPtr client) REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); - rc = dixLookupResourceByType((pointer *) &pmap, stuff->id, RT_COLORMAP, + rc = dixLookupResourceByType((void **) &pmap, stuff->id, RT_COLORMAP, client, DixDestroyAccess); if (rc == Success) { /* Freeing a default colormap is a no-op */ @@ -2334,7 +2333,7 @@ ProcCopyColormapAndFree(ClientPtr client) REQUEST_SIZE_MATCH(xCopyColormapAndFreeReq); mid = stuff->mid; LEGAL_NEW_RESOURCE(mid, client); - rc = dixLookupResourceByType((pointer *) &pSrcMap, stuff->srcCmap, + rc = dixLookupResourceByType((void **) &pSrcMap, stuff->srcCmap, RT_COLORMAP, client, DixReadAccess | DixRemoveAccess); if (rc == Success) @@ -2352,7 +2351,7 @@ ProcInstallColormap(ClientPtr client) REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); - rc = dixLookupResourceByType((pointer *) &pcmp, stuff->id, RT_COLORMAP, + rc = dixLookupResourceByType((void **) &pcmp, stuff->id, RT_COLORMAP, client, DixInstallAccess); if (rc != Success) goto out; @@ -2381,7 +2380,7 @@ ProcUninstallColormap(ClientPtr client) REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); - rc = dixLookupResourceByType((pointer *) &pcmp, stuff->id, RT_COLORMAP, + rc = dixLookupResourceByType((void **) &pcmp, stuff->id, RT_COLORMAP, client, DixUninstallAccess); if (rc != Success) goto out; @@ -2449,7 +2448,7 @@ ProcAllocColor(ClientPtr client) REQUEST(xAllocColorReq); REQUEST_SIZE_MATCH(xAllocColorReq); - rc = dixLookupResourceByType((pointer *) &pmap, stuff->cmap, RT_COLORMAP, + rc = dixLookupResourceByType((void **) &pmap, stuff->cmap, RT_COLORMAP, client, DixAddAccess); if (rc == Success) { xAllocColorReply acr = { @@ -2486,7 +2485,7 @@ ProcAllocNamedColor(ClientPtr client) REQUEST(xAllocNamedColorReq); REQUEST_FIXED_SIZE(xAllocNamedColorReq, stuff->nbytes); - rc = dixLookupResourceByType((pointer *) &pcmp, stuff->cmap, RT_COLORMAP, + rc = dixLookupResourceByType((void **) &pcmp, stuff->cmap, RT_COLORMAP, client, DixAddAccess); if (rc == Success) { xAllocNamedColorReply ancr = { @@ -2531,7 +2530,7 @@ ProcAllocColorCells(ClientPtr client) REQUEST(xAllocColorCellsReq); REQUEST_SIZE_MATCH(xAllocColorCellsReq); - rc = dixLookupResourceByType((pointer *) &pcmp, stuff->cmap, RT_COLORMAP, + rc = dixLookupResourceByType((void **) &pcmp, stuff->cmap, RT_COLORMAP, client, DixAddAccess); if (rc == Success) { int npixels, nmasks; @@ -2592,7 +2591,7 @@ ProcAllocColorPlanes(ClientPtr client) REQUEST(xAllocColorPlanesReq); REQUEST_SIZE_MATCH(xAllocColorPlanesReq); - rc = dixLookupResourceByType((pointer *) &pcmp, stuff->cmap, RT_COLORMAP, + rc = dixLookupResourceByType((void **) &pcmp, stuff->cmap, RT_COLORMAP, client, DixAddAccess); if (rc == Success) { xAllocColorPlanesReply acpr; @@ -2654,7 +2653,7 @@ ProcFreeColors(ClientPtr client) REQUEST(xFreeColorsReq); REQUEST_AT_LEAST_SIZE(xFreeColorsReq); - rc = dixLookupResourceByType((pointer *) &pcmp, stuff->cmap, RT_COLORMAP, + rc = dixLookupResourceByType((void **) &pcmp, stuff->cmap, RT_COLORMAP, client, DixRemoveAccess); if (rc == Success) { int count; @@ -2680,7 +2679,7 @@ ProcStoreColors(ClientPtr client) REQUEST(xStoreColorsReq); REQUEST_AT_LEAST_SIZE(xStoreColorsReq); - rc = dixLookupResourceByType((pointer *) &pcmp, stuff->cmap, RT_COLORMAP, + rc = dixLookupResourceByType((void **) &pcmp, stuff->cmap, RT_COLORMAP, client, DixWriteAccess); if (rc == Success) { int count; @@ -2706,7 +2705,7 @@ ProcStoreNamedColor(ClientPtr client) REQUEST(xStoreNamedColorReq); REQUEST_FIXED_SIZE(xStoreNamedColorReq, stuff->nbytes); - rc = dixLookupResourceByType((pointer *) &pcmp, stuff->cmap, RT_COLORMAP, + rc = dixLookupResourceByType((void **) &pcmp, stuff->cmap, RT_COLORMAP, client, DixWriteAccess); if (rc == Success) { xColorItem def; @@ -2734,7 +2733,7 @@ ProcQueryColors(ClientPtr client) REQUEST(xQueryColorsReq); REQUEST_AT_LEAST_SIZE(xQueryColorsReq); - rc = dixLookupResourceByType((pointer *) &pcmp, stuff->cmap, RT_COLORMAP, + rc = dixLookupResourceByType((void **) &pcmp, stuff->cmap, RT_COLORMAP, client, DixReadAccess); if (rc == Success) { int count; @@ -2781,7 +2780,7 @@ ProcLookupColor(ClientPtr client) REQUEST(xLookupColorReq); REQUEST_FIXED_SIZE(xLookupColorReq, stuff->nbytes); - rc = dixLookupResourceByType((pointer *) &pcmp, stuff->cmap, RT_COLORMAP, + rc = dixLookupResourceByType((void **) &pcmp, stuff->cmap, RT_COLORMAP, client, DixReadAccess); if (rc == Success) { CARD16 exactRed, exactGreen, exactBlue; @@ -2832,7 +2831,7 @@ ProcCreateCursor(ClientPtr client) REQUEST_SIZE_MATCH(xCreateCursorReq); LEGAL_NEW_RESOURCE(stuff->cid, client); - rc = dixLookupResourceByType((pointer *) &src, stuff->source, RT_PIXMAP, + rc = dixLookupResourceByType((void **) &src, stuff->source, RT_PIXMAP, client, DixReadAccess); if (rc != Success) { client->errorValue = stuff->source; @@ -2844,7 +2843,7 @@ ProcCreateCursor(ClientPtr client) /* Find and validate cursor mask pixmap, if one is provided */ if (stuff->mask != None) { - rc = dixLookupResourceByType((pointer *) &msk, stuff->mask, RT_PIXMAP, + rc = dixLookupResourceByType((void **) &msk, stuff->mask, RT_PIXMAP, client, DixReadAccess); if (rc != Success) { client->errorValue = stuff->mask; @@ -2876,7 +2875,7 @@ ProcCreateCursor(ClientPtr client) } (*src->drawable.pScreen->GetImage) ((DrawablePtr) src, 0, 0, width, height, - XYPixmap, 1, (pointer) srcbits); + XYPixmap, 1, (void *) srcbits); if (msk == (PixmapPtr) NULL) { unsigned char *bits = mskbits; @@ -2888,7 +2887,7 @@ ProcCreateCursor(ClientPtr client) memset((char *) mskbits, 0, n); (*msk->drawable.pScreen->GetImage) ((DrawablePtr) msk, 0, 0, width, height, XYPixmap, 1, - (pointer) mskbits); + (void *) mskbits); } cm.width = width; cm.height = height; @@ -2901,7 +2900,7 @@ ProcCreateCursor(ClientPtr client) if (rc != Success) goto bail; - if (!AddResource(stuff->cid, RT_CURSOR, (pointer) pCursor)) { + if (!AddResource(stuff->cid, RT_CURSOR, (void *) pCursor)) { rc = BadAlloc; goto bail; } @@ -2931,7 +2930,7 @@ ProcCreateGlyphCursor(ClientPtr client) &pCursor, client, stuff->cid); if (res != Success) return res; - if (AddResource(stuff->cid, RT_CURSOR, (pointer) pCursor)) + if (AddResource(stuff->cid, RT_CURSOR, (void *) pCursor)) return Success; return BadAlloc; } @@ -2945,7 +2944,7 @@ ProcFreeCursor(ClientPtr client) REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); - rc = dixLookupResourceByType((pointer *) &pCursor, stuff->id, RT_CURSOR, + rc = dixLookupResourceByType((void **) &pCursor, stuff->id, RT_CURSOR, client, DixDestroyAccess); if (rc == Success) { FreeResource(stuff->id, RT_NONE); @@ -3094,10 +3093,10 @@ ProcChangeHosts(ClientPtr client) if (stuff->mode == HostInsert) return AddHost(client, (int) stuff->hostFamily, - stuff->hostLength, (pointer) &stuff[1]); + stuff->hostLength, (void *) &stuff[1]); if (stuff->mode == HostDelete) return RemoveHost(client, (int) stuff->hostFamily, - stuff->hostLength, (pointer) &stuff[1]); + stuff->hostLength, (void *) &stuff[1]); client->errorValue = stuff->mode; return BadValue; } @@ -3108,7 +3107,7 @@ ProcListHosts(ClientPtr client) xListHostsReply reply; int len, nHosts, result; BOOL enabled; - pointer pdata; + void *pdata; /* REQUEST(xListHostsReq); */ @@ -3349,7 +3348,7 @@ CloseDownClient(ClientPtr client) clientinfo.client = client; clientinfo.prefix = (xConnSetupPrefix *) NULL; clientinfo.setup = (xConnSetup *) NULL; - CallCallbacks((&ClientStateCallback), (pointer) &clientinfo); + CallCallbacks((&ClientStateCallback), (void *) &clientinfo); } } client->clientGone = TRUE; /* so events aren't sent to client */ @@ -3379,7 +3378,7 @@ CloseDownClient(ClientPtr client) clientinfo.client = client; clientinfo.prefix = (xConnSetupPrefix *) NULL; clientinfo.setup = (xConnSetup *) NULL; - CallCallbacks((&ClientStateCallback), (pointer) &clientinfo); + CallCallbacks((&ClientStateCallback), (void *) &clientinfo); } TouchListenerGone(client->clientAsMask); FreeClientResources(client); @@ -3414,7 +3413,7 @@ KillAllClients(void) } void -InitClient(ClientPtr client, int i, pointer ospriv) +InitClient(ClientPtr client, int i, void *ospriv) { client->index = i; client->clientAsMask = ((Mask) i) << CLIENTOFFSET; @@ -3424,7 +3423,6 @@ InitClient(ClientPtr client, int i, pointer ospriv) QueryMinMaxKeyCodes(&client->minKC, &client->maxKC); client->smart_start_tick = SmartScheduleTime; client->smart_stop_tick = SmartScheduleTime; - client->smart_check_tick = SmartScheduleTime; client->clientIds = NULL; } @@ -3436,7 +3434,7 @@ InitClient(ClientPtr client, int i, pointer ospriv) *************************/ ClientPtr -NextAvailableClient(pointer ospriv) +NextAvailableClient(void *ospriv) { int i; ClientPtr client; @@ -3476,7 +3474,7 @@ NextAvailableClient(pointer ospriv) clientinfo.client = client; clientinfo.prefix = (xConnSetupPrefix *) NULL; clientinfo.setup = (xConnSetup *) NULL; - CallCallbacks((&ClientStateCallback), (pointer) &clientinfo); + CallCallbacks((&ClientStateCallback), (void *) &clientinfo); } return client; } @@ -3596,7 +3594,7 @@ SendConnSetup(ClientPtr client, const char *reason) clientinfo.client = client; clientinfo.prefix = lconnSetupPrefix; clientinfo.setup = (xConnSetup *) lConnectionInfo; - CallCallbacks((&ClientStateCallback), (pointer) &clientinfo); + CallCallbacks((&ClientStateCallback), (void *) &clientinfo); } return Success; } diff --git a/xserver/dix/dixfonts.c b/xserver/dix/dixfonts.c index 9a686e69c..1c6442c8f 100644 --- a/xserver/dix/dixfonts.c +++ b/xserver/dix/dixfonts.c @@ -70,7 +70,7 @@ Equipment Corporation. #include "xf86bigfontsrv.h" #endif -extern pointer fosNaturalParams; +extern void *fosNaturalParams; extern FontPtr defaultFont; static FontPathElementPtr *font_path_elements = (FontPathElementPtr *) 0; @@ -128,7 +128,7 @@ dixGetGlyphs(FontPtr font, unsigned long count, unsigned char *chars, * adding RT_FONT prevents conflict with default cursor font */ Bool -SetDefaultFont(char *defaultfontname) +SetDefaultFont(const char *defaultfontname) { int err; FontPtr pf; @@ -139,7 +139,7 @@ SetDefaultFont(char *defaultfontname) (unsigned) strlen(defaultfontname), defaultfontname); if (err != Success) return FALSE; - err = dixLookupResourceByType((pointer *) &pf, fid, RT_FONT, serverClient, + err = dixLookupResourceByType((void **) &pf, fid, RT_FONT, serverClient, DixReadAccess); if (err != Success) return FALSE; @@ -197,7 +197,7 @@ RemoveFontWakeup(FontPathElementPtr fpe) } void -FontWakeup(pointer data, int count, pointer LastSelectMask) +FontWakeup(void *data, int count, void *LastSelectMask) { int i; FontPathElementPtr fpe; @@ -224,7 +224,7 @@ FreeFPE(FontPathElementPtr fpe) fpe->refcount--; if (fpe->refcount == 0) { (*fpe_functions[fpe->type].free_fpe) (fpe); - free(fpe->name); + free((void *) fpe->name); free(fpe); } } @@ -267,7 +267,7 @@ doOpenFont(ClientPtr client, OFclosurePtr c) if (client->clientGone) { if (c->current_fpe < c->num_fpes) { fpe = c->fpe_list[c->current_fpe]; - (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe); + (*fpe_functions[fpe->type].client_died) ((void *) client, fpe); } err = Successful; goto bail; @@ -275,7 +275,7 @@ doOpenFont(ClientPtr client, OFclosurePtr c) while (c->current_fpe < c->num_fpes) { fpe = c->fpe_list[c->current_fpe]; err = (*fpe_functions[fpe->type].open_font) - ((pointer) client, fpe, c->flags, + ((void *) client, fpe, c->flags, c->fontname, c->fnamelen, FontFormat, BitmapFormatMaskByte | BitmapFormatMaskBit | @@ -288,7 +288,7 @@ doOpenFont(ClientPtr client, OFclosurePtr c) if (err == FontNameAlias && alias) { newlen = strlen(alias); - newname = (char *) realloc(c->fontname, newlen); + newname = (char *) realloc((char *) c->fontname, newlen); if (!newname) { err = AllocError; break; @@ -350,7 +350,7 @@ doOpenFont(ClientPtr client, OFclosurePtr c) } } } - if (!AddResource(c->fontid, RT_FONT, (pointer) pfont)) { + if (!AddResource(c->fontid, RT_FONT, (void *) pfont)) { err = AllocError; goto bail; } @@ -368,14 +368,14 @@ doOpenFont(ClientPtr client, OFclosurePtr c) FreeFPE(c->fpe_list[i]); } free(c->fpe_list); - free(c->fontname); + free((void *) c->fontname); free(c); return TRUE; } int OpenFont(ClientPtr client, XID fid, Mask flags, unsigned lenfname, - char *pfontname) + const char *pfontname) { OFclosurePtr c; int i; @@ -404,7 +404,7 @@ OpenFont(ClientPtr client, XID fid, Mask flags, unsigned lenfname, cached = FindCachedFontPattern(patternCache, pfontname, lenfname); if (cached && cached->info.cachable) { - if (!AddResource(fid, RT_FONT, (pointer) cached)) + if (!AddResource(fid, RT_FONT, (void *) cached)) return BadAlloc; cached->refcnt++; return Success; @@ -426,7 +426,7 @@ OpenFont(ClientPtr client, XID fid, Mask flags, unsigned lenfname, */ c->fpe_list = malloc(sizeof(FontPathElementPtr) * num_fpes); if (!c->fpe_list) { - free(c->fontname); + free((void *) c->fontname); free(c); return BadAlloc; } @@ -453,7 +453,7 @@ OpenFont(ClientPtr client, XID fid, Mask flags, unsigned lenfname, * \param value must conform to DeleteType */ int -CloseFont(pointer value, XID fid) +CloseFont(void *value, XID fid) { int nscr; ScreenPtr pscr; @@ -571,7 +571,7 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c) if (client->clientGone) { if (c->current.current_fpe < c->num_fpes) { fpe = c->fpe_list[c->current.current_fpe]; - (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe); + (*fpe_functions[fpe->type].client_died) ((void *) client, fpe); } err = Successful; goto bail; @@ -588,7 +588,7 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c) /* This FPE doesn't support/require list_fonts_and_aliases */ err = (*fpe_functions[fpe->type].list_fonts) - ((pointer) c->client, fpe, c->current.pattern, + ((void *) c->client, fpe, c->current.pattern, c->current.patlen, c->current.max_names - c->names->nnames, c->names); @@ -615,7 +615,7 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c) if (!c->current.list_started) { err = (*fpe_functions[fpe->type].start_list_fonts_and_aliases) - ((pointer) c->client, fpe, c->current.pattern, + ((void *) c->client, fpe, c->current.pattern, c->current.patlen, c->current.max_names - c->names->nnames, &c->current.private); if (err == Suspended) { @@ -635,7 +635,7 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c) name = 0; err = (*fpe_functions[fpe->type].list_next_font_or_alias) - ((pointer) c->client, fpe, &name, &namelen, &tmpname, + ((void *) c->client, fpe, &name, &namelen, &tmpname, &resolvedlen, c->current.private); if (err == Suspended) { if (!ClientIsAsleep(client)) @@ -687,7 +687,7 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c) tmpname = 0; (void) (*fpe_functions[fpe->type].list_next_font_or_alias) - ((pointer) c->client, fpe, &tmpname, &tmpnamelen, + ((void *) c->client, fpe, &tmpname, &tmpnamelen, &tmpname, &tmpnamelen, c->current.private); if (--aliascount <= 0) { err = BadFontName; @@ -869,7 +869,7 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c) if (client->clientGone) { if (c->current.current_fpe < c->num_fpes) { fpe = c->fpe_list[c->current.current_fpe]; - (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe); + (*fpe_functions[fpe->type].client_died) ((void *) client, fpe); } err = Successful; goto bail; @@ -1118,12 +1118,12 @@ doPolyText(ClientPtr client, PTclosurePtr c) if (client->clientGone) { fpe = c->pGC->font->fpe; - (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe); + (*fpe_functions[fpe->type].client_died) ((void *) client, fpe); if (ClientIsAsleep(client)) { /* Client has died, but we cannot bail out right now. We need to clean up after the work we did when going to - sleep. Setting the drawable pointer to 0 makes this + sleep. Setting the drawable poiner to 0 makes this happen without any attempts to render or perform other unnecessary activities. */ c->pDraw = (DrawablePtr) 0; @@ -1144,7 +1144,7 @@ doPolyText(ClientPtr client, PTclosurePtr c) the FPE code to clean up after client and avoid further rendering while we clean up after ourself. */ fpe = c->pGC->font->fpe; - (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe); + (*fpe_functions[fpe->type].client_died) ((void *) client, fpe); c->pDraw = (DrawablePtr) 0; } } @@ -1165,7 +1165,7 @@ doPolyText(ClientPtr client, PTclosurePtr c) fid = ((Font) *(c->pElt + 4)) /* big-endian */ |((Font) *(c->pElt + 3)) << 8 | ((Font) *(c->pElt + 2)) << 16 | ((Font) *(c->pElt + 1)) << 24; - err = dixLookupResourceByType((pointer *) &pFont, fid, RT_FONT, + err = dixLookupResourceByType((void **) &pFont, fid, RT_FONT, client, DixUseAccess); if (err != Success) { /* restore pFont for step 4 (described below) */ @@ -1399,7 +1399,7 @@ doImageText(ClientPtr client, ITclosurePtr c) if (client->clientGone) { fpe = c->pGC->font->fpe; - (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe); + (*fpe_functions[fpe->type].client_died) ((void *) client, fpe); err = Success; goto bail; } @@ -1413,7 +1413,7 @@ doImageText(ClientPtr client, ITclosurePtr c) /* Our drawable has disappeared. Treat like client died... ask the FPE code to clean up after client. */ fpe = c->pGC->font->fpe; - (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe); + (*fpe_functions[fpe->type].client_died) ((void *) client, fpe); err = Success; goto bail; } @@ -1537,7 +1537,7 @@ ImageText(ClientPtr client, DrawablePtr pDraw, GC * pGC, int nChars, /* does the necessary magic to figure out the fpe type */ static int -DetermineFPEType(char *pathname) +DetermineFPEType(const char *pathname) { int i; @@ -1633,21 +1633,23 @@ SetFontPathElements(int npaths, unsigned char *paths, int *bad, Bool persist) } /* if error or can't do it, act like it's a new one */ if (!fpe) { + char *name; fpe = malloc(sizeof(FontPathElementRec)); if (!fpe) { err = BadAlloc; goto bail; } - fpe->name = malloc(len + 1); - if (!fpe->name) { + name = malloc(len + 1); + if (!name) { free(fpe); err = BadAlloc; goto bail; } fpe->refcount = 1; - strncpy(fpe->name, (char *) cp, (int) len); - fpe->name[len] = '\0'; + strncpy(name, (char *) cp, (int) len); + name[len] = '\0'; + fpe->name = name; fpe->name_length = len; fpe->type = DetermineFPEType(fpe->name); if (fpe->type == -1) @@ -1656,11 +1658,11 @@ SetFontPathElements(int npaths, unsigned char *paths, int *bad, Bool persist) err = (*fpe_functions[fpe->type].init_fpe) (fpe); if (err != Successful) { if (persist) { - ErrorF + DebugF ("[dix] Could not init font path element %s, removing from list!\n", fpe->name); } - free(fpe->name); + free((void *) fpe->name); free(fpe); } } @@ -1712,9 +1714,10 @@ SetFontPath(ClientPtr client, int npaths, unsigned char *paths) } int -SetDefaultFontPath(char *path) +SetDefaultFontPath(const char *path) { - char *temp_path, *start, *end; + const char *start, *end; + char *temp_path; unsigned char *cp, *pp, *nump, *newpath; int num = 1, len, err, size = 0, bad; @@ -1819,7 +1822,7 @@ DeleteClientFontStuff(ClientPtr client) for (i = 0; i < num_fpes; i++) { fpe = font_path_elements[i]; if (fpe_functions[fpe->type].client_died) - (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe); + (*fpe_functions[fpe->type].client_died) ((void *) client, fpe); } } @@ -1937,7 +1940,7 @@ FreeFonts(void) FontPtr find_old_font(XID id) { - pointer pFont; + void *pFont; dixLookupResourceByType(&pFont, id, RT_NONE, serverClient, DixReadAccess); return (FontPtr) pFont; @@ -1954,7 +1957,7 @@ _X_EXPORT int StoreFontClientFont(FontPtr pfont, Font id) { - return AddResource(id, RT_NONE, (pointer) pfont); + return AddResource(id, RT_NONE, (void *) pfont); } _X_EXPORT @@ -1985,7 +1988,7 @@ init_fs_handlers(FontPathElementPtr fpe, BlockHandlerProcPtr block_handler) } if (fs_handlers_installed == 0) { if (!RegisterBlockAndWakeupHandlers(block_handler, - FontWakeup, (pointer) 0)) + FontWakeup, (void *) 0)) return AllocError; fs_handlers_installed++; } @@ -2002,7 +2005,7 @@ remove_fs_handlers(FontPathElementPtr fpe, BlockHandlerProcPtr block_handler, /* remove the handlers if no one else is using them */ if (--fs_handlers_installed == 0) { RemoveBlockAndWakeupHandlers(block_handler, FontWakeup, - (pointer) 0); + (void *) 0); } } RemoveFontWakeup(fpe); diff --git a/xserver/dix/dixutils.c b/xserver/dix/dixutils.c index c250bb1db..cdd370bd6 100644 --- a/xserver/dix/dixutils.c +++ b/xserver/dix/dixutils.c @@ -199,7 +199,7 @@ dixLookupDrawable(DrawablePtr *pDraw, XID id, ClientPtr client, *pDraw = NULL; - rc = dixLookupResourceByClass((pointer *) &pTmp, id, RC_DRAWABLE, client, + rc = dixLookupResourceByClass((void **) &pTmp, id, RC_DRAWABLE, client, access); if (rc != Success) @@ -236,7 +236,7 @@ dixLookupWindow(WindowPtr *pWin, XID id, ClientPtr client, Mask access) int dixLookupGC(GCPtr *pGC, XID id, ClientPtr client, Mask access) { - return dixLookupResourceByType((pointer *) pGC, id, RT_GC, client, access); + return dixLookupResourceByType((void **) pGC, id, RT_GC, client, access); } int @@ -246,11 +246,11 @@ dixLookupFontable(FontPtr *pFont, XID id, ClientPtr client, Mask access) GC *pGC; client->errorValue = id; /* EITHER font or gc */ - rc = dixLookupResourceByType((pointer *) pFont, id, RT_FONT, client, + rc = dixLookupResourceByType((void **) pFont, id, RT_FONT, client, access); if (rc != BadFont) return rc; - rc = dixLookupResourceByType((pointer *) &pGC, id, RT_GC, client, access); + rc = dixLookupResourceByType((void **) &pGC, id, RT_GC, client, access); if (rc == BadGC) return BadFont; if (rc == Success) @@ -261,7 +261,7 @@ dixLookupFontable(FontPtr *pFont, XID id, ClientPtr client, Mask access) int dixLookupClient(ClientPtr *pClient, XID rid, ClientPtr client, Mask access) { - pointer pRes; + void *pRes; int rc = BadValue, clientIndex = CLIENT_ID(rid); if (!clientIndex || !clients[clientIndex] || (rid & SERVER_BIT)) @@ -296,7 +296,7 @@ AlterSaveSetForClient(ClientPtr client, WindowPtr pWin, unsigned mode, j = 0; if (numnow) { pTmp = client->saveSet; - while ((j < numnow) && (SaveSetWindow(pTmp[j]) != (pointer) pWin)) + while ((j < numnow) && (SaveSetWindow(pTmp[j]) != (void *) pWin)) j++; } if (mode == SetModeInsert) { @@ -362,7 +362,7 @@ NoopDDA(void) typedef struct _BlockHandler { BlockHandlerProcPtr BlockHandler; WakeupHandlerProcPtr WakeupHandler; - pointer blockData; + void *blockData; Bool deleted; } BlockHandlerRec, *BlockHandlerPtr; @@ -378,7 +378,7 @@ static Bool handlerDeleted; * \param pReadMask nor how it represents the det of descriptors */ void -BlockHandler(pointer pTimeout, pointer pReadmask) +BlockHandler(void *pTimeout, void *pReadmask) { int i, j; @@ -413,7 +413,7 @@ BlockHandler(pointer pTimeout, pointer pReadmask) * \param pReadmask the resulting descriptor mask */ void -WakeupHandler(int result, pointer pReadmask) +WakeupHandler(int result, void *pReadmask) { int i, j; @@ -449,7 +449,7 @@ WakeupHandler(int result, pointer pReadmask) Bool RegisterBlockAndWakeupHandlers(BlockHandlerProcPtr blockHandler, WakeupHandlerProcPtr wakeupHandler, - pointer blockData) + void *blockData) { BlockHandlerPtr new; @@ -472,7 +472,7 @@ RegisterBlockAndWakeupHandlers(BlockHandlerProcPtr blockHandler, void RemoveBlockAndWakeupHandlers(BlockHandlerProcPtr blockHandler, WakeupHandlerProcPtr wakeupHandler, - pointer blockData) + void *blockData) { int i; @@ -556,9 +556,8 @@ ProcessWorkQueueZombies(void) } Bool -QueueWorkProc(Bool (*function) - (ClientPtr /* pClient */ , pointer /* closure */ ), - ClientPtr client, pointer closure) +QueueWorkProc(Bool (*function) (ClientPtr pClient, void *closure), + ClientPtr client, void *closure) { WorkQueuePtr q; @@ -586,13 +585,13 @@ typedef struct _SleepQueue { struct _SleepQueue *next; ClientPtr client; ClientSleepProcPtr function; - pointer closure; + void *closure; } SleepQueueRec, *SleepQueuePtr; static SleepQueuePtr sleepQueue = NULL; Bool -ClientSleep(ClientPtr client, ClientSleepProcPtr function, pointer closure) +ClientSleep(ClientPtr client, ClientSleepProcPtr function, void *closure) { SleepQueuePtr q; @@ -666,7 +665,7 @@ static int numCallbackListsToCleanup = 0; static CallbackListPtr **listsToCleanup = NULL; static Bool -_AddCallback(CallbackListPtr *pcbl, CallbackProcPtr callback, pointer data) +_AddCallback(CallbackListPtr *pcbl, CallbackProcPtr callback, void *data) { CallbackPtr cbr; @@ -682,7 +681,7 @@ _AddCallback(CallbackListPtr *pcbl, CallbackProcPtr callback, pointer data) } static Bool -_DeleteCallback(CallbackListPtr *pcbl, CallbackProcPtr callback, pointer data) +_DeleteCallback(CallbackListPtr *pcbl, CallbackProcPtr callback, void *data) { CallbackListPtr cbl = *pcbl; CallbackPtr cbr, pcbr; @@ -709,7 +708,7 @@ _DeleteCallback(CallbackListPtr *pcbl, CallbackProcPtr callback, pointer data) } void -_CallCallbacks(CallbackListPtr *pcbl, pointer call_data) +_CallCallbacks(CallbackListPtr *pcbl, void *call_data) { CallbackListPtr cbl = *pcbl; CallbackPtr cbr, pcbr; @@ -821,7 +820,7 @@ CreateCallbackList(CallbackListPtr *pcbl) /* ===== Public Procedures ===== */ Bool -AddCallback(CallbackListPtr *pcbl, CallbackProcPtr callback, pointer data) +AddCallback(CallbackListPtr *pcbl, CallbackProcPtr callback, void *data) { if (!pcbl) return FALSE; @@ -833,7 +832,7 @@ AddCallback(CallbackListPtr *pcbl, CallbackProcPtr callback, pointer data) } Bool -DeleteCallback(CallbackListPtr *pcbl, CallbackProcPtr callback, pointer data) +DeleteCallback(CallbackListPtr *pcbl, CallbackProcPtr callback, void *data) { if (!pcbl || !*pcbl) return FALSE; @@ -867,3 +866,28 @@ InitCallbackManager(void) { DeleteCallbackManager(); } + +/** + * Coordinates the global GL context used by modules in the X Server + * doing rendering with OpenGL. + * + * When setting a GL context (glXMakeCurrent() or eglMakeCurrent()), + * there is an expensive implied glFlush() required by the GLX and EGL + * APIs, so modules don't want to have to do it on every request. But + * the individual modules using GL also don't know about each other, + * so they have to coordinate who owns the current context. + * + * When you're about to do a MakeCurrent, you should set this variable + * to your context's address, and you can skip MakeCurrent if it's + * already set to yours. + * + * When you're about to do a DestroyContext, you should set this to + * NULL if it's set to your context. + * + * When you're about to do an unbindContext on a DRI driver, you + * should set this to NULL. Despite the unbindContext interface + * sounding like it only unbinds the passed in context, it actually + * unconditionally clears the dispatch table even if the given + * context wasn't current. + */ +void *lastGLContext = NULL; diff --git a/xserver/dix/events.c b/xserver/dix/events.c index 4aaa54c85..b8c67fdfc 100644 --- a/xserver/dix/events.c +++ b/xserver/dix/events.c @@ -580,7 +580,7 @@ XineramaSetWindowPntrs(DeviceIntPtr pDev, WindowPtr pWin) PanoramiXRes *win; int rc, i; - rc = dixLookupResourceByType((pointer *) &win, pWin->drawable.id, + rc = dixLookupResourceByType((void **) &win, pWin->drawable.id, XRT_WINDOW, serverClient, DixReadAccess); if (rc != Success) return FALSE; @@ -1162,7 +1162,7 @@ EnqueueEvent(InternalEvent *ev, DeviceIntPtr device) eventinfo.event = ev; eventinfo.device = device; - CallCallbacks(&DeviceEventCallback, (pointer) &eventinfo); + CallCallbacks(&DeviceEventCallback, (void *) &eventinfo); } if (event->type == ET_Motion) { @@ -2671,6 +2671,9 @@ DeliverOneEvent(InternalEvent *event, DeviceIntPtr dev, enum InputLevel level, case CORE: rc = EventToCore(event, &xE, &count); break; + default: + rc = BadImplementation; + break; } if (rc == Success) { @@ -2832,7 +2835,7 @@ DeliverEvents(WindowPtr pWin, xEvent *xE, int count, WindowPtr otherParent) return deliveries; } -static Bool +Bool PointInBorderSize(WindowPtr pWin, int x, int y) { BoxRec box; @@ -2873,49 +2876,9 @@ PointInBorderSize(WindowPtr pWin, int x, int y) WindowPtr XYToWindow(SpritePtr pSprite, int x, int y) { - WindowPtr pWin; - BoxRec box; + ScreenPtr pScreen = RootWindow(pSprite)->drawable.pScreen; - pSprite->spriteTraceGood = 1; /* root window still there */ - pWin = RootWindow(pSprite)->firstChild; - while (pWin) { - if ((pWin->mapped) && - (x >= pWin->drawable.x - wBorderWidth(pWin)) && - (x < pWin->drawable.x + (int) pWin->drawable.width + - wBorderWidth(pWin)) && - (y >= pWin->drawable.y - wBorderWidth(pWin)) && - (y < pWin->drawable.y + (int) pWin->drawable.height + - wBorderWidth(pWin)) - /* When a window is shaped, a further check - * is made to see if the point is inside - * borderSize - */ - && (!wBoundingShape(pWin) || PointInBorderSize(pWin, x, y)) - && (!wInputShape(pWin) || - RegionContainsPoint(wInputShape(pWin), - x - pWin->drawable.x, - y - pWin->drawable.y, &box)) -#ifdef ROOTLESS - /* In rootless mode windows may be offscreen, even when - * they're in X's stack. (E.g. if the native window system - * implements some form of virtual desktop system). - */ - && !pWin->rootlessUnhittable -#endif - ) { - if (pSprite->spriteTraceGood >= pSprite->spriteTraceSize) { - pSprite->spriteTraceSize += 10; - pSprite->spriteTrace = realloc(pSprite->spriteTrace, - pSprite->spriteTraceSize * - sizeof(WindowPtr)); - } - pSprite->spriteTrace[pSprite->spriteTraceGood++] = pWin; - pWin = pWin->firstChild; - } - else - pWin = pWin->nextSib; - } - return DeepestSpriteWin(pSprite); + return (*pScreen->XYToWindow)(pScreen, pSprite, x, y); } /** @@ -3274,7 +3237,7 @@ InitializeSprite(DeviceIntPtr pDev, WindowPtr pWin) pCursor = RefCursor(pCursor); if (pSprite->current) FreeCursor(pSprite->current, None); - pSprite->current = RefCursor(pCursor); + pSprite->current = pCursor; if (pScreen) { (*pScreen->RealizeCursor) (pDev, pScreen, pSprite->current); @@ -3828,6 +3791,8 @@ MatchForType(const GrabPtr grab, GrabPtr tmp, enum InputLevel level, match = CORE_MATCH; ignore_device = TRUE; break; + default: + return NO_MATCH; } tmp->grabtype = grabtype; @@ -3956,6 +3921,8 @@ CheckPassiveGrabsOnWindow(WindowPtr pWin, return NULL; tempGrab = AllocGrab(NULL); + if (tempGrab == NULL) + return NULL; /* Fill out the grab details, but leave the type for later before * comparing */ @@ -4293,12 +4260,6 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev, thisDev); } if (!deliveries) { - /* XXX: In theory, we could pass the internal events through to - * everything and only convert just before hitting the wire. We can't - * do that yet, so DGE is the last stop for internal events. From here - * onwards, we deal with core/XI events. - */ - sendCore = (IsMaster(thisDev) && thisDev->coreEvents); /* try core event */ if ((sendCore && grab->grabtype == CORE) || grab->grabtype != CORE) @@ -4412,7 +4373,7 @@ RecalculateDeliverableEvents(WindowPtr pWin) * \param value must conform to DeleteType */ int -OtherClientGone(pointer value, XID id) +OtherClientGone(void *value, XID id) { OtherClientsPtr other, prev; WindowPtr pWin = (WindowPtr) value; @@ -4493,7 +4454,7 @@ EventSelectForWindow(WindowPtr pWin, ClientPtr client, Mask mask) others->resource = FakeClientID(client->index); others->next = pWin->optional->otherClients; pWin->optional->otherClients = others; - if (!AddResource(others->resource, RT_OTHERCLIENT, (pointer) pWin)) + if (!AddResource(others->resource, RT_OTHERCLIENT, (void *) pWin)) return BadAlloc; } maskSet: @@ -4980,7 +4941,7 @@ ProcChangeActivePointerGrab(ClientPtr client) if (stuff->cursor == None) newCursor = NullCursor; else { - int rc = dixLookupResourceByType((pointer *) &newCursor, stuff->cursor, + int rc = dixLookupResourceByType((void **) &newCursor, stuff->cursor, RT_CURSOR, client, DixUseAccess); if (rc != Success) { @@ -5051,7 +5012,7 @@ ProcUngrabPointer(ClientPtr client) * @param other_mode GrabModeSync or GrabModeAsync * @param status Return code to be returned to the caller. * - * @returns Success or BadValue. + * @returns Success or BadValue or BadAlloc. */ int GrabDevice(ClientPtr client, DeviceIntPtr dev, @@ -5097,7 +5058,7 @@ GrabDevice(ClientPtr client, DeviceIntPtr dev, if (curs == None) cursor = NullCursor; else { - rc = dixLookupResourceByType((pointer *) &cursor, curs, RT_CURSOR, + rc = dixLookupResourceByType((void **) &cursor, curs, RT_CURSOR, client, DixUseAccess); if (rc != Success) { client->errorValue = curs; @@ -5132,6 +5093,8 @@ GrabDevice(ClientPtr client, DeviceIntPtr dev, GrabPtr tempGrab; tempGrab = AllocGrab(NULL); + if (tempGrab == NULL) + return BadAlloc; tempGrab->next = NULL; tempGrab->window = pWin; @@ -5623,7 +5586,7 @@ ProcGrabButton(ClientPtr client) if (stuff->cursor == None) cursor = NullCursor; else { - rc = dixLookupResourceByType((pointer *) &cursor, stuff->cursor, + rc = dixLookupResourceByType((void **) &cursor, stuff->cursor, RT_CURSOR, client, DixUseAccess); if (rc != Success) { client->errorValue = stuff->cursor; @@ -5877,7 +5840,7 @@ ProcRecolorCursor(ClientPtr client) REQUEST(xRecolorCursorReq); REQUEST_SIZE_MATCH(xRecolorCursorReq); - rc = dixLookupResourceByType((pointer *) &pCursor, stuff->cursor, RT_CURSOR, + rc = dixLookupResourceByType((void **) &pCursor, stuff->cursor, RT_CURSOR, client, DixWriteAccess); if (rc != Success) { client->errorValue = stuff->cursor; @@ -5978,7 +5941,7 @@ WriteEventsToClient(ClientPtr pClient, int count, xEvent *events) eventinfo.client = pClient; eventinfo.events = events; eventinfo.count = count; - CallCallbacks(&EventCallback, (pointer) &eventinfo); + CallCallbacks(&EventCallback, (void *) &eventinfo); } #ifdef XSERVER_DTRACE if (XSERVER_SEND_EVENT_ENABLED()) { diff --git a/xserver/dix/extension.c b/xserver/dix/extension.c index 24e9cb43a..ede4bf5bd 100644 --- a/xserver/dix/extension.c +++ b/xserver/dix/extension.c @@ -77,7 +77,6 @@ AddExtension(const char *name, int NumEvents, int NumErrors, { int i; ExtensionEntry *ext, **newexts; - size_t buflen; if (!MainProc || !SwappedMainProc || !MinorOpcodeProc) return ((ExtensionEntry *) NULL); @@ -97,7 +96,7 @@ AddExtension(const char *name, int NumEvents, int NumErrors, } ext->name = strdup(name); ext->num_aliases = 0; - ext->aliases = (char **) NULL; + ext->aliases = (const char **) NULL; if (!ext->name) { dixFreePrivates(ext->devPrivates, PRIVATE_EXTENSION); free(ext); @@ -107,7 +106,7 @@ AddExtension(const char *name, int NumEvents, int NumErrors, newexts = (ExtensionEntry **) realloc(extensions, (i + 1) * sizeof(ExtensionEntry *)); if (!newexts) { - free(ext->name); + free((void *) ext->name); dixFreePrivates(ext->devPrivates, PRIVATE_EXTENSION); free(ext); return ((ExtensionEntry *) NULL); @@ -148,13 +147,12 @@ Bool AddExtensionAlias(const char *alias, ExtensionEntry * ext) { char *name; - char **aliases; - size_t buflen; + const char **aliases; if (!ext) return FALSE; - aliases = (char **) realloc(ext->aliases, - (ext->num_aliases + 1) * sizeof(char *)); + aliases = realloc(ext->aliases, + (ext->num_aliases + 1) * sizeof(char *)); if (!aliases) return FALSE; ext->aliases = aliases; @@ -231,9 +229,9 @@ CloseDownExtensions(void) if (extensions[i]->CloseDown) extensions[i]->CloseDown(extensions[i]); NumExtensions = i; - free(extensions[i]->name); + free((void *) extensions[i]->name); for (j = extensions[i]->num_aliases; --j >= 0;) - free(extensions[i]->aliases[j]); + free((void *) extensions[i]->aliases[j]); free(extensions[i]->aliases); dixFreePrivates(extensions[i]->devPrivates, PRIVATE_EXTENSION); free(extensions[i]); diff --git a/xserver/dix/gc.c b/xserver/dix/gc.c index f46e0ddc4..88d650121 100644 --- a/xserver/dix/gc.c +++ b/xserver/dix/gc.c @@ -261,12 +261,14 @@ ChangeGC(ClientPtr client, GC * pGC, BITS32 mask, ChangeGCValPtr pUnion) case GCStipple: NEXT_PTR(PixmapPtr, pPixmap); - if ((pPixmap->drawable.depth != 1) || - (pPixmap->drawable.pScreen != pGC->pScreen)) { + if (pPixmap && ((pPixmap->drawable.depth != 1) || + (pPixmap->drawable.pScreen != pGC->pScreen))) + { error = BadMatch; } else { - pPixmap->refcnt++; + if (pPixmap) + pPixmap->refcnt++; if (pGC->stipple) (*pGC->pScreen->DestroyPixmap) (pGC->stipple); pGC->stipple = pPixmap; @@ -339,7 +341,7 @@ ChangeGC(ClientPtr client, GC * pGC, BITS32 mask, ChangeGCValPtr pUnion) pPixmap->refcnt++; } (*pGC->funcs->ChangeClip) (pGC, pPixmap ? CT_PIXMAP : CT_NONE, - (pointer) pPixmap, 0); + (void *) pPixmap, 0); break; case GCDashOffset: NEXTVAL(INT16, pGC->dashOffset); @@ -494,7 +496,7 @@ NewGCObject(ScreenPtr pScreen, int depth) pGC->clipOrg.x = 0; pGC->clipOrg.y = 0; pGC->clientClipType = CT_NONE; - pGC->clientClip = (pointer) NULL; + pGC->clientClip = (void *) NULL; pGC->numInDashList = 2; pGC->dash = DefaultDash; pGC->dashOffset = 0; @@ -764,7 +766,7 @@ CopyGC(GC * pgcSrc, GC * pgcDst, BITS32 mask) * \param value must conform to DeleteType */ int -FreeGC(pointer value, XID gid) +FreeGC(void *value, XID gid) { GCPtr pGC = (GCPtr) value; @@ -1023,7 +1025,7 @@ SetClipRects(GCPtr pGC, int xOrigin, int yOrigin, int nrects, if (size) memmove((char *) prectsNew, (char *) prects, size); - (*pGC->funcs->ChangeClip) (pGC, newct, (pointer) prectsNew, nrects); + (*pGC->funcs->ChangeClip) (pGC, newct, (void *) prectsNew, nrects); if (pGC->funcs->ChangeGC) (*pGC->funcs->ChangeGC) (pGC, GCClipXOrigin | GCClipYOrigin | GCClipMask); diff --git a/xserver/dix/getevents.c b/xserver/dix/getevents.c index 23f9c33f5..ffa89fad2 100644 --- a/xserver/dix/getevents.c +++ b/xserver/dix/getevents.c @@ -1382,10 +1382,10 @@ fill_pointer_events(InternalEvent *events, DeviceIntPtr pDev, int type, { int num_events = 1; DeviceEvent *event; - RawDeviceEvent *raw; + RawDeviceEvent *raw = NULL; double screenx = 0.0, screeny = 0.0; /* desktop coordinate system */ double devx = 0.0, devy = 0.0; /* desktop-wide in device coords */ - int sx, sy; /* for POINTER_SCREEN */ + int sx = 0, sy = 0; /* for POINTER_SCREEN */ ValuatorMask mask; ScreenPtr scr; int num_barrier_events = 0; @@ -1437,7 +1437,7 @@ fill_pointer_events(InternalEvent *events, DeviceIntPtr pDev, int type, transformAbsolute(pDev, &mask); clipAbsolute(pDev, &mask); - if ((flags & POINTER_NORAW) == 0) + if ((flags & POINTER_NORAW) == 0 && raw) set_raw_valuators(raw, &mask, raw->valuators.data); } else { @@ -1445,7 +1445,7 @@ fill_pointer_events(InternalEvent *events, DeviceIntPtr pDev, int type, if (flags & POINTER_ACCELERATE) accelPointer(pDev, &mask, ms); - if ((flags & POINTER_NORAW) == 0) + if ((flags & POINTER_NORAW) == 0 && raw) set_raw_valuators(raw, &mask, raw->valuators.data); moveRelative(pDev, flags, &mask); @@ -1512,7 +1512,8 @@ fill_pointer_events(InternalEvent *events, DeviceIntPtr pDev, int type, event_set_root_coordinates(event, screenx - scr->x, screeny - scr->y); if (flags & POINTER_EMULATED) { - raw->flags = XIPointerEmulated; + if (raw) + raw->flags = XIPointerEmulated; event->flags = XIPointerEmulated; } diff --git a/xserver/dix/globals.c b/xserver/dix/globals.c index f0e6f21b5..21813bb63 100644 --- a/xserver/dix/globals.c +++ b/xserver/dix/globals.c @@ -112,9 +112,9 @@ int defaultScreenSaverAllowExposures = DEFAULT_SCREEN_SAVER_EXPOSURES; Bool screenSaverSuspended = FALSE; #endif -char *defaultFontPath = COMPILEDDEFAULTFONTPATH; -char *defaultTextFont = COMPILEDDEFAULTFONT; -char *defaultCursorFont = COMPILEDCURSORFONT; +const char *defaultFontPath = COMPILEDDEFAULTFONTPATH; +const char *defaultTextFont = COMPILEDDEFAULTFONT; +const char *defaultCursorFont = COMPILEDCURSORFONT; FontPtr defaultFont; /* not declared in dix.h to avoid including font.h in every compilation of dix code */ CursorPtr rootCursor; @@ -130,8 +130,9 @@ TimeStamp currentTime; int defaultColorVisualClass = -1; int monitorResolution = 0; -char *display; -int displayfd; +const char *display; +int displayfd = -1; +Bool explicit_display = FALSE; char *ConnectionInfo; CARD32 TimeOutValue = DEFAULT_TIMEOUT * MILLI_PER_SECOND; diff --git a/xserver/dix/glyphcurs.c b/xserver/dix/glyphcurs.c index 9004cb152..54040253c 100644 --- a/xserver/dix/glyphcurs.c +++ b/xserver/dix/glyphcurs.c @@ -114,7 +114,7 @@ ServerBitsFromGlyph(FontPtr pfont, unsigned ch, CursorMetricPtr cm, /* fill the pixmap with 0 */ gcval[0].val = GXcopy; gcval[1].val = 0; - gcval[2].ptr = (pointer) pfont; + gcval[2].ptr = (void *) pfont; ChangeGC(NullClient, pGC, GCFunction | GCForeground | GCFont, gcval); ValidateGC((DrawablePtr) ppix, pGC); (*pGC->ops->PolyFillRect) ((DrawablePtr) ppix, pGC, 1, &rect); diff --git a/xserver/dix/grabs.c b/xserver/dix/grabs.c index a03897af4..e3fc38bf5 100644 --- a/xserver/dix/grabs.c +++ b/xserver/dix/grabs.c @@ -199,12 +199,11 @@ AllocGrab(const GrabPtr src) free(grab); grab = NULL; } - } - - if (src && !CopyGrab(grab, src)) { - free(grab->xi2mask); - free(grab); - grab = NULL; + else if (src && !CopyGrab(grab, src)) { + free(grab->xi2mask); + free(grab); + grab = NULL; + } } return grab; @@ -317,7 +316,7 @@ CopyGrab(GrabPtr dst, const GrabPtr src) } int -DeletePassiveGrab(pointer value, XID id) +DeletePassiveGrab(void *value, XID id) { GrabPtr g, prev; GrabPtr pGrab = (GrabPtr) value; @@ -564,7 +563,7 @@ AddPassiveGrabToList(ClientPtr client, GrabPtr pGrab) pGrab->next = pGrab->window->optional->passiveGrabs; pGrab->window->optional->passiveGrabs = pGrab; - if (AddResource(pGrab->resource, RT_PASSIVEGRAB, (pointer) pGrab)) + if (AddResource(pGrab->resource, RT_PASSIVEGRAB, (void *) pGrab)) return Success; return BadAlloc; } @@ -662,7 +661,7 @@ DeletePassiveGrabFromList(GrabPtr pMinuendGrab) ok = FALSE; } else if (!AddResource(pNewGrab->resource, RT_PASSIVEGRAB, - (pointer) pNewGrab)) + (void *) pNewGrab)) ok = FALSE; else adds[nadds++] = pNewGrab; diff --git a/xserver/dix/main.c b/xserver/dix/main.c index 05dcbeddd..7427e08ca 100644 --- a/xserver/dix/main.c +++ b/xserver/dix/main.c @@ -168,13 +168,16 @@ dix_main(int argc, char *argv[], char *envp[]) serverClient = calloc(sizeof(ClientRec), 1); if (!serverClient) FatalError("couldn't create server client"); - InitClient(serverClient, 0, (pointer) NULL); + InitClient(serverClient, 0, (void *) NULL); } else ResetWellKnownSockets(); clients[0] = serverClient; currentMaxClients = 1; + /* clear any existing selections */ + InitSelections(); + /* Initialize privates before first allocation */ dixResetPrivates(); @@ -192,7 +195,6 @@ dix_main(int argc, char *argv[], char *envp[]) InitAtoms(); InitEvents(); - InitSelections(); InitGlyphCaching(); dixResetRegistry(); ResetFontPrivateIndex(); diff --git a/xserver/dix/pixmap.c b/xserver/dix/pixmap.c index d5dc3831b..4b880af58 100644 --- a/xserver/dix/pixmap.c +++ b/xserver/dix/pixmap.c @@ -49,7 +49,7 @@ from The Open Group. /* callable by ddx */ PixmapPtr GetScratchPixmapHeader(ScreenPtr pScreen, int width, int height, int depth, - int bitsPerPixel, int devKind, pointer pPixData) + int bitsPerPixel, int devKind, void *pPixData) { PixmapPtr pPixmap = pScreen->pScratchPixmap; diff --git a/xserver/dix/privates.c b/xserver/dix/privates.c index 41b1a7678..e03b2255b 100644 --- a/xserver/dix/privates.c +++ b/xserver/dix/privates.c @@ -259,7 +259,7 @@ fixupDefaultColormaps(FixupFunc fixup, unsigned bytes) for (s = 0; s < screenInfo.numScreens; s++) { ColormapPtr cmap; - dixLookupResourceByType((pointer *) &cmap, + dixLookupResourceByType((void **) &cmap, screenInfo.screens[s]->defColormap, RT_COLORMAP, serverClient, DixCreateAccess); if (cmap && @@ -348,7 +348,7 @@ dixRegisterPrivateKey(DevPrivateKey key, DevPrivateType type, unsigned size) if (size == 0) bytes = sizeof(void *); - /* align to void * size */ + /* align to pointer size */ bytes = (bytes + sizeof(void *) - 1) & ~(sizeof(void *) - 1); /* Update offsets for all affected keys */ @@ -697,7 +697,7 @@ _dixAllocateScreenObjectWithPrivates(ScreenPtr pScreen, privates_size = pScreen->screenSpecificPrivates[type].offset; else privates_size = global_keys[type].offset; - /* round up so that void * is aligned */ + /* round up so that pointer is aligned */ baseSize = (baseSize + sizeof(void *) - 1) & ~(sizeof(void *) - 1); totalSize = baseSize + privates_size; object = malloc(totalSize); diff --git a/xserver/dix/property.c b/xserver/dix/property.c index dec409024..9f51cd0ff 100644 --- a/xserver/dix/property.c +++ b/xserver/dix/property.c @@ -242,7 +242,7 @@ ProcChangeProperty(ClientPtr client) int dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property, Atom type, int format, int mode, unsigned long len, - pointer value, Bool sendevent) + void *value, Bool sendevent) { PropertyPtr pProp; PropertyRec savedProp; @@ -356,7 +356,7 @@ dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property, int ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format, - int mode, unsigned long len, pointer value, Bool sendevent) + int mode, unsigned long len, void *value, Bool sendevent) { return dixChangeWindowProperty(serverClient, pWin, property, type, format, mode, len, value, sendevent); diff --git a/xserver/dix/protocol.txt b/xserver/dix/protocol.txt index 8e152edaa..f83f38c58 100644 --- a/xserver/dix/protocol.txt +++ b/xserver/dix/protocol.txt @@ -311,11 +311,22 @@ R028 RANDR:GetPanning R029 RANDR:SetPanning R030 RANDR:SetOutputPrimary R031 RANDR:GetOutputPrimary +R032 RANDR:RRGetProviders +R033 RANDR:RRGetProviderInfo +R034 RANDR:RRSetProviderOffloadSink +R035 RANDR:RRSetProviderOutputSource +R036 RANDR:RRListProviderProperties +R037 RANDR:RRQueryProviderProperty +R038 RANDR:RRConfigureProviderProperty +R039 RANDR:RRChangeProviderProperty +R040 RANDR:RRDeleteProviderProperty +R041 RANDR:RRGetProviderProperty V000 RANDR:ScreenChangeNotify V001 RANDR:Notify E000 RANDR:BadRROutput E001 RANDR:BadRRCrtc E002 RANDR:BadRRMode +E003 RANDR:BadRRProvider R000 RECORD:QueryVersion R001 RECORD:CreateContext R002 RECORD:RegisterClients diff --git a/xserver/dix/resource.c b/xserver/dix/resource.c index 2aafa343c..623d862d6 100644 --- a/xserver/dix/resource.c +++ b/xserver/dix/resource.c @@ -165,7 +165,7 @@ typedef struct _Resource { struct _Resource *next; XID id; RESTYPE type; - pointer value; + void *value; } ResourceRec, *ResourcePtr; typedef struct _ClientResource { @@ -203,7 +203,7 @@ struct ResourceType { * resource can't be determined. */ static void -GetDefaultBytes(pointer value, XID id, ResourceSizePtr size) +GetDefaultBytes(void *value, XID id, ResourceSizePtr size) { size->resourceSize = 0; size->pixmapRefSize = 0; @@ -224,7 +224,7 @@ GetDefaultBytes(pointer value, XID id, ResourceSizePtr size) * @param[out] cdata Pointer to opaque data. */ static void -DefaultFindSubRes(pointer value, FindAllRes func, pointer cdata) +DefaultFindSubRes(void *value, FindAllRes func, void *cdata) { /* do nothing */ } @@ -268,7 +268,7 @@ GetDrawableBytes(DrawablePtr drawable) * pixmap reference. */ static void -GetPixmapBytes(pointer value, XID id, ResourceSizePtr size) +GetPixmapBytes(void *value, XID id, ResourceSizePtr size) { PixmapPtr pixmap = value; @@ -297,7 +297,7 @@ GetPixmapBytes(pointer value, XID id, ResourceSizePtr size) * pixmap references of a window. */ static void -GetWindowBytes(pointer value, XID id, ResourceSizePtr size) +GetWindowBytes(void *value, XID id, ResourceSizePtr size) { SizeType pixmapSizeFunc = GetResourceTypeSizeFunc(RT_PIXMAP); ResourceSizeRec pixmapSize = { 0, 0, 0 }; @@ -339,7 +339,7 @@ GetWindowBytes(pointer value, XID id, ResourceSizePtr size) * @param[out] cdata Pointer to opaque data */ static void -FindWindowSubRes(pointer value, FindAllRes func, pointer cdata) +FindWindowSubRes(void *value, FindAllRes func, void *cdata) { WindowPtr window = value; @@ -370,7 +370,7 @@ FindWindowSubRes(pointer value, FindAllRes func, pointer cdata) * pixmap references of a graphics context. */ static void -GetGcBytes(pointer value, XID id, ResourceSizePtr size) +GetGcBytes(void *value, XID id, ResourceSizePtr size) { SizeType pixmapSizeFunc = GetResourceTypeSizeFunc(RT_PIXMAP); ResourceSizeRec pixmapSize = { 0, 0, 0 }; @@ -411,7 +411,7 @@ GetGcBytes(pointer value, XID id, ResourceSizePtr size) * @param[out] cdata Pointer to opaque data */ static void -FindGCSubRes(pointer value, FindAllRes func, pointer cdata) +FindGCSubRes(void *value, FindAllRes func, void *cdata) { GCPtr gc = value; @@ -743,7 +743,7 @@ GetXIDList(ClientPtr pClient, unsigned count, XID *pids) unsigned int found = 0; XID rc, id = pClient->clientAsMask; XID maxid; - pointer val; + void *val; maxid = id | RESOURCE_ID_MASK; while ((found < count) && (id <= maxid)) { @@ -787,7 +787,7 @@ FakeClientID(int client) } Bool -AddResource(XID id, RESTYPE type, pointer value) +AddResource(XID id, RESTYPE type, void *value) { int client; ClientResourceRec *rrec; @@ -948,7 +948,7 @@ FreeResourceByType(XID id, RESTYPE type, Bool skipFree) */ Bool -ChangeResourceValue(XID id, RESTYPE rtype, pointer value) +ChangeResourceValue(XID id, RESTYPE rtype, void *value) { int cid; ResourcePtr res; @@ -973,7 +973,7 @@ ChangeResourceValue(XID id, RESTYPE rtype, pointer value) void FindClientResourcesByType(ClientPtr client, - RESTYPE type, FindResType func, pointer cdata) + RESTYPE type, FindResType func, void *cdata) { ResourcePtr *resources; ResourcePtr this, next; @@ -998,17 +998,17 @@ FindClientResourcesByType(ClientPtr client, } } -void FindSubResources(pointer resource, +void FindSubResources(void *resource, RESTYPE type, FindAllRes func, - pointer cdata) + void *cdata) { struct ResourceType rtype = resourceTypes[type & TypeMask]; rtype.findSubResFunc(resource, func, cdata); } void -FindAllClientResources(ClientPtr client, FindAllRes func, pointer cdata) +FindAllClientResources(ClientPtr client, FindAllRes func, void *cdata) { ResourcePtr *resources; ResourcePtr this, next; @@ -1031,14 +1031,14 @@ FindAllClientResources(ClientPtr client, FindAllRes func, pointer cdata) } } -pointer +void * LookupClientResourceComplex(ClientPtr client, RESTYPE type, - FindComplexResType func, pointer cdata) + FindComplexResType func, void *cdata) { ResourcePtr *resources; ResourcePtr this, next; - pointer value; + void *value; int i; if (!client) @@ -1158,7 +1158,7 @@ FreeAllResources(void) Bool LegalNewID(XID id, ClientPtr client) { - pointer val; + void *val; int rc; #ifdef PANORAMIX @@ -1181,7 +1181,7 @@ LegalNewID(XID id, ClientPtr client) } int -dixLookupResourceByType(pointer *result, XID id, RESTYPE rtype, +dixLookupResourceByType(void **result, XID id, RESTYPE rtype, ClientPtr client, Mask mode) { int cid = CLIENT_ID(id); @@ -1216,7 +1216,7 @@ dixLookupResourceByType(pointer *result, XID id, RESTYPE rtype, } int -dixLookupResourceByClass(pointer *result, XID id, RESTYPE rclass, +dixLookupResourceByClass(void **result, XID id, RESTYPE rclass, ClientPtr client, Mask mode) { int cid = CLIENT_ID(id); diff --git a/xserver/dix/touch.c b/xserver/dix/touch.c index a7ea213ba..1eeed78bd 100644 --- a/xserver/dix/touch.c +++ b/xserver/dix/touch.c @@ -75,7 +75,7 @@ static unsigned char resize_waiting[(MAXDEVICES + 7) / 8]; * anyway and re-executing this won't help. */ static Bool -TouchResizeQueue(ClientPtr client, pointer closure) +TouchResizeQueue(ClientPtr client, void *closure) { int i; diff --git a/xserver/dix/window.c b/xserver/dix/window.c index 0e9109e89..f4acdc889 100644 --- a/xserver/dix/window.c +++ b/xserver/dix/window.c @@ -227,7 +227,7 @@ log_window_info(WindowPtr pWin, int depth) win_name = get_window_name(pWin); ErrorF("win 0x%.8x (%s), [%d, %d] to [%d, %d]", - pWin->drawable.id, + (unsigned) pWin->drawable.id, win_name ? win_name : "no name", pWin->drawable.x, pWin->drawable.y, pWin->drawable.x + pWin->drawable.width, @@ -240,7 +240,7 @@ log_window_info(WindowPtr pWin, int depth) ErrorF(" (%s compositing: pixmap %x)", (pWin->redirectDraw == RedirectDrawAutomatic) ? "automatic" : "manual", - pScreen->GetWindowPixmap(pWin)->drawable.id); + (unsigned) pScreen->GetWindowPixmap(pWin)->drawable.id); #endif switch (pWin->visibility) { @@ -283,7 +283,7 @@ PrintWindowTree(void) for (scrnum = 0; scrnum < screenInfo.numScreens; scrnum++) { pScreen = screenInfo.screens[scrnum]; ErrorF("[dix] Dumping windows for screen %d (pixmap %x):\n", scrnum, - pScreen->GetScreenPixmap(pScreen)->drawable.id); + (unsigned) pScreen->GetScreenPixmap(pScreen)->drawable.id); pWin = pScreen->root; depth = 1; while (pWin) { @@ -305,7 +305,7 @@ PrintWindowTree(void) } int -TraverseTree(WindowPtr pWin, VisitWindowProcPtr func, pointer data) +TraverseTree(WindowPtr pWin, VisitWindowProcPtr func, void *data) { int result; WindowPtr pChild; @@ -338,7 +338,7 @@ TraverseTree(WindowPtr pWin, VisitWindowProcPtr func, pointer data) *****/ int -WalkTree(ScreenPtr pScreen, VisitWindowProcPtr func, pointer data) +WalkTree(ScreenPtr pScreen, VisitWindowProcPtr func, void *data) { return (TraverseTree(pScreen->root, func, data)); } @@ -363,7 +363,7 @@ SetWindowToDefaults(WindowPtr pWin) pWin->backingStore = NotUseful; pWin->DIXsaveUnder = FALSE; - pWin->backStorage = (pointer) NULL; + pWin->backStorage = (void *) NULL; pWin->mapped = FALSE; /* off */ pWin->realized = FALSE; /* off */ @@ -524,7 +524,7 @@ CreateRootWindow(ScreenPtr pScreen) RT_WINDOW, pWin, RT_NONE, NULL, DixCreateAccess)) return FALSE; - if (!AddResource(pWin->drawable.id, RT_WINDOW, (pointer) pWin)) + if (!AddResource(pWin->drawable.id, RT_WINDOW, (void *) pWin)) return FALSE; if (disableBackingStore) @@ -959,7 +959,7 @@ CrushTree(WindowPtr pWin) *****/ int -DeleteWindow(pointer value, XID wid) +DeleteWindow(void *value, XID wid) { WindowPtr pParent; WindowPtr pWin = (WindowPtr) value; @@ -1107,7 +1107,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client) * incremented. */ } else { - rc = dixLookupResourceByType((pointer *) &pPixmap, pixID, + rc = dixLookupResourceByType((void **) &pPixmap, pixID, RT_PIXMAP, client, DixReadAccess); if (rc == Success) { if ((pPixmap->drawable.depth != pWin->drawable.depth) || @@ -1161,7 +1161,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client) pixID = pWin->parent->border.pixmap->drawable.id; } } - rc = dixLookupResourceByType((pointer *) &pPixmap, pixID, RT_PIXMAP, + rc = dixLookupResourceByType((void **) &pPixmap, pixID, RT_PIXMAP, client, DixReadAccess); if (rc == Success) { if ((pPixmap->drawable.depth != pWin->drawable.depth) || @@ -1308,7 +1308,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client) error = BadMatch; goto PatchUp; } - rc = dixLookupResourceByType((pointer *) &pCmap, cmap, RT_COLORMAP, + rc = dixLookupResourceByType((void **) &pCmap, cmap, RT_COLORMAP, client, DixUseAccess); if (rc != Success) { error = rc; @@ -1378,7 +1378,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client) pCursor = (CursorPtr) None; } else { - rc = dixLookupResourceByType((pointer *) &pCursor, cursorID, + rc = dixLookupResourceByType((void **) &pCursor, cursorID, RT_CURSOR, client, DixUseAccess); if (rc != Success) { error = rc; @@ -2377,7 +2377,7 @@ CirculateWindow(WindowPtr pParent, int direction, ClientPtr client) } static int -CompareWIDs(WindowPtr pWin, pointer value) +CompareWIDs(WindowPtr pWin, void *value) { /* must conform to VisitWindowProcPtr */ Window *wid = (Window *) value; @@ -2402,7 +2402,7 @@ ReparentWindow(WindowPtr pWin, WindowPtr pParent, ScreenPtr pScreen; pScreen = pWin->drawable.pScreen; - if (TraverseTree(pWin, CompareWIDs, (pointer) &pParent->drawable.id) == + if (TraverseTree(pWin, CompareWIDs, (void *) &pParent->drawable.id) == WT_STOPWALKING) return BadMatch; if (!MakeWindowOptional(pWin)) @@ -2688,7 +2688,7 @@ UnrealizeTree(WindowPtr pWin, Bool fromConfigure) #ifdef PANORAMIX if (!noPanoramiXExtension && !pChild->drawable.pScreen->myNum) { PanoramiXRes *win; - int rc = dixLookupResourceByType((pointer *) &win, + int rc = dixLookupResourceByType((void **) &win, pChild->drawable.id, XRT_WINDOW, serverClient, DixWriteAccess); @@ -3167,7 +3167,7 @@ TileScreenSaver(ScreenPtr pScreen, int kind) &cursor, serverClient, (XID) 0); if (cursor) { cursorID = FakeClientID(0); - if (AddResource(cursorID, RT_CURSOR, (pointer) cursor)) { + if (AddResource(cursorID, RT_CURSOR, (void *) cursor)) { attributes[attri] = cursorID; mask |= CWCursor; } @@ -3196,7 +3196,7 @@ TileScreenSaver(ScreenPtr pScreen, int kind) return FALSE; if (!AddResource(pWin->drawable.id, RT_WINDOW, - (pointer) pScreen->screensaver.pWindow)) + (void *) pScreen->screensaver.pWindow)) return FALSE; if (mask & CWBackPixmap) { diff --git a/xserver/doc/Makefile.in b/xserver/doc/Makefile.in index ed460d86d..53f935472 100644 --- a/xserver/doc/Makefile.in +++ b/xserver/doc/Makefile.in @@ -191,6 +191,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -235,6 +237,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -337,7 +343,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -346,6 +355,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -412,6 +422,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/doc/dtrace/Makefile.in b/xserver/doc/dtrace/Makefile.in index e58da4ff0..21b68a4ac 100644 --- a/xserver/doc/dtrace/Makefile.in +++ b/xserver/doc/dtrace/Makefile.in @@ -182,6 +182,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -226,6 +228,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -328,7 +334,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -337,6 +346,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -403,6 +413,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/dri3/Makefile.in b/xserver/dri3/Makefile.in index ae22ab258..d756874ba 100644 --- a/xserver/dri3/Makefile.in +++ b/xserver/dri3/Makefile.in @@ -192,6 +192,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -236,6 +238,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -338,7 +344,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -347,6 +356,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -413,6 +423,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/dri3/dri3.h b/xserver/dri3/dri3.h index 7c0c33018..edc7fa267 100644 --- a/xserver/dri3/dri3.h +++ b/xserver/dri3/dri3.h @@ -30,12 +30,17 @@ #include <X11/extensions/dri3proto.h> #include <randrstr.h> -#define DRI3_SCREEN_INFO_VERSION 0 +#define DRI3_SCREEN_INFO_VERSION 1 typedef int (*dri3_open_proc)(ScreenPtr screen, RRProviderPtr provider, int *fd); +typedef int (*dri3_open_client_proc)(ClientPtr client, + ScreenPtr screen, + RRProviderPtr provider, + int *fd); + typedef PixmapPtr (*dri3_pixmap_from_fd_proc) (ScreenPtr screen, int fd, CARD16 width, @@ -55,11 +60,18 @@ typedef struct dri3_screen_info { dri3_open_proc open; dri3_pixmap_from_fd_proc pixmap_from_fd; dri3_fd_from_pixmap_proc fd_from_pixmap; + + /* Version 1 */ + dri3_open_client_proc open_client; + } dri3_screen_info_rec, *dri3_screen_info_ptr; extern _X_EXPORT Bool dri3_screen_init(ScreenPtr screen, dri3_screen_info_ptr info); +extern _X_EXPORT int +dri3_send_open_reply(ClientPtr client, int fd); + #endif #endif /* _DRI3_H_ */ diff --git a/xserver/dri3/dri3_request.c b/xserver/dri3/dri3_request.c index 4e1408fb5..fe45620c9 100644 --- a/xserver/dri3/dri3_request.c +++ b/xserver/dri3/dri3_request.c @@ -55,16 +55,35 @@ proc_dri3_query_version(ClientPtr client) return Success; } -static int -proc_dri3_open(ClientPtr client) +int +dri3_send_open_reply(ClientPtr client, int fd) { - REQUEST(xDRI3OpenReq); xDRI3OpenReply rep = { .type = X_Reply, .nfd = 1, .sequenceNumber = client->sequence, .length = 0, }; + + if (client->swapped) { + swaps(&rep.sequenceNumber); + swapl(&rep.length); + } + + if (WriteFdToClient(client, fd, TRUE) < 0) { + close(fd); + return BadAlloc; + } + + WriteToClient(client, sizeof (rep), &rep); + + return Success; +} + +static int +proc_dri3_open(ClientPtr client) +{ + REQUEST(xDRI3OpenReq); RRProviderPtr provider; DrawablePtr drawable; ScreenPtr screen; @@ -92,17 +111,8 @@ proc_dri3_open(ClientPtr client) if (status != Success) return status; - if (client->swapped) { - swaps(&rep.sequenceNumber); - swapl(&rep.length); - } - - if (WriteFdToClient(client, fd, TRUE) < 0) { - close(fd); - return BadAlloc; - } - - WriteToClient(client, sizeof (rep), &rep); + if (client->ignoreCount == 0) + return dri3_send_open_reply(client, fd); return Success; } @@ -168,7 +178,7 @@ proc_dri3_pixmap_from_buffer(ClientPtr client) (*drawable->pScreen->DestroyPixmap) (pixmap); return rc; } - if (AddResource(stuff->pixmap, RT_PIXMAP, (pointer) pixmap)) + if (AddResource(stuff->pixmap, RT_PIXMAP, (void *) pixmap)) return Success; return Success; @@ -189,7 +199,7 @@ proc_dri3_buffer_from_pixmap(ClientPtr client) PixmapPtr pixmap; REQUEST_SIZE_MATCH(xDRI3BufferFromPixmapReq); - rc = dixLookupResourceByType((pointer *) &pixmap, stuff->pixmap, RT_PIXMAP, + rc = dixLookupResourceByType((void **) &pixmap, stuff->pixmap, RT_PIXMAP, client, DixWriteAccess); if (rc != Success) { client->errorValue = stuff->pixmap; diff --git a/xserver/dri3/dri3_screen.c b/xserver/dri3/dri3_screen.c index c88029612..6c0c60cbf 100644 --- a/xserver/dri3/dri3_screen.c +++ b/xserver/dri3/dri3_screen.c @@ -30,6 +30,14 @@ #include <misyncshm.h> #include <randrstr.h> +static inline Bool has_open(dri3_screen_info_ptr info) { + if (info == NULL) + return FALSE; + + return info->open != NULL || + (info->version >= 1 && info->open_client != NULL); +} + int dri3_open(ClientPtr client, ScreenPtr screen, RRProviderPtr provider, int *fd) { @@ -37,10 +45,14 @@ dri3_open(ClientPtr client, ScreenPtr screen, RRProviderPtr provider, int *fd) dri3_screen_info_ptr info = ds->info; int rc; - if (!info || !info->open) + if (!has_open(info)) return BadMatch; - rc = (*info->open) (screen, provider, fd); + if (info->version >= 1 && info->open_client != NULL) + rc = (*info->open_client) (client, screen, provider, fd); + else + rc = (*info->open) (screen, provider, fd); + if (rc != Success) return rc; diff --git a/xserver/exa/Makefile.in b/xserver/exa/Makefile.in index 96c32fae3..ea840749f 100644 --- a/xserver/exa/Makefile.in +++ b/xserver/exa/Makefile.in @@ -195,6 +195,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -239,6 +241,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -341,7 +347,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -350,6 +359,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -416,6 +426,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/exa/exa.c b/xserver/exa/exa.c index f8e499c2b..a2995db24 100644 --- a/xserver/exa/exa.c +++ b/xserver/exa/exa.c @@ -475,7 +475,7 @@ static void exaCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst); static void - exaChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects); + exaChangeClip(GCPtr pGC, int type, void *pvalue, int nrects); static void exaCopyClip(GCPtr pGCDst, GCPtr pGCSrc); @@ -579,7 +579,7 @@ exaCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst) } static void -exaChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects) +exaChangeClip(GCPtr pGC, int type, void *pvalue, int nrects) { ExaGCPriv(pGC); swap(pExaGC, pGC, funcs); @@ -620,8 +620,8 @@ exaCreateGC(GCPtr pGC) swap(pExaScr, pScreen, CreateGC); if ((ret = (*pScreen->CreateGC) (pGC))) { - wrap(pExaGC, pGC, funcs, (GCFuncs *) &exaGCFuncs); - wrap(pExaGC, pGC, ops, (GCOps *) &exaOps); + wrap(pExaGC, pGC, funcs, &exaGCFuncs); + wrap(pExaGC, pGC, ops, &exaOps); } swap(pExaScr, pScreen, CreateGC); @@ -702,8 +702,8 @@ exaCreateScreenResources(ScreenPtr pScreen) } static void -ExaBlockHandler(ScreenPtr pScreen, pointer pTimeout, - pointer pReadmask) +ExaBlockHandler(ScreenPtr pScreen, void *pTimeout, + void *pReadmask) { ExaScreenPriv(pScreen); @@ -733,7 +733,7 @@ ExaBlockHandler(ScreenPtr pScreen, pointer pTimeout, static void ExaWakeupHandler(ScreenPtr pScreen, unsigned long result, - pointer pReadmask) + void *pReadmask) { ExaScreenPriv(pScreen); diff --git a/xserver/exa/exa.h b/xserver/exa/exa.h index be022b2db..98d094dff 100644 --- a/xserver/exa/exa.h +++ b/xserver/exa/exa.h @@ -58,7 +58,7 @@ struct _ExaOffscreenArea { int offset; /* aligned offset */ int size; /* total allocation size */ unsigned last_use; - pointer privData; + void *privData; ExaOffscreenSaveProc save; @@ -685,7 +685,7 @@ typedef struct _ExaDriver { */ Bool (*ModifyPixmapHeader) (PixmapPtr pPixmap, int width, int height, int depth, int bitsPerPixel, int devKind, - pointer pPixData); + void *pPixData); /* hooks for drivers with tiling support: * driver MUST fill out new_fb_pitch with valid pitch of pixmap @@ -784,7 +784,7 @@ extern _X_EXPORT ExaOffscreenArea *exaOffscreenAlloc(ScreenPtr pScreen, int size, int align, Bool locked, ExaOffscreenSaveProc save, - pointer privData); + void *privData); extern _X_EXPORT ExaOffscreenArea *exaOffscreenFree(ScreenPtr pScreen, ExaOffscreenArea * area); diff --git a/xserver/exa/exa_accel.c b/xserver/exa/exa_accel.c index 0e948f414..9c742bdc9 100644 --- a/xserver/exa/exa_accel.c +++ b/xserver/exa/exa_accel.c @@ -1039,7 +1039,6 @@ exaFillRegionSolid(DrawablePtr pDrawable, RegionPtr pRegion, Pixel pixel, pExaPixmap->sys_ptr && pDrawable->type == DRAWABLE_PIXMAP && pDrawable->width == 1 && pDrawable->height == 1 && pDrawable->bitsPerPixel != 24) { - ExaPixmapPriv(pPixmap); RegionPtr pending_damage = DamagePendingRegion(pExaPixmap->pDamage); switch (pDrawable->bitsPerPixel) { diff --git a/xserver/exa/exa_classic.c b/xserver/exa/exa_classic.c index 0fa422fcd..a6a60e50c 100644 --- a/xserver/exa/exa_classic.c +++ b/xserver/exa/exa_classic.c @@ -147,7 +147,7 @@ exaCreatePixmap_classic(ScreenPtr pScreen, int w, int h, int depth, Bool exaModifyPixmapHeader_classic(PixmapPtr pPixmap, int width, int height, int depth, int bitsPerPixel, int devKind, - pointer pPixData) + void *pPixData) { ScreenPtr pScreen; ExaScreenPrivPtr pExaScr; diff --git a/xserver/exa/exa_driver.c b/xserver/exa/exa_driver.c index d467ca928..8799a798e 100644 --- a/xserver/exa/exa_driver.c +++ b/xserver/exa/exa_driver.c @@ -130,7 +130,7 @@ exaCreatePixmap_driver(ScreenPtr pScreen, int w, int h, int depth, Bool exaModifyPixmapHeader_driver(PixmapPtr pPixmap, int width, int height, int depth, int bitsPerPixel, int devKind, - pointer pPixData) + void *pPixData) { ScreenPtr pScreen; ExaScreenPrivPtr pExaScr; @@ -218,7 +218,7 @@ exaPixmapHasGpuCopy_driver(PixmapPtr pPixmap) ScreenPtr pScreen = pPixmap->drawable.pScreen; ExaScreenPriv(pScreen); - pointer saved_ptr; + void *saved_ptr; Bool ret; saved_ptr = pPixmap->devPrivate.ptr; diff --git a/xserver/exa/exa_glyphs.c b/xserver/exa/exa_glyphs.c index 71f750fb6..aa71b215e 100644 --- a/xserver/exa/exa_glyphs.c +++ b/xserver/exa/exa_glyphs.c @@ -127,7 +127,7 @@ exaUnrealizeGlyphCaches(ScreenPtr pScreen, unsigned int format) continue; if (cache->picture) { - FreePicture((pointer) cache->picture, (XID) 0); + FreePicture((void *) cache->picture, (XID) 0); cache->picture = NULL; } @@ -225,7 +225,7 @@ exaRealizeGlyphCaches(ScreenPtr pScreen, unsigned int format) } /* Each cache references the picture individually */ - FreePicture((pointer) pPicture, (XID) 0); + FreePicture((void *) pPicture, (XID) 0); return TRUE; bail: @@ -737,7 +737,7 @@ exaGlyphs(CARD8 op, /* The driver can't seem to composite to a8, let's try argb (but * without component-alpha) */ - FreePicture((pointer) pMask, (XID) 0); + FreePicture((void *) pMask, (XID) 0); argbFormat = PictureMatchFormat(pScreen, 32, PICT_a8r8g8b8); @@ -833,7 +833,7 @@ exaGlyphs(CARD8 op, pDst, xSrc + x - first_xOff, ySrc + y - first_yOff, 0, 0, x, y, width, height); - FreePicture((pointer) pMask, (XID) 0); + FreePicture((void *) pMask, (XID) 0); (*pScreen->DestroyPixmap) (pMaskPixmap); } } diff --git a/xserver/exa/exa_migration_classic.c b/xserver/exa/exa_migration_classic.c index e890f6754..f712e1914 100644 --- a/xserver/exa/exa_migration_classic.c +++ b/xserver/exa/exa_migration_classic.c @@ -350,7 +350,7 @@ exaDoMoveInPixmap(ExaMigrationPtr migrate) pExaPixmap->area = exaOffscreenAlloc(pScreen, pExaPixmap->fb_size, pExaScr->info->pixmapOffsetAlign, FALSE, - exaPixmapSave, (pointer) pPixmap); + exaPixmapSave, (void *) pPixmap); if (pExaPixmap->area == NULL) return; @@ -465,12 +465,12 @@ exaMigrateTowardFb(ExaMigrationPtr migrate) if (pExaPixmap->score == EXA_PIXMAP_SCORE_PINNED) { DBG_MIGRATE(("UseScreen: not migrating pinned pixmap %p\n", - (pointer) pPixmap)); + (void *) pPixmap)); return; } DBG_MIGRATE(("UseScreen %p score %d\n", - (pointer) pPixmap, pExaPixmap->score)); + (void *) pPixmap, pExaPixmap->score)); if (pExaPixmap->score == EXA_PIXMAP_SCORE_INIT) { exaDoMoveInPixmap(migrate); @@ -504,7 +504,7 @@ exaMigrateTowardSys(ExaMigrationPtr migrate) ExaPixmapPriv(pPixmap); - DBG_MIGRATE(("UseMem: %p score %d\n", (pointer) pPixmap, + DBG_MIGRATE(("UseMem: %p score %d\n", (void *) pPixmap, pExaPixmap->score)); if (pExaPixmap->score == EXA_PIXMAP_SCORE_PINNED) diff --git a/xserver/exa/exa_mixed.c b/xserver/exa/exa_mixed.c index b43dfec42..f618a1ea8 100644 --- a/xserver/exa/exa_mixed.c +++ b/xserver/exa/exa_mixed.c @@ -125,7 +125,7 @@ exaCreatePixmap_mixed(ScreenPtr pScreen, int w, int h, int depth, Bool exaModifyPixmapHeader_mixed(PixmapPtr pPixmap, int width, int height, int depth, - int bitsPerPixel, int devKind, pointer pPixData) + int bitsPerPixel, int devKind, void *pPixData) { ScreenPtr pScreen; ExaScreenPrivPtr pExaScr; @@ -282,7 +282,7 @@ exaPixmapHasGpuCopy_mixed(PixmapPtr pPixmap) ExaScreenPriv(pScreen); ExaPixmapPriv(pPixmap); - pointer saved_ptr; + void *saved_ptr; Bool ret; if (!pExaPixmap->driverPriv) diff --git a/xserver/exa/exa_offscreen.c b/xserver/exa/exa_offscreen.c index 1f571cf22..e28734898 100644 --- a/xserver/exa/exa_offscreen.c +++ b/xserver/exa/exa_offscreen.c @@ -160,7 +160,7 @@ exaFindAreaToEvict(ExaScreenPrivPtr pExaScr, int size, int align) */ ExaOffscreenArea * exaOffscreenAlloc(ScreenPtr pScreen, int size, int align, - Bool locked, ExaOffscreenSaveProc save, pointer privData) + Bool locked, ExaOffscreenSaveProc save, void *privData) { ExaOffscreenArea *area; diff --git a/xserver/exa/exa_priv.h b/xserver/exa/exa_priv.h index 1f5605687..61a1f4ccb 100644 --- a/xserver/exa/exa_priv.h +++ b/xserver/exa/exa_priv.h @@ -248,11 +248,19 @@ extern DevPrivateKeyRec exaScreenPrivateKeyRec; real->mem = priv->Saved##mem; \ } +#ifdef HAVE_TYPEOF +#define swap(priv, real, mem) {\ + typeof(real->mem) tmp = priv->Saved##mem; \ + priv->Saved##mem = real->mem; \ + real->mem = tmp; \ +} +#else #define swap(priv, real, mem) {\ void *tmp = priv->Saved##mem; \ priv->Saved##mem = real->mem; \ real->mem = tmp; \ } +#endif #define EXA_PRE_FALLBACK(_screen_) \ ExaScreenPriv(_screen_); \ @@ -333,8 +341,8 @@ typedef struct { typedef struct { /* GC values from the layer below. */ - GCOps *Savedops; - GCFuncs *Savedfuncs; + const GCOps *Savedops; + const GCFuncs *Savedfuncs; } ExaGCPrivRec, *ExaGCPrivPtr; typedef struct { @@ -422,13 +430,13 @@ void ExaCheckImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y, unsigned int nglyph, - CharInfoPtr * ppci, pointer pglyphBase); + CharInfoPtr * ppci, void *pglyphBase); void ExaCheckPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y, unsigned int nglyph, - CharInfoPtr * ppci, pointer pglyphBase); + CharInfoPtr * ppci, void *pglyphBase); void @@ -601,7 +609,7 @@ Bool exaModifyPixmapHeader_classic(PixmapPtr pPixmap, int width, int height, int depth, int bitsPerPixel, int devKind, - pointer pPixData); + void *pPixData); Bool exaDestroyPixmap_classic(PixmapPtr pPixmap); @@ -619,7 +627,7 @@ Bool exaModifyPixmapHeader_driver(PixmapPtr pPixmap, int width, int height, int depth, int bitsPerPixel, int devKind, - pointer pPixData); + void *pPixData); Bool exaDestroyPixmap_driver(PixmapPtr pPixmap); @@ -636,7 +644,7 @@ exaCreatePixmap_mixed(ScreenPtr pScreen, int w, int h, int depth, Bool exaModifyPixmapHeader_mixed(PixmapPtr pPixmap, int width, int height, int depth, - int bitsPerPixel, int devKind, pointer pPixData); + int bitsPerPixel, int devKind, void *pPixData); Bool exaDestroyPixmap_mixed(PixmapPtr pPixmap); diff --git a/xserver/exa/exa_render.c b/xserver/exa/exa_render.c index 172e2b56d..c4edf407e 100644 --- a/xserver/exa/exa_render.c +++ b/xserver/exa/exa_render.c @@ -915,7 +915,7 @@ exaComposite(CARD8 op, if (!pSrc->repeat && xSrc >= 0 && ySrc >= 0 && (xSrc + width <= pSrc->pDrawable->width) && (ySrc + height <= pSrc->pDrawable->height)) { - Bool ret; + Bool suc; xDst += pDst->pDrawable->x; yDst += pDst->pDrawable->y; @@ -927,7 +927,7 @@ exaComposite(CARD8 op, yDst, width, height)) goto done; - ret = exaHWCopyNtoN(pSrc->pDrawable, pDst->pDrawable, NULL, + suc = exaHWCopyNtoN(pSrc->pDrawable, pDst->pDrawable, NULL, RegionRects(®ion), RegionNumRects(®ion), xSrc - xDst, ySrc - yDst, FALSE, FALSE); @@ -939,7 +939,7 @@ exaComposite(CARD8 op, xSrc -= pSrc->pDrawable->x; ySrc -= pSrc->pDrawable->y; - if (!ret) + if (!suc) goto fallback; goto done; diff --git a/xserver/exa/exa_unaccel.c b/xserver/exa/exa_unaccel.c index b0a0011cb..b0c6344a5 100644 --- a/xserver/exa/exa_unaccel.c +++ b/xserver/exa/exa_unaccel.c @@ -319,7 +319,7 @@ ExaCheckPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, void ExaCheckImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y, unsigned int nglyph, - CharInfoPtr * ppci, pointer pglyphBase) + CharInfoPtr * ppci, void *pglyphBase) { EXA_PRE_FALLBACK_GC(pGC); EXA_FALLBACK(("to %p (%c)\n", pDrawable, exaDrawableLocation(pDrawable))); @@ -334,7 +334,7 @@ ExaCheckImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, void ExaCheckPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y, unsigned int nglyph, - CharInfoPtr * ppci, pointer pglyphBase) + CharInfoPtr * ppci, void *pglyphBase) { EXA_PRE_FALLBACK_GC(pGC); EXA_FALLBACK(("to %p (%c), style %d alu %d\n", pDrawable, @@ -685,7 +685,7 @@ ExaCheckAddTraps(PicturePtr pPicture, EXA_PRE_FALLBACK(pScreen); - EXA_FALLBACK(("to pict %p (%c)\n", + EXA_FALLBACK(("to pict %p (%c)\n", pPicture, exaDrawableLocation(pPicture->pDrawable))); exaPrepareAccess(pPicture->pDrawable, EXA_PREPARE_DEST); swap(pExaScr, ps, AddTraps); diff --git a/xserver/fb/Makefile.am b/xserver/fb/Makefile.am index 89f3babb1..752eabeb7 100644 --- a/xserver/fb/Makefile.am +++ b/xserver/fb/Makefile.am @@ -22,6 +22,7 @@ libfb_la_SOURCES = \ fbbits.h \ fbblt.c \ fbbltone.c \ + fbcmap_mi.c \ fbcopy.c \ fbfill.c \ fbfillrect.c \ @@ -50,5 +51,3 @@ libfb_la_SOURCES = \ fbwindow.c libwfb_la_SOURCES = $(libfb_la_SOURCES) - -EXTRA_DIST = fbcmap_mi.c diff --git a/xserver/fb/Makefile.in b/xserver/fb/Makefile.in index 288b5c78d..0db6f3041 100644 --- a/xserver/fb/Makefile.in +++ b/xserver/fb/Makefile.in @@ -78,14 +78,15 @@ am__DEPENDENCIES_1 = libfb_la_DEPENDENCIES = $(am__DEPENDENCIES_1) am_libfb_la_OBJECTS = libfb_la-fb24_32.lo libfb_la-fballpriv.lo \ libfb_la-fbarc.lo libfb_la-fbbits.lo libfb_la-fbblt.lo \ - libfb_la-fbbltone.lo libfb_la-fbcopy.lo libfb_la-fbfill.lo \ - libfb_la-fbfillrect.lo libfb_la-fbfillsp.lo libfb_la-fbgc.lo \ - libfb_la-fbgetsp.lo libfb_la-fbglyph.lo libfb_la-fbimage.lo \ - libfb_la-fbline.lo libfb_la-fboverlay.lo libfb_la-fbpict.lo \ - libfb_la-fbpixmap.lo libfb_la-fbpoint.lo libfb_la-fbpush.lo \ - libfb_la-fbscreen.lo libfb_la-fbseg.lo libfb_la-fbsetsp.lo \ - libfb_la-fbsolid.lo libfb_la-fbstipple.lo libfb_la-fbtile.lo \ - libfb_la-fbtrap.lo libfb_la-fbutil.lo libfb_la-fbwindow.lo + libfb_la-fbbltone.lo libfb_la-fbcmap_mi.lo libfb_la-fbcopy.lo \ + libfb_la-fbfill.lo libfb_la-fbfillrect.lo libfb_la-fbfillsp.lo \ + libfb_la-fbgc.lo libfb_la-fbgetsp.lo libfb_la-fbglyph.lo \ + libfb_la-fbimage.lo libfb_la-fbline.lo libfb_la-fboverlay.lo \ + libfb_la-fbpict.lo libfb_la-fbpixmap.lo libfb_la-fbpoint.lo \ + libfb_la-fbpush.lo libfb_la-fbscreen.lo libfb_la-fbseg.lo \ + libfb_la-fbsetsp.lo libfb_la-fbsolid.lo libfb_la-fbstipple.lo \ + libfb_la-fbtile.lo libfb_la-fbtrap.lo libfb_la-fbutil.lo \ + libfb_la-fbwindow.lo libfb_la_OBJECTS = $(am_libfb_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) @@ -97,7 +98,8 @@ libfb_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ libwfb_la_DEPENDENCIES = $(am__DEPENDENCIES_1) am__objects_1 = libwfb_la-fb24_32.lo libwfb_la-fballpriv.lo \ libwfb_la-fbarc.lo libwfb_la-fbbits.lo libwfb_la-fbblt.lo \ - libwfb_la-fbbltone.lo libwfb_la-fbcopy.lo libwfb_la-fbfill.lo \ + libwfb_la-fbbltone.lo libwfb_la-fbcmap_mi.lo \ + libwfb_la-fbcopy.lo libwfb_la-fbfill.lo \ libwfb_la-fbfillrect.lo libwfb_la-fbfillsp.lo \ libwfb_la-fbgc.lo libwfb_la-fbgetsp.lo libwfb_la-fbglyph.lo \ libwfb_la-fbimage.lo libwfb_la-fbline.lo \ @@ -224,6 +226,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -268,6 +272,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -370,7 +378,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -379,6 +390,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -445,6 +457,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ @@ -534,6 +550,7 @@ libfb_la_SOURCES = \ fbbits.h \ fbblt.c \ fbbltone.c \ + fbcmap_mi.c \ fbcopy.c \ fbfill.c \ fbfillrect.c \ @@ -562,7 +579,6 @@ libfb_la_SOURCES = \ fbwindow.c libwfb_la_SOURCES = $(libfb_la_SOURCES) -EXTRA_DIST = fbcmap_mi.c all: all-am .SUFFIXES: @@ -625,6 +641,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfb_la-fbbits.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfb_la-fbblt.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfb_la-fbbltone.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfb_la-fbcmap_mi.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfb_la-fbcopy.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfb_la-fbfill.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfb_la-fbfillrect.Plo@am__quote@ @@ -654,6 +671,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwfb_la-fbbits.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwfb_la-fbblt.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwfb_la-fbbltone.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwfb_la-fbcmap_mi.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwfb_la-fbcopy.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwfb_la-fbfill.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwfb_la-fbfillrect.Plo@am__quote@ @@ -741,6 +759,13 @@ libfb_la-fbbltone.lo: fbbltone.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfb_la_CFLAGS) $(CFLAGS) -c -o libfb_la-fbbltone.lo `test -f 'fbbltone.c' || echo '$(srcdir)/'`fbbltone.c +libfb_la-fbcmap_mi.lo: fbcmap_mi.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfb_la_CFLAGS) $(CFLAGS) -MT libfb_la-fbcmap_mi.lo -MD -MP -MF $(DEPDIR)/libfb_la-fbcmap_mi.Tpo -c -o libfb_la-fbcmap_mi.lo `test -f 'fbcmap_mi.c' || echo '$(srcdir)/'`fbcmap_mi.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libfb_la-fbcmap_mi.Tpo $(DEPDIR)/libfb_la-fbcmap_mi.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fbcmap_mi.c' object='libfb_la-fbcmap_mi.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfb_la_CFLAGS) $(CFLAGS) -c -o libfb_la-fbcmap_mi.lo `test -f 'fbcmap_mi.c' || echo '$(srcdir)/'`fbcmap_mi.c + libfb_la-fbcopy.lo: fbcopy.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfb_la_CFLAGS) $(CFLAGS) -MT libfb_la-fbcopy.lo -MD -MP -MF $(DEPDIR)/libfb_la-fbcopy.Tpo -c -o libfb_la-fbcopy.lo `test -f 'fbcopy.c' || echo '$(srcdir)/'`fbcopy.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libfb_la-fbcopy.Tpo $(DEPDIR)/libfb_la-fbcopy.Plo @@ -944,6 +969,13 @@ libwfb_la-fbbltone.lo: fbbltone.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwfb_la_CFLAGS) $(CFLAGS) -c -o libwfb_la-fbbltone.lo `test -f 'fbbltone.c' || echo '$(srcdir)/'`fbbltone.c +libwfb_la-fbcmap_mi.lo: fbcmap_mi.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwfb_la_CFLAGS) $(CFLAGS) -MT libwfb_la-fbcmap_mi.lo -MD -MP -MF $(DEPDIR)/libwfb_la-fbcmap_mi.Tpo -c -o libwfb_la-fbcmap_mi.lo `test -f 'fbcmap_mi.c' || echo '$(srcdir)/'`fbcmap_mi.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libwfb_la-fbcmap_mi.Tpo $(DEPDIR)/libwfb_la-fbcmap_mi.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fbcmap_mi.c' object='libwfb_la-fbcmap_mi.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwfb_la_CFLAGS) $(CFLAGS) -c -o libwfb_la-fbcmap_mi.lo `test -f 'fbcmap_mi.c' || echo '$(srcdir)/'`fbcmap_mi.c + libwfb_la-fbcopy.lo: fbcopy.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwfb_la_CFLAGS) $(CFLAGS) -MT libwfb_la-fbcopy.lo -MD -MP -MF $(DEPDIR)/libwfb_la-fbcopy.Tpo -c -o libwfb_la-fbcopy.lo `test -f 'fbcopy.c' || echo '$(srcdir)/'`fbcopy.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libwfb_la-fbcopy.Tpo $(DEPDIR)/libwfb_la-fbcopy.Plo diff --git a/xserver/fb/fb.h b/xserver/fb/fb.h index 26957df4c..90577677b 100644 --- a/xserver/fb/fb.h +++ b/xserver/fb/fb.h @@ -776,7 +776,7 @@ fb24_32ModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, int depth, - int bitsPerPixel, int devKind, pointer pPixData); + int bitsPerPixel, int devKind, void *pPixData); /* * fballpriv.c @@ -1229,7 +1229,7 @@ fbPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y, - unsigned int nglyph, CharInfoPtr * ppci, pointer pglyphBase); + unsigned int nglyph, CharInfoPtr * ppci, void *pglyphBase); extern _X_EXPORT void @@ -1237,7 +1237,7 @@ fbImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y, - unsigned int nglyph, CharInfoPtr * ppci, pointer pglyphBase); + unsigned int nglyph, CharInfoPtr * ppci, void *pglyphBase); /* * fbimage.c @@ -1409,7 +1409,7 @@ extern _X_EXPORT void _fbSetWindowPixmap(WindowPtr pWindow, PixmapPtr pPixmap); extern _X_EXPORT Bool - fbSetupScreen(ScreenPtr pScreen, pointer pbits, /* pointer to screen bitmap */ + fbSetupScreen(ScreenPtr pScreen, void *pbits, /* pointer to screen bitmap */ int xsize, /* in pixels */ int ysize, int dpix, /* dots per inch */ int dpiy, int width, /* pixel width of frame buffer */ @@ -1418,7 +1418,7 @@ extern _X_EXPORT Bool extern _X_EXPORT Bool wfbFinishScreenInit(ScreenPtr pScreen, - pointer pbits, + void *pbits, int xsize, int ysize, int dpix, @@ -1430,7 +1430,7 @@ wfbFinishScreenInit(ScreenPtr pScreen, extern _X_EXPORT Bool wfbScreenInit(ScreenPtr pScreen, - pointer pbits, + void *pbits, int xsize, int ysize, int dpix, @@ -1442,14 +1442,14 @@ wfbScreenInit(ScreenPtr pScreen, extern _X_EXPORT Bool fbFinishScreenInit(ScreenPtr pScreen, - pointer pbits, + void *pbits, int xsize, int ysize, int dpix, int dpiy, int width, int bpp); extern _X_EXPORT Bool fbScreenInit(ScreenPtr pScreen, - pointer pbits, + void *pbits, int xsize, int ysize, int dpix, int dpiy, int width, int bpp); /* diff --git a/xserver/fb/fb24_32.c b/xserver/fb/fb24_32.c index 5eb81e8f0..ecb39510d 100644 --- a/xserver/fb/fb24_32.c +++ b/xserver/fb/fb24_32.c @@ -495,7 +495,7 @@ fb24_32ReformatTile(PixmapPtr pOldTile, int bitsPerPixel) } typedef struct { - pointer pbits; + void *pbits; int width; } miScreenInitParmsRec, *miScreenInitParmsPtr; @@ -526,7 +526,7 @@ fb24_32ModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, int depth, - int bitsPerPixel, int devKind, pointer pPixData) + int bitsPerPixel, int devKind, void *pPixData) { int bpp, w; diff --git a/xserver/fb/fb24_32.h b/xserver/fb/fb24_32.h index 1bec00b80..b357edf38 100644 --- a/xserver/fb/fb24_32.h +++ b/xserver/fb/fb24_32.h @@ -31,14 +31,14 @@ Bool fb24_32FinishScreenInit(ScreenPtr pScreen, - pointer pbits, + void *pbits, int xsize, int ysize, int dpix, int dpiy, int width, int bpp); Bool fb24_32ScreenInit(ScreenPtr pScreen, - pointer pbits, + void *pbits, int xsize, int ysize, int dpix, int dpiy, int width, int bpp); #endif diff --git a/xserver/fb/fbblt.c b/xserver/fb/fbblt.c index 72a05f61a..c615106d1 100644 --- a/xserver/fb/fbblt.c +++ b/xserver/fb/fbblt.c @@ -56,42 +56,48 @@ fbBlt(FbBits * srcLine, int n, nmiddle; Bool destInvarient; int startbyte, endbyte; - int careful; FbDeclareMergeRop(); + if (alu == GXcopy && pm == FB_ALLONES && + !(srcX & 7) && !(dstX & 7) && !(width & 7)) + { + CARD8 *src_byte = (CARD8 *) srcLine + (srcX >> 3); + CARD8 *dst_byte = (CARD8 *) dstLine + (dstX >> 3); + FbStride src_byte_stride = srcStride << (FB_SHIFT - 3); + FbStride dst_byte_stride = dstStride << (FB_SHIFT - 3); + int width_byte = (width >> 3); + + /* Make sure there's no overlap; we can't use memcpy in that + * case as it's not well defined, so fall through to the + * general code + */ + if (src_byte + width_byte <= dst_byte || + dst_byte + width_byte <= src_byte) + { + int i; + + if (!upsidedown) + for (i = 0; i < height; i++) + MEMCPY_WRAPPED(dst_byte + i * dst_byte_stride, + src_byte + i * src_byte_stride, + width_byte); + else + for (i = height - 1; i >= 0; i--) + MEMCPY_WRAPPED(dst_byte + i * dst_byte_stride, + src_byte + i * src_byte_stride, + width_byte); + + return; + } + } + if (bpp == 24 && !FbCheck24Pix(pm)) { fbBlt24(srcLine, srcStride, srcX, dstLine, dstStride, dstX, width, height, alu, pm, reverse, upsidedown); return; } - careful = !((srcLine < dstLine && srcLine + width * (bpp >> 3) > dstLine) || - (dstLine < srcLine && dstLine + width * (bpp >> 3) > srcLine)) - || (bpp & 7); - - if (alu == GXcopy && pm == FB_ALLONES && !careful && - !(srcX & 7) && !(dstX & 7) && !(width & 7)) { - int i; - CARD8 *tmpsrc = (CARD8 *) srcLine; - CARD8 *tmpdst = (CARD8 *) dstLine; - - srcStride *= sizeof(FbBits); - dstStride *= sizeof(FbBits); - width >>= 3; - tmpsrc += (srcX >> 3); - tmpdst += (dstX >> 3); - - if (!upsidedown) - for (i = 0; i < height; i++) - MEMCPY_WRAPPED(tmpdst + i * dstStride, tmpsrc + i * srcStride, width); - else - for (i = height - 1; i >= 0; i--) - MEMCPY_WRAPPED(tmpdst + i * dstStride, tmpsrc + i * srcStride, width); - - return; - } - FbInitializeMergeRop(alu, pm); destInvarient = FbDestInvarientMergeRop(); if (upsidedown) { diff --git a/xserver/fb/fbglyph.c b/xserver/fb/fbglyph.c index 3080a7728..4f2904c31 100644 --- a/xserver/fb/fbglyph.c +++ b/xserver/fb/fbglyph.c @@ -241,7 +241,7 @@ fbPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y, - unsigned int nglyph, CharInfoPtr * ppci, pointer pglyphBase) + unsigned int nglyph, CharInfoPtr * ppci, void *pglyphBase) { FbGCPrivPtr pPriv = fbGetGCPrivate(pGC); CharInfoPtr pci; @@ -309,7 +309,7 @@ fbImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y, - unsigned int nglyph, CharInfoPtr * ppciInit, pointer pglyphBase) + unsigned int nglyph, CharInfoPtr * ppciInit, void *pglyphBase) { FbGCPrivPtr pPriv = fbGetGCPrivate(pGC); CharInfoPtr *ppci; diff --git a/xserver/fb/fboverlay.c b/xserver/fb/fboverlay.c index c6802e4b4..935bf1b50 100644 --- a/xserver/fb/fboverlay.c +++ b/xserver/fb/fboverlay.c @@ -104,7 +104,7 @@ fbOverlayWindowLayer(WindowPtr pWin) for (i = 0; i < pScrPriv->nlayers; i++) if (dixLookupPrivate(&pWin->devPrivates, fbGetWinPrivateKey(pWin)) == - (pointer) pScrPriv->layer[i].u.run.pixmap) + (void *) pScrPriv->layer[i].u.run.pixmap) return i; return 0; } @@ -115,7 +115,7 @@ fbOverlayCreateScreenResources(ScreenPtr pScreen) int i; FbOverlayScrPrivPtr pScrPriv = fbOverlayGetScrPriv(pScreen); PixmapPtr pPixmap; - pointer pbits; + void *pbits; int width; int depth; BoxRec box; @@ -250,8 +250,8 @@ fbOverlayWindowExposures(WindowPtr pWin, Bool fbOverlaySetupScreen(ScreenPtr pScreen, - pointer pbits1, - pointer pbits2, + void *pbits1, + void *pbits2, int xsize, int ysize, int dpix, @@ -287,8 +287,8 @@ fb24_32OverlayCreateScreenResources(ScreenPtr pScreen) Bool fbOverlayFinishScreenInit(ScreenPtr pScreen, - pointer pbits1, - pointer pbits2, + void *pbits1, + void *pbits2, int xsize, int ysize, int dpix, diff --git a/xserver/fb/fboverlay.h b/xserver/fb/fboverlay.h index 9a93457c7..57c9873c2 100644 --- a/xserver/fb/fboverlay.h +++ b/xserver/fb/fboverlay.h @@ -38,7 +38,7 @@ typedef void (*fbOverlayPaintKeyProc) (DrawablePtr, RegionPtr, CARD32, int); typedef struct _fbOverlayLayer { union { struct { - pointer pbits; + void *pbits; int width; int depth; } init; @@ -89,8 +89,8 @@ fbOverlayWindowExposures(WindowPtr pWin, extern _X_EXPORT Bool fbOverlaySetupScreen(ScreenPtr pScreen, - pointer pbits1, - pointer pbits2, + void *pbits1, + void *pbits2, int xsize, int ysize, int dpix, @@ -99,8 +99,8 @@ fbOverlaySetupScreen(ScreenPtr pScreen, extern _X_EXPORT Bool fbOverlayFinishScreenInit(ScreenPtr pScreen, - pointer pbits1, - pointer pbits2, + void *pbits1, + void *pbits2, int xsize, int ysize, int dpix, diff --git a/xserver/fb/fbpict.c b/xserver/fb/fbpict.c index 90178a665..21baf8950 100644 --- a/xserver/fb/fbpict.c +++ b/xserver/fb/fbpict.c @@ -82,7 +82,7 @@ fbDestroyGlyphCache(void) } } -static void +void fbUnrealizeGlyph(ScreenPtr pScreen, GlyphPtr pGlyph) { @@ -90,7 +90,7 @@ fbUnrealizeGlyph(ScreenPtr pScreen, pixman_glyph_cache_remove (glyphCache, pGlyph, NULL); } -static void +void fbGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, diff --git a/xserver/fb/fbpict.h b/xserver/fb/fbpict.h index 110f32dfe..8b0f59f7a 100644 --- a/xserver/fb/fbpict.h +++ b/xserver/fb/fbpict.h @@ -65,11 +65,24 @@ fbTrapezoids(CARD8 op, INT16 xSrc, INT16 ySrc, int ntrap, xTrapezoid * traps); extern _X_EXPORT void - fbTriangles(CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int ntris, xTriangle * tris); +extern _X_EXPORT void +fbUnrealizeGlyph(ScreenPtr pScreen, + GlyphPtr pGlyph); + +extern _X_EXPORT void +fbGlyphs(CARD8 op, + PicturePtr pSrc, + PicturePtr pDst, + PictFormatPtr maskFormat, + INT16 xSrc, + INT16 ySrc, int nlist, + GlyphListPtr list, + GlyphPtr *glyphs); + #endif /* _FBPICT_H_ */ diff --git a/xserver/fb/fbpixmap.c b/xserver/fb/fbpixmap.c index 0824b64bb..677f28af0 100644 --- a/xserver/fb/fbpixmap.c +++ b/xserver/fb/fbpixmap.c @@ -66,7 +66,7 @@ fbCreatePixmapBpp(ScreenPtr pScreen, int width, int height, int depth, int bpp, pPixmap->drawable.height = height; pPixmap->devKind = paddedWidth; pPixmap->refcnt = 1; - pPixmap->devPrivate.ptr = (pointer) ((char *) pPixmap + base + adjust); + pPixmap->devPrivate.ptr = (void *) ((char *) pPixmap + base + adjust); pPixmap->master_pixmap = NULL; #ifdef FB_DEBUG diff --git a/xserver/fb/fbscreen.c b/xserver/fb/fbscreen.c index f9080a445..0d4d87f8b 100644 --- a/xserver/fb/fbscreen.c +++ b/xserver/fb/fbscreen.c @@ -37,7 +37,8 @@ fbCloseScreen(ScreenPtr pScreen) free(depths[d].vids); free(depths); free(pScreen->visuals); - free(pScreen->devPrivate); + if (pScreen->devPrivate) + FreePixmap((PixmapPtr)pScreen->devPrivate); return TRUE; } @@ -90,7 +91,7 @@ _fbSetWindowPixmap(WindowPtr pWindow, PixmapPtr pPixmap) } Bool -fbSetupScreen(ScreenPtr pScreen, pointer pbits, /* pointer to screen bitmap */ +fbSetupScreen(ScreenPtr pScreen, void *pbits, /* pointer to screen bitmap */ int xsize, /* in pixels */ int ysize, int dpix, /* dots per inch */ int dpiy, int width, /* pixel width of frame buffer */ @@ -135,7 +136,7 @@ fbSetupScreen(ScreenPtr pScreen, pointer pbits, /* pointer to screen bitmap */ #ifdef FB_ACCESS_WRAPPER Bool wfbFinishScreenInit(ScreenPtr pScreen, - pointer pbits, + void *pbits, int xsize, int ysize, int dpix, @@ -146,7 +147,7 @@ wfbFinishScreenInit(ScreenPtr pScreen, #else Bool fbFinishScreenInit(ScreenPtr pScreen, - pointer pbits, + void *pbits, int xsize, int ysize, int dpix, int dpiy, int width, int bpp) #endif { @@ -224,7 +225,7 @@ fbFinishScreenInit(ScreenPtr pScreen, #ifdef FB_ACCESS_WRAPPER Bool wfbScreenInit(ScreenPtr pScreen, - pointer pbits, + void *pbits, int xsize, int ysize, int dpix, @@ -242,7 +243,7 @@ wfbScreenInit(ScreenPtr pScreen, #else Bool fbScreenInit(ScreenPtr pScreen, - pointer pbits, + void *pbits, int xsize, int ysize, int dpix, int dpiy, int width, int bpp) { if (!fbSetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, width, bpp)) diff --git a/xserver/glamor/Makefile.am b/xserver/glamor/Makefile.am new file mode 100644 index 000000000..bde58b632 --- /dev/null +++ b/xserver/glamor/Makefile.am @@ -0,0 +1,53 @@ +noinst_LTLIBRARIES = libglamor.la libglamor_egl_stubs.la + +libglamor_la_LIBADD = $(GLAMOR_LIBS) + +AM_CFLAGS = $(CWARNFLAGS) $(DIX_CFLAGS) $(GLAMOR_CFLAGS) + +libglamor_la_SOURCES = \ + glamor.c \ + glamor_context.h \ + glamor_copyarea.c \ + glamor_copywindow.c \ + glamor_core.c \ + glamor_debug.h \ + glamor_fill.c \ + glamor_font.c \ + glamor_font.h \ + glamor_glx.c \ + glamor_glyphs.c \ + glamor_polylines.c \ + glamor_segment.c \ + glamor_image.c \ + glamor_render.c \ + glamor_gradient.c \ + glamor_program.c \ + glamor_program.h \ + glamor_rects.c \ + glamor_spans.c \ + glamor_text.c \ + glamor_transfer.c \ + glamor_transfer.h \ + glamor_transform.c \ + glamor_transform.h \ + glamor_trapezoid.c \ + glamor_tile.c \ + glamor_triangles.c\ + glamor_addtraps.c\ + glamor_copyplane.c\ + glamor_glyphblt.c\ + glamor_points.c\ + glamor_priv.h\ + glamor_pixmap.c\ + glamor_largepixmap.c\ + glamor_picture.c\ + glamor_vbo.c \ + glamor_window.c\ + glamor_fbo.c\ + glamor_compositerects.c\ + glamor_utils.h\ + glamor.h + +libglamor_egl_stubs_la_SOURCES = glamor_egl_stubs.c + +sdk_HEADERS = glamor.h diff --git a/xserver/glamor/Makefile.in b/xserver/glamor/Makefile.in new file mode 100644 index 000000000..0f65e3392 --- /dev/null +++ b/xserver/glamor/Makefile.in @@ -0,0 +1,929 @@ +# Makefile.in generated by automake 1.12.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2012 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = glamor +DIST_COMMON = $(sdk_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in $(top_srcdir)/depcomp +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/xorg-tls.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ + $(top_builddir)/include/xorg-server.h \ + $(top_builddir)/include/dix-config.h \ + $(top_builddir)/include/xorg-config.h \ + $(top_builddir)/include/xkb-config.h \ + $(top_builddir)/include/xwin-config.h \ + $(top_builddir)/include/kdrive-config.h \ + $(top_builddir)/include/version-config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +am__DEPENDENCIES_1 = +libglamor_la_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_libglamor_la_OBJECTS = glamor.lo glamor_copyarea.lo \ + glamor_copywindow.lo glamor_core.lo glamor_fill.lo \ + glamor_font.lo glamor_glx.lo glamor_glyphs.lo \ + glamor_polylines.lo glamor_segment.lo glamor_image.lo \ + glamor_render.lo glamor_gradient.lo glamor_program.lo \ + glamor_rects.lo glamor_spans.lo glamor_text.lo \ + glamor_transfer.lo glamor_transform.lo glamor_trapezoid.lo \ + glamor_tile.lo glamor_triangles.lo glamor_addtraps.lo \ + glamor_copyplane.lo glamor_glyphblt.lo glamor_points.lo \ + glamor_pixmap.lo glamor_largepixmap.lo glamor_picture.lo \ + glamor_vbo.lo glamor_window.lo glamor_fbo.lo \ + glamor_compositerects.lo +libglamor_la_OBJECTS = $(am_libglamor_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +libglamor_egl_stubs_la_LIBADD = +am_libglamor_egl_stubs_la_OBJECTS = glamor_egl_stubs.lo +libglamor_egl_stubs_la_OBJECTS = $(am_libglamor_egl_stubs_la_OBJECTS) +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libglamor_la_SOURCES) $(libglamor_egl_stubs_la_SOURCES) +DIST_SOURCES = $(libglamor_la_SOURCES) \ + $(libglamor_egl_stubs_la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(sdkdir)" +HEADERS = $(sdk_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ +ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ +APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ +APP_MAN_DIR = @APP_MAN_DIR@ +APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BASE_CFLAGS = @BASE_CFLAGS@ +BASE_FONT_PATH = @BASE_FONT_PATH@ +BUILD_DATE = @BUILD_DATE@ +BUILD_TIME = @BUILD_TIME@ +BUNDLE_ID_PREFIX = @BUNDLE_ID_PREFIX@ +CC = @CC@ +CCAS = @CCAS@ +CCASDEPMODE = @CCASDEPMODE@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CHANGELOG_CMD = @CHANGELOG_CMD@ +COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CWARNFLAGS = @CWARNFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DBUS_CFLAGS = @DBUS_CFLAGS@ +DBUS_LIBS = @DBUS_LIBS@ +DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ +DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ +DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ +DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DGA_CFLAGS = @DGA_CFLAGS@ +DGA_LIBS = @DGA_LIBS@ +DIX_CFLAGS = @DIX_CFLAGS@ +DIX_LIB = @DIX_LIB@ +DLLTOOL = @DLLTOOL@ +DLOPEN_LIBS = @DLOPEN_LIBS@ +DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ +DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ +DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ +DMXMODULES_LIBS = @DMXMODULES_LIBS@ +DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ +DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ +DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ +DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ +DOT = @DOT@ +DOXYGEN = @DOXYGEN@ +DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ +DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ +DRI3PROTO_CFLAGS = @DRI3PROTO_CFLAGS@ +DRI3PROTO_LIBS = @DRI3PROTO_LIBS@ +DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ +DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ +DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ +DSYMUTIL = @DSYMUTIL@ +DTRACE = @DTRACE@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +FILE_MAN_DIR = @FILE_MAN_DIR@ +FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ +FONT100DPIDIR = @FONT100DPIDIR@ +FONT75DPIDIR = @FONT75DPIDIR@ +FONTMISCDIR = @FONTMISCDIR@ +FONTOTFDIR = @FONTOTFDIR@ +FONTROOTDIR = @FONTROOTDIR@ +FONTTTFDIR = @FONTTTFDIR@ +FONTTYPE1DIR = @FONTTYPE1DIR@ +FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ +GLX_DEFINES = @GLX_DEFINES@ +GLX_SYS_LIBS = @GLX_SYS_LIBS@ +GLX_TLS = @GLX_TLS@ +GL_CFLAGS = @GL_CFLAGS@ +GL_LIBS = @GL_LIBS@ +GREP = @GREP@ +HAL_CFLAGS = @HAL_CFLAGS@ +HAL_LIBS = @HAL_LIBS@ +HAVE_DOT = @HAVE_DOT@ +INSTALL = @INSTALL@ +INSTALL_CMD = @INSTALL_CMD@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ +KDRIVE_INCS = @KDRIVE_INCS@ +KDRIVE_LIBS = @KDRIVE_LIBS@ +KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ +KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ +KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ +KHRONOS_OPENGL_REGISTRY_CFLAGS = @KHRONOS_OPENGL_REGISTRY_CFLAGS@ +KHRONOS_OPENGL_REGISTRY_LIBS = @KHRONOS_OPENGL_REGISTRY_LIBS@ +KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ +LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ +LIBDRM_LIBS = @LIBDRM_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBSHA1_CFLAGS = @LIBSHA1_CFLAGS@ +LIBSHA1_LIBS = @LIBSHA1_LIBS@ +LIBTOOL = @LIBTOOL@ +LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ +LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ +LIB_MAN_DIR = @LIB_MAN_DIR@ +LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAIN_LIB = @MAIN_LIB@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MAN_SUBSTS = @MAN_SUBSTS@ +MISC_MAN_DIR = @MISC_MAN_DIR@ +MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJC = @OBJC@ +OBJCCLD = @OBJCCLD@ +OBJCDEPMODE = @OBJCDEPMODE@ +OBJCFLAGS = @OBJCFLAGS@ +OBJCLINK = @OBJCLINK@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ +OPENSSL_LIBS = @OPENSSL_LIBS@ +OS_LIB = @OS_LIB@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ +PCIACCESS_LIBS = @PCIACCESS_LIBS@ +PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ +PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ +PIXMAN_LIBS = @PIXMAN_LIBS@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PROJECTROOT = @PROJECTROOT@ +PYTHON3 = @PYTHON3@ +RANLIB = @RANLIB@ +RAWCPP = @RAWCPP@ +RAWCPPFLAGS = @RAWCPPFLAGS@ +RELEASE_DATE = @RELEASE_DATE@ +SDK_REQUIRED_MODULES = @SDK_REQUIRED_MODULES@ +SED = @SED@ +SELINUX_CFLAGS = @SELINUX_CFLAGS@ +SELINUX_LIBS = @SELINUX_LIBS@ +SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ +SET_MAKE = @SET_MAKE@ +SHA1_CFLAGS = @SHA1_CFLAGS@ +SHA1_LIBS = @SHA1_LIBS@ +SHELL = @SHELL@ +SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ +STRICT_CFLAGS = @STRICT_CFLAGS@ +STRIP = @STRIP@ +STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ +SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ +TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ +TSLIB_CFLAGS = @TSLIB_CFLAGS@ +TSLIB_LIBS = @TSLIB_LIBS@ +UDEV_CFLAGS = @UDEV_CFLAGS@ +UDEV_LIBS = @UDEV_LIBS@ +UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ +VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ +VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ +WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ +WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ +WINDRES = @WINDRES@ +X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ +X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ +XDMCP_CFLAGS = @XDMCP_CFLAGS@ +XDMCP_LIBS = @XDMCP_LIBS@ +XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ +XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ +XDMX_CFLAGS = @XDMX_CFLAGS@ +XDMX_LIBS = @XDMX_LIBS@ +XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ +XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ +XEPHYR_INCS = @XEPHYR_INCS@ +XEPHYR_LIBS = @XEPHYR_LIBS@ +XF86CONFIGDIR = @XF86CONFIGDIR@ +XF86CONFIGFILE = @XF86CONFIGFILE@ +XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@ +XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@ +XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ +XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ +XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ +XKB_DFLT_LAYOUT = @XKB_DFLT_LAYOUT@ +XKB_DFLT_MODEL = @XKB_DFLT_MODEL@ +XKB_DFLT_OPTIONS = @XKB_DFLT_OPTIONS@ +XKB_DFLT_RULES = @XKB_DFLT_RULES@ +XKB_DFLT_VARIANT = @XKB_DFLT_VARIANT@ +XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ +XLIB_CFLAGS = @XLIB_CFLAGS@ +XLIB_LIBS = @XLIB_LIBS@ +XMLTO = @XMLTO@ +XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ +XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ +XNEST_LIBS = @XNEST_LIBS@ +XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ +XORG_CFLAGS = @XORG_CFLAGS@ +XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ +XORG_INCS = @XORG_INCS@ +XORG_LIBS = @XORG_LIBS@ +XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ +XORG_MAN_PAGE = @XORG_MAN_PAGE@ +XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ +XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ +XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XORG_SGML_PATH = @XORG_SGML_PATH@ +XORG_SYS_LIBS = @XORG_SYS_LIBS@ +XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ +XPBPROXY_LIBS = @XPBPROXY_LIBS@ +XQUARTZ_LIBS = @XQUARTZ_LIBS@ +XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ +XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ +XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ +XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ +XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ +XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ +XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ +XSERVER_LIBS = @XSERVER_LIBS@ +XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ +XSHMFENCE_CFLAGS = @XSHMFENCE_CFLAGS@ +XSHMFENCE_LIBS = @XSHMFENCE_LIBS@ +XSLTPROC = @XSLTPROC@ +XSL_STYLESHEET = @XSL_STYLESHEET@ +XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ +XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ +XVFB_LIBS = @XVFB_LIBS@ +XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ +XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ +XWINMODULES_LIBS = @XWINMODULES_LIBS@ +XWIN_LIBS = @XWIN_LIBS@ +XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ +XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ +YACC = @YACC@ +YFLAGS = @YFLAGS@ +__XCONFIGDIR__ = @__XCONFIGDIR__@ +__XCONFIGFILE__ = @__XCONFIGFILE__@ +abi_ansic = @abi_ansic@ +abi_extension = @abi_extension@ +abi_videodrv = @abi_videodrv@ +abi_xinput = @abi_xinput@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +driverdir = @driverdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +extdir = @extdir@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +logdir = @logdir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +moduledir = @moduledir@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sdkdir = @sdkdir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +symbol_visibility = @symbol_visibility@ +sysconfdir = @sysconfdir@ +sysconfigdir = @sysconfigdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +noinst_LTLIBRARIES = libglamor.la libglamor_egl_stubs.la +libglamor_la_LIBADD = $(GLAMOR_LIBS) +AM_CFLAGS = $(CWARNFLAGS) $(DIX_CFLAGS) $(GLAMOR_CFLAGS) +libglamor_la_SOURCES = \ + glamor.c \ + glamor_context.h \ + glamor_copyarea.c \ + glamor_copywindow.c \ + glamor_core.c \ + glamor_debug.h \ + glamor_fill.c \ + glamor_font.c \ + glamor_font.h \ + glamor_glx.c \ + glamor_glyphs.c \ + glamor_polylines.c \ + glamor_segment.c \ + glamor_image.c \ + glamor_render.c \ + glamor_gradient.c \ + glamor_program.c \ + glamor_program.h \ + glamor_rects.c \ + glamor_spans.c \ + glamor_text.c \ + glamor_transfer.c \ + glamor_transfer.h \ + glamor_transform.c \ + glamor_transform.h \ + glamor_trapezoid.c \ + glamor_tile.c \ + glamor_triangles.c\ + glamor_addtraps.c\ + glamor_copyplane.c\ + glamor_glyphblt.c\ + glamor_points.c\ + glamor_priv.h\ + glamor_pixmap.c\ + glamor_largepixmap.c\ + glamor_picture.c\ + glamor_vbo.c \ + glamor_window.c\ + glamor_fbo.c\ + glamor_compositerects.c\ + glamor_utils.h\ + glamor.h + +libglamor_egl_stubs_la_SOURCES = glamor_egl_stubs.c +sdk_HEADERS = glamor.h +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign glamor/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign glamor/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } +libglamor.la: $(libglamor_la_OBJECTS) $(libglamor_la_DEPENDENCIES) $(EXTRA_libglamor_la_DEPENDENCIES) + $(AM_V_CCLD)$(LINK) $(libglamor_la_OBJECTS) $(libglamor_la_LIBADD) $(LIBS) +libglamor_egl_stubs.la: $(libglamor_egl_stubs_la_OBJECTS) $(libglamor_egl_stubs_la_DEPENDENCIES) $(EXTRA_libglamor_egl_stubs_la_DEPENDENCIES) + $(AM_V_CCLD)$(LINK) $(libglamor_egl_stubs_la_OBJECTS) $(libglamor_egl_stubs_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor_addtraps.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor_compositerects.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor_copyarea.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor_copyplane.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor_copywindow.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor_core.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor_egl_stubs.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor_fbo.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor_fill.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor_font.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor_glx.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor_glyphblt.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor_glyphs.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor_gradient.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor_image.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor_largepixmap.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor_picture.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor_pixmap.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor_points.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor_polylines.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor_program.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor_rects.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor_render.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor_segment.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor_spans.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor_text.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor_tile.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor_transfer.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor_transform.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor_trapezoid.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor_triangles.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor_vbo.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor_window.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-sdkHEADERS: $(sdk_HEADERS) + @$(NORMAL_INSTALL) + @list='$(sdk_HEADERS)'; test -n "$(sdkdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(sdkdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(sdkdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(sdkdir)'"; \ + $(INSTALL_HEADER) $$files "$(DESTDIR)$(sdkdir)" || exit $$?; \ + done + +uninstall-sdkHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(sdk_HEADERS)'; test -n "$(sdkdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(sdkdir)'; $(am__uninstall_files_from_dir) + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +cscopelist: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(HEADERS) +installdirs: + for dir in "$(DESTDIR)$(sdkdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-sdkHEADERS + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-sdkHEADERS + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstLTLIBRARIES cscopelist ctags \ + distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-sdkHEADERS install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-sdkHEADERS + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/xserver/glamor/glamor.c b/xserver/glamor/glamor.c new file mode 100644 index 000000000..358890375 --- /dev/null +++ b/xserver/glamor/glamor.c @@ -0,0 +1,699 @@ +/* + * Copyright © 2008 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Authors: + * Eric Anholt <eric@anholt.net> + * Zhigang Gong <zhigang.gong@linux.intel.com> + * + */ + +/** @file glamor.c + * This file covers the initialization and teardown of glamor, and has various + * functions not responsible for performing rendering. + */ + +#include <stdlib.h> + +#include "glamor_priv.h" + +static DevPrivateKeyRec glamor_screen_private_key_index; +DevPrivateKey glamor_screen_private_key = &glamor_screen_private_key_index; +static DevPrivateKeyRec glamor_pixmap_private_key_index; +DevPrivateKey glamor_pixmap_private_key = &glamor_pixmap_private_key_index; + +/** + * glamor_get_drawable_pixmap() returns a backing pixmap for a given drawable. + * + * @param drawable the drawable being requested. + * + * This function returns the backing pixmap for a drawable, whether it is a + * redirected window, unredirected window, or already a pixmap. Note that + * coordinate translation is needed when drawing to the backing pixmap of a + * redirected window, and the translation coordinates are provided by calling + * exaGetOffscreenPixmap() on the drawable. + */ +PixmapPtr +glamor_get_drawable_pixmap(DrawablePtr drawable) +{ + if (drawable->type == DRAWABLE_WINDOW) + return drawable->pScreen->GetWindowPixmap((WindowPtr) drawable); + else + return (PixmapPtr) drawable; +} + +_X_EXPORT void +glamor_set_pixmap_type(PixmapPtr pixmap, glamor_pixmap_type_t type) +{ + glamor_pixmap_private *pixmap_priv; + glamor_screen_private *glamor_priv = + glamor_get_screen_private(pixmap->drawable.pScreen); + + pixmap_priv = dixLookupPrivate(&pixmap->devPrivates, + glamor_pixmap_private_key); + if (pixmap_priv == NULL) { + pixmap_priv = calloc(sizeof(*pixmap_priv), 1); + glamor_set_pixmap_private(pixmap, pixmap_priv); + pixmap_priv->base.pixmap = pixmap; + pixmap_priv->base.glamor_priv = glamor_priv; + } + pixmap_priv->type = type; + pixmap_priv->base.box.x1 = 0; + pixmap_priv->base.box.x2 = pixmap->drawable.width; + pixmap_priv->base.box.y1 = 0; + pixmap_priv->base.box.y2 = pixmap->drawable.height; +} + +_X_EXPORT void +glamor_set_pixmap_texture(PixmapPtr pixmap, unsigned int tex) +{ + ScreenPtr screen = pixmap->drawable.pScreen; + glamor_pixmap_private *pixmap_priv; + glamor_screen_private *glamor_priv; + glamor_pixmap_fbo *fbo; + GLenum format; + + glamor_priv = glamor_get_screen_private(screen); + pixmap_priv = glamor_get_pixmap_private(pixmap); + + if (pixmap_priv->base.fbo) { + fbo = glamor_pixmap_detach_fbo(pixmap_priv); + glamor_destroy_fbo(fbo); + } + + format = gl_iformat_for_pixmap(pixmap); + fbo = glamor_create_fbo_from_tex(glamor_priv, pixmap->drawable.width, + pixmap->drawable.height, format, tex, 0); + + if (fbo == NULL) { + ErrorF("XXX fail to create fbo.\n"); + return; + } + + glamor_pixmap_attach_fbo(pixmap, fbo); +} + +void +glamor_set_screen_pixmap(PixmapPtr screen_pixmap, PixmapPtr *back_pixmap) +{ + glamor_pixmap_private *pixmap_priv; + glamor_screen_private *glamor_priv; + + glamor_priv = glamor_get_screen_private(screen_pixmap->drawable.pScreen); + pixmap_priv = glamor_get_pixmap_private(screen_pixmap); + glamor_priv->screen_fbo = pixmap_priv->base.fbo->fb; + + pixmap_priv->base.fbo->width = screen_pixmap->drawable.width; + pixmap_priv->base.fbo->height = screen_pixmap->drawable.height; + + glamor_priv->back_pixmap = back_pixmap; +} + +uint32_t +glamor_get_pixmap_texture(PixmapPtr pixmap) +{ + glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap); + + if (pixmap_priv->type != GLAMOR_TEXTURE_ONLY) + return 0; + + return pixmap_priv->base.fbo->tex; +} + +PixmapPtr +glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth, + unsigned int usage) +{ + PixmapPtr pixmap; + glamor_pixmap_type_t type = GLAMOR_TEXTURE_ONLY; + glamor_pixmap_private *pixmap_priv; + glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); + glamor_pixmap_fbo *fbo = NULL; + int pitch; + GLenum format; + + if (w > 32767 || h > 32767) + return NullPixmap; + + if ((usage == GLAMOR_CREATE_PIXMAP_CPU + || (usage == CREATE_PIXMAP_USAGE_GLYPH_PICTURE && w <= 64 && h <= 64) + || (w == 0 && h == 0) + || !glamor_check_pixmap_fbo_depth(depth)) + || (!GLAMOR_TEXTURED_LARGE_PIXMAP && + !glamor_check_fbo_size(glamor_priv, w, h))) + return fbCreatePixmap(screen, w, h, depth, usage); + else + pixmap = fbCreatePixmap(screen, 0, 0, depth, usage); + + pixmap_priv = calloc(1, sizeof(*pixmap_priv)); + + if (!pixmap_priv) { + fbDestroyPixmap(pixmap); + return fbCreatePixmap(screen, w, h, depth, usage); + } + glamor_set_pixmap_private(pixmap, pixmap_priv); + + if (usage == GLAMOR_CREATE_PIXMAP_MAP) + type = GLAMOR_MEMORY_MAP; + + pixmap_priv->base.pixmap = pixmap; + pixmap_priv->base.glamor_priv = glamor_priv; + + format = gl_iformat_for_pixmap(pixmap); + + pitch = (((w * pixmap->drawable.bitsPerPixel + 7) / 8) + 3) & ~3; + screen->ModifyPixmapHeader(pixmap, w, h, 0, 0, pitch, NULL); + + if (usage == GLAMOR_CREATE_PIXMAP_NO_TEXTURE) { + pixmap_priv->type = GLAMOR_TEXTURE_ONLY; + pixmap_priv->base.box.x1 = 0; + pixmap_priv->base.box.y1 = 0; + pixmap_priv->base.box.x2 = w; + pixmap_priv->base.box.y2 = h; + return pixmap; + } + else if (type == GLAMOR_MEMORY_MAP || usage == GLAMOR_CREATE_NO_LARGE || + glamor_check_fbo_size(glamor_priv, w, h)) + { + pixmap_priv->type = type; + pixmap_priv->base.box.x1 = 0; + pixmap_priv->base.box.y1 = 0; + pixmap_priv->base.box.x2 = w; + pixmap_priv->base.box.y2 = h; + fbo = glamor_create_fbo(glamor_priv, w, h, format, usage); + } else { + int tile_size = glamor_priv->max_fbo_size; + DEBUGF("Create LARGE pixmap %p width %d height %d, tile size %d\n", pixmap, w, h, tile_size); + pixmap_priv->type = GLAMOR_TEXTURE_LARGE; + fbo = glamor_create_fbo_array(glamor_priv, w, h, format, usage, + tile_size, tile_size, pixmap_priv); + } + + if (fbo == NULL) { + fbDestroyPixmap(pixmap); + free(pixmap_priv); + return fbCreatePixmap(screen, w, h, depth, usage); + } + + glamor_pixmap_attach_fbo(pixmap, fbo); + + return pixmap; +} + +void +glamor_destroy_textured_pixmap(PixmapPtr pixmap) +{ + if (pixmap->refcnt == 1) { + glamor_pixmap_private *pixmap_priv; + + pixmap_priv = glamor_get_pixmap_private(pixmap); + if (pixmap_priv != NULL) + glamor_pixmap_destroy_fbo(pixmap_priv); + } +} + +Bool +glamor_destroy_pixmap(PixmapPtr pixmap) +{ + glamor_screen_private + *glamor_priv = glamor_get_screen_private(pixmap->drawable.pScreen); + if (glamor_priv->dri3_enabled) + glamor_egl_destroy_textured_pixmap(pixmap); + else + glamor_destroy_textured_pixmap(pixmap); + return fbDestroyPixmap(pixmap); +} + +void +glamor_block_handler(ScreenPtr screen) +{ + glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); + + glamor_make_current(glamor_priv); + glamor_priv->tick++; + glFlush(); + glamor_fbo_expire(glamor_priv); + if (glamor_priv->state == RENDER_STATE + && glamor_priv->render_idle_cnt++ > RENDER_IDEL_MAX) { + glamor_priv->state = IDLE_STATE; + glamor_priv->render_idle_cnt = 0; + } +} + +static void +_glamor_block_handler(void *data, OSTimePtr timeout, void *last_select_mask) +{ + glamor_screen_private *glamor_priv = data; + + glamor_make_current(glamor_priv); + glFlush(); +} + +static void +_glamor_wakeup_handler(void *data, int result, void *last_select_mask) +{ +} + +static void +glamor_set_debug_level(int *debug_level) +{ + char *debug_level_string; + + debug_level_string = getenv("GLAMOR_DEBUG"); + if (debug_level_string + && sscanf(debug_level_string, "%d", debug_level) == 1) + return; + *debug_level = 0; +} + +int glamor_debug_level; + +/** + * Creates any pixmaps used internally by glamor, since those can't be + * allocated at ScreenInit time. + */ +static Bool +glamor_create_screen_resources(ScreenPtr screen) +{ + glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); + Bool ret = TRUE; + + screen->CreateScreenResources = + glamor_priv->saved_procs.create_screen_resources; + if (screen->CreateScreenResources) + ret = screen->CreateScreenResources(screen); + screen->CreateScreenResources = glamor_create_screen_resources; + + if (!glamor_realize_glyph_caches(screen)) { + ErrorF("Failed to initialize glyph cache\n"); + ret = FALSE; + } + + return ret; +} + +/** Set up glamor for an already-configured GL context. */ +Bool +glamor_init(ScreenPtr screen, unsigned int flags) +{ + glamor_screen_private *glamor_priv; + int gl_version; + int max_viewport_size[2]; + +#ifdef RENDER + PictureScreenPtr ps = GetPictureScreenIfSet(screen); +#endif + if (flags & ~GLAMOR_VALID_FLAGS) { + ErrorF("glamor_init: Invalid flags %x\n", flags); + return FALSE; + } + glamor_priv = calloc(1, sizeof(*glamor_priv)); + if (glamor_priv == NULL) + return FALSE; + + glamor_priv->flags = flags; + if (flags & GLAMOR_INVERTED_Y_AXIS) { + glamor_priv->yInverted = TRUE; + } + else + glamor_priv->yInverted = FALSE; + + if (!dixRegisterPrivateKey(glamor_screen_private_key, PRIVATE_SCREEN, 0)) { + LogMessage(X_WARNING, + "glamor%d: Failed to allocate screen private\n", + screen->myNum); + goto fail; + } + + glamor_set_screen_private(screen, glamor_priv); + + if (!dixRegisterPrivateKey(glamor_pixmap_private_key, PRIVATE_PIXMAP, 0)) { + LogMessage(X_WARNING, + "glamor%d: Failed to allocate pixmap private\n", + screen->myNum); + goto fail;; + } + + if (epoxy_is_desktop_gl()) + glamor_priv->gl_flavor = GLAMOR_GL_DESKTOP; + else + glamor_priv->gl_flavor = GLAMOR_GL_ES2; + + gl_version = epoxy_gl_version(); + + /* Would be nice to have a cleaner test for GLSL 1.30 support, + * but for now this should suffice + */ + if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP && gl_version >= 30) + glamor_priv->glsl_version = 130; + else + glamor_priv->glsl_version = 120; + + + /* We'd like to require GL_ARB_map_buffer_range or + * GL_OES_map_buffer_range, since it offers more information to + * the driver than plain old glMapBuffer() or glBufferSubData(). + * It's been supported on Mesa on the desktop since 2009 and on + * GLES2 since October 2012. It's supported on Apple's iOS + * drivers for SGX535 and A7, but apparently not on most Android + * devices (the OES extension spec wasn't released until June + * 2012). + * + * 82% of 0 A.D. players (desktop GL) submitting hardware reports + * have support for it, with most of the ones lacking it being on + * Windows with Intel 4-series (G45) graphics or older. + */ + if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) { + if (gl_version < 21) { + ErrorF("Require OpenGL version 2.1 or later.\n"); + goto fail; + } + } else { + if (gl_version < 20) { + ErrorF("Require Open GLES2.0 or later.\n"); + goto fail; + } + + if (!epoxy_has_gl_extension("GL_EXT_texture_format_BGRA8888")) { + ErrorF("GL_EXT_texture_format_BGRA8888 required\n"); + goto fail; + } + } + + glamor_priv->has_khr_debug = epoxy_has_gl_extension("GL_KHR_debug"); + glamor_priv->has_pack_invert = + epoxy_has_gl_extension("GL_MESA_pack_invert"); + glamor_priv->has_fbo_blit = + epoxy_has_gl_extension("GL_EXT_framebuffer_blit"); + glamor_priv->has_map_buffer_range = + epoxy_has_gl_extension("GL_ARB_map_buffer_range"); + glamor_priv->has_buffer_storage = + epoxy_has_gl_extension("GL_ARB_buffer_storage"); + glGetIntegerv(GL_MAX_TEXTURE_SIZE, &glamor_priv->max_fbo_size); + glGetIntegerv(GL_MAX_VIEWPORT_DIMS, max_viewport_size); + glamor_priv->max_fbo_size = MIN(glamor_priv->max_fbo_size, max_viewport_size[0]); + glamor_priv->max_fbo_size = MIN(glamor_priv->max_fbo_size, max_viewport_size[1]); +#ifdef MAX_FBO_SIZE + glamor_priv->max_fbo_size = MAX_FBO_SIZE; +#endif + + glamor_set_debug_level(&glamor_debug_level); + + /* If we are using egl screen, call egl screen init to + * register correct close screen function. */ + if (flags & GLAMOR_USE_EGL_SCREEN) { + glamor_egl_screen_init(screen, &glamor_priv->ctx); + } else { + if (!glamor_glx_screen_init(&glamor_priv->ctx)) + goto fail; + } + + glamor_priv->saved_procs.close_screen = screen->CloseScreen; + screen->CloseScreen = glamor_close_screen; + + glamor_priv->saved_procs.create_screen_resources = + screen->CreateScreenResources; + screen->CreateScreenResources = glamor_create_screen_resources; + + if (!glamor_font_init(screen)) + goto fail; + + if (flags & GLAMOR_USE_SCREEN) { + if (!RegisterBlockAndWakeupHandlers(_glamor_block_handler, + _glamor_wakeup_handler, + glamor_priv)) { + goto fail; + } + + glamor_priv->saved_procs.create_gc = screen->CreateGC; + screen->CreateGC = glamor_create_gc; + + glamor_priv->saved_procs.create_pixmap = screen->CreatePixmap; + screen->CreatePixmap = glamor_create_pixmap; + + glamor_priv->saved_procs.destroy_pixmap = screen->DestroyPixmap; + screen->DestroyPixmap = glamor_destroy_pixmap; + + glamor_priv->saved_procs.get_spans = screen->GetSpans; + screen->GetSpans = glamor_get_spans; + + glamor_priv->saved_procs.get_image = screen->GetImage; + screen->GetImage = glamor_get_image; + + glamor_priv->saved_procs.change_window_attributes = + screen->ChangeWindowAttributes; + screen->ChangeWindowAttributes = glamor_change_window_attributes; + + glamor_priv->saved_procs.copy_window = screen->CopyWindow; + screen->CopyWindow = glamor_copy_window; + + glamor_priv->saved_procs.bitmap_to_region = screen->BitmapToRegion; + screen->BitmapToRegion = glamor_bitmap_to_region; + } +#ifdef RENDER + if (flags & GLAMOR_USE_PICTURE_SCREEN) { + glamor_priv->saved_procs.composite = ps->Composite; + ps->Composite = glamor_composite; + + glamor_priv->saved_procs.trapezoids = ps->Trapezoids; + ps->Trapezoids = glamor_trapezoids; + + glamor_priv->saved_procs.triangles = ps->Triangles; + ps->Triangles = glamor_triangles; + + glamor_priv->saved_procs.addtraps = ps->AddTraps; + ps->AddTraps = glamor_add_traps; + + } + + glamor_priv->saved_procs.composite_rects = ps->CompositeRects; + ps->CompositeRects = glamor_composite_rectangles; + + glamor_priv->saved_procs.glyphs = ps->Glyphs; + ps->Glyphs = glamor_glyphs; + + glamor_priv->saved_procs.unrealize_glyph = ps->UnrealizeGlyph; + ps->UnrealizeGlyph = glamor_glyph_unrealize; + + glamor_priv->saved_procs.create_picture = ps->CreatePicture; + ps->CreatePicture = glamor_create_picture; + + glamor_priv->saved_procs.destroy_picture = ps->DestroyPicture; + ps->DestroyPicture = glamor_destroy_picture; + glamor_init_composite_shaders(screen); +#endif + glamor_priv->saved_procs.set_window_pixmap = screen->SetWindowPixmap; + screen->SetWindowPixmap = glamor_set_window_pixmap; + + glamor_init_vbo(screen); + glamor_init_pixmap_fbo(screen); + glamor_init_solid_shader(screen); + glamor_init_tile_shader(screen); +#ifdef GLAMOR_TRAPEZOID_SHADER + glamor_init_trapezoid_shader(screen); +#endif + glamor_init_finish_access_shaders(screen); +#ifdef GLAMOR_GRADIENT_SHADER + glamor_init_gradient_shader(screen); +#endif + glamor_pixmap_init(screen); + glamor_glyphs_init(screen); + + glamor_priv->screen = screen; + + return TRUE; + + fail: + free(glamor_priv); + glamor_set_screen_private(screen, NULL); + return FALSE; +} + +static void +glamor_release_screen_priv(ScreenPtr screen) +{ + glamor_screen_private *glamor_priv; + + glamor_priv = glamor_get_screen_private(screen); +#ifdef RENDER + glamor_fini_composite_shaders(screen); +#endif + glamor_fini_vbo(screen); + glamor_fini_pixmap_fbo(screen); + glamor_fini_solid_shader(screen); + glamor_fini_tile_shader(screen); +#ifdef GLAMOR_TRAPEZOID_SHADER + glamor_fini_trapezoid_shader(screen); +#endif + glamor_fini_finish_access_shaders(screen); +#ifdef GLAMOR_GRADIENT_SHADER + glamor_fini_gradient_shader(screen); +#endif + glamor_pixmap_fini(screen); + free(glamor_priv); + + glamor_set_screen_private(screen, NULL); +} + +_X_EXPORT void +glamor_set_pixmap_private(PixmapPtr pixmap, glamor_pixmap_private *priv) +{ + glamor_pixmap_private *old_priv; + glamor_pixmap_fbo *fbo; + + old_priv = dixGetPrivate(&pixmap->devPrivates, glamor_pixmap_private_key); + + if (priv) { + assert(old_priv == NULL); + } + else { + if (old_priv == NULL) + return; + fbo = glamor_pixmap_detach_fbo(old_priv); + glamor_purge_fbo(fbo); + free(old_priv); + } + + dixSetPrivate(&pixmap->devPrivates, glamor_pixmap_private_key, priv); +} + +Bool +glamor_close_screen(ScreenPtr screen) +{ + glamor_screen_private *glamor_priv; + PixmapPtr screen_pixmap; + int flags; + +#ifdef RENDER + PictureScreenPtr ps = GetPictureScreenIfSet(screen); +#endif + glamor_priv = glamor_get_screen_private(screen); + flags = glamor_priv->flags; + glamor_glyphs_fini(screen); + screen->CloseScreen = glamor_priv->saved_procs.close_screen; + screen->CreateScreenResources = + glamor_priv->saved_procs.create_screen_resources; + if (flags & GLAMOR_USE_SCREEN) { + + screen->CreateGC = glamor_priv->saved_procs.create_gc; + screen->CreatePixmap = glamor_priv->saved_procs.create_pixmap; + screen->DestroyPixmap = glamor_priv->saved_procs.destroy_pixmap; + screen->GetSpans = glamor_priv->saved_procs.get_spans; + screen->ChangeWindowAttributes = + glamor_priv->saved_procs.change_window_attributes; + screen->CopyWindow = glamor_priv->saved_procs.copy_window; + screen->BitmapToRegion = glamor_priv->saved_procs.bitmap_to_region; + } +#ifdef RENDER + if (ps && (flags & GLAMOR_USE_PICTURE_SCREEN)) { + + ps->Composite = glamor_priv->saved_procs.composite; + ps->Trapezoids = glamor_priv->saved_procs.trapezoids; + ps->Triangles = glamor_priv->saved_procs.triangles; + ps->CreatePicture = glamor_priv->saved_procs.create_picture; + } + ps->CompositeRects = glamor_priv->saved_procs.composite_rects; + ps->Glyphs = glamor_priv->saved_procs.glyphs; + ps->UnrealizeGlyph = glamor_priv->saved_procs.unrealize_glyph; + screen->SetWindowPixmap = glamor_priv->saved_procs.set_window_pixmap; +#endif + screen_pixmap = screen->GetScreenPixmap(screen); + glamor_set_pixmap_private(screen_pixmap, NULL); + if (glamor_priv->back_pixmap && *glamor_priv->back_pixmap) + glamor_set_pixmap_private(*glamor_priv->back_pixmap, NULL); + + glamor_release_screen_priv(screen); + + return screen->CloseScreen(screen); +} + +void +glamor_fini(ScreenPtr screen) +{ + /* Do nothing currently. */ +} + +void +glamor_enable_dri3(ScreenPtr screen) +{ + glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); + + glamor_priv->dri3_enabled = TRUE; +} + +Bool +glamor_supports_pixmap_import_export(ScreenPtr screen) +{ + glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); + + return glamor_priv->dri3_enabled; +} + +_X_EXPORT int +glamor_fd_from_pixmap(ScreenPtr screen, + PixmapPtr pixmap, CARD16 *stride, CARD32 *size) +{ + glamor_pixmap_private *pixmap_priv; + glamor_screen_private *glamor_priv = + glamor_get_screen_private(pixmap->drawable.pScreen); + + pixmap_priv = glamor_get_pixmap_private(pixmap); + if (pixmap_priv == NULL || !glamor_priv->dri3_enabled) + return -1; + switch (pixmap_priv->type) { + case GLAMOR_TEXTURE_DRM: + case GLAMOR_TEXTURE_ONLY: + if (!glamor_pixmap_ensure_fbo(pixmap, GL_RGBA, 0)) + return -1; + return glamor_egl_dri3_fd_name_from_tex(screen, + pixmap, + pixmap_priv->base.fbo->tex, + FALSE, stride, size); + default: + break; + } + return -1; +} + +int +glamor_name_from_pixmap(PixmapPtr pixmap, CARD16 *stride, CARD32 *size) +{ + glamor_pixmap_private *pixmap_priv; + glamor_screen_private *glamor_priv = + glamor_get_screen_private(pixmap->drawable.pScreen); + + pixmap_priv = glamor_get_pixmap_private(pixmap); + if (pixmap_priv == NULL || !glamor_priv->dri3_enabled) + return -1; + switch (pixmap_priv->type) { + case GLAMOR_TEXTURE_DRM: + case GLAMOR_TEXTURE_ONLY: + if (!glamor_pixmap_ensure_fbo(pixmap, GL_RGBA, 0)) + return -1; + return glamor_egl_dri3_fd_name_from_tex(pixmap->drawable.pScreen, + pixmap, + pixmap_priv->base.fbo->tex, + TRUE, stride, size); + default: + break; + } + return -1; +} diff --git a/xserver/glamor/glamor.h b/xserver/glamor/glamor.h new file mode 100644 index 000000000..b0f2212d9 --- /dev/null +++ b/xserver/glamor/glamor.h @@ -0,0 +1,463 @@ +/* + * Copyright © 2008 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Authors: + * Eric Anholt <eric@anholt.net> + * Zhigang Gong <zhigang.gong@linux.intel.com> + * + */ + +#ifndef GLAMOR_H +#define GLAMOR_H + +#include <scrnintstr.h> +#include <pixmapstr.h> +#include <gcstruct.h> +#include <picturestr.h> +#include <fb.h> +#include <fbpict.h> +#ifdef GLAMOR_FOR_XORG +#include <xf86xv.h> +#endif + +struct glamor_context; + +/* + * glamor_pixmap_type : glamor pixmap's type. + * @MEMORY: pixmap is in memory. + * @TEXTURE_DRM: pixmap is in a texture created from a DRM buffer. + * @SEPARATE_TEXTURE: The texture is created from a DRM buffer, but + * the format is incompatible, so this type of pixmap + * will never fallback to DDX layer. + * @DRM_ONLY: pixmap is in a external DRM buffer. + * @TEXTURE_ONLY: pixmap is in an internal texture. + */ +typedef enum glamor_pixmap_type { + GLAMOR_MEMORY, + GLAMOR_MEMORY_MAP, + GLAMOR_TEXTURE_DRM, + GLAMOR_SEPARATE_TEXTURE, + GLAMOR_DRM_ONLY, + GLAMOR_TEXTURE_ONLY, + GLAMOR_TEXTURE_LARGE, + GLAMOR_TEXTURE_PACK +} glamor_pixmap_type_t; + +#define GLAMOR_EGL_EXTERNAL_BUFFER 3 +#define GLAMOR_INVERTED_Y_AXIS 1 +#define GLAMOR_USE_SCREEN (1 << 1) +#define GLAMOR_USE_PICTURE_SCREEN (1 << 2) +#define GLAMOR_USE_EGL_SCREEN (1 << 3) +#define GLAMOR_NO_DRI3 (1 << 4) +#define GLAMOR_VALID_FLAGS (GLAMOR_INVERTED_Y_AXIS \ + | GLAMOR_USE_SCREEN \ + | GLAMOR_USE_PICTURE_SCREEN \ + | GLAMOR_USE_EGL_SCREEN \ + | GLAMOR_NO_DRI3) + +/* @glamor_init: Initialize glamor internal data structure. + * + * @screen: Current screen pointer. + * @flags: Please refer the flags description above. + * + * @GLAMOR_INVERTED_Y_AXIS: + * set 1 means the GL env's origin (0,0) is at top-left. + * EGL/DRM platform is an example need to set this bit. + * glx platform's origin is at bottom-left thus need to + * clear this bit. + * + * @GLAMOR_USE_SCREEN: + * If running in an pre-existing X environment, and the + * gl context is GLX, then you should set this bit and + * let the glamor to handle all the screen related + * functions such as GC ops and CreatePixmap/DestroyPixmap. + * + * @GLAMOR_USE_PICTURE_SCREEN: + * If don't use any other underlying DDX driver to handle + * the picture related rendering functions, please set this + * bit on. Otherwise, clear this bit. And then it is the DDX + * driver's responsibility to determine how/when to jump to + * glamor's picture compositing path. + * + * @GLAMOR_USE_EGL_SCREEN: + * If you are using EGL layer, then please set this bit + * on, otherwise, clear it. + * + * This function initializes necessary internal data structure + * for glamor. And before calling into this function, the OpenGL + * environment should be ready. Should be called before any real + * glamor rendering or texture allocation functions. And should + * be called after the DDX's screen initialization or at the last + * step of the DDX's screen initialization. + */ +extern _X_EXPORT Bool glamor_init(ScreenPtr screen, unsigned int flags); +extern _X_EXPORT void glamor_fini(ScreenPtr screen); + +/* This function is used to free the glamor private screen's + * resources. If the DDX driver is not set GLAMOR_USE_SCREEN, + * then, DDX need to call this function at proper stage, if + * it is the xorg DDX driver,then it should be called at free + * screen stage not the close screen stage. The reason is after + * call to this function, the xorg DDX may need to destroy the + * screen pixmap which must be a glamor pixmap and requires + * the internal data structure still exist at that time. + * Otherwise, the glamor internal structure will not be freed.*/ +extern _X_EXPORT Bool glamor_close_screen(ScreenPtr screen); + +/* Let glamor to know the screen's fbo. The low level + * driver should already assign a tex + * to this pixmap through the set_pixmap_texture. */ +extern _X_EXPORT void glamor_set_screen_pixmap(PixmapPtr screen_pixmap, + PixmapPtr *back_pixmap); + +extern _X_EXPORT uint32_t glamor_get_pixmap_texture(PixmapPtr pixmap); + +extern _X_EXPORT Bool glamor_glyphs_init(ScreenPtr pScreen); + +extern _X_EXPORT void glamor_set_pixmap_texture(PixmapPtr pixmap, + unsigned int tex); + +extern _X_EXPORT void glamor_set_pixmap_type(PixmapPtr pixmap, + glamor_pixmap_type_t type); +extern _X_EXPORT void glamor_destroy_textured_pixmap(PixmapPtr pixmap); +extern _X_EXPORT void glamor_block_handler(ScreenPtr screen); + +extern _X_EXPORT PixmapPtr glamor_create_pixmap(ScreenPtr screen, int w, int h, + int depth, unsigned int usage); +extern _X_EXPORT Bool glamor_destroy_pixmap(PixmapPtr pixmap); + +#define GLAMOR_CREATE_PIXMAP_CPU 0x100 +#define GLAMOR_CREATE_PIXMAP_FIXUP 0x101 +#define GLAMOR_CREATE_FBO_NO_FBO 0x103 +#define GLAMOR_CREATE_PIXMAP_MAP 0x104 +#define GLAMOR_CREATE_NO_LARGE 0x105 +#define GLAMOR_CREATE_PIXMAP_NO_TEXTURE 0x106 + +/* @glamor_egl_exchange_buffers: Exchange the underlying buffers(KHR image,fbo). + * + * @front: front pixmap. + * @back: back pixmap. + * + * Used by the DRI2 page flip. This function will exchange the KHR images and + * fbos of the two pixmaps. + * */ +extern _X_EXPORT void glamor_egl_exchange_buffers(PixmapPtr front, + PixmapPtr back); + +extern _X_EXPORT void glamor_pixmap_exchange_fbos(PixmapPtr front, + PixmapPtr back); + +/* The DDX is not supposed to call these three functions */ +extern _X_EXPORT void glamor_enable_dri3(ScreenPtr screen); +extern _X_EXPORT unsigned int glamor_egl_create_argb8888_based_texture(ScreenPtr + screen, + int w, + int h); +extern _X_EXPORT int glamor_egl_dri3_fd_name_from_tex(ScreenPtr, PixmapPtr, + unsigned int, Bool, + CARD16 *, CARD32 *); + +/* @glamor_supports_pixmap_import_export: Returns whether + * glamor_fd_from_pixmap(), glamor_name_from_pixmap(), and + * glamor_pixmap_from_fd() are supported. + * + * @screen: Current screen pointer. + * + * To have DRI3 support enabled, glamor and glamor_egl need to be + * initialized. glamor also has to be compiled with gbm support. + * + * The EGL layer needs to have the following extensions working: + * + * .EGL_KHR_gl_texture_2D_image + * .EGL_EXT_image_dma_buf_import + * */ +extern _X_EXPORT Bool glamor_supports_pixmap_import_export(ScreenPtr screen); + +/* @glamor_fd_from_pixmap: Get a dma-buf fd from a pixmap. + * + * @screen: Current screen pointer. + * @pixmap: The pixmap from which we want the fd. + * @stride, @size: Pointers to fill the stride and size of the + * buffer associated to the fd. + * + * the pixmap and the buffer associated by the fd will share the same + * content. + * Returns the fd on success, -1 on error. + * */ +extern _X_EXPORT int glamor_fd_from_pixmap(ScreenPtr screen, + PixmapPtr pixmap, + CARD16 *stride, CARD32 *size); + +/** + * @glamor_name_from_pixmap: Gets a gem name from a pixmap. + * + * @pixmap: The pixmap from which we want the gem name. + * + * the pixmap and the buffer associated by the gem name will share the + * same content. This function can be used by the DDX to support DRI2, + * and needs the same set of buffer export GL extensions as DRI3 + * support. + * + * Returns the name on success, -1 on error. + * */ +extern _X_EXPORT int glamor_name_from_pixmap(PixmapPtr pixmap, + CARD16 *stride, CARD32 *size); + +/* @glamor_pixmap_from_fd: Creates a pixmap to wrap a dma-buf fd. + * + * @screen: Current screen pointer. + * @fd: The dma-buf fd to import. + * @width: The width of the buffer. + * @height: The height of the buffer. + * @stride: The stride of the buffer. + * @depth: The depth of the buffer. + * @bpp: The number of bpp of the buffer. + * + * Returns a valid pixmap if the import succeeded, else NULL. + * */ +extern _X_EXPORT PixmapPtr glamor_pixmap_from_fd(ScreenPtr screen, + int fd, + CARD16 width, + CARD16 height, + CARD16 stride, + CARD8 depth, + CARD8 bpp); + +#ifdef GLAMOR_FOR_XORG + +#define GLAMOR_EGL_MODULE_NAME "glamoregl" + +/* @glamor_egl_init: Initialize EGL environment. + * + * @scrn: Current screen info pointer. + * @fd: Current drm fd. + * + * This function creates and intialize EGL contexts. + * Should be called from DDX's preInit function. + * Return TRUE if success, otherwise return FALSE. + * */ +extern _X_EXPORT Bool glamor_egl_init(ScrnInfoPtr scrn, int fd); + +extern _X_EXPORT Bool glamor_egl_init_textured_pixmap(ScreenPtr screen); + +/* @glamor_egl_create_textured_screen: Create textured screen pixmap. + * + * @screen: screen pointer to be processed. + * @handle: screen pixmap's BO handle. + * @stride: screen pixmap's stride in bytes. + * + * This function is similar with the create_textured_pixmap. As the + * screen pixmap is a special, we handle it separately in this function. + */ +extern _X_EXPORT Bool glamor_egl_create_textured_screen(ScreenPtr screen, + int handle, int stride); + +/* @glamor_egl_create_textured_screen_ext: + * + * extent one parameter to track the pointer of the DDX layer's back pixmap. + * We need this pointer during the closing screen stage. As before back to + * the DDX's close screen, we have to free all the glamor related resources. + */ +extern _X_EXPORT Bool glamor_egl_create_textured_screen_ext(ScreenPtr screen, + int handle, + int stride, + PixmapPtr + *back_pixmap); + +/* + * @glamor_egl_create_textured_pixmap: Try to create a textured pixmap from + * a BO handle. + * + * @pixmap: The pixmap need to be processed. + * @handle: The BO's handle attached to this pixmap at DDX layer. + * @stride: Stride in bytes for this pixmap. + * + * This function try to create a texture from the handle and attach + * the texture to the pixmap , thus glamor can render to this pixmap + * as well. Return true if successful, otherwise return FALSE. + */ +extern _X_EXPORT Bool glamor_egl_create_textured_pixmap(PixmapPtr pixmap, + int handle, int stride); + +/* + * @glamor_egl_create_textured_pixmap_from_bo: Try to create a textured pixmap + * from a gbm_bo. + * + * @pixmap: The pixmap need to be processed. + * @bo: a pointer on a gbm_bo structure attached to this pixmap at DDX layer. + * + * This function is similar to glamor_egl_create_textured_pixmap. + */ +extern _X_EXPORT Bool + glamor_egl_create_textured_pixmap_from_gbm_bo(PixmapPtr pixmap, void *bo); + +#endif + +extern _X_EXPORT void glamor_egl_screen_init(ScreenPtr screen, + struct glamor_context *glamor_ctx); +extern _X_EXPORT void glamor_egl_destroy_textured_pixmap(PixmapPtr pixmap); + +extern _X_EXPORT int glamor_create_gc(GCPtr gc); + +extern _X_EXPORT void glamor_validate_gc(GCPtr gc, unsigned long changes, + DrawablePtr drawable); + +extern Bool _X_EXPORT glamor_change_window_attributes(WindowPtr pWin, unsigned long mask); +extern void _X_EXPORT glamor_copy_window(WindowPtr window, DDXPointRec old_origin, RegionPtr src_region); + +/* Glamor rendering/drawing functions with XXX_nf. + * nf means no fallback within glamor internal if possible. If glamor + * fail to accelerate the operation, glamor will return a false, and the + * caller need to implement fallback method. Return a true means the + * rendering request get done successfully. */ +extern _X_EXPORT Bool glamor_fill_spans_nf(DrawablePtr drawable, + GCPtr gc, + int n, DDXPointPtr points, + int *widths, int sorted); + +extern _X_EXPORT Bool glamor_poly_fill_rect_nf(DrawablePtr drawable, + GCPtr gc, + int nrect, xRectangle *prect); + +extern _X_EXPORT Bool glamor_put_image_nf(DrawablePtr drawable, + GCPtr gc, int depth, int x, int y, + int w, int h, int left_pad, + int image_format, char *bits); + +extern _X_EXPORT Bool glamor_copy_n_to_n_nf(DrawablePtr src, + DrawablePtr dst, + GCPtr gc, + BoxPtr box, + int nbox, + int dx, + int dy, + Bool reverse, + Bool upsidedown, Pixel bitplane, + void *closure); + +extern _X_EXPORT Bool glamor_composite_nf(CARD8 op, + PicturePtr source, + PicturePtr mask, + PicturePtr dest, + INT16 x_source, + INT16 y_source, + INT16 x_mask, + INT16 y_mask, + INT16 x_dest, INT16 y_dest, + CARD16 width, CARD16 height); + +extern _X_EXPORT Bool glamor_trapezoids_nf(CARD8 op, + PicturePtr src, PicturePtr dst, + PictFormatPtr mask_format, + INT16 x_src, INT16 y_src, + int ntrap, xTrapezoid *traps); + +extern _X_EXPORT Bool glamor_glyphs_nf(CARD8 op, + PicturePtr src, + PicturePtr dst, + PictFormatPtr mask_format, + INT16 x_src, + INT16 y_src, int nlist, + GlyphListPtr list, GlyphPtr *glyphs); + +extern _X_EXPORT Bool glamor_triangles_nf(CARD8 op, + PicturePtr pSrc, + PicturePtr pDst, + PictFormatPtr maskFormat, + INT16 xSrc, INT16 ySrc, + int ntris, xTriangle *tris); + +extern _X_EXPORT void glamor_glyph_unrealize(ScreenPtr screen, GlyphPtr glyph); + +extern _X_EXPORT Bool glamor_set_spans_nf(DrawablePtr drawable, GCPtr gc, + char *src, DDXPointPtr points, + int *widths, int n, int sorted); + +extern _X_EXPORT Bool glamor_get_spans_nf(DrawablePtr drawable, int wmax, + DDXPointPtr points, int *widths, + int count, char *dst); + +extern _X_EXPORT Bool glamor_composite_rects_nf(CARD8 op, + PicturePtr pDst, + xRenderColor *color, + int nRect, xRectangle *rects); + +extern _X_EXPORT Bool glamor_get_image_nf(DrawablePtr pDrawable, int x, int y, + int w, int h, unsigned int format, + unsigned long planeMask, char *d); + +extern _X_EXPORT Bool glamor_add_traps_nf(PicturePtr pPicture, + INT16 x_off, + INT16 y_off, int ntrap, + xTrap *traps); + +extern _X_EXPORT Bool glamor_copy_plane_nf(DrawablePtr pSrc, DrawablePtr pDst, + GCPtr pGC, int srcx, int srcy, int w, + int h, int dstx, int dsty, + unsigned long bitPlane, + RegionPtr *pRegion); + +extern _X_EXPORT Bool glamor_image_glyph_blt_nf(DrawablePtr pDrawable, + GCPtr pGC, int x, int y, + unsigned int nglyph, + CharInfoPtr *ppci, + void *pglyphBase); + +extern _X_EXPORT Bool glamor_poly_glyph_blt_nf(DrawablePtr pDrawable, GCPtr pGC, + int x, int y, + unsigned int nglyph, + CharInfoPtr *ppci, + void *pglyphBase); + +extern _X_EXPORT Bool glamor_push_pixels_nf(GCPtr pGC, PixmapPtr pBitmap, + DrawablePtr pDrawable, int w, int h, + int x, int y); + +extern _X_EXPORT Bool glamor_poly_point_nf(DrawablePtr pDrawable, GCPtr pGC, + int mode, int npt, DDXPointPtr ppt); + +extern _X_EXPORT Bool glamor_poly_segment_nf(DrawablePtr pDrawable, GCPtr pGC, + int nseg, xSegment *pSeg); + +extern _X_EXPORT Bool glamor_poly_lines_nf(DrawablePtr drawable, GCPtr gc, + int mode, int n, DDXPointPtr points); + +extern _X_EXPORT Bool glamor_poly_text8_nf(DrawablePtr drawable, GCPtr gc, + int x, int y, int count, char *chars, int *final_pos); + +extern _X_EXPORT Bool glamor_poly_text16_nf(DrawablePtr drawable, GCPtr gc, + int x, int y, int count, unsigned short *chars, int *final_pos); + +extern _X_EXPORT Bool glamor_image_text8_nf(DrawablePtr drawable, GCPtr gc, + int x, int y, int count, char *chars); + +extern _X_EXPORT Bool glamor_image_text16_nf(DrawablePtr drawable, GCPtr gc, + int x, int y, int count, unsigned short *chars); + +#define HAS_GLAMOR_TEXT 1 + +#ifdef GLAMOR_FOR_XORG +extern _X_EXPORT XF86VideoAdaptorPtr glamor_xv_init(ScreenPtr pScreen, + int num_texture_ports); +#endif + +#endif /* GLAMOR_H */ diff --git a/xserver/glamor/glamor_addtraps.c b/xserver/glamor/glamor_addtraps.c new file mode 100644 index 000000000..fdc0f4232 --- /dev/null +++ b/xserver/glamor/glamor_addtraps.c @@ -0,0 +1,61 @@ +/* + * Copyright © 2009 Intel Corporation + * Copyright © 1998 Keith Packard + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Authors: + * Zhigang Gong <zhigang.gong@gmail.com> + * + */ + +#include "glamor_priv.h" + +static Bool +_glamor_add_traps(PicturePtr pPicture, + INT16 x_off, + INT16 y_off, int ntrap, xTrap *traps, Bool fallback) +{ + if (!fallback + && (!pPicture->pDrawable + || glamor_ddx_fallback_check_pixmap(pPicture->pDrawable))) + return FALSE; + + if (glamor_prepare_access_picture(pPicture, GLAMOR_ACCESS_RW)) { + fbAddTraps(pPicture, x_off, y_off, ntrap, traps); + } + glamor_finish_access_picture(pPicture); + + return TRUE; +} + +void +glamor_add_traps(PicturePtr pPicture, + INT16 x_off, INT16 y_off, int ntrap, xTrap *traps) +{ + _glamor_add_traps(pPicture, x_off, y_off, ntrap, traps, TRUE); +} + +Bool +glamor_add_traps_nf(PicturePtr pPicture, + INT16 x_off, INT16 y_off, int ntrap, xTrap *traps) +{ + return _glamor_add_traps(pPicture, x_off, y_off, ntrap, traps, FALSE); +} diff --git a/xserver/glamor/glamor_compositerects.c b/xserver/glamor/glamor_compositerects.c new file mode 100644 index 000000000..3b6b2ed07 --- /dev/null +++ b/xserver/glamor/glamor_compositerects.c @@ -0,0 +1,276 @@ +/* + * Copyright © 2009 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Authors: + * Zhigang Gong <zhigang.gong@linux.intel.com> + * + * original author is Chris Wilson at sna. + * + */ + +#include "glamor_priv.h" +#include "mipict.h" +#include "damage.h" + +/** @file glamor_compositerects. + * + * compositeRects acceleration implementation + */ + +static int16_t +bound(int16_t a, uint16_t b) +{ + int v = (int) a + (int) b; + + if (v > MAXSHORT) + return MAXSHORT; + return v; +} + +static Bool +_pixman_region_init_clipped_rectangles(pixman_region16_t * region, + unsigned int num_rects, + xRectangle *rects, + int tx, int ty, BoxPtr extents) +{ + pixman_box16_t stack_boxes[64], *boxes = stack_boxes; + pixman_bool_t ret; + unsigned int i, j; + + if (num_rects > ARRAY_SIZE(stack_boxes)) { + boxes = malloc(sizeof(pixman_box16_t) * num_rects); + if (boxes == NULL) + return FALSE; + } + + for (i = j = 0; i < num_rects; i++) { + boxes[j].x1 = rects[i].x + tx; + if (boxes[j].x1 < extents->x1) + boxes[j].x1 = extents->x1; + + boxes[j].y1 = rects[i].y + ty; + if (boxes[j].y1 < extents->y1) + boxes[j].y1 = extents->y1; + + boxes[j].x2 = bound(rects[i].x + tx, rects[i].width); + if (boxes[j].x2 > extents->x2) + boxes[j].x2 = extents->x2; + + boxes[j].y2 = bound(rects[i].y + ty, rects[i].height); + if (boxes[j].y2 > extents->y2) + boxes[j].y2 = extents->y2; + + if (boxes[j].x2 > boxes[j].x1 && boxes[j].y2 > boxes[j].y1) + j++; + } + + ret = FALSE; + if (j) + ret = pixman_region_init_rects(region, boxes, j); + + if (boxes != stack_boxes) + free(boxes); + + DEBUGF("%s: nrects=%d, region=(%d, %d), (%d, %d) x %d\n", + __FUNCTION__, num_rects, + region->extents.x1, region->extents.y1, + region->extents.x2, region->extents.y2, j); + return ret; +} + +void +glamor_composite_rectangles(CARD8 op, + PicturePtr dst, + xRenderColor * color, + int num_rects, xRectangle *rects) +{ + PixmapPtr pixmap; + struct glamor_pixmap_private *priv; + pixman_region16_t region; + pixman_box16_t *boxes; + int dst_x, dst_y; + int num_boxes; + PicturePtr source = NULL; + Bool need_free_region = FALSE; + + DEBUGF("%s(op=%d, %08x x %d [(%d, %d)x(%d, %d) ...])\n", + __FUNCTION__, op, + (color->alpha >> 8 << 24) | + (color->red >> 8 << 16) | + (color->green >> 8 << 8) | + (color->blue >> 8 << 0), + num_rects, rects[0].x, rects[0].y, rects[0].width, rects[0].height); + + if (!num_rects) + return; + + if (RegionNil(dst->pCompositeClip)) { + DEBUGF("%s: empty clip, skipping\n", __FUNCTION__); + return; + } + + if ((color->red | color->green | color->blue | color->alpha) <= 0x00ff) { + switch (op) { + case PictOpOver: + case PictOpOutReverse: + case PictOpAdd: + return; + case PictOpInReverse: + case PictOpSrc: + op = PictOpClear; + break; + case PictOpAtopReverse: + op = PictOpOut; + break; + case PictOpXor: + op = PictOpOverReverse; + break; + } + } + if (color->alpha <= 0x00ff) { + switch (op) { + case PictOpOver: + case PictOpOutReverse: + return; + case PictOpInReverse: + op = PictOpClear; + break; + case PictOpAtopReverse: + op = PictOpOut; + break; + case PictOpXor: + op = PictOpOverReverse; + break; + } + } + else if (color->alpha >= 0xff00) { + switch (op) { + case PictOpOver: + op = PictOpSrc; + break; + case PictOpInReverse: + return; + case PictOpOutReverse: + op = PictOpClear; + break; + case PictOpAtopReverse: + op = PictOpOverReverse; + break; + case PictOpXor: + op = PictOpOut; + break; + } + } + DEBUGF("%s: converted to op %d\n", __FUNCTION__, op); + + if (!_pixman_region_init_clipped_rectangles(®ion, + num_rects, rects, + dst->pDrawable->x, + dst->pDrawable->y, + &dst->pCompositeClip->extents)) + { + DEBUGF("%s: allocation failed for region\n", __FUNCTION__); + return; + } + + pixmap = glamor_get_drawable_pixmap(dst->pDrawable); + priv = glamor_get_pixmap_private(pixmap); + + if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(priv)) + goto fallback; + if (dst->alphaMap) { + DEBUGF("%s: fallback, dst has an alpha-map\n", __FUNCTION__); + goto fallback; + } + + need_free_region = TRUE; + + DEBUGF("%s: drawable extents (%d, %d),(%d, %d) x %d\n", + __FUNCTION__, + RegionExtents(®ion)->x1, RegionExtents(®ion)->y1, + RegionExtents(®ion)->x2, RegionExtents(®ion)->y2, + RegionNumRects(®ion)); + + if (dst->pCompositeClip->data && + (!pixman_region_intersect(®ion, ®ion, dst->pCompositeClip) || + RegionNil(®ion))) { + DEBUGF("%s: zero-intersection between rectangles and clip\n", + __FUNCTION__); + pixman_region_fini(®ion); + return; + } + + DEBUGF("%s: clipped extents (%d, %d),(%d, %d) x %d\n", + __FUNCTION__, + RegionExtents(®ion)->x1, RegionExtents(®ion)->y1, + RegionExtents(®ion)->x2, RegionExtents(®ion)->y2, + RegionNumRects(®ion)); + + glamor_get_drawable_deltas(dst->pDrawable, pixmap, &dst_x, &dst_y); + pixman_region_translate(®ion, dst_x, dst_y); + + DEBUGF("%s: pixmap +(%d, %d) extents (%d, %d),(%d, %d)\n", + __FUNCTION__, dst_x, dst_y, + RegionExtents(®ion)->x1, RegionExtents(®ion)->y1, + RegionExtents(®ion)->x2, RegionExtents(®ion)->y2); + + boxes = pixman_region_rectangles(®ion, &num_boxes); + if (op == PictOpSrc || op == PictOpClear) { + CARD32 pixel; + + if (op == PictOpClear) + pixel = 0; + else + miRenderColorToPixel(dst->pFormat, color, &pixel); + glamor_solid_boxes(pixmap, boxes, num_boxes, pixel); + + goto done; + } + else { + if (_X_LIKELY(priv->type != GLAMOR_TEXTURE_LARGE)) { + int error; + + source = CreateSolidPicture(0, color, &error); + if (!source) + goto done; + if (glamor_composite_clipped_region(op, source, + NULL, dst, + NULL, NULL, priv, + ®ion, 0, 0, 0, 0, 0, 0)) + goto done; + } + } + fallback: + miCompositeRects(op, dst, color, num_rects, rects); + done: + /* XXX xserver-1.8: CompositeRects is not tracked by Damage, so we must + * manually append the damaged regions ourselves. + */ + DamageRegionAppend(&pixmap->drawable, ®ion); + DamageRegionProcessPending(&pixmap->drawable); + + if (need_free_region) + pixman_region_fini(®ion); + if (source) + FreePicture(source, 0); + return; +} diff --git a/xserver/glamor/glamor_context.h b/xserver/glamor/glamor_context.h new file mode 100644 index 000000000..47b87e620 --- /dev/null +++ b/xserver/glamor/glamor_context.h @@ -0,0 +1,49 @@ +/* + * Copyright © 2013 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +/** + * @file glamor_context.h + * + * This is the struct of state required for context switching in + * glamor. It has to use types that don't require including either + * server headers or Xlib headers, since it will be included by both + * the server and the GLX (xlib) code. + */ + +struct glamor_context { + /** Either an EGLDisplay or an Xlib Display */ + void *display; + + /** Either a GLXContext or an EGLContext. */ + void *ctx; + + /** The EGLSurface we should MakeCurrent to */ + void *drawable; + + /** The GLXDrawable we should MakeCurrent to */ + uint32_t drawable_xid; + + void (*make_current)(struct glamor_context *glamor_ctx); +}; + +Bool glamor_glx_screen_init(struct glamor_context *glamor_ctx); diff --git a/xserver/glamor/glamor_copyarea.c b/xserver/glamor/glamor_copyarea.c new file mode 100644 index 000000000..e1988225f --- /dev/null +++ b/xserver/glamor/glamor_copyarea.c @@ -0,0 +1,626 @@ +/* + * Copyright © 2008 Intel Corporation + * Copyright © 1998 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Keith Packard not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Keith Packard makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + * Authors: + * Eric Anholt <eric@anholt.net> + * Zhigang Gong <zhigang.gong@linux.intel.com> + */ + +#include "glamor_priv.h" + +/** @file glamor_copyarea.c + * + * GC CopyArea implementation + */ +static Bool +glamor_copy_n_to_n_fbo_blit(DrawablePtr src, + DrawablePtr dst, + GCPtr gc, BoxPtr box, int nbox, int dx, int dy) +{ + ScreenPtr screen = dst->pScreen; + PixmapPtr dst_pixmap = glamor_get_drawable_pixmap(dst); + PixmapPtr src_pixmap = glamor_get_drawable_pixmap(src); + glamor_pixmap_private *src_pixmap_priv, *dst_pixmap_priv; + glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); + int dst_x_off, dst_y_off, src_x_off, src_y_off, i; + int fbo_x_off, fbo_y_off; + int src_fbo_x_off, src_fbo_y_off; + + if (!glamor_priv->has_fbo_blit) { + glamor_delayed_fallback(screen, "no EXT_framebuffer_blit\n"); + return FALSE; + } + src_pixmap_priv = glamor_get_pixmap_private(src_pixmap); + dst_pixmap_priv = glamor_get_pixmap_private(dst_pixmap); + + if (gc) { + if (gc->alu != GXcopy) { + glamor_delayed_fallback(screen, "non-copy ALU\n"); + return FALSE; + } + } + + if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(src_pixmap_priv)) { + glamor_delayed_fallback(screen, "no src fbo\n"); + return FALSE; + } + + if (glamor_set_destination_pixmap(dst_pixmap)) + return FALSE; + + pixmap_priv_get_fbo_off(dst_pixmap_priv, &fbo_x_off, &fbo_y_off); + pixmap_priv_get_fbo_off(src_pixmap_priv, &src_fbo_x_off, &src_fbo_y_off); + + glamor_make_current(glamor_priv); + glBindFramebuffer(GL_READ_FRAMEBUFFER_EXT, src_pixmap_priv->base.fbo->fb); + glamor_get_drawable_deltas(dst, dst_pixmap, &dst_x_off, &dst_y_off); + glamor_get_drawable_deltas(src, src_pixmap, &src_x_off, &src_y_off); + dst_x_off += fbo_x_off; + dst_y_off += fbo_y_off; + src_y_off += dy + src_fbo_y_off; + src_x_off += src_fbo_x_off; + + for (i = 0; i < nbox; i++) { + if (glamor_priv->yInverted) { + glBlitFramebuffer(box[i].x1 + dx + src_x_off, + box[i].y1 + src_y_off, + box[i].x2 + dx + src_x_off, + box[i].y2 + src_y_off, + box[i].x1 + dst_x_off, + box[i].y1 + dst_y_off, + box[i].x2 + dst_x_off, + box[i].y2 + dst_y_off, + GL_COLOR_BUFFER_BIT, GL_NEAREST); + } + else { + int flip_dst_y1 = + dst_pixmap->drawable.height - (box[i].y2 + dst_y_off); + int flip_dst_y2 = + dst_pixmap->drawable.height - (box[i].y1 + dst_y_off); + int flip_src_y1 = + src_pixmap->drawable.height - (box[i].y2 + src_y_off); + int flip_src_y2 = + src_pixmap->drawable.height - (box[i].y1 + src_y_off); + + glBlitFramebuffer(box[i].x1 + dx + src_x_off, + flip_src_y1, + box[i].x2 + dx + src_x_off, + flip_src_y2, + box[i].x1 + dst_x_off, + flip_dst_y1, + box[i].x2 + dst_x_off, + flip_dst_y2, + GL_COLOR_BUFFER_BIT, GL_NEAREST); + } + } + glamor_priv->state = BLIT_STATE; + return TRUE; +} + +static Bool +glamor_copy_n_to_n_textured(DrawablePtr src, + DrawablePtr dst, + GCPtr gc, BoxPtr box, int nbox, int dx, int dy) +{ + glamor_screen_private *glamor_priv = + glamor_get_screen_private(dst->pScreen); + PixmapPtr src_pixmap = glamor_get_drawable_pixmap(src); + PixmapPtr dst_pixmap = glamor_get_drawable_pixmap(dst); + int i; + float vertices[8], texcoords[8]; + glamor_pixmap_private *src_pixmap_priv; + glamor_pixmap_private *dst_pixmap_priv; + int src_x_off, src_y_off, dst_x_off, dst_y_off; + enum glamor_pixmap_status src_status = GLAMOR_NONE; + GLfloat dst_xscale, dst_yscale, src_xscale, src_yscale; + + src_pixmap_priv = glamor_get_pixmap_private(src_pixmap); + dst_pixmap_priv = glamor_get_pixmap_private(dst_pixmap); + + if (src_pixmap_priv->base.gl_fbo == GLAMOR_FBO_UNATTACHED) { +#ifndef GLAMOR_PIXMAP_DYNAMIC_UPLOAD + glamor_delayed_fallback(dst->pScreen, "src has no fbo.\n"); + return FALSE; +#else + src_status = glamor_upload_pixmap_to_texture(src_pixmap); + if (src_status != GLAMOR_UPLOAD_DONE) + return FALSE; + + src_pixmap_priv = glamor_get_pixmap_private(src_pixmap); +#endif + } + + pixmap_priv_get_dest_scale(dst_pixmap_priv, &dst_xscale, &dst_yscale); + pixmap_priv_get_scale(src_pixmap_priv, &src_xscale, &src_yscale); + + glamor_get_drawable_deltas(dst, dst_pixmap, &dst_x_off, &dst_y_off); + + glamor_make_current(glamor_priv); + + glamor_set_destination_pixmap_priv_nc(dst_pixmap_priv); + glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT, + GL_FALSE, 2 * sizeof(float), vertices); + glEnableVertexAttribArray(GLAMOR_VERTEX_POS); + + glamor_get_drawable_deltas(src, src_pixmap, &src_x_off, &src_y_off); + dx += src_x_off; + dy += src_y_off; + + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D, src_pixmap_priv->base.fbo->tex); + if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) { + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER); + } + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + + glVertexAttribPointer(GLAMOR_VERTEX_SOURCE, 2, GL_FLOAT, GL_FALSE, + 2 * sizeof(float), texcoords); + glEnableVertexAttribArray(GLAMOR_VERTEX_SOURCE); + glUseProgram(glamor_priv->finish_access_prog[0]); + glUniform1i(glamor_priv->finish_access_revert[0], REVERT_NONE); + glUniform1i(glamor_priv->finish_access_swap_rb[0], SWAP_NONE_UPLOADING); + + for (i = 0; i < nbox; i++) { + + glamor_set_normalize_vcoords(dst_pixmap_priv, + dst_xscale, dst_yscale, + box[i].x1 + dst_x_off, + box[i].y1 + dst_y_off, + box[i].x2 + dst_x_off, + box[i].y2 + dst_y_off, + glamor_priv->yInverted, vertices); + + glamor_set_normalize_tcoords(src_pixmap_priv, + src_xscale, + src_yscale, + box[i].x1 + dx, + box[i].y1 + dy, + box[i].x2 + dx, + box[i].y2 + dy, + glamor_priv->yInverted, texcoords); + glDrawArrays(GL_TRIANGLE_FAN, 0, 4); + } + + glDisableVertexAttribArray(GLAMOR_VERTEX_POS); + glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE); + /* The source texture is bound to a fbo, we have to flush it here. */ + glamor_priv->state = RENDER_STATE; + glamor_priv->render_idle_cnt = 0; + return TRUE; +} + +static Bool +__glamor_copy_n_to_n(DrawablePtr src, + DrawablePtr dst, + GCPtr gc, + BoxPtr box, + int nbox, + int dx, + int dy, + Bool reverse, + Bool upsidedown, Pixel bitplane, void *closure) +{ + PixmapPtr dst_pixmap, src_pixmap, temp_pixmap = NULL; + DrawablePtr temp_src = src; + glamor_pixmap_private *dst_pixmap_priv, *src_pixmap_priv; + glamor_screen_private *glamor_priv; + BoxRec bound; + ScreenPtr screen; + int temp_dx = dx; + int temp_dy = dy; + int src_x_off, src_y_off, dst_x_off, dst_y_off; + int i; + int overlaped = 0; + Bool ret = FALSE; + + dst_pixmap = glamor_get_drawable_pixmap(dst); + dst_pixmap_priv = glamor_get_pixmap_private(dst_pixmap); + src_pixmap = glamor_get_drawable_pixmap(src); + src_pixmap_priv = glamor_get_pixmap_private(src_pixmap); + screen = dst_pixmap->drawable.pScreen; + glamor_priv = glamor_get_screen_private(dst->pScreen); + glamor_get_drawable_deltas(src, src_pixmap, &src_x_off, &src_y_off); + + glamor_get_drawable_deltas(dst, dst_pixmap, &dst_x_off, &dst_y_off); + + if (src_pixmap_priv->base.fbo + && src_pixmap_priv->base.fbo->fb == dst_pixmap_priv->base.fbo->fb) { + int x_shift = abs(src_x_off - dx - dst_x_off); + int y_shift = abs(src_y_off - dy - dst_y_off); + + for (i = 0; i < nbox; i++) { + if (x_shift < abs(box[i].x2 - box[i].x1) + && y_shift < abs(box[i].y2 - box[i].y1)) { + overlaped = 1; + break; + } + } + } + DEBUGF("Copy %d %d %dx%d dx %d dy %d from %p to %p \n", + box[0].x1, box[0].y1, + box[0].x2 - box[0].x1, box[0].y2 - box[0].y1, + dx, dy, src_pixmap, dst_pixmap); + if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP && + !overlaped && + (glamor_priv->state != RENDER_STATE + || !src_pixmap_priv->base.gl_tex || !dst_pixmap_priv->base.gl_tex) + && glamor_copy_n_to_n_fbo_blit(src, dst, gc, box, nbox, dx, dy)) { + ret = TRUE; + goto done; + } + glamor_calculate_boxes_bound(&bound, box, nbox); + + /* Overlaped indicate the src and dst are the same pixmap. */ + if (overlaped || (!GLAMOR_PIXMAP_PRIV_HAS_FBO(src_pixmap_priv) + && (((bound.x2 - bound.x1) * (bound.y2 - bound.y1) + * 4 > + src_pixmap->drawable.width * + src_pixmap->drawable.height) + || !(glamor_check_fbo_size(glamor_priv, + src_pixmap->drawable.width, + src_pixmap->drawable. + height))))) { + + temp_pixmap = glamor_create_pixmap(screen, + bound.x2 - bound.x1, + bound.y2 - bound.y1, + src_pixmap->drawable.depth, + overlaped ? 0 : + GLAMOR_CREATE_PIXMAP_CPU); + assert(bound.x2 - bound.x1 <= glamor_priv->max_fbo_size); + assert(bound.y2 - bound.y1 <= glamor_priv->max_fbo_size); + if (!temp_pixmap) + goto done; + glamor_translate_boxes(box, nbox, -bound.x1, -bound.y1); + temp_src = &temp_pixmap->drawable; + + if (overlaped) + glamor_copy_n_to_n_textured(src, temp_src, gc, box, + nbox, + temp_dx + bound.x1, temp_dy + bound.y1); + else + fbCopyNtoN(src, temp_src, gc, box, nbox, + temp_dx + bound.x1, temp_dy + bound.y1, + reverse, upsidedown, bitplane, closure); + glamor_translate_boxes(box, nbox, bound.x1, bound.y1); + temp_dx = -bound.x1; + temp_dy = -bound.y1; + } + else { + temp_dx = dx; + temp_dy = dy; + temp_src = src; + } + + if (glamor_copy_n_to_n_textured + (temp_src, dst, gc, box, nbox, temp_dx, temp_dy)) { + ret = TRUE; + } + done: + if (temp_src != src) + glamor_destroy_pixmap(temp_pixmap); + return ret; +} + +static Bool +_glamor_copy_n_to_n(DrawablePtr src, + DrawablePtr dst, + GCPtr gc, + BoxPtr box, + int nbox, + int dx, + int dy, + Bool reverse, + Bool upsidedown, Pixel bitplane, + void *closure, Bool fallback) +{ + ScreenPtr screen = dst->pScreen; + PixmapPtr dst_pixmap, src_pixmap; + glamor_pixmap_private *dst_pixmap_priv, *src_pixmap_priv; + glamor_screen_private *glamor_priv; + BoxPtr extent; + RegionRec region; + int src_x_off, src_y_off, dst_x_off, dst_y_off; + Bool ok = FALSE; + int force_clip = 0; + + if (nbox == 0) + return TRUE; + dst_pixmap = glamor_get_drawable_pixmap(dst); + dst_pixmap_priv = glamor_get_pixmap_private(dst_pixmap); + src_pixmap = glamor_get_drawable_pixmap(src); + src_pixmap_priv = glamor_get_pixmap_private(src_pixmap); + + glamor_priv = glamor_get_screen_private(screen); + + DEBUGF("Copy %d %d %dx%d dx %d dy %d from %p to %p \n", + box[0].x1, box[0].y1, + box[0].x2 - box[0].x1, box[0].y2 - box[0].y1, + dx, dy, src_pixmap, dst_pixmap); + + if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(dst_pixmap_priv)) + goto fall_back; + + if (gc) { + if (!glamor_set_planemask(dst_pixmap, gc->planemask)) + goto fall_back; + glamor_make_current(glamor_priv); + if (!glamor_set_alu(screen, gc->alu)) { + goto fail_noregion; + } + } + + if (!src_pixmap_priv) { + glamor_set_pixmap_type(src_pixmap, GLAMOR_MEMORY); + src_pixmap_priv = glamor_get_pixmap_private(src_pixmap); + } + + glamor_get_drawable_deltas(src, src_pixmap, &src_x_off, &src_y_off); + glamor_get_drawable_deltas(dst, dst_pixmap, &dst_x_off, &dst_y_off); + + RegionInitBoxes(®ion, box, nbox); + extent = RegionExtents(®ion); + + if (!glamor_check_fbo_size(glamor_priv, + extent->x2 - extent->x1, extent->y2 - extent->y1) + && (src_pixmap_priv->type == GLAMOR_MEMORY + || (src_pixmap_priv == dst_pixmap_priv))) { + force_clip = 1; + } + + if (force_clip || dst_pixmap_priv->type == GLAMOR_TEXTURE_LARGE + || src_pixmap_priv->type == GLAMOR_TEXTURE_LARGE) { + glamor_pixmap_clipped_regions *clipped_dst_regions; + int n_dst_region, i, j; + PixmapPtr temp_source_pixmap; + glamor_pixmap_private *temp_source_priv = NULL; + + RegionTranslate(®ion, dst_x_off, dst_y_off); + if (!force_clip) + clipped_dst_regions = + glamor_compute_clipped_regions(dst_pixmap_priv, ®ion, + &n_dst_region, 0, reverse, + upsidedown); + else + clipped_dst_regions = + glamor_compute_clipped_regions_ext(dst_pixmap_priv, ®ion, + &n_dst_region, + glamor_priv->max_fbo_size, + glamor_priv->max_fbo_size, + reverse, upsidedown); + for (i = 0; i < n_dst_region; i++) { + int n_src_region; + glamor_pixmap_clipped_regions *clipped_src_regions; + BoxPtr current_boxes; + int n_current_boxes; + + SET_PIXMAP_FBO_CURRENT(dst_pixmap_priv, + clipped_dst_regions[i].block_idx); + + temp_source_pixmap = NULL; + if (src_pixmap_priv->type == GLAMOR_TEXTURE_LARGE) { + RegionTranslate(clipped_dst_regions[i].region, + -dst_x_off + src_x_off + dx, + -dst_y_off + src_y_off + dy); + clipped_src_regions = + glamor_compute_clipped_regions(src_pixmap_priv, + clipped_dst_regions[i]. + region, &n_src_region, 0, + reverse, upsidedown); + DEBUGF("Source is large pixmap.\n"); + for (j = 0; j < n_src_region; j++) { + if (src_pixmap_priv != dst_pixmap_priv) + SET_PIXMAP_FBO_CURRENT(src_pixmap_priv, + clipped_src_regions[j]. + block_idx); + else if (src_pixmap_priv == dst_pixmap_priv && + clipped_src_regions[j].block_idx != + clipped_dst_regions[i].block_idx) { + /* source and the dest are the same, but need different block_idx. + * we create a empty pixmap and fill the required source fbo and box to + * it. It's a little hacky, but avoid extra copy. */ + temp_source_pixmap = + glamor_create_pixmap(src->pScreen, 0, 0, src->depth, + 0); + if (!temp_source_pixmap) { + ok = FALSE; + goto fail; + } + src->pScreen->ModifyPixmapHeader(temp_source_pixmap, + src_pixmap->drawable. + width, + src_pixmap->drawable. + height, 0, 0, + src_pixmap->devKind, + NULL); + temp_source_priv = + glamor_get_pixmap_private(temp_source_pixmap); + *temp_source_priv = *src_pixmap_priv; + temp_source_priv->large.box = + src_pixmap_priv->large. + box_array[clipped_src_regions[j].block_idx]; + temp_source_priv->base.fbo = + src_pixmap_priv->large. + fbo_array[clipped_src_regions[j].block_idx]; + temp_source_priv->base.pixmap = temp_source_pixmap; + } + assert(temp_source_pixmap || + !(src_pixmap_priv == dst_pixmap_priv && + (clipped_src_regions[j].block_idx != + clipped_dst_regions[i].block_idx))); + + RegionTranslate(clipped_src_regions[j].region, + -src_x_off - dx, -src_y_off - dy); + current_boxes = RegionRects(clipped_src_regions[j].region); + n_current_boxes = + RegionNumRects(clipped_src_regions[j].region); + DEBUGF("dst pixmap fbo idx %d src pixmap fbo idx %d \n", + clipped_dst_regions[i].block_idx, + clipped_src_regions[j].block_idx); + DEBUGF("Copy %d %d %d %d dx %d dy %d from %p to %p \n", + current_boxes[0].x1, current_boxes[0].y1, + current_boxes[0].x2, current_boxes[0].y2, dx, dy, + src_pixmap, dst_pixmap); + if (!temp_source_pixmap) + ok = __glamor_copy_n_to_n(src, dst, gc, current_boxes, + n_current_boxes, dx, dy, + reverse, upsidedown, bitplane, + closure); + else { + ok = __glamor_copy_n_to_n(&temp_source_pixmap->drawable, + dst, gc, current_boxes, + n_current_boxes, dx, dy, + reverse, upsidedown, bitplane, + closure); + temp_source_priv->type = GLAMOR_MEMORY; + temp_source_priv->base.fbo = NULL; + glamor_destroy_pixmap(temp_source_pixmap); + temp_source_pixmap = NULL; + } + + RegionDestroy(clipped_src_regions[j].region); + if (!ok) { + assert(0); + goto fail; + } + } + + if (n_src_region == 0) + ok = TRUE; + free(clipped_src_regions); + } + else { + RegionTranslate(clipped_dst_regions[i].region, + -dst_x_off, -dst_y_off); + current_boxes = RegionRects(clipped_dst_regions[i].region); + n_current_boxes = RegionNumRects(clipped_dst_regions[i].region); + + DEBUGF("dest pixmap fbo idx %d \n", + clipped_dst_regions[i].block_idx); + DEBUGF("Copy %d %d %d %d dx %d dy %d from %p to %p \n", + current_boxes[0].x1, current_boxes[0].y1, + current_boxes[0].x2, current_boxes[0].y2, + dx, dy, src_pixmap, dst_pixmap); + + ok = __glamor_copy_n_to_n(src, dst, gc, current_boxes, + n_current_boxes, dx, dy, reverse, + upsidedown, bitplane, closure); + + } + RegionDestroy(clipped_dst_regions[i].region); + } + if (n_dst_region == 0) + ok = TRUE; + free(clipped_dst_regions); + } + else { + ok = __glamor_copy_n_to_n(src, dst, gc, box, nbox, dx, dy, + reverse, upsidedown, bitplane, closure); + } + + fail: + RegionUninit(®ion); + fail_noregion: + glamor_make_current(glamor_priv); + glamor_set_alu(screen, GXcopy); + + if (ok) + return TRUE; + fall_back: + if (!fallback && glamor_ddx_fallback_check_pixmap(src) + && glamor_ddx_fallback_check_pixmap(dst)) + goto done; + + if (src_pixmap_priv->type == GLAMOR_DRM_ONLY + || dst_pixmap_priv->type == GLAMOR_DRM_ONLY) { + LogMessage(X_WARNING, + "Access a DRM only pixmap is not allowed within glamor.\n"); + return TRUE; + } + glamor_report_delayed_fallbacks(src->pScreen); + glamor_report_delayed_fallbacks(dst->pScreen); + + glamor_fallback("from %p to %p (%c,%c)\n", src, dst, + glamor_get_drawable_location(src), + glamor_get_drawable_location(dst)); + + if (glamor_prepare_access(dst, GLAMOR_ACCESS_RW) && + glamor_prepare_access(src, GLAMOR_ACCESS_RO) && + glamor_prepare_access_gc(gc)) { + fbCopyNtoN(src, dst, gc, box, nbox, + dx, dy, reverse, upsidedown, bitplane, closure); + } + glamor_finish_access_gc(gc); + glamor_finish_access(src); + glamor_finish_access(dst); + ok = TRUE; + + done: + glamor_clear_delayed_fallbacks(src->pScreen); + glamor_clear_delayed_fallbacks(dst->pScreen); + return ok; +} + +RegionPtr +glamor_copy_area(DrawablePtr src, DrawablePtr dst, GCPtr gc, + int srcx, int srcy, int width, int height, int dstx, int dsty) +{ + RegionPtr region; + + region = miDoCopy(src, dst, gc, + srcx, srcy, width, height, + dstx, dsty, glamor_copy_n_to_n, 0, NULL); + + return region; +} + +void +glamor_copy_n_to_n(DrawablePtr src, + DrawablePtr dst, + GCPtr gc, + BoxPtr box, + int nbox, + int dx, + int dy, + Bool reverse, Bool upsidedown, Pixel bitplane, void *closure) +{ + _glamor_copy_n_to_n(src, dst, gc, box, nbox, dx, + dy, reverse, upsidedown, bitplane, closure, TRUE); +} + +Bool +glamor_copy_n_to_n_nf(DrawablePtr src, + DrawablePtr dst, + GCPtr gc, + BoxPtr box, + int nbox, + int dx, + int dy, + Bool reverse, + Bool upsidedown, Pixel bitplane, void *closure) +{ + return _glamor_copy_n_to_n(src, dst, gc, box, nbox, dx, + dy, reverse, upsidedown, bitplane, closure, + FALSE); +} diff --git a/xserver/glamor/glamor_copyplane.c b/xserver/glamor/glamor_copyplane.c new file mode 100644 index 000000000..2bd2de30d --- /dev/null +++ b/xserver/glamor/glamor_copyplane.c @@ -0,0 +1,75 @@ +/* + * Copyright © 2009 Intel Corporation + * Copyright © 1998 Keith Packard + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Authors: + * Zhigang Gong <zhigang.gong@gmail.com> + * + */ + +#include "glamor_priv.h" + +static Bool +_glamor_copy_plane(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, + int srcx, int srcy, int w, int h, int dstx, int dsty, + unsigned long bitPlane, RegionPtr *pRegion, Bool fallback) +{ + if (!fallback && glamor_ddx_fallback_check_gc(pGC) + && glamor_ddx_fallback_check_pixmap(pSrc) + && glamor_ddx_fallback_check_pixmap(pDst)) + goto fail; + + if (glamor_prepare_access(pDst, GLAMOR_ACCESS_RW) && + glamor_prepare_access(pSrc, GLAMOR_ACCESS_RO) && + glamor_prepare_access_gc(pGC)) { + *pRegion = fbCopyPlane(pSrc, pDst, pGC, srcx, srcy, w, h, + dstx, dsty, bitPlane); + } + glamor_finish_access_gc(pGC); + glamor_finish_access(pSrc); + glamor_finish_access(pDst); + return TRUE; + + fail: + return FALSE; +} + +RegionPtr +glamor_copy_plane(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, + int srcx, int srcy, int w, int h, int dstx, int dsty, + unsigned long bitPlane) +{ + RegionPtr ret; + + _glamor_copy_plane(pSrc, pDst, pGC, srcx, srcy, w, h, + dstx, dsty, bitPlane, &ret, TRUE); + return ret; +} + +Bool +glamor_copy_plane_nf(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, + int srcx, int srcy, int w, int h, int dstx, int dsty, + unsigned long bitPlane, RegionPtr *pRegion) +{ + return _glamor_copy_plane(pSrc, pDst, pGC, srcx, srcy, w, h, + dstx, dsty, bitPlane, pRegion, FALSE); +} diff --git a/xserver/glamor/glamor_copywindow.c b/xserver/glamor/glamor_copywindow.c new file mode 100644 index 000000000..1ced4b336 --- /dev/null +++ b/xserver/glamor/glamor_copywindow.c @@ -0,0 +1,56 @@ +/* + * Copyright © 2008 Intel Corporation + * Copyright © 1998 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Keith Packard not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Keith Packard makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#include "glamor_priv.h" + +/** @file glamor_copywindow.c + * + * Screen CopyWindow implementation. + */ + +void +glamor_copy_window(WindowPtr win, DDXPointRec old_origin, RegionPtr src_region) +{ + RegionRec dst_region; + int dx, dy; + PixmapPtr pixmap = win->drawable.pScreen->GetWindowPixmap(win); + + dx = old_origin.x - win->drawable.x; + dy = old_origin.y - win->drawable.y; + REGION_TRANSLATE(win->drawable.pScreen, src_region, -dx, -dy); + + REGION_INIT(win->drawable.pScreen, &dst_region, NullBox, 0); + + REGION_INTERSECT(win->drawable.pScreen, &dst_region, + &win->borderClip, src_region); +#ifdef COMPOSITE + if (pixmap->screen_x || pixmap->screen_y) + REGION_TRANSLATE(win->drawable.pScreen, &dst_region, + -pixmap->screen_x, -pixmap->screen_y); +#endif + + miCopyRegion(&pixmap->drawable, &pixmap->drawable, + NULL, &dst_region, dx, dy, glamor_copy_n_to_n, 0, NULL); + + REGION_UNINIT(win->drawable.pScreen, &dst_region); +} diff --git a/xserver/glamor/glamor_core.c b/xserver/glamor/glamor_core.c new file mode 100644 index 000000000..b34943761 --- /dev/null +++ b/xserver/glamor/glamor_core.c @@ -0,0 +1,558 @@ +/* + * Copyright © 2001 Keith Packard + * Copyright © 2008 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Authors: + * Eric Anholt <eric@anholt.net> + * + */ + +/** @file glamor_core.c + * + * This file covers core X rendering in glamor. + */ + +#include <stdlib.h> + +#include "glamor_priv.h" + +const Bool +glamor_get_drawable_location(const DrawablePtr drawable) +{ + PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable); + glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap); + glamor_screen_private *glamor_priv = + glamor_get_screen_private(drawable->pScreen); + if (pixmap_priv == NULL || + pixmap_priv->base.gl_fbo == GLAMOR_FBO_UNATTACHED) + return 'm'; + if (pixmap_priv->base.fbo->fb == glamor_priv->screen_fbo) + return 's'; + else + return 'f'; +} + +GLint +glamor_compile_glsl_prog(GLenum type, const char *source) +{ + GLint ok; + GLint prog; + + prog = glCreateShader(type); + glShaderSource(prog, 1, (const GLchar **) &source, NULL); + glCompileShader(prog); + glGetShaderiv(prog, GL_COMPILE_STATUS, &ok); + if (!ok) { + GLchar *info; + GLint size; + + glGetShaderiv(prog, GL_INFO_LOG_LENGTH, &size); + info = malloc(size); + if (info) { + glGetShaderInfoLog(prog, size, NULL, info); + ErrorF("Failed to compile %s: %s\n", + type == GL_FRAGMENT_SHADER ? "FS" : "VS", info); + ErrorF("Program source:\n%s", source); + free(info); + } + else + ErrorF("Failed to get shader compilation info.\n"); + FatalError("GLSL compile failure\n"); + } + + return prog; +} + +void +glamor_link_glsl_prog(ScreenPtr screen, GLint prog, const char *format, ...) +{ + GLint ok; + glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); + + glLinkProgram(prog); + glGetProgramiv(prog, GL_LINK_STATUS, &ok); + if (!ok) { + GLchar *info; + GLint size; + + glGetProgramiv(prog, GL_INFO_LOG_LENGTH, &size); + info = malloc(size); + + glGetProgramInfoLog(prog, size, NULL, info); + ErrorF("Failed to link: %s\n", info); + FatalError("GLSL link failure\n"); + } + + if (glamor_priv->has_khr_debug) { + char *label; + va_list va; + + va_start(va, format); + XNFvasprintf(&label, format, va); + glObjectLabel(GL_PROGRAM, prog, -1, label); + free(label); + va_end(va); + } +} + +Bool +glamor_prepare_access(DrawablePtr drawable, glamor_access_t access) +{ + PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable); + glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap); + + if (pixmap->devPrivate.ptr) { + /* Already mapped, nothing needs to be done. Note that we + * aren't allowing promotion from RO to RW, because it would + * require re-mapping the PBO. + */ + assert(!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv) || + access == GLAMOR_ACCESS_RO || + pixmap_priv->base.map_access == GLAMOR_ACCESS_RW); + return TRUE; + } + pixmap_priv->base.map_access = access; + + return glamor_download_pixmap_to_cpu(pixmap, access); +} + +/* + * When downloading a unsupported color format to CPU memory, + we need to shuffle the color elements and then use a supported + color format to read it back to CPU memory. + + For an example, the picture's format is PICT_b8g8r8a8, + Then the expecting color layout is as below (little endian): + 0 1 2 3 : address + a r g b + + Now the in GLES2 the supported color format is GL_RGBA, type is + GL_UNSIGNED_TYPE, then we need to shuffle the fragment + color as : + frag_color = sample(texture).argb; + before we use glReadPixel to get it back. + + For the uploading process, the shuffle is a revert shuffle. + We still use GL_RGBA, GL_UNSIGNED_BYTE to upload the color + to a texture, then let's see + 0 1 2 3 : address + a r g b : correct colors + R G B A : GL_RGBA with GL_UNSIGNED_BYTE + + Now we need to shuffle again, the mapping rule is + r = G, g = B, b = A, a = R. Then the uploading shuffle is as + below: + frag_color = sample(texture).gbar; +*/ + +void +glamor_init_finish_access_shaders(ScreenPtr screen) +{ + glamor_screen_private *glamor_priv; + const char *vs_source = + "attribute vec4 v_position;\n" + "attribute vec4 v_texcoord0;\n" + "varying vec2 source_texture;\n" + "void main()\n" + "{\n" + " gl_Position = v_position;\n" + " source_texture = v_texcoord0.xy;\n" + "}\n"; + + const char *common_source = + GLAMOR_DEFAULT_PRECISION + "varying vec2 source_texture;\n" + "uniform sampler2D sampler;\n" + "uniform int revert;\n" + "uniform int swap_rb;\n" + "#define REVERT_NONE 0\n" + "#define REVERT_NORMAL 1\n" + "#define SWAP_NONE_DOWNLOADING 0\n" + "#define SWAP_DOWNLOADING 1\n" + "#define SWAP_UPLOADING 2\n" + "#define SWAP_NONE_UPLOADING 3\n"; + + const char *fs_source = + "void main()\n" + "{\n" + " if (revert == REVERT_NONE) \n" + " { \n" + " if ((swap_rb != SWAP_NONE_DOWNLOADING) && (swap_rb != SWAP_NONE_UPLOADING)) \n" + " gl_FragColor = texture2D(sampler, source_texture).bgra;\n" + " else \n" + " gl_FragColor = texture2D(sampler, source_texture).rgba;\n" + " } \n" + " else \n" + " { \n" + " if (swap_rb == SWAP_DOWNLOADING) \n" + " gl_FragColor = texture2D(sampler, source_texture).argb;\n" + " else if (swap_rb == SWAP_NONE_DOWNLOADING)\n" + " gl_FragColor = texture2D(sampler, source_texture).abgr;\n" + " else if (swap_rb == SWAP_UPLOADING)\n" + " gl_FragColor = texture2D(sampler, source_texture).gbar;\n" + " else if (swap_rb == SWAP_NONE_UPLOADING)\n" + " gl_FragColor = texture2D(sampler, source_texture).abgr;\n" + " } \n" + "}\n"; + + const char *set_alpha_source = + "void main()\n" + "{\n" + " if (revert == REVERT_NONE) \n" + " { \n" + " if ((swap_rb != SWAP_NONE_DOWNLOADING) && (swap_rb != SWAP_NONE_UPLOADING)) \n" + " gl_FragColor = vec4(texture2D(sampler, source_texture).bgr, 1);\n" + " else \n" + " gl_FragColor = vec4(texture2D(sampler, source_texture).rgb, 1);\n" + " } \n" + " else \n" + " { \n" + " if (swap_rb == SWAP_DOWNLOADING) \n" + " gl_FragColor = vec4(1, texture2D(sampler, source_texture).rgb);\n" + " else if (swap_rb == SWAP_NONE_DOWNLOADING)\n" + " gl_FragColor = vec4(1, texture2D(sampler, source_texture).bgr);\n" + " else if (swap_rb == SWAP_UPLOADING)\n" + " gl_FragColor = vec4(texture2D(sampler, source_texture).gba, 1);\n" + " else if (swap_rb == SWAP_NONE_UPLOADING)\n" + " gl_FragColor = vec4(texture2D(sampler, source_texture).abg, 1);\n" + " } \n" + "}\n"; + GLint fs_prog, vs_prog, avs_prog, set_alpha_prog; + GLint sampler_uniform_location; + char *source; + + glamor_priv = glamor_get_screen_private(screen); + glamor_make_current(glamor_priv); + glamor_priv->finish_access_prog[0] = glCreateProgram(); + glamor_priv->finish_access_prog[1] = glCreateProgram(); + + vs_prog = glamor_compile_glsl_prog(GL_VERTEX_SHADER, vs_source); + + XNFasprintf(&source, "%s%s", common_source, fs_source); + fs_prog = glamor_compile_glsl_prog(GL_FRAGMENT_SHADER, source); + free(source); + + glAttachShader(glamor_priv->finish_access_prog[0], vs_prog); + glAttachShader(glamor_priv->finish_access_prog[0], fs_prog); + + avs_prog = glamor_compile_glsl_prog(GL_VERTEX_SHADER, vs_source); + + XNFasprintf(&source, "%s%s", common_source, set_alpha_source); + set_alpha_prog = glamor_compile_glsl_prog(GL_FRAGMENT_SHADER, + source); + free(source); + + glAttachShader(glamor_priv->finish_access_prog[1], avs_prog); + glAttachShader(glamor_priv->finish_access_prog[1], set_alpha_prog); + + glBindAttribLocation(glamor_priv->finish_access_prog[0], + GLAMOR_VERTEX_POS, "v_position"); + glBindAttribLocation(glamor_priv->finish_access_prog[0], + GLAMOR_VERTEX_SOURCE, "v_texcoord0"); + glamor_link_glsl_prog(screen, glamor_priv->finish_access_prog[0], + "finish access 0"); + + glBindAttribLocation(glamor_priv->finish_access_prog[1], + GLAMOR_VERTEX_POS, "v_position"); + glBindAttribLocation(glamor_priv->finish_access_prog[1], + GLAMOR_VERTEX_SOURCE, "v_texcoord0"); + glamor_link_glsl_prog(screen, glamor_priv->finish_access_prog[1], + "finish access 1"); + + glamor_priv->finish_access_revert[0] = + glGetUniformLocation(glamor_priv->finish_access_prog[0], "revert"); + + glamor_priv->finish_access_swap_rb[0] = + glGetUniformLocation(glamor_priv->finish_access_prog[0], "swap_rb"); + sampler_uniform_location = + glGetUniformLocation(glamor_priv->finish_access_prog[0], "sampler"); + glUseProgram(glamor_priv->finish_access_prog[0]); + glUniform1i(sampler_uniform_location, 0); + glUniform1i(glamor_priv->finish_access_revert[0], 0); + glUniform1i(glamor_priv->finish_access_swap_rb[0], 0); + + glamor_priv->finish_access_revert[1] = + glGetUniformLocation(glamor_priv->finish_access_prog[1], "revert"); + glamor_priv->finish_access_swap_rb[1] = + glGetUniformLocation(glamor_priv->finish_access_prog[1], "swap_rb"); + sampler_uniform_location = + glGetUniformLocation(glamor_priv->finish_access_prog[1], "sampler"); + glUseProgram(glamor_priv->finish_access_prog[1]); + glUniform1i(glamor_priv->finish_access_revert[1], 0); + glUniform1i(sampler_uniform_location, 0); + glUniform1i(glamor_priv->finish_access_swap_rb[1], 0); +} + +void +glamor_fini_finish_access_shaders(ScreenPtr screen) +{ + glamor_screen_private *glamor_priv; + + glamor_priv = glamor_get_screen_private(screen); + glamor_make_current(glamor_priv); + glDeleteProgram(glamor_priv->finish_access_prog[0]); + glDeleteProgram(glamor_priv->finish_access_prog[1]); +} + +void +glamor_finish_access(DrawablePtr drawable) +{ + PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable); + glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap); + glamor_screen_private *glamor_priv = + glamor_get_screen_private(drawable->pScreen); + + if (!GLAMOR_PIXMAP_PRIV_HAS_FBO_DOWNLOADED(pixmap_priv)) + return; + + /* If we are doing a series of unmaps from a nested map, we're + * done. None of the callers do any rendering to maps after + * starting an unmap sequence, so we don't need to delay until the + * last nested unmap. + */ + if (!pixmap->devPrivate.ptr) + return; + + if (pixmap_priv->base.map_access == GLAMOR_ACCESS_RW) { + glamor_restore_pixmap_to_texture(pixmap); + } + + if (pixmap_priv->base.fbo->pbo != 0 && pixmap_priv->base.fbo->pbo_valid) { + assert(glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP); + + glamor_make_current(glamor_priv); + glBindBuffer(GL_PIXEL_PACK_BUFFER, 0); + glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0); + glDeleteBuffers(1, &pixmap_priv->base.fbo->pbo); + + pixmap_priv->base.fbo->pbo_valid = FALSE; + pixmap_priv->base.fbo->pbo = 0; + } + else { + free(pixmap->devPrivate.ptr); + } + + if (pixmap_priv->type == GLAMOR_TEXTURE_DRM) + pixmap->devKind = pixmap_priv->base.drm_stride; + + if (pixmap_priv->base.gl_fbo == GLAMOR_FBO_DOWNLOADED) + pixmap_priv->base.gl_fbo = GLAMOR_FBO_NORMAL; + + pixmap->devPrivate.ptr = NULL; +} + +/** + * Calls uxa_prepare_access with UXA_PREPARE_SRC for the tile, if that is the + * current fill style. + * + * Solid doesn't use an extra pixmap source, so we don't worry about them. + * Stippled/OpaqueStippled are 1bpp and can be in fb, so we should worry + * about them. + */ +Bool +glamor_prepare_access_gc(GCPtr gc) +{ + if (gc->stipple) { + if (!glamor_prepare_access(&gc->stipple->drawable, GLAMOR_ACCESS_RO)) + return FALSE; + } + if (gc->fillStyle == FillTiled) { + if (!glamor_prepare_access(&gc->tile.pixmap->drawable, + GLAMOR_ACCESS_RO)) { + if (gc->stipple) + glamor_finish_access(&gc->stipple->drawable); + return FALSE; + } + } + return TRUE; +} + +/** + * Finishes access to the tile in the GC, if used. + */ +void +glamor_finish_access_gc(GCPtr gc) +{ + if (gc->fillStyle == FillTiled) + glamor_finish_access(&gc->tile.pixmap->drawable); + if (gc->stipple) + glamor_finish_access(&gc->stipple->drawable); +} + +Bool +glamor_stipple(PixmapPtr pixmap, PixmapPtr stipple, + int x, int y, int width, int height, + unsigned char alu, unsigned long planemask, + unsigned long fg_pixel, unsigned long bg_pixel, + int stipple_x, int stipple_y) +{ + glamor_fallback("stubbed out stipple depth %d\n", pixmap->drawable.depth); + return FALSE; +} + +GCOps glamor_gc_ops = { + .FillSpans = glamor_fill_spans, + .SetSpans = glamor_set_spans, + .PutImage = glamor_put_image, + .CopyArea = glamor_copy_area, + .CopyPlane = glamor_copy_plane, + .PolyPoint = glamor_poly_point, + .Polylines = glamor_poly_lines, + .PolySegment = glamor_poly_segment, + .PolyRectangle = miPolyRectangle, + .PolyArc = miPolyArc, + .FillPolygon = miFillPolygon, + .PolyFillRect = glamor_poly_fill_rect, + .PolyFillArc = miPolyFillArc, + .PolyText8 = glamor_poly_text8, + .PolyText16 = glamor_poly_text16, + .ImageText8 = glamor_image_text8, + .ImageText16 = glamor_image_text16, + .ImageGlyphBlt = miImageGlyphBlt, + .PolyGlyphBlt = glamor_poly_glyph_blt, + .PushPixels = glamor_push_pixels, +}; + +/** + * uxa_validate_gc() sets the ops to glamor's implementations, which may be + * accelerated or may sync the card and fall back to fb. + */ +void +glamor_validate_gc(GCPtr gc, unsigned long changes, DrawablePtr drawable) +{ + /* fbValidateGC will do direct access to pixmaps if the tiling has changed. + * Preempt fbValidateGC by doing its work and masking the change out, so + * that we can do the Prepare/finish_access. + */ +#ifdef FB_24_32BIT + if ((changes & GCTile) && fbGetRotatedPixmap(gc)) { + gc->pScreen->DestroyPixmap(fbGetRotatedPixmap(gc)); + fbGetRotatedPixmap(gc) = 0; + } + + if (gc->fillStyle == FillTiled) { + PixmapPtr old_tile, new_tile; + + old_tile = gc->tile.pixmap; + if (old_tile->drawable.bitsPerPixel != drawable->bitsPerPixel) { + new_tile = fbGetRotatedPixmap(gc); + if (!new_tile || + new_tile->drawable.bitsPerPixel != drawable->bitsPerPixel) { + if (new_tile) + gc->pScreen->DestroyPixmap(new_tile); + /* fb24_32ReformatTile will do direct access of a newly- + * allocated pixmap. + */ + glamor_fallback + ("GC %p tile FB_24_32 transformat %p.\n", gc, old_tile); + + if (glamor_prepare_access + (&old_tile->drawable, GLAMOR_ACCESS_RO)) { + new_tile = + fb24_32ReformatTile(old_tile, drawable->bitsPerPixel); + glamor_finish_access(&old_tile->drawable); + } + } + if (new_tile) { + fbGetRotatedPixmap(gc) = old_tile; + gc->tile.pixmap = new_tile; + changes |= GCTile; + } + } + } +#endif + if (changes & GCTile) { + if (!gc->tileIsPixel) { + glamor_pixmap_private *pixmap_priv = + glamor_get_pixmap_private(gc->tile.pixmap); + if ((!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv)) + && FbEvenTile(gc->tile.pixmap->drawable.width * + drawable->bitsPerPixel)) { + glamor_fallback + ("GC %p tile changed %p.\n", gc, gc->tile.pixmap); + if (glamor_prepare_access + (&gc->tile.pixmap->drawable, GLAMOR_ACCESS_RW)) { + fbPadPixmap(gc->tile.pixmap); + glamor_finish_access(&gc->tile.pixmap->drawable); + } + } + } + /* Mask out the GCTile change notification, now that we've done FB's + * job for it. + */ + changes &= ~GCTile; + } + + if (changes & GCStipple && gc->stipple) { + /* We can't inline stipple handling like we do for GCTile because + * it sets fbgc privates. + */ + if (glamor_prepare_access(&gc->stipple->drawable, GLAMOR_ACCESS_RW)) { + fbValidateGC(gc, changes, drawable); + glamor_finish_access(&gc->stipple->drawable); + } + } + else { + fbValidateGC(gc, changes, drawable); + } + + gc->ops = &glamor_gc_ops; +} + +static GCFuncs glamor_gc_funcs = { + glamor_validate_gc, + miChangeGC, + miCopyGC, + miDestroyGC, + miChangeClip, + miDestroyClip, + miCopyClip +}; + +/** + * exaCreateGC makes a new GC and hooks up its funcs handler, so that + * exaValidateGC() will get called. + */ +int +glamor_create_gc(GCPtr gc) +{ + if (!fbCreateGC(gc)) + return FALSE; + + gc->funcs = &glamor_gc_funcs; + + return TRUE; +} + +RegionPtr +glamor_bitmap_to_region(PixmapPtr pixmap) +{ + RegionPtr ret; + + glamor_fallback("pixmap %p \n", pixmap); + if (!glamor_prepare_access(&pixmap->drawable, GLAMOR_ACCESS_RO)) + return NULL; + ret = fbPixmapToRegion(pixmap); + glamor_finish_access(&pixmap->drawable); + return ret; +} + diff --git a/xserver/glamor/glamor_debug.h b/xserver/glamor/glamor_debug.h new file mode 100644 index 000000000..638bee20c --- /dev/null +++ b/xserver/glamor/glamor_debug.h @@ -0,0 +1,107 @@ +/* + * Copyright © 2009 Intel Corporation + * Copyright © 1998 Keith Packard + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Authors: + * Zhigang Gong <zhigang.gong@gmail.com> + * + */ + +#ifndef __GLAMOR_DEBUG_H__ +#define __GLAMOR_DEBUG_H__ + +#define GLAMOR_DELAYED_STRING_MAX 64 + +#define GLAMOR_DEBUG_NONE 0 +#define GLAMOR_DEBUG_UNIMPL 0 +#define GLAMOR_DEBUG_FALLBACK 1 +#define GLAMOR_DEBUG_TEXTURE_DOWNLOAD 2 +#define GLAMOR_DEBUG_TEXTURE_DYNAMIC_UPLOAD 3 + +extern void +AbortServer(void) + _X_NORETURN; + +#define GLAMOR_PANIC(_format_, ...) \ + do { \ + LogMessageVerb(X_NONE, 0, "Glamor Fatal Error" \ + " at %32s line %d: " _format_ "\n", \ + __FUNCTION__, __LINE__, \ + ##__VA_ARGS__ ); \ + exit(1); \ + } while(0) + +#define __debug_output_message(_format_, _prefix_, ...) \ + LogMessageVerb(X_NONE, 0, \ + "%32s:\t" _format_ , \ + /*_prefix_,*/ \ + __FUNCTION__, \ + ##__VA_ARGS__) + +#define glamor_debug_output(_level_, _format_,...) \ + do { \ + if (glamor_debug_level >= _level_) \ + __debug_output_message(_format_, \ + "Glamor debug", \ + ##__VA_ARGS__); \ + } while(0) + +#define glamor_fallback(_format_,...) \ + do { \ + if (glamor_debug_level >= GLAMOR_DEBUG_FALLBACK) \ + __debug_output_message(_format_, \ + "Glamor fallback", \ + ##__VA_ARGS__);} while(0) + +#define glamor_delayed_fallback(_screen_, _format_,...) \ + do { \ + if (glamor_debug_level >= GLAMOR_DEBUG_FALLBACK) { \ + glamor_screen_private *_glamor_priv_; \ + _glamor_priv_ = glamor_get_screen_private(_screen_); \ + _glamor_priv_->delayed_fallback_pending = 1; \ + snprintf(_glamor_priv_->delayed_fallback_string, \ + GLAMOR_DELAYED_STRING_MAX, \ + "glamor delayed fallback: \t%s " _format_ , \ + __FUNCTION__, ##__VA_ARGS__); } } while(0) + +#define glamor_clear_delayed_fallbacks(_screen_) \ + do { \ + if (glamor_debug_level >= GLAMOR_DEBUG_FALLBACK) { \ + glamor_screen_private *_glamor_priv_; \ + _glamor_priv_ = glamor_get_screen_private(_screen_); \ + _glamor_priv_->delayed_fallback_pending = 0; } } while(0) + +#define glamor_report_delayed_fallbacks(_screen_) \ + do { \ + if (glamor_debug_level >= GLAMOR_DEBUG_FALLBACK) { \ + glamor_screen_private *_glamor_priv_; \ + _glamor_priv_ = glamor_get_screen_private(_screen_); \ + LogMessageVerb(X_INFO, 0, "%s", \ + _glamor_priv_->delayed_fallback_string); \ + _glamor_priv_->delayed_fallback_pending = 0; } } while(0) + +#define DEBUGF(str, ...) do {} while(0) +//#define DEBUGF(str, ...) ErrorF(str, ##__VA_ARGS__) +#define DEBUGRegionPrint(x) do {} while (0) +//#define DEBUGRegionPrint RegionPrint + +#endif diff --git a/xserver/glamor/glamor_egl.c b/xserver/glamor/glamor_egl.c new file mode 100644 index 000000000..54af2753e --- /dev/null +++ b/xserver/glamor/glamor_egl.c @@ -0,0 +1,833 @@ +/* + * Copyright © 2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including + * the next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Authors: + * Zhigang Gong <zhigang.gong@linux.intel.com> + * + */ + +#include "dix-config.h" + +#define GLAMOR_FOR_XORG +#include <xorg-server.h> +#include <unistd.h> +#include <fcntl.h> +#include <sys/ioctl.h> +#include <errno.h> +#include <xf86.h> +#include <xf86drm.h> +#define EGL_DISPLAY_NO_X_MESA + +#ifdef GLAMOR_HAS_GBM +#include <gbm.h> +#include <drm_fourcc.h> +#endif + +#define MESA_EGL_NO_X11_HEADERS +#include <epoxy/gl.h> +#include <epoxy/egl.h> + +#include "glamor.h" +#include "glamor_priv.h" +#include "dri3.h" + +static const char glamor_name[] = "glamor"; + +static void +glamor_identify(int flags) +{ + xf86Msg(X_INFO, "%s: OpenGL accelerated X.org driver based.\n", + glamor_name); +} + +struct glamor_egl_screen_private { + EGLDisplay display; + EGLContext context; + EGLint major, minor; + char *device_path; + + CreateScreenResourcesProcPtr CreateScreenResources; + CloseScreenProcPtr CloseScreen; + int fd; + EGLImageKHR front_image; + PixmapPtr *back_pixmap; + int cpp; +#ifdef GLAMOR_HAS_GBM + struct gbm_device *gbm; +#endif + int has_gem; + int gl_context_depth; + int dri3_capable; + + CloseScreenProcPtr saved_close_screen; + xf86FreeScreenProc *saved_free_screen; +}; + +int xf86GlamorEGLPrivateIndex = -1; + + +static struct glamor_egl_screen_private * +glamor_egl_get_screen_private(ScrnInfoPtr scrn) +{ + return (struct glamor_egl_screen_private *) + scrn->privates[xf86GlamorEGLPrivateIndex].ptr; +} + +static void +glamor_egl_make_current(struct glamor_context *glamor_ctx) +{ + /* There's only a single global dispatch table in Mesa. EGL, GLX, + * and AIGLX's direct dispatch table manipulation don't talk to + * each other. We need to set the context to NULL first to avoid + * EGL's no-op context change fast path when switching back to + * EGL. + */ + eglMakeCurrent(glamor_ctx->display, EGL_NO_SURFACE, + EGL_NO_SURFACE, EGL_NO_CONTEXT); + + if (!eglMakeCurrent(glamor_ctx->display, + EGL_NO_SURFACE, EGL_NO_SURFACE, + glamor_ctx->ctx)) { + FatalError("Failed to make EGL context current\n"); + } +} + +static EGLImageKHR +_glamor_egl_create_image(struct glamor_egl_screen_private *glamor_egl, + int width, int height, int stride, int name, int depth) +{ + EGLImageKHR image; + + EGLint attribs[] = { + EGL_WIDTH, 0, + EGL_HEIGHT, 0, + EGL_DRM_BUFFER_STRIDE_MESA, 0, + EGL_DRM_BUFFER_FORMAT_MESA, + EGL_DRM_BUFFER_FORMAT_ARGB32_MESA, + EGL_DRM_BUFFER_USE_MESA, + EGL_DRM_BUFFER_USE_SHARE_MESA | EGL_DRM_BUFFER_USE_SCANOUT_MESA, + EGL_NONE + }; + attribs[1] = width; + attribs[3] = height; + attribs[5] = stride; + if (depth != 32 && depth != 24) + return EGL_NO_IMAGE_KHR; + image = eglCreateImageKHR(glamor_egl->display, + glamor_egl->context, + EGL_DRM_BUFFER_MESA, + (void *) (uintptr_t) name, + attribs); + if (image == EGL_NO_IMAGE_KHR) + return EGL_NO_IMAGE_KHR; + + return image; +} + +static int +glamor_get_flink_name(int fd, int handle, int *name) +{ + struct drm_gem_flink flink; + + flink.handle = handle; + if (ioctl(fd, DRM_IOCTL_GEM_FLINK, &flink) < 0) + return FALSE; + *name = flink.name; + return TRUE; +} + +static Bool +glamor_create_texture_from_image(ScreenPtr screen, + EGLImageKHR image, GLuint * texture) +{ + struct glamor_screen_private *glamor_priv = + glamor_get_screen_private(screen); + + glamor_make_current(glamor_priv); + + glGenTextures(1, texture); + glBindTexture(GL_TEXTURE_2D, *texture); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + + glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, image); + glBindTexture(GL_TEXTURE_2D, 0); + + return TRUE; +} + +unsigned int +glamor_egl_create_argb8888_based_texture(ScreenPtr screen, int w, int h) +{ + ScrnInfoPtr scrn = xf86ScreenToScrn(screen); + struct glamor_egl_screen_private *glamor_egl; + EGLImageKHR image; + GLuint texture; + +#ifdef GLAMOR_HAS_GBM + struct gbm_bo *bo; + EGLNativePixmapType native_pixmap; + + glamor_egl = glamor_egl_get_screen_private(scrn); + bo = gbm_bo_create(glamor_egl->gbm, w, h, GBM_FORMAT_ARGB8888, + GBM_BO_USE_RENDERING | GBM_BO_USE_SCANOUT); + if (!bo) + return 0; + + /* If the following assignment raises an error or a warning + * then that means EGLNativePixmapType is not struct gbm_bo * + * on your platform: This code won't work and you should not + * compile with dri3 support enabled */ + native_pixmap = bo; + + image = eglCreateImageKHR(glamor_egl->display, + EGL_NO_CONTEXT, + EGL_NATIVE_PIXMAP_KHR, + native_pixmap, NULL); + gbm_bo_destroy(bo); + if (image == EGL_NO_IMAGE_KHR) + return 0; + glamor_create_texture_from_image(screen, image, &texture); + eglDestroyImageKHR(glamor_egl->display, image); + + return texture; +#else + return 0; /* this path should never happen */ +#endif +} + +Bool +glamor_egl_create_textured_screen(ScreenPtr screen, int handle, int stride) +{ + ScrnInfoPtr scrn = xf86ScreenToScrn(screen); + struct glamor_pixmap_private *pixmap_priv; + struct glamor_egl_screen_private *glamor_egl; + PixmapPtr screen_pixmap; + + glamor_egl = glamor_egl_get_screen_private(scrn); + screen_pixmap = screen->GetScreenPixmap(screen); + pixmap_priv = glamor_get_pixmap_private(screen_pixmap); + + if (!glamor_egl_create_textured_pixmap(screen_pixmap, handle, stride)) { + xf86DrvMsg(scrn->scrnIndex, X_ERROR, + "Failed to create textured screen."); + return FALSE; + } + + glamor_egl->front_image = pixmap_priv->base.image; + glamor_set_screen_pixmap(screen_pixmap, glamor_egl->back_pixmap); + return TRUE; +} + +Bool +glamor_egl_create_textured_screen_ext(ScreenPtr screen, + int handle, + int stride, PixmapPtr *back_pixmap) +{ + ScrnInfoPtr scrn = xf86ScreenToScrn(screen); + struct glamor_egl_screen_private *glamor_egl; + + glamor_egl = glamor_egl_get_screen_private(scrn); + + glamor_egl->back_pixmap = back_pixmap; + if (!glamor_egl_create_textured_screen(screen, handle, stride)) + return FALSE; + return TRUE; +} + +static Bool +glamor_egl_check_has_gem(int fd) +{ + struct drm_gem_flink flink; + + flink.handle = 0; + + ioctl(fd, DRM_IOCTL_GEM_FLINK, &flink); + if (errno == ENOENT || errno == EINVAL) + return TRUE; + return FALSE; +} + +Bool +glamor_egl_create_textured_pixmap(PixmapPtr pixmap, int handle, int stride) +{ + ScreenPtr screen = pixmap->drawable.pScreen; + ScrnInfoPtr scrn = xf86ScreenToScrn(screen); + struct glamor_screen_private *glamor_priv = + glamor_get_screen_private(screen); + struct glamor_pixmap_private *pixmap_priv = + glamor_get_pixmap_private(pixmap); + struct glamor_egl_screen_private *glamor_egl; + EGLImageKHR image; + GLuint texture; + int name; + Bool ret = FALSE; + + glamor_egl = glamor_egl_get_screen_private(scrn); + + glamor_make_current(glamor_priv); + if (glamor_egl->has_gem) { + if (!glamor_get_flink_name(glamor_egl->fd, handle, &name)) { + xf86DrvMsg(scrn->scrnIndex, X_ERROR, + "Couldn't flink pixmap handle\n"); + glamor_set_pixmap_type(pixmap, GLAMOR_DRM_ONLY); + assert(0); + return FALSE; + } + } + else + name = handle; + + image = _glamor_egl_create_image(glamor_egl, + pixmap->drawable.width, + pixmap->drawable.height, + ((stride * 8 + + 7) / pixmap->drawable.bitsPerPixel), + name, pixmap->drawable.depth); + if (image == EGL_NO_IMAGE_KHR) { + glamor_set_pixmap_type(pixmap, GLAMOR_DRM_ONLY); + goto done; + } + glamor_create_texture_from_image(screen, image, &texture); + glamor_set_pixmap_type(pixmap, GLAMOR_TEXTURE_DRM); + glamor_set_pixmap_texture(pixmap, texture); + pixmap_priv->base.image = image; + ret = TRUE; + + done: + return ret; +} + +Bool +glamor_egl_create_textured_pixmap_from_gbm_bo(PixmapPtr pixmap, void *bo) +{ + ScreenPtr screen = pixmap->drawable.pScreen; + ScrnInfoPtr scrn = xf86ScreenToScrn(screen); + struct glamor_screen_private *glamor_priv = + glamor_get_screen_private(screen); + struct glamor_pixmap_private *pixmap_priv = + glamor_get_pixmap_private(pixmap); + struct glamor_egl_screen_private *glamor_egl; + EGLImageKHR image; + GLuint texture; + Bool ret = FALSE; + + glamor_egl = glamor_egl_get_screen_private(scrn); + + glamor_make_current(glamor_priv); + + image = eglCreateImageKHR(glamor_egl->display, + glamor_egl->context, + EGL_NATIVE_PIXMAP_KHR, bo, NULL); + if (image == EGL_NO_IMAGE_KHR) { + glamor_set_pixmap_type(pixmap, GLAMOR_DRM_ONLY); + goto done; + } + glamor_create_texture_from_image(screen, image, &texture); + glamor_set_pixmap_type(pixmap, GLAMOR_TEXTURE_DRM); + glamor_set_pixmap_texture(pixmap, texture); + pixmap_priv->base.image = image; + ret = TRUE; + + done: + return ret; +} + +#ifdef GLAMOR_HAS_GBM +int glamor_get_fd_from_bo(int gbm_fd, struct gbm_bo *bo, int *fd); +void glamor_get_name_from_bo(int gbm_fd, struct gbm_bo *bo, int *name); +int +glamor_get_fd_from_bo(int gbm_fd, struct gbm_bo *bo, int *fd) +{ + union gbm_bo_handle handle; + struct drm_prime_handle args; + + handle = gbm_bo_get_handle(bo); + args.handle = handle.u32; + args.flags = DRM_CLOEXEC; + if (ioctl(gbm_fd, DRM_IOCTL_PRIME_HANDLE_TO_FD, &args)) + return FALSE; + *fd = args.fd; + return TRUE; +} + +void +glamor_get_name_from_bo(int gbm_fd, struct gbm_bo *bo, int *name) +{ + union gbm_bo_handle handle; + + handle = gbm_bo_get_handle(bo); + if (!glamor_get_flink_name(gbm_fd, handle.u32, name)) + *name = -1; +} +#endif + +int +glamor_egl_dri3_fd_name_from_tex(ScreenPtr screen, + PixmapPtr pixmap, + unsigned int tex, + Bool want_name, CARD16 *stride, CARD32 *size) +{ +#ifdef GLAMOR_HAS_GBM + ScrnInfoPtr scrn = xf86ScreenToScrn(screen); + struct glamor_pixmap_private *pixmap_priv = + glamor_get_pixmap_private(pixmap); + struct glamor_screen_private *glamor_priv = + glamor_get_screen_private(screen); + struct glamor_egl_screen_private *glamor_egl; + EGLImageKHR image; + struct gbm_bo *bo; + int fd = -1; + + EGLint attribs[] = { + EGL_IMAGE_PRESERVED_KHR, EGL_TRUE, + EGL_GL_TEXTURE_LEVEL_KHR, 0, + EGL_NONE + }; + + glamor_egl = glamor_egl_get_screen_private(scrn); + + glamor_make_current(glamor_priv); + + image = pixmap_priv->base.image; + if (!image) { + image = eglCreateImageKHR(glamor_egl->display, + glamor_egl->context, + EGL_GL_TEXTURE_2D_KHR, + (EGLClientBuffer) (uintptr_t) + tex, attribs); + if (image == EGL_NO_IMAGE_KHR) + goto failure; + + pixmap_priv->base.image = image; + glamor_set_pixmap_type(pixmap, GLAMOR_TEXTURE_DRM); + } + + bo = gbm_bo_import(glamor_egl->gbm, GBM_BO_IMPORT_EGL_IMAGE, image, 0); + if (!bo) + goto failure; + + pixmap->devKind = gbm_bo_get_stride(bo); + + if (want_name) { + if (glamor_egl->has_gem) + glamor_get_name_from_bo(glamor_egl->fd, bo, &fd); + } + else { + if (glamor_get_fd_from_bo(glamor_egl->fd, bo, &fd)) { + } + } + *stride = pixmap->devKind; + *size = pixmap->devKind * gbm_bo_get_height(bo); + + gbm_bo_destroy(bo); + failure: + return fd; +#else + return -1; +#endif +} + +_X_EXPORT PixmapPtr +glamor_pixmap_from_fd(ScreenPtr screen, + int fd, + CARD16 width, + CARD16 height, + CARD16 stride, CARD8 depth, CARD8 bpp) +{ +#ifdef GLAMOR_HAS_GBM + ScrnInfoPtr scrn = xf86ScreenToScrn(screen); + struct glamor_egl_screen_private *glamor_egl; + struct gbm_bo *bo; + EGLImageKHR image; + PixmapPtr pixmap; + Bool ret = FALSE; + + EGLint attribs[] = { + EGL_WIDTH, 0, + EGL_HEIGHT, 0, + EGL_LINUX_DRM_FOURCC_EXT, DRM_FORMAT_ARGB8888, + EGL_DMA_BUF_PLANE0_FD_EXT, 0, + EGL_DMA_BUF_PLANE0_OFFSET_EXT, 0, + EGL_DMA_BUF_PLANE0_PITCH_EXT, 0, + EGL_NONE + }; + + glamor_egl = glamor_egl_get_screen_private(scrn); + + if (!glamor_egl->dri3_capable) + return NULL; + + if (bpp != 32 || !(depth == 24 || depth == 32) || width == 0 || height == 0) + return NULL; + + attribs[1] = width; + attribs[3] = height; + attribs[7] = fd; + attribs[11] = stride; + image = eglCreateImageKHR(glamor_egl->display, + EGL_NO_CONTEXT, + EGL_LINUX_DMA_BUF_EXT, + NULL, attribs); + + if (image == EGL_NO_IMAGE_KHR) + return NULL; + + /* EGL_EXT_image_dma_buf_import can impose restrictions on the + * usage of the image. Use gbm_bo to bypass the limitations. */ + + bo = gbm_bo_import(glamor_egl->gbm, GBM_BO_IMPORT_EGL_IMAGE, image, 0); + eglDestroyImageKHR(glamor_egl->display, image); + + if (!bo) + return NULL; + + pixmap = screen->CreatePixmap(screen, 0, 0, depth, 0); + screen->ModifyPixmapHeader(pixmap, width, height, 0, 0, stride, NULL); + + ret = glamor_egl_create_textured_pixmap_from_gbm_bo(pixmap, bo); + gbm_bo_destroy(bo); + + if (ret) + return pixmap; + else { + screen->DestroyPixmap(pixmap); + return NULL; + } +#else + return NULL; +#endif +} + +static void +_glamor_egl_destroy_pixmap_image(PixmapPtr pixmap) +{ + ScrnInfoPtr scrn = xf86ScreenToScrn(pixmap->drawable.pScreen); + struct glamor_egl_screen_private *glamor_egl = + glamor_egl_get_screen_private(scrn); + struct glamor_pixmap_private *pixmap_priv = + glamor_get_pixmap_private(pixmap); + + if (pixmap_priv->base.image) { + /* Before destroy an image which was attached to + * a texture. we must call glFlush to make sure the + * operation on that texture has been done.*/ + glamor_block_handler(pixmap->drawable.pScreen); + eglDestroyImageKHR(glamor_egl->display, pixmap_priv->base.image); + pixmap_priv->base.image = NULL; + } +} + +_X_EXPORT void +glamor_egl_exchange_buffers(PixmapPtr front, PixmapPtr back) +{ + ScrnInfoPtr scrn = xf86ScreenToScrn(front->drawable.pScreen); + struct glamor_egl_screen_private *glamor_egl = + glamor_egl_get_screen_private(scrn); + EGLImageKHR temp; + struct glamor_pixmap_private *front_priv = + glamor_get_pixmap_private(front); + struct glamor_pixmap_private *back_priv = + glamor_get_pixmap_private(back); + + glamor_pixmap_exchange_fbos(front, back); + + temp = back_priv->base.image; + back_priv->base.image = front_priv->base.image; + front_priv->base.image = temp; + + glamor_set_pixmap_type(front, GLAMOR_TEXTURE_DRM); + glamor_set_pixmap_type(back, GLAMOR_TEXTURE_DRM); + glamor_egl->front_image = front_priv->base.image; + +} + +void +glamor_egl_destroy_textured_pixmap(PixmapPtr pixmap) +{ + if (pixmap->refcnt == 1) + _glamor_egl_destroy_pixmap_image(pixmap); + glamor_destroy_textured_pixmap(pixmap); +} + +static Bool +glamor_egl_close_screen(ScreenPtr screen) +{ + ScrnInfoPtr scrn; + struct glamor_egl_screen_private *glamor_egl; + struct glamor_pixmap_private *pixmap_priv; + PixmapPtr screen_pixmap; + + scrn = xf86ScreenToScrn(screen); + glamor_egl = glamor_egl_get_screen_private(scrn); + screen_pixmap = screen->GetScreenPixmap(screen); + pixmap_priv = glamor_get_pixmap_private(screen_pixmap); + + eglDestroyImageKHR(glamor_egl->display, glamor_egl->front_image); + pixmap_priv->base.image = NULL; + glamor_egl->front_image = NULL; + + if (glamor_egl->back_pixmap && *glamor_egl->back_pixmap) { + pixmap_priv = glamor_get_pixmap_private(*glamor_egl->back_pixmap); + if (pixmap_priv->base.image) { + eglDestroyImageKHR(glamor_egl->display, pixmap_priv->base.image); + pixmap_priv->base.image = NULL; + } + } + + screen->CloseScreen = glamor_egl->saved_close_screen; + + return screen->CloseScreen(screen); +} + +static int +glamor_dri3_open_client(ClientPtr client, + ScreenPtr screen, + RRProviderPtr provider, + int *fdp) +{ + ScrnInfoPtr scrn = xf86ScreenToScrn(screen); + struct glamor_egl_screen_private *glamor_egl = + glamor_egl_get_screen_private(scrn); + int fd; + drm_magic_t magic; + + fd = open(glamor_egl->device_path, O_RDWR|O_CLOEXEC); + if (fd < 0) + return BadAlloc; + + /* Before FD passing in the X protocol with DRI3 (and increased + * security of rendering with per-process address spaces on the + * GPU), the kernel had to come up with a way to have the server + * decide which clients got to access the GPU, which was done by + * each client getting a unique (magic) number from the kernel, + * passing it to the server, and the server then telling the + * kernel which clients were authenticated for using the device. + * + * Now that we have FD passing, the server can just set up the + * authentication on its own and hand the prepared FD off to the + * client. + */ + if (drmGetMagic(fd, &magic) < 0) { + if (errno == EACCES) { + /* Assume that we're on a render node, and the fd is + * already as authenticated as it should be. + */ + *fdp = fd; + return Success; + } else { + close(fd); + return BadMatch; + } + } + + if (drmAuthMagic(glamor_egl->fd, magic) < 0) { + close(fd); + return BadMatch; + } + + *fdp = fd; + return Success; +} + +static dri3_screen_info_rec glamor_dri3_info = { + .version = 1, + .open_client = glamor_dri3_open_client, + .pixmap_from_fd = glamor_pixmap_from_fd, + .fd_from_pixmap = glamor_fd_from_pixmap, +}; + +void +glamor_egl_screen_init(ScreenPtr screen, struct glamor_context *glamor_ctx) +{ + ScrnInfoPtr scrn = xf86ScreenToScrn(screen); + glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); + struct glamor_egl_screen_private *glamor_egl = + glamor_egl_get_screen_private(scrn); + + glamor_egl->saved_close_screen = screen->CloseScreen; + screen->CloseScreen = glamor_egl_close_screen; + + glamor_ctx->ctx = glamor_egl->context; + glamor_ctx->display = glamor_egl->display; + + glamor_ctx->make_current = glamor_egl_make_current; + + if (glamor_egl->dri3_capable) { + /* Tell the core that we have the interfaces for import/export + * of pixmaps. + */ + glamor_enable_dri3(screen); + + /* If the driver wants to do its own auth dance (e.g. Xwayland + * on pre-3.15 kernels that don't have render nodes and thus + * has the wayland compositor as a master), then it needs us + * to stay out of the way and let it init DRI3 on its own. + */ + if (!(glamor_priv->flags & GLAMOR_NO_DRI3)) { + /* To do DRI3 device FD generation, we need to open a new fd + * to the same device we were handed in originally. + */ + glamor_egl->device_path = drmGetDeviceNameFromFd(glamor_egl->fd); + + if (!dri3_screen_init(screen, &glamor_dri3_info)) { + xf86DrvMsg(scrn->scrnIndex, X_ERROR, + "Failed to initialize DRI3.\n"); + } + } + } +} + +static void +glamor_egl_free_screen(ScrnInfoPtr scrn) +{ + struct glamor_egl_screen_private *glamor_egl; + + glamor_egl = glamor_egl_get_screen_private(scrn); + if (glamor_egl != NULL) { + + eglMakeCurrent(glamor_egl->display, + EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); +#ifdef GLAMOR_HAS_GBM + if (glamor_egl->gbm) + gbm_device_destroy(glamor_egl->gbm); +#endif + free(glamor_egl->device_path); + + scrn->FreeScreen = glamor_egl->saved_free_screen; + free(glamor_egl); + scrn->FreeScreen(scrn); + } +} + +Bool +glamor_egl_init(ScrnInfoPtr scrn, int fd) +{ + struct glamor_egl_screen_private *glamor_egl; + const char *version; + + EGLint config_attribs[] = { +#ifdef GLAMOR_GLES2 + EGL_CONTEXT_CLIENT_VERSION, 2, +#endif + EGL_NONE + }; + + glamor_identify(0); + glamor_egl = calloc(sizeof(*glamor_egl), 1); + if (glamor_egl == NULL) + return FALSE; + if (xf86GlamorEGLPrivateIndex == -1) + xf86GlamorEGLPrivateIndex = xf86AllocateScrnInfoPrivateIndex(); + + scrn->privates[xf86GlamorEGLPrivateIndex].ptr = glamor_egl; + glamor_egl->fd = fd; +#ifdef GLAMOR_HAS_GBM + glamor_egl->gbm = gbm_create_device(glamor_egl->fd); + if (glamor_egl->gbm == NULL) { + ErrorF("couldn't get display device\n"); + return FALSE; + } + glamor_egl->display = eglGetDisplay(glamor_egl->gbm); +#else + glamor_egl->display = eglGetDisplay((EGLNativeDisplayType) (intptr_t) fd); +#endif + + glamor_egl->has_gem = glamor_egl_check_has_gem(fd); + +#ifndef GLAMOR_GLES2 + eglBindAPI(EGL_OPENGL_API); +#else + eglBindAPI(EGL_OPENGL_ES_API); +#endif + if (!eglInitialize + (glamor_egl->display, &glamor_egl->major, &glamor_egl->minor)) { + xf86DrvMsg(scrn->scrnIndex, X_ERROR, "eglInitialize() failed\n"); + return FALSE; + } + + version = eglQueryString(glamor_egl->display, EGL_VERSION); + xf86Msg(X_INFO, "%s: EGL version %s:\n", glamor_name, version); + +#define GLAMOR_CHECK_EGL_EXTENSION(EXT) \ + if (!epoxy_has_egl_extension(glamor_egl->display, "EGL_" #EXT)) { \ + ErrorF("EGL_" #EXT " required.\n"); \ + return FALSE; \ + } + +#define GLAMOR_CHECK_EGL_EXTENSIONS(EXT1, EXT2) \ + if (!epoxy_has_egl_extension(glamor_egl->display, "EGL_" #EXT1) && \ + !epoxy_has_egl_extension(glamor_egl->display, "EGL_" #EXT2)) { \ + ErrorF("EGL_" #EXT1 " or EGL_" #EXT2 " required.\n"); \ + return FALSE; \ + } + + GLAMOR_CHECK_EGL_EXTENSION(MESA_drm_image); + GLAMOR_CHECK_EGL_EXTENSION(KHR_gl_renderbuffer_image); +#ifdef GLAMOR_GLES2 + GLAMOR_CHECK_EGL_EXTENSIONS(KHR_surfaceless_context, KHR_surfaceless_gles2); +#else + GLAMOR_CHECK_EGL_EXTENSIONS(KHR_surfaceless_context, + KHR_surfaceless_opengl); +#endif + +#ifdef GLAMOR_HAS_GBM + if (epoxy_has_egl_extension(glamor_egl->display, + "EGL_KHR_gl_texture_2D_image") && + epoxy_has_egl_extension(glamor_egl->display, + "EGL_EXT_image_dma_buf_import")) + glamor_egl->dri3_capable = TRUE; +#endif + + glamor_egl->context = eglCreateContext(glamor_egl->display, + NULL, EGL_NO_CONTEXT, + config_attribs); + if (glamor_egl->context == EGL_NO_CONTEXT) { + xf86DrvMsg(scrn->scrnIndex, X_ERROR, "Failed to create EGL context\n"); + return FALSE; + } + + if (!eglMakeCurrent(glamor_egl->display, + EGL_NO_SURFACE, EGL_NO_SURFACE, glamor_egl->context)) { + xf86DrvMsg(scrn->scrnIndex, X_ERROR, + "Failed to make EGL context current\n"); + return FALSE; + } + glamor_egl->saved_free_screen = scrn->FreeScreen; + scrn->FreeScreen = glamor_egl_free_screen; +#ifdef GLAMOR_GLES2 + xf86DrvMsg(scrn->scrnIndex, X_INFO, "Using GLES2.\n"); + xf86DrvMsg(scrn->scrnIndex, X_WARNING, + "Glamor is using GLES2 but GLX needs GL. " + "Indirect GLX may not work correctly.\n"); +#endif + return TRUE; +} + +/** Stub to retain compatibility with pre-server-1.16 ABI. */ +Bool +glamor_egl_init_textured_pixmap(ScreenPtr screen) +{ + return TRUE; +} diff --git a/xserver/glamor/glamor_egl_stubs.c b/xserver/glamor/glamor_egl_stubs.c new file mode 100644 index 000000000..028d1cc05 --- /dev/null +++ b/xserver/glamor/glamor_egl_stubs.c @@ -0,0 +1,56 @@ +/* + * Copyright © 2013 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +/** @file glamor_egl_stubs.c + * + * Stubbed out glamor_egl.c functions for servers other than Xorg. + */ + +#include "dix-config.h" + +#include "glamor.h" + +void +glamor_egl_screen_init(ScreenPtr screen, struct glamor_context *glamor_ctx) +{ +} + +void +glamor_egl_destroy_textured_pixmap(PixmapPtr pixmap) +{ +} + +int +glamor_egl_dri3_fd_name_from_tex(ScreenPtr screen, + PixmapPtr pixmap, + unsigned int tex, + Bool want_name, CARD16 *stride, CARD32 *size) +{ + return 0; +} + +unsigned int +glamor_egl_create_argb8888_based_texture(ScreenPtr screen, int w, int h) +{ + return 0; +} diff --git a/xserver/glamor/glamor_eglmodule.c b/xserver/glamor/glamor_eglmodule.c new file mode 100644 index 000000000..d7e183649 --- /dev/null +++ b/xserver/glamor/glamor_eglmodule.c @@ -0,0 +1,51 @@ +/* + * Copyright (C) 1998 The XFree86 Project, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the XFree86 Project shall + * not be used in advertising or otherwise to promote the sale, use or other + * dealings in this Software without prior written authorization from the + * XFree86 Project. + * + * Authors: + * Zhigang Gong <zhigang.gong@gmail.com> + */ + +#include "dix-config.h" + +#include <xorg-server.h> +#include <xf86.h> +#define GLAMOR_FOR_XORG +#include <xf86Module.h> +#include "glamor.h" + +static XF86ModuleVersionInfo VersRec = { + GLAMOR_EGL_MODULE_NAME, + MODULEVENDORSTRING, + MODINFOSTRING1, + MODINFOSTRING2, + XORG_VERSION_CURRENT, + 1, 0, 0, /* version */ + ABI_CLASS_ANSIC, /* Only need the ansic layer */ + ABI_ANSIC_VERSION, + MOD_CLASS_NONE, + {0, 0, 0, 0} /* signature, to be patched into the file by a tool */ +}; + +_X_EXPORT XF86ModuleData glamoreglModuleData = { &VersRec, NULL, NULL }; diff --git a/xserver/glamor/glamor_fbo.c b/xserver/glamor/glamor_fbo.c new file mode 100644 index 000000000..090dfd8e7 --- /dev/null +++ b/xserver/glamor/glamor_fbo.c @@ -0,0 +1,590 @@ +/* + * Copyright © 2009 Intel Corporation + * Copyright © 1998 Keith Packard + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Authors: + * Zhigang Gong <zhigang.gong@gmail.com> + * + */ + +#include <stdlib.h> + +#include "glamor_priv.h" + +#define GLAMOR_CACHE_EXPIRE_MAX 100 + +#define GLAMOR_CACHE_DEFAULT 0 +#define GLAMOR_CACHE_EXACT_SIZE 1 + +//#define NO_FBO_CACHE 1 +#define FBO_CACHE_THRESHOLD (256*1024*1024) + +/* Loop from the tail to the head. */ +#define xorg_list_for_each_entry_reverse(pos, head, member) \ + for (pos = __container_of((head)->prev, pos, member); \ + &pos->member != (head); \ + pos = __container_of(pos->member.prev, pos, member)) + +#define xorg_list_for_each_entry_safe_reverse(pos, tmp, head, member) \ + for (pos = __container_of((head)->prev, pos, member), \ + tmp = __container_of(pos->member.prev, pos, member); \ + &pos->member != (head); \ + pos = tmp, tmp = __container_of(pos->member.prev, tmp, member)) + +inline static int +cache_wbucket(int size) +{ + int order = __fls(size / 32); + + if (order >= CACHE_BUCKET_WCOUNT) + order = CACHE_BUCKET_WCOUNT - 1; + return order; +} + +inline static int +cache_hbucket(int size) +{ + int order = __fls(size / 32); + + if (order >= CACHE_BUCKET_HCOUNT) + order = CACHE_BUCKET_HCOUNT - 1; + return order; +} + +static glamor_pixmap_fbo * +glamor_pixmap_fbo_cache_get(glamor_screen_private *glamor_priv, + int w, int h, GLenum format, int flag) +{ + struct xorg_list *cache; + glamor_pixmap_fbo *fbo_entry, *ret_fbo = NULL; + int n_format; + +#ifdef NO_FBO_CACHE + return NULL; +#else + n_format = cache_format(format); + if (n_format == -1) + return NULL; + cache = &glamor_priv->fbo_cache[n_format] + [cache_wbucket(w)] + [cache_hbucket(h)]; + if (!(flag & GLAMOR_CACHE_EXACT_SIZE)) { + xorg_list_for_each_entry(fbo_entry, cache, list) { + if (fbo_entry->width >= w && fbo_entry->height >= h) { + + DEBUGF("Request w %d h %d format %x \n", w, h, format); + DEBUGF("got cache entry %p w %d h %d fbo %d tex %d format %x\n", + fbo_entry, fbo_entry->width, fbo_entry->height, + fbo_entry->fb, fbo_entry->tex); + xorg_list_del(&fbo_entry->list); + ret_fbo = fbo_entry; + break; + } + } + } + else { + xorg_list_for_each_entry(fbo_entry, cache, list) { + if (fbo_entry->width == w && fbo_entry->height == h) { + + DEBUGF("Request w %d h %d format %x \n", w, h, format); + DEBUGF("got cache entry %p w %d h %d fbo %d tex %d format %x\n", + fbo_entry, fbo_entry->width, fbo_entry->height, + fbo_entry->fb, fbo_entry->tex, fbo_entry->format); + assert(format == fbo_entry->format); + xorg_list_del(&fbo_entry->list); + ret_fbo = fbo_entry; + break; + } + } + } + + if (ret_fbo) + glamor_priv->fbo_cache_watermark -= ret_fbo->width * ret_fbo->height; + + assert(glamor_priv->fbo_cache_watermark >= 0); + + return ret_fbo; +#endif +} + +void +glamor_purge_fbo(glamor_pixmap_fbo *fbo) +{ + glamor_make_current(fbo->glamor_priv); + + if (fbo->fb) + glDeleteFramebuffers(1, &fbo->fb); + if (fbo->tex) + glDeleteTextures(1, &fbo->tex); + if (fbo->pbo) + glDeleteBuffers(1, &fbo->pbo); + + free(fbo); +} + +static void +glamor_pixmap_fbo_cache_put(glamor_pixmap_fbo *fbo) +{ + struct xorg_list *cache; + int n_format; + +#ifdef NO_FBO_CACHE + glamor_purge_fbo(fbo); + return; +#else + n_format = cache_format(fbo->format); + + if (fbo->fb == 0 || n_format == -1 + || fbo->glamor_priv->fbo_cache_watermark >= FBO_CACHE_THRESHOLD) { + fbo->glamor_priv->tick += GLAMOR_CACHE_EXPIRE_MAX; + glamor_fbo_expire(fbo->glamor_priv); + glamor_purge_fbo(fbo); + return; + } + + cache = &fbo->glamor_priv->fbo_cache[n_format] + [cache_wbucket(fbo->width)] + [cache_hbucket(fbo->height)]; + DEBUGF + ("Put cache entry %p to cache %p w %d h %d format %x fbo %d tex %d \n", + fbo, cache, fbo->width, fbo->height, fbo->format, fbo->fb, fbo->tex); + + fbo->glamor_priv->fbo_cache_watermark += fbo->width * fbo->height; + xorg_list_add(&fbo->list, cache); + fbo->expire = fbo->glamor_priv->tick + GLAMOR_CACHE_EXPIRE_MAX; +#endif +} + +static int +glamor_pixmap_ensure_fb(glamor_pixmap_fbo *fbo) +{ + int status, err = 0; + + glamor_make_current(fbo->glamor_priv); + + if (fbo->fb == 0) + glGenFramebuffers(1, &fbo->fb); + assert(fbo->tex != 0); + glBindFramebuffer(GL_FRAMEBUFFER, fbo->fb); + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, + GL_TEXTURE_2D, fbo->tex, 0); + status = glCheckFramebufferStatus(GL_FRAMEBUFFER); + if (status != GL_FRAMEBUFFER_COMPLETE) { + const char *str; + + switch (status) { + case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT: + str = "incomplete attachment"; + break; + case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: + str = "incomplete/missing attachment"; + break; + case GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER: + str = "incomplete draw buffer"; + break; + case GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER: + str = "incomplete read buffer"; + break; + case GL_FRAMEBUFFER_UNSUPPORTED: + str = "unsupported"; + break; + case GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE: + str = "incomplete multiple"; + break; + default: + str = "unknown error"; + break; + } + + glamor_fallback("glamor: Failed to create fbo, %s\n", str); + err = -1; + } + + return err; +} + +glamor_pixmap_fbo * +glamor_create_fbo_from_tex(glamor_screen_private *glamor_priv, + int w, int h, GLenum format, GLint tex, int flag) +{ + glamor_pixmap_fbo *fbo; + + fbo = calloc(1, sizeof(*fbo)); + if (fbo == NULL) + return NULL; + + xorg_list_init(&fbo->list); + + fbo->tex = tex; + fbo->width = w; + fbo->height = h; + fbo->format = format; + fbo->glamor_priv = glamor_priv; + + if (flag == GLAMOR_CREATE_PIXMAP_MAP) { + glamor_make_current(glamor_priv); + glGenBuffers(1, &fbo->pbo); + goto done; + } + + if (flag != GLAMOR_CREATE_FBO_NO_FBO) { + if (glamor_pixmap_ensure_fb(fbo) != 0) { + glamor_purge_fbo(fbo); + fbo = NULL; + } + } + + done: + return fbo; +} + +void +glamor_fbo_expire(glamor_screen_private *glamor_priv) +{ + struct xorg_list *cache; + glamor_pixmap_fbo *fbo_entry, *tmp; + int i, j, k; + + for (i = 0; i < CACHE_FORMAT_COUNT; i++) + for (j = 0; j < CACHE_BUCKET_WCOUNT; j++) + for (k = 0; k < CACHE_BUCKET_HCOUNT; k++) { + cache = &glamor_priv->fbo_cache[i][j][k]; + xorg_list_for_each_entry_safe_reverse(fbo_entry, tmp, cache, + list) { + if (GLAMOR_TICK_AFTER(fbo_entry->expire, glamor_priv->tick)) { + break; + } + + glamor_priv->fbo_cache_watermark -= + fbo_entry->width * fbo_entry->height; + xorg_list_del(&fbo_entry->list); + DEBUGF("cache %p fbo %p expired %d current %d \n", cache, + fbo_entry, fbo_entry->expire, glamor_priv->tick); + glamor_purge_fbo(fbo_entry); + } + } + +} + +void +glamor_init_pixmap_fbo(ScreenPtr screen) +{ + glamor_screen_private *glamor_priv; + int i, j, k; + + glamor_priv = glamor_get_screen_private(screen); + for (i = 0; i < CACHE_FORMAT_COUNT; i++) + for (j = 0; j < CACHE_BUCKET_WCOUNT; j++) + for (k = 0; k < CACHE_BUCKET_HCOUNT; k++) { + xorg_list_init(&glamor_priv->fbo_cache[i][j][k]); + } + glamor_priv->fbo_cache_watermark = 0; +} + +void +glamor_fini_pixmap_fbo(ScreenPtr screen) +{ + struct xorg_list *cache; + glamor_screen_private *glamor_priv; + glamor_pixmap_fbo *fbo_entry, *tmp; + int i, j, k; + + glamor_priv = glamor_get_screen_private(screen); + for (i = 0; i < CACHE_FORMAT_COUNT; i++) + for (j = 0; j < CACHE_BUCKET_WCOUNT; j++) + for (k = 0; k < CACHE_BUCKET_HCOUNT; k++) { + cache = &glamor_priv->fbo_cache[i][j][k]; + xorg_list_for_each_entry_safe_reverse(fbo_entry, tmp, cache, + list) { + xorg_list_del(&fbo_entry->list); + glamor_purge_fbo(fbo_entry); + } + } +} + +void +glamor_destroy_fbo(glamor_pixmap_fbo *fbo) +{ + xorg_list_del(&fbo->list); + glamor_pixmap_fbo_cache_put(fbo); + +} + +static int +_glamor_create_tex(glamor_screen_private *glamor_priv, + int w, int h, GLenum format) +{ + unsigned int tex = 0; + + /* With dri3, we want to allocate ARGB8888 pixmaps only. + * Depending on the implementation, GL_RGBA might not + * give us ARGB8888. We ask glamor_egl to use get + * an ARGB8888 based texture for us. */ + if (glamor_priv->dri3_enabled && format == GL_RGBA) { + tex = glamor_egl_create_argb8888_based_texture(glamor_priv->screen, + w, h); + } + if (!tex) { + glamor_make_current(glamor_priv); + glGenTextures(1, &tex); + glBindTexture(GL_TEXTURE_2D, tex); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexImage2D(GL_TEXTURE_2D, 0, format, w, h, 0, + format, GL_UNSIGNED_BYTE, NULL); + } + return tex; +} + +glamor_pixmap_fbo * +glamor_create_fbo(glamor_screen_private *glamor_priv, + int w, int h, GLenum format, int flag) +{ + glamor_pixmap_fbo *fbo; + GLint tex = 0; + int cache_flag; + + if (flag == GLAMOR_CREATE_FBO_NO_FBO) + goto new_fbo; + + if (flag == GLAMOR_CREATE_PIXMAP_MAP) + goto no_tex; + + /* Tiling from textures requires exact pixmap sizes. As we don't + * know which pixmaps will be used as tiles, just allocate + * everything at the requested size + */ + cache_flag = GLAMOR_CACHE_EXACT_SIZE; + + fbo = glamor_pixmap_fbo_cache_get(glamor_priv, w, h, format, cache_flag); + if (fbo) + return fbo; + new_fbo: + tex = _glamor_create_tex(glamor_priv, w, h, format); + no_tex: + fbo = glamor_create_fbo_from_tex(glamor_priv, w, h, format, tex, flag); + + return fbo; +} + +static glamor_pixmap_fbo * +_glamor_create_fbo_array(glamor_screen_private *glamor_priv, + int w, int h, GLenum format, int flag, + int block_w, int block_h, + glamor_pixmap_private *pixmap_priv, int has_fbo) +{ + int block_wcnt; + int block_hcnt; + glamor_pixmap_fbo **fbo_array; + BoxPtr box_array; + int i, j; + glamor_pixmap_private_large_t *priv; + + priv = &pixmap_priv->large; + + block_wcnt = (w + block_w - 1) / block_w; + block_hcnt = (h + block_h - 1) / block_h; + + box_array = calloc(block_wcnt * block_hcnt, sizeof(box_array[0])); + if (box_array == NULL) + return NULL; + + fbo_array = calloc(block_wcnt * block_hcnt, sizeof(glamor_pixmap_fbo *)); + if (fbo_array == NULL) { + free(box_array); + return FALSE; + } + for (i = 0; i < block_hcnt; i++) { + int block_y1, block_y2; + int fbo_w, fbo_h; + + block_y1 = i * block_h; + block_y2 = (block_y1 + block_h) > h ? h : (block_y1 + block_h); + fbo_h = block_y2 - block_y1; + + for (j = 0; j < block_wcnt; j++) { + box_array[i * block_wcnt + j].x1 = j * block_w; + box_array[i * block_wcnt + j].y1 = block_y1; + box_array[i * block_wcnt + j].x2 = + (j + 1) * block_w > w ? w : (j + 1) * block_w; + box_array[i * block_wcnt + j].y2 = block_y2; + fbo_w = + box_array[i * block_wcnt + j].x2 - box_array[i * block_wcnt + + j].x1; + if (!has_fbo) + fbo_array[i * block_wcnt + j] = glamor_create_fbo(glamor_priv, + fbo_w, fbo_h, + format, + GLAMOR_CREATE_PIXMAP_FIXUP); + else + fbo_array[i * block_wcnt + j] = priv->base.fbo; + if (fbo_array[i * block_wcnt + j] == NULL) + goto cleanup; + } + } + + priv->box = box_array[0]; + priv->box_array = box_array; + priv->fbo_array = fbo_array; + priv->block_wcnt = block_wcnt; + priv->block_hcnt = block_hcnt; + return fbo_array[0]; + + cleanup: + for (i = 0; i < block_wcnt * block_hcnt; i++) + if ((fbo_array)[i]) + glamor_destroy_fbo((fbo_array)[i]); + free(box_array); + free(fbo_array); + return NULL; +} + +/* Create a fbo array to cover the w*h region, by using block_w*block_h + * block.*/ +glamor_pixmap_fbo * +glamor_create_fbo_array(glamor_screen_private *glamor_priv, + int w, int h, GLenum format, int flag, + int block_w, int block_h, + glamor_pixmap_private *pixmap_priv) +{ + pixmap_priv->large.block_w = block_w; + pixmap_priv->large.block_h = block_h; + return _glamor_create_fbo_array(glamor_priv, w, h, format, flag, + block_w, block_h, pixmap_priv, 0); +} + +glamor_pixmap_fbo * +glamor_pixmap_detach_fbo(glamor_pixmap_private *pixmap_priv) +{ + glamor_pixmap_fbo *fbo; + + if (pixmap_priv == NULL) + return NULL; + + fbo = pixmap_priv->base.fbo; + if (fbo == NULL) + return NULL; + + pixmap_priv->base.fbo = NULL; + return fbo; +} + +/* The pixmap must not be attached to another fbo. */ +void +glamor_pixmap_attach_fbo(PixmapPtr pixmap, glamor_pixmap_fbo *fbo) +{ + glamor_pixmap_private *pixmap_priv; + + pixmap_priv = glamor_get_pixmap_private(pixmap); + + if (pixmap_priv->base.fbo) + return; + + pixmap_priv->base.fbo = fbo; + + switch (pixmap_priv->type) { + case GLAMOR_TEXTURE_LARGE: + case GLAMOR_TEXTURE_ONLY: + case GLAMOR_TEXTURE_DRM: + pixmap_priv->base.gl_fbo = GLAMOR_FBO_NORMAL; + if (fbo->tex != 0) + pixmap_priv->base.gl_tex = 1; + else { + /* XXX For the Xephyr only, may be broken now. */ + pixmap_priv->base.gl_tex = 0; + } + case GLAMOR_MEMORY_MAP: + pixmap->devPrivate.ptr = NULL; + break; + default: + break; + } +} + +void +glamor_pixmap_destroy_fbo(glamor_pixmap_private *priv) +{ + glamor_pixmap_fbo *fbo; + + if (priv->type == GLAMOR_TEXTURE_LARGE) { + int i; + glamor_pixmap_private_large_t *large = &priv->large; + + for (i = 0; i < large->block_wcnt * large->block_hcnt; i++) + glamor_destroy_fbo(large->fbo_array[i]); + free(large->fbo_array); + } + else { + fbo = glamor_pixmap_detach_fbo(priv); + if (fbo) + glamor_destroy_fbo(fbo); + } + + free(priv); +} + +Bool +glamor_pixmap_ensure_fbo(PixmapPtr pixmap, GLenum format, int flag) +{ + glamor_screen_private *glamor_priv; + glamor_pixmap_private *pixmap_priv; + glamor_pixmap_fbo *fbo; + + glamor_priv = glamor_get_screen_private(pixmap->drawable.pScreen); + pixmap_priv = glamor_get_pixmap_private(pixmap); + if (pixmap_priv->base.fbo == NULL) { + + fbo = glamor_create_fbo(glamor_priv, pixmap->drawable.width, + pixmap->drawable.height, format, flag); + if (fbo == NULL) + return FALSE; + + glamor_pixmap_attach_fbo(pixmap, fbo); + } + else { + /* We do have a fbo, but it may lack of fb or tex. */ + if (!pixmap_priv->base.fbo->tex) + pixmap_priv->base.fbo->tex = + _glamor_create_tex(glamor_priv, pixmap->drawable.width, + pixmap->drawable.height, format); + + if (flag != GLAMOR_CREATE_FBO_NO_FBO && pixmap_priv->base.fbo->fb == 0) + if (glamor_pixmap_ensure_fb(pixmap_priv->base.fbo) != 0) + return FALSE; + } + + return TRUE; +} + +_X_EXPORT void +glamor_pixmap_exchange_fbos(PixmapPtr front, PixmapPtr back) +{ + glamor_pixmap_private *front_priv, *back_priv; + glamor_pixmap_fbo *temp_fbo; + + front_priv = glamor_get_pixmap_private(front); + back_priv = glamor_get_pixmap_private(back); + temp_fbo = front_priv->base.fbo; + front_priv->base.fbo = back_priv->base.fbo; + back_priv->base.fbo = temp_fbo; +} diff --git a/xserver/glamor/glamor_fill.c b/xserver/glamor/glamor_fill.c new file mode 100644 index 000000000..073904d2a --- /dev/null +++ b/xserver/glamor/glamor_fill.c @@ -0,0 +1,356 @@ +/* + * Copyright © 2008 Intel Corporation + * Copyright © 1998 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Keith Packard not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Keith Packard makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + * Authors: + * Eric Anholt <eric@anholt.net> + * Zhigang Gong <zhigang.gong@linux.intel.com> + */ + +#include "glamor_priv.h" + +/** @file glamor_fill.c + * + * GC fill implementation, based loosely on fb_fill.c + */ + +/** + * Fills the given rectangle of a drawable with the GC's fill style. + */ +Bool +glamor_fill(DrawablePtr drawable, + GCPtr gc, int x, int y, int width, int height, Bool fallback) +{ + PixmapPtr dst_pixmap = glamor_get_drawable_pixmap(drawable); + int off_x, off_y; + PixmapPtr sub_pixmap = NULL; + glamor_access_t sub_pixmap_access; + DrawablePtr saved_drawable = NULL; + int saved_x = x, saved_y = y; + + glamor_get_drawable_deltas(drawable, dst_pixmap, &off_x, &off_y); + + switch (gc->fillStyle) { + case FillSolid: + if (!glamor_solid(dst_pixmap, + x + off_x, + y + off_y, + width, height, gc->alu, gc->planemask, gc->fgPixel)) + goto fail; + break; + case FillStippled: + case FillOpaqueStippled: + if (!glamor_stipple(dst_pixmap, + gc->stipple, + x + off_x, + y + off_y, + width, + height, + gc->alu, + gc->planemask, + gc->fgPixel, + gc->bgPixel, gc->patOrg.x, gc->patOrg.y)) + goto fail; + break; + case FillTiled: + if (!glamor_tile(dst_pixmap, + gc->tile.pixmap, + x + off_x, + y + off_y, + width, + height, + gc->alu, + gc->planemask, + x - drawable->x - gc->patOrg.x, + y - drawable->y - gc->patOrg.y)) + goto fail; + break; + } + return TRUE; + + fail: + if (!fallback) { + if (glamor_ddx_fallback_check_pixmap(&dst_pixmap->drawable) + && glamor_ddx_fallback_check_gc(gc)) + return FALSE; + } + /* Is it possible to set the access as WO? */ + + sub_pixmap_access = GLAMOR_ACCESS_RW; + + sub_pixmap = glamor_get_sub_pixmap(dst_pixmap, x + off_x, + y + off_y, width, height, + sub_pixmap_access); + + if (sub_pixmap != NULL) { + if (gc->fillStyle != FillSolid) { + gc->patOrg.x += (drawable->x - x); + gc->patOrg.y += (drawable->y - y); + } + saved_drawable = drawable; + drawable = &sub_pixmap->drawable; + saved_x = x; + saved_y = y; + x = 0; + y = 0; + } + if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RW) && + glamor_prepare_access_gc(gc)) { + fbFill(drawable, gc, x, y, width, height); + } + glamor_finish_access_gc(gc); + glamor_finish_access(drawable); + + if (sub_pixmap != NULL) { + if (gc->fillStyle != FillSolid) { + gc->patOrg.x -= (saved_drawable->x - saved_x); + gc->patOrg.y -= (saved_drawable->y - saved_y); + } + + x = saved_x; + y = saved_y; + + glamor_put_sub_pixmap(sub_pixmap, dst_pixmap, + x + off_x, y + off_y, + width, height, sub_pixmap_access); + } + + return TRUE; +} + +void +glamor_init_solid_shader(ScreenPtr screen) +{ + glamor_screen_private *glamor_priv; + const char *solid_vs = + "attribute vec4 v_position;" + "void main()\n" + "{\n" + " gl_Position = v_position;\n" + "}\n"; + const char *solid_fs = + GLAMOR_DEFAULT_PRECISION + "uniform vec4 color;\n" + "void main()\n" + "{\n" + " gl_FragColor = color;\n" + "}\n"; + GLint fs_prog, vs_prog; + + glamor_priv = glamor_get_screen_private(screen); + glamor_make_current(glamor_priv); + glamor_priv->solid_prog = glCreateProgram(); + vs_prog = glamor_compile_glsl_prog(GL_VERTEX_SHADER, solid_vs); + fs_prog = glamor_compile_glsl_prog(GL_FRAGMENT_SHADER, solid_fs); + glAttachShader(glamor_priv->solid_prog, vs_prog); + glAttachShader(glamor_priv->solid_prog, fs_prog); + + glBindAttribLocation(glamor_priv->solid_prog, + GLAMOR_VERTEX_POS, "v_position"); + glamor_link_glsl_prog(screen, glamor_priv->solid_prog, "solid"); + + glamor_priv->solid_color_uniform_location = + glGetUniformLocation(glamor_priv->solid_prog, "color"); +} + +void +glamor_fini_solid_shader(ScreenPtr screen) +{ + glamor_screen_private *glamor_priv; + + glamor_priv = glamor_get_screen_private(screen); + glamor_make_current(glamor_priv); + glDeleteProgram(glamor_priv->solid_prog); +} + +static void +_glamor_solid_boxes(PixmapPtr pixmap, BoxPtr box, int nbox, float *color) +{ + ScreenPtr screen = pixmap->drawable.pScreen; + glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); + glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap); + GLfloat xscale, yscale; + float stack_vertices[32]; + float *vertices = stack_vertices; + int valid_nbox = ARRAY_SIZE(stack_vertices) / (4 * 2); + + glamor_set_destination_pixmap_priv_nc(pixmap_priv); + + glamor_make_current(glamor_priv); + glUseProgram(glamor_priv->solid_prog); + + glUniform4fv(glamor_priv->solid_color_uniform_location, 1, color); + + pixmap_priv_get_dest_scale(pixmap_priv, &xscale, &yscale); + + if (nbox > valid_nbox) { + int allocated_nbox; + float *new_vertices; + + if (nbox > GLAMOR_COMPOSITE_VBO_VERT_CNT / 6) + allocated_nbox = GLAMOR_COMPOSITE_VBO_VERT_CNT / 6; + else + allocated_nbox = nbox; + new_vertices = malloc(allocated_nbox * 4 * 2 * sizeof(float)); + if (new_vertices) { + vertices = new_vertices; + valid_nbox = allocated_nbox; + } + } + + glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT, + GL_FALSE, 2 * sizeof(float), vertices); + glEnableVertexAttribArray(GLAMOR_VERTEX_POS); + + while (nbox) { + int box_cnt, i; + float *next_box; + + next_box = vertices; + box_cnt = nbox > valid_nbox ? valid_nbox : nbox; + for (i = 0; i < box_cnt; i++) { + glamor_set_normalize_vcoords(pixmap_priv, xscale, yscale, + box[i].x1, box[i].y1, + box[i].x2, box[i].y2, + glamor_priv->yInverted, + next_box); + next_box += 4 * 2; + } + if (box_cnt == 1) + glDrawArrays(GL_TRIANGLE_FAN, 0, box_cnt * 4); + else { + if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) { + glDrawRangeElements(GL_TRIANGLES, 0, box_cnt * 4, box_cnt * 6, + GL_UNSIGNED_SHORT, NULL); + } else { + glDrawElements(GL_TRIANGLES, box_cnt * 6, GL_UNSIGNED_SHORT, + NULL); + } + } + nbox -= box_cnt; + box += box_cnt; + } + + if (vertices != stack_vertices) + free(vertices); + + glDisableVertexAttribArray(GLAMOR_VERTEX_POS); + glamor_priv->state = RENDER_STATE; + glamor_priv->render_idle_cnt = 0; +} + +/** + * Fills the given rectangles of pixmap with an X pixel value. + * + * This is a helper used by other code after clipping and translation + * of coordinates to a glamor backing pixmap. + */ +Bool +glamor_solid_boxes(PixmapPtr pixmap, + BoxPtr box, int nbox, unsigned long fg_pixel) +{ + glamor_pixmap_private *pixmap_priv; + GLfloat color[4]; + + pixmap_priv = glamor_get_pixmap_private(pixmap); + + if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv)) + return FALSE; + + glamor_get_rgba_from_pixel(fg_pixel, + &color[0], + &color[1], + &color[2], &color[3], format_for_pixmap(pixmap)); + + if (pixmap_priv->type == GLAMOR_TEXTURE_LARGE) { + RegionRec region; + int n_region; + glamor_pixmap_clipped_regions *clipped_regions; + int i; + + RegionInitBoxes(®ion, box, nbox); + clipped_regions = + glamor_compute_clipped_regions(pixmap_priv, ®ion, &n_region, 0, + 0, 0); + for (i = 0; i < n_region; i++) { + BoxPtr inner_box; + int inner_nbox; + + SET_PIXMAP_FBO_CURRENT(pixmap_priv, clipped_regions[i].block_idx); + + inner_box = RegionRects(clipped_regions[i].region); + inner_nbox = RegionNumRects(clipped_regions[i].region); + _glamor_solid_boxes(pixmap, inner_box, inner_nbox, color); + RegionDestroy(clipped_regions[i].region); + } + free(clipped_regions); + RegionUninit(®ion); + } + else + _glamor_solid_boxes(pixmap, box, nbox, color); + + return TRUE; +} + +/** + * Fills a rectangle of a pixmap with an X pixel value. + * + * This is a helper used by other glamor code mostly for clearing of + * buffers to 0. + */ +Bool +glamor_solid(PixmapPtr pixmap, int x, int y, int width, int height, + unsigned char alu, unsigned long planemask, unsigned long fg_pixel) +{ + ScreenPtr screen = pixmap->drawable.pScreen; + glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); + glamor_pixmap_private *pixmap_priv; + BoxRec box; + + pixmap_priv = glamor_get_pixmap_private(pixmap); + + if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv)) + return FALSE; + + if (!glamor_set_planemask(pixmap, planemask)) { + glamor_fallback("Failedto set planemask in glamor_solid.\n"); + return FALSE; + } + + glamor_make_current(glamor_priv); + if (!glamor_set_alu(screen, alu)) { + if (alu == GXclear) + fg_pixel = 0; + else { + glamor_fallback("unsupported alu %x\n", alu); + return FALSE; + } + } + box.x1 = x; + box.y1 = y; + box.x2 = x + width; + box.y2 = y + height; + glamor_solid_boxes(pixmap, &box, 1, fg_pixel); + + glamor_set_alu(screen, GXcopy); + + return TRUE; +} diff --git a/xserver/glamor/glamor_font.c b/xserver/glamor/glamor_font.c new file mode 100644 index 000000000..57c607dc2 --- /dev/null +++ b/xserver/glamor/glamor_font.c @@ -0,0 +1,184 @@ +/* + * Copyright © 2014 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * that the name of the copyright holders not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no representations + * about the suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +#include "glamor_priv.h" +#include "glamor_font.h" +#include <dixfontstr.h> + +static int glamor_font_generation; +static int glamor_font_private_index; +static int glamor_font_screen_count; + +glamor_font_t * +glamor_font_get(ScreenPtr screen, FontPtr font) +{ + glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); + + glamor_font_t *privates; + glamor_font_t *glamor_font; + int overall_width, overall_height; + int num_rows; + int num_cols; + int glyph_width_pixels; + int glyph_width_bytes; + int glyph_height; + int row, col; + unsigned char c[2]; + CharInfoPtr glyph; + unsigned long count; + + + privates = FontGetPrivate(font, glamor_font_private_index); + if (!privates) { + privates = calloc(glamor_font_screen_count, sizeof (glamor_font_t)); + if (!privates) + return NULL; + FontSetPrivate(font, glamor_font_private_index, privates); + } + + glamor_font = &privates[screen->myNum]; + + if (glamor_font->realized) + return glamor_font; + + glamor_font->realized = TRUE; + + /* Figure out how many glyphs are in the font */ + num_cols = font->info.lastCol - font->info.firstCol + 1; + num_rows = font->info.lastRow - font->info.firstRow + 1; + + /* Figure out the size of each glyph */ + glyph_width_pixels = font->info.maxbounds.rightSideBearing - font->info.minbounds.leftSideBearing; + glyph_height = font->info.maxbounds.ascent + font->info.maxbounds.descent; + + glyph_width_bytes = (glyph_width_pixels + 7) >> 3; + + glamor_font->glyph_width_pixels = glyph_width_pixels; + glamor_font->glyph_width_bytes = glyph_width_bytes; + glamor_font->glyph_height = glyph_height; + + overall_width = glyph_width_bytes * num_cols; + overall_height = glyph_height * num_rows; + + /* Check whether the font has a default character */ + c[0] = font->info.lastRow + 1; + c[1] = font->info.lastCol + 1; + (*font->get_glyphs)(font, 1, c, TwoD16Bit, &count, &glyph); + + glamor_font->default_char = count ? glyph : NULL; + glamor_font->default_row = font->info.defaultCh >> 8; + glamor_font->default_col = font->info.defaultCh; + + glamor_priv = glamor_get_screen_private(screen); + glamor_make_current(glamor_priv); + + glGenTextures(1, &glamor_font->texture_id); + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D, glamor_font->texture_id); + + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + + /* Allocate storage */ + glTexImage2D(GL_TEXTURE_2D, 0, GL_R8UI, overall_width, overall_height, + 0, GL_RED_INTEGER, GL_UNSIGNED_BYTE, NULL); + + glPixelStorei(GL_UNPACK_ALIGNMENT, 4); + + /* Paint all of the glyphs */ + for (row = 0; row < num_rows; row++) { + for (col = 0; col < num_cols; col++) { + c[0] = row + font->info.firstRow; + c[1] = col + font->info.firstCol; + + (*font->get_glyphs)(font, 1, c, TwoD16Bit, &count, &glyph); + + if (count) + glTexSubImage2D(GL_TEXTURE_2D, 0, col * glyph_width_bytes, row * glyph_height, + GLYPHWIDTHBYTES(glyph), GLYPHHEIGHTPIXELS(glyph), + GL_RED_INTEGER, GL_UNSIGNED_BYTE, glyph->bits); + } + } + + return glamor_font; +} + +static Bool +glamor_realize_font(ScreenPtr screen, FontPtr font) +{ + return TRUE; +} + +static Bool +glamor_unrealize_font(ScreenPtr screen, FontPtr font) +{ + glamor_screen_private *glamor_priv; + glamor_font_t *privates = FontGetPrivate(font, glamor_font_private_index); + glamor_font_t *glamor_font; + int s; + + if (!privates) + return TRUE; + + glamor_font = &privates[screen->myNum]; + + if (!glamor_font->realized) + return TRUE; + + /* Unrealize the font, freeing the allocated texture */ + glamor_font->realized = FALSE; + + glamor_priv = glamor_get_screen_private(screen); + glamor_make_current(glamor_priv); + glDeleteTextures(1, &glamor_font->texture_id); + + /* Check to see if all of the screens are done with this font + * and free the private when that happens + */ + for (s = 0; s < glamor_font_screen_count; s++) + if (privates[s].realized) + return TRUE; + + free(privates); + FontSetPrivate(font, glamor_font_private_index, NULL); + return TRUE; +} + +Bool +glamor_font_init(ScreenPtr screen) +{ + if (glamor_font_generation != serverGeneration) { + glamor_font_private_index = AllocateFontPrivateIndex(); + if (glamor_font_private_index == -1) + return FALSE; + glamor_font_screen_count = 0; + glamor_font_generation = serverGeneration; + } + + if (screen->myNum >= glamor_font_screen_count) + glamor_font_screen_count = screen->myNum + 1; + + screen->RealizeFont = glamor_realize_font; + screen->UnrealizeFont = glamor_unrealize_font; + return TRUE; +} diff --git a/xserver/glamor/glamor_font.h b/xserver/glamor/glamor_font.h new file mode 100644 index 000000000..36d20624d --- /dev/null +++ b/xserver/glamor/glamor_font.h @@ -0,0 +1,49 @@ +/* + * Copyright © 2014 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * that the name of the copyright holders not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no representations + * about the suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +#ifndef _GLAMOR_FONT_H_ +#define _GLAMOR_FONT_H_ + +typedef struct { + Bool realized; + CharInfoPtr default_char; + CARD8 default_row; + CARD8 default_col; + + GLuint texture_id; + + CARD16 glyph_width_bytes; + CARD16 glyph_width_pixels; + CARD16 glyph_height; + +} glamor_font_t; + +glamor_font_t * +glamor_font_get(ScreenPtr screen, FontPtr font); + +Bool +glamor_font_init(ScreenPtr screen); + +void +glamor_fini_glyph_shader(ScreenPtr screen); + +#endif /* _GLAMOR_FONT_H_ */ diff --git a/xserver/glamor/glamor_glx.c b/xserver/glamor/glamor_glx.c new file mode 100644 index 000000000..7107c7c17 --- /dev/null +++ b/xserver/glamor/glamor_glx.c @@ -0,0 +1,68 @@ +/* + * Copyright © 2013 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include <epoxy/glx.h> +#include "glamor_context.h" + +/** + * @file glamor_glx.c + * + * GLX context management for glamor. + * + * This has to be kept separate from the server sources because of + * Xlib's conflicting definition of CARD32 and similar typedefs. + */ + +static void +glamor_glx_make_current(struct glamor_context *glamor_ctx) +{ + /* There's only a single global dispatch table in Mesa. EGL, GLX, + * and AIGLX's direct dispatch table manipulation don't talk to + * each other. We need to set the context to NULL first to avoid + * GLX's no-op context change fast path when switching back to + * GLX. + */ + glXMakeCurrent(glamor_ctx->display, None, None); + + glXMakeCurrent(glamor_ctx->display, glamor_ctx->drawable_xid, + glamor_ctx->ctx); +} + + +Bool +glamor_glx_screen_init(struct glamor_context *glamor_ctx) +{ + glamor_ctx->ctx = glXGetCurrentContext(); + if (!glamor_ctx->ctx) + return False; + + glamor_ctx->display = glXGetCurrentDisplay(); + if (!glamor_ctx->display) + return False; + + glamor_ctx->drawable_xid = glXGetCurrentDrawable(); + + glamor_ctx->make_current = glamor_glx_make_current; + + return True; +} diff --git a/xserver/glamor/glamor_glyphblt.c b/xserver/glamor/glamor_glyphblt.c new file mode 100644 index 000000000..1c511ff2b --- /dev/null +++ b/xserver/glamor/glamor_glyphblt.c @@ -0,0 +1,317 @@ +/* + * Copyright © 2009 Intel Corporation + * Copyright © 1998 Keith Packard + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Authors: + * Zhigang Gong <zhigang.gong@gmail.com> + * + */ + +#include "glamor_priv.h" +#include <dixfontstr.h> +#include "glamor_transform.h" + +static const glamor_facet glamor_facet_poly_glyph_blt = { + .name = "poly_glyph_blt", + .vs_vars = "attribute vec2 primitive;\n", + .vs_exec = (" vec2 pos = vec2(0,0);\n" + GLAMOR_POS(gl_Position, primitive)), +}; + +static Bool +glamor_poly_glyph_blt_gl(DrawablePtr drawable, GCPtr gc, + int start_x, int y, unsigned int nglyph, + CharInfoPtr *ppci, void *pglyph_base) +{ + ScreenPtr screen = drawable->pScreen; + glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); + PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable); + glamor_pixmap_private *pixmap_priv; + glamor_program *prog; + RegionPtr clip = gc->pCompositeClip; + int box_x, box_y; + + pixmap_priv = glamor_get_pixmap_private(pixmap); + if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv)) + goto bail; + + glamor_make_current(glamor_priv); + + prog = glamor_use_program_fill(pixmap, gc, &glamor_priv->poly_glyph_blt_progs, + &glamor_facet_poly_glyph_blt); + if (!prog) + goto bail_ctx; + + glEnableVertexAttribArray(GLAMOR_VERTEX_POS); + + start_x += drawable->x; + y += drawable->y; + + glamor_pixmap_loop(pixmap_priv, box_x, box_y) { + int x; + int n; + int num_points, max_points; + INT16 *points = NULL; + int off_x, off_y; + char *vbo_offset; + + glamor_set_destination_drawable(drawable, box_x, box_y, FALSE, TRUE, prog->matrix_uniform, &off_x, &off_y); + + max_points = 500; + num_points = 0; + x = start_x; + for (n = 0; n < nglyph; n++) { + CharInfoPtr charinfo = ppci[n]; + int w = GLYPHWIDTHPIXELS(charinfo); + int h = GLYPHHEIGHTPIXELS(charinfo); + uint8_t *glyphbits = FONTGLYPHBITS(NULL, charinfo); + + if (w && h) { + int glyph_x = x + charinfo->metrics.leftSideBearing; + int glyph_y = y - charinfo->metrics.ascent; + int glyph_stride = GLYPHWIDTHBYTESPADDED(charinfo); + int xx, yy; + + for (yy = 0; yy < h; yy++) { + uint8_t *glyph = glyphbits; + for (xx = 0; xx < w; glyph += ((xx&7) == 7), xx++) { + int pt_x_i = glyph_x + xx; + int pt_y_i = glyph_y + yy; + + if (!(*glyph & (1 << (xx & 7)))) + continue; + + if (!RegionContainsPoint(clip, pt_x_i, pt_y_i, NULL)) + continue; + + if (!num_points) { + points = glamor_get_vbo_space(screen, + max_points * (2 * sizeof (INT16)), + &vbo_offset); + + glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_SHORT, + GL_FALSE, 0, vbo_offset); + } + + *points++ = pt_x_i; + *points++ = pt_y_i; + num_points++; + + if (num_points == max_points) { + glamor_put_vbo_space(screen); + glDrawArrays(GL_POINTS, 0, num_points); + num_points = 0; + } + } + glyphbits += glyph_stride; + } + } + x += charinfo->metrics.characterWidth; + } + + if (num_points) { + glamor_put_vbo_space(screen); + glDrawArrays(GL_POINTS, 0, num_points); + } + } + + glDisable(GL_COLOR_LOGIC_OP); + glDisableVertexAttribArray(GLAMOR_VERTEX_POS); + + return TRUE; +bail_ctx: + glDisable(GL_COLOR_LOGIC_OP); +bail: + return FALSE; +} + +void +glamor_poly_glyph_blt(DrawablePtr drawable, GCPtr gc, + int start_x, int y, unsigned int nglyph, + CharInfoPtr *ppci, void *pglyph_base) +{ + if (glamor_poly_glyph_blt_gl(drawable, gc, start_x, y, nglyph, ppci, pglyph_base)) + return; + miPolyGlyphBlt(drawable, gc, start_x, y, nglyph, + ppci, pglyph_base); +} + +Bool +glamor_poly_glyph_blt_nf(DrawablePtr drawable, GCPtr gc, + int start_x, int y, unsigned int nglyph, + CharInfoPtr *ppci, void *pglyph_base) +{ + if (glamor_poly_glyph_blt_gl(drawable, gc, start_x, y, nglyph, ppci, pglyph_base)) + return TRUE; + if (glamor_ddx_fallback_check_pixmap(drawable) && glamor_ddx_fallback_check_gc(gc)) + return FALSE; + miPolyGlyphBlt(drawable, gc, start_x, y, nglyph, + ppci, pglyph_base); + return TRUE; +} + +Bool +glamor_image_glyph_blt_nf(DrawablePtr drawable, GCPtr gc, + int start_x, int y, unsigned int nglyph, + CharInfoPtr *ppci, void *pglyph_base) +{ + miImageGlyphBlt(drawable, gc, start_x, y, nglyph, ppci, pglyph_base); + return TRUE; +} + +static Bool +glamor_push_pixels_points(GCPtr gc, PixmapPtr bitmap, + DrawablePtr drawable, int w, int h, int x, int y) +{ + ScreenPtr screen = drawable->pScreen; + glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); + PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable); + glamor_pixmap_private *pixmap_priv; + uint8_t *bitmap_data = bitmap->devPrivate.ptr; + int bitmap_stride = bitmap->devKind; + int off_x, off_y; + int yy, xx; + GLfloat xscale, yscale; + float color[4]; + unsigned long fg_pixel = gc->fgPixel; + float *points, *next_point; + int num_points = 0; + char *vbo_offset; + RegionPtr clip; + + if (w * h > MAXINT / (2 * sizeof(float))) + return FALSE; + + if (gc->fillStyle != FillSolid) { + glamor_fallback("gc fillstyle not solid\n"); + return FALSE; + } + + pixmap_priv = glamor_get_pixmap_private(pixmap); + if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv)) + return FALSE; + + glamor_make_current(glamor_priv); + if (!glamor_set_alu(screen, gc->alu)) { + if (gc->alu == GXclear) + fg_pixel = 0; + else { + glamor_fallback("unsupported alu %x\n", gc->alu); + return FALSE; + } + } + + if (!glamor_set_planemask(pixmap, gc->planemask)) { + glamor_fallback("Failed to set planemask in %s.\n", __FUNCTION__); + return FALSE; + } + + glamor_get_drawable_deltas(drawable, pixmap, &off_x, &off_y); + + glamor_set_destination_pixmap_priv_nc(pixmap_priv); + pixmap_priv_get_dest_scale(pixmap_priv, &xscale, &yscale); + + glUseProgram(glamor_priv->solid_prog); + + glamor_get_rgba_from_pixel(fg_pixel, + &color[0], &color[1], &color[2], &color[3], + format_for_pixmap(pixmap)); + glUniform4fv(glamor_priv->solid_color_uniform_location, 1, color); + + points = glamor_get_vbo_space(screen, w * h * sizeof(float) * 2, + &vbo_offset); + next_point = points; + + clip = fbGetCompositeClip(gc); + + /* Note that because fb sets miTranslate in the GC, our incoming X + * and Y are in screen coordinate space (same for spans, but not + * other operations). + */ + for (yy = 0; yy < h; yy++) { + uint8_t *bitmap_row = bitmap_data + yy * bitmap_stride; + for (xx = 0; xx < w; xx++) { + if (bitmap_row[xx / 8] & (1 << xx % 8) && + RegionContainsPoint(clip, + x + xx, + y + yy, + NULL)) { + next_point[0] = v_from_x_coord_x(xscale, x + xx + off_x + 0.5); + if (glamor_priv->yInverted) + next_point[1] = v_from_x_coord_y_inverted(yscale, y + yy + off_y + 0.5); + else + next_point[1] = v_from_x_coord_y(yscale, y + yy + off_y + 0.5); + + next_point += 2; + num_points++; + } + } + } + glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT, + GL_FALSE, 2 * sizeof(float), + vbo_offset); + glEnableVertexAttribArray(GLAMOR_VERTEX_POS); + + glamor_put_vbo_space(screen); + + glDrawArrays(GL_POINTS, 0, num_points); + + glDisableVertexAttribArray(GLAMOR_VERTEX_POS); + + return TRUE; +} + +static Bool +_glamor_push_pixels(GCPtr pGC, PixmapPtr pBitmap, + DrawablePtr pDrawable, int w, int h, int x, int y, + Bool fallback) +{ + glamor_pixmap_private *pixmap_priv; + + if (!fallback && glamor_ddx_fallback_check_pixmap(pDrawable) + && glamor_ddx_fallback_check_pixmap(&pBitmap->drawable) + && glamor_ddx_fallback_check_gc(pGC)) + return FALSE; + + pixmap_priv = glamor_get_pixmap_private(pBitmap); + if (pixmap_priv->type == GLAMOR_MEMORY) { + if (glamor_push_pixels_points(pGC, pBitmap, pDrawable, w, h, x, y)) + return TRUE; + } + + miPushPixels(pGC, pBitmap, pDrawable, w, h, x, y); + return TRUE; +} + +void +glamor_push_pixels(GCPtr pGC, PixmapPtr pBitmap, + DrawablePtr pDrawable, int w, int h, int x, int y) +{ + _glamor_push_pixels(pGC, pBitmap, pDrawable, w, h, x, y, TRUE); +} + +Bool +glamor_push_pixels_nf(GCPtr pGC, PixmapPtr pBitmap, + DrawablePtr pDrawable, int w, int h, int x, int y) +{ + return _glamor_push_pixels(pGC, pBitmap, pDrawable, w, h, x, y, FALSE); +} diff --git a/xserver/glamor/glamor_glyphs.c b/xserver/glamor/glamor_glyphs.c new file mode 100644 index 000000000..42f5f65f6 --- /dev/null +++ b/xserver/glamor/glamor_glyphs.c @@ -0,0 +1,1807 @@ +/* + * Copyright © 2008 Red Hat, Inc. + * Partly based on code Copyright © 2000 SuSE, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Red Hat not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. Red Hat makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * Red Hat DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL Red Hat + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of SuSE not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. SuSE makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: Owen Taylor <otaylor@fishsoup.net> + * Based on code by: Keith Packard + */ + +#include <stdlib.h> + +#include "glamor_priv.h" + +#include <mipict.h> + +#if DEBUG_GLYPH_CACHE +#define DBG_GLYPH_CACHE(a) ErrorF a +#else +#define DBG_GLYPH_CACHE(a) +#endif + +/* Width of the pixmaps we use for the caches; this should be less than + * max texture size of the driver; this may need to actually come from + * the driver. + */ + +/* Maximum number of glyphs we buffer on the stack before flushing + * rendering to the mask or destination surface. + */ +#define GLYPH_BUFFER_SIZE 1024 + +#define CACHE_PICTURE_SIZE 1024 +#define GLYPH_MIN_SIZE 8 +#define GLYPH_MAX_SIZE 64 +#define GLYPH_CACHE_SIZE ((CACHE_PICTURE_SIZE) * CACHE_PICTURE_SIZE / (GLYPH_MIN_SIZE * GLYPH_MIN_SIZE)) +#define MASK_CACHE_MAX_SIZE 32 +#define MASK_CACHE_WIDTH (CACHE_PICTURE_SIZE / MASK_CACHE_MAX_SIZE) +#define MASK_CACHE_MASK ((1LL << (MASK_CACHE_WIDTH)) - 1) + +typedef struct { + PicturePtr source; + glamor_composite_rect_t rects[GLYPH_BUFFER_SIZE + 4]; + int count; +} glamor_glyph_buffer_t; + +struct glamor_glyph { + glamor_glyph_cache_t *cache; + uint16_t x, y; + uint16_t size, pos; + unsigned long long left_x1_map, left_x2_map; + unsigned long long right_x1_map, right_x2_map; /* Use to check real intersect or not. */ + Bool has_edge_map; + Bool cached; +}; + +typedef enum { + GLAMOR_GLYPH_SUCCESS, /* Glyph added to render buffer */ + GLAMOR_GLYPH_FAIL, /* out of memory, etc */ + GLAMOR_GLYPH_NEED_FLUSH, /* would evict a glyph already in the buffer */ +} glamor_glyph_cache_result_t; + +#define NeedsComponent(f) (PICT_FORMAT_A(f) != 0 && PICT_FORMAT_RGB(f) != 0) +static DevPrivateKeyRec glamor_glyph_key; + +static inline struct glamor_glyph * +glamor_glyph_get_private(GlyphPtr glyph) +{ + return (struct glamor_glyph *) glyph->devPrivates; +} + +/* + * Mask cache is located at the corresponding cache picture's last row. + * and is deadicated for the mask picture when do the glyphs_via_mask. + * + * As we split the glyphs list according to its overlapped or non-overlapped, + * we can reduce the length of glyphs to do the glyphs_via_mask to 2 or 3 + * glyphs one time for most cases. Thus it give us a case to allocate a + * small portion of the corresponding cache directly as the mask picture. + * Then we can rendering the glyphs to this mask picture, and latter we + * can accumulate the second steps, composite the mask to the dest with + * the other non-overlapped glyphs's rendering process. + * Another major benefit is we now only need to clear a relatively small mask + * region then before. It also make us implement a bunch mask picture clearing + * algorithm to avoid too frequently small region clearing. + * + * If there is no any overlapping, this method will not get performance gain. + * If there is some overlapping, then this algorithm can get about 15% performance + * gain. + */ + +struct glamor_glyph_mask_cache_entry { + int idx; + int width; + int height; + int x; + int y; +}; + +static struct glamor_glyph_mask_cache { + PixmapPtr pixmap; + struct glamor_glyph_mask_cache_entry mcache[MASK_CACHE_WIDTH]; + unsigned int free_bitmap; + unsigned int cleared_bitmap; +} *mask_cache[GLAMOR_NUM_GLYPH_CACHE_FORMATS] = { +NULL}; + +static void +clear_mask_cache_bitmap(struct glamor_glyph_mask_cache *maskcache, + unsigned int clear_mask_bits) +{ + unsigned int i = 0; + BoxRec box[MASK_CACHE_WIDTH]; + int box_cnt = 0; + + assert((clear_mask_bits & ~MASK_CACHE_MASK) == 0); + for (i = 0; i < MASK_CACHE_WIDTH; i++) { + if (clear_mask_bits & (1 << i)) { + box[box_cnt].x1 = maskcache->mcache[i].x; + box[box_cnt].x2 = maskcache->mcache[i].x + MASK_CACHE_MAX_SIZE; + box[box_cnt].y1 = maskcache->mcache[i].y; + box[box_cnt].y2 = maskcache->mcache[i].y + MASK_CACHE_MAX_SIZE; + box_cnt++; + } + } + glamor_solid_boxes(maskcache->pixmap, box, box_cnt, 0); + maskcache->cleared_bitmap |= clear_mask_bits; +} + +static void +clear_mask_cache(struct glamor_glyph_mask_cache *maskcache) +{ + int x = 0; + int cnt = MASK_CACHE_WIDTH; + unsigned int i = 0; + struct glamor_glyph_mask_cache_entry *mce; + + glamor_solid(maskcache->pixmap, 0, CACHE_PICTURE_SIZE, CACHE_PICTURE_SIZE, + MASK_CACHE_MAX_SIZE, GXcopy, 0xFFFFFFFF, 0); + mce = &maskcache->mcache[0]; + while (cnt--) { + mce->width = 0; + mce->height = 0; + mce->x = x; + mce->y = CACHE_PICTURE_SIZE; + mce->idx = i++; + x += MASK_CACHE_MAX_SIZE; + mce++; + } + maskcache->free_bitmap = MASK_CACHE_MASK; + maskcache->cleared_bitmap = MASK_CACHE_MASK; +} + +static int +find_continuous_bits(unsigned int bits, int bits_cnt, unsigned int *pbits_mask) +{ + int idx = 0; + unsigned int bits_mask; + + bits_mask = ((1LL << bits_cnt) - 1); + + if (_X_UNLIKELY(bits_cnt > 56)) { + while (bits) { + if ((bits & bits_mask) == bits_mask) { + *pbits_mask = bits_mask << idx; + return idx; + } + bits >>= 1; + idx++; + } + } + else { + idx = __fls(bits); + while (bits) { + unsigned int temp_bits; + + temp_bits = bits_mask << (idx - bits_cnt + 1); + if ((bits & temp_bits) == temp_bits) { + *pbits_mask = temp_bits; + return (idx - bits_cnt + 1); + } + /* Find first zero. And clear the tested bit. */ + bits &= ~(1LL << idx); + idx = __fls(~bits); + bits &= ~((1LL << idx) - 1); + idx--; + } + } + return -1; +} + +static struct glamor_glyph_mask_cache_entry * +get_mask_cache(struct glamor_glyph_mask_cache *maskcache, int blocks) +{ + int free_cleared_bit, idx = -1; + int retry_cnt = 0; + unsigned int bits_mask = 0; + + if (maskcache->free_bitmap == 0) + return NULL; + retry: + free_cleared_bit = maskcache->free_bitmap & maskcache->cleared_bitmap; + if (free_cleared_bit && blocks == 1) { + idx = __fls(free_cleared_bit); + bits_mask = 1 << idx; + } + else if (free_cleared_bit && blocks > 1) { + idx = find_continuous_bits(free_cleared_bit, blocks, &bits_mask); + } + + if (idx < 0) { + clear_mask_cache_bitmap(maskcache, maskcache->free_bitmap); + if (retry_cnt++ > 2) + return NULL; + goto retry; + } + + maskcache->cleared_bitmap &= ~bits_mask; + maskcache->free_bitmap &= ~bits_mask; + DEBUGF("get idx %d free %x clear %x \n", + idx, maskcache->free_bitmap, maskcache->cleared_bitmap); + return &maskcache->mcache[idx]; +} + +static void +put_mask_cache_bitmap(struct glamor_glyph_mask_cache *maskcache, + unsigned int bitmap) +{ + maskcache->free_bitmap |= bitmap; + DEBUGF("put bitmap %x free %x clear %x \n", + bitmap, maskcache->free_bitmap, maskcache->cleared_bitmap); +} + +static void +glamor_unrealize_glyph_caches(ScreenPtr pScreen) +{ + glamor_screen_private *glamor = glamor_get_screen_private(pScreen); + int i; + + if (!glamor->glyph_cache_initialized) + return; + + for (i = 0; i < GLAMOR_NUM_GLYPH_CACHE_FORMATS; i++) { + glamor_glyph_cache_t *cache = &glamor->glyphCaches[i]; + + if (cache->picture) + FreePicture(cache->picture, 0); + + if (cache->glyphs) + free(cache->glyphs); + + if (mask_cache[i]) + free(mask_cache[i]); + } + glamor->glyph_cache_initialized = FALSE; +} + +void +glamor_glyphs_fini(ScreenPtr pScreen) +{ + glamor_unrealize_glyph_caches(pScreen); +} + +/* All caches for a single format share a single pixmap for glyph storage, + * allowing mixing glyphs of different sizes without paying a penalty + * for switching between source pixmaps. (Note that for a size of font + * right at the border between two sizes, we might be switching for almost + * every glyph.) + * + * This function allocates the storage pixmap, and then fills in the + * rest of the allocated structures for all caches with the given format. + */ + +Bool +glamor_realize_glyph_caches(ScreenPtr pScreen) +{ + glamor_screen_private *glamor = glamor_get_screen_private(pScreen); + + unsigned int formats[] = { + PIXMAN_a8, + PIXMAN_a8r8g8b8, + }; + int i; + + memset(glamor->glyphCaches, 0, sizeof(glamor->glyphCaches)); + + for (i = 0; i < sizeof(formats) / sizeof(formats[0]); i++) { + glamor_glyph_cache_t *cache = &glamor->glyphCaches[i]; + PixmapPtr pixmap; + PicturePtr picture; + XID component_alpha; + int depth = PIXMAN_FORMAT_DEPTH(formats[i]); + int error; + PictFormatPtr pPictFormat = + PictureMatchFormat(pScreen, depth, formats[i]); + if (!pPictFormat) + goto bail; + + /* Now allocate the pixmap and picture */ + pixmap = pScreen->CreatePixmap(pScreen, + CACHE_PICTURE_SIZE, + CACHE_PICTURE_SIZE + MASK_CACHE_MAX_SIZE, + depth, GLAMOR_CREATE_NO_LARGE); + if (!pixmap) + goto bail; + + component_alpha = NeedsComponent(pPictFormat->format); + picture = CreatePicture(0, &pixmap->drawable, pPictFormat, + CPComponentAlpha, &component_alpha, + serverClient, &error); + + pScreen->DestroyPixmap(pixmap); + if (!picture) + goto bail; + + ValidatePicture(picture); + + cache->picture = picture; + cache->glyphs = calloc(sizeof(GlyphPtr), GLYPH_CACHE_SIZE); + if (!cache->glyphs) + goto bail; + + cache->evict = rand() % GLYPH_CACHE_SIZE; + mask_cache[i] = calloc(1, sizeof(*mask_cache[i])); + mask_cache[i]->pixmap = pixmap; + clear_mask_cache(mask_cache[i]); + } + assert(i == GLAMOR_NUM_GLYPH_CACHE_FORMATS); + + return TRUE; + + bail: + glamor_unrealize_glyph_caches(pScreen); + return FALSE; +} + +/** + * Called by glamor_create_screen_resources() to set up the glyph cache. + * + * This was previously required to be called by the drivers, but not + * as of the xserver 1.16 ABI. + */ +Bool +glamor_glyphs_init(ScreenPtr pScreen) +{ + glamor_screen_private *glamor = glamor_get_screen_private(pScreen); + + if (glamor->glyph_cache_initialized) + return TRUE; + + if (!dixRegisterPrivateKey(&glamor_glyph_key, + PRIVATE_GLYPH, sizeof(struct glamor_glyph))) + return FALSE; + + glamor->glyph_cache_initialized = TRUE; + + return TRUE; +} + +/* The most efficient thing to way to upload the glyph to the screen + * is to use CopyArea; glamor pixmaps are always offscreen. + */ +static void +glamor_glyph_cache_upload_glyph(ScreenPtr screen, + glamor_glyph_cache_t *cache, + GlyphPtr glyph, int x, int y) +{ + PicturePtr pGlyphPicture = GlyphPicture(glyph)[screen->myNum]; + PixmapPtr pGlyphPixmap = (PixmapPtr) pGlyphPicture->pDrawable; + PixmapPtr pCachePixmap = (PixmapPtr) cache->picture->pDrawable; + PixmapPtr scratch; + BoxRec box; + GCPtr gc; + + gc = GetScratchGC(pCachePixmap->drawable.depth, screen); + if (!gc) + return; + + ValidateGC(&pCachePixmap->drawable, gc); + + scratch = pGlyphPixmap; + if (pGlyphPixmap->drawable.depth != pCachePixmap->drawable.depth) { + + scratch = glamor_create_pixmap(screen, + glyph->info.width, + glyph->info.height, + pCachePixmap->drawable.depth, 0); + if (scratch) { + PicturePtr picture; + int error; + + picture = + CreatePicture(0, + &scratch->drawable, + PictureMatchFormat + (screen, + pCachePixmap->drawable.depth, + cache->picture->format), + 0, NULL, serverClient, &error); + if (picture) { + ValidatePicture(picture); + glamor_composite(PictOpSrc, + pGlyphPicture, + NULL, picture, + 0, 0, 0, 0, 0, + 0, glyph->info.width, glyph->info.height); + FreePicture(picture, 0); + } + } + else { + scratch = pGlyphPixmap; + } + } + + box.x1 = x; + box.y1 = y; + box.x2 = x + glyph->info.width; + box.y2 = y + glyph->info.height; + glamor_copy_n_to_n_nf(&scratch->drawable, + &pCachePixmap->drawable, NULL, + &box, 1, -x, -y, FALSE, FALSE, 0, NULL); + if (scratch != pGlyphPixmap) + screen->DestroyPixmap(scratch); + + FreeScratchGC(gc); +} + +void +glamor_glyph_unrealize(ScreenPtr screen, GlyphPtr glyph) +{ + struct glamor_glyph *priv; + + /* Use Lookup in case we have not attached to this glyph. */ + priv = glamor_glyph_get_private(glyph); + + if (priv->cached) + priv->cache->glyphs[priv->pos] = NULL; +} + +/* Cut and paste from render/glyph.c - probably should export it instead */ +static void +glamor_glyph_extents(int nlist, + GlyphListPtr list, GlyphPtr *glyphs, BoxPtr extents) +{ + int x1, x2, y1, y2; + int x, y, n; + + x1 = y1 = MAXSHORT; + x2 = y2 = MINSHORT; + x = y = 0; + while (nlist--) { + x += list->xOff; + y += list->yOff; + n = list->len; + list++; + while (n--) { + GlyphPtr glyph = *glyphs++; + int v; + + v = x - glyph->info.x; + if (v < x1) + x1 = v; + v += glyph->info.width; + if (v > x2) + x2 = v; + + v = y - glyph->info.y; + if (v < y1) + y1 = v; + v += glyph->info.height; + if (v > y2) + y2 = v; + + x += glyph->info.xOff; + y += glyph->info.yOff; + } + } + + extents->x1 = x1 < MINSHORT ? MINSHORT : x1; + extents->x2 = x2 > MAXSHORT ? MAXSHORT : x2; + extents->y1 = y1 < MINSHORT ? MINSHORT : y1; + extents->y2 = y2 > MAXSHORT ? MAXSHORT : y2; +} + +static void +glamor_glyph_priv_get_edge_map(GlyphPtr glyph, struct glamor_glyph *priv, + PicturePtr glyph_picture) +{ + PixmapPtr glyph_pixmap = (PixmapPtr) glyph_picture->pDrawable; + int j; + unsigned long long left_x1_map = 0, left_x2_map = 0; + unsigned long long right_x1_map = 0, right_x2_map = 0; + int bitsPerPixel; + int stride; + void *bits; + int width; + unsigned int left_x1_data = 0, left_x2_data = 0; + unsigned int right_x1_data = 0, right_x2_data = 0; + + bitsPerPixel = glyph_pixmap->drawable.bitsPerPixel; + stride = glyph_pixmap->devKind; + bits = glyph_pixmap->devPrivate.ptr; + width = glyph->info.width; + + if (glyph_pixmap->drawable.width < 2 + || !(glyph_pixmap->drawable.depth == 8 + || glyph_pixmap->drawable.depth == 1 + || glyph_pixmap->drawable.depth == 32)) { + priv->has_edge_map = FALSE; + return; + } + + left_x1_map = left_x2_map = 0; + right_x1_map = right_x2_map = 0; + + for (j = 0; j < glyph_pixmap->drawable.height; j++) { + if (bitsPerPixel == 8) { + unsigned char *data; + + data = (unsigned char *) ((unsigned char *) bits + stride * j); + left_x1_data = *data++; + left_x2_data = *data; + data = + (unsigned char *) ((unsigned char *) bits + stride * j + width - + 2); + right_x1_data = *data++; + right_x2_data = *data; + } + else if (bitsPerPixel == 32) { + left_x1_data = *((unsigned int *) bits + stride / 4 * j); + left_x2_data = *((unsigned int *) bits + stride / 4 * j + 1); + right_x1_data = + *((unsigned int *) bits + stride / 4 * j + width - 2); + right_x2_data = + *((unsigned int *) bits + stride / 4 * j + width - 1); + } + else if (bitsPerPixel == 1) { + unsigned char temp; + + temp = *((unsigned char *) glyph_pixmap->devPrivate.ptr + + glyph_pixmap->devKind * j) & 0x3; + left_x1_data = temp & 0x1; + left_x2_data = temp & 0x2; + + temp = *((unsigned char *) glyph_pixmap->devPrivate.ptr + + glyph_pixmap->devKind * j + + (glyph_pixmap->drawable.width - 2) / 8); + right_x1_data = temp + & (1 << ((glyph_pixmap->drawable.width - 2) % 8)); + temp = *((unsigned char *) glyph_pixmap->devPrivate.ptr + + glyph_pixmap->devKind * j + + (glyph_pixmap->drawable.width - 1) / 8); + right_x2_data = temp + & (1 << ((glyph_pixmap->drawable.width - 1) % 8)); + } + left_x1_map |= (left_x1_data != 0) << j; + left_x2_map |= (left_x2_data != 0) << j; + right_x1_map |= (right_x1_data != 0) << j; + right_x2_map |= (right_x2_data != 0) << j; + } + + priv->left_x1_map = left_x1_map; + priv->left_x2_map = left_x2_map; + priv->right_x1_map = right_x1_map; + priv->right_x2_map = right_x2_map; + priv->has_edge_map = TRUE; + return; +} + +/** + * Returns TRUE if the glyphs in the lists intersect. Only checks based on + * bounding box, which appears to be good enough to catch most cases at least. + */ + +#define INTERSECTED_TYPE_MASK 1 +#define NON_INTERSECTED 0 +#define INTERSECTED 1 + +struct glamor_glyph_list { + int nlist; + GlyphListPtr list; + GlyphPtr *glyphs; + int type; +}; + +static Bool +glyph_new_fixed_list(struct glamor_glyph_list *fixed_list, + GlyphPtr *cur_glyphs, + GlyphPtr ** head_glyphs, + GlyphListPtr cur_list, + int cur_pos, int cur_x, int cur_y, + int x1, int y1, int x2, int y2, + GlyphListPtr *head_list, + int *head_pos, + int *head_x, + int *head_y, int *fixed_cnt, int type, BoxPtr prev_extents) +{ + int x_off = 0; + int y_off = 0; + int n_off = 0; + int list_cnt; + + if (type == NON_INTERSECTED) { + if (x1 < prev_extents->x2 && x2 > prev_extents->x1 + && y1 < prev_extents->y2 && y2 > prev_extents->y1) + return FALSE; + x_off = (*(cur_glyphs - 1))->info.xOff; + y_off = (*(cur_glyphs - 1))->info.yOff; + n_off = 1; + } + + list_cnt = cur_list - *head_list + 1; + if (cur_pos <= n_off) { + DEBUGF("break at %d n_off %d\n", cur_pos, n_off); + list_cnt--; + if (cur_pos < n_off) { + /* we overlap with previous list's last glyph. */ + x_off += cur_list->xOff; + y_off += cur_list->yOff; + cur_list--; + cur_pos = cur_list->len; + if (cur_pos <= n_off) { + list_cnt--; + } + } + } + DEBUGF("got %d lists\n", list_cnt); + if (list_cnt != 0) { + fixed_list->list = malloc(list_cnt * sizeof(*cur_list)); + memcpy(fixed_list->list, *head_list, list_cnt * sizeof(*cur_list)); + fixed_list->list[0].xOff = *head_x; + fixed_list->list[0].yOff = *head_y; + fixed_list->glyphs = *head_glyphs; + fixed_list->type = type & INTERSECTED_TYPE_MASK; + fixed_list->nlist = list_cnt; + if (cur_list != *head_list) { + fixed_list->list[0].len = (*head_list)->len - *head_pos; + if (cur_pos != n_off) + fixed_list->list[list_cnt - 1].len = cur_pos - n_off; + } + else + fixed_list->list[0].len = cur_pos - *head_pos - n_off; + (*fixed_cnt)++; + } + + if (type <= INTERSECTED) { + *head_list = cur_list; + *head_pos = cur_pos - n_off; + *head_x = cur_x - x_off; + *head_y = cur_y - y_off; + *head_glyphs = cur_glyphs - n_off; + } + return TRUE; +} + +/* + * This function detects glyph lists's overlapping. + * + * If check_fake_overlap is set, then it will check the glyph's left + * and right small boxes's real overlapping pixels. And if there is + * no real pixel overlapping, then it will not be treated as overlapped + * case. And we also can configured it to ignore less than 2 pixels + * overlappig. + * + * This function analyzes all the lists and split the list to multiple + * lists which are pure overlapped glyph lists or pure non-overlapped + * list if the overlapping only ocurr on the two adjacent glyphs. + * Otherwise, it return -1. + * + **/ + +static int +glamor_glyphs_intersect(int nlist, GlyphListPtr list, GlyphPtr *glyphs, + PictFormatShort mask_format, + ScreenPtr screen, Bool check_fake_overlap, + struct glamor_glyph_list *fixed_list, int fixed_size) +{ + int x1, x2, y1, y2; + int n; + int x, y; + BoxPtr extents; + BoxRec prev_extents; + Bool first = TRUE, first_list = TRUE; + Bool need_free_list_region = FALSE; + Bool need_free_fixed_list = FALSE; + struct glamor_glyph *priv = NULL; + Bool in_non_intersected_list = -1; + GlyphListPtr head_list; + int head_x, head_y, head_pos; + int fixed_cnt = 0; + GlyphPtr *head_glyphs; + GlyphListPtr cur_list = list; + RegionRec list_region; + RegionRec current_region; + BoxRec current_box; + + if (nlist > 1) { + pixman_region_init(&list_region); + need_free_list_region = TRUE; + } + + pixman_region_init(¤t_region); + + extents = pixman_region_extents(¤t_region); + + x = 0; + y = 0; + x1 = x2 = y1 = y2 = 0; + n = 0; + extents->x1 = 0; + extents->y1 = 0; + extents->x2 = 0; + extents->y2 = 0; + + head_list = list; + DEBUGF("has %d lists.\n", nlist); + while (nlist--) { + BoxRec left_box, right_box = { 0 }; + Bool has_left_edge_box = FALSE, has_right_edge_box = FALSE; + Bool left_to_right; + struct glamor_glyph *left_priv = NULL, *right_priv = NULL; + + x += list->xOff; + y += list->yOff; + n = list->len; + left_to_right = TRUE; + cur_list = list++; + + if (_X_UNLIKELY(!first_list)) { + pixman_region_init_with_extents(¤t_region, extents); + pixman_region_union(&list_region, &list_region, ¤t_region); + first = TRUE; + } + else { + head_list = cur_list; + head_pos = cur_list->len - n; + head_x = x; + head_y = y; + head_glyphs = glyphs; + } + + DEBUGF("current list %p has %d glyphs\n", cur_list, n); + while (n--) { + GlyphPtr glyph = *glyphs++; + + DEBUGF("the %dth glyph\n", cur_list->len - n - 1); + if (glyph->info.width == 0 || glyph->info.height == 0) { + x += glyph->info.xOff; + y += glyph->info.yOff; + continue; + } + if (mask_format + && mask_format != GlyphPicture(glyph)[screen->myNum]->format) { + need_free_fixed_list = TRUE; + goto done; + } + + x1 = x - glyph->info.x; + if (x1 < MINSHORT) + x1 = MINSHORT; + y1 = y - glyph->info.y; + if (y1 < MINSHORT) + y1 = MINSHORT; + if (check_fake_overlap) + priv = glamor_glyph_get_private(glyph); + + x2 = x1 + glyph->info.width; + y2 = y1 + glyph->info.height; + + if (x2 > MAXSHORT) + x2 = MAXSHORT; + if (y2 > MAXSHORT) + y2 = MAXSHORT; + + if (first) { + extents->x1 = x1; + extents->y1 = y1; + extents->x2 = x2; + extents->y2 = y2; + + prev_extents = *extents; + + first = FALSE; + if (check_fake_overlap && priv + && priv->has_edge_map && glyph->info.yOff == 0) { + left_box.x1 = x1; + left_box.x2 = x1 + 1; + left_box.y1 = y1; + + right_box.x1 = x2 - 2; + right_box.x2 = x2 - 1; + right_box.y1 = y1; + left_priv = right_priv = priv; + has_left_edge_box = TRUE; + has_right_edge_box = TRUE; + } + } + else { + if (_X_UNLIKELY(!first_list)) { + current_box.x1 = x1; + current_box.y1 = y1; + current_box.x2 = x2; + current_box.y2 = y2; + if (pixman_region_contains_rectangle + (&list_region, ¤t_box) != PIXMAN_REGION_OUT) { + need_free_fixed_list = TRUE; + goto done; + } + } + + if (x1 < extents->x2 && x2 > extents->x1 + && y1 < extents->y2 && y2 > extents->y1) { + + if (check_fake_overlap && + (has_left_edge_box || has_right_edge_box) + && priv->has_edge_map && glyph->info.yOff == 0) { + int left_dx, right_dx; + unsigned long long intersected; + + left_dx = has_left_edge_box ? 1 : 0; + right_dx = has_right_edge_box ? 1 : 0; + if (x1 + 1 < extents->x2 - right_dx && + x2 - 1 > extents->x1 + left_dx) + goto real_intersected; + + if (left_to_right && has_right_edge_box) { + if (x1 == right_box.x1) { + intersected = + ((priv->left_x1_map & right_priv-> + right_x1_map) + | (priv->left_x2_map & right_priv-> + right_x2_map)); + if (intersected) + goto real_intersected; + } + else if (x1 == right_box.x2) { + intersected = + (priv->left_x1_map & right_priv-> + right_x2_map); + if (intersected) { +#ifdef GLYPHS_EDEGE_OVERLAP_LOOSE_CHECK + /* tolerate with two pixels overlap. */ + intersected &= ~(1 << __fls(intersected)); + if ((intersected & (intersected - 1))) +#endif + goto real_intersected; + } + } + } + else if (!left_to_right && has_left_edge_box) { + if (x2 - 1 == left_box.x1) { + intersected = + (priv->right_x2_map & left_priv-> + left_x1_map); + if (intersected) { +#ifdef GLYPHS_EDEGE_OVERLAP_LOOSE_CHECK + /* tolerate with two pixels overlap. */ + intersected &= ~(1 << __fls(intersected)); + if ((intersected & (intersected - 1))) +#endif + goto real_intersected; + } + } + else if (x2 - 1 == right_box.x2) { + if ((priv->right_x1_map & left_priv-> + left_x1_map) + || (priv->right_x2_map & left_priv-> + left_x2_map)) + goto real_intersected; + } + } + else { + if (x1 < extents->x2 && x1 + 2 > extents->x1) + goto real_intersected; + } + goto non_intersected; + } + else { + real_intersected: + DEBUGF("overlap with previous glyph.\n"); + if (in_non_intersected_list == 1) { + if (fixed_cnt >= fixed_size) { + need_free_fixed_list = TRUE; + goto done; + } + if (!glyph_new_fixed_list(&fixed_list[fixed_cnt], + glyphs - 1, + &head_glyphs, + cur_list, + cur_list->len - (n + 1), + x, y, x1, y1, x2, y2, + &head_list, &head_pos, + &head_x, &head_y, + &fixed_cnt, + NON_INTERSECTED, + &prev_extents)) { + need_free_fixed_list = TRUE; + goto done; + } + } + + in_non_intersected_list = 0; + + } + } + else { + non_intersected: + DEBUGF("doesn't overlap with previous glyph.\n"); + if (in_non_intersected_list == 0) { + if (fixed_cnt >= fixed_size) { + need_free_fixed_list = TRUE; + goto done; + } + if (!glyph_new_fixed_list(&fixed_list[fixed_cnt], + glyphs - 1, + &head_glyphs, + cur_list, + cur_list->len - (n + 1), x, y, + x1, y1, x2, y2, + &head_list, + &head_pos, + &head_x, + &head_y, &fixed_cnt, + INTERSECTED, &prev_extents)) { + need_free_fixed_list = TRUE; + goto done; + } + } + in_non_intersected_list = 1; + } + prev_extents = *extents; + } + + if (check_fake_overlap && priv + && priv->has_edge_map && glyph->info.yOff == 0) { + if (!has_left_edge_box || x1 < extents->x1) { + left_box.x1 = x1; + left_box.x2 = x1 + 1; + left_box.y1 = y1; + has_left_edge_box = TRUE; + left_priv = priv; + } + + if (!has_right_edge_box || x2 > extents->x2) { + right_box.x1 = x2 - 2; + right_box.x2 = x2 - 1; + right_box.y1 = y1; + has_right_edge_box = TRUE; + right_priv = priv; + } + } + + if (x1 < extents->x1) + extents->x1 = x1; + if (x2 > extents->x2) + extents->x2 = x2; + + if (y1 < extents->y1) + extents->y1 = y1; + if (y2 > extents->y2) + extents->y2 = y2; + + x += glyph->info.xOff; + y += glyph->info.yOff; + } + first_list = FALSE; + } + + if (in_non_intersected_list == 0 && fixed_cnt == 0) { + fixed_cnt = -1; + goto done; + } + + if ((in_non_intersected_list != -1 || head_pos != n) && (fixed_cnt > 0)) { + if (fixed_cnt >= fixed_size) { + need_free_fixed_list = TRUE; + goto done; + } + if (!glyph_new_fixed_list(&fixed_list[fixed_cnt], + glyphs - 1, + &head_glyphs, + cur_list, + cur_list->len - (n + 1), x, y, + x1, y1, x2, y2, + &head_list, + &head_pos, + &head_x, + &head_y, &fixed_cnt, + (!in_non_intersected_list) | 0x80, + &prev_extents)) { + need_free_fixed_list = TRUE; + goto done; + } + } + + done: + if (need_free_list_region) + pixman_region_fini(&list_region); + pixman_region_fini(¤t_region); + + if (need_free_fixed_list && fixed_cnt >= 0) { + while (fixed_cnt--) { + free(fixed_list[fixed_cnt].list); + } + } + + DEBUGF("Got %d fixed list \n", fixed_cnt); + return fixed_cnt; +} + +static inline unsigned int +glamor_glyph_size_to_count(int size) +{ + size /= GLYPH_MIN_SIZE; + return size * size; +} + +static inline unsigned int +glamor_glyph_count_to_mask(int count) +{ + return ~(count - 1); +} + +static inline unsigned int +glamor_glyph_size_to_mask(int size) +{ + return glamor_glyph_count_to_mask(glamor_glyph_size_to_count(size)); +} + +static PicturePtr +glamor_glyph_cache(glamor_screen_private *glamor, GlyphPtr glyph, int *out_x, + int *out_y) +{ + ScreenPtr screen = glamor->screen; + PicturePtr glyph_picture = GlyphPicture(glyph)[screen->myNum]; + glamor_glyph_cache_t *cache = + &glamor->glyphCaches[PICT_FORMAT_RGB(glyph_picture->format) != 0]; + struct glamor_glyph *priv = NULL, *evicted_priv = NULL; + int size, mask, pos, s; + + if (glyph->info.width > GLYPH_MAX_SIZE + || glyph->info.height > GLYPH_MAX_SIZE) + return NULL; + + for (size = GLYPH_MIN_SIZE; size <= GLYPH_MAX_SIZE; size *= 2) + if (glyph->info.width <= size && glyph->info.height <= size) + break; + + s = glamor_glyph_size_to_count(size); + mask = glamor_glyph_count_to_mask(s); + pos = (cache->count + s - 1) & mask; + + priv = glamor_glyph_get_private(glyph); + if (pos < GLYPH_CACHE_SIZE) { + cache->count = pos + s; + } + else { + for (s = size; s <= GLYPH_MAX_SIZE; s *= 2) { + int i = cache->evict & glamor_glyph_size_to_mask(s); + GlyphPtr evicted = cache->glyphs[i]; + + if (evicted == NULL) + continue; + + evicted_priv = glamor_glyph_get_private(evicted); + assert(evicted_priv->pos == i); + if (evicted_priv->size >= s) { + cache->glyphs[i] = NULL; + evicted_priv->cached = FALSE; + pos = cache->evict & glamor_glyph_size_to_mask(size); + } + else + evicted_priv = NULL; + break; + } + if (evicted_priv == NULL) { + int count = glamor_glyph_size_to_count(size); + + mask = glamor_glyph_count_to_mask(count); + pos = cache->evict & mask; + for (s = 0; s < count; s++) { + GlyphPtr evicted = cache->glyphs[pos + s]; + + if (evicted != NULL) { + + evicted_priv = glamor_glyph_get_private(evicted); + + assert(evicted_priv->pos == pos + s); + evicted_priv->cached = FALSE; + cache->glyphs[pos + s] = NULL; + } + } + + } + /* And pick a new eviction position */ + cache->evict = rand() % GLYPH_CACHE_SIZE; + } + + cache->glyphs[pos] = glyph; + + priv->cache = cache; + priv->size = size; + priv->pos = pos; + s = pos / ((GLYPH_MAX_SIZE / GLYPH_MIN_SIZE) * + (GLYPH_MAX_SIZE / GLYPH_MIN_SIZE)); + priv->x = s % (CACHE_PICTURE_SIZE / GLYPH_MAX_SIZE) * GLYPH_MAX_SIZE; + priv->y = (s / (CACHE_PICTURE_SIZE / GLYPH_MAX_SIZE)) * GLYPH_MAX_SIZE; + for (s = GLYPH_MIN_SIZE; s < GLYPH_MAX_SIZE; s *= 2) { + if (pos & 1) + priv->x += s; + if (pos & 2) + priv->y += s; + pos >>= 2; + } + + glamor_glyph_cache_upload_glyph(screen, cache, glyph, priv->x, priv->y); +#ifndef GLYPHS_NO_EDEGEMAP_OVERLAP_CHECK + if (priv->has_edge_map == FALSE && glyph->info.width >= 2) + glamor_glyph_priv_get_edge_map(glyph, priv, glyph_picture); +#endif + priv->cached = TRUE; + + *out_x = priv->x; + *out_y = priv->y; + return cache->picture; +} + +typedef void (*glyphs_flush_func) (void *arg); +struct glyphs_flush_dst_arg { + CARD8 op; + PicturePtr src; + PicturePtr dst; + glamor_glyph_buffer_t *buffer; + int x_src, y_src; + int x_dst, y_dst; +}; + +static struct glyphs_flush_dst_arg dst_arg; +static struct glyphs_flush_mask_arg mask_arg; +static glamor_glyph_buffer_t dst_buffer; +static glamor_glyph_buffer_t mask_buffer; +unsigned long long mask_glyphs_cnt = 0; +unsigned long long dst_glyphs_cnt = 0; + +#define GLYPHS_DST_MODE_VIA_MASK 0 +#define GLYPHS_DST_MODE_VIA_MASK_CACHE 1 +#define GLYPHS_DST_MODE_TO_DST 2 +#define GLYPHS_DST_MODE_MASK_TO_DST 3 + +struct glyphs_flush_mask_arg { + PicturePtr mask; + glamor_glyph_buffer_t *buffer; + struct glamor_glyph_mask_cache *maskcache; + unsigned int used_bitmap; +}; + +static void +glamor_glyphs_flush_mask(struct glyphs_flush_mask_arg *arg) +{ + if (arg->buffer->count > 0) { +#ifdef RENDER + glamor_composite_glyph_rects(PictOpAdd, arg->buffer->source, + NULL, arg->mask, + arg->buffer->count, arg->buffer->rects); +#endif + } + arg->buffer->count = 0; + arg->buffer->source = NULL; + +} + +static void +glamor_glyphs_flush_dst(struct glyphs_flush_dst_arg *arg) +{ + if (!arg->buffer) + return; + + if (mask_buffer.count > 0) { + glamor_glyphs_flush_mask(&mask_arg); + } + if (mask_arg.used_bitmap) { + put_mask_cache_bitmap(mask_arg.maskcache, mask_arg.used_bitmap); + mask_arg.used_bitmap = 0; + } + + if (arg->buffer->count > 0) { + glamor_composite_glyph_rects(arg->op, arg->src, + arg->buffer->source, arg->dst, + arg->buffer->count, + &arg->buffer->rects[0]); + arg->buffer->count = 0; + arg->buffer->source = NULL; + } +} + +static glamor_glyph_cache_result_t +glamor_buffer_glyph(glamor_screen_private *glamor_priv, + glamor_glyph_buffer_t *buffer, + PictFormatShort format, + GlyphPtr glyph, struct glamor_glyph *priv, + int x_glyph, int y_glyph, + int dx, int dy, int w, int h, + int glyphs_dst_mode, + glyphs_flush_func glyphs_flush, void *flush_arg) +{ + ScreenPtr screen = glamor_priv->screen; + glamor_composite_rect_t *rect; + PicturePtr source; + int x, y; + glamor_glyph_cache_t *cache; + + if (glyphs_dst_mode != GLYPHS_DST_MODE_MASK_TO_DST) + priv = glamor_glyph_get_private(glyph); + + if (PICT_FORMAT_BPP(format) == 1) + format = PICT_a8; + + cache = &glamor_priv->glyphCaches[PICT_FORMAT_RGB(format) != 0]; + + if (buffer->source && buffer->source != cache->picture && glyphs_flush) { + (*glyphs_flush) (flush_arg); + glyphs_flush = NULL; + } + + if (buffer->count == GLYPH_BUFFER_SIZE && glyphs_flush) { + (*glyphs_flush) (flush_arg); + glyphs_flush = NULL; + } + + if (priv && priv->cached) { + rect = &buffer->rects[buffer->count++]; + rect->x_src = priv->x + dx; + rect->y_src = priv->y + dy; + if (buffer->source == NULL) + buffer->source = priv->cache->picture; + if (glyphs_dst_mode <= GLYPHS_DST_MODE_VIA_MASK_CACHE) + assert(priv->cache->glyphs[priv->pos] == glyph); + } + else { + assert(glyphs_dst_mode != GLYPHS_DST_MODE_MASK_TO_DST); + if (glyphs_flush) + (*glyphs_flush) (flush_arg); + source = glamor_glyph_cache(glamor_priv, glyph, &x, &y); + + if (source != NULL) { + rect = &buffer->rects[buffer->count++]; + rect->x_src = x + dx; + rect->y_src = y + dy; + if (buffer->source == NULL) + buffer->source = source; + if (glyphs_dst_mode == GLYPHS_DST_MODE_VIA_MASK_CACHE) { + /* mode 1 means we are using global mask cache, + * thus we have to composite from the cache picture + * to the cache picture, we need a flush here to make + * sure latter we get the corret glyphs data.*/ + glamor_make_current(glamor_priv); + glFlush(); + } + } + else { + /* Couldn't find the glyph in the cache, use the glyph picture directly */ + source = GlyphPicture(glyph)[screen->myNum]; + if (buffer->source && buffer->source != source && glyphs_flush) + (*glyphs_flush) (flush_arg); + buffer->source = source; + + rect = &buffer->rects[buffer->count++]; + rect->x_src = 0 + dx; + rect->y_src = 0 + dy; + } + priv = glamor_glyph_get_private(glyph); + } + + rect->x_dst = x_glyph; + rect->y_dst = y_glyph; + if (glyphs_dst_mode != GLYPHS_DST_MODE_MASK_TO_DST) { + rect->x_dst -= glyph->info.x; + rect->y_dst -= glyph->info.y; + } + rect->width = w; + rect->height = h; + if (glyphs_dst_mode > GLYPHS_DST_MODE_VIA_MASK_CACHE) { + rect->x_mask = rect->x_src; + rect->y_mask = rect->y_src; + rect->x_src = dst_arg.x_src + rect->x_dst - dst_arg.x_dst; + rect->y_src = dst_arg.y_src + rect->y_dst - dst_arg.y_dst; + } + + return GLAMOR_GLYPH_SUCCESS; +} + +static void +glamor_buffer_glyph_clip(glamor_screen_private *glamor_priv, + BoxPtr rects, + int nrect, PictFormatShort format, + GlyphPtr glyph, struct glamor_glyph *priv, + int glyph_x, int glyph_y, + int glyph_dx, int glyph_dy, + int width, int height, + int glyphs_mode, + glyphs_flush_func flush_func, void *arg) +{ + int i; + + for (i = 0; i < nrect; i++) { + int dst_x, dst_y; + int dx, dy; + int x2, y2; + + dst_x = glyph_x - glyph_dx; + dst_y = glyph_y - glyph_dy; + x2 = dst_x + width; + y2 = dst_y + height; + dx = dy = 0; + if (rects[i].y1 >= y2) + break; + + if (dst_x < rects[i].x1) + dx = rects[i].x1 - dst_x, dst_x = rects[i].x1; + if (x2 > rects[i].x2) + x2 = rects[i].x2; + if (dst_y < rects[i].y1) + dy = rects[i].y1 - dst_y, dst_y = rects[i].y1; + if (y2 > rects[i].y2) + y2 = rects[i].y2; + if (dst_x < x2 && dst_y < y2) { + + glamor_buffer_glyph(glamor_priv, + &dst_buffer, + format, + glyph, priv, + dst_x + glyph_dx, + dst_y + glyph_dy, + dx, dy, + x2 - dst_x, y2 - dst_y, + glyphs_mode, flush_func, arg); + } + } +} + +static void +glamor_glyphs_via_mask(CARD8 op, + PicturePtr src, + PicturePtr dst, + PictFormatPtr mask_format, + INT16 x_src, + INT16 y_src, + int nlist, GlyphListPtr list, GlyphPtr *glyphs, + Bool use_mask_cache) +{ + PixmapPtr mask_pixmap = 0; + PicturePtr mask; + ScreenPtr screen = dst->pDrawable->pScreen; + int width = 0, height = 0; + int x, y; + int x_dst = list->xOff, y_dst = list->yOff; + int n; + GlyphPtr glyph; + int error; + BoxRec extents = { 0, 0, 0, 0 }; + XID component_alpha; + glamor_screen_private *glamor_priv; + int need_free_mask = FALSE; + glamor_glyph_buffer_t buffer; + struct glyphs_flush_mask_arg arg; + glamor_glyph_buffer_t *pmask_buffer; + struct glyphs_flush_mask_arg *pmask_arg; + struct glamor_glyph_mask_cache_entry *mce = NULL; + struct glamor_glyph_mask_cache *maskcache; + glamor_glyph_cache_t *cache; + int glyphs_dst_mode; + + glamor_glyph_extents(nlist, list, glyphs, &extents); + + if (extents.x2 <= extents.x1 || extents.y2 <= extents.y1) + return; + glamor_priv = glamor_get_screen_private(screen); + width = extents.x2 - extents.x1; + height = extents.y2 - extents.y1; + + if (mask_format->depth == 1) { + PictFormatPtr a8Format = PictureMatchFormat(screen, 8, PICT_a8); + + if (a8Format) + mask_format = a8Format; + } + + cache = &glamor_priv->glyphCaches + [PICT_FORMAT_RGB(mask_format->format) != 0]; + maskcache = mask_cache[PICT_FORMAT_RGB(mask_format->format) != 0]; + + x = -extents.x1; + y = -extents.y1; + if (!use_mask_cache || width > (CACHE_PICTURE_SIZE / 4) + || height > MASK_CACHE_MAX_SIZE) { + new_mask_pixmap: + mask_pixmap = glamor_create_pixmap(screen, width, height, + mask_format->depth, + CREATE_PIXMAP_USAGE_SCRATCH); + if (!mask_pixmap) { + glamor_destroy_pixmap(mask_pixmap); + return; + } + glamor_solid(mask_pixmap, 0, 0, width, height, GXcopy, 0xFFFFFFFF, 0); + component_alpha = NeedsComponent(mask_format->format); + mask = CreatePicture(0, &mask_pixmap->drawable, + mask_format, CPComponentAlpha, + &component_alpha, serverClient, &error); + if (!mask) + return; + need_free_mask = TRUE; + pmask_arg = &arg; + pmask_buffer = &buffer; + pmask_buffer->count = 0; + pmask_buffer->source = NULL; + pmask_arg->used_bitmap = 0; + glyphs_dst_mode = GLYPHS_DST_MODE_VIA_MASK; + } + else { + int retry_cnt = 0; + + retry: + mce = get_mask_cache(maskcache, + (width + MASK_CACHE_MAX_SIZE - + 1) / MASK_CACHE_MAX_SIZE); + + if (mce == NULL) { + glamor_glyphs_flush_dst(&dst_arg); + retry_cnt++; + if (retry_cnt > 2) { + assert(0); + goto new_mask_pixmap; + } + goto retry; + } + + mask = cache->picture; + x += mce->x; + y += mce->y; + mce->width = (width + MASK_CACHE_MAX_SIZE - 1) / MASK_CACHE_MAX_SIZE; + mce->height = 1; + if (mask_arg.mask && mask_arg.mask != mask && mask_buffer.count != 0) + glamor_glyphs_flush_dst(&dst_arg); + pmask_arg = &mask_arg; + pmask_buffer = &mask_buffer; + pmask_arg->maskcache = maskcache; + glyphs_dst_mode = GLYPHS_DST_MODE_VIA_MASK_CACHE; + } + pmask_arg->mask = mask; + pmask_arg->buffer = pmask_buffer; + while (nlist--) { + x += list->xOff; + y += list->yOff; + n = list->len; + mask_glyphs_cnt += n; + while (n--) { + glyph = *glyphs++; + if (glyph->info.width > 0 && glyph->info.height > 0) { + glyphs_flush_func flush_func; + void *temp_arg; + + if (need_free_mask) { + if (pmask_buffer->count) + flush_func = + (glyphs_flush_func) glamor_glyphs_flush_mask; + else + flush_func = NULL; + temp_arg = pmask_arg; + } + else { + /* If we are using global mask cache, then we need to + * flush dst instead of mask. As some dst depends on the + * previous mask result. Just flush mask can't get all previous's + * overlapped glyphs.*/ + if (dst_buffer.count || mask_buffer.count) + flush_func = + (glyphs_flush_func) glamor_glyphs_flush_dst; + else + flush_func = NULL; + temp_arg = &dst_arg; + } + glamor_buffer_glyph(glamor_priv, pmask_buffer, + mask_format->format, + glyph, NULL, x, y, + 0, 0, + glyph->info.width, glyph->info.height, + glyphs_dst_mode, + flush_func, (void *) temp_arg); + } + x += glyph->info.xOff; + y += glyph->info.yOff; + } + list++; + } + + x = extents.x1; + y = extents.y1; + if (need_free_mask) { + glamor_glyphs_flush_mask(pmask_arg); + CompositePicture(op, + src, + mask, + dst, + x_src + x - x_dst, + y_src + y - y_dst, 0, 0, x, y, width, height); + FreePicture(mask, 0); + glamor_destroy_pixmap(mask_pixmap); + } + else { + struct glamor_glyph priv; + glyphs_flush_func flush_func; + BoxPtr rects; + int nrect; + + priv.cache = cache; + priv.x = mce->x; + priv.y = mce->y; + priv.cached = TRUE; + rects = REGION_RECTS(dst->pCompositeClip); + nrect = REGION_NUM_RECTS(dst->pCompositeClip); + + pmask_arg->used_bitmap |= ((1 << mce->width) - 1) << mce->idx; + dst_arg.op = op; + dst_arg.src = src; + dst_arg.dst = dst; + dst_arg.buffer = &dst_buffer; + dst_arg.x_src = x_src; + dst_arg.y_src = y_src; + dst_arg.x_dst = x_dst; + dst_arg.y_dst = y_dst; + + if (dst_buffer.source == NULL) { + dst_buffer.source = cache->picture; + } + else if (dst_buffer.source != cache->picture) { + glamor_glyphs_flush_dst(&dst_arg); + dst_buffer.source = cache->picture; + } + + x += dst->pDrawable->x; + y += dst->pDrawable->y; + + if (dst_buffer.count || mask_buffer.count) + flush_func = (glyphs_flush_func) glamor_glyphs_flush_dst; + else + flush_func = NULL; + + glamor_buffer_glyph_clip(glamor_priv, + rects, nrect, + mask_format->format, + NULL, &priv, + x, y, + 0, 0, + width, height, + GLYPHS_DST_MODE_MASK_TO_DST, + flush_func, (void *) &dst_arg); + } +} + +static void +glamor_glyphs_to_dst(CARD8 op, + PicturePtr src, + PicturePtr dst, + INT16 x_src, + INT16 y_src, + int nlist, GlyphListPtr list, GlyphPtr *glyphs) +{ + ScreenPtr screen = dst->pDrawable->pScreen; + int x = 0, y = 0; + int x_dst = list->xOff, y_dst = list->yOff; + int n; + GlyphPtr glyph; + BoxPtr rects; + int nrect; + glamor_screen_private *glamor_priv; + + rects = REGION_RECTS(dst->pCompositeClip); + nrect = REGION_NUM_RECTS(dst->pCompositeClip); + + glamor_priv = glamor_get_screen_private(screen); + + dst_arg.op = op; + dst_arg.src = src; + dst_arg.dst = dst; + dst_arg.buffer = &dst_buffer; + dst_arg.x_src = x_src; + dst_arg.y_src = y_src; + dst_arg.x_dst = x_dst; + dst_arg.y_dst = y_dst; + + x = dst->pDrawable->x; + y = dst->pDrawable->y; + + while (nlist--) { + x += list->xOff; + y += list->yOff; + n = list->len; + dst_glyphs_cnt += n; + while (n--) { + glyph = *glyphs++; + + if (glyph->info.width > 0 && glyph->info.height > 0) { + glyphs_flush_func flush_func; + + if (dst_buffer.count || mask_buffer.count) + flush_func = (glyphs_flush_func) glamor_glyphs_flush_dst; + else + flush_func = NULL; + glamor_buffer_glyph_clip(glamor_priv, + rects, nrect, + (GlyphPicture(glyph)[screen->myNum])-> + format, glyph, NULL, x, y, + glyph->info.x, glyph->info.y, + glyph->info.width, glyph->info.height, + GLYPHS_DST_MODE_TO_DST, flush_func, + (void *) &dst_arg); + } + + x += glyph->info.xOff; + y += glyph->info.yOff; + } + list++; + } +} + +#define MAX_FIXED_SIZE +static void +glamor_glyphs_reset_buffer(glamor_glyph_buffer_t *buffer) +{ + buffer->count = 0; + buffer->source = NULL; +} + +static Bool +_glamor_glyphs(CARD8 op, + PicturePtr src, + PicturePtr dst, + PictFormatPtr mask_format, + INT16 x_src, + INT16 y_src, int nlist, GlyphListPtr list, + GlyphPtr *glyphs, Bool fallback) +{ + PictFormatShort format; + int fixed_size, fixed_cnt = 0; + struct glamor_glyph_list *fixed_list = NULL; + Bool need_free_list = FALSE; + +#ifndef GLYPHS_NO_EDEGEMAP_OVERLAP_CHECK + Bool check_fake_overlap = TRUE; + + if (!(op == PictOpOver || op == PictOpAdd || op == PictOpXor)) { + /* C = (0,0,0,0) D = glyphs , SRC = A, DEST = B (faked overlapped glyphs, overlapped with (0,0,0,0)). + * For those op, (A IN (C ADD D)) OP B != (A IN D) OP ((A IN C) OP B) + * or (A IN (D ADD C)) OP B != (A IN C) OP ((A IN D) OP B) + * We need to split the faked regions to three or two, and composite the disoverlapped small + * boxes one by one. For other Ops, it's safe to composite the whole box. */ + check_fake_overlap = FALSE; + } +#else + Bool check_fake_overlap = FALSE; +#endif + if (mask_format) + format = mask_format->depth << 24 | mask_format->format; + else + format = 0; + + fixed_size = 32; + glamor_glyphs_reset_buffer(&dst_buffer); + + if (!mask_format || (((nlist == 1 && list->len == 1) || op == PictOpAdd) + && (dst->format == + ((mask_format->depth << 24) | mask_format-> + format)))) { + glamor_glyphs_to_dst(op, src, dst, x_src, y_src, nlist, list, glyphs); + goto last_flush; + } + + glamor_glyphs_reset_buffer(&mask_buffer); + + /* We have mask_format. Need to check the real overlap or not. */ + format = mask_format->depth << 24 | mask_format->format; + + fixed_list = calloc(fixed_size, sizeof(*fixed_list)); + if (_X_UNLIKELY(fixed_list == NULL)) + fixed_size = 0; + fixed_cnt = glamor_glyphs_intersect(nlist, list, glyphs, + format, dst->pDrawable->pScreen, + check_fake_overlap, + fixed_list, fixed_size); + if (fixed_cnt == 0) + mask_format = NULL; + need_free_list = TRUE; + + if (fixed_cnt <= 0) { + if (mask_format == NULL) { + glamor_glyphs_to_dst(op, src, dst, x_src, y_src, nlist, + list, glyphs); + goto last_flush; + } + else { + glamor_glyphs_via_mask(op, src, dst, mask_format, + x_src, y_src, nlist, list, glyphs, FALSE); + goto free_fixed_list; + } + } + else { + + /* We have splitted the original list to serval list, some are overlapped + * and some are non-overlapped. For the non-overlapped, we render it to + * dst directly. For the overlapped, we render it to mask picture firstly, + * then render the mask to dst. If we can use mask cache which is in the + * glyphs cache's last row, we can accumulate the rendering of mask to dst + * with the other dst_buffer's rendering operations thus can reduce the call + * of glDrawElements. + * + * */ + struct glamor_glyph_list *saved_list; + + saved_list = fixed_list; + mask_arg.used_bitmap = 0; + while (fixed_cnt--) { + if (fixed_list->type == NON_INTERSECTED) { + glamor_glyphs_to_dst(op, src, dst, + x_src, y_src, + fixed_list->nlist, + fixed_list->list, fixed_list->glyphs); + } + else + glamor_glyphs_via_mask(op, src, dst, + mask_format, x_src, y_src, + fixed_list->nlist, + fixed_list->list, + fixed_list->glyphs, TRUE); + + free(fixed_list->list); + fixed_list++; + } + free(saved_list); + need_free_list = FALSE; + } + + last_flush: + if (dst_buffer.count || mask_buffer.count) + glamor_glyphs_flush_dst(&dst_arg); + free_fixed_list: + if (need_free_list) { + assert(fixed_cnt <= 0); + free(fixed_list); + } + return TRUE; +} + +void +glamor_glyphs(CARD8 op, + PicturePtr src, + PicturePtr dst, + PictFormatPtr mask_format, + INT16 x_src, + INT16 y_src, int nlist, GlyphListPtr list, GlyphPtr *glyphs) +{ + _glamor_glyphs(op, src, dst, mask_format, x_src, + y_src, nlist, list, glyphs, TRUE); +} + +Bool +glamor_glyphs_nf(CARD8 op, + PicturePtr src, + PicturePtr dst, + PictFormatPtr mask_format, + INT16 x_src, + INT16 y_src, int nlist, GlyphListPtr list, GlyphPtr *glyphs) +{ + return _glamor_glyphs(op, src, dst, mask_format, x_src, + y_src, nlist, list, glyphs, FALSE); +} diff --git a/xserver/glamor/glamor_gradient.c b/xserver/glamor/glamor_gradient.c new file mode 100644 index 000000000..28d66917f --- /dev/null +++ b/xserver/glamor/glamor_gradient.c @@ -0,0 +1,1482 @@ +/* + * Copyright © 2009 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Authors: + * Junyan He <junyan.he@linux.intel.com> + * + */ + +/** @file glamor_gradient.c + * + * Gradient acceleration implementation + */ + +#include "glamor_priv.h" + +#ifdef RENDER + +#define LINEAR_SMALL_STOPS (6 + 2) +#define LINEAR_LARGE_STOPS (16 + 2) + +#define RADIAL_SMALL_STOPS (6 + 2) +#define RADIAL_LARGE_STOPS (16 + 2) + +#ifdef GLAMOR_GRADIENT_SHADER + +static const char * +_glamor_create_getcolor_fs_source(ScreenPtr screen, int stops_count, + int use_array) +{ + char *gradient_fs = NULL; + +#define gradient_fs_getcolor\ + GLAMOR_DEFAULT_PRECISION\ + "uniform int n_stop;\n"\ + "uniform float stops[%d];\n"\ + "uniform vec4 stop_colors[%d];\n"\ + "vec4 get_color(float stop_len)\n"\ + "{\n"\ + " int i = 0;\n"\ + " float new_alpha; \n"\ + " vec4 gradient_color;\n"\ + " float percentage; \n"\ + " for(i = 0; i < n_stop - 1; i++) {\n"\ + " if(stop_len < stops[i])\n"\ + " break; \n"\ + " }\n"\ + " \n"\ + " if(stops[i] - stops[i-1] > 2.0)\n"\ + " percentage = 0.0;\n" /*For comply with pixman, walker->stepper overflow.*/\ + " else if(stops[i] - stops[i-1] < 0.000001)\n"\ + " percentage = 0.0;\n"\ + " else \n"\ + " percentage = (stop_len - stops[i-1])/(stops[i] - stops[i-1]);\n"\ + " new_alpha = percentage * stop_colors[i].a + \n"\ + " (1.0-percentage) * stop_colors[i-1].a; \n"\ + " gradient_color = vec4((percentage * stop_colors[i].rgb \n"\ + " + (1.0-percentage) * stop_colors[i-1].rgb)*new_alpha, \n"\ + " new_alpha);\n"\ + " \n"\ + " return gradient_color;\n"\ + "}\n" + + /* Because the array access for shader is very slow, the performance is very low + if use array. So use global uniform to replace for it if the number of n_stops is small. */ + const char *gradient_fs_getcolor_no_array = + GLAMOR_DEFAULT_PRECISION + "uniform int n_stop;\n" + "uniform float stop0;\n" + "uniform float stop1;\n" + "uniform float stop2;\n" + "uniform float stop3;\n" + "uniform float stop4;\n" + "uniform float stop5;\n" + "uniform float stop6;\n" + "uniform float stop7;\n" + "uniform vec4 stop_color0;\n" + "uniform vec4 stop_color1;\n" + "uniform vec4 stop_color2;\n" + "uniform vec4 stop_color3;\n" + "uniform vec4 stop_color4;\n" + "uniform vec4 stop_color5;\n" + "uniform vec4 stop_color6;\n" + "uniform vec4 stop_color7;\n" + "\n" + "vec4 get_color(float stop_len)\n" + "{\n" + " float stop_after;\n" + " float stop_before;\n" + " vec4 stop_color_before;\n" + " vec4 stop_color_after;\n" + " float new_alpha; \n" + " vec4 gradient_color;\n" + " float percentage; \n" + " \n" + " if((stop_len < stop0) && (n_stop >= 1)) {\n" + " stop_color_before = stop_color0;\n" + " stop_color_after = stop_color0;\n" + " stop_after = stop0;\n" + " stop_before = stop0;\n" + " } else if((stop_len < stop1) && (n_stop >= 2)) {\n" + " stop_color_before = stop_color0;\n" + " stop_color_after = stop_color1;\n" + " stop_after = stop1;\n" + " stop_before = stop0;\n" + " } else if((stop_len < stop2) && (n_stop >= 3)) {\n" + " stop_color_before = stop_color1;\n" + " stop_color_after = stop_color2;\n" + " stop_after = stop2;\n" + " stop_before = stop1;\n" + " } else if((stop_len < stop3) && (n_stop >= 4)){\n" + " stop_color_before = stop_color2;\n" + " stop_color_after = stop_color3;\n" + " stop_after = stop3;\n" + " stop_before = stop2;\n" + " } else if((stop_len < stop4) && (n_stop >= 5)){\n" + " stop_color_before = stop_color3;\n" + " stop_color_after = stop_color4;\n" + " stop_after = stop4;\n" + " stop_before = stop3;\n" + " } else if((stop_len < stop5) && (n_stop >= 6)){\n" + " stop_color_before = stop_color4;\n" + " stop_color_after = stop_color5;\n" + " stop_after = stop5;\n" + " stop_before = stop4;\n" + " } else if((stop_len < stop6) && (n_stop >= 7)){\n" + " stop_color_before = stop_color5;\n" + " stop_color_after = stop_color6;\n" + " stop_after = stop6;\n" + " stop_before = stop5;\n" + " } else if((stop_len < stop7) && (n_stop >= 8)){\n" + " stop_color_before = stop_color6;\n" + " stop_color_after = stop_color7;\n" + " stop_after = stop7;\n" + " stop_before = stop6;\n" + " } else {\n" + " stop_color_before = stop_color7;\n" + " stop_color_after = stop_color7;\n" + " stop_after = stop7;\n" + " stop_before = stop7;\n" + " }\n" + " if(stop_after - stop_before > 2.0)\n" + " percentage = 0.0;\n" //For comply with pixman, walker->stepper overflow. + " else if(stop_after - stop_before < 0.000001)\n" + " percentage = 0.0;\n" + " else \n" + " percentage = (stop_len - stop_before)/(stop_after - stop_before);\n" + " new_alpha = percentage * stop_color_after.a + \n" + " (1.0-percentage) * stop_color_before.a; \n" + " gradient_color = vec4((percentage * stop_color_after.rgb \n" + " + (1.0-percentage) * stop_color_before.rgb)*new_alpha, \n" + " new_alpha);\n" + " \n" + " return gradient_color;\n" + "}\n"; + + if (use_array) { + XNFasprintf(&gradient_fs, + gradient_fs_getcolor, stops_count, stops_count); + return gradient_fs; + } + else { + return XNFstrdup(gradient_fs_getcolor_no_array); + } +} + +static void +_glamor_create_radial_gradient_program(ScreenPtr screen, int stops_count, + int dyn_gen) +{ + glamor_screen_private *glamor_priv; + int index; + + GLint gradient_prog = 0; + char *gradient_fs = NULL; + GLint fs_prog, vs_prog; + + const char *gradient_vs = + GLAMOR_DEFAULT_PRECISION + "attribute vec4 v_position;\n" + "attribute vec4 v_texcoord;\n" + "varying vec2 source_texture;\n" + "\n" + "void main()\n" + "{\n" + " gl_Position = v_position;\n" + " source_texture = v_texcoord.xy;\n" + "}\n"; + + /* + * Refer to pixman radial gradient. + * + * The problem is given the two circles of c1 and c2 with the radius of r1 and + * r1, we need to caculate the t, which is used to do interpolate with stops, + * using the fomula: + * length((1-t)*c1 + t*c2 - p) = (1-t)*r1 + t*r2 + * expand the fomula with xy coond, get the following: + * sqrt(sqr((1-t)*c1.x + t*c2.x - p.x) + sqr((1-t)*c1.y + t*c2.y - p.y)) + * = (1-t)r1 + t*r2 + * <====> At*t- 2Bt + C = 0 + * where A = sqr(c2.x - c1.x) + sqr(c2.y - c1.y) - sqr(r2 -r1) + * B = (p.x - c1.x)*(c2.x - c1.x) + (p.y - c1.y)*(c2.y - c1.y) + r1*(r2 -r1) + * C = sqr(p.x - c1.x) + sqr(p.y - c1.y) - r1*r1 + * + * solve the fomula and we get the result of + * t = (B + sqrt(B*B - A*C)) / A or + * t = (B - sqrt(B*B - A*C)) / A (quadratic equation have two solutions) + * + * The solution we are going to prefer is the bigger one, unless the + * radius associated to it is negative (or it falls outside the valid t range) + */ + +#define gradient_radial_fs_template\ + GLAMOR_DEFAULT_PRECISION\ + "uniform mat3 transform_mat;\n"\ + "uniform int repeat_type;\n"\ + "uniform float A_value;\n"\ + "uniform vec2 c1;\n"\ + "uniform float r1;\n"\ + "uniform vec2 c2;\n"\ + "uniform float r2;\n"\ + "varying vec2 source_texture;\n"\ + "\n"\ + "vec4 get_color(float stop_len);\n"\ + "\n"\ + "int t_invalid;\n"\ + "\n"\ + "float get_stop_len()\n"\ + "{\n"\ + " float t = 0.0;\n"\ + " float sqrt_value;\n"\ + " t_invalid = 0;\n"\ + " \n"\ + " vec3 tmp = vec3(source_texture.x, source_texture.y, 1.0);\n"\ + " vec3 source_texture_trans = transform_mat * tmp;\n"\ + " source_texture_trans.xy = source_texture_trans.xy/source_texture_trans.z;\n"\ + " float B_value = (source_texture_trans.x - c1.x) * (c2.x - c1.x)\n"\ + " + (source_texture_trans.y - c1.y) * (c2.y - c1.y)\n"\ + " + r1 * (r2 - r1);\n"\ + " float C_value = (source_texture_trans.x - c1.x) * (source_texture_trans.x - c1.x)\n"\ + " + (source_texture_trans.y - c1.y) * (source_texture_trans.y - c1.y)\n"\ + " - r1*r1;\n"\ + " if(abs(A_value) < 0.00001) {\n"\ + " if(B_value == 0.0) {\n"\ + " t_invalid = 1;\n"\ + " return t;\n"\ + " }\n"\ + " t = 0.5 * C_value / B_value;"\ + " } else {\n"\ + " sqrt_value = B_value * B_value - A_value * C_value;\n"\ + " if(sqrt_value < 0.0) {\n"\ + " t_invalid = 1;\n"\ + " return t;\n"\ + " }\n"\ + " sqrt_value = sqrt(sqrt_value);\n"\ + " t = (B_value + sqrt_value) / A_value;\n"\ + " }\n"\ + " if(repeat_type == %d) {\n" /* RepeatNone case. */\ + " if((t <= 0.0) || (t > 1.0))\n"\ + /* try another if first one invalid*/\ + " t = (B_value - sqrt_value) / A_value;\n"\ + " \n"\ + " if((t <= 0.0) || (t > 1.0)) {\n" /*still invalid, return.*/\ + " t_invalid = 1;\n"\ + " return t;\n"\ + " }\n"\ + " } else {\n"\ + " if(t * (r2 - r1) <= -1.0 * r1)\n"\ + /* try another if first one invalid*/\ + " t = (B_value - sqrt_value) / A_value;\n"\ + " \n"\ + " if(t * (r2 -r1) <= -1.0 * r1) {\n" /*still invalid, return.*/\ + " t_invalid = 1;\n"\ + " return t;\n"\ + " }\n"\ + " }\n"\ + " \n"\ + " if(repeat_type == %d){\n" /* repeat normal*/\ + " t = fract(t);\n"\ + " }\n"\ + " \n"\ + " if(repeat_type == %d) {\n" /* repeat reflect*/\ + " t = abs(fract(t * 0.5 + 0.5) * 2.0 - 1.0);\n"\ + " }\n"\ + " \n"\ + " return t;\n"\ + "}\n"\ + "\n"\ + "void main()\n"\ + "{\n"\ + " float stop_len = get_stop_len();\n"\ + " if(t_invalid == 1) {\n"\ + " gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n"\ + " } else {\n"\ + " gl_FragColor = get_color(stop_len);\n"\ + " }\n"\ + "}\n"\ + "\n"\ + "%s\n" /* fs_getcolor_source */ + const char *fs_getcolor_source; + + glamor_priv = glamor_get_screen_private(screen); + + if ((glamor_priv->radial_max_nstops >= stops_count) && (dyn_gen)) { + /* Very Good, not to generate again. */ + return; + } + + glamor_make_current(glamor_priv); + + if (dyn_gen && glamor_priv->gradient_prog[SHADER_GRADIENT_RADIAL][2]) { + glDeleteProgram(glamor_priv->gradient_prog[SHADER_GRADIENT_RADIAL][2]); + glamor_priv->gradient_prog[SHADER_GRADIENT_RADIAL][2] = 0; + } + + gradient_prog = glCreateProgram(); + + vs_prog = glamor_compile_glsl_prog(GL_VERTEX_SHADER, gradient_vs); + + fs_getcolor_source = + _glamor_create_getcolor_fs_source(screen, stops_count, + (stops_count > 0)); + + XNFasprintf(&gradient_fs, + gradient_radial_fs_template, + PIXMAN_REPEAT_NONE, PIXMAN_REPEAT_NORMAL, + PIXMAN_REPEAT_REFLECT, + fs_getcolor_source); + + fs_prog = glamor_compile_glsl_prog(GL_FRAGMENT_SHADER, gradient_fs); + + free(gradient_fs); + + glAttachShader(gradient_prog, vs_prog); + glAttachShader(gradient_prog, fs_prog); + glDeleteShader(vs_prog); + glDeleteShader(fs_prog); + + glBindAttribLocation(gradient_prog, GLAMOR_VERTEX_POS, "v_position"); + glBindAttribLocation(gradient_prog, GLAMOR_VERTEX_SOURCE, "v_texcoord"); + + glamor_link_glsl_prog(screen, gradient_prog, "radial gradient"); + + if (dyn_gen) { + index = 2; + glamor_priv->radial_max_nstops = stops_count; + } + else if (stops_count) { + index = 1; + } + else { + index = 0; + } + + glamor_priv->gradient_prog[SHADER_GRADIENT_RADIAL][index] = gradient_prog; +} + +static void +_glamor_create_linear_gradient_program(ScreenPtr screen, int stops_count, + int dyn_gen) +{ + glamor_screen_private *glamor_priv; + + int index = 0; + GLint gradient_prog = 0; + char *gradient_fs = NULL; + GLint fs_prog, vs_prog; + + const char *gradient_vs = + GLAMOR_DEFAULT_PRECISION + "attribute vec4 v_position;\n" + "attribute vec4 v_texcoord;\n" + "varying vec2 source_texture;\n" + "\n" + "void main()\n" + "{\n" + " gl_Position = v_position;\n" + " source_texture = v_texcoord.xy;\n" + "}\n"; + + /* + * | + * |\ + * | \ + * | \ + * | \ + * |\ \ + * | \ \ + * cos_val = |\ p1d \ / + * sqrt(1/(slope*slope+1.0)) ------>\ \ \ / + * | \ \ \ + * | \ \ / \ + * | \ *Pt1\ + * *p1 | \ \ *P + * \ | / \ \ / + * \ | / \ \ / + * \ | pd \ + * \ | \ / \ + * p2* | \ / \ / + * slope = (p2.y - p1.y) / | / p2d / + * (p2.x - p1.x) | / \ / + * | / \ / + * | / / + * | / / + * | / *Pt2 + * | / + * | / + * | / + * | / + * | / + * -------+--------------------------------- + * O| + * | + * | + * + * step 1: compute the distance of p, pt1 and pt2 in the slope direction. + * Caculate the distance on Y axis first and multiply cos_val to + * get the value on slope direction(pd, p1d and p2d represent the + * distance of p, pt1, and pt2 respectively). + * + * step 2: caculate the percentage of (pd - p1d)/(p2d - p1d). + * If (pd - p1d) > (p2d - p1d) or < 0, then sub or add (p2d - p1d) + * to make it in the range of [0, (p2d - p1d)]. + * + * step 3: compare the percentage to every stop and find the stpos just + * before and after it. Use the interpolation fomula to compute RGBA. + */ + +#define gradient_fs_template \ + GLAMOR_DEFAULT_PRECISION\ + "uniform mat3 transform_mat;\n"\ + "uniform int repeat_type;\n"\ + "uniform int hor_ver;\n"\ + "uniform float pt_slope;\n"\ + "uniform float cos_val;\n"\ + "uniform float p1_distance;\n"\ + "uniform float pt_distance;\n"\ + "varying vec2 source_texture;\n"\ + "\n"\ + "vec4 get_color(float stop_len);\n"\ + "\n"\ + "float get_stop_len()\n"\ + "{\n"\ + " vec3 tmp = vec3(source_texture.x, source_texture.y, 1.0);\n"\ + " float len_percentage;\n"\ + " float distance;\n"\ + " float _p1_distance;\n"\ + " float _pt_distance;\n"\ + " float y_dist;\n"\ + " float stop_after;\n"\ + " float stop_before;\n"\ + " vec4 stop_color_before;\n"\ + " vec4 stop_color_after;\n"\ + " float new_alpha; \n"\ + " vec4 gradient_color;\n"\ + " float percentage; \n"\ + " vec3 source_texture_trans = transform_mat * tmp;\n"\ + " \n"\ + " if(hor_ver == 0) { \n" /*Normal case.*/\ + " y_dist = source_texture_trans.y - source_texture_trans.x*pt_slope;\n"\ + " distance = y_dist * cos_val;\n"\ + " _p1_distance = p1_distance * source_texture_trans.z;\n"\ + " _pt_distance = pt_distance * source_texture_trans.z;\n"\ + " \n"\ + " } else if (hor_ver == 1) {\n"/*horizontal case.*/\ + " distance = source_texture_trans.x;\n"\ + " _p1_distance = p1_distance * source_texture_trans.z;\n"\ + " _pt_distance = pt_distance * source_texture_trans.z;\n"\ + " } \n"\ + " \n"\ + " distance = distance - _p1_distance; \n"\ + " \n"\ + " if(repeat_type == %d){\n" /* repeat normal*/\ + " distance = mod(distance, _pt_distance);\n"\ + " }\n"\ + " \n"\ + " if(repeat_type == %d) {\n" /* repeat reflect*/\ + " distance = abs(mod(distance + _pt_distance, 2.0 * _pt_distance) - _pt_distance);\n"\ + " }\n"\ + " \n"\ + " len_percentage = distance/(_pt_distance);\n"\ + " \n"\ + " return len_percentage;\n"\ + "}\n"\ + "\n"\ + "void main()\n"\ + "{\n"\ + " float stop_len = get_stop_len();\n"\ + " gl_FragColor = get_color(stop_len);\n"\ + "}\n"\ + "\n"\ + "%s" /* fs_getcolor_source */ + const char *fs_getcolor_source; + + glamor_priv = glamor_get_screen_private(screen); + + if ((glamor_priv->linear_max_nstops >= stops_count) && (dyn_gen)) { + /* Very Good, not to generate again. */ + return; + } + + glamor_make_current(glamor_priv); + if (dyn_gen && glamor_priv->gradient_prog[SHADER_GRADIENT_LINEAR][2]) { + glDeleteProgram(glamor_priv->gradient_prog[SHADER_GRADIENT_LINEAR][2]); + glamor_priv->gradient_prog[SHADER_GRADIENT_LINEAR][2] = 0; + } + + gradient_prog = glCreateProgram(); + + vs_prog = glamor_compile_glsl_prog(GL_VERTEX_SHADER, gradient_vs); + + fs_getcolor_source = + _glamor_create_getcolor_fs_source(screen, stops_count, stops_count > 0); + + XNFasprintf(&gradient_fs, + gradient_fs_template, + PIXMAN_REPEAT_NORMAL, PIXMAN_REPEAT_REFLECT, + fs_getcolor_source); + + fs_prog = glamor_compile_glsl_prog(GL_FRAGMENT_SHADER, gradient_fs); + free(gradient_fs); + + glAttachShader(gradient_prog, vs_prog); + glAttachShader(gradient_prog, fs_prog); + glDeleteShader(vs_prog); + glDeleteShader(fs_prog); + + glBindAttribLocation(gradient_prog, GLAMOR_VERTEX_POS, "v_position"); + glBindAttribLocation(gradient_prog, GLAMOR_VERTEX_SOURCE, "v_texcoord"); + + glamor_link_glsl_prog(screen, gradient_prog, "linear gradient"); + + if (dyn_gen) { + index = 2; + glamor_priv->linear_max_nstops = stops_count; + } + else if (stops_count) { + index = 1; + } + else { + index = 0; + } + + glamor_priv->gradient_prog[SHADER_GRADIENT_LINEAR][index] = gradient_prog; +} + +void +glamor_init_gradient_shader(ScreenPtr screen) +{ + glamor_screen_private *glamor_priv; + int i; + + glamor_priv = glamor_get_screen_private(screen); + + for (i = 0; i < 3; i++) { + glamor_priv->gradient_prog[SHADER_GRADIENT_LINEAR][i] = 0; + glamor_priv->gradient_prog[SHADER_GRADIENT_RADIAL][i] = 0; + } + glamor_priv->linear_max_nstops = 0; + glamor_priv->radial_max_nstops = 0; + + _glamor_create_linear_gradient_program(screen, 0, 0); + _glamor_create_linear_gradient_program(screen, LINEAR_LARGE_STOPS, 0); + + _glamor_create_radial_gradient_program(screen, 0, 0); + _glamor_create_radial_gradient_program(screen, RADIAL_LARGE_STOPS, 0); +} + +void +glamor_fini_gradient_shader(ScreenPtr screen) +{ + glamor_screen_private *glamor_priv; + int i = 0; + + glamor_priv = glamor_get_screen_private(screen); + glamor_make_current(glamor_priv); + + for (i = 0; i < 3; i++) { + /* Linear Gradient */ + if (glamor_priv->gradient_prog[SHADER_GRADIENT_LINEAR][i]) + glDeleteProgram(glamor_priv->gradient_prog + [SHADER_GRADIENT_LINEAR][i]); + + if (glamor_priv->gradient_prog[SHADER_GRADIENT_RADIAL][i]) + glDeleteProgram(glamor_priv->gradient_prog + [SHADER_GRADIENT_RADIAL][i]); + } +} + +static void +_glamor_gradient_convert_trans_matrix(PictTransform *from, float to[3][3], + int width, int height, int normalize) +{ + /* + * Because in the shader program, we normalize all the pixel cood to [0, 1], + * so with the transform matrix, the correct logic should be: + * v_s = A*T*v + * v_s: point vector in shader after normalized. + * A: The transition matrix from width X height --> 1.0 X 1.0 + * T: The transform matrix. + * v: point vector in width X height space. + * + * result is OK if we use this fomula. But for every point in width X height space, + * we can just use their normalized point vector in shader, namely we can just + * use the result of A*v in shader. So we have no chance to insert T in A*v. + * We can just convert v_s = A*T*v to v_s = A*T*inv(A)*A*v, where inv(A) is the + * inverse matrix of A. Now, v_s = (A*T*inv(A)) * (A*v) + * So, to get the correct v_s, we need to cacula1 the matrix: (A*T*inv(A)), and + * we name this matrix T_s. + * + * Firstly, because A is for the scale convertion, we find + * -- -- + * |1/w 0 0 | + * A = | 0 1/h 0 | + * | 0 0 1.0| + * -- -- + * so T_s = A*T*inv(a) and result + * + * -- -- + * | t11 h*t12/w t13/w| + * T_s = | w*t21/h t22 t23/h| + * | w*t31 h*t32 t33 | + * -- -- + */ + + to[0][0] = (float) pixman_fixed_to_double(from->matrix[0][0]); + to[0][1] = (float) pixman_fixed_to_double(from->matrix[0][1]) + * (normalize ? (((float) height) / ((float) width)) : 1.0); + to[0][2] = (float) pixman_fixed_to_double(from->matrix[0][2]) + / (normalize ? ((float) width) : 1.0); + + to[1][0] = (float) pixman_fixed_to_double(from->matrix[1][0]) + * (normalize ? (((float) width) / ((float) height)) : 1.0); + to[1][1] = (float) pixman_fixed_to_double(from->matrix[1][1]); + to[1][2] = (float) pixman_fixed_to_double(from->matrix[1][2]) + / (normalize ? ((float) height) : 1.0); + + to[2][0] = (float) pixman_fixed_to_double(from->matrix[2][0]) + * (normalize ? ((float) width) : 1.0); + to[2][1] = (float) pixman_fixed_to_double(from->matrix[2][1]) + * (normalize ? ((float) height) : 1.0); + to[2][2] = (float) pixman_fixed_to_double(from->matrix[2][2]); + + DEBUGF("the transform matrix is:\n%f\t%f\t%f\n%f\t%f\t%f\n%f\t%f\t%f\n", + to[0][0], to[0][1], to[0][2], + to[1][0], to[1][1], to[1][2], to[2][0], to[2][1], to[2][2]); +} + +static int +_glamor_gradient_set_pixmap_destination(ScreenPtr screen, + glamor_screen_private *glamor_priv, + PicturePtr dst_picture, + GLfloat *xscale, GLfloat *yscale, + int x_source, int y_source, + float vertices[8], + float tex_vertices[8], + int tex_normalize) +{ + glamor_pixmap_private *pixmap_priv; + PixmapPtr pixmap = NULL; + + pixmap = glamor_get_drawable_pixmap(dst_picture->pDrawable); + pixmap_priv = glamor_get_pixmap_private(pixmap); + + if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv)) { /* should always have here. */ + return 0; + } + + glamor_set_destination_pixmap_priv_nc(pixmap_priv); + + pixmap_priv_get_dest_scale(pixmap_priv, xscale, yscale); + + DEBUGF("xscale = %f, yscale = %f," + " x_source = %d, y_source = %d, width = %d, height = %d\n", + *xscale, *yscale, x_source, y_source, + dst_picture->pDrawable->width, dst_picture->pDrawable->height); + + glamor_set_normalize_vcoords_tri_strip(*xscale, *yscale, + 0, 0, + (INT16) (dst_picture->pDrawable-> + width), + (INT16) (dst_picture->pDrawable-> + height), + glamor_priv->yInverted, vertices); + + if (tex_normalize) { + glamor_set_normalize_tcoords_tri_stripe(*xscale, *yscale, + x_source, y_source, + (INT16) (dst_picture-> + pDrawable->width + + x_source), + (INT16) (dst_picture-> + pDrawable->height + + y_source), + glamor_priv->yInverted, + tex_vertices); + } + else { + glamor_set_tcoords_tri_strip((INT16) (dst_picture->pDrawable->width), + (INT16) (dst_picture->pDrawable->height), + x_source, y_source, + (INT16) (dst_picture->pDrawable->width) + + x_source, + (INT16) (dst_picture->pDrawable->height) + + y_source, glamor_priv->yInverted, + tex_vertices); + } + + DEBUGF("vertices --> leftup : %f X %f, rightup: %f X %f," + "rightbottom: %f X %f, leftbottom : %f X %f\n", + vertices[0], vertices[1], vertices[2], vertices[3], + vertices[4], vertices[5], vertices[6], vertices[7]); + DEBUGF("tex_vertices --> leftup : %f X %f, rightup: %f X %f," + "rightbottom: %f X %f, leftbottom : %f X %f\n", + tex_vertices[0], tex_vertices[1], tex_vertices[2], tex_vertices[3], + tex_vertices[4], tex_vertices[5], tex_vertices[6], tex_vertices[7]); + + glamor_make_current(glamor_priv); + + glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT, + GL_FALSE, 0, vertices); + glVertexAttribPointer(GLAMOR_VERTEX_SOURCE, 2, GL_FLOAT, + GL_FALSE, 0, tex_vertices); + + glEnableVertexAttribArray(GLAMOR_VERTEX_POS); + glEnableVertexAttribArray(GLAMOR_VERTEX_SOURCE); + + return 1; +} + +static int +_glamor_gradient_set_stops(PicturePtr src_picture, PictGradient *pgradient, + GLfloat *stop_colors, GLfloat *n_stops) +{ + int i; + int count = 1; + + for (i = 0; i < pgradient->nstops; i++) { + stop_colors[count * 4] = + pixman_fixed_to_double(pgradient->stops[i].color.red); + stop_colors[count * 4 + 1] = + pixman_fixed_to_double(pgradient->stops[i].color.green); + stop_colors[count * 4 + 2] = + pixman_fixed_to_double(pgradient->stops[i].color.blue); + stop_colors[count * 4 + 3] = + pixman_fixed_to_double(pgradient->stops[i].color.alpha); + + n_stops[count] = + (GLfloat) pixman_fixed_to_double(pgradient->stops[i].x); + count++; + } + + /* for the end stop. */ + count++; + + switch (src_picture->repeatType) { +#define REPEAT_FILL_STOPS(m, n) \ + stop_colors[(m)*4 + 0] = stop_colors[(n)*4 + 0]; \ + stop_colors[(m)*4 + 1] = stop_colors[(n)*4 + 1]; \ + stop_colors[(m)*4 + 2] = stop_colors[(n)*4 + 2]; \ + stop_colors[(m)*4 + 3] = stop_colors[(n)*4 + 3]; + + default: + case PIXMAN_REPEAT_NONE: + stop_colors[0] = 0.0; //R + stop_colors[1] = 0.0; //G + stop_colors[2] = 0.0; //B + stop_colors[3] = 0.0; //Alpha + n_stops[0] = -(float) INT_MAX; //should be small enough. + + stop_colors[0 + (count - 1) * 4] = 0.0; //R + stop_colors[1 + (count - 1) * 4] = 0.0; //G + stop_colors[2 + (count - 1) * 4] = 0.0; //B + stop_colors[3 + (count - 1) * 4] = 0.0; //Alpha + n_stops[count - 1] = (float) INT_MAX; //should be large enough. + break; + case PIXMAN_REPEAT_NORMAL: + REPEAT_FILL_STOPS(0, count - 2); + n_stops[0] = n_stops[count - 2] - 1.0; + + REPEAT_FILL_STOPS(count - 1, 1); + n_stops[count - 1] = n_stops[1] + 1.0; + break; + case PIXMAN_REPEAT_REFLECT: + REPEAT_FILL_STOPS(0, 1); + n_stops[0] = -n_stops[1]; + + REPEAT_FILL_STOPS(count - 1, count - 2); + n_stops[count - 1] = 1.0 + 1.0 - n_stops[count - 2]; + break; + case PIXMAN_REPEAT_PAD: + REPEAT_FILL_STOPS(0, 1); + n_stops[0] = -(float) INT_MAX; + + REPEAT_FILL_STOPS(count - 1, count - 2); + n_stops[count - 1] = (float) INT_MAX; + break; +#undef REPEAT_FILL_STOPS + } + + for (i = 0; i < count; i++) { + DEBUGF("n_stops[%d] = %f, color = r:%f g:%f b:%f a:%f\n", + i, n_stops[i], + stop_colors[i * 4], stop_colors[i * 4 + 1], + stop_colors[i * 4 + 2], stop_colors[i * 4 + 3]); + } + + return count; +} + +PicturePtr +glamor_generate_radial_gradient_picture(ScreenPtr screen, + PicturePtr src_picture, + int x_source, int y_source, + int width, int height, + PictFormatShort format) +{ + glamor_screen_private *glamor_priv; + PicturePtr dst_picture = NULL; + PixmapPtr pixmap = NULL; + GLint gradient_prog = 0; + int error; + float tex_vertices[8]; + int stops_count = 0; + int count = 0; + GLfloat *stop_colors = NULL; + GLfloat *n_stops = NULL; + GLfloat xscale, yscale; + float vertices[8]; + float transform_mat[3][3]; + static const float identity_mat[3][3] = { {1.0, 0.0, 0.0}, + {0.0, 1.0, 0.0}, + {0.0, 0.0, 1.0} + }; + GLfloat stop_colors_st[RADIAL_SMALL_STOPS * 4]; + GLfloat n_stops_st[RADIAL_SMALL_STOPS]; + GLfloat A_value; + GLfloat cxy[4]; + float c1x, c1y, c2x, c2y, r1, r2; + + GLint transform_mat_uniform_location = 0; + GLint repeat_type_uniform_location = 0; + GLint n_stop_uniform_location = 0; + GLint stops_uniform_location = 0; + GLint stop_colors_uniform_location = 0; + GLint stop0_uniform_location = 0; + GLint stop1_uniform_location = 0; + GLint stop2_uniform_location = 0; + GLint stop3_uniform_location = 0; + GLint stop4_uniform_location = 0; + GLint stop5_uniform_location = 0; + GLint stop6_uniform_location = 0; + GLint stop7_uniform_location = 0; + GLint stop_color0_uniform_location = 0; + GLint stop_color1_uniform_location = 0; + GLint stop_color2_uniform_location = 0; + GLint stop_color3_uniform_location = 0; + GLint stop_color4_uniform_location = 0; + GLint stop_color5_uniform_location = 0; + GLint stop_color6_uniform_location = 0; + GLint stop_color7_uniform_location = 0; + GLint A_value_uniform_location = 0; + GLint c1_uniform_location = 0; + GLint r1_uniform_location = 0; + GLint c2_uniform_location = 0; + GLint r2_uniform_location = 0; + + glamor_priv = glamor_get_screen_private(screen); + glamor_make_current(glamor_priv); + + /* Create a pixmap with VBO. */ + pixmap = glamor_create_pixmap(screen, + width, height, + PIXMAN_FORMAT_DEPTH(format), 0); + if (!pixmap) + goto GRADIENT_FAIL; + + dst_picture = CreatePicture(0, &pixmap->drawable, + PictureMatchFormat(screen, + PIXMAN_FORMAT_DEPTH(format), + format), 0, 0, serverClient, + &error); + + /* Release the reference, picture will hold the last one. */ + glamor_destroy_pixmap(pixmap); + + if (!dst_picture) + goto GRADIENT_FAIL; + + ValidatePicture(dst_picture); + + stops_count = src_picture->pSourcePict->radial.nstops + 2; + + /* Because the max value of nstops is unkown, so create a program + when nstops > LINEAR_LARGE_STOPS. */ + if (stops_count <= RADIAL_SMALL_STOPS) { + gradient_prog = glamor_priv->gradient_prog[SHADER_GRADIENT_RADIAL][0]; + } + else if (stops_count <= RADIAL_LARGE_STOPS) { + gradient_prog = glamor_priv->gradient_prog[SHADER_GRADIENT_RADIAL][1]; + } + else { + _glamor_create_radial_gradient_program(screen, + src_picture->pSourcePict->linear. + nstops + 2, 1); + gradient_prog = glamor_priv->gradient_prog[SHADER_GRADIENT_RADIAL][2]; + } + + /* Bind all the uniform vars . */ + transform_mat_uniform_location = glGetUniformLocation(gradient_prog, + "transform_mat"); + repeat_type_uniform_location = glGetUniformLocation(gradient_prog, + "repeat_type"); + n_stop_uniform_location = glGetUniformLocation(gradient_prog, "n_stop"); + A_value_uniform_location = glGetUniformLocation(gradient_prog, "A_value"); + c1_uniform_location = glGetUniformLocation(gradient_prog, "c1"); + r1_uniform_location = glGetUniformLocation(gradient_prog, "r1"); + c2_uniform_location = glGetUniformLocation(gradient_prog, "c2"); + r2_uniform_location = glGetUniformLocation(gradient_prog, "r2"); + + if (src_picture->pSourcePict->radial.nstops + 2 <= RADIAL_SMALL_STOPS) { + stop0_uniform_location = + glGetUniformLocation(gradient_prog, "stop0"); + stop1_uniform_location = + glGetUniformLocation(gradient_prog, "stop1"); + stop2_uniform_location = + glGetUniformLocation(gradient_prog, "stop2"); + stop3_uniform_location = + glGetUniformLocation(gradient_prog, "stop3"); + stop4_uniform_location = + glGetUniformLocation(gradient_prog, "stop4"); + stop5_uniform_location = + glGetUniformLocation(gradient_prog, "stop5"); + stop6_uniform_location = + glGetUniformLocation(gradient_prog, "stop6"); + stop7_uniform_location = + glGetUniformLocation(gradient_prog, "stop7"); + + stop_color0_uniform_location = + glGetUniformLocation(gradient_prog, "stop_color0"); + stop_color1_uniform_location = + glGetUniformLocation(gradient_prog, "stop_color1"); + stop_color2_uniform_location = + glGetUniformLocation(gradient_prog, "stop_color2"); + stop_color3_uniform_location = + glGetUniformLocation(gradient_prog, "stop_color3"); + stop_color4_uniform_location = + glGetUniformLocation(gradient_prog, "stop_color4"); + stop_color5_uniform_location = + glGetUniformLocation(gradient_prog, "stop_color5"); + stop_color6_uniform_location = + glGetUniformLocation(gradient_prog, "stop_color6"); + stop_color7_uniform_location = + glGetUniformLocation(gradient_prog, "stop_color7"); + } + else { + stops_uniform_location = + glGetUniformLocation(gradient_prog, "stops"); + stop_colors_uniform_location = + glGetUniformLocation(gradient_prog, "stop_colors"); + } + + glUseProgram(gradient_prog); + + glUniform1i(repeat_type_uniform_location, src_picture->repeatType); + + if (src_picture->transform) { + _glamor_gradient_convert_trans_matrix(src_picture->transform, + transform_mat, width, height, 0); + glUniformMatrix3fv(transform_mat_uniform_location, + 1, 1, &transform_mat[0][0]); + } + else { + glUniformMatrix3fv(transform_mat_uniform_location, + 1, 1, &identity_mat[0][0]); + } + + if (!_glamor_gradient_set_pixmap_destination + (screen, glamor_priv, dst_picture, &xscale, &yscale, x_source, y_source, + vertices, tex_vertices, 0)) + goto GRADIENT_FAIL; + + /* Set all the stops and colors to shader. */ + if (stops_count > RADIAL_SMALL_STOPS) { + stop_colors = malloc(4 * stops_count * sizeof(float)); + if (stop_colors == NULL) { + ErrorF("Failed to allocate stop_colors memory.\n"); + goto GRADIENT_FAIL; + } + + n_stops = malloc(stops_count * sizeof(float)); + if (n_stops == NULL) { + ErrorF("Failed to allocate n_stops memory.\n"); + goto GRADIENT_FAIL; + } + } + else { + stop_colors = stop_colors_st; + n_stops = n_stops_st; + } + + count = + _glamor_gradient_set_stops(src_picture, + &src_picture->pSourcePict->gradient, + stop_colors, n_stops); + + if (src_picture->pSourcePict->linear.nstops + 2 <= RADIAL_SMALL_STOPS) { + int j = 0; + + glUniform4f(stop_color0_uniform_location, + stop_colors[4 * j + 0], stop_colors[4 * j + 1], + stop_colors[4 * j + 2], stop_colors[4 * j + 3]); + j++; + glUniform4f(stop_color1_uniform_location, + stop_colors[4 * j + 0], stop_colors[4 * j + 1], + stop_colors[4 * j + 2], stop_colors[4 * j + 3]); + j++; + glUniform4f(stop_color2_uniform_location, + stop_colors[4 * j + 0], stop_colors[4 * j + 1], + stop_colors[4 * j + 2], stop_colors[4 * j + 3]); + j++; + glUniform4f(stop_color3_uniform_location, + stop_colors[4 * j + 0], stop_colors[4 * j + 1], + stop_colors[4 * j + 2], stop_colors[4 * j + 3]); + j++; + glUniform4f(stop_color4_uniform_location, + stop_colors[4 * j + 0], stop_colors[4 * j + 1], + stop_colors[4 * j + 2], stop_colors[4 * j + 3]); + j++; + glUniform4f(stop_color5_uniform_location, + stop_colors[4 * j + 0], stop_colors[4 * j + 1], + stop_colors[4 * j + 2], stop_colors[4 * j + 3]); + j++; + glUniform4f(stop_color6_uniform_location, + stop_colors[4 * j + 0], stop_colors[4 * j + 1], + stop_colors[4 * j + 2], stop_colors[4 * j + 3]); + j++; + glUniform4f(stop_color7_uniform_location, + stop_colors[4 * j + 0], stop_colors[4 * j + 1], + stop_colors[4 * j + 2], stop_colors[4 * j + 3]); + + j = 0; + glUniform1f(stop0_uniform_location, n_stops[j++]); + glUniform1f(stop1_uniform_location, n_stops[j++]); + glUniform1f(stop2_uniform_location, n_stops[j++]); + glUniform1f(stop3_uniform_location, n_stops[j++]); + glUniform1f(stop4_uniform_location, n_stops[j++]); + glUniform1f(stop5_uniform_location, n_stops[j++]); + glUniform1f(stop6_uniform_location, n_stops[j++]); + glUniform1f(stop7_uniform_location, n_stops[j++]); + glUniform1i(n_stop_uniform_location, count); + } + else { + glUniform4fv(stop_colors_uniform_location, count, stop_colors); + glUniform1fv(stops_uniform_location, count, n_stops); + glUniform1i(n_stop_uniform_location, count); + } + + c1x = (float) pixman_fixed_to_double(src_picture->pSourcePict->radial.c1.x); + c1y = (float) pixman_fixed_to_double(src_picture->pSourcePict->radial.c1.y); + c2x = (float) pixman_fixed_to_double(src_picture->pSourcePict->radial.c2.x); + c2y = (float) pixman_fixed_to_double(src_picture->pSourcePict->radial.c2.y); + + r1 = (float) pixman_fixed_to_double(src_picture->pSourcePict->radial.c1. + radius); + r2 = (float) pixman_fixed_to_double(src_picture->pSourcePict->radial.c2. + radius); + + glamor_set_circle_centre(width, height, c1x, c1y, glamor_priv->yInverted, + cxy); + glUniform2fv(c1_uniform_location, 1, cxy); + glUniform1f(r1_uniform_location, r1); + + glamor_set_circle_centre(width, height, c2x, c2y, glamor_priv->yInverted, + cxy); + glUniform2fv(c2_uniform_location, 1, cxy); + glUniform1f(r2_uniform_location, r2); + + A_value = + (c2x - c1x) * (c2x - c1x) + (c2y - c1y) * (c2y - c1y) - (r2 - + r1) * (r2 - + r1); + glUniform1f(A_value_uniform_location, A_value); + + DEBUGF("C1:(%f, %f) R1:%f\nC2:(%f, %f) R2:%f\nA = %f\n", + c1x, c1y, r1, c2x, c2y, r2, A_value); + + /* Now rendering. */ + glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); + + /* Do the clear logic. */ + if (stops_count > RADIAL_SMALL_STOPS) { + free(n_stops); + free(stop_colors); + } + + glDisableVertexAttribArray(GLAMOR_VERTEX_POS); + glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE); + + return dst_picture; + + GRADIENT_FAIL: + if (dst_picture) { + FreePicture(dst_picture, 0); + } + + if (stops_count > RADIAL_SMALL_STOPS) { + if (n_stops) + free(n_stops); + if (stop_colors) + free(stop_colors); + } + + glDisableVertexAttribArray(GLAMOR_VERTEX_POS); + glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE); + return NULL; +} + +PicturePtr +glamor_generate_linear_gradient_picture(ScreenPtr screen, + PicturePtr src_picture, + int x_source, int y_source, + int width, int height, + PictFormatShort format) +{ + glamor_screen_private *glamor_priv; + PicturePtr dst_picture = NULL; + PixmapPtr pixmap = NULL; + GLint gradient_prog = 0; + int error; + float pt_distance; + float p1_distance; + GLfloat cos_val; + float tex_vertices[8]; + int stops_count = 0; + GLfloat *stop_colors = NULL; + GLfloat *n_stops = NULL; + int count = 0; + float slope; + GLfloat xscale, yscale; + GLfloat pt1[2], pt2[2]; + float vertices[8]; + float transform_mat[3][3]; + static const float identity_mat[3][3] = { {1.0, 0.0, 0.0}, + {0.0, 1.0, 0.0}, + {0.0, 0.0, 1.0} + }; + GLfloat stop_colors_st[LINEAR_SMALL_STOPS * 4]; + GLfloat n_stops_st[LINEAR_SMALL_STOPS]; + + GLint transform_mat_uniform_location = 0; + GLint n_stop_uniform_location = 0; + GLint stops_uniform_location = 0; + GLint stop0_uniform_location = 0; + GLint stop1_uniform_location = 0; + GLint stop2_uniform_location = 0; + GLint stop3_uniform_location = 0; + GLint stop4_uniform_location = 0; + GLint stop5_uniform_location = 0; + GLint stop6_uniform_location = 0; + GLint stop7_uniform_location = 0; + GLint stop_colors_uniform_location = 0; + GLint stop_color0_uniform_location = 0; + GLint stop_color1_uniform_location = 0; + GLint stop_color2_uniform_location = 0; + GLint stop_color3_uniform_location = 0; + GLint stop_color4_uniform_location = 0; + GLint stop_color5_uniform_location = 0; + GLint stop_color6_uniform_location = 0; + GLint stop_color7_uniform_location = 0; + GLint pt_slope_uniform_location = 0; + GLint repeat_type_uniform_location = 0; + GLint hor_ver_uniform_location = 0; + GLint cos_val_uniform_location = 0; + GLint p1_distance_uniform_location = 0; + GLint pt_distance_uniform_location = 0; + + glamor_priv = glamor_get_screen_private(screen); + glamor_make_current(glamor_priv); + + /* Create a pixmap with VBO. */ + pixmap = glamor_create_pixmap(screen, + width, height, + PIXMAN_FORMAT_DEPTH(format), 0); + + if (!pixmap) + goto GRADIENT_FAIL; + + dst_picture = CreatePicture(0, &pixmap->drawable, + PictureMatchFormat(screen, + PIXMAN_FORMAT_DEPTH(format), + format), 0, 0, serverClient, + &error); + + /* Release the reference, picture will hold the last one. */ + glamor_destroy_pixmap(pixmap); + + if (!dst_picture) + goto GRADIENT_FAIL; + + ValidatePicture(dst_picture); + + stops_count = src_picture->pSourcePict->linear.nstops + 2; + + /* Because the max value of nstops is unkown, so create a program + when nstops > LINEAR_LARGE_STOPS. */ + if (stops_count <= LINEAR_SMALL_STOPS) { + gradient_prog = glamor_priv->gradient_prog[SHADER_GRADIENT_LINEAR][0]; + } + else if (stops_count <= LINEAR_LARGE_STOPS) { + gradient_prog = glamor_priv->gradient_prog[SHADER_GRADIENT_LINEAR][1]; + } + else { + _glamor_create_linear_gradient_program(screen, + src_picture->pSourcePict->linear. + nstops + 2, 1); + gradient_prog = glamor_priv->gradient_prog[SHADER_GRADIENT_LINEAR][2]; + } + + /* Bind all the uniform vars . */ + n_stop_uniform_location = + glGetUniformLocation(gradient_prog, "n_stop"); + pt_slope_uniform_location = + glGetUniformLocation(gradient_prog, "pt_slope"); + repeat_type_uniform_location = + glGetUniformLocation(gradient_prog, "repeat_type"); + hor_ver_uniform_location = + glGetUniformLocation(gradient_prog, "hor_ver"); + transform_mat_uniform_location = + glGetUniformLocation(gradient_prog, "transform_mat"); + cos_val_uniform_location = + glGetUniformLocation(gradient_prog, "cos_val"); + p1_distance_uniform_location = + glGetUniformLocation(gradient_prog, "p1_distance"); + pt_distance_uniform_location = + glGetUniformLocation(gradient_prog, "pt_distance"); + + if (src_picture->pSourcePict->linear.nstops + 2 <= LINEAR_SMALL_STOPS) { + stop0_uniform_location = + glGetUniformLocation(gradient_prog, "stop0"); + stop1_uniform_location = + glGetUniformLocation(gradient_prog, "stop1"); + stop2_uniform_location = + glGetUniformLocation(gradient_prog, "stop2"); + stop3_uniform_location = + glGetUniformLocation(gradient_prog, "stop3"); + stop4_uniform_location = + glGetUniformLocation(gradient_prog, "stop4"); + stop5_uniform_location = + glGetUniformLocation(gradient_prog, "stop5"); + stop6_uniform_location = + glGetUniformLocation(gradient_prog, "stop6"); + stop7_uniform_location = + glGetUniformLocation(gradient_prog, "stop7"); + + stop_color0_uniform_location = + glGetUniformLocation(gradient_prog, "stop_color0"); + stop_color1_uniform_location = + glGetUniformLocation(gradient_prog, "stop_color1"); + stop_color2_uniform_location = + glGetUniformLocation(gradient_prog, "stop_color2"); + stop_color3_uniform_location = + glGetUniformLocation(gradient_prog, "stop_color3"); + stop_color4_uniform_location = + glGetUniformLocation(gradient_prog, "stop_color4"); + stop_color5_uniform_location = + glGetUniformLocation(gradient_prog, "stop_color5"); + stop_color6_uniform_location = + glGetUniformLocation(gradient_prog, "stop_color6"); + stop_color7_uniform_location = + glGetUniformLocation(gradient_prog, "stop_color7"); + } + else { + stops_uniform_location = + glGetUniformLocation(gradient_prog, "stops"); + stop_colors_uniform_location = + glGetUniformLocation(gradient_prog, "stop_colors"); + } + + glUseProgram(gradient_prog); + + glUniform1i(repeat_type_uniform_location, src_picture->repeatType); + + /* set the transform matrix. */ + if (src_picture->transform) { + _glamor_gradient_convert_trans_matrix(src_picture->transform, + transform_mat, width, height, 1); + glUniformMatrix3fv(transform_mat_uniform_location, + 1, 1, &transform_mat[0][0]); + } + else { + glUniformMatrix3fv(transform_mat_uniform_location, + 1, 1, &identity_mat[0][0]); + } + + if (!_glamor_gradient_set_pixmap_destination + (screen, glamor_priv, dst_picture, &xscale, &yscale, x_source, y_source, + vertices, tex_vertices, 1)) + goto GRADIENT_FAIL; + + /* Normalize the PTs. */ + glamor_set_normalize_pt(xscale, yscale, + pixman_fixed_to_double(src_picture->pSourcePict-> + linear.p1.x), + pixman_fixed_to_double(src_picture->pSourcePict-> + linear.p1.y), + glamor_priv->yInverted, pt1); + DEBUGF("pt1:(%f, %f) ---> (%f %f)\n", + pixman_fixed_to_double(src_picture->pSourcePict->linear.p1.x), + pixman_fixed_to_double(src_picture->pSourcePict->linear.p1.y), + pt1[0], pt1[1]); + + glamor_set_normalize_pt(xscale, yscale, + pixman_fixed_to_double(src_picture->pSourcePict-> + linear.p2.x), + pixman_fixed_to_double(src_picture->pSourcePict-> + linear.p2.y), + glamor_priv->yInverted, pt2); + DEBUGF("pt2:(%f, %f) ---> (%f %f)\n", + pixman_fixed_to_double(src_picture->pSourcePict->linear.p2.x), + pixman_fixed_to_double(src_picture->pSourcePict->linear.p2.y), + pt2[0], pt2[1]); + + /* Set all the stops and colors to shader. */ + if (stops_count > LINEAR_SMALL_STOPS) { + stop_colors = malloc(4 * stops_count * sizeof(float)); + if (stop_colors == NULL) { + ErrorF("Failed to allocate stop_colors memory.\n"); + goto GRADIENT_FAIL; + } + + n_stops = malloc(stops_count * sizeof(float)); + if (n_stops == NULL) { + ErrorF("Failed to allocate n_stops memory.\n"); + goto GRADIENT_FAIL; + } + } + else { + stop_colors = stop_colors_st; + n_stops = n_stops_st; + } + + count = + _glamor_gradient_set_stops(src_picture, + &src_picture->pSourcePict->gradient, + stop_colors, n_stops); + + if (src_picture->pSourcePict->linear.nstops + 2 <= LINEAR_SMALL_STOPS) { + int j = 0; + + glUniform4f(stop_color0_uniform_location, + stop_colors[4 * j + 0], stop_colors[4 * j + 1], + stop_colors[4 * j + 2], stop_colors[4 * j + 3]); + j++; + glUniform4f(stop_color1_uniform_location, + stop_colors[4 * j + 0], stop_colors[4 * j + 1], + stop_colors[4 * j + 2], stop_colors[4 * j + 3]); + j++; + glUniform4f(stop_color2_uniform_location, + stop_colors[4 * j + 0], stop_colors[4 * j + 1], + stop_colors[4 * j + 2], stop_colors[4 * j + 3]); + j++; + glUniform4f(stop_color3_uniform_location, + stop_colors[4 * j + 0], stop_colors[4 * j + 1], + stop_colors[4 * j + 2], stop_colors[4 * j + 3]); + j++; + glUniform4f(stop_color4_uniform_location, + stop_colors[4 * j + 0], stop_colors[4 * j + 1], + stop_colors[4 * j + 2], stop_colors[4 * j + 3]); + j++; + glUniform4f(stop_color5_uniform_location, + stop_colors[4 * j + 0], stop_colors[4 * j + 1], + stop_colors[4 * j + 2], stop_colors[4 * j + 3]); + j++; + glUniform4f(stop_color6_uniform_location, + stop_colors[4 * j + 0], stop_colors[4 * j + 1], + stop_colors[4 * j + 2], stop_colors[4 * j + 3]); + j++; + glUniform4f(stop_color7_uniform_location, + stop_colors[4 * j + 0], stop_colors[4 * j + 1], + stop_colors[4 * j + 2], stop_colors[4 * j + 3]); + + j = 0; + glUniform1f(stop0_uniform_location, n_stops[j++]); + glUniform1f(stop1_uniform_location, n_stops[j++]); + glUniform1f(stop2_uniform_location, n_stops[j++]); + glUniform1f(stop3_uniform_location, n_stops[j++]); + glUniform1f(stop4_uniform_location, n_stops[j++]); + glUniform1f(stop5_uniform_location, n_stops[j++]); + glUniform1f(stop6_uniform_location, n_stops[j++]); + glUniform1f(stop7_uniform_location, n_stops[j++]); + + glUniform1i(n_stop_uniform_location, count); + } + else { + glUniform4fv(stop_colors_uniform_location, count, stop_colors); + glUniform1fv(stops_uniform_location, count, n_stops); + glUniform1i(n_stop_uniform_location, count); + } + + if (src_picture->pSourcePict->linear.p2.y == src_picture->pSourcePict->linear.p1.y) { // The horizontal case. + glUniform1i(hor_ver_uniform_location, 1); + DEBUGF("p1.y: %f, p2.y: %f, enter the horizontal case\n", + pt1[1], pt2[1]); + + p1_distance = pt1[0]; + pt_distance = (pt2[0] - p1_distance); + glUniform1f(p1_distance_uniform_location, p1_distance); + glUniform1f(pt_distance_uniform_location, pt_distance); + } + else { + /* The slope need to compute here. In shader, the viewport set will change + the orginal slope and the slope which is vertical to it will not be correct. */ + slope = -(float) (src_picture->pSourcePict->linear.p2.x + - src_picture->pSourcePict->linear.p1.x) / + (float) (src_picture->pSourcePict->linear.p2.y + - src_picture->pSourcePict->linear.p1.y); + slope = slope * yscale / xscale; + glUniform1f(pt_slope_uniform_location, slope); + glUniform1i(hor_ver_uniform_location, 0); + + cos_val = sqrt(1.0 / (slope * slope + 1.0)); + glUniform1f(cos_val_uniform_location, cos_val); + + p1_distance = (pt1[1] - pt1[0] * slope) * cos_val; + pt_distance = (pt2[1] - pt2[0] * slope) * cos_val - p1_distance; + glUniform1f(p1_distance_uniform_location, p1_distance); + glUniform1f(pt_distance_uniform_location, pt_distance); + } + + /* Now rendering. */ + glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); + + /* Do the clear logic. */ + if (stops_count > LINEAR_SMALL_STOPS) { + free(n_stops); + free(stop_colors); + } + + glDisableVertexAttribArray(GLAMOR_VERTEX_POS); + glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE); + + return dst_picture; + + GRADIENT_FAIL: + if (dst_picture) { + FreePicture(dst_picture, 0); + } + + if (stops_count > LINEAR_SMALL_STOPS) { + if (n_stops) + free(n_stops); + if (stop_colors) + free(stop_colors); + } + + glDisableVertexAttribArray(GLAMOR_VERTEX_POS); + glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE); + return NULL; +} + +#endif /* End of GLAMOR_GRADIENT_SHADER */ + +#endif /* End of RENDER */ diff --git a/xserver/glamor/glamor_image.c b/xserver/glamor/glamor_image.c new file mode 100644 index 000000000..b38b41212 --- /dev/null +++ b/xserver/glamor/glamor_image.c @@ -0,0 +1,179 @@ +/* + * Copyright © 2014 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * that the name of the copyright holders not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no representations + * about the suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +#include "glamor_priv.h" +#include "glamor_transfer.h" +#include "glamor_transform.h" + +/* + * PutImage. Only does ZPixmap right now as other formats are quite a bit harder + */ + +static Bool +glamor_put_image_gl(DrawablePtr drawable, GCPtr gc, int depth, int x, int y, + int w, int h, int leftPad, int format, char *bits) +{ + ScreenPtr screen = drawable->pScreen; + glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); + PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable); + glamor_pixmap_private *pixmap_priv; + uint32_t byte_stride = PixmapBytePad(w, drawable->depth); + RegionRec region; + BoxRec box; + int off_x, off_y; + + pixmap_priv = glamor_get_pixmap_private(pixmap); + + if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv)) + return FALSE; + + if (gc->alu != GXcopy) + goto bail; + + if (!glamor_pm_is_solid(&pixmap->drawable, gc->planemask)) + goto bail; + + if (format == XYPixmap && drawable->depth == 1 && leftPad == 0) + format = ZPixmap; + + if (format != ZPixmap) + goto bail; + + x += drawable->x; + y += drawable->y; + box.x1 = x; + box.y1 = y; + box.x2 = box.x1 + w; + box.y2 = box.y1 + h; + RegionInit(®ion, &box, 1); + RegionIntersect(®ion, ®ion, gc->pCompositeClip); + + glamor_get_drawable_deltas(drawable, pixmap, &off_x, &off_y); + if (off_x || off_y) { + x += off_x; + y += off_y; + RegionTranslate(®ion, off_x, off_y); + } + + glamor_make_current(glamor_priv); + + glamor_upload_region(pixmap, ®ion, x, y, (uint8_t *) bits, byte_stride); + + RegionUninit(®ion); + return TRUE; +bail: + return FALSE; +} + +static void +glamor_put_image_bail(DrawablePtr drawable, GCPtr gc, int depth, int x, int y, + int w, int h, int leftPad, int format, char *bits) +{ + if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RW)) + fbPutImage(drawable, gc, depth, x, y, w, h, leftPad, format, bits); + glamor_finish_access(drawable); +} + +void +glamor_put_image(DrawablePtr drawable, GCPtr gc, int depth, int x, int y, + int w, int h, int leftPad, int format, char *bits) +{ + if (glamor_put_image_gl(drawable, gc, depth, x, y, w, h, leftPad, format, bits)) + return; + glamor_put_image_bail(drawable, gc, depth, x, y, w, h, leftPad, format, bits); +} + +Bool +glamor_put_image_nf(DrawablePtr drawable, GCPtr gc, int depth, int x, int y, + int w, int h, int leftPad, int format, char *bits) +{ + if (glamor_put_image_gl(drawable, gc, depth, x, y, w, h, leftPad, format, bits)) + return TRUE; + if (glamor_ddx_fallback_check_pixmap(drawable) && + glamor_ddx_fallback_check_gc(gc)) + return FALSE; + glamor_put_image_bail(drawable, gc, depth, x, y, w, h, leftPad, format, bits); + return TRUE; +} + +static Bool +glamor_get_image_gl(DrawablePtr drawable, int x, int y, int w, int h, + unsigned int format, unsigned long plane_mask, char *d) +{ + PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable); + glamor_pixmap_private *pixmap_priv; + uint32_t byte_stride = PixmapBytePad(w, drawable->depth); + BoxRec box; + int off_x, off_y; + + pixmap_priv = glamor_get_pixmap_private(pixmap); + if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv)) + goto bail; + + if (format != ZPixmap || !glamor_pm_is_solid(drawable, plane_mask)) + goto bail; + + glamor_get_drawable_deltas(drawable, pixmap, &off_x, &off_y); + box.x1 = x; + box.x2 = x + w; + box.y1 = y; + box.y2 = y + h; + glamor_download_boxes(pixmap, &box, 1, + drawable->x + off_x, drawable->y + off_y, + -x, -y, + (uint8_t *) d, byte_stride); + return TRUE; +bail: + return FALSE; +} + +static void +glamor_get_image_bail(DrawablePtr drawable, int x, int y, int w, int h, + unsigned int format, unsigned long plane_mask, char *d) +{ + if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RO)) + fbGetImage(drawable, x, y, w, h, format, plane_mask, d); + glamor_finish_access(drawable); +} + +void +glamor_get_image(DrawablePtr drawable, int x, int y, int w, int h, + unsigned int format, unsigned long plane_mask, char *d) +{ + if (glamor_get_image_gl(drawable, x, y, w, h, format, plane_mask, d)) + return; + glamor_get_image_bail(drawable, x, y, w, h, format, plane_mask, d); +} + +Bool +glamor_get_image_nf(DrawablePtr drawable, int x, int y, int w, int h, + unsigned int format, unsigned long plane_mask, char *d) +{ + if (glamor_get_image_gl(drawable, x, y, w, h, format, plane_mask, d)) + return TRUE; + + if (glamor_ddx_fallback_check_pixmap(drawable)) + return FALSE; + + glamor_get_image_bail(drawable, x, y, w, h, format, plane_mask, d); + return TRUE; +} diff --git a/xserver/glamor/glamor_largepixmap.c b/xserver/glamor/glamor_largepixmap.c new file mode 100644 index 000000000..b3a8d5d20 --- /dev/null +++ b/xserver/glamor/glamor_largepixmap.c @@ -0,0 +1,1417 @@ +#include <stdlib.h> + +#include "glamor_priv.h" + +/** + * Clip the boxes regards to each pixmap's block array. + * + * Should translate the region to relative coords to the pixmap, + * start at (0,0). + */ +#if 0 +//#define DEBUGF(str, ...) do {} while(0) +#define DEBUGF(str, ...) ErrorF(str, ##__VA_ARGS__) +//#define DEBUGRegionPrint(x) do {} while (0) +#define DEBUGRegionPrint RegionPrint +#endif + +static glamor_pixmap_clipped_regions * +__glamor_compute_clipped_regions(int block_w, + int block_h, + int block_stride, + int x, int y, + int w, int h, + RegionPtr region, + int *n_region, int reverse, int upsidedown) +{ + glamor_pixmap_clipped_regions *clipped_regions; + BoxPtr extent; + int start_x, start_y, end_x, end_y; + int start_block_x, start_block_y; + int end_block_x, end_block_y; + int loop_start_block_x, loop_start_block_y; + int loop_end_block_x, loop_end_block_y; + int loop_block_stride; + int i, j, delta_i, delta_j; + RegionRec temp_region; + RegionPtr current_region; + int block_idx; + int k = 0; + int temp_block_idx; + + extent = RegionExtents(region); + start_x = MAX(x, extent->x1); + start_y = MAX(y, extent->y1); + end_x = MIN(x + w, extent->x2); + end_y = MIN(y + h, extent->y2); + + DEBUGF("start compute clipped regions:\n"); + DEBUGF("block w %d h %d x %d y %d w %d h %d, block_stride %d \n", + block_w, block_h, x, y, w, h, block_stride); + DEBUGRegionPrint(region); + + DEBUGF("start_x %d start_y %d end_x %d end_y %d \n", start_x, start_y, + end_x, end_y); + + if (start_x >= end_x || start_y >= end_y) { + *n_region = 0; + return NULL; + } + + start_block_x = (start_x - x) / block_w; + start_block_y = (start_y - y) / block_h; + end_block_x = (end_x - x) / block_w; + end_block_y = (end_y - y) / block_h; + + clipped_regions = calloc((end_block_x - start_block_x + 1) + * (end_block_y - start_block_y + 1), + sizeof(*clipped_regions)); + + DEBUGF("startx %d starty %d endx %d endy %d \n", + start_x, start_y, end_x, end_y); + DEBUGF("start_block_x %d end_block_x %d \n", start_block_x, end_block_x); + DEBUGF("start_block_y %d end_block_y %d \n", start_block_y, end_block_y); + + if (!reverse) { + loop_start_block_x = start_block_x; + loop_end_block_x = end_block_x + 1; + delta_i = 1; + } + else { + loop_start_block_x = end_block_x; + loop_end_block_x = start_block_x - 1; + delta_i = -1; + } + + if (!upsidedown) { + loop_start_block_y = start_block_y; + loop_end_block_y = end_block_y + 1; + delta_j = 1; + } + else { + loop_start_block_y = end_block_y; + loop_end_block_y = start_block_y - 1; + delta_j = -1; + } + + loop_block_stride = delta_j * block_stride; + block_idx = (loop_start_block_y - delta_j) * block_stride; + + for (j = loop_start_block_y; j != loop_end_block_y; j += delta_j) { + block_idx += loop_block_stride; + temp_block_idx = block_idx + loop_start_block_x; + for (i = loop_start_block_x; + i != loop_end_block_x; i += delta_i, temp_block_idx += delta_i) { + BoxRec temp_box; + + temp_box.x1 = x + i * block_w; + temp_box.y1 = y + j * block_h; + temp_box.x2 = MIN(temp_box.x1 + block_w, end_x); + temp_box.y2 = MIN(temp_box.y1 + block_h, end_y); + RegionInitBoxes(&temp_region, &temp_box, 1); + DEBUGF("block idx %d \n", temp_block_idx); + DEBUGRegionPrint(&temp_region); + current_region = RegionCreate(NULL, 4); + RegionIntersect(current_region, &temp_region, region); + DEBUGF("i %d j %d region: \n", i, j); + DEBUGRegionPrint(current_region); + if (RegionNumRects(current_region)) { + clipped_regions[k].region = current_region; + clipped_regions[k].block_idx = temp_block_idx; + k++; + } + else + RegionDestroy(current_region); + RegionUninit(&temp_region); + } + } + + *n_region = k; + return clipped_regions; +} + +/** + * Do a two round clipping, + * first is to clip the region regard to current pixmap's + * block array. Then for each clipped region, do a inner + * block clipping. This is to make sure the final result + * will be shapped by inner_block_w and inner_block_h, and + * the final region also will not cross the pixmap's block + * boundary. + * + * This is mainly used by transformation support when do + * compositing. + */ + +glamor_pixmap_clipped_regions * +glamor_compute_clipped_regions_ext(glamor_pixmap_private *pixmap_priv, + RegionPtr region, + int *n_region, + int inner_block_w, int inner_block_h, + int reverse, int upsidedown) +{ + glamor_pixmap_clipped_regions *clipped_regions, *inner_regions, + *result_regions; + int i, j, x, y, k, inner_n_regions; + int width, height; + glamor_pixmap_private_large_t *priv; + + priv = &pixmap_priv->large; + + DEBUGF("ext called \n"); + + if (pixmap_priv->type != GLAMOR_TEXTURE_LARGE) { + clipped_regions = calloc(1, sizeof(*clipped_regions)); + if (clipped_regions == NULL) { + *n_region = 0; + return NULL; + } + clipped_regions[0].region = RegionCreate(NULL, 1); + clipped_regions[0].block_idx = 0; + RegionCopy(clipped_regions[0].region, region); + *n_region = 1; + priv->block_w = priv->base.pixmap->drawable.width; + priv->block_h = priv->base.pixmap->drawable.height; + priv->box_array = &priv->box; + priv->box.x1 = priv->box.y1 = 0; + priv->box.x2 = priv->block_w; + priv->box.y2 = priv->block_h; + } + else { + clipped_regions = __glamor_compute_clipped_regions(priv->block_w, + priv->block_h, + priv->block_wcnt, + 0, 0, + priv->base.pixmap-> + drawable.width, + priv->base.pixmap-> + drawable.height, + region, n_region, + reverse, upsidedown); + + if (clipped_regions == NULL) { + *n_region = 0; + return NULL; + } + } + if (inner_block_w >= priv->block_w && inner_block_h >= priv->block_h) + return clipped_regions; + result_regions = calloc(*n_region + * ((priv->block_w + inner_block_w - 1) / + inner_block_w) + * ((priv->block_h + inner_block_h - 1) / + inner_block_h), sizeof(*result_regions)); + k = 0; + for (i = 0; i < *n_region; i++) { + x = priv->box_array[clipped_regions[i].block_idx].x1; + y = priv->box_array[clipped_regions[i].block_idx].y1; + width = priv->box_array[clipped_regions[i].block_idx].x2 - x; + height = priv->box_array[clipped_regions[i].block_idx].y2 - y; + inner_regions = __glamor_compute_clipped_regions(inner_block_w, + inner_block_h, + 0, x, y, + width, + height, + clipped_regions[i]. + region, + &inner_n_regions, + reverse, upsidedown); + for (j = 0; j < inner_n_regions; j++) { + result_regions[k].region = inner_regions[j].region; + result_regions[k].block_idx = clipped_regions[i].block_idx; + k++; + } + free(inner_regions); + } + *n_region = k; + free(clipped_regions); + return result_regions; +} + +/* + * + * For the repeat pad mode, we can simply convert the region and + * let the out-of-box region can cover the needed edge of the source/mask + * Then apply a normal clip we can get what we want. + */ +static RegionPtr +_glamor_convert_pad_region(RegionPtr region, int w, int h) +{ + RegionPtr pad_region; + int nrect; + BoxPtr box; + int overlap; + + nrect = RegionNumRects(region); + box = RegionRects(region); + pad_region = RegionCreate(NULL, 4); + if (pad_region == NULL) + return NULL; + while (nrect--) { + BoxRec pad_box; + RegionRec temp_region; + + pad_box = *box; + if (pad_box.x1 < 0 && pad_box.x2 <= 0) + pad_box.x2 = 1; + else if (pad_box.x1 >= w && pad_box.x2 > w) + pad_box.x1 = w - 1; + if (pad_box.y1 < 0 && pad_box.y2 <= 0) + pad_box.y2 = 1; + else if (pad_box.y1 >= h && pad_box.y2 > h) + pad_box.y1 = h - 1; + RegionInitBoxes(&temp_region, &pad_box, 1); + RegionAppend(pad_region, &temp_region); + RegionUninit(&temp_region); + box++; + } + RegionValidate(pad_region, &overlap); + return pad_region; +} + +/* + * For one type of large pixmap, its one direction is not exceed the + * size limitation, and in another word, on one direction it has only + * one block. + * + * This case of reflect repeating, we can optimize it and avoid repeat + * clip on that direction. We can just enlarge the repeat box and can + * cover all the dest region on that direction. But latter, we need to + * fixup the clipped result to get a correct coords for the subsequent + * processing. This function is to do the coords correction. + * + * */ +static void +_glamor_largepixmap_reflect_fixup(short *xy1, short *xy2, int wh) +{ + int odd1, odd2; + int c1, c2; + + if (*xy2 - *xy1 > wh) { + *xy1 = 0; + *xy2 = wh; + return; + } + modulus(*xy1, wh, c1); + odd1 = ((*xy1 - c1) / wh) & 0x1; + modulus(*xy2, wh, c2); + odd2 = ((*xy2 - c2) / wh) & 0x1; + + if (odd1 && odd2) { + *xy1 = wh - c2; + *xy2 = wh - c1; + } + else if (odd1 && !odd2) { + *xy1 = 0; + *xy2 = MAX(c2, wh - c1); + } + else if (!odd1 && odd2) { + *xy2 = wh; + *xy1 = MIN(c1, wh - c2); + } + else { + *xy1 = c1; + *xy2 = c2; + } +} + +/** + * Clip the boxes regards to each pixmap's block array. + * + * Should translate the region to relative coords to the pixmap, + * start at (0,0). + * + * @is_transform: if it is set, it has a transform matrix. + * + */ +static glamor_pixmap_clipped_regions * +_glamor_compute_clipped_regions(glamor_pixmap_private *pixmap_priv, + RegionPtr region, int *n_region, + int repeat_type, int is_transform, + int reverse, int upsidedown) +{ + glamor_pixmap_clipped_regions *clipped_regions; + BoxPtr extent; + int i, j; + RegionPtr current_region; + int pixmap_width, pixmap_height; + int m; + BoxRec repeat_box; + RegionRec repeat_region; + int right_shift = 0; + int down_shift = 0; + int x_center_shift = 0, y_center_shift = 0; + glamor_pixmap_private_large_t *priv; + + priv = &pixmap_priv->large; + + DEBUGRegionPrint(region); + if (pixmap_priv->type != GLAMOR_TEXTURE_LARGE) { + clipped_regions = calloc(1, sizeof(*clipped_regions)); + clipped_regions[0].region = RegionCreate(NULL, 1); + clipped_regions[0].block_idx = 0; + RegionCopy(clipped_regions[0].region, region); + *n_region = 1; + return clipped_regions; + } + + pixmap_width = priv->base.pixmap->drawable.width; + pixmap_height = priv->base.pixmap->drawable.height; + if (repeat_type == 0 || repeat_type == RepeatPad) { + RegionPtr saved_region = NULL; + + if (repeat_type == RepeatPad) { + saved_region = region; + region = + _glamor_convert_pad_region(saved_region, pixmap_width, + pixmap_height); + if (region == NULL) { + *n_region = 0; + return NULL; + } + } + clipped_regions = __glamor_compute_clipped_regions(priv->block_w, + priv->block_h, + priv->block_wcnt, + 0, 0, + priv->base.pixmap-> + drawable.width, + priv->base.pixmap-> + drawable.height, + region, n_region, + reverse, upsidedown); + if (saved_region) + RegionDestroy(region); + return clipped_regions; + } + extent = RegionExtents(region); + + x_center_shift = extent->x1 / pixmap_width; + if (x_center_shift < 0) + x_center_shift--; + if (abs(x_center_shift) & 1) + x_center_shift++; + y_center_shift = extent->y1 / pixmap_height; + if (y_center_shift < 0) + y_center_shift--; + if (abs(y_center_shift) & 1) + y_center_shift++; + + if (extent->x1 < 0) + right_shift = ((-extent->x1 + pixmap_width - 1) / pixmap_width); + if (extent->y1 < 0) + down_shift = ((-extent->y1 + pixmap_height - 1) / pixmap_height); + + if (right_shift != 0 || down_shift != 0) { + if (repeat_type == RepeatReflect) { + right_shift = (right_shift + 1) & ~1; + down_shift = (down_shift + 1) & ~1; + } + RegionTranslate(region, right_shift * pixmap_width, + down_shift * pixmap_height); + } + + extent = RegionExtents(region); + /* Tile a large pixmap to another large pixmap. + * We can't use the target large pixmap as the + * loop variable, instead we need to loop for all + * the blocks in the tile pixmap. + * + * simulate repeat each single block to cover the + * target's blocks. Two special case: + * a block_wcnt == 1 or block_hcnt ==1, then we + * only need to loop one direction as the other + * direction is fully included in the first block. + * + * For the other cases, just need to start + * from a proper shiftx/shifty, and then increase + * y by tile_height each time to walk trhough the + * target block and then walk trhough the target + * at x direction by increate tile_width each time. + * + * This way, we can consolidate all the sub blocks + * of the target boxes into one tile source's block. + * + * */ + m = 0; + clipped_regions = calloc(priv->block_wcnt * priv->block_hcnt, + sizeof(*clipped_regions)); + if (clipped_regions == NULL) { + *n_region = 0; + return NULL; + } + if (right_shift != 0 || down_shift != 0) { + DEBUGF("region to be repeated shifted \n"); + DEBUGRegionPrint(region); + } + DEBUGF("repeat pixmap width %d height %d \n", pixmap_width, pixmap_height); + DEBUGF("extent x1 %d y1 %d x2 %d y2 %d \n", extent->x1, extent->y1, + extent->x2, extent->y2); + for (j = 0; j < priv->block_hcnt; j++) { + for (i = 0; i < priv->block_wcnt; i++) { + int dx = pixmap_width; + int dy = pixmap_height; + int idx; + int shift_x; + int shift_y; + int saved_y1, saved_y2; + int x_idx = 0, y_idx = 0, saved_y_idx = 0; + RegionRec temp_region; + BoxRec reflect_repeat_box; + BoxPtr valid_repeat_box; + + shift_x = (extent->x1 / pixmap_width) * pixmap_width; + shift_y = (extent->y1 / pixmap_height) * pixmap_height; + idx = j * priv->block_wcnt + i; + if (repeat_type == RepeatReflect) { + x_idx = (extent->x1 / pixmap_width); + y_idx = (extent->y1 / pixmap_height); + } + + /* Construct a rect to clip the target region. */ + repeat_box.x1 = shift_x + priv->box_array[idx].x1; + repeat_box.y1 = shift_y + priv->box_array[idx].y1; + if (priv->block_wcnt == 1) { + repeat_box.x2 = extent->x2; + dx = extent->x2 - repeat_box.x1; + } + else + repeat_box.x2 = shift_x + priv->box_array[idx].x2; + if (priv->block_hcnt == 1) { + repeat_box.y2 = extent->y2; + dy = extent->y2 - repeat_box.y1; + } + else + repeat_box.y2 = shift_y + priv->box_array[idx].y2; + + current_region = RegionCreate(NULL, 4); + RegionInit(&temp_region, NULL, 4); + DEBUGF("init repeat box %d %d %d %d \n", + repeat_box.x1, repeat_box.y1, repeat_box.x2, repeat_box.y2); + + if (repeat_type == RepeatNormal) { + saved_y1 = repeat_box.y1; + saved_y2 = repeat_box.y2; + for (; repeat_box.x1 < extent->x2; + repeat_box.x1 += dx, repeat_box.x2 += dx) { + repeat_box.y1 = saved_y1; + repeat_box.y2 = saved_y2; + for (repeat_box.y1 = saved_y1, repeat_box.y2 = saved_y2; + repeat_box.y1 < extent->y2; + repeat_box.y1 += dy, repeat_box.y2 += dy) { + + RegionInitBoxes(&repeat_region, &repeat_box, 1); + DEBUGF("Start to clip repeat region: \n"); + DEBUGRegionPrint(&repeat_region); + RegionIntersect(&temp_region, &repeat_region, region); + DEBUGF("clip result:\n"); + DEBUGRegionPrint(&temp_region); + RegionAppend(current_region, &temp_region); + RegionUninit(&repeat_region); + } + } + } + else if (repeat_type == RepeatReflect) { + saved_y1 = repeat_box.y1; + saved_y2 = repeat_box.y2; + saved_y_idx = y_idx; + for (;; repeat_box.x1 += dx, repeat_box.x2 += dx) { + repeat_box.y1 = saved_y1; + repeat_box.y2 = saved_y2; + y_idx = saved_y_idx; + reflect_repeat_box.x1 = (x_idx & 1) ? + ((2 * x_idx + 1) * dx - repeat_box.x2) : repeat_box.x1; + reflect_repeat_box.x2 = (x_idx & 1) ? + ((2 * x_idx + 1) * dx - repeat_box.x1) : repeat_box.x2; + valid_repeat_box = &reflect_repeat_box; + + if (valid_repeat_box->x1 >= extent->x2) + break; + for (repeat_box.y1 = saved_y1, repeat_box.y2 = saved_y2;; + repeat_box.y1 += dy, repeat_box.y2 += dy) { + + DEBUGF("x_idx %d y_idx %d dx %d dy %d\n", x_idx, y_idx, + dx, dy); + DEBUGF("repeat box %d %d %d %d \n", repeat_box.x1, + repeat_box.y1, repeat_box.x2, repeat_box.y2); + + if (priv->block_hcnt > 1) { + reflect_repeat_box.y1 = (y_idx & 1) ? + ((2 * y_idx + 1) * dy - + repeat_box.y2) : repeat_box.y1; + reflect_repeat_box.y2 = + (y_idx & 1) ? ((2 * y_idx + 1) * dy - + repeat_box.y1) : repeat_box.y2; + } + else { + reflect_repeat_box.y1 = repeat_box.y1; + reflect_repeat_box.y2 = repeat_box.y2; + } + + DEBUGF("valid_repeat_box x1 %d y1 %d \n", + valid_repeat_box->x1, valid_repeat_box->y1); + if (valid_repeat_box->y1 >= extent->y2) + break; + RegionInitBoxes(&repeat_region, valid_repeat_box, 1); + DEBUGF("start to clip repeat[reflect] region: \n"); + DEBUGRegionPrint(&repeat_region); + RegionIntersect(&temp_region, &repeat_region, region); + DEBUGF("result:\n"); + DEBUGRegionPrint(&temp_region); + if (is_transform && RegionNumRects(&temp_region)) { + BoxRec temp_box; + BoxPtr temp_extent; + + temp_extent = RegionExtents(&temp_region); + if (priv->block_wcnt > 1) { + if (x_idx & 1) { + temp_box.x1 = + ((2 * x_idx + 1) * dx - + temp_extent->x2); + temp_box.x2 = + ((2 * x_idx + 1) * dx - + temp_extent->x1); + } + else { + temp_box.x1 = temp_extent->x1; + temp_box.x2 = temp_extent->x2; + } + modulus(temp_box.x1, pixmap_width, temp_box.x1); + modulus(temp_box.x2, pixmap_width, temp_box.x2); + if (temp_box.x2 == 0) + temp_box.x2 = pixmap_width; + } + else { + temp_box.x1 = temp_extent->x1; + temp_box.x2 = temp_extent->x2; + _glamor_largepixmap_reflect_fixup(&temp_box.x1, + &temp_box.x2, + pixmap_width); + } + + if (priv->block_hcnt > 1) { + if (y_idx & 1) { + temp_box.y1 = + ((2 * y_idx + 1) * dy - + temp_extent->y2); + temp_box.y2 = + ((2 * y_idx + 1) * dy - + temp_extent->y1); + } + else { + temp_box.y1 = temp_extent->y1; + temp_box.y2 = temp_extent->y2; + } + + modulus(temp_box.y1, pixmap_height, + temp_box.y1); + modulus(temp_box.y2, pixmap_height, + temp_box.y2); + if (temp_box.y2 == 0) + temp_box.y2 = pixmap_height; + } + else { + temp_box.y1 = temp_extent->y1; + temp_box.y2 = temp_extent->y2; + _glamor_largepixmap_reflect_fixup(&temp_box.y1, + &temp_box.y2, + pixmap_height); + } + + RegionInitBoxes(&temp_region, &temp_box, 1); + RegionTranslate(&temp_region, + x_center_shift * pixmap_width, + y_center_shift * pixmap_height); + DEBUGF("for transform result:\n"); + DEBUGRegionPrint(&temp_region); + } + RegionAppend(current_region, &temp_region); + RegionUninit(&repeat_region); + y_idx++; + } + x_idx++; + } + } + DEBUGF("dx %d dy %d \n", dx, dy); + + if (RegionNumRects(current_region)) { + + if ((right_shift != 0 || down_shift != 0) && + !(is_transform && repeat_type == RepeatReflect)) + RegionTranslate(current_region, -right_shift * pixmap_width, + -down_shift * pixmap_height); + clipped_regions[m].region = current_region; + clipped_regions[m].block_idx = idx; + m++; + } + else + RegionDestroy(current_region); + RegionUninit(&temp_region); + } + } + + if (right_shift != 0 || down_shift != 0) + RegionTranslate(region, -right_shift * pixmap_width, + -down_shift * pixmap_height); + *n_region = m; + + return clipped_regions; +} + +glamor_pixmap_clipped_regions * +glamor_compute_clipped_regions(glamor_pixmap_private *priv, RegionPtr region, + int *n_region, int repeat_type, + int reverse, int upsidedown) +{ + return _glamor_compute_clipped_regions(priv, region, n_region, repeat_type, + 0, reverse, upsidedown); +} + +/* XXX overflow still exist. maybe we need to change to use region32. + * by default. Or just use region32 for repeat cases? + **/ +glamor_pixmap_clipped_regions * +glamor_compute_transform_clipped_regions(glamor_pixmap_private *priv, + struct pixman_transform *transform, + RegionPtr region, int *n_region, + int dx, int dy, int repeat_type, + int reverse, int upsidedown) +{ + BoxPtr temp_extent; + struct pixman_box32 temp_box; + struct pixman_box16 short_box; + RegionPtr temp_region; + glamor_pixmap_clipped_regions *ret; + + temp_region = RegionCreate(NULL, 4); + temp_extent = RegionExtents(region); + DEBUGF("dest region \n"); + DEBUGRegionPrint(region); + /* dx/dy may exceed MAX SHORT. we have to use + * a box32 to represent it.*/ + temp_box.x1 = temp_extent->x1 + dx; + temp_box.x2 = temp_extent->x2 + dx; + temp_box.y1 = temp_extent->y1 + dy; + temp_box.y2 = temp_extent->y2 + dy; + + DEBUGF("source box %d %d %d %d \n", temp_box.x1, temp_box.y1, temp_box.x2, + temp_box.y2); + if (transform) + glamor_get_transform_extent_from_box(&temp_box, transform); + if (repeat_type == RepeatNone) { + if (temp_box.x1 < 0) + temp_box.x1 = 0; + if (temp_box.y1 < 0) + temp_box.y1 = 0; + temp_box.x2 = MIN(temp_box.x2, priv->base.pixmap->drawable.width); + temp_box.y2 = MIN(temp_box.y2, priv->base.pixmap->drawable.height); + } + /* Now copy back the box32 to a box16 box. */ + short_box.x1 = temp_box.x1; + short_box.y1 = temp_box.y1; + short_box.x2 = temp_box.x2; + short_box.y2 = temp_box.y2; + RegionInitBoxes(temp_region, &short_box, 1); + DEBUGF("copy to temp source region \n"); + DEBUGRegionPrint(temp_region); + ret = _glamor_compute_clipped_regions(priv, + temp_region, + n_region, + repeat_type, 1, reverse, upsidedown); + DEBUGF("n_regions = %d \n", *n_region); + RegionDestroy(temp_region); + + return ret; +} + +/* + * As transform and repeatpad mode. + * We may get a clipped result which in multipe regions. + * It's not easy to do a 2nd round clipping just as we do + * without transform/repeatPad. As it's not easy to reverse + * the 2nd round clipping result with a transform/repeatPad mode, + * or even impossible for some transformation. + * + * So we have to merge the fragmental region into one region + * if the clipped result cross the region boundary. + */ +static void +glamor_merge_clipped_regions(glamor_pixmap_private *pixmap_priv, + int repeat_type, + glamor_pixmap_clipped_regions *clipped_regions, + int *n_regions, int *need_clean_fbo) +{ + BoxPtr temp_extent; + BoxRec temp_box, copy_box; + RegionPtr temp_region; + glamor_pixmap_private *temp_priv; + PixmapPtr temp_pixmap; + int overlap; + int i; + int pixmap_width, pixmap_height; + glamor_pixmap_private_large_t *priv; + + priv = &pixmap_priv->large; + pixmap_width = priv->base.pixmap->drawable.width; + pixmap_height = priv->base.pixmap->drawable.height; + + temp_region = RegionCreate(NULL, 4); + for (i = 0; i < *n_regions; i++) { + DEBUGF("Region %d:\n", i); + DEBUGRegionPrint(clipped_regions[i].region); + RegionAppend(temp_region, clipped_regions[i].region); + } + + RegionValidate(temp_region, &overlap); + DEBUGF("temp region: \n"); + DEBUGRegionPrint(temp_region); + temp_extent = RegionExtents(temp_region); + + temp_box = *temp_extent; + + DEBUGF("need copy region: \n"); + DEBUGF("%d %d %d %d \n", temp_box.x1, temp_box.y1, temp_box.x2, + temp_box.y2); + temp_pixmap = + glamor_create_pixmap(priv->base.pixmap->drawable.pScreen, + temp_box.x2 - temp_box.x1, + temp_box.y2 - temp_box.y1, + priv->base.pixmap->drawable.depth, + GLAMOR_CREATE_PIXMAP_FIXUP); + if (temp_pixmap == NULL) { + assert(0); + return; + } + + temp_priv = glamor_get_pixmap_private(temp_pixmap); + assert(temp_priv->type != GLAMOR_TEXTURE_LARGE); + + priv->box = temp_box; + if (temp_extent->x1 >= 0 && temp_extent->x2 <= pixmap_width + && temp_extent->y1 >= 0 && temp_extent->y2 <= pixmap_height) { + int dx, dy; + + copy_box.x1 = 0; + copy_box.y1 = 0; + copy_box.x2 = temp_extent->x2 - temp_extent->x1; + copy_box.y2 = temp_extent->y2 - temp_extent->y1; + dx = temp_extent->x1; + dy = temp_extent->y1; + glamor_copy_n_to_n(&priv->base.pixmap->drawable, + &temp_pixmap->drawable, + NULL, ©_box, 1, dx, dy, 0, 0, 0, NULL); +// glamor_solid(temp_pixmap, 0, 0, temp_pixmap->drawable.width, +// temp_pixmap->drawable.height, GXcopy, 0xffffffff, 0xff00); + } + else { + for (i = 0; i < *n_regions; i++) { + BoxPtr box; + int nbox; + + box = REGION_RECTS(clipped_regions[i].region); + nbox = REGION_NUM_RECTS(clipped_regions[i].region); + while (nbox--) { + int dx, dy, c, d; + + DEBUGF("box x1 %d y1 %d x2 %d y2 %d \n", + box->x1, box->y1, box->x2, box->y2); + modulus(box->x1, pixmap_width, c); + dx = c - (box->x1 - temp_box.x1); + copy_box.x1 = box->x1 - temp_box.x1; + copy_box.x2 = box->x2 - temp_box.x1; + + modulus(box->y1, pixmap_height, d); + dy = d - (box->y1 - temp_box.y1); + copy_box.y1 = box->y1 - temp_box.y1; + copy_box.y2 = box->y2 - temp_box.y1; + + DEBUGF("copying box %d %d %d %d, dx %d dy %d\n", + copy_box.x1, copy_box.y1, copy_box.x2, + copy_box.y2, dx, dy); + + glamor_copy_n_to_n(&priv->base.pixmap->drawable, + &temp_pixmap->drawable, + NULL, ©_box, 1, dx, dy, 0, 0, 0, NULL); + box++; + } + } + //glamor_solid(temp_pixmap, 0, 0, temp_pixmap->drawable.width, + // temp_pixmap->drawable.height, GXcopy, 0xffffffff, 0xff); + } + /* The first region will be released at caller side. */ + for (i = 1; i < *n_regions; i++) + RegionDestroy(clipped_regions[i].region); + RegionDestroy(temp_region); + priv->box = temp_box; + priv->base.fbo = glamor_pixmap_detach_fbo(temp_priv); + DEBUGF("priv box x1 %d y1 %d x2 %d y2 %d \n", + priv->box.x1, priv->box.y1, priv->box.x2, priv->box.y2); + glamor_destroy_pixmap(temp_pixmap); + *need_clean_fbo = 1; + *n_regions = 1; +} + +/** + * Given an expected transformed block width and block height, + * + * This function calculate a new block width and height which + * guarantee the transform result will not exceed the given + * block width and height. + * + * For large block width and height (> 2048), we choose a + * smaller new width and height and to reduce the cross region + * boundary and can avoid some overhead. + * + **/ +Bool +glamor_get_transform_block_size(struct pixman_transform *transform, + int block_w, int block_h, + int *transformed_block_w, + int *transformed_block_h) +{ + double a, b, c, d, e, f, g, h; + double scale; + int width, height; + + a = pixman_fixed_to_double(transform->matrix[0][0]); + b = pixman_fixed_to_double(transform->matrix[0][1]); + c = pixman_fixed_to_double(transform->matrix[1][0]); + d = pixman_fixed_to_double(transform->matrix[1][1]); + scale = pixman_fixed_to_double(transform->matrix[2][2]); + if (block_w > 2048) { + /* For large block size, we shrink it to smaller box, + * thus latter we may get less cross boundary regions and + * thus can avoid some extra copy. + * + **/ + width = block_w / 4; + height = block_h / 4; + } + else { + width = block_w - 2; + height = block_h - 2; + } + e = a + b; + f = c + d; + + g = a - b; + h = c - d; + + e = MIN(block_w, floor(width * scale) / MAX(fabs(e), fabs(g))); + f = MIN(block_h, floor(height * scale) / MAX(fabs(f), fabs(h))); + *transformed_block_w = MIN(e, f) - 1; + *transformed_block_h = *transformed_block_w; + if (*transformed_block_w <= 0 || *transformed_block_h <= 0) + return FALSE; + DEBUGF("original block_w/h %d %d, fixed %d %d \n", block_w, block_h, + *transformed_block_w, *transformed_block_h); + return TRUE; +} + +#define VECTOR_FROM_POINT(p, x, y) \ + p.v[0] = x; \ + p.v[1] = y; \ + p.v[2] = 1.0; +void +glamor_get_transform_extent_from_box(struct pixman_box32 *box, + struct pixman_transform *transform) +{ + struct pixman_f_vector p0, p1, p2, p3; + float min_x, min_y, max_x, max_y; + + struct pixman_f_transform ftransform; + + VECTOR_FROM_POINT(p0, box->x1, box->y1) + VECTOR_FROM_POINT(p1, box->x2, box->y1) + VECTOR_FROM_POINT(p2, box->x2, box->y2) + VECTOR_FROM_POINT(p3, box->x1, box->y2) + + pixman_f_transform_from_pixman_transform(&ftransform, transform); + pixman_f_transform_point(&ftransform, &p0); + pixman_f_transform_point(&ftransform, &p1); + pixman_f_transform_point(&ftransform, &p2); + pixman_f_transform_point(&ftransform, &p3); + + min_x = MIN(p0.v[0], p1.v[0]); + min_x = MIN(min_x, p2.v[0]); + min_x = MIN(min_x, p3.v[0]); + + min_y = MIN(p0.v[1], p1.v[1]); + min_y = MIN(min_y, p2.v[1]); + min_y = MIN(min_y, p3.v[1]); + + max_x = MAX(p0.v[0], p1.v[0]); + max_x = MAX(max_x, p2.v[0]); + max_x = MAX(max_x, p3.v[0]); + + max_y = MAX(p0.v[1], p1.v[1]); + max_y = MAX(max_y, p2.v[1]); + max_y = MAX(max_y, p3.v[1]); + box->x1 = floor(min_x) - 1; + box->y1 = floor(min_y) - 1; + box->x2 = ceil(max_x) + 1; + box->y2 = ceil(max_y) + 1; +} + +static void +_glamor_process_transformed_clipped_region(glamor_pixmap_private *priv, + int repeat_type, + glamor_pixmap_clipped_regions * + clipped_regions, int *n_regions, + int *need_clean_fbo) +{ + int shift_x, shift_y; + + if (*n_regions != 1) { + /* Merge all source regions into one region. */ + glamor_merge_clipped_regions(priv, repeat_type, + clipped_regions, n_regions, + need_clean_fbo); + } + else { + SET_PIXMAP_FBO_CURRENT(priv, clipped_regions[0].block_idx); + if (repeat_type == RepeatReflect || repeat_type == RepeatNormal) { + /* The required source areas are in one region, + * we need to shift the corresponding box's coords to proper position, + * thus we can calculate the relative coords correctly.*/ + BoxPtr temp_box; + int rem; + + temp_box = RegionExtents(clipped_regions[0].region); + modulus(temp_box->x1, priv->base.pixmap->drawable.width, rem); + shift_x = (temp_box->x1 - rem) / priv->base.pixmap->drawable.width; + modulus(temp_box->y1, priv->base.pixmap->drawable.height, rem); + shift_y = (temp_box->y1 - rem) / priv->base.pixmap->drawable.height; + + if (shift_x != 0) { + priv->large.box.x1 += + shift_x * priv->base.pixmap->drawable.width; + priv->large.box.x2 += + shift_x * priv->base.pixmap->drawable.width; + } + if (shift_y != 0) { + priv->large.box.y1 += + shift_y * priv->base.pixmap->drawable.height; + priv->large.box.y2 += + shift_y * priv->base.pixmap->drawable.height; + } + } + } +} + +Bool +glamor_composite_largepixmap_region(CARD8 op, + PicturePtr source, + PicturePtr mask, + PicturePtr dest, + glamor_pixmap_private *source_pixmap_priv, + glamor_pixmap_private *mask_pixmap_priv, + glamor_pixmap_private *dest_pixmap_priv, + RegionPtr region, Bool force_clip, + INT16 x_source, + INT16 y_source, + INT16 x_mask, + INT16 y_mask, + INT16 x_dest, INT16 y_dest, + CARD16 width, CARD16 height) +{ + glamor_pixmap_clipped_regions *clipped_dest_regions; + glamor_pixmap_clipped_regions *clipped_source_regions; + glamor_pixmap_clipped_regions *clipped_mask_regions; + int n_dest_regions; + int n_mask_regions; + int n_source_regions; + int i, j, k; + int need_clean_source_fbo = 0; + int need_clean_mask_fbo = 0; + int is_normal_source_fbo = 0; + int is_normal_mask_fbo = 0; + int fixed_block_width, fixed_block_height; + int null_source, null_mask; + glamor_pixmap_private *need_free_source_pixmap_priv = NULL; + glamor_pixmap_private *need_free_mask_pixmap_priv = NULL; + int source_repeat_type = 0, mask_repeat_type = 0; + int ok = TRUE; + + if (source->repeat) + source_repeat_type = source->repeatType; + else + source_repeat_type = RepeatNone; + + if (mask && mask->repeat) + mask_repeat_type = mask->repeatType; + else + mask_repeat_type = RepeatNone; + + fixed_block_width = dest_pixmap_priv->large.block_w; + fixed_block_height = dest_pixmap_priv->large.block_h; + /* If we got an totally out-of-box region for a source or mask + * region without repeat, we need to set it as null_source and + * give it a solid color (0,0,0,0). */ + null_source = 0; + null_mask = 0; + RegionTranslate(region, -dest->pDrawable->x, -dest->pDrawable->y); + + /* need to transform the dest region to the correct sourcei/mask region. + * it's a little complex, as one single edge of the + * target region may be transformed to cross a block boundary of the + * source or mask. Then it's impossible to handle it as usual way. + * We may have to split the original dest region to smaller region, and + * make sure each region's transformed region can fit into one texture, + * and then continue this loop again, and each time when a transformed region + * cross the bound, we need to copy it to a single pixmap and do the composition + * with the new pixmap. If the transformed region doesn't cross a source/mask's + * boundary then we don't need to copy. + * + */ + if (source_pixmap_priv + && source->transform + && source_pixmap_priv->type == GLAMOR_TEXTURE_LARGE) { + int source_transformed_block_width, source_transformed_block_height; + + if (!glamor_get_transform_block_size(source->transform, + source_pixmap_priv->large.block_w, + source_pixmap_priv->large.block_h, + &source_transformed_block_width, + &source_transformed_block_height)) + { + DEBUGF("source block size less than 1, fallback.\n"); + RegionTranslate(region, dest->pDrawable->x, dest->pDrawable->y); + return FALSE; + } + fixed_block_width = + min(fixed_block_width, source_transformed_block_width); + fixed_block_height = + min(fixed_block_height, source_transformed_block_height); + DEBUGF("new source block size %d x %d \n", fixed_block_width, + fixed_block_height); + } + + if (mask_pixmap_priv + && mask->transform && mask_pixmap_priv->type == GLAMOR_TEXTURE_LARGE) { + int mask_transformed_block_width, mask_transformed_block_height; + + if (!glamor_get_transform_block_size(mask->transform, + mask_pixmap_priv->large.block_w, + mask_pixmap_priv->large.block_h, + &mask_transformed_block_width, + &mask_transformed_block_height)) { + DEBUGF("mask block size less than 1, fallback.\n"); + RegionTranslate(region, dest->pDrawable->x, dest->pDrawable->y); + return FALSE; + } + fixed_block_width = + min(fixed_block_width, mask_transformed_block_width); + fixed_block_height = + min(fixed_block_height, mask_transformed_block_height); + DEBUGF("new mask block size %d x %d \n", fixed_block_width, + fixed_block_height); + } + + /*compute the correct block width and height whose transformed source/mask + *region can fit into one texture.*/ + if (force_clip || fixed_block_width < dest_pixmap_priv->large.block_w + || fixed_block_height < dest_pixmap_priv->large.block_h) + clipped_dest_regions = + glamor_compute_clipped_regions_ext(dest_pixmap_priv, region, + &n_dest_regions, + fixed_block_width, + fixed_block_height, 0, 0); + else + clipped_dest_regions = glamor_compute_clipped_regions(dest_pixmap_priv, + region, + &n_dest_regions, + 0, 0, 0); + DEBUGF("dest clipped result %d region: \n", n_dest_regions); + if (source_pixmap_priv + && (source_pixmap_priv == dest_pixmap_priv || + source_pixmap_priv == mask_pixmap_priv) + && source_pixmap_priv->type == GLAMOR_TEXTURE_LARGE) { + /* XXX self-copy... */ + need_free_source_pixmap_priv = source_pixmap_priv; + source_pixmap_priv = malloc(sizeof(*source_pixmap_priv)); + *source_pixmap_priv = *need_free_source_pixmap_priv; + need_free_source_pixmap_priv = source_pixmap_priv; + } + assert(mask_pixmap_priv != dest_pixmap_priv); + + for (i = 0; i < n_dest_regions; i++) { + DEBUGF("dest region %d idx %d\n", i, + clipped_dest_regions[i].block_idx); + DEBUGRegionPrint(clipped_dest_regions[i].region); + SET_PIXMAP_FBO_CURRENT(dest_pixmap_priv, + clipped_dest_regions[i].block_idx); + if (source_pixmap_priv && + source_pixmap_priv->type == GLAMOR_TEXTURE_LARGE) { + if (!source->transform && source_repeat_type != RepeatPad) { + RegionTranslate(clipped_dest_regions[i].region, + x_source - x_dest, y_source - y_dest); + clipped_source_regions = + glamor_compute_clipped_regions(source_pixmap_priv, + clipped_dest_regions[i]. + region, &n_source_regions, + source_repeat_type, 0, 0); + is_normal_source_fbo = 1; + } + else { + clipped_source_regions = + glamor_compute_transform_clipped_regions(source_pixmap_priv, + source->transform, + clipped_dest_regions + [i].region, + &n_source_regions, + x_source - x_dest, + y_source - y_dest, + source_repeat_type, + 0, 0); + is_normal_source_fbo = 0; + if (n_source_regions == 0) { + /* Pad the out-of-box region to (0,0,0,0). */ + null_source = 1; + n_source_regions = 1; + } + else + _glamor_process_transformed_clipped_region + (source_pixmap_priv, source_repeat_type, + clipped_source_regions, &n_source_regions, + &need_clean_source_fbo); + } + DEBUGF("source clipped result %d region: \n", n_source_regions); + for (j = 0; j < n_source_regions; j++) { + if (is_normal_source_fbo) + SET_PIXMAP_FBO_CURRENT(source_pixmap_priv, + clipped_source_regions[j].block_idx); + + if (mask_pixmap_priv && + mask_pixmap_priv->type == GLAMOR_TEXTURE_LARGE) { + if (is_normal_mask_fbo && is_normal_source_fbo) { + /* both mask and source are normal fbo box without transform or repeatpad. + * The region is clipped against source and then we clip it against mask here.*/ + DEBUGF("source region %d idx %d\n", j, + clipped_source_regions[j].block_idx); + DEBUGRegionPrint(clipped_source_regions[j].region); + RegionTranslate(clipped_source_regions[j].region, + -x_source + x_mask, -y_source + y_mask); + clipped_mask_regions = + glamor_compute_clipped_regions(mask_pixmap_priv, + clipped_source_regions + [j].region, + &n_mask_regions, + mask_repeat_type, 0, + 0); + is_normal_mask_fbo = 1; + } + else if (is_normal_mask_fbo && !is_normal_source_fbo) { + assert(n_source_regions == 1); + /* The source fbo is not a normal fbo box, it has transform or repeatpad. + * the valid clip region should be the clip dest region rather than the + * clip source region.*/ + RegionTranslate(clipped_dest_regions[i].region, + -x_dest + x_mask, -y_dest + y_mask); + clipped_mask_regions = + glamor_compute_clipped_regions(mask_pixmap_priv, + clipped_dest_regions + [i].region, + &n_mask_regions, + mask_repeat_type, 0, + 0); + is_normal_mask_fbo = 1; + } + else { + /* This mask region has transform or repeatpad, we need clip it agains the previous + * valid region rather than the mask region. */ + if (!is_normal_source_fbo) + clipped_mask_regions = + glamor_compute_transform_clipped_regions + (mask_pixmap_priv, mask->transform, + clipped_dest_regions[i].region, + &n_mask_regions, x_mask - x_dest, + y_mask - y_dest, mask_repeat_type, 0, 0); + else + clipped_mask_regions = + glamor_compute_transform_clipped_regions + (mask_pixmap_priv, mask->transform, + clipped_source_regions[j].region, + &n_mask_regions, x_mask - x_source, + y_mask - y_source, mask_repeat_type, 0, 0); + is_normal_mask_fbo = 0; + if (n_mask_regions == 0) { + /* Pad the out-of-box region to (0,0,0,0). */ + null_mask = 1; + n_mask_regions = 1; + } + else + _glamor_process_transformed_clipped_region + (mask_pixmap_priv, mask_repeat_type, + clipped_mask_regions, &n_mask_regions, + &need_clean_mask_fbo); + } + DEBUGF("mask clipped result %d region: \n", n_mask_regions); + +#define COMPOSITE_REGION(region) do { \ + if (!glamor_composite_clipped_region(op, \ + null_source ? NULL : source, \ + null_mask ? NULL : mask, dest, \ + null_source ? NULL : source_pixmap_priv, \ + null_mask ? NULL : mask_pixmap_priv, \ + dest_pixmap_priv, region, \ + x_source, y_source, x_mask, y_mask, \ + x_dest, y_dest)) { \ + assert(0); \ + } \ + } while(0) + + for (k = 0; k < n_mask_regions; k++) { + DEBUGF("mask region %d idx %d\n", k, + clipped_mask_regions[k].block_idx); + DEBUGRegionPrint(clipped_mask_regions[k].region); + if (is_normal_mask_fbo) { + SET_PIXMAP_FBO_CURRENT(mask_pixmap_priv, + clipped_mask_regions[k]. + block_idx); + DEBUGF("mask fbo off %d %d \n", + mask_pixmap_priv->large.box.x1, + mask_pixmap_priv->large.box.y1); + DEBUGF("start composite mask hasn't transform.\n"); + RegionTranslate(clipped_mask_regions[k].region, + x_dest - x_mask + + dest->pDrawable->x, + y_dest - y_mask + + dest->pDrawable->y); + COMPOSITE_REGION(clipped_mask_regions[k].region); + } + else if (!is_normal_mask_fbo && !is_normal_source_fbo) { + DEBUGF + ("start composite both mask and source have transform.\n"); + RegionTranslate(clipped_dest_regions[i].region, + dest->pDrawable->x, + dest->pDrawable->y); + COMPOSITE_REGION(clipped_dest_regions[i].region); + } + else { + DEBUGF + ("start composite only mask has transform.\n"); + RegionTranslate(clipped_source_regions[j].region, + x_dest - x_source + + dest->pDrawable->x, + y_dest - y_source + + dest->pDrawable->y); + COMPOSITE_REGION(clipped_source_regions[j].region); + } + RegionDestroy(clipped_mask_regions[k].region); + } + free(clipped_mask_regions); + if (null_mask) + null_mask = 0; + if (need_clean_mask_fbo) { + assert(is_normal_mask_fbo == 0); + glamor_destroy_fbo(mask_pixmap_priv->base.fbo); + mask_pixmap_priv->base.fbo = NULL; + need_clean_mask_fbo = 0; + } + } + else { + if (is_normal_source_fbo) { + RegionTranslate(clipped_source_regions[j].region, + -x_source + x_dest + dest->pDrawable->x, + -y_source + y_dest + + dest->pDrawable->y); + COMPOSITE_REGION(clipped_source_regions[j].region); + } + else { + /* Source has transform or repeatPad. dest regions is the right + * region to do the composite. */ + RegionTranslate(clipped_dest_regions[i].region, + dest->pDrawable->x, dest->pDrawable->y); + COMPOSITE_REGION(clipped_dest_regions[i].region); + } + } + if (clipped_source_regions && clipped_source_regions[j].region) + RegionDestroy(clipped_source_regions[j].region); + } + free(clipped_source_regions); + if (null_source) + null_source = 0; + if (need_clean_source_fbo) { + assert(is_normal_source_fbo == 0); + glamor_destroy_fbo(source_pixmap_priv->base.fbo); + source_pixmap_priv->base.fbo = NULL; + need_clean_source_fbo = 0; + } + } + else { + if (mask_pixmap_priv && + mask_pixmap_priv->type == GLAMOR_TEXTURE_LARGE) { + if (!mask->transform && mask_repeat_type != RepeatPad) { + RegionTranslate(clipped_dest_regions[i].region, + x_mask - x_dest, y_mask - y_dest); + clipped_mask_regions = + glamor_compute_clipped_regions(mask_pixmap_priv, + clipped_dest_regions[i]. + region, &n_mask_regions, + mask_repeat_type, 0, 0); + is_normal_mask_fbo = 1; + } + else { + clipped_mask_regions = + glamor_compute_transform_clipped_regions + (mask_pixmap_priv, mask->transform, + clipped_dest_regions[i].region, &n_mask_regions, + x_mask - x_dest, y_mask - y_dest, mask_repeat_type, 0, + 0); + is_normal_mask_fbo = 0; + if (n_mask_regions == 0) { + /* Pad the out-of-box region to (0,0,0,0). */ + null_mask = 1; + n_mask_regions = 1; + } + else + _glamor_process_transformed_clipped_region + (mask_pixmap_priv, mask_repeat_type, + clipped_mask_regions, &n_mask_regions, + &need_clean_mask_fbo); + } + + for (k = 0; k < n_mask_regions; k++) { + DEBUGF("mask region %d idx %d\n", k, + clipped_mask_regions[k].block_idx); + DEBUGRegionPrint(clipped_mask_regions[k].region); + if (is_normal_mask_fbo) { + SET_PIXMAP_FBO_CURRENT(mask_pixmap_priv, + clipped_mask_regions[k]. + block_idx); + RegionTranslate(clipped_mask_regions[k].region, + x_dest - x_mask + dest->pDrawable->x, + y_dest - y_mask + dest->pDrawable->y); + COMPOSITE_REGION(clipped_mask_regions[k].region); + } + else { + RegionTranslate(clipped_dest_regions[i].region, + dest->pDrawable->x, dest->pDrawable->y); + COMPOSITE_REGION(clipped_dest_regions[i].region); + } + RegionDestroy(clipped_mask_regions[k].region); + } + free(clipped_mask_regions); + if (null_mask) + null_mask = 0; + if (need_clean_mask_fbo) { + glamor_destroy_fbo(mask_pixmap_priv->base.fbo); + mask_pixmap_priv->base.fbo = NULL; + need_clean_mask_fbo = 0; + } + } + else { + RegionTranslate(clipped_dest_regions[i].region, + dest->pDrawable->x, dest->pDrawable->y); + COMPOSITE_REGION(clipped_dest_regions[i].region); + } + } + RegionDestroy(clipped_dest_regions[i].region); + } + free(clipped_dest_regions); + free(need_free_source_pixmap_priv); + free(need_free_mask_pixmap_priv); + ok = TRUE; + return ok; +} diff --git a/xserver/glamor/glamor_picture.c b/xserver/glamor/glamor_picture.c new file mode 100644 index 000000000..5fdc5f9b0 --- /dev/null +++ b/xserver/glamor/glamor_picture.c @@ -0,0 +1,131 @@ +/* + * Copyright © 2009 Intel Corporation + * Copyright © 1998 Keith Packard + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Authors: + * Zhigang Gong <zhigang.gong@gmail.com> + * + */ + +#include <stdlib.h> + +#include "glamor_priv.h" +#include "mipict.h" + +/* Upload picture to texture. We may need to flip the y axis or + * wire alpha to 1. So we may conditional create fbo for the picture. + * */ +enum glamor_pixmap_status +glamor_upload_picture_to_texture(PicturePtr picture) +{ + PixmapPtr pixmap; + + assert(picture->pDrawable); + pixmap = glamor_get_drawable_pixmap(picture->pDrawable); + + return glamor_upload_pixmap_to_texture(pixmap); +} + +Bool +glamor_prepare_access_picture(PicturePtr picture, glamor_access_t access) +{ + if (!picture || !picture->pDrawable) + return TRUE; + + return glamor_prepare_access(picture->pDrawable, access); +} + +void +glamor_finish_access_picture(PicturePtr picture) +{ + if (!picture || !picture->pDrawable) + return; + + glamor_finish_access(picture->pDrawable); +} + +/* + * We should already have drawable attached to it, if it has one. + * Then set the attached pixmap to is_picture format, and set + * the pict format. + * */ +int +glamor_create_picture(PicturePtr picture) +{ + PixmapPtr pixmap; + glamor_pixmap_private *pixmap_priv; + + if (!picture || !picture->pDrawable) + return 0; + + pixmap = glamor_get_drawable_pixmap(picture->pDrawable); + pixmap_priv = glamor_get_pixmap_private(pixmap); + if (!pixmap_priv) { + /* We must create a pixmap priv to track the picture format even + * if the pixmap is a pure in memory pixmap. The reason is that + * we may need to upload this pixmap to a texture on the fly. During + * the uploading, we need to know the picture format. */ + glamor_set_pixmap_type(pixmap, GLAMOR_MEMORY); + pixmap_priv = glamor_get_pixmap_private(pixmap); + } + else { + if (GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv)) { + /* If the picture format is not compatible with glamor fbo format, + * we have to mark this pixmap as a separated texture, and don't + * fallback to DDX layer. */ + if (pixmap_priv->type == GLAMOR_TEXTURE_DRM + && !glamor_pict_format_is_compatible(picture)) + glamor_set_pixmap_type(pixmap, GLAMOR_SEPARATE_TEXTURE); + } + } + + pixmap_priv->base.is_picture = 1; + pixmap_priv->base.picture = picture; + + return miCreatePicture(picture); +} + +void +glamor_destroy_picture(PicturePtr picture) +{ + PixmapPtr pixmap; + glamor_pixmap_private *pixmap_priv; + + if (!picture || !picture->pDrawable) + return; + + pixmap = glamor_get_drawable_pixmap(picture->pDrawable); + pixmap_priv = glamor_get_pixmap_private(pixmap); + + if (pixmap_priv) { + pixmap_priv->base.is_picture = 0; + pixmap_priv->base.picture = NULL; + } + miDestroyPicture(picture); +} + +void +glamor_picture_format_fixup(PicturePtr picture, + glamor_pixmap_private *pixmap_priv) +{ + pixmap_priv->base.picture = picture; +} diff --git a/xserver/glamor/glamor_pixmap.c b/xserver/glamor/glamor_pixmap.c new file mode 100644 index 000000000..789d3772e --- /dev/null +++ b/xserver/glamor/glamor_pixmap.c @@ -0,0 +1,1689 @@ +/* + * Copyright © 2001 Keith Packard + * Copyright © 2008 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Authors: + * Eric Anholt <eric@anholt.net> + * Zhigang Gong <zhigang.gong@linux.intel.com> + * + */ + +#include <stdlib.h> + +#include "glamor_priv.h" +/** + * Sets the offsets to add to coordinates to make them address the same bits in + * the backing drawable. These coordinates are nonzero only for redirected + * windows. + */ +void +glamor_get_drawable_deltas(DrawablePtr drawable, PixmapPtr pixmap, + int *x, int *y) +{ +#ifdef COMPOSITE + if (drawable->type == DRAWABLE_WINDOW) { + *x = -pixmap->screen_x; + *y = -pixmap->screen_y; + return; + } +#endif + + *x = 0; + *y = 0; +} + +void +glamor_pixmap_init(ScreenPtr screen) +{ + +} + +void +glamor_pixmap_fini(ScreenPtr screen) +{ +} + +void +glamor_set_destination_pixmap_fbo(glamor_pixmap_fbo *fbo, int x0, int y0, + int width, int height) +{ + glamor_make_current(fbo->glamor_priv); + + glBindFramebuffer(GL_FRAMEBUFFER, fbo->fb); + glViewport(x0, y0, width, height); +} + +void +glamor_set_destination_pixmap_priv_nc(glamor_pixmap_private *pixmap_priv) +{ + int w, h; + + PIXMAP_PRIV_GET_ACTUAL_SIZE(pixmap_priv, w, h); + glamor_set_destination_pixmap_fbo(pixmap_priv->base.fbo, 0, 0, w, h); +} + +int +glamor_set_destination_pixmap_priv(glamor_pixmap_private *pixmap_priv) +{ + if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv)) + return -1; + + glamor_set_destination_pixmap_priv_nc(pixmap_priv); + return 0; +} + +int +glamor_set_destination_pixmap(PixmapPtr pixmap) +{ + int err; + glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap); + + err = glamor_set_destination_pixmap_priv(pixmap_priv); + return err; +} + +Bool +glamor_set_planemask(PixmapPtr pixmap, unsigned long planemask) +{ + if (glamor_pm_is_solid(&pixmap->drawable, planemask)) { + return GL_TRUE; + } + + glamor_fallback("unsupported planemask %lx\n", planemask); + return GL_FALSE; +} + +Bool +glamor_set_alu(ScreenPtr screen, unsigned char alu) +{ + glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); + + if (glamor_priv->gl_flavor == GLAMOR_GL_ES2) { + if (alu != GXcopy) + return FALSE; + else + return TRUE; + } + + if (alu == GXcopy) { + glDisable(GL_COLOR_LOGIC_OP); + return TRUE; + } + glEnable(GL_COLOR_LOGIC_OP); + switch (alu) { + case GXclear: + glLogicOp(GL_CLEAR); + break; + case GXand: + glLogicOp(GL_AND); + break; + case GXandReverse: + glLogicOp(GL_AND_REVERSE); + break; + case GXandInverted: + glLogicOp(GL_AND_INVERTED); + break; + case GXnoop: + glLogicOp(GL_NOOP); + break; + case GXxor: + glLogicOp(GL_XOR); + break; + case GXor: + glLogicOp(GL_OR); + break; + case GXnor: + glLogicOp(GL_NOR); + break; + case GXequiv: + glLogicOp(GL_EQUIV); + break; + case GXinvert: + glLogicOp(GL_INVERT); + break; + case GXorReverse: + glLogicOp(GL_OR_REVERSE); + break; + case GXcopyInverted: + glLogicOp(GL_COPY_INVERTED); + break; + case GXorInverted: + glLogicOp(GL_OR_INVERTED); + break; + case GXnand: + glLogicOp(GL_NAND); + break; + case GXset: + glLogicOp(GL_SET); + break; + default: + glamor_fallback("unsupported alu %x\n", alu); + return FALSE; + } + + return TRUE; +} + +/* + * Map picture's format to the correct gl texture format and type. + * no_alpha is used to indicate whehter we need to wire alpha to 1. + * + * Although opengl support A1/GL_BITMAP, we still don't use it + * here, it seems that mesa has bugs when uploading a A1 bitmap. + * + * Return 0 if find a matched texture type. Otherwise return -1. + **/ +static int +glamor_get_tex_format_type_from_pictformat_gl(PictFormatShort format, + GLenum *tex_format, + GLenum *tex_type, + int *no_alpha, + int *revert, + int *swap_rb, int is_upload) +{ + *no_alpha = 0; + *revert = REVERT_NONE; + *swap_rb = is_upload ? SWAP_NONE_UPLOADING : SWAP_NONE_DOWNLOADING; + switch (format) { + case PICT_a1: + *tex_format = GL_ALPHA; + *tex_type = GL_UNSIGNED_BYTE; + *revert = is_upload ? REVERT_UPLOADING_A1 : REVERT_DOWNLOADING_A1; + break; + case PICT_b8g8r8x8: + *no_alpha = 1; + case PICT_b8g8r8a8: + *tex_format = GL_BGRA; + *tex_type = GL_UNSIGNED_INT_8_8_8_8; + break; + + case PICT_x8r8g8b8: + *no_alpha = 1; + case PICT_a8r8g8b8: + *tex_format = GL_BGRA; + *tex_type = GL_UNSIGNED_INT_8_8_8_8_REV; + break; + case PICT_x8b8g8r8: + *no_alpha = 1; + case PICT_a8b8g8r8: + *tex_format = GL_RGBA; + *tex_type = GL_UNSIGNED_INT_8_8_8_8_REV; + break; + case PICT_x2r10g10b10: + *no_alpha = 1; + case PICT_a2r10g10b10: + *tex_format = GL_BGRA; + *tex_type = GL_UNSIGNED_INT_2_10_10_10_REV; + break; + case PICT_x2b10g10r10: + *no_alpha = 1; + case PICT_a2b10g10r10: + *tex_format = GL_RGBA; + *tex_type = GL_UNSIGNED_INT_2_10_10_10_REV; + break; + + case PICT_r5g6b5: + *tex_format = GL_RGB; + *tex_type = GL_UNSIGNED_SHORT_5_6_5; + break; + case PICT_b5g6r5: + *tex_format = GL_RGB; + *tex_type = GL_UNSIGNED_SHORT_5_6_5_REV; + break; + case PICT_x1b5g5r5: + *no_alpha = 1; + case PICT_a1b5g5r5: + *tex_format = GL_RGBA; + *tex_type = GL_UNSIGNED_SHORT_1_5_5_5_REV; + break; + + case PICT_x1r5g5b5: + *no_alpha = 1; + case PICT_a1r5g5b5: + *tex_format = GL_BGRA; + *tex_type = GL_UNSIGNED_SHORT_1_5_5_5_REV; + break; + case PICT_a8: + *tex_format = GL_ALPHA; + *tex_type = GL_UNSIGNED_BYTE; + break; + case PICT_x4r4g4b4: + *no_alpha = 1; + case PICT_a4r4g4b4: + *tex_format = GL_BGRA; + *tex_type = GL_UNSIGNED_SHORT_4_4_4_4_REV; + break; + + case PICT_x4b4g4r4: + *no_alpha = 1; + case PICT_a4b4g4r4: + *tex_format = GL_RGBA; + *tex_type = GL_UNSIGNED_SHORT_4_4_4_4_REV; + break; + + default: + return -1; + } + return 0; +} + +#define IS_LITTLE_ENDIAN (IMAGE_BYTE_ORDER == LSBFirst) + +static int +glamor_get_tex_format_type_from_pictformat_gles2(PictFormatShort format, + GLenum *tex_format, + GLenum *tex_type, + int *no_alpha, + int *revert, + int *swap_rb, int is_upload) +{ + int need_swap_rb = 0; + + *no_alpha = 0; + *revert = IS_LITTLE_ENDIAN ? REVERT_NONE : REVERT_NORMAL; + + switch (format) { + case PICT_b8g8r8x8: + *no_alpha = 1; + case PICT_b8g8r8a8: + *tex_format = GL_RGBA; + *tex_type = GL_UNSIGNED_BYTE; + need_swap_rb = 1; + *revert = IS_LITTLE_ENDIAN ? REVERT_NORMAL : REVERT_NONE; + break; + + case PICT_x8r8g8b8: + *no_alpha = 1; + case PICT_a8r8g8b8: + *tex_format = GL_RGBA; + *tex_type = GL_UNSIGNED_BYTE; + need_swap_rb = 1; + break; + + case PICT_x8b8g8r8: + *no_alpha = 1; + case PICT_a8b8g8r8: + *tex_format = GL_RGBA; + *tex_type = GL_UNSIGNED_BYTE; + break; + + case PICT_x2r10g10b10: + *no_alpha = 1; + case PICT_a2r10g10b10: + *tex_format = GL_RGBA; + /* glReadPixmap doesn't support GL_UNSIGNED_INT_10_10_10_2. + * we have to use GL_UNSIGNED_BYTE and do the conversion in + * shader latter.*/ + *tex_type = GL_UNSIGNED_BYTE; + if (is_upload == 1) { + if (!IS_LITTLE_ENDIAN) + *revert = REVERT_UPLOADING_10_10_10_2; + else + *revert = REVERT_UPLOADING_2_10_10_10; + } + else { + if (!IS_LITTLE_ENDIAN) { + *revert = REVERT_DOWNLOADING_10_10_10_2; + } + else { + *revert = REVERT_DOWNLOADING_2_10_10_10; + } + } + need_swap_rb = 1; + + break; + + case PICT_x2b10g10r10: + *no_alpha = 1; + case PICT_a2b10g10r10: + *tex_format = GL_RGBA; + *tex_type = GL_UNSIGNED_BYTE; + if (is_upload == 1) { + if (!IS_LITTLE_ENDIAN) + *revert = REVERT_UPLOADING_10_10_10_2; + else + *revert = REVERT_UPLOADING_2_10_10_10; + } + else { + if (!IS_LITTLE_ENDIAN) { + *revert = REVERT_DOWNLOADING_10_10_10_2; + } + else { + *revert = REVERT_DOWNLOADING_2_10_10_10; + } + } + break; + + case PICT_r5g6b5: + *tex_format = GL_RGB; + *tex_type = GL_UNSIGNED_SHORT_5_6_5; + *revert = IS_LITTLE_ENDIAN ? REVERT_NONE : REVERT_NORMAL; + + break; + + case PICT_b5g6r5: + *tex_format = GL_RGB; + *tex_type = GL_UNSIGNED_SHORT_5_6_5; + need_swap_rb = IS_LITTLE_ENDIAN ? 1 : 0;; + break; + + case PICT_x1b5g5r5: + *no_alpha = 1; + case PICT_a1b5g5r5: + *tex_format = GL_RGBA; + *tex_type = GL_UNSIGNED_SHORT_5_5_5_1; + if (IS_LITTLE_ENDIAN) { + *revert = + is_upload ? REVERT_UPLOADING_1_5_5_5 : + REVERT_DOWNLOADING_1_5_5_5; + } + else + *revert = REVERT_NONE; + break; + + case PICT_x1r5g5b5: + *no_alpha = 1; + case PICT_a1r5g5b5: + *tex_format = GL_RGBA; + *tex_type = GL_UNSIGNED_SHORT_5_5_5_1; + if (IS_LITTLE_ENDIAN) { + *revert = + is_upload ? REVERT_UPLOADING_1_5_5_5 : + REVERT_DOWNLOADING_1_5_5_5; + } + else + *revert = REVERT_NONE; + need_swap_rb = 1; + break; + + case PICT_a1: + *tex_format = GL_ALPHA; + *tex_type = GL_UNSIGNED_BYTE; + *revert = is_upload ? REVERT_UPLOADING_A1 : REVERT_DOWNLOADING_A1; + break; + + case PICT_a8: + *tex_format = GL_ALPHA; + *tex_type = GL_UNSIGNED_BYTE; + *revert = REVERT_NONE; + break; + + case PICT_x4r4g4b4: + *no_alpha = 1; + case PICT_a4r4g4b4: + *tex_format = GL_RGBA; + *tex_type = GL_UNSIGNED_SHORT_4_4_4_4; + *revert = IS_LITTLE_ENDIAN ? REVERT_NORMAL : REVERT_NONE; + need_swap_rb = 1; + break; + + case PICT_x4b4g4r4: + *no_alpha = 1; + case PICT_a4b4g4r4: + *tex_format = GL_RGBA; + *tex_type = GL_UNSIGNED_SHORT_4_4_4_4; + *revert = IS_LITTLE_ENDIAN ? REVERT_NORMAL : REVERT_NONE; + break; + + default: + LogMessageVerb(X_INFO, 0, + "fail to get matched format for %x \n", format); + return -1; + } + + if (need_swap_rb) + *swap_rb = is_upload ? SWAP_UPLOADING : SWAP_DOWNLOADING; + else + *swap_rb = is_upload ? SWAP_NONE_UPLOADING : SWAP_NONE_DOWNLOADING; + return 0; +} + +static int +glamor_get_tex_format_type_from_pixmap(PixmapPtr pixmap, + GLenum *format, + GLenum *type, + int *no_alpha, + int *revert, int *swap_rb, int is_upload) +{ + glamor_pixmap_private *pixmap_priv; + PictFormatShort pict_format; + glamor_screen_private *glamor_priv = + glamor_get_screen_private(pixmap->drawable.pScreen); + + pixmap_priv = glamor_get_pixmap_private(pixmap); + if (GLAMOR_PIXMAP_PRIV_IS_PICTURE(pixmap_priv)) + pict_format = pixmap_priv->base.picture->format; + else + pict_format = format_for_depth(pixmap->drawable.depth); + + if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) { + return glamor_get_tex_format_type_from_pictformat_gl(pict_format, + format, type, + no_alpha, + revert, + swap_rb, + is_upload); + } else { + return glamor_get_tex_format_type_from_pictformat_gles2(pict_format, + format, type, + no_alpha, + revert, + swap_rb, + is_upload); + } +} + +static void * +_glamor_color_convert_a1_a8(void *src_bits, void *dst_bits, int w, int h, + int stride, int revert) +{ + PictFormatShort dst_format, src_format; + pixman_image_t *dst_image; + pixman_image_t *src_image; + int src_stride; + + if (revert == REVERT_UPLOADING_A1) { + src_format = PICT_a1; + dst_format = PICT_a8; + src_stride = PixmapBytePad(w, 1); + } + else { + dst_format = PICT_a1; + src_format = PICT_a8; + src_stride = (((w * 8 + 7) / 8) + 3) & ~3; + } + + dst_image = pixman_image_create_bits(dst_format, w, h, dst_bits, stride); + if (dst_image == NULL) { + return NULL; + } + + src_image = pixman_image_create_bits(src_format, + w, h, src_bits, src_stride); + + if (src_image == NULL) { + pixman_image_unref(dst_image); + return NULL; + } + + pixman_image_composite(PictOpSrc, src_image, NULL, dst_image, + 0, 0, 0, 0, 0, 0, w, h); + + pixman_image_unref(src_image); + pixman_image_unref(dst_image); + return dst_bits; +} + +#define ADJUST_BITS(d, src_bits, dst_bits) (((dst_bits) == (src_bits)) ? (d) : \ + (((dst_bits) > (src_bits)) ? \ + (((d) << ((dst_bits) - (src_bits))) \ + + (( 1 << ((dst_bits) - (src_bits))) >> 1)) \ + : ((d) >> ((src_bits) - (dst_bits))))) + +#define GLAMOR_DO_CONVERT(src, dst, no_alpha, swap, \ + a_shift_src, a_bits_src, \ + b_shift_src, b_bits_src, \ + g_shift_src, g_bits_src, \ + r_shift_src, r_bits_src, \ + a_shift, a_bits, \ + b_shift, b_bits, \ + g_shift, g_bits, \ + r_shift, r_bits) \ + do { \ + typeof(src) a,b,g,r; \ + typeof(src) a_mask_src, b_mask_src, g_mask_src, r_mask_src;\ + a_mask_src = (((1 << (a_bits_src)) - 1) << a_shift_src);\ + b_mask_src = (((1 << (b_bits_src)) - 1) << b_shift_src);\ + g_mask_src = (((1 << (g_bits_src)) - 1) << g_shift_src);\ + r_mask_src = (((1 << (r_bits_src)) - 1) << r_shift_src);\ + if (no_alpha) \ + a = (a_mask_src) >> (a_shift_src); \ + else \ + a = ((src) & (a_mask_src)) >> (a_shift_src); \ + b = ((src) & (b_mask_src)) >> (b_shift_src); \ + g = ((src) & (g_mask_src)) >> (g_shift_src); \ + r = ((src) & (r_mask_src)) >> (r_shift_src); \ + a = ADJUST_BITS(a, a_bits_src, a_bits); \ + b = ADJUST_BITS(b, b_bits_src, b_bits); \ + g = ADJUST_BITS(g, g_bits_src, g_bits); \ + r = ADJUST_BITS(r, r_bits_src, r_bits); \ + if (swap == 0) \ + (*dst) = ((a) << (a_shift)) | ((b) << (b_shift)) | ((g) << (g_shift)) | ((r) << (r_shift)); \ + else \ + (*dst) = ((a) << (a_shift)) | ((r) << (b_shift)) | ((g) << (g_shift)) | ((b) << (r_shift)); \ + } while (0) + +static void * +_glamor_color_revert_x2b10g10r10(void *src_bits, void *dst_bits, int w, int h, + int stride, int no_alpha, int revert, + int swap_rb) +{ + int x, y; + unsigned int *words, *saved_words, *source_words; + int swap = !(swap_rb == SWAP_NONE_DOWNLOADING || + swap_rb == SWAP_NONE_UPLOADING); + + source_words = src_bits; + words = dst_bits; + saved_words = words; + + for (y = 0; y < h; y++) { + DEBUGF("Line %d : ", y); + for (x = 0; x < w; x++) { + unsigned int pixel = source_words[x]; + + if (revert == REVERT_DOWNLOADING_2_10_10_10) + GLAMOR_DO_CONVERT(pixel, &words[x], no_alpha, swap, + 24, 8, 16, 8, 8, 8, 0, 8, + 30, 2, 20, 10, 10, 10, 0, 10); + else + GLAMOR_DO_CONVERT(pixel, &words[x], no_alpha, swap, + 30, 2, 20, 10, 10, 10, 0, 10, + 24, 8, 16, 8, 8, 8, 0, 8); + DEBUGF("%x:%x ", pixel, words[x]); + } + DEBUGF("\n"); + words += stride / sizeof(*words); + source_words += stride / sizeof(*words); + } + DEBUGF("\n"); + return saved_words; + +} + +static void * +_glamor_color_revert_x1b5g5r5(void *src_bits, void *dst_bits, int w, int h, + int stride, int no_alpha, int revert, int swap_rb) +{ + int x, y; + unsigned short *words, *saved_words, *source_words; + int swap = !(swap_rb == SWAP_NONE_DOWNLOADING || + swap_rb == SWAP_NONE_UPLOADING); + + words = dst_bits; + source_words = src_bits; + saved_words = words; + + for (y = 0; y < h; y++) { + DEBUGF("Line %d : ", y); + for (x = 0; x < w; x++) { + unsigned short pixel = source_words[x]; + + if (revert == REVERT_DOWNLOADING_1_5_5_5) + GLAMOR_DO_CONVERT(pixel, &words[x], no_alpha, swap, + 0, 1, 1, 5, 6, 5, 11, 5, + 15, 1, 10, 5, 5, 5, 0, 5); + else + GLAMOR_DO_CONVERT(pixel, &words[x], no_alpha, swap, + 15, 1, 10, 5, 5, 5, 0, 5, + 0, 1, 1, 5, 6, 5, 11, 5); + DEBUGF("%04x:%04x ", pixel, words[x]); + } + DEBUGF("\n"); + words += stride / sizeof(*words); + source_words += stride / sizeof(*words); + } + DEBUGF("\n"); + return saved_words; +} + +/* + * This function is to convert an unsupported color format to/from a + * supported GL format. + * Here are the current scenarios: + * + * @no_alpha: + * If it is set, then we need to wire the alpha value to 1. + * @revert: + REVERT_DOWNLOADING_A1 : convert an Alpha8 buffer to a A1 buffer. + REVERT_UPLOADING_A1 : convert an A1 buffer to an Alpha8 buffer + REVERT_DOWNLOADING_2_10_10_10 : convert r10G10b10X2 to X2B10G10R10 + REVERT_UPLOADING_2_10_10_10 : convert X2B10G10R10 to R10G10B10X2 + REVERT_DOWNLOADING_1_5_5_5 : convert B5G5R5X1 to X1R5G5B5 + REVERT_UPLOADING_1_5_5_5 : convert X1R5G5B5 to B5G5R5X1 + @swap_rb: if we have the swap_rb set, then we need to swap the R and B's position. + * + */ + +static void * +glamor_color_convert_to_bits(void *src_bits, void *dst_bits, int w, int h, + int stride, int no_alpha, int revert, int swap_rb) +{ + if (revert == REVERT_DOWNLOADING_A1 || revert == REVERT_UPLOADING_A1) { + return _glamor_color_convert_a1_a8(src_bits, dst_bits, w, h, stride, + revert); + } + else if (revert == REVERT_DOWNLOADING_2_10_10_10 || + revert == REVERT_UPLOADING_2_10_10_10) { + return _glamor_color_revert_x2b10g10r10(src_bits, dst_bits, w, h, + stride, no_alpha, revert, + swap_rb); + } + else if (revert == REVERT_DOWNLOADING_1_5_5_5 || + revert == REVERT_UPLOADING_1_5_5_5) { + return _glamor_color_revert_x1b5g5r5(src_bits, dst_bits, w, h, stride, + no_alpha, revert, swap_rb); + } + else + ErrorF("convert a non-supported mode %x.\n", revert); + + return NULL; +} + +/** + * Upload pixmap to a specified texture. + * This texture may not be the one attached to it. + **/ +static void +__glamor_upload_pixmap_to_texture(PixmapPtr pixmap, unsigned int *tex, + GLenum format, + GLenum type, + int x, int y, int w, int h, + void *bits, int pbo) +{ + glamor_screen_private *glamor_priv = + glamor_get_screen_private(pixmap->drawable.pScreen); + int non_sub = 0; + unsigned int iformat = 0; + + glamor_make_current(glamor_priv); + if (*tex == 0) { + glGenTextures(1, tex); + if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) + iformat = gl_iformat_for_pixmap(pixmap); + else + iformat = format; + non_sub = 1; + assert(x == 0 && y == 0); + } + + glBindTexture(GL_TEXTURE_2D, *tex); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glPixelStorei(GL_UNPACK_ALIGNMENT, 4); + + assert(pbo || bits != 0); + if (bits == NULL) { + glBindBuffer(GL_PIXEL_UNPACK_BUFFER, pbo); + glUnmapBuffer(GL_PIXEL_UNPACK_BUFFER); + } + if (non_sub) + glTexImage2D(GL_TEXTURE_2D, 0, iformat, w, h, 0, format, type, bits); + else + glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, w, h, format, type, bits); + + if (bits == NULL) + glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0); +} + +static Bool +_glamor_upload_bits_to_pixmap_texture(PixmapPtr pixmap, GLenum format, + GLenum type, int no_alpha, int revert, + int swap_rb, int x, int y, int w, int h, + int stride, void *bits, int pbo) +{ + glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap); + glamor_screen_private *glamor_priv = + glamor_get_screen_private(pixmap->drawable.pScreen); + static float vertices[8]; + + static float texcoords[8] = { 0, 1, + 1, 1, + 1, 0, + 0, 0 + }; + static float texcoords_inv[8] = { 0, 0, + 1, 0, + 1, 1, + 0, 1 + }; + float *ptexcoords; + float dst_xscale, dst_yscale; + GLuint tex = 0; + int need_flip; + int need_free_bits = 0; + + need_flip = !glamor_priv->yInverted; + + if (bits == NULL) + goto ready_to_upload; + + if (revert > REVERT_NORMAL) { + /* XXX if we are restoring the pixmap, then we may not need to allocate + * new buffer */ + void *converted_bits; + + if (pixmap->drawable.depth == 1) + stride = (((w * 8 + 7) / 8) + 3) & ~3; + + converted_bits = malloc(h * stride); + + if (converted_bits == NULL) + return FALSE; + bits = glamor_color_convert_to_bits(bits, converted_bits, w, h, + stride, no_alpha, revert, swap_rb); + if (bits == NULL) { + ErrorF("Failed to convert pixmap no_alpha %d," + "revert mode %d, swap mode %d\n", no_alpha, revert, swap_rb); + return FALSE; + } + no_alpha = 0; + revert = REVERT_NONE; + swap_rb = SWAP_NONE_UPLOADING; + need_free_bits = TRUE; + } + + ready_to_upload: + + /* Try fast path firstly, upload the pixmap to the texture attached + * to the fbo directly. */ + if (no_alpha == 0 + && revert == REVERT_NONE && swap_rb == SWAP_NONE_UPLOADING && !need_flip +#ifdef WALKAROUND_LARGE_TEXTURE_MAP + && pixmap_priv->type != GLAMOR_TEXTURE_LARGE +#endif + ) { + int fbo_x_off, fbo_y_off; + + assert(pixmap_priv->base.fbo->tex); + pixmap_priv_get_fbo_off(pixmap_priv, &fbo_x_off, &fbo_y_off); + + assert(x + fbo_x_off >= 0 && y + fbo_y_off >= 0); + assert(x + fbo_x_off + w <= pixmap_priv->base.fbo->width); + assert(y + fbo_y_off + h <= pixmap_priv->base.fbo->height); + __glamor_upload_pixmap_to_texture(pixmap, &pixmap_priv->base.fbo->tex, + format, type, + x + fbo_x_off, y + fbo_y_off, w, h, + bits, pbo); + return TRUE; + } + + if (need_flip) + ptexcoords = texcoords; + else + ptexcoords = texcoords_inv; + + pixmap_priv_get_dest_scale(pixmap_priv, &dst_xscale, &dst_yscale); + glamor_set_normalize_vcoords(pixmap_priv, dst_xscale, + dst_yscale, + x, y, + x + w, y + h, + glamor_priv->yInverted, vertices); + /* Slow path, we need to flip y or wire alpha to 1. */ + glamor_make_current(glamor_priv); + glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT, + GL_FALSE, 2 * sizeof(float), vertices); + glEnableVertexAttribArray(GLAMOR_VERTEX_POS); + glVertexAttribPointer(GLAMOR_VERTEX_SOURCE, 2, GL_FLOAT, + GL_FALSE, 2 * sizeof(float), ptexcoords); + glEnableVertexAttribArray(GLAMOR_VERTEX_SOURCE); + + glamor_set_destination_pixmap_priv_nc(pixmap_priv); + __glamor_upload_pixmap_to_texture(pixmap, &tex, + format, type, 0, 0, w, h, bits, pbo); + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D, tex); + + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glUseProgram(glamor_priv->finish_access_prog[no_alpha]); + glUniform1i(glamor_priv->finish_access_revert[no_alpha], revert); + glUniform1i(glamor_priv->finish_access_swap_rb[no_alpha], swap_rb); + + glDrawArrays(GL_TRIANGLE_FAN, 0, 4); + + glDisableVertexAttribArray(GLAMOR_VERTEX_POS); + glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE); + glDeleteTextures(1, &tex); + glBindFramebuffer(GL_FRAMEBUFFER, 0); + + if (need_free_bits) + free(bits); + return TRUE; +} + +/* + * Prepare to upload a pixmap to texture memory. + * no_alpha equals 1 means the format needs to wire alpha to 1. + * Two condtion need to setup a fbo for a pixmap + * 1. !yInverted, we need to do flip if we are not yInverted. + * 2. no_alpha != 0, we need to wire the alpha. + * */ +static int +glamor_pixmap_upload_prepare(PixmapPtr pixmap, GLenum format, int no_alpha, + int revert, int swap_rb) +{ + int flag = 0; + glamor_pixmap_private *pixmap_priv; + glamor_screen_private *glamor_priv; + glamor_pixmap_fbo *fbo; + GLenum iformat; + + pixmap_priv = glamor_get_pixmap_private(pixmap); + glamor_priv = glamor_get_screen_private(pixmap->drawable.pScreen); + + if (pixmap_priv->base.gl_fbo != GLAMOR_FBO_UNATTACHED) + return 0; + + if (pixmap_priv->base.fbo + && (pixmap_priv->base.fbo->width < pixmap->drawable.width + || pixmap_priv->base.fbo->height < pixmap->drawable.height)) { + fbo = glamor_pixmap_detach_fbo(pixmap_priv); + glamor_destroy_fbo(fbo); + } + + if (pixmap_priv->base.fbo && pixmap_priv->base.fbo->fb) + return 0; + + if (!(no_alpha || (revert == REVERT_NORMAL) + || (swap_rb != SWAP_NONE_UPLOADING) + || !glamor_priv->yInverted)) { + /* We don't need a fbo, a simple texture uploading should work. */ + + flag = GLAMOR_CREATE_FBO_NO_FBO; + } + + if ((flag == GLAMOR_CREATE_FBO_NO_FBO + && pixmap_priv->base.fbo && pixmap_priv->base.fbo->tex) + || (flag == 0 && pixmap_priv->base.fbo && pixmap_priv->base.fbo->fb)) + return 0; + + if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) + iformat = gl_iformat_for_pixmap(pixmap); + else + iformat = format; + + if (!glamor_pixmap_ensure_fbo(pixmap, iformat, flag)) + return -1; + + return 0; +} + +/* + * upload sub region to a large region. + * */ +static void +glamor_put_bits(char *dst_bits, int dst_stride, char *src_bits, + int src_stride, int bpp, int x, int y, int w, int h) +{ + int j; + int byte_per_pixel; + + byte_per_pixel = bpp / 8; + src_bits += y * src_stride + (x * byte_per_pixel); + + for (j = y; j < y + h; j++) { + memcpy(dst_bits, src_bits, w * byte_per_pixel); + src_bits += src_stride; + dst_bits += dst_stride; + } +} + +/* + * download sub region from a large region. + */ +static void +glamor_get_bits(char *dst_bits, int dst_stride, char *src_bits, + int src_stride, int bpp, int x, int y, int w, int h) +{ + int j; + int byte_per_pixel; + + byte_per_pixel = bpp / 8; + dst_bits += y * dst_stride + x * byte_per_pixel; + + for (j = y; j < y + h; j++) { + memcpy(dst_bits, src_bits, w * byte_per_pixel); + src_bits += src_stride; + dst_bits += dst_stride; + } +} + +Bool +glamor_upload_sub_pixmap_to_texture(PixmapPtr pixmap, int x, int y, int w, + int h, int stride, void *bits, int pbo) +{ + GLenum format, type; + int no_alpha, revert, swap_rb; + glamor_pixmap_private *pixmap_priv; + Bool force_clip; + + if (glamor_get_tex_format_type_from_pixmap(pixmap, + &format, + &type, + &no_alpha, + &revert, &swap_rb, 1)) { + glamor_fallback("Unknown pixmap depth %d.\n", pixmap->drawable.depth); + return FALSE; + } + if (glamor_pixmap_upload_prepare(pixmap, format, no_alpha, revert, swap_rb)) + return FALSE; + + pixmap_priv = glamor_get_pixmap_private(pixmap); + force_clip = pixmap_priv->base.glamor_priv->gl_flavor != GLAMOR_GL_DESKTOP + && !glamor_check_fbo_size(pixmap_priv->base.glamor_priv, w, h); + + if (pixmap_priv->type == GLAMOR_TEXTURE_LARGE || force_clip) { + RegionRec region; + BoxRec box; + int n_region; + glamor_pixmap_clipped_regions *clipped_regions; + void *sub_bits; + int i, j; + + sub_bits = malloc(h * stride); + if (sub_bits == NULL) + return FALSE; + box.x1 = x; + box.y1 = y; + box.x2 = x + w; + box.y2 = y + h; + RegionInitBoxes(®ion, &box, 1); + if (!force_clip) + clipped_regions = + glamor_compute_clipped_regions(pixmap_priv, ®ion, &n_region, + 0, 0, 0); + else + clipped_regions = + glamor_compute_clipped_regions_ext(pixmap_priv, ®ion, + &n_region, + pixmap_priv->large.block_w, + pixmap_priv->large.block_h, + 0, + 0); + DEBUGF("prepare upload %dx%d to a large pixmap %p\n", w, h, pixmap); + for (i = 0; i < n_region; i++) { + BoxPtr boxes; + int nbox; + int temp_stride; + void *temp_bits; + + assert(pbo == 0); + + SET_PIXMAP_FBO_CURRENT(pixmap_priv, clipped_regions[i].block_idx); + + boxes = RegionRects(clipped_regions[i].region); + nbox = RegionNumRects(clipped_regions[i].region); + DEBUGF("split to %d boxes\n", nbox); + for (j = 0; j < nbox; j++) { + temp_stride = PixmapBytePad(boxes[j].x2 - boxes[j].x1, + pixmap->drawable.depth); + + if (boxes[j].x1 == x && temp_stride == stride) { + temp_bits = (char *) bits + (boxes[j].y1 - y) * stride; + } + else { + temp_bits = sub_bits; + glamor_put_bits(temp_bits, temp_stride, bits, stride, + pixmap->drawable.bitsPerPixel, + boxes[j].x1 - x, boxes[j].y1 - y, + boxes[j].x2 - boxes[j].x1, + boxes[j].y2 - boxes[j].y1); + } + DEBUGF("upload x %d y %d w %d h %d temp stride %d \n", + boxes[j].x1 - x, boxes[j].y1 - y, + boxes[j].x2 - boxes[j].x1, + boxes[j].y2 - boxes[j].y1, temp_stride); + if (_glamor_upload_bits_to_pixmap_texture + (pixmap, format, type, no_alpha, revert, swap_rb, + boxes[j].x1, boxes[j].y1, boxes[j].x2 - boxes[j].x1, + boxes[j].y2 - boxes[j].y1, temp_stride, temp_bits, + pbo) == FALSE) { + RegionUninit(®ion); + free(sub_bits); + assert(0); + return FALSE; + } + } + RegionDestroy(clipped_regions[i].region); + } + free(sub_bits); + free(clipped_regions); + RegionUninit(®ion); + return TRUE; + } + else + return _glamor_upload_bits_to_pixmap_texture(pixmap, format, type, + no_alpha, revert, swap_rb, + x, y, w, h, stride, bits, + pbo); +} + +enum glamor_pixmap_status +glamor_upload_pixmap_to_texture(PixmapPtr pixmap) +{ + glamor_pixmap_private *pixmap_priv; + void *data; + int pbo; + int ret; + + pixmap_priv = glamor_get_pixmap_private(pixmap); + + if ((pixmap_priv->base.fbo) + && (pixmap_priv->base.fbo->pbo_valid)) { + data = NULL; + pbo = pixmap_priv->base.fbo->pbo; + } + else { + data = pixmap->devPrivate.ptr; + pbo = 0; + } + + if (glamor_upload_sub_pixmap_to_texture(pixmap, 0, 0, + pixmap->drawable.width, + pixmap->drawable.height, + pixmap->devKind, data, pbo)) + ret = GLAMOR_UPLOAD_DONE; + else + ret = GLAMOR_UPLOAD_FAILED; + + return ret; +} + +void +glamor_restore_pixmap_to_texture(PixmapPtr pixmap) +{ + if (glamor_upload_pixmap_to_texture(pixmap) != GLAMOR_UPLOAD_DONE) + LogMessage(X_WARNING, "Failed to restore pixmap to texture.\n"); +} + +/* + * as gles2 only support a very small set of color format and + * type when do glReadPixel, + * Before we use glReadPixels to get back a textured pixmap, + * Use shader to convert it to a supported format and thus + * get a new temporary pixmap returned. + * */ + +glamor_pixmap_fbo * +glamor_es2_pixmap_read_prepare(PixmapPtr source, int x, int y, int w, int h, + GLenum format, GLenum type, int no_alpha, + int revert, int swap_rb) +{ + glamor_pixmap_private *source_priv; + glamor_screen_private *glamor_priv; + ScreenPtr screen; + glamor_pixmap_fbo *temp_fbo; + float temp_xscale, temp_yscale, source_xscale, source_yscale; + static float vertices[8]; + static float texcoords[8]; + + screen = source->drawable.pScreen; + + glamor_priv = glamor_get_screen_private(screen); + source_priv = glamor_get_pixmap_private(source); + temp_fbo = glamor_create_fbo(glamor_priv, w, h, format, 0); + if (temp_fbo == NULL) + return NULL; + + glamor_make_current(glamor_priv); + temp_xscale = 1.0 / w; + temp_yscale = 1.0 / h; + + glamor_set_normalize_vcoords((struct glamor_pixmap_private *) NULL, + temp_xscale, temp_yscale, 0, 0, w, h, + glamor_priv->yInverted, vertices); + + glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT, GL_FALSE, + 2 * sizeof(float), vertices); + glEnableVertexAttribArray(GLAMOR_VERTEX_POS); + + pixmap_priv_get_scale(source_priv, &source_xscale, &source_yscale); + glamor_set_normalize_tcoords(source_priv, source_xscale, + source_yscale, + x, y, + x + w, y + h, + glamor_priv->yInverted, texcoords); + + glVertexAttribPointer(GLAMOR_VERTEX_SOURCE, 2, GL_FLOAT, GL_FALSE, + 2 * sizeof(float), texcoords); + glEnableVertexAttribArray(GLAMOR_VERTEX_SOURCE); + + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D, source_priv->base.fbo->tex); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + + glamor_set_destination_pixmap_fbo(temp_fbo, 0, 0, w, h); + glUseProgram(glamor_priv->finish_access_prog[no_alpha]); + glUniform1i(glamor_priv->finish_access_revert[no_alpha], revert); + glUniform1i(glamor_priv->finish_access_swap_rb[no_alpha], swap_rb); + + glDrawArrays(GL_TRIANGLE_FAN, 0, 4); + + glDisableVertexAttribArray(GLAMOR_VERTEX_POS); + glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE); + return temp_fbo; +} + +/* + * Download a sub region of pixmap to a specified memory region. + * The pixmap must have a valid FBO, otherwise return a NULL. + * */ + +static void * +_glamor_download_sub_pixmap_to_cpu(PixmapPtr pixmap, GLenum format, + GLenum type, int no_alpha, + int revert, int swap_rb, + int x, int y, int w, int h, + int stride, void *bits, int pbo, + glamor_access_t access) +{ + glamor_pixmap_private *pixmap_priv; + GLenum gl_access = 0, gl_usage = 0; + void *data, *read; + glamor_screen_private *glamor_priv = + glamor_get_screen_private(pixmap->drawable.pScreen); + glamor_pixmap_fbo *temp_fbo = NULL; + int need_post_conversion = 0; + int need_free_data = 0; + int fbo_x_off, fbo_y_off; + + data = bits; + pixmap_priv = glamor_get_pixmap_private(pixmap); + if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv)) + return NULL; + + switch (access) { + case GLAMOR_ACCESS_RO: + gl_access = GL_READ_ONLY; + gl_usage = GL_STREAM_READ; + break; + case GLAMOR_ACCESS_RW: + gl_access = GL_READ_WRITE; + gl_usage = GL_DYNAMIC_DRAW; + break; + default: + ErrorF("Glamor: Invalid access code. %d\n", access); + assert(0); + } + + glamor_make_current(glamor_priv); + glamor_set_destination_pixmap_priv_nc(pixmap_priv); + + need_post_conversion = (revert > REVERT_NORMAL); + if (need_post_conversion) { + if (pixmap->drawable.depth == 1) { + int temp_stride; + + temp_stride = (((w * 8 + 7) / 8) + 3) & ~3; + data = malloc(temp_stride * h); + if (data == NULL) + return NULL; + need_free_data = 1; + } + } + + pixmap_priv_get_fbo_off(pixmap_priv, &fbo_x_off, &fbo_y_off); + + if (glamor_priv->gl_flavor == GLAMOR_GL_ES2 + && !need_post_conversion + && (swap_rb != SWAP_NONE_DOWNLOADING || revert != REVERT_NONE)) { + if (!(temp_fbo = glamor_es2_pixmap_read_prepare(pixmap, x, y, w, h, + format, type, no_alpha, + revert, swap_rb))) { + free(data); + return NULL; + } + x = 0; + y = 0; + fbo_x_off = 0; + fbo_y_off = 0; + } + + glPixelStorei(GL_PACK_ALIGNMENT, 4); + + if (glamor_priv->has_pack_invert || glamor_priv->yInverted) { + + if (!glamor_priv->yInverted) { + assert(glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP); + glPixelStorei(GL_PACK_INVERT_MESA, 1); + } + + if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP && data == NULL) { + assert(pbo > 0); + glBindBuffer(GL_PIXEL_PACK_BUFFER, pbo); + glBufferData(GL_PIXEL_PACK_BUFFER, stride * h, NULL, gl_usage); + } + + glReadPixels(x + fbo_x_off, y + fbo_y_off, w, h, format, type, data); + + if (!glamor_priv->yInverted) { + assert(glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP); + glPixelStorei(GL_PACK_INVERT_MESA, 0); + } + if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP && bits == NULL) { + bits = glMapBuffer(GL_PIXEL_PACK_BUFFER, gl_access); + glBindBuffer(GL_PIXEL_PACK_BUFFER, 0); + } + } + else { + unsigned int temp_pbo; + int yy; + + glamor_make_current(glamor_priv); + glGenBuffers(1, &temp_pbo); + glBindBuffer(GL_PIXEL_PACK_BUFFER, temp_pbo); + glBufferData(GL_PIXEL_PACK_BUFFER, stride * h, NULL, GL_STREAM_READ); + glReadPixels(x + fbo_x_off, y + fbo_y_off, w, h, format, type, 0); + read = glMapBuffer(GL_PIXEL_PACK_BUFFER, GL_READ_ONLY); + for (yy = 0; yy < pixmap->drawable.height; yy++) + memcpy((char *) data + yy * stride, + (char *) read + (h - yy - 1) * stride, stride); + glUnmapBuffer(GL_PIXEL_PACK_BUFFER); + glBindBuffer(GL_PIXEL_PACK_BUFFER, 0); + glDeleteBuffers(1, &temp_pbo); + } + + glBindFramebuffer(GL_FRAMEBUFFER, 0); + + if (need_post_conversion) { + /* As OpenGL desktop version never enters here. + * Don't need to consider if the pbo is valid.*/ + bits = glamor_color_convert_to_bits(data, bits, + w, h, + stride, no_alpha, revert, swap_rb); + } + + if (temp_fbo != NULL) + glamor_destroy_fbo(temp_fbo); + if (need_free_data) + free(data); + + return bits; +} + +void * +glamor_download_sub_pixmap_to_cpu(PixmapPtr pixmap, int x, int y, int w, int h, + int stride, void *bits, int pbo, + glamor_access_t access) +{ + GLenum format, type; + int no_alpha, revert, swap_rb; + glamor_pixmap_private *pixmap_priv; + Bool force_clip; + + if (glamor_get_tex_format_type_from_pixmap(pixmap, + &format, + &type, + &no_alpha, + &revert, &swap_rb, 0)) { + glamor_fallback("Unknown pixmap depth %d.\n", pixmap->drawable.depth); + return NULL; + } + + pixmap_priv = glamor_get_pixmap_private(pixmap); + if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv)) + return NULL; + + force_clip = pixmap_priv->base.glamor_priv->gl_flavor != GLAMOR_GL_DESKTOP + && !glamor_check_fbo_size(pixmap_priv->base.glamor_priv, w, h); + + if (pixmap_priv->type == GLAMOR_TEXTURE_LARGE || force_clip) { + + RegionRec region; + BoxRec box; + int n_region; + glamor_pixmap_clipped_regions *clipped_regions; + void *sub_bits; + int i, j; + + sub_bits = malloc(h * stride); + if (sub_bits == NULL) + return FALSE; + box.x1 = x; + box.y1 = y; + box.x2 = x + w; + box.y2 = y + h; + RegionInitBoxes(®ion, &box, 1); + + if (!force_clip) + clipped_regions = + glamor_compute_clipped_regions(pixmap_priv, ®ion, &n_region, + 0, 0, 0); + else + clipped_regions = + glamor_compute_clipped_regions_ext(pixmap_priv, ®ion, + &n_region, + pixmap_priv->large.block_w, + pixmap_priv->large.block_h, + 0, + 0); + + DEBUGF("start download large pixmap %p %dx%d \n", pixmap, w, h); + for (i = 0; i < n_region; i++) { + BoxPtr boxes; + int nbox; + int temp_stride; + void *temp_bits; + + assert(pbo == 0); + SET_PIXMAP_FBO_CURRENT(pixmap_priv, clipped_regions[i].block_idx); + + boxes = RegionRects(clipped_regions[i].region); + nbox = RegionNumRects(clipped_regions[i].region); + for (j = 0; j < nbox; j++) { + temp_stride = PixmapBytePad(boxes[j].x2 - boxes[j].x1, + pixmap->drawable.depth); + + if (boxes[j].x1 == x && temp_stride == stride) { + temp_bits = (char *) bits + (boxes[j].y1 - y) * stride; + } + else { + temp_bits = sub_bits; + } + DEBUGF("download x %d y %d w %d h %d temp stride %d \n", + boxes[j].x1, boxes[j].y1, + boxes[j].x2 - boxes[j].x1, + boxes[j].y2 - boxes[j].y1, temp_stride); + + /* For large pixmap, we don't support pbo currently. */ + assert(pbo == 0); + if (_glamor_download_sub_pixmap_to_cpu + (pixmap, format, type, no_alpha, revert, swap_rb, + boxes[j].x1, boxes[j].y1, boxes[j].x2 - boxes[j].x1, + boxes[j].y2 - boxes[j].y1, temp_stride, temp_bits, pbo, + access) == FALSE) { + RegionUninit(®ion); + free(sub_bits); + assert(0); + return NULL; + } + if (boxes[j].x1 != x || temp_stride != stride) + glamor_get_bits(bits, stride, temp_bits, temp_stride, + pixmap->drawable.bitsPerPixel, + boxes[j].x1 - x, boxes[j].y1 - y, + boxes[j].x2 - boxes[j].x1, + boxes[j].y2 - boxes[j].y1); + } + + RegionDestroy(clipped_regions[i].region); + } + free(sub_bits); + free(clipped_regions); + RegionUninit(®ion); + return bits; + } + else + return _glamor_download_sub_pixmap_to_cpu(pixmap, format, type, + no_alpha, revert, swap_rb, x, + y, w, h, stride, bits, pbo, + access); +} + +/** + * Move a pixmap to CPU memory. + * The input data is the pixmap's fbo. + * The output data is at pixmap->devPrivate.ptr. We always use pbo + * to read the fbo and then map it to va. If possible, we will use + * it directly as devPrivate.ptr. + * If successfully download a fbo to cpu then return TRUE. + * Otherwise return FALSE. + **/ +Bool +glamor_download_pixmap_to_cpu(PixmapPtr pixmap, glamor_access_t access) +{ + glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap); + unsigned int stride; + void *data = NULL, *dst; + glamor_screen_private *glamor_priv = + glamor_get_screen_private(pixmap->drawable.pScreen); + int pbo = 0; + + if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv)) + return TRUE; + + glamor_debug_output(GLAMOR_DEBUG_TEXTURE_DOWNLOAD, + "Downloading pixmap %p %dx%d depth%d\n", + pixmap, + pixmap->drawable.width, + pixmap->drawable.height, pixmap->drawable.depth); + + stride = pixmap->devKind; + + if (glamor_priv->gl_flavor == GLAMOR_GL_ES2 + || (!glamor_priv->has_pack_invert && !glamor_priv->yInverted) + || pixmap_priv->type == GLAMOR_TEXTURE_LARGE) { + data = malloc(stride * pixmap->drawable.height); + } + else { + glamor_make_current(glamor_priv); + if (pixmap_priv->base.fbo->pbo == 0) + glGenBuffers(1, &pixmap_priv->base.fbo->pbo); + pbo = pixmap_priv->base.fbo->pbo; + } + + if (pixmap_priv->type == GLAMOR_TEXTURE_DRM) { + stride = PixmapBytePad(pixmap->drawable.width, pixmap->drawable.depth); + pixmap_priv->base.drm_stride = pixmap->devKind; + pixmap->devKind = stride; + } + + dst = glamor_download_sub_pixmap_to_cpu(pixmap, 0, 0, + pixmap->drawable.width, + pixmap->drawable.height, + pixmap->devKind, data, pbo, access); + + if (!dst) { + if (data) + free(data); + return FALSE; + } + + if (pbo != 0) + pixmap_priv->base.fbo->pbo_valid = 1; + + pixmap_priv->base.gl_fbo = GLAMOR_FBO_DOWNLOADED; + + pixmap->devPrivate.ptr = dst; + + return TRUE; +} + +/* fixup a fbo to the exact size as the pixmap. */ +/* XXX LARGE pixmap? */ +Bool +glamor_fixup_pixmap_priv(ScreenPtr screen, glamor_pixmap_private *pixmap_priv) +{ + glamor_pixmap_fbo *old_fbo; + glamor_pixmap_fbo *new_fbo = NULL; + PixmapPtr scratch = NULL; + glamor_pixmap_private *scratch_priv; + DrawablePtr drawable; + GCPtr gc = NULL; + int ret = FALSE; + + drawable = &pixmap_priv->base.pixmap->drawable; + + if (!GLAMOR_PIXMAP_FBO_NOT_EXACT_SIZE(pixmap_priv)) + return TRUE; + + old_fbo = pixmap_priv->base.fbo; + + if (!old_fbo) + return FALSE; + + gc = GetScratchGC(drawable->depth, screen); + if (!gc) + goto fail; + + scratch = glamor_create_pixmap(screen, drawable->width, drawable->height, + drawable->depth, GLAMOR_CREATE_PIXMAP_FIXUP); + + scratch_priv = glamor_get_pixmap_private(scratch); + + if (!scratch_priv->base.fbo) + goto fail; + + ValidateGC(&scratch->drawable, gc); + glamor_copy_area(drawable, + &scratch->drawable, + gc, 0, 0, drawable->width, drawable->height, 0, 0); + old_fbo = glamor_pixmap_detach_fbo(pixmap_priv); + new_fbo = glamor_pixmap_detach_fbo(scratch_priv); + glamor_pixmap_attach_fbo(pixmap_priv->base.pixmap, new_fbo); + glamor_pixmap_attach_fbo(scratch, old_fbo); + + DEBUGF("old %dx%d type %d\n", + drawable->width, drawable->height, pixmap_priv->type); + DEBUGF("copy tex %d %dx%d to tex %d %dx%d \n", + old_fbo->tex, old_fbo->width, old_fbo->height, new_fbo->tex, + new_fbo->width, new_fbo->height); + ret = TRUE; + fail: + if (gc) + FreeScratchGC(gc); + if (scratch) + glamor_destroy_pixmap(scratch); + + return ret; +} + +/* + * We may use this function to reduce a large pixmap to a small sub + * pixmap. Two scenarios currently: + * 1. When fallback a large textured pixmap to CPU but we do need to + * do rendering within a small sub region, then we can just get a + * sub region. + * + * 2. When uploading a large pixmap to texture but we only need to + * use part of the source/mask picture. As glTexImage2D will be more + * efficient to upload a contingent region rather than a sub block + * in a large buffer. We use this function to gather the sub region + * to a contingent sub pixmap. + * + * The sub-pixmap must have the same format as the source pixmap. + * + * */ +PixmapPtr +glamor_get_sub_pixmap(PixmapPtr pixmap, int x, int y, int w, int h, + glamor_access_t access) +{ + glamor_screen_private *glamor_priv; + PixmapPtr sub_pixmap; + glamor_pixmap_private *sub_pixmap_priv, *pixmap_priv; + void *data; + int pbo; + int flag; + + if (x < 0 || y < 0) + return NULL; + w = (x + w) > pixmap->drawable.width ? (pixmap->drawable.width - x) : w; + h = (y + h) > pixmap->drawable.height ? (pixmap->drawable.height - y) : h; + + glamor_priv = glamor_get_screen_private(pixmap->drawable.pScreen); + pixmap_priv = glamor_get_pixmap_private(pixmap); + + if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv)) + return NULL; + if (glamor_priv->gl_flavor == GLAMOR_GL_ES2 || + pixmap_priv->type == GLAMOR_TEXTURE_LARGE) + flag = GLAMOR_CREATE_PIXMAP_CPU; + else + flag = GLAMOR_CREATE_PIXMAP_MAP; + + sub_pixmap = glamor_create_pixmap(pixmap->drawable.pScreen, w, h, + pixmap->drawable.depth, flag); + + if (sub_pixmap == NULL) + return NULL; + + sub_pixmap_priv = glamor_get_pixmap_private(sub_pixmap); + pbo = + sub_pixmap_priv ? (sub_pixmap_priv->base.fbo ? sub_pixmap_priv->base. + fbo->pbo : 0) : 0; + + if (pixmap_priv->base.is_picture) { + sub_pixmap_priv->base.picture = pixmap_priv->base.picture; + sub_pixmap_priv->base.is_picture = pixmap_priv->base.is_picture; + } + + if (pbo) + data = NULL; + else + data = sub_pixmap->devPrivate.ptr; + + data = + glamor_download_sub_pixmap_to_cpu(pixmap, x, y, w, h, + sub_pixmap->devKind, data, pbo, + access); + if (data == NULL) { + fbDestroyPixmap(sub_pixmap); + return NULL; + } + if (pbo) { + assert(sub_pixmap->devPrivate.ptr == NULL); + sub_pixmap->devPrivate.ptr = data; + sub_pixmap_priv->base.fbo->pbo_valid = 1; + } +#if 0 + struct pixman_box16 box; + PixmapPtr new_sub_pixmap; + int dx, dy; + + box.x1 = 0; + box.y1 = 0; + box.x2 = w; + box.y2 = h; + + dx = x; + dy = y; + + new_sub_pixmap = glamor_create_pixmap(pixmap->drawable.pScreen, w, h, + pixmap->drawable.depth, + GLAMOR_CREATE_PIXMAP_CPU); + glamor_copy_n_to_n(&pixmap->drawable, &new_sub_pixmap->drawable, NULL, &box, + 1, dx, dy, 0, 0, 0, NULL); + glamor_compare_pixmaps(new_sub_pixmap, sub_pixmap, 0, 0, w, h, 1, 1); +#endif + + return sub_pixmap; +} + +void +glamor_put_sub_pixmap(PixmapPtr sub_pixmap, PixmapPtr pixmap, int x, int y, + int w, int h, glamor_access_t access) +{ + void *bits; + int pbo; + glamor_pixmap_private *sub_pixmap_priv; + + if (access != GLAMOR_ACCESS_RO) { + sub_pixmap_priv = glamor_get_pixmap_private(sub_pixmap); + if (sub_pixmap_priv->base.fbo && sub_pixmap_priv->base.fbo->pbo_valid) { + bits = NULL; + pbo = sub_pixmap_priv->base.fbo->pbo; + } + else { + bits = sub_pixmap->devPrivate.ptr; + pbo = 0; + } + + assert(x >= 0 && y >= 0); + w = (w > sub_pixmap->drawable.width) ? sub_pixmap->drawable.width : w; + h = (h > sub_pixmap->drawable.height) ? sub_pixmap->drawable.height : h; + glamor_upload_sub_pixmap_to_texture(pixmap, x, y, w, h, + sub_pixmap->devKind, bits, pbo); + } + glamor_destroy_pixmap(sub_pixmap); +} diff --git a/xserver/glamor/glamor_points.c b/xserver/glamor/glamor_points.c new file mode 100644 index 000000000..d4525e294 --- /dev/null +++ b/xserver/glamor/glamor_points.c @@ -0,0 +1,141 @@ +/* + * Copyright © 2009 Intel Corporation + * Copyright © 1998 Keith Packard + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Authors: + * Zhigang Gong <zhigang.gong@linux.intel.com> + * + */ + +#include "glamor_priv.h" +#include "glamor_transform.h" + +static const glamor_facet glamor_facet_point = { + .name = "poly_point", + .vs_vars = "attribute vec2 primitive;\n", + .vs_exec = GLAMOR_POS(gl_Position, primitive), +}; + +static Bool +glamor_poly_point_gl(DrawablePtr drawable, GCPtr gc, int mode, int npt, DDXPointPtr ppt) +{ + ScreenPtr screen = drawable->pScreen; + glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); + PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable); + glamor_program *prog = &glamor_priv->point_prog; + glamor_pixmap_private *pixmap_priv; + int off_x, off_y; + GLshort *vbo_ppt; + char *vbo_offset; + int box_x, box_y; + + pixmap_priv = glamor_get_pixmap_private(pixmap); + if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv)) + goto bail; + + glamor_make_current(glamor_priv); + + if (prog->failed) + goto bail_ctx; + + if (!prog->prog) { + if (!glamor_build_program(screen, prog, + &glamor_facet_point, + &glamor_fill_solid)) + goto bail_ctx; + } + + if (!glamor_use_program(pixmap, gc, prog, NULL)) + goto bail_ctx; + + vbo_ppt = glamor_get_vbo_space(screen, npt * (2 * sizeof (INT16)), &vbo_offset); + glEnableVertexAttribArray(GLAMOR_VERTEX_POS); + glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_SHORT, GL_FALSE, 0, vbo_offset); + if (mode == CoordModePrevious) { + int n = npt; + INT16 x = 0, y = 0; + while (n--) { + vbo_ppt[0] = (x += ppt->x); + vbo_ppt[1] = (y += ppt->y); + vbo_ppt += 2; + ppt++; + } + } else + memcpy(vbo_ppt, ppt, npt * (2 * sizeof (INT16))); + glamor_put_vbo_space(screen); + + glEnable(GL_SCISSOR_TEST); + + glamor_pixmap_loop(pixmap_priv, box_x, box_y) { + int nbox = RegionNumRects(gc->pCompositeClip); + BoxPtr box = RegionRects(gc->pCompositeClip); + + glamor_set_destination_drawable(drawable, box_x, box_y, TRUE, TRUE, prog->matrix_uniform, &off_x, &off_y); + + while (nbox--) { + glScissor(box->x1 + off_x, + box->y1 + off_y, + box->x2 - box->x1, + box->y2 - box->y1); + box++; + glDrawArrays(GL_POINTS, 0, npt); + } + } + + glDisable(GL_SCISSOR_TEST); + glDisable(GL_COLOR_LOGIC_OP); + glDisableVertexAttribArray(GLAMOR_VERTEX_POS); + + glamor_priv->state = RENDER_STATE; + glamor_priv->render_idle_cnt = 0; + + return TRUE; + +bail_ctx: + glDisable(GL_COLOR_LOGIC_OP); +bail: + return FALSE; +} + +void +glamor_poly_point(DrawablePtr drawable, GCPtr gc, int mode, int npt, + DDXPointPtr ppt) +{ + if (glamor_poly_point_gl(drawable, gc, mode, npt, ppt)) + return; + miPolyPoint(drawable, gc, mode, npt, ppt); +} + +Bool +glamor_poly_point_nf(DrawablePtr drawable, GCPtr gc, int mode, int npt, + DDXPointPtr ppt) +{ + if (glamor_poly_point_gl(drawable, gc, mode, npt, ppt)) + return TRUE; + + if (glamor_ddx_fallback_check_pixmap(drawable) && glamor_ddx_fallback_check_gc(gc)) + return FALSE; + + miPolyPoint(drawable, gc, mode, npt, ppt); + return TRUE; +} + diff --git a/xserver/glamor/glamor_polylines.c b/xserver/glamor/glamor_polylines.c new file mode 100644 index 000000000..1adf45ddc --- /dev/null +++ b/xserver/glamor/glamor_polylines.c @@ -0,0 +1,136 @@ +/* + * Copyright © 2009 Intel Corporation + * Copyright © 1998 Keith Packard + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Authors: + * Eric Anholt <eric@anholt.net> + * + */ + +#include "glamor_priv.h" + +/** @file glamor_polylines.c + * + * GC PolyFillRect implementation, taken straight from fb_fill.c + */ + +/** + * glamor_poly_lines() checks if it can accelerate the lines as a group of + * horizontal or vertical lines (rectangles), and uses existing rectangle fill + * acceleration if so. + */ +static Bool +_glamor_poly_lines(DrawablePtr drawable, GCPtr gc, int mode, int n, + DDXPointPtr points, Bool fallback) +{ + xRectangle *rects; + int x1, x2, y1, y2; + int i; + + /* Don't try to do wide lines or non-solid fill style. */ + if (gc->lineWidth != 0) { + /* This ends up in miSetSpans, which is accelerated as well as we + * can hope X wide lines will be. + */ + goto fail; + } + + if (gc->lineStyle != LineSolid) { + glamor_fallback("non-solid fill line style %d\n", gc->lineStyle); + goto fail; + } + rects = malloc(sizeof(xRectangle) * (n - 1)); + x1 = points[0].x; + y1 = points[0].y; + /* If we have any non-horizontal/vertical, fall back. */ + for (i = 0; i < n - 1; i++) { + if (mode == CoordModePrevious) { + x2 = x1 + points[i + 1].x; + y2 = y1 + points[i + 1].y; + } + else { + x2 = points[i + 1].x; + y2 = points[i + 1].y; + } + if (x1 != x2 && y1 != y2) { + free(rects); + glamor_fallback("stub diagonal poly_line\n"); + goto fail; + } + if (x1 < x2) { + rects[i].x = x1; + rects[i].width = x2 - x1 + 1; + } + else { + rects[i].x = x2; + rects[i].width = x1 - x2 + 1; + } + if (y1 < y2) { + rects[i].y = y1; + rects[i].height = y2 - y1 + 1; + } + else { + rects[i].y = y2; + rects[i].height = y1 - y2 + 1; + } + + x1 = x2; + y1 = y2; + } + gc->ops->PolyFillRect(drawable, gc, n - 1, rects); + free(rects); + return TRUE; + + fail: + if (!fallback && glamor_ddx_fallback_check_pixmap(drawable) + && glamor_ddx_fallback_check_gc(gc)) + return FALSE; + + switch (gc->lineStyle) { + case LineSolid: + if (gc->lineWidth == 0) + miZeroLine(drawable, gc, mode, n, points); + else + miWideLine(drawable, gc, mode, n, points); + break; + case LineOnOffDash: + case LineDoubleDash: + miWideDash(drawable, gc, mode, n, points); + break; + } + + return TRUE; +} + +void +glamor_poly_lines(DrawablePtr drawable, GCPtr gc, int mode, int n, + DDXPointPtr points) +{ + _glamor_poly_lines(drawable, gc, mode, n, points, TRUE); +} + +Bool +glamor_poly_lines_nf(DrawablePtr drawable, GCPtr gc, int mode, int n, + DDXPointPtr points) +{ + return _glamor_poly_lines(drawable, gc, mode, n, points, FALSE); +} diff --git a/xserver/glamor/glamor_priv.h b/xserver/glamor/glamor_priv.h new file mode 100644 index 000000000..c56c55973 --- /dev/null +++ b/xserver/glamor/glamor_priv.h @@ -0,0 +1,1056 @@ +/* + * Copyright © 2008 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Authors: + * Eric Anholt <eric@anholt.net> + * + */ +#ifndef GLAMOR_PRIV_H +#define GLAMOR_PRIV_H + +#include "dix-config.h" + +#include <xorg-server.h> +#include "glamor.h" + +#include <epoxy/gl.h> +#if GLAMOR_HAS_GBM +#define MESA_EGL_NO_X11_HEADERS +#include <epoxy/egl.h> +#endif + +#define GLAMOR_DEFAULT_PRECISION \ + "#ifdef GL_ES\n" \ + "precision mediump float;\n" \ + "#endif\n" + +#ifdef RENDER +#include "glyphstr.h" +#endif + +#include "glamor_debug.h" +#include "glamor_context.h" +#include "glamor_program.h" + +#include <list.h> + +struct glamor_pixmap_private; + +typedef struct glamor_composite_shader { + GLuint prog; + GLint dest_to_dest_uniform_location; + GLint dest_to_source_uniform_location; + GLint dest_to_mask_uniform_location; + GLint source_uniform_location; + GLint mask_uniform_location; + GLint source_wh; + GLint mask_wh; + GLint source_repeat_mode; + GLint mask_repeat_mode; + union { + float source_solid_color[4]; + struct { + struct glamor_pixmap_private *source_priv; + PicturePtr source; + }; + }; + + union { + float mask_solid_color[4]; + struct { + struct glamor_pixmap_private *mask_priv; + PicturePtr mask; + }; + }; +} glamor_composite_shader; + +enum shader_source { + SHADER_SOURCE_SOLID, + SHADER_SOURCE_TEXTURE, + SHADER_SOURCE_TEXTURE_ALPHA, + SHADER_SOURCE_COUNT, +}; + +enum shader_mask { + SHADER_MASK_NONE, + SHADER_MASK_SOLID, + SHADER_MASK_TEXTURE, + SHADER_MASK_TEXTURE_ALPHA, + SHADER_MASK_COUNT, +}; + +enum shader_in { + SHADER_IN_SOURCE_ONLY, + SHADER_IN_NORMAL, + SHADER_IN_CA_SOURCE, + SHADER_IN_CA_ALPHA, + SHADER_IN_COUNT, +}; + +struct shader_key { + enum shader_source source; + enum shader_mask mask; + enum shader_in in; +}; + +struct blendinfo { + Bool dest_alpha; + Bool source_alpha; + GLenum source_blend; + GLenum dest_blend; +}; + +typedef struct { + INT16 x_src; + INT16 y_src; + INT16 x_mask; + INT16 y_mask; + INT16 x_dst; + INT16 y_dst; + INT16 width; + INT16 height; +} glamor_composite_rect_t; + +enum glamor_vertex_type { + GLAMOR_VERTEX_POS, + GLAMOR_VERTEX_SOURCE, + GLAMOR_VERTEX_MASK +}; + +enum gradient_shader { + SHADER_GRADIENT_LINEAR, + SHADER_GRADIENT_RADIAL, + SHADER_GRADIENT_CONICAL, + SHADER_GRADIENT_COUNT, +}; + +struct glamor_screen_private; +struct glamor_pixmap_private; + +enum glamor_gl_flavor { + GLAMOR_GL_DESKTOP, // OPENGL API + GLAMOR_GL_ES2 // OPENGL ES2.0 API +}; + +#define GLAMOR_NUM_GLYPH_CACHE_FORMATS 2 + +#define GLAMOR_COMPOSITE_VBO_VERT_CNT (64*1024) + +typedef struct { + PicturePtr picture; /* Where the glyphs of the cache are stored */ + GlyphPtr *glyphs; + uint16_t count; + uint16_t evict; +} glamor_glyph_cache_t; + +struct glamor_saved_procs { + CloseScreenProcPtr close_screen; + CreateScreenResourcesProcPtr create_screen_resources; + CreateGCProcPtr create_gc; + CreatePixmapProcPtr create_pixmap; + DestroyPixmapProcPtr destroy_pixmap; + GetSpansProcPtr get_spans; + GetImageProcPtr get_image; + CompositeProcPtr composite; + CompositeRectsProcPtr composite_rects; + TrapezoidsProcPtr trapezoids; + GlyphsProcPtr glyphs; + ChangeWindowAttributesProcPtr change_window_attributes; + CopyWindowProcPtr copy_window; + BitmapToRegionProcPtr bitmap_to_region; + TrianglesProcPtr triangles; + AddTrapsProcPtr addtraps; + CreatePictureProcPtr create_picture; + DestroyPictureProcPtr destroy_picture; + UnrealizeGlyphProcPtr unrealize_glyph; + SetWindowPixmapProcPtr set_window_pixmap; +}; + +#define CACHE_FORMAT_COUNT 3 + +#define CACHE_BUCKET_WCOUNT 4 +#define CACHE_BUCKET_HCOUNT 4 + +#define GLAMOR_TICK_AFTER(t0, t1) \ + (((int)(t1) - (int)(t0)) < 0) + +#define IDLE_STATE 0 +#define RENDER_STATE 1 +#define BLIT_STATE 2 +#define RENDER_IDEL_MAX 32 + +typedef struct glamor_screen_private { + Bool yInverted; + unsigned int tick; + enum glamor_gl_flavor gl_flavor; + int glsl_version; + int has_pack_invert; + int has_fbo_blit; + int has_map_buffer_range; + int has_buffer_storage; + int has_khr_debug; + int max_fbo_size; + + struct xorg_list + fbo_cache[CACHE_FORMAT_COUNT][CACHE_BUCKET_WCOUNT][CACHE_BUCKET_HCOUNT]; + unsigned long fbo_cache_watermark; + + /* glamor_solid */ + GLint solid_prog; + GLint solid_color_uniform_location; + + /* glamor point shader */ + glamor_program point_prog; + + /* glamor spans shaders */ + glamor_program_fill fill_spans_program; + + /* glamor rect shaders */ + glamor_program_fill poly_fill_rect_program; + + /* glamor glyphblt shaders */ + glamor_program_fill poly_glyph_blt_progs; + + /* glamor text shaders */ + glamor_program_fill poly_text_progs; + glamor_program te_text_prog; + glamor_program image_text_prog; + + /* vertext/elment_index buffer object for render */ + GLuint vbo, ebo; + /** Next offset within the VBO that glamor_get_vbo_space() will use. */ + int vbo_offset; + int vbo_size; + /** + * Pointer to glamor_get_vbo_space()'s current VBO mapping. + * + * Note that this is not necessarily equal to the pointer returned + * by glamor_get_vbo_space(), so it can't be used in place of that. + */ + char *vb; + int vb_stride; + Bool has_source_coords, has_mask_coords; + int render_nr_verts; + glamor_composite_shader composite_shader[SHADER_SOURCE_COUNT] + [SHADER_MASK_COUNT] + [SHADER_IN_COUNT]; + glamor_glyph_cache_t glyphCaches[GLAMOR_NUM_GLYPH_CACHE_FORMATS]; + Bool glyph_cache_initialized; + + /* shaders to restore a texture to another texture. */ + GLint finish_access_prog[2]; + GLint finish_access_revert[2]; + GLint finish_access_swap_rb[2]; + + /* glamor_tile */ + GLint tile_prog; + GLint tile_wh; + + /* glamor gradient, 0 for small nstops, 1 for + large nstops and 2 for dynamic generate. */ + GLint gradient_prog[SHADER_GRADIENT_COUNT][3]; + int linear_max_nstops; + int radial_max_nstops; + + /* glamor trapezoid shader. */ + GLint trapezoid_prog; + + PixmapPtr *back_pixmap; + int screen_fbo; + struct glamor_saved_procs saved_procs; + char delayed_fallback_string[GLAMOR_DELAYED_STRING_MAX + 1]; + int delayed_fallback_pending; + int flags; + int state; + unsigned int render_idle_cnt; + ScreenPtr screen; + int dri3_enabled; + + /* xv */ + GLint xv_prog; + + struct glamor_context ctx; +} glamor_screen_private; + +typedef enum glamor_access { + GLAMOR_ACCESS_RO, + GLAMOR_ACCESS_RW, +} glamor_access_t; + +enum glamor_fbo_state { + /** There is no storage attached to the pixmap. */ + GLAMOR_FBO_UNATTACHED, + /** + * The pixmap has FBO storage attached, but devPrivate.ptr doesn't + * point at anything. + */ + GLAMOR_FBO_NORMAL, + /** + * The FBO is present and can be accessed as a linear memory + * mapping through devPrivate.ptr. + */ + GLAMOR_FBO_DOWNLOADED, +}; + +/* glamor_pixmap_fbo: + * @list: to be used to link to the cache pool list. + * @expire: when push to cache pool list, set a expire count. + * will be freed when glamor_priv->tick is equal or + * larger than this expire count in block handler. + * @pbo_valid: The pbo has a valid copy of the pixmap's data. + * @tex: attached texture. + * @fb: attached fbo. + * @pbo: attached pbo. + * @width: width of this fbo. + * @height: height of this fbo. + * @format: internal format of this fbo's texture. + * @type: internal type of this fbo's texture. + * @glamor_priv: point to glamor private data. + */ +typedef struct glamor_pixmap_fbo { + struct xorg_list list; + unsigned int expire; + unsigned char pbo_valid; + GLuint tex; + GLuint fb; + GLuint pbo; + int width; + int height; + GLenum format; + GLenum type; + glamor_screen_private *glamor_priv; +} glamor_pixmap_fbo; + +/* + * glamor_pixmap_private - glamor pixmap's private structure. + * @gl_tex: The pixmap is in a gl texture originally. + * @is_picture: The drawable is attached to a picture. + * @pict_format: the corresponding picture's format. + * @pixmap: The corresponding pixmap's pointer. + * + * For GLAMOR_TEXTURE_LARGE, nbox should larger than 1. + * And the box and fbo will both have nbox elements. + * and box[i] store the relatively coords in this pixmap + * of the fbo[i]. The reason why use boxes not region to + * represent this structure is we may need to use overlapped + * boxes for one pixmap for some special reason. + * + * pixmap + * ****************** + * * fbo0 * fbo1 * + * * * * + * ****************** + * * fbo2 * fbo3 * + * * * * + * ****************** + * + * Let's assume the texture has size of 1024x1024 + * box[0] = {0,0,1024,1024} + * box[1] = {1024,0,2048,2048} + * ... + * + * For GLAMOR_TEXTURE_ATLAS nbox should be 1. And box + * and fbo both has one elements, and the box store + * the relatively coords in the fbo of this pixmap: + * + * fbo + * ****************** + * * pixmap * + * * ********* * + * * * * * + * * ********* * + * * * + * ****************** + * + * Assume the pixmap is at the (100,100) relatively to + * the fbo's origin. + * box[0]={100, 100, 1124, 1124}; + * + * Considering large pixmap is not a normal case, to keep + * it simple, I designe it as the following way. + * When deal with a large pixmap, it split the working + * rectangle into serval boxes, and each box fit into a + * corresponding fbo. And then the rendering function will + * loop from the left-top box to the right-bottom box, + * each time, we will set current box and current fbo + * to the box and fbo elements. Thus the inner routines + * can handle it as normal, only the coords calculation need + * to aware of it's large pixmap. + * + * Currently, we haven't implemented the atlas pixmap. + * + **/ + +typedef struct glamor_pixmap_clipped_regions { + int block_idx; + RegionPtr region; +} glamor_pixmap_clipped_regions; + +#define SET_PIXMAP_FBO_CURRENT(priv, idx) \ + do { \ + if (priv->type == GLAMOR_TEXTURE_LARGE) { \ + (priv)->large.base.fbo = priv->large.fbo_array[idx]; \ + (priv)->large.box = priv->large.box_array[idx]; \ + } \ + } while(0) + +typedef struct glamor_pixmap_private_base { + glamor_pixmap_type_t type; + enum glamor_fbo_state gl_fbo; + /** + * If devPrivate.ptr is non-NULL (meaning we're within + * glamor_prepare_access), determies whether we should re-upload + * that data on glamor_finish_access(). + */ + glamor_access_t map_access; + unsigned char is_picture:1; + unsigned char gl_tex:1; + glamor_pixmap_fbo *fbo; + PixmapPtr pixmap; + BoxRec box; + int drm_stride; + glamor_screen_private *glamor_priv; + PicturePtr picture; +#if GLAMOR_HAS_GBM + EGLImageKHR image; +#endif +} glamor_pixmap_private_base_t; + +/* + * @base.fbo: current fbo. + * @box: current fbo's coords in the whole pixmap. + * @block_w: block width of this large pixmap. + * @block_h: block height of this large pixmap. + * @block_wcnt: block count in one block row. + * @block_hcnt: block count in one block column. + * @nbox: total block count. + * @box_array: contains each block's corresponding box. + * @fbo_array: contains each block's fbo pointer. + * + **/ +typedef struct glamor_pixmap_private_large { + union { + glamor_pixmap_type_t type; + glamor_pixmap_private_base_t base; + }; + BoxRec box; + int block_w; + int block_h; + int block_wcnt; + int block_hcnt; + int nbox; + BoxPtr box_array; + glamor_pixmap_fbo **fbo_array; +} glamor_pixmap_private_large_t; + +/* + * @box: the relative coords in the corresponding fbo. + */ +typedef struct glamor_pixmap_private_atlas { + union { + glamor_pixmap_type_t type; + glamor_pixmap_private_base_t base; + }; + BoxRec box; +} glamor_pixmap_private_atlas_t; + +typedef struct glamor_pixmap_private { + union { + glamor_pixmap_type_t type; + glamor_pixmap_private_base_t base; + glamor_pixmap_private_large_t large; + glamor_pixmap_private_atlas_t atlas; + }; +} glamor_pixmap_private; + +static inline glamor_pixmap_fbo * +glamor_pixmap_fbo_at(glamor_pixmap_private *priv, int x, int y) +{ + if (priv->type == GLAMOR_TEXTURE_LARGE) { + assert(x < priv->large.block_wcnt); + assert(y < priv->large.block_hcnt); + return priv->large.fbo_array[y * priv->large.block_wcnt + x]; + } + assert (x == 0); + assert (y == 0); + return priv->base.fbo; +} + +static inline BoxPtr +glamor_pixmap_box_at(glamor_pixmap_private *priv, int x, int y) +{ + if (priv->type == GLAMOR_TEXTURE_LARGE) { + assert(x < priv->large.block_wcnt); + assert(y < priv->large.block_hcnt); + return &priv->large.box_array[y * priv->large.block_wcnt + x]; + } + assert (x == 0); + assert (y == 0); + return &priv->base.box; +} + +static inline int +glamor_pixmap_wcnt(glamor_pixmap_private *priv) +{ + if (priv->type == GLAMOR_TEXTURE_LARGE) + return priv->large.block_wcnt; + return 1; +} + +static inline int +glamor_pixmap_hcnt(glamor_pixmap_private *priv) +{ + if (priv->type == GLAMOR_TEXTURE_LARGE) + return priv->large.block_hcnt; + return 1; +} + +#define glamor_pixmap_loop(priv, x, y) \ + for (y = 0; y < glamor_pixmap_hcnt(priv); y++) \ + for (x = 0; x < glamor_pixmap_wcnt(priv); x++) + +/* + * Pixmap dynamic status, used by dynamic upload feature. + * + * GLAMOR_NONE: initial status, don't need to do anything. + * GLAMOR_UPLOAD_PENDING: marked as need to be uploaded to gl texture. + * GLAMOR_UPLOAD_DONE: the pixmap has been uploaded successfully. + * GLAMOR_UPLOAD_FAILED: fail to upload the pixmap. + * + * */ +typedef enum glamor_pixmap_status { + GLAMOR_NONE, + GLAMOR_UPLOAD_PENDING, + GLAMOR_UPLOAD_DONE, + GLAMOR_UPLOAD_FAILED +} glamor_pixmap_status_t; + +extern DevPrivateKey glamor_screen_private_key; +extern DevPrivateKey glamor_pixmap_private_key; +static inline glamor_screen_private * +glamor_get_screen_private(ScreenPtr screen) +{ + return (glamor_screen_private *) + dixLookupPrivate(&screen->devPrivates, glamor_screen_private_key); +} + +static inline void +glamor_set_screen_private(ScreenPtr screen, glamor_screen_private *priv) +{ + dixSetPrivate(&screen->devPrivates, glamor_screen_private_key, priv); +} + +static inline glamor_pixmap_private * +glamor_get_pixmap_private(PixmapPtr pixmap) +{ + glamor_pixmap_private *priv; + + priv = dixLookupPrivate(&pixmap->devPrivates, glamor_pixmap_private_key); + if (!priv) { + glamor_set_pixmap_type(pixmap, GLAMOR_MEMORY); + priv = dixLookupPrivate(&pixmap->devPrivates, + glamor_pixmap_private_key); + } + return priv; +} + +void glamor_set_pixmap_private(PixmapPtr pixmap, glamor_pixmap_private *priv); + +/** + * Returns TRUE if the given planemask covers all the significant bits in the + * pixel values for pDrawable. + */ +static inline Bool +glamor_pm_is_solid(DrawablePtr drawable, unsigned long planemask) +{ + return (planemask & FbFullMask(drawable->depth)) == + FbFullMask(drawable->depth); +} + +extern int glamor_debug_level; + +/* glamor.c */ +PixmapPtr glamor_get_drawable_pixmap(DrawablePtr drawable); + +glamor_pixmap_fbo *glamor_pixmap_detach_fbo(glamor_pixmap_private * + pixmap_priv); +void glamor_pixmap_attach_fbo(PixmapPtr pixmap, glamor_pixmap_fbo *fbo); +glamor_pixmap_fbo *glamor_create_fbo_from_tex(glamor_screen_private * + glamor_priv, int w, int h, + GLenum format, GLint tex, + int flag); +glamor_pixmap_fbo *glamor_create_fbo(glamor_screen_private *glamor_priv, int w, + int h, GLenum format, int flag); +void glamor_destroy_fbo(glamor_pixmap_fbo *fbo); +void glamor_pixmap_destroy_fbo(glamor_pixmap_private *priv); +void glamor_purge_fbo(glamor_pixmap_fbo *fbo); + +void glamor_init_pixmap_fbo(ScreenPtr screen); +void glamor_fini_pixmap_fbo(ScreenPtr screen); +Bool glamor_pixmap_fbo_fixup(ScreenPtr screen, PixmapPtr pixmap); +void glamor_fbo_expire(glamor_screen_private *glamor_priv); + +glamor_pixmap_fbo *glamor_create_fbo_array(glamor_screen_private *glamor_priv, + int w, int h, GLenum format, + int flag, int block_w, int block_h, + glamor_pixmap_private *); + +/* glamor_copyarea.c */ +RegionPtr + +glamor_copy_area(DrawablePtr src, DrawablePtr dst, GCPtr gc, + int srcx, int srcy, int width, int height, int dstx, int dsty); +void glamor_copy_n_to_n(DrawablePtr src, DrawablePtr dst, GCPtr gc, + BoxPtr box, int nbox, int dx, int dy, Bool reverse, + Bool upsidedown, Pixel bitplane, void *closure); + +/* glamor_core.c */ +Bool glamor_prepare_access(DrawablePtr drawable, glamor_access_t access); +void glamor_finish_access(DrawablePtr drawable); +Bool glamor_prepare_access_window(WindowPtr window); +void glamor_finish_access_window(WindowPtr window); +Bool glamor_prepare_access_gc(GCPtr gc); +void glamor_finish_access_gc(GCPtr gc); +void glamor_init_finish_access_shaders(ScreenPtr screen); +void glamor_fini_finish_access_shaders(ScreenPtr screen); +const Bool glamor_get_drawable_location(const DrawablePtr drawable); +void glamor_get_drawable_deltas(DrawablePtr drawable, PixmapPtr pixmap, + int *x, int *y); +Bool glamor_stipple(PixmapPtr pixmap, PixmapPtr stipple, + int x, int y, int width, int height, + unsigned char alu, unsigned long planemask, + unsigned long fg_pixel, unsigned long bg_pixel, + int stipple_x, int stipple_y); +GLint glamor_compile_glsl_prog(GLenum type, const char *source); +void glamor_link_glsl_prog(ScreenPtr screen, GLint prog, + const char *format, ...) _X_ATTRIBUTE_PRINTF(3,4); +void glamor_get_color_4f_from_pixel(PixmapPtr pixmap, + unsigned long fg_pixel, GLfloat *color); + +int glamor_set_destination_pixmap(PixmapPtr pixmap); +int glamor_set_destination_pixmap_priv(glamor_pixmap_private *pixmap_priv); +void glamor_set_destination_pixmap_fbo(glamor_pixmap_fbo *, int, int, int, int); + +/* nc means no check. caller must ensure this pixmap has valid fbo. + * usually use the GLAMOR_PIXMAP_PRIV_HAS_FBO firstly. + * */ +void glamor_set_destination_pixmap_priv_nc(glamor_pixmap_private *pixmap_priv); + +glamor_pixmap_fbo *glamor_es2_pixmap_read_prepare(PixmapPtr source, int x, + int y, int w, int h, + GLenum format, GLenum type, + int no_alpha, int revert, + int swap_rb); + +Bool glamor_set_alu(ScreenPtr screen, unsigned char alu); +Bool glamor_set_planemask(PixmapPtr pixmap, unsigned long planemask); +RegionPtr glamor_bitmap_to_region(PixmapPtr pixmap); + +/* glamor_fill.c */ +Bool glamor_fill(DrawablePtr drawable, + GCPtr gc, int x, int y, int width, int height, Bool fallback); +Bool glamor_solid(PixmapPtr pixmap, int x, int y, int width, int height, + unsigned char alu, unsigned long planemask, + unsigned long fg_pixel); +Bool glamor_solid_boxes(PixmapPtr pixmap, + BoxPtr box, int nbox, unsigned long fg_pixel); + +void glamor_init_solid_shader(ScreenPtr screen); +void glamor_fini_solid_shader(ScreenPtr screen); + +/* glamor_glyphs.c */ +Bool glamor_realize_glyph_caches(ScreenPtr screen); +void glamor_glyphs_fini(ScreenPtr screen); +void glamor_glyphs(CARD8 op, + PicturePtr pSrc, + PicturePtr pDst, + PictFormatPtr maskFormat, + INT16 xSrc, + INT16 ySrc, int nlist, GlyphListPtr list, GlyphPtr *glyphs); + +/* glamor_polylines.c */ +void glamor_poly_lines(DrawablePtr drawable, GCPtr gc, int mode, int n, + DDXPointPtr points); + +/* glamor_render.c */ +Bool glamor_composite_clipped_region(CARD8 op, + PicturePtr source, + PicturePtr mask, + PicturePtr dest, + glamor_pixmap_private *soruce_pixmap_priv, + glamor_pixmap_private *mask_pixmap_priv, + glamor_pixmap_private *dest_pixmap_priv, + RegionPtr region, + int x_source, + int y_source, + int x_mask, int y_mask, + int x_dest, int y_dest); + +void glamor_composite(CARD8 op, + PicturePtr pSrc, + PicturePtr pMask, + PicturePtr pDst, + INT16 xSrc, + INT16 ySrc, + INT16 xMask, + INT16 yMask, + INT16 xDst, INT16 yDst, CARD16 width, CARD16 height); + +void glamor_init_composite_shaders(ScreenPtr screen); +void glamor_fini_composite_shaders(ScreenPtr screen); +void glamor_composite_glyph_rects(CARD8 op, + PicturePtr src, PicturePtr mask, + PicturePtr dst, int nrect, + glamor_composite_rect_t *rects); +void glamor_composite_rects(CARD8 op, + PicturePtr pDst, + xRenderColor *color, int nRect, xRectangle *rects); +void glamor_init_trapezoid_shader(ScreenPtr screen); +void glamor_fini_trapezoid_shader(ScreenPtr screen); +PicturePtr glamor_convert_gradient_picture(ScreenPtr screen, + PicturePtr source, + int x_source, + int y_source, int width, int height); + +Bool glamor_composite_choose_shader(CARD8 op, + PicturePtr source, + PicturePtr mask, + PicturePtr dest, + glamor_pixmap_private *source_pixmap_priv, + glamor_pixmap_private *mask_pixmap_priv, + glamor_pixmap_private *dest_pixmap_priv, + struct shader_key *s_key, + glamor_composite_shader ** shader, + struct blendinfo *op_info, + PictFormatShort *psaved_source_format); + +void glamor_composite_set_shader_blend(glamor_pixmap_private *dest_priv, + struct shader_key *key, + glamor_composite_shader *shader, + struct blendinfo *op_info); + +void *glamor_setup_composite_vbo(ScreenPtr screen, int n_verts); + +/* glamor_trapezoid.c */ +void glamor_trapezoids(CARD8 op, + PicturePtr src, PicturePtr dst, + PictFormatPtr mask_format, INT16 x_src, INT16 y_src, + int ntrap, xTrapezoid *traps); + +/* glamor_tile.c */ +Bool glamor_tile(PixmapPtr pixmap, PixmapPtr tile, + int x, int y, int width, int height, + unsigned char alu, unsigned long planemask, + int tile_x, int tile_y); +void glamor_init_tile_shader(ScreenPtr screen); +void glamor_fini_tile_shader(ScreenPtr screen); + +/* glamor_gradient.c */ +void glamor_init_gradient_shader(ScreenPtr screen); +void glamor_fini_gradient_shader(ScreenPtr screen); +PicturePtr glamor_generate_linear_gradient_picture(ScreenPtr screen, + PicturePtr src_picture, + int x_source, int y_source, + int width, int height, + PictFormatShort format); +PicturePtr glamor_generate_radial_gradient_picture(ScreenPtr screen, + PicturePtr src_picture, + int x_source, int y_source, + int width, int height, + PictFormatShort format); + +/* glamor_triangles.c */ +void glamor_triangles(CARD8 op, + PicturePtr pSrc, + PicturePtr pDst, + PictFormatPtr maskFormat, + INT16 xSrc, INT16 ySrc, int ntris, xTriangle * tris); + +/* glamor_pixmap.c */ + +void glamor_pixmap_init(ScreenPtr screen); +void glamor_pixmap_fini(ScreenPtr screen); + +/* glamor_vbo.c */ + +void glamor_init_vbo(ScreenPtr screen); +void glamor_fini_vbo(ScreenPtr screen); + +void * +glamor_get_vbo_space(ScreenPtr screen, unsigned size, char **vbo_offset); + +void +glamor_put_vbo_space(ScreenPtr screen); + +/** + * Download a pixmap's texture to cpu memory. If success, + * One copy of current pixmap's texture will be put into + * the pixmap->devPrivate.ptr. Will use pbo to map to + * the pointer if possible. + * The pixmap must be a gl texture pixmap. gl_fbo must be GLAMOR_FBO_NORMAL and + * gl_tex must be 1. Used by glamor_prepare_access. + * + */ +Bool glamor_download_pixmap_to_cpu(PixmapPtr pixmap, glamor_access_t access); + +void *glamor_download_sub_pixmap_to_cpu(PixmapPtr pixmap, int x, int y, int w, + int h, int stride, void *bits, int pbo, + glamor_access_t access); + +/** + * Restore a pixmap's data which is downloaded by + * glamor_download_pixmap_to_cpu to its original + * gl texture. Used by glamor_finish_access. + * + * The pixmap must originally be a texture -- gl_fbo must be + * GLAMOR_FBO_NORMAL. + **/ +void glamor_restore_pixmap_to_texture(PixmapPtr pixmap); + +/** + * According to the flag, + * if the flag is GLAMOR_CREATE_FBO_NO_FBO then just ensure + * the fbo has a valid texture. Otherwise, it will ensure + * the fbo has valid texture and attach to a valid fb. + * If the fbo already has a valid glfbo then do nothing. + */ +Bool glamor_pixmap_ensure_fbo(PixmapPtr pixmap, GLenum format, int flag); + +/** + * Upload a pixmap to gl texture. Used by dynamic pixmap + * uploading feature. The pixmap must be a software pixmap. + * This function will change current FBO and current shaders. + */ +enum glamor_pixmap_status glamor_upload_pixmap_to_texture(PixmapPtr pixmap); + +Bool glamor_upload_sub_pixmap_to_texture(PixmapPtr pixmap, int x, int y, int w, + int h, int stride, void *bits, + int pbo); + +PixmapPtr glamor_get_sub_pixmap(PixmapPtr pixmap, int x, int y, + int w, int h, glamor_access_t access); +void glamor_put_sub_pixmap(PixmapPtr sub_pixmap, PixmapPtr pixmap, int x, int y, + int w, int h, glamor_access_t access); + +glamor_pixmap_clipped_regions * +glamor_compute_clipped_regions(glamor_pixmap_private *priv, + RegionPtr region, int *clipped_nbox, + int repeat_type, int reverse, + int upsidedown); + +glamor_pixmap_clipped_regions * +glamor_compute_clipped_regions_ext(glamor_pixmap_private *pixmap_priv, + RegionPtr region, int *n_region, + int inner_block_w, int inner_block_h, + int reverse, int upsidedown); + +glamor_pixmap_clipped_regions * +glamor_compute_transform_clipped_regions(glamor_pixmap_private *priv, + struct pixman_transform *transform, + RegionPtr region, + int *n_region, int dx, int dy, + int repeat_type, int reverse, + int upsidedown); + +Bool glamor_composite_largepixmap_region(CARD8 op, + PicturePtr source, + PicturePtr mask, + PicturePtr dest, + glamor_pixmap_private *source_pixmap_priv, + glamor_pixmap_private *mask_pixmap_priv, + glamor_pixmap_private *dest_pixmap_priv, + RegionPtr region, Bool force_clip, + INT16 x_source, + INT16 y_source, + INT16 x_mask, + INT16 y_mask, + INT16 x_dest, INT16 y_dest, + CARD16 width, CARD16 height); + +Bool glamor_get_transform_block_size(struct pixman_transform *transform, + int block_w, int block_h, + int *transformed_block_w, + int *transformed_block_h); + +void glamor_get_transform_extent_from_box(struct pixman_box32 *temp_box, + struct pixman_transform *transform); + +/** + * Upload a picture to gl texture. Similar to the + * glamor_upload_pixmap_to_texture. Used in rendering. + **/ +enum glamor_pixmap_status glamor_upload_picture_to_texture(PicturePtr picture); + +/** + * Upload bits to a pixmap's texture. This function will + * convert the bits to the specified format/type format + * if the conversion is unavoidable. + **/ +Bool glamor_upload_bits_to_pixmap_texture(PixmapPtr pixmap, GLenum format, + GLenum type, int no_alpha, int revert, + int swap_rb, void *bits); + +/** + * Destroy all the resources allocated on the uploading + * phase, includs the tex and fbo. + **/ +void glamor_destroy_upload_pixmap(PixmapPtr pixmap); + +int glamor_create_picture(PicturePtr picture); + +void glamor_set_window_pixmap(WindowPtr pWindow, PixmapPtr pPixmap); + +Bool glamor_prepare_access_picture(PicturePtr picture, glamor_access_t access); + +void glamor_finish_access_picture(PicturePtr picture); + +void glamor_destroy_picture(PicturePtr picture); + +/* fixup a fbo to the exact size as the pixmap. */ +Bool glamor_fixup_pixmap_priv(ScreenPtr screen, + glamor_pixmap_private *pixmap_priv); + +void glamor_picture_format_fixup(PicturePtr picture, + glamor_pixmap_private *pixmap_priv); + +void glamor_add_traps(PicturePtr pPicture, + INT16 x_off, INT16 y_off, int ntrap, xTrap *traps); + +RegionPtr glamor_copy_plane(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, + int srcx, int srcy, int w, int h, + int dstx, int dsty, + unsigned long bitPlane); + +/* glamor_text.c */ +int glamor_poly_text8(DrawablePtr pDrawable, GCPtr pGC, + int x, int y, int count, char *chars); + +int glamor_poly_text16(DrawablePtr pDrawable, GCPtr pGC, + int x, int y, int count, unsigned short *chars); + +void glamor_image_text8(DrawablePtr pDrawable, GCPtr pGC, + int x, int y, int count, char *chars); + +void glamor_image_text16(DrawablePtr pDrawable, GCPtr pGC, + int x, int y, int count, unsigned short *chars); + +/* glamor_spans.c */ +void +glamor_fill_spans(DrawablePtr drawable, + GCPtr gc, + int n, DDXPointPtr points, int *widths, int sorted); + +void +glamor_get_spans(DrawablePtr drawable, int wmax, + DDXPointPtr points, int *widths, int count, char *dst); + +void +glamor_set_spans(DrawablePtr drawable, GCPtr gc, char *src, + DDXPointPtr points, int *widths, int numPoints, int sorted); + +/* glamor_rects.c */ +void +glamor_poly_fill_rect(DrawablePtr drawable, + GCPtr gc, int nrect, xRectangle *prect); + +/* glamor_image.c */ +void +glamor_put_image(DrawablePtr drawable, GCPtr gc, int depth, int x, int y, + int w, int h, int leftPad, int format, char *bits); + +void +glamor_get_image(DrawablePtr pDrawable, int x, int y, int w, int h, + unsigned int format, unsigned long planeMask, char *d); + +/* glamor_glyphblt.c */ +void glamor_image_glyph_blt(DrawablePtr pDrawable, GCPtr pGC, + int x, int y, unsigned int nglyph, + CharInfoPtr *ppci, void *pglyphBase); + +void glamor_poly_glyph_blt(DrawablePtr pDrawable, GCPtr pGC, + int x, int y, unsigned int nglyph, + CharInfoPtr *ppci, void *pglyphBase); + +void glamor_push_pixels(GCPtr pGC, PixmapPtr pBitmap, + DrawablePtr pDrawable, int w, int h, int x, int y); + +void glamor_poly_point(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, + DDXPointPtr ppt); + +void glamor_poly_segment(DrawablePtr pDrawable, GCPtr pGC, int nseg, + xSegment *pSeg); + +void glamor_poly_line(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, + DDXPointPtr ppt); + +void glamor_composite_rectangles(CARD8 op, + PicturePtr dst, + xRenderColor *color, + int num_rects, xRectangle *rects); + +/* glamor_xv */ +typedef struct { + uint32_t transform_index; + uint32_t gamma; /* gamma value x 1000 */ + int brightness; + int saturation; + int hue; + int contrast; + + DrawablePtr pDraw; + PixmapPtr pPixmap; + uint32_t src_pitch; + uint8_t *src_addr; + int src_w, src_h, dst_w, dst_h; + int src_x, src_y, drw_x, drw_y; + int w, h; + RegionRec clip; + PixmapPtr src_pix[3]; /* y, u, v for planar */ + int src_pix_w, src_pix_h; +} glamor_port_private; + +void glamor_init_xv_shader(ScreenPtr screen); +void glamor_fini_xv_shader(ScreenPtr screen); + +#include"glamor_utils.h" + +/* Dynamic pixmap upload to texture if needed. + * Sometimes, the target is a gl texture pixmap/picture, + * but the source or mask is in cpu memory. In that case, + * upload the source/mask to gl texture and then avoid + * fallback the whole process to cpu. Most of the time, + * this will increase performance obviously. */ + +#define GLAMOR_PIXMAP_DYNAMIC_UPLOAD +#define GLAMOR_GRADIENT_SHADER +#define GLAMOR_TRAPEZOID_SHADER +#define GLAMOR_TEXTURED_LARGE_PIXMAP 1 +#define WALKAROUND_LARGE_TEXTURE_MAP +#if 0 +#define MAX_FBO_SIZE 32 /* For test purpose only. */ +#endif +//#define GLYPHS_NO_EDEGEMAP_OVERLAP_CHECK +#define GLYPHS_EDEGE_OVERLAP_LOOSE_CHECK + +#include "glamor_font.h" + +#endif /* GLAMOR_PRIV_H */ diff --git a/xserver/glamor/glamor_program.c b/xserver/glamor/glamor_program.c new file mode 100644 index 000000000..0f4d0f06a --- /dev/null +++ b/xserver/glamor/glamor_program.c @@ -0,0 +1,386 @@ +/* + * Copyright © 2014 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * that the name of the copyright holders not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no representations + * about the suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +#include "glamor_priv.h" +#include "glamor_transform.h" +#include "glamor_program.h" + +static Bool +use_solid(PixmapPtr pixmap, GCPtr gc, glamor_program *prog, void *arg) +{ + return glamor_set_solid(pixmap, gc, TRUE, prog->fg_uniform); +} + +const glamor_facet glamor_fill_solid = { + .name = "solid", + .fs_exec = " gl_FragColor = fg;\n", + .locations = glamor_program_location_fg, + .use = use_solid, +}; + +static Bool +use_tile(PixmapPtr pixmap, GCPtr gc, glamor_program *prog, void *arg) +{ + return glamor_set_tiled(pixmap, gc, prog->fill_offset_uniform, prog->fill_size_uniform); +} + +static const glamor_facet glamor_fill_tile = { + .name = "tile", + .vs_exec = " fill_pos = (fill_offset + primitive.xy + pos) / fill_size;\n", + .fs_exec = " gl_FragColor = texture2D(sampler, fill_pos);\n", + .locations = glamor_program_location_fill, + .use = use_tile, +}; + +#if 0 +static Bool +use_stipple(PixmapPtr pixmap, GCPtr gc, glamor_program *prog) +{ + return glamor_set_stippled(pixmap, gc, prog->fg_uniform, prog->fill_offset_uniform, prog->fill_size_uniform); +} + +static const glamor_facet glamor_fill_stipple = { + .name = "stipple", + .version = 130, + .vs_exec = " fill_pos = fill_offset + primitive.xy + pos;\n"; + .fs_exec = (" if (texelFetch(sampler, ivec2(mod(fill_pos,fill_size)), 0).x == 0)\n" + " discard;\n" + " gl_FragColor = fg;\n") + .locations = glamor_program_location_fg | glamor_program_location_fill + .use = use_stipple, +}; + +static const glamor_facet glamor_fill_opaque_stipple = { + .name = "opaque_stipple", + .version = 130, + .vs_exec = " fill_pos = fill_offset + primitive.xy + pos;\n"; + .fs_exec = (" if (texelFetch(sampler, ivec2(mod(fill_pos,fill_size)), 0).x == 0)\n" + " gl_FragColor = bg;\n" + " else\n" + " gl_FragColor = fg;\n"), + .locations = glamor_program_location_fg | glamor_program_location_bg | glamor_program_location_fill + .use = use_opaque_stipple +}; +#endif + +static const glamor_facet *glamor_facet_fill[4] = { + &glamor_fill_solid, + &glamor_fill_tile, + NULL, + NULL, +}; + +typedef struct { + glamor_program_location location; + const char *vs_vars; + const char *fs_vars; +} glamor_location_var; + +static glamor_location_var location_vars[] = { + { + .location = glamor_program_location_fg, + .fs_vars = "uniform vec4 fg;\n" + }, + { + .location = glamor_program_location_bg, + .fs_vars = "uniform vec4 bg;\n" + }, + { + .location = glamor_program_location_fill, + .vs_vars = ("uniform vec2 fill_offset;\n" + "uniform vec2 fill_size;\n" + "varying vec2 fill_pos;\n"), + .fs_vars = ("uniform sampler2D sampler;\n" + "uniform vec2 fill_size;\n" + "varying vec2 fill_pos;\n") + }, + { + .location = glamor_program_location_font, + .fs_vars = "uniform usampler2D font;\n", + }, +}; + +#define NUM_LOCATION_VARS (sizeof location_vars / sizeof location_vars[0]) + +static char * +add_var(char *cur, const char *add) +{ + char *new; + + if (!add) + return cur; + + new = realloc(cur, strlen(cur) + strlen(add) + 1); + if (!new) { + free(cur); + return NULL; + } + strcat(new, add); + return new; +} + +static char * +vs_location_vars(glamor_program_location locations) +{ + int l; + char *vars = strdup(""); + + for (l = 0; vars && l < NUM_LOCATION_VARS; l++) + if (locations & location_vars[l].location) + vars = add_var(vars, location_vars[l].vs_vars); + return vars; +} + +static char * +fs_location_vars(glamor_program_location locations) +{ + int l; + char *vars = strdup(""); + + for (l = 0; vars && l < NUM_LOCATION_VARS; l++) + if (locations & location_vars[l].location) + vars = add_var(vars, location_vars[l].fs_vars); + return vars; +} + +static const char vs_template[] = + "%s" /* version */ + "%s" /* prim vs_vars */ + "%s" /* fill vs_vars */ + "%s" /* location vs_vars */ + GLAMOR_DECLARE_MATRIX + "void main() {\n" + "%s" /* prim vs_exec, outputs 'pos' and gl_Position */ + "%s" /* fill vs_exec */ + "}\n"; + +static const char fs_template[] = + "%s" /* version */ + GLAMOR_DEFAULT_PRECISION + "%s" /* prim fs_vars */ + "%s" /* fill fs_vars */ + "%s" /* location fs_vars */ + "void main() {\n" + "%s" /* prim fs_exec */ + "%s" /* fill fs_exec */ + "}\n"; + +static const char * +str(const char *s) +{ + if (!s) + return ""; + return s; +} + +static const glamor_facet facet_null_fill = { + .name = "" +}; + +static GLint +glamor_get_uniform(glamor_program *prog, + glamor_program_location location, + const char *name) +{ + GLint uniform; + if (location && (prog->locations & location) == 0) + return -2; + uniform = glGetUniformLocation(prog->prog, name); +#if DBG + ErrorF("%s uniform %d\n", name, uniform); +#endif + return uniform; +} + +Bool +glamor_build_program(ScreenPtr screen, + glamor_program *prog, + const glamor_facet *prim, + const glamor_facet *fill) +{ + glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); + + glamor_program_location locations = prim->locations; + glamor_program_flag flags = prim->flags; + + int version = prim->version; + char *version_string = NULL; + + char *fs_vars = NULL; + char *vs_vars = NULL; + + char *vs_prog_string; + char *fs_prog_string; + + GLint fs_prog, vs_prog; + + if (!fill) + fill = &facet_null_fill; + + locations |= fill->locations; + flags |= fill->flags; + version = MAX(version, fill->version); + + if (version > glamor_priv->glsl_version) + goto fail; + + vs_vars = vs_location_vars(locations); + fs_vars = fs_location_vars(locations); + + if (!vs_vars) + goto fail; + if (!fs_vars) + goto fail; + + if (version) { + if (asprintf(&version_string, "#version %d\n", version) < 0) + version_string = NULL; + if (!version_string) + goto fail; + } + + if (asprintf(&vs_prog_string, + vs_template, + str(version_string), + str(prim->vs_vars), + str(fill->vs_vars), + vs_vars, + str(prim->vs_exec), + str(fill->vs_exec)) < 0) + vs_prog_string = NULL; + + if (asprintf(&fs_prog_string, + fs_template, + str(version_string), + str(prim->fs_vars), + str(fill->fs_vars), + fs_vars, + str(prim->fs_exec), + str(fill->fs_exec)) < 0) + fs_prog_string = NULL; + + if (!vs_prog_string || !fs_prog_string) + goto fail; + +#define DBG 0 +#if DBG + ErrorF("\nPrograms for %s %s\nVertex shader:\n\n%s\n\nFragment Shader:\n\n%s", + prim->name, fill->name, vs_prog_string, fs_prog_string); +#endif + + prog->prog = glCreateProgram(); + prog->flags = flags; + prog->locations = locations; + prog->prim_use = prim->use; + prog->fill_use = fill->use; + + vs_prog = glamor_compile_glsl_prog(GL_VERTEX_SHADER, vs_prog_string); + fs_prog = glamor_compile_glsl_prog(GL_FRAGMENT_SHADER, fs_prog_string); + free(vs_prog_string); + free(fs_prog_string); + glAttachShader(prog->prog, vs_prog); + glDeleteShader(vs_prog); + glAttachShader(prog->prog, fs_prog); + glDeleteShader(fs_prog); + glBindAttribLocation(prog->prog, GLAMOR_VERTEX_POS, "primitive"); + + if (prim->source_name) { +#if DBG + ErrorF("Bind GLAMOR_VERTEX_SOURCE to %s\n", prim->source_name); +#endif + glBindAttribLocation(prog->prog, GLAMOR_VERTEX_SOURCE, prim->source_name); + } + + glamor_link_glsl_prog(screen, prog->prog, "%s_%s", prim->name, fill->name); + + prog->matrix_uniform = glamor_get_uniform(prog, glamor_program_location_none, "v_matrix"); + prog->fg_uniform = glamor_get_uniform(prog, glamor_program_location_fg, "fg"); + prog->bg_uniform = glamor_get_uniform(prog, glamor_program_location_bg, "bg"); + prog->fill_offset_uniform = glamor_get_uniform(prog, glamor_program_location_fill, "fill_offset"); + prog->fill_size_uniform = glamor_get_uniform(prog, glamor_program_location_fill, "fill_size"); + prog->font_uniform = glamor_get_uniform(prog, glamor_program_location_font, "font"); + + if (glGetError() != GL_NO_ERROR) + goto fail; + + free(version_string); + free(fs_vars); + free(vs_vars); + return TRUE; +fail: + prog->failed = 1; + if (prog->prog) { + glDeleteProgram(prog->prog); + prog->prog = 0; + } + free(version_string); + free(fs_vars); + free(vs_vars); + return FALSE; +} + +Bool +glamor_use_program(PixmapPtr pixmap, + GCPtr gc, + glamor_program *prog, + void *arg) +{ + glUseProgram(prog->prog); + + if (prog->prim_use && !prog->prim_use(pixmap, gc, prog, arg)) + return FALSE; + + if (prog->fill_use && !prog->fill_use(pixmap, gc, prog, arg)) + return FALSE; + + return TRUE; +} + +glamor_program * +glamor_use_program_fill(PixmapPtr pixmap, + GCPtr gc, + glamor_program_fill *program_fill, + const glamor_facet *prim) +{ + ScreenPtr screen = pixmap->drawable.pScreen; + glamor_program *prog = &program_fill->progs[gc->fillStyle]; + + int fill_style = gc->fillStyle; + const glamor_facet *fill; + + if (prog->failed) + return FALSE; + + if (!prog->prog) { + fill = glamor_facet_fill[fill_style]; + if (!fill) + return NULL; + + if (!glamor_build_program(screen, prog, prim, fill)) + return NULL; + } + + if (!glamor_use_program(pixmap, gc, prog, NULL)) + return NULL; + + return prog; +} diff --git a/xserver/glamor/glamor_program.h b/xserver/glamor/glamor_program.h new file mode 100644 index 000000000..88efc3593 --- /dev/null +++ b/xserver/glamor/glamor_program.h @@ -0,0 +1,94 @@ +/* + * Copyright © 2014 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * that the name of the copyright holders not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no representations + * about the suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +#ifndef _GLAMOR_PROGRAM_H_ +#define _GLAMOR_PROGRAM_H_ + +typedef enum { + glamor_program_location_none = 0, + glamor_program_location_fg = 1, + glamor_program_location_bg = 2, + glamor_program_location_fill = 4, + glamor_program_location_font = 8, +} glamor_program_location; + +typedef enum { + glamor_program_flag_none = 0, +} glamor_program_flag; + +typedef struct _glamor_program glamor_program; + +typedef Bool (*glamor_use) (PixmapPtr pixmap, GCPtr gc, glamor_program *prog, void *arg); + +typedef struct { + const char *name; + const int version; + const char *vs_vars; + const char *vs_exec; + const char *fs_vars; + const char *fs_exec; + const glamor_program_location locations; + const glamor_program_flag flags; + const char *source_name; + glamor_use use; +} glamor_facet; + +struct _glamor_program { + GLint prog; + GLint failed; + GLint matrix_uniform; + GLint fg_uniform; + GLint bg_uniform; + GLint fill_size_uniform; + GLint fill_offset_uniform; + GLint font_uniform; + glamor_program_location locations; + glamor_program_flag flags; + glamor_use prim_use; + glamor_use fill_use; +}; + +typedef struct { + glamor_program progs[4]; +} glamor_program_fill; + +extern const glamor_facet glamor_fill_solid; + +Bool +glamor_build_program(ScreenPtr screen, + glamor_program *prog, + const glamor_facet *prim, + const glamor_facet *fill); + +Bool +glamor_use_program(PixmapPtr pixmap, + GCPtr gc, + glamor_program *prog, + void *arg); + +glamor_program * +glamor_use_program_fill(PixmapPtr pixmap, + GCPtr gc, + glamor_program_fill *program_fill, + const glamor_facet *prim); + +#endif /* _GLAMOR_PROGRAM_H_ */ diff --git a/xserver/glamor/glamor_rects.c b/xserver/glamor/glamor_rects.c new file mode 100644 index 000000000..3a5c3f3f9 --- /dev/null +++ b/xserver/glamor/glamor_rects.c @@ -0,0 +1,187 @@ +/* + * Copyright © 2014 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * that the name of the copyright holders not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no representations + * about the suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +#include "glamor_priv.h" +#include "glamor_program.h" +#include "glamor_transform.h" + +static const glamor_facet glamor_facet_polyfillrect_130 = { + .name = "poly_fill_rect", + .version = 130, + .vs_vars = "attribute vec4 primitive;\n", + .vs_exec = (" vec2 pos = primitive.zw * vec2(gl_VertexID&1, (gl_VertexID&2)>>1);\n" + GLAMOR_POS(gl_Position, (primitive.xy + pos))), +}; + +static const glamor_facet glamor_facet_polyfillrect_120 = { + .name = "poly_fill_rect", + .vs_vars = "attribute vec2 primitive;\n", + .vs_exec = (" vec2 pos = vec2(0,0);\n" + GLAMOR_POS(gl_Position, primitive.xy)), +}; + +static Bool +glamor_poly_fill_rect_gl(DrawablePtr drawable, + GCPtr gc, int nrect, xRectangle *prect) +{ + ScreenPtr screen = drawable->pScreen; + glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); + PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable); + glamor_pixmap_private *pixmap_priv; + glamor_program *prog; + int off_x, off_y; + GLshort *v; + char *vbo_offset; + int box_x, box_y; + + pixmap_priv = glamor_get_pixmap_private(pixmap); + if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv)) + goto bail; + + glamor_make_current(glamor_priv); + + if (glamor_priv->glsl_version >= 130) { + prog = glamor_use_program_fill(pixmap, gc, + &glamor_priv->poly_fill_rect_program, + &glamor_facet_polyfillrect_130); + + if (!prog) + goto bail_ctx; + + /* Set up the vertex buffers for the points */ + + v = glamor_get_vbo_space(drawable->pScreen, nrect * sizeof (xRectangle), &vbo_offset); + + glEnableVertexAttribArray(GLAMOR_VERTEX_POS); + glVertexAttribDivisor(GLAMOR_VERTEX_POS, 1); + glVertexAttribPointer(GLAMOR_VERTEX_POS, 4, GL_SHORT, GL_FALSE, + 4 * sizeof (short), vbo_offset); + + memcpy(v, prect, nrect * sizeof (xRectangle)); + + glamor_put_vbo_space(screen); + } else { + int n; + + prog = glamor_use_program_fill(pixmap, gc, + &glamor_priv->poly_fill_rect_program, + &glamor_facet_polyfillrect_120); + + if (!prog) + goto bail_ctx; + + /* Set up the vertex buffers for the points */ + + v = glamor_get_vbo_space(drawable->pScreen, nrect * 8 * sizeof (short), &vbo_offset); + + glEnableVertexAttribArray(GLAMOR_VERTEX_POS); + glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_SHORT, GL_FALSE, + 2 * sizeof (short), vbo_offset); + + for (n = 0; n < nrect; n++) { + v[0] = prect->x; v[1] = prect->y; + v[2] = prect->x; v[3] = prect->y + prect->height; + v[4] = prect->x + prect->width; v[5] = prect->y + prect->height; + v[6] = prect->x + prect->width; v[7] = prect->y; + prect++; + v += 8; + } + + glamor_put_vbo_space(screen); + } + + glEnable(GL_SCISSOR_TEST); + + glamor_pixmap_loop(pixmap_priv, box_x, box_y) { + int nbox = RegionNumRects(gc->pCompositeClip); + BoxPtr box = RegionRects(gc->pCompositeClip); + + glamor_set_destination_drawable(drawable, box_x, box_y, TRUE, FALSE, prog->matrix_uniform, &off_x, &off_y); + + while (nbox--) { + glScissor(box->x1 + off_x, + box->y1 + off_y, + box->x2 - box->x1, + box->y2 - box->y1); + box++; + if (glamor_priv->glsl_version >= 130) + glDrawArraysInstanced(GL_TRIANGLE_STRIP, 0, 4, nrect); + else { + if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) { + glDrawArrays(GL_QUADS, 0, nrect * 4); + } else { + int i; + for (i = 0; i < nrect; i++) { + glDrawArrays(GL_TRIANGLE_FAN, i * 4, 4); + } + } + } + } + } + + glDisable(GL_SCISSOR_TEST); + glDisable(GL_COLOR_LOGIC_OP); + if (glamor_priv->glsl_version >= 130) + glVertexAttribDivisor(GLAMOR_VERTEX_POS, 0); + glDisableVertexAttribArray(GLAMOR_VERTEX_POS); + + return TRUE; +bail_ctx: + glDisable(GL_COLOR_LOGIC_OP); +bail: + return FALSE; +} + +static void +glamor_poly_fill_rect_bail(DrawablePtr drawable, + GCPtr gc, int nrect, xRectangle *prect) +{ + glamor_fallback("to %p (%c)\n", drawable, + glamor_get_drawable_location(drawable)); + if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RW) && + glamor_prepare_access_gc(gc)) { + fbPolyFillRect(drawable, gc, nrect, prect); + } + glamor_finish_access_gc(gc); + glamor_finish_access(drawable); +} + +void +glamor_poly_fill_rect(DrawablePtr drawable, + GCPtr gc, int nrect, xRectangle *prect) +{ + if (glamor_poly_fill_rect_gl(drawable, gc, nrect, prect)) + return; + glamor_poly_fill_rect_bail(drawable, gc, nrect, prect); +} + +Bool +glamor_poly_fill_rect_nf(DrawablePtr drawable, + GCPtr gc, int nrect, xRectangle *prect) +{ + if (glamor_poly_fill_rect_gl(drawable, gc, nrect, prect)) + return TRUE; + if (glamor_ddx_fallback_check_pixmap(drawable) && glamor_ddx_fallback_check_gc(gc)) + return FALSE; + glamor_poly_fill_rect_bail(drawable, gc, nrect, prect); + return TRUE; +} diff --git a/xserver/glamor/glamor_render.c b/xserver/glamor/glamor_render.c new file mode 100644 index 000000000..e5d5d2cb1 --- /dev/null +++ b/xserver/glamor/glamor_render.c @@ -0,0 +1,1983 @@ +/* + * Copyright © 2009 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Authors: + * Eric Anholt <eric@anholt.net> + * Zhigang Gong <zhigang.gong@linux.intel.com> + * Junyan He <junyan.he@linux.intel.com> + * + */ + +/** @file glamor_render.c + * + * Render acceleration implementation + */ + +#include "glamor_priv.h" + +#ifdef RENDER +#include "mipict.h" +#include "fbpict.h" +#if 0 +//#define DEBUGF(str, ...) do {} while(0) +#define DEBUGF(str, ...) ErrorF(str, ##__VA_ARGS__) +//#define DEBUGRegionPrint(x) do {} while (0) +#define DEBUGRegionPrint RegionPrint +#endif + +static struct blendinfo composite_op_info[] = { + [PictOpClear] = {0, 0, GL_ZERO, GL_ZERO}, + [PictOpSrc] = {0, 0, GL_ONE, GL_ZERO}, + [PictOpDst] = {0, 0, GL_ZERO, GL_ONE}, + [PictOpOver] = {0, 1, GL_ONE, GL_ONE_MINUS_SRC_ALPHA}, + [PictOpOverReverse] = {1, 0, GL_ONE_MINUS_DST_ALPHA, GL_ONE}, + [PictOpIn] = {1, 0, GL_DST_ALPHA, GL_ZERO}, + [PictOpInReverse] = {0, 1, GL_ZERO, GL_SRC_ALPHA}, + [PictOpOut] = {1, 0, GL_ONE_MINUS_DST_ALPHA, GL_ZERO}, + [PictOpOutReverse] = {0, 1, GL_ZERO, GL_ONE_MINUS_SRC_ALPHA}, + [PictOpAtop] = {1, 1, GL_DST_ALPHA, GL_ONE_MINUS_SRC_ALPHA}, + [PictOpAtopReverse] = {1, 1, GL_ONE_MINUS_DST_ALPHA, GL_SRC_ALPHA}, + [PictOpXor] = {1, 1, GL_ONE_MINUS_DST_ALPHA, GL_ONE_MINUS_SRC_ALPHA}, + [PictOpAdd] = {0, 0, GL_ONE, GL_ONE}, +}; + +#define RepeatFix 10 +static GLuint +glamor_create_composite_fs(struct shader_key *key) +{ + const char *repeat_define = + "#define RepeatNone 0\n" + "#define RepeatNormal 1\n" + "#define RepeatPad 2\n" + "#define RepeatReflect 3\n" + "#define RepeatFix 10\n" + "uniform int source_repeat_mode;\n" + "uniform int mask_repeat_mode;\n"; + const char *relocate_texture = + GLAMOR_DEFAULT_PRECISION + "vec2 rel_tex_coord(vec2 texture, vec4 wh, int repeat) \n" + "{\n" + " vec2 rel_tex; \n" + " rel_tex = texture * wh.xy; \n" + " if (repeat == RepeatNone)\n" + " return rel_tex; \n" + " else if (repeat == RepeatNormal) \n" + " rel_tex = floor(rel_tex) + (fract(rel_tex) / wh.xy); \n" + " else if(repeat == RepeatPad) { \n" + " if (rel_tex.x >= 1.0) rel_tex.x = 1.0 - wh.z * wh.x / 2.; \n" + " else if(rel_tex.x < 0.0) rel_tex.x = 0.0; \n" + " if (rel_tex.y >= 1.0) rel_tex.y = 1.0 - wh.w * wh.y / 2.; \n" + " else if(rel_tex.y < 0.0) rel_tex.y = 0.0; \n" + " rel_tex = rel_tex / wh.xy; \n" + " } \n" + " else if(repeat == RepeatReflect) {\n" + " if ((1.0 - mod(abs(floor(rel_tex.x)), 2.0)) < 0.001)\n" + " rel_tex.x = 2.0 - (1.0 - fract(rel_tex.x))/wh.x;\n" + " else \n" + " rel_tex.x = fract(rel_tex.x)/wh.x;\n" + " if ((1.0 - mod(abs(floor(rel_tex.y)), 2.0)) < 0.001)\n" + " rel_tex.y = 2.0 - (1.0 - fract(rel_tex.y))/wh.y;\n" + " else \n" + " rel_tex.y = fract(rel_tex.y)/wh.y;\n" + " } \n" + " return rel_tex; \n" + "}\n"; + /* The texture and the pixmap size is not match eaxctly, so can't sample it directly. + * rel_sampler will recalculate the texture coords.*/ + const char *rel_sampler = + " vec4 rel_sampler(sampler2D tex_image, vec2 tex, vec4 wh, int repeat, int set_alpha)\n" + "{\n" + " tex = rel_tex_coord(tex, wh, repeat - RepeatFix);\n" + " if (repeat == RepeatFix) {\n" + " if (!(tex.x >= 0.0 && tex.x < 1.0 \n" + " && tex.y >= 0.0 && tex.y < 1.0))\n" + " return vec4(0.0, 0.0, 0.0, set_alpha);\n" + " tex = (fract(tex) / wh.xy);\n" + " }\n" + " if (set_alpha != 1)\n" + " return texture2D(tex_image, tex);\n" + " else\n" + " return vec4(texture2D(tex_image, tex).rgb, 1.0);\n" + "}\n"; + + const char *source_solid_fetch = + GLAMOR_DEFAULT_PRECISION + "uniform vec4 source;\n" + "vec4 get_source()\n" + "{\n" + " return source;\n" + "}\n"; + const char *source_alpha_pixmap_fetch = + GLAMOR_DEFAULT_PRECISION + "varying vec2 source_texture;\n" + "uniform sampler2D source_sampler;\n" + "uniform vec4 source_wh;" + "vec4 get_source()\n" + "{\n" + " if (source_repeat_mode < RepeatFix)\n" + " return texture2D(source_sampler, source_texture);\n" + " else \n" + " return rel_sampler(source_sampler, source_texture,\n" + " source_wh, source_repeat_mode, 0);\n" + "}\n"; + const char *source_pixmap_fetch = + GLAMOR_DEFAULT_PRECISION + "varying vec2 source_texture;\n" + "uniform sampler2D source_sampler;\n" + "uniform vec4 source_wh;\n" + "vec4 get_source()\n" + "{\n" + " if (source_repeat_mode < RepeatFix) \n" + " return vec4(texture2D(source_sampler, source_texture).rgb, 1);\n" + " else \n" + " return rel_sampler(source_sampler, source_texture,\n" + " source_wh, source_repeat_mode, 1);\n" + "}\n"; + const char *mask_solid_fetch = + GLAMOR_DEFAULT_PRECISION + "uniform vec4 mask;\n" + "vec4 get_mask()\n" + "{\n" + " return mask;\n" + "}\n"; + const char *mask_alpha_pixmap_fetch = + GLAMOR_DEFAULT_PRECISION + "varying vec2 mask_texture;\n" + "uniform sampler2D mask_sampler;\n" + "uniform vec4 mask_wh;\n" + "vec4 get_mask()\n" + "{\n" + " if (mask_repeat_mode < RepeatFix) \n" + " return texture2D(mask_sampler, mask_texture);\n" + " else \n" + " return rel_sampler(mask_sampler, mask_texture,\n" + " mask_wh, mask_repeat_mode, 0);\n" + "}\n"; + const char *mask_pixmap_fetch = + GLAMOR_DEFAULT_PRECISION + "varying vec2 mask_texture;\n" + "uniform sampler2D mask_sampler;\n" + "uniform vec4 mask_wh;\n" + "vec4 get_mask()\n" + "{\n" + " if (mask_repeat_mode < RepeatFix) \n" + " return vec4(texture2D(mask_sampler, mask_texture).rgb, 1);\n" + " else \n" + " return rel_sampler(mask_sampler, mask_texture,\n" + " mask_wh, mask_repeat_mode, 1);\n" + "}\n"; + const char *in_source_only = + GLAMOR_DEFAULT_PRECISION + "void main()\n" + "{\n" + " gl_FragColor = get_source();\n" + "}\n"; + const char *in_normal = + GLAMOR_DEFAULT_PRECISION + "void main()\n" + "{\n" + " gl_FragColor = get_source() * get_mask().a;\n" + "}\n"; + const char *in_ca_source = + GLAMOR_DEFAULT_PRECISION + "void main()\n" + "{\n" + " gl_FragColor = get_source() * get_mask();\n" + "}\n"; + const char *in_ca_alpha = + GLAMOR_DEFAULT_PRECISION + "void main()\n" + "{\n" + " gl_FragColor = get_source().a * get_mask();\n" + "}\n"; + char *source; + const char *source_fetch; + const char *mask_fetch = ""; + const char *in; + GLuint prog; + + switch (key->source) { + case SHADER_SOURCE_SOLID: + source_fetch = source_solid_fetch; + break; + case SHADER_SOURCE_TEXTURE_ALPHA: + source_fetch = source_alpha_pixmap_fetch; + break; + case SHADER_SOURCE_TEXTURE: + source_fetch = source_pixmap_fetch; + break; + default: + FatalError("Bad composite shader source"); + } + + switch (key->mask) { + case SHADER_MASK_NONE: + break; + case SHADER_MASK_SOLID: + mask_fetch = mask_solid_fetch; + break; + case SHADER_MASK_TEXTURE_ALPHA: + mask_fetch = mask_alpha_pixmap_fetch; + break; + case SHADER_MASK_TEXTURE: + mask_fetch = mask_pixmap_fetch; + break; + default: + FatalError("Bad composite shader mask"); + } + + switch (key->in) { + case SHADER_IN_SOURCE_ONLY: + in = in_source_only; + break; + case SHADER_IN_NORMAL: + in = in_normal; + break; + case SHADER_IN_CA_SOURCE: + in = in_ca_source; + break; + case SHADER_IN_CA_ALPHA: + in = in_ca_alpha; + break; + default: + FatalError("Bad composite IN type"); + } + + XNFasprintf(&source, "%s%s%s%s%s%s", repeat_define, relocate_texture, + rel_sampler, source_fetch, mask_fetch, in); + + prog = glamor_compile_glsl_prog(GL_FRAGMENT_SHADER, source); + free(source); + + return prog; +} + +static GLuint +glamor_create_composite_vs(struct shader_key *key) +{ + const char *main_opening = + "attribute vec4 v_position;\n" + "attribute vec4 v_texcoord0;\n" + "attribute vec4 v_texcoord1;\n" + "varying vec2 source_texture;\n" + "varying vec2 mask_texture;\n" + "void main()\n" + "{\n" + " gl_Position = v_position;\n"; + const char *source_coords = " source_texture = v_texcoord0.xy;\n"; + const char *mask_coords = " mask_texture = v_texcoord1.xy;\n"; + const char *main_closing = "}\n"; + const char *source_coords_setup = ""; + const char *mask_coords_setup = ""; + char *source; + GLuint prog; + + if (key->source != SHADER_SOURCE_SOLID) + source_coords_setup = source_coords; + + if (key->mask != SHADER_MASK_NONE && key->mask != SHADER_MASK_SOLID) + mask_coords_setup = mask_coords; + + XNFasprintf(&source, + "%s%s%s%s", + main_opening, + source_coords_setup, mask_coords_setup, main_closing); + + prog = glamor_compile_glsl_prog(GL_VERTEX_SHADER, source); + free(source); + + return prog; +} + +static void +glamor_create_composite_shader(ScreenPtr screen, struct shader_key *key, + glamor_composite_shader *shader) +{ + GLuint vs, fs, prog; + GLint source_sampler_uniform_location, mask_sampler_uniform_location; + glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); + + glamor_make_current(glamor_priv); + vs = glamor_create_composite_vs(key); + if (vs == 0) + return; + fs = glamor_create_composite_fs(key); + if (fs == 0) + return; + + prog = glCreateProgram(); + glAttachShader(prog, vs); + glAttachShader(prog, fs); + + glBindAttribLocation(prog, GLAMOR_VERTEX_POS, "v_position"); + glBindAttribLocation(prog, GLAMOR_VERTEX_SOURCE, "v_texcoord0"); + glBindAttribLocation(prog, GLAMOR_VERTEX_MASK, "v_texcoord1"); + + glamor_link_glsl_prog(screen, prog, "composite"); + + shader->prog = prog; + + glUseProgram(prog); + + if (key->source == SHADER_SOURCE_SOLID) { + shader->source_uniform_location = glGetUniformLocation(prog, "source"); + } + else { + source_sampler_uniform_location = + glGetUniformLocation(prog, "source_sampler"); + glUniform1i(source_sampler_uniform_location, 0); + shader->source_wh = glGetUniformLocation(prog, "source_wh"); + shader->source_repeat_mode = + glGetUniformLocation(prog, "source_repeat_mode"); + } + + if (key->mask != SHADER_MASK_NONE) { + if (key->mask == SHADER_MASK_SOLID) { + shader->mask_uniform_location = glGetUniformLocation(prog, "mask"); + } + else { + mask_sampler_uniform_location = + glGetUniformLocation(prog, "mask_sampler"); + glUniform1i(mask_sampler_uniform_location, 1); + shader->mask_wh = glGetUniformLocation(prog, "mask_wh"); + shader->mask_repeat_mode = + glGetUniformLocation(prog, "mask_repeat_mode"); + } + } +} + +static glamor_composite_shader * +glamor_lookup_composite_shader(ScreenPtr screen, struct + shader_key + *key) +{ + glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); + glamor_composite_shader *shader; + + shader = &glamor_priv->composite_shader[key->source][key->mask][key->in]; + if (shader->prog == 0) + glamor_create_composite_shader(screen, key, shader); + + return shader; +} + +static void +glamor_init_eb(unsigned short *eb, int vert_cnt) +{ + int i, j; + + for (i = 0, j = 0; j < vert_cnt; i += 6, j += 4) { + eb[i] = j; + eb[i + 1] = j + 1; + eb[i + 2] = j + 2; + eb[i + 3] = j; + eb[i + 4] = j + 2; + eb[i + 5] = j + 3; + } +} + +void +glamor_init_composite_shaders(ScreenPtr screen) +{ + glamor_screen_private *glamor_priv; + unsigned short *eb; + int eb_size; + + glamor_priv = glamor_get_screen_private(screen); + glamor_make_current(glamor_priv); + glGenBuffers(1, &glamor_priv->ebo); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, glamor_priv->ebo); + + eb_size = GLAMOR_COMPOSITE_VBO_VERT_CNT * sizeof(short) * 2; + + eb = XNFalloc(eb_size); + glamor_init_eb(eb, GLAMOR_COMPOSITE_VBO_VERT_CNT); + glBufferData(GL_ELEMENT_ARRAY_BUFFER, eb_size, eb, GL_STATIC_DRAW); + free(eb); +} + +void +glamor_fini_composite_shaders(ScreenPtr screen) +{ + glamor_screen_private *glamor_priv; + glamor_composite_shader *shader; + int i, j, k; + + glamor_priv = glamor_get_screen_private(screen); + glamor_make_current(glamor_priv); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); + glDeleteBuffers(1, &glamor_priv->ebo); + + for (i = 0; i < SHADER_SOURCE_COUNT; i++) + for (j = 0; j < SHADER_MASK_COUNT; j++) + for (k = 0; k < SHADER_IN_COUNT; k++) { + shader = &glamor_priv->composite_shader[i][j][k]; + if (shader->prog) + glDeleteProgram(shader->prog); + } +} + +static Bool +glamor_set_composite_op(ScreenPtr screen, + CARD8 op, struct blendinfo *op_info_result, + PicturePtr dest, PicturePtr mask) +{ + GLenum source_blend, dest_blend; + struct blendinfo *op_info; + + if (op >= ARRAY_SIZE(composite_op_info)) { + glamor_fallback("unsupported render op %d \n", op); + return GL_FALSE; + } + op_info = &composite_op_info[op]; + + source_blend = op_info->source_blend; + dest_blend = op_info->dest_blend; + + /* If there's no dst alpha channel, adjust the blend op so that we'll treat + * it as always 1. + */ + if (PICT_FORMAT_A(dest->format) == 0 && op_info->dest_alpha) { + if (source_blend == GL_DST_ALPHA) + source_blend = GL_ONE; + else if (source_blend == GL_ONE_MINUS_DST_ALPHA) + source_blend = GL_ZERO; + } + + /* Set up the source alpha value for blending in component alpha mode. */ + if (mask && mask->componentAlpha + && PICT_FORMAT_RGB(mask->format) != 0 && op_info->source_alpha) { + if (dest_blend == GL_SRC_ALPHA) + dest_blend = GL_SRC_COLOR; + else if (dest_blend == GL_ONE_MINUS_SRC_ALPHA) + dest_blend = GL_ONE_MINUS_SRC_COLOR; + } + + op_info_result->source_blend = source_blend; + op_info_result->dest_blend = dest_blend; + op_info_result->source_alpha = op_info->source_alpha; + op_info_result->dest_alpha = op_info->dest_alpha; + + return TRUE; +} + +static void +glamor_set_composite_texture(glamor_screen_private *glamor_priv, int unit, + PicturePtr picture, + glamor_pixmap_private *pixmap_priv, + GLuint wh_location, GLuint repeat_location) +{ + float wh[4]; + int repeat_type; + + glamor_make_current(glamor_priv); + glActiveTexture(GL_TEXTURE0 + unit); + glBindTexture(GL_TEXTURE_2D, pixmap_priv->base.fbo->tex); + repeat_type = picture->repeatType; + switch (picture->repeatType) { + case RepeatNone: + if (glamor_priv->gl_flavor != GLAMOR_GL_ES2) { + /* XXX GLES2 doesn't support GL_CLAMP_TO_BORDER. */ + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, + GL_CLAMP_TO_BORDER); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, + GL_CLAMP_TO_BORDER); + } else { + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + } + break; + case RepeatNormal: + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); + break; + case RepeatPad: + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + break; + case RepeatReflect: + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_MIRRORED_REPEAT); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_MIRRORED_REPEAT); + break; + } + + switch (picture->filter) { + default: + case PictFilterFast: + case PictFilterNearest: + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + break; + case PictFilterGood: + case PictFilterBest: + case PictFilterBilinear: + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + break; + } + + /* + * GLES2 doesn't support RepeatNone. We need to fix it anyway. + * + **/ + if (repeat_type != RepeatNone) + repeat_type += RepeatFix; + else if (glamor_priv->gl_flavor == GLAMOR_GL_ES2 + || pixmap_priv->type == GLAMOR_TEXTURE_LARGE) { + if (picture->transform + || (GLAMOR_PIXMAP_FBO_NOT_EXACT_SIZE(pixmap_priv))) + repeat_type += RepeatFix; + } + if (repeat_type >= RepeatFix) { + glamor_pixmap_fbo_fix_wh_ratio(wh, pixmap_priv); + if ((wh[0] != 1.0 || wh[1] != 1.0) + || (glamor_priv->gl_flavor == GLAMOR_GL_ES2 + && repeat_type == RepeatFix)) + glUniform4fv(wh_location, 1, wh); + else + repeat_type -= RepeatFix; + } + glUniform1i(repeat_location, repeat_type); +} + +static void +glamor_set_composite_solid(float *color, GLint uniform_location) +{ + glUniform4fv(uniform_location, 1, color); +} + +static int +compatible_formats(CARD8 op, PicturePtr dst, PicturePtr src) +{ + if (op == PictOpSrc) { + if (src->format == dst->format) + return 1; + + if (src->format == PICT_a8r8g8b8 && dst->format == PICT_x8r8g8b8) + return 1; + + if (src->format == PICT_a8b8g8r8 && dst->format == PICT_x8b8g8r8) + return 1; + } + else if (op == PictOpOver) { + if (src->alphaMap || dst->alphaMap) + return 0; + + if (src->format != dst->format) + return 0; + + if (src->format == PICT_x8r8g8b8 || src->format == PICT_x8b8g8r8) + return 1; + } + + return 0; +} + +static char +glamor_get_picture_location(PicturePtr picture) +{ + if (picture == NULL) + return ' '; + + if (picture->pDrawable == NULL) { + switch (picture->pSourcePict->type) { + case SourcePictTypeSolidFill: + return 'c'; + case SourcePictTypeLinear: + return 'l'; + case SourcePictTypeRadial: + return 'r'; + default: + return '?'; + } + } + return glamor_get_drawable_location(picture->pDrawable); +} + +static Bool +glamor_composite_with_copy(CARD8 op, + PicturePtr source, + PicturePtr dest, + INT16 x_source, + INT16 y_source, + INT16 x_dest, INT16 y_dest, RegionPtr region) +{ + int ret = FALSE; + + if (!source->pDrawable) + return FALSE; + + if (!compatible_formats(op, dest, source)) + return FALSE; + + if (source->repeat || source->transform) { + return FALSE; + } + + x_dest += dest->pDrawable->x; + y_dest += dest->pDrawable->y; + x_source += source->pDrawable->x; + y_source += source->pDrawable->y; + if (PICT_FORMAT_A(source->format) == 0) { + /* Fallback if we sample outside the source so that we + * swizzle the correct clear color for out-of-bounds texels. + */ + if (region->extents.x1 + x_source - x_dest < 0) + goto cleanup_region; + if (region->extents.x2 + x_source - x_dest > source->pDrawable->width) + goto cleanup_region; + + if (region->extents.y1 + y_source - y_dest < 0) + goto cleanup_region; + if (region->extents.y2 + y_source - y_dest > source->pDrawable->height) + goto cleanup_region; + } + ret = glamor_copy_n_to_n_nf(source->pDrawable, + dest->pDrawable, NULL, + RegionRects(region), RegionNumRects(region), + x_source - x_dest, y_source - y_dest, + FALSE, FALSE, 0, NULL); + cleanup_region: + return ret; +} + +void * +glamor_setup_composite_vbo(ScreenPtr screen, int n_verts) +{ + glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); + int vert_size; + char *vbo_offset; + float *vb; + + glamor_priv->render_nr_verts = 0; + glamor_priv->vb_stride = 2 * sizeof(float); + if (glamor_priv->has_source_coords) + glamor_priv->vb_stride += 2 * sizeof(float); + if (glamor_priv->has_mask_coords) + glamor_priv->vb_stride += 2 * sizeof(float); + + vert_size = n_verts * glamor_priv->vb_stride; + + glamor_make_current(glamor_priv); + vb = glamor_get_vbo_space(screen, vert_size, &vbo_offset); + + glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT, GL_FALSE, + glamor_priv->vb_stride, vbo_offset); + glEnableVertexAttribArray(GLAMOR_VERTEX_POS); + + if (glamor_priv->has_source_coords) { + glVertexAttribPointer(GLAMOR_VERTEX_SOURCE, 2, + GL_FLOAT, GL_FALSE, + glamor_priv->vb_stride, + vbo_offset + 2 * sizeof(float)); + glEnableVertexAttribArray(GLAMOR_VERTEX_SOURCE); + } + + if (glamor_priv->has_mask_coords) { + glVertexAttribPointer(GLAMOR_VERTEX_MASK, 2, GL_FLOAT, GL_FALSE, + glamor_priv->vb_stride, + vbo_offset + (glamor_priv->has_source_coords ? + 4 : 2) * sizeof(float)); + glEnableVertexAttribArray(GLAMOR_VERTEX_MASK); + } + + return vb; +} + +static void +glamor_flush_composite_rects(ScreenPtr screen) +{ + glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); + + glamor_make_current(glamor_priv); + + if (!glamor_priv->render_nr_verts) + return; + + if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) { + glDrawRangeElements(GL_TRIANGLES, 0, glamor_priv->render_nr_verts, + (glamor_priv->render_nr_verts * 3) / 2, + GL_UNSIGNED_SHORT, NULL); + } else { + glDrawElements(GL_TRIANGLES, (glamor_priv->render_nr_verts * 3) / 2, + GL_UNSIGNED_SHORT, NULL); + } +} + +int pict_format_combine_tab[][3] = { + {PICT_TYPE_ARGB, PICT_TYPE_A, PICT_TYPE_ARGB}, + {PICT_TYPE_ABGR, PICT_TYPE_A, PICT_TYPE_ABGR}, +}; + +static Bool +combine_pict_format(PictFormatShort * des, const PictFormatShort src, + const PictFormatShort mask, enum shader_in in_ca) +{ + PictFormatShort new_vis; + int src_type, mask_type, src_bpp; + int i; + + if (src == mask) { + *des = src; + return TRUE; + } + src_bpp = PICT_FORMAT_BPP(src); + + assert(src_bpp == PICT_FORMAT_BPP(mask)); + + new_vis = PICT_FORMAT_VIS(src) | PICT_FORMAT_VIS(mask); + + switch (in_ca) { + case SHADER_IN_SOURCE_ONLY: + return TRUE; + case SHADER_IN_NORMAL: + src_type = PICT_FORMAT_TYPE(src); + mask_type = PICT_TYPE_A; + break; + case SHADER_IN_CA_SOURCE: + src_type = PICT_FORMAT_TYPE(src); + mask_type = PICT_FORMAT_TYPE(mask); + break; + case SHADER_IN_CA_ALPHA: + src_type = PICT_TYPE_A; + mask_type = PICT_FORMAT_TYPE(mask); + break; + default: + return FALSE; + } + + if (src_type == mask_type) { + *des = PICT_VISFORMAT(src_bpp, src_type, new_vis); + return TRUE; + } + + for (i = 0; + i < + sizeof(pict_format_combine_tab) / + sizeof(pict_format_combine_tab[0]); i++) { + if ((src_type == pict_format_combine_tab[i][0] + && mask_type == pict_format_combine_tab[i][1]) + || (src_type == pict_format_combine_tab[i][1] + && mask_type == pict_format_combine_tab[i][0])) { + *des = PICT_VISFORMAT(src_bpp, pict_format_combine_tab[i] + [2], new_vis); + return TRUE; + } + } + return FALSE; +} + +static void +glamor_set_normalize_tcoords_generic(glamor_pixmap_private *priv, + int repeat_type, + float *matrix, + float xscale, float yscale, + int x1, int y1, int x2, int y2, + int yInverted, float *texcoords, + int stride) +{ + if (!matrix && repeat_type == RepeatNone) + glamor_set_normalize_tcoords_ext(priv, xscale, yscale, + x1, y1, + x2, y2, yInverted, texcoords, stride); + else if (matrix && repeat_type == RepeatNone) + glamor_set_transformed_normalize_tcoords_ext(priv, matrix, xscale, + yscale, x1, y1, + x2, y2, + yInverted, + texcoords, stride); + else if (!matrix && repeat_type != RepeatNone) + glamor_set_repeat_normalize_tcoords_ext(priv, repeat_type, + xscale, yscale, + x1, y1, + x2, y2, + yInverted, texcoords, stride); + else if (matrix && repeat_type != RepeatNone) + glamor_set_repeat_transformed_normalize_tcoords_ext(priv, repeat_type, + matrix, xscale, + yscale, x1, y1, x2, + y2, yInverted, + texcoords, stride); +} + +Bool +glamor_composite_choose_shader(CARD8 op, + PicturePtr source, + PicturePtr mask, + PicturePtr dest, + glamor_pixmap_private *source_pixmap_priv, + glamor_pixmap_private *mask_pixmap_priv, + glamor_pixmap_private *dest_pixmap_priv, + struct shader_key *s_key, + glamor_composite_shader ** shader, + struct blendinfo *op_info, + PictFormatShort *psaved_source_format) +{ + ScreenPtr screen = dest->pDrawable->pScreen; + PixmapPtr dest_pixmap = dest_pixmap_priv->base.pixmap; + PixmapPtr source_pixmap = NULL; + PixmapPtr mask_pixmap = NULL; + enum glamor_pixmap_status source_status = GLAMOR_NONE; + enum glamor_pixmap_status mask_status = GLAMOR_NONE; + PictFormatShort saved_source_format = 0; + struct shader_key key; + GLfloat source_solid_color[4]; + GLfloat mask_solid_color[4]; + Bool ret = FALSE; + + if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(dest_pixmap_priv)) { + glamor_fallback("dest has no fbo.\n"); + goto fail; + } + + memset(&key, 0, sizeof(key)); + if (!source) { + key.source = SHADER_SOURCE_SOLID; + source_solid_color[0] = 0.0; + source_solid_color[1] = 0.0; + source_solid_color[2] = 0.0; + source_solid_color[3] = 0.0; + } + else if (!source->pDrawable) { + if (source->pSourcePict->type == SourcePictTypeSolidFill) { + key.source = SHADER_SOURCE_SOLID; + glamor_get_rgba_from_pixel(source->pSourcePict->solidFill.color, + &source_solid_color[0], + &source_solid_color[1], + &source_solid_color[2], + &source_solid_color[3], PICT_a8r8g8b8); + } + else + goto fail; + } + else { + if (PICT_FORMAT_A(source->format)) + key.source = SHADER_SOURCE_TEXTURE_ALPHA; + else + key.source = SHADER_SOURCE_TEXTURE; + } + + if (mask) { + if (!mask->pDrawable) { + if (mask->pSourcePict->type == SourcePictTypeSolidFill) { + key.mask = SHADER_MASK_SOLID; + glamor_get_rgba_from_pixel + (mask->pSourcePict->solidFill.color, + &mask_solid_color[0], + &mask_solid_color[1], + &mask_solid_color[2], &mask_solid_color[3], PICT_a8r8g8b8); + } + else + goto fail; + } + else { + key.mask = SHADER_MASK_TEXTURE_ALPHA; + } + + if (!mask->componentAlpha) { + key.in = SHADER_IN_NORMAL; + } + else { + if (op == PictOpClear) + key.mask = SHADER_MASK_NONE; + else if (op == PictOpSrc || op == PictOpAdd + || op == PictOpIn || op == PictOpOut + || op == PictOpOverReverse) + key.in = SHADER_IN_CA_SOURCE; + else if (op == PictOpOutReverse || op == PictOpInReverse) { + key.in = SHADER_IN_CA_ALPHA; + } + else { + glamor_fallback("Unsupported component alpha op: %d\n", op); + goto fail; + } + } + } + else { + key.mask = SHADER_MASK_NONE; + key.in = SHADER_IN_SOURCE_ONLY; + } + + if (source && source->alphaMap) { + glamor_fallback("source alphaMap\n"); + goto fail; + } + if (mask && mask->alphaMap) { + glamor_fallback("mask alphaMap\n"); + goto fail; + } + + if (key.source == SHADER_SOURCE_TEXTURE || + key.source == SHADER_SOURCE_TEXTURE_ALPHA) { + source_pixmap = source_pixmap_priv->base.pixmap; + if (source_pixmap == dest_pixmap) { + /* XXX source and the dest share the same texture. + * Does it need special handle? */ + glamor_fallback("source == dest\n"); + } + if (source_pixmap_priv->base.gl_fbo == GLAMOR_FBO_UNATTACHED) { +#ifdef GLAMOR_PIXMAP_DYNAMIC_UPLOAD + source_status = GLAMOR_UPLOAD_PENDING; +#else + glamor_fallback("no texture in source\n"); + goto fail; +#endif + } + } + + if (key.mask == SHADER_MASK_TEXTURE || + key.mask == SHADER_MASK_TEXTURE_ALPHA) { + mask_pixmap = mask_pixmap_priv->base.pixmap; + if (mask_pixmap == dest_pixmap) { + glamor_fallback("mask == dest\n"); + goto fail; + } + if (mask_pixmap_priv->base.gl_fbo == GLAMOR_FBO_UNATTACHED) { +#ifdef GLAMOR_PIXMAP_DYNAMIC_UPLOAD + mask_status = GLAMOR_UPLOAD_PENDING; +#else + glamor_fallback("no texture in mask\n"); + goto fail; +#endif + } + } + +#ifdef GLAMOR_PIXMAP_DYNAMIC_UPLOAD + if (source_status == GLAMOR_UPLOAD_PENDING + && mask_status == GLAMOR_UPLOAD_PENDING + && source_pixmap == mask_pixmap) { + + if (source->format != mask->format) { + saved_source_format = source->format; + + if (!combine_pict_format(&source->format, source->format, + mask->format, key.in)) { + glamor_fallback("combine source %x mask %x failed.\n", + source->format, mask->format); + goto fail; + } + + if (source->format != saved_source_format) { + glamor_picture_format_fixup(source, source_pixmap_priv); + } + /* XXX + * By default, glamor_upload_picture_to_texture will wire alpha to 1 + * if one picture doesn't have alpha. So we don't do that again in + * rendering function. But here is a special case, as source and + * mask share the same texture but may have different formats. For + * example, source doesn't have alpha, but mask has alpha. Then the + * texture will have the alpha value for the mask. And will not wire + * to 1 for the source. In this case, we have to use different shader + * to wire the source's alpha to 1. + * + * But this may cause a potential problem if the source's repeat mode + * is REPEAT_NONE, and if the source is smaller than the dest, then + * for the region not covered by the source may be painted incorrectly. + * because we wire the alpha to 1. + * + **/ + if (!PICT_FORMAT_A(saved_source_format) + && PICT_FORMAT_A(mask->format)) + key.source = SHADER_SOURCE_TEXTURE; + + if (!PICT_FORMAT_A(mask->format) + && PICT_FORMAT_A(saved_source_format)) + key.mask = SHADER_MASK_TEXTURE; + + mask_status = GLAMOR_NONE; + } + + source_status = glamor_upload_picture_to_texture(source); + if (source_status != GLAMOR_UPLOAD_DONE) { + glamor_fallback("Failed to upload source texture.\n"); + goto fail; + } + } + else { + if (source_status == GLAMOR_UPLOAD_PENDING) { + source_status = glamor_upload_picture_to_texture(source); + if (source_status != GLAMOR_UPLOAD_DONE) { + glamor_fallback("Failed to upload source texture.\n"); + goto fail; + } + } + + if (mask_status == GLAMOR_UPLOAD_PENDING) { + mask_status = glamor_upload_picture_to_texture(mask); + if (mask_status != GLAMOR_UPLOAD_DONE) { + glamor_fallback("Failed to upload mask texture.\n"); + goto fail; + } + } + } +#endif + + /* If the source and mask are two differently-formatted views of + * the same pixmap bits, and the pixmap was already uploaded (so + * the dynamic code above doesn't apply), then fall back to + * software. We should use texture views to fix this properly. + */ + if (source_pixmap && source_pixmap == mask_pixmap && + source->format != mask->format) { + goto fail; + } + + /*Before enter the rendering stage, we need to fixup + * transformed source and mask, if the transform is not int translate. */ + if (key.source != SHADER_SOURCE_SOLID + && source->transform + && !pixman_transform_is_int_translate(source->transform) + && source_pixmap_priv->type != GLAMOR_TEXTURE_LARGE) { + if (!glamor_fixup_pixmap_priv(screen, source_pixmap_priv)) + goto fail; + } + if (key.mask != SHADER_MASK_NONE && key.mask != SHADER_MASK_SOLID + && mask->transform + && !pixman_transform_is_int_translate(mask->transform) + && mask_pixmap_priv->type != GLAMOR_TEXTURE_LARGE) { + if (!glamor_fixup_pixmap_priv(screen, mask_pixmap_priv)) + goto fail; + } + + if (!glamor_set_composite_op(screen, op, op_info, dest, mask)) + goto fail; + + *shader = glamor_lookup_composite_shader(screen, &key); + if ((*shader)->prog == 0) { + glamor_fallback("no shader program for this render acccel mode\n"); + goto fail; + } + + if (key.source == SHADER_SOURCE_SOLID) + memcpy(&(*shader)->source_solid_color[0], + source_solid_color, 4 * sizeof(float)); + else { + (*shader)->source_priv = source_pixmap_priv; + (*shader)->source = source; + } + + if (key.mask == SHADER_MASK_SOLID) + memcpy(&(*shader)->mask_solid_color[0], + mask_solid_color, 4 * sizeof(float)); + else { + (*shader)->mask_priv = mask_pixmap_priv; + (*shader)->mask = mask; + } + + ret = TRUE; + memcpy(s_key, &key, sizeof(key)); + *psaved_source_format = saved_source_format; + goto done; + + fail: + if (saved_source_format) + source->format = saved_source_format; + done: + return ret; +} + +void +glamor_composite_set_shader_blend(glamor_pixmap_private *dest_priv, + struct shader_key *key, + glamor_composite_shader *shader, + struct blendinfo *op_info) +{ + glamor_screen_private *glamor_priv; + + glamor_priv = dest_priv->base.glamor_priv; + + glamor_make_current(glamor_priv); + glUseProgram(shader->prog); + + if (key->source == SHADER_SOURCE_SOLID) { + glamor_set_composite_solid(shader->source_solid_color, + shader->source_uniform_location); + } + else { + glamor_set_composite_texture(glamor_priv, 0, + shader->source, + shader->source_priv, shader->source_wh, + shader->source_repeat_mode); + } + + if (key->mask != SHADER_MASK_NONE) { + if (key->mask == SHADER_MASK_SOLID) { + glamor_set_composite_solid(shader->mask_solid_color, + shader->mask_uniform_location); + } + else { + glamor_set_composite_texture(glamor_priv, 1, + shader->mask, + shader->mask_priv, shader->mask_wh, + shader->mask_repeat_mode); + } + } + + if (op_info->source_blend == GL_ONE && op_info->dest_blend == GL_ZERO) { + glDisable(GL_BLEND); + } + else { + glEnable(GL_BLEND); + glBlendFunc(op_info->source_blend, op_info->dest_blend); + } +} + +static Bool +glamor_composite_with_shader(CARD8 op, + PicturePtr source, + PicturePtr mask, + PicturePtr dest, + glamor_pixmap_private *source_pixmap_priv, + glamor_pixmap_private *mask_pixmap_priv, + glamor_pixmap_private *dest_pixmap_priv, + int nrect, glamor_composite_rect_t *rects, + Bool two_pass_ca) +{ + ScreenPtr screen = dest->pDrawable->pScreen; + glamor_screen_private *glamor_priv = dest_pixmap_priv->base.glamor_priv; + PixmapPtr dest_pixmap = dest_pixmap_priv->base.pixmap; + PixmapPtr source_pixmap = NULL; + PixmapPtr mask_pixmap = NULL; + GLfloat dst_xscale, dst_yscale; + GLfloat mask_xscale = 1, mask_yscale = 1, src_xscale = 1, src_yscale = 1; + struct shader_key key, key_ca; + int dest_x_off, dest_y_off; + int source_x_off, source_y_off; + int mask_x_off, mask_y_off; + PictFormatShort saved_source_format = 0; + float src_matrix[9], mask_matrix[9]; + float *psrc_matrix = NULL, *pmask_matrix = NULL; + int nrect_max; + Bool ret = FALSE; + glamor_composite_shader *shader = NULL, *shader_ca = NULL; + struct blendinfo op_info, op_info_ca; + + if (!glamor_composite_choose_shader(op, source, mask, dest, + source_pixmap_priv, mask_pixmap_priv, + dest_pixmap_priv, + &key, &shader, &op_info, + &saved_source_format)) { + glamor_fallback("glamor_composite_choose_shader failed\n"); + return ret; + } + if (two_pass_ca) { + if (!glamor_composite_choose_shader(PictOpAdd, source, mask, dest, + source_pixmap_priv, + mask_pixmap_priv, dest_pixmap_priv, + &key_ca, &shader_ca, &op_info_ca, + &saved_source_format)) { + glamor_fallback("glamor_composite_choose_shader failed\n"); + return ret; + } + } + + glamor_set_destination_pixmap_priv_nc(dest_pixmap_priv); + glamor_composite_set_shader_blend(dest_pixmap_priv, &key, shader, &op_info); + + glamor_make_current(glamor_priv); + + glamor_priv->has_source_coords = key.source != SHADER_SOURCE_SOLID; + glamor_priv->has_mask_coords = (key.mask != SHADER_MASK_NONE && + key.mask != SHADER_MASK_SOLID); + + dest_pixmap = glamor_get_drawable_pixmap(dest->pDrawable); + dest_pixmap_priv = glamor_get_pixmap_private(dest_pixmap); + glamor_get_drawable_deltas(dest->pDrawable, dest_pixmap, + &dest_x_off, &dest_y_off); + pixmap_priv_get_dest_scale(dest_pixmap_priv, &dst_xscale, &dst_yscale); + + if (glamor_priv->has_source_coords) { + source_pixmap = source_pixmap_priv->base.pixmap; + glamor_get_drawable_deltas(source->pDrawable, + source_pixmap, &source_x_off, &source_y_off); + pixmap_priv_get_scale(source_pixmap_priv, &src_xscale, &src_yscale); + if (source->transform) { + psrc_matrix = src_matrix; + glamor_picture_get_matrixf(source, psrc_matrix); + } + } + + if (glamor_priv->has_mask_coords) { + mask_pixmap = mask_pixmap_priv->base.pixmap; + glamor_get_drawable_deltas(mask->pDrawable, mask_pixmap, + &mask_x_off, &mask_y_off); + pixmap_priv_get_scale(mask_pixmap_priv, &mask_xscale, &mask_yscale); + if (mask->transform) { + pmask_matrix = mask_matrix; + glamor_picture_get_matrixf(mask, pmask_matrix); + } + } + + nrect_max = MIN(nrect, GLAMOR_COMPOSITE_VBO_VERT_CNT / 4); + + while (nrect) { + int mrect, rect_processed; + int vb_stride; + float *vertices; + + mrect = nrect > nrect_max ? nrect_max : nrect; + vertices = glamor_setup_composite_vbo(screen, mrect * 4); + rect_processed = mrect; + vb_stride = glamor_priv->vb_stride / sizeof(float); + while (mrect--) { + INT16 x_source; + INT16 y_source; + INT16 x_mask; + INT16 y_mask; + INT16 x_dest; + INT16 y_dest; + CARD16 width; + CARD16 height; + + x_dest = rects->x_dst + dest_x_off; + y_dest = rects->y_dst + dest_y_off; + x_source = rects->x_src + source_x_off; + y_source = rects->y_src + source_y_off; + x_mask = rects->x_mask + mask_x_off; + y_mask = rects->y_mask + mask_y_off; + width = rects->width; + height = rects->height; + + DEBUGF + ("dest(%d,%d) source(%d %d) mask (%d %d), width %d height %d \n", + x_dest, y_dest, x_source, y_source, x_mask, y_mask, width, + height); + + glamor_set_normalize_vcoords_ext(dest_pixmap_priv, dst_xscale, + dst_yscale, x_dest, y_dest, + x_dest + width, y_dest + height, + glamor_priv->yInverted, vertices, + vb_stride); + vertices += 2; + if (key.source != SHADER_SOURCE_SOLID) { + glamor_set_normalize_tcoords_generic(source_pixmap_priv, + source->repeatType, + psrc_matrix, src_xscale, + src_yscale, x_source, + y_source, x_source + width, + y_source + height, + glamor_priv->yInverted, + vertices, vb_stride); + vertices += 2; + } + + if (key.mask != SHADER_MASK_NONE && key.mask != SHADER_MASK_SOLID) { + glamor_set_normalize_tcoords_generic(mask_pixmap_priv, + mask->repeatType, + pmask_matrix, mask_xscale, + mask_yscale, x_mask, + y_mask, x_mask + width, + y_mask + height, + glamor_priv->yInverted, + vertices, vb_stride); + vertices += 2; + } + glamor_priv->render_nr_verts += 4; + rects++; + + /* We've incremented by one of our 4 verts, now do the other 3. */ + vertices += 3 * vb_stride; + } + glamor_put_vbo_space(screen); + glamor_flush_composite_rects(screen); + nrect -= rect_processed; + if (two_pass_ca) { + glamor_composite_set_shader_blend(dest_pixmap_priv, + &key_ca, shader_ca, &op_info_ca); + glamor_flush_composite_rects(screen); + if (nrect) + glamor_composite_set_shader_blend(dest_pixmap_priv, + &key, shader, &op_info); + } + } + + glDisableVertexAttribArray(GLAMOR_VERTEX_POS); + glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE); + glDisableVertexAttribArray(GLAMOR_VERTEX_MASK); + glDisable(GL_BLEND); + DEBUGF("finish rendering.\n"); + glamor_priv->state = RENDER_STATE; + glamor_priv->render_idle_cnt = 0; + if (saved_source_format) + source->format = saved_source_format; + + ret = TRUE; + return ret; +} + +PicturePtr +glamor_convert_gradient_picture(ScreenPtr screen, + PicturePtr source, + int x_source, + int y_source, int width, int height) +{ + PixmapPtr pixmap; + PicturePtr dst = NULL; + int error; + PictFormatShort format; + + if (!source->pDrawable) + format = PICT_a8r8g8b8; + else + format = source->format; +#ifdef GLAMOR_GRADIENT_SHADER + if (!source->pDrawable) { + if (source->pSourcePict->type == SourcePictTypeLinear) { + dst = glamor_generate_linear_gradient_picture(screen, + source, x_source, + y_source, width, + height, format); + } + else if (source->pSourcePict->type == SourcePictTypeRadial) { + dst = glamor_generate_radial_gradient_picture(screen, + source, x_source, + y_source, width, + height, format); + } + + if (dst) { +#if 0 /* Debug to compare it to pixman, Enable it if needed. */ + glamor_compare_pictures(screen, source, + dst, x_source, y_source, width, height, + 0, 3); +#endif + return dst; + } + } +#endif + pixmap = glamor_create_pixmap(screen, + width, + height, + PIXMAN_FORMAT_DEPTH(format), + GLAMOR_CREATE_PIXMAP_CPU); + + if (!pixmap) + return NULL; + + dst = CreatePicture(0, + &pixmap->drawable, + PictureMatchFormat(screen, + PIXMAN_FORMAT_DEPTH(format), + format), 0, 0, serverClient, &error); + glamor_destroy_pixmap(pixmap); + if (!dst) + return NULL; + + ValidatePicture(dst); + + fbComposite(PictOpSrc, source, NULL, dst, x_source, y_source, + 0, 0, 0, 0, width, height); + return dst; +} + +Bool +glamor_composite_clipped_region(CARD8 op, + PicturePtr source, + PicturePtr mask, + PicturePtr dest, + glamor_pixmap_private *source_pixmap_priv, + glamor_pixmap_private *mask_pixmap_priv, + glamor_pixmap_private *dest_pixmap_priv, + RegionPtr region, + int x_source, + int y_source, + int x_mask, int y_mask, int x_dest, int y_dest) +{ + ScreenPtr screen = dest->pDrawable->pScreen; + PixmapPtr source_pixmap = NULL, mask_pixmap = NULL; + PicturePtr temp_src = source, temp_mask = mask; + glamor_pixmap_private *temp_src_priv = source_pixmap_priv; + glamor_pixmap_private *temp_mask_priv = mask_pixmap_priv; + int x_temp_src, y_temp_src, x_temp_mask, y_temp_mask; + BoxPtr extent; + glamor_composite_rect_t rect[10]; + glamor_composite_rect_t *prect = rect; + int prect_size = ARRAY_SIZE(rect); + int ok = FALSE; + int i; + int width; + int height; + BoxPtr box; + int nbox; + Bool two_pass_ca = FALSE; + + extent = RegionExtents(region); + box = RegionRects(region); + nbox = RegionNumRects(region); + width = extent->x2 - extent->x1; + height = extent->y2 - extent->y1; + + x_temp_src = x_source; + y_temp_src = y_source; + x_temp_mask = x_mask; + y_temp_mask = y_mask; + + DEBUGF("clipped (%d %d) (%d %d) (%d %d) width %d height %d \n", + x_source, y_source, x_mask, y_mask, x_dest, y_dest, width, height); + + if (source_pixmap_priv) + source_pixmap = source_pixmap_priv->base.pixmap; + + if (mask_pixmap_priv) + mask_pixmap = mask_pixmap_priv->base.pixmap; + + /* XXX is it possible source mask have non-zero drawable.x/y? */ + if (source + && ((!source->pDrawable + && (source->pSourcePict->type != SourcePictTypeSolidFill)) + || (source->pDrawable + && !GLAMOR_PIXMAP_PRIV_HAS_FBO(source_pixmap_priv) + && (source_pixmap->drawable.width != width + || source_pixmap->drawable.height != height)))) { + temp_src = + glamor_convert_gradient_picture(screen, source, + extent->x1 + x_source - x_dest - dest->pDrawable->x, + extent->y1 + y_source - y_dest - dest->pDrawable->y, + width, height); + if (!temp_src) { + temp_src = source; + goto out; + } + temp_src_priv = + glamor_get_pixmap_private((PixmapPtr) (temp_src->pDrawable)); + x_temp_src = -extent->x1 + x_dest + dest->pDrawable->x; + y_temp_src = -extent->y1 + y_dest + dest->pDrawable->y; + } + + if (mask + && + ((!mask->pDrawable + && (mask->pSourcePict->type != SourcePictTypeSolidFill)) + || (mask->pDrawable && !GLAMOR_PIXMAP_PRIV_HAS_FBO(mask_pixmap_priv) + && (mask_pixmap->drawable.width != width + || mask_pixmap->drawable.height != height)))) { + /* XXX if mask->pDrawable is the same as source->pDrawable, we have an opportunity + * to do reduce one convertion. */ + temp_mask = + glamor_convert_gradient_picture(screen, mask, + extent->x1 + x_mask - x_dest - dest->pDrawable->x, + extent->y1 + y_mask - y_dest - dest->pDrawable->y, + width, height); + if (!temp_mask) { + temp_mask = mask; + goto out; + } + temp_mask_priv = + glamor_get_pixmap_private((PixmapPtr) (temp_mask->pDrawable)); + x_temp_mask = -extent->x1 + x_dest + dest->pDrawable->x; + y_temp_mask = -extent->y1 + y_dest + dest->pDrawable->y; + } + /* Do two-pass PictOpOver componentAlpha, until we enable + * dual source color blending. + */ + + if (mask && mask->componentAlpha) { + if (op == PictOpOver) { + two_pass_ca = TRUE; + op = PictOpOutReverse; + } + } + + if (!mask && temp_src) { + if (glamor_composite_with_copy(op, temp_src, dest, + x_temp_src, y_temp_src, + x_dest, y_dest, region)) { + ok = TRUE; + goto out; + } + } + + /*XXXXX, self copy? */ + + x_dest += dest->pDrawable->x; + y_dest += dest->pDrawable->y; + if (temp_src && temp_src->pDrawable) { + x_temp_src += temp_src->pDrawable->x; + y_temp_src += temp_src->pDrawable->y; + } + if (temp_mask && temp_mask->pDrawable) { + x_temp_mask += temp_mask->pDrawable->x; + y_temp_mask += temp_mask->pDrawable->y; + } + + if (nbox > ARRAY_SIZE(rect)) { + prect = calloc(nbox, sizeof(*prect)); + if (prect) + prect_size = nbox; + else { + prect = rect; + prect_size = ARRAY_SIZE(rect); + } + } + while (nbox) { + int box_cnt; + + box_cnt = nbox > prect_size ? prect_size : nbox; + for (i = 0; i < box_cnt; i++) { + prect[i].x_src = box[i].x1 + x_temp_src - x_dest; + prect[i].y_src = box[i].y1 + y_temp_src - y_dest; + prect[i].x_mask = box[i].x1 + x_temp_mask - x_dest; + prect[i].y_mask = box[i].y1 + y_temp_mask - y_dest; + prect[i].x_dst = box[i].x1; + prect[i].y_dst = box[i].y1; + prect[i].width = box[i].x2 - box[i].x1; + prect[i].height = box[i].y2 - box[i].y1; + DEBUGF("dest %d %d \n", prect[i].x_dst, prect[i].y_dst); + } + ok = glamor_composite_with_shader(op, temp_src, temp_mask, dest, + temp_src_priv, temp_mask_priv, + dest_pixmap_priv, + box_cnt, prect, two_pass_ca); + if (!ok) + break; + nbox -= box_cnt; + box += box_cnt; + } + + if (prect != rect) + free(prect); + out: + if (temp_src != source) + FreePicture(temp_src, 0); + if (temp_mask != mask) + FreePicture(temp_mask, 0); + + return ok; +} + +static Bool +_glamor_composite(CARD8 op, + PicturePtr source, + PicturePtr mask, + PicturePtr dest, + INT16 x_source, + INT16 y_source, + INT16 x_mask, + INT16 y_mask, + INT16 x_dest, INT16 y_dest, + CARD16 width, CARD16 height, Bool fallback) +{ + ScreenPtr screen = dest->pDrawable->pScreen; + glamor_pixmap_private *dest_pixmap_priv; + glamor_pixmap_private *source_pixmap_priv = NULL, *mask_pixmap_priv = NULL; + PixmapPtr dest_pixmap = glamor_get_drawable_pixmap(dest->pDrawable); + PixmapPtr source_pixmap = NULL, mask_pixmap = NULL; + glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); + Bool ret = TRUE; + RegionRec region; + BoxPtr extent; + int nbox, ok = FALSE; + PixmapPtr sub_dest_pixmap = NULL; + PixmapPtr sub_source_pixmap = NULL; + PixmapPtr sub_mask_pixmap = NULL; + int dest_x_off, dest_y_off, saved_dest_x, saved_dest_y; + int source_x_off, source_y_off, saved_source_x, saved_source_y; + int mask_x_off, mask_y_off, saved_mask_x, saved_mask_y; + DrawablePtr saved_dest_drawable; + DrawablePtr saved_source_drawable; + DrawablePtr saved_mask_drawable; + int force_clip = 0; + + dest_pixmap_priv = glamor_get_pixmap_private(dest_pixmap); + + if (source->pDrawable) { + source_pixmap = glamor_get_drawable_pixmap(source->pDrawable); + source_pixmap_priv = glamor_get_pixmap_private(source_pixmap); + if (source_pixmap_priv && source_pixmap_priv->type == GLAMOR_DRM_ONLY) + goto fail; + } + + if (mask && mask->pDrawable) { + mask_pixmap = glamor_get_drawable_pixmap(mask->pDrawable); + mask_pixmap_priv = glamor_get_pixmap_private(mask_pixmap); + if (mask_pixmap_priv && mask_pixmap_priv->type == GLAMOR_DRM_ONLY) + goto fail; + } + + DEBUGF + ("source pixmap %p (%d %d) mask(%d %d) dest(%d %d) width %d height %d \n", + source_pixmap, x_source, y_source, x_mask, y_mask, x_dest, y_dest, + width, height); + + if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(dest_pixmap_priv)) { + goto fail; + } + + if (op >= ARRAY_SIZE(composite_op_info)) + goto fail; + + if (mask && mask->componentAlpha) { + if (op == PictOpAtop + || op == PictOpAtopReverse + || op == PictOpXor || op >= PictOpSaturate) { + glamor_fallback("glamor_composite(): component alpha op %x\n", op); + goto fail; + } + } + + if ((source && source->filter >= PictFilterConvolution) + || (mask && mask->filter >= PictFilterConvolution)) { + glamor_fallback("glamor_composite(): unsupported filter\n"); + goto fail; + } + + if (!miComputeCompositeRegion(®ion, + source, mask, dest, + x_source + + (source_pixmap ? source->pDrawable->x : 0), + y_source + + (source_pixmap ? source->pDrawable->y : 0), + x_mask + + (mask_pixmap ? mask->pDrawable->x : 0), + y_mask + + (mask_pixmap ? mask->pDrawable->y : 0), + x_dest + dest->pDrawable->x, + y_dest + dest->pDrawable->y, width, height)) { + ret = TRUE; + goto done; + } + + nbox = REGION_NUM_RECTS(®ion); + DEBUGF("first clipped when compositing.\n"); + DEBUGRegionPrint(®ion); + extent = RegionExtents(®ion); + if (nbox == 0) { + ret = TRUE; + goto done; + } + /* If destination is not a large pixmap, but the region is larger + * than texture size limitation, and source or mask is memory pixmap, + * then there may be need to load a large memory pixmap to a + * texture, and this is not permitted. Then we force to clip the + * destination and make sure latter will not upload a large memory + * pixmap. */ + if (!glamor_check_fbo_size(glamor_priv, + extent->x2 - extent->x1, extent->y2 - extent->y1) + && (dest_pixmap_priv->type != GLAMOR_TEXTURE_LARGE) + && ((source_pixmap_priv + && (source_pixmap_priv->type == GLAMOR_MEMORY || + source->repeatType == RepeatPad)) + || (mask_pixmap_priv && + (mask_pixmap_priv->type == GLAMOR_MEMORY || + mask->repeatType == RepeatPad)) + || (!source_pixmap_priv && + (source->pSourcePict->type != SourcePictTypeSolidFill)) + || (!mask_pixmap_priv && mask && + mask->pSourcePict->type != SourcePictTypeSolidFill))) + force_clip = 1; + + if (force_clip || dest_pixmap_priv->type == GLAMOR_TEXTURE_LARGE + || (source_pixmap_priv + && source_pixmap_priv->type == GLAMOR_TEXTURE_LARGE) + || (mask_pixmap_priv && mask_pixmap_priv->type == GLAMOR_TEXTURE_LARGE)) + ok = glamor_composite_largepixmap_region(op, + source, mask, dest, + source_pixmap_priv, + mask_pixmap_priv, + dest_pixmap_priv, + ®ion, force_clip, + x_source, y_source, + x_mask, y_mask, + x_dest, y_dest, width, height); + else + ok = glamor_composite_clipped_region(op, source, + mask, dest, + source_pixmap_priv, + mask_pixmap_priv, + dest_pixmap_priv, + ®ion, + x_source, y_source, + x_mask, y_mask, x_dest, y_dest); + + REGION_UNINIT(dest->pDrawable->pScreen, ®ion); + + if (ok) + goto done; + fail: + + if (!fallback && glamor_ddx_fallback_check_pixmap(&dest_pixmap->drawable) + && (!source_pixmap + || glamor_ddx_fallback_check_pixmap(&source_pixmap->drawable)) + && (!mask_pixmap + || glamor_ddx_fallback_check_pixmap(&mask_pixmap->drawable))) { + ret = FALSE; + goto done; + } + + glamor_fallback + ("from picts %p:%p %dx%d / %p:%p %d x %d (%c,%c) to pict %p:%p %dx%d (%c)\n", + source, source->pDrawable, + source->pDrawable ? source->pDrawable->width : 0, + source->pDrawable ? source->pDrawable->height : 0, mask, + (!mask) ? NULL : mask->pDrawable, (!mask + || !mask->pDrawable) ? 0 : + mask->pDrawable->width, (!mask + || !mask->pDrawable) ? 0 : mask-> + pDrawable->height, glamor_get_picture_location(source), + glamor_get_picture_location(mask), dest, dest->pDrawable, + dest->pDrawable->width, dest->pDrawable->height, + glamor_get_picture_location(dest)); + +#define GET_SUB_PICTURE(p, access) do { \ + glamor_get_drawable_deltas(p->pDrawable, p ##_pixmap, \ + & p ##_x_off, & p ##_y_off); \ + sub_ ##p ##_pixmap = glamor_get_sub_pixmap(p ##_pixmap, \ + x_ ##p + p ##_x_off + p->pDrawable->x, \ + y_ ##p + p ##_y_off + p->pDrawable->y, \ + width, height, access); \ + if (sub_ ##p ##_pixmap != NULL) { \ + saved_ ##p ##_drawable = p->pDrawable; \ + saved_ ##p ##_x = x_ ##p; \ + saved_ ##p ##_y = y_ ##p; \ + if (p->pCompositeClip) \ + pixman_region_translate (p->pCompositeClip, \ + -p->pDrawable->x - x_ ##p, \ + -p->pDrawable->y - y_ ##p); \ + p->pDrawable = &sub_ ##p ##_pixmap->drawable; \ + x_ ##p = 0; \ + y_ ##p = 0; \ + } } while(0) + GET_SUB_PICTURE(dest, GLAMOR_ACCESS_RW); + if (source->pDrawable && !source->transform) + GET_SUB_PICTURE(source, GLAMOR_ACCESS_RO); + if (mask && mask->pDrawable && !mask->transform) + GET_SUB_PICTURE(mask, GLAMOR_ACCESS_RO); + + if (glamor_prepare_access_picture(dest, GLAMOR_ACCESS_RW) && + glamor_prepare_access_picture(source, GLAMOR_ACCESS_RO) && + glamor_prepare_access_picture(mask, GLAMOR_ACCESS_RO)) { + fbComposite(op, + source, mask, dest, + x_source, y_source, + x_mask, y_mask, x_dest, y_dest, width, height); + } + glamor_finish_access_picture(mask); + glamor_finish_access_picture(source); + glamor_finish_access_picture(dest); + +#define PUT_SUB_PICTURE(p, access) do { \ + if (sub_ ##p ##_pixmap != NULL) { \ + x_ ##p = saved_ ##p ##_x; \ + y_ ##p = saved_ ##p ##_y; \ + p->pDrawable = saved_ ##p ##_drawable; \ + if (p->pCompositeClip) \ + pixman_region_translate (p->pCompositeClip, \ + p->pDrawable->x + x_ ##p, \ + p->pDrawable->y + y_ ##p); \ + glamor_put_sub_pixmap(sub_ ##p ##_pixmap, p ##_pixmap, \ + x_ ##p + p ##_x_off + p->pDrawable->x, \ + y_ ##p + p ##_y_off + p->pDrawable->y, \ + width, height, access); \ + }} while(0) + if (mask && mask->pDrawable) + PUT_SUB_PICTURE(mask, GLAMOR_ACCESS_RO); + if (source->pDrawable) + PUT_SUB_PICTURE(source, GLAMOR_ACCESS_RO); + PUT_SUB_PICTURE(dest, GLAMOR_ACCESS_RW); + done: + return ret; +} + +void +glamor_composite(CARD8 op, + PicturePtr source, + PicturePtr mask, + PicturePtr dest, + INT16 x_source, + INT16 y_source, + INT16 x_mask, + INT16 y_mask, + INT16 x_dest, INT16 y_dest, CARD16 width, CARD16 height) +{ + _glamor_composite(op, source, mask, dest, x_source, y_source, + x_mask, y_mask, x_dest, y_dest, width, height, TRUE); +} + +Bool +glamor_composite_nf(CARD8 op, + PicturePtr source, + PicturePtr mask, + PicturePtr dest, + INT16 x_source, + INT16 y_source, + INT16 x_mask, + INT16 y_mask, + INT16 x_dest, INT16 y_dest, CARD16 width, CARD16 height) +{ + return _glamor_composite(op, source, mask, dest, x_source, y_source, + x_mask, y_mask, x_dest, y_dest, width, height, + FALSE); +} + +static void +glamor_get_src_rect_extent(int nrect, + glamor_composite_rect_t *rects, BoxPtr extent) +{ + extent->x1 = MAXSHORT; + extent->y1 = MAXSHORT; + extent->x2 = MINSHORT; + extent->y2 = MINSHORT; + + while (nrect--) { + if (extent->x1 > rects->x_src) + extent->x1 = rects->x_src; + if (extent->y1 > rects->y_src) + extent->y1 = rects->y_src; + if (extent->x2 < rects->x_src + rects->width) + extent->x2 = rects->x_src + rects->width; + if (extent->y2 < rects->y_src + rects->height) + extent->y2 = rects->y_src + rects->height; + rects++; + } +} + +static void +glamor_composite_src_rect_translate(int nrect, + glamor_composite_rect_t *rects, + int x, int y) +{ + while (nrect--) { + rects->x_src += x; + rects->y_src += y; + rects++; + } +} + +void +glamor_composite_glyph_rects(CARD8 op, + PicturePtr src, PicturePtr mask, PicturePtr dst, + int nrect, glamor_composite_rect_t *rects) +{ + int n; + PicturePtr temp_src = NULL; + glamor_composite_rect_t *r; + + ValidatePicture(src); + ValidatePicture(dst); + if (!(glamor_is_large_picture(src) + || (mask && glamor_is_large_picture(mask)) + || glamor_is_large_picture(dst))) { + glamor_pixmap_private *src_pixmap_priv = NULL; + glamor_pixmap_private *mask_pixmap_priv = NULL; + glamor_pixmap_private *dst_pixmap_priv; + glamor_pixmap_private *temp_src_priv = NULL; + BoxRec src_extent; + + dst_pixmap_priv = glamor_get_pixmap_private + (glamor_get_drawable_pixmap(dst->pDrawable)); + + if (mask && mask->pDrawable) + mask_pixmap_priv = glamor_get_pixmap_private + (glamor_get_drawable_pixmap(mask->pDrawable)); + if (src->pDrawable) + src_pixmap_priv = glamor_get_pixmap_private + (glamor_get_drawable_pixmap(src->pDrawable)); + + if (!src->pDrawable + && (src->pSourcePict->type != SourcePictTypeSolidFill)) { + glamor_get_src_rect_extent(nrect, rects, &src_extent); + temp_src = glamor_convert_gradient_picture(dst->pDrawable->pScreen, + src, + src_extent.x1, + src_extent.y1, + src_extent.x2 - + src_extent.x1, + src_extent.y2 - + src_extent.y1); + if (!temp_src) + goto fallback; + + temp_src_priv = glamor_get_pixmap_private + ((PixmapPtr) (temp_src->pDrawable)); + glamor_composite_src_rect_translate(nrect, rects, + -src_extent.x1, -src_extent.y1); + } + else { + temp_src = src; + temp_src_priv = src_pixmap_priv; + } + + if (mask && mask->componentAlpha) { + if (op == PictOpOver) { + if (glamor_composite_with_shader(PictOpOutReverse, + temp_src, mask, dst, + temp_src_priv, + mask_pixmap_priv, + dst_pixmap_priv, nrect, rects, + TRUE)) + goto done; + } + } + else { + if (glamor_composite_with_shader + (op, temp_src, mask, dst, temp_src_priv, mask_pixmap_priv, + dst_pixmap_priv, nrect, rects, FALSE)) + goto done; + } + } + fallback: + n = nrect; + r = rects; + + while (n--) { + CompositePicture(op, + temp_src ? temp_src : src, + mask, + dst, + r->x_src, r->y_src, + r->x_mask, r->y_mask, + r->x_dst, r->y_dst, r->width, r->height); + r++; + } + + done: + if (temp_src && temp_src != src) + FreePicture(temp_src, 0); +} + +static Bool +_glamor_composite_rects(CARD8 op, + PicturePtr pDst, + xRenderColor *color, + int nRect, xRectangle *rects, Bool fallback) +{ + miCompositeRects(op, pDst, color, nRect, rects); + return TRUE; +} + +void +glamor_composite_rects(CARD8 op, + PicturePtr pDst, + xRenderColor *color, int nRect, xRectangle *rects) +{ + _glamor_composite_rects(op, pDst, color, nRect, rects, TRUE); +} + +Bool +glamor_composite_rects_nf(CARD8 op, + PicturePtr pDst, + xRenderColor *color, int nRect, xRectangle *rects) +{ + return _glamor_composite_rects(op, pDst, color, nRect, rects, FALSE); +} + +#endif /* RENDER */ diff --git a/xserver/glamor/glamor_segment.c b/xserver/glamor/glamor_segment.c new file mode 100644 index 000000000..53f7da0cb --- /dev/null +++ b/xserver/glamor/glamor_segment.c @@ -0,0 +1,44 @@ +/* + * Copyright © 2014 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * that the name of the copyright holders not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no representations + * about the suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +#include "glamor_priv.h" + +Bool +glamor_poly_segment_nf(DrawablePtr drawable, GCPtr gc, int nseg, + xSegment *seg) +{ + if (glamor_ddx_fallback_check_pixmap(drawable) && + glamor_ddx_fallback_check_gc(gc)) { + return FALSE; + } + + miPolySegment(drawable, gc, nseg, seg); + + return TRUE; +} + +void +glamor_poly_segment(DrawablePtr drawable, GCPtr gc, int nseg, + xSegment *seg) +{ + miPolySegment(drawable, gc, nseg, seg); +} diff --git a/xserver/glamor/glamor_spans.c b/xserver/glamor/glamor_spans.c new file mode 100644 index 000000000..46ba6c38f --- /dev/null +++ b/xserver/glamor/glamor_spans.c @@ -0,0 +1,434 @@ +/* + * Copyright © 2014 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * that the name of the copyright holders not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no representations + * about the suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +#include "glamor_priv.h" +#include "glamor_transform.h" +#include "glamor_transfer.h" + +glamor_program fill_spans_progs[4]; + +static const glamor_facet glamor_facet_fillspans_130 = { + .name = "fill_spans", + .version = 130, + .vs_vars = "attribute vec3 primitive;\n", + .vs_exec = (" vec2 pos = vec2(primitive.z,1) * vec2(gl_VertexID&1, (gl_VertexID&2)>>1);\n" + GLAMOR_POS(gl_Position, (primitive.xy + pos))), +}; + +static const glamor_facet glamor_facet_fillspans_120 = { + .name = "fill_spans", + .vs_vars = "attribute vec2 primitive;\n", + .vs_exec = (" vec2 pos = vec2(0,0);\n" + GLAMOR_POS(gl_Position, primitive.xy)), +}; + +static Bool +glamor_fill_spans_gl(DrawablePtr drawable, + GCPtr gc, + int n, DDXPointPtr points, int *widths, int sorted) +{ + ScreenPtr screen = drawable->pScreen; + glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); + PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable); + glamor_pixmap_private *pixmap_priv; + glamor_program *prog; + int off_x, off_y; + GLshort *v; + char *vbo_offset; + int c; + int box_x, box_y; + + pixmap_priv = glamor_get_pixmap_private(pixmap); + if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv)) + goto bail; + + glamor_make_current(glamor_priv); + + if (glamor_priv->glsl_version >= 130) { + prog = glamor_use_program_fill(pixmap, gc, &glamor_priv->fill_spans_program, + &glamor_facet_fillspans_130); + + if (!prog) + goto bail_ctx; + + /* Set up the vertex buffers for the points */ + + v = glamor_get_vbo_space(drawable->pScreen, n * (4 * sizeof (GLshort)), &vbo_offset); + + glEnableVertexAttribArray(GLAMOR_VERTEX_POS); + glVertexAttribDivisor(GLAMOR_VERTEX_POS, 1); + glVertexAttribPointer(GLAMOR_VERTEX_POS, 3, GL_SHORT, GL_FALSE, + 4 * sizeof (GLshort), vbo_offset); + + for (c = 0; c < n; c++) { + v[0] = points->x; + v[1] = points->y; + v[2] = *widths++; + points++; + v += 4; + } + + glamor_put_vbo_space(screen); + } else { + prog = glamor_use_program_fill(pixmap, gc, &glamor_priv->fill_spans_program, + &glamor_facet_fillspans_120); + + if (!prog) + goto bail_ctx; + + /* Set up the vertex buffers for the points */ + + v = glamor_get_vbo_space(drawable->pScreen, n * 8 * sizeof (short), &vbo_offset); + + glEnableVertexAttribArray(GLAMOR_VERTEX_POS); + glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_SHORT, GL_FALSE, + 2 * sizeof (short), vbo_offset); + + for (c = 0; c < n; c++) { + v[0] = points->x; v[1] = points->y; + v[2] = points->x; v[3] = points->y + 1; + v[4] = points->x + *widths; v[5] = points->y + 1; + v[6] = points->x + *widths; v[7] = points->y; + + widths++; + points++; + v += 8; + } + + glamor_put_vbo_space(screen); + } + + glEnable(GL_SCISSOR_TEST); + + glamor_pixmap_loop(pixmap_priv, box_x, box_y) { + int nbox = RegionNumRects(gc->pCompositeClip); + BoxPtr box = RegionRects(gc->pCompositeClip); + + glamor_set_destination_drawable(drawable, box_x, box_y, FALSE, FALSE, prog->matrix_uniform, &off_x, &off_y); + + while (nbox--) { + glScissor(box->x1 + off_x, + box->y1 + off_y, + box->x2 - box->x1, + box->y2 - box->y1); + box++; + if (glamor_priv->glsl_version >= 130) + glDrawArraysInstanced(GL_TRIANGLE_STRIP, 0, 4, n); + else { + if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) { + glDrawArrays(GL_QUADS, 0, 4 * n); + } else { + int i; + for (i = 0; i < n; i++) { + glDrawArrays(GL_TRIANGLE_FAN, i * 4, 4); + } + } + } + } + } + + glDisable(GL_SCISSOR_TEST); + glDisable(GL_COLOR_LOGIC_OP); + if (glamor_priv->glsl_version >= 130) + glVertexAttribDivisor(GLAMOR_VERTEX_POS, 0); + glDisableVertexAttribArray(GLAMOR_VERTEX_POS); + + return TRUE; +bail_ctx: + glDisable(GL_COLOR_LOGIC_OP); +bail: + return FALSE; +} + +static void +glamor_fill_spans_bail(DrawablePtr drawable, + GCPtr gc, + int n, DDXPointPtr points, int *widths, int sorted) +{ + if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RW) && + glamor_prepare_access_gc(gc)) { + fbFillSpans(drawable, gc, n, points, widths, sorted); + } + glamor_finish_access_gc(gc); + glamor_finish_access(drawable); +} + +void +glamor_fill_spans(DrawablePtr drawable, + GCPtr gc, + int n, DDXPointPtr points, int *widths, int sorted) +{ + if (glamor_fill_spans_gl(drawable, gc, n, points, widths, sorted)) + return; + glamor_fill_spans_bail(drawable, gc, n, points, widths, sorted); +} + +Bool +glamor_fill_spans_nf(DrawablePtr drawable, + GCPtr gc, + int n, DDXPointPtr points, int *widths, int sorted) +{ + if (glamor_fill_spans_gl(drawable, gc, n, points, widths, sorted)) + return TRUE; + + if (glamor_ddx_fallback_check_pixmap(drawable) && glamor_ddx_fallback_check_gc(gc)) + return FALSE; + + glamor_fill_spans_bail(drawable, gc, n, points, widths, sorted); + return TRUE; +} + +static Bool +glamor_get_spans_gl(DrawablePtr drawable, int wmax, + DDXPointPtr points, int *widths, int count, char *dst) +{ + ScreenPtr screen = drawable->pScreen; + glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); + PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable); + glamor_pixmap_private *pixmap_priv; + int box_x, box_y; + int n; + char *d; + GLenum type; + GLenum format; + int off_x, off_y; + + pixmap_priv = glamor_get_pixmap_private(pixmap); + if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv)) + goto bail; + + glamor_get_drawable_deltas(drawable, pixmap, &off_x, &off_y); + + glamor_format_for_pixmap(pixmap, &format, &type); + + glamor_make_current(glamor_priv); + + glamor_pixmap_loop(pixmap_priv, box_x, box_y) { + BoxPtr box = glamor_pixmap_box_at(pixmap_priv, box_x, box_y); + glamor_pixmap_fbo *fbo = glamor_pixmap_fbo_at(pixmap_priv, box_x, box_y); + + glBindFramebuffer(GL_READ_FRAMEBUFFER, fbo->fb); + glPixelStorei(GL_PACK_ALIGNMENT, 4); + + d = dst; + for (n = 0; n < count; n++) { + int x1 = points[n].x + off_x; + int y = points[n].y + off_y; + int w = widths[n]; + int x2 = x1 + w; + char *l; + + l = d; + d += PixmapBytePad(w, drawable->depth); + + /* clip */ + if (x1 < box->x1) { + l += (box->x1 - x1) * (drawable->bitsPerPixel >> 3); + x1 = box->x1; + } + if (x2 > box->x2) + x2 = box->x2; + + if (x1 >= x2) + continue; + if (y < box->y1) + continue; + if (y >= box->y2) + continue; + + glReadPixels(x1 - box->x1, y - box->y1, x2 - x1, 1, format, type, l); + } + } + + return TRUE; +bail: + return FALSE; +} + +static void +glamor_get_spans_bail(DrawablePtr drawable, int wmax, + DDXPointPtr points, int *widths, int count, char *dst) +{ + if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RO)) + fbGetSpans(drawable, wmax, points, widths, count, dst); + glamor_finish_access(drawable); +} + +void +glamor_get_spans(DrawablePtr drawable, int wmax, + DDXPointPtr points, int *widths, int count, char *dst) +{ + if (glamor_get_spans_gl(drawable, wmax, points, widths, count, dst)) + return; + glamor_get_spans_bail(drawable, wmax, points, widths, count, dst); +} + +Bool +glamor_get_spans_nf(DrawablePtr drawable, int wmax, + DDXPointPtr points, int *widths, int count, char *dst) +{ + if (glamor_get_spans_gl(drawable, wmax, points, widths, count, dst)) + return TRUE; + + if (glamor_ddx_fallback_check_pixmap(drawable)) + return FALSE; + + glamor_get_spans_bail(drawable, wmax, points, widths, count, dst); + return TRUE; +} + +static Bool +glamor_set_spans_gl(DrawablePtr drawable, GCPtr gc, char *src, + DDXPointPtr points, int *widths, int numPoints, int sorted) +{ + ScreenPtr screen = drawable->pScreen; + glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); + PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable); + glamor_pixmap_private *pixmap_priv; + int box_x, box_y; + int n; + char *s; + GLenum type; + GLenum format; + int off_x, off_y; + + pixmap_priv = glamor_get_pixmap_private(pixmap); + if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv)) + goto bail; + + if (gc->alu != GXcopy) + goto bail; + + if (!glamor_pm_is_solid(&pixmap->drawable, gc->planemask)) + goto bail; + + glamor_get_drawable_deltas(drawable, pixmap, &off_x, &off_y); + glamor_format_for_pixmap(pixmap, &format, &type); + + glamor_make_current(glamor_priv); + + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + + glPixelStorei(GL_UNPACK_ALIGNMENT, 4); + + glamor_pixmap_loop(pixmap_priv, box_x, box_y) { + BoxPtr box = glamor_pixmap_box_at(pixmap_priv, box_x, box_y); + glamor_pixmap_fbo *fbo = glamor_pixmap_fbo_at(pixmap_priv, box_x, box_y); + + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D, fbo->tex); + + s = src; + for (n = 0; n < numPoints; n++) { + + BoxPtr clip_box = RegionRects(gc->pCompositeClip); + int nclip_box = RegionNumRects(gc->pCompositeClip); + int w = widths[n]; + int y = points[n].y; + int x = points[n].x; + + while (nclip_box--) { + int x1 = x; + int x2 = x + w; + int y1 = y; + char *l = s; + + /* clip to composite clip */ + if (x1 < clip_box->x1) { + l += (clip_box->x1 - x1) * (drawable->bitsPerPixel >> 3); + x1 = clip_box->x1; + } + if (x2 > clip_box->x2) + x2 = clip_box->x2; + + if (y < clip_box->y1) + continue; + if (y >= clip_box->y2) + continue; + + /* adjust to pixmap coordinates */ + x1 += off_x; + x2 += off_x; + y1 += off_y; + + if (x1 < box->x1) { + l += (box->x1 - x1) * (drawable->bitsPerPixel >> 3); + x1 = box->x1; + } + if (x2 > box->x2) + x2 = box->x2; + + if (x1 >= x2) + continue; + if (y1 < box->y1) + continue; + if (y1 >= box->y2) + continue; + + glTexSubImage2D(GL_TEXTURE_2D, 0, + x1 - box->x1, y1 - box->y1, x2 - x1, 1, + format, type, + l); + } + s += PixmapBytePad(w, drawable->depth); + } + } + + return TRUE; + +bail: + return FALSE; +} + +static void +glamor_set_spans_bail(DrawablePtr drawable, GCPtr gc, char *src, + DDXPointPtr points, int *widths, int numPoints, int sorted) +{ + if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RW) && glamor_prepare_access_gc(gc)) + fbSetSpans(drawable, gc, src, points, widths, numPoints, sorted); + glamor_finish_access_gc(gc); + glamor_finish_access(drawable); +} + +void +glamor_set_spans(DrawablePtr drawable, GCPtr gc, char *src, + DDXPointPtr points, int *widths, int numPoints, int sorted) +{ + if (glamor_set_spans_gl(drawable, gc, src, points, widths, numPoints, sorted)) + return; + glamor_set_spans_bail(drawable, gc, src, points, widths, numPoints, sorted); +} + +Bool +glamor_set_spans_nf(DrawablePtr drawable, GCPtr gc, char *src, + DDXPointPtr points, int *widths, int numPoints, int sorted) +{ + if (glamor_set_spans_gl(drawable, gc, src, points, widths, numPoints, sorted)) + return TRUE; + + if (glamor_ddx_fallback_check_pixmap(drawable) && glamor_ddx_fallback_check_gc(gc)) + return FALSE; + + glamor_set_spans_bail(drawable, gc, src, points, widths, numPoints, sorted); + return TRUE; +} diff --git a/xserver/glamor/glamor_text.c b/xserver/glamor/glamor_text.c new file mode 100644 index 000000000..6e02b9aa8 --- /dev/null +++ b/xserver/glamor/glamor_text.c @@ -0,0 +1,534 @@ +/* + * Copyright © 2014 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * that the name of the copyright holders not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no representations + * about the suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +#include "glamor_priv.h" +#include <dixfontstr.h> +#include "glamor_transform.h" + +/* + * Fill in the array of charinfo pointers for the provided characters. For + * missing characters, place a NULL in the array so that the charinfo array + * aligns exactly with chars + */ + +static void +glamor_get_glyphs(FontPtr font, glamor_font_t *glamor_font, + int count, char *chars, Bool sixteen, CharInfoPtr *charinfo) +{ + unsigned long nglyphs; + FontEncoding encoding; + int char_step; + int c; + + if (sixteen) { + char_step = 2; + if (FONTLASTROW(font) == 0) + encoding = Linear16Bit; + else + encoding = TwoD16Bit; + } else { + char_step = 1; + encoding = Linear8Bit; + } + + /* If the font has a default character, then we shouldn't have to + * worry about missing glyphs, so just get the whole string all at + * once. Otherwise, we have to fetch chars one at a time to notice + * missing ones. + */ + if (glamor_font->default_char) { + GetGlyphs(font, (unsigned long) count, (unsigned char *) chars, + encoding, &nglyphs, charinfo); + + /* Make sure it worked. There's a bug in libXfont through + * version 1.4.7 which would cause it to fail when the font is + * a 2D font without a first row, and the application sends a + * 1-d request. In this case, libXfont would return zero + * glyphs, even when the font had a default character. + * + * It's easy enough for us to work around that bug here by + * simply checking the returned nglyphs and falling through to + * the one-at-a-time code below. Not doing this check would + * result in uninitialized memory accesses in the rendering code. + */ + if (nglyphs == count) + return; + } + + for (c = 0; c < count; c++) { + GetGlyphs(font, 1, (unsigned char *) chars, + encoding, &nglyphs, &charinfo[c]); + if (!nglyphs) + charinfo[c] = NULL; + chars += char_step; + } +} + +/* + * Construct quads for the provided list of characters and draw them + */ + +static int +glamor_text(DrawablePtr drawable, GCPtr gc, + glamor_font_t *glamor_font, + glamor_program *prog, + int x, int y, + int count, char *s_chars, CharInfoPtr *charinfo, + Bool sixteen) +{ + unsigned char *chars = (unsigned char *) s_chars; + FontPtr font = gc->font; + int off_x, off_y; + int c; + int nglyph; + GLshort *v; + char *vbo_offset; + CharInfoPtr ci; + int firstRow = font->info.firstRow; + int firstCol = font->info.firstCol; + int glyph_spacing_x = glamor_font->glyph_width_bytes * 8; + int glyph_spacing_y = glamor_font->glyph_height; + int box_x, box_y; + PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable); + glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap); + + /* Set the font as texture 1 */ + + glActiveTexture(GL_TEXTURE1); + glBindTexture(GL_TEXTURE_2D, glamor_font->texture_id); + glUniform1i(prog->font_uniform, 1); + + /* Set up the vertex buffers for the font and destination */ + + v = glamor_get_vbo_space(drawable->pScreen, count * (6 * sizeof (GLshort)), &vbo_offset); + + glEnableVertexAttribArray(GLAMOR_VERTEX_POS); + glVertexAttribDivisor(GLAMOR_VERTEX_POS, 1); + glVertexAttribPointer(GLAMOR_VERTEX_POS, 4, GL_SHORT, GL_FALSE, + 6 * sizeof (GLshort), vbo_offset); + + glEnableVertexAttribArray(GLAMOR_VERTEX_SOURCE); + glVertexAttribDivisor(GLAMOR_VERTEX_SOURCE, 1); + glVertexAttribPointer(GLAMOR_VERTEX_SOURCE, 2, GL_SHORT, GL_FALSE, + 6 * sizeof (GLshort), vbo_offset + 4 * sizeof (GLshort)); + + /* Set the vertex coordinates */ + nglyph = 0; + + for (c = 0; c < count; c++) { + if ((ci = *charinfo++)) { + int x1 = x + ci->metrics.leftSideBearing; + int y1 = y - ci->metrics.ascent; + int width = GLYPHWIDTHPIXELS(ci); + int height = GLYPHHEIGHTPIXELS(ci); + int tx, ty = 0; + int row = 0, col; + + x += ci->metrics.characterWidth; + + if (sixteen) { + if (ci == glamor_font->default_char) { + row = glamor_font->default_row; + col = glamor_font->default_col; + } else { + row = chars[0]; + col = chars[1]; + } + if (FONTLASTROW(font) != 0) + ty = (row - firstRow) * glyph_spacing_y; + else + col += row << 8; + } else { + if (ci == glamor_font->default_char) + col = glamor_font->default_col; + else + col = chars[0]; + } + + tx = (col - firstCol) * glyph_spacing_x; + + v[ 0] = x1; + v[ 1] = y1; + v[ 2] = width; + v[ 3] = height; + v[ 4] = tx; + v[ 5] = ty; + + v += 6; + nglyph++; + } + chars += 1 + sixteen; + } + glamor_put_vbo_space(drawable->pScreen); + + if (nglyph != 0) { + + glEnable(GL_SCISSOR_TEST); + + glamor_pixmap_loop(pixmap_priv, box_x, box_y) { + BoxPtr box = RegionRects(gc->pCompositeClip); + int nbox = RegionNumRects(gc->pCompositeClip); + + glamor_set_destination_drawable(drawable, box_x, box_y, TRUE, FALSE, prog->matrix_uniform, &off_x, &off_y); + + /* Run over the clip list, drawing the glyphs + * in each box + */ + + while (nbox--) { + glScissor(box->x1 + off_x, + box->y1 + off_y, + box->x2 - box->x1, + box->y2 - box->y1); + box++; + glDrawArraysInstanced(GL_TRIANGLE_STRIP, 0, 4, nglyph); + } + } + glDisable(GL_SCISSOR_TEST); + } + + glVertexAttribDivisor(GLAMOR_VERTEX_SOURCE, 0); + glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE); + glVertexAttribDivisor(GLAMOR_VERTEX_POS, 0); + glDisableVertexAttribArray(GLAMOR_VERTEX_POS); + glDisable(GL_COLOR_LOGIC_OP); + + return x; +} + +static const char vs_vars_text[] = + "attribute vec4 primitive;\n" + "attribute vec2 source;\n" + "varying vec2 glyph_pos;\n"; + +static const char vs_exec_text[] = + " vec2 pos = primitive.zw * vec2(gl_VertexID&1, (gl_VertexID&2)>>1);\n" + GLAMOR_POS(gl_Position, (primitive.xy + pos)) + " glyph_pos = source + pos;\n"; + +static const char fs_vars_text[] = + "varying vec2 glyph_pos;\n"; + +static const char fs_exec_text[] = + " ivec2 itile_texture = ivec2(glyph_pos);\n" + " uint x = uint(itile_texture.x & 7);\n" + " itile_texture.x >>= 3;\n" + " uint texel = texelFetch(font, itile_texture, 0).x;\n" + " uint bit = (texel >> x) & uint(1);\n" + " if (bit == uint(0))\n" + " discard;\n"; + +static const char fs_exec_te[] = + " ivec2 itile_texture = ivec2(glyph_pos);\n" + " uint x = uint(itile_texture.x & 7);\n" + " itile_texture.x >>= 3;\n" + " uint texel = texelFetch(font, itile_texture, 0).x;\n" + " uint bit = (texel >> x) & uint(1);\n" + " if (bit == uint(0))\n" + " gl_FragColor = bg;\n" + " else\n" + " gl_FragColor = fg;\n"; + +static const glamor_facet glamor_facet_poly_text = { + .name = "poly_text", + .version = 130, + .vs_vars = vs_vars_text, + .vs_exec = vs_exec_text, + .fs_vars = fs_vars_text, + .fs_exec = fs_exec_text, + .source_name = "source", + .locations = glamor_program_location_font, +}; + +static Bool +glamor_poly_text(DrawablePtr drawable, GCPtr gc, + int x, int y, int count, char *chars, Bool sixteen, int *final_pos) +{ + ScreenPtr screen = drawable->pScreen; + glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); + PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable); + glamor_program *prog; + glamor_pixmap_private *pixmap_priv; + glamor_font_t *glamor_font; + CharInfoPtr charinfo[255]; /* encoding only has 1 byte for count */ + + glamor_font = glamor_font_get(drawable->pScreen, gc->font); + if (!glamor_font) + goto bail; + + glamor_get_glyphs(gc->font, glamor_font, count, chars, sixteen, charinfo); + + pixmap_priv = glamor_get_pixmap_private(pixmap); + if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv)) + goto bail; + + glamor_make_current(glamor_priv); + + prog = glamor_use_program_fill(pixmap, gc, &glamor_priv->poly_text_progs, &glamor_facet_poly_text); + + if (!prog) + goto bail_ctx; + + x = glamor_text(drawable, gc, glamor_font, prog, + x, y, count, chars, charinfo, sixteen); + + glDisable(GL_COLOR_LOGIC_OP); + + glamor_priv->state = RENDER_STATE; + glamor_priv->render_idle_cnt = 0; + + *final_pos = x; + return TRUE; + +bail_ctx: + glDisable(GL_COLOR_LOGIC_OP); +bail: + return FALSE; +} + +Bool +glamor_poly_text8_nf(DrawablePtr drawable, GCPtr gc, + int x, int y, int count, char *chars, int *final_pos) +{ + if (glamor_poly_text(drawable, gc, x, y, count, chars, FALSE, final_pos)) + return TRUE; + if (glamor_ddx_fallback_check_pixmap(drawable) && glamor_ddx_fallback_check_gc(gc)) + return FALSE; + *final_pos = miPolyText8(drawable, gc, x, y, count, chars); + return TRUE; +} + +int +glamor_poly_text8(DrawablePtr drawable, GCPtr gc, + int x, int y, int count, char *chars) +{ + int final_pos; + + if (glamor_poly_text(drawable, gc, x, y, count, chars, FALSE, &final_pos)) + return final_pos; + return miPolyText8(drawable, gc, x, y, count, chars); +} + +Bool +glamor_poly_text16_nf(DrawablePtr drawable, GCPtr gc, + int x, int y, int count, unsigned short *chars, int *final_pos) +{ + if (glamor_poly_text(drawable, gc, x, y, count, (char *) chars, TRUE, final_pos)) + return TRUE; + + if (glamor_ddx_fallback_check_pixmap(drawable) && glamor_ddx_fallback_check_gc(gc)) + return FALSE; + *final_pos = miPolyText16(drawable, gc, x, y, count, chars); + return TRUE; +} + +int +glamor_poly_text16(DrawablePtr drawable, GCPtr gc, + int x, int y, int count, unsigned short *chars) +{ + int final_pos; + + if (glamor_poly_text(drawable, gc, x, y, count, (char *) chars, TRUE, &final_pos)) + return final_pos; + return miPolyText16(drawable, gc, x, y, count, chars); +} + +/* + * Draw image text, which is always solid in copy mode and has the + * background cleared while painting the text. For fonts which have + * their bitmap metrics exactly equal to the area to clear, we can use + * the accelerated version which paints both fg and bg at the same + * time. Otherwise, clear the whole area and then paint the glyphs on + * top + */ + +static const glamor_facet glamor_facet_image_text = { + .name = "image_text", + .version = 130, + .vs_vars = vs_vars_text, + .vs_exec = vs_exec_text, + .fs_vars = fs_vars_text, + .fs_exec = fs_exec_text, + .source_name = "source", + .locations = glamor_program_location_font, +}; + +static Bool +use_image_solid(PixmapPtr pixmap, GCPtr gc, glamor_program *prog, void *arg) +{ + return glamor_set_solid(pixmap, gc, FALSE, prog->fg_uniform); +} + +static const glamor_facet glamor_facet_image_fill = { + .name = "solid", + .fs_exec = " gl_FragColor = fg;\n", + .locations = glamor_program_location_fg, + .use = use_image_solid, +}; + +static Bool +glamor_te_text_use(PixmapPtr pixmap, GCPtr gc, glamor_program *prog, void *arg) +{ + if (!glamor_set_solid(pixmap, gc, FALSE, prog->fg_uniform)) + return FALSE; + glamor_set_color(pixmap, gc->bgPixel, prog->bg_uniform); + return TRUE; +} + +static const glamor_facet glamor_facet_te_text = { + .name = "te_text", + .version = 130, + .vs_vars = vs_vars_text, + .vs_exec = vs_exec_text, + .fs_vars = fs_vars_text, + .fs_exec = fs_exec_te, + .locations = glamor_program_location_fg | glamor_program_location_bg | glamor_program_location_font, + .source_name = "source", + .use = glamor_te_text_use, +}; + +static Bool +glamor_image_text(DrawablePtr drawable, GCPtr gc, + int x, int y, int count, char *chars, + Bool sixteen) +{ + ScreenPtr screen = drawable->pScreen; + glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); + PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable); + glamor_program *prog; + glamor_pixmap_private *pixmap_priv; + glamor_font_t *glamor_font; + const glamor_facet *prim_facet; + const glamor_facet *fill_facet; + CharInfoPtr charinfo[255]; /* encoding only has 1 byte for count */ + + pixmap_priv = glamor_get_pixmap_private(pixmap); + if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv)) + return FALSE; + + glamor_font = glamor_font_get(drawable->pScreen, gc->font); + if (!glamor_font) + return FALSE; + + glamor_get_glyphs(gc->font, glamor_font, count, chars, sixteen, charinfo); + + glamor_make_current(glamor_priv); + + if (TERMINALFONT(gc->font)) + prog = &glamor_priv->te_text_prog; + else + prog = &glamor_priv->image_text_prog; + + if (prog->failed) + goto bail; + + if (!prog->prog) { + if (TERMINALFONT(gc->font)) { + prim_facet = &glamor_facet_te_text; + fill_facet = NULL; + } else { + prim_facet = &glamor_facet_image_text; + fill_facet = &glamor_facet_image_fill; + } + + if (!glamor_build_program(screen, prog, prim_facet, fill_facet)) + goto bail; + } + + if (!TERMINALFONT(gc->font)) { + int width = 0; + int c; + RegionRec region; + BoxRec box; + int off_x, off_y; + + /* Check planemask before drawing background to + * bail early if it's not OK + */ + if (!glamor_set_planemask(pixmap, gc->planemask)) + goto bail; + for (c = 0; c < count; c++) + if (charinfo[c]) + width += charinfo[c]->metrics.characterWidth; + + glamor_get_drawable_deltas(drawable, pixmap, &off_x, &off_y); + + if (width >= 0) { + box.x1 = off_x + drawable->x + x; + box.x2 = off_x + drawable->x + x + width; + } else { + box.x1 = off_x + drawable->x + x + width; + box.x2 = off_x + drawable->x + x; + } + box.y1 = off_y + drawable->y + y - gc->font->info.fontAscent; + box.y2 = off_y + drawable->y + y + gc->font->info.fontDescent; + RegionInit(®ion, &box, 1); + RegionIntersect(®ion, ®ion, gc->pCompositeClip); + glamor_solid_boxes(pixmap, RegionRects(®ion), RegionNumRects(®ion), gc->bgPixel); + RegionUninit(®ion); + } + + if (!glamor_use_program(pixmap, gc, prog, NULL)) + goto bail; + + (void) glamor_text(drawable, gc, glamor_font, prog, + x, y, count, chars, charinfo, sixteen); + + glamor_priv->state = RENDER_STATE; + glamor_priv->render_idle_cnt = 0; + + return TRUE; + +bail: + glDisable(GL_COLOR_LOGIC_OP); + return FALSE; +} + +Bool +glamor_image_text8_nf(DrawablePtr drawable, GCPtr gc, + int x, int y, int count, char *chars) +{ + return glamor_image_text(drawable, gc, x, y, count, chars, FALSE); +} + +void +glamor_image_text8(DrawablePtr drawable, GCPtr gc, + int x, int y, int count, char *chars) +{ + if (!glamor_image_text(drawable, gc, x, y, count, chars, FALSE)) + miImageText8(drawable, gc, x, y, count, chars); +} + +Bool +glamor_image_text16_nf(DrawablePtr drawable, GCPtr gc, + int x, int y, int count, unsigned short *chars) +{ + return glamor_image_text(drawable, gc, x, y, count, (char *) chars, TRUE); +} + +void +glamor_image_text16(DrawablePtr drawable, GCPtr gc, + int x, int y, int count, unsigned short *chars) +{ + if (!glamor_image_text(drawable, gc, x, y, count, (char *) chars, TRUE)) + miImageText16(drawable, gc, x, y, count, chars); +} diff --git a/xserver/glamor/glamor_tile.c b/xserver/glamor/glamor_tile.c new file mode 100644 index 000000000..4e479763e --- /dev/null +++ b/xserver/glamor/glamor_tile.c @@ -0,0 +1,293 @@ +/* + * Copyright © 2009 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Authors: + * Eric Anholt <eric@anholt.net> + * Zhigang Gong <zhigang.gong@linux.intel.com> + * + */ + +#include "glamor_priv.h" + +/** @file glamor_tile.c + * + * Implements the basic fill-with-a-tile support used by multiple GC ops. + */ + +void +glamor_init_tile_shader(ScreenPtr screen) +{ + glamor_screen_private *glamor_priv; + const char *tile_vs = + "attribute vec4 v_position;\n" + "attribute vec4 v_texcoord0;\n" + "varying vec2 tile_texture;\n" + "void main()\n" + "{\n" + " gl_Position = v_position;\n" + " tile_texture = v_texcoord0.xy;\n" + "}\n"; + const char *tile_fs = + GLAMOR_DEFAULT_PRECISION + "varying vec2 tile_texture;\n" + "uniform sampler2D sampler;\n" + "uniform vec2 wh;" + "void main()\n" + "{\n" + " vec2 rel_tex;" + " rel_tex = tile_texture * wh; \n" + " rel_tex = floor(rel_tex) + (fract(rel_tex) / wh); \n" + " gl_FragColor = texture2D(sampler, rel_tex);\n" + "}\n"; + GLint fs_prog, vs_prog; + GLint sampler_uniform_location; + + glamor_priv = glamor_get_screen_private(screen); + glamor_make_current(glamor_priv); + glamor_priv->tile_prog = glCreateProgram(); + vs_prog = glamor_compile_glsl_prog(GL_VERTEX_SHADER, tile_vs); + fs_prog = glamor_compile_glsl_prog(GL_FRAGMENT_SHADER, tile_fs); + glAttachShader(glamor_priv->tile_prog, vs_prog); + glAttachShader(glamor_priv->tile_prog, fs_prog); + + glBindAttribLocation(glamor_priv->tile_prog, + GLAMOR_VERTEX_POS, "v_position"); + glBindAttribLocation(glamor_priv->tile_prog, + GLAMOR_VERTEX_SOURCE, "v_texcoord0"); + glamor_link_glsl_prog(screen, glamor_priv->tile_prog, "tile"); + + sampler_uniform_location = + glGetUniformLocation(glamor_priv->tile_prog, "sampler"); + glUseProgram(glamor_priv->tile_prog); + glUniform1i(sampler_uniform_location, 0); + + glamor_priv->tile_wh = + glGetUniformLocation(glamor_priv->tile_prog, "wh"); +} + +void +glamor_fini_tile_shader(ScreenPtr screen) +{ + glamor_screen_private *glamor_priv; + + glamor_priv = glamor_get_screen_private(screen); + glamor_make_current(glamor_priv); + glDeleteProgram(glamor_priv->tile_prog); +} + +static void +_glamor_tile(PixmapPtr pixmap, PixmapPtr tile, + int x, int y, int width, int height, int tile_x, int tile_y) +{ + ScreenPtr screen = pixmap->drawable.pScreen; + glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); + int x1 = x; + int x2 = x + width; + int y1 = y; + int y2 = y + height; + int tile_x1 = tile_x; + int tile_x2 = tile_x + width; + int tile_y1 = tile_y; + int tile_y2 = tile_y + height; + float vertices[8]; + float source_texcoords[8]; + GLfloat dst_xscale, dst_yscale, src_xscale, src_yscale; + glamor_pixmap_private *src_pixmap_priv; + glamor_pixmap_private *dst_pixmap_priv; + float wh[4]; + + src_pixmap_priv = glamor_get_pixmap_private(tile); + dst_pixmap_priv = glamor_get_pixmap_private(pixmap); + + glamor_set_destination_pixmap_priv_nc(dst_pixmap_priv); + pixmap_priv_get_dest_scale(dst_pixmap_priv, &dst_xscale, &dst_yscale); + pixmap_priv_get_scale(src_pixmap_priv, &src_xscale, &src_yscale); + glamor_make_current(glamor_priv); + glUseProgram(glamor_priv->tile_prog); + + glamor_pixmap_fbo_fix_wh_ratio(wh, src_pixmap_priv); + glUniform2fv(glamor_priv->tile_wh, 1, wh); + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D, src_pixmap_priv->base.fbo->tex); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); + glamor_set_repeat_normalize_tcoords + (src_pixmap_priv, RepeatNormal, + src_xscale, src_yscale, + tile_x1, tile_y1, + tile_x2, tile_y2, glamor_priv->yInverted, source_texcoords); + + glVertexAttribPointer(GLAMOR_VERTEX_SOURCE, 2, GL_FLOAT, GL_FALSE, + 2 * sizeof(float), source_texcoords); + glEnableVertexAttribArray(GLAMOR_VERTEX_SOURCE); + + glamor_set_normalize_vcoords(dst_pixmap_priv, dst_xscale, dst_yscale, + x1, y1, + x2, y2, glamor_priv->yInverted, vertices); + + glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT, GL_FALSE, + 2 * sizeof(float), vertices); + glEnableVertexAttribArray(GLAMOR_VERTEX_POS); + glDrawArrays(GL_TRIANGLE_FAN, 0, 4); + + glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE); + glDisableVertexAttribArray(GLAMOR_VERTEX_POS); + + glamor_priv->state = RENDER_STATE; + glamor_priv->render_idle_cnt = 0; +} + +Bool +glamor_tile(PixmapPtr pixmap, PixmapPtr tile, + int x, int y, int width, int height, + unsigned char alu, unsigned long planemask, int tile_x, int tile_y) +{ + ScreenPtr screen = pixmap->drawable.pScreen; + glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); + glamor_pixmap_private *dst_pixmap_priv; + glamor_pixmap_private *src_pixmap_priv; + + dst_pixmap_priv = glamor_get_pixmap_private(pixmap); + src_pixmap_priv = glamor_get_pixmap_private(tile); + + if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(dst_pixmap_priv)) + return FALSE; + + if (glamor_priv->tile_prog == 0) { + glamor_fallback("Tiling unsupported\n"); + goto fail; + } + + if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(src_pixmap_priv)) { + /* XXX dynamic uploading candidate. */ + glamor_fallback("Non-texture tile pixmap\n"); + goto fail; + } + + if (!glamor_set_planemask(pixmap, planemask)) { + glamor_fallback("unsupported planemask %lx\n", planemask); + goto fail; + } + + glamor_make_current(glamor_priv); + if (!glamor_set_alu(screen, alu)) { + glamor_fallback("unsupported alu %x\n", alu); + goto fail; + } + + if (dst_pixmap_priv->type == GLAMOR_TEXTURE_LARGE + || src_pixmap_priv->type == GLAMOR_TEXTURE_LARGE) { + glamor_pixmap_clipped_regions *clipped_dst_regions; + int n_dst_region, i, j, k; + BoxRec box; + RegionRec region; + + box.x1 = x; + box.y1 = y; + box.x2 = x + width; + box.y2 = y + height; + RegionInitBoxes(®ion, &box, 1); + clipped_dst_regions = glamor_compute_clipped_regions(dst_pixmap_priv, + ®ion, + &n_dst_region, 0, + 0, 0); + for (i = 0; i < n_dst_region; i++) { + int n_src_region; + glamor_pixmap_clipped_regions *clipped_src_regions; + BoxPtr current_boxes; + int n_current_boxes; + + SET_PIXMAP_FBO_CURRENT(dst_pixmap_priv, + clipped_dst_regions[i].block_idx); + + if (src_pixmap_priv->type == GLAMOR_TEXTURE_LARGE) { + RegionTranslate(clipped_dst_regions[i].region, + tile_x - x, tile_y - y); + DEBUGF("tiled a large src pixmap. %dx%d \n", + tile->drawable.width, tile->drawable.height); + clipped_src_regions = + glamor_compute_clipped_regions(src_pixmap_priv, + clipped_dst_regions[i]. + region, &n_src_region, 1, 0, + 0); + DEBUGF("got %d src regions %d \n", n_src_region); + for (j = 0; j < n_src_region; j++) { + + SET_PIXMAP_FBO_CURRENT(src_pixmap_priv, + clipped_src_regions[j].block_idx); + + RegionTranslate(clipped_src_regions[j].region, + x - tile_x, y - tile_y); + current_boxes = RegionRects(clipped_src_regions[j].region); + n_current_boxes = + RegionNumRects(clipped_src_regions[j].region); + for (k = 0; k < n_current_boxes; k++) { + DEBUGF + ("Tile on %d %d %d %d dst block id %d tile block id %d tilex %d tiley %d\n", + current_boxes[k].x1, current_boxes[k].y1, + current_boxes[k].x2 - current_boxes[k].x1, + current_boxes[k].y2 - current_boxes[k].y1, + clipped_dst_regions[i].block_idx, + clipped_src_regions[j].block_idx, + (tile_x + (current_boxes[k].x1 - x)), + tile_y + (current_boxes[k].y1 - y)); + + _glamor_tile(pixmap, tile, + current_boxes[k].x1, current_boxes[k].y1, + current_boxes[k].x2 - current_boxes[k].x1, + current_boxes[k].y2 - current_boxes[k].y1, + (tile_x + (current_boxes[k].x1 - x)), + (tile_y + (current_boxes[k].y1 - y))); + } + + RegionDestroy(clipped_src_regions[j].region); + } + free(clipped_src_regions); + } + else { + current_boxes = RegionRects(clipped_dst_regions[i].region); + n_current_boxes = RegionNumRects(clipped_dst_regions[i].region); + for (k = 0; k < n_current_boxes; k++) { + _glamor_tile(pixmap, tile, + current_boxes[k].x1, current_boxes[k].y1, + current_boxes[k].x2 - current_boxes[k].x1, + current_boxes[k].y2 - current_boxes[k].y1, + (tile_x + (current_boxes[k].x1 - x)), + (tile_y + (current_boxes[k].y1 - y))); + } + } + RegionDestroy(clipped_dst_regions[i].region); + } + free(clipped_dst_regions); + RegionUninit(®ion); + } + else + _glamor_tile(pixmap, tile, x, y, width, height, tile_x, tile_y); + + glamor_set_alu(screen, GXcopy); + return TRUE; + fail: + return FALSE; + +} diff --git a/xserver/glamor/glamor_transfer.c b/xserver/glamor/glamor_transfer.c new file mode 100644 index 000000000..ad875c962 --- /dev/null +++ b/xserver/glamor/glamor_transfer.c @@ -0,0 +1,262 @@ +/* + * Copyright © 2014 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * that the name of the copyright holders not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no representations + * about the suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +#include "glamor_priv.h" +#include "glamor_transfer.h" + +/* XXX a kludge for now */ +void +glamor_format_for_pixmap(PixmapPtr pixmap, GLenum *format, GLenum *type) +{ + switch (pixmap->drawable.depth) { + case 24: + case 32: + *format = GL_BGRA; + *type = GL_UNSIGNED_INT_8_8_8_8_REV; + break; + case 16: + *format = GL_RGB; + *type = GL_UNSIGNED_SHORT_5_6_5; + break; + case 15: + *format = GL_BGRA; + *type = GL_UNSIGNED_SHORT_1_5_5_5_REV; + break; + case 8: + *format = GL_ALPHA; + *type = GL_UNSIGNED_BYTE; + break; + default: + FatalError("Invalid pixmap depth %d\n", pixmap->drawable.depth); + break; + } +} + +/* + * Write a region of bits into a pixmap + */ +void +glamor_upload_boxes(PixmapPtr pixmap, BoxPtr in_boxes, int in_nbox, + int dx_src, int dy_src, + int dx_dst, int dy_dst, + uint8_t *bits, uint32_t byte_stride) +{ + ScreenPtr screen = pixmap->drawable.pScreen; + glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); + glamor_pixmap_private *priv = glamor_get_pixmap_private(pixmap); + int box_x, box_y; + int bytes_per_pixel = pixmap->drawable.bitsPerPixel >> 3; + GLenum type; + GLenum format; + + glamor_format_for_pixmap(pixmap, &format, &type); + + glamor_make_current(glamor_priv); + + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + + glPixelStorei(GL_UNPACK_ALIGNMENT, 4); + glPixelStorei(GL_UNPACK_ROW_LENGTH, byte_stride / bytes_per_pixel); + + glamor_pixmap_loop(priv, box_x, box_y) { + BoxPtr box = glamor_pixmap_box_at(priv, box_x, box_y); + glamor_pixmap_fbo *fbo = glamor_pixmap_fbo_at(priv, box_x, box_y); + BoxPtr boxes = in_boxes; + int nbox = in_nbox; + + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D, fbo->tex); + + while (nbox--) { + + /* compute drawable coordinates */ + int x1 = boxes->x1 + dx_dst; + int x2 = boxes->x2 + dx_dst; + int y1 = boxes->y1 + dy_dst; + int y2 = boxes->y2 + dy_dst; + + boxes++; + + if (x1 < box->x1) + x1 = box->x1; + if (box->x2 < x2) + x2 = box->x2; + + if (x2 <= x1) + continue; + + if (y1 < box->y1) + y1 = box->y1; + if (box->y2 < y2) + y2 = box->y2; + + if (y2 <= y1) + continue; + + glPixelStorei(GL_UNPACK_SKIP_ROWS, y1 - dy_dst + dy_src); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, x1 - dx_dst + dx_src); + + glTexSubImage2D(GL_TEXTURE_2D, 0, + x1 - box->x1, y1 - box->y1, + x2 - x1, y2 - y1, + format, type, + bits); + } + } + + glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); + glPixelStorei(GL_UNPACK_SKIP_ROWS, 0); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0); +} + +/* + * Upload a region of data + */ + +void +glamor_upload_region(PixmapPtr pixmap, RegionPtr region, + int region_x, int region_y, + uint8_t *bits, uint32_t byte_stride) +{ + glamor_upload_boxes(pixmap, RegionRects(region), RegionNumRects(region), + -region_x, -region_y, + 0, 0, + bits, byte_stride); +} + +/* + * Take the data in the pixmap and stuff it back into the FBO + */ +void +glamor_upload_pixmap(PixmapPtr pixmap) +{ + BoxRec box; + + box.x1 = 0; + box.x2 = pixmap->drawable.width; + box.y1 = 0; + box.y2 = pixmap->drawable.height; + glamor_upload_boxes(pixmap, &box, 1, 0, 0, 0, 0, + pixmap->devPrivate.ptr, pixmap->devKind); +} + +/* + * Read stuff from the pixmap FBOs and write to memory + */ +void +glamor_download_boxes(PixmapPtr pixmap, BoxPtr in_boxes, int in_nbox, + int dx_src, int dy_src, + int dx_dst, int dy_dst, + uint8_t *bits, uint32_t byte_stride) +{ + ScreenPtr screen = pixmap->drawable.pScreen; + glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); + glamor_pixmap_private *priv = glamor_get_pixmap_private(pixmap); + int box_x, box_y; + int bytes_per_pixel = pixmap->drawable.bitsPerPixel >> 3; + GLenum type; + GLenum format; + + glamor_format_for_pixmap(pixmap, &format, &type); + + glamor_make_current(glamor_priv); + + glPixelStorei(GL_PACK_ALIGNMENT, 4); + glPixelStorei(GL_PACK_ROW_LENGTH, byte_stride / bytes_per_pixel); + + glamor_pixmap_loop(priv, box_x, box_y) { + BoxPtr box = glamor_pixmap_box_at(priv, box_x, box_y); + glamor_pixmap_fbo *fbo = glamor_pixmap_fbo_at(priv, box_x, box_y); + BoxPtr boxes = in_boxes; + int nbox = in_nbox; + + glBindFramebuffer(GL_READ_FRAMEBUFFER, fbo->fb); + + while (nbox--) { + + /* compute drawable coordinates */ + int x1 = boxes->x1 + dx_src; + int x2 = boxes->x2 + dx_src; + int y1 = boxes->y1 + dy_src; + int y2 = boxes->y2 + dy_src; + + boxes++; + + if (x1 < box->x1) + x1 = box->x1; + if (box->x2 < x2) + x2 = box->x2; + + if (y1 < box->y1) + y1 = box->y1; + if (box->y2 < y2) + y2 = box->y2; + + if (x2 <= x1) + continue; + if (y2 <= y1) + continue; + + glPixelStorei(GL_PACK_SKIP_PIXELS, x1 - dx_src + dx_dst); + glPixelStorei(GL_PACK_SKIP_ROWS, y1 - dy_src + dy_dst); + glReadPixels(x1 - box->x1, y1 - box->y1, x2 - x1, y2 - y1, format, type, bits); + } + } + glPixelStorei(GL_PACK_ROW_LENGTH, 0); + glPixelStorei(GL_PACK_SKIP_ROWS, 0); + glPixelStorei(GL_PACK_SKIP_PIXELS, 0); +} + +/* + * Read data from the pixmap FBO + */ +void +glamor_download_rect(PixmapPtr pixmap, int x, int y, int w, int h, uint8_t *bits) +{ + BoxRec box; + + box.x1 = x; + box.x2 = x + w; + box.y1 = y; + box.y2 = y + h; + + glamor_download_boxes(pixmap, &box, 1, 0, 0, -x, -y, + bits, PixmapBytePad(w, pixmap->drawable.depth)); +} + +/* + * Pull the data from the FBO down to the pixmap + */ +void +glamor_download_pixmap(PixmapPtr pixmap) +{ + BoxRec box; + + box.x1 = 0; + box.x2 = pixmap->drawable.width; + box.y1 = 0; + box.y2 = pixmap->drawable.height; + + glamor_download_boxes(pixmap, &box, 1, 0, 0, 0, 0, + pixmap->devPrivate.ptr, pixmap->devKind); +} diff --git a/xserver/glamor/glamor_transfer.h b/xserver/glamor/glamor_transfer.h new file mode 100644 index 000000000..de8186a70 --- /dev/null +++ b/xserver/glamor/glamor_transfer.h @@ -0,0 +1,55 @@ +/* + * Copyright © 2014 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * that the name of the copyright holders not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no representations + * about the suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +#ifndef _GLAMOR_TRANSFER_H_ +#define _GLAMOR_TRANSFER_H_ + +void +glamor_format_for_pixmap(PixmapPtr pixmap, GLenum *format, GLenum *type); + +void +glamor_upload_boxes(PixmapPtr pixmap, BoxPtr in_boxes, int in_nbox, + int dx_src, int dy_src, + int dx_dst, int dy_dst, + uint8_t *bits, uint32_t byte_stride); + +void +glamor_upload_region(PixmapPtr pixmap, RegionPtr region, + int region_x, int region_y, + uint8_t *bits, uint32_t byte_stride); + +void +glamor_upload_pixmap(PixmapPtr pixmap); + +void +glamor_download_boxes(PixmapPtr pixmap, BoxPtr in_boxes, int in_nbox, + int dx_src, int dy_src, + int dx_dst, int dy_dst, + uint8_t *bits, uint32_t byte_stride); + +void +glamor_download_rect(PixmapPtr pixmap, int x, int y, int w, int h, uint8_t *bits); + +void +glamor_download_pixmap(PixmapPtr pixmap); + +#endif /* _GLAMOR_TRANSFER_H_ */ diff --git a/xserver/glamor/glamor_transform.c b/xserver/glamor/glamor_transform.c new file mode 100644 index 000000000..d6ba56421 --- /dev/null +++ b/xserver/glamor/glamor_transform.c @@ -0,0 +1,215 @@ +/* + * Copyright © 2014 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * that the name of the copyright holders not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no representations + * about the suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +#include "glamor_priv.h" +#include "glamor_transform.h" + + +/* + * Set up rendering to target the specified drawable, computing an + * appropriate transform for the vertex shader to convert + * drawable-relative coordinates into pixmap-relative coordinates. If + * requested, the offset from pixmap origin coordinates back to window + * system coordinates will be returned in *p_off_x, *p_off_y so that + * clipping computations can be adjusted as appropriate + */ + +void +glamor_set_destination_drawable(DrawablePtr drawable, + int box_x, + int box_y, + Bool do_drawable_translate, + Bool center_offset, + GLint matrix_uniform_location, + int *p_off_x, + int *p_off_y) +{ + PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable); + glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap); + int off_x, off_y; + BoxPtr box = glamor_pixmap_box_at(pixmap_priv, box_x, box_y); + int w = box->x2 - box->x1; + int h = box->y2 - box->y1; + float scale_x = 2.0f / (float) w; + float scale_y = 2.0f / (float) h; + float center_adjust = 0.0f; + + glamor_get_drawable_deltas(drawable, pixmap, &off_x, &off_y); + + off_x -= box->x1; + off_y -= box->y1; + + if (p_off_x) { + *p_off_x = off_x; + *p_off_y = off_y; + } + + /* A tricky computation to find the right value for the two linear functions + * that transform rendering coordinates to pixmap coordinates + * + * pixmap_x = render_x + drawable->x + off_x + * pixmap_y = render_y + drawable->y + off_y + * + * gl_x = pixmap_x * 2 / width - 1 + * gl_y = pixmap_y * 2 / height - 1 + * + * gl_x = (render_x + drawable->x + off_x) * 2 / width - 1 + * + * gl_x = (render_x) * 2 / width + (drawable->x + off_x) * 2 / width - 1 + * + * I'll think about yInverted later, when I have some way to test + */ + + if (do_drawable_translate) { + off_x += drawable->x; + off_y += drawable->y; + } + + /* + * To get GL_POINTS drawn in the right spot, we need to adjust the + * coordinates by 1/2 a pixel. + */ + if (center_offset) + center_adjust = 0.5f; + + glUniform4f(matrix_uniform_location, + scale_x, (off_x + center_adjust) * scale_x - 1.0f, + scale_y, (off_y + center_adjust) * scale_y - 1.0f); + + glamor_set_destination_pixmap_fbo(glamor_pixmap_fbo_at(pixmap_priv, box_x, box_y), + 0, 0, w, h); +} + +/* + * Set up for solid rendering to the specified pixmap using alu, fg and planemask + * from the specified GC. Load the target color into the specified uniform + */ + +void +glamor_set_color(PixmapPtr pixmap, + CARD32 pixel, + GLint uniform) +{ + float color[4]; + + glamor_get_rgba_from_pixel(pixel, + &color[0], &color[1], &color[2], &color[3], + format_for_pixmap(pixmap)); + + glUniform4fv(uniform, 1, color); +} + +Bool +glamor_set_solid(PixmapPtr pixmap, + GCPtr gc, + Bool use_alu, + GLint uniform) +{ + CARD32 pixel; + int alu = use_alu ? gc->alu : GXcopy; + + if (!glamor_set_planemask(pixmap, gc->planemask)) + return FALSE; + + pixel = gc->fgPixel; + + if (!glamor_set_alu(pixmap->drawable.pScreen, alu)) { + switch (gc->alu) { + case GXclear: + pixel = 0; + break; + case GXcopyInverted: + pixel = ~pixel; + break; + case GXset: + pixel = ~0 & gc->planemask; + break; + default: + return FALSE; + } + } + glamor_set_color(pixmap, gc->fgPixel, uniform); + + return TRUE; +} + +Bool +glamor_set_texture(PixmapPtr pixmap, + PixmapPtr texture, + int off_x, + int off_y, + GLint offset_uniform, + GLint size_uniform) +{ + glamor_pixmap_private *texture_priv; + + texture_priv = glamor_get_pixmap_private(texture); + + if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(texture_priv)) + return FALSE; + + if (texture_priv->type == GLAMOR_TEXTURE_LARGE) + return FALSE; + + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D, texture_priv->base.fbo->tex); + + glUniform2f(offset_uniform, off_x, off_y); + glUniform2f(size_uniform, texture->drawable.width, texture->drawable.height); + return TRUE; +} + +Bool +glamor_set_tiled(PixmapPtr pixmap, + GCPtr gc, + GLint offset_uniform, + GLint size_uniform) +{ + if (!glamor_set_alu(pixmap->drawable.pScreen, gc->alu)) + return FALSE; + + if (!glamor_set_planemask(pixmap, gc->planemask)) + return FALSE; + + return glamor_set_texture(pixmap, + gc->tile.pixmap, + -gc->patOrg.x, + -gc->patOrg.y, + offset_uniform, + size_uniform); +} + +Bool +glamor_set_stippled(PixmapPtr pixmap, + GCPtr gc, + GLint fg_uniform, + GLint offset_uniform, + GLint size_uniform) +{ + if (!glamor_set_solid(pixmap, gc, TRUE, fg_uniform)) + return FALSE; + + if (!glamor_set_texture(pixmap, gc->stipple, gc->patOrg.x, gc->patOrg.y, offset_uniform, size_uniform)) + return FALSE; + + return TRUE; +} diff --git a/xserver/glamor/glamor_transform.h b/xserver/glamor/glamor_transform.h new file mode 100644 index 000000000..36b789af8 --- /dev/null +++ b/xserver/glamor/glamor_transform.h @@ -0,0 +1,87 @@ +/* + * Copyright © 2014 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * that the name of the copyright holders not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no representations + * about the suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +#ifndef _GLAMOR_TRANSFORM_H_ +#define _GLAMOR_TRANSFORM_H_ + +void +glamor_set_destination_drawable(DrawablePtr drawable, + int box_x, + int box_y, + Bool do_drawable_translate, + Bool center_offset, + GLint matrix_uniform_location, + int *p_off_x, + int *p_off_y); + +void +glamor_set_color(PixmapPtr pixmap, + CARD32 pixel, + GLint uniform); + +Bool +glamor_set_texture(PixmapPtr pixmap, + PixmapPtr texture, + int off_x, + int off_y, + GLint offset_uniform, + GLint size_uniform); + +Bool +glamor_set_solid(PixmapPtr pixmap, + GCPtr gc, + Bool use_alu, + GLint uniform); + +Bool +glamor_set_tiled(PixmapPtr pixmap, + GCPtr gc, + GLint offset_uniform, + GLint size_uniform); + +Bool +glamor_set_stippled(PixmapPtr pixmap, + GCPtr gc, + GLint fg_uniform, + GLint offset_uniform, + GLint size_uniform); + +/* + * Vertex shader bits that transform X coordinates to pixmap + * coordinates using the matrix computed above + */ + +#define GLAMOR_DECLARE_MATRIX "uniform vec4 v_matrix;\n" +#define GLAMOR_X_POS(x) #x " *v_matrix.x + v_matrix.y" +#define GLAMOR_Y_POS(y) #y " *v_matrix.z + v_matrix.w" +#if 0 +#define GLAMOR_POS(dst,src) \ + " " #dst ".x = " #src ".x * v_matrix.x + v_matrix.y;\n" \ + " " #dst ".y = " #src ".y * v_matrix.z + v_matrix.w;\n" \ + " " #dst ".z = 0.0;\n" \ + " " #dst ".w = 1.0;\n" +#endif +#define GLAMOR_POS(dst,src) \ + " " #dst ".xy = " #src ".xy * v_matrix.xz + v_matrix.yw;\n" \ + " " #dst ".zw = vec2(0.0,1.0);\n" + +#endif /* _GLAMOR_TRANSFORM_H_ */ diff --git a/xserver/glamor/glamor_trapezoid.c b/xserver/glamor/glamor_trapezoid.c new file mode 100644 index 000000000..4aba469af --- /dev/null +++ b/xserver/glamor/glamor_trapezoid.c @@ -0,0 +1,1818 @@ +/* + * Copyright © 2009 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Authors: + * Junyan He <junyan.he@linux.intel.com> + * + */ + +/** @file glamor_trapezoid.c + * + * Trapezoid acceleration implementation + */ + +#include "glamor_priv.h" + +#ifdef RENDER +#include "mipict.h" +#include "fbpict.h" + +static xFixed +_glamor_linefixedX(xLineFixed *l, xFixed y, Bool ceil) +{ + xFixed dx = l->p2.x - l->p1.x; + xFixed_32_32 ex = (xFixed_32_32) (y - l->p1.y) * dx; + xFixed dy = l->p2.y - l->p1.y; + + if (ceil) + ex += (dy - 1); + return l->p1.x + (xFixed) (ex / dy); +} + +static xFixed +_glamor_linefixedY(xLineFixed *l, xFixed x, Bool ceil) +{ + xFixed dy = l->p2.y - l->p1.y; + xFixed_32_32 ey = (xFixed_32_32) (x - l->p1.x) * dy; + xFixed dx = l->p2.x - l->p1.x; + + if (ceil) + ey += (dx - 1); + return l->p1.y + (xFixed) (ey / dx); +} + +#ifdef GLAMOR_TRAPEZOID_SHADER + +#define GLAMOR_VERTEX_TOP_BOTTOM (GLAMOR_VERTEX_SOURCE + 1) +#define GLAMOR_VERTEX_LEFT_PARAM (GLAMOR_VERTEX_SOURCE + 2) +#define GLAMOR_VERTEX_RIGHT_PARAM (GLAMOR_VERTEX_SOURCE + 3) + +#define DEBUG_CLIP_VTX 0 + +#define POINT_INSIDE_CLIP_RECT(point, rect) \ + (point[0] >= IntToxFixed(rect->x1) \ + && point[0] <= IntToxFixed(rect->x2) \ + && point[1] >= IntToxFixed(rect->y1) \ + && point[1] <= IntToxFixed(rect->y2)) + +static xFixed +_glamor_lines_crossfixedY(xLineFixed *l, xLineFixed *r) +{ + xFixed dx1 = l->p2.x - l->p1.x; + xFixed dx2 = r->p2.x - r->p1.x; + xFixed dy1 = l->p2.y - l->p1.y; + xFixed dy2 = r->p2.y - r->p1.y; + xFixed_32_32 tmp = (xFixed_32_32) dy2 * dy1; + xFixed_32_32 dividend1 = (tmp >> 32) * (l->p1.x - r->p1.x); + xFixed_32_32 dividend2; + xFixed_32_32 dividend3; + xFixed_32_32 divisor; + + tmp = (xFixed_32_32) dx1 *dy2; + + dividend2 = (tmp >> 32) * l->p1.y; + tmp = (xFixed_32_32) dy1 *dx2; + + dividend3 = (tmp >> 32) * r->p1.y; + divisor = ((xFixed_32_32) dx1 * (xFixed_32_32) dy2 + - (xFixed_32_32) dy1 * (xFixed_32_32) dx2) >> 32; + + if (divisor) + return (xFixed) ((dividend2 - dividend1 - dividend3) / divisor); + + return 0xFFFFFFFF; +} + +static Bool +point_inside_trapezoid(int point[2], xTrapezoid *trap, xFixed cut_y) +{ + int ret = TRUE; + int tmp; + + if (point[1] > trap->bottom) { + ret = FALSE; + if (DEBUG_CLIP_VTX) { + ErrorF("Out of Trap bottom, point[1] = %d(0x%x)), " + "bottom = %d(0x%x)\n", + (unsigned int) xFixedToInt(point[1]), point[1], + (unsigned int) xFixedToInt(trap->bottom), + (unsigned int) trap->bottom); + } + + return ret; + } + + if (point[1] < trap->top) { + ret = FALSE; + if (DEBUG_CLIP_VTX) { + ErrorF("Out of Trap top, point[1] = %d(0x%x)), " + "top = %d(0x%x)\n", + (unsigned int) xFixedToInt(point[1]), point[1], + (unsigned int) xFixedToInt(trap->top), + (unsigned int) trap->top); + } + + return ret; + } + + tmp = _glamor_linefixedX(&trap->left, point[1], FALSE); + if (point[0] < tmp) { + ret = FALSE; + + if (abs(cut_y - trap->top) < pixman_fixed_1_minus_e && + abs(point[1] - trap->top) < pixman_fixed_1_minus_e && + tmp - point[0] < pixman_fixed_1_minus_e) { + ret = TRUE; + } + else if (abs(cut_y - trap->bottom) < pixman_fixed_1_minus_e && + point[1] - trap->bottom < pixman_fixed_1_minus_e && + tmp - point[0] < pixman_fixed_1_minus_e) { + ret = TRUE; + } + + if (DEBUG_CLIP_VTX && !ret) { + ErrorF("Out of Trap left, point[0] = %d(0x%x)), " + "left = %d(0x%x)\n", + (unsigned int) xFixedToInt(point[0]), point[0], + (unsigned int) xFixedToInt(tmp), (unsigned int) tmp); + } + + if (!ret) + return ret; + } + + tmp = _glamor_linefixedX(&trap->right, point[1], TRUE); + if (point[0] > tmp) { + ret = FALSE; + + if (abs(cut_y - trap->top) < pixman_fixed_1_minus_e && + abs(point[1] - trap->top) < pixman_fixed_1_minus_e && + point[0] - tmp < pixman_fixed_1_minus_e) { + ret = TRUE; + } + else if (abs(cut_y - trap->bottom) < pixman_fixed_1_minus_e && + abs(point[1] - trap->bottom) < pixman_fixed_1_minus_e && + point[0] - tmp < pixman_fixed_1_minus_e) { + ret = TRUE; + } + + if (DEBUG_CLIP_VTX && !ret) { + ErrorF("Out of Trap right, point[0] = %d(0x%x)), " + "right = %d(0x%x)\n", + (unsigned int) xFixedToInt(point[0]), point[0], + (unsigned int) xFixedToInt(tmp), (unsigned int) tmp); + } + + if (!ret) + return ret; + } + + return ret; +} + +static void +glamor_emit_composite_vert(ScreenPtr screen, + float *vb, + const float *src_coords, + const float *mask_coords, + const float *dst_coords, int i) +{ + glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); + int j = 0; + + vb += i * glamor_priv->vb_stride / sizeof(float); + + vb[j++] = dst_coords[i * 2 + 0]; + vb[j++] = dst_coords[i * 2 + 1]; + if (glamor_priv->has_source_coords) { + vb[j++] = src_coords[i * 2 + 0]; + vb[j++] = src_coords[i * 2 + 1]; + } + if (glamor_priv->has_mask_coords) { + vb[j++] = mask_coords[i * 2 + 0]; + vb[j++] = mask_coords[i * 2 + 1]; + } + + glamor_priv->render_nr_verts++; +} + +static void +glamor_emit_composite_triangle(ScreenPtr screen, + float *vb, + const float *src_coords, + const float *mask_coords, + const float *dst_coords) +{ + glamor_emit_composite_vert(screen, vb, + src_coords, mask_coords, dst_coords, 0); + glamor_emit_composite_vert(screen, vb, + src_coords, mask_coords, dst_coords, 1); + glamor_emit_composite_vert(screen, vb, + src_coords, mask_coords, dst_coords, 2); +} + +static void +glamor_flush_composite_triangles(ScreenPtr screen) +{ + glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); + + glamor_make_current(glamor_priv); + glamor_put_vbo_space(screen); + + if (!glamor_priv->render_nr_verts) + return; + + glDrawArrays(GL_TRIANGLES, 0, glamor_priv->render_nr_verts); +} + +static Bool +_glamor_clip_trapezoid_vertex(xTrapezoid *trap, BoxPtr pbox, + int vertex[6], int *num) +{ + xFixed edge_cross_y = 0xFFFFFFFF; + int tl[2]; + int bl[2]; + int tr[2]; + int br[2]; + int left_cut_top[2]; + int left_cut_left[2]; + int left_cut_right[2]; + int left_cut_bottom[2]; + int right_cut_top[2]; + int right_cut_left[2]; + int right_cut_right[2]; + int right_cut_bottom[2]; + int tmp[2]; + int tmp_vtx[20 * 2]; + float tmp_vtx_slope[20]; + BoxRec trap_bound; + int i = 0; + int vertex_num = 0; + + if (DEBUG_CLIP_VTX) { + ErrorF + ("The parameter of xTrapezoid is:\ntop: %d 0x%x\tbottom: %d 0x%x\n" + "left: p1 (%d 0x%x, %d 0x%x)\tp2 (%d 0x%x, %d 0x%x)\n" + "right: p1 (%d 0x%x, %d 0x%x)\tp2 (%d 0x%x, %d 0x%x)\n", + xFixedToInt(trap->top), (unsigned int) trap->top, + xFixedToInt(trap->bottom), (unsigned int) trap->bottom, + xFixedToInt(trap->left.p1.x), (unsigned int) trap->left.p1.x, + xFixedToInt(trap->left.p1.y), (unsigned int) trap->left.p1.y, + xFixedToInt(trap->left.p2.x), (unsigned int) trap->left.p2.x, + xFixedToInt(trap->left.p2.y), (unsigned int) trap->left.p2.y, + xFixedToInt(trap->right.p1.x), (unsigned int) trap->right.p1.x, + xFixedToInt(trap->right.p1.y), (unsigned int) trap->right.p1.y, + xFixedToInt(trap->right.p2.x), (unsigned int) trap->right.p2.x, + xFixedToInt(trap->right.p2.y), (unsigned int) trap->right.p2.y); + } + + miTrapezoidBounds(1, trap, &trap_bound); + if (DEBUG_CLIP_VTX) + ErrorF("The bounds for this traps is: bounds.x1 = %d, bounds.x2 = %d, " + "bounds.y1 = %d, bounds.y2 = %d\n", trap_bound.x1, trap_bound.x2, + trap_bound.y1, trap_bound.y2); + + if (trap_bound.x1 > pbox->x2 || trap_bound.x2 < pbox->x1) + return FALSE; + if (trap_bound.y1 > pbox->y2 || trap_bound.y2 < pbox->y1) + return FALSE; + +#define IS_TRAP_EDGE_VERTICAL(edge) \ + (edge->p1.x == edge->p2.x) + +#define CACULATE_CUT_VERTEX(vtx, cal_x, ceil, vh_edge, edge) \ + do { \ + if(cal_x) { \ + vtx[1] = (vh_edge); \ + vtx[0] = (_glamor_linefixedX( \ + edge, vh_edge, ceil)); \ + if(DEBUG_CLIP_VTX) \ + ErrorF("The intersection point of line y=%d and " \ + "line of p1:(%d,%d) -- p2 (%d,%d) " \ + "is (%d, %d)\n", \ + xFixedToInt(vh_edge), \ + xFixedToInt(edge->p1.x), \ + xFixedToInt(edge->p1.y), \ + xFixedToInt(edge->p2.x), \ + xFixedToInt(edge->p2.y), \ + xFixedToInt(vtx[0]), \ + xFixedToInt(vtx[1])); \ + } else { \ + vtx[0] = (vh_edge); \ + vtx[1] = (_glamor_linefixedY( \ + edge, vh_edge, ceil)); \ + if(DEBUG_CLIP_VTX) \ + ErrorF("The intersection point of line x=%d and " \ + "line of p1:(%d,%d) -- p2 (%d,%d) " \ + "is (%d, %d)\n", \ + xFixedToInt(vh_edge), \ + xFixedToInt(edge->p1.x), \ + xFixedToInt(edge->p1.y), \ + xFixedToInt(edge->p2.x), \ + xFixedToInt(edge->p2.y), \ + xFixedToInt(vtx[0]), \ + xFixedToInt(vtx[1])); \ + } \ + } while(0) + +#define ADD_VERTEX_IF_INSIDE(vtx) \ + if(POINT_INSIDE_CLIP_RECT(vtx, pbox) \ + && point_inside_trapezoid(vtx, trap, edge_cross_y)){ \ + tmp_vtx[vertex_num] = xFixedToInt(vtx[0]); \ + tmp_vtx[vertex_num + 1] = xFixedToInt(vtx[1]); \ + vertex_num += 2; \ + if(DEBUG_CLIP_VTX) \ + ErrorF("@ Point: (%d, %d) is inside " \ + "the Rect and Trapezoid\n", \ + xFixedToInt(vtx[0]), \ + xFixedToInt(vtx[1])); \ + } else if(DEBUG_CLIP_VTX){ \ + ErrorF("X Point: (%d, %d) is outside " \ + "the Rect and Trapezoid\t", \ + xFixedToInt(vtx[0]), \ + xFixedToInt(vtx[1])); \ + if(POINT_INSIDE_CLIP_RECT(vtx, pbox)) \ + ErrorF("The Point is outside " \ + "the Trapezoid\n"); \ + else \ + ErrorF("The Point is outside " \ + "the Rect\n"); \ + } + + /*Trap's right edge cut right edge. */ + if ((!IS_TRAP_EDGE_VERTICAL((&trap->left))) || + (!IS_TRAP_EDGE_VERTICAL((&trap->right)))) { + edge_cross_y = _glamor_lines_crossfixedY((&trap->left), (&trap->right)); + if (DEBUG_CLIP_VTX) { + ErrorF("Trap's left edge cut right edge at %d(0x%x), " + "trap_top = %x, trap_bottom = %x\n", + xFixedToInt(edge_cross_y), edge_cross_y, + (unsigned int) trap->top, (unsigned int) trap->bottom); + } + } + + /*Trap's TopLeft, BottomLeft, TopRight and BottomRight. */ + CACULATE_CUT_VERTEX(tl, 1, FALSE, trap->top, (&trap->left)); + CACULATE_CUT_VERTEX(bl, 1, FALSE, trap->bottom, (&trap->left)); + CACULATE_CUT_VERTEX(tr, 1, TRUE, trap->top, (&trap->right)); + CACULATE_CUT_VERTEX(br, 1, TRUE, trap->bottom, (&trap->right)); + + if (DEBUG_CLIP_VTX) + ErrorF("Trap's TopLeft, BottomLeft, TopRight and BottomRight\n"); + if (DEBUG_CLIP_VTX) + ErrorF("Caculate the vertex of trapezoid:\n" + " (%3d, %3d)-------------------------(%3d, %3d)\n" + " / \\ \n" + " / \\ \n" + " / \\ \n" + " (%3d, %3d)---------------------------------(%3d, %3d)\n" + "Clip with rect:\n" + " (%3d, %3d)------------------------(%3d, %3d) \n" + " | | \n" + " | | \n" + " | | \n" + " (%3d, %3d)------------------------(%3d, %3d) \n", + xFixedToInt(tl[0]), xFixedToInt(tl[1]), xFixedToInt(tr[0]), + xFixedToInt(tr[1]), xFixedToInt(bl[0]), xFixedToInt(bl[1]), + xFixedToInt(br[0]), xFixedToInt(br[1]), + pbox->x1, pbox->y1, pbox->x2, pbox->y1, pbox->x1, pbox->y2, + pbox->x2, pbox->y2); + + ADD_VERTEX_IF_INSIDE(tl); + ADD_VERTEX_IF_INSIDE(bl); + ADD_VERTEX_IF_INSIDE(tr); + ADD_VERTEX_IF_INSIDE(br); + + /*Trap's left edge cut Rect. */ + if (DEBUG_CLIP_VTX) + ErrorF("Trap's left edge cut Rect\n"); + CACULATE_CUT_VERTEX(left_cut_top, 1, FALSE, IntToxFixed(pbox->y1), + (&trap->left)); + ADD_VERTEX_IF_INSIDE(left_cut_top); + if (!IS_TRAP_EDGE_VERTICAL((&trap->left))) { + CACULATE_CUT_VERTEX(left_cut_left, 0, FALSE, IntToxFixed(pbox->x1), + (&trap->left)); + ADD_VERTEX_IF_INSIDE(left_cut_left); + } + CACULATE_CUT_VERTEX(left_cut_bottom, 1, FALSE, IntToxFixed(pbox->y2), + (&trap->left)); + ADD_VERTEX_IF_INSIDE(left_cut_bottom); + if (!IS_TRAP_EDGE_VERTICAL((&trap->left))) { + CACULATE_CUT_VERTEX(left_cut_right, 0, FALSE, IntToxFixed(pbox->x2), + (&trap->left)); + ADD_VERTEX_IF_INSIDE(left_cut_right); + } + + /*Trap's right edge cut Rect. */ + if (DEBUG_CLIP_VTX) + ErrorF("Trap's right edge cut Rect\n"); + CACULATE_CUT_VERTEX(right_cut_top, 1, TRUE, IntToxFixed(pbox->y1), + (&trap->right)); + ADD_VERTEX_IF_INSIDE(right_cut_top); + if (!IS_TRAP_EDGE_VERTICAL((&trap->right))) { + CACULATE_CUT_VERTEX(right_cut_left, 0, TRUE, IntToxFixed(pbox->x1), + (&trap->right)); + ADD_VERTEX_IF_INSIDE(right_cut_left); + } + CACULATE_CUT_VERTEX(right_cut_bottom, 1, TRUE, IntToxFixed(pbox->y2), + (&trap->right)); + ADD_VERTEX_IF_INSIDE(right_cut_bottom); + if (!IS_TRAP_EDGE_VERTICAL((&trap->right))) { + CACULATE_CUT_VERTEX(right_cut_right, 0, TRUE, IntToxFixed(pbox->x2), + (&trap->right)); + ADD_VERTEX_IF_INSIDE(right_cut_right); + } + + /* Trap's top cut Left and Right of rect. */ + if (DEBUG_CLIP_VTX) + ErrorF("Trap's top cut Left and Right of rect\n"); + tmp[0] = IntToxFixed(pbox->x1); + tmp[1] = trap->top; + ADD_VERTEX_IF_INSIDE(tmp); + tmp[0] = IntToxFixed(pbox->x2); + tmp[1] = trap->top; + ADD_VERTEX_IF_INSIDE(tmp); + + /* Trap's bottom cut Left and Right of rect. */ + if (DEBUG_CLIP_VTX) + ErrorF("Trap's bottom cut Left and Right of rect\n"); + tmp[0] = IntToxFixed(pbox->x1); + tmp[1] = trap->bottom; + ADD_VERTEX_IF_INSIDE(tmp); + tmp[0] = IntToxFixed(pbox->x2); + tmp[1] = trap->bottom; + ADD_VERTEX_IF_INSIDE(tmp); + + /* The orginal 4 vertex of rect. */ + if (DEBUG_CLIP_VTX) + ErrorF("The orginal 4 vertex of rect\n"); + tmp[0] = IntToxFixed(pbox->x1); + tmp[1] = IntToxFixed(pbox->y1); + ADD_VERTEX_IF_INSIDE(tmp); + tmp[0] = IntToxFixed(pbox->x1); + tmp[1] = IntToxFixed(pbox->y2); + ADD_VERTEX_IF_INSIDE(tmp); + tmp[0] = IntToxFixed(pbox->x2); + tmp[1] = IntToxFixed(pbox->y2); + ADD_VERTEX_IF_INSIDE(tmp); + tmp[0] = IntToxFixed(pbox->x2); + tmp[1] = IntToxFixed(pbox->y1); + ADD_VERTEX_IF_INSIDE(tmp); + + if (DEBUG_CLIP_VTX) { + ErrorF("\nThe candidate vertex number is %d\n", vertex_num / 2); + for (i = 0; i < vertex_num / 2; i++) { + ErrorF("(%d, %d) ", tmp_vtx[2 * i], tmp_vtx[2 * i + 1]); + } + ErrorF("\n"); + } + + /* Sort the vertex by X and then Y. */ + for (i = 0; i < vertex_num / 2; i++) { + int j; + + for (j = 0; j < vertex_num / 2 - i - 1; j++) { + if (tmp_vtx[2 * j] > tmp_vtx[2 * (j + 1)] + || (tmp_vtx[2 * j] == tmp_vtx[2 * (j + 1)] + && tmp_vtx[2 * j + 1] > tmp_vtx[2 * (j + 1) + 1])) { + tmp[0] = tmp_vtx[2 * j]; + tmp[1] = tmp_vtx[2 * j + 1]; + tmp_vtx[2 * j] = tmp_vtx[2 * (j + 1)]; + tmp_vtx[2 * j + 1] = tmp_vtx[2 * (j + 1) + 1]; + tmp_vtx[2 * (j + 1)] = tmp[0]; + tmp_vtx[2 * (j + 1) + 1] = tmp[1]; + } + } + + } + + if (DEBUG_CLIP_VTX) { + ErrorF("\nAfter sort vertex number is:\n"); + for (i = 0; i < vertex_num / 2; i++) { + ErrorF("(%d, %d) ", tmp_vtx[2 * i], tmp_vtx[2 * i + 1]); + } + ErrorF("\n"); + } + + memset(vertex, -1, 2 * 6); + *num = 0; + + for (i = 0; i < vertex_num / 2; i++) { + if (*num > 0 && vertex[2 * (*num - 1)] == tmp_vtx[2 * i] + && vertex[2 * (*num - 1) + 1] == tmp_vtx[2 * i + 1]) { + /*same vertex. */ + if (DEBUG_CLIP_VTX) + ErrorF("X Point:(%d, %d) discard\n", + tmp_vtx[2 * i], tmp_vtx[2 * i + 1]); + continue; + } + + (*num)++; + if (*num > 6) { + if (DEBUG_CLIP_VTX) + FatalError("Trapezoid clip with Rect can never have vtx" + "number bigger than 6\n"); + else { + ErrorF("Trapezoid clip with Rect can never have vtx" + "number bigger than 6\n"); + *num = 6; + break; + } + } + + vertex[2 * (*num - 1)] = tmp_vtx[2 * i]; + vertex[2 * (*num - 1) + 1] = tmp_vtx[2 * i + 1]; + if (DEBUG_CLIP_VTX) + ErrorF("@ Point:(%d, %d) select, num now is %d\n", + tmp_vtx[2 * i], tmp_vtx[2 * i + 1], *num); + } + + /* Now we need to arrange the vtx in the polygon's counter-clockwise + order. We first select the left and top point as the start point and + sort every vtx by the slope from vtx to the start vtx. */ + for (i = 1; i < *num; i++) { + tmp_vtx_slope[i] = (vertex[2 * i] != vertex[0] ? + (float) (vertex[2 * i + 1] - + vertex[1]) / (float) (vertex[2 * i] - + vertex[0]) + : (float) INT_MAX); + } + + if (DEBUG_CLIP_VTX) { + ErrorF("\nvtx number: %d, VTX and slope:\n", *num); + for (i = 0; i < *num; i++) { + ErrorF("(%d, %d):%f ", + vertex[2 * i], vertex[2 * i + 1], tmp_vtx_slope[i]); + } + ErrorF("\n"); + } + + /* Sort the vertex by slope. */ + for (i = 0; i < *num - 1; i++) { + int j; + float tmp_slope; + + for (j = 1; j < *num - i - 1; j++) { + if (tmp_vtx_slope[j] < tmp_vtx_slope[j + 1]) { + tmp_slope = tmp_vtx_slope[j]; + tmp_vtx_slope[j] = tmp_vtx_slope[j + 1]; + tmp_vtx_slope[j + 1] = tmp_slope; + tmp[0] = vertex[2 * j]; + tmp[1] = vertex[2 * j + 1]; + vertex[2 * j] = vertex[2 * (j + 1)]; + vertex[2 * j + 1] = vertex[2 * (j + 1) + 1]; + vertex[2 * (j + 1)] = tmp[0]; + vertex[2 * (j + 1) + 1] = tmp[1]; + } + } + } + + if (DEBUG_CLIP_VTX) { + ErrorF("\nBefore return, vtx number: %d, VTX and slope:\n", *num); + for (i = 0; i < *num; i++) { + ErrorF("(%d, %d):%f ", + vertex[2 * i], vertex[2 * i + 1], tmp_vtx_slope[i]); + } + ErrorF("\n"); + } + + return TRUE; +} + +static void * +glamor_setup_composite_vbo_for_trapezoid(ScreenPtr screen, int n_verts) +{ + glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); + int stride; + int vert_size; + char *vbo_offset; + void *vb; + + glamor_priv->render_nr_verts = 0; + + /* For GLAMOR_VERTEX_POS */ + glamor_priv->vb_stride = 2 * sizeof(float); + + /* For GLAMOR_GLAMOR_VERTEX_SOURCE */ + glamor_priv->vb_stride += 2 * sizeof(float); + + /* For GLAMOR_VERTEX_TOP_BOTTOM */ + glamor_priv->vb_stride += 2 * sizeof(float); + + /* For GLAMOR_VERTEX_LEFT_PARAM */ + glamor_priv->vb_stride += 4 * sizeof(float); + + /* For GLAMOR_VERTEX_RIGHT_PARAM */ + glamor_priv->vb_stride += 4 * sizeof(float); + + vert_size = n_verts * glamor_priv->vb_stride; + + glamor_make_current(glamor_priv); + + glDisableVertexAttribArray(GLAMOR_VERTEX_POS); + glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE); + glDisableVertexAttribArray(GLAMOR_VERTEX_TOP_BOTTOM); + glDisableVertexAttribArray(GLAMOR_VERTEX_LEFT_PARAM); + glDisableVertexAttribArray(GLAMOR_VERTEX_RIGHT_PARAM); + + vb = glamor_get_vbo_space(screen, vert_size, &vbo_offset); + + /* Set the vertex pointer. */ + glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT, + GL_FALSE, glamor_priv->vb_stride, + vbo_offset); + glEnableVertexAttribArray(GLAMOR_VERTEX_POS); + stride = 2; + + glVertexAttribPointer(GLAMOR_VERTEX_SOURCE, 2, GL_FLOAT, + GL_FALSE, glamor_priv->vb_stride, + vbo_offset + stride * sizeof(float)); + glEnableVertexAttribArray(GLAMOR_VERTEX_SOURCE); + stride += 2; + + glVertexAttribPointer(GLAMOR_VERTEX_TOP_BOTTOM, 2, GL_FLOAT, + GL_FALSE, glamor_priv->vb_stride, + vbo_offset + stride * sizeof(float)); + glEnableVertexAttribArray(GLAMOR_VERTEX_TOP_BOTTOM); + stride += 2; + + glVertexAttribPointer(GLAMOR_VERTEX_LEFT_PARAM, 4, GL_FLOAT, + GL_FALSE, glamor_priv->vb_stride, + vbo_offset + stride * sizeof(float)); + glEnableVertexAttribArray(GLAMOR_VERTEX_LEFT_PARAM); + stride += 4; + + glVertexAttribPointer(GLAMOR_VERTEX_RIGHT_PARAM, 4, GL_FLOAT, + GL_FALSE, glamor_priv->vb_stride, + vbo_offset + stride * sizeof(float)); + glEnableVertexAttribArray(GLAMOR_VERTEX_RIGHT_PARAM); + + return vb; +} + +static Bool +_glamor_trapezoids_with_shader(CARD8 op, + PicturePtr src, PicturePtr dst, + PictFormatPtr mask_format, INT16 x_src, + INT16 y_src, int ntrap, xTrapezoid * traps) +{ + ScreenPtr screen = dst->pDrawable->pScreen; + glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); + struct shader_key key; + glamor_composite_shader *shader = NULL; + struct blendinfo op_info; + PictFormatShort saved_source_format = 0; + PixmapPtr source_pixmap = NULL; + PixmapPtr dest_pixmap = NULL; + glamor_pixmap_private *source_pixmap_priv = NULL; + glamor_pixmap_private *dest_pixmap_priv = NULL; + glamor_pixmap_private *temp_src_priv = NULL; + int x_temp_src, y_temp_src; + int src_width, src_height; + int source_x_off, source_y_off; + GLfloat src_xscale = 1, src_yscale = 1; + int x_dst, y_dst; + int dest_x_off, dest_y_off; + GLfloat dst_xscale, dst_yscale; + BoxRec bounds; + PicturePtr temp_src = src; + int vert_stride = 3; + int ntriangle_per_loop; + int nclip_rect; + int mclip_rect; + int clip_processed; + int clipped_vtx[6 * 2]; + RegionRec region; + BoxPtr box = NULL; + BoxPtr pbox = NULL; + int traps_count = 0; + int traps_not_completed = 0; + xTrapezoid *ptrap = NULL; + int nbox; + float src_matrix[9]; + Bool ret = FALSE; + + /* If a mask format wasn't provided, we get to choose, but behavior should + * be as if there was no temporary mask the traps were accumulated into. + */ + if (!mask_format) { + if (dst->polyEdge == PolyEdgeSharp) + mask_format = PictureMatchFormat(screen, 1, PICT_a1); + else + mask_format = PictureMatchFormat(screen, 8, PICT_a8); + for (; ntrap; ntrap--, traps++) + glamor_trapezoids(op, src, dst, mask_format, x_src, + y_src, 1, traps); + return TRUE; + } + + miTrapezoidBounds(ntrap, traps, &bounds); + DEBUGF("The bounds for all traps is: bounds.x1 = %d, bounds.x2 = %d, " + "bounds.y1 = %d, bounds.y2 = %d\n", bounds.x1, bounds.x2, + bounds.y1, bounds.y2); + + /* No area need to render. */ + if (bounds.y1 >= bounds.y2 || bounds.x1 >= bounds.x2) + return TRUE; + + dest_pixmap = glamor_get_drawable_pixmap(dst->pDrawable); + dest_pixmap_priv = glamor_get_pixmap_private(dest_pixmap); + + if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(dest_pixmap_priv) + || dest_pixmap_priv->type == GLAMOR_TEXTURE_LARGE) { + /* Currently. Always fallback to cpu if destination is in CPU memory. */ + ret = FALSE; + DEBUGF("dst pixmap has no FBO.\n"); + goto TRAPEZOID_OUT; + } + + if (src->pDrawable) { + source_pixmap = glamor_get_drawable_pixmap(src->pDrawable); + source_pixmap_priv = glamor_get_pixmap_private(source_pixmap); + temp_src_priv = source_pixmap_priv; + if (source_pixmap_priv + && (source_pixmap_priv->type == GLAMOR_DRM_ONLY + || source_pixmap_priv->type == GLAMOR_TEXTURE_LARGE)) { + ret = FALSE; + goto TRAPEZOID_OUT; + } + } + + x_dst = bounds.x1; + y_dst = bounds.y1; + + src_width = bounds.x2 - bounds.x1; + src_height = bounds.y2 - bounds.y1; + + x_temp_src = x_src + bounds.x1 - (traps[0].left.p1.x >> 16); + y_temp_src = y_src + bounds.y1 - (traps[0].left.p1.y >> 16); + + if ((!src->pDrawable && (src->pSourcePict->type != SourcePictTypeSolidFill)) //1. The Gradient case. + /* 2. Has no fbo but can upload. */ + || (src->pDrawable && !GLAMOR_PIXMAP_PRIV_HAS_FBO(source_pixmap_priv) + && ((src_width * src_height * 4 < + source_pixmap->drawable.width * source_pixmap->drawable.height) + || !glamor_check_fbo_size(glamor_priv, + source_pixmap->drawable.width, + source_pixmap->drawable.height)))) { + + if (!glamor_check_fbo_size(glamor_priv, src_width, src_height)) { + ret = FALSE; + goto TRAPEZOID_OUT; + } + temp_src = glamor_convert_gradient_picture(screen, src, + x_src, y_src, + src_width, src_height); + if (!temp_src) { + temp_src = src; + ret = FALSE; + DEBUGF("Convert gradient picture failed\n"); + goto TRAPEZOID_OUT; + } + temp_src_priv = + glamor_get_pixmap_private((PixmapPtr) temp_src->pDrawable); + x_temp_src = y_temp_src = 0; + } + + x_dst += dst->pDrawable->x; + y_dst += dst->pDrawable->y; + if (temp_src->pDrawable) { + x_temp_src += temp_src->pDrawable->x; + y_temp_src += temp_src->pDrawable->y; + } + + if (!miComputeCompositeRegion(®ion, + temp_src, NULL, dst, + x_temp_src, y_temp_src, + 0, 0, x_dst, y_dst, src_width, src_height)) { + DEBUGF("All the regions are clipped out, do nothing\n"); + goto TRAPEZOID_OUT; + } + + glamor_make_current(glamor_priv); + + box = REGION_RECTS(®ion); + nbox = REGION_NUM_RECTS(®ion); + pbox = box; + + ret = glamor_composite_choose_shader(op, temp_src, NULL, dst, + temp_src_priv, NULL, dest_pixmap_priv, + &key, &shader, &op_info, + &saved_source_format); + if (ret == FALSE) { + DEBUGF("can not set the shader program for composite\n"); + goto TRAPEZOID_RESET_GL; + } + glamor_set_destination_pixmap_priv_nc(dest_pixmap_priv); + glamor_composite_set_shader_blend(dest_pixmap_priv, &key, shader, &op_info); + glamor_priv->has_source_coords = key.source != SHADER_SOURCE_SOLID; + glamor_priv->has_mask_coords = (key.mask != SHADER_MASK_NONE && + key.mask != SHADER_MASK_SOLID); + + glamor_get_drawable_deltas(dst->pDrawable, dest_pixmap, + &dest_x_off, &dest_y_off); + + pixmap_priv_get_dest_scale(dest_pixmap_priv, &dst_xscale, &dst_yscale); + + if (glamor_priv->has_source_coords) { + source_pixmap = glamor_get_drawable_pixmap(temp_src->pDrawable); + source_pixmap_priv = glamor_get_pixmap_private(source_pixmap); + glamor_get_drawable_deltas(temp_src->pDrawable, + source_pixmap, &source_x_off, &source_y_off); + pixmap_priv_get_scale(source_pixmap_priv, &src_xscale, &src_yscale); + glamor_picture_get_matrixf(temp_src, src_matrix); + vert_stride += 3; + } + + if (glamor_priv->has_mask_coords) { + DEBUGF("Should never have mask coords here!\n"); + ret = FALSE; + goto TRAPEZOID_RESET_GL; + } + + /* A trapezoid clip with a rectangle will at most generate a hexagon, + which can be devided into 4 triangles to render. */ + ntriangle_per_loop = + (vert_stride * nbox * ntrap * 4) > + GLAMOR_COMPOSITE_VBO_VERT_CNT ? (GLAMOR_COMPOSITE_VBO_VERT_CNT / + vert_stride) : nbox * ntrap * 4; + ntriangle_per_loop = (ntriangle_per_loop / 4) * 4; + + nclip_rect = nbox; + while (nclip_rect) { + float *vb; + + mclip_rect = (nclip_rect * ntrap * 4) > ntriangle_per_loop ? + (ntriangle_per_loop / (4 * ntrap)) : nclip_rect; + + if (!mclip_rect) { /* Maybe too many traps. */ + mclip_rect = 1; + ptrap = traps; + traps_count = ntriangle_per_loop / 4; + traps_not_completed = ntrap - traps_count; + } + else { + traps_count = ntrap; + ptrap = traps; + traps_not_completed = 0; + } + + NTRAPS_LOOP_AGAIN: + + vb = glamor_setup_composite_vbo(screen, + (mclip_rect * traps_count * + 4 * vert_stride)); + clip_processed = mclip_rect; + + while (mclip_rect--) { + while (traps_count--) { + int vtx_num; + int i; + float vertices[3 * 2], source_texcoords[3 * 2]; + + DEBUGF + ("In loop of render trapezoid, nclip_rect = %d, mclip_rect = %d, " + "clip_processed = %d, traps_count = %d, traps_not_completed = %d\n", + nclip_rect, mclip_rect, clip_processed, traps_count, + traps_not_completed); + + if (_glamor_clip_trapezoid_vertex + (ptrap, pbox, clipped_vtx, &vtx_num)) { + for (i = 0; i < vtx_num - 2; i++) { + int clipped_vtx_tmp[3 * 2]; + + clipped_vtx_tmp[0] = clipped_vtx[0]; + clipped_vtx_tmp[1] = clipped_vtx[1]; + clipped_vtx_tmp[2] = clipped_vtx[(i + 1) * 2]; + clipped_vtx_tmp[3] = clipped_vtx[(i + 1) * 2 + 1]; + clipped_vtx_tmp[4] = clipped_vtx[(i + 2) * 2]; + clipped_vtx_tmp[5] = clipped_vtx[(i + 2) * 2 + 1]; + glamor_set_normalize_tri_vcoords(dst_xscale, dst_yscale, + clipped_vtx_tmp, + glamor_priv->yInverted, + vertices); + DEBUGF("vertices of triangle: (%f X %f), (%f X %f), " + "(%f X %f)\n", vertices[0], vertices[1], + vertices[2], vertices[3], vertices[4], + vertices[5]); + + if (key.source != SHADER_SOURCE_SOLID) { + if (src->transform) { + glamor_set_transformed_normalize_tri_tcoords + (source_pixmap_priv, src_matrix, src_xscale, + src_yscale, clipped_vtx_tmp, + glamor_priv->yInverted, source_texcoords); + } + else { + glamor_set_normalize_tri_tcoords(src_xscale, + src_yscale, + clipped_vtx_tmp, + glamor_priv-> + yInverted, + source_texcoords); + } + + DEBUGF("source_texcoords of triangle: (%f X %f), " + "(%f X %f), (%f X %f)\n", + source_texcoords[0], source_texcoords[1], + source_texcoords[2], source_texcoords[3], + source_texcoords[4], source_texcoords[5]); + } + + glamor_emit_composite_triangle(screen, vb, + source_texcoords, + NULL, vertices); + vb += 3 * glamor_priv->vb_stride / sizeof(float); + } + } + + ptrap++; + } + + if (traps_not_completed) { /* one loop of ntraps not completed */ + mclip_rect = 1; + traps_count = traps_not_completed > (ntriangle_per_loop / 4) ? + (ntriangle_per_loop / 4) : traps_not_completed; + traps_not_completed -= traps_count; + glamor_flush_composite_triangles(screen); + goto NTRAPS_LOOP_AGAIN; + } + else { + ptrap = traps; + traps_count = ntrap; + } + + pbox++; + } + + glamor_flush_composite_triangles(screen); + + nclip_rect -= clip_processed; + } + + ret = TRUE; + + TRAPEZOID_RESET_GL: + glDisableVertexAttribArray(GLAMOR_VERTEX_POS); + glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE); + glDisableVertexAttribArray(GLAMOR_VERTEX_MASK); + glDisable(GL_BLEND); + + TRAPEZOID_OUT: + if (box) { + REGION_UNINIT(dst->pDrawable->pScreen, ®ion); + } + + if (temp_src != src) { + FreePicture(temp_src, 0); + } + else { + if (saved_source_format) { + src->format = saved_source_format; + } + } + + return ret; +} + +void +glamor_init_trapezoid_shader(ScreenPtr screen) +{ + glamor_screen_private *glamor_priv; + GLint fs_prog, vs_prog; + + const char *trapezoid_vs = + GLAMOR_DEFAULT_PRECISION + "attribute vec4 v_position;\n" + "attribute vec2 v_texcoord;\n" + /* v_top_bottom, v_left_param and v_right_param contain the + constant value for all the vertex of one rect. Using uniform + is more suitable but we need to reset the uniform variables + for every rect rendering and can not use the vbo, which causes + performance loss. So we set these attributes to same value + for every vertex of one rect and so it is also a constant in FS */ + "attribute vec2 v_top_bottom;\n" + "attribute vec4 v_left_param;\n" + "attribute vec4 v_right_param;\n" + "\n" + "varying vec2 source_texture;\n" + "varying float trap_top;\n" + "varying float trap_bottom;\n" + "varying float trap_left_x;\n" + "varying float trap_left_y;\n" + "varying float trap_left_slope;\n" + "varying float trap_left_vertical_f;\n" + "varying float trap_right_x;\n" + "varying float trap_right_y;\n" + "varying float trap_right_slope;\n" + "varying float trap_right_vertical_f;\n" + "\n" + "void main()\n" + "{\n" + " gl_Position = v_position;\n" + " source_texture = v_texcoord.xy;\n" + " trap_top = v_top_bottom.x;\n" + " trap_bottom = v_top_bottom.y;\n" + " \n" + " trap_left_x = v_left_param.x;\n" + " trap_left_y = v_left_param.y;\n" + " trap_left_slope = v_left_param.z;\n" + " trap_left_vertical_f = v_left_param.w;\n" + " \n" + " trap_right_x = v_right_param.x;\n" + " trap_right_y = v_right_param.y;\n" + " trap_right_slope = v_right_param.z;\n" + " trap_right_vertical_f = v_right_param.w;\n" + "}\n"; + + /* + * Because some GL fill function do not support the MultSample + * anti-alias, we need to do the MSAA here. This manner like + * pixman, will caculate the value of area in trapezoid dividing + * the totol area for each pixel, as follow: + | + ----+------------------------------------------------------> + | + | ------------- + | / \ + | / \ + | / \ + | / +----------------+ + | / |.....\ | + | / |......\ | + | / |.......\ | + | / |........\ | + | /-------------------+---------\ | + | | | + | | | + | +----------------+ + | + \|/ + + */ + const char *trapezoid_fs = + GLAMOR_DEFAULT_PRECISION + "varying vec2 source_texture; \n" + "varying float trap_top; \n" + "varying float trap_bottom; \n" + "varying float trap_left_x; \n" + "varying float trap_left_y; \n" + "varying float trap_left_slope; \n" + "varying float trap_left_vertical_f; \n" + "varying float trap_right_x; \n" + "varying float trap_right_y; \n" + "varying float trap_right_slope; \n" + "varying float trap_right_vertical_f; \n" + "float x_per_pix = 1.0;" + "float y_per_pix = 1.0;" + "\n" + "float get_alpha_val() \n" + "{ \n" + " float x_up_cut_left; \n" + " float x_bottom_cut_left; \n" + " float x_up_cut_right; \n" + " float x_bottom_cut_right; \n" + " bool trap_left_vertical;\n" + " bool trap_right_vertical;\n" + " if (abs(trap_left_vertical_f - 1.0) <= 0.0001)\n" + " trap_left_vertical = true;\n" + " else\n" + " trap_left_vertical = false;\n" + " if (abs(trap_right_vertical_f - 1.0) <= 0.0001)\n" + " trap_right_vertical = true;\n" + " else\n" + " trap_right_vertical = false;\n" + " \n" + " if(trap_left_vertical == true) { \n" + " x_up_cut_left = trap_left_x; \n" + " x_bottom_cut_left = trap_left_x; \n" + " } else { \n" + " x_up_cut_left = trap_left_x \n" + " + (source_texture.y - y_per_pix/2.0 - trap_left_y) \n" + " / trap_left_slope; \n" + " x_bottom_cut_left = trap_left_x \n" + " + (source_texture.y + y_per_pix/2.0 - trap_left_y) \n" + " / trap_left_slope; \n" + " } \n" + " \n" + " if(trap_right_vertical == true) { \n" + " x_up_cut_right = trap_right_x; \n" + " x_bottom_cut_right = trap_right_x; \n" + " } else { \n" + " x_up_cut_right = trap_right_x \n" + " + (source_texture.y - y_per_pix/2.0 - trap_right_y) \n" + " / trap_right_slope; \n" + " x_bottom_cut_right = trap_right_x \n" + " + (source_texture.y + y_per_pix/2.0 - trap_right_y) \n" + " / trap_right_slope; \n" + " } \n" + " \n" + " if((x_up_cut_left <= source_texture.x - x_per_pix/2.0) && \n" + " (x_bottom_cut_left <= source_texture.x - x_per_pix/2.0) && \n" + " (x_up_cut_right >= source_texture.x + x_per_pix/2.0) && \n" + " (x_bottom_cut_right >= source_texture.x + x_per_pix/2.0) && \n" + " (trap_top <= source_texture.y - y_per_pix/2.0) && \n" + " (trap_bottom >= source_texture.y + y_per_pix/2.0)) { \n" + // The complete inside case. + " return 1.0; \n" + " } else if((trap_top > source_texture.y + y_per_pix/2.0) || \n" + " (trap_bottom < source_texture.y - y_per_pix/2.0)) { \n" + // The complete outside. Above the top or Below the bottom. + " return 0.0; \n" + " } else { \n" + " if((x_up_cut_right < source_texture.x - x_per_pix/2.0 && \n" + " x_bottom_cut_right < source_texture.x - x_per_pix/2.0) \n" + " || (x_up_cut_left > source_texture.x + x_per_pix/2.0 && \n" + " x_bottom_cut_left > source_texture.x + x_per_pix/2.0)) { \n" + // The complete outside. At Left or Right of the trapezoide. + " return 0.0; \n" + " } \n" + " } \n" + // Get here, the pix is partly inside the trapezoid. + " { \n" + " float percent = 0.0; \n" + " float up = (source_texture.y - y_per_pix/2.0) >= trap_top ? \n" + " (source_texture.y - y_per_pix/2.0) : trap_top; \n" + " float bottom = (source_texture.y + y_per_pix/2.0) <= trap_bottom ? \n" + " (source_texture.y + y_per_pix/2.0) : trap_bottom; \n" + " float left = source_texture.x - x_per_pix/2.0; \n" + " float right = source_texture.x + x_per_pix/2.0; \n" + " \n" + " percent = (bottom - up) / y_per_pix; \n" + " \n" + " if(trap_left_vertical == true) { \n" + " if(trap_left_x > source_texture.x - x_per_pix/2.0 && \n" + " trap_left_x < source_texture.x + x_per_pix/2.0) \n" + " left = trap_left_x; \n" + " } \n" + " if(trap_right_vertical == true) { \n" + " if(trap_right_x > source_texture.x - x_per_pix/2.0 && \n" + " trap_right_x < source_texture.x + x_per_pix/2.0) \n" + " right = trap_right_x; \n" + " } \n" + " if((up >= bottom) || (left >= right)) \n" + " return 0.0; \n" + " \n" + " percent = percent * ((right - left)/x_per_pix); \n" + " if(trap_left_vertical == true && trap_right_vertical == true) \n" + " return percent; \n" + " \n" + " if(trap_left_vertical != true) { \n" + " float area; \n" + // the slope should never be 0.0 here + " float up_x = trap_left_x + (up - trap_left_y)/trap_left_slope; \n" + " float bottom_x = trap_left_x + (bottom - trap_left_y)/trap_left_slope; \n" + " if(trap_left_slope < 0.0 && up_x > left) { \n" + /* case 1 + | + ----+-------------------------------------> + | / + | / + | +---/--------+ + | | /.........| + | | /..........| + | |/...........| + | /............| + | /|............| + | +------------+ + | + \|/ + */ + " float left_y = trap_left_y + trap_left_slope*(left - trap_left_x); \n" + " if((up_x > left) && (left_y > up)) { \n" + " area = 0.5 * (up_x - left) * (left_y - up); \n" + " if(up_x > right) { \n" + " float right_y = trap_left_y \n" + " + trap_left_slope*(right - trap_left_x); \n" + " area = area - 0.5 * (up_x - right) * (right_y - up); \n" + " } \n" + " if(left_y > bottom) { \n" + " area = area - 0.5 * (bottom_x - left) * (left_y - bottom); \n" + " } \n" + " } else { \n" + " area = 0.0; \n" + " } \n" + " percent = percent * (1.0 - (area/((right-left)*(bottom-up)))); \n" + " } else if(trap_left_slope > 0.0 && bottom_x > left) { \n" + /* case 2 + | + ----+-------------------------------------> + | \ + | \ + | +\-----------+ + | | \..........| + | | \.........| + | | \........| + | | \.......| + | | \......| + | +------\-----+ + | \ + | \ + \|/ + */ + " float right_y = trap_left_y + trap_left_slope*(right - trap_left_x); \n" + " if((up_x < right) && (right_y > up)) { \n" + " area = 0.5 * (right - up_x) * (right_y - up); \n" + " if(up_x < left) { \n" + " float left_y = trap_left_y \n" + " + trap_left_slope*(left - trap_left_x); \n" + " area = area - 0.5 * (left - up_x) * (left_y - up); \n" + " } \n" + " if(right_y > bottom) { \n" + " area = area - 0.5 * (right - bottom_x) * (right_y - bottom); \n" + " } \n" + " } else { \n" + " area = 0.0; \n" + " } \n" + " percent = percent * (area/((right-left)*(bottom-up))); \n" + " } \n" + " } \n" + " \n" + " if(trap_right_vertical != true) { \n" + " float area; \n" + // the slope should never be 0.0 here + " float up_x = trap_right_x + (up - trap_right_y)/trap_right_slope; \n" + " float bottom_x = trap_right_x + (bottom - trap_right_y)/trap_right_slope; \n" + " if(trap_right_slope < 0.0 && bottom_x < right) { \n" + /* case 3 + | + ----+-------------------------------------> + | / + | +--------/---+ + | |......./ | + | |....../ | + | |...../ | + | |..../ | + | |.../ | + | +--/---------+ + | / + | + \|/ + */ + " float left_y = trap_right_y + trap_right_slope*(left - trap_right_x); \n" + " if((up_x > left) && (left_y > up)) { \n" + " area = 0.5 * (up_x - left) * (left_y - up); \n" + " if(up_x > right) { \n" + " float right_y = trap_right_y \n" + " + trap_right_slope*(right - trap_right_x); \n" + " area = area - 0.5 * (up_x - right) * (right_y - up); \n" + " } \n" + " if(left_y > bottom) { \n" + " area = area - 0.5 * (bottom_x - left) * (left_y - bottom); \n" + " } \n" + " } else { \n" + " area = 0.0; \n" + " } \n" + " percent = percent * (area/((right-left)*(bottom-up))); \n" + " } else if(trap_right_slope > 0.0 && up_x < right) { \n" + /* case 4 + | + ----+-------------------------------------> + | \ + | +--------\---+ + | |.........\ | + | |..........\ | + | |...........\| + | |............\ + | |............|\ + | +------------+ \ + | \ + | + \|/ + */ + " float right_y = trap_right_y + trap_right_slope*(right - trap_right_x); \n" + " if((up_x < right) && (right_y > up)) { \n" + " area = 0.5 * (right - up_x) * (right_y - up); \n" + " if(up_x < left) { \n" + " float left_y = trap_right_y \n" + " + trap_right_slope*(left - trap_right_x); \n" + " area = area - 0.5 * (left - up_x) * (left_y - up); \n" + " } \n" + " if(right_y > bottom) { \n" + " area = area - 0.5 * (right - bottom_x) * (right_y - bottom); \n" + " } \n" + " } else { \n" + " area = 0.0; \n" + " } \n" + " percent = percent * (1.0 - (area/((right-left)*(bottom-up)))); \n" + " } \n" + " } \n" + " \n" + " return percent; \n" + " } \n" + "} \n" + "\n" + "void main() \n" + "{ \n" + " float alpha_val = get_alpha_val(); \n" + " gl_FragColor = vec4(0.0, 0.0, 0.0, alpha_val); \n" + "}\n"; + + glamor_priv = glamor_get_screen_private(screen); + glamor_make_current(glamor_priv); + + glamor_priv->trapezoid_prog = glCreateProgram(); + + vs_prog = glamor_compile_glsl_prog(GL_VERTEX_SHADER, trapezoid_vs); + fs_prog = glamor_compile_glsl_prog(GL_FRAGMENT_SHADER, trapezoid_fs); + + glAttachShader(glamor_priv->trapezoid_prog, vs_prog); + glAttachShader(glamor_priv->trapezoid_prog, fs_prog); + + glBindAttribLocation(glamor_priv->trapezoid_prog, + GLAMOR_VERTEX_POS, "v_positionsition"); + glBindAttribLocation(glamor_priv->trapezoid_prog, + GLAMOR_VERTEX_SOURCE, "v_texcoord"); + glBindAttribLocation(glamor_priv->trapezoid_prog, + GLAMOR_VERTEX_TOP_BOTTOM, "v_top_bottom"); + glBindAttribLocation(glamor_priv->trapezoid_prog, + GLAMOR_VERTEX_LEFT_PARAM, "v_left_param"); + glBindAttribLocation(glamor_priv->trapezoid_prog, + GLAMOR_VERTEX_RIGHT_PARAM, "v_right_param"); + + glamor_link_glsl_prog(screen, glamor_priv->trapezoid_prog, "trapezoid"); +} + +void +glamor_fini_trapezoid_shader(ScreenPtr screen) +{ + glamor_screen_private *glamor_priv; + + glamor_priv = glamor_get_screen_private(screen); + glamor_make_current(glamor_priv); + glDeleteProgram(glamor_priv->trapezoid_prog); +} + +static Bool +_glamor_generate_trapezoid_with_shader(ScreenPtr screen, PicturePtr picture, + xTrapezoid *traps, int ntrap, + BoxRec *bounds) +{ + glamor_screen_private *glamor_priv; + glamor_pixmap_private *pixmap_priv; + PixmapPtr pixmap = NULL; + GLint trapezoid_prog; + GLfloat xscale, yscale; + float left_slope, right_slope; + xTrapezoid *ptrap; + BoxRec one_trap_bound; + int nrect_max; + int i, j; + float params[4]; + + glamor_priv = glamor_get_screen_private(screen); + trapezoid_prog = glamor_priv->trapezoid_prog; + + pixmap = glamor_get_drawable_pixmap(picture->pDrawable); + pixmap_priv = glamor_get_pixmap_private(pixmap); + + if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv) + || pixmap_priv->type == GLAMOR_TEXTURE_LARGE) { /* should always have here. */ + DEBUGF("GLAMOR_PIXMAP_PRIV_HAS_FBO check failed, fallback\n"); + return FALSE; + } + + /* First, clear all to zero */ + if (!glamor_solid(pixmap, 0, 0, pixmap_priv->base.pixmap->drawable.width, + pixmap_priv->base.pixmap->drawable.height, + GXclear, 0xFFFFFFFF, 0)) { + DEBUGF("glamor_solid failed, fallback\n"); + return FALSE; + } + + glamor_make_current(glamor_priv); + + glamor_set_destination_pixmap_priv_nc(pixmap_priv); + + pixmap_priv_get_dest_scale(pixmap_priv, (&xscale), (&yscale)); + + /* Now draw the Trapezoid mask. */ + glUseProgram(trapezoid_prog); + + glEnable(GL_BLEND); + glBlendFunc(GL_ONE, GL_ONE); + + nrect_max = GLAMOR_COMPOSITE_VBO_VERT_CNT / (4 * GLAMOR_VERTEX_RIGHT_PARAM); + + for (i = 0; i < ntrap;) { + float *vertices; + int mrect; + int stride; + + mrect = (ntrap - i) > nrect_max ? nrect_max : (ntrap - i); + vertices = glamor_setup_composite_vbo_for_trapezoid(screen, 4 * mrect); + stride = glamor_priv->vb_stride / sizeof(float); + + for (j = 0; j < mrect; j++) { + ptrap = traps + i + j; + + DEBUGF + ("--- The parameter of xTrapezoid is:\ntop: %d 0x%x\tbottom: %d 0x%x\n" + "left: p1 (%d 0x%x, %d 0x%x)\tp2 (%d 0x%x, %d 0x%x)\n" + "right: p1 (%d 0x%x, %d 0x%x)\tp2 (%d 0x%x, %d 0x%x)\n", + xFixedToInt(ptrap->top), ptrap->top, + xFixedToInt(ptrap->bottom), ptrap->bottom, + xFixedToInt(ptrap->left.p1.x), ptrap->left.p1.x, + xFixedToInt(ptrap->left.p1.y), ptrap->left.p1.y, + xFixedToInt(ptrap->left.p2.x), ptrap->left.p2.x, + xFixedToInt(ptrap->left.p2.y), ptrap->left.p2.y, + xFixedToInt(ptrap->right.p1.x), ptrap->right.p1.x, + xFixedToInt(ptrap->right.p1.y), ptrap->right.p1.y, + xFixedToInt(ptrap->right.p2.x), ptrap->right.p2.x, + xFixedToInt(ptrap->right.p2.y), ptrap->right.p2.y); + + miTrapezoidBounds(1, ptrap, &one_trap_bound); + + vertices += 2; + glamor_set_tcoords_ext((pixmap_priv->base.pixmap->drawable.width), + (pixmap_priv->base.pixmap->drawable.height), + (one_trap_bound.x1), (one_trap_bound.y1), + (one_trap_bound.x2), (one_trap_bound.y2), + glamor_priv->yInverted, vertices, stride); + DEBUGF("tex_vertices --> leftup : %f X %f, rightup: %f X %f," + "rightbottom: %f X %f, leftbottom : %f X %f\n", vertices[0], + vertices[1], vertices[1 * stride], vertices[1 * stride + 1], + vertices[2 * stride], vertices[2 * stride + 1], + vertices[3 * stride], vertices[3 * stride + 1]); + + /* Need to rebase. */ + one_trap_bound.x1 -= bounds->x1; + one_trap_bound.x2 -= bounds->x1; + one_trap_bound.y1 -= bounds->y1; + one_trap_bound.y2 -= bounds->y1; + + vertices -= 2; + + glamor_set_normalize_vcoords_ext(pixmap_priv, xscale, yscale, + one_trap_bound.x1, + one_trap_bound.y1, + one_trap_bound.x2, + one_trap_bound.y2, + glamor_priv->yInverted, vertices, + stride); + DEBUGF("vertices --> leftup : %f X %f, rightup: %f X %f," + "rightbottom: %f X %f, leftbottom : %f X %f\n", vertices[0], + vertices[1], vertices[1 * stride], vertices[1 * stride + 1], + vertices[2 * stride], vertices[2 * stride + 1], + vertices[3 * stride], vertices[3 * stride + 1]); + vertices += 4; + + /* Set the top and bottom. */ + params[0] = ((float) ptrap->top) / 65536; + params[1] = ((float) ptrap->bottom) / 65536; + glamor_set_const_ext(params, 2, vertices, 4, stride); + vertices += 2; + + /* Set the left params. */ + params[0] = ((float) ptrap->left.p1.x) / 65536; + params[1] = ((float) ptrap->left.p1.y) / 65536; + + if (ptrap->left.p1.x == ptrap->left.p2.x) { + left_slope = 0.0; + params[3] = 1.0; + } + else { + left_slope = ((float) (ptrap->left.p1.y - ptrap->left.p2.y)) + / ((float) (ptrap->left.p1.x - ptrap->left.p2.x)); + params[3] = 0.0; + } + params[2] = left_slope; + glamor_set_const_ext(params, 4, vertices, 4, stride); + vertices += 4; + + /* Set the left params. */ + params[0] = ((float) ptrap->right.p1.x) / 65536; + params[1] = ((float) ptrap->right.p1.y) / 65536; + + if (ptrap->right.p1.x == ptrap->right.p2.x) { + right_slope = 0.0; + params[3] = 1.0; + } + else { + right_slope = ((float) (ptrap->right.p1.y - ptrap->right.p2.y)) + / ((float) (ptrap->right.p1.x - ptrap->right.p2.x)); + params[3] = 0.0; + } + params[2] = right_slope; + glamor_set_const_ext(params, 4, vertices, 4, stride); + vertices += 4; + + DEBUGF("trap_top = %f, trap_bottom = %f, " + "trap_left_x = %f, trap_left_y = %f, left_slope = %f, " + "trap_right_x = %f, trap_right_y = %f, right_slope = %f\n", + ((float) ptrap->top) / 65536, + ((float) ptrap->bottom) / 65536, + ((float) ptrap->left.p1.x) / 65536, + ((float) ptrap->left.p1.y) / 65536, left_slope, + ((float) ptrap->right.p1.x) / 65536, + ((float) ptrap->right.p1.y) / 65536, right_slope); + + glamor_priv->render_nr_verts += 4; + vertices += 3 * stride; + } + + i += mrect; + + glamor_put_vbo_space(screen); + + /* Now rendering. */ + if (!glamor_priv->render_nr_verts) + continue; + + if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) { + glDrawRangeElements(GL_TRIANGLES, 0, + glamor_priv->render_nr_verts, + (glamor_priv->render_nr_verts * 3) / 2, + GL_UNSIGNED_SHORT, NULL); + } else { + glDrawElements(GL_TRIANGLES, + (glamor_priv->render_nr_verts * 3) / 2, + GL_UNSIGNED_SHORT, NULL); + } + } + + glBlendFunc(GL_ONE, GL_ZERO); + glDisable(GL_BLEND); + glDisableVertexAttribArray(GLAMOR_VERTEX_POS); + glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE); + glDisableVertexAttribArray(GLAMOR_VERTEX_TOP_BOTTOM); + glDisableVertexAttribArray(GLAMOR_VERTEX_LEFT_PARAM); + glDisableVertexAttribArray(GLAMOR_VERTEX_RIGHT_PARAM); + return TRUE; +} + +#endif /*GLAMOR_TRAPEZOID_SHADER */ + +/** + * Creates an appropriate picture for temp mask use. + */ +static PicturePtr +glamor_create_mask_picture(ScreenPtr screen, + PicturePtr dst, + PictFormatPtr pict_format, + CARD16 width, CARD16 height, int gpu) +{ + PixmapPtr pixmap; + PicturePtr picture; + int error; + + if (!pict_format) { + if (dst->polyEdge == PolyEdgeSharp) + pict_format = PictureMatchFormat(screen, 1, PICT_a1); + else + pict_format = PictureMatchFormat(screen, 8, PICT_a8); + if (!pict_format) + return 0; + } + + if (gpu) { + pixmap = glamor_create_pixmap(screen, width, height, + pict_format->depth, 0); + } + else { + pixmap = glamor_create_pixmap(screen, 0, 0, + pict_format->depth, + GLAMOR_CREATE_PIXMAP_CPU); + } + + if (!pixmap) + return 0; + picture = CreatePicture(0, &pixmap->drawable, pict_format, + 0, 0, serverClient, &error); + glamor_destroy_pixmap(pixmap); + return picture; +} + +static int +_glamor_trapezoid_bounds(int ntrap, xTrapezoid *traps, BoxPtr box) +{ + int has_large_trapezoid = 0; + + box->y1 = MAXSHORT; + box->y2 = MINSHORT; + box->x1 = MAXSHORT; + box->x2 = MINSHORT; + + for (; ntrap; ntrap--, traps++) { + INT16 x1, y1, x2, y2; + + if (!xTrapezoidValid(traps)) + continue; + y1 = xFixedToInt(traps->top); + if (y1 < box->y1) + box->y1 = y1; + + y2 = xFixedToInt(xFixedCeil(traps->bottom)); + if (y2 > box->y2) + box->y2 = y2; + + x1 = xFixedToInt(min + (_glamor_linefixedX(&traps->left, traps->top, FALSE), + _glamor_linefixedX(&traps->left, traps->bottom, + FALSE))); + if (x1 < box->x1) + box->x1 = x1; + + x2 = xFixedToInt(xFixedCeil + (max + (_glamor_linefixedX(&traps->right, traps->top, TRUE), + _glamor_linefixedX(&traps->right, traps->bottom, + TRUE)))); + if (x2 > box->x2) + box->x2 = x2; + + if (!has_large_trapezoid && (x2 - x1) > 256 && (y2 - y1) > 32) + has_large_trapezoid = 1; + } + + return has_large_trapezoid; +} + +/** + * glamor_trapezoids will first try to create a trapezoid mask using shader, + * if failed, miTrapezoids will generate trapezoid mask accumulating in + * system memory. + */ +static Bool +_glamor_trapezoids(CARD8 op, + PicturePtr src, PicturePtr dst, + PictFormatPtr mask_format, INT16 x_src, INT16 y_src, + int ntrap, xTrapezoid *traps, Bool fallback) +{ + ScreenPtr screen = dst->pDrawable->pScreen; + BoxRec bounds; + PicturePtr picture; + INT16 x_dst, y_dst; + INT16 x_rel, y_rel; + int width, height, stride; + PixmapPtr pixmap; + pixman_image_t *image = NULL; + int ret = 0; + int has_large_trapezoid; + + /* If a mask format wasn't provided, we get to choose, but behavior should + * be as if there was no temporary mask the traps were accumulated into. + */ + if (!mask_format) { + if (dst->polyEdge == PolyEdgeSharp) + mask_format = PictureMatchFormat(screen, 1, PICT_a1); + else + mask_format = PictureMatchFormat(screen, 8, PICT_a8); + for (; ntrap; ntrap--, traps++) + glamor_trapezoids(op, src, dst, mask_format, x_src, + y_src, 1, traps); + return TRUE; + } + + has_large_trapezoid = _glamor_trapezoid_bounds(ntrap, traps, &bounds); + DEBUGF("The bounds for all traps is: bounds.x1 = %d, bounds.x2 = %d, " + "bounds.y1 = %d, bounds.y2 = %d, ---- ntrap = %d\n", bounds.x1, + bounds.x2, bounds.y1, bounds.y2, ntrap); + + if (bounds.y1 >= bounds.y2 || bounds.x1 >= bounds.x2) + return TRUE; + + x_dst = traps[0].left.p1.x >> 16; + y_dst = traps[0].left.p1.y >> 16; + + width = bounds.x2 - bounds.x1; + height = bounds.y2 - bounds.y1; + stride = PixmapBytePad(width, mask_format->depth); + +#ifdef GLAMOR_TRAPEZOID_SHADER + /* We seperate the render to two paths. + Some GL implemetation do not implement the Anti-Alias for triangles + and polygen's filling. So when the edge is not vertical or horizontal, + sawtooth will be obvious. The trapezoid is widely used to render wide + lines and circles. In these case, the line or circle will be divided + into a large number of small trapezoids to approximate it, so the sawtooth + at the edge will cause the result not be acceptable. + When the depth of the mask is 1, there is no Anti-Alias needed, so we + use the clip logic to generate the result directly(fast path). + When the depth is not 1, AA is needed and we use a shader to generate + a temp mask pixmap. + */ + if (mask_format->depth == 1) { + ret = _glamor_trapezoids_with_shader(op, src, dst, mask_format, + x_src, y_src, ntrap, traps); + if (ret) + return TRUE; + } + else { + if (has_large_trapezoid || ntrap > 256) { + /* The shader speed is relative slower than pixman when generating big chunk + trapezoid mask. We fallback to pixman to improve the performance. */ + ; + } + else if (dst->polyMode == PolyModeImprecise) { + /* The precise mode is that we sample the trapezoid on the centre points of + an (2*n+1)x(2*n-1) subpixel grid. It is computationally expensive in shader + and we use inside area ratio to replace it if the polymode == Imprecise. */ + picture = glamor_create_mask_picture(screen, dst, mask_format, + width, height, 1); + if (!picture) + return TRUE; + + ret = + _glamor_generate_trapezoid_with_shader(screen, picture, traps, + ntrap, &bounds); + + if (!ret) + FreePicture(picture, 0); + } + } +#endif + + if (!ret) { + DEBUGF("Fallback to sw rasterize of trapezoid\n"); + + picture = glamor_create_mask_picture(screen, dst, mask_format, + width, height, 0); + if (!picture) + return TRUE; + + image = pixman_image_create_bits(picture->format, + width, height, NULL, stride); + if (!image) { + FreePicture(picture, 0); + return TRUE; + } + + for (; ntrap; ntrap--, traps++) + pixman_rasterize_trapezoid(image, + (pixman_trapezoid_t *) traps, + -bounds.x1, -bounds.y1); + + pixmap = glamor_get_drawable_pixmap(picture->pDrawable); + + screen->ModifyPixmapHeader(pixmap, width, height, + mask_format->depth, + BitsPerPixel(mask_format->depth), + PixmapBytePad(width, + mask_format->depth), + pixman_image_get_data(image)); + } + + x_rel = bounds.x1 + x_src - x_dst; + y_rel = bounds.y1 + y_src - y_dst; + DEBUGF("x_src = %d, y_src = %d, x_dst = %d, y_dst = %d, " + "x_rel = %d, y_rel = %d\n", x_src, y_src, x_dst, + y_dst, x_rel, y_rel); + + CompositePicture(op, src, picture, dst, + x_rel, y_rel, + 0, 0, + bounds.x1, bounds.y1, + bounds.x2 - bounds.x1, bounds.y2 - bounds.y1); + + if (image) + pixman_image_unref(image); + + FreePicture(picture, 0); + return TRUE; +} + +void +glamor_trapezoids(CARD8 op, + PicturePtr src, PicturePtr dst, + PictFormatPtr mask_format, INT16 x_src, INT16 y_src, + int ntrap, xTrapezoid *traps) +{ + DEBUGF("x_src = %d, y_src = %d, ntrap = %d\n", x_src, y_src, ntrap); + + _glamor_trapezoids(op, src, dst, mask_format, x_src, + y_src, ntrap, traps, TRUE); +} + +Bool +glamor_trapezoids_nf(CARD8 op, + PicturePtr src, PicturePtr dst, + PictFormatPtr mask_format, INT16 x_src, INT16 y_src, + int ntrap, xTrapezoid *traps) +{ + DEBUGF("x_src = %d, y_src = %d, ntrap = %d\n", x_src, y_src, ntrap); + + return _glamor_trapezoids(op, src, dst, mask_format, x_src, + y_src, ntrap, traps, FALSE); +} + +#endif /* RENDER */ diff --git a/xserver/glamor/glamor_triangles.c b/xserver/glamor/glamor_triangles.c new file mode 100644 index 000000000..b89cb2de7 --- /dev/null +++ b/xserver/glamor/glamor_triangles.c @@ -0,0 +1,74 @@ +/* + * Copyright © 2009 Intel Corporation + * Copyright © 1998 Keith Packard + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Authors: + * Zhigang Gong <zhigang.gong@gmail.com> + * + */ + +#include "glamor_priv.h" + +static Bool +_glamor_triangles(CARD8 op, + PicturePtr pSrc, + PicturePtr pDst, + PictFormatPtr maskFormat, + INT16 xSrc, INT16 ySrc, int ntris, xTriangle * tris, + Bool fallback) +{ + if (!fallback && glamor_ddx_fallback_check_pixmap(pDst->pDrawable) + && (!pSrc->pDrawable + || glamor_ddx_fallback_check_pixmap(pSrc->pDrawable))) + return FALSE; + + if (glamor_prepare_access_picture(pDst, GLAMOR_ACCESS_RW) && + glamor_prepare_access_picture(pSrc, GLAMOR_ACCESS_RO)) { + fbTriangles(op, pSrc, pDst, maskFormat, xSrc, ySrc, ntris, tris); + } + glamor_finish_access_picture(pSrc); + glamor_finish_access_picture(pDst); + + return TRUE; +} + +void +glamor_triangles(CARD8 op, + PicturePtr pSrc, + PicturePtr pDst, + PictFormatPtr maskFormat, + INT16 xSrc, INT16 ySrc, int ntris, xTriangle * tris) +{ + _glamor_triangles(op, pSrc, pDst, maskFormat, + xSrc, ySrc, ntris, tris, TRUE); +} + +Bool +glamor_triangles_nf(CARD8 op, + PicturePtr pSrc, + PicturePtr pDst, + PictFormatPtr maskFormat, + INT16 xSrc, INT16 ySrc, int ntris, xTriangle * tris) +{ + return _glamor_triangles(op, pSrc, pDst, maskFormat, + xSrc, ySrc, ntris, tris, FALSE); +} diff --git a/xserver/glamor/glamor_utils.h b/xserver/glamor/glamor_utils.h new file mode 100644 index 000000000..4c1581ef5 --- /dev/null +++ b/xserver/glamor/glamor_utils.h @@ -0,0 +1,1510 @@ +/* + * Copyright © 2009 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Authors: + * Zhigang Gong <zhigang.gong@linux.intel.com> + * + */ + +#ifndef GLAMOR_PRIV_H +#error This file can only be included by glamor_priv.h +#endif + +#ifndef __GLAMOR_UTILS_H__ +#define __GLAMOR_UTILS_H__ + +#define v_from_x_coord_x(_xscale_, _x_) ( 2 * (_x_) * (_xscale_) - 1.0) +#define v_from_x_coord_y(_yscale_, _y_) (-2 * (_y_) * (_yscale_) + 1.0) +#define v_from_x_coord_y_inverted(_yscale_, _y_) (2 * (_y_) * (_yscale_) - 1.0) +#define t_from_x_coord_x(_xscale_, _x_) ((_x_) * (_xscale_)) +#define t_from_x_coord_y(_yscale_, _y_) (1.0 - (_y_) * (_yscale_)) +#define t_from_x_coord_y_inverted(_yscale_, _y_) ((_y_) * (_yscale_)) + +#define pixmap_priv_get_dest_scale(_pixmap_priv_, _pxscale_, _pyscale_) \ + do { \ + int _w_,_h_; \ + PIXMAP_PRIV_GET_ACTUAL_SIZE(_pixmap_priv_, _w_, _h_); \ + *(_pxscale_) = 1.0 / _w_; \ + *(_pyscale_) = 1.0 / _h_; \ + } while(0) + +#define pixmap_priv_get_scale(_pixmap_priv_, _pxscale_, _pyscale_) \ + do { \ + *(_pxscale_) = 1.0 / (_pixmap_priv_)->base.fbo->width; \ + *(_pyscale_) = 1.0 / (_pixmap_priv_)->base.fbo->height; \ + } while(0) + +#define GLAMOR_PIXMAP_FBO_NOT_EXACT_SIZE(priv) \ + (priv->base.fbo->width != priv->base.pixmap->drawable.width \ + || priv->base.fbo->height != priv->base.pixmap->drawable.height) \ + +#define PIXMAP_PRIV_GET_ACTUAL_SIZE(priv, w, h) \ + do { \ + if (_X_UNLIKELY(priv->type == GLAMOR_TEXTURE_LARGE)) { \ + w = priv->large.box.x2 - priv->large.box.x1; \ + h = priv->large.box.y2 - priv->large.box.y1; \ + } else { \ + w = priv->base.pixmap->drawable.width; \ + h = priv->base.pixmap->drawable.height; \ + } \ + } while(0) + +#define glamor_pixmap_fbo_fix_wh_ratio(wh, priv) \ + do { \ + int actual_w, actual_h; \ + PIXMAP_PRIV_GET_ACTUAL_SIZE(priv, actual_w, actual_h); \ + wh[0] = (float)priv->base.fbo->width / actual_w; \ + wh[1] = (float)priv->base.fbo->height / actual_h; \ + wh[2] = 1.0 / priv->base.fbo->width; \ + wh[3] = 1.0 / priv->base.fbo->height; \ + } while(0) + +#define pixmap_priv_get_fbo_off(_priv_, _xoff_, _yoff_) \ + do { \ + if (_X_UNLIKELY(_priv_ && (_priv_)->type == GLAMOR_TEXTURE_LARGE)) { \ + *(_xoff_) = - (_priv_)->large.box.x1; \ + *(_yoff_) = - (_priv_)->large.box.y1; \ + } else { \ + *(_xoff_) = 0; \ + *(_yoff_) = 0; \ + } \ + } while(0) + +#define xFixedToFloat(_val_) ((float)xFixedToInt(_val_) \ + + ((float)xFixedFrac(_val_) / 65536.0)) + +#define glamor_picture_get_matrixf(_picture_, _matrix_) \ + do { \ + int _i_; \ + if ((_picture_)->transform) \ + { \ + for(_i_ = 0; _i_ < 3; _i_++) \ + { \ + (_matrix_)[_i_ * 3 + 0] = \ + xFixedToFloat((_picture_)->transform->matrix[_i_][0]); \ + (_matrix_)[_i_ * 3 + 1] = \ + xFixedToFloat((_picture_)->transform->matrix[_i_][1]); \ + (_matrix_)[_i_ * 3 + 2] = \ + xFixedToFloat((_picture_)->transform->matrix[_i_][2]); \ + } \ + } \ + } while(0) + +#define fmod(x, w) (x - w * floor((float)x/w)) + +#define fmodulus(x, w, c) do {c = fmod(x, w); \ + c = c >= 0 ? c : c + w;} \ + while(0) +/* @x: is current coord + * @x2: is the right/bottom edge + * @w: is current width or height + * @odd: is output value, 0 means we are in an even region, 1 means we are in a + * odd region. + * @c: is output value, equal to x mod w. */ +#define fodd_repeat_mod(x, x2, w, odd, c) \ + do { \ + float shift; \ + fmodulus((x), w, c); \ + shift = fabs((x) - (c)); \ + shift = floor(fabs(round(shift)) / w); \ + odd = (int)shift & 1; \ + if (odd && (((x2 % w) == 0) && \ + round(fabs(x)) == x2)) \ + odd = 0; \ + } while(0) + +/* @txy: output value, is the corrected coords. + * @xy: input coords to be fixed up. + * @cd: xy mod wh, is a input value. + * @wh: current width or height. + * @bxy1,bxy2: current box edge's x1/x2 or y1/y2 + * + * case 1: + * ---------- + * | * | + * | | + * ---------- + * tx = (c - x1) mod w + * + * case 2: + * --------- + * * | | + * | | + * --------- + * tx = - (c - (x1 mod w)) + * + * case 3: + * + * ---------- + * | | * + * | | + * ---------- + * tx = ((x2 mod x) - c) + (x2 - x1) + **/ +#define __glamor_repeat_reflect_fixup(txy, xy, \ + cd, wh, bxy1, bxy2) \ + do { \ + cd = wh - cd; \ + if ( xy >= bxy1 && xy < bxy2) { \ + cd = cd - bxy1; \ + fmodulus(cd, wh, txy); \ + } else if (xy < bxy1) { \ + float bxy1_mod; \ + fmodulus(bxy1, wh, bxy1_mod); \ + txy = -(cd - bxy1_mod); \ + } \ + else if (xy >= bxy2) { \ + float bxy2_mod; \ + fmodulus(bxy2, wh, bxy2_mod); \ + if (bxy2_mod == 0) \ + bxy2_mod = wh; \ + txy = (bxy2_mod - cd) + bxy2 - bxy1; \ + } else {assert(0); txy = 0;} \ + } while(0) + +#define _glamor_repeat_reflect_fixup(txy, xy, cd, odd, \ + wh, bxy1, bxy2) \ + do { \ + if (odd) { \ + __glamor_repeat_reflect_fixup(txy, xy, \ + cd, wh, bxy1, bxy2); \ + } else \ + txy = xy - bxy1; \ + } while(0) + +#define _glamor_get_reflect_transform_coords(priv, repeat_type, \ + tx1, ty1, \ + _x1_, _y1_) \ + do { \ + int odd_x, odd_y; \ + float c, d; \ + fodd_repeat_mod(_x1_,priv->box.x2, \ + priv->base.pixmap->drawable.width, \ + odd_x, c); \ + fodd_repeat_mod(_y1_, priv->box.y2, \ + priv->base.pixmap->drawable.height, \ + odd_y, d); \ + DEBUGF("c %f d %f oddx %d oddy %d \n", \ + c, d, odd_x, odd_y); \ + DEBUGF("x2 %d x1 %d fbo->width %d \n", priv->box.x2, \ + priv->box.x1, priv->base.fbo->width); \ + DEBUGF("y2 %d y1 %d fbo->height %d \n", priv->box.y2, \ + priv->box.y1, priv->base.fbo->height); \ + _glamor_repeat_reflect_fixup(tx1, _x1_, c, odd_x, \ + priv->base.pixmap->drawable.width, \ + priv->box.x1, priv->box.x2); \ + _glamor_repeat_reflect_fixup(ty1, _y1_, d, odd_y, \ + priv->base.pixmap->drawable.height, \ + priv->box.y1, priv->box.y2); \ + } while(0) + +#define _glamor_get_repeat_coords(priv, repeat_type, tx1, \ + ty1, tx2, ty2, \ + _x1_, _y1_, _x2_, \ + _y2_, c, d, odd_x, odd_y) \ + do { \ + if (repeat_type == RepeatReflect) { \ + DEBUGF("x1 y1 %d %d\n", \ + _x1_, _y1_ ); \ + DEBUGF("width %d box.x1 %d \n", \ + (priv)->base.pixmap->drawable.width, \ + priv->box.x1); \ + if (odd_x) { \ + c = (priv)->base.pixmap->drawable.width \ + - c; \ + tx1 = c - priv->box.x1; \ + tx2 = tx1 - ((_x2_) - (_x1_)); \ + } else { \ + tx1 = c - priv->box.x1; \ + tx2 = tx1 + ((_x2_) - (_x1_)); \ + } \ + if (odd_y){ \ + d = (priv)->base.pixmap->drawable.height\ + - d; \ + ty1 = d - priv->box.y1; \ + ty2 = ty1 - ((_y2_) - (_y1_)); \ + } else { \ + ty1 = d - priv->box.y1; \ + ty2 = ty1 + ((_y2_) - (_y1_)); \ + } \ + } else { /* RepeatNormal*/ \ + tx1 = (c - priv->box.x1); \ + ty1 = (d - priv->box.y1); \ + tx2 = tx1 + ((_x2_) - (_x1_)); \ + ty2 = ty1 + ((_y2_) - (_y1_)); \ + } \ + } while(0) + +/* _x1_ ... _y2_ may has fractional. */ +#define glamor_get_repeat_transform_coords(priv, repeat_type, tx1, \ + ty1, _x1_, _y1_) \ + do { \ + DEBUGF("width %d box.x1 %d x2 %d y1 %d y2 %d\n", \ + (priv)->base.pixmap->drawable.width, \ + priv->box.x1, priv->box.x2, priv->box.y1, \ + priv->box.y2); \ + DEBUGF("x1 %f y1 %f \n", _x1_, _y1_); \ + if (repeat_type != RepeatReflect) { \ + tx1 = _x1_ - priv->box.x1; \ + ty1 = _y1_ - priv->box.y1; \ + } else \ + _glamor_get_reflect_transform_coords(priv, repeat_type, \ + tx1, ty1, \ + _x1_, _y1_); \ + DEBUGF("tx1 %f ty1 %f \n", tx1, ty1); \ + } while(0) + +/* _x1_ ... _y2_ must be integer. */ +#define glamor_get_repeat_coords(priv, repeat_type, tx1, \ + ty1, tx2, ty2, _x1_, _y1_, _x2_, \ + _y2_) \ + do { \ + int c, d; \ + int odd_x = 0, odd_y = 0; \ + DEBUGF("width %d box.x1 %d x2 %d y1 %d y2 %d\n", \ + (priv)->base.pixmap->drawable.width, \ + priv->box.x1, priv->box.x2, \ + priv->box.y1, priv->box.y2); \ + modulus((_x1_), (priv)->base.pixmap->drawable.width, c); \ + modulus((_y1_), (priv)->base.pixmap->drawable.height, d); \ + DEBUGF("c %d d %d \n", c, d); \ + if (repeat_type == RepeatReflect) { \ + odd_x = abs((_x1_ - c) \ + / (priv->base.pixmap->drawable.width)) & 1; \ + odd_y = abs((_y1_ - d) \ + / (priv->base.pixmap->drawable.height)) & 1; \ + } \ + _glamor_get_repeat_coords(priv, repeat_type, tx1, ty1, tx2, ty2,\ + _x1_, _y1_, _x2_, _y2_, c, d, \ + odd_x, odd_y); \ + } while(0) + +#define glamor_transform_point(matrix, tx, ty, x, y) \ + do { \ + int _i_; \ + float _result_[4]; \ + for (_i_ = 0; _i_ < 3; _i_++) { \ + _result_[_i_] = (matrix)[_i_ * 3] * (x) + (matrix)[_i_ * 3 + 1] * (y) \ + + (matrix)[_i_ * 3 + 2]; \ + } \ + tx = _result_[0] / _result_[2]; \ + ty = _result_[1] / _result_[2]; \ + } while(0) + +#define _glamor_set_normalize_tpoint(xscale, yscale, _tx_, _ty_, \ + texcoord, yInverted) \ + do { \ + (texcoord)[0] = t_from_x_coord_x(xscale, _tx_); \ + if (_X_LIKELY(yInverted)) \ + (texcoord)[1] = t_from_x_coord_y_inverted(yscale, _ty_);\ + else \ + (texcoord)[1] = t_from_x_coord_y(yscale, _ty_); \ + DEBUGF("normalized point tx %f ty %f \n", (texcoord)[0], \ + (texcoord)[1]); \ + } while(0) + +#define glamor_set_transformed_point(priv, matrix, xscale, \ + yscale, texcoord, \ + x, y, \ + yInverted) \ + do { \ + float tx, ty; \ + int fbo_x_off, fbo_y_off; \ + pixmap_priv_get_fbo_off(priv, &fbo_x_off, &fbo_y_off); \ + glamor_transform_point(matrix, tx, ty, x, y); \ + DEBUGF("tx %f ty %f fbooff %d %d \n", \ + tx, ty, fbo_x_off, fbo_y_off); \ + \ + tx += fbo_x_off; \ + ty += fbo_y_off; \ + (texcoord)[0] = t_from_x_coord_x(xscale, tx); \ + if (_X_LIKELY(yInverted)) \ + (texcoord)[1] = t_from_x_coord_y_inverted(yscale, ty); \ + else \ + (texcoord)[1] = t_from_x_coord_y(yscale, ty); \ + DEBUGF("normalized tx %f ty %f \n", (texcoord)[0], (texcoord)[1]); \ + } while(0) + +#define glamor_set_transformed_normalize_tri_tcoords(priv, \ + matrix, \ + xscale, \ + yscale, \ + vtx, \ + yInverted, \ + texcoords) \ + do { \ + glamor_set_transformed_point(priv, matrix, xscale, yscale, \ + texcoords, (vtx)[0], (vtx)[1], \ + yInverted); \ + glamor_set_transformed_point(priv, matrix, xscale, yscale, \ + texcoords+2, (vtx)[2], (vtx)[3], \ + yInverted); \ + glamor_set_transformed_point(priv, matrix, xscale, yscale, \ + texcoords+4, (vtx)[4], (vtx)[5], \ + yInverted); \ + } while (0) + +#define glamor_set_transformed_normalize_tcoords_ext( priv, \ + matrix, \ + xscale, \ + yscale, \ + tx1, ty1, tx2, ty2, \ + yInverted, texcoords, \ + stride) \ + do { \ + glamor_set_transformed_point(priv, matrix, xscale, yscale, \ + texcoords, tx1, ty1, \ + yInverted); \ + glamor_set_transformed_point(priv, matrix, xscale, yscale, \ + texcoords + 1 * stride, tx2, ty1, \ + yInverted); \ + glamor_set_transformed_point(priv, matrix, xscale, yscale, \ + texcoords + 2 * stride, tx2, ty2, \ + yInverted); \ + glamor_set_transformed_point(priv, matrix, xscale, yscale, \ + texcoords + 3 * stride, tx1, ty2, \ + yInverted); \ + } while (0) + +#define glamor_set_transformed_normalize_tcoords( priv, \ + matrix, \ + xscale, \ + yscale, \ + tx1, ty1, tx2, ty2, \ + yInverted, texcoords) \ + do { \ + glamor_set_transformed_normalize_tcoords_ext( priv, \ + matrix, \ + xscale, \ + yscale, \ + tx1, ty1, tx2, ty2, \ + yInverted, texcoords, \ + 2); \ + } while (0) + +#define glamor_set_normalize_tri_tcoords(xscale, \ + yscale, \ + vtx, \ + yInverted, \ + texcoords) \ + do { \ + _glamor_set_normalize_tpoint(xscale, yscale, \ + (vtx)[0], (vtx)[1], \ + texcoords, \ + yInverted); \ + _glamor_set_normalize_tpoint(xscale, yscale, \ + (vtx)[2], (vtx)[3], \ + texcoords+2, \ + yInverted); \ + _glamor_set_normalize_tpoint(xscale, yscale, \ + (vtx)[4], (vtx)[5], \ + texcoords+4, \ + yInverted); \ + } while (0) + +#define glamor_set_repeat_transformed_normalize_tcoords_ext( priv, \ + repeat_type, \ + matrix, \ + xscale, \ + yscale, \ + _x1_, _y1_, \ + _x2_, _y2_, \ + yInverted, \ + texcoords, \ + stride) \ + do { \ + if (_X_LIKELY(priv->type != GLAMOR_TEXTURE_LARGE)) { \ + glamor_set_transformed_normalize_tcoords_ext(priv, matrix, xscale, \ + yscale, _x1_, _y1_, \ + _x2_, _y2_, yInverted, \ + texcoords, stride); \ + } else { \ + float tx1, ty1, tx2, ty2, tx3, ty3, tx4, ty4; \ + float ttx1, tty1, ttx2, tty2, ttx3, tty3, ttx4, tty4; \ + DEBUGF("original coords %d %d %d %d\n", _x1_, _y1_, _x2_, _y2_); \ + glamor_transform_point(matrix, tx1, ty1, _x1_, _y1_); \ + glamor_transform_point(matrix, tx2, ty2, _x2_, _y1_); \ + glamor_transform_point(matrix, tx3, ty3, _x2_, _y2_); \ + glamor_transform_point(matrix, tx4, ty4, _x1_, _y2_); \ + DEBUGF("transformed %f %f %f %f %f %f %f %f\n", \ + tx1, ty1, tx2, ty2, tx3, ty3, tx4, ty4); \ + glamor_get_repeat_transform_coords((&priv->large), repeat_type, \ + ttx1, tty1, \ + tx1, ty1); \ + glamor_get_repeat_transform_coords((&priv->large), repeat_type, \ + ttx2, tty2, \ + tx2, ty2); \ + glamor_get_repeat_transform_coords((&priv->large), repeat_type, \ + ttx3, tty3, \ + tx3, ty3); \ + glamor_get_repeat_transform_coords((&priv->large), repeat_type, \ + ttx4, tty4, \ + tx4, ty4); \ + DEBUGF("repeat transformed %f %f %f %f %f %f %f %f\n", ttx1, tty1, \ + ttx2, tty2, ttx3, tty3, ttx4, tty4); \ + _glamor_set_normalize_tpoint(xscale, yscale, ttx1, tty1, \ + texcoords, yInverted); \ + _glamor_set_normalize_tpoint(xscale, yscale, ttx2, tty2, \ + texcoords + 1 * stride, yInverted); \ + _glamor_set_normalize_tpoint(xscale, yscale, ttx3, tty3, \ + texcoords + 2 * stride, yInverted); \ + _glamor_set_normalize_tpoint(xscale, yscale, ttx4, tty4, \ + texcoords + 3 * stride, yInverted); \ + } \ + } while (0) + +#define glamor_set_repeat_transformed_normalize_tcoords( priv, \ + repeat_type, \ + matrix, \ + xscale, \ + yscale, \ + _x1_, _y1_, \ + _x2_, _y2_, \ + yInverted, \ + texcoords) \ + do { \ + glamor_set_repeat_transformed_normalize_tcoords_ext( priv, \ + repeat_type, \ + matrix, \ + xscale, \ + yscale, \ + _x1_, _y1_, \ + _x2_, _y2_, \ + yInverted, \ + texcoords, \ + 2); \ + } while (0) + +#define _glamor_set_normalize_tcoords(xscale, yscale, tx1, \ + ty1, tx2, ty2, \ + yInverted, vertices, stride) \ + do { \ + /* vertices may be write-only, so we use following \ + * temporary variable. */ \ + float _t0_, _t1_, _t2_, _t5_; \ + (vertices)[0] = _t0_ = t_from_x_coord_x(xscale, tx1); \ + (vertices)[1 * stride] = _t2_ = t_from_x_coord_x(xscale, tx2); \ + (vertices)[2 * stride] = _t2_; \ + (vertices)[3 * stride] = _t0_; \ + if (_X_LIKELY(yInverted)) { \ + (vertices)[1] = _t1_ = t_from_x_coord_y_inverted(yscale, ty1); \ + (vertices)[2 * stride + 1] = _t5_ = t_from_x_coord_y_inverted(yscale, ty2);\ + } \ + else { \ + (vertices)[1] = _t1_ = t_from_x_coord_y(yscale, ty1); \ + (vertices)[2 * stride + 1] = _t5_ = t_from_x_coord_y(yscale, ty2);\ + } \ + (vertices)[1 * stride + 1] = _t1_; \ + (vertices)[3 * stride + 1] = _t5_; \ + } while(0) + +#define glamor_set_normalize_tcoords_ext(priv, xscale, yscale, \ + x1, y1, x2, y2, \ + yInverted, vertices, stride) \ + do { \ + if (_X_UNLIKELY(priv->type == GLAMOR_TEXTURE_LARGE)) { \ + float tx1, tx2, ty1, ty2; \ + int fbo_x_off, fbo_y_off; \ + pixmap_priv_get_fbo_off(priv, &fbo_x_off, &fbo_y_off); \ + tx1 = x1 + fbo_x_off; \ + tx2 = x2 + fbo_x_off; \ + ty1 = y1 + fbo_y_off; \ + ty2 = y2 + fbo_y_off; \ + _glamor_set_normalize_tcoords(xscale, yscale, tx1, ty1, \ + tx2, ty2, yInverted, vertices, \ + stride); \ + } else \ + _glamor_set_normalize_tcoords(xscale, yscale, x1, y1, \ + x2, y2, yInverted, vertices, stride);\ + } while(0) + +#define glamor_set_normalize_tcoords(priv, xscale, yscale, \ + x1, y1, x2, y2, \ + yInverted, vertices) \ + do { \ + glamor_set_normalize_tcoords_ext(priv, xscale, yscale, \ + x1, y1, x2, y2, \ + yInverted, vertices, 2); \ + } while(0) + +#define glamor_set_repeat_normalize_tcoords_ext(priv, repeat_type, \ + xscale, yscale, \ + _x1_, _y1_, _x2_, _y2_, \ + yInverted, vertices, stride)\ + do { \ + if (_X_UNLIKELY(priv->type == GLAMOR_TEXTURE_LARGE)) { \ + float tx1, tx2, ty1, ty2; \ + if (repeat_type == RepeatPad) { \ + tx1 = _x1_ - priv->large.box.x1; \ + ty1 = _y1_ - priv->large.box.y1; \ + tx2 = tx1 + ((_x2_) - (_x1_)); \ + ty2 = ty1 + ((_y2_) - (_y1_)); \ + } else { \ + glamor_get_repeat_coords((&priv->large), repeat_type, \ + tx1, ty1, tx2, ty2, \ + _x1_, _y1_, _x2_, _y2_); \ + } \ + _glamor_set_normalize_tcoords(xscale, yscale, tx1, ty1, \ + tx2, ty2, yInverted, vertices, \ + stride); \ + } else \ + _glamor_set_normalize_tcoords(xscale, yscale, _x1_, _y1_, \ + _x2_, _y2_, yInverted, vertices, \ + stride); \ + } while(0) + +#define glamor_set_repeat_normalize_tcoords(priv, repeat_type, \ + xscale, yscale, \ + _x1_, _y1_, _x2_, _y2_, \ + yInverted, vertices) \ + do { \ + glamor_set_repeat_normalize_tcoords_ext(priv, repeat_type, \ + xscale, yscale, \ + _x1_, _y1_, _x2_, _y2_, \ + yInverted, vertices, 2); \ + } while(0) + +#define glamor_set_normalize_tcoords_tri_stripe(xscale, yscale, \ + x1, y1, x2, y2, \ + yInverted, vertices) \ + do { \ + (vertices)[0] = t_from_x_coord_x(xscale, x1); \ + (vertices)[2] = t_from_x_coord_x(xscale, x2); \ + (vertices)[6] = (vertices)[2]; \ + (vertices)[4] = (vertices)[0]; \ + if (_X_LIKELY(yInverted)) { \ + (vertices)[1] = t_from_x_coord_y_inverted(yscale, y1); \ + (vertices)[7] = t_from_x_coord_y_inverted(yscale, y2); \ + } \ + else { \ + (vertices)[1] = t_from_x_coord_y(yscale, y1); \ + (vertices)[7] = t_from_x_coord_y(yscale, y2); \ + } \ + (vertices)[3] = (vertices)[1]; \ + (vertices)[5] = (vertices)[7]; \ + } while(0) + +#define glamor_set_tcoords(width, height, x1, y1, x2, y2, \ + yInverted, vertices) \ + do { \ + (vertices)[0] = (x1); \ + (vertices)[2] = (x2); \ + (vertices)[4] = (vertices)[2]; \ + (vertices)[6] = (vertices)[0]; \ + if (_X_LIKELY(yInverted)) { \ + (vertices)[1] = (y1); \ + (vertices)[5] = (y2); \ + } \ + else { \ + (vertices)[1] = height - (y2); \ + (vertices)[5] = height - (y1); \ + } \ + (vertices)[3] = (vertices)[1]; \ + (vertices)[7] = (vertices)[5]; \ + } while(0) + +#define glamor_set_tcoords_ext(width, height, x1, y1, x2, y2, \ + yInverted, vertices, stride) \ + do { \ + (vertices)[0] = (x1); \ + (vertices)[1*stride] = (x2); \ + (vertices)[2*stride] = (vertices)[1*stride]; \ + (vertices)[3*stride] = (vertices)[0]; \ + if (_X_LIKELY(yInverted)) { \ + (vertices)[1] = (y1); \ + (vertices)[2*stride + 1] = (y2); \ + } \ + else { \ + (vertices)[1] = height - (y2); \ + (vertices)[2*stride + 1] = height - (y1); \ + } \ + (vertices)[1*stride + 1] = (vertices)[1]; \ + (vertices)[3*stride + 1] = (vertices)[2*stride + 1]; \ + } while(0) + +#define glamor_set_normalize_one_vcoord(xscale, yscale, x, y, \ + yInverted, vertices) \ + do { \ + (vertices)[0] = v_from_x_coord_x(xscale, x); \ + if (_X_LIKELY(yInverted)) { \ + (vertices)[1] = v_from_x_coord_y_inverted(yscale, y); \ + } else { \ + (vertices)[1] = v_from_x_coord_y(yscale, y); \ + } \ + } while(0) + +#define glamor_set_normalize_tri_vcoords(xscale, yscale, vtx, \ + yInverted, vertices) \ + do { \ + glamor_set_normalize_one_vcoord(xscale, yscale, \ + (vtx)[0], (vtx)[1], \ + yInverted, vertices); \ + glamor_set_normalize_one_vcoord(xscale, yscale, \ + (vtx)[2], (vtx)[3], \ + yInverted, vertices+2); \ + glamor_set_normalize_one_vcoord(xscale, yscale, \ + (vtx)[4], (vtx)[5], \ + yInverted, vertices+4); \ + } while(0) + +#define glamor_set_tcoords_tri_strip(width, height, x1, y1, x2, y2, \ + yInverted, vertices) \ + do { \ + (vertices)[0] = (x1); \ + (vertices)[2] = (x2); \ + (vertices)[6] = (vertices)[2]; \ + (vertices)[4] = (vertices)[0]; \ + if (_X_LIKELY(yInverted)) { \ + (vertices)[1] = (y1); \ + (vertices)[7] = (y2); \ + } \ + else { \ + (vertices)[1] = height - (y2); \ + (vertices)[7] = height - (y1); \ + } \ + (vertices)[3] = (vertices)[1]; \ + (vertices)[5] = (vertices)[7]; \ + } while(0) + +#define glamor_set_normalize_vcoords_ext(priv, xscale, yscale, \ + x1, y1, x2, y2, \ + yInverted, vertices, stride) \ + do { \ + int fbo_x_off, fbo_y_off; \ + /* vertices may be write-only, so we use following \ + * temporary variable. */ \ + float _t0_, _t1_, _t2_, _t5_; \ + pixmap_priv_get_fbo_off(priv, &fbo_x_off, &fbo_y_off); \ + (vertices)[0] = _t0_ = v_from_x_coord_x(xscale, x1 + fbo_x_off); \ + (vertices)[1 * stride] = _t2_ = v_from_x_coord_x(xscale, \ + x2 + fbo_x_off); \ + (vertices)[2 * stride] = _t2_; \ + (vertices)[3 * stride] = _t0_; \ + if (_X_LIKELY(yInverted)) { \ + (vertices)[1] = _t1_ = v_from_x_coord_y_inverted(yscale, \ + y1 + fbo_y_off); \ + (vertices)[2 * stride + 1] = _t5_ = \ + v_from_x_coord_y_inverted(yscale, \ + y2 + fbo_y_off); \ + } \ + else { \ + (vertices)[1] = _t1_ = v_from_x_coord_y(yscale, y1 + fbo_y_off); \ + (vertices)[2 * stride + 1] = _t5_ = v_from_x_coord_y(yscale, \ + y2 + fbo_y_off); \ + } \ + (vertices)[1 * stride + 1] = _t1_; \ + (vertices)[3 * stride + 1] = _t5_; \ + } while(0) + +#define glamor_set_normalize_vcoords(priv, xscale, yscale, \ + x1, y1, x2, y2, \ + yInverted, vertices) \ + do { \ + glamor_set_normalize_vcoords_ext(priv, xscale, yscale, \ + x1, y1, x2, y2, \ + yInverted, vertices, 2); \ + } while(0) + +#define glamor_set_const_ext(params, nparam, vertices, nverts, stride) \ + do { \ + int _i_ = 0, _j_ = 0; \ + for(; _i_ < nverts; _i_++) { \ + for(_j_ = 0; _j_ < nparam; _j_++) { \ + vertices[stride*_i_ + _j_] = params[_j_]; \ + } \ + } \ + } while(0) + +#define glamor_set_normalize_vcoords_tri_strip(xscale, yscale, \ + x1, y1, x2, y2, \ + yInverted, vertices) \ + do { \ + (vertices)[0] = v_from_x_coord_x(xscale, x1); \ + (vertices)[2] = v_from_x_coord_x(xscale, x2); \ + (vertices)[6] = (vertices)[2]; \ + (vertices)[4] = (vertices)[0]; \ + if (_X_LIKELY(yInverted)) { \ + (vertices)[1] = v_from_x_coord_y_inverted(yscale, y1); \ + (vertices)[7] = v_from_x_coord_y_inverted(yscale, y2); \ + } \ + else { \ + (vertices)[1] = v_from_x_coord_y(yscale, y1); \ + (vertices)[7] = v_from_x_coord_y(yscale, y2); \ + } \ + (vertices)[3] = (vertices)[1]; \ + (vertices)[5] = (vertices)[7]; \ + } while(0) + +#define glamor_set_normalize_pt(xscale, yscale, x, y, \ + yInverted, pt) \ + do { \ + (pt)[0] = t_from_x_coord_x(xscale, x); \ + if (_X_LIKELY(yInverted)) { \ + (pt)[1] = t_from_x_coord_y_inverted(yscale, y); \ + } else { \ + (pt)[1] = t_from_x_coord_y(yscale, y); \ + } \ + } while(0) + +#define glamor_set_circle_centre(width, height, x, y, \ + yInverted, c) \ + do { \ + (c)[0] = (float)x; \ + if (_X_LIKELY(yInverted)) { \ + (c)[1] = (float)y; \ + } else { \ + (c)[1] = (float)height - (float)y; \ + } \ + } while(0) + +inline static void +glamor_calculate_boxes_bound(BoxPtr bound, BoxPtr boxes, int nbox) +{ + int x_min, y_min; + int x_max, y_max; + int i; + + x_min = y_min = MAXSHORT; + x_max = y_max = MINSHORT; + for (i = 0; i < nbox; i++) { + if (x_min > boxes[i].x1) + x_min = boxes[i].x1; + if (y_min > boxes[i].y1) + y_min = boxes[i].y1; + + if (x_max < boxes[i].x2) + x_max = boxes[i].x2; + if (y_max < boxes[i].y2) + y_max = boxes[i].y2; + } + bound->x1 = x_min; + bound->y1 = y_min; + bound->x2 = x_max; + bound->y2 = y_max; +} + +inline static void +glamor_translate_boxes(BoxPtr boxes, int nbox, int dx, int dy) +{ + int i; + + for (i = 0; i < nbox; i++) { + boxes[i].x1 += dx; + boxes[i].y1 += dy; + boxes[i].x2 += dx; + boxes[i].y2 += dy; + } +} + +#ifndef ARRAY_SIZE +#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0])) +#endif + +#define ALIGN(i,m) (((i) + (m) - 1) & ~((m) - 1)) +#define MIN(a,b) ((a) < (b) ? (a) : (b)) +#define MAX(a,b) ((a) > (b) ? (a) : (b)) + +#define glamor_check_fbo_size(_glamor_,_w_, _h_) ((_w_) > 0 && (_h_) > 0 \ + && (_w_) <= _glamor_->max_fbo_size \ + && (_h_) <= _glamor_->max_fbo_size) + +/* For 1bpp pixmap, we don't store it as texture. */ +#define glamor_check_pixmap_fbo_depth(_depth_) ( \ + _depth_ == 8 \ + || _depth_ == 15 \ + || _depth_ == 16 \ + || _depth_ == 24 \ + || _depth_ == 30 \ + || _depth_ == 32) + +#define GLAMOR_PIXMAP_PRIV_IS_PICTURE(pixmap_priv) (pixmap_priv && pixmap_priv->base.is_picture == 1) +#define GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv) (pixmap_priv && pixmap_priv->base.gl_fbo == GLAMOR_FBO_NORMAL) +#define GLAMOR_PIXMAP_PRIV_HAS_FBO_DOWNLOADED(pixmap_priv) (pixmap_priv && (pixmap_priv->base.gl_fbo == GLAMOR_FBO_DOWNLOADED)) + +/** + * Borrow from uxa. + */ +static inline CARD32 +format_for_depth(int depth) +{ + switch (depth) { + case 1: + return PICT_a1; + case 4: + return PICT_a4; + case 8: + return PICT_a8; + case 15: + return PICT_x1r5g5b5; + case 16: + return PICT_r5g6b5; + default: + case 24: + return PICT_x8r8g8b8; +#if XORG_VERSION_CURRENT >= 10699900 + case 30: + return PICT_x2r10g10b10; +#endif + case 32: + return PICT_a8r8g8b8; + } +} + +static inline GLenum +gl_iformat_for_pixmap(PixmapPtr pixmap) +{ + glamor_screen_private *glamor_priv = + glamor_get_screen_private(pixmap->drawable.pScreen); + + if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP && + (pixmap->drawable.depth == 1 || pixmap->drawable.depth == 8)) { + return GL_ALPHA; + } else { + return GL_RGBA; + } +} + +static inline CARD32 +format_for_pixmap(PixmapPtr pixmap) +{ + glamor_pixmap_private *pixmap_priv; + PictFormatShort pict_format; + + pixmap_priv = glamor_get_pixmap_private(pixmap); + if (GLAMOR_PIXMAP_PRIV_IS_PICTURE(pixmap_priv)) + pict_format = pixmap_priv->base.picture->format; + else + pict_format = format_for_depth(pixmap->drawable.depth); + + return pict_format; +} + +#define REVERT_NONE 0 +#define REVERT_NORMAL 1 +#define REVERT_DOWNLOADING_A1 2 +#define REVERT_UPLOADING_A1 3 +#define REVERT_DOWNLOADING_2_10_10_10 4 +#define REVERT_UPLOADING_2_10_10_10 5 +#define REVERT_DOWNLOADING_1_5_5_5 7 +#define REVERT_UPLOADING_1_5_5_5 8 +#define REVERT_DOWNLOADING_10_10_10_2 9 +#define REVERT_UPLOADING_10_10_10_2 10 + +#define SWAP_NONE_DOWNLOADING 0 +#define SWAP_DOWNLOADING 1 +#define SWAP_UPLOADING 2 +#define SWAP_NONE_UPLOADING 3 + +inline static int +cache_format(GLenum format) +{ + switch (format) { + case GL_ALPHA: + return 2; + case GL_RGB: + return 1; + case GL_RGBA: + return 0; + default: + return -1; + } +} + +/* borrowed from uxa */ +static inline Bool +glamor_get_rgba_from_pixel(CARD32 pixel, + float *red, + float *green, + float *blue, float *alpha, CARD32 format) +{ + int rbits, bbits, gbits, abits; + int rshift, bshift, gshift, ashift; + + rbits = PICT_FORMAT_R(format); + gbits = PICT_FORMAT_G(format); + bbits = PICT_FORMAT_B(format); + abits = PICT_FORMAT_A(format); + + if (PICT_FORMAT_TYPE(format) == PICT_TYPE_A) { + rshift = gshift = bshift = ashift = 0; + } + else if (PICT_FORMAT_TYPE(format) == PICT_TYPE_ARGB) { + bshift = 0; + gshift = bbits; + rshift = gshift + gbits; + ashift = rshift + rbits; + } + else if (PICT_FORMAT_TYPE(format) == PICT_TYPE_ABGR) { + rshift = 0; + gshift = rbits; + bshift = gshift + gbits; + ashift = bshift + bbits; +#if XORG_VERSION_CURRENT >= 10699900 + } + else if (PICT_FORMAT_TYPE(format) == PICT_TYPE_BGRA) { + ashift = 0; + rshift = abits; + if (abits == 0) + rshift = PICT_FORMAT_BPP(format) - (rbits + gbits + bbits); + gshift = rshift + rbits; + bshift = gshift + gbits; +#endif + } + else { + return FALSE; + } +#define COLOR_INT_TO_FLOAT(_fc_, _p_, _s_, _bits_) \ + *_fc_ = (((_p_) >> (_s_)) & (( 1 << (_bits_)) - 1)) \ + / (float)((1<<(_bits_)) - 1) + + if (rbits) + COLOR_INT_TO_FLOAT(red, pixel, rshift, rbits); + else + *red = 0; + + if (gbits) + COLOR_INT_TO_FLOAT(green, pixel, gshift, gbits); + else + *green = 0; + + if (bbits) + COLOR_INT_TO_FLOAT(blue, pixel, bshift, bbits); + else + *blue = 0; + + if (abits) + COLOR_INT_TO_FLOAT(alpha, pixel, ashift, abits); + else + *alpha = 1; + + return TRUE; +} + +inline static Bool +glamor_pict_format_is_compatible(PicturePtr picture) +{ + GLenum iformat; + PixmapPtr pixmap = glamor_get_drawable_pixmap(picture->pDrawable); + + iformat = gl_iformat_for_pixmap(pixmap); + switch (iformat) { + case GL_RGBA: + return (picture->format == PICT_a8r8g8b8 || + picture->format == PICT_x8r8g8b8); + case GL_ALPHA: + return (picture->format == PICT_a8); + default: + return FALSE; + } +} + +/* return TRUE if we can access this pixmap at DDX driver. */ +inline static Bool +glamor_ddx_fallback_check_pixmap(DrawablePtr drawable) +{ + PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable); + glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap); + + return (!pixmap_priv + || (pixmap_priv->type == GLAMOR_TEXTURE_DRM + || pixmap_priv->type == GLAMOR_MEMORY + || pixmap_priv->type == GLAMOR_DRM_ONLY)); +} + +inline static Bool +glamor_ddx_fallback_check_gc(GCPtr gc) +{ + PixmapPtr pixmap; + + if (!gc) + return TRUE; + switch (gc->fillStyle) { + case FillStippled: + case FillOpaqueStippled: + pixmap = gc->stipple; + break; + case FillTiled: + pixmap = gc->tile.pixmap; + break; + default: + pixmap = NULL; + } + return (!pixmap || glamor_ddx_fallback_check_pixmap(&pixmap->drawable)); +} + +inline static Bool +glamor_is_large_pixmap(PixmapPtr pixmap) +{ + glamor_pixmap_private *priv; + + priv = glamor_get_pixmap_private(pixmap); + return (priv->type == GLAMOR_TEXTURE_LARGE); +} + +inline static Bool +glamor_is_large_picture(PicturePtr picture) +{ + PixmapPtr pixmap; + + if (picture->pDrawable) { + pixmap = glamor_get_drawable_pixmap(picture->pDrawable); + return glamor_is_large_pixmap(pixmap); + } + return FALSE; +} + +inline static Bool +glamor_tex_format_is_readable(GLenum format) +{ + return ((format == GL_RGBA || format == GL_RGB || format == GL_ALPHA)); + +} + +static inline void +_glamor_dump_pixmap_bits(PixmapPtr pixmap, int x, int y, int w, int h) +{ + int i, j; + unsigned char *p = pixmap->devPrivate.ptr; + int stride = pixmap->devKind; + + p = p + y * stride + x; + + for (i = 0; i < h; i++) { + ErrorF("line %3d: ", i); + for (j = 0; j < w; j++) + ErrorF("%2d ", (p[j / 8] & (1 << (j % 8))) >> (j % 8)); + p += stride; + ErrorF("\n"); + } +} + +static inline void +_glamor_dump_pixmap_byte(PixmapPtr pixmap, int x, int y, int w, int h) +{ + int i, j; + unsigned char *p = pixmap->devPrivate.ptr; + int stride = pixmap->devKind; + + p = p + y * stride + x; + + for (i = 0; i < h; i++) { + ErrorF("line %3d: ", i); + for (j = 0; j < w; j++) + ErrorF("%2x ", p[j]); + p += stride; + ErrorF("\n"); + } +} + +static inline void +_glamor_dump_pixmap_sword(PixmapPtr pixmap, int x, int y, int w, int h) +{ + int i, j; + unsigned short *p = pixmap->devPrivate.ptr; + int stride = pixmap->devKind / 2; + + p = p + y * stride + x; + + for (i = 0; i < h; i++) { + ErrorF("line %3d: ", i); + for (j = 0; j < w; j++) + ErrorF("%2x ", p[j]); + p += stride; + ErrorF("\n"); + } +} + +static inline void +_glamor_dump_pixmap_word(PixmapPtr pixmap, int x, int y, int w, int h) +{ + int i, j; + unsigned int *p = pixmap->devPrivate.ptr; + int stride = pixmap->devKind / 4; + + p = p + y * stride + x; + + for (i = 0; i < h; i++) { + ErrorF("line %3d: ", i); + for (j = 0; j < w; j++) + ErrorF("%2x ", p[j]); + p += stride; + ErrorF("\n"); + } +} + +static inline void +glamor_dump_pixmap(PixmapPtr pixmap, int x, int y, int w, int h) +{ + w = ((x + w) > pixmap->drawable.width) ? (pixmap->drawable.width - x) : w; + h = ((y + h) > pixmap->drawable.height) ? (pixmap->drawable.height - y) : h; + + glamor_prepare_access(&pixmap->drawable, GLAMOR_ACCESS_RO); + switch (pixmap->drawable.depth) { + case 8: + _glamor_dump_pixmap_byte(pixmap, x, y, w, h); + break; + case 15: + case 16: + _glamor_dump_pixmap_sword(pixmap, x, y, w, h); + break; + + case 24: + case 32: + _glamor_dump_pixmap_word(pixmap, x, y, w, h); + break; + case 1: + _glamor_dump_pixmap_bits(pixmap, x, y, w, h); + break; + default: + ErrorF("dump depth %d, not implemented.\n", pixmap->drawable.depth); + } + glamor_finish_access(&pixmap->drawable); +} + +static inline void +_glamor_compare_pixmaps(PixmapPtr pixmap1, PixmapPtr pixmap2, + int x, int y, int w, int h, + PictFormatShort short_format, int all, int diffs) +{ + int i, j; + unsigned char *p1 = pixmap1->devPrivate.ptr; + unsigned char *p2 = pixmap2->devPrivate.ptr; + int line_need_printed = 0; + int test_code = 0xAABBCCDD; + int little_endian = 0; + unsigned char *p_test; + int bpp = pixmap1->drawable.depth == 8 ? 1 : 4; + int stride = pixmap1->devKind; + + assert(pixmap1->devKind == pixmap2->devKind); + + ErrorF("stride:%d, width:%d, height:%d\n", stride, w, h); + + p1 = p1 + y * stride + x; + p2 = p2 + y * stride + x; + + if (all) { + for (i = 0; i < h; i++) { + ErrorF("line %3d: ", i); + + for (j = 0; j < stride; j++) { + if (j % bpp == 0) + ErrorF("[%d]%2x:%2x ", j / bpp, p1[j], p2[j]); + else + ErrorF("%2x:%2x ", p1[j], p2[j]); + } + + p1 += stride; + p2 += stride; + ErrorF("\n"); + } + } + else { + if (short_format == PICT_a8r8g8b8) { + p_test = (unsigned char *) &test_code; + little_endian = (*p_test == 0xDD); + bpp = 4; + + for (i = 0; i < h; i++) { + line_need_printed = 0; + + for (j = 0; j < stride; j++) { + if (p1[j] != p2[j] && + (p1[j] - p2[j] > diffs || p2[j] - p1[j] > diffs)) { + if (line_need_printed) { + if (little_endian) { + switch (j % 4) { + case 2: + ErrorF("[%d]RED:%2x:%2x ", j / bpp, p1[j], + p2[j]); + break; + case 1: + ErrorF("[%d]GREEN:%2x:%2x ", j / bpp, p1[j], + p2[j]); + break; + case 0: + ErrorF("[%d]BLUE:%2x:%2x ", j / bpp, p1[j], + p2[j]); + break; + case 3: + ErrorF("[%d]Alpha:%2x:%2x ", j / bpp, p1[j], + p2[j]); + break; + } + } + else { + switch (j % 4) { + case 1: + ErrorF("[%d]RED:%2x:%2x ", j / bpp, p1[j], + p2[j]); + break; + case 2: + ErrorF("[%d]GREEN:%2x:%2x ", j / bpp, p1[j], + p2[j]); + break; + case 3: + ErrorF("[%d]BLUE:%2x:%2x ", j / bpp, p1[j], + p2[j]); + break; + case 0: + ErrorF("[%d]Alpha:%2x:%2x ", j / bpp, p1[j], + p2[j]); + break; + } + } + } + else { + line_need_printed = 1; + j = -1; + ErrorF("line %3d: ", i); + continue; + } + } + } + + p1 += stride; + p2 += stride; + ErrorF("\n"); + } + } //more format can be added here. + else { // the default format, just print. + for (i = 0; i < h; i++) { + line_need_printed = 0; + + for (j = 0; j < stride; j++) { + if (p1[j] != p2[j]) { + if (line_need_printed) { + ErrorF("[%d]%2x:%2x ", j / bpp, p1[j], p2[j]); + } + else { + line_need_printed = 1; + j = -1; + ErrorF("line %3d: ", i); + continue; + } + } + } + + p1 += stride; + p2 += stride; + ErrorF("\n"); + } + } + } +} + +static inline void +glamor_compare_pixmaps(PixmapPtr pixmap1, PixmapPtr pixmap2, + int x, int y, int w, int h, int all, int diffs) +{ + assert(pixmap1->drawable.depth == pixmap2->drawable.depth); + + if (glamor_prepare_access(&pixmap1->drawable, GLAMOR_ACCESS_RO) && + glamor_prepare_access(&pixmap2->drawable, GLAMOR_ACCESS_RO)) { + _glamor_compare_pixmaps(pixmap1, pixmap2, x, y, w, h, -1, all, diffs); + } + glamor_finish_access(&pixmap1->drawable); + glamor_finish_access(&pixmap2->drawable); +} + +/* This function is used to compare two pictures. + If the picture has no drawable, we use fb functions to generate it. */ +static inline void +glamor_compare_pictures(ScreenPtr screen, + PicturePtr fst_picture, + PicturePtr snd_picture, + int x_source, int y_source, + int width, int height, int all, int diffs) +{ + PixmapPtr fst_pixmap; + PixmapPtr snd_pixmap; + int fst_generated, snd_generated; + int error; + int fst_type = -1; + int snd_type = -1; // -1 represent has drawable. + + if (fst_picture->format != snd_picture->format) { + ErrorF("Different picture format can not compare!\n"); + return; + } + + if (!fst_picture->pDrawable) { + fst_type = fst_picture->pSourcePict->type; + } + + if (!snd_picture->pDrawable) { + snd_type = snd_picture->pSourcePict->type; + } + + if ((fst_type != -1) && (snd_type != -1) && (fst_type != snd_type)) { + ErrorF("Different picture type will never be same!\n"); + return; + } + + fst_generated = snd_generated = 0; + + if (!fst_picture->pDrawable) { + PicturePtr pixman_pic; + PixmapPtr pixmap = NULL; + PictFormatShort format; + + format = fst_picture->format; + + pixmap = glamor_create_pixmap(screen, + width, height, + PIXMAN_FORMAT_DEPTH(format), + GLAMOR_CREATE_PIXMAP_CPU); + + pixman_pic = CreatePicture(0, + &pixmap->drawable, + PictureMatchFormat(screen, + PIXMAN_FORMAT_DEPTH + (format), format), 0, 0, + serverClient, &error); + + fbComposite(PictOpSrc, fst_picture, NULL, pixman_pic, + x_source, y_source, 0, 0, 0, 0, width, height); + + glamor_destroy_pixmap(pixmap); + + fst_picture = pixman_pic; + fst_generated = 1; + } + + if (!snd_picture->pDrawable) { + PicturePtr pixman_pic; + PixmapPtr pixmap = NULL; + PictFormatShort format; + + format = snd_picture->format; + + pixmap = glamor_create_pixmap(screen, + width, height, + PIXMAN_FORMAT_DEPTH(format), + GLAMOR_CREATE_PIXMAP_CPU); + + pixman_pic = CreatePicture(0, + &pixmap->drawable, + PictureMatchFormat(screen, + PIXMAN_FORMAT_DEPTH + (format), format), 0, 0, + serverClient, &error); + + fbComposite(PictOpSrc, snd_picture, NULL, pixman_pic, + x_source, y_source, 0, 0, 0, 0, width, height); + + glamor_destroy_pixmap(pixmap); + + snd_picture = pixman_pic; + snd_generated = 1; + } + + fst_pixmap = glamor_get_drawable_pixmap(fst_picture->pDrawable); + snd_pixmap = glamor_get_drawable_pixmap(snd_picture->pDrawable); + + if (fst_pixmap->drawable.depth != snd_pixmap->drawable.depth) { + if (fst_generated) + glamor_destroy_picture(fst_picture); + if (snd_generated) + glamor_destroy_picture(snd_picture); + + ErrorF("Different pixmap depth can not compare!\n"); + return; + } + + if ((fst_type == SourcePictTypeLinear) || + (fst_type == SourcePictTypeRadial) || + (fst_type == SourcePictTypeConical) || + (snd_type == SourcePictTypeLinear) || + (snd_type == SourcePictTypeRadial) || + (snd_type == SourcePictTypeConical)) { + x_source = y_source = 0; + } + + if (glamor_prepare_access(&fst_pixmap->drawable, GLAMOR_ACCESS_RO) && + glamor_prepare_access(&snd_pixmap->drawable, GLAMOR_ACCESS_RO)) { + _glamor_compare_pixmaps(fst_pixmap, snd_pixmap, + x_source, y_source, + width, height, fst_picture->format, + all, diffs); + } + glamor_finish_access(&fst_pixmap->drawable); + glamor_finish_access(&snd_pixmap->drawable); + + if (fst_generated) + glamor_destroy_picture(fst_picture); + if (snd_generated) + glamor_destroy_picture(snd_picture); + + return; +} + +#ifdef __i386__ +static inline unsigned long +__fls(unsigned long x) +{ + asm("bsr %1,%0":"=r"(x) + : "rm"(x)); + return x; +} +#else +static inline unsigned long +__fls(unsigned long x) +{ + int n; + + if (x == 0) + return (0); + n = 0; + if (x <= 0x0000FFFF) { + n = n + 16; + x = x << 16; + } + if (x <= 0x00FFFFFF) { + n = n + 8; + x = x << 8; + } + if (x <= 0x0FFFFFFF) { + n = n + 4; + x = x << 4; + } + if (x <= 0x3FFFFFFF) { + n = n + 2; + x = x << 2; + } + if (x <= 0x7FFFFFFF) { + n = n + 1; + } + return 31 - n; +} +#endif + +static inline void +glamor_make_current(glamor_screen_private *glamor_priv) +{ + if (lastGLContext != &glamor_priv->ctx) { + lastGLContext = &glamor_priv->ctx; + glamor_priv->ctx.make_current(&glamor_priv->ctx); + } +} + +#endif diff --git a/xserver/glamor/glamor_vbo.c b/xserver/glamor/glamor_vbo.c new file mode 100644 index 000000000..e90610102 --- /dev/null +++ b/xserver/glamor/glamor_vbo.c @@ -0,0 +1,177 @@ +/* + * Copyright © 2014 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +/** + * @file glamor_vbo.c + * + * Helpers for managing streamed vertex bufffers used in glamor. + */ + +#include "glamor_priv.h" + +/** Default size of the VBO, in bytes. + * + * If a single request is larger than this size, we'll resize the VBO + * and return an appropriate mapping, but we'll resize back down after + * that to avoid hogging that memory forever. We don't anticipate + * normal usage actually requiring larger VBO sizes. + */ +#define GLAMOR_VBO_SIZE (512 * 1024) + +/** + * Returns a pointer to @size bytes of VBO storage, which should be + * accessed by the GL using vbo_offset within the VBO. + */ +void * +glamor_get_vbo_space(ScreenPtr screen, unsigned size, char **vbo_offset) +{ + glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); + void *data; + + glamor_make_current(glamor_priv); + + glBindBuffer(GL_ARRAY_BUFFER, glamor_priv->vbo); + + if (glamor_priv->has_buffer_storage) { + if (glamor_priv->vbo_size < glamor_priv->vbo_offset + size) { + if (glamor_priv->vbo_size) + glUnmapBuffer(GL_ARRAY_BUFFER); + + if (size > glamor_priv->vbo_size) { + glamor_priv->vbo_size = MAX(GLAMOR_VBO_SIZE, size); + + /* We aren't allowed to resize glBufferStorage() + * buffers, so we need to gen a new one. + */ + glDeleteBuffers(1, &glamor_priv->vbo); + glGenBuffers(1, &glamor_priv->vbo); + glBindBuffer(GL_ARRAY_BUFFER, glamor_priv->vbo); + + assert(glGetError() == GL_NO_ERROR); + glBufferStorage(GL_ARRAY_BUFFER, glamor_priv->vbo_size, NULL, + GL_MAP_WRITE_BIT | + GL_MAP_PERSISTENT_BIT | + GL_MAP_COHERENT_BIT); + + if (glGetError() != GL_NO_ERROR) { + /* If the driver failed our coherent mapping, fall + * back to the ARB_mbr path. + */ + glamor_priv->has_buffer_storage = false; + glamor_priv->vbo_size = 0; + + return glamor_get_vbo_space(screen, size, vbo_offset); + } + } + + glamor_priv->vbo_offset = 0; + glamor_priv->vb = glMapBufferRange(GL_ARRAY_BUFFER, + 0, glamor_priv->vbo_size, + GL_MAP_WRITE_BIT | + GL_MAP_INVALIDATE_BUFFER_BIT | + GL_MAP_PERSISTENT_BIT | + GL_MAP_COHERENT_BIT); + } + *vbo_offset = (void *)(uintptr_t)glamor_priv->vbo_offset; + data = glamor_priv->vb + glamor_priv->vbo_offset; + glamor_priv->vbo_offset += size; + } else if (glamor_priv->has_map_buffer_range) { + if (glamor_priv->vbo_size < glamor_priv->vbo_offset + size) { + glamor_priv->vbo_size = MAX(GLAMOR_VBO_SIZE, size); + glamor_priv->vbo_offset = 0; + glBufferData(GL_ARRAY_BUFFER, + glamor_priv->vbo_size, NULL, GL_STREAM_DRAW); + } + + data = glMapBufferRange(GL_ARRAY_BUFFER, + glamor_priv->vbo_offset, + size, + GL_MAP_WRITE_BIT | + GL_MAP_UNSYNCHRONIZED_BIT | + GL_MAP_INVALIDATE_RANGE_BIT); + assert(data != NULL); + *vbo_offset = (char *)(uintptr_t)glamor_priv->vbo_offset; + glamor_priv->vbo_offset += size; + } else { + /* Return a pointer to the statically allocated non-VBO + * memory. We'll upload it through glBufferData() later. + */ + if (glamor_priv->vbo_size < size) { + glamor_priv->vbo_size = MAX(GLAMOR_VBO_SIZE, size); + free(glamor_priv->vb); + glamor_priv->vb = XNFalloc(glamor_priv->vbo_size); + } + *vbo_offset = NULL; + /* We point to the start of glamor_priv->vb every time, and + * the vbo_offset determines the size of the glBufferData(). + */ + glamor_priv->vbo_offset = size; + data = glamor_priv->vb; + } + + return data; +} + +void +glamor_put_vbo_space(ScreenPtr screen) +{ + glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); + + glamor_make_current(glamor_priv); + + if (glamor_priv->has_buffer_storage) { + /* If we're in the ARB_buffer_storage path, we have a + * persistent mapping, so we can leave it around until we + * reach the end of the buffer. + */ + } else if (glamor_priv->has_map_buffer_range) { + glUnmapBuffer(GL_ARRAY_BUFFER); + } else { + glBufferData(GL_ARRAY_BUFFER, glamor_priv->vbo_offset, + glamor_priv->vb, GL_DYNAMIC_DRAW); + } + + glBindBuffer(GL_ARRAY_BUFFER, 0); +} + +void +glamor_init_vbo(ScreenPtr screen) +{ + glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); + + glamor_make_current(glamor_priv); + + glGenBuffers(1, &glamor_priv->vbo); +} + +void +glamor_fini_vbo(ScreenPtr screen) +{ + glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); + + glamor_make_current(glamor_priv); + + glDeleteBuffers(1, &glamor_priv->vbo); + if (!glamor_priv->has_map_buffer_range) + free(glamor_priv->vb); +} diff --git a/xserver/glamor/glamor_window.c b/xserver/glamor/glamor_window.c new file mode 100644 index 000000000..60647bf80 --- /dev/null +++ b/xserver/glamor/glamor_window.c @@ -0,0 +1,99 @@ +/* + * Copyright © 2008 Intel Corporation + * Copyright © 1998 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Keith Packard not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Keith Packard makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#include "glamor_priv.h" + +/** @file glamor_window.c + * + * Screen Change Window Attribute implementation. + */ + +static void +glamor_fixup_window_pixmap(DrawablePtr pDrawable, PixmapPtr *ppPixmap) +{ + PixmapPtr pPixmap = *ppPixmap; + glamor_pixmap_private *pixmap_priv; + + if (pPixmap->drawable.bitsPerPixel != pDrawable->bitsPerPixel) { + pixmap_priv = glamor_get_pixmap_private(pPixmap); + if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv)) { + glamor_fallback("pixmap %p has no fbo\n", pPixmap); + goto fail; + } + glamor_debug_output(GLAMOR_DEBUG_UNIMPL, "To be implemented.\n"); + } + return; + + fail: + GLAMOR_PANIC + (" We can't fall back to fbFixupWindowPixmap, as the fb24_32ReformatTile" + " is broken for glamor. \n"); +} + +Bool +glamor_change_window_attributes(WindowPtr pWin, unsigned long mask) +{ + if (mask & CWBackPixmap) { + if (pWin->backgroundState == BackgroundPixmap) + glamor_fixup_window_pixmap(&pWin->drawable, + &pWin->background.pixmap); + } + + if (mask & CWBorderPixmap) { + if (pWin->borderIsPixel == FALSE) + glamor_fixup_window_pixmap(&pWin->drawable, &pWin->border.pixmap); + } + return TRUE; +} + +void +glamor_set_window_pixmap(WindowPtr win, PixmapPtr pPixmap) +{ + ScreenPtr screen = win->drawable.pScreen; + glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); + PixmapPtr old = screen->GetWindowPixmap(win); + + if (pPixmap != old) { + glamor_pixmap_private *pixmap_priv; + PicturePtr pic = NULL; + + pixmap_priv = glamor_get_pixmap_private(old); + if (GLAMOR_PIXMAP_PRIV_IS_PICTURE(pixmap_priv) && + pixmap_priv->base.picture->pDrawable == (DrawablePtr) win) { + pic = pixmap_priv->base.picture; + pixmap_priv->base.is_picture = 0; + pixmap_priv->base.picture = NULL; + } + + pixmap_priv = glamor_get_pixmap_private(pPixmap); + if (pixmap_priv) { + pixmap_priv->base.is_picture = ! !pic; + pixmap_priv->base.picture = pic; + } + } + + screen->SetWindowPixmap = glamor_priv->saved_procs.set_window_pixmap; + (screen->SetWindowPixmap) (win, pPixmap); + glamor_priv->saved_procs.set_window_pixmap = screen->SetWindowPixmap; + screen->SetWindowPixmap = glamor_set_window_pixmap; +} diff --git a/xserver/glamor/glamor_xv.c b/xserver/glamor/glamor_xv.c new file mode 100644 index 000000000..369b02b61 --- /dev/null +++ b/xserver/glamor/glamor_xv.c @@ -0,0 +1,606 @@ +/* + * Copyright © 2013 Red Hat + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Authors: + * Dave Airlie <airlied@redhat.com> + * + * some code is derived from the xf86-video-ati radeon driver, mainly + * the calculations. + */ + +/** @file glamor_xv.c + * + * Xv acceleration implementation + */ + +#ifdef HAVE_DIX_CONFIG_H +#include <dix-config.h> +#endif + +#include "xf86xv.h" +#define GLAMOR_FOR_XORG +#include "glamor_priv.h" + +#include <X11/extensions/Xv.h> +#include "fourcc.h" +/* Reference color space transform data */ +typedef struct tagREF_TRANSFORM { + float RefLuma; + float RefRCb; + float RefRCr; + float RefGCb; + float RefGCr; + float RefBCb; + float RefBCr; +} REF_TRANSFORM; + +#define RTFSaturation(a) (1.0 + ((a)*1.0)/1000.0) +#define RTFBrightness(a) (((a)*1.0)/2000.0) +#define RTFIntensity(a) (((a)*1.0)/2000.0) +#define RTFContrast(a) (1.0 + ((a)*1.0)/1000.0) +#define RTFHue(a) (((a)*3.1416)/1000.0) + +static const char *xv_vs = "attribute vec4 v_position;\n" + "attribute vec4 v_texcoord0;\n" + "varying vec2 tcs;\n" + "void main()\n" + "{\n" + " gl_Position = v_position;\n" + "tcs = v_texcoord0.xy;\n" + "}\n"; + +static const char *xv_ps = GLAMOR_DEFAULT_PRECISION + "uniform sampler2D y_sampler;\n" + "uniform sampler2D u_sampler;\n" + "uniform sampler2D v_sampler;\n" + "uniform vec4 offsetyco;\n" + "uniform vec4 ucogamma;\n" + "uniform vec4 vco;\n" + "varying vec2 tcs;\n" + "float sample;\n" + "vec4 temp1;\n" + "void main()\n" + "{\n" + "sample = texture2D(y_sampler, tcs).w;\n" + "temp1.xyz = offsetyco.www * vec3(sample) + offsetyco.xyz;\n" + "sample = texture2D(u_sampler, tcs).w;\n" + "temp1.xyz = ucogamma.xyz * vec3(sample) + temp1.xyz;\n" + "sample = texture2D(v_sampler, tcs).w;\n" + "temp1.xyz = clamp(vco.xyz * vec3(sample) + temp1.xyz, 0.0, 1.0);\n" + "temp1.w = 1.0;\n" + "gl_FragColor = temp1;\n" + "}\n"; + +void +glamor_init_xv_shader(ScreenPtr screen) +{ + glamor_screen_private *glamor_priv; + GLint fs_prog, vs_prog; + + glamor_priv = glamor_get_screen_private(screen); + glamor_make_current(glamor_priv); + glamor_priv->xv_prog = glCreateProgram(); + + vs_prog = glamor_compile_glsl_prog(GL_VERTEX_SHADER, xv_vs); + fs_prog = glamor_compile_glsl_prog(GL_FRAGMENT_SHADER, xv_ps); + glAttachShader(glamor_priv->xv_prog, vs_prog); + glAttachShader(glamor_priv->xv_prog, fs_prog); + + glBindAttribLocation(glamor_priv->xv_prog, + GLAMOR_VERTEX_POS, "v_position"); + glBindAttribLocation(glamor_priv->xv_prog, + GLAMOR_VERTEX_SOURCE, "v_texcoord0"); + glamor_link_glsl_prog(screen, glamor_priv->xv_prog, "xv"); +} + +#define ClipValue(v,min,max) ((v) < (min) ? (min) : (v) > (max) ? (max) : (v)) +#define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE) + +static Atom xvBrightness, xvContrast, xvSaturation, xvHue, xvColorspace, + xvGamma; + +#define NUM_ATTRIBUTES 5 +static XF86AttributeRec Attributes_glamor[NUM_ATTRIBUTES + 1] = { + {XvSettable | XvGettable, -1000, 1000, "XV_BRIGHTNESS"}, + {XvSettable | XvGettable, -1000, 1000, "XV_CONTRAST"}, + {XvSettable | XvGettable, -1000, 1000, "XV_SATURATION"}, + {XvSettable | XvGettable, -1000, 1000, "XV_HUE"}, + {XvSettable | XvGettable, 0, 1, "XV_COLORSPACE"}, + {0, 0, 0, NULL} +}; + +#define NUM_FORMATS 3 + +static XF86VideoFormatRec Formats[NUM_FORMATS] = { + {15, TrueColor}, {16, TrueColor}, {24, TrueColor} +}; + +#define NUM_IMAGES 2 + +static XF86ImageRec Images[NUM_IMAGES] = { + XVIMAGE_YV12, + XVIMAGE_I420, +}; + +static void +glamor_xv_stop_video(ScrnInfoPtr pScrn, void *data, Bool cleanup) +{ + glamor_port_private *port_priv = (glamor_port_private *) data; + int i; + + if (!cleanup) + return; + + for (i = 0; i < 3; i++) { + if (port_priv->src_pix[i]) { + glamor_destroy_pixmap(port_priv->src_pix[i]); + port_priv->src_pix[i] = NULL; + } + } +} + +static int +glamor_xv_set_port_attribute(ScrnInfoPtr pScrn, + Atom attribute, INT32 value, void *data) +{ + glamor_port_private *port_priv = (glamor_port_private *) data; + + if (attribute == xvBrightness) + port_priv->brightness = ClipValue(value, -1000, 1000); + else if (attribute == xvHue) + port_priv->hue = ClipValue(value, -1000, 1000); + else if (attribute == xvContrast) + port_priv->contrast = ClipValue(value, -1000, 1000); + else if (attribute == xvSaturation) + port_priv->saturation = ClipValue(value, -1000, 1000); + else if (attribute == xvGamma) + port_priv->gamma = ClipValue(value, 100, 10000); + else if (attribute == xvColorspace) + port_priv->transform_index = ClipValue(value, 0, 1); + else + return BadMatch; + return Success; +} + +static int +glamor_xv_get_port_attribute(ScrnInfoPtr pScrn, + Atom attribute, INT32 *value, void *data) +{ + glamor_port_private *port_priv = (glamor_port_private *) data; + + if (attribute == xvBrightness) + *value = port_priv->brightness; + else if (attribute == xvHue) + *value = port_priv->hue; + else if (attribute == xvContrast) + *value = port_priv->contrast; + else if (attribute == xvSaturation) + *value = port_priv->saturation; + else if (attribute == xvGamma) + *value = port_priv->gamma; + else if (attribute == xvColorspace) + *value = port_priv->transform_index; + else + return BadMatch; + + return Success; +} + +static void +glamor_xv_query_best_size(ScrnInfoPtr pScrn, + Bool motion, + short vid_w, short vid_h, + short drw_w, short drw_h, + unsigned int *p_w, unsigned int *p_h, void *data) +{ + *p_w = drw_w; + *p_h = drw_h; +} + +static int +glamor_xv_query_image_attributes(ScrnInfoPtr pScrn, + int id, + unsigned short *w, unsigned short *h, + int *pitches, int *offsets) +{ + int size = 0, tmp; + + if (offsets) + offsets[0] = 0; + switch (id) { + case FOURCC_YV12: + case FOURCC_I420: + *h = *h; + *w = *w; + size = *w; + if (pitches) + pitches[0] = size; + size *= *h; + if (offsets) + offsets[1] = size; + tmp = *w >> 1; + if (pitches) + pitches[1] = pitches[2] = tmp; + tmp *= (*h >> 1); + size += tmp; + if (offsets) + offsets[2] = size; + size += tmp; + break; + } + return size; +} + +/* Parameters for ITU-R BT.601 and ITU-R BT.709 colour spaces + note the difference to the parameters used in overlay are due + to 10bit vs. float calcs */ +static REF_TRANSFORM trans[2] = { + {1.1643, 0.0, 1.5960, -0.3918, -0.8129, 2.0172, 0.0}, /* BT.601 */ + {1.1643, 0.0, 1.7927, -0.2132, -0.5329, 2.1124, 0.0} /* BT.709 */ +}; + +static void +glamor_display_textured_video(glamor_port_private *port_priv) +{ + ScreenPtr screen = port_priv->pPixmap->drawable.pScreen; + glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); + glamor_pixmap_private *pixmap_priv = + glamor_get_pixmap_private(port_priv->pPixmap); + glamor_pixmap_private *src_pixmap_priv[3]; + float vertices[32], texcoords[8]; + BoxPtr box = REGION_RECTS(&port_priv->clip); + int nBox = REGION_NUM_RECTS(&port_priv->clip); + int dst_x_off, dst_y_off; + GLfloat dst_xscale, dst_yscale; + GLfloat src_xscale[3], src_yscale[3]; + int i; + const float Loff = -0.0627; + const float Coff = -0.502; + float uvcosf, uvsinf; + float yco; + float uco[3], vco[3], off[3]; + float bright, cont, gamma; + int ref = port_priv->transform_index; + GLint uloc, sampler_loc; + + cont = RTFContrast(port_priv->contrast); + bright = RTFBrightness(port_priv->brightness); + gamma = (float) port_priv->gamma / 1000.0; + uvcosf = RTFSaturation(port_priv->saturation) * cos(RTFHue(port_priv->hue)); + uvsinf = RTFSaturation(port_priv->saturation) * sin(RTFHue(port_priv->hue)); +/* overlay video also does pre-gamma contrast/sat adjust, should we? */ + + yco = trans[ref].RefLuma * cont; + uco[0] = -trans[ref].RefRCr * uvsinf; + uco[1] = trans[ref].RefGCb * uvcosf - trans[ref].RefGCr * uvsinf; + uco[2] = trans[ref].RefBCb * uvcosf; + vco[0] = trans[ref].RefRCr * uvcosf; + vco[1] = trans[ref].RefGCb * uvsinf + trans[ref].RefGCr * uvcosf; + vco[2] = trans[ref].RefBCb * uvsinf; + off[0] = Loff * yco + Coff * (uco[0] + vco[0]) + bright; + off[1] = Loff * yco + Coff * (uco[1] + vco[1]) + bright; + off[2] = Loff * yco + Coff * (uco[2] + vco[2]) + bright; + gamma = 1.0; + + pixmap_priv_get_dest_scale(pixmap_priv, &dst_xscale, &dst_yscale); + glamor_get_drawable_deltas(port_priv->pDraw, port_priv->pPixmap, &dst_x_off, + &dst_y_off); + glamor_set_destination_pixmap_priv_nc(pixmap_priv); + + for (i = 0; i < 3; i++) { + if (port_priv->src_pix[i]) { + src_pixmap_priv[i] = + glamor_get_pixmap_private(port_priv->src_pix[i]); + pixmap_priv_get_scale(src_pixmap_priv[i], &src_xscale[i], + &src_yscale[i]); + } + } + glamor_make_current(glamor_priv); + glUseProgram(glamor_priv->xv_prog); + + uloc = glGetUniformLocation(glamor_priv->xv_prog, "offsetyco"); + glUniform4f(uloc, off[0], off[1], off[2], yco); + uloc = glGetUniformLocation(glamor_priv->xv_prog, "ucogamma"); + glUniform4f(uloc, uco[0], uco[1], uco[2], gamma); + uloc = glGetUniformLocation(glamor_priv->xv_prog, "vco"); + glUniform4f(uloc, vco[0], vco[1], vco[2], 0); + + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D, src_pixmap_priv[0]->base.fbo->tex); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + + glActiveTexture(GL_TEXTURE1); + glBindTexture(GL_TEXTURE_2D, src_pixmap_priv[1]->base.fbo->tex); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + + glActiveTexture(GL_TEXTURE2); + glBindTexture(GL_TEXTURE_2D, src_pixmap_priv[2]->base.fbo->tex); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + + sampler_loc = glGetUniformLocation(glamor_priv->xv_prog, "y_sampler"); + glUniform1i(sampler_loc, 0); + sampler_loc = glGetUniformLocation(glamor_priv->xv_prog, "u_sampler"); + glUniform1i(sampler_loc, 1); + sampler_loc = glGetUniformLocation(glamor_priv->xv_prog, "v_sampler"); + glUniform1i(sampler_loc, 2); + + glVertexAttribPointer(GLAMOR_VERTEX_SOURCE, 2, + GL_FLOAT, GL_FALSE, + 2 * sizeof(float), texcoords); + glEnableVertexAttribArray(GLAMOR_VERTEX_SOURCE); + + glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT, + GL_FALSE, 2 * sizeof(float), vertices); + + glEnableVertexAttribArray(GLAMOR_VERTEX_POS); + for (i = 0; i < nBox; i++) { + float off_x = box[i].x1 - port_priv->drw_x; + float off_y = box[i].y1 - port_priv->drw_y; + float diff_x = (float) port_priv->src_w / (float) port_priv->dst_w; + float diff_y = (float) port_priv->src_h / (float) port_priv->dst_h; + float srcx, srcy, srcw, srch; + int dstx, dsty, dstw, dsth; + + dstx = box[i].x1 + dst_x_off; + dsty = box[i].y1 + dst_y_off; + dstw = box[i].x2 - box[i].x1; + dsth = box[i].y2 - box[i].y1; + + srcx = port_priv->src_x + off_x * diff_x; + srcy = port_priv->src_y + off_y * diff_y; + srcw = (port_priv->src_w * dstw) / (float) port_priv->dst_w; + srch = (port_priv->src_h * dsth) / (float) port_priv->dst_h; + + glamor_set_normalize_vcoords(pixmap_priv, + dst_xscale, dst_yscale, + dstx, + dsty, + dstx + dstw, + dsty + dsth, + glamor_priv->yInverted, vertices); + + glamor_set_normalize_tcoords(src_pixmap_priv[0], + src_xscale[0], + src_yscale[0], + srcx, + srcy, + srcx + srcw, + srcy + srch, + glamor_priv->yInverted, texcoords); + + glDrawArrays(GL_TRIANGLE_FAN, 0, 4); + } + + glDisableVertexAttribArray(GLAMOR_VERTEX_POS); + glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE); + + DamageDamageRegion(port_priv->pDraw, &port_priv->clip); +} + +static int +glamor_xv_put_image(ScrnInfoPtr pScrn, + short src_x, short src_y, + short drw_x, short drw_y, + short src_w, short src_h, + short drw_w, short drw_h, + int id, + unsigned char *buf, + short width, + short height, + Bool sync, + RegionPtr clipBoxes, void *data, DrawablePtr pDrawable) +{ + ScreenPtr screen = pDrawable->pScreen; + glamor_port_private *port_priv = (glamor_port_private *) data; + INT32 x1, x2, y1, y2; + int srcPitch, srcPitch2; + BoxRec dstBox; + int top, nlines; + int s2offset, s3offset, tmp; + + s2offset = s3offset = srcPitch2 = 0; + + /* Clip */ + x1 = src_x; + x2 = src_x + src_w; + y1 = src_y; + y2 = src_y + src_h; + + dstBox.x1 = drw_x; + dstBox.x2 = drw_x + drw_w; + dstBox.y1 = drw_y; + dstBox.y2 = drw_y + drw_h; + if (!xf86XVClipVideoHelper + (&dstBox, &x1, &x2, &y1, &y2, clipBoxes, width, height)) + return Success; + + if ((x1 >= x2) || (y1 >= y2)) + return Success; + + srcPitch = width; + srcPitch2 = width >> 1; + + if (!port_priv->src_pix[0] || + (width != port_priv->src_pix_w || height != port_priv->src_pix_h)) { + int i; + + for (i = 0; i < 3; i++) + if (port_priv->src_pix[i]) + glamor_destroy_pixmap(port_priv->src_pix[i]); + + port_priv->src_pix[0] = + glamor_create_pixmap(screen, width, height, 8, 0); + port_priv->src_pix[1] = + glamor_create_pixmap(screen, width >> 1, height >> 1, 8, 0); + port_priv->src_pix[2] = + glamor_create_pixmap(screen, width >> 1, height >> 1, 8, 0); + port_priv->src_pix_w = width; + port_priv->src_pix_h = height; + + if (!port_priv->src_pix[0] || !port_priv->src_pix[1] || + !port_priv->src_pix[2]) + return BadAlloc; + } + + top = (y1 >> 16) & ~1; + nlines = ((y2 + 0xffff) >> 16) - top; + + switch (id) { + case FOURCC_YV12: + case FOURCC_I420: + s2offset = srcPitch * height; + s3offset = s2offset + (srcPitch2 * ((height + 1) >> 1)); + s2offset += ((top >> 1) * srcPitch2); + s3offset += ((top >> 1) * srcPitch2); + if (id == FOURCC_YV12) { + tmp = s2offset; + s2offset = s3offset; + s3offset = tmp; + } + glamor_upload_sub_pixmap_to_texture(port_priv->src_pix[0], + 0, 0, srcPitch, nlines, + port_priv->src_pix[0]->devKind, + buf + (top * srcPitch), 0); + + glamor_upload_sub_pixmap_to_texture(port_priv->src_pix[1], + 0, 0, srcPitch2, (nlines + 1) >> 1, + port_priv->src_pix[1]->devKind, + buf + s2offset, 0); + + glamor_upload_sub_pixmap_to_texture(port_priv->src_pix[2], + 0, 0, srcPitch2, (nlines + 1) >> 1, + port_priv->src_pix[2]->devKind, + buf + s3offset, 0); + break; + default: + return BadMatch; + } + + if (pDrawable->type == DRAWABLE_WINDOW) + port_priv->pPixmap = (*screen->GetWindowPixmap) ((WindowPtr) pDrawable); + else + port_priv->pPixmap = (PixmapPtr) pDrawable; + + if (!RegionEqual(&port_priv->clip, clipBoxes)) { + RegionCopy(&port_priv->clip, clipBoxes); + } + + port_priv->src_x = src_x; + port_priv->src_y = src_y; + port_priv->src_w = src_w; + port_priv->src_h = src_h; + port_priv->dst_w = drw_w; + port_priv->dst_h = drw_h; + port_priv->drw_x = drw_x; + port_priv->drw_y = drw_y; + port_priv->w = width; + port_priv->h = height; + port_priv->pDraw = pDrawable; + glamor_display_textured_video(port_priv); + return Success; +} + +static XF86VideoEncodingRec DummyEncodingGLAMOR[1] = { + { + 0, + "XV_IMAGE", + 8192, 8192, + {1, 1} + } +}; + +XF86VideoAdaptorPtr +glamor_xv_init(ScreenPtr screen, int num_texture_ports) +{ + glamor_port_private *port_priv; + XF86VideoAdaptorPtr adapt; + int i; + + glamor_init_xv_shader(screen); + + adapt = calloc(1, sizeof(XF86VideoAdaptorRec) + num_texture_ports * + (sizeof(glamor_port_private) + sizeof(DevUnion))); + if (adapt == NULL) + return NULL; + + xvBrightness = MAKE_ATOM("XV_BRIGHTNESS"); + xvContrast = MAKE_ATOM("XV_CONTRAST"); + xvSaturation = MAKE_ATOM("XV_SATURATION"); + xvHue = MAKE_ATOM("XV_HUE"); + xvGamma = MAKE_ATOM("XV_GAMMA"); + xvColorspace = MAKE_ATOM("XV_COLORSPACE"); + + adapt->type = XvWindowMask | XvInputMask | XvImageMask; + adapt->flags = 0; + adapt->name = "GLAMOR Textured Video"; + adapt->nEncodings = 1; + adapt->pEncodings = DummyEncodingGLAMOR; + + adapt->nFormats = NUM_FORMATS; + adapt->pFormats = Formats; + adapt->nPorts = num_texture_ports; + adapt->pPortPrivates = (DevUnion *) (&adapt[1]); + + adapt->pAttributes = Attributes_glamor; + adapt->nAttributes = NUM_ATTRIBUTES; + + port_priv = + (glamor_port_private *) (&adapt->pPortPrivates[num_texture_ports]); + adapt->pImages = Images; + adapt->nImages = NUM_IMAGES; + adapt->PutVideo = NULL; + adapt->PutStill = NULL; + adapt->GetVideo = NULL; + adapt->GetStill = NULL; + adapt->StopVideo = glamor_xv_stop_video; + adapt->SetPortAttribute = glamor_xv_set_port_attribute; + adapt->GetPortAttribute = glamor_xv_get_port_attribute; + adapt->QueryBestSize = glamor_xv_query_best_size; + adapt->PutImage = glamor_xv_put_image; + adapt->ReputImage = NULL; + adapt->QueryImageAttributes = glamor_xv_query_image_attributes; + + for (i = 0; i < num_texture_ports; i++) { + glamor_port_private *pPriv = &port_priv[i]; + + pPriv->brightness = 0; + pPriv->contrast = 0; + pPriv->saturation = 0; + pPriv->hue = 0; + pPriv->gamma = 1000; + pPriv->transform_index = 0; + + REGION_NULL(pScreen, &pPriv->clip); + + adapt->pPortPrivates[i].ptr = (void *) (pPriv); + } + return adapt; +} diff --git a/xserver/glx/Makefile.in b/xserver/glx/Makefile.in index 92246a693..b05e41bf5 100644 --- a/xserver/glx/Makefile.in +++ b/xserver/glx/Makefile.in @@ -179,6 +179,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -223,6 +225,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -325,7 +331,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -334,6 +343,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -400,6 +410,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/glx/glxcmds.c b/xserver/glx/glxcmds.c index b8da04882..2fc3f4cc8 100644 --- a/xserver/glx/glxcmds.c +++ b/xserver/glx/glxcmds.c @@ -133,7 +133,7 @@ _X_HIDDEN int validGlxContext(ClientPtr client, XID id, int access_mode, __GLXcontext ** context, int *err) { - *err = dixLookupResourceByType((pointer *) context, id, + *err = dixLookupResourceByType((void **) context, id, __glXContextRes, client, access_mode); if (*err != Success || (*context)->idExists == GL_FALSE) { client->errorValue = id; @@ -151,7 +151,7 @@ validGlxDrawable(ClientPtr client, XID id, int type, int access_mode, { int rc; - rc = dixLookupResourceByType((pointer *) drawable, id, + rc = dixLookupResourceByType((void **) drawable, id, __glXDrawableRes, client, access_mode); if (rc != Success && rc != BadValue) { *err = rc; @@ -188,7 +188,7 @@ validGlxDrawable(ClientPtr client, XID id, int type, int access_mode, void __glXContextDestroy(__GLXcontext * context) { - __glXFlushContextCache(); + lastGLContext = NULL; } static void @@ -275,6 +275,17 @@ DoCreateContext(__GLXclientState * cl, GLXContextID gcId, ** Allocate memory for the new context */ if (!isDirect) { + /* Only allow creating indirect GLX contexts if allowed by + * server command line. Indirect GLX is of limited use (since + * it's only GL 1.4), it's slower than direct contexts, and + * it's a massive attack surface for buffer overflow type + * errors. + */ + if (!enableIndirectGLX) { + client->errorValue = isDirect; + return BadValue; + } + /* Without any attributes, the only error that the driver should be * able to generate is BadAlloc. As result, just drop the error * returned from the driver on the floor. @@ -434,10 +445,6 @@ static void StopUsingContext(__GLXcontext * glxc) { if (glxc) { - if (glxc == __glXLastContext) { - /* Tell server GL library */ - __glXLastContext = 0; - } glxc->currentClient = NULL; if (!glxc->idExists) { FreeResourceByType(glxc->id, __glXContextRes, FALSE); @@ -448,7 +455,6 @@ StopUsingContext(__GLXcontext * glxc) static void StartUsingContext(__GLXclientState * cl, __GLXcontext * glxc) { - __glXLastContext = glxc; glxc->currentClient = cl->client; } @@ -627,7 +633,7 @@ DoMakeCurrent(__GLXclientState * cl, if (!(*prevglxc->loseCurrent) (prevglxc)) { return __glXError(GLXBadContext); } - __glXFlushContextCache(); + lastGLContext = NULL; if (!prevglxc->isDirect) { prevglxc->drawPriv = NULL; prevglxc->readPriv = NULL; @@ -640,7 +646,9 @@ DoMakeCurrent(__GLXclientState * cl, glxc->readPriv = readPriv; /* make the context current */ + lastGLContext = glxc; if (!(*glxc->makeCurrent) (glxc)) { + lastGLContext = NULL; glxc->drawPriv = NULL; glxc->readPriv = NULL; return __glXError(GLXBadContext); @@ -2507,7 +2515,7 @@ __glXpresentCompleteNotify(WindowPtr window, CARD8 present_mode, CARD32 serial, int glx_type; int rc; - rc = dixLookupResourceByType((pointer *) &drawable, window->drawable.id, + rc = dixLookupResourceByType((void **) &drawable, window->drawable.id, __glXDrawableRes, serverClient, DixGetAttrAccess); if (rc != Success) diff --git a/xserver/glx/glxdri2.c b/xserver/glx/glxdri2.c index b2f3d6ee8..c756bf570 100644 --- a/xserver/glx/glxdri2.c +++ b/xserver/glx/glxdri2.c @@ -55,14 +55,9 @@ typedef struct __GLXDRIscreen __GLXDRIscreen; typedef struct __GLXDRIcontext __GLXDRIcontext; typedef struct __GLXDRIdrawable __GLXDRIdrawable; -#ifdef __DRI2_ROBUSTNESS #define ALL_DRI_CTX_FLAGS (__DRI_CTX_FLAG_DEBUG \ | __DRI_CTX_FLAG_FORWARD_COMPATIBLE \ | __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS) -#else -#define ALL_DRI_CTX_FLAGS (__DRI_CTX_FLAG_DEBUG \ - | __DRI_CTX_FLAG_FORWARD_COMPATIBLE) -#endif struct __GLXDRIscreen { __GLXscreen base; @@ -120,55 +115,54 @@ __glXDRIdrawableDestroy(__GLXdrawable * drawable) } static void -__glXDRIdrawableCopySubBuffer(__GLXdrawable * drawable, - int x, int y, int w, int h) +copy_box(__GLXdrawable * drawable, + int dst, int src, + int x, int y, int w, int h) { - __GLXDRIdrawable *private = (__GLXDRIdrawable *) drawable; BoxRec box; RegionRec region; + __GLXcontext *cx = lastGLContext; box.x1 = x; - box.y1 = private->height - y - h; + box.y1 = y; box.x2 = x + w; - box.y2 = private->height - y; + box.y2 = y + h; RegionInit(®ion, &box, 0); - DRI2CopyRegion(drawable->pDraw, ®ion, - DRI2BufferFrontLeft, DRI2BufferBackLeft); + DRI2CopyRegion(drawable->pDraw, ®ion, dst, src); + if (cx != lastGLContext) { + lastGLContext = cx; + cx->makeCurrent(cx); + } } static void -__glXDRIdrawableWaitX(__GLXdrawable * drawable) +__glXDRIdrawableCopySubBuffer(__GLXdrawable * drawable, + int x, int y, int w, int h) { __GLXDRIdrawable *private = (__GLXDRIdrawable *) drawable; - BoxRec box; - RegionRec region; - box.x1 = 0; - box.y1 = 0; - box.x2 = private->width; - box.y2 = private->height; - RegionInit(®ion, &box, 0); + copy_box(drawable, x, private->height - y - h, + w, h, + DRI2BufferFrontLeft, DRI2BufferBackLeft); +} - DRI2CopyRegion(drawable->pDraw, ®ion, - DRI2BufferFakeFrontLeft, DRI2BufferFrontLeft); +static void +__glXDRIdrawableWaitX(__GLXdrawable * drawable) +{ + __GLXDRIdrawable *private = (__GLXDRIdrawable *) drawable; + + copy_box(drawable, DRI2BufferFakeFrontLeft, DRI2BufferFrontLeft, + 0, 0, private->width, private->height); } static void __glXDRIdrawableWaitGL(__GLXdrawable * drawable) { __GLXDRIdrawable *private = (__GLXDRIdrawable *) drawable; - BoxRec box; - RegionRec region; - - box.x1 = 0; - box.y1 = 0; - box.x2 = private->width; - box.y2 = private->height; - RegionInit(®ion, &box, 0); - DRI2CopyRegion(drawable->pDraw, ®ion, - DRI2BufferFrontLeft, DRI2BufferFakeFrontLeft); + copy_box(drawable, DRI2BufferFrontLeft, DRI2BufferFakeFrontLeft, + 0, 0, private->width, private->height); } static void @@ -209,31 +203,37 @@ __glXDRIdrawableSwapBuffers(ClientPtr client, __GLXdrawable * drawable) __GLXDRIdrawable *priv = (__GLXDRIdrawable *) drawable; __GLXDRIscreen *screen = priv->screen; CARD64 unused; + __GLXcontext *cx = lastGLContext; + int status; -#if __DRI2_FLUSH_VERSION >= 3 if (screen->flush) { (*screen->flush->flush) (priv->driDrawable); (*screen->flush->invalidate) (priv->driDrawable); } -#else - if (screen->flush) - (*screen->flush->flushInvalidate) (priv->driDrawable); -#endif - if (DRI2SwapBuffers(client, drawable->pDraw, 0, 0, 0, &unused, - __glXdriSwapEvent, drawable) != Success) - return FALSE; + status = DRI2SwapBuffers(client, drawable->pDraw, 0, 0, 0, &unused, + __glXdriSwapEvent, drawable); + if (cx != lastGLContext) { + lastGLContext = cx; + cx->makeCurrent(cx); + } - return TRUE; + return status == Success; } static int __glXDRIdrawableSwapInterval(__GLXdrawable * drawable, int interval) { + __GLXcontext *cx = lastGLContext; + if (interval <= 0) /* || interval > BIGNUM? */ return GLX_BAD_VALUE; DRI2SwapInterval(drawable->pDraw, interval); + if (cx != lastGLContext) { + lastGLContext = cx; + cx->makeCurrent(cx); + } return 0; } @@ -286,7 +286,16 @@ static Bool __glXDRIcontextWait(__GLXcontext * baseContext, __GLXclientState * cl, int *error) { - if (DRI2WaitSwap(cl->client, baseContext->drawPriv->pDraw)) { + __GLXcontext *cx = lastGLContext; + Bool ret; + + ret = DRI2WaitSwap(cl->client, baseContext->drawPriv->pDraw); + if (cx != lastGLContext) { + lastGLContext = cx; + cx->makeCurrent(cx); + } + + if (ret) { *error = cl->client->noClientException; return TRUE; } @@ -294,8 +303,6 @@ __glXDRIcontextWait(__GLXcontext * baseContext, return FALSE; } -#ifdef __DRI_TEX_BUFFER - static int __glXDRIbindTexImage(__GLXcontext * baseContext, int buffer, __GLXdrawable * glxPixmap) @@ -307,14 +314,12 @@ __glXDRIbindTexImage(__GLXcontext * baseContext, if (texBuffer == NULL) return Success; -#if __DRI_TEX_BUFFER_VERSION >= 2 if (texBuffer->base.version >= 2 && texBuffer->setTexBuffer2 != NULL) { (*texBuffer->setTexBuffer2) (context->driContext, glxPixmap->target, glxPixmap->format, drawable->driDrawable); } else -#endif { texBuffer->setTexBuffer(context->driContext, glxPixmap->target, drawable->driDrawable); @@ -331,24 +336,6 @@ __glXDRIreleaseTexImage(__GLXcontext * baseContext, return Success; } -#else - -static int -__glXDRIbindTexImage(__GLXcontext * baseContext, - int buffer, __GLXdrawable * glxPixmap) -{ - return Success; -} - -static int -__glXDRIreleaseTexImage(__GLXcontext * baseContext, - int buffer, __GLXdrawable * pixmap) -{ - return Success; -} - -#endif - static __GLXtextureFromPixmap __glXDRItextureFromPixmap = { __glXDRIbindTexImage, __glXDRIreleaseTexImage @@ -398,11 +385,7 @@ dri2_convert_glx_attribs(__GLXDRIscreen *screen, unsigned num_attribs, *major_ver = 1; *minor_ver = 0; -#ifdef __DRI2_ROBUSTNESS *reset = __DRI_CTX_RESET_NO_NOTIFICATION; -#else - (void) reset; -#endif for (i = 0; i < num_attribs; i++) { switch (attribs[i * 2]) { @@ -433,7 +416,6 @@ dri2_convert_glx_attribs(__GLXDRIscreen *screen, unsigned num_attribs, return False; } break; -#ifdef __DRI2_ROBUSTNESS case GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB: if (screen->dri2->base.version >= 4) { *error = BadValue; @@ -452,7 +434,6 @@ dri2_convert_glx_attribs(__GLXDRIscreen *screen, unsigned num_attribs, return False; } break; -#endif default: /* If an unknown attribute is received, fail. */ @@ -493,14 +474,13 @@ create_driver_context(__GLXDRIcontext * context, { context->driContext = NULL; -#if __DRI_DRI2_VERSION >= 3 if (screen->dri2->base.version >= 3) { uint32_t ctx_attribs[3 * 2]; unsigned num_ctx_attribs = 0; unsigned dri_err = 0; unsigned major_ver; unsigned minor_ver; - uint32_t flags; + uint32_t flags = 0; int reset; int api = __DRI_API_OPENGL; @@ -525,13 +505,11 @@ create_driver_context(__GLXDRIcontext * context, ctx_attribs[num_ctx_attribs++] = flags; } -#ifdef __DRI2_ROBUSTNESS if (reset != __DRI_CTX_RESET_NO_NOTIFICATION) { ctx_attribs[num_ctx_attribs++] = __DRI_CTX_ATTRIB_RESET_STRATEGY; ctx_attribs[num_ctx_attribs++] = reset; } -#endif } context->driContext = @@ -567,7 +545,6 @@ create_driver_context(__GLXDRIcontext * context, return; } -#endif if (num_attribs != 0) { *error = BadValue; @@ -625,13 +602,11 @@ __glXDRIscreenCreateContext(__GLXscreen * baseScreen, static void __glXDRIinvalidateBuffers(DrawablePtr pDraw, void *priv, XID id) { -#if __DRI2_FLUSH_VERSION >= 3 __GLXDRIdrawable *private = priv; __GLXDRIscreen *screen = private->screen; if (screen->flush) (*screen->flush->invalidate) (private->driDrawable); -#endif } static __GLXdrawable * @@ -644,6 +619,8 @@ __glXDRIscreenCreateDrawable(ClientPtr client, __GLXDRIscreen *driScreen = (__GLXDRIscreen *) screen; __GLXDRIconfig *config = (__GLXDRIconfig *) glxConfig; __GLXDRIdrawable *private; + __GLXcontext *cx = lastGLContext; + Bool ret; private = calloc(1, sizeof *private); if (private == NULL) @@ -662,9 +639,15 @@ __glXDRIscreenCreateDrawable(ClientPtr client, private->base.waitGL = __glXDRIdrawableWaitGL; private->base.waitX = __glXDRIdrawableWaitX; - if (DRI2CreateDrawable2(client, pDraw, drawId, - __glXDRIinvalidateBuffers, private, - &private->dri2_id)) { + ret = DRI2CreateDrawable2(client, pDraw, drawId, + __glXDRIinvalidateBuffers, private, + &private->dri2_id); + if (cx != lastGLContext) { + lastGLContext = cx; + cx->makeCurrent(cx); + } + + if (ret) { free(private); return NULL; } @@ -686,9 +669,22 @@ dri2GetBuffers(__DRIdrawable * driDrawable, DRI2BufferPtr *buffers; int i; int j; + __GLXcontext *cx = lastGLContext; buffers = DRI2GetBuffers(private->base.pDraw, width, height, attachments, count, out_count); + if (cx != lastGLContext) { + lastGLContext = cx; + cx->makeCurrent(cx); + + /* If DRI2GetBuffers() changed the GL context, it may also have + * invalidated the DRI2 buffers, so let's get them again + */ + buffers = DRI2GetBuffers(private->base.pDraw, + width, height, attachments, count, out_count); + assert(lastGLContext == cx); + } + if (*out_count > MAX_DRAWABLE_BUFFERS) { *out_count = 0; return NULL; @@ -730,10 +726,24 @@ dri2GetBuffersWithFormat(__DRIdrawable * driDrawable, DRI2BufferPtr *buffers; int i; int j = 0; + __GLXcontext *cx = lastGLContext; buffers = DRI2GetBuffersWithFormat(private->base.pDraw, width, height, attachments, count, out_count); + if (cx != lastGLContext) { + lastGLContext = cx; + cx->makeCurrent(cx); + + /* If DRI2GetBuffersWithFormat() changed the GL context, it may also have + * invalidated the DRI2 buffers, so let's get them again + */ + buffers = DRI2GetBuffersWithFormat(private->base.pDraw, + width, height, attachments, count, + out_count); + assert(lastGLContext == cx); + } + if (*out_count > MAX_DRAWABLE_BUFFERS) { *out_count = 0; return NULL; @@ -778,18 +788,14 @@ static const __DRIdri2LoaderExtension loaderExtension = { dri2GetBuffersWithFormat, }; -#ifdef __DRI_USE_INVALIDATE static const __DRIuseInvalidateExtension dri2UseInvalidate = { {__DRI_USE_INVALIDATE, 1} }; -#endif static const __DRIextension *loader_extensions[] = { &systemTimeExtension.base, &loaderExtension.base, -#ifdef __DRI_USE_INVALIDATE &dri2UseInvalidate.base, -#endif NULL }; @@ -850,8 +856,6 @@ initializeExtensions(__GLXDRIscreen * screen) __glXEnableExtension(screen->glx_enable_bits, "GLX_MESA_copy_sub_buffer"); LogMessage(X_INFO, "AIGLX: enabled GLX_MESA_copy_sub_buffer\n"); - -#if __DRI_DRI2_VERSION >= 3 if (screen->dri2->base.version >= 3) { __glXEnableExtension(screen->glx_enable_bits, "GLX_ARB_create_context"); @@ -864,7 +868,6 @@ initializeExtensions(__GLXDRIscreen * screen) LogMessage(X_INFO, "AIGLX: enabled GLX_EXT_create_context_es2_profile\n"); } -#endif if (DRI2HasSwapControl(pScreen)) { __glXEnableExtension(screen->glx_enable_bits, "GLX_INTEL_swap_event"); @@ -889,32 +892,25 @@ initializeExtensions(__GLXDRIscreen * screen) } for (i = 0; extensions[i]; i++) { -#ifdef __DRI_READ_DRAWABLE if (strcmp(extensions[i]->name, __DRI_READ_DRAWABLE) == 0) { __glXEnableExtension(screen->glx_enable_bits, "GLX_SGI_make_current_read"); LogMessage(X_INFO, "AIGLX: enabled GLX_SGI_make_current_read\n"); } -#endif -#ifdef __DRI_TEX_BUFFER if (strcmp(extensions[i]->name, __DRI_TEX_BUFFER) == 0) { screen->texBuffer = (const __DRItexBufferExtension *) extensions[i]; /* GLX_EXT_texture_from_pixmap is always enabled. */ LogMessage(X_INFO, "AIGLX: GLX_EXT_texture_from_pixmap backed by buffer objects\n"); } -#endif -#ifdef __DRI2_FLUSH if (strcmp(extensions[i]->name, __DRI2_FLUSH) == 0 && extensions[i]->version >= 3) { screen->flush = (__DRI2flushExtension *) extensions[i]; } -#endif -#ifdef __DRI2_ROBUSTNESS if (strcmp(extensions[i]->name, __DRI2_ROBUSTNESS) == 0 && screen->dri2->base.version >= 3) { __glXEnableExtension(screen->glx_enable_bits, @@ -922,7 +918,6 @@ initializeExtensions(__GLXDRIscreen * screen) LogMessage(X_INFO, "AIGLX: enabled GLX_ARB_create_context_robustness\n"); } -#endif /* Ignore unknown extensions */ } diff --git a/xserver/glx/glxdricommon.c b/xserver/glx/glxdricommon.c index a97d027a8..62cce131d 100644 --- a/xserver/glx/glxdricommon.c +++ b/xserver/glx/glxdricommon.c @@ -226,7 +226,7 @@ glxConvertConfigs(const __DRIcoreExtension * core, } for (i = 0; configs[i]; i++) { - int renderType = 0; + unsigned int renderType = 0; if (core->getConfigAttrib(configs[i], __DRI_ATTRIB_RENDER_TYPE, &renderType)) { if (render_type_is_pbuffer_only(renderType) && diff --git a/xserver/glx/glxdriswrast.c b/xserver/glx/glxdriswrast.c index cbc109a6d..c30ce9aed 100644 --- a/xserver/glx/glxdriswrast.c +++ b/xserver/glx/glxdriswrast.c @@ -170,8 +170,6 @@ __glXDRIcontextCopy(__GLXcontext * baseDst, __GLXcontext * baseSrc, src->driContext, mask); } -#ifdef __DRI_TEX_BUFFER - static int __glXDRIbindTexImage(__GLXcontext * baseContext, int buffer, __GLXdrawable * glxPixmap) @@ -205,24 +203,6 @@ __glXDRIreleaseTexImage(__GLXcontext * baseContext, return Success; } -#else - -static int -__glXDRIbindTexImage(__GLXcontext * baseContext, - int buffer, __GLXdrawable * glxPixmap) -{ - return Success; -} - -static int -__glXDRIreleaseTexImage(__GLXcontext * baseContext, - int buffer, __GLXdrawable * pixmap) -{ - return Success; -} - -#endif - static __GLXtextureFromPixmap __glXDRItextureFromPixmap = { __glXDRIbindTexImage, __glXDRIreleaseTexImage @@ -357,6 +337,7 @@ swrastPutImage(__DRIdrawable * draw, int op, __GLXDRIdrawable *drawable = loaderPrivate; DrawablePtr pDraw = drawable->base.pDraw; GCPtr gc; + __GLXcontext *cx = lastGLContext; switch (op) { case __DRI_SWRAST_IMAGE_OP_DRAW: @@ -372,6 +353,10 @@ swrastPutImage(__DRIdrawable * draw, int op, ValidateGC(pDraw, gc); gc->ops->PutImage(pDraw, gc, pDraw->depth, x, y, w, h, 0, ZPixmap, data); + if (cx != lastGLContext) { + lastGLContext = cx; + cx->makeCurrent(cx); + } } static void @@ -381,8 +366,13 @@ swrastGetImage(__DRIdrawable * draw, __GLXDRIdrawable *drawable = loaderPrivate; DrawablePtr pDraw = drawable->base.pDraw; ScreenPtr pScreen = pDraw->pScreen; + __GLXcontext *cx = lastGLContext; pScreen->GetImage(pDraw, x, y, w, h, ZPixmap, ~0L, data); + if (cx != lastGLContext) { + lastGLContext = cx; + cx->makeCurrent(cx); + } } static const __DRIswrastLoaderExtension swrastLoaderExtension = { @@ -407,20 +397,17 @@ initializeExtensions(__GLXDRIscreen * screen) extensions = screen->core->getExtensions(screen->driScreen); for (i = 0; extensions[i]; i++) { -#ifdef __DRI_COPY_SUB_BUFFER if (strcmp(extensions[i]->name, __DRI_COPY_SUB_BUFFER) == 0) { screen->copySubBuffer = (const __DRIcopySubBufferExtension *) extensions[i]; /* GLX_MESA_copy_sub_buffer is always enabled. */ } -#endif -#ifdef __DRI_TEX_BUFFER if (strcmp(extensions[i]->name, __DRI_TEX_BUFFER) == 0) { screen->texBuffer = (const __DRItexBufferExtension *) extensions[i]; /* GLX_EXT_texture_from_pixmap is always enabled. */ } -#endif + /* Ignore unknown extensions */ } } diff --git a/xserver/glx/glxext.c b/xserver/glx/glxext.c index 316b4f6e8..c2de3cedd 100644 --- a/xserver/glx/glxext.c +++ b/xserver/glx/glxext.c @@ -48,12 +48,6 @@ #include "indirect_util.h" /* -** The last context used by the server. It is the context that is current -** from the server's perspective. -*/ -__GLXcontext *__glXLastContext; - -/* ** X resources. */ RESTYPE __glXContextRes; @@ -79,7 +73,7 @@ static int __glXDispatch(ClientPtr); static void ResetExtension(ExtensionEntry * extEntry) { - __glXFlushContextCache(); + lastGLContext = NULL; } /* @@ -141,8 +135,7 @@ DrawableGone(__GLXdrawable * glxPriv, XID xid) (c->drawPriv == glxPriv || c->readPriv == glxPriv)) { /* just force a re-bind the next time through */ (*c->loseCurrent) (c); - if (c == __glXLastContext) - __glXFlushContextCache(); + lastGLContext = NULL; } if (c->drawPriv == glxPriv) c->drawPriv = NULL; @@ -164,7 +157,7 @@ __glXAddContext(__GLXcontext * cx) { /* Register this context as a resource. */ - if (!AddResource(cx->id, __glXContextRes, (pointer)cx)) { + if (!AddResource(cx->id, __glXContextRes, (void *)cx)) { return False; } @@ -203,8 +196,8 @@ __glXFreeContext(__GLXcontext * cx) free(cx->feedbackBuf); free(cx->selectBuf); - if (cx == __glXLastContext) { - __glXFlushContextCache(); + if (cx == lastGLContext) { + lastGLContext = NULL; } /* We can get here through both regular dispatching from @@ -278,7 +271,7 @@ glxGetClient(ClientPtr pClient) } static void -glxClientCallback(CallbackListPtr *list, pointer closure, pointer data) +glxClientCallback(CallbackListPtr *list, void *closure, void *data) { NewClientInfoRec *clientinfo = (NewClientInfoRec *) data; ClientPtr pClient = clientinfo->client; @@ -296,6 +289,7 @@ glxClientCallback(CallbackListPtr *list, pointer closure, pointer data) next = c->next; if (c->currentClient == pClient) { c->loseCurrent(c); + lastGLContext = NULL; c->currentClient = NULL; __glXFreeContext(c); } @@ -322,6 +316,23 @@ GlxPushProvider(__GLXprovider * provider) __glXProviderStack = provider; } +static Bool +checkScreenVisuals(void) +{ + int i, j; + + for (i = 0; i < screenInfo.numScreens; i++) { + ScreenPtr screen = screenInfo.screens[i]; + for (j = 0; j < screen->numVisuals; j++) { + if (screen->visuals[j].class == TrueColor || + screen->visuals[j].class == DirectColor) + return True; + } + } + + return False; +} + /* ** Initialize the GLX extension. */ @@ -340,6 +351,10 @@ GlxExtensionInit(void) *stack = &__glXDRISWRastProvider; } + /* Mesa requires at least one True/DirectColor visual */ + if (!checkScreenVisuals()) + return; + __glXContextRes = CreateNewResourceType((DeleteType) ContextGone, "GLXContext"); __glXDrawableRes = CreateNewResourceType((DeleteType) DrawableGone, @@ -406,12 +421,6 @@ GlxExtensionInit(void) /************************************************************************/ -void -__glXFlushContextCache(void) -{ - __glXLastContext = 0; -} - /* ** Make a context the current one for the GL (in this implementation, there ** is only one instance of the GL, and we use it to serve all GL clients by @@ -449,21 +458,22 @@ __glXForceCurrent(__GLXclientState * cl, GLXContextTag tag, int *error) if (cx->wait && (*cx->wait) (cx, cl, error)) return NULL; - if (cx == __glXLastContext) { + if (cx == lastGLContext) { /* No need to re-bind */ return cx; } /* Make this context the current one for the GL. */ if (!cx->isDirect) { + lastGLContext = cx; if (!(*cx->makeCurrent) (cx)) { /* Bind failed, and set the error code. Bummer */ + lastGLContext = NULL; cl->client->errorValue = cx->id; *error = __glXError(GLXBadContextState); return 0; } } - __glXLastContext = cx; return cx; } @@ -554,9 +564,9 @@ __glXsetGetProcAddress(glx_gpa_proc get_proc_address) void *__glGetProcAddress(const char *proc) { - void *ret = _get_proc_address(proc); + void *ret = (void *) _get_proc_address(proc); - return ret ? ret : NoopDDA; + return ret ? ret : (void *) NoopDDA; } /* diff --git a/xserver/glx/glxserver.h b/xserver/glx/glxserver.h index 7f36e5f5e..a324b290f 100644 --- a/xserver/glx/glxserver.h +++ b/xserver/glx/glxserver.h @@ -46,7 +46,6 @@ #include <resource.h> #include <scrnintstr.h> -#define GL_GLEXT_PROTOTYPES /* we want prototypes */ #include <GL/gl.h> #include <GL/glext.h> #include <GL/glxproto.h> @@ -85,7 +84,6 @@ void __glXScreenInitVisuals(__GLXscreen * screen); /* ** The last context used (from the server's persective) is cached. */ -extern __GLXcontext *__glXLastContext; extern __GLXcontext *__glXForceCurrent(__GLXclientState *, GLXContextTag, int *); diff --git a/xserver/glx/indirect_program.c b/xserver/glx/indirect_program.c index fa4a2408b..d503262c2 100644 --- a/xserver/glx/indirect_program.c +++ b/xserver/glx/indirect_program.c @@ -122,25 +122,3 @@ __glXDispSwap_GetProgramStringARB(struct __GLXclientStateRec *cl, GLbyte * pc) return DoGetProgramString(cl, pc, get_program, get_program_string, True); } - -int -__glXDisp_GetProgramStringNV(struct __GLXclientStateRec *cl, GLbyte * pc) -{ - PFNGLGETPROGRAMIVARBPROC get_program = - __glGetProcAddress("glGetProgramivARB"); - PFNGLGETPROGRAMSTRINGARBPROC get_program_string = - __glGetProcAddress("glGetProgramStringARB"); - - return DoGetProgramString(cl, pc, get_program, get_program_string, False); -} - -int -__glXDispSwap_GetProgramStringNV(struct __GLXclientStateRec *cl, GLbyte * pc) -{ - PFNGLGETPROGRAMIVARBPROC get_program = - __glGetProcAddress("glGetProgramivARB"); - PFNGLGETPROGRAMSTRINGARBPROC get_program_string = - __glGetProcAddress("glGetProgramStringARB"); - - return DoGetProgramString(cl, pc, get_program, get_program_string, True); -} diff --git a/xserver/glx/indirect_texture_compression.c b/xserver/glx/indirect_texture_compression.c index 94de47dd6..2018de6ae 100644 --- a/xserver/glx/indirect_texture_compression.c +++ b/xserver/glx/indirect_texture_compression.c @@ -54,9 +54,11 @@ __glXDisp_GetCompressedTexImage(struct __GLXclientStateRec *cl, GLbyte * pc) &compsize); if (compsize != 0) { + PFNGLGETCOMPRESSEDTEXIMAGEARBPROC GetCompressedTexImageARB = + __glGetProcAddress("glGetCompressedTexImageARB"); __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1); __glXClearErrorOccured(); - glGetCompressedTexImageARB(target, level, answer); + GetCompressedTexImageARB(target, level, answer); } if (__glXErrorOccured()) { @@ -96,9 +98,11 @@ __glXDispSwap_GetCompressedTexImage(struct __GLXclientStateRec *cl, GLbyte * pc) &compsize); if (compsize != 0) { + PFNGLGETCOMPRESSEDTEXIMAGEARBPROC GetCompressedTexImageARB = + __glGetProcAddress("glGetCompressedTexImageARB"); __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1); __glXClearErrorOccured(); - glGetCompressedTexImageARB(target, level, answer); + GetCompressedTexImageARB(target, level, answer); } if (__glXErrorOccured()) { diff --git a/xserver/hw/Makefile.am b/xserver/hw/Makefile.am index 6c2cc6bd4..19895dc77 100644 --- a/xserver/hw/Makefile.am +++ b/xserver/hw/Makefile.am @@ -26,6 +26,10 @@ if XQUARTZ XQUARTZ_SUBDIRS = xquartz endif +if XWAYLAND +XWAYLAND_SUBDIRS = xwayland +endif + SUBDIRS = \ $(XORG_SUBDIRS) \ $(XWIN_SUBDIRS) \ @@ -33,9 +37,10 @@ SUBDIRS = \ $(XNEST_SUBDIRS) \ $(DMX_SUBDIRS) \ $(KDRIVE_SUBDIRS) \ - $(XQUARTZ_SUBDIRS) + $(XQUARTZ_SUBDIRS) \ + $(XWAYLAND_SUBDIRS) -DIST_SUBDIRS = dmx xfree86 vfb xnest xwin xquartz kdrive +DIST_SUBDIRS = dmx xfree86 vfb xnest xwin xquartz kdrive xwayland relink: $(AM_V_at)for i in $(SUBDIRS) ; do $(MAKE) -C $$i relink || exit 1 ; done diff --git a/xserver/hw/Makefile.in b/xserver/hw/Makefile.in index 34214658d..9fba38116 100644 --- a/xserver/hw/Makefile.in +++ b/xserver/hw/Makefile.in @@ -167,6 +167,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -211,6 +213,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -313,7 +319,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -322,6 +331,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -388,6 +398,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ @@ -467,6 +481,7 @@ top_srcdir = @top_srcdir@ @XWIN_TRUE@XWIN_SUBDIRS = xwin @KDRIVE_TRUE@KDRIVE_SUBDIRS = kdrive @XQUARTZ_TRUE@XQUARTZ_SUBDIRS = xquartz +@XWAYLAND_TRUE@XWAYLAND_SUBDIRS = xwayland SUBDIRS = \ $(XORG_SUBDIRS) \ $(XWIN_SUBDIRS) \ @@ -474,9 +489,10 @@ SUBDIRS = \ $(XNEST_SUBDIRS) \ $(DMX_SUBDIRS) \ $(KDRIVE_SUBDIRS) \ - $(XQUARTZ_SUBDIRS) + $(XQUARTZ_SUBDIRS) \ + $(XWAYLAND_SUBDIRS) -DIST_SUBDIRS = dmx xfree86 vfb xnest xwin xquartz kdrive +DIST_SUBDIRS = dmx xfree86 vfb xnest xwin xquartz kdrive xwayland all: all-recursive .SUFFIXES: diff --git a/xserver/hw/dmx/Makefile.am b/xserver/hw/dmx/Makefile.am index a05af139e..eef84cb66 100644 --- a/xserver/hw/dmx/Makefile.am +++ b/xserver/hw/dmx/Makefile.am @@ -65,7 +65,6 @@ Xdmx_SOURCES = dmx.c \ dmxwindow.c \ dmxwindow.h \ $(top_srcdir)/mi/miinitext.c \ - $(top_srcdir)/fb/fbcmap_mi.c \ $(GLX_SRCS) diff --git a/xserver/hw/dmx/Makefile.in b/xserver/hw/dmx/Makefile.in index d3420401b..814cddf65 100644 --- a/xserver/hw/dmx/Makefile.in +++ b/xserver/hw/dmx/Makefile.in @@ -84,9 +84,8 @@ am__Xdmx_SOURCES_DIST = dmx.c dmxcb.c dmxcb.h dmxclient.h dmxcmap.c \ dmxpict.h dmxpixmap.c dmxpixmap.h dmxprop.c dmxprop.h \ dmxscrinit.c dmxscrinit.h dmxstat.c dmxstat.h dmxsync.c \ dmxsync.h dmxvisual.c dmxvisual.h dmxwindow.c dmxwindow.h \ - $(top_srcdir)/mi/miinitext.c $(top_srcdir)/fb/fbcmap_mi.c \ - $(top_srcdir)/Xext/panoramiX.c dmx_glxvisuals.c \ - dmx_glxvisuals.h + $(top_srcdir)/mi/miinitext.c $(top_srcdir)/Xext/panoramiX.c \ + dmx_glxvisuals.c dmx_glxvisuals.h @XINERAMA_TRUE@am__objects_1 = panoramiX.$(OBJEXT) @GLX_TRUE@am__objects_2 = $(am__objects_1) dmx_glxvisuals.$(OBJEXT) am_Xdmx_OBJECTS = dmx.$(OBJEXT) dmxcb.$(OBJEXT) dmxcmap.$(OBJEXT) \ @@ -96,7 +95,7 @@ am_Xdmx_OBJECTS = dmx.$(OBJEXT) dmxcb.$(OBJEXT) dmxcmap.$(OBJEXT) \ dmxpict.$(OBJEXT) dmxpixmap.$(OBJEXT) dmxprop.$(OBJEXT) \ dmxscrinit.$(OBJEXT) dmxstat.$(OBJEXT) dmxsync.$(OBJEXT) \ dmxvisual.$(OBJEXT) dmxwindow.$(OBJEXT) miinitext.$(OBJEXT) \ - fbcmap_mi.$(OBJEXT) $(am__objects_2) + $(am__objects_2) Xdmx_OBJECTS = $(am_Xdmx_OBJECTS) am__DEPENDENCIES_1 = $(GLX_LIBS) input/libdmxinput.a \ config/libdmxconfig.a @@ -228,6 +227,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -272,6 +273,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -374,7 +379,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -383,6 +391,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -458,6 +467,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ @@ -587,7 +600,6 @@ Xdmx_SOURCES = dmx.c \ dmxwindow.c \ dmxwindow.h \ $(top_srcdir)/mi/miinitext.c \ - $(top_srcdir)/fb/fbcmap_mi.c \ $(GLX_SRCS) Xdmx_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG) @@ -704,7 +716,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxsync.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxvisual.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxwindow.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fbcmap_mi.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/miinitext.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/panoramiX.Po@am__quote@ @@ -743,20 +754,6 @@ miinitext.obj: $(top_srcdir)/mi/miinitext.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o miinitext.obj `if test -f '$(top_srcdir)/mi/miinitext.c'; then $(CYGPATH_W) '$(top_srcdir)/mi/miinitext.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/mi/miinitext.c'; fi` -fbcmap_mi.o: $(top_srcdir)/fb/fbcmap_mi.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT fbcmap_mi.o -MD -MP -MF $(DEPDIR)/fbcmap_mi.Tpo -c -o fbcmap_mi.o `test -f '$(top_srcdir)/fb/fbcmap_mi.c' || echo '$(srcdir)/'`$(top_srcdir)/fb/fbcmap_mi.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fbcmap_mi.Tpo $(DEPDIR)/fbcmap_mi.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/fb/fbcmap_mi.c' object='fbcmap_mi.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o fbcmap_mi.o `test -f '$(top_srcdir)/fb/fbcmap_mi.c' || echo '$(srcdir)/'`$(top_srcdir)/fb/fbcmap_mi.c - -fbcmap_mi.obj: $(top_srcdir)/fb/fbcmap_mi.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT fbcmap_mi.obj -MD -MP -MF $(DEPDIR)/fbcmap_mi.Tpo -c -o fbcmap_mi.obj `if test -f '$(top_srcdir)/fb/fbcmap_mi.c'; then $(CYGPATH_W) '$(top_srcdir)/fb/fbcmap_mi.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/fb/fbcmap_mi.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fbcmap_mi.Tpo $(DEPDIR)/fbcmap_mi.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/fb/fbcmap_mi.c' object='fbcmap_mi.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o fbcmap_mi.obj `if test -f '$(top_srcdir)/fb/fbcmap_mi.c'; then $(CYGPATH_W) '$(top_srcdir)/fb/fbcmap_mi.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/fb/fbcmap_mi.c'; fi` - panoramiX.o: $(top_srcdir)/Xext/panoramiX.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT panoramiX.o -MD -MP -MF $(DEPDIR)/panoramiX.Tpo -c -o panoramiX.o `test -f '$(top_srcdir)/Xext/panoramiX.c' || echo '$(srcdir)/'`$(top_srcdir)/Xext/panoramiX.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/panoramiX.Tpo $(DEPDIR)/panoramiX.Po diff --git a/xserver/hw/dmx/config/Canvas.c b/xserver/hw/dmx/config/Canvas.c index f0586e509..103103346 100644 --- a/xserver/hw/dmx/config/Canvas.c +++ b/xserver/hw/dmx/config/Canvas.c @@ -98,10 +98,10 @@ static XtResource resources[] = { {XtNcallback, XtCCallback, XtRCallback, sizeof(XtCallbackList), offset(input_callback), XtRCallback, NULL} , - {XtNcanvasExposeCallback, XtCcanvasExposeCallback, XtRCallback, + {(char *) XtNcanvasExposeCallback, (char *) XtCcanvasExposeCallback, XtRCallback, sizeof(XtCallbackList), offset(expose_callback), XtRCallback, NULL} , - {XtNcanvasResizeCallback, XtCcanvasResizeCallback, XtRCallback, + {(char *) XtNcanvasResizeCallback, (char *) XtCcanvasResizeCallback, XtRCallback, sizeof(XtCallbackList), offset(resize_callback), XtRCallback, NULL} , }; @@ -109,7 +109,7 @@ static XtResource resources[] = { #undef offset static XtActionsRec actions[] = { - {"canvas", CanvasAction}, + {(char *) "canvas", CanvasAction}, }; static char translations[] = "<Key>: canvas()\n\ @@ -123,7 +123,7 @@ CanvasClassRec canvasClassRec = { /* core */ { (WidgetClass) Superclass, /* superclass */ - "Canvas", /* class_name */ + (char *) "Canvas", /* class_name */ sizeof(CanvasRec), /* widget_size */ NULL, /* class_initialize */ NULL, /* class_part_initialize */ diff --git a/xserver/hw/dmx/config/Makefile.in b/xserver/hw/dmx/config/Makefile.in index b20b8bfc1..3e147796a 100644 --- a/xserver/hw/dmx/config/Makefile.in +++ b/xserver/hw/dmx/config/Makefile.in @@ -242,6 +242,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -286,6 +288,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -388,7 +394,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -397,6 +406,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -463,6 +473,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/hw/dmx/config/man/Makefile.in b/xserver/hw/dmx/config/man/Makefile.in index c2a36a9a7..17ff0ea1a 100644 --- a/xserver/hw/dmx/config/man/Makefile.in +++ b/xserver/hw/dmx/config/man/Makefile.in @@ -160,6 +160,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -204,6 +206,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -268,6 +274,7 @@ MAN_SUBSTS = @MAN_SUBSTS@ -e 's|__logdir__|$(logdir)|g' -e \ 's|__XKB_DFLT_OPTIONS__|$(XKB_DFLT_OPTIONS)|g' -e \ 's|__bundle_id_prefix__|$(BUNDLE_ID_PREFIX)|g' -e \ 's|__modulepath__|$(DEFAULT_MODULE_PATH)|g' -e \ + 's|__suid_wrapper_dir__|$(SUID_WRAPPER_DIR)|g' -e \ 's|__default_font_path__|$(COMPILEDDEFAULTFONTPATH)|g' -e \ '\|$(COMPILEDDEFAULTFONTPATH)| s|/,|/, |g' MISC_MAN_DIR = @MISC_MAN_DIR@ @@ -322,7 +329,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -331,6 +341,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -397,6 +408,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/hw/dmx/config/xdmxconfig.c b/xserver/hw/dmx/config/xdmxconfig.c index 2121dd781..0540d0173 100644 --- a/xserver/hw/dmx/config/xdmxconfig.c +++ b/xserver/hw/dmx/config/xdmxconfig.c @@ -303,7 +303,6 @@ dmxConfigCanvasUpdate(void) fs = XQueryFont(dpy, gcontext); for (pt = dmxConfigCurrent->subentry; pt; pt = pt->next) { int x, y, len; - int xo = 3, yo = fs->ascent + fs->descent + 2; GC gc; if (pt->type != dmxConfigDisplay) @@ -321,6 +320,8 @@ dmxConfigCanvasUpdate(void) y = dmxConfigWidgetHeight - 1; XDrawRectangle(dpy, win, gc, x, y, w, h); if (fs && len) { + int xo = 3, yo = fs->ascent + fs->descent + 2; + while (len && XTextWidth(fs, pt->display->name, len) >= w - 2 * xo) --len; if (len) @@ -974,9 +975,9 @@ main(int argc, char **argv) const char *canvastrans = "<Btn3Down>: placeMenu() XtMenuPopup(buttonpopup)"; XtActionsRec actiontable[] = { - {"openOk", dmxConfigOkAction}, - {"placeMenu", dmxConfigPlaceMenu}, - {"noop", NULL} + {(char *) "openOk", dmxConfigOkAction}, + {(char *) "placeMenu", dmxConfigPlaceMenu}, + {(char *) "noop", NULL} }; dmxConfigFilename = XtNewString((argc >= 2) ? argv[1] : ""); diff --git a/xserver/hw/dmx/dmx.c b/xserver/hw/dmx/dmx.c index 0f7cb5c64..99e970cb9 100644 --- a/xserver/hw/dmx/dmx.c +++ b/xserver/hw/dmx/dmx.c @@ -268,7 +268,7 @@ ProcDMXForceWindowCreation(ClientPtr client) PanoramiXRes *win; int i; - if (Success != dixLookupResourceByType((pointer *) &win, + if (Success != dixLookupResourceByType((void **) &win, stuff->window, XRT_WINDOW, client, DixReadAccess)) return -1; /* BadWindow */ @@ -556,7 +556,7 @@ dmxPopulatePanoramiX(ClientPtr client, Window window, int count = 0; DMXWindowAttributesRec attr; - if (Success != dixLookupResourceByType((pointer *) &win, + if (Success != dixLookupResourceByType((void **) &win, window, XRT_WINDOW, client, DixReadAccess)) return -1; /* BadWindow */ diff --git a/xserver/hw/dmx/dmxclient.h b/xserver/hw/dmx/dmxclient.h index 19dfdbe16..be8116f14 100644 --- a/xserver/hw/dmx/dmxclient.h +++ b/xserver/hw/dmx/dmxclient.h @@ -118,17 +118,6 @@ typedef XID KeySym64; #undef KeySym #endif -/* These are in exglobals.h, but that conflicts with xkbsrv.h */ -extern int ProximityIn; -extern int ProximityOut; -extern int DeviceValuator; -extern int DeviceMotionNotify; -extern int DeviceFocusIn; -extern int DeviceFocusOut; -extern int DeviceStateNotify; -extern int DeviceMappingNotify; -extern int ChangeDeviceNotify; - /* Some protocol gets included last, after undefines. */ #include <X11/XKBlib.h> #include <X11/extensions/XKBproto.h> diff --git a/xserver/hw/dmx/dmxextension.c b/xserver/hw/dmx/dmxextension.c index c6c6a8e6d..fcc97e3df 100644 --- a/xserver/hw/dmx/dmxextension.c +++ b/xserver/hw/dmx/dmxextension.c @@ -728,7 +728,7 @@ static Bool FoundPixImage; * another screen with the same image. If so, copy the pixmap image * from the existing screen to the newly created pixmap. */ static void -dmxBERestorePixmapImage(pointer value, XID id, RESTYPE type, pointer p) +dmxBERestorePixmapImage(void *value, XID id, RESTYPE type, void *p) { if ((type & TypeMask) == (XRT_PIXMAP & TypeMask)) { PixmapPtr pDst = (PixmapPtr) p; @@ -737,7 +737,7 @@ dmxBERestorePixmapImage(pointer value, XID id, RESTYPE type, pointer p) PixmapPtr pPix; int i; - dixLookupResourceByType((pointer *) &pPix, pXinPix->info[idx].id, + dixLookupResourceByType((void **) &pPix, pXinPix->info[idx].id, RT_PIXMAP, NullClient, DixUnknownAccess); if (pPix != pDst) return; /* Not a match.... Next! */ @@ -749,7 +749,7 @@ dmxBERestorePixmapImage(pointer value, XID id, RESTYPE type, pointer p) if (i == idx) continue; /* Self replication is bad */ - dixLookupResourceByType((pointer *) &pSrc, pXinPix->info[i].id, + dixLookupResourceByType((void **) &pSrc, pXinPix->info[i].id, RT_PIXMAP, NullClient, DixUnknownAccess); pSrcPriv = DMX_GET_PIXMAP_PRIV(pSrc); if (pSrcPriv->pixmap) { @@ -828,7 +828,7 @@ dmxBERestorePixmap(PixmapPtr pPixmap) for (i = currentMaxClients; --i >= 0;) if (clients[i]) FindAllClientResources(clients[i], dmxBERestorePixmapImage, - (pointer) pPixmap); + (void *) pPixmap); /* No corresponding pixmap image was found on other screens, so we * need to copy it from the saved image when the screen was detached @@ -895,7 +895,7 @@ dmxBERestorePixmap(PixmapPtr pPixmap) * number passed in as \a n and calls the appropriate DMX function to * create the associated resource on the back-end server. */ static void -dmxBECreateResources(pointer value, XID id, RESTYPE type, pointer n) +dmxBECreateResources(void *value, XID id, RESTYPE type, void *n) { int scrnNum = (uintptr_t) n; ScreenPtr pScreen = screenInfo.screens[scrnNum]; @@ -1121,7 +1121,7 @@ dmxCompareScreens(DMXScreenInfo * new, DMXScreenInfo * old) /** Restore Render's picture */ static void -dmxBERestoreRenderPict(pointer value, XID id, pointer n) +dmxBERestoreRenderPict(void *value, XID id, void *n) { PicturePtr pPicture = value; /* The picture */ DrawablePtr pDraw = pPicture->pDrawable; /* The picture's drawable */ @@ -1145,7 +1145,7 @@ dmxBERestoreRenderPict(pointer value, XID id, pointer n) /** Restore Render's glyphs */ static void -dmxBERestoreRenderGlyph(pointer value, XID id, pointer n) +dmxBERestoreRenderGlyph(void *value, XID id, void *n) { GlyphSetPtr glyphSet = value; int scrnNum = (uintptr_t) n; @@ -1340,7 +1340,7 @@ dmxAttachScreen(int idx, DMXScreenAttributesPtr attr) for (i = currentMaxClients; --i >= 0;) if (clients[i]) FindAllClientResources(clients[i], dmxBECreateResources, - (pointer) (uintptr_t) idx); + (void *) (uintptr_t) idx); /* Create window hierarchy (top down) */ dmxBECreateWindowTree(idx); @@ -1350,14 +1350,14 @@ dmxAttachScreen(int idx, DMXScreenAttributesPtr attr) if (clients[i]) FindClientResourcesByType(clients[i], PictureType, dmxBERestoreRenderPict, - (pointer) (uintptr_t) idx); + (void *) (uintptr_t) idx); /* Restore the glyph state for RENDER */ for (i = currentMaxClients; --i >= 0;) if (clients[i]) FindClientResourcesByType(clients[i], GlyphSetType, dmxBERestoreRenderGlyph, - (pointer) (uintptr_t) idx); + (void *) (uintptr_t) idx); /* Refresh screen by generating exposure events for all windows */ dmxForceExposures(idx); @@ -1425,7 +1425,7 @@ dmxAttachScreen(int idx, DMXScreenAttributesPtr attr) /** Search the Xinerama XRT_PIXMAP resources for the pixmap that needs * to have its image saved. */ static void -dmxBEFindPixmapImage(pointer value, XID id, RESTYPE type, pointer p) +dmxBEFindPixmapImage(void *value, XID id, RESTYPE type, void *p) { if ((type & TypeMask) == (XRT_PIXMAP & TypeMask)) { PixmapPtr pDst = (PixmapPtr) p; @@ -1434,7 +1434,7 @@ dmxBEFindPixmapImage(pointer value, XID id, RESTYPE type, pointer p) PixmapPtr pPix; int i; - dixLookupResourceByType((pointer *) &pPix, pXinPix->info[idx].id, + dixLookupResourceByType((void **) &pPix, pXinPix->info[idx].id, RT_PIXMAP, NullClient, DixUnknownAccess); if (pPix != pDst) return; /* Not a match.... Next! */ @@ -1446,7 +1446,7 @@ dmxBEFindPixmapImage(pointer value, XID id, RESTYPE type, pointer p) if (i == idx) continue; /* Self replication is bad */ - dixLookupResourceByType((pointer *) &pSrc, pXinPix->info[i].id, + dixLookupResourceByType((void **) &pSrc, pXinPix->info[i].id, RT_PIXMAP, NullClient, DixUnknownAccess); pSrcPriv = DMX_GET_PIXMAP_PRIV(pSrc); if (pSrcPriv->pixmap) { @@ -1482,7 +1482,7 @@ dmxBESavePixmap(PixmapPtr pPixmap) for (i = currentMaxClients; --i >= 0;) if (clients[i]) FindAllClientResources(clients[i], dmxBEFindPixmapImage, - (pointer) pPixmap); + (void *) pPixmap); /* Save the image only if there is no other screens that have a * pixmap that corresponds to the one we are trying to save. */ @@ -1522,7 +1522,7 @@ dmxBESavePixmap(PixmapPtr pPixmap) * number passed in as \a n and calls the appropriate DMX function to * free the associated resource on the back-end server. */ static void -dmxBEDestroyResources(pointer value, XID id, RESTYPE type, pointer n) +dmxBEDestroyResources(void *value, XID id, RESTYPE type, void *n) { int scrnNum = (uintptr_t) n; ScreenPtr pScreen = screenInfo.screens[scrnNum]; @@ -1683,7 +1683,7 @@ dmxDetachScreen(int idx) for (i = currentMaxClients; --i >= 0;) if (clients[i]) FindAllClientResources(clients[i], dmxBEDestroyResources, - (pointer) (uintptr_t) idx); + (void *) (uintptr_t) idx); /* Free scratch GCs */ dmxBEDestroyScratchGCs(idx); diff --git a/xserver/hw/dmx/dmxfont.c b/xserver/hw/dmx/dmxfont.c index 7ef7ad971..115422d41 100644 --- a/xserver/hw/dmx/dmxfont.c +++ b/xserver/hw/dmx/dmxfont.c @@ -397,12 +397,12 @@ dmxBELoadFont(ScreenPtr pScreen, FontPtr pFont) "font-path-related options, see the Xdmx man page.\n"); } + free(goodfps); if (!dmxIgnoreBadFontPaths || (dmxIgnoreBadFontPaths && dmxSetFontPath(dmxScreen))) { /* We still have errors so return with error */ dmxFreeFontPath(fp); XFreeFontPath(oldFontPath); - free(goodfps); return FALSE; } } @@ -460,7 +460,7 @@ dmxRealizeFont(ScreenPtr pScreen, FontPtr pFont) pFontPriv->refcnt = 0; } - FontSetPrivate(pFont, dmxFontPrivateIndex, (pointer) pFontPriv); + FontSetPrivate(pFont, dmxFontPrivateIndex, (void *) pFontPriv); if (dmxScreen->beDisplay) { if (!dmxBELoadFont(pScreen, pFont)) diff --git a/xserver/hw/dmx/dmxgc.c b/xserver/hw/dmx/dmxgc.c index 703aeb336..2d61ea2f7 100644 --- a/xserver/hw/dmx/dmxgc.c +++ b/xserver/hw/dmx/dmxgc.c @@ -378,7 +378,7 @@ dmxDestroyGC(GCPtr pGC) /** Change the clip rects for a GC. */ void -dmxChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects) +dmxChangeClip(GCPtr pGC, int type, void *pvalue, int nrects) { ScreenPtr pScreen = pGC->pScreen; DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; diff --git a/xserver/hw/dmx/dmxgc.h b/xserver/hw/dmx/dmxgc.h index 7b99d88c6..c8ecb53a0 100644 --- a/xserver/hw/dmx/dmxgc.h +++ b/xserver/hw/dmx/dmxgc.h @@ -55,7 +55,7 @@ extern void dmxValidateGC(GCPtr pGC, unsigned long changes, extern void dmxChangeGC(GCPtr pGC, unsigned long mask); extern void dmxCopyGC(GCPtr pGCSrc, unsigned long changes, GCPtr pGCDst); extern void dmxDestroyGC(GCPtr pGC); -extern void dmxChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects); +extern void dmxChangeClip(GCPtr pGC, int type, void *pvalue, int nrects); extern void dmxDestroyClip(GCPtr pGC); extern void dmxCopyClip(GCPtr pGCDst, GCPtr pGCSrc); diff --git a/xserver/hw/dmx/dmxgcops.c b/xserver/hw/dmx/dmxgcops.c index 19330668a..aa7c8eb54 100644 --- a/xserver/hw/dmx/dmxgcops.c +++ b/xserver/hw/dmx/dmxgcops.c @@ -508,7 +508,7 @@ dmxImageText16(DrawablePtr pDrawable, GCPtr pGC, void dmxImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y, unsigned int nglyph, - CharInfoPtr * ppci, pointer pglyphBase) + CharInfoPtr * ppci, void *pglyphBase) { /* Error -- this should never happen! */ } @@ -517,7 +517,7 @@ dmxImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, void dmxPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y, unsigned int nglyph, - CharInfoPtr * ppci, pointer pglyphBase) + CharInfoPtr * ppci, void *pglyphBase) { /* Error -- this should never happen! */ } @@ -551,7 +551,7 @@ dmxFindAlternatePixmap(DrawablePtr pDrawable, XID *draw) if (pDrawable->type != DRAWABLE_PIXMAP) return NULL; - if (Success != dixLookupResourceByType((pointer *) &pXinPix, + if (Success != dixLookupResourceByType((void **) &pXinPix, pDrawable->id, XRT_PIXMAP, NullClient, DixUnknownAccess)) return NULL; @@ -562,7 +562,7 @@ dmxFindAlternatePixmap(DrawablePtr pDrawable, XID *draw) PixmapPtr pSrc; dmxPixPrivPtr pSrcPriv; - dixLookupResourceByType((pointer *) &pSrc, pXinPix->info[i].id, + dixLookupResourceByType((void **) &pSrc, pXinPix->info[i].id, RT_PIXMAP, NullClient, DixUnknownAccess); pSrcPriv = DMX_GET_PIXMAP_PRIV(pSrc); if (pSrcPriv->pixmap) { diff --git a/xserver/hw/dmx/dmxgcops.h b/xserver/hw/dmx/dmxgcops.h index 4ba0ad500..529b6ffc6 100644 --- a/xserver/hw/dmx/dmxgcops.h +++ b/xserver/hw/dmx/dmxgcops.h @@ -78,10 +78,10 @@ extern void dmxImageText16(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, unsigned short *chars); extern void dmxImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y, unsigned int nglyph, - CharInfoPtr * ppci, pointer pglyphBase); + CharInfoPtr * ppci, void *pglyphBase); extern void dmxPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y, unsigned int nglyph, - CharInfoPtr * ppci, pointer pglyphBase); + CharInfoPtr * ppci, void *pglyphBase); extern void dmxPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst, int w, int h, int x, int y); diff --git a/xserver/hw/dmx/dmxinit.c b/xserver/hw/dmx/dmxinit.c index 7adcba0bb..fd2ade0ef 100644 --- a/xserver/hw/dmx/dmxinit.c +++ b/xserver/hw/dmx/dmxinit.c @@ -597,10 +597,8 @@ static void dmxAddExtensions(Bool glxSupported) { GlxExtensionInit, "GLX", &glxSupported }, #endif }; - int i; - for (i = 0; i < ARRAY_SIZE(dmxExtensions); i++) - LoadExtension(&dmxExtensions[i], TRUE); + LoadExtensionList(dmxExtensions, ARRAY_SIZE(dmxExtensions), TRUE); } /** This routine is called in Xserver/dix/main.c from \a main(). */ diff --git a/xserver/hw/dmx/dmxpict.c b/xserver/hw/dmx/dmxpict.c index c9762c2f1..64d0ae150 100644 --- a/xserver/hw/dmx/dmxpict.c +++ b/xserver/hw/dmx/dmxpict.c @@ -285,7 +285,7 @@ dmxProcRenderCreateGlyphSet(ClientPtr client) /* Store glyphsets from backends in glyphSet->devPrivate ????? */ /* Make sure we handle all errors here!! */ - dixLookupResourceByType((pointer *) &glyphSet, + dixLookupResourceByType((void **) &glyphSet, stuff->gsid, GlyphSetType, client, DixDestroyAccess); @@ -332,7 +332,7 @@ dmxProcRenderFreeGlyphSet(ClientPtr client) REQUEST(xRenderFreeGlyphSetReq); REQUEST_SIZE_MATCH(xRenderFreeGlyphSetReq); - dixLookupResourceByType((pointer *) &glyphSet, + dixLookupResourceByType((void **) &glyphSet, stuff->glyphset, GlyphSetType, client, DixDestroyAccess); @@ -378,7 +378,7 @@ dmxProcRenderAddGlyphs(ClientPtr client) CARD8 *bits; int nbytes; - dixLookupResourceByType((pointer *) &glyphSet, + dixLookupResourceByType((void **) &glyphSet, stuff->glyphset, GlyphSetType, client, DixReadAccess); glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet); @@ -423,7 +423,7 @@ dmxProcRenderFreeGlyphs(ClientPtr client) REQUEST(xRenderFreeGlyphsReq); REQUEST_AT_LEAST_SIZE(xRenderFreeGlyphsReq); - dixLookupResourceByType((pointer *) &glyphSet, + dixLookupResourceByType((void **) &glyphSet, stuff->glyphset, GlyphSetType, client, DixWriteAccess); @@ -498,14 +498,14 @@ dmxProcRenderCompositeGlyphs(ClientPtr client) GlyphSetPtr glyphSet; dmxGlyphPrivPtr glyphPriv; - dixLookupResourceByType((pointer *) &pSrc, + dixLookupResourceByType((void **) &pSrc, stuff->src, PictureType, client, DixReadAccess); pSrcPriv = DMX_GET_PICT_PRIV(pSrc); if (!pSrcPriv->pict) return ret; - dixLookupResourceByType((pointer *) &pDst, + dixLookupResourceByType((void **) &pDst, stuff->dst, PictureType, client, DixWriteAccess); @@ -524,7 +524,7 @@ dmxProcRenderCompositeGlyphs(ClientPtr client) return ret; if (stuff->maskFormat) - dixLookupResourceByType((pointer *) &pFmt, + dixLookupResourceByType((void **) &pFmt, stuff->maskFormat, PictFormatType, client, DixReadAccess); else @@ -585,7 +585,7 @@ dmxProcRenderCompositeGlyphs(ClientPtr client) curGlyph = glyphs; curElt = elts; - dixLookupResourceByType((pointer *) &glyphSet, + dixLookupResourceByType((void **) &glyphSet, stuff->glyphset, GlyphSetType, client, DixReadAccess); glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet); @@ -595,7 +595,7 @@ dmxProcRenderCompositeGlyphs(ClientPtr client) buffer += sizeof(xGlyphElt); if (elt->len == 0xff) { - dixLookupResourceByType((pointer *) &glyphSet, + dixLookupResourceByType((void **) &glyphSet, *((CARD32 *) buffer), GlyphSetType, client, DixReadAccess); glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet); @@ -894,7 +894,7 @@ dmxDestroyPicture(PicturePtr pPicture) /** Change the picture's list of clip rectangles. */ int -dmxChangePictureClip(PicturePtr pPicture, int clipType, pointer value, int n) +dmxChangePictureClip(PicturePtr pPicture, int clipType, void *value, int n) { ScreenPtr pScreen = pPicture->pDrawable->pScreen; DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; diff --git a/xserver/hw/dmx/dmxpict.h b/xserver/hw/dmx/dmxpict.h index 6c37be924..080da3bef 100644 --- a/xserver/hw/dmx/dmxpict.h +++ b/xserver/hw/dmx/dmxpict.h @@ -65,7 +65,7 @@ extern Bool dmxDestroyPictureList(WindowPtr pWindow); extern int dmxCreatePicture(PicturePtr pPicture); extern void dmxDestroyPicture(PicturePtr pPicture); extern int dmxChangePictureClip(PicturePtr pPicture, int clipType, - pointer value, int n); + void *value, int n); extern void dmxDestroyPictureClip(PicturePtr pPicture); extern void dmxChangePicture(PicturePtr pPicture, Mask mask); extern void dmxValidatePicture(PicturePtr pPicture, Mask mask); diff --git a/xserver/hw/dmx/dmxstat.c b/xserver/hw/dmx/dmxstat.c index 0d8c22a9e..0ae5107a4 100644 --- a/xserver/hw/dmx/dmxstat.c +++ b/xserver/hw/dmx/dmxstat.c @@ -175,7 +175,7 @@ dmxStatSync(DMXScreenInfo * dmxScreen, /* Actually do the work of printing out the human-readable message. */ static CARD32 -dmxStatCallback(OsTimerPtr timer, CARD32 t, pointer arg) +dmxStatCallback(OsTimerPtr timer, CARD32 t, void *arg) { int i, j; static int header = 0; diff --git a/xserver/hw/dmx/dmxsync.c b/xserver/hw/dmx/dmxsync.c index bf28584b4..81dbbc64d 100644 --- a/xserver/hw/dmx/dmxsync.c +++ b/xserver/hw/dmx/dmxsync.c @@ -82,7 +82,7 @@ dmxDoSync(DMXScreenInfo * dmxScreen) } static CARD32 -dmxSyncCallback(OsTimerPtr timer, CARD32 time, pointer arg) +dmxSyncCallback(OsTimerPtr timer, CARD32 time, void *arg) { int i; @@ -99,13 +99,13 @@ dmxSyncCallback(OsTimerPtr timer, CARD32 time, pointer arg) } static void -dmxSyncBlockHandler(pointer blockData, OSTimePtr pTimeout, pointer pReadMask) +dmxSyncBlockHandler(void *blockData, OSTimePtr pTimeout, void *pReadMask) { TimerForce(dmxSyncTimer); } static void -dmxSyncWakeupHandler(pointer blockData, int result, pointer pReadMask) +dmxSyncWakeupHandler(void *blockData, int result, void *pReadMask) { } diff --git a/xserver/hw/dmx/dmxwindow.c b/xserver/hw/dmx/dmxwindow.c index 9b8a3840e..1c235273c 100644 --- a/xserver/hw/dmx/dmxwindow.c +++ b/xserver/hw/dmx/dmxwindow.c @@ -86,7 +86,7 @@ dmxCreateRootWindow(WindowPtr pWindow) parent = dmxScreen->scrnWin; /* This is our "Screen" window */ visual = dmxScreen->beVisuals[dmxScreen->beDefVisualIndex].visual; - dixLookupResourceByType((pointer *) &pCmap, wColormap(pWindow), + dixLookupResourceByType((void **) &pCmap, wColormap(pWindow), RT_COLORMAP, NullClient, DixUnknownAccess); pCmapPriv = DMX_GET_COLORMAP_PRIV(pCmap); @@ -192,7 +192,7 @@ dmxGetDefaultWindowAttributes(WindowPtr pWindow, ColormapPtr pCmap; dmxColormapPrivPtr pCmapPriv; - dixLookupResourceByType((pointer *) &pCmap, wColormap(pWindow), + dixLookupResourceByType((void **) &pCmap, wColormap(pWindow), RT_COLORMAP, NullClient, DixUnknownAccess); pCmapPriv = DMX_GET_COLORMAP_PRIV(pCmap); *cmap = pCmapPriv->cmap; @@ -561,7 +561,7 @@ dmxDoChangeWindowAttributes(WindowPtr pWindow, ColormapPtr pCmap; dmxColormapPrivPtr pCmapPriv; - dixLookupResourceByType((pointer *) &pCmap, wColormap(pWindow), + dixLookupResourceByType((void **) &pCmap, wColormap(pWindow), RT_COLORMAP, NullClient, DixUnknownAccess); pCmapPriv = DMX_GET_COLORMAP_PRIV(pCmap); attribs->colormap = pCmapPriv->cmap; diff --git a/xserver/hw/dmx/doc/Makefile.in b/xserver/hw/dmx/doc/Makefile.in index 2693e2c86..b72bc4ceb 100644 --- a/xserver/hw/dmx/doc/Makefile.in +++ b/xserver/hw/dmx/doc/Makefile.in @@ -172,6 +172,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -216,6 +218,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -318,7 +324,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -327,6 +336,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -393,6 +403,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/hw/dmx/doxygen/Makefile.in b/xserver/hw/dmx/doxygen/Makefile.in index 66179a50c..ce42f5073 100644 --- a/xserver/hw/dmx/doxygen/Makefile.in +++ b/xserver/hw/dmx/doxygen/Makefile.in @@ -153,6 +153,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -197,6 +199,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -299,7 +305,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -308,6 +317,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -374,6 +384,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/hw/dmx/examples/Makefile.in b/xserver/hw/dmx/examples/Makefile.in index 0f1c83cb9..d1fe91042 100644 --- a/xserver/hw/dmx/examples/Makefile.in +++ b/xserver/hw/dmx/examples/Makefile.in @@ -267,6 +267,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -311,6 +313,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -413,7 +419,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -422,6 +431,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -488,6 +498,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/hw/dmx/glxProxy/Makefile.in b/xserver/hw/dmx/glxProxy/Makefile.in index 5688b0c4d..84069a014 100644 --- a/xserver/hw/dmx/glxProxy/Makefile.in +++ b/xserver/hw/dmx/glxProxy/Makefile.in @@ -173,6 +173,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -217,6 +219,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -319,7 +325,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -328,6 +337,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -394,6 +404,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/hw/dmx/glxProxy/glxcmds.c b/xserver/hw/dmx/glxProxy/glxcmds.c index 190eeefe2..23c3366bd 100644 --- a/xserver/hw/dmx/glxProxy/glxcmds.c +++ b/xserver/hw/dmx/glxProxy/glxcmds.c @@ -195,7 +195,7 @@ CreateContext(__GLXclientState * cl, shareglxc = NULL; } else { - dixLookupResourceByType((pointer *) &shareglxc, shareList, + dixLookupResourceByType((void **) &shareglxc, shareList, __glXContextRes, NullClient, DixUnknownAccess); if (!shareglxc) { client->errorValue = shareList; @@ -425,7 +425,7 @@ CreateContext(__GLXclientState * cl, /* ** Register this context as a resource. */ - if (!AddResource(gcId, __glXContextRes, (pointer) glxc)) { + if (!AddResource(gcId, __glXContextRes, (void *) glxc)) { free(glxc->real_ids); free(glxc->real_vids); free(glxc); @@ -511,14 +511,14 @@ __glXBindSwapBarrierSGIX(__GLXclientState * cl, GLbyte * pc) rc = dixLookupDrawable(&pDraw, req->drawable, client, 0, DixGetAttrAccess); if (rc != Success) { - dixLookupResourceByType((pointer *) &pGlxPixmap, req->drawable, + dixLookupResourceByType((void **) &pGlxPixmap, req->drawable, __glXPixmapRes, NullClient, DixUnknownAccess); if (pGlxPixmap) pDraw = pGlxPixmap->pDraw; } if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1, 3)) { - dixLookupResourceByType((pointer *) &pGlxWindow, req->drawable, + dixLookupResourceByType((void **) &pGlxWindow, req->drawable, __glXWindowRes, NullClient, DixUnknownAccess); if (pGlxWindow) pDraw = pGlxWindow->pDraw; @@ -544,14 +544,14 @@ __glXJoinSwapGroupSGIX(__GLXclientState * cl, GLbyte * pc) rc = dixLookupDrawable(&pDraw, req->drawable, client, 0, DixManageAccess); if (rc != Success) { - dixLookupResourceByType((pointer *) &pGlxPixmap, req->drawable, + dixLookupResourceByType((void **) &pGlxPixmap, req->drawable, __glXPixmapRes, NullClient, DixUnknownAccess); if (pGlxPixmap) pDraw = pGlxPixmap->pDraw; } if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1, 3)) { - dixLookupResourceByType((pointer *) &pGlxWindow, req->drawable, + dixLookupResourceByType((void **) &pGlxWindow, req->drawable, __glXWindowRes, NullClient, DixUnknownAccess); if (pGlxWindow) pDraw = pGlxWindow->pDraw; @@ -566,7 +566,7 @@ __glXJoinSwapGroupSGIX(__GLXclientState * cl, GLbyte * pc) rc = dixLookupDrawable(&pMember, req->member, client, 0, DixGetAttrAccess); if (rc != Success) { - dixLookupResourceByType((pointer *) &pGlxPixmap, req->member, + dixLookupResourceByType((void **) &pGlxPixmap, req->member, __glXPixmapRes, NullClient, DixUnknownAccess); if (pGlxPixmap) @@ -574,7 +574,7 @@ __glXJoinSwapGroupSGIX(__GLXclientState * cl, GLbyte * pc) } if (!pMember && __GLX_IS_VERSION_SUPPORTED(1, 3)) { - dixLookupResourceByType((pointer *) &pGlxWindow, req->member, + dixLookupResourceByType((void **) &pGlxWindow, req->member, __glXWindowRes, NullClient, DixUnknownAccess); if (pGlxWindow) @@ -605,7 +605,7 @@ __glXDestroyContext(__GLXclientState * cl, GLbyte * pc) int to_screen = 0; int s; - dixLookupResourceByType((pointer *) &glxc, gcId, __glXContextRes, + dixLookupResourceByType((void **) &glxc, gcId, __glXContextRes, NullClient, DixUnknownAccess); if (glxc) { /* @@ -880,7 +880,7 @@ MakeCurrent(__GLXclientState * cl, ** Lookup new context. It must not be current for someone else. */ if (contextId != None) { - dixLookupResourceByType((pointer *) &glxc, contextId, __glXContextRes, + dixLookupResourceByType((void **) &glxc, contextId, __glXContextRes, NullClient, DixUnknownAccess); if (!glxc) { client->errorValue = contextId; @@ -935,7 +935,7 @@ MakeCurrent(__GLXclientState * cl, } if (!pDraw) { - dixLookupResourceByType((pointer *) &pGlxPixmap, drawId, + dixLookupResourceByType((void **) &pGlxPixmap, drawId, __glXPixmapRes, NullClient, DixUnknownAccess); if (pGlxPixmap) { @@ -960,7 +960,7 @@ MakeCurrent(__GLXclientState * cl, } if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1, 3)) { - dixLookupResourceByType((pointer *) &pGlxWindow, drawId, + dixLookupResourceByType((void **) &pGlxWindow, drawId, __glXWindowRes, NullClient, DixUnknownAccess); if (pGlxWindow) { @@ -983,7 +983,7 @@ MakeCurrent(__GLXclientState * cl, } if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1, 3)) { - dixLookupResourceByType((pointer *) &pGlxPbuffer, drawId, + dixLookupResourceByType((void **) &pGlxPbuffer, drawId, __glXPbufferRes, NullClient, DixUnknownAccess); if (pGlxPbuffer) { @@ -1050,7 +1050,7 @@ MakeCurrent(__GLXclientState * cl, } if (!pReadDraw) { - dixLookupResourceByType((pointer *) &pReadGlxPixmap, readId, + dixLookupResourceByType((void **) &pReadGlxPixmap, readId, __glXPixmapRes, NullClient, DixUnknownAccess); if (pReadGlxPixmap) { @@ -1072,7 +1072,7 @@ MakeCurrent(__GLXclientState * cl, } if (!pReadDraw && __GLX_IS_VERSION_SUPPORTED(1, 3)) { - dixLookupResourceByType((pointer *) &pGlxReadWindow, readId, + dixLookupResourceByType((void **) &pGlxReadWindow, readId, __glXWindowRes, NullClient, DixUnknownAccess); if (pGlxReadWindow) { @@ -1094,7 +1094,7 @@ MakeCurrent(__GLXclientState * cl, } if (!pReadDraw && __GLX_IS_VERSION_SUPPORTED(1, 3)) { - dixLookupResourceByType((pointer *) &pGlxReadPbuffer, readId, + dixLookupResourceByType((void **) &pGlxReadPbuffer, readId, __glXPbufferRes, NullClient, DixUnknownAccess); if (pGlxReadPbuffer) { @@ -1236,14 +1236,14 @@ MakeCurrent(__GLXclientState * cl, to_screen = screenInfo.numScreens - 1; if (pDraw && new_reply.writeType != GLX_PBUFFER_TYPE) { - dixLookupResourceByClass((pointer *) &pXinDraw, + dixLookupResourceByClass((void **) &pXinDraw, pDraw->id, XRC_DRAWABLE, client, DixReadAccess); } if (pReadDraw && pReadDraw != pDraw && new_reply.readType != GLX_PBUFFER_TYPE) { - dixLookupResourceByClass((pointer *) &pXinReadDraw, + dixLookupResourceByClass((void **) &pXinReadDraw, pReadDraw->id, XRC_DRAWABLE, client, DixReadAccess); } @@ -1460,7 +1460,7 @@ __glXIsDirect(__GLXclientState * cl, GLbyte * pc) /* ** Find the GL context. */ - dixLookupResourceByType((pointer *) &glxc, req->context, __glXContextRes, + dixLookupResourceByType((void **) &glxc, req->context, __glXContextRes, NullClient, DixUnknownAccess); if (!glxc) { client->errorValue = req->context; @@ -1619,13 +1619,13 @@ __glXCopyContext(__GLXclientState * cl, GLbyte * pc) /* ** Check that each context exists. */ - dixLookupResourceByType((pointer *) &src, source, __glXContextRes, + dixLookupResourceByType((void **) &src, source, __glXContextRes, NullClient, DixUnknownAccess); if (!src) { client->errorValue = source; return __glXBadContext; } - dixLookupResourceByType((pointer *) &dst, dest, __glXContextRes, + dixLookupResourceByType((void **) &dst, dest, __glXContextRes, NullClient, DixUnknownAccess); if (!dst) { client->errorValue = dest; @@ -1925,7 +1925,7 @@ CreateGLXPixmap(__GLXclientState * cl, from_screen = 0; to_screen = screenInfo.numScreens - 1; - dixLookupResourceByClass((pointer *) &pXinDraw, + dixLookupResourceByClass((void **) &pXinDraw, pDraw->id, XRC_DRAWABLE, client, DixReadAccess); } @@ -2009,6 +2009,7 @@ CreateGLXPixmap(__GLXclientState * cl, } else { client->errorValue = (visual ? visual : fbconfigId); + free(pGlxPixmap->be_xids); free(pGlxPixmap); return BadValue; } @@ -2017,6 +2018,7 @@ CreateGLXPixmap(__GLXclientState * cl, } if (!(AddResource(glxpixmapId, __glXPixmapRes, pGlxPixmap))) { + free(pGlxPixmap->be_xids); free(pGlxPixmap); return BadAlloc; } @@ -2055,7 +2057,7 @@ __glXDestroyGLXPixmap(__GLXclientState * cl, GLbyte * pc) /* ** Check if it's a valid GLX pixmap. */ - dixLookupResourceByType((pointer *) &pGlxPixmap, glxpixmap, + dixLookupResourceByType((void **) &pGlxPixmap, glxpixmap, __glXPixmapRes, NullClient, DixUnknownAccess); if (!pGlxPixmap) { client->errorValue = glxpixmap; @@ -2141,7 +2143,7 @@ __glXDoSwapBuffers(__GLXclientState * cl, XID drawId, GLXContextTag tag) } if (!pDraw) { - dixLookupResourceByType((pointer *) &pGlxPixmap, drawId, + dixLookupResourceByType((void **) &pGlxPixmap, drawId, __glXPixmapRes, NullClient, DixUnknownAccess); if (pGlxPixmap) { /* @@ -2153,7 +2155,7 @@ __glXDoSwapBuffers(__GLXclientState * cl, XID drawId, GLXContextTag tag) } if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1, 3)) { - dixLookupResourceByType((pointer *) &pGlxWindow, drawId, + dixLookupResourceByType((void **) &pGlxWindow, drawId, __glXWindowRes, NullClient, DixUnknownAccess); if (pGlxWindow) { /* @@ -2183,7 +2185,7 @@ __glXDoSwapBuffers(__GLXclientState * cl, XID drawId, GLXContextTag tag) if (!noPanoramiXExtension) { from_screen = 0; to_screen = screenInfo.numScreens - 1; - dixLookupResourceByClass((pointer *) &pXinDraw, + dixLookupResourceByClass((void **) &pXinDraw, pDraw->id, XRC_DRAWABLE, client, DixReadAccess); } @@ -2291,7 +2293,7 @@ __glXSwapBuffers(__GLXclientState * cl, GLbyte * pc) } if (!pDraw) { - dixLookupResourceByType((pointer *) &pGlxPixmap, drawId, + dixLookupResourceByType((void **) &pGlxPixmap, drawId, __glXPixmapRes, NullClient, DixUnknownAccess); if (pGlxPixmap) { /* @@ -2302,7 +2304,7 @@ __glXSwapBuffers(__GLXclientState * cl, GLbyte * pc) } if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1, 3)) { - dixLookupResourceByType((pointer *) &pGlxWindow, drawId, + dixLookupResourceByType((void **) &pGlxWindow, drawId, __glXWindowRes, NullClient, DixUnknownAccess); if (pGlxWindow) { /* @@ -2817,12 +2819,12 @@ __glXUseXFont(__GLXclientState * cl, GLbyte * pc) ** Font can actually be either the ID of a font or the ID of a GC ** containing a font. */ - dixLookupResourceByType((pointer *) &pFont, req->font, RT_FONT, + dixLookupResourceByType((void **) &pFont, req->font, RT_FONT, NullClient, DixUnknownAccess); if (!pFont) { GC *pGC; - dixLookupResourceByType((pointer *) &pGC, req->font, + dixLookupResourceByType((void **) &pGC, req->font, RT_GC, NullClient, DixUnknownAccess); if (!pGC) { client->errorValue = req->font; @@ -3082,7 +3084,7 @@ __glXCreateWindow(__GLXclientState * cl, GLbyte * pc) VisualPtr pVisual; VisualID visId; int i, rc; - pointer val; + void *val; /* ** Check if windowId is valid @@ -3184,7 +3186,7 @@ __glXDestroyWindow(__GLXclientState * cl, GLbyte * pc) ClientPtr client = cl->client; xGLXDestroyWindowReq *req = (xGLXDestroyWindowReq *) pc; XID glxwindow = req->glxwindow; - pointer val; + void *val; /* ** Check if it's a valid GLX window. @@ -3216,7 +3218,7 @@ __glXQueryContext(__GLXclientState * cl, GLbyte * pc) int nReplyBytes; req = (xGLXQueryContextReq *) pc; - dixLookupResourceByType((pointer *) &ctx, req->context, __glXContextRes, + dixLookupResourceByType((void **) &ctx, req->context, __glXContextRes, NullClient, DixUnknownAccess); if (!ctx) { client->errorValue = req->context; @@ -3266,7 +3268,7 @@ __glXQueryContextInfoEXT(__GLXclientState * cl, GLbyte * pc) int nReplyBytes; req = (xGLXQueryContextInfoEXTReq *) pc; - dixLookupResourceByType((pointer *) &ctx, + dixLookupResourceByType((void **) &ctx, req->context, __glXContextRes, client, DixReadAccess); @@ -3439,7 +3441,7 @@ __glXDestroyPbuffer(__GLXclientState * cl, GLbyte * pc) /* ** Check if it's a valid Pbuffer */ - dixLookupResourceByType((pointer *) &pGlxPbuffer, pbuffer, + dixLookupResourceByType((void **) &pGlxPbuffer, pbuffer, __glXPbufferRes, NullClient, DixUnknownAccess); if (!pGlxPbuffer) { client->errorValue = pbuffer; @@ -3514,7 +3516,7 @@ __glXGetDrawableAttributes(__GLXclientState * cl, GLbyte * pc) if (!pDraw) { __GLXpixmap *pGlxPixmap; - dixLookupResourceByType((pointer *) &pGlxPixmap, + dixLookupResourceByType((void **) &pGlxPixmap, drawId, __glXPixmapRes, NullClient, DixUnknownAccess); if (pGlxPixmap) { @@ -3527,7 +3529,7 @@ __glXGetDrawableAttributes(__GLXclientState * cl, GLbyte * pc) if (!pDraw) { __glXWindow *pGlxWindow; - dixLookupResourceByType((pointer *) &pGlxWindow, + dixLookupResourceByType((void **) &pGlxWindow, drawId, __glXWindowRes, NullClient, DixUnknownAccess); if (pGlxWindow) { @@ -3540,7 +3542,7 @@ __glXGetDrawableAttributes(__GLXclientState * cl, GLbyte * pc) if (!pDraw) { __glXPbuffer *pGlxPbuffer; - dixLookupResourceByType((pointer *) &pGlxPbuffer, + dixLookupResourceByType((void **) &pGlxPbuffer, drawId, __glXPbufferRes, NullClient, DixUnknownAccess); if (pGlxPbuffer) { @@ -3567,7 +3569,7 @@ __glXGetDrawableAttributes(__GLXclientState * cl, GLbyte * pc) #ifdef PANORAMIX if (!noPanoramiXExtension) { - if (Success != dixLookupResourceByClass((pointer *) &pXinDraw, + if (Success != dixLookupResourceByClass((void **) &pXinDraw, pDraw->id, XRC_DRAWABLE, client, DixReadAccess)) { client->errorValue = drawId; @@ -3676,7 +3678,7 @@ __glXChangeDrawableAttributes(__GLXclientState * cl, GLbyte * pc) if (!pDraw) { __GLXpixmap *pGlxPixmap; - dixLookupResourceByType((pointer *) &pGlxPixmap, + dixLookupResourceByType((void **) &pGlxPixmap, drawId, __glXPixmapRes, NullClient, DixUnknownAccess); if (pGlxPixmap) { @@ -3689,7 +3691,7 @@ __glXChangeDrawableAttributes(__GLXclientState * cl, GLbyte * pc) if (!pDraw) { __glXWindow *pGlxWindow; - dixLookupResourceByType((pointer *) &pGlxWindow, + dixLookupResourceByType((void **) &pGlxWindow, drawId, __glXWindowRes, NullClient, DixUnknownAccess); if (pGlxWindow) { @@ -3702,7 +3704,7 @@ __glXChangeDrawableAttributes(__GLXclientState * cl, GLbyte * pc) if (!pDraw) { __glXPbuffer *pGlxPbuffer; - dixLookupResourceByType((pointer *) &pGlxPbuffer, + dixLookupResourceByType((void **) &pGlxPbuffer, drawId, __glXPbufferRes, NullClient, DixUnknownAccess); if (pGlxPbuffer) { @@ -3731,7 +3733,7 @@ __glXChangeDrawableAttributes(__GLXclientState * cl, GLbyte * pc) if (!noPanoramiXExtension) { PanoramiXRes *pXinDraw; - if (Success != dixLookupResourceByClass((pointer *) &pXinDraw, + if (Success != dixLookupResourceByClass((void **) &pXinDraw, pDraw->id, XRC_DRAWABLE, client, DixReadAccess)) { client->errorValue = drawId; diff --git a/xserver/hw/dmx/glxProxy/glxext.c b/xserver/hw/dmx/glxProxy/glxext.c index b46970864..3c5a14bc7 100644 --- a/xserver/hw/dmx/glxProxy/glxext.c +++ b/xserver/hw/dmx/glxProxy/glxext.c @@ -182,7 +182,7 @@ __glXFreeGLXWindow(__glXWindow * pGlxWindow) WindowPtr pWindow = (WindowPtr) pGlxWindow->pDraw; WindowPtr ret; - dixLookupResourceByType((pointer) &ret, + dixLookupResourceByType((void *) &ret, pWindow->drawable.id, RT_WINDOW, NullClient, DixUnknownAccess); if (ret == pWindow) { @@ -414,7 +414,7 @@ __glXDispatch(ClientPtr client) */ XID xid = FakeClientID(client->index); - if (!AddResource(xid, __glXClientRes, (pointer) (long) client->index)) { + if (!AddResource(xid, __glXClientRes, (void *) (long) client->index)) { return BadAlloc; } ResetClientState(client->index); @@ -468,7 +468,7 @@ __glXSwapDispatch(ClientPtr client) */ XID xid = FakeClientID(client->index); - if (!AddResource(xid, __glXClientRes, (pointer) (long) client->index)) { + if (!AddResource(xid, __glXClientRes, (void *) (long) client->index)) { return BadAlloc; } ResetClientState(client->index); diff --git a/xserver/hw/dmx/glxProxy/glxswap.c b/xserver/hw/dmx/glxProxy/glxswap.c index 87a748621..5f565010d 100644 --- a/xserver/hw/dmx/glxProxy/glxswap.c +++ b/xserver/hw/dmx/glxProxy/glxswap.c @@ -110,7 +110,7 @@ SwapGroupIsReadyToSwap(SwapGroupPtr pSwap) } static Bool -SGSwapCleanup(ClientPtr client, pointer closure) +SGSwapCleanup(ClientPtr client, void *closure) { /* SwapGroupPtr pSwap = (SwapGroupPtr)closure; */ @@ -154,7 +154,7 @@ SGSwapBuffers(__GLXclientState * cl, XID drawId, GLXContextTag tag, else { /* The swap group/barrier is not yet ready to swap, so put * client to sleep until the rest are ready to swap */ - ClientSleep(cl->client, SGSwapCleanup, (pointer) pWin); + ClientSleep(cl->client, SGSwapCleanup, (void *) pWin); pCur->sleeping = TRUE; } diff --git a/xserver/hw/dmx/input/Makefile.in b/xserver/hw/dmx/input/Makefile.in index 9b27d4682..a0b08fbfd 100644 --- a/xserver/hw/dmx/input/Makefile.in +++ b/xserver/hw/dmx/input/Makefile.in @@ -188,6 +188,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -232,6 +234,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -334,7 +340,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -343,6 +352,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -409,6 +419,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/hw/dmx/input/dmxbackend.c b/xserver/hw/dmx/input/dmxbackend.c index 807e02328..56abe8013 100644 --- a/xserver/hw/dmx/input/dmxbackend.c +++ b/xserver/hw/dmx/input/dmxbackend.c @@ -101,7 +101,7 @@ typedef struct _myPrivate { #endif /** Create and return a private data structure. */ -pointer +void * dmxBackendCreatePrivate(DeviceIntPtr pDevice) { GETDMXLOCALFROMPDEVICE; @@ -115,7 +115,7 @@ dmxBackendCreatePrivate(DeviceIntPtr pDevice) * verify that the structure was actually created by * #dmxBackendCreatePrivate. */ void -dmxBackendDestroyPrivate(pointer private) +dmxBackendDestroyPrivate(void *private) { free(private); } @@ -262,7 +262,7 @@ dmxBackendOffscreen(int screen, int x, int y) /** This routine is called from #dmxCoreMotion for each motion * event. \a x and \a y are global coordinants. */ void -dmxBackendUpdatePosition(pointer private, int x, int y) +dmxBackendUpdatePosition(void *private, int x, int y) { GETPRIVFROMPRIVATE; int screen = miPointerGetScreen(inputInfo.pointer)->myNum; @@ -500,7 +500,7 @@ dmxBackendCollectEvents(DevicePtr pDev, * event processing actually takes place here, but this is a convenient * place to update the pointer. */ void -dmxBackendProcessInput(pointer private) +dmxBackendProcessInput(void *private) { GETPRIVFROMPRIVATE; @@ -650,7 +650,7 @@ dmxBackendKbdGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info) /** Process #DMXFunctionType functions. The only function handled here * is to acknowledge a pending server shutdown. */ int -dmxBackendFunctions(pointer private, DMXFunctionType function) +dmxBackendFunctions(void *private, DMXFunctionType function) { switch (function) { case DMX_FUNCTION_TERMINATE: diff --git a/xserver/hw/dmx/input/dmxbackend.h b/xserver/hw/dmx/input/dmxbackend.h index 6a49a56d6..a60857369 100644 --- a/xserver/hw/dmx/input/dmxbackend.h +++ b/xserver/hw/dmx/input/dmxbackend.h @@ -38,8 +38,8 @@ #ifndef _DMXBACKEND_H_ #define _DMXBACKEND_H_ -extern pointer dmxBackendCreatePrivate(DeviceIntPtr pDevice); -extern void dmxBackendDestroyPrivate(pointer private); +extern void *dmxBackendCreatePrivate(DeviceIntPtr pDevice); +extern void dmxBackendDestroyPrivate(void *private); extern void dmxBackendInit(DevicePtr pDev); extern void dmxBackendLateReInit(DevicePtr pDev); extern void dmxBackendMouGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info); @@ -49,8 +49,8 @@ extern void dmxBackendCollectEvents(DevicePtr pDev, dmxEnqueueProcPtr enqueue, dmxCheckSpecialProcPtr checkspecial, DMXBlockType block); -extern void dmxBackendProcessInput(pointer private); -extern int dmxBackendFunctions(pointer private, DMXFunctionType function); -extern void dmxBackendUpdatePosition(pointer private, int x, int y); +extern void dmxBackendProcessInput(void *private); +extern int dmxBackendFunctions(void *private, DMXFunctionType function); +extern void dmxBackendUpdatePosition(void *private, int x, int y); #endif diff --git a/xserver/hw/dmx/input/dmxcommon.c b/xserver/hw/dmx/input/dmxcommon.c index db558b55f..90154ef3e 100644 --- a/xserver/hw/dmx/input/dmxcommon.c +++ b/xserver/hw/dmx/input/dmxcommon.c @@ -339,7 +339,7 @@ dmxCommonOthOn(DevicePtr pDev) if (!(priv->xi = XOpenDevice(priv->display, dmxLocal->deviceId))) { dmxLog(dmxWarning, "Cannot open %s device (id=%d) on %s\n", dmxLocal->deviceName ? dmxLocal->deviceName : "(unknown)", - dmxLocal->deviceId, dmxInput->name); + (int) dmxLocal->deviceId, dmxInput->name); return -1; } ADD(DeviceKeyPress); @@ -558,7 +558,7 @@ dmxFindPointerScreen(int x, int y) * (e.g., when a keyboard and mouse form a pair that should share the * same private area). If the requested private area cannot be located, * then NULL is returned. */ -pointer +void * dmxCommonCopyPrivate(DeviceIntPtr pDevice) { GETDMXLOCALFROMPDEVICE; @@ -583,7 +583,7 @@ dmxCommonCopyPrivate(DeviceIntPtr pDevice) * server startup and server shutdown). */ void -dmxCommonSaveState(pointer private) +dmxCommonSaveState(void *private) { GETPRIVFROMPRIVATE; XKeyboardState ks; @@ -641,7 +641,7 @@ dmxCommonSaveState(pointer private) /** This routine restores all the information saved by #dmxCommonSaveState. */ void -dmxCommonRestoreState(pointer private) +dmxCommonRestoreState(void *private) { GETPRIVFROMPRIVATE; int retcode = -1; diff --git a/xserver/hw/dmx/input/dmxcommon.h b/xserver/hw/dmx/input/dmxcommon.h index d4f8d3c89..ed04287a5 100644 --- a/xserver/hw/dmx/input/dmxcommon.h +++ b/xserver/hw/dmx/input/dmxcommon.h @@ -118,7 +118,7 @@ extern void dmxCommonOthOff(DevicePtr pDev); extern void dmxCommonOthGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info); /* helper functions */ -extern pointer dmxCommonCopyPrivate(DeviceIntPtr pDevice); -extern void dmxCommonSaveState(pointer private); -extern void dmxCommonRestoreState(pointer private); +extern void *dmxCommonCopyPrivate(DeviceIntPtr pDevice); +extern void dmxCommonSaveState(void *private); +extern void dmxCommonRestoreState(void *private); #endif diff --git a/xserver/hw/dmx/input/dmxconsole.c b/xserver/hw/dmx/input/dmxconsole.c index 600a70553..f33a0ebd3 100644 --- a/xserver/hw/dmx/input/dmxconsole.c +++ b/xserver/hw/dmx/input/dmxconsole.c @@ -141,7 +141,7 @@ unscaley(myPrivate * priv, int y) } /** Create the private area for \a pDevice. */ -pointer +void * dmxConsoleCreatePrivate(DeviceIntPtr pDevice) { GETDMXLOCALFROMPDEVICE; @@ -153,7 +153,7 @@ dmxConsoleCreatePrivate(DeviceIntPtr pDevice) /** If \a private is non-NULL, free its associated memory. */ void -dmxConsoleDestroyPrivate(pointer private) +dmxConsoleDestroyPrivate(void *private) { free(private); } @@ -193,7 +193,7 @@ dmxConsoleDrawFineCursor(myPrivate * priv, XRectangle * rect) } static void -dmxConsoleDrawWindows(pointer private) +dmxConsoleDrawWindows(void *private) { GETONLYPRIVFROMPRIVATE; Display *dpy = priv->display; @@ -391,7 +391,7 @@ dmxConsoleUpdateFineCursor(myPrivate * priv) * fashion: the actual layout of the windows of the screen might not * have had any human-visible changes. */ void -dmxConsoleUpdateInfo(pointer private, DMXUpdateType type, WindowPtr pWindow) +dmxConsoleUpdateInfo(void *private, DMXUpdateType type, WindowPtr pWindow) { GETONLYPRIVFROMPRIVATE; dmxConsoleDraw(priv, 1, 1); @@ -436,7 +436,7 @@ dmxConsoleMoveRelative(myPrivate * priv, int x, int y, * allows the console's notion of the cursor postion to change when * another input device actually caused the change. */ void -dmxConsoleUpdatePosition(pointer private, int x, int y) +dmxConsoleUpdatePosition(void *private, int x, int y) { GETONLYPRIVFROMPRIVATE; int tmpX, tmpY; @@ -825,8 +825,8 @@ dmxConsoleInit(DevicePtr pDev) /* Set up properties */ XStoreName(dpy, win, DMX_CONSOLE_NAME); - class_hints.res_name = DMX_RES_NAME; - class_hints.res_class = DMX_RES_CLASS; + class_hints.res_name = (char *) DMX_RES_NAME; + class_hints.res_class = (char *) DMX_RES_CLASS; XSetClassHint(dpy, win, &class_hints); /* Map the window */ @@ -941,7 +941,7 @@ dmxConsoleKbdGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info) /** Handle special console-only keys. */ int -dmxConsoleFunctions(pointer private, DMXFunctionType function) +dmxConsoleFunctions(void *private, DMXFunctionType function) { GETONLYPRIVFROMPRIVATE; XRectangle rect; diff --git a/xserver/hw/dmx/input/dmxconsole.h b/xserver/hw/dmx/input/dmxconsole.h index 1c5261101..ea6033c3a 100644 --- a/xserver/hw/dmx/input/dmxconsole.h +++ b/xserver/hw/dmx/input/dmxconsole.h @@ -37,8 +37,8 @@ #ifndef _DMXCONSOLE_H_ #define _DMXCONSOLE_H_ -extern pointer dmxConsoleCreatePrivate(DeviceIntPtr pDevice); -extern void dmxConsoleDestroyPrivate(pointer private); +extern void *dmxConsoleCreatePrivate(DeviceIntPtr pDevice); +extern void dmxConsoleDestroyPrivate(void *private); extern void dmxConsoleInit(DevicePtr pDev); extern void dmxConsoleReInit(DevicePtr pDev); extern void dmxConsoleMouGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info); @@ -48,12 +48,12 @@ extern void dmxConsoleCollectEvents(DevicePtr pDev, dmxEnqueueProcPtr enqueue, dmxCheckSpecialProcPtr checkspecial, DMXBlockType block); -extern int dmxConsoleFunctions(pointer private, DMXFunctionType function); -extern void dmxConsoleUpdatePosition(pointer private, int x, int y); -extern void dmxConsoleKbdSetCtrl(pointer private, KeybdCtrl * ctrl); +extern int dmxConsoleFunctions(void *private, DMXFunctionType function); +extern void dmxConsoleUpdatePosition(void *private, int x, int y); +extern void dmxConsoleKbdSetCtrl(void *private, KeybdCtrl * ctrl); extern void dmxConsoleCapture(DMXInputInfo * dmxInput); extern void dmxConsoleUncapture(DMXInputInfo * dmxInput); -extern void dmxConsoleUpdateInfo(pointer private, +extern void dmxConsoleUpdateInfo(void *private, DMXUpdateType, WindowPtr pWindow); #endif diff --git a/xserver/hw/dmx/input/dmxevents.c b/xserver/hw/dmx/input/dmxevents.c index bcb5c2ed8..14ac05f5c 100644 --- a/xserver/hw/dmx/input/dmxevents.c +++ b/xserver/hw/dmx/input/dmxevents.c @@ -701,7 +701,6 @@ dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym, XEvent * e, DMXBlockType block) { GETDMXINPUTFROMPDEV; - xEvent xE; DeviceIntPtr p = dmxLocal->pDevice; int valuators[3]; ValuatorMask mask; @@ -716,7 +715,7 @@ dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym, if (dmxCheckFunctionKeys(dmxLocal, type, keySym)) return; if (dmxLocal->sendsCore && dmxLocal != dmxLocalCoreKeyboard) - xE.u.u.detail = dmxFixup(pDev, detail, keySym); + detail = dmxFixup(pDev, detail, keySym); /*ErrorF("KEY %d sym %d\n", detail, (int) keySym); */ QueueKeyboardEvents(p, type, detail, NULL); diff --git a/xserver/hw/dmx/input/dmxinputinit.c b/xserver/hw/dmx/input/dmxinputinit.c index b22a41f56..abb6a8551 100644 --- a/xserver/hw/dmx/input/dmxinputinit.c +++ b/xserver/hw/dmx/input/dmxinputinit.c @@ -225,7 +225,7 @@ dmxKbdCtrl(DeviceIntPtr pDevice, KeybdCtrl * ctrl) /* taken from kdrive/src/kinput.c: */ static void -dmxBell(int volume, DeviceIntPtr pDev, pointer arg, int something) +dmxBell(int volume, DeviceIntPtr pDev, void *arg, int something) { #if 0 KeybdCtrl *ctrl = arg; @@ -336,7 +336,7 @@ _dmxKeyboardBellProc(DMXLocalInputInfoPtr dmxLocal, int percent) * sound the bell on all of the devices that send core events. */ void dmxKeyboardBellProc(int percent, DeviceIntPtr pDevice, - pointer ctrl, int unknown) + void *ctrl, int unknown) { GETDMXLOCALFROMPDEVICE; int i, j; @@ -633,7 +633,7 @@ dmxCollectAll(DMXInputInfo * dmxInput) } static void -dmxBlockHandler(pointer blockData, OSTimePtr pTimeout, pointer pReadMask) +dmxBlockHandler(void *blockData, OSTimePtr pTimeout, void *pReadMask) { DMXInputInfo *dmxInput = &dmxInputs[(uintptr_t) blockData]; static unsigned long generation = 0; @@ -645,7 +645,7 @@ dmxBlockHandler(pointer blockData, OSTimePtr pTimeout, pointer pReadMask) } static void -dmxSwitchReturn(pointer p) +dmxSwitchReturn(void *p) { DMXInputInfo *dmxInput = p; int i; @@ -662,7 +662,7 @@ dmxSwitchReturn(pointer p) } static void -dmxWakeupHandler(pointer blockData, int result, pointer pReadMask) +dmxWakeupHandler(void *blockData, int result, void *pReadMask) { DMXInputInfo *dmxInput = &dmxInputs[(uintptr_t) blockData]; int i; @@ -921,7 +921,7 @@ dmxInputScanForExtensions(DMXInputInfo * dmxInput, int doXI) break; } dmxLogInput(dmxInput, " %2d %-10.10s %-16.16s\n", - devices[i].id, + (int) devices[i].id, devices[i].name ? devices[i].name : "", use); } @@ -993,7 +993,6 @@ dmxInputLateReInit(DMXInputInfo * dmxInput) void dmxInputInit(DMXInputInfo * dmxInput) { - DeviceIntPtr pPointer = NULL, pKeyboard = NULL; dmxArg a; const char *name; int i; @@ -1108,12 +1107,6 @@ dmxInputInit(DMXInputInfo * dmxInput) DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[i]; dmxLocal->pDevice = dmxAddDevice(dmxLocal); - if (dmxLocal->isCore) { - if (dmxLocal->type == DMX_LOCAL_MOUSE) - pPointer = dmxLocal->pDevice; - if (dmxLocal->type == DMX_LOCAL_KEYBOARD) - pKeyboard = dmxLocal->pDevice; - } } dmxInput->processInputEvents = dmxProcessInputEvents; @@ -1136,7 +1129,7 @@ dmxInputFreeLocal(DMXLocalInputInfoRec * local) local->destroy_private(local->private); free(local->history); free(local->valuators); - free(local->deviceName); + free((void *) local->deviceName); local->private = NULL; local->history = NULL; local->deviceName = NULL; @@ -1164,7 +1157,7 @@ dmxInputFree(DMXInputInfo * dmxInput) dmxInput->devs = NULL; dmxInput->numDevs = 0; if (dmxInput->freename) - free(dmxInput->name); + free((void *) dmxInput->name); dmxInput->name = NULL; } @@ -1218,7 +1211,7 @@ dmxInputLogDevices(void) dmxLogCont(dmxInfo, "\t[i%d/%*.*s", dmxInput->inputIdx, len, len, dmxInput->name); if (dmxInput->devs[i]->deviceId >= 0) - dmxLogCont(dmxInfo, "/id%d", dmxInput->devs[i]->deviceId); + dmxLogCont(dmxInfo, "/id%d", (int) dmxInput->devs[i]->deviceId); if (dmxInput->devs[i]->deviceName) dmxLogCont(dmxInfo, "=%s", dmxInput->devs[i]->deviceName); dmxLogCont(dmxInfo, "] %s\n", diff --git a/xserver/hw/dmx/input/dmxinputinit.h b/xserver/hw/dmx/input/dmxinputinit.h index 94ec1019b..11af2ca82 100644 --- a/xserver/hw/dmx/input/dmxinputinit.h +++ b/xserver/hw/dmx/input/dmxinputinit.h @@ -127,8 +127,8 @@ typedef struct _DMXLocalInitInfo { KeySym *symbols; /**< Key symbols */ } DMXLocalInitInfo, *DMXLocalInitInfoPtr; -typedef pointer (*dmxCreatePrivateProcPtr) (DeviceIntPtr); -typedef void (*dmxDestroyPrivateProcPtr) (pointer); +typedef void *(*dmxCreatePrivateProcPtr) (DeviceIntPtr); +typedef void (*dmxDestroyPrivateProcPtr) (void *); typedef void (*dmxInitProcPtr) (DevicePtr); typedef void (*dmxReInitProcPtr) (DevicePtr); @@ -136,13 +136,13 @@ typedef void (*dmxLateReInitProcPtr) (DevicePtr); typedef void (*dmxGetInfoProcPtr) (DevicePtr, DMXLocalInitInfoPtr); typedef int (*dmxOnProcPtr) (DevicePtr); typedef void (*dmxOffProcPtr) (DevicePtr); -typedef void (*dmxUpdatePositionProcPtr) (pointer, int x, int y); +typedef void (*dmxUpdatePositionProcPtr) (void *, int x, int y); -typedef void (*dmxVTPreSwitchProcPtr) (pointer); /* Turn I/O Off */ -typedef void (*dmxVTPostSwitchProcPtr) (pointer); /* Turn I/O On */ -typedef void (*dmxVTSwitchReturnProcPtr) (pointer); -typedef int (*dmxVTSwitchProcPtr) (pointer, int vt, - dmxVTSwitchReturnProcPtr, pointer); +typedef void (*dmxVTPreSwitchProcPtr) (void *); /* Turn I/O Off */ +typedef void (*dmxVTPostSwitchProcPtr) (void *); /* Turn I/O On */ +typedef void (*dmxVTSwitchReturnProcPtr) (void *); +typedef int (*dmxVTSwitchProcPtr) (void *, int vt, + dmxVTSwitchReturnProcPtr, void *); typedef void (*dmxMotionProcPtr) (DevicePtr, int *valuators, @@ -157,9 +157,9 @@ typedef void (*dmxCollectEventsProcPtr) (DevicePtr, dmxMotionProcPtr, dmxEnqueueProcPtr, dmxCheckSpecialProcPtr, DMXBlockType); -typedef void (*dmxProcessInputProcPtr) (pointer); -typedef void (*dmxUpdateInfoProcPtr) (pointer, DMXUpdateType, WindowPtr); -typedef int (*dmxFunctionsProcPtr) (pointer, DMXFunctionType); +typedef void (*dmxProcessInputProcPtr) (void *); +typedef void (*dmxUpdateInfoProcPtr) (void *, DMXUpdateType, WindowPtr); +typedef int (*dmxFunctionsProcPtr) (void *, DMXFunctionType); typedef void (*dmxKBCtrlProcPtr) (DevicePtr, KeybdCtrl * ctrl); typedef void (*dmxMCtrlProcPtr) (DevicePtr, PtrCtrl * ctrl); @@ -223,7 +223,7 @@ typedef struct _DMXLocalInputInfo { dmxKBCtrlProcPtr kCtrl; /**< Keyboard control */ dmxKBBellProcPtr kBell; /**< Bell control */ - pointer private; /**< Device-dependent private */ + void *private; /**< Device-dependent private */ int isCore; /**< Is a DMX core device */ int sendsCore; /**< Sends DMX core events */ KeybdCtrl kctrl; /**< Keyboard control */ @@ -269,7 +269,7 @@ extern DMXLocalInputInfoPtr dmxInputCopyLocal(DMXInputInfo * dmxInput, extern void dmxChangePointerControl(DeviceIntPtr pDevice, PtrCtrl * ctrl); extern void dmxKeyboardKbdCtrlProc(DeviceIntPtr pDevice, KeybdCtrl * ctrl); extern void dmxKeyboardBellProc(int percent, DeviceIntPtr pDevice, - pointer ctrl, int unknown); + void *ctrl, int unknown); extern int dmxInputExtensionErrorHandler(Display * dsp, _Xconst char *name, _Xconst char *reason); diff --git a/xserver/hw/dmx/input/lnx-keyboard.c b/xserver/hw/dmx/input/lnx-keyboard.c index ecf4f591c..1a4d01f36 100644 --- a/xserver/hw/dmx/input/lnx-keyboard.c +++ b/xserver/hw/dmx/input/lnx-keyboard.c @@ -361,7 +361,7 @@ static unsigned char at2lnx[NUM_KEYCODES] = { }; /** Create a private structure for use within this file. */ -pointer +void * kbdLinuxCreatePrivate(DeviceIntPtr pKeyboard) { myPrivate *priv = calloc(1, sizeof(*priv)); @@ -373,7 +373,7 @@ kbdLinuxCreatePrivate(DeviceIntPtr pKeyboard) /** Destroy a private structure. */ void -kbdLinuxDestroyPrivate(pointer priv) +kbdLinuxDestroyPrivate(void *priv) { free(priv); } @@ -466,13 +466,13 @@ static int kbdLinuxActivate(int fd, int vtno, int setSig); /** Currently unused hook called prior to an VT switch. */ void -kbdLinuxVTPreSwitch(pointer p) +kbdLinuxVTPreSwitch(void *p) { } /** Currently unused hook called after returning from a VT switch. */ void -kbdLinuxVTPostSwitch(pointer p) +kbdLinuxVTPostSwitch(void *p) { } @@ -481,8 +481,8 @@ kbdLinuxVTPostSwitch(pointer p) * switched back to the pre-switch VT (i.e., the user returns to the DMX * session). */ int -kbdLinuxVTSwitch(pointer p, int vt, - void (*switch_return) (pointer), pointer switch_return_data) +kbdLinuxVTSwitch(void *p, int vt, + void (*switch_return) (void *), void *switch_return_data) { myPrivate *priv = p; diff --git a/xserver/hw/dmx/input/lnx-keyboard.h b/xserver/hw/dmx/input/lnx-keyboard.h index 891c6a9a4..857ea11b1 100644 --- a/xserver/hw/dmx/input/lnx-keyboard.h +++ b/xserver/hw/dmx/input/lnx-keyboard.h @@ -37,19 +37,19 @@ #ifndef _LNX_KEYBOARD_H_ #define _LNX_KEYBOARD_H_ -extern pointer kbdLinuxCreatePrivate(DeviceIntPtr pKeyboard); -extern void kbdLinuxDestroyPrivate(pointer private); +extern void *kbdLinuxCreatePrivate(DeviceIntPtr pKeyboard); +extern void kbdLinuxDestroyPrivate(void *private); extern void kbdLinuxInit(DevicePtr pDev); extern void kbdLinuxGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info); extern int kbdLinuxOn(DevicePtr pDev); extern void kbdLinuxOff(DevicePtr pDev); -extern void kbdLinuxVTPreSwitch(pointer p); -extern void kbdLinuxVTPostSwitch(pointer p); -extern int kbdLinuxVTSwitch(pointer p, int vt, +extern void kbdLinuxVTPreSwitch(void *p); +extern void kbdLinuxVTPostSwitch(void *p); +extern int kbdLinuxVTSwitch(void *p, int vt, dmxVTSwitchReturnProcPtr switch_return, - pointer switch_return_data); + void *switch_return_data); extern void kbdLinuxRead(DevicePtr pDev, dmxMotionProcPtr motion, diff --git a/xserver/hw/dmx/input/lnx-ms.c b/xserver/hw/dmx/input/lnx-ms.c index 7e1acf450..210f6de22 100644 --- a/xserver/hw/dmx/input/lnx-ms.c +++ b/xserver/hw/dmx/input/lnx-ms.c @@ -302,18 +302,18 @@ msLinuxGetMap(DevicePtr pDev, unsigned char *map, int *nButtons) /** Currently unused hook called prior to an VT switch. */ void -msLinuxVTPreSwitch(pointer p) +msLinuxVTPreSwitch(void *p) { } /** Currently unused hook called after returning from a VT switch. */ void -msLinuxVTPostSwitch(pointer p) +msLinuxVTPostSwitch(void *p) { } /** Create a private structure for use within this file. */ -pointer +void * msLinuxCreatePrivate(DeviceIntPtr pMouse) { myPrivate *priv = calloc(1, sizeof(*priv)); @@ -325,7 +325,7 @@ msLinuxCreatePrivate(DeviceIntPtr pMouse) /** Destroy a private structure. */ void -msLinuxDestroyPrivate(pointer priv) +msLinuxDestroyPrivate(void *priv) { free(priv); } diff --git a/xserver/hw/dmx/input/lnx-ms.h b/xserver/hw/dmx/input/lnx-ms.h index 28ed09557..7f3ba4ead 100644 --- a/xserver/hw/dmx/input/lnx-ms.h +++ b/xserver/hw/dmx/input/lnx-ms.h @@ -37,8 +37,8 @@ #ifndef _LNX_MS_H_ #define _LNX_MS_H_ -extern pointer msLinuxCreatePrivate(DeviceIntPtr pMouse); -extern void msLinuxDestroyPrivate(pointer priv); +extern void *msLinuxCreatePrivate(DeviceIntPtr pMouse); +extern void msLinuxDestroyPrivate(void *priv); extern void msLinuxRead(DevicePtr pDev, dmxMotionProcPtr motion, dmxEnqueueProcPtr enqueue, @@ -49,7 +49,7 @@ extern void msLinuxGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info); extern int msLinuxOn(DevicePtr pDev); extern void msLinuxOff(DevicePtr pDev); extern void msLinuxCtrl(DevicePtr pDev, PtrCtrl * ctrl); -extern void msLinuxVTPreSwitch(pointer p); -extern void msLinuxVTPostSwitch(pointer p); +extern void msLinuxVTPreSwitch(void *p); +extern void msLinuxVTPostSwitch(void *p); #endif diff --git a/xserver/hw/dmx/input/lnx-ps2.c b/xserver/hw/dmx/input/lnx-ps2.c index 67c73a0c5..dd70cb8ea 100644 --- a/xserver/hw/dmx/input/lnx-ps2.c +++ b/xserver/hw/dmx/input/lnx-ps2.c @@ -272,18 +272,18 @@ ps2LinuxGetMap(DevicePtr pDev, unsigned char *map, int *nButtons) /** Currently unused hook called prior to an VT switch. */ void -ps2LinuxVTPreSwitch(pointer p) +ps2LinuxVTPreSwitch(void *p) { } /** Currently unused hook called after returning from a VT switch. */ void -ps2LinuxVTPostSwitch(pointer p) +ps2LinuxVTPostSwitch(void *p) { } /** Create a private structure for use within this file. */ -pointer +void * ps2LinuxCreatePrivate(DeviceIntPtr pMouse) { myPrivate *priv = calloc(1, sizeof(*priv)); @@ -295,7 +295,7 @@ ps2LinuxCreatePrivate(DeviceIntPtr pMouse) /** Destroy a private structure. */ void -ps2LinuxDestroyPrivate(pointer priv) +ps2LinuxDestroyPrivate(void *priv) { free(priv); } diff --git a/xserver/hw/dmx/input/lnx-ps2.h b/xserver/hw/dmx/input/lnx-ps2.h index 93f0f0219..339f3538c 100644 --- a/xserver/hw/dmx/input/lnx-ps2.h +++ b/xserver/hw/dmx/input/lnx-ps2.h @@ -37,8 +37,8 @@ #ifndef _LNX_PS2_H_ #define _LNX_PS2_H_ -extern pointer ps2LinuxCreatePrivate(DeviceIntPtr pMouse); -extern void ps2LinuxDestroyPrivate(pointer priv); +extern void *ps2LinuxCreatePrivate(DeviceIntPtr pMouse); +extern void ps2LinuxDestroyPrivate(void *priv); extern void ps2LinuxRead(DevicePtr pDev, dmxMotionProcPtr motion, dmxEnqueueProcPtr enqueue, @@ -49,7 +49,7 @@ extern void ps2LinuxGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info); extern int ps2LinuxOn(DevicePtr pDev); extern void ps2LinuxOff(DevicePtr pDev); extern void ps2LinuxCtrl(DevicePtr pDev, PtrCtrl * ctrl); -extern void ps2LinuxVTPreSwitch(pointer p); -extern void ps2LinuxVTPostSwitch(pointer p); +extern void ps2LinuxVTPreSwitch(void *p); +extern void ps2LinuxVTPostSwitch(void *p); #endif diff --git a/xserver/hw/dmx/input/usb-common.c b/xserver/hw/dmx/input/usb-common.c index c7c166cce..67aa07e0a 100644 --- a/xserver/hw/dmx/input/usb-common.c +++ b/xserver/hw/dmx/input/usb-common.c @@ -474,7 +474,7 @@ usbOff(DevicePtr pDev) } /** Create a private structure for use within this file. */ -pointer +void * usbCreatePrivate(DeviceIntPtr pDevice) { myPrivate *priv = calloc(1, sizeof(*priv)); @@ -486,7 +486,7 @@ usbCreatePrivate(DeviceIntPtr pDevice) /** Destroy a private structure. */ void -usbDestroyPrivate(pointer priv) +usbDestroyPrivate(void *priv) { free(priv); } diff --git a/xserver/hw/dmx/input/usb-common.h b/xserver/hw/dmx/input/usb-common.h index eea98afbe..71593765f 100644 --- a/xserver/hw/dmx/input/usb-common.h +++ b/xserver/hw/dmx/input/usb-common.h @@ -43,8 +43,8 @@ typedef enum { usbOther } usbType; -extern pointer usbCreatePrivate(DeviceIntPtr pDevice); -extern void usbDestroyPrivate(pointer priv); +extern void *usbCreatePrivate(DeviceIntPtr pDevice); +extern void usbDestroyPrivate(void *priv); extern void usbRead(DevicePtr pDev, dmxMotionProcPtr motion, dmxEnqueueProcPtr enqueue, diff --git a/xserver/hw/dmx/man/Makefile.in b/xserver/hw/dmx/man/Makefile.in index 79e558847..680f8f42a 100644 --- a/xserver/hw/dmx/man/Makefile.in +++ b/xserver/hw/dmx/man/Makefile.in @@ -160,6 +160,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -204,6 +206,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -268,6 +274,7 @@ MAN_SUBSTS = @MAN_SUBSTS@ -e 's|__logdir__|$(logdir)|g' -e \ 's|__XKB_DFLT_OPTIONS__|$(XKB_DFLT_OPTIONS)|g' -e \ 's|__bundle_id_prefix__|$(BUNDLE_ID_PREFIX)|g' -e \ 's|__modulepath__|$(DEFAULT_MODULE_PATH)|g' -e \ + 's|__suid_wrapper_dir__|$(SUID_WRAPPER_DIR)|g' -e \ 's|__default_font_path__|$(COMPILEDDEFAULTFONTPATH)|g' -e \ '\|$(COMPILEDDEFAULTFONTPATH)| s|/,|/, |g' MISC_MAN_DIR = @MISC_MAN_DIR@ @@ -322,7 +329,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -331,6 +341,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -397,6 +408,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/hw/kdrive/Makefile.in b/xserver/hw/kdrive/Makefile.in index 4b8960244..6f181074a 100644 --- a/xserver/hw/kdrive/Makefile.in +++ b/xserver/hw/kdrive/Makefile.in @@ -167,6 +167,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -211,6 +213,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -313,7 +319,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -322,6 +331,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -388,6 +398,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/hw/kdrive/ephyr/Makefile.am b/xserver/hw/kdrive/ephyr/Makefile.am index 6b790fddd..00a53d0df 100644 --- a/xserver/hw/kdrive/ephyr/Makefile.am +++ b/xserver/hw/kdrive/ephyr/Makefile.am @@ -27,12 +27,20 @@ AM_CPPFLAGS = \ @XEPHYR_INCS@ \ @XEPHYR_CFLAGS@ \ -I$(top_srcdir) \ + -I$(top_srcdir)/glamor \ -I$(top_srcdir)/exa if XV XV_SRCS = ephyrvideo.c endif +if GLAMOR +GLAMOR_SRCS = \ + ephyr_glamor_glx.c \ + ephyr_glamor_glx.h \ + $() +endif + if DRI DRI_SRCS = \ ephyrdriext.c \ @@ -59,14 +67,24 @@ Xephyr_SOURCES = \ hostx.h \ $(XV_SRCS) \ $(DRI_SRCS) \ + $(GLAMOR_SRCS) \ $() +if GLAMOR +AM_CPPFLAGS += $(XLIB_CFLAGS) +XEPHYR_GLAMOR_LIB = \ + $(top_builddir)/glamor/libglamor.la \ + $(top_builddir)/glamor/libglamor_egl_stubs.la \ + $() +endif + Xephyr_LDADD = \ $(top_builddir)/exa/libexa.la \ + $(XEPHYR_GLAMOR_LIB) \ @KDRIVE_LIBS@ \ @XEPHYR_LIBS@ -Xephyr_DEPENDENCIES = @KDRIVE_LOCAL_LIBS@ +Xephyr_DEPENDENCIES = @KDRIVE_LOCAL_LIBS@ $(XEPHYR_GLAMOR_LIB) Xephyr_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG) diff --git a/xserver/hw/kdrive/ephyr/Makefile.in b/xserver/hw/kdrive/ephyr/Makefile.in index d5e461d58..1cf0570e5 100644 --- a/xserver/hw/kdrive/ephyr/Makefile.in +++ b/xserver/hw/kdrive/ephyr/Makefile.in @@ -72,6 +72,7 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ bin_PROGRAMS = Xephyr$(EXEEXT) +@GLAMOR_TRUE@am__append_1 = $(XLIB_CFLAGS) subdir = hw/kdrive/ephyr DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(top_srcdir)/depcomp @@ -99,14 +100,18 @@ PROGRAMS = $(bin_PROGRAMS) am__Xephyr_SOURCES_DIST = ephyr.c ephyr.h ephyrlog.h ephyr_draw.c os.c \ ephyrinit.c hostx.c hostx.h ephyrvideo.c ephyrdriext.c \ ephyrdriext.h ephyrdri.c ephyrdri.h ephyrglxext.c \ - ephyrglxext.h ephyrhostglx.c ephyrhostglx.h + ephyrglxext.h ephyrhostglx.c ephyrhostglx.h ephyr_glamor_glx.c \ + ephyr_glamor_glx.h @XV_TRUE@am__objects_1 = ephyrvideo.$(OBJEXT) @DRI_TRUE@am__objects_2 = ephyrdriext.$(OBJEXT) ephyrdri.$(OBJEXT) \ @DRI_TRUE@ ephyrglxext.$(OBJEXT) ephyrhostglx.$(OBJEXT) +@GLAMOR_TRUE@am__objects_3 = ephyr_glamor_glx.$(OBJEXT) am_Xephyr_OBJECTS = ephyr.$(OBJEXT) ephyr_draw.$(OBJEXT) os.$(OBJEXT) \ ephyrinit.$(OBJEXT) hostx.$(OBJEXT) $(am__objects_1) \ - $(am__objects_2) + $(am__objects_2) $(am__objects_3) Xephyr_OBJECTS = $(am_Xephyr_OBJECTS) +@GLAMOR_TRUE@am__DEPENDENCIES_1 = $(top_builddir)/glamor/libglamor.la \ +@GLAMOR_TRUE@ $(top_builddir)/glamor/libglamor_egl_stubs.la AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent @@ -234,6 +239,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -278,6 +285,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -380,7 +391,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -389,6 +403,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -455,6 +470,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ @@ -528,15 +547,15 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = man -AM_CPPFLAGS = \ - @KDRIVE_INCS@ \ - @KDRIVE_CFLAGS@ \ - @XEPHYR_INCS@ \ - @XEPHYR_CFLAGS@ \ - -I$(top_srcdir) \ - -I$(top_srcdir)/exa - +AM_CPPFLAGS = @KDRIVE_INCS@ @KDRIVE_CFLAGS@ @XEPHYR_INCS@ \ + @XEPHYR_CFLAGS@ -I$(top_srcdir) -I$(top_srcdir)/glamor \ + -I$(top_srcdir)/exa $(am__append_1) @XV_TRUE@XV_SRCS = ephyrvideo.c +@GLAMOR_TRUE@GLAMOR_SRCS = \ +@GLAMOR_TRUE@ ephyr_glamor_glx.c \ +@GLAMOR_TRUE@ ephyr_glamor_glx.h \ +@GLAMOR_TRUE@ $() + @DRI_TRUE@DRI_SRCS = \ @DRI_TRUE@ ephyrdriext.c \ @DRI_TRUE@ ephyrdriext.h \ @@ -559,14 +578,21 @@ Xephyr_SOURCES = \ hostx.h \ $(XV_SRCS) \ $(DRI_SRCS) \ + $(GLAMOR_SRCS) \ $() +@GLAMOR_TRUE@XEPHYR_GLAMOR_LIB = \ +@GLAMOR_TRUE@ $(top_builddir)/glamor/libglamor.la \ +@GLAMOR_TRUE@ $(top_builddir)/glamor/libglamor_egl_stubs.la \ +@GLAMOR_TRUE@ $() + Xephyr_LDADD = \ $(top_builddir)/exa/libexa.la \ + $(XEPHYR_GLAMOR_LIB) \ @KDRIVE_LIBS@ \ @XEPHYR_LIBS@ -Xephyr_DEPENDENCIES = @KDRIVE_LOCAL_LIBS@ +Xephyr_DEPENDENCIES = @KDRIVE_LOCAL_LIBS@ $(XEPHYR_GLAMOR_LIB) Xephyr_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG) all: all-recursive @@ -660,6 +686,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ephyr.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ephyr_draw.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ephyr_glamor_glx.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ephyrdri.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ephyrdriext.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ephyrglxext.Po@am__quote@ diff --git a/xserver/hw/kdrive/ephyr/ephyr.c b/xserver/hw/kdrive/ephyr/ephyr.c index b2a79855c..def50d8d8 100644 --- a/xserver/hw/kdrive/ephyr/ephyr.c +++ b/xserver/hw/kdrive/ephyr/ephyr.c @@ -43,9 +43,15 @@ #include "ephyrglxext.h" #endif /* XF86DRI */ +#ifdef GLAMOR +#include "glamor.h" +#endif +#include "ephyr_glamor_glx.h" + #include "xkbsrv.h" extern int KdTsPhyScreen; +extern Bool ephyr_glamor; KdKeyboardInfo *ephyrKbd; KdPointerInfo *ephyrMouse; @@ -326,22 +332,26 @@ ephyrInternalDamageRedisplay(ScreenPtr pScreen) int nbox; BoxPtr pbox; - nbox = RegionNumRects(pRegion); - pbox = RegionRects(pRegion); - - while (nbox--) { - hostx_paint_rect(screen, - pbox->x1, pbox->y1, - pbox->x1, pbox->y1, - pbox->x2 - pbox->x1, pbox->y2 - pbox->y1); - pbox++; + if (ephyr_glamor) { + ephyr_glamor_damage_redisplay(scrpriv->glamor, pRegion); + } else { + nbox = RegionNumRects(pRegion); + pbox = RegionRects(pRegion); + + while (nbox--) { + hostx_paint_rect(screen, + pbox->x1, pbox->y1, + pbox->x1, pbox->y1, + pbox->x2 - pbox->x1, pbox->y2 - pbox->y1); + pbox++; + } } DamageEmpty(scrpriv->pDamage); } } static void -ephyrInternalDamageBlockHandler(pointer data, OSTimePtr pTimeout, pointer pRead) +ephyrInternalDamageBlockHandler(void *data, OSTimePtr pTimeout, void *pRead) { ScreenPtr pScreen = (ScreenPtr) data; @@ -349,7 +359,7 @@ ephyrInternalDamageBlockHandler(pointer data, OSTimePtr pTimeout, pointer pRead) } static void -ephyrInternalDamageWakeupHandler(pointer data, int i, pointer LastSelectMask) +ephyrInternalDamageWakeupHandler(void *data, int i, void *LastSelectMask) { /* FIXME: Not needed ? */ } @@ -368,7 +378,7 @@ ephyrSetInternalDamage(ScreenPtr pScreen) if (!RegisterBlockAndWakeupHandlers(ephyrInternalDamageBlockHandler, ephyrInternalDamageWakeupHandler, - (pointer) pScreen)) + (void *) pScreen)) return FALSE; pPixmap = (*pScreen->GetScreenPixmap) (pScreen); @@ -389,7 +399,7 @@ ephyrUnsetInternalDamage(ScreenPtr pScreen) RemoveBlockAndWakeupHandlers(ephyrInternalDamageBlockHandler, ephyrInternalDamageWakeupHandler, - (pointer) pScreen); + (void *) pScreen); } #ifdef RANDR @@ -662,6 +672,7 @@ ephyrInitScreen(ScreenPtr pScreen) return TRUE; } + Bool ephyrFinishInitScreen(ScreenPtr pScreen) { @@ -679,6 +690,12 @@ ephyrFinishInitScreen(ScreenPtr pScreen) return TRUE; } +/** + * Called by kdrive after calling down the + * pScreen->CreateScreenResources() chain, this gives us a chance to + * make any pixmaps after the screen and all extensions have been + * initialized. + */ Bool ephyrCreateResources(ScreenPtr pScreen) { @@ -693,8 +710,13 @@ ephyrCreateResources(ScreenPtr pScreen) return KdShadowSet(pScreen, scrpriv->randr, ephyrShadowUpdate, ephyrWindowLinear); - else + else { +#ifdef GLAMOR + if (ephyr_glamor) + ephyr_glamor_create_screen_resources(pScreen); +#endif return ephyrSetInternalDamage(pScreen); + } } void @@ -1008,6 +1030,29 @@ ephyrProcessButtonRelease(xcb_generic_event_t *xev) KdEnqueuePointerEvent(ephyrMouse, mouseState | KD_MOUSE_DELTA, 0, 0, 0); } +/* Xephyr wants ctrl+shift to grab the window, but that conflicts with + ctrl+alt+shift key combos. Remember the modifier state on key presses and + releases, if mod1 is pressed, we need ctrl, shift and mod1 released + before we allow a shift-ctrl grab activation. + + note: a key event contains the mask _before_ the current key takes + effect, so mod1_was_down will be reset on the first key press after all + three were released, not on the last release. That'd require some more + effort. + */ +static int +ephyrUpdateGrabModifierState(int state) +{ + static int mod1_was_down = 0; + + if ((state & (XCB_MOD_MASK_CONTROL|XCB_MOD_MASK_SHIFT|XCB_MOD_MASK_1)) == 0) + mod1_was_down = 0; + else if (state & XCB_MOD_MASK_1) + mod1_was_down = 1; + + return mod1_was_down; +} + static void ephyrProcessKeyPress(xcb_generic_event_t *xev) { @@ -1018,6 +1063,7 @@ ephyrProcessKeyPress(xcb_generic_event_t *xev) return; } + ephyrUpdateGrabModifierState(key->state); ephyrUpdateModifierState(key->state); KdEnqueueKeyboardEvent(ephyrKbd, key->detail, FALSE); } @@ -1029,6 +1075,7 @@ ephyrProcessKeyRelease(xcb_generic_event_t *xev) xcb_key_release_event_t *key = (xcb_key_release_event_t *)xev; static xcb_key_symbols_t *keysyms; static int grabbed_screen = -1; + int mod1_down = ephyrUpdateGrabModifierState(key->state); if (!keysyms) keysyms = xcb_key_symbols_alloc(conn); @@ -1049,7 +1096,7 @@ ephyrProcessKeyRelease(xcb_generic_event_t *xev) hostx_set_win_title(screen, "(ctrl+shift grabs mouse and keyboard)"); } - else { + else if (!mod1_down) { /* Attempt grab */ xcb_grab_keyboard_cookie_t kbgrabc = xcb_grab_keyboard(conn, @@ -1176,6 +1223,9 @@ ephyrPoll(void) break; } + if (ephyr_glamor) + ephyr_glamor_process_event(xev); + free(xev); } } @@ -1207,6 +1257,9 @@ ephyrGetColors(ScreenPtr pScreen, int n, xColorItem * pdefs) void ephyrPutColors(ScreenPtr pScreen, int n, xColorItem * pdefs) { + KdScreenPriv(pScreen); + KdScreenInfo *screen = pScreenPriv->screen; + EphyrScrPriv *scrpriv = screen->driver; int min, max, p; /* XXX Not sure if this is right */ @@ -1226,6 +1279,18 @@ ephyrPutColors(ScreenPtr pScreen, int n, xColorItem * pdefs) pdefs->green >> 8, pdefs->blue >> 8); pdefs++; } + if (scrpriv->pDamage) { + BoxRec box; + RegionRec region; + + box.x1 = 0; + box.y1 = 0; + box.x2 = pScreen->width; + box.y2 = pScreen->height; + RegionInit(®ion, &box, 1); + DamageReportDamage(scrpriv->pDamage, ®ion); + RegionUninit(®ion); + } } /* Mouse calls */ diff --git a/xserver/hw/kdrive/ephyr/ephyr.h b/xserver/hw/kdrive/ephyr/ephyr.h index 73fdb59e6..34ce4601b 100644 --- a/xserver/hw/kdrive/ephyr/ephyr.h +++ b/xserver/hw/kdrive/ephyr/ephyr.h @@ -80,6 +80,12 @@ typedef struct _ephyrScrPriv { KdScreenInfo *screen; int mynum; /* Screen number */ + + /** + * Per-screen Xlib-using state for glamor (private to + * ephyr_glamor_glx.c) + */ + struct ephyr_glamor *glamor; } EphyrScrPriv; extern KdCardFuncs ephyrFuncs; @@ -203,6 +209,14 @@ void void ephyrDrawFini(ScreenPtr pScreen); +/* hostx.c glamor support */ +Bool ephyr_glamor_init(ScreenPtr pScreen); +Bool ephyr_glamor_create_screen_resources(ScreenPtr pScreen); +void ephyr_glamor_enable(ScreenPtr pScreen); +void ephyr_glamor_disable(ScreenPtr pScreen); +void ephyr_glamor_fini(ScreenPtr pScreen); +void ephyr_glamor_host_paint_rect(ScreenPtr pScreen); + /*ephyvideo.c*/ Bool ephyrInitVideo(ScreenPtr pScreen); diff --git a/xserver/hw/kdrive/ephyr/ephyr_glamor_glx.c b/xserver/hw/kdrive/ephyr/ephyr_glamor_glx.c new file mode 100644 index 000000000..eaf565496 --- /dev/null +++ b/xserver/hw/kdrive/ephyr/ephyr_glamor_glx.c @@ -0,0 +1,346 @@ +/* + * Copyright © 2013 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +/** @file ephyr_glamor_glx.c + * + * Separate file for hiding Xlib and GLX-using parts of xephyr from + * the rest of the server-struct-aware build. + */ + +#include <stdlib.h> +#include <X11/Xlib.h> +#include <X11/Xlibint.h> +#undef Xcalloc +#undef Xrealloc +#undef Xfree +#include <X11/Xlib-xcb.h> +#include <xcb/xcb_aux.h> +#include <pixman.h> +#include <epoxy/glx.h> +#include "ephyr_glamor_glx.h" +#include "os.h" +#include <X11/Xproto.h> + +/** @{ + * + * global state for Xephyr with glamor. + * + * Xephyr can render with multiple windows, but all the windows have + * to be on the same X connection and all have to have the same + * visual. + */ +static Display *dpy; +static XVisualInfo *visual_info; +static GLXFBConfig fb_config; +/** @} */ + +/** + * Per-screen state for Xephyr with glamor. + */ +struct ephyr_glamor { + GLXContext ctx; + Window win; + GLXWindow glx_win; + + GLuint tex; + + GLuint texture_shader; + GLuint texture_shader_position_loc; + GLuint texture_shader_texcoord_loc; + + /* Size of the window that we're rendering to. */ + unsigned width, height; +}; + +static GLint +ephyr_glamor_compile_glsl_prog(GLenum type, const char *source) +{ + GLint ok; + GLint prog; + + prog = glCreateShader(type); + glShaderSource(prog, 1, (const GLchar **) &source, NULL); + glCompileShader(prog); + glGetShaderiv(prog, GL_COMPILE_STATUS, &ok); + if (!ok) { + GLchar *info; + GLint size; + + glGetShaderiv(prog, GL_INFO_LOG_LENGTH, &size); + info = malloc(size); + if (info) { + glGetShaderInfoLog(prog, size, NULL, info); + ErrorF("Failed to compile %s: %s\n", + type == GL_FRAGMENT_SHADER ? "FS" : "VS", info); + ErrorF("Program source:\n%s", source); + free(info); + } + else + ErrorF("Failed to get shader compilation info.\n"); + FatalError("GLSL compile failure\n"); + } + + return prog; +} + +static GLuint +ephyr_glamor_build_glsl_prog(GLuint vs, GLuint fs) +{ + GLint ok; + GLuint prog; + + prog = glCreateProgram(); + glAttachShader(prog, vs); + glAttachShader(prog, fs); + + glLinkProgram(prog); + glGetProgramiv(prog, GL_LINK_STATUS, &ok); + if (!ok) { + GLchar *info; + GLint size; + + glGetProgramiv(prog, GL_INFO_LOG_LENGTH, &size); + info = malloc(size); + + glGetProgramInfoLog(prog, size, NULL, info); + ErrorF("Failed to link: %s\n", info); + FatalError("GLSL link failure\n"); + } + + return prog; +} + +static void +ephyr_glamor_setup_texturing_shader(struct ephyr_glamor *glamor) +{ + const char *vs_source = + "attribute vec2 texcoord;\n" + "attribute vec2 position;\n" + "varying vec2 t;\n" + "\n" + "void main()\n" + "{\n" + " t = texcoord;\n" + " gl_Position = vec4(position, 0, 1);\n" + "}\n"; + + const char *fs_source = + "varying vec2 t;\n" + "uniform sampler2D s; /* initially 0 */\n" + "\n" + "void main()\n" + "{\n" + " gl_FragColor = texture2D(s, t);\n" + "}\n"; + + GLuint fs, vs, prog; + + vs = ephyr_glamor_compile_glsl_prog(GL_VERTEX_SHADER, vs_source); + fs = ephyr_glamor_compile_glsl_prog(GL_FRAGMENT_SHADER, fs_source); + prog = ephyr_glamor_build_glsl_prog(vs, fs); + + glamor->texture_shader = prog; + glamor->texture_shader_position_loc = glGetAttribLocation(prog, "position"); + assert(glamor->texture_shader_position_loc != -1); + glamor->texture_shader_texcoord_loc = glGetAttribLocation(prog, "texcoord"); + assert(glamor->texture_shader_texcoord_loc != -1); +} + +xcb_connection_t * +ephyr_glamor_connect(void) +{ + dpy = XOpenDisplay(NULL); + if (!dpy) + return NULL; + + XSetEventQueueOwner(dpy, XCBOwnsEventQueue); + + return XGetXCBConnection(dpy); +} + +void +ephyr_glamor_set_texture(struct ephyr_glamor *glamor, uint32_t tex) +{ + glamor->tex = tex; +} + +void +ephyr_glamor_damage_redisplay(struct ephyr_glamor *glamor, + struct pixman_region16 *damage) +{ + /* Redraw the whole screen, since glXSwapBuffers leaves the back + * buffer undefined. + */ + static const float position[] = { + -1, -1, + 1, -1, + 1, 1, + -1, 1, + }; + static const float texcoords[] = { + 0, 1, + 1, 1, + 1, 0, + 0, 0, + }; + + glXMakeCurrent(dpy, glamor->glx_win, glamor->ctx); + + glBindFramebuffer(GL_FRAMEBUFFER, 0); + glUseProgram(glamor->texture_shader); + glViewport(0, 0, glamor->width, glamor->height); + + glVertexAttribPointer(glamor->texture_shader_position_loc, + 2, GL_FLOAT, FALSE, 0, position); + glVertexAttribPointer(glamor->texture_shader_texcoord_loc, + 2, GL_FLOAT, FALSE, 0, texcoords); + glEnableVertexAttribArray(glamor->texture_shader_position_loc); + glEnableVertexAttribArray(glamor->texture_shader_texcoord_loc); + + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D, glamor->tex); + glDrawArrays(GL_TRIANGLE_FAN, 0, 4); + + glDisableVertexAttribArray(glamor->texture_shader_position_loc); + glDisableVertexAttribArray(glamor->texture_shader_texcoord_loc); + + glXSwapBuffers(dpy, glamor->glx_win); +} + +/** + * Xlib-based handling of xcb events for glamor. + * + * We need to let the Xlib event filtering run on the event so that + * Mesa's dri2_glx.c userspace event mangling gets run, and we + * correctly get our invalidate events propagated into the driver. + */ +void +ephyr_glamor_process_event(xcb_generic_event_t *xev) +{ + + uint32_t response_type = xev->response_type & 0x7f; + /* Note the types on wire_to_event: there's an Xlib XEvent (with + * the broken types) that it returns, and a protocol xEvent that + * it inspects. + */ + Bool (*wire_to_event)(Display *dpy, XEvent *ret, xEvent *event); + + XLockDisplay(dpy); + /* Set the event handler to NULL to get access to the current one. */ + wire_to_event = XESetWireToEvent(dpy, response_type, NULL); + if (wire_to_event) { + XEvent processed_event; + + /* OK they had an event handler. Plug it back in, and call + * through to it. + */ + XESetWireToEvent(dpy, response_type, wire_to_event); + xev->sequence = LastKnownRequestProcessed(dpy); + wire_to_event(dpy, &processed_event, (xEvent *)xev); + } + XUnlockDisplay(dpy); +} + +struct ephyr_glamor * +ephyr_glamor_glx_screen_init(xcb_window_t win) +{ + GLXContext ctx; + struct ephyr_glamor *glamor; + GLXWindow glx_win; + + glamor = calloc(1, sizeof(struct ephyr_glamor)); + if (!glamor) { + FatalError("malloc"); + return NULL; + } + + glx_win = glXCreateWindow(dpy, fb_config, win, NULL); + + ctx = glXCreateContext(dpy, visual_info, NULL, True); + if (ctx == NULL) + FatalError("glXCreateContext failed\n"); + + if (!glXMakeCurrent(dpy, glx_win, ctx)) + FatalError("glXMakeCurrent failed\n"); + + glamor->ctx = ctx; + glamor->win = win; + glamor->glx_win = glx_win; + ephyr_glamor_setup_texturing_shader(glamor); + + return glamor; +} + +void +ephyr_glamor_glx_screen_fini(struct ephyr_glamor *glamor) +{ + glXMakeCurrent(dpy, None, NULL); + glXDestroyContext(dpy, glamor->ctx); + glXDestroyWindow(dpy, glamor->glx_win); + + free(glamor); +} + +xcb_visualtype_t * +ephyr_glamor_get_visual(void) +{ + xcb_screen_t *xscreen = + xcb_aux_get_screen(XGetXCBConnection(dpy), DefaultScreen(dpy)); + int attribs[] = { + GLX_RENDER_TYPE, GLX_RGBA_BIT, + GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT, + GLX_RED_SIZE, 1, + GLX_GREEN_SIZE, 1, + GLX_BLUE_SIZE, 1, + GLX_DOUBLEBUFFER, 1, + None + }; + int event_base = 0, error_base = 0, nelements; + GLXFBConfig *fbconfigs; + + if (!glXQueryExtension (dpy, &error_base, &event_base)) + FatalError("Couldn't find GLX extension\n"); + + fbconfigs = glXChooseFBConfig(dpy, DefaultScreen(dpy), attribs, &nelements); + if (!nelements) + FatalError("Couldn't choose an FBConfig\n"); + fb_config = fbconfigs[0]; + free(fbconfigs); + + visual_info = glXGetVisualFromFBConfig(dpy, fb_config); + if (visual_info == NULL) + FatalError("Couldn't get RGB visual\n"); + + return xcb_aux_find_visual_by_id(xscreen, visual_info->visualid); +} + +void +ephyr_glamor_set_window_size(struct ephyr_glamor *glamor, + unsigned width, unsigned height) +{ + if (!glamor) + return; + + glamor->width = width; + glamor->height = height; +} diff --git a/xserver/hw/kdrive/ephyr/ephyr_glamor_glx.h b/xserver/hw/kdrive/ephyr/ephyr_glamor_glx.h new file mode 100644 index 000000000..0c238cf5b --- /dev/null +++ b/xserver/hw/kdrive/ephyr/ephyr_glamor_glx.h @@ -0,0 +1,83 @@ +/* + * Copyright © 2013 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +/** + * ephyr_glamor_glx.h + * + * Prototypes exposed by ephyr_glamor_glx.c, without including any + * server headers. + */ + +#include <xcb/xcb.h> +#include "dix-config.h" + +struct ephyr_glamor; +struct pixman_region16; + +xcb_connection_t * +ephyr_glamor_connect(void); + +void +ephyr_glamor_set_texture(struct ephyr_glamor *ephyr_glamor, uint32_t tex); + +xcb_visualtype_t * +ephyr_glamor_get_visual(void); + +struct ephyr_glamor * +ephyr_glamor_glx_screen_init(xcb_window_t win); + +void +ephyr_glamor_glx_screen_fini(struct ephyr_glamor *glamor); + +#ifdef GLAMOR +void +ephyr_glamor_set_window_size(struct ephyr_glamor *glamor, + unsigned width, unsigned height); + +void +ephyr_glamor_damage_redisplay(struct ephyr_glamor *glamor, + struct pixman_region16 *damage); + +void +ephyr_glamor_process_event(xcb_generic_event_t *xev); + +#else /* !GLAMOR */ + +static inline void +ephyr_glamor_set_window_size(struct ephyr_glamor *glamor, + unsigned width, unsigned height) +{ +} + +static inline void +ephyr_glamor_damage_redisplay(struct ephyr_glamor *glamor, + struct pixman_region16 *damage) +{ +} + +static inline void +ephyr_glamor_process_event(xcb_generic_event_t *xev) +{ +} + +#endif /* !GLAMOR */ diff --git a/xserver/hw/kdrive/ephyr/ephyrdriext.c b/xserver/hw/kdrive/ephyr/ephyrdriext.c index e2b33db03..8368d1233 100644 --- a/xserver/hw/kdrive/ephyr/ephyrdriext.c +++ b/xserver/hw/kdrive/ephyr/ephyrdriext.c @@ -1098,7 +1098,6 @@ ProcXF86DRIGetDrawableInfo(register ClientPtr client) if (rep.numClipRects) { if (clipRects) { ScreenPtr pScreen = screenInfo.screens[stuff->screen]; - int i = 0; EPHYR_LOG("clip list of host gl drawable:\n"); for (i = 0; i < rep.numClipRects; i++) { diff --git a/xserver/hw/kdrive/ephyr/ephyrinit.c b/xserver/hw/kdrive/ephyr/ephyrinit.c index cf8bc9073..fac84cd13 100644 --- a/xserver/hw/kdrive/ephyr/ephyrinit.c +++ b/xserver/hw/kdrive/ephyr/ephyrinit.c @@ -35,6 +35,7 @@ extern Bool EphyrWantGrayScale; extern Bool EphyrWantResize; extern Bool kdHasPointer; extern Bool kdHasKbd; +extern Bool ephyr_glamor; #ifdef GLXEXT extern Bool ephyrNoDRI; @@ -64,10 +65,7 @@ static const ExtensionModule ephyrExtensions[] = { static void ephyrExtensionInit(void) { - int i; - - for (i = 0; i < ARRAY_SIZE(ephyrExtensions); i++) - LoadExtension(&ephyrExtensions[i], TRUE); + LoadExtensionList(ephyrExtensions, ARRAY_SIZE(ephyrExtensions), TRUE); } @@ -138,6 +136,9 @@ ddxUseMsg(void) ErrorF("-fullscreen Attempt to run Xephyr fullscreen\n"); ErrorF("-grayscale Simulate 8bit grayscale\n"); ErrorF("-resizeable Make Xephyr windows resizeable\n"); +#ifdef GLAMOR + ErrorF("-glamor Enable 2D acceleration using glamor\n"); +#endif ErrorF ("-fakexa Simulate acceleration using software rendering\n"); ErrorF("-verbosity <level> Set log verbosity level\n"); @@ -149,8 +150,6 @@ ddxUseMsg(void) ErrorF ("-title [title] set the window title in the WM_NAME property\n"); ErrorF("\n"); - - exit(1); } void @@ -243,6 +242,16 @@ ddxProcessArgument(int argc, char **argv, int i) EphyrWantResize = 1; return 1; } +#ifdef GLAMOR + else if (!strcmp (argv[i], "-glamor")) { + ephyr_glamor = TRUE; + ephyrFuncs.initAccel = ephyr_glamor_init; + ephyrFuncs.enableAccel = ephyr_glamor_enable; + ephyrFuncs.disableAccel = ephyr_glamor_disable; + ephyrFuncs.finiAccel = ephyr_glamor_fini; + return 1; + } +#endif else if (!strcmp(argv[i], "-fakexa")) { ephyrFuncs.initAccel = ephyrDrawInit; ephyrFuncs.enableAccel = ephyrDrawEnable; diff --git a/xserver/hw/kdrive/ephyr/ephyrvideo.c b/xserver/hw/kdrive/ephyr/ephyrvideo.c index 4a05721af..c6728351f 100644 --- a/xserver/hw/kdrive/ephyr/ephyrvideo.c +++ b/xserver/hw/kdrive/ephyr/ephyrvideo.c @@ -84,15 +84,15 @@ static Bool ephyrXVPrivSaveImageToPortPriv(EphyrPortPriv * a_port_priv, int a_image_len); static void ephyrStopVideo(KdScreenInfo * a_info, - pointer a_xv_priv, Bool a_exit); + void *a_xv_priv, Bool a_exit); static int ephyrSetPortAttribute(KdScreenInfo * a_info, Atom a_attr_name, - int a_attr_value, pointer a_port_priv); + int a_attr_value, void *a_port_priv); static int ephyrGetPortAttribute(KdScreenInfo * a_screen_info, Atom a_attr_name, - int *a_attr_value, pointer a_port_priv); + int *a_attr_value, void *a_port_priv); static void ephyrQueryBestSize(KdScreenInfo * a_info, Bool a_motion, @@ -101,7 +101,7 @@ static void ephyrQueryBestSize(KdScreenInfo * a_info, short a_drw_w, short a_drw_h, unsigned int *a_prefered_w, - unsigned int *a_prefered_h, pointer a_port_priv); + unsigned int *a_prefered_h, void *a_port_priv); static int ephyrPutImage(KdScreenInfo * a_info, DrawablePtr a_drawable, @@ -118,13 +118,13 @@ static int ephyrPutImage(KdScreenInfo * a_info, short a_width, short a_height, Bool a_sync, - RegionPtr a_clipping_region, pointer a_port_priv); + RegionPtr a_clipping_region, void *a_port_priv); static int ephyrReputImage(KdScreenInfo * a_info, DrawablePtr a_drawable, short a_drw_x, short a_drw_y, - RegionPtr a_clipping_region, pointer a_port_priv); + RegionPtr a_clipping_region, void *a_port_priv); static int ephyrPutVideo(KdScreenInfo * a_info, DrawablePtr a_drawable, @@ -132,7 +132,7 @@ static int ephyrPutVideo(KdScreenInfo * a_info, short a_drw_x, short a_drw_y, short a_vid_w, short a_vid_h, short a_drw_w, short a_drw_h, - RegionPtr a_clip_region, pointer a_port_priv); + RegionPtr a_clip_region, void *a_port_priv); static int ephyrGetVideo(KdScreenInfo * a_info, DrawablePtr a_drawable, @@ -140,7 +140,7 @@ static int ephyrGetVideo(KdScreenInfo * a_info, short a_drw_x, short a_drw_y, short a_vid_w, short a_vid_h, short a_drw_w, short a_drw_h, - RegionPtr a_clip_region, pointer a_port_priv); + RegionPtr a_clip_region, void *a_port_priv); static int ephyrPutStill(KdScreenInfo * a_info, DrawablePtr a_drawable, @@ -148,7 +148,7 @@ static int ephyrPutStill(KdScreenInfo * a_info, short a_drw_x, short a_drw_y, short a_vid_w, short a_vid_h, short a_drw_w, short a_drw_h, - RegionPtr a_clip_region, pointer a_port_priv); + RegionPtr a_clip_region, void *a_port_priv); static int ephyrGetStill(KdScreenInfo * a_info, DrawablePtr a_drawable, @@ -156,7 +156,7 @@ static int ephyrGetStill(KdScreenInfo * a_info, short a_drw_x, short a_drw_y, short a_vid_w, short a_vid_h, short a_drw_w, short a_drw_h, - RegionPtr a_clip_region, pointer a_port_priv); + RegionPtr a_clip_region, void *a_port_priv); static int ephyrQueryImageAttributes(KdScreenInfo * a_info, int a_id, @@ -744,7 +744,7 @@ ephyrXVPrivSaveImageToPortPriv(EphyrPortPriv * a_port_priv, } static void -ephyrStopVideo(KdScreenInfo * a_info, pointer a_port_priv, Bool a_exit) +ephyrStopVideo(KdScreenInfo * a_info, void *a_port_priv, Bool a_exit) { xcb_connection_t *conn = hostx_get_xcbconn(); EphyrPortPriv *port_priv = a_port_priv; @@ -759,7 +759,7 @@ ephyrStopVideo(KdScreenInfo * a_info, pointer a_port_priv, Bool a_exit) static int ephyrSetPortAttribute(KdScreenInfo * a_info, - Atom a_attr_name, int a_attr_value, pointer a_port_priv) + Atom a_attr_name, int a_attr_value, void *a_port_priv) { xcb_connection_t *conn = hostx_get_xcbconn(); int res = Success, host_atom = 0; @@ -814,7 +814,7 @@ ephyrSetPortAttribute(KdScreenInfo * a_info, static int ephyrGetPortAttribute(KdScreenInfo * a_screen_info, - Atom a_attr_name, int *a_attr_value, pointer a_port_priv) + Atom a_attr_name, int *a_attr_value, void *a_port_priv) { xcb_connection_t *conn = hostx_get_xcbconn(); int res = Success, host_atom = 0; @@ -862,7 +862,7 @@ ephyrQueryBestSize(KdScreenInfo * a_info, short a_drw_w, short a_drw_h, unsigned int *a_prefered_w, - unsigned int *a_prefered_h, pointer a_port_priv) + unsigned int *a_prefered_h, void *a_port_priv) { xcb_connection_t *conn = hostx_get_xcbconn(); EphyrPortPriv *port_priv = a_port_priv; @@ -992,7 +992,7 @@ ephyrPutImage(KdScreenInfo * a_info, unsigned char *a_buf, short a_width, short a_height, - Bool a_sync, RegionPtr a_clipping_region, pointer a_port_priv) + Bool a_sync, RegionPtr a_clipping_region, void *a_port_priv) { EphyrPortPriv *port_priv = a_port_priv; Bool is_ok = FALSE; @@ -1064,7 +1064,7 @@ static int ephyrReputImage(KdScreenInfo * a_info, DrawablePtr a_drawable, short a_drw_x, - short a_drw_y, RegionPtr a_clipping_region, pointer a_port_priv) + short a_drw_y, RegionPtr a_clipping_region, void *a_port_priv) { EphyrPortPriv *port_priv = a_port_priv; int result = BadImplementation; @@ -1107,7 +1107,7 @@ ephyrPutVideo(KdScreenInfo * a_info, short a_drw_x, short a_drw_y, short a_vid_w, short a_vid_h, short a_drw_w, short a_drw_h, - RegionPtr a_clipping_region, pointer a_port_priv) + RegionPtr a_clipping_region, void *a_port_priv) { EphyrScrPriv *scrpriv = a_info->driver; xcb_connection_t *conn = hostx_get_xcbconn(); @@ -1138,7 +1138,7 @@ ephyrGetVideo(KdScreenInfo * a_info, short a_drw_x, short a_drw_y, short a_vid_w, short a_vid_h, short a_drw_w, short a_drw_h, - RegionPtr a_clipping_region, pointer a_port_priv) + RegionPtr a_clipping_region, void *a_port_priv) { EphyrScrPriv *scrpriv = a_info->driver; xcb_connection_t *conn = hostx_get_xcbconn(); @@ -1170,7 +1170,7 @@ ephyrPutStill(KdScreenInfo * a_info, short a_drw_x, short a_drw_y, short a_vid_w, short a_vid_h, short a_drw_w, short a_drw_h, - RegionPtr a_clipping_region, pointer a_port_priv) + RegionPtr a_clipping_region, void *a_port_priv) { EphyrScrPriv *scrpriv = a_info->driver; xcb_connection_t *conn = hostx_get_xcbconn(); @@ -1201,7 +1201,7 @@ ephyrGetStill(KdScreenInfo * a_info, short a_drw_x, short a_drw_y, short a_vid_w, short a_vid_h, short a_drw_w, short a_drw_h, - RegionPtr a_clipping_region, pointer a_port_priv) + RegionPtr a_clipping_region, void *a_port_priv) { EphyrScrPriv *scrpriv = a_info->driver; xcb_connection_t *conn = hostx_get_xcbconn(); diff --git a/xserver/hw/kdrive/ephyr/hostx.c b/xserver/hw/kdrive/ephyr/hostx.c index 57e7dc292..435919e0a 100644 --- a/xserver/hw/kdrive/ephyr/hostx.c +++ b/xserver/hw/kdrive/ephyr/hostx.c @@ -36,6 +36,7 @@ #include <string.h> /* for memset */ #include <errno.h> #include <time.h> +#include <err.h> #include <sys/ipc.h> #include <sys/shm.h> @@ -54,6 +55,11 @@ #include <xcb/xf86dri.h> #include <xcb/glx.h> #endif /* XF86DRI */ +#ifdef GLAMOR +#include <epoxy/gl.h> +#include "glamor.h" +#include "ephyr_glamor_glx.h" +#endif #include "ephyrlog.h" #include "ephyr.h" @@ -85,13 +91,12 @@ static int HostXWantDamageDebug = 0; extern EphyrKeySyms ephyrKeySyms; -extern int monitorResolution; - extern Bool EphyrWantResize; char *ephyrResName = NULL; int ephyrResNameFromCmd = 0; char *ephyrTitle = NULL; +Bool ephyr_glamor = FALSE; static void hostx_set_fullscreen_hint(void); @@ -304,7 +309,12 @@ hostx_init(void) | XCB_EVENT_MASK_STRUCTURE_NOTIFY; EPHYR_DBG("mark"); - HostX.conn = xcb_connect(NULL, &HostX.screen); +#ifdef GLAMOR + if (ephyr_glamor) + HostX.conn = ephyr_glamor_connect(); + else +#endif + HostX.conn = xcb_connect(NULL, &HostX.screen); if (xcb_connection_has_error(HostX.conn)) { fprintf(stderr, "\nXephyr cannot open host display. Is DISPLAY set?\n"); exit(1); @@ -314,7 +324,12 @@ hostx_init(void) HostX.winroot = xscreen->root; HostX.gc = xcb_generate_id(HostX.conn); HostX.depth = xscreen->root_depth; - HostX.visual = xcb_aux_find_visual_by_id(xscreen, xscreen->root_visual); +#ifdef GLAMOR + if (ephyr_glamor) + HostX.visual = ephyr_glamor_get_visual(); + else +#endif + HostX.visual = xcb_aux_find_visual_by_id(xscreen,xscreen->root_visual); xcb_create_gc(HostX.conn, HostX.gc, HostX.winroot, 0, NULL); cookie_WINDOW_STATE = xcb_intern_atom(HostX.conn, FALSE, @@ -644,7 +659,7 @@ hostx_screen_init(KdScreenInfo *screen, } } - if (HostX.have_shm) { + if (!ephyr_glamor && HostX.have_shm) { scrpriv->ximg = xcb_image_create_native(HostX.conn, width, buffer_height, @@ -679,7 +694,7 @@ hostx_screen_init(KdScreenInfo *screen, } } - if (!shm_success) { + if (!ephyr_glamor && !shm_success) { EPHYR_DBG("Creating image %dx%d for screen scrpriv=%p\n", width, buffer_height, scrpriv); scrpriv->ximg = xcb_image_create_native(HostX.conn, @@ -719,6 +734,15 @@ hostx_screen_init(KdScreenInfo *screen, scrpriv->win_width = width; scrpriv->win_height = height; +#ifdef GLAMOR + if (ephyr_glamor) { + *bytes_per_line = 0; + *bits_per_pixel = 0; + ephyr_glamor_set_window_size(scrpriv->glamor, + scrpriv->win_width, scrpriv->win_height); + return NULL; + } else +#endif if (host_depth_matches_server(scrpriv)) { *bytes_per_line = scrpriv->ximg->stride; *bits_per_pixel = scrpriv->ximg->bpp; @@ -750,6 +774,23 @@ hostx_paint_rect(KdScreenInfo *screen, EPHYR_DBG("painting in screen %d\n", scrpriv->mynum); +#ifdef GLAMOR + if (ephyr_glamor) { + BoxRec box; + RegionRec region; + + box.x1 = dx; + box.y1 = dy; + box.x2 = dx + width; + box.y2 = dy + height; + + RegionInit(®ion, &box, 1); + ephyr_glamor_damage_redisplay(scrpriv->glamor, ®ion); + RegionUninit(®ion); + return; + } +#endif + /* * Copy the image data updated by the shadow layer * on to the window @@ -1178,3 +1219,87 @@ hostx_get_resource_id_peer(int a_local_resource_id, int *a_remote_resource_id) } #endif /* XF86DRI */ + +#ifdef GLAMOR +Bool +ephyr_glamor_init(ScreenPtr screen) +{ + KdScreenPriv(screen); + KdScreenInfo *kd_screen = pScreenPriv->screen; + EphyrScrPriv *scrpriv = kd_screen->driver; + + scrpriv->glamor = ephyr_glamor_glx_screen_init(scrpriv->win); + ephyr_glamor_set_window_size(scrpriv->glamor, + scrpriv->win_width, scrpriv->win_height); + + glamor_init(screen, + GLAMOR_USE_SCREEN | + GLAMOR_USE_PICTURE_SCREEN | + GLAMOR_INVERTED_Y_AXIS); + + return TRUE; +} + +Bool +ephyr_glamor_create_screen_resources(ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + KdScreenInfo *kd_screen = pScreenPriv->screen; + EphyrScrPriv *scrpriv = kd_screen->driver; + PixmapPtr screen_pixmap; + uint32_t tex; + + if (!ephyr_glamor) + return TRUE; + + /* kdrive's fbSetupScreen() told mi to have + * miCreateScreenResources() (which is called before this) make a + * scratch pixmap wrapping ephyr-glamor's NULL + * KdScreenInfo->fb.framebuffer. + * + * We want a real (texture-based) screen pixmap at this point. + * This is what glamor will render into, and we'll then texture + * out of that into the host's window to present the results. + * + * Thus, delete the current screen pixmap, and put a fresh one in. + */ + screen_pixmap = pScreen->GetScreenPixmap(pScreen); + pScreen->DestroyPixmap(screen_pixmap); + + screen_pixmap = pScreen->CreatePixmap(pScreen, + pScreen->width, + pScreen->height, + pScreen->rootDepth, + GLAMOR_CREATE_NO_LARGE); + + pScreen->SetScreenPixmap(screen_pixmap); + + /* Tell the GLX code what to GL texture to read from. */ + tex = glamor_get_pixmap_texture(screen_pixmap); + ephyr_glamor_set_texture(scrpriv->glamor, tex); + + return TRUE; +} + +void +ephyr_glamor_enable(ScreenPtr screen) +{ +} + +void +ephyr_glamor_disable(ScreenPtr screen) +{ +} + +void +ephyr_glamor_fini(ScreenPtr screen) +{ + KdScreenPriv(screen); + KdScreenInfo *kd_screen = pScreenPriv->screen; + EphyrScrPriv *scrpriv = kd_screen->driver; + + glamor_fini(screen); + ephyr_glamor_glx_screen_fini(scrpriv->glamor); + scrpriv->glamor = NULL; +} +#endif diff --git a/xserver/hw/kdrive/ephyr/man/Makefile.in b/xserver/hw/kdrive/ephyr/man/Makefile.in index 783623fda..52091f5b0 100644 --- a/xserver/hw/kdrive/ephyr/man/Makefile.in +++ b/xserver/hw/kdrive/ephyr/man/Makefile.in @@ -160,6 +160,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -204,6 +206,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -268,6 +274,7 @@ MAN_SUBSTS = @MAN_SUBSTS@ -e 's|__logdir__|$(logdir)|g' -e \ 's|__XKB_DFLT_OPTIONS__|$(XKB_DFLT_OPTIONS)|g' -e \ 's|__bundle_id_prefix__|$(BUNDLE_ID_PREFIX)|g' -e \ 's|__modulepath__|$(DEFAULT_MODULE_PATH)|g' -e \ + 's|__suid_wrapper_dir__|$(SUID_WRAPPER_DIR)|g' -e \ 's|__default_font_path__|$(COMPILEDDEFAULTFONTPATH)|g' -e \ '\|$(COMPILEDDEFAULTFONTPATH)| s|/,|/, |g' MISC_MAN_DIR = @MISC_MAN_DIR@ @@ -322,7 +329,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -331,6 +341,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -397,6 +408,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/hw/kdrive/fake/Makefile.in b/xserver/hw/kdrive/fake/Makefile.in index 7f99a338b..6648b29f7 100644 --- a/xserver/hw/kdrive/fake/Makefile.in +++ b/xserver/hw/kdrive/fake/Makefile.in @@ -171,6 +171,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -215,6 +217,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -317,7 +323,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -326,6 +335,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -392,6 +402,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/hw/kdrive/fbdev/Makefile.in b/xserver/hw/kdrive/fbdev/Makefile.in index 27281014d..90a1cb212 100644 --- a/xserver/hw/kdrive/fbdev/Makefile.in +++ b/xserver/hw/kdrive/fbdev/Makefile.in @@ -172,6 +172,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -216,6 +218,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -318,7 +324,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -327,6 +336,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -393,6 +403,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/hw/kdrive/linux/Makefile.in b/xserver/hw/kdrive/linux/Makefile.in index 8e122eba2..694ca34ea 100644 --- a/xserver/hw/kdrive/linux/Makefile.in +++ b/xserver/hw/kdrive/linux/Makefile.in @@ -173,6 +173,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -217,6 +219,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -319,7 +325,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -328,6 +337,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -394,6 +404,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/hw/kdrive/linux/linux.c b/xserver/hw/kdrive/linux/linux.c index 00de2ae0e..73a8169bf 100644 --- a/xserver/hw/kdrive/linux/linux.c +++ b/xserver/hw/kdrive/linux/linux.c @@ -68,13 +68,16 @@ LinuxCheckChown(const char *file) struct stat st; __uid_t u; __gid_t g; + int r; if (stat(file, &st) < 0) return; u = getuid(); g = getgid(); - if (st.st_uid != u || st.st_gid != g) - chown(file, u, g); + if (st.st_uid != u || st.st_gid != g) { + r = chown(file, u, g); + (void) r; + } } static int @@ -167,14 +170,14 @@ LinuxSetSwitchMode(int mode) } static void -LinuxApmBlock(pointer blockData, OSTimePtr pTimeout, pointer pReadmask) +LinuxApmBlock(void *blockData, OSTimePtr pTimeout, void *pReadmask) { } static Bool LinuxApmRunning; static void -LinuxApmWakeup(pointer blockData, int result, pointer pReadmask) +LinuxApmWakeup(void *blockData, int result, void *pReadmask) { fd_set *readmask = (fd_set *) pReadmask; diff --git a/xserver/hw/kdrive/openbsd/Makefile.in b/xserver/hw/kdrive/openbsd/Makefile.in index 3df02dd46..62a1db968 100644 --- a/xserver/hw/kdrive/openbsd/Makefile.in +++ b/xserver/hw/kdrive/openbsd/Makefile.in @@ -164,6 +164,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -208,6 +210,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -310,7 +316,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -319,6 +328,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -385,6 +395,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/hw/kdrive/src/Makefile.am b/xserver/hw/kdrive/src/Makefile.am index 5799ddbdb..d69f0dd99 100644 --- a/xserver/hw/kdrive/src/Makefile.am +++ b/xserver/hw/kdrive/src/Makefile.am @@ -4,7 +4,7 @@ AM_CPPFLAGS = \ AM_CFLAGS = -DHAVE_DIX_CONFIG_H -noinst_LTLIBRARIES = libkdrive.la libkdrivestubs.la +noinst_LTLIBRARIES = libkdrive.la if XV KDRIVE_XV_SOURCES = \ @@ -23,6 +23,3 @@ libkdrive_la_SOURCES = \ kshadow.c \ $(KDRIVE_XV_SOURCES) \ $(top_srcdir)/mi/miinitext.c - -libkdrivestubs_la_SOURCES = \ - $(top_srcdir)/fb/fbcmap_mi.c diff --git a/xserver/hw/kdrive/src/Makefile.in b/xserver/hw/kdrive/src/Makefile.in index c785be8db..37796b53c 100644 --- a/xserver/hw/kdrive/src/Makefile.in +++ b/xserver/hw/kdrive/src/Makefile.in @@ -85,9 +85,6 @@ AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = -libkdrivestubs_la_LIBADD = -am_libkdrivestubs_la_OBJECTS = fbcmap_mi.lo -libkdrivestubs_la_OBJECTS = $(am_libkdrivestubs_la_OBJECTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false @@ -122,9 +119,8 @@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = -SOURCES = $(libkdrive_la_SOURCES) $(libkdrivestubs_la_SOURCES) -DIST_SOURCES = $(am__libkdrive_la_SOURCES_DIST) \ - $(libkdrivestubs_la_SOURCES) +SOURCES = $(libkdrive_la_SOURCES) +DIST_SOURCES = $(am__libkdrive_la_SOURCES_DIST) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -171,6 +167,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -215,6 +213,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -317,7 +319,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -326,6 +331,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -392,6 +398,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ @@ -469,7 +479,7 @@ AM_CPPFLAGS = \ @KDRIVE_CFLAGS@ AM_CFLAGS = -DHAVE_DIX_CONFIG_H -noinst_LTLIBRARIES = libkdrive.la libkdrivestubs.la +noinst_LTLIBRARIES = libkdrive.la @XV_TRUE@KDRIVE_XV_SOURCES = \ @XV_TRUE@ kxv.c \ @XV_TRUE@ kxv.h @@ -486,9 +496,6 @@ libkdrive_la_SOURCES = \ $(KDRIVE_XV_SOURCES) \ $(top_srcdir)/mi/miinitext.c -libkdrivestubs_la_SOURCES = \ - $(top_srcdir)/fb/fbcmap_mi.c - all: all-am .SUFFIXES: @@ -536,8 +543,6 @@ clean-noinstLTLIBRARIES: } libkdrive.la: $(libkdrive_la_OBJECTS) $(libkdrive_la_DEPENDENCIES) $(EXTRA_libkdrive_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(libkdrive_la_OBJECTS) $(libkdrive_la_LIBADD) $(LIBS) -libkdrivestubs.la: $(libkdrivestubs_la_OBJECTS) $(libkdrivestubs_la_DEPENDENCIES) $(EXTRA_libkdrivestubs_la_DEPENDENCIES) - $(AM_V_CCLD)$(LINK) $(libkdrivestubs_la_OBJECTS) $(libkdrivestubs_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -545,7 +550,6 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fbcmap_mi.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kcmap.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kdrive.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kinfo.Plo@am__quote@ @@ -583,13 +587,6 @@ miinitext.lo: $(top_srcdir)/mi/miinitext.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o miinitext.lo `test -f '$(top_srcdir)/mi/miinitext.c' || echo '$(srcdir)/'`$(top_srcdir)/mi/miinitext.c -fbcmap_mi.lo: $(top_srcdir)/fb/fbcmap_mi.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT fbcmap_mi.lo -MD -MP -MF $(DEPDIR)/fbcmap_mi.Tpo -c -o fbcmap_mi.lo `test -f '$(top_srcdir)/fb/fbcmap_mi.c' || echo '$(srcdir)/'`$(top_srcdir)/fb/fbcmap_mi.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fbcmap_mi.Tpo $(DEPDIR)/fbcmap_mi.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/fb/fbcmap_mi.c' object='fbcmap_mi.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o fbcmap_mi.lo `test -f '$(top_srcdir)/fb/fbcmap_mi.c' || echo '$(srcdir)/'`$(top_srcdir)/fb/fbcmap_mi.c - mostlyclean-libtool: -rm -f *.lo diff --git a/xserver/hw/kdrive/src/kcmap.c b/xserver/hw/kdrive/src/kcmap.c index c93c2f4d3..0970064f6 100644 --- a/xserver/hw/kdrive/src/kcmap.c +++ b/xserver/hw/kdrive/src/kcmap.c @@ -138,7 +138,7 @@ KdInstallColormap(ColormapPtr pCmap) /* Tell X clients that the installed colormap is going away. */ if (pScreenPriv->pInstalledmap) WalkTree(pScreenPriv->pInstalledmap->pScreen, TellLostMap, - (pointer) &(pScreenPriv->pInstalledmap->mid)); + (void *) &(pScreenPriv->pInstalledmap->mid)); /* Take note of the new installed colorscreen-> */ pScreenPriv->pInstalledmap = pCmap; @@ -146,7 +146,7 @@ KdInstallColormap(ColormapPtr pCmap) KdSetColormap(pCmap->pScreen); /* Tell X clients of the new colormap */ - WalkTree(pCmap->pScreen, TellGainedMap, (pointer) &(pCmap->mid)); + WalkTree(pCmap->pScreen, TellGainedMap, (void *) &(pCmap->mid)); } /* @@ -173,13 +173,13 @@ KdUninstallColormap(ColormapPtr pCmap) return; /* install default */ - dixLookupResourceByType((pointer *) &defMap, defMapID, RT_COLORMAP, + dixLookupResourceByType((void **) &defMap, defMapID, RT_COLORMAP, serverClient, DixInstallAccess); if (defMap) (*pCmap->pScreen->InstallColormap) (defMap); else { /* uninstall and clear colormap pointer */ - WalkTree(pCmap->pScreen, TellLostMap, (pointer) &(pCmap->mid)); + WalkTree(pCmap->pScreen, TellLostMap, (void *) &(pCmap->mid)); pScreenPriv->pInstalledmap = 0; } } diff --git a/xserver/hw/kdrive/src/kdrive.c b/xserver/hw/kdrive/src/kdrive.c index 382968420..9814fc66a 100644 --- a/xserver/hw/kdrive/src/kdrive.c +++ b/xserver/hw/kdrive/src/kdrive.c @@ -118,10 +118,17 @@ KdDoSwitchCmd(const char *reason) { if (kdSwitchCmd) { char *command; + int ret; if (asprintf(&command, "%s %s", kdSwitchCmd, reason) == -1) return; - system(command); + + /* Ignore the return value from system; I'm not sure + * there's anything more useful to be done when + * it fails + */ + ret = system(command); + (void) ret; free(command); } } @@ -665,7 +672,7 @@ KdCloseScreen(ScreenPtr pScreen) pScreenPriv->screen->pScreen = 0; - free((pointer) pScreenPriv); + free((void *) pScreenPriv); return ret; } diff --git a/xserver/hw/kdrive/src/kdrive.h b/xserver/hw/kdrive/src/kdrive.h index 296d611ed..bec75cb6f 100644 --- a/xserver/hw/kdrive/src/kdrive.h +++ b/xserver/hw/kdrive/src/kdrive.h @@ -526,11 +526,11 @@ void KdSetLed(KdKeyboardInfo * ki, int led, Bool on); void - KdSetPointerMatrix(KdPointerMatrix * pointer); + KdSetPointerMatrix(KdPointerMatrix *pointer); void -KdComputePointerMatrix(KdPointerMatrix * pointer, Rotation randr, int width, +KdComputePointerMatrix(KdPointerMatrix *pointer, Rotation randr, int width, int height); void @@ -538,11 +538,11 @@ void void -KdBlockHandler(ScreenPtr pScreen, pointer timeout, pointer readmask); +KdBlockHandler(ScreenPtr pScreen, void *timeout, void *readmask); void -KdWakeupHandler(ScreenPtr pScreen, unsigned long result, pointer readmask); +KdWakeupHandler(ScreenPtr pScreen, unsigned long result, void *readmask); void KdDisableInput(void); diff --git a/xserver/hw/kdrive/src/kinput.c b/xserver/hw/kdrive/src/kinput.c index a9a9fa583..a539ca513 100644 --- a/xserver/hw/kdrive/src/kinput.c +++ b/xserver/hw/kdrive/src/kinput.c @@ -533,7 +533,7 @@ LegalModifier(unsigned int key, DeviceIntPtr pDev) } static void -KdBell(int volume, DeviceIntPtr pDev, pointer arg, int something) +KdBell(int volume, DeviceIntPtr pDev, void *arg, int something) { KeybdCtrl *ctrl = arg; KdKeyboardInfo *ki = NULL; @@ -1940,7 +1940,7 @@ _KdEnqueuePointerEvent(KdPointerInfo * pi, int type, int x, int y, int z, } void -KdBlockHandler(ScreenPtr pScreen, pointer timeout, pointer readmask) +KdBlockHandler(ScreenPtr pScreen, void *timeo, void *readmask) { KdPointerInfo *pi; int myTimeout = 0; @@ -1962,11 +1962,11 @@ KdBlockHandler(ScreenPtr pScreen, pointer timeout, pointer readmask) myTimeout = 20; } if (myTimeout > 0) - AdjustWaitForDelay(timeout, myTimeout); + AdjustWaitForDelay(timeo, myTimeout); } void -KdWakeupHandler(ScreenPtr pScreen, unsigned long lresult, pointer readmask) +KdWakeupHandler(ScreenPtr pScreen, unsigned long lresult, void *readmask) { int result = (int) lresult; fd_set *pReadmask = (fd_set *) readmask; diff --git a/xserver/hw/kdrive/src/kxv.c b/xserver/hw/kdrive/src/kxv.c index 22639728d..9cc0edd8a 100644 --- a/xserver/hw/kdrive/src/kxv.c +++ b/xserver/hw/kdrive/src/kxv.c @@ -208,7 +208,7 @@ KdXVScreenInit(ScreenPtr pScreen, KdVideoAdaptorPtr * adaptors, int num) sure that I appreciate that. */ ScreenPriv = malloc(sizeof(KdXVScreenRec)); - pxvs->devPriv.ptr = (pointer) ScreenPriv; + pxvs->devPriv.ptr = (void *) ScreenPriv; if (!ScreenPriv) return FALSE; @@ -385,28 +385,7 @@ KdXVInitAdaptors(ScreenPtr pScreen, KdVideoAdaptorPtr * infoPtr, int number) for (i = 0, pi = pImage, imagePtr = adaptorPtr->pImages; i < adaptorPtr->nImages; i++, pi++, imagePtr++) { - pi->id = imagePtr->id; - pi->type = imagePtr->type; - pi->byte_order = imagePtr->byte_order; - memcpy(pi->guid, imagePtr->guid, 16); - pi->bits_per_pixel = imagePtr->bits_per_pixel; - pi->format = imagePtr->format; - pi->num_planes = imagePtr->num_planes; - pi->depth = imagePtr->depth; - pi->red_mask = imagePtr->red_mask; - pi->green_mask = imagePtr->green_mask; - pi->blue_mask = imagePtr->blue_mask; - pi->y_sample_bits = imagePtr->y_sample_bits; - pi->u_sample_bits = imagePtr->u_sample_bits; - pi->v_sample_bits = imagePtr->v_sample_bits; - pi->horz_y_period = imagePtr->horz_y_period; - pi->horz_u_period = imagePtr->horz_u_period; - pi->horz_v_period = imagePtr->horz_v_period; - pi->vert_y_period = imagePtr->vert_y_period; - pi->vert_u_period = imagePtr->vert_u_period; - pi->vert_v_period = imagePtr->vert_v_period; - memcpy(pi->component_order, imagePtr->component_order, 32); - pi->scanline_order = imagePtr->scanline_order; + memcpy(pi, imagePtr, sizeof(*pi)); } pa->nImages = adaptorPtr->nImages; pa->pImages = pImage; @@ -417,9 +396,7 @@ KdXVInitAdaptors(ScreenPtr pScreen, KdVideoAdaptorPtr * infoPtr, int number) calloc(adaptorPtr->nAttributes, sizeof(XvAttributeRec)))) { for (pat = pAttribute, attributePtr = adaptorPtr->pAttributes, i = 0; i < adaptorPtr->nAttributes; pat++, i++, attributePtr++) { - pat->flags = attributePtr->flags; - pat->min_value = attributePtr->min_value; - pat->max_value = attributePtr->max_value; + memcpy(pat, attributePtr, sizeof(*pat)); pat->name = strdup(attributePtr->name); } pa->nAttributes = adaptorPtr->nAttributes; @@ -487,7 +464,7 @@ KdXVInitAdaptors(ScreenPtr pScreen, KdVideoAdaptorPtr * infoPtr, int number) adaptorPriv->PutImage = adaptorPtr->PutImage; adaptorPriv->ReputImage = adaptorPtr->ReputImage; - pa->devPriv.ptr = (pointer) adaptorPriv; + pa->devPriv.ptr = (void *) adaptorPriv; if (!(pPort = calloc(adaptorPtr->nPorts, sizeof(XvPortRec)))) { KdXVFreeAdaptor(pa); @@ -874,7 +851,7 @@ KdXVReputImage(XvPortRecPrivatePtr portPriv) } static int -KdXVReputAllVideo(WindowPtr pWin, pointer data) +KdXVReputAllVideo(WindowPtr pWin, void *data) { KdXVWindowPtr WinPriv; @@ -1821,14 +1798,14 @@ KdXVCopyPlanarData(KdScreenInfo * screen, CARD8 *src, CARD8 *dst, int randr, w >>= 1; for (j = 0; j < h; j++) { - CARD32 *dst = (CARD32 *) dst1; + CARD32 *dst32 = (CARD32 *) dst1; CARD8 *s1l = src1; CARD8 *s1r = src1 + srcNext; CARD8 *s2 = src2; CARD8 *s3 = src3; for (i = 0; i < w; i++) { - *dst++ = *s1l | (*s1r << 16) | (*s3 << 8) | (*s2 << 24); + *dst32++ = *s1l | (*s1r << 16) | (*s3 << 8) | (*s2 << 24); s1l += srcRight; s1r += srcRight; s2 += srcRight2; diff --git a/xserver/hw/kdrive/src/kxv.h b/xserver/hw/kdrive/src/kxv.h index 29118bc96..85a030ee9 100644 --- a/xserver/hw/kdrive/src/kxv.h +++ b/xserver/hw/kdrive/src/kxv.h @@ -56,34 +56,7 @@ of the copyright holder. #define VIDEO_OVERLAID_STILLS 0x00000008 #define VIDEO_CLIP_TO_VIEWPORT 0x00000010 -typedef struct { - int id; - int type; - int byte_order; - unsigned char guid[16]; - int bits_per_pixel; - int format; - int num_planes; - - /* for RGB formats only */ - int depth; - unsigned int red_mask; - unsigned int green_mask; - unsigned int blue_mask; - - /* for YUV formats only */ - unsigned int y_sample_bits; - unsigned int u_sample_bits; - unsigned int v_sample_bits; - unsigned int horz_y_period; - unsigned int horz_u_period; - unsigned int horz_v_period; - unsigned int vert_y_period; - unsigned int vert_u_period; - unsigned int vert_v_period; - char component_order[32]; - int scanline_order; -} KdImageRec, *KdImagePtr; +typedef XvImageRec KdImageRec, *KdImagePtr; typedef struct { KdScreenInfo *screen; @@ -98,41 +71,41 @@ typedef int (*PutVideoFuncPtr) (KdScreenInfo * screen, DrawablePtr pDraw, short vid_x, short vid_y, short drw_x, short drw_y, short vid_w, short vid_h, short drw_w, short drw_h, RegionPtr clipBoxes, - pointer data); + void *data); typedef int (*PutStillFuncPtr) (KdScreenInfo * screen, DrawablePtr pDraw, short vid_x, short vid_y, short drw_x, short drw_y, short vid_w, short vid_h, short drw_w, short drw_h, RegionPtr clipBoxes, - pointer data); + void *data); typedef int (*GetVideoFuncPtr) (KdScreenInfo * screen, DrawablePtr pDraw, short vid_x, short vid_y, short drw_x, short drw_y, short vid_w, short vid_h, short drw_w, short drw_h, RegionPtr clipBoxes, - pointer data); + void *data); typedef int (*GetStillFuncPtr) (KdScreenInfo * screen, DrawablePtr pDraw, short vid_x, short vid_y, short drw_x, short drw_y, short vid_w, short vid_h, short drw_w, short drw_h, RegionPtr clipBoxes, - pointer data); -typedef void (*StopVideoFuncPtr) (KdScreenInfo * screen, pointer data, + void *data); +typedef void (*StopVideoFuncPtr) (KdScreenInfo * screen, void *data, Bool Exit); typedef int (*SetPortAttributeFuncPtr) (KdScreenInfo * screen, Atom attribute, - int value, pointer data); + int value, void *data); typedef int (*GetPortAttributeFuncPtr) (KdScreenInfo * screen, Atom attribute, - int *value, pointer data); + int *value, void *data); typedef void (*QueryBestSizeFuncPtr) (KdScreenInfo * screen, Bool motion, short vid_w, short vid_h, short drw_w, short drw_h, unsigned int *p_w, - unsigned int *p_h, pointer data); + unsigned int *p_h, void *data); typedef int (*PutImageFuncPtr) (KdScreenInfo * screen, DrawablePtr pDraw, short src_x, short src_y, short drw_x, short drw_y, short src_w, short src_h, short drw_w, short drw_h, int image, unsigned char *buf, short width, short height, - Bool Sync, RegionPtr clipBoxes, pointer data); + Bool Sync, RegionPtr clipBoxes, void *data); typedef int (*ReputImageFuncPtr) (KdScreenInfo * screen, DrawablePtr pDraw, short drw_x, short drw_y, RegionPtr clipBoxes, - pointer data); + void *data); typedef int (*QueryImageAttributesFuncPtr) (KdScreenInfo * screen, int image, unsigned short *width, unsigned short *height, @@ -158,12 +131,7 @@ typedef struct { short class; } KdVideoFormatRec, *KdVideoFormatPtr; -typedef struct { - int flags; - int min_value; - int max_value; - char *name; -} KdAttributeRec, *KdAttributePtr; +typedef XvAttributeRec KdAttributeRec, *KdAttributePtr; typedef struct { unsigned int type; diff --git a/xserver/hw/kdrive/wscons/Makefile.in b/xserver/hw/kdrive/wscons/Makefile.in index 8c684d06f..d3c49d22b 100644 --- a/xserver/hw/kdrive/wscons/Makefile.in +++ b/xserver/hw/kdrive/wscons/Makefile.in @@ -177,6 +177,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -221,6 +223,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -323,7 +329,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -332,6 +341,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -398,6 +408,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/hw/vfb/InitOutput.c b/xserver/hw/vfb/InitOutput.c index 97eccfd4e..9c4926462 100644 --- a/xserver/hw/vfb/InitOutput.c +++ b/xserver/hw/vfb/InitOutput.c @@ -404,7 +404,6 @@ vfbInstallColormap(ColormapPtr pmap) if (pmap != oldpmap) { int entries; XWDFileHeader *pXWDHeader; - XWDColor *pXWDCmap; VisualPtr pVisual; Pixel *ppix; xrgb *prgb; @@ -419,7 +418,6 @@ vfbInstallColormap(ColormapPtr pmap) entries = pmap->pVisual->ColormapEntries; pXWDHeader = vfbScreens[pmap->pScreen->myNum].pXWDHeader; - pXWDCmap = vfbScreens[pmap->pScreen->myNum].pXWDCmap; pVisual = pmap->pVisual; swapcopy32(pXWDHeader->visual_class, pVisual->class); @@ -460,7 +458,7 @@ vfbUninstallColormap(ColormapPtr pmap) if (pmap == curpmap) { if (pmap->mid != pmap->pScreen->defColormap) { - dixLookupResourceByType((pointer *) &curpmap, + dixLookupResourceByType((void **) &curpmap, pmap->pScreen->defColormap, RT_COLORMAP, serverClient, DixInstallAccess); @@ -508,7 +506,7 @@ vfbSaveScreen(ScreenPtr pScreen, int on) /* this flushes any changes to the screens out to the mmapped file */ static void -vfbBlockHandler(pointer blockData, OSTimePtr pTimeout, pointer pReadmask) +vfbBlockHandler(void *blockData, OSTimePtr pTimeout, void *pReadmask) { int i; @@ -529,7 +527,7 @@ vfbBlockHandler(pointer blockData, OSTimePtr pTimeout, pointer pReadmask) } static void -vfbWakeupHandler(pointer blockData, int result, pointer pReadmask) +vfbWakeupHandler(void *blockData, int result, void *pReadmask) { } @@ -894,14 +892,11 @@ static const ExtensionModule vfbExtensions[] = { static void vfbExtensionInit(void) { - int i; - - for (i = 0; i < ARRAY_SIZE(vfbExtensions); i++) - LoadExtension(&vfbExtensions[i], TRUE); + LoadExtensionList(vfbExtensions, ARRAY_SIZE(vfbExtensions), TRUE); } void -InitOutput(ScreenInfo * screenInfo, int argc, char **argv) +InitOutput(ScreenInfo * screen_info, int argc, char **argv) { int i; int NumFormats = 0; @@ -937,18 +932,18 @@ InitOutput(ScreenInfo * screenInfo, int argc, char **argv) if (vfbPixmapDepths[i]) { if (NumFormats >= MAXFORMATS) FatalError("MAXFORMATS is too small for this server\n"); - screenInfo->formats[NumFormats].depth = i; - screenInfo->formats[NumFormats].bitsPerPixel = vfbBitsPerPixel(i); - screenInfo->formats[NumFormats].scanlinePad = BITMAP_SCANLINE_PAD; + screen_info->formats[NumFormats].depth = i; + screen_info->formats[NumFormats].bitsPerPixel = vfbBitsPerPixel(i); + screen_info->formats[NumFormats].scanlinePad = BITMAP_SCANLINE_PAD; NumFormats++; } } - screenInfo->imageByteOrder = IMAGE_BYTE_ORDER; - screenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT; - screenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD; - screenInfo->bitmapBitOrder = BITMAP_BIT_ORDER; - screenInfo->numPixmapFormats = NumFormats; + screen_info->imageByteOrder = IMAGE_BYTE_ORDER; + screen_info->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT; + screen_info->bitmapScanlinePad = BITMAP_SCANLINE_PAD; + screen_info->bitmapBitOrder = BITMAP_BIT_ORDER; + screen_info->numPixmapFormats = NumFormats; /* initialize screens */ diff --git a/xserver/hw/vfb/Makefile.am b/xserver/hw/vfb/Makefile.am index 9f4992c8b..f0f9fee47 100644 --- a/xserver/hw/vfb/Makefile.am +++ b/xserver/hw/vfb/Makefile.am @@ -1,7 +1,6 @@ SUBDIRS = man bin_PROGRAMS = Xvfb -noinst_LIBRARIES = libfbcmap.a AM_CFLAGS = -DHAVE_DIX_CONFIG_H \ $(XVFBMODULES_CFLAGS) \ @@ -9,20 +8,16 @@ AM_CFLAGS = -DHAVE_DIX_CONFIG_H \ SRCS = InitInput.c \ InitOutput.c \ - $(top_srcdir)/Xext/dpmsstubs.c \ - $(top_srcdir)/Xi/stubs.c \ $(top_srcdir)/mi/miinitext.c -libfbcmap_a_CFLAGS = $(AM_CFLAGS) -libfbcmap_a_SOURCES = $(top_srcdir)/fb/fbcmap_mi.c - Xvfb_SOURCES = $(SRCS) XVFB_LIBS = \ @XVFB_LIBS@ \ - libfbcmap.a \ $(MAIN_LIB) \ - $(XSERVER_LIBS) + $(XSERVER_LIBS) \ + $(top_builddir)/Xext/libXextdpmsstubs.la \ + $(top_builddir)/Xi/libXistubs.la Xvfb_LDADD = $(XVFB_LIBS) $(XVFB_SYS_LIBS) $(XSERVER_SYS_LIBS) Xvfb_DEPENDENCIES = $(XVFB_LIBS) diff --git a/xserver/hw/vfb/Makefile.in b/xserver/hw/vfb/Makefile.in index b0d2adf78..768de33a6 100644 --- a/xserver/hw/vfb/Makefile.in +++ b/xserver/hw/vfb/Makefile.in @@ -14,7 +14,6 @@ @SET_MAKE@ - VPATH = @srcdir@ am__make_dryrun = \ { \ @@ -74,25 +73,16 @@ CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/version-config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = -LIBRARIES = $(noinst_LIBRARIES) -ARFLAGS = cru -AM_V_AR = $(am__v_AR_@AM_V@) -am__v_AR_ = $(am__v_AR_@AM_DEFAULT_V@) -am__v_AR_0 = @echo " AR " $@; -am__v_AR_1 = -libfbcmap_a_AR = $(AR) $(ARFLAGS) -libfbcmap_a_LIBADD = -am_libfbcmap_a_OBJECTS = libfbcmap_a-fbcmap_mi.$(OBJEXT) -libfbcmap_a_OBJECTS = $(am_libfbcmap_a_OBJECTS) am__installdirs = "$(DESTDIR)$(bindir)" PROGRAMS = $(bin_PROGRAMS) am__objects_1 = InitInput.$(OBJEXT) InitOutput.$(OBJEXT) \ - dpmsstubs.$(OBJEXT) stubs.$(OBJEXT) miinitext.$(OBJEXT) + miinitext.$(OBJEXT) am_Xvfb_OBJECTS = $(am__objects_1) Xvfb_OBJECTS = $(am_Xvfb_OBJECTS) am__DEPENDENCIES_1 = -am__DEPENDENCIES_2 = libfbcmap.a $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_1) +am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ + $(top_builddir)/Xext/libXextdpmsstubs.la \ + $(top_builddir)/Xi/libXistubs.la AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent @@ -134,8 +124,8 @@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = -SOURCES = $(libfbcmap_a_SOURCES) $(Xvfb_SOURCES) -DIST_SOURCES = $(libfbcmap_a_SOURCES) $(Xvfb_SOURCES) +SOURCES = $(Xvfb_SOURCES) +DIST_SOURCES = $(Xvfb_SOURCES) RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ @@ -220,6 +210,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -264,6 +256,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -366,7 +362,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -375,6 +374,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -441,11 +441,16 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = \ @XVFB_LIBS@ \ - libfbcmap.a \ $(MAIN_LIB) \ - $(XSERVER_LIBS) + $(XSERVER_LIBS) \ + $(top_builddir)/Xext/libXextdpmsstubs.la \ + $(top_builddir)/Xi/libXistubs.la XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ @@ -519,19 +524,14 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = man -noinst_LIBRARIES = libfbcmap.a AM_CFLAGS = -DHAVE_DIX_CONFIG_H \ $(XVFBMODULES_CFLAGS) \ $(DIX_CFLAGS) SRCS = InitInput.c \ InitOutput.c \ - $(top_srcdir)/Xext/dpmsstubs.c \ - $(top_srcdir)/Xi/stubs.c \ $(top_srcdir)/mi/miinitext.c -libfbcmap_a_CFLAGS = $(AM_CFLAGS) -libfbcmap_a_SOURCES = $(top_srcdir)/fb/fbcmap_mi.c Xvfb_SOURCES = $(SRCS) Xvfb_LDADD = $(XVFB_LIBS) $(XVFB_SYS_LIBS) $(XSERVER_SYS_LIBS) Xvfb_DEPENDENCIES = $(XVFB_LIBS) @@ -570,13 +570,6 @@ $(top_srcdir)/configure: $(am__configure_deps) $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): - -clean-noinstLIBRARIES: - -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) -libfbcmap.a: $(libfbcmap_a_OBJECTS) $(libfbcmap_a_DEPENDENCIES) $(EXTRA_libfbcmap_a_DEPENDENCIES) - $(AM_V_at)-rm -f libfbcmap.a - $(AM_V_AR)$(libfbcmap_a_AR) libfbcmap.a $(libfbcmap_a_OBJECTS) $(libfbcmap_a_LIBADD) - $(AM_V_at)$(RANLIB) libfbcmap.a install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ @@ -635,10 +628,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/InitInput.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/InitOutput.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dpmsstubs.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfbcmap_a-fbcmap_mi.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/miinitext.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stubs.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @@ -661,48 +651,6 @@ distclean-compile: @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< -libfbcmap_a-fbcmap_mi.o: $(top_srcdir)/fb/fbcmap_mi.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfbcmap_a_CFLAGS) $(CFLAGS) -MT libfbcmap_a-fbcmap_mi.o -MD -MP -MF $(DEPDIR)/libfbcmap_a-fbcmap_mi.Tpo -c -o libfbcmap_a-fbcmap_mi.o `test -f '$(top_srcdir)/fb/fbcmap_mi.c' || echo '$(srcdir)/'`$(top_srcdir)/fb/fbcmap_mi.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libfbcmap_a-fbcmap_mi.Tpo $(DEPDIR)/libfbcmap_a-fbcmap_mi.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/fb/fbcmap_mi.c' object='libfbcmap_a-fbcmap_mi.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfbcmap_a_CFLAGS) $(CFLAGS) -c -o libfbcmap_a-fbcmap_mi.o `test -f '$(top_srcdir)/fb/fbcmap_mi.c' || echo '$(srcdir)/'`$(top_srcdir)/fb/fbcmap_mi.c - -libfbcmap_a-fbcmap_mi.obj: $(top_srcdir)/fb/fbcmap_mi.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfbcmap_a_CFLAGS) $(CFLAGS) -MT libfbcmap_a-fbcmap_mi.obj -MD -MP -MF $(DEPDIR)/libfbcmap_a-fbcmap_mi.Tpo -c -o libfbcmap_a-fbcmap_mi.obj `if test -f '$(top_srcdir)/fb/fbcmap_mi.c'; then $(CYGPATH_W) '$(top_srcdir)/fb/fbcmap_mi.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/fb/fbcmap_mi.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libfbcmap_a-fbcmap_mi.Tpo $(DEPDIR)/libfbcmap_a-fbcmap_mi.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/fb/fbcmap_mi.c' object='libfbcmap_a-fbcmap_mi.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfbcmap_a_CFLAGS) $(CFLAGS) -c -o libfbcmap_a-fbcmap_mi.obj `if test -f '$(top_srcdir)/fb/fbcmap_mi.c'; then $(CYGPATH_W) '$(top_srcdir)/fb/fbcmap_mi.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/fb/fbcmap_mi.c'; fi` - -dpmsstubs.o: $(top_srcdir)/Xext/dpmsstubs.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dpmsstubs.o -MD -MP -MF $(DEPDIR)/dpmsstubs.Tpo -c -o dpmsstubs.o `test -f '$(top_srcdir)/Xext/dpmsstubs.c' || echo '$(srcdir)/'`$(top_srcdir)/Xext/dpmsstubs.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/dpmsstubs.Tpo $(DEPDIR)/dpmsstubs.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/Xext/dpmsstubs.c' object='dpmsstubs.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dpmsstubs.o `test -f '$(top_srcdir)/Xext/dpmsstubs.c' || echo '$(srcdir)/'`$(top_srcdir)/Xext/dpmsstubs.c - -dpmsstubs.obj: $(top_srcdir)/Xext/dpmsstubs.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dpmsstubs.obj -MD -MP -MF $(DEPDIR)/dpmsstubs.Tpo -c -o dpmsstubs.obj `if test -f '$(top_srcdir)/Xext/dpmsstubs.c'; then $(CYGPATH_W) '$(top_srcdir)/Xext/dpmsstubs.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/Xext/dpmsstubs.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/dpmsstubs.Tpo $(DEPDIR)/dpmsstubs.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/Xext/dpmsstubs.c' object='dpmsstubs.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dpmsstubs.obj `if test -f '$(top_srcdir)/Xext/dpmsstubs.c'; then $(CYGPATH_W) '$(top_srcdir)/Xext/dpmsstubs.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/Xext/dpmsstubs.c'; fi` - -stubs.o: $(top_srcdir)/Xi/stubs.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT stubs.o -MD -MP -MF $(DEPDIR)/stubs.Tpo -c -o stubs.o `test -f '$(top_srcdir)/Xi/stubs.c' || echo '$(srcdir)/'`$(top_srcdir)/Xi/stubs.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/stubs.Tpo $(DEPDIR)/stubs.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/Xi/stubs.c' object='stubs.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o stubs.o `test -f '$(top_srcdir)/Xi/stubs.c' || echo '$(srcdir)/'`$(top_srcdir)/Xi/stubs.c - -stubs.obj: $(top_srcdir)/Xi/stubs.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT stubs.obj -MD -MP -MF $(DEPDIR)/stubs.Tpo -c -o stubs.obj `if test -f '$(top_srcdir)/Xi/stubs.c'; then $(CYGPATH_W) '$(top_srcdir)/Xi/stubs.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/Xi/stubs.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/stubs.Tpo $(DEPDIR)/stubs.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/Xi/stubs.c' object='stubs.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o stubs.obj `if test -f '$(top_srcdir)/Xi/stubs.c'; then $(CYGPATH_W) '$(top_srcdir)/Xi/stubs.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/Xi/stubs.c'; fi` - miinitext.o: $(top_srcdir)/mi/miinitext.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT miinitext.o -MD -MP -MF $(DEPDIR)/miinitext.Tpo -c -o miinitext.o `test -f '$(top_srcdir)/mi/miinitext.c' || echo '$(srcdir)/'`$(top_srcdir)/mi/miinitext.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/miinitext.Tpo $(DEPDIR)/miinitext.Po @@ -906,7 +854,7 @@ distdir: $(DISTFILES) done check-am: all-am check: check-recursive -all-am: Makefile $(LIBRARIES) $(PROGRAMS) +all-am: Makefile $(PROGRAMS) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(bindir)"; do \ @@ -944,8 +892,7 @@ maintainer-clean-generic: @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive -clean-am: clean-binPROGRAMS clean-generic clean-libtool \ - clean-noinstLIBRARIES mostlyclean-am +clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive -rm -rf ./$(DEPDIR) @@ -1019,20 +966,19 @@ uninstall-am: uninstall-binPROGRAMS .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am check check-am clean clean-binPROGRAMS \ - clean-generic clean-libtool clean-noinstLIBRARIES cscopelist \ - cscopelist-recursive ctags ctags-recursive distclean \ - distclean-compile distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am html html-am info info-am \ - install install-am install-binPROGRAMS install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ - install-ps install-ps-am install-strip installcheck \ - installcheck-am installdirs installdirs-am maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags tags-recursive uninstall uninstall-am \ - uninstall-binPROGRAMS + clean-generic clean-libtool cscopelist cscopelist-recursive \ + ctags ctags-recursive distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-binPROGRAMS install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ + uninstall uninstall-am uninstall-binPROGRAMS relink: diff --git a/xserver/hw/vfb/man/Makefile.in b/xserver/hw/vfb/man/Makefile.in index 3c3337b2b..481cfffbf 100644 --- a/xserver/hw/vfb/man/Makefile.in +++ b/xserver/hw/vfb/man/Makefile.in @@ -160,6 +160,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -204,6 +206,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -268,6 +274,7 @@ MAN_SUBSTS = @MAN_SUBSTS@ -e 's|__logdir__|$(logdir)|g' -e \ 's|__XKB_DFLT_OPTIONS__|$(XKB_DFLT_OPTIONS)|g' -e \ 's|__bundle_id_prefix__|$(BUNDLE_ID_PREFIX)|g' -e \ 's|__modulepath__|$(DEFAULT_MODULE_PATH)|g' -e \ + 's|__suid_wrapper_dir__|$(SUID_WRAPPER_DIR)|g' -e \ 's|__default_font_path__|$(COMPILEDDEFAULTFONTPATH)|g' -e \ '\|$(COMPILEDDEFAULTFONTPATH)| s|/,|/, |g' MISC_MAN_DIR = @MISC_MAN_DIR@ @@ -322,7 +329,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -331,6 +341,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -397,6 +408,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/hw/xfree86/Makefile.am b/xserver/hw/xfree86/Makefile.am index 15670d01d..58d197e31 100644 --- a/xserver/hw/xfree86/Makefile.am +++ b/xserver/hw/xfree86/Makefile.am @@ -14,6 +14,10 @@ DRI3_BUILDDIR = $(top_builddir)/dri3 DRI3_LIB = $(DRI3_BUILDDIR)/libdri3.la endif +if GLAMOR_EGL +GLAMOR_EGL_SUBDIR = glamor_egl +endif + if XF86UTILS XF86UTILS_SUBDIR = utils endif @@ -33,12 +37,13 @@ endif SUBDIRS = common ddc x86emu $(INT10_SUBDIR) os-support parser \ ramdac $(VGAHW_SUBDIR) loader modes $(DRI_SUBDIR) \ $(DRI2_SUBDIR) . $(VBE_SUBDIR) i2c dixmods \ - fbdevhw shadowfb exa $(XF86UTILS_SUBDIR) doc man + fbdevhw shadowfb exa $(XF86UTILS_SUBDIR) doc man \ + $(GLAMOR_EGL_SUBDIR) DIST_SUBDIRS = common ddc i2c x86emu int10 fbdevhw os-support \ parser ramdac shadowfb vbe vgahw \ loader dixmods dri dri2 exa modes \ - utils doc man + utils doc man glamor_egl bin_PROGRAMS = Xorg nodist_Xorg_SOURCES = sdksyms.c @@ -76,6 +81,12 @@ Xorg_DEPENDENCIES = $(LOCAL_LIBS) Xorg_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG) +if SUID_WRAPPER +wrapdir = $(SUID_WRAPPER_DIR) +wrap_PROGRAMS = Xorg.wrap +Xorg_wrap_SOURCES = xorg-wrapper.c +endif + BUILT_SOURCES = xorg.conf.example DISTCLEANFILES = xorg.conf.example EXTRA_DIST = xorgconf.cpp @@ -93,6 +104,12 @@ if INSTALL_SETUID chown root $(DESTDIR)$(bindir)/Xorg chmod u+s $(DESTDIR)$(bindir)/Xorg endif +if SUID_WRAPPER + $(MKDIR_P) $(DESTDIR)$(SUID_WRAPPER_DIR) + mv $(DESTDIR)$(bindir)/Xorg $(DESTDIR)$(SUID_WRAPPER_DIR)/Xorg.bin + ${INSTALL} -m 755 Xorg.sh $(DESTDIR)$(bindir)/Xorg + -chown root $(DESTDIR)$(SUID_WRAPPER_DIR)/Xorg.wrap && chmod u+s $(DESTDIR)$(SUID_WRAPPER_DIR)/Xorg.wrap +endif uninstall-local: if CYGWIN @@ -114,7 +131,7 @@ xorg.conf.example: xorgconf.cpp relink: $(AM_V_at)rm -f Xorg$(EXEEXT) && $(MAKE) Xorg$(EXEEXT) -CLEANFILES = sdksyms.c sdksyms.dep +CLEANFILES = sdksyms.c sdksyms.dep Xorg.sh EXTRA_DIST += sdksyms.sh sdksyms.dep sdksyms.c: sdksyms.sh diff --git a/xserver/hw/xfree86/Makefile.in b/xserver/hw/xfree86/Makefile.in index 99c985f9a..1c3f9e1df 100644 --- a/xserver/hw/xfree86/Makefile.in +++ b/xserver/hw/xfree86/Makefile.in @@ -51,9 +51,10 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ bin_PROGRAMS = Xorg$(EXEEXT) +@SUID_WRAPPER_TRUE@wrap_PROGRAMS = Xorg.wrap$(EXEEXT) subdir = hw/xfree86 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ - $(top_srcdir)/depcomp + $(srcdir)/Xorg.sh.in $(top_srcdir)/depcomp ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ @@ -71,10 +72,10 @@ CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/xwin-config.h \ $(top_builddir)/include/kdrive-config.h \ $(top_builddir)/include/version-config.h -CONFIG_CLEAN_FILES = +CONFIG_CLEAN_FILES = Xorg.sh CONFIG_CLEAN_VPATH_FILES = -am__installdirs = "$(DESTDIR)$(bindir)" -PROGRAMS = $(bin_PROGRAMS) +am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(wrapdir)" +PROGRAMS = $(bin_PROGRAMS) $(wrap_PROGRAMS) nodist_Xorg_OBJECTS = sdksyms.$(OBJEXT) Xorg_OBJECTS = $(nodist_Xorg_OBJECTS) am__DEPENDENCIES_1 = @@ -93,6 +94,10 @@ am__v_lt_1 = Xorg_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(Xorg_LDFLAGS) $(LDFLAGS) -o $@ +am__Xorg_wrap_SOURCES_DIST = xorg-wrapper.c +@SUID_WRAPPER_TRUE@am_Xorg_wrap_OBJECTS = xorg-wrapper.$(OBJEXT) +Xorg_wrap_OBJECTS = $(am_Xorg_wrap_OBJECTS) +Xorg_wrap_LDADD = $(LDADD) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false @@ -127,8 +132,8 @@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = -SOURCES = $(nodist_Xorg_SOURCES) -DIST_SOURCES = +SOURCES = $(nodist_Xorg_SOURCES) $(Xorg_wrap_SOURCES) +DIST_SOURCES = $(am__Xorg_wrap_SOURCES_DIST) RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ @@ -212,6 +217,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -256,6 +263,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -358,7 +369,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -367,6 +381,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -433,6 +448,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ @@ -511,6 +530,7 @@ top_srcdir = @top_srcdir@ @DRI2_TRUE@DRI2_LIB = dri2/libdri2.la @DRI3_TRUE@DRI3_BUILDDIR = $(top_builddir)/dri3 @DRI3_TRUE@DRI3_LIB = $(DRI3_BUILDDIR)/libdri3.la +@GLAMOR_EGL_TRUE@GLAMOR_EGL_SUBDIR = glamor_egl @XF86UTILS_TRUE@XF86UTILS_SUBDIR = utils @VGAHW_TRUE@VGAHW_SUBDIR = vgahw @VBE_TRUE@VBE_SUBDIR = vbe @@ -518,12 +538,13 @@ top_srcdir = @top_srcdir@ SUBDIRS = common ddc x86emu $(INT10_SUBDIR) os-support parser \ ramdac $(VGAHW_SUBDIR) loader modes $(DRI_SUBDIR) \ $(DRI2_SUBDIR) . $(VBE_SUBDIR) i2c dixmods \ - fbdevhw shadowfb exa $(XF86UTILS_SUBDIR) doc man + fbdevhw shadowfb exa $(XF86UTILS_SUBDIR) doc man \ + $(GLAMOR_EGL_SUBDIR) DIST_SUBDIRS = common ddc i2c x86emu int10 fbdevhw os-support \ parser ramdac shadowfb vbe vgahw \ loader dixmods dri dri2 exa modes \ - utils doc man + utils doc man glamor_egl nodist_Xorg_SOURCES = sdksyms.c AM_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@ @@ -559,6 +580,8 @@ Xorg_LDADD = \ Xorg_DEPENDENCIES = $(LOCAL_LIBS) Xorg_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG) +@SUID_WRAPPER_TRUE@wrapdir = $(SUID_WRAPPER_DIR) +@SUID_WRAPPER_TRUE@Xorg_wrap_SOURCES = xorg-wrapper.c BUILT_SOURCES = xorg.conf.example DISTCLEANFILES = xorg.conf.example EXTRA_DIST = xorgconf.cpp sdksyms.sh @@ -569,7 +592,7 @@ CONF_SUBSTS = -e 's|__filemansuffix__|$(FILE_MAN_SUFFIX)|g' \ -e 's|MODULEPATH|$(DEFAULT_MODULE_PATH)|g' \ -e 's|DEFAULTFONTPATH|$(COMPILEDDEFAULTFONTPATH)|g' -CLEANFILES = sdksyms.c sdksyms.dep +CLEANFILES = sdksyms.c sdksyms.dep Xorg.sh SDKSYMS_DEP = sdksyms.dep all: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) all-recursive @@ -606,6 +629,8 @@ $(top_srcdir)/configure: $(am__configure_deps) $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): +Xorg.sh: $(top_builddir)/config.status $(srcdir)/Xorg.sh.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ @@ -652,9 +677,58 @@ clean-binPROGRAMS: list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list +install-wrapPROGRAMS: $(wrap_PROGRAMS) + @$(NORMAL_INSTALL) + @list='$(wrap_PROGRAMS)'; test -n "$(wrapdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(wrapdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(wrapdir)" || exit 1; \ + fi; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p || test -f $$p1; \ + then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(wrapdir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(wrapdir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-wrapPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(wrap_PROGRAMS)'; test -n "$(wrapdir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(wrapdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(wrapdir)" && rm -f $$files + +clean-wrapPROGRAMS: + @list='$(wrap_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list Xorg$(EXEEXT): $(Xorg_OBJECTS) $(Xorg_DEPENDENCIES) $(EXTRA_Xorg_DEPENDENCIES) @rm -f Xorg$(EXEEXT) $(AM_V_CCLD)$(Xorg_LINK) $(Xorg_OBJECTS) $(Xorg_LDADD) $(LIBS) +Xorg.wrap$(EXEEXT): $(Xorg_wrap_OBJECTS) $(Xorg_wrap_DEPENDENCIES) $(EXTRA_Xorg_wrap_DEPENDENCIES) + @rm -f Xorg.wrap$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(Xorg_wrap_OBJECTS) $(Xorg_wrap_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -663,6 +737,7 @@ distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sdksyms.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xorg-wrapper.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @@ -878,7 +953,7 @@ check: $(BUILT_SOURCES) all-am: Makefile $(PROGRAMS) installdirs: installdirs-recursive installdirs-am: - for dir in "$(DESTDIR)$(bindir)"; do \ + for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(wrapdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: $(BUILT_SOURCES) @@ -917,7 +992,8 @@ maintainer-clean-generic: -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) clean: clean-recursive -clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am +clean-am: clean-binPROGRAMS clean-generic clean-libtool \ + clean-wrapPROGRAMS mostlyclean-am distclean: distclean-recursive -rm -rf ./$(DEPDIR) @@ -937,7 +1013,7 @@ info: info-recursive info-am: -install-data-am: install-data-local +install-data-am: install-data-local install-wrapPROGRAMS install-dvi: install-dvi-recursive @@ -984,7 +1060,8 @@ ps: ps-recursive ps-am: -uninstall-am: uninstall-binPROGRAMS uninstall-local +uninstall-am: uninstall-binPROGRAMS uninstall-local \ + uninstall-wrapPROGRAMS @$(NORMAL_INSTALL) $(MAKE) $(AM_MAKEFLAGS) uninstall-hook .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all check \ @@ -993,20 +1070,22 @@ uninstall-am: uninstall-binPROGRAMS uninstall-local .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am check check-am clean clean-binPROGRAMS \ - clean-generic clean-libtool cscopelist cscopelist-recursive \ - ctags ctags-recursive distclean distclean-compile \ - distclean-generic distclean-libtool distclean-tags distdir dvi \ - dvi-am html html-am info info-am install install-am \ - install-binPROGRAMS install-data install-data-am \ - install-data-local install-dvi install-dvi-am install-exec \ - install-exec-am install-exec-hook install-html install-html-am \ - install-info install-info-am install-man install-pdf \ - install-pdf-am install-ps install-ps-am install-strip \ - installcheck installcheck-am installdirs installdirs-am \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \ - uninstall-binPROGRAMS uninstall-hook uninstall-local + clean-generic clean-libtool clean-wrapPROGRAMS cscopelist \ + cscopelist-recursive ctags ctags-recursive distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-binPROGRAMS install-data \ + install-data-am install-data-local install-dvi install-dvi-am \ + install-exec install-exec-am install-exec-hook install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip install-wrapPROGRAMS installcheck \ + installcheck-am installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-recursive uninstall uninstall-am \ + uninstall-binPROGRAMS uninstall-hook uninstall-local \ + uninstall-wrapPROGRAMS # Without logdir, X will post an error on the terminal and will not start @@ -1018,6 +1097,10 @@ install-exec-hook: (cd $(DESTDIR)$(bindir) && rm -f X && $(LN_S) Xorg$(EXEEXT) X) @INSTALL_SETUID_TRUE@ chown root $(DESTDIR)$(bindir)/Xorg @INSTALL_SETUID_TRUE@ chmod u+s $(DESTDIR)$(bindir)/Xorg +@SUID_WRAPPER_TRUE@ $(MKDIR_P) $(DESTDIR)$(SUID_WRAPPER_DIR) +@SUID_WRAPPER_TRUE@ mv $(DESTDIR)$(bindir)/Xorg $(DESTDIR)$(SUID_WRAPPER_DIR)/Xorg.bin +@SUID_WRAPPER_TRUE@ ${INSTALL} -m 755 Xorg.sh $(DESTDIR)$(bindir)/Xorg +@SUID_WRAPPER_TRUE@ -chown root $(DESTDIR)$(SUID_WRAPPER_DIR)/Xorg.wrap && chmod u+s $(DESTDIR)$(SUID_WRAPPER_DIR)/Xorg.wrap uninstall-local: @CYGWIN_TRUE@ $(AM_V_at)rm -f $(DESTDIR)$(libdir)/libXorg.exe.a diff --git a/xserver/hw/xfree86/Xorg.sh.in b/xserver/hw/xfree86/Xorg.sh.in new file mode 100644 index 000000000..cef4859c8 --- /dev/null +++ b/xserver/hw/xfree86/Xorg.sh.in @@ -0,0 +1,11 @@ +#!/bin/sh +# +# Execute Xorg.wrap if it exists otherwise execute Xorg.bin directly. +# This allows distros to put the suid wrapper in a separate package. + +basedir=@SUID_WRAPPER_DIR@ +if [ -x "$basedir"/Xorg.wrap ]; then + exec "$basedir"/Xorg.wrap "$@" +else + exec "$basedir"/Xorg.bin "$@" +fi diff --git a/xserver/hw/xfree86/common/Makefile.in b/xserver/hw/xfree86/common/Makefile.in index 517bb0e59..67551387c 100644 --- a/xserver/hw/xfree86/common/Makefile.in +++ b/xserver/hw/xfree86/common/Makefile.in @@ -226,6 +226,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -270,6 +272,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -372,7 +378,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -381,6 +390,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -447,6 +457,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/hw/xfree86/common/compiler.h b/xserver/hw/xfree86/common/compiler.h index 4f3454685..141b974ca 100644 --- a/xserver/hw/xfree86/common/compiler.h +++ b/xserver/hw/xfree86/common/compiler.h @@ -103,6 +103,7 @@ #if !defined(__sparc__) && !defined(__sparc) && !defined(__arm32__) && !defined(__nds32__) \ && !(defined(__alpha__) && defined(linux)) \ && !(defined(__ia64__) && defined(linux)) \ + && !(defined(__mips64) && defined(linux)) \ extern _X_EXPORT void outb(unsigned short, unsigned char); extern _X_EXPORT void outw(unsigned short, unsigned short); @@ -1351,7 +1352,10 @@ stl_u(unsigned long val, unsigned int *p) #else /* ix86 */ #if !defined(__SUNPRO_C) -#if !defined(FAKEIT) && !defined(__mc68000__) && !defined(__arm__) && !defined(__sh__) && !defined(__hppa__) && !defined(__s390__) && !defined(__m32r__) && !defined(__aarch64__) +#if !defined(FAKEIT) && !defined(__mc68000__) && !defined(__arm__) && \ + !defined(__sh__) && !defined(__hppa__) && !defined(__s390__) && \ + !defined(__m32r__) && !defined(__aarch64__) && !defined(__arc__) && \ + !defined(__xtensa__) #ifdef GCCUSESGAS /* @@ -1453,7 +1457,7 @@ inl(unsigned short port) #endif /* GCCUSESGAS */ -#else /* !defined(FAKEIT) && !defined(__mc68000__) && !defined(__arm__) && !defined(__sh__) && !defined(__hppa__) && !defined(__m32r__) */ +#else /* !defined(FAKEIT) && !defined(__mc68000__) && !defined(__arm__) && !defined(__sh__) && !defined(__hppa__) && !defined(__m32r__) && !defined(__arc__) */ static __inline__ void outb(unsigned short port, unsigned char val) diff --git a/xserver/hw/xfree86/common/dgaproc.h b/xserver/hw/xfree86/common/dgaproc.h index e824d3094..87e923f26 100644 --- a/xserver/hw/xfree86/common/dgaproc.h +++ b/xserver/hw/xfree86/common/dgaproc.h @@ -24,7 +24,7 @@ typedef struct { int num; /* A unique identifier for the mode (num > 0) */ - char *name; /* name of mode given in the XF86Config */ + const char *name; /* name of mode given in the XF86Config */ int VSync_num; int VSync_den; int flags; /* DGA_CONCURRENT_ACCESS, etc... */ diff --git a/xserver/hw/xfree86/common/vidmodeproc.h b/xserver/hw/xfree86/common/vidmodeproc.h index 311d35c7b..cff340c47 100644 --- a/xserver/hw/xfree86/common/vidmodeproc.h +++ b/xserver/hw/xfree86/common/vidmodeproc.h @@ -34,7 +34,7 @@ typedef enum { } VidModeSelectMonitor; typedef union { - pointer ptr; + const void *ptr; int i; float f; } vidMonitorValue; @@ -42,38 +42,38 @@ typedef union { extern Bool VidModeExtensionInit(ScreenPtr pScreen); extern _X_EXPORT Bool VidModeAvailable(int scrnIndex); -extern _X_EXPORT Bool VidModeGetCurrentModeline(int scrnIndex, pointer *mode, +extern _X_EXPORT Bool VidModeGetCurrentModeline(int scrnIndex, void **mode, int *dotClock); -extern _X_EXPORT Bool VidModeGetFirstModeline(int scrnIndex, pointer *mode, +extern _X_EXPORT Bool VidModeGetFirstModeline(int scrnIndex, void **mode, int *dotClock); -extern _X_EXPORT Bool VidModeGetNextModeline(int scrnIndex, pointer *mode, +extern _X_EXPORT Bool VidModeGetNextModeline(int scrnIndex, void **mode, int *dotClock); -extern _X_EXPORT Bool VidModeDeleteModeline(int scrnIndex, pointer mode); +extern _X_EXPORT Bool VidModeDeleteModeline(int scrnIndex, void *mode); extern _X_EXPORT Bool VidModeZoomViewport(int scrnIndex, int zoom); extern _X_EXPORT Bool VidModeGetViewPort(int scrnIndex, int *x, int *y); extern _X_EXPORT Bool VidModeSetViewPort(int scrnIndex, int x, int y); -extern _X_EXPORT Bool VidModeSwitchMode(int scrnIndex, pointer mode); +extern _X_EXPORT Bool VidModeSwitchMode(int scrnIndex, void *mode); extern _X_EXPORT Bool VidModeLockZoom(int scrnIndex, Bool lock); -extern _X_EXPORT Bool VidModeGetMonitor(int scrnIndex, pointer *monitor); +extern _X_EXPORT Bool VidModeGetMonitor(int scrnIndex, void **monitor); extern _X_EXPORT int VidModeGetNumOfClocks(int scrnIndex, Bool *progClock); extern _X_EXPORT Bool VidModeGetClocks(int scrnIndex, int *Clocks); extern _X_EXPORT ModeStatus VidModeCheckModeForMonitor(int scrnIndex, - pointer mode); + void *mode); extern _X_EXPORT ModeStatus VidModeCheckModeForDriver(int scrnIndex, - pointer mode); -extern _X_EXPORT void VidModeSetCrtcForMode(int scrnIndex, pointer mode); -extern _X_EXPORT Bool VidModeAddModeline(int scrnIndex, pointer mode); + void *mode); +extern _X_EXPORT void VidModeSetCrtcForMode(int scrnIndex, void *mode); +extern _X_EXPORT Bool VidModeAddModeline(int scrnIndex, void *mode); extern _X_EXPORT int VidModeGetDotClock(int scrnIndex, int Clock); extern _X_EXPORT int VidModeGetNumOfModes(int scrnIndex); extern _X_EXPORT Bool VidModeSetGamma(int scrnIndex, float red, float green, float blue); extern _X_EXPORT Bool VidModeGetGamma(int scrnIndex, float *red, float *green, float *blue); -extern _X_EXPORT pointer VidModeCreateMode(void); -extern _X_EXPORT void VidModeCopyMode(pointer modefrom, pointer modeto); -extern _X_EXPORT int VidModeGetModeValue(pointer mode, int valtyp); -extern _X_EXPORT void VidModeSetModeValue(pointer mode, int valtyp, int val); -extern _X_EXPORT vidMonitorValue VidModeGetMonitorValue(pointer monitor, +extern _X_EXPORT void *VidModeCreateMode(void); +extern _X_EXPORT void VidModeCopyMode(void *modefrom, void *modeto); +extern _X_EXPORT int VidModeGetModeValue(void *mode, int valtyp); +extern _X_EXPORT void VidModeSetModeValue(void *mode, int valtyp, int val); +extern _X_EXPORT vidMonitorValue VidModeGetMonitorValue(void *monitor, int valtyp, int indx); extern _X_EXPORT Bool VidModeSetGammaRamp(int, int, CARD16 *, CARD16 *, CARD16 *); diff --git a/xserver/hw/xfree86/common/xf86.h b/xserver/hw/xfree86/common/xf86.h index eada01cf9..cec31354e 100644 --- a/xserver/hw/xfree86/common/xf86.h +++ b/xserver/hw/xfree86/common/xf86.h @@ -128,7 +128,7 @@ extern _X_EXPORT ScrnInfoPtr xf86ConfigPciEntity(ScrnInfoPtr pScrn, void *dummy, EntityProc init, EntityProc enter, EntityProc leave, - pointer private); + void *private); /* Obsolete! don't use */ extern _X_EXPORT Bool xf86ConfigActivePciEntity(ScrnInfoPtr pScrn, int entityIndex, @@ -136,7 +136,7 @@ extern _X_EXPORT Bool xf86ConfigActivePciEntity(ScrnInfoPtr pScrn, void *dummy, EntityProc init, EntityProc enter, EntityProc leave, - pointer private); + void *private); #else #define xf86VGAarbiterInit() do {} while (0) #define xf86VGAarbiterFini() do {} while (0) @@ -166,7 +166,7 @@ extern _X_EXPORT void xf86RemoveEntityFromScreen(ScrnInfoPtr pScrn, extern _X_EXPORT EntityInfoPtr xf86GetEntityInfo(int entityIndex); extern _X_EXPORT Bool xf86SetEntityFuncs(int entityIndex, EntityProc init, EntityProc enter, EntityProc leave, - pointer); + void *); extern _X_EXPORT Bool xf86IsEntityPrimary(int entityIndex); extern _X_EXPORT ScrnInfoPtr xf86FindScreenForEntity(int entityIndex); @@ -203,11 +203,6 @@ extern _X_EXPORT void xf86ReconfigureLayout(void); extern _X_EXPORT Bool xf86DPMSInit(ScreenPtr pScreen, DPMSSetProcPtr set, int flags); -#ifdef DPMSExtension -extern _X_EXPORT int DPMSSet(ClientPtr client, int level); -extern _X_EXPORT Bool DPMSSupported(void); -#endif - /* xf86DGA.c */ #ifdef XFreeXDGA @@ -220,29 +215,35 @@ extern _X_EXPORT xf86SetDGAModeProc xf86SetDGAMode; /* xf86Events.c */ +typedef struct _InputInfoRec *InputInfoPtr; + extern _X_EXPORT void SetTimeSinceLastInputEvent(void); -extern _X_EXPORT pointer xf86AddInputHandler(int fd, InputHandlerProc proc, - pointer data); -extern _X_EXPORT int xf86RemoveInputHandler(pointer handler); -extern _X_EXPORT void xf86DisableInputHandler(pointer handler); -extern _X_EXPORT void xf86EnableInputHandler(pointer handler); -extern _X_EXPORT pointer xf86AddGeneralHandler(int fd, InputHandlerProc proc, - pointer data); -extern _X_EXPORT int xf86RemoveGeneralHandler(pointer handler); -extern _X_EXPORT void xf86DisableGeneralHandler(pointer handler); -extern _X_EXPORT void xf86EnableGeneralHandler(pointer handler); +extern _X_EXPORT void *xf86AddInputHandler(int fd, InputHandlerProc proc, + void *data); +extern _X_EXPORT int xf86RemoveInputHandler(void *handler); +extern _X_EXPORT void xf86DisableInputHandler(void *handler); +extern _X_EXPORT void xf86EnableInputHandler(void *handler); +extern _X_EXPORT void *xf86AddGeneralHandler(int fd, InputHandlerProc proc, + void *data); +extern _X_EXPORT int xf86RemoveGeneralHandler(void *handler); +extern _X_EXPORT void xf86DisableGeneralHandler(void *handler); +extern _X_EXPORT void xf86EnableGeneralHandler(void *handler); extern _X_EXPORT InputHandlerProc xf86SetConsoleHandler(InputHandlerProc - handler, pointer data); + handler, void *data); extern _X_EXPORT void xf86InterceptSignals(int *signo); extern _X_EXPORT void xf86InterceptSigIll(void (*sigillhandler) (void)); extern _X_EXPORT Bool xf86EnableVTSwitch(Bool new); extern _X_EXPORT void xf86ProcessActionEvent(ActionEvent action, void *arg); extern _X_EXPORT void xf86PrintBacktrace(void); extern _X_EXPORT Bool xf86VTOwner(void); +extern _X_EXPORT void xf86VTLeave(void); +extern _X_EXPORT void xf86VTEnter(void); +extern _X_EXPORT void xf86EnableInputDeviceForVTSwitch(InputInfoPtr pInfo); +extern _X_EXPORT void xf86DisableInputDeviceForVTSwitch(InputInfoPtr pInfo); /* xf86Helper.c */ -extern _X_EXPORT void xf86AddDriver(DriverPtr driver, pointer module, +extern _X_EXPORT void xf86AddDriver(DriverPtr driver, void *module, int flags); extern _X_EXPORT void xf86DeleteDriver(int drvIndex); extern _X_EXPORT ScrnInfoPtr xf86AllocateScreen(DriverPtr drv, int flags); @@ -333,36 +334,36 @@ xf86DisableRandR(void); extern _X_EXPORT CARD32 xorgGetVersion(void); extern _X_EXPORT CARD32 -xf86GetModuleVersion(pointer module); -extern _X_EXPORT pointer +xf86GetModuleVersion(void *module); +extern _X_EXPORT void * xf86LoadDrvSubModule(DriverPtr drv, const char *name); -extern _X_EXPORT pointer +extern _X_EXPORT void * xf86LoadSubModule(ScrnInfoPtr pScrn, const char *name); -extern _X_EXPORT pointer -xf86LoadOneModule(char *name, pointer optlist); +extern _X_EXPORT void * +xf86LoadOneModule(const char *name, void *optlist); extern _X_EXPORT void -xf86UnloadSubModule(pointer mod); +xf86UnloadSubModule(void *mod); extern _X_EXPORT Bool xf86LoaderCheckSymbol(const char *name); extern _X_EXPORT void xf86SetBackingStore(ScreenPtr pScreen); extern _X_EXPORT void xf86SetSilkenMouse(ScreenPtr pScreen); -extern _X_EXPORT pointer -xf86FindXvOptions(ScrnInfoPtr pScrn, int adapt_index, char *port_name, - char **adaptor_name, pointer *adaptor_options); +extern _X_EXPORT void * +xf86FindXvOptions(ScrnInfoPtr pScrn, int adapt_index, const char *port_name, + const char **adaptor_name, void **adaptor_options); extern _X_EXPORT void xf86GetOS(const char **name, int *major, int *minor, int *teeny); extern _X_EXPORT ScrnInfoPtr xf86ConfigFbEntity(ScrnInfoPtr pScrn, int scrnFlag, int entityIndex, EntityProc init, - EntityProc enter, EntityProc leave, pointer private); + EntityProc enter, EntityProc leave, void *private); extern _X_EXPORT Bool xf86IsScreenPrimary(ScrnInfoPtr pScrn); extern _X_EXPORT int xf86RegisterRootWindowProperty(int ScrnIndex, Atom property, Atom type, - int format, unsigned long len, pointer value); + int format, unsigned long len, void *value); extern _X_EXPORT Bool xf86IsUnblank(int mode); @@ -394,7 +395,7 @@ extern _X_EXPORT ModeStatus xf86CheckModeForDriver(ScrnInfoPtr scrp, DisplayModePtr mode, int flags); extern _X_EXPORT int xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes, - char **modeNames, ClockRangePtr clockRanges, + const char **modeNames, ClockRangePtr clockRanges, int *linePitches, int minPitch, int maxPitch, int minHeight, int maxHeight, int pitchInc, int virtualX, int virtualY, int apertureSize, diff --git a/xserver/hw/xfree86/common/xf86AutoConfig.c b/xserver/hw/xfree86/common/xf86AutoConfig.c index 4460b97a2..ef74ba2d5 100644 --- a/xserver/hw/xfree86/common/xf86AutoConfig.c +++ b/xserver/hw/xfree86/common/xf86AutoConfig.c @@ -265,7 +265,7 @@ listPossibleVideoDrivers(char *matches[], int nmatches) #endif #ifdef XSERVER_LIBPCIACCESS if (i < (nmatches - 1)) - i = xf86PciMatchDriver(matches, nmatches); + i += xf86PciMatchDriver(&matches[i], nmatches - i); #endif #if defined(__linux__) @@ -306,6 +306,7 @@ copyScreen(confScreenPtr oscreen, GDevPtr odev, int i, char *driver) { confScreenPtr nscreen; GDevPtr cptr = NULL; + char *identifier; nscreen = malloc(sizeof(confScreenRec)); if (!nscreen) @@ -319,13 +320,14 @@ copyScreen(confScreenPtr oscreen, GDevPtr odev, int i, char *driver) } memcpy(cptr, odev, sizeof(GDevRec)); - if (asprintf(&cptr->identifier, "Autoconfigured Video Device %s", driver) + if (asprintf(&identifier, "Autoconfigured Video Device %s", driver) == -1) { free(cptr); free(nscreen); return FALSE; } cptr->driver = driver; + cptr->identifier = identifier; xf86ConfigLayout.screens[i].screen = nscreen; diff --git a/xserver/hw/xfree86/common/xf86Bus.c b/xserver/hw/xfree86/common/xf86Bus.c index 3f9ee71e6..9289744a3 100644 --- a/xserver/hw/xfree86/common/xf86Bus.c +++ b/xserver/hw/xfree86/common/xf86Bus.c @@ -81,7 +81,7 @@ xf86CallDriverProbe(DriverPtr drv, Bool detect_only) if (drv->platformProbe != NULL) { foundScreen = xf86platformProbeDev(drv); } - if (ServerIsNotSeat0()) + if (ServerIsNotSeat0() && foundScreen) return foundScreen; #endif @@ -201,7 +201,7 @@ xf86BusProbe(void) { #ifdef XSERVER_PLATFORM_BUS xf86platformProbe(); - if (ServerIsNotSeat0()) + if (ServerIsNotSeat0() && xf86_num_platform_devices > 0) return; #endif #ifdef XSERVER_LIBPCIACCESS @@ -210,6 +210,9 @@ xf86BusProbe(void) #if (defined(__sparc__) || defined(__sparc)) xf86SbusProbe(); #endif +#ifdef XSERVER_PLATFORM_BUS + xf86platformPrimary(); +#endif } /* @@ -288,7 +291,7 @@ xf86IsEntityPrimary(int entityIndex) Bool xf86SetEntityFuncs(int entityIndex, EntityProc init, EntityProc enter, - EntityProc leave, pointer private) + EntityProc leave, void *private) { if (entityIndex >= xf86NumEntities) return FALSE; diff --git a/xserver/hw/xfree86/common/xf86Bus.h b/xserver/hw/xfree86/common/xf86Bus.h index e83ba780a..c59625db6 100644 --- a/xserver/hw/xfree86/common/xf86Bus.h +++ b/xserver/hw/xfree86/common/xf86Bus.h @@ -51,7 +51,7 @@ typedef struct { EntityProc entityInit; EntityProc entityEnter; EntityProc entityLeave; - pointer private; + void *private; Bool active; Bool inUse; BusRec bus; diff --git a/xserver/hw/xfree86/common/xf86Config.c b/xserver/hw/xfree86/common/xf86Config.c index f37d23bbb..89ba2c1b0 100644 --- a/xserver/hw/xfree86/common/xf86Config.c +++ b/xserver/hw/xfree86/common/xf86Config.c @@ -103,7 +103,7 @@ "/etc/X11/%X," "%C/X11/%X" #endif #ifndef SYS_CONFIGDIRPATH -#define SYS_CONFIGDIRPATH "/usr/share/X11/%X," "%D/X11/%X" +#define SYS_CONFIGDIRPATH "%D/X11/%X" #endif #ifndef PROJECTROOT #define PROJECTROOT "/usr/X11R6" @@ -171,7 +171,7 @@ xf86GetPathElem(char **pnt) static char * xf86ValidateFontPath(char *path) { - char *tmp_path, *out_pnt, *path_elem, *next, *p1, *dir_elem; + char *next, *tmp_path, *out_pnt, *path_elem, *p1, *dir_elem; struct stat stat_buf; int flag; int dirlen; @@ -232,21 +232,33 @@ xf86ValidateFontPath(char *path) return tmp_path; } +#define FIND_SUITABLE(pointertype, listhead, ptr) \ + do { \ + pointertype _l, _p; \ + \ + for (_l = (listhead), _p = NULL; !_p && _l; _l = (pointertype)_l->list.next) { \ + if (!_l->match_seat || (SeatId && xf86nameCompare(_l->match_seat, SeatId) == 0)) \ + _p = _l; \ + } \ + \ + (ptr) = _p; \ + } while(0) + /* * use the datastructure that the parser provides and pick out the parts * that we need at this point */ -char ** -xf86ModulelistFromConfig(pointer **optlist) +const char ** +xf86ModulelistFromConfig(void ***optlist) { int count = 0, i = 0; - char **modulearray; + const char **modulearray; const char *ignore[] = { "GLcore", "speedo", "bitmap", "drm", "freetype", "type1", NULL }; - pointer *optarray; + void **optarray; XF86LoadPtr modp; Bool found; @@ -352,7 +364,7 @@ xf86ModulelistFromConfig(pointer **optlist) * allocate the memory and walk the list again to fill in the pointers */ modulearray = xnfalloc((count + 1) * sizeof(char *)); - optarray = xnfalloc((count + 1) * sizeof(pointer)); + optarray = xnfalloc((count + 1) * sizeof(void *)); count = 0; if (xf86configptr->conf_modules) { modp = xf86configptr->conf_modules->mod_load_lst; @@ -374,12 +386,12 @@ xf86ModulelistFromConfig(pointer **optlist) return modulearray; } -char ** +const char ** xf86DriverlistFromConfig(void) { int count = 0; int j; - char **modulearray; + const char **modulearray; screenLayoutPtr slp; /* @@ -446,11 +458,11 @@ xf86DriverlistFromConfig(void) return modulearray; } -char ** +const char ** xf86InputDriverlistFromConfig(void) { int count = 0; - char **modulearray; + const char **modulearray; InputInfoPtr *idp; /* @@ -505,11 +517,11 @@ xf86InputDriverlistFromConfig(void) } static void -fixup_video_driver_list(char **drivers) +fixup_video_driver_list(const char **drivers) { - static const char *fallback[4] = { "fbdev", "vesa", "wsfb", NULL }; - char **end, **drv; - char *x; + static const char *fallback[5] = { "modesetting", "fbdev", "vesa", "wsfb", NULL }; + const char **end, **drv; + const char *x; int i; /* walk to the end of the list */ @@ -532,10 +544,10 @@ fixup_video_driver_list(char **drivers) } } -static char ** +static const char ** GenerateDriverlist(const char *dirname) { - char **ret; + const char **ret; const char *subdirs[] = { dirname, NULL }; static const char *patlist[] = { "(.*)_drv\\.so", NULL }; ret = LoaderListDirs(subdirs, patlist); @@ -547,10 +559,10 @@ GenerateDriverlist(const char *dirname) return ret; } -char ** +const char ** xf86DriverlistFromCompile(void) { - static char **driverlist = NULL; + static const char **driverlist = NULL; if (!driverlist) driverlist = GenerateDriverlist("drivers"); @@ -588,33 +600,35 @@ configFiles(XF86ConfFilesPtr fileconf) /* FontPath */ must_copy = TRUE; - temp_path = defaultFontPath ? defaultFontPath : ""; + temp_path = defaultFontPath ? (char *) defaultFontPath : (char *) ""; if (xf86fpFlag) pathFrom = X_CMDLINE; else if (fileconf && fileconf->file_fontpath) { pathFrom = X_CONFIG; if (xf86Info.useDefaultFontPath) { - if (asprintf(&defaultFontPath, "%s%s%s", fileconf->file_fontpath, + char *new_font_path; + if (asprintf(&new_font_path, "%s%s%s", fileconf->file_fontpath, *temp_path ? "," : "", temp_path) == -1) - defaultFontPath = NULL; + new_font_path = NULL; else must_copy = FALSE; + defaultFontPath = new_font_path; } else defaultFontPath = fileconf->file_fontpath; } else pathFrom = X_DEFAULT; - temp_path = defaultFontPath ? defaultFontPath : ""; + temp_path = defaultFontPath ? (char *) defaultFontPath : (char *) ""; /* xf86ValidateFontPath modifies its argument, but returns a copy of it. */ - temp_path = must_copy ? xnfstrdup(defaultFontPath) : defaultFontPath; + temp_path = must_copy ? xnfstrdup(defaultFontPath) : (char *) defaultFontPath; defaultFontPath = xf86ValidateFontPath(temp_path); free(temp_path); /* make fontpath more readable in the logfiles */ countDirs = 1; - temp_path = defaultFontPath; + temp_path = (char *) defaultFontPath; while ((temp_path = index(temp_path, ',')) != NULL) { countDirs++; temp_path++; @@ -622,7 +636,7 @@ configFiles(XF86ConfFilesPtr fileconf) log_buf = xnfalloc(strlen(defaultFontPath) + (2 * countDirs) + 1); temp_path = log_buf; - start = defaultFontPath; + start = (char *) defaultFontPath; while ((end = index(start, ',')) != NULL) { size = (end - start) + 1; *(temp_path++) = '\t'; @@ -774,13 +788,7 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts) MessageType from; const char *s; XkbRMLVOSet set; - - /* Default options. */ - set.rules = XKB_DFLT_RULES; - set.model = "pc105"; - set.layout = "us"; - set.variant = NULL; - set.options = NULL; + const char *rules; /* * Merge the ServerLayout and ServerFlags options. The former have @@ -960,9 +968,15 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts) * evdev rules set. */ #if defined(linux) if (!xf86Info.forceInputDevices) - set.rules = "evdev"; + rules = "evdev"; + else #endif + rules = "base"; + + /* Xkb default options. */ + XkbInitRules(&set, rules, "pc105", "us", NULL, NULL); XkbSetRulesDflts(&set); + XkbFreeRMLVOSet(&set, FALSE); xf86Info.useDefaultFontPath = TRUE; xf86Info.useDefaultFontPathFrom = X_DEFAULT; @@ -1577,8 +1591,11 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout, * config file, or - if it is NULL - configScreen autogenerates one for * us */ if (!count) { + XF86ConfScreenPtr screen; + + FIND_SUITABLE (XF86ConfScreenPtr, xf86configptr->conf_screen_lst, screen); slp[0].screen = xnfcalloc(1, sizeof(confScreenRec)); - if (!configScreen(slp[0].screen, xf86configptr->conf_screen_lst, + if (!configScreen(slp[0].screen, screen, 0, X_CONFIG)) { free(slp[0].screen); free(slp); @@ -1674,7 +1691,7 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout, */ static Bool configImpliedLayout(serverLayoutPtr servlayoutp, XF86ConfScreenPtr conf_screen, - XF86ConfigPtr xf86configptr) + XF86ConfigPtr conf_ptr) { MessageType from; XF86ConfScreenPtr s; @@ -1719,7 +1736,7 @@ configImpliedLayout(serverLayoutPtr servlayoutp, XF86ConfScreenPtr conf_screen, memset(&layout, 0, sizeof(layout)); layout.lay_identifier = servlayoutp->id; - if (xf86layoutAddInputDevices(xf86configptr, &layout) > 0) { + if (xf86layoutAddInputDevices(conf_ptr, &layout) > 0) { if (!configInputDevices(&layout, servlayoutp)) return FALSE; from = X_DEFAULT; @@ -1818,7 +1835,7 @@ configScreen(confScreenPtr screenp, XF86ConfScreenPtr conf_screen, int scrnum, * set it to NULL so that the section can be autoconfigured later */ screenp->device = xnfcalloc(1, sizeof(GDevRec)); if ((!conf_screen->scrn_device) && (xf86configptr->conf_device_lst)) { - conf_screen->scrn_device = xf86configptr->conf_device_lst; + FIND_SUITABLE (XF86ConfDevicePtr, xf86configptr->conf_device_lst, conf_screen->scrn_device); xf86Msg(X_DEFAULT, "No device specified for screen \"%s\".\n" "\tUsing the first device section listed.\n", screenp->id); } @@ -2348,9 +2365,10 @@ checkInput(serverLayoutPtr layout, Bool implicit_layout) ConfigStatus xf86HandleConfigFile(Bool autoconfig) { - char *scanptr; + const char *scanptr; Bool singlecard = 0; Bool implicit_layout = FALSE; + XF86ConfLayoutPtr layout; if (!autoconfig) { char *filename, *dirname, *sysdirname; @@ -2426,14 +2444,17 @@ xf86HandleConfigFile(Bool autoconfig) */ /* First check if a layout section is present, and if it is valid. */ + FIND_SUITABLE(XF86ConfLayoutPtr, xf86configptr->conf_layout_lst, layout); + if (layout == NULL || xf86ScreenName != NULL) { + XF86ConfScreenPtr screen; - if (xf86configptr->conf_layout_lst == NULL || xf86ScreenName != NULL) { if (xf86ScreenName == NULL) { xf86Msg(X_DEFAULT, "No Layout section. Using the first Screen section.\n"); } + FIND_SUITABLE (XF86ConfScreenPtr, xf86configptr->conf_screen_lst, screen); if (!configImpliedLayout(&xf86ConfigLayout, - xf86configptr->conf_screen_lst, + screen, xf86configptr)) { xf86Msg(X_ERROR, "Unable to determine the screen layout\n"); return CONFIG_PARSE_ERROR; @@ -2443,21 +2464,18 @@ xf86HandleConfigFile(Bool autoconfig) else { if (xf86configptr->conf_flags != NULL) { char *dfltlayout = NULL; - pointer optlist = xf86configptr->conf_flags->flg_option_lst; + void *optlist = xf86configptr->conf_flags->flg_option_lst; if (optlist && xf86FindOption(optlist, "defaultserverlayout")) dfltlayout = xf86SetStrOption(optlist, "defaultserverlayout", NULL); - if (!configLayout - (&xf86ConfigLayout, xf86configptr->conf_layout_lst, - dfltlayout)) { + if (!configLayout(&xf86ConfigLayout, layout, dfltlayout)) { xf86Msg(X_ERROR, "Unable to determine the screen layout\n"); return CONFIG_PARSE_ERROR; } } else { - if (!configLayout(&xf86ConfigLayout, xf86configptr->conf_layout_lst, - NULL)) { + if (!configLayout(&xf86ConfigLayout, layout, NULL)) { xf86Msg(X_ERROR, "Unable to determine the screen layout\n"); return CONFIG_PARSE_ERROR; } diff --git a/xserver/hw/xfree86/common/xf86Config.h b/xserver/hw/xfree86/common/xf86Config.h index de06677c3..23fb383c3 100644 --- a/xserver/hw/xfree86/common/xf86Config.h +++ b/xserver/hw/xfree86/common/xf86Config.h @@ -59,10 +59,10 @@ typedef struct _ModuleDefault { /* * prototypes */ -char **xf86ModulelistFromConfig(pointer **); -char **xf86DriverlistFromConfig(void); -char **xf86DriverlistFromCompile(void); -char **xf86InputDriverlistFromConfig(void); +const char **xf86ModulelistFromConfig(void ***); +const char **xf86DriverlistFromConfig(void); +const char **xf86DriverlistFromCompile(void); +const char **xf86InputDriverlistFromConfig(void); Bool xf86BuiltinInputDriver(const char *); ConfigStatus xf86HandleConfigFile(Bool); diff --git a/xserver/hw/xfree86/common/xf86Configure.c b/xserver/hw/xfree86/common/xf86Configure.c index 9f67230f8..e5412ac3a 100644 --- a/xserver/hw/xfree86/common/xf86Configure.c +++ b/xserver/hw/xfree86/common/xf86Configure.c @@ -34,6 +34,7 @@ #define IN_XSERVER #include "Configint.h" #include "xf86DDC.h" +#include "xf86pciBus.h" #if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__) #include "xf86Bus.h" #include "xf86Sbus.h" @@ -80,6 +81,7 @@ xf86AddBusDeviceToConfigure(const char *driver, BusType bus, void *busData, int chipset) { int ret, i, j; + char *lower_driver; if (!xf86DoConfigure || !xf86DoConfigurePass1) return NULL; @@ -116,8 +118,9 @@ xf86AddBusDeviceToConfigure(const char *driver, BusType bus, void *busData, DevToConfig[i].iDriver = CurrentDriver; /* Fill in what we know, converting the driver name to lower case */ - DevToConfig[i].GDev.driver = xnfalloc(strlen(driver) + 1); - for (j = 0; (DevToConfig[i].GDev.driver[j] = tolower(driver[j])); j++); + lower_driver = xnfalloc(strlen(driver) + 1); + for (j = 0; (lower_driver[j] = tolower(driver[j])); j++); + DevToConfig[i].GDev.driver = lower_driver; switch (bus) { #ifdef XSERVER_LIBPCIACCESS @@ -156,8 +159,8 @@ configureInputSection(void) parsePrologue(XF86ConfInputPtr, XF86ConfInputRec) - ptr->inp_identifier = "Keyboard0"; - ptr->inp_driver = "kbd"; + ptr->inp_identifier = xnfstrdup("Keyboard0"); + ptr->inp_driver = xnfstrdup("kbd"); ptr->list.next = NULL; /* Crude mechanism to auto-detect mouse (os dependent) */ @@ -172,17 +175,17 @@ configureInputSection(void) } mouse = calloc(1, sizeof(XF86ConfInputRec)); - mouse->inp_identifier = "Mouse0"; - mouse->inp_driver = "mouse"; + mouse->inp_identifier = xnfstrdup("Mouse0"); + mouse->inp_driver = xnfstrdup("mouse"); mouse->inp_option_lst = - xf86addNewOption(mouse->inp_option_lst, strdup("Protocol"), - strdup(DFLT_MOUSE_PROTO)); + xf86addNewOption(mouse->inp_option_lst, xnfstrdup("Protocol"), + xnfstrdup(DFLT_MOUSE_PROTO)); mouse->inp_option_lst = - xf86addNewOption(mouse->inp_option_lst, strdup("Device"), - strdup(DFLT_MOUSE_DEV)); + xf86addNewOption(mouse->inp_option_lst, xnfstrdup("Device"), + xnfstrdup(DFLT_MOUSE_DEV)); mouse->inp_option_lst = - xf86addNewOption(mouse->inp_option_lst, strdup("ZAxisMapping"), - strdup("4 5 6 7")); + xf86addNewOption(mouse->inp_option_lst, xnfstrdup("ZAxisMapping"), + xnfstrdup("4 5 6 7")); ptr = (XF86ConfInputPtr) xf86addListItem((glp) ptr, (glp) mouse); return ptr; } @@ -192,24 +195,28 @@ configureScreenSection(int screennum) { int i; int depths[] = { 1, 4, 8, 15, 16, 24 /*, 32 */ }; + char *tmp; parsePrologue(XF86ConfScreenPtr, XF86ConfScreenRec) - XNFasprintf(&ptr->scrn_identifier, "Screen%d", screennum); - XNFasprintf(&ptr->scrn_monitor_str, "Monitor%d", screennum); - XNFasprintf(&ptr->scrn_device_str, "Card%d", screennum); + XNFasprintf(&tmp, "Screen%d", screennum); + ptr->scrn_identifier = tmp; + XNFasprintf(&tmp, "Monitor%d", screennum); + ptr->scrn_monitor_str = tmp; + XNFasprintf(&tmp, "Card%d", screennum); + ptr->scrn_device_str = tmp; for (i = 0; i < sizeof(depths) / sizeof(depths[0]); i++) { - XF86ConfDisplayPtr display; + XF86ConfDisplayPtr conf_display; - display = calloc(1, sizeof(XF86ConfDisplayRec)); - display->disp_depth = depths[i]; - display->disp_black.red = display->disp_white.red = -1; - display->disp_black.green = display->disp_white.green = -1; - display->disp_black.blue = display->disp_white.blue = -1; + conf_display = calloc(1, sizeof(XF86ConfDisplayRec)); + conf_display->disp_depth = depths[i]; + conf_display->disp_black.red = conf_display->disp_white.red = -1; + conf_display->disp_black.green = conf_display->disp_white.green = -1; + conf_display->disp_black.blue = conf_display->disp_white.blue = -1; ptr->scrn_display_lst = (XF86ConfDisplayPtr) xf86addListItem((glp) ptr-> scrn_display_lst, (glp) - display); + conf_display); } return ptr; @@ -245,12 +252,14 @@ configureDeviceSection(int screennum) { OptionInfoPtr p; int i = 0; + char *identifier; parsePrologue(XF86ConfDevicePtr, XF86ConfDeviceRec) /* Move device info to parser structure */ - if (asprintf(&ptr->dev_identifier, "Card%d", screennum) == -1) - ptr->dev_identifier = NULL; + if (asprintf(&identifier, "Card%d", screennum) == -1) + identifier = NULL; + ptr->dev_identifier = identifier; ptr->dev_chipset = DevToConfig[screennum].GDev.chipset; ptr->dev_busid = DevToConfig[screennum].GDev.busID; ptr->dev_driver = DevToConfig[screennum].GDev.driver; @@ -281,7 +290,7 @@ configureDeviceSection(int screennum) " ### <string>: \"String\", <freq>: \"<f> Hz/kHz/MHz\",\n" " ### <percent>: \"<f>%\"\n" " ### [arg]: arg optional\n"; - ptr->dev_comment = strdup(descrip); + ptr->dev_comment = xnfstrdup(descrip); if (ptr->dev_comment) { for (p = DevToConfig[screennum].GDev.options; p->name != NULL; p++) { char *p_e; @@ -328,9 +337,9 @@ configureLayoutSection(void) iptr = malloc(sizeof(XF86ConfInputrefRec)); iptr->list.next = NULL; iptr->iref_option_lst = NULL; - iptr->iref_inputdev_str = "Mouse0"; + iptr->iref_inputdev_str = xnfstrdup("Mouse0"); iptr->iref_option_lst = - xf86addNewOption(iptr->iref_option_lst, strdup("CorePointer"), + xf86addNewOption(iptr->iref_option_lst, xnfstrdup("CorePointer"), NULL); ptr->lay_input_lst = (XF86ConfInputrefPtr) xf86addListItem((glp) ptr->lay_input_lst, (glp) iptr); @@ -342,9 +351,9 @@ configureLayoutSection(void) iptr = malloc(sizeof(XF86ConfInputrefRec)); iptr->list.next = NULL; iptr->iref_option_lst = NULL; - iptr->iref_inputdev_str = "Keyboard0"; + iptr->iref_inputdev_str = xnfstrdup("Keyboard0"); iptr->iref_option_lst = - xf86addNewOption(iptr->iref_option_lst, strdup("CoreKeyboard"), + xf86addNewOption(iptr->iref_option_lst, xnfstrdup("CoreKeyboard"), NULL); ptr->lay_input_lst = (XF86ConfInputrefPtr) xf86addListItem((glp) ptr->lay_input_lst, (glp) iptr); @@ -352,20 +361,23 @@ configureLayoutSection(void) for (scrnum = 0; scrnum < nDevToConfig; scrnum++) { XF86ConfAdjacencyPtr aptr; + char *tmp; aptr = malloc(sizeof(XF86ConfAdjacencyRec)); aptr->list.next = NULL; aptr->adj_x = 0; aptr->adj_y = 0; aptr->adj_scrnum = scrnum; - XNFasprintf(&aptr->adj_screen_str, "Screen%d", scrnum); + XNFasprintf(&tmp, "Screen%d", scrnum); + aptr->adj_screen_str = tmp; if (scrnum == 0) { aptr->adj_where = CONF_ADJ_ABSOLUTE; aptr->adj_refscreen = NULL; } else { aptr->adj_where = CONF_ADJ_RIGHTOF; - XNFasprintf(&aptr->adj_refscreen, "Screen%d", scrnum - 1); + XNFasprintf(&tmp, "Screen%d", scrnum - 1); + aptr->adj_refscreen = tmp; } ptr->lay_adjacency_lst = (XF86ConfAdjacencyPtr) xf86addListItem((glp) ptr->lay_adjacency_lst, @@ -386,7 +398,7 @@ configureFlagsSection(void) static XF86ConfModulePtr configureModuleSection(void) { - char **elist, **el; + const char **elist, **el; /* Find the list of extension & font modules. */ const char *esubdirs[] = { @@ -419,9 +431,9 @@ configureFilesSection(void) parsePrologue(XF86ConfFilesPtr, XF86ConfFilesRec) if (xf86ModulePath) - ptr->file_modulepath = strdup(xf86ModulePath); + ptr->file_modulepath = xnfstrdup(xf86ModulePath); if (defaultFontPath) - ptr->file_fontpath = strdup(defaultFontPath); + ptr->file_fontpath = xnfstrdup(defaultFontPath); return ptr; } @@ -429,11 +441,13 @@ configureFilesSection(void) static XF86ConfMonitorPtr configureMonitorSection(int screennum) { + char *tmp; parsePrologue(XF86ConfMonitorPtr, XF86ConfMonitorRec) - XNFasprintf(&ptr->mon_identifier, "Monitor%d", screennum); - ptr->mon_vendor = strdup("Monitor Vendor"); - ptr->mon_modelname = strdup("Monitor Model"); + XNFasprintf(&tmp, "Monitor%d", screennum); + ptr->mon_identifier = tmp; + ptr->mon_vendor = xnfstrdup("Monitor Vendor"); + ptr->mon_modelname = xnfstrdup("Monitor Model"); return ptr; } @@ -471,11 +485,13 @@ configureDDCMonitorSection(int screennum) #define displaySizeMaxLen 80 char displaySize_string[displaySizeMaxLen]; int displaySizeLen; + char *tmp; parsePrologue(XF86ConfMonitorPtr, XF86ConfMonitorRec) - XNFasprintf(&ptr->mon_identifier, "Monitor%d", screennum); - ptr->mon_vendor = strdup(ConfiguredMonitor->vendor.name); + XNFasprintf(&tmp, "Monitor%d", screennum); + ptr->mon_identifier = tmp; + ptr->mon_vendor = xnfstrdup(ConfiguredMonitor->vendor.name); XNFasprintf(&ptr->mon_modelname, "%x", ConfiguredMonitor->vendor.prod_id); /* features in centimetres, we want millimetres */ @@ -513,7 +529,7 @@ configureDDCMonitorSection(int screennum) if (ConfiguredMonitor->features.dpms) { ptr->mon_option_lst = - xf86addNewOption(ptr->mon_option_lst, strdup("DPMS"), NULL); + xf86addNewOption(ptr->mon_option_lst, xnfstrdup("DPMS"), NULL); } return ptr; @@ -527,7 +543,7 @@ DoConfigure(void) char filename[PATH_MAX]; const char *addslash = ""; XF86ConfigPtr xf86config = NULL; - char **vlist, **vl; + const char **vlist, **vl; int *dev2screen; vlist = xf86DriverlistFromCompile(); @@ -569,24 +585,24 @@ DoConfigure(void) /* Add device, monitor and screen sections for detected devices */ for (screennum = 0; screennum < nDevToConfig; screennum++) { - XF86ConfDevicePtr DevicePtr; - XF86ConfMonitorPtr MonitorPtr; - XF86ConfScreenPtr ScreenPtr; + XF86ConfDevicePtr device_ptr; + XF86ConfMonitorPtr monitor_ptr; + XF86ConfScreenPtr screen_ptr; - DevicePtr = configureDeviceSection(screennum); + device_ptr = configureDeviceSection(screennum); xf86config->conf_device_lst = (XF86ConfDevicePtr) xf86addListItem((glp) xf86config-> conf_device_lst, (glp) - DevicePtr); - MonitorPtr = configureMonitorSection(screennum); - xf86config->conf_monitor_lst = (XF86ConfMonitorPtr) xf86addListItem((glp) xf86config->conf_monitor_lst, (glp) MonitorPtr); - ScreenPtr = configureScreenSection(screennum); + device_ptr); + monitor_ptr = configureMonitorSection(screennum); + xf86config->conf_monitor_lst = (XF86ConfMonitorPtr) xf86addListItem((glp) xf86config->conf_monitor_lst, (glp) monitor_ptr); + screen_ptr = configureScreenSection(screennum); xf86config->conf_screen_lst = (XF86ConfScreenPtr) xf86addListItem((glp) xf86config-> conf_screen_lst, (glp) - ScreenPtr); + screen_ptr); } xf86config->conf_files = configureFilesSection(); @@ -697,27 +713,27 @@ DoConfigure(void) xf86freeScreenList(xf86config->conf_screen_lst); xf86config->conf_screen_lst = NULL; for (j = 0; j < xf86NumScreens; j++) { - XF86ConfMonitorPtr MonitorPtr; - XF86ConfScreenPtr ScreenPtr; + XF86ConfMonitorPtr monitor_ptr; + XF86ConfScreenPtr screen_ptr; ConfiguredMonitor = NULL; if ((*xf86Screens[dev2screen[j]]->PreInit) (xf86Screens[dev2screen[j]], PROBE_DETECT) && ConfiguredMonitor) { - MonitorPtr = configureDDCMonitorSection(j); + monitor_ptr = configureDDCMonitorSection(j); } else { - MonitorPtr = configureMonitorSection(j); + monitor_ptr = configureMonitorSection(j); } - ScreenPtr = configureScreenSection(j); + screen_ptr = configureScreenSection(j); - xf86config->conf_monitor_lst = (XF86ConfMonitorPtr) xf86addListItem((glp) xf86config->conf_monitor_lst, (glp) MonitorPtr); + xf86config->conf_monitor_lst = (XF86ConfMonitorPtr) xf86addListItem((glp) xf86config->conf_monitor_lst, (glp) monitor_ptr); xf86config->conf_screen_lst = (XF86ConfScreenPtr) xf86addListItem((glp) xf86config-> conf_screen_lst, (glp) - ScreenPtr); + screen_ptr); } if (xf86writeConfigFile(filename, xf86config) == 0) { @@ -766,7 +782,7 @@ void DoShowOptions(void) { int i = 0; - char **vlist = 0; + const char **vlist = NULL; char *pSymbol = 0; XF86ModuleData *initData = 0; diff --git a/xserver/hw/xfree86/common/xf86DGA.c b/xserver/hw/xfree86/common/xf86DGA.c index 6a05ce536..b9e1e3f88 100644 --- a/xserver/hw/xfree86/common/xf86DGA.c +++ b/xserver/hw/xfree86/common/xf86DGA.c @@ -450,7 +450,7 @@ xf86SetDGAMode(ScrnInfoPtr pScrn, int num, DGADevicePtr devRet) pMode->pixmapHeight, pMode->depth, pMode->bitsPerPixel, pMode->bytesPerScanline, - (pointer) (pMode->address)); + (void *) (pMode->address)); } } @@ -1214,7 +1214,7 @@ DGAHandleEvent(int screen_num, InternalEvent *ev, DeviceIntPtr device) static void XDGAResetProc(ExtensionEntry * extEntry); -static void DGAClientStateChange(CallbackListPtr *, pointer, pointer); +static void DGAClientStateChange(CallbackListPtr *, void *, void *); static DevPrivateKeyRec DGAScreenPrivateKeyRec; @@ -1404,7 +1404,7 @@ ProcXDGAQueryModes(ClientPtr client) } static void -DGAClientStateChange(CallbackListPtr *pcbl, pointer nulldata, pointer calldata) +DGAClientStateChange(CallbackListPtr *pcbl, void *nulldata, void *calldata) { NewClientInfoRec *pci = (NewClientInfoRec *) calldata; ClientPtr client = NULL; @@ -1484,7 +1484,7 @@ ProcXDGASetMode(ClientPtr client) DGA_SETCLIENT(stuff->screen, client); if (pPix) { - if (AddResource(stuff->pid, RT_PIXMAP, (pointer) (pPix))) { + if (AddResource(stuff->pid, RT_PIXMAP, (void *) (pPix))) { pPix->drawable.id = (int) stuff->pid; rep.flags = DGA_PIXMAP_AVAILABLE; } @@ -1562,7 +1562,7 @@ ProcXDGAInstallColormap(ClientPtr client) REQUEST_SIZE_MATCH(xXDGAInstallColormapReq); - rc = dixLookupResourceByType((pointer *) &cmap, stuff->cmap, RT_COLORMAP, + rc = dixLookupResourceByType((void **) &cmap, stuff->cmap, RT_COLORMAP, client, DixInstallAccess); if (rc != Success) return rc; @@ -1991,7 +1991,7 @@ ProcXF86DGAInstallColormap(ClientPtr client) if (!DGAActive(stuff->screen)) return DGAErrorBase + XF86DGADirectNotActivated; - rc = dixLookupResourceByType((pointer *) &pcmp, stuff->id, RT_COLORMAP, + rc = dixLookupResourceByType((void **) &pcmp, stuff->id, RT_COLORMAP, client, DixInstallAccess); if (rc == Success) { DGAInstallCmap(pcmp); diff --git a/xserver/hw/xfree86/common/xf86DPMS.c b/xserver/hw/xfree86/common/xf86DPMS.c index 881cb2773..2b5a3ed1e 100644 --- a/xserver/hw/xfree86/common/xf86DPMS.c +++ b/xserver/hw/xfree86/common/xf86DPMS.c @@ -60,7 +60,7 @@ xf86DPMSInit(ScreenPtr pScreen, DPMSSetProcPtr set, int flags) #ifdef DPMSExtension ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); DPMSPtr pDPMS; - pointer DPMSOpt; + void *DPMSOpt; MessageType enabled_from; DPMSKey = &DPMSKeyRec; @@ -166,7 +166,7 @@ DPMSSet(ClientPtr client, int level) return rc; } } else if (!xf86IsUnblank(screenIsSaved)) { - rc = dixSaveScreens(client, SCREEN_SAVER_FORCER, ScreenSaverReset); + rc = dixSaveScreens(client, SCREEN_SAVER_OFF, ScreenSaverReset); if (rc != Success) return rc; } diff --git a/xserver/hw/xfree86/common/xf86Events.c b/xserver/hw/xfree86/common/xf86Events.c index d0b14314b..35a673d15 100644 --- a/xserver/hw/xfree86/common/xf86Events.c +++ b/xserver/hw/xfree86/common/xf86Events.c @@ -56,6 +56,7 @@ #include <X11/X.h> #include <X11/Xpoll.h> #include <X11/Xproto.h> +#include <X11/Xatom.h> #include "misc.h" #include "compiler.h" #include "xf86.h" @@ -85,6 +86,8 @@ #endif #include "xf86platformBus.h" +#include "systemd-logind.h" + /* * This is a toggling variable: * FALSE = No VT switching keys have been pressed last time around @@ -114,7 +117,7 @@ static void xf86VTSwitch(void); typedef struct x_IHRec { int fd; InputHandlerProc ihproc; - pointer data; + void *data; Bool enabled; Bool is_input; struct x_IHRec *next; @@ -243,7 +246,7 @@ xf86ProcessActionEvent(ActionEvent action, void *arg) /* ARGSUSED */ void -xf86Wakeup(pointer blockData, int err, pointer pReadmask) +xf86Wakeup(void *blockData, int err, void *pReadmask) { fd_set *LastSelectMask = (fd_set *) pReadmask; fd_set devicesWithInput; @@ -407,184 +410,233 @@ xf86ReleaseKeys(DeviceIntPtr pDev) } } +void +xf86DisableInputDeviceForVTSwitch(InputInfoPtr pInfo) +{ + if (!pInfo->dev) + return; + + if (!pInfo->dev->enabled) + pInfo->flags |= XI86_DEVICE_DISABLED; + + xf86ReleaseKeys(pInfo->dev); + ProcessInputEvents(); + DisableDevice(pInfo->dev, TRUE); +} + +void +xf86EnableInputDeviceForVTSwitch(InputInfoPtr pInfo) +{ + if (pInfo->dev && (pInfo->flags & XI86_DEVICE_DISABLED) == 0) + EnableDevice(pInfo->dev, TRUE); + pInfo->flags &= ~XI86_DEVICE_DISABLED; +} + /* - * xf86VTSwitch -- - * Handle requests for switching the vt. + * xf86UpdateHasVTProperty -- + * Update a flag property on the root window to say whether the server VT + * is currently the active one as some clients need to know this. */ static void -xf86VTSwitch(void) +xf86UpdateHasVTProperty(Bool hasVT) +{ + Atom property_name; + int32_t value = hasVT ? 1 : 0; + int i; + + property_name = MakeAtom(HAS_VT_ATOM_NAME, sizeof(HAS_VT_ATOM_NAME) - 1, + FALSE); + if (property_name == BAD_RESOURCE) + FatalError("Failed to retrieve \"HAS_VT\" atom\n"); + for (i = 0; i < xf86NumScreens; i++) { + ChangeWindowProperty(xf86ScrnToScreen(xf86Screens[i])->root, + property_name, XA_INTEGER, 32, + PropModeReplace, 1, &value, TRUE); + } +} + +void +xf86VTLeave(void) { int i; InputInfoPtr pInfo; IHPtr ih; - DebugF("xf86VTSwitch()\n"); - -#ifdef XFreeXDGA - if (!DGAVTSwitch()) - return; + DebugF("xf86VTSwitch: Leaving, xf86Exiting is %s\n", + BOOLTOSTRING((dispatchException & DE_TERMINATE) ? TRUE : FALSE)); +#ifdef DPMSExtension + if (DPMSPowerLevel != DPMSModeOn) + DPMSSet(serverClient, DPMSModeOn); #endif + for (i = 0; i < xf86NumScreens; i++) { + if (!(dispatchException & DE_TERMINATE)) + if (xf86Screens[i]->EnableDisableFBAccess) + (*xf86Screens[i]->EnableDisableFBAccess) (xf86Screens[i], FALSE); + } /* - * Since all screens are currently all in the same state it is sufficient - * check the first. This might change in future. + * Keep the order: Disable Device > LeaveVT + * EnterVT > EnableDevice */ - if (xf86VTOwner()) { + for (ih = InputHandlers; ih; ih = ih->next) { + if (ih->is_input) + xf86DisableInputHandler(ih); + else + xf86DisableGeneralHandler(ih); + } + for (pInfo = xf86InputDevs; pInfo; pInfo = pInfo->next) + xf86DisableInputDeviceForVTSwitch(pInfo); - DebugF("xf86VTSwitch: Leaving, xf86Exiting is %s\n", - BOOLTOSTRING((dispatchException & DE_TERMINATE) ? TRUE : FALSE)); -#ifdef DPMSExtension - if (DPMSPowerLevel != DPMSModeOn) - DPMSSet(serverClient, DPMSModeOn); + OsBlockSIGIO(); + for (i = 0; i < xf86NumScreens; i++) + xf86Screens[i]->LeaveVT(xf86Screens[i]); + for (i = 0; i < xf86NumGPUScreens; i++) + xf86GPUScreens[i]->LeaveVT(xf86GPUScreens[i]); + + xf86AccessLeave(); /* We need this here, otherwise */ + + if (!xf86VTSwitchAway()) + goto switch_failed; + +#ifdef XF86PM + if (xf86OSPMClose) + xf86OSPMClose(); + xf86OSPMClose = NULL; #endif - for (i = 0; i < xf86NumScreens; i++) { - if (!(dispatchException & DE_TERMINATE)) - if (xf86Screens[i]->EnableDisableFBAccess) - (*xf86Screens[i]->EnableDisableFBAccess) (xf86Screens[i], FALSE); - } + for (i = 0; i < xf86NumScreens; i++) { /* - * Keep the order: Disable Device > LeaveVT - * EnterVT > EnableDevice + * zero all access functions to + * trap calls when switched away. */ - for (ih = InputHandlers; ih; ih = ih->next) { - if (ih->is_input) - xf86DisableInputHandler(ih); - else - xf86DisableGeneralHandler(ih); - } - for (pInfo = xf86InputDevs; pInfo; pInfo = pInfo->next) { - if (pInfo->dev) { - if (!pInfo->dev->enabled) - pInfo->flags |= XI86_DEVICE_DISABLED; - xf86ReleaseKeys(pInfo->dev); - ProcessInputEvents(); - DisableDevice(pInfo->dev, TRUE); - } - } + xf86Screens[i]->vtSema = FALSE; + } + if (xorgHWAccess) + xf86DisableIO(); - OsBlockSIGIO(); - for (i = 0; i < xf86NumScreens; i++) - xf86Screens[i]->LeaveVT(xf86Screens[i]); - for (i = 0; i < xf86NumGPUScreens; i++) - xf86GPUScreens[i]->LeaveVT(xf86GPUScreens[i]); + xf86UpdateHasVTProperty(FALSE); - xf86AccessLeave(); /* We need this here, otherwise */ + return; - if (!xf86VTSwitchAway()) { - /* - * switch failed - */ +switch_failed: + DebugF("xf86VTSwitch: Leave failed\n"); + xf86AccessEnter(); + for (i = 0; i < xf86NumScreens; i++) { + if (!xf86Screens[i]->EnterVT(xf86Screens[i])) + FatalError("EnterVT failed for screen %d\n", i); + } + for (i = 0; i < xf86NumGPUScreens; i++) { + if (!xf86GPUScreens[i]->EnterVT(xf86GPUScreens[i])) + FatalError("EnterVT failed for gpu screen %d\n", i); + } + if (!(dispatchException & DE_TERMINATE)) { + for (i = 0; i < xf86NumScreens; i++) { + if (xf86Screens[i]->EnableDisableFBAccess) + (*xf86Screens[i]->EnableDisableFBAccess) (xf86Screens[i], TRUE); + } + } + dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset); + + for (pInfo = xf86InputDevs; pInfo; pInfo = pInfo->next) + xf86EnableInputDeviceForVTSwitch(pInfo); + for (ih = InputHandlers; ih; ih = ih->next) { + if (ih->is_input) + xf86EnableInputHandler(ih); + else + xf86EnableGeneralHandler(ih); + } + OsReleaseSIGIO(); +} - DebugF("xf86VTSwitch: Leave failed\n"); - xf86AccessEnter(); - for (i = 0; i < xf86NumScreens; i++) { - if (!xf86Screens[i]->EnterVT(xf86Screens[i])) - FatalError("EnterVT failed for screen %d\n", i); - } - for (i = 0; i < xf86NumGPUScreens; i++) { - if (!xf86GPUScreens[i]->EnterVT(xf86GPUScreens[i])) - FatalError("EnterVT failed for gpu screen %d\n", i); - } - if (!(dispatchException & DE_TERMINATE)) { - for (i = 0; i < xf86NumScreens; i++) { - if (xf86Screens[i]->EnableDisableFBAccess) - (*xf86Screens[i]->EnableDisableFBAccess) (xf86Screens[i], TRUE); - } - } - dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset); +void +xf86VTEnter(void) +{ + int i; + InputInfoPtr pInfo; + IHPtr ih; - pInfo = xf86InputDevs; - while (pInfo) { - if (pInfo->dev && (pInfo->flags & XI86_DEVICE_DISABLED) == 0) - EnableDevice(pInfo->dev, TRUE); - pInfo->flags &= ~XI86_DEVICE_DISABLED; - pInfo = pInfo->next; - } - for (ih = InputHandlers; ih; ih = ih->next) { - if (ih->is_input) - xf86EnableInputHandler(ih); - else - xf86EnableGeneralHandler(ih); - } - OsReleaseSIGIO(); + DebugF("xf86VTSwitch: Entering\n"); + if (!xf86VTSwitchTo()) + return; - } - else { #ifdef XF86PM - if (xf86OSPMClose) - xf86OSPMClose(); - xf86OSPMClose = NULL; + xf86OSPMClose = xf86OSPMOpen(); #endif - for (i = 0; i < xf86NumScreens; i++) { - /* - * zero all access functions to - * trap calls when switched away. - */ - xf86Screens[i]->vtSema = FALSE; - } - if (xorgHWAccess) - xf86DisableIO(); - } + if (xorgHWAccess) + xf86EnableIO(); + xf86AccessEnter(); + for (i = 0; i < xf86NumScreens; i++) { + xf86Screens[i]->vtSema = TRUE; + if (!xf86Screens[i]->EnterVT(xf86Screens[i])) + FatalError("EnterVT failed for screen %d\n", i); + } + for (i = 0; i < xf86NumGPUScreens; i++) { + xf86GPUScreens[i]->vtSema = TRUE; + if (!xf86GPUScreens[i]->EnterVT(xf86GPUScreens[i])) + FatalError("EnterVT failed for gpu screen %d\n", i); + } + for (i = 0; i < xf86NumScreens; i++) { + if (xf86Screens[i]->EnableDisableFBAccess) + (*xf86Screens[i]->EnableDisableFBAccess) (xf86Screens[i], TRUE); } - else { - DebugF("xf86VTSwitch: Entering\n"); - if (!xf86VTSwitchTo()) - return; -#ifdef XF86PM - xf86OSPMClose = xf86OSPMOpen(); + /* Turn screen saver off when switching back */ + dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset); + + /* If we use systemd-logind it will enable input devices for us */ + if (!systemd_logind_controls_session()) + for (pInfo = xf86InputDevs; pInfo; pInfo = pInfo->next) + xf86EnableInputDeviceForVTSwitch(pInfo); + + for (ih = InputHandlers; ih; ih = ih->next) { + if (ih->is_input) + xf86EnableInputHandler(ih); + else + xf86EnableGeneralHandler(ih); + } +#ifdef XSERVER_PLATFORM_BUS + /* check for any new output devices */ + xf86platformVTProbe(); #endif - if (xorgHWAccess) - xf86EnableIO(); - xf86AccessEnter(); - for (i = 0; i < xf86NumScreens; i++) { - xf86Screens[i]->vtSema = TRUE; - if (!xf86Screens[i]->EnterVT(xf86Screens[i])) - FatalError("EnterVT failed for screen %d\n", i); - } - for (i = 0; i < xf86NumGPUScreens; i++) { - xf86GPUScreens[i]->vtSema = TRUE; - if (!xf86GPUScreens[i]->EnterVT(xf86GPUScreens[i])) - FatalError("EnterVT failed for gpu screen %d\n", i); - } - for (i = 0; i < xf86NumScreens; i++) { - if (xf86Screens[i]->EnableDisableFBAccess) - (*xf86Screens[i]->EnableDisableFBAccess) (xf86Screens[i], TRUE); - } + xf86UpdateHasVTProperty(TRUE); - /* Turn screen saver off when switching back */ - dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset); + OsReleaseSIGIO(); +} - pInfo = xf86InputDevs; - while (pInfo) { - if (pInfo->dev && (pInfo->flags & XI86_DEVICE_DISABLED) == 0) - EnableDevice(pInfo->dev, TRUE); - pInfo->flags &= ~XI86_DEVICE_DISABLED; - pInfo = pInfo->next; - } +/* + * xf86VTSwitch -- + * Handle requests for switching the vt. + */ +static void +xf86VTSwitch(void) +{ + DebugF("xf86VTSwitch()\n"); - for (ih = InputHandlers; ih; ih = ih->next) { - if (ih->is_input) - xf86EnableInputHandler(ih); - else - xf86EnableGeneralHandler(ih); - } -#ifdef XSERVER_PLATFORM_BUS - /* check for any new output devices */ - xf86platformVTProbe(); +#ifdef XFreeXDGA + if (!DGAVTSwitch()) + return; #endif - OsReleaseSIGIO(); - } + /* + * Since all screens are currently all in the same state it is sufficient + * check the first. This might change in future. + * + * VTLeave is always handled here (VT_PROCESS guarantees this is safe), + * if we use systemd_logind xf86VTEnter() gets called by systemd-logind.c + * once it has resumed all drm nodes. + */ + if (xf86VTOwner()) + xf86VTLeave(); + else if (!systemd_logind_controls_session()) + xf86VTEnter(); } /* Input handler registration */ -static pointer -addInputHandler(int fd, InputHandlerProc proc, pointer data) +static void * +addInputHandler(int fd, InputHandlerProc proc, void *data) { IHPtr ih; @@ -606,8 +658,8 @@ addInputHandler(int fd, InputHandlerProc proc, pointer data) return ih; } -pointer -xf86AddInputHandler(int fd, InputHandlerProc proc, pointer data) +void * +xf86AddInputHandler(int fd, InputHandlerProc proc, void *data) { IHPtr ih = addInputHandler(fd, proc, data); @@ -618,8 +670,8 @@ xf86AddInputHandler(int fd, InputHandlerProc proc, pointer data) return ih; } -pointer -xf86AddGeneralHandler(int fd, InputHandlerProc proc, pointer data) +void * +xf86AddGeneralHandler(int fd, InputHandlerProc proc, void *data) { IHPtr ih = addInputHandler(fd, proc, data); @@ -634,7 +686,7 @@ xf86AddGeneralHandler(int fd, InputHandlerProc proc, pointer data) * proc may be NULL if the server should not handle events on the console. */ InputHandlerProc -xf86SetConsoleHandler(InputHandlerProc proc, pointer data) +xf86SetConsoleHandler(InputHandlerProc proc, void *data) { static IHPtr handler = NULL; InputHandlerProc old_proc = NULL; @@ -667,7 +719,7 @@ removeInputHandler(IHPtr ih) } int -xf86RemoveInputHandler(pointer handler) +xf86RemoveInputHandler(void *handler) { IHPtr ih; int fd; @@ -686,7 +738,7 @@ xf86RemoveInputHandler(pointer handler) } int -xf86RemoveGeneralHandler(pointer handler) +xf86RemoveGeneralHandler(void *handler) { IHPtr ih; int fd; @@ -705,7 +757,7 @@ xf86RemoveGeneralHandler(pointer handler) } void -xf86DisableInputHandler(pointer handler) +xf86DisableInputHandler(void *handler) { IHPtr ih; @@ -719,7 +771,7 @@ xf86DisableInputHandler(pointer handler) } void -xf86DisableGeneralHandler(pointer handler) +xf86DisableGeneralHandler(void *handler) { IHPtr ih; @@ -733,7 +785,7 @@ xf86DisableGeneralHandler(pointer handler) } void -xf86EnableInputHandler(pointer handler) +xf86EnableInputHandler(void *handler) { IHPtr ih; @@ -747,7 +799,7 @@ xf86EnableInputHandler(pointer handler) } void -xf86EnableGeneralHandler(pointer handler) +xf86EnableGeneralHandler(void *handler) { IHPtr ih; diff --git a/xserver/hw/xfree86/common/xf86Extensions.c b/xserver/hw/xfree86/common/xf86Extensions.c index f9e791607..25b2bc3d0 100644 --- a/xserver/hw/xfree86/common/xf86Extensions.c +++ b/xserver/hw/xfree86/common/xf86Extensions.c @@ -89,7 +89,6 @@ load_extension_config(void) { XF86ConfModulePtr mod_con = xf86configptr->conf_modules; XF86LoadPtr modp; - int i; /* Only the best. */ if (!mod_con) @@ -133,10 +132,7 @@ load_extension_config(void) void xf86ExtensionInit(void) { - int i; - load_extension_config(); - for (i = 0; i < ARRAY_SIZE(extensionModules); i++) - LoadExtension(&extensionModules[i], TRUE); + LoadExtensionList(extensionModules, ARRAY_SIZE(extensionModules), TRUE); } diff --git a/xserver/hw/xfree86/common/xf86Globals.c b/xserver/hw/xfree86/common/xf86Globals.c index 7df7a80c4..984c39bca 100644 --- a/xserver/hw/xfree86/common/xf86Globals.c +++ b/xserver/hw/xfree86/common/xf86Globals.c @@ -143,7 +143,7 @@ const char *xf86ConfigFile = NULL; const char *xf86ConfigDir = NULL; const char *xf86ModulePath = DEFAULT_MODULE_PATH; MessageType xf86ModPathFrom = X_DEFAULT; -const char *xf86LogFile = DEFAULT_LOGPREFIX; +const char *xf86LogFile = DEFAULT_LOGDIR "/" DEFAULT_LOGPREFIX; MessageType xf86LogFileFrom = X_DEFAULT; Bool xf86LogFileWasOpened = FALSE; serverLayoutRec xf86ConfigLayout = { NULL, }; diff --git a/xserver/hw/xfree86/common/xf86Helper.c b/xserver/hw/xfree86/common/xf86Helper.c index 676cc8062..e2b32a074 100644 --- a/xserver/hw/xfree86/common/xf86Helper.c +++ b/xserver/hw/xfree86/common/xf86Helper.c @@ -67,7 +67,7 @@ static int xf86ScrnInfoPrivateCount = 0; /* Add a pointer to a new DriverRec to xf86DriverList */ void -xf86AddDriver(DriverPtr driver, pointer module, int flags) +xf86AddDriver(DriverPtr driver, void *module, int flags) { /* Don't add null entries */ if (!driver) @@ -107,7 +107,7 @@ xf86DeleteDriver(int drvIndex) /* Add a pointer to a new InputDriverRec to xf86InputDriverList */ void -xf86AddInputDriver(InputDriverPtr driver, pointer module, int flags) +xf86AddInputDriver(InputDriverPtr driver, void *module, int flags) { /* Don't add null entries */ if (!driver) @@ -422,7 +422,6 @@ xf86SetDepthBpp(ScrnInfoPtr scrp, int depth, int dummy, int fbbpp, * Check for DefaultDepth and DefaultFbBpp options in the * Device sections. */ - int i; GDevPtr device; Bool found = FALSE; @@ -1069,9 +1068,7 @@ void xf86EnableDisableFBAccess(ScrnInfoPtr pScrnInfo, Bool enable) { ScreenPtr pScreen = pScrnInfo->pScreen; - PixmapPtr pspix; - pspix = (*pScreen->GetScreenPixmap) (pScreen); if (enable) { /* * Restore all of the clip lists on the screen @@ -1220,16 +1217,45 @@ xf86ErrorF(const char *format, ...) va_end(ap); } +/* Note temporarily modifies the passed in buffer! */ +static void xf86_mkdir_p(char *path) +{ + char *sep = path; + + while ((sep = strchr(sep + 1, '/'))) { + *sep = 0; + (void)mkdir(path, 0777); + *sep = '/'; + } + (void)mkdir(path, 0777); +} + void xf86LogInit(void) { - char *lf = NULL; + char *env, *lf = NULL; + char buf[PATH_MAX]; #define LOGSUFFIX ".log" #define LOGOLDSUFFIX ".old" /* Get the log file name */ if (xf86LogFileFrom == X_DEFAULT) { + /* When not running as root, we won't be able to write to /var/log */ + if (geteuid() != 0) { + if ((env = getenv("XDG_DATA_HOME"))) + snprintf(buf, sizeof(buf), "%s/%s", env, + DEFAULT_XDG_DATA_HOME_LOGDIR); + else if ((env = getenv("HOME"))) + snprintf(buf, sizeof(buf), "%s/%s/%s", env, + DEFAULT_XDG_DATA_HOME, DEFAULT_XDG_DATA_HOME_LOGDIR); + + if (env) { + xf86_mkdir_p(buf); + strlcat(buf, "/" DEFAULT_LOGPREFIX, sizeof(buf)); + xf86LogFile = buf; + } + } /* Append the display number and ".log" */ if (asprintf(&lf, "%s%%s" LOGSUFFIX, xf86LogFile) == -1) FatalError("Cannot allocate space for the log file name\n"); @@ -1532,15 +1558,15 @@ xf86DisableRandR(void) } CARD32 -xf86GetModuleVersion(pointer module) +xf86GetModuleVersion(void *module) { return (CARD32) LoaderGetModuleVersion(module); } -pointer +void * xf86LoadDrvSubModule(DriverPtr drv, const char *name) { - pointer ret; + void *ret; int errmaj = 0, errmin = 0; ret = LoadSubModule(drv->module, name, NULL, NULL, NULL, NULL, @@ -1550,10 +1576,10 @@ xf86LoadDrvSubModule(DriverPtr drv, const char *name) return ret; } -pointer +void * xf86LoadSubModule(ScrnInfoPtr pScrn, const char *name) { - pointer ret; + void *ret; int errmaj = 0, errmin = 0; ret = LoadSubModule(pScrn->module, name, NULL, NULL, NULL, NULL, @@ -1566,12 +1592,12 @@ xf86LoadSubModule(ScrnInfoPtr pScrn, const char *name) /* * xf86LoadOneModule loads a single module. */ -pointer -xf86LoadOneModule(char *name, pointer opt) +void * +xf86LoadOneModule(const char *name, void *opt) { int errmaj, errmin; char *Name; - pointer mod; + void *mod; if (!name) return NULL; @@ -1595,7 +1621,7 @@ xf86LoadOneModule(char *name, pointer opt) } void -xf86UnloadSubModule(pointer mod) +xf86UnloadSubModule(void *mod) { UnloadSubModule(mod); } @@ -1698,9 +1724,9 @@ xf86SetSilkenMouse(ScreenPtr pScreen) /* Wrote this function for the PM2 Xv driver, preliminary. */ -pointer -xf86FindXvOptions(ScrnInfoPtr pScrn, int adaptor_index, char *port_name, - char **adaptor_name, pointer *adaptor_options) +void * +xf86FindXvOptions(ScrnInfoPtr pScrn, int adaptor_index, const char *port_name, + const char **adaptor_name, void **adaptor_options) { confXvAdaptorPtr adaptor; int i; @@ -1732,7 +1758,7 @@ xf86FindXvOptions(ScrnInfoPtr pScrn, int adaptor_index, char *port_name, static void xf86ConfigFbEntityInactive(EntityInfoPtr pEnt, EntityProc init, - EntityProc enter, EntityProc leave, pointer private) + EntityProc enter, EntityProc leave, void *private) { ScrnInfoPtr pScrn; @@ -1744,7 +1770,7 @@ xf86ConfigFbEntityInactive(EntityInfoPtr pEnt, EntityProc init, ScrnInfoPtr xf86ConfigFbEntity(ScrnInfoPtr pScrn, int scrnFlag, int entityIndex, EntityProc init, EntityProc enter, EntityProc leave, - pointer private) + void *private) { EntityInfoPtr pEnt = xf86GetEntityInfo(entityIndex); @@ -1786,7 +1812,7 @@ xf86IsScreenPrimary(ScrnInfoPtr pScrn) int xf86RegisterRootWindowProperty(int ScrnIndex, Atom property, Atom type, - int format, unsigned long len, pointer value) + int format, unsigned long len, void *value) { RootWinPropPtr pNewProp = NULL, pRegProp; Bool existing = FALSE; @@ -1818,7 +1844,7 @@ xf86RegisterRootWindowProperty(int ScrnIndex, Atom property, Atom type, pNewProp->next = NULL; } else { - free(pNewProp->name); + free((void *) pNewProp->name); existing = TRUE; } diff --git a/xserver/hw/xfree86/common/xf86InPriv.h b/xserver/hw/xfree86/common/xf86InPriv.h index 5826ac388..b8229d2c1 100644 --- a/xserver/hw/xfree86/common/xf86InPriv.h +++ b/xserver/hw/xfree86/common/xf86InPriv.h @@ -37,7 +37,4 @@ extern InputDriverPtr *xf86InputDriverList; extern int xf86NumInputDrivers; -/* xf86Helper.c */ -InputDriverPtr xf86LookupInputDriver(const char *name); - #endif /* _xf86InPriv_h */ diff --git a/xserver/hw/xfree86/common/xf86Init.c b/xserver/hw/xfree86/common/xf86Init.c index bad9128b9..bb5d8256c 100644 --- a/xserver/hw/xfree86/common/xf86Init.c +++ b/xserver/hw/xfree86/common/xf86Init.c @@ -53,6 +53,8 @@ #include "scrnintstr.h" #include "site.h" #include "mi.h" +#include "dbus-core.h" +#include "systemd-logind.h" #include "compiler.h" @@ -313,7 +315,7 @@ xf86CreateRootWindow(WindowPtr pWin) int err = Success; ScreenPtr pScreen = pWin->drawable.pScreen; RootWinPropPtr pProp; - CreateWindowProcPtr CreateWindow = (CreateWindowProcPtr) + CreateWindowProcPtr create_window = (CreateWindowProcPtr) dixLookupPrivate(&pScreen->devPrivates, xf86CreateRootWindowKey); DebugF("xf86CreateRootWindow(%p)\n", pWin); @@ -327,7 +329,7 @@ xf86CreateRootWindow(WindowPtr pWin) } /* Unhook this function ... */ - pScreen->CreateWindow = CreateWindow; + pScreen->CreateWindow = create_window; dixSetPrivate(&pScreen->devPrivates, xf86CreateRootWindowKey, NULL); /* ... and call the previous CreateWindow fuction, if any */ @@ -389,6 +391,11 @@ InstallSignalHandlers(void) } } +/* The memory storing the initial value of the XFree86_has_VT root window + * property. This has to remain available until server start-up, so we just + * use a global. */ +static CARD32 HasVTValue = 1; + /* * InitOutput -- * Initialize screenInfo for all actually accessible framebuffers. @@ -399,8 +406,8 @@ void InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv) { int i, j, k, scr_index; - char **modulelist; - pointer *optionlist; + const char **modulelist; + void **optionlist; Pix24Flags screenpix24, pix24; MessageType pix24From = X_DEFAULT; Bool pix24Fail = FALSE; @@ -460,6 +467,9 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv) if (xf86DoShowOptions) DoShowOptions(); + dbus_core_init(); + systemd_logind_init(); + /* Do a general bus probe. This will be a PCI probe for x86 platforms */ xf86BusProbe(); @@ -548,7 +558,8 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv) if (NEED_IO_ENABLED(flags)) want_hw_access = TRUE; - if (!(flags & HW_SKIP_CONSOLE)) + /* Non-seat0 X servers should not open console */ + if (!(flags & HW_SKIP_CONSOLE) && !ServerIsNotSeat0()) xorgHWOpenConsole = TRUE; } @@ -627,7 +638,9 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv) for (i = 0; i < xf86NumScreens; i++) { if (xf86Screens[i]->name == NULL) { - XNFasprintf(&xf86Screens[i]->name, "screen%d", i); + char *tmp; + XNFasprintf(&tmp, "screen%d", i); + xf86Screens[i]->name = tmp; xf86MsgVerb(X_WARNING, 0, "Screen driver %d has no name set, using `%s'.\n", i, xf86Screens[i]->name); @@ -727,7 +740,9 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv) if (xf86Info.vtno >= 0) { #define VT_ATOM_NAME "XFree86_VT" Atom VTAtom = -1; + Atom HasVTAtom = -1; CARD32 *VT = NULL; + CARD32 *HasVT = &HasVTValue; int ret; /* This memory needs to stay available until the screen has been @@ -740,6 +755,8 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv) *VT = xf86Info.vtno; VTAtom = MakeAtom(VT_ATOM_NAME, sizeof(VT_ATOM_NAME) - 1, TRUE); + HasVTAtom = MakeAtom(HAS_VT_ATOM_NAME, + sizeof(HAS_VT_ATOM_NAME) - 1, TRUE); for (i = 0, ret = Success; i < xf86NumScreens && ret == Success; i++) { @@ -747,9 +764,14 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv) xf86RegisterRootWindowProperty(xf86Screens[i]->scrnIndex, VTAtom, XA_INTEGER, 32, 1, VT); + if (ret == Success) + ret = xf86RegisterRootWindowProperty(xf86Screens[i] + ->scrnIndex, + HasVTAtom, XA_INTEGER, + 32, 1, HasVT); if (ret != Success) xf86DrvMsg(xf86Screens[i]->scrnIndex, X_WARNING, - "Failed to register VT property\n"); + "Failed to register VT properties\n"); } } @@ -1071,6 +1093,9 @@ ddxGiveUp(enum ExitCode error) if (xorgHWOpenConsole) xf86CloseConsole(); + systemd_logind_fini(); + dbus_core_fini(); + xf86CloseLog(error); /* If an unexpected signal was caught, dump a core for debugging */ @@ -1572,10 +1597,10 @@ ddxUseMsg(void) * xf86LoadModules iterates over a list that is being passed in. */ Bool -xf86LoadModules(char **list, pointer *optlist) +xf86LoadModules(const char **list, void **optlist) { int errmaj, errmin; - pointer opt; + void *opt; int i; char *name; Bool failed = FALSE; diff --git a/xserver/hw/xfree86/common/xf86Mode.c b/xserver/hw/xfree86/common/xf86Mode.c index 706ab64fc..44bc55953 100644 --- a/xserver/hw/xfree86/common/xf86Mode.c +++ b/xserver/hw/xfree86/common/xf86Mode.c @@ -1354,7 +1354,7 @@ scanLineWidth(unsigned int xsize, /* pixels */ int xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes, - char **modeNames, ClockRangePtr clockRanges, + const char **modeNames, ClockRangePtr clockRanges, int *linePitches, int minPitch, int maxPitch, int pitchInc, int minHeight, int maxHeight, int virtualX, int virtualY, int apertureSize, LookupModeFlags strategy) @@ -1998,7 +1998,7 @@ xf86DeleteMode(DisplayModePtr * modeList, DisplayModePtr mode) mode->next->prev = mode->prev; } - free(mode->name); + free((void *) mode->name); free(mode); } diff --git a/xserver/hw/xfree86/common/xf86Module.h b/xserver/hw/xfree86/common/xf86Module.h index 265b55348..b848f53f1 100644 --- a/xserver/hw/xfree86/common/xf86Module.h +++ b/xserver/hw/xfree86/common/xf86Module.h @@ -80,8 +80,8 @@ typedef enum { * mask is 0xFFFF0000. */ #define ABI_ANSIC_VERSION SET_ABI_VERSION(0, 4) -#define ABI_VIDEODRV_VERSION SET_ABI_VERSION(15, 0) -#define ABI_XINPUT_VERSION SET_ABI_VERSION(20, 0) +#define ABI_VIDEODRV_VERSION SET_ABI_VERSION(18, 0) +#define ABI_XINPUT_VERSION SET_ABI_VERSION(21, 0) #define ABI_EXTENSION_VERSION SET_ABI_VERSION(8, 0) #define ABI_FONT_VERSION SET_ABI_VERSION(0, 6) @@ -170,13 +170,13 @@ typedef struct { #define INITARGS void /* Prototypes for Loader functions that are exported to modules */ -extern _X_EXPORT pointer LoadSubModule(pointer, const char *, const char **, - const char **, pointer, +extern _X_EXPORT void *LoadSubModule(void *, const char *, const char **, + const char **, void *, const XF86ModReqInfo *, int *, int *); -extern _X_EXPORT void UnloadSubModule(pointer); -extern _X_EXPORT void UnloadModule(pointer); -extern _X_EXPORT pointer LoaderSymbol(const char *); -extern _X_EXPORT char **LoaderListDirs(const char **, const char **); +extern _X_EXPORT void UnloadSubModule(void *); +extern _X_EXPORT void UnloadModule(void *); +extern _X_EXPORT void *LoaderSymbol(const char *); +extern _X_EXPORT const char **LoaderListDirs(const char **, const char **); extern _X_EXPORT void LoaderFreeDirList(char **); extern _X_EXPORT void LoaderErrorMsg(const char *, const char *, int, int); extern _X_EXPORT void LoaderGetOS(const char **name, int *major, int *minor, @@ -184,11 +184,11 @@ extern _X_EXPORT void LoaderGetOS(const char **name, int *major, int *minor, extern _X_EXPORT Bool LoaderShouldIgnoreABI(void); extern _X_EXPORT int LoaderGetABIVersion(const char *abiclass); -typedef pointer (*ModuleSetupProc) (pointer, pointer, int *, int *); -typedef void (*ModuleTearDownProc) (pointer); +typedef void *(*ModuleSetupProc) (void *, void *, int *, int *); +typedef void (*ModuleTearDownProc) (void *); -#define MODULESETUPPROTO(func) pointer func(pointer, pointer, int*, int*) -#define MODULETEARDOWNPROTO(func) void func(pointer) +#define MODULESETUPPROTO(func) void *func(void *, void *, int*, int*) +#define MODULETEARDOWNPROTO(func) void func(void *) typedef struct { XF86ModuleVersionInfo *vers; diff --git a/xserver/hw/xfree86/common/xf86Opt.h b/xserver/hw/xfree86/common/xf86Opt.h index c3ba2d75c..3be2a0fc7 100644 --- a/xserver/hw/xfree86/common/xf86Opt.h +++ b/xserver/hw/xfree86/common/xf86Opt.h @@ -39,7 +39,7 @@ typedef struct { typedef union { unsigned long num; - char *str; + const char *str; double realnum; Bool bool; OptFrequency freq; @@ -123,7 +123,7 @@ extern _X_EXPORT OptionInfoPtr xf86TokenToOptinfo(const OptionInfoRec * table, extern _X_EXPORT const char *xf86TokenToOptName(const OptionInfoRec * table, int token); extern _X_EXPORT Bool xf86IsOptionSet(const OptionInfoRec * table, int token); -extern _X_EXPORT char *xf86GetOptValString(const OptionInfoRec * table, +extern _X_EXPORT const char *xf86GetOptValString(const OptionInfoRec * table, int token); extern _X_EXPORT Bool xf86GetOptValInteger(const OptionInfoRec * table, int token, int *value); diff --git a/xserver/hw/xfree86/common/xf86Option.c b/xserver/hw/xfree86/common/xf86Option.c index 607c33354..0e8bc1f83 100644 --- a/xserver/hw/xfree86/common/xf86Option.c +++ b/xserver/hw/xfree86/common/xf86Option.c @@ -478,7 +478,8 @@ static Bool ParseOptionValue(int scrnIndex, XF86OptionPtr options, OptionInfoPtr p, Bool markUsed) { - char *s, *end; + const char *s; + char *end; Bool wasUsed = FALSE; if ((s = xf86findOptionValue(options, p->name)) != NULL) { @@ -755,7 +756,7 @@ xf86IsOptionSet(const OptionInfoRec * table, int token) return p && p->found; } -char * +const char * xf86GetOptValString(const OptionInfoRec * table, int token) { OptionInfoPtr p; diff --git a/xserver/hw/xfree86/common/xf86Optionstr.h b/xserver/hw/xfree86/common/xf86Optionstr.h index c38499cb5..4ef917dee 100644 --- a/xserver/hw/xfree86/common/xf86Optionstr.h +++ b/xserver/hw/xfree86/common/xf86Optionstr.h @@ -31,10 +31,10 @@ */ typedef struct _XF86OptionRec { GenericListRec list; - char *opt_name; - char *opt_val; + const char *opt_name; + const char *opt_val; int opt_used; - char *opt_comment; + const char *opt_comment; } XF86OptionRec; typedef struct _InputOption *XF86OptionPtr; diff --git a/xserver/hw/xfree86/common/xf86PM.c b/xserver/hw/xfree86/common/xf86PM.c index 15257cb81..9e49e8eaf 100644 --- a/xserver/hw/xfree86/common/xf86PM.c +++ b/xserver/hw/xfree86/common/xf86PM.c @@ -196,7 +196,7 @@ DoApmEvent(pmEvent event, Bool undo) #define MAX_NO_EVENTS 8 void -xf86HandlePMEvents(int fd, pointer data) +xf86HandlePMEvents(int fd, void *data) { pmEvent events[MAX_NO_EVENTS]; int i, n; diff --git a/xserver/hw/xfree86/common/xf86Priv.h b/xserver/hw/xfree86/common/xf86Priv.h index 58cfe0a1a..6e374eb7e 100644 --- a/xserver/hw/xfree86/common/xf86Priv.h +++ b/xserver/hw/xfree86/common/xf86Priv.h @@ -139,11 +139,11 @@ DoShowOptions(void) /* xf86Events.c */ extern _X_EXPORT void -xf86Wakeup(pointer blockData, int err, pointer pReadmask); +xf86Wakeup(void *blockData, int err, void *pReadmask); extern _X_HIDDEN int xf86SigWrapper(int signo); extern _X_EXPORT void -xf86HandlePMEvents(int fd, pointer data); +xf86HandlePMEvents(int fd, void *data); extern _X_EXPORT int (*xf86PMGetEventFromOs) (int fd, pmEvent * events, int num); extern _X_EXPORT pmWait (*xf86PMConfirmEventToOs) (int fd, pmEvent event); @@ -156,7 +156,7 @@ xf86CloseLog(enum ExitCode error); /* xf86Init.c */ extern _X_EXPORT Bool -xf86LoadModules(char **list, pointer *optlist); +xf86LoadModules(const char **list, void **optlist); extern _X_EXPORT int xf86SetVerbosity(int verb); extern _X_EXPORT int diff --git a/xserver/hw/xfree86/common/xf86Privstr.h b/xserver/hw/xfree86/common/xf86Privstr.h index e20be03a9..410ef17ac 100644 --- a/xserver/hw/xfree86/common/xf86Privstr.h +++ b/xserver/hw/xfree86/common/xf86Privstr.h @@ -136,11 +136,11 @@ typedef struct { /* Information for root window properties. */ typedef struct _RootWinProp { struct _RootWinProp *next; - char *name; + const char *name; Atom type; short format; long size; - pointer data; + void *data; } RootWinProp, *RootWinPropPtr; /* ISC's cc can't handle ~ of UL constants, so explicitly type cast them. */ @@ -163,4 +163,8 @@ typedef struct _RootWinProp { #define WSCONS 32 #endif +/* Root window property to tell clients whether our VT is currently active. + * Name chosen to match the "XFree86_VT" property. */ +#define HAS_VT_ATOM_NAME "XFree86_has_VT" + #endif /* _XF86PRIVSTR_H */ diff --git a/xserver/hw/xfree86/common/xf86VGAarbiter.c b/xserver/hw/xfree86/common/xf86VGAarbiter.c index 225fff06e..5cc24298b 100644 --- a/xserver/hw/xfree86/common/xf86VGAarbiter.c +++ b/xserver/hw/xfree86/common/xf86VGAarbiter.c @@ -257,7 +257,7 @@ VGAarbiterCloseScreen(ScreenPtr pScreen) UNWRAP_SCREEN_INFO(FreeScreen); UNWRAP_SPRITE; - free((pointer) pScreenPriv); + free((void *) pScreenPriv); xf86VGAarbiterLock(xf86ScreenToScrn(pScreen)); val = (*pScreen->CloseScreen) (pScreen); xf86VGAarbiterUnlock(xf86ScreenToScrn(pScreen)); @@ -266,7 +266,7 @@ VGAarbiterCloseScreen(ScreenPtr pScreen) static void VGAarbiterBlockHandler(ScreenPtr pScreen, - pointer pTimeout, pointer pReadmask) + void *pTimeout, void *pReadmask) { SCREEN_PROLOG(BlockHandler); VGAGet(pScreen); @@ -277,7 +277,7 @@ VGAarbiterBlockHandler(ScreenPtr pScreen, static void VGAarbiterWakeupHandler(ScreenPtr pScreen, unsigned long result, - pointer pReadmask) + void *pReadmask) { SCREEN_PROLOG(WakeupHandler); VGAGet(pScreen); @@ -586,7 +586,7 @@ VGAarbiterCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst) } static void -VGAarbiterChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects) +VGAarbiterChangeClip(GCPtr pGC, int type, void *pvalue, int nrects) { GC_UNWRAP(pGC); (*pGC->funcs->ChangeClip) (pGC, type, pvalue, nrects); @@ -860,7 +860,7 @@ VGAarbiterImageGlyphBlt(DrawablePtr pDraw, GCPtr pGC, int xInit, int yInit, unsigned int nglyph, - CharInfoPtr * ppci, pointer pglyphBase) + CharInfoPtr * ppci, void *pglyphBase) { ScreenPtr pScreen = pGC->pScreen; @@ -877,7 +877,7 @@ VGAarbiterPolyGlyphBlt(DrawablePtr pDraw, GCPtr pGC, int xInit, int yInit, unsigned int nglyph, - CharInfoPtr * ppci, pointer pglyphBase) + CharInfoPtr * ppci, void *pglyphBase) { ScreenPtr pScreen = pGC->pScreen; diff --git a/xserver/hw/xfree86/common/xf86VGAarbiterPriv.h b/xserver/hw/xfree86/common/xf86VGAarbiterPriv.h index ba6edfcc3..ec21bc2f2 100644 --- a/xserver/hw/xfree86/common/xf86VGAarbiterPriv.h +++ b/xserver/hw/xfree86/common/xf86VGAarbiterPriv.h @@ -137,15 +137,15 @@ typedef struct _VGAarbiterScreen { } VGAarbiterScreenRec, *VGAarbiterScreenPtr; typedef struct _VGAarbiterGC { - GCOps *wrapOps; - GCFuncs *wrapFuncs; + const GCOps *wrapOps; + const GCFuncs *wrapFuncs; } VGAarbiterGCRec, *VGAarbiterGCPtr; /* Screen funcs */ -static void VGAarbiterBlockHandler(ScreenPtr pScreen, pointer pTimeout, - pointer pReadmask); +static void VGAarbiterBlockHandler(ScreenPtr pScreen, void *pTimeout, + void *pReadmask); static void VGAarbiterWakeupHandler(ScreenPtr pScreen, - unsigned long result, pointer pReadmask); + unsigned long result, void *pReadmask); static Bool VGAarbiterCloseScreen(ScreenPtr pScreen); static void VGAarbiterGetImage(DrawablePtr pDrawable, int sx, int sy, int w, int h, unsigned int format, @@ -188,7 +188,7 @@ static void VGAarbiterValidateGC(GCPtr pGC, unsigned long changes, static void VGAarbiterChangeGC(GCPtr pGC, unsigned long mask); static void VGAarbiterCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst); static void VGAarbiterDestroyGC(GCPtr pGC); -static void VGAarbiterChangeClip(GCPtr pGC, int type, pointer pvalue, +static void VGAarbiterChangeClip(GCPtr pGC, int type, void *pvalue, int nrects); static void VGAarbiterDestroyClip(GCPtr pGC); static void VGAarbiterCopyClip(GCPtr pgcDst, GCPtr pgcSrc); @@ -236,10 +236,10 @@ static void VGAarbiterImageText16(DrawablePtr pDraw, GCPtr pGC, int x, int y, int count, unsigned short *chars); static void VGAarbiterImageGlyphBlt(DrawablePtr pDraw, GCPtr pGC, int xInit, int yInit, unsigned int nglyph, - CharInfoPtr * ppci, pointer pglyphBase); + CharInfoPtr * ppci, void *pglyphBase); static void VGAarbiterPolyGlyphBlt(DrawablePtr pDraw, GCPtr pGC, int xInit, int yInit, unsigned int nglyph, - CharInfoPtr * ppci, pointer pglyphBase); + CharInfoPtr * ppci, void *pglyphBase); static void VGAarbiterPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDraw, int dx, int dy, int xOrg, int yOrg); diff --git a/xserver/hw/xfree86/common/xf86VidMode.c b/xserver/hw/xfree86/common/xf86VidMode.c index a7d1c25bf..e708b2792 100644 --- a/xserver/hw/xfree86/common/xf86VidMode.c +++ b/xserver/hw/xfree86/common/xf86VidMode.c @@ -138,7 +138,7 @@ VidModeAvailable(int scrnIndex) } Bool -VidModeGetCurrentModeline(int scrnIndex, pointer *mode, int *dotClock) +VidModeGetCurrentModeline(int scrnIndex, void **mode, int *dotClock) { ScrnInfoPtr pScrn; @@ -148,7 +148,7 @@ VidModeGetCurrentModeline(int scrnIndex, pointer *mode, int *dotClock) pScrn = xf86Screens[scrnIndex]; if (pScrn->currentMode) { - *mode = (pointer) (pScrn->currentMode); + *mode = (void *) (pScrn->currentMode); *dotClock = pScrn->currentMode->Clock; return TRUE; @@ -211,7 +211,7 @@ VidModeGetClocks(int scrnIndex, int *Clocks) } Bool -VidModeGetFirstModeline(int scrnIndex, pointer *mode, int *dotClock) +VidModeGetFirstModeline(int scrnIndex, void **mode, int *dotClock) { ScrnInfoPtr pScrn; VidModePtr pVidMode; @@ -228,7 +228,7 @@ VidModeGetFirstModeline(int scrnIndex, pointer *mode, int *dotClock) pVidMode->Next = pVidMode->First->next; if (pVidMode->First->status == MODE_OK) { - *mode = (pointer) (pVidMode->First); + *mode = (void *) (pVidMode->First); *dotClock = VidModeGetDotClock(scrnIndex, pVidMode->First->Clock); return TRUE; } @@ -237,7 +237,7 @@ VidModeGetFirstModeline(int scrnIndex, pointer *mode, int *dotClock) } Bool -VidModeGetNextModeline(int scrnIndex, pointer *mode, int *dotClock) +VidModeGetNextModeline(int scrnIndex, void **mode, int *dotClock) { ScrnInfoPtr pScrn; VidModePtr pVidMode; @@ -252,7 +252,7 @@ VidModeGetNextModeline(int scrnIndex, pointer *mode, int *dotClock) for (p = pVidMode->Next; p != NULL && p != pVidMode->First; p = p->next) { if (p->status == MODE_OK) { pVidMode->Next = p->next; - *mode = (pointer) p; + *mode = (void *) p; *dotClock = VidModeGetDotClock(scrnIndex, p->Clock); return TRUE; } @@ -262,7 +262,7 @@ VidModeGetNextModeline(int scrnIndex, pointer *mode, int *dotClock) } Bool -VidModeDeleteModeline(int scrnIndex, pointer mode) +VidModeDeleteModeline(int scrnIndex, void *mode) { ScrnInfoPtr pScrn; @@ -323,7 +323,7 @@ VidModeGetViewPort(int scrnIndex, int *x, int *y) } Bool -VidModeSwitchMode(int scrnIndex, pointer mode) +VidModeSwitchMode(int scrnIndex, void *mode) { ScrnInfoPtr pScrn; DisplayModePtr pTmpMode; @@ -362,7 +362,7 @@ VidModeLockZoom(int scrnIndex, Bool lock) } Bool -VidModeGetMonitor(int scrnIndex, pointer *monitor) +VidModeGetMonitor(int scrnIndex, void **monitor) { ScrnInfoPtr pScrn; @@ -370,13 +370,13 @@ VidModeGetMonitor(int scrnIndex, pointer *monitor) return FALSE; pScrn = xf86Screens[scrnIndex]; - *monitor = (pointer) (pScrn->monitor); + *monitor = (void *) (pScrn->monitor); return TRUE; } ModeStatus -VidModeCheckModeForMonitor(int scrnIndex, pointer mode) +VidModeCheckModeForMonitor(int scrnIndex, void *mode) { ScrnInfoPtr pScrn; @@ -389,7 +389,7 @@ VidModeCheckModeForMonitor(int scrnIndex, pointer mode) } ModeStatus -VidModeCheckModeForDriver(int scrnIndex, pointer mode) +VidModeCheckModeForDriver(int scrnIndex, void *mode) { ScrnInfoPtr pScrn; @@ -402,7 +402,7 @@ VidModeCheckModeForDriver(int scrnIndex, pointer mode) } void -VidModeSetCrtcForMode(int scrnIndex, pointer mode) +VidModeSetCrtcForMode(int scrnIndex, void *mode) { ScrnInfoPtr pScrn; DisplayModePtr ScreenModes; @@ -421,7 +421,7 @@ VidModeSetCrtcForMode(int scrnIndex, pointer mode) } Bool -VidModeAddModeline(int scrnIndex, pointer mode) +VidModeAddModeline(int scrnIndex, void *mode) { ScrnInfoPtr pScrn; @@ -444,7 +444,7 @@ VidModeAddModeline(int scrnIndex, pointer mode) int VidModeGetNumOfModes(int scrnIndex) { - pointer mode = NULL; + void *mode = NULL; int dotClock = 0, nummodes = 0; if (!VidModeGetFirstModeline(scrnIndex, &mode, &dotClock)) @@ -526,7 +526,7 @@ VidModeGetGammaRampSize(int scrnIndex) return xf86GetGammaRampSize(xf86Screens[scrnIndex]->pScreen); } -pointer +void * VidModeCreateMode(void) { DisplayModePtr mode; @@ -543,13 +543,13 @@ VidModeCreateMode(void) } void -VidModeCopyMode(pointer modefrom, pointer modeto) +VidModeCopyMode(void *modefrom, void *modeto) { memcpy(modeto, modefrom, sizeof(DisplayModeRec)); } int -VidModeGetModeValue(pointer mode, int valtyp) +VidModeGetModeValue(void *mode, int valtyp) { int ret = 0; @@ -592,7 +592,7 @@ VidModeGetModeValue(pointer mode, int valtyp) } void -VidModeSetModeValue(pointer mode, int valtyp, int val) +VidModeSetModeValue(void *mode, int valtyp, int val) { switch (valtyp) { case VIDMODE_H_DISPLAY: @@ -633,7 +633,7 @@ VidModeSetModeValue(pointer mode, int valtyp, int val) } vidMonitorValue -VidModeGetMonitorValue(pointer monitor, int valtyp, int indx) +VidModeGetMonitorValue(void *monitor, int valtyp, int indx) { vidMonitorValue ret = { NULL, }; diff --git a/xserver/hw/xfree86/common/xf86Xinput.c b/xserver/hw/xfree86/common/xf86Xinput.c index 4b588a741..4e8060b0f 100644 --- a/xserver/hw/xfree86/common/xf86Xinput.c +++ b/xserver/hw/xfree86/common/xf86Xinput.c @@ -1,6 +1,6 @@ /* * Copyright 1995-1999 by Frederic Lepied, France. <Lepied@XFree86.org> - * + * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that @@ -9,8 +9,8 @@ * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Frederic Lepied makes no * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * + * is provided "as is" without express or implied warranty. + * * FREDERIC LEPIED DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL FREDERIC LEPIED BE LIABLE FOR ANY SPECIAL, INDIRECT OR @@ -63,6 +63,7 @@ #include "mipointer.h" #include "extinit.h" #include "loaderProcs.h" +#include "systemd-logind.h" #include "exevents.h" /* AddInputDevice */ #include "exglobals.h" @@ -80,6 +81,12 @@ #include <stdarg.h> #include <stdint.h> /* for int64_t */ +#include <sys/types.h> +#include <sys/stat.h> +#include <unistd.h> +#ifdef HAVE_SYS_MKDEV_H +#include <sys/mkdev.h> /* for major() & minor() on Solaris */ +#endif #include "mi.h" @@ -103,11 +110,14 @@ static int xf86InputDevicePostInit(DeviceIntPtr dev); +static InputInfoPtr *new_input_devices; +static int new_input_devices_count; + /** * Eval config and modify DeviceVelocityRec accordingly */ static void -ProcessVelocityConfiguration(DeviceIntPtr pDev, char *devname, pointer list, +ProcessVelocityConfiguration(DeviceIntPtr pDev, const char *devname, void *list, DeviceVelocityPtr s) { int tempi; @@ -305,7 +315,7 @@ ApplyTransformationMatrix(DeviceIntPtr dev) /*********************************************************************** * * xf86ProcessCommonOptions -- - * + * * Process global options. * *********************************************************************** @@ -661,7 +671,7 @@ MergeInputClasses(const InputInfoPtr idev, const InputAttributes * attrs) /* Collect class options and driver settings */ classopts = xf86optionListDup(cl->option_lst); if (cl->driver) { - free(idev->driver); + free((void *) idev->driver); idev->driver = xstrdup(cl->driver); if (!idev->driver) { xf86Msg(X_ERROR, "Failed to allocate memory while merging " @@ -760,6 +770,9 @@ xf86DeleteInput(InputInfoPtr pInp, int flags) FreeInputAttributes(pInp->attrs); + if (pInp->flags & XI86_SERVER_FD) + systemd_logind_release_fd(pInp->major, pInp->minor, pInp->fd); + /* Remove the entry from the list. */ if (pInp == xf86InputDevs) xf86InputDevs = pInp->next; @@ -773,8 +786,8 @@ xf86DeleteInput(InputInfoPtr pInp, int flags) /* Else the entry wasn't in the xf86InputDevs list (ignore this). */ } - free(pInp->driver); - free(pInp->name); + free((void *) pInp->driver); + free((void *) pInp->name); xf86optionListFree(pInp->options); free(pInp); } @@ -794,6 +807,18 @@ xf86InputDevicePostInit(DeviceIntPtr dev) return Success; } +static void +xf86stat(const char *path, int *maj, int *min) +{ + struct stat st; + + if (stat(path, &st) == -1) + return; + + *maj = major(st.st_rdev); + *min = minor(st.st_rdev); +} + /** * Create a new input device, activate and enable it. * @@ -816,7 +841,9 @@ xf86NewInputDevice(InputInfoPtr pInfo, DeviceIntPtr *pdev, BOOL enable) { InputDriverPtr drv = NULL; DeviceIntPtr dev = NULL; + Bool paused; int rval; + const char *path; /* Memory leak for every attached device if we don't * test if the module is already loaded first */ @@ -830,6 +857,29 @@ xf86NewInputDevice(InputInfoPtr pInfo, DeviceIntPtr *pdev, BOOL enable) goto unwind; } + path = xf86CheckStrOption(pInfo->options, "Device", NULL); + if (path && pInfo->major == 0 && pInfo->minor == 0) + xf86stat(path, &pInfo->major, &pInfo->minor); + + if (path && (drv->capabilities & XI86_DRV_CAP_SERVER_FD)){ + int fd = systemd_logind_take_fd(pInfo->major, pInfo->minor, + path, &paused); + if (fd != -1) { + if (paused) { + /* Put on new_input_devices list for delayed probe */ + new_input_devices = xnfrealloc(new_input_devices, + sizeof(pInfo) * (new_input_devices_count + 1)); + new_input_devices[new_input_devices_count] = pInfo; + new_input_devices_count++; + systemd_logind_release_fd(pInfo->major, pInfo->minor, fd); + return BadMatch; + } + pInfo->fd = fd; + pInfo->flags |= XI86_SERVER_FD; + pInfo->options = xf86ReplaceIntOption(pInfo->options, "fd", fd); + } + } + xf86Msg(X_INFO, "Using input driver '%s' for '%s'\n", drv->driverName, pInfo->name); @@ -949,6 +999,12 @@ NewInputDeviceRequest(InputOption *options, InputAttributes * attrs, goto unwind; } } + + if (strcmp(key, "major") == 0) + pInfo->major = atoi(value); + + if (strcmp(key, "minor") == 0) + pInfo->minor = atoi(value); } nt_list_for_each_entry(option, options, list.next) { @@ -1021,7 +1077,7 @@ DeleteInputDeviceRequest(DeviceIntPtr pDev) OsReleaseSignals(); } -/* +/* * convenient functions to post events */ @@ -1067,7 +1123,7 @@ xf86CheckMotionEvent4DGA(DeviceIntPtr device, int is_absolute, #if XFreeXDGA ScreenPtr scr = NULL; - int idx, i; + int idx = 0, i; /* The evdev driver may not always send all axes across. */ if (valuator_mask_isset(mask, 0) || valuator_mask_isset(mask, 1)) { @@ -1345,7 +1401,7 @@ xf86FirstLocalDevice(void) return xf86InputDevs; } -/* +/* * Cx - raw data from touch screen * to_max - scaled highest dimension * (remember, this is of rows - 1 because of 0 origin) @@ -1419,7 +1475,7 @@ xf86InitValuatorDefaults(DeviceIntPtr dev, int axnum) * Device will be moved to the off_devices list, but it will still be there * until you really clean up after it. * Notifies the client about an inactive device. - * + * * @param panic True if device is unrecoverable and needs to be removed. */ void @@ -1437,7 +1493,7 @@ xf86DisableDevice(DeviceIntPtr dev, Bool panic) /** * Reactivate a device. Call this function from the driver if you just found * out that the read error wasn't quite that bad after all. - * Device will be re-activated, and an event sent to the client. + * Device will be re-activated, and an event sent to the client. */ void xf86EnableDevice(DeviceIntPtr dev) @@ -1469,4 +1525,32 @@ xf86PostTouchEvent(DeviceIntPtr dev, uint32_t touchid, uint16_t type, QueueTouchEvents(dev, type, touchid, flags, mask); } +void +xf86InputEnableVTProbe(void) +{ + int i, is_auto = 0; + InputOption *option = NULL; + DeviceIntPtr pdev; + + for (i = 0; i < new_input_devices_count; i++) { + InputInfoPtr pInfo = new_input_devices[i]; + + is_auto = 0; + nt_list_for_each_entry(option, pInfo->options, list.next) { + const char *key = input_option_get_key(option); + const char *value = input_option_get_value(option); + + if (strcmp(key, "_source") == 0 && + (strcmp(value, "server/hal") == 0 || + strcmp(value, "server/udev") == 0 || + strcmp(value, "server/wscons") == 0)) + is_auto = 1; + } + xf86NewInputDevice(pInfo, &pdev, + (!is_auto || + (is_auto && xf86Info.autoEnableDevices))); + } + new_input_devices_count = 0; +} + /* end of xf86Xinput.c */ diff --git a/xserver/hw/xfree86/common/xf86Xinput.h b/xserver/hw/xfree86/common/xf86Xinput.h index 35c38a554..ef9a117cb 100644 --- a/xserver/hw/xfree86/common/xf86Xinput.h +++ b/xserver/hw/xfree86/common/xf86Xinput.h @@ -64,6 +64,10 @@ /* 0x08 is reserved for legacy XI86_SEND_DRAG_EVENTS, do not use for now */ /* server-internal only */ #define XI86_DEVICE_DISABLED 0x10 /* device was disabled before vt switch */ +#define XI86_SERVER_FD 0x20 /* fd is managed by xserver */ + +/* Input device driver capabilities */ +#define XI86_DRV_CAP_SERVER_FD 0x01 /* This holds the input driver entry and module information. */ typedef struct _InputDriverRec { @@ -74,13 +78,14 @@ typedef struct _InputDriverRec { struct _InputInfoRec * pInfo, int flags); void (*UnInit) (struct _InputDriverRec * drv, struct _InputInfoRec * pInfo, int flags); - pointer module; + void *module; const char **default_options; + int capabilities; } InputDriverRec, *InputDriverPtr; /* This is to input devices what the ScrnInfoRec is to screens. */ -typedef struct _InputInfoRec { +struct _InputInfoRec { struct _InputInfoRec *next; char *name; char *driver; @@ -96,14 +101,16 @@ typedef struct _InputInfoRec { int *valuators, int first_valuator, int num_valuators); int fd; + int major; + int minor; DeviceIntPtr dev; - pointer private; + void *private; const char *type_name; InputDriverPtr drv; - pointer module; + void *module; XF86OptionPtr options; InputAttributes *attrs; -} *InputInfoPtr; +}; /* xf86Globals.c */ extern InputInfoPtr xf86InputDevs; @@ -172,13 +179,14 @@ extern _X_EXPORT void xf86AddEnabledDevice(InputInfoPtr pInfo); extern _X_EXPORT void xf86RemoveEnabledDevice(InputInfoPtr pInfo); extern _X_EXPORT void xf86DisableDevice(DeviceIntPtr dev, Bool panic); extern _X_EXPORT void xf86EnableDevice(DeviceIntPtr dev); +extern _X_EXPORT void xf86InputEnableVTProbe(void); /* not exported */ int xf86NewInputDevice(InputInfoPtr pInfo, DeviceIntPtr *pdev, BOOL is_auto); InputInfoPtr xf86AllocateInput(void); /* xf86Helper.c */ -extern _X_EXPORT void xf86AddInputDriver(InputDriverPtr driver, pointer module, +extern _X_EXPORT void xf86AddInputDriver(InputDriverPtr driver, void *module, int flags); extern _X_EXPORT void xf86DeleteInputDriver(int drvIndex); extern _X_EXPORT InputDriverPtr xf86LookupInputDriver(const char *name); diff --git a/xserver/hw/xfree86/common/xf86cmap.c b/xserver/hw/xfree86/common/xf86cmap.c index 85f35f8db..3f9c88035 100644 --- a/xserver/hw/xfree86/common/xf86cmap.c +++ b/xserver/hw/xfree86/common/xf86cmap.c @@ -224,7 +224,7 @@ xf86HandleColormaps(ScreenPtr pScreen, ComputeGamma(pScreenPriv); /* get the default map */ - dixLookupResourceByType((pointer *) &pDefMap, pScreen->defColormap, + dixLookupResourceByType((void **) &pDefMap, pScreen->defColormap, RT_COLORMAP, serverClient, DixInstallAccess); if (!CMapAllocateColormapPrivate(pDefMap)) { diff --git a/xserver/hw/xfree86/common/xf86fbman.c b/xserver/hw/xfree86/common/xf86fbman.c index 4da6af2b6..db715bd2f 100644 --- a/xserver/hw/xfree86/common/xf86fbman.c +++ b/xserver/hw/xfree86/common/xf86fbman.c @@ -74,7 +74,7 @@ xf86FBManagerRunning(ScreenPtr pScreen) Bool xf86RegisterFreeBoxCallback(ScreenPtr pScreen, FreeBoxCallbackProcPtr FreeBoxCallback, - pointer devPriv) + void *devPriv) { FBManagerFuncsPtr funcs; @@ -93,7 +93,7 @@ xf86AllocateOffscreenArea(ScreenPtr pScreen, int w, int h, int gran, MoveAreaCallbackProcPtr moveCB, - RemoveAreaCallbackProcPtr removeCB, pointer privData) + RemoveAreaCallbackProcPtr removeCB, void *privData) { FBManagerFuncsPtr funcs; @@ -113,7 +113,7 @@ xf86AllocateOffscreenLinear(ScreenPtr pScreen, int gran, MoveLinearCallbackProcPtr moveCB, RemoveLinearCallbackProcPtr removeCB, - pointer privData) + void *privData) { FBManagerFuncsPtr funcs; @@ -309,7 +309,7 @@ SendCallFreeBoxCallbacks(FBManagerPtr offman) static Bool localRegisterFreeBoxCallback(ScreenPtr pScreen, FreeBoxCallbackProcPtr FreeBoxCallback, - pointer devPriv) + void *devPriv) { FBManagerPtr offman; FreeBoxCallbackProcPtr *newCallbacks; @@ -346,7 +346,7 @@ AllocateArea(FBManagerPtr offman, int w, int h, int granularity, MoveAreaCallbackProcPtr moveCB, - RemoveAreaCallbackProcPtr removeCB, pointer privData) + RemoveAreaCallbackProcPtr removeCB, void *privData) { ScreenPtr pScreen = offman->pScreen; FBLinkPtr link = NULL; @@ -436,7 +436,7 @@ localAllocateOffscreenArea(ScreenPtr pScreen, int w, int h, int gran, MoveAreaCallbackProcPtr moveCB, - RemoveAreaCallbackProcPtr removeCB, pointer privData) + RemoveAreaCallbackProcPtr removeCB, void *privData) { FBManagerPtr offman; FBAreaPtr area = NULL; @@ -824,7 +824,7 @@ DumpDebug(FBLinearLinkPtr pLink) } static FBLinearPtr -AllocateLinear(FBManagerPtr offman, int size, int granularity, pointer privData) +AllocateLinear(FBManagerPtr offman, int size, int granularity, void *privData) { ScreenPtr pScreen = offman->pScreen; FBLinearLinkPtr linear = NULL; @@ -903,7 +903,7 @@ localAllocateOffscreenLinear(ScreenPtr pScreen, int gran, MoveLinearCallbackProcPtr moveCB, RemoveLinearCallbackProcPtr removeCB, - pointer privData) + void *privData) { FBManagerPtr offman; FBLinearLinkPtr link; @@ -1122,11 +1122,8 @@ localQueryLargestOffscreenLinear(ScreenPtr pScreen, if (localQueryLargestOffscreenArea(pScreen, &w, &h, gran, FAVOR_WIDTH_THEN_AREA, priority)) { - FBManagerPtr offman; BoxPtr extents; - offman = (FBManagerPtr) dixLookupPrivate(&pScreen->devPrivates, - xf86FBScreenKey); extents = RegionExtents(offman->InitialBoxes); if ((extents->x2 - extents->x1) == w) *size = w * h; @@ -1394,7 +1391,7 @@ xf86AllocateLinearOffscreenArea(ScreenPtr pScreen, int gran, MoveAreaCallbackProcPtr moveCB, RemoveAreaCallbackProcPtr removeCB, - pointer privData) + void *privData) { FBManagerFuncsPtr funcs; FBManagerPtr offman; diff --git a/xserver/hw/xfree86/common/xf86fbman.h b/xserver/hw/xfree86/common/xf86fbman.h index 99bf9917b..092c2e2dd 100644 --- a/xserver/hw/xfree86/common/xf86fbman.h +++ b/xserver/hw/xfree86/common/xf86fbman.h @@ -60,7 +60,7 @@ typedef struct _FBLinear { DevUnion devPrivate; } FBLinear, *FBLinearPtr; -typedef void (*FreeBoxCallbackProcPtr) (ScreenPtr, RegionPtr, pointer); +typedef void (*FreeBoxCallbackProcPtr) (ScreenPtr, RegionPtr, void *); typedef void (*MoveAreaCallbackProcPtr) (FBAreaPtr, FBAreaPtr); typedef void (*RemoveAreaCallbackProcPtr) (FBAreaPtr); @@ -73,7 +73,7 @@ typedef struct { int granularity, MoveAreaCallbackProcPtr moveCB, RemoveAreaCallbackProcPtr removeCB, - pointer privData); + void *privData); void (*FreeOffscreenArea) (FBAreaPtr area); Bool (*ResizeOffscreenArea) (FBAreaPtr area, int w, int h); Bool (*QueryLargestOffscreenArea) (ScreenPtr pScreen, @@ -82,14 +82,14 @@ typedef struct { int preferences, int priority); Bool (*RegisterFreeBoxCallback) (ScreenPtr pScreen, FreeBoxCallbackProcPtr FreeBoxCallback, - pointer devPriv); + void *devPriv); /* linear functions */ FBLinearPtr(*AllocateOffscreenLinear) (ScreenPtr pScreen, int size, int granularity, MoveLinearCallbackProcPtr moveCB, RemoveLinearCallbackProcPtr - removeCB, pointer privData); + removeCB, void *privData); void (*FreeOffscreenLinear) (FBLinearPtr area); Bool (*ResizeOffscreenLinear) (FBLinearPtr area, int size); Bool (*QueryLargestOffscreenLinear) (ScreenPtr pScreen, @@ -121,7 +121,7 @@ xf86AllocateOffscreenArea(ScreenPtr pScreen, int w, int h, int granularity, MoveAreaCallbackProcPtr moveCB, - RemoveAreaCallbackProcPtr removeCB, pointer privData); + RemoveAreaCallbackProcPtr removeCB, void *privData); extern _X_EXPORT FBAreaPtr xf86AllocateLinearOffscreenArea(ScreenPtr pScreen, @@ -129,7 +129,7 @@ xf86AllocateLinearOffscreenArea(ScreenPtr pScreen, int granularity, MoveAreaCallbackProcPtr moveCB, RemoveAreaCallbackProcPtr removeCB, - pointer privData); + void *privData); extern _X_EXPORT FBLinearPtr xf86AllocateOffscreenLinear(ScreenPtr pScreen, @@ -137,7 +137,7 @@ xf86AllocateOffscreenLinear(ScreenPtr pScreen, int granularity, MoveLinearCallbackProcPtr moveCB, RemoveLinearCallbackProcPtr removeCB, - pointer privData); + void *privData); extern _X_EXPORT void xf86FreeOffscreenArea(FBAreaPtr area); extern _X_EXPORT void xf86FreeOffscreenLinear(FBLinearPtr area); @@ -152,7 +152,7 @@ extern _X_EXPORT Bool xf86RegisterFreeBoxCallback(ScreenPtr pScreen, FreeBoxCallbackProcPtr FreeBoxCallback, - pointer devPriv); + void *devPriv); extern _X_EXPORT Bool xf86PurgeUnlockedOffscreenAreas(ScreenPtr pScreen); diff --git a/xserver/hw/xfree86/common/xf86pciBus.c b/xserver/hw/xfree86/common/xf86pciBus.c index 258988a84..c06b04033 100644 --- a/xserver/hw/xfree86/common/xf86pciBus.c +++ b/xserver/hw/xfree86/common/xf86pciBus.c @@ -575,7 +575,7 @@ xf86PciProbeDev(DriverPtr drvp) } void -xf86PciIsolateDevice(char *argument) +xf86PciIsolateDevice(const char *argument) { int bus, device, func; @@ -1013,7 +1013,7 @@ xf86MatchPciInstances(const char *driverName, int vendorID, static void xf86ConfigPciEntityInactive(EntityInfoPtr pEnt, PciChipsets * p_chip, EntityProc init, EntityProc enter, - EntityProc leave, pointer private) + EntityProc leave, void *private) { ScrnInfoPtr pScrn; @@ -1027,7 +1027,7 @@ xf86ConfigPciEntityInactive(EntityInfoPtr pEnt, PciChipsets * p_chip, ScrnInfoPtr xf86ConfigPciEntity(ScrnInfoPtr pScrn, int scrnFlag, int entityIndex, PciChipsets * p_chip, void *dummy, EntityProc init, - EntityProc enter, EntityProc leave, pointer private) + EntityProc enter, EntityProc leave, void *private) { EntityInfoPtr pEnt = xf86GetEntityInfo(entityIndex); @@ -1068,7 +1068,7 @@ xf86ConfigPciEntity(ScrnInfoPtr pScrn, int scrnFlag, int entityIndex, Bool xf86ConfigActivePciEntity(ScrnInfoPtr pScrn, int entityIndex, PciChipsets * p_chip, void *dummy, EntityProc init, - EntityProc enter, EntityProc leave, pointer private) + EntityProc enter, EntityProc leave, void *private) { EntityInfoPtr pEnt = xf86GetEntityInfo(entityIndex); @@ -1320,8 +1320,9 @@ xchomp(char *line) * don't export their PCI ID's properly. If distros don't end up using this * feature it can and should be removed because the symbol-based resolution * scheme should be the primary one */ -void -xf86MatchDriverFromFiles(char **matches, uint16_t match_vendor, uint16_t match_chip) +int +xf86MatchDriverFromFiles(uint16_t match_vendor, uint16_t match_chip, + char *matches[], int nmatches) { DIR *idsdir; FILE *fp; @@ -1331,11 +1332,11 @@ xf86MatchDriverFromFiles(char **matches, uint16_t match_vendor, uint16_t match_c ssize_t read; char path_name[256], vendor_str[5], chip_str[5]; uint16_t vendor, chip; - int i, j; + int i = 0, j; idsdir = opendir(PCI_TXT_IDS_PATH); if (!idsdir) - return; + return 0; xf86Msg(X_INFO, "Scanning %s directory for additional PCI ID's supported by the drivers\n", @@ -1386,10 +1387,6 @@ xf86MatchDriverFromFiles(char **matches, uint16_t match_vendor, uint16_t match_c } } if (vendor == match_vendor && chip == match_chip) { - i = 0; - while (matches[i]) { - i++; - } matches[i] = (char *) malloc(sizeof(char) * strlen(direntry->d_name) - 3); @@ -1412,6 +1409,7 @@ xf86MatchDriverFromFiles(char **matches, uint16_t match_vendor, uint16_t match_c } xf86Msg(X_INFO, "Matched %s from file name %s\n", matches[i], direntry->d_name); + i++; } } else { @@ -1425,6 +1423,7 @@ xf86MatchDriverFromFiles(char **matches, uint16_t match_vendor, uint16_t match_c end: free(line); closedir(idsdir); + return i; } #endif /* __linux__ */ @@ -1435,7 +1434,7 @@ xf86MatchDriverFromFiles(char **matches, uint16_t match_vendor, uint16_t match_c int xf86PciMatchDriver(char *matches[], int nmatches) { - int i; + int i = 0; struct pci_device *info = NULL; struct pci_device_iterator *iter; @@ -1450,13 +1449,10 @@ xf86PciMatchDriver(char *matches[], int nmatches) pci_iterator_destroy(iter); #ifdef __linux__ if (info) - xf86MatchDriverFromFiles(matches, info->vendor_id, info->device_id); + i += xf86MatchDriverFromFiles(info->vendor_id, info->device_id, + matches, nmatches); #endif - for (i = 0; (i < nmatches) && (matches[i]); i++) { - /* find end of matches list */ - } - if ((info != NULL) && (i < nmatches)) { i += xf86VideoPtrToDriverList(info, &(matches[i]), nmatches - i); } @@ -1484,6 +1480,7 @@ xf86PciConfigureNewDev(void *busData, struct pci_device *pVideo, GDevRec * GDev, int *chipset) { char busnum[8]; + char *tmp; pVideo = (struct pci_device *) busData; @@ -1493,8 +1490,9 @@ xf86PciConfigureNewDev(void *busData, struct pci_device *pVideo, snprintf(busnum, sizeof(busnum), "%d@%d", pVideo->bus & 0x00ff, pVideo->bus >> 8); - XNFasprintf(&GDev->busID, "PCI:%s:%d:%d", + XNFasprintf(&tmp, "PCI:%s:%d:%d", busnum, pVideo->dev, pVideo->func); + GDev->busID = tmp; GDev->chipID = pVideo->device_id; GDev->chipRev = pVideo->revision; diff --git a/xserver/hw/xfree86/common/xf86pciBus.h b/xserver/hw/xfree86/common/xf86pciBus.h index 4972c3688..45b5a0fee 100644 --- a/xserver/hw/xfree86/common/xf86pciBus.h +++ b/xserver/hw/xfree86/common/xf86pciBus.h @@ -36,7 +36,7 @@ void xf86PciProbe(void); Bool xf86PciAddMatchingDev(DriverPtr drvp); Bool xf86PciProbeDev(DriverPtr drvp); -void xf86PciIsolateDevice(char *argument); +void xf86PciIsolateDevice(const char *argument); int xf86PciMatchDriver(char *matches[], int nmatches); Bool xf86PciConfigure(void *busData, struct pci_device *pDev); void xf86PciConfigureNewDev(void *busData, struct pci_device *pVideo, @@ -47,8 +47,9 @@ void xf86PciConfigureNewDev(void *busData, struct pci_device *pVideo, ((x)->func == (y)->func) && \ ((x)->dev == (y)->dev)) -void -xf86MatchDriverFromFiles(char **matches, uint16_t match_vendor, uint16_t match_chip); +int +xf86MatchDriverFromFiles(uint16_t match_vendor, uint16_t match_chip, + char *matches[], int nmatches); int xf86VideoPtrToDriverList(struct pci_device *dev, char *returnList[], int returnListMax); diff --git a/xserver/hw/xfree86/common/xf86platformBus.c b/xserver/hw/xfree86/common/xf86platformBus.c index 33b2b7dd8..c5417885d 100644 --- a/xserver/hw/xfree86/common/xf86platformBus.c +++ b/xserver/hw/xfree86/common/xf86platformBus.c @@ -38,6 +38,7 @@ #include <unistd.h> #include "os.h" #include "hotplug.h" +#include "systemd-logind.h" #include "xf86.h" #include "xf86_OSproc.h" @@ -46,16 +47,17 @@ #include "xf86Bus.h" #include "Pci.h" #include "xf86platformBus.h" +#include "xf86Config.h" #include "randrstr.h" int platformSlotClaimed; int xf86_num_platform_devices; -static struct xf86_platform_device *xf86_platform_devices; +struct xf86_platform_device *xf86_platform_devices; int -xf86_add_platform_device(struct OdevAttributes *attribs) +xf86_add_platform_device(struct OdevAttributes *attribs, Bool unowned) { xf86_platform_devices = xnfrealloc(xf86_platform_devices, (sizeof(struct xf86_platform_device) @@ -63,6 +65,8 @@ xf86_add_platform_device(struct OdevAttributes *attribs) xf86_platform_devices[xf86_num_platform_devices].attribs = attribs; xf86_platform_devices[xf86_num_platform_devices].pdev = NULL; + xf86_platform_devices[xf86_num_platform_devices].flags = + unowned ? XF86_PDEV_UNOWNED : 0; xf86_num_platform_devices++; return 0; @@ -89,35 +93,55 @@ xf86_add_platform_device_attrib(int index, int attrib_id, char *attrib_name) return config_odev_add_attribute(device->attribs, attrib_id, attrib_name); } +Bool +xf86_add_platform_device_int_attrib(int index, int attrib_id, int attrib_value) +{ + return config_odev_add_int_attribute(xf86_platform_devices[index].attribs, attrib_id, attrib_value); +} + char * xf86_get_platform_attrib(int index, int attrib_id) { - struct xf86_platform_device *device = &xf86_platform_devices[index]; - struct OdevAttribute *oa; - - xorg_list_for_each_entry(oa, &device->attribs->list, member) { - if (oa->attrib_id == attrib_id) - return oa->attrib_name; - } - return NULL; + return config_odev_get_attribute(xf86_platform_devices[index].attribs, attrib_id); } char * xf86_get_platform_device_attrib(struct xf86_platform_device *device, int attrib_id) { - struct OdevAttribute *oa; + return config_odev_get_attribute(device->attribs, attrib_id); +} - xorg_list_for_each_entry(oa, &device->attribs->list, member) { - if (oa->attrib_id == attrib_id) - return oa->attrib_name; - } - return NULL; +int +xf86_get_platform_int_attrib(int index, int attrib_id, int def) +{ + return config_odev_get_int_attribute(xf86_platform_devices[index].attribs, attrib_id, def); +} + +int +xf86_get_platform_device_int_attrib(struct xf86_platform_device *device, int attrib_id, int def) +{ + return config_odev_get_int_attribute(device->attribs, attrib_id, def); } Bool xf86_get_platform_device_unowned(int index) { - return xf86_platform_devices[index].attribs->unowned; + return (xf86_platform_devices[index].flags & XF86_PDEV_UNOWNED) ? + TRUE : FALSE; +} + +struct xf86_platform_device * +xf86_find_platform_device_by_devnum(int major, int minor) +{ + int i, attr_major, attr_minor; + + for (i = 0; i < xf86_num_platform_devices; i++) { + attr_major = xf86_get_platform_int_attrib(i, ODEV_ATTRIB_MAJOR, 0); + attr_minor = xf86_get_platform_int_attrib(i, ODEV_ATTRIB_MINOR, 0); + if (attr_major == major && attr_minor == minor) + return &xf86_platform_devices[i]; + } + return NULL; } /* @@ -176,6 +200,81 @@ xf86_check_platform_slot(const struct xf86_platform_device *pd) return TRUE; } +static Bool +MatchToken(const char *value, struct xorg_list *patterns, + int (*compare)(const char *, const char *)) +{ + const xf86MatchGroup *group; + + /* If there are no patterns, accept the match */ + if (xorg_list_is_empty(patterns)) + return TRUE; + + /* If there are patterns but no attribute, reject the match */ + if (!value) + return FALSE; + + /* + * Otherwise, iterate the list of patterns ensuring each entry has a + * match. Each list entry is a separate Match line of the same type. + */ + xorg_list_for_each_entry(group, patterns, entry) { + Bool match = FALSE; + char *const *cur; + + for (cur = group->values; *cur; cur++) { + if ((*compare)(value, *cur) == 0) { + match = TRUE; + break; + } + } + + if (!match) + return FALSE; + } + + /* All the entries in the list matched the attribute */ + return TRUE; +} + +static Bool +OutputClassMatches(const XF86ConfOutputClassPtr oclass, int index) +{ + char *driver = xf86_get_platform_attrib(index, ODEV_ATTRIB_DRIVER); + + if (!MatchToken(driver, &oclass->match_driver, strcmp)) + return FALSE; + + return TRUE; +} + +static int +xf86OutputClassDriverList(int index, char *matches[], int nmatches) +{ + XF86ConfOutputClassPtr cl; + int i = 0; + + if (nmatches == 0) + return 0; + + for (cl = xf86configptr->conf_outputclass_lst; cl; cl = cl->list.next) { + if (OutputClassMatches(cl, index)) { + char *path = xf86_get_platform_attrib(index, ODEV_ATTRIB_PATH); + + xf86Msg(X_INFO, "Applying OutputClass \"%s\" to %s\n", + cl->identifier, path); + xf86Msg(X_NONE, "\tloading driver: %s\n", cl->driver); + + matches[i++] = xstrdup(cl->driver); + } + + if (i >= nmatches) + break; + } + + return i; +} + /** * @return The numbers of found devices that match with the current system * drivers. @@ -195,16 +294,15 @@ xf86PlatformMatchDriver(char *matches[], int nmatches) else if (!xf86IsPrimaryPlatform(&xf86_platform_devices[i]) && (pass == 0)) continue; + j += xf86OutputClassDriverList(i, &matches[j], nmatches - j); + info = xf86_platform_devices[i].pdev; #ifdef __linux__ if (info) - xf86MatchDriverFromFiles(matches, info->vendor_id, info->device_id); + j += xf86MatchDriverFromFiles(info->vendor_id, info->device_id, + &matches[j], nmatches - j); #endif - for (j = 0; (j < nmatches) && (matches[j]); j++) { - /* find end of matches list */ - } - if ((info != NULL) && (j < nmatches)) { j += xf86VideoPtrToDriverList(info, &(matches[j]), nmatches - j); } @@ -288,15 +386,15 @@ static Bool doPlatformProbe(struct xf86_platform_device *dev, DriverPtr drvp, GDevPtr gdev, int flags, intptr_t match_data) { Bool foundScreen = FALSE; - int entity; + int entity, fd, major, minor; - if (gdev->screen == 0 && !xf86_check_platform_slot(dev)) + if (gdev && gdev->screen == 0 && !xf86_check_platform_slot(dev)) return FALSE; entity = xf86ClaimPlatformSlot(dev, drvp, 0, - gdev, gdev->active); + gdev, gdev ? gdev->active : 0); - if ((entity == -1) && (gdev->screen > 0)) { + if ((entity == -1) && gdev && (gdev->screen > 0)) { unsigned nent; for (nent = 0; nent < xf86NumEntities; nent++) { @@ -312,6 +410,16 @@ static Bool doPlatformProbe(struct xf86_platform_device *dev, DriverPtr drvp, } } if (entity != -1) { + if ((dev->flags & XF86_PDEV_SERVER_FD) && (!drvp->driverFunc || + !drvp->driverFunc(NULL, SUPPORTS_SERVER_FDS, NULL))) { + fd = xf86_get_platform_device_int_attrib(dev, ODEV_ATTRIB_FD, -1); + major = xf86_get_platform_device_int_attrib(dev, ODEV_ATTRIB_MAJOR, 0); + minor = xf86_get_platform_device_int_attrib(dev, ODEV_ATTRIB_MINOR, 0); + systemd_logind_release_fd(major, minor, fd); + config_odev_add_int_attribute(dev->attribs, ODEV_ATTRIB_FD, -1); + dev->flags &= ~XF86_PDEV_SERVER_FD; + } + if (drvp->platformProbe(drvp, entity, flags, dev, match_data)) foundScreen = TRUE; else @@ -368,10 +476,9 @@ xf86platformProbeDev(DriverPtr drvp) /* for non-seat0 servers assume first device is the master */ if (ServerIsNotSeat0()) break; - if (xf86_platform_devices[j].pdev) { - if (xf86IsPrimaryPlatform(&xf86_platform_devices[j])) - break; - } + + if (xf86IsPrimaryPlatform(&xf86_platform_devices[j])) + break; } } @@ -398,9 +505,8 @@ xf86platformAddDevice(int index) { int i, old_screens, scr_index; DriverPtr drvp = NULL; - int entity; screenLayoutPtr layout; - static char *hotplug_driver_name = "modesetting"; + static const char *hotplug_driver_name = "modesetting"; /* force load the driver for now */ xf86LoadOneModule(hotplug_driver_name, NULL); @@ -418,11 +524,8 @@ xf86platformAddDevice(int index) return -1; old_screens = xf86NumGPUScreens; - entity = xf86ClaimPlatformSlot(&xf86_platform_devices[index], - drvp, 0, 0, 0); - if (!drvp->platformProbe(drvp, entity, PLATFORM_PROBE_GPU_SCREEN, &xf86_platform_devices[index], 0)) { - xf86UnclaimPlatformSlot(&xf86_platform_devices[index], NULL); - } + doPlatformProbe(&xf86_platform_devices[index], drvp, NULL, + PLATFORM_PROBE_GPU_SCREEN, 0); if (old_screens == xf86NumGPUScreens) return -1; i = old_screens; @@ -524,11 +627,28 @@ void xf86platformVTProbe(void) int i; for (i = 0; i < xf86_num_platform_devices; i++) { - if (xf86_platform_devices[i].attribs->unowned == FALSE) + if (!(xf86_platform_devices[i].flags & XF86_PDEV_UNOWNED)) continue; - xf86_platform_devices[i].attribs->unowned = FALSE; + xf86_platform_devices[i].flags &= ~XF86_PDEV_UNOWNED; xf86PlatformReprobeDevice(i, xf86_platform_devices[i].attribs); } } + +void xf86platformPrimary(void) +{ + /* use the first platform device as a fallback */ + if (primaryBus.type == BUS_NONE) { + xf86Msg(X_INFO, "no primary bus or device found\n"); + + if (xf86_num_platform_devices > 0) { + char *syspath = xf86_get_platform_attrib(0, ODEV_ATTRIB_SYSPATH); + + primaryBus.id.plat = &xf86_platform_devices[0]; + primaryBus.type = BUS_PLATFORM; + + xf86Msg(X_NONE, "\tfalling back to %s\n", syspath); + } + } +} #endif diff --git a/xserver/hw/xfree86/common/xf86platformBus.h b/xserver/hw/xfree86/common/xf86platformBus.h index 4e1757854..dec195648 100644 --- a/xserver/hw/xfree86/common/xf86platformBus.h +++ b/xserver/hw/xfree86/common/xf86platformBus.h @@ -30,24 +30,36 @@ struct xf86_platform_device { struct OdevAttributes *attribs; /* for PCI devices */ struct pci_device *pdev; + int flags; }; +/* xf86_platform_device flags */ +#define XF86_PDEV_UNOWNED 0x01 +#define XF86_PDEV_SERVER_FD 0x02 +#define XF86_PDEV_PAUSED 0x04 + #ifdef XSERVER_PLATFORM_BUS int xf86platformProbe(void); int xf86platformProbeDev(DriverPtr drvp); extern int xf86_num_platform_devices; +extern struct xf86_platform_device *xf86_platform_devices; extern char * xf86_get_platform_attrib(int index, int attrib_id); extern int -xf86_add_platform_device(struct OdevAttributes *attribs); +xf86_get_platform_int_attrib(int index, int attrib_id, int def); +extern int +xf86_add_platform_device(struct OdevAttributes *attribs, Bool unowned); extern int xf86_remove_platform_device(int dev_index); extern Bool +xf86_get_platform_device_unowned(int index); +/* Note starting with xserver 1.16 these 2 functions never fail */ +extern Bool xf86_add_platform_device_attrib(int index, int attrib_id, char *attrib_str); extern Bool -xf86_get_platform_device_unowned(int index); +xf86_add_platform_device_int_attrib(int index, int attrib_id, int attrib_value); extern int xf86platformAddDevice(int index); @@ -56,6 +68,8 @@ xf86platformRemoveDevice(int index); extern _X_EXPORT char * xf86_get_platform_device_attrib(struct xf86_platform_device *device, int attrib_id); +extern _X_EXPORT int +xf86_get_platform_device_int_attrib(struct xf86_platform_device *device, int attrib_id, int def); extern _X_EXPORT Bool xf86PlatformDeviceCheckBusID(struct xf86_platform_device *device, const char *busid); @@ -63,6 +77,7 @@ extern _X_EXPORT int xf86PlatformMatchDriver(char *matches[], int nmatches); extern void xf86platformVTProbe(void); +extern void xf86platformPrimary(void); #endif #endif diff --git a/xserver/hw/xfree86/common/xf86sbusBus.h b/xserver/hw/xfree86/common/xf86sbusBus.h index a4d9c6cde..9cfcbc574 100644 --- a/xserver/hw/xfree86/common/xf86sbusBus.h +++ b/xserver/hw/xfree86/common/xf86sbusBus.h @@ -52,16 +52,16 @@ typedef struct sbus_device { int fd; int width, height; sbusPromNode node; - char *descr; - char *device; + const char *descr; + const char *device; } sbusDevice, *sbusDevicePtr; struct sbus_devtable { int devId; int fbType; - char *promName; - char *driverName; - char *descr; + const char *promName; + const char *driverName; + const char *descr; }; extern _X_EXPORT void xf86SbusProbe(void); @@ -76,10 +76,10 @@ extern _X_EXPORT sbusDevicePtr xf86GetSbusInfoForEntity(int entityIndex); extern _X_EXPORT int xf86GetEntityForSbusInfo(sbusDevicePtr psdp); extern _X_EXPORT void xf86SbusUseBuiltinMode(ScrnInfoPtr pScrn, sbusDevicePtr psdp); -extern _X_EXPORT pointer xf86MapSbusMem(sbusDevicePtr psdp, +extern _X_EXPORT void *xf86MapSbusMem(sbusDevicePtr psdp, unsigned long offset, unsigned long size); -extern _X_EXPORT void xf86UnmapSbusMem(sbusDevicePtr psdp, pointer addr, +extern _X_EXPORT void xf86UnmapSbusMem(sbusDevicePtr psdp, void *addr, unsigned long size); extern _X_EXPORT void xf86SbusHideOsHwCursor(sbusDevicePtr psdp); extern _X_EXPORT void xf86SbusSetOsHwCursorCmap(sbusDevicePtr psdp, int bg, diff --git a/xserver/hw/xfree86/common/xf86str.h b/xserver/hw/xfree86/common/xf86str.h index 4c2d147a2..a81e88614 100644 --- a/xserver/hw/xfree86/common/xf86str.h +++ b/xserver/hw/xfree86/common/xf86str.h @@ -145,7 +145,7 @@ typedef enum { typedef struct _DisplayModeRec { struct _DisplayModeRec *prev; struct _DisplayModeRec *next; - char *name; /* identifier for the mode */ + const char *name; /* identifier for the mode */ ModeStatus status; int type; @@ -212,9 +212,9 @@ typedef struct { #define GAMMA_ZERO (GAMMA_MIN / 100.0) typedef struct { - char *id; - char *vendor; - char *model; + const char *id; + const char *vendor; + const char *model; int nHsync; range hsync[MAX_HSYNC]; int nVrefresh; @@ -224,8 +224,8 @@ typedef struct { Gamma gamma; /* Gamma of the monitor */ int widthmm; int heightmm; - pointer options; - pointer DDC; + void *options; + void *DDC; Bool reducedblanking; /* Allow CVT reduced blanking modes? */ int maxPixClock; /* in kHz, like mode->Clock */ } MonRec, *MonPtr; @@ -256,10 +256,11 @@ typedef enum { RR_GET_INFO, RR_SET_CONFIG, RR_GET_MODE_MM, - GET_REQUIRED_HW_INTERFACES = 10 + GET_REQUIRED_HW_INTERFACES = 10, + SUPPORTS_SERVER_FDS = 11, } xorgDriverFuncOp; -typedef Bool xorgDriverFuncProc(ScrnInfoPtr, xorgDriverFuncOp, pointer); +typedef Bool xorgDriverFuncProc(ScrnInfoPtr, xorgDriverFuncOp, void *); /* RR_GET_INFO, RR_SET_CONFIG */ typedef struct { @@ -299,11 +300,11 @@ struct _DriverRec; typedef struct { int driverVersion; - char *driverName; + const char *driverName; void (*Identify) (int flags); Bool (*Probe) (struct _DriverRec * drv, int flags); const OptionInfoRec *(*AvailableOptions) (int chipid, int bustype); - pointer module; + void *module; int refCount; } DriverRec1; @@ -315,11 +316,11 @@ struct xf86_platform_device; typedef struct _DriverRec { int driverVersion; - char *driverName; + const char *driverName; void (*Identify) (int flags); Bool (*Probe) (struct _DriverRec * drv, int flags); const OptionInfoRec *(*AvailableOptions) (int chipid, int bustype); - pointer module; + void *module; int refCount; xorgDriverFuncProc *driverFunc; @@ -386,19 +387,19 @@ typedef enum { } DacSpeedIndex; typedef struct { - char *identifier; - char *vendor; - char *board; - char *chipset; - char *ramdac; - char *driver; + const char *identifier; + const char *vendor; + const char *board; + const char *chipset; + const char *ramdac; + const char *driver; struct _confscreenrec *myScreenSection; Bool claimed; int dacSpeeds[MAXDACSPEEDS]; int numclocks; int clock[MAXCLOCKS]; - char *clockchip; - char *busID; + const char *clockchip; + const char *busID; Bool active; Bool inUse; int videoRam; @@ -408,7 +409,7 @@ typedef struct { unsigned long IOBase; int chipID; int chipRev; - pointer options; + void *options; int irq; int screen; /* For multi-CRTC cards */ } GDevRec, *GDevPtr; @@ -424,24 +425,24 @@ typedef struct { rgb blackColour; rgb whiteColour; int defaultVisual; - char **modes; - pointer options; + const char **modes; + void *options; } DispRec, *DispPtr; typedef struct _confxvportrec { - char *identifier; - pointer options; + const char *identifier; + void *options; } confXvPortRec, *confXvPortPtr; typedef struct _confxvadaptrec { - char *identifier; + const char *identifier; int numports; confXvPortPtr ports; - pointer options; + void *options; } confXvAdaptorRec, *confXvAdaptorPtr; typedef struct _confscreenrec { - char *id; + const char *id; int screennum; int defaultdepth; int defaultbpp; @@ -452,7 +453,7 @@ typedef struct _confscreenrec { DispPtr displays; int numxvadaptors; confXvAdaptorPtr xvadaptors; - pointer options; + void *options; } confScreenRec, *confScreenPtr; typedef enum { @@ -467,29 +468,29 @@ typedef enum { typedef struct _screenlayoutrec { confScreenPtr screen; - char *topname; + const char *topname; confScreenPtr top; - char *bottomname; + const char *bottomname; confScreenPtr bottom; - char *leftname; + const char *leftname; confScreenPtr left; - char *rightname; + const char *rightname; confScreenPtr right; PositionType where; int x; int y; - char *refname; + const char *refname; confScreenPtr refscreen; } screenLayoutRec, *screenLayoutPtr; typedef struct _InputInfoRec InputInfoRec; typedef struct _serverlayoutrec { - char *id; + const char *id; screenLayoutPtr screens; GDevPtr inactives; InputInfoRec **inputs; /* NULL terminated */ - pointer options; + void *options; } serverLayoutRec, *serverLayoutPtr; typedef struct _confdribufferrec { @@ -512,7 +513,7 @@ typedef struct _confdrirec { #define NUM_RESERVED_POINTERS 14 #define NUM_RESERVED_FUNCS 10 -typedef pointer (*funcPointer) (void); +typedef void *(*funcPointer) (void); /* flags for depth 24 pixmap options */ typedef enum { @@ -581,7 +582,7 @@ typedef struct _PciChipsets { } PciChipsets; /* Entity properties */ -typedef void (*EntityProc) (int entityIndex, pointer private); +typedef void (*EntityProc) (int entityIndex, void *private); typedef struct _entityInfo { int index; @@ -671,7 +672,7 @@ typedef void xf86ModeSetProc(ScrnInfoPtr); typedef struct _ScrnInfoRec { int driverVersion; - char *driverName; /* canonical name used in */ + const char *driverName; /* canonical name used in */ /* the config file */ ScreenPtr pScreen; /* Pointer to the ScreenRec */ int scrnIndex; /* Number of this screen */ @@ -730,20 +731,20 @@ typedef struct _ScrnInfoRec { int heightmm; int xDpi; /* width DPI */ int yDpi; /* height DPI */ - char *name; /* Name to prefix messages */ - pointer driverPrivate; /* Driver private area */ + const char *name; /* Name to prefix messages */ + void *driverPrivate; /* Driver private area */ DevUnion *privates; /* Other privates can hook in * here */ DriverPtr drv; /* xf86DriverList[] entry */ - pointer module; /* Pointer to module head */ + void *module; /* Pointer to module head */ int colorKey; int overlayFlags; /* Some of these may be moved out of here into the driver private area */ - char *chipset; /* chipset name */ - char *ramdac; /* ramdac name */ - char *clockchip; /* clock name */ + const char *chipset; /* chipset name */ + const char *ramdac; /* ramdac name */ + const char *clockchip; /* clock name */ Bool progClock; /* clock is programmable */ int numClocks; /* number of clocks */ int clock[MAXCLOCKS]; /* list of clock frequencies */ @@ -754,7 +755,7 @@ typedef struct _ScrnInfoRec { int memClk; /* memory clock */ int textClockFreq; /* clock of text mode */ Bool flipPixels; /* swap default black/white */ - pointer options; + void *options; int chipID; int chipRev; @@ -779,7 +780,7 @@ typedef struct _ScrnInfoRec { int *entityInstanceList; struct pci_device *vgaDev; - pointer reservedPtr[NUM_RESERVED_POINTERS]; + void *reservedPtr[NUM_RESERVED_POINTERS]; /* * Driver entry points. @@ -864,7 +865,7 @@ typedef enum { typedef void (*DPMSSetProcPtr) (ScrnInfoPtr, int, int); /* Input handler proc */ -typedef void (*InputHandlerProc) (int fd, pointer data); +typedef void (*InputHandlerProc) (int fd, void *data); /* These are used by xf86GetClocks */ #define CLK_REG_SAVE -1 diff --git a/xserver/hw/xfree86/common/xf86vmode.c b/xserver/hw/xfree86/common/xf86vmode.c index cad0e6a21..2b07833ad 100644 --- a/xserver/hw/xfree86/common/xf86vmode.c +++ b/xserver/hw/xfree86/common/xf86vmode.c @@ -216,7 +216,7 @@ setEventMask(ScreenPtr pScreen, ClientPtr client, unsigned long mask) } static int -XF86VidModeFreeEvents(pointer value, XID id) +XF86VidModeFreeEvents(void *value, XID id) { XF86VidModeEventPtr pOld = (XF86VidModeEventPtr) value; ScreenPtr pScreen = pOld->screen; @@ -314,7 +314,7 @@ ProcXF86VidModeGetModeLine(ClientPtr client) .type = X_Reply, .sequenceNumber = client->sequence }; - pointer mode; + void *mode; int dotClock; int ver; @@ -413,7 +413,7 @@ ProcXF86VidModeGetAllModeLines(ClientPtr client) { REQUEST(xXF86VidModeGetAllModeLinesReq); xXF86VidModeGetAllModeLinesReply rep; - pointer mode; + void *mode; int modecount, dotClock; int ver; @@ -524,7 +524,7 @@ ProcXF86VidModeAddModeLine(ClientPtr client) xXF86OldVidModeAddModeLineReq *oldstuff = (xXF86OldVidModeAddModeLineReq *) client->requestBuffer; xXF86VidModeAddModeLineReq newstuff; - pointer mode; + void *mode; int len; int dotClock; int ver; @@ -688,7 +688,7 @@ ProcXF86VidModeDeleteModeLine(ClientPtr client) xXF86OldVidModeDeleteModeLineReq *oldstuff = (xXF86OldVidModeDeleteModeLineReq *) client->requestBuffer; xXF86VidModeDeleteModeLineReq newstuff; - pointer mode; + void *mode; int len, dotClock; int ver; @@ -813,7 +813,7 @@ ProcXF86VidModeModModeLine(ClientPtr client) xXF86OldVidModeModModeLineReq *oldstuff = (xXF86OldVidModeModModeLineReq *) client->requestBuffer; xXF86VidModeModModeLineReq newstuff; - pointer mode, modetmp; + void *mode, *modetmp; int len, dotClock; int ver; @@ -942,7 +942,7 @@ ProcXF86VidModeValidateModeLine(ClientPtr client) (xXF86OldVidModeValidateModeLineReq *) client->requestBuffer; xXF86VidModeValidateModeLineReq newstuff; xXF86VidModeValidateModeLineReply rep; - pointer mode, modetmp = NULL; + void *mode, *modetmp = NULL; int len, status, dotClock; int ver; @@ -1080,7 +1080,7 @@ ProcXF86VidModeSwitchToMode(ClientPtr client) xXF86OldVidModeSwitchToModeReq *oldstuff = (xXF86OldVidModeSwitchToModeReq *) client->requestBuffer; xXF86VidModeSwitchToModeReq newstuff; - pointer mode; + void *mode; int len, dotClock; int ver; @@ -1205,7 +1205,7 @@ ProcXF86VidModeGetMonitor(ClientPtr client) }; CARD32 *hsyncdata, *vsyncdata; int i, nHsync, nVrefresh; - pointer monitor; + void *monitor; DEBUG_P("XF86VidModeGetMonitor"); diff --git a/xserver/hw/xfree86/common/xf86xv.c b/xserver/hw/xfree86/common/xf86xv.c index 92d0f6da2..b16cb5df3 100644 --- a/xserver/hw/xfree86/common/xf86xv.c +++ b/xserver/hw/xfree86/common/xf86xv.c @@ -261,7 +261,7 @@ xf86XVScreenInit(ScreenPtr pScreen, XF86VideoAdaptorPtr * adaptors, int num) sure that I appreciate that. */ ScreenPriv = malloc(sizeof(XF86XVScreenRec)); - pxvs->devPriv.ptr = (pointer) ScreenPriv; + pxvs->devPriv.ptr = (void *) ScreenPriv; if (!ScreenPriv) return FALSE; @@ -551,7 +551,7 @@ xf86XVInitAdaptors(ScreenPtr pScreen, XF86VideoAdaptorPtr * infoPtr, int number) adaptorPriv->PutImage = adaptorPtr->PutImage; adaptorPriv->ReputImage = adaptorPtr->ReputImage; /* image/still */ - pa->devPriv.ptr = (pointer) adaptorPriv; + pa->devPriv.ptr = (void *) adaptorPriv; if (!(pPort = calloc(adaptorPtr->nPorts, sizeof(XvPortRec)))) { xf86XVFreeAdaptor(pa); @@ -957,7 +957,7 @@ xf86XVReputImage(XvPortRecPrivatePtr portPriv) } static int -xf86XVReputAllVideo(WindowPtr pWin, pointer data) +xf86XVReputAllVideo(WindowPtr pWin, void *data) { XF86XVWindowPtr WinPriv = GET_XF86XV_WINDOW(pWin); @@ -1922,7 +1922,7 @@ xf86XVFillKeyHelper(ScreenPtr pScreen, CARD32 key, RegionPtr fillboxes) } void -xf86XVFillKeyHelperPort(DrawablePtr pDraw, pointer data, CARD32 key, +xf86XVFillKeyHelperPort(DrawablePtr pDraw, void *data, CARD32 key, RegionPtr clipboxes, Bool fillEverything) { WindowPtr pWin = (WindowPtr) pDraw; diff --git a/xserver/hw/xfree86/common/xf86xv.h b/xserver/hw/xfree86/common/xf86xv.h index 091efcaa9..8986e2e57 100644 --- a/xserver/hw/xfree86/common/xf86xv.h +++ b/xserver/hw/xfree86/common/xf86xv.h @@ -84,47 +84,47 @@ typedef int (*PutVideoFuncPtr) (ScrnInfoPtr pScrn, short vid_x, short vid_y, short drw_x, short drw_y, short vid_w, short vid_h, short drw_w, short drw_h, RegionPtr clipBoxes, - pointer data, DrawablePtr pDraw); + void *data, DrawablePtr pDraw); typedef int (*PutStillFuncPtr) (ScrnInfoPtr pScrn, short vid_x, short vid_y, short drw_x, short drw_y, short vid_w, short vid_h, short drw_w, short drw_h, - RegionPtr clipBoxes, pointer data, + RegionPtr clipBoxes, void *data, DrawablePtr pDraw); typedef int (*GetVideoFuncPtr) (ScrnInfoPtr pScrn, short vid_x, short vid_y, short drw_x, short drw_y, short vid_w, short vid_h, short drw_w, short drw_h, - RegionPtr clipBoxes, pointer data, + RegionPtr clipBoxes, void *data, DrawablePtr pDraw); typedef int (*GetStillFuncPtr) (ScrnInfoPtr pScrn, short vid_x, short vid_y, short drw_x, short drw_y, short vid_w, short vid_h, short drw_w, short drw_h, - RegionPtr clipBoxes, pointer data, + RegionPtr clipBoxes, void *data, DrawablePtr pDraw); -typedef void (*StopVideoFuncPtr) (ScrnInfoPtr pScrn, pointer data, Bool Exit); +typedef void (*StopVideoFuncPtr) (ScrnInfoPtr pScrn, void *data, Bool Exit); typedef int (*SetPortAttributeFuncPtr) (ScrnInfoPtr pScrn, Atom attribute, - INT32 value, pointer data); + INT32 value, void *data); typedef int (*GetPortAttributeFuncPtr) (ScrnInfoPtr pScrn, Atom attribute, - INT32 *value, pointer data); + INT32 *value, void *data); typedef void (*QueryBestSizeFuncPtr) (ScrnInfoPtr pScrn, Bool motion, short vid_w, short vid_h, short drw_w, short drw_h, unsigned int *p_w, - unsigned int *p_h, pointer data); + unsigned int *p_h, void *data); typedef int (*PutImageFuncPtr) (ScrnInfoPtr pScrn, short src_x, short src_y, short drw_x, short drw_y, short src_w, short src_h, short drw_w, short drw_h, int image, unsigned char *buf, short width, short height, Bool Sync, RegionPtr clipBoxes, - pointer data, DrawablePtr pDraw); + void *data, DrawablePtr pDraw); typedef int (*ReputImageFuncPtr) (ScrnInfoPtr pScrn, short src_x, short src_y, short drw_x, short drw_y, short src_w, short src_h, short drw_w, short drw_h, - RegionPtr clipBoxes, pointer data, + RegionPtr clipBoxes, void *data, DrawablePtr pDraw); typedef int (*QueryImageAttributesFuncPtr) (ScrnInfoPtr pScrn, int image, unsigned short *width, unsigned short *height, int *pitches, int *offsets); -typedef void (*ClipNotifyFuncPtr) (ScrnInfoPtr pScrn, pointer data, +typedef void (*ClipNotifyFuncPtr) (ScrnInfoPtr pScrn, void *data, WindowPtr window, int dx, int dy); typedef enum { @@ -137,7 +137,7 @@ typedef enum { typedef struct { int id; - char *name; + const char *name; unsigned short width, height; XvRationalRec rate; } XF86VideoEncodingRec, *XF86VideoEncodingPtr; @@ -151,13 +151,13 @@ typedef struct { int flags; int min_value; int max_value; - char *name; + const char *name; } XF86AttributeRec, *XF86AttributePtr; typedef struct { unsigned int type; int flags; - char *name; + const char *name; int nEncodings; XF86VideoEncodingPtr pEncodings; int nFormats; @@ -238,7 +238,7 @@ xf86XVFillKeyHelperDrawable(DrawablePtr pDraw, CARD32 key, RegionPtr clipboxes); extern _X_EXPORT void -xf86XVFillKeyHelperPort(DrawablePtr pDraw, pointer data, CARD32 key, +xf86XVFillKeyHelperPort(DrawablePtr pDraw, void *data, CARD32 key, RegionPtr clipboxes, Bool fillEverything); extern _X_EXPORT Bool diff --git a/xserver/hw/xfree86/common/xf86xvmc.h b/xserver/hw/xfree86/common/xf86xvmc.h index 2478fe344..aaa4e65f0 100644 --- a/xserver/hw/xfree86/common/xf86xvmc.h +++ b/xserver/hw/xfree86/common/xf86xvmc.h @@ -109,7 +109,7 @@ typedef void (*xf86XvMCDestroySubpictureProcPtr) (ScrnInfoPtr pScrn, XvMCSubpicturePtr subpicture); typedef struct { - char *name; + const char *name; int num_surfaces; XF86MCSurfaceInfoPtr *surfaces; int num_subpictures; diff --git a/xserver/hw/xfree86/ddc/Makefile.in b/xserver/hw/xfree86/ddc/Makefile.in index 602918d06..cc6c3709a 100644 --- a/xserver/hw/xfree86/ddc/Makefile.in +++ b/xserver/hw/xfree86/ddc/Makefile.in @@ -193,6 +193,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -237,6 +239,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -339,7 +345,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -348,6 +357,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -414,6 +424,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/hw/xfree86/ddc/ddc.c b/xserver/hw/xfree86/ddc/ddc.c index 44c1d535c..04d1a09c5 100644 --- a/xserver/hw/xfree86/ddc/ddc.c +++ b/xserver/hw/xfree86/ddc/ddc.c @@ -299,7 +299,7 @@ xf86DoEDID_DDC1(ScrnInfoPtr pScrn, DDC1SetSpeedProc DDC1SetSpeed, /* DDC2 */ static I2CDevPtr -DDC2MakeDevice(I2CBusPtr pBus, int address, char *name) +DDC2MakeDevice(I2CBusPtr pBus, int address, const char *name) { I2CDevPtr dev = NULL; diff --git a/xserver/hw/xfree86/ddc/interpret_edid.c b/xserver/hw/xfree86/ddc/interpret_edid.c index 882a6b201..17a8f81c0 100644 --- a/xserver/hw/xfree86/ddc/interpret_edid.c +++ b/xserver/hw/xfree86/ddc/interpret_edid.c @@ -332,6 +332,97 @@ xf86ForEachVideoBlock(xf86MonPtr mon, handle_video_fn fn, void *data) } } +static Bool +cea_db_offsets(Uchar *cea, int *start, int *end) +{ + /* Data block offset in CEA extension block */ + *start = CEA_EXT_MIN_DATA_OFFSET; + *end = cea[2]; + if (*end == 0) + *end = CEA_EXT_MAX_DATA_OFFSET; + if (*end < CEA_EXT_MIN_DATA_OFFSET || *end > CEA_EXT_MAX_DATA_OFFSET) + return FALSE; + return TRUE; +} + +static int +cea_db_len(Uchar *db) +{ + return db[0] & 0x1f; +} + +static int +cea_db_tag(Uchar *db) +{ + return db[0] >> 5; +} + +typedef void (*handle_cea_db_fn) (Uchar *, void *); + +static void +cea_for_each_db(xf86MonPtr mon, handle_cea_db_fn fn, void *data) +{ + int i; + + if (!mon) + return; + + if (!(mon->flags & EDID_COMPLETE_RAWDATA)) + return; + + if (!mon->no_sections) + return; + + if (!mon->rawData) + return; + + for (i = 0; i < mon->no_sections; i++) { + int start, end, offset; + Uchar *ext; + + ext = mon->rawData + EDID1_LEN * (i + 1); + if (ext[EXT_TAG] != CEA_EXT) + continue; + + if (!cea_db_offsets(ext, &start, &end)) + continue; + + for (offset = start; + offset < end && offset + cea_db_len(&ext[offset]) < end; + offset += cea_db_len(&ext[offset]) + 1) + fn(&ext[offset], data); + } +} + +struct find_hdmi_block_data { + struct cea_data_block *hdmi; +}; + +static void find_hdmi_block(Uchar *db, void *data) +{ + struct find_hdmi_block_data *result = data; + int oui; + + if (cea_db_tag(db) != CEA_VENDOR_BLK) + return; + + if (cea_db_len(db) < 5) + return; + + oui = (db[3] << 16) | (db[2] << 8) | db[1]; + if (oui == IEEE_ID_HDMI) + result->hdmi = (struct cea_data_block *)db; +} + +struct cea_data_block *xf86MonitorFindHDMIBlock(xf86MonPtr mon) +{ + struct find_hdmi_block_data result = { NULL }; + + cea_for_each_db(mon, find_hdmi_block, &result); + + return result.hdmi; +} + xf86MonPtr xf86InterpretEEDID(int scrnIndex, Uchar * block) { @@ -666,49 +757,5 @@ validate_version(int scrnIndex, struct edid_version *r) Bool xf86MonitorIsHDMI(xf86MonPtr mon) { - int i = 0, version, offset; - char *edid = NULL; - - if (!mon) - return FALSE; - - if (!(mon->flags & EDID_COMPLETE_RAWDATA)) - return FALSE; - - if (!mon->no_sections) - return FALSE; - - edid = (char *) mon->rawData; - if (!edid) - return FALSE; - - /* find the CEA extension block */ - for (i = 1; i <= mon->no_sections; i++) - if (edid[i * 128] == 0x02) - break; - if (i == mon->no_sections + 1) - return FALSE; - edid += (i * 128); - - version = edid[1]; - offset = edid[2]; - if (version < 3 || offset < 4) - return FALSE; - - /* walk the cea data blocks */ - for (i = 4; i < offset; i += (edid[i] & 0x1f) + 1) { - char *x = edid + i; - - /* find a vendor specific block */ - if ((x[0] & 0xe0) >> 5 == 0x03) { - int oui = (x[3] << 16) + (x[2] << 8) + x[1]; - - /* find the HDMI vendor OUI */ - if (oui == 0x000c03) - return TRUE; - } - } - - /* guess it's not HDMI after all */ - return FALSE; + return xf86MonitorFindHDMIBlock(mon) != NULL; } diff --git a/xserver/hw/xfree86/ddc/xf86DDC.h b/xserver/hw/xfree86/ddc/xf86DDC.h index bdc7648a9..de8e71831 100644 --- a/xserver/hw/xfree86/ddc/xf86DDC.h +++ b/xserver/hw/xfree86/ddc/xf86DDC.h @@ -98,4 +98,6 @@ typedef void (*handle_video_fn) (struct cea_video_block *, void *); void xf86ForEachVideoBlock(xf86MonPtr, handle_video_fn, void *); +struct cea_data_block *xf86MonitorFindHDMIBlock(xf86MonPtr mon); + #endif diff --git a/xserver/hw/xfree86/dixmods/Makefile.am b/xserver/hw/xfree86/dixmods/Makefile.am index 3c43640ec..dd076e421 100644 --- a/xserver/hw/xfree86/dixmods/Makefile.am +++ b/xserver/hw/xfree86/dixmods/Makefile.am @@ -19,12 +19,12 @@ AM_CPPFLAGS = @XORG_INCS@ \ libfb_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG) libfb_la_LIBADD = $(top_builddir)/fb/libfb.la -libfb_la_SOURCES = $(top_builddir)/fb/fbcmap_mi.c fbmodule.c +libfb_la_SOURCES = fbmodule.c libfb_la_CFLAGS = $(AM_CFLAGS) libwfb_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG) libwfb_la_LIBADD = $(top_builddir)/fb/libwfb.la -libwfb_la_SOURCES = $(top_builddir)/fb/fbcmap_mi.c fbmodule.c +libwfb_la_SOURCES = fbmodule.c libwfb_la_CFLAGS = $(AM_CFLAGS) -DFB_ACCESS_WRAPPER libglx_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG) diff --git a/xserver/hw/xfree86/dixmods/Makefile.in b/xserver/hw/xfree86/dixmods/Makefile.in index 2af86613e..c19fb9a57 100644 --- a/xserver/hw/xfree86/dixmods/Makefile.in +++ b/xserver/hw/xfree86/dixmods/Makefile.in @@ -117,7 +117,7 @@ libdixmods_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libdixmods_la_CFLAGS) \ $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ libfb_la_DEPENDENCIES = $(top_builddir)/fb/libfb.la -am_libfb_la_OBJECTS = libfb_la-fbcmap_mi.lo libfb_la-fbmodule.lo +am_libfb_la_OBJECTS = libfb_la-fbmodule.lo libfb_la_OBJECTS = $(am_libfb_la_OBJECTS) libfb_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libfb_la_CFLAGS) \ @@ -141,7 +141,7 @@ libshadow_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(libshadow_la_LDFLAGS) $(LDFLAGS) -o $@ libwfb_la_DEPENDENCIES = $(top_builddir)/fb/libwfb.la -am_libwfb_la_OBJECTS = libwfb_la-fbcmap_mi.lo libwfb_la-fbmodule.lo +am_libwfb_la_OBJECTS = libwfb_la-fbmodule.lo libwfb_la_OBJECTS = $(am_libwfb_la_OBJECTS) libwfb_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libwfb_la_CFLAGS) \ @@ -235,6 +235,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -279,6 +281,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -381,7 +387,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -390,6 +399,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -456,6 +466,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ @@ -544,11 +558,11 @@ AM_CPPFLAGS = @XORG_INCS@ \ libfb_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG) libfb_la_LIBADD = $(top_builddir)/fb/libfb.la -libfb_la_SOURCES = $(top_builddir)/fb/fbcmap_mi.c fbmodule.c +libfb_la_SOURCES = fbmodule.c libfb_la_CFLAGS = $(AM_CFLAGS) libwfb_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG) libwfb_la_LIBADD = $(top_builddir)/fb/libwfb.la -libwfb_la_SOURCES = $(top_builddir)/fb/fbcmap_mi.c fbmodule.c +libwfb_la_SOURCES = fbmodule.c libwfb_la_CFLAGS = $(AM_CFLAGS) -DFB_ACCESS_WRAPPER libglx_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG) libglx_la_LIBADD = $(top_builddir)/glx/libglx.la $(GLX_SYS_LIBS) \ @@ -695,9 +709,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glxmodule.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdixmods_la-miinitext.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfb_la-fbcmap_mi.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfb_la-fbmodule.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwfb_la-fbcmap_mi.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwfb_la-fbmodule.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shmodule.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xkbKillSrv.Plo@am__quote@ @@ -732,13 +744,6 @@ libdixmods_la-miinitext.lo: $(top_srcdir)/mi/miinitext.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdixmods_la_CFLAGS) $(CFLAGS) -c -o libdixmods_la-miinitext.lo `test -f '$(top_srcdir)/mi/miinitext.c' || echo '$(srcdir)/'`$(top_srcdir)/mi/miinitext.c -libfb_la-fbcmap_mi.lo: $(top_builddir)/fb/fbcmap_mi.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfb_la_CFLAGS) $(CFLAGS) -MT libfb_la-fbcmap_mi.lo -MD -MP -MF $(DEPDIR)/libfb_la-fbcmap_mi.Tpo -c -o libfb_la-fbcmap_mi.lo `test -f '$(top_builddir)/fb/fbcmap_mi.c' || echo '$(srcdir)/'`$(top_builddir)/fb/fbcmap_mi.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libfb_la-fbcmap_mi.Tpo $(DEPDIR)/libfb_la-fbcmap_mi.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_builddir)/fb/fbcmap_mi.c' object='libfb_la-fbcmap_mi.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfb_la_CFLAGS) $(CFLAGS) -c -o libfb_la-fbcmap_mi.lo `test -f '$(top_builddir)/fb/fbcmap_mi.c' || echo '$(srcdir)/'`$(top_builddir)/fb/fbcmap_mi.c - libfb_la-fbmodule.lo: fbmodule.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfb_la_CFLAGS) $(CFLAGS) -MT libfb_la-fbmodule.lo -MD -MP -MF $(DEPDIR)/libfb_la-fbmodule.Tpo -c -o libfb_la-fbmodule.lo `test -f 'fbmodule.c' || echo '$(srcdir)/'`fbmodule.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libfb_la-fbmodule.Tpo $(DEPDIR)/libfb_la-fbmodule.Plo @@ -746,13 +751,6 @@ libfb_la-fbmodule.lo: fbmodule.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfb_la_CFLAGS) $(CFLAGS) -c -o libfb_la-fbmodule.lo `test -f 'fbmodule.c' || echo '$(srcdir)/'`fbmodule.c -libwfb_la-fbcmap_mi.lo: $(top_builddir)/fb/fbcmap_mi.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwfb_la_CFLAGS) $(CFLAGS) -MT libwfb_la-fbcmap_mi.lo -MD -MP -MF $(DEPDIR)/libwfb_la-fbcmap_mi.Tpo -c -o libwfb_la-fbcmap_mi.lo `test -f '$(top_builddir)/fb/fbcmap_mi.c' || echo '$(srcdir)/'`$(top_builddir)/fb/fbcmap_mi.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libwfb_la-fbcmap_mi.Tpo $(DEPDIR)/libwfb_la-fbcmap_mi.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_builddir)/fb/fbcmap_mi.c' object='libwfb_la-fbcmap_mi.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwfb_la_CFLAGS) $(CFLAGS) -c -o libwfb_la-fbcmap_mi.lo `test -f '$(top_builddir)/fb/fbcmap_mi.c' || echo '$(srcdir)/'`$(top_builddir)/fb/fbcmap_mi.c - libwfb_la-fbmodule.lo: fbmodule.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwfb_la_CFLAGS) $(CFLAGS) -MT libwfb_la-fbmodule.lo -MD -MP -MF $(DEPDIR)/libwfb_la-fbmodule.Tpo -c -o libwfb_la-fbmodule.lo `test -f 'fbmodule.c' || echo '$(srcdir)/'`fbmodule.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libwfb_la-fbmodule.Tpo $(DEPDIR)/libwfb_la-fbmodule.Plo diff --git a/xserver/hw/xfree86/dixmods/glxmodule.c b/xserver/hw/xfree86/dixmods/glxmodule.c index 133a2a65d..d53c6652d 100644 --- a/xserver/hw/xfree86/dixmods/glxmodule.c +++ b/xserver/hw/xfree86/dixmods/glxmodule.c @@ -47,10 +47,8 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. static MODULESETUPPROTO(glxSetup); -static const ExtensionModule GLXExt = { - GlxExtensionInit, - "GLX", - &noGlxExtension +static const ExtensionModule GLXExt[] = { + { GlxExtensionInit, "GLX", &noGlxExtension }, }; static XF86ModuleVersionInfo VersRec = { @@ -68,8 +66,8 @@ static XF86ModuleVersionInfo VersRec = { _X_EXPORT XF86ModuleData glxModuleData = { &VersRec, glxSetup, NULL }; -static pointer -glxSetup(pointer module, pointer opts, int *errmaj, int *errmin) +static void * +glxSetup(void *module, void *opts, int *errmaj, int *errmin) { static Bool setupDone = FALSE; __GLXprovider *provider; @@ -90,7 +88,7 @@ glxSetup(pointer module, pointer opts, int *errmaj, int *errmin) GlxPushProvider(provider); } - LoadExtension(&GLXExt, FALSE); + LoadExtensionList(GLXExt, ARRAY_SIZE(GLXExt), FALSE); return module; } diff --git a/xserver/hw/xfree86/doc/Makefile.in b/xserver/hw/xfree86/doc/Makefile.in index 2bfcce65d..257d825a9 100644 --- a/xserver/hw/xfree86/doc/Makefile.in +++ b/xserver/hw/xfree86/doc/Makefile.in @@ -151,6 +151,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -195,6 +197,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -297,7 +303,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -306,6 +315,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -372,6 +382,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/hw/xfree86/doc/ddxDesign.xml b/xserver/hw/xfree86/doc/ddxDesign.xml index 7c2c20ff3..d1fd9af7b 100644 --- a/xserver/hw/xfree86/doc/ddxDesign.xml +++ b/xserver/hw/xfree86/doc/ddxDesign.xml @@ -5920,10 +5920,10 @@ These may be moved out of the loader at some point. <blockquote><para> <programlisting> - void LoadExtension(ExtensionModule *ext); + void LoadExtensionList(const ExtensionModule ext[]); </programlisting> <blockquote><para> - This registers the entry points for the extension identified by + This registers the entry points for the extension array identified by <parameter>ext</parameter>. The <structname>ExtensionModule</structname> struct is defined as: diff --git a/xserver/hw/xfree86/dri/Makefile.in b/xserver/hw/xfree86/dri/Makefile.in index 0108dccf2..8d1147b31 100644 --- a/xserver/hw/xfree86/dri/Makefile.in +++ b/xserver/hw/xfree86/dri/Makefile.in @@ -192,6 +192,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -236,6 +238,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -338,7 +344,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -347,6 +356,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -413,6 +423,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/hw/xfree86/dri/dri.c b/xserver/hw/xfree86/dri/dri.c index 6af9fb9c5..5fc658e1b 100644 --- a/xserver/hw/xfree86/dri/dri.c +++ b/xserver/hw/xfree86/dri/dri.c @@ -100,6 +100,11 @@ drmServerInfo DRIDRMServerInfo; * easily changed here. */ #define DRI_MSG_VERBOSITY 1 + +static void +DRIDrvMsg(int scrnIndex, MessageType type, const char *format, ...) + _X_ATTRIBUTE_PRINTF(3,4); + static void DRIDrvMsg(int scrnIndex, MessageType type, const char *format, ...) { @@ -172,19 +177,15 @@ DRIOpenDRMMaster(ScrnInfoPtr pScrn, memset(&tmp, 0, sizeof(tmp)); /* Check the DRM lib version. - * drmGetLibVersion was not supported in version 1.0, so check for - * symbol first to avoid possible crash or hang. */ drmlibmajor = 1; drmlibminor = 0; - if (xf86LoaderCheckSymbol("drmGetLibVersion")) { - drmlibv = drmGetLibVersion(-1); - if (drmlibv != NULL) { - drmlibmajor = drmlibv->version_major; - drmlibminor = drmlibv->version_minor; - drmFreeVersion(drmlibv); - } + drmlibv = drmGetLibVersion(-1); + if (drmlibv != NULL) { + drmlibmajor = drmlibv->version_major; + drmlibminor = drmlibv->version_minor; + drmFreeVersion(drmlibv); } /* Check if the libdrm can handle falling back to loading based on name @@ -399,7 +400,7 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD) } DRIDrvMsg(pScreen->myNum, X_INFO, "[drm] added %d byte SAREA at %p\n", - pDRIPriv->pDriverInfo->SAREASize, pDRIPriv->hSAREA); + (int) pDRIPriv->pDriverInfo->SAREASize, (void *) (uintptr_t) pDRIPriv->hSAREA); /* Backwards compat. */ if (drmMap(pDRIPriv->drmFD, @@ -413,7 +414,7 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD) return FALSE; } DRIDrvMsg(pScreen->myNum, X_INFO, "[drm] mapped SAREA %p to %p\n", - pDRIPriv->hSAREA, pDRIPriv->pSAREA); + (void *) (uintptr_t) pDRIPriv->hSAREA, pDRIPriv->pSAREA); memset(pDRIPriv->pSAREA, 0, pDRIPriv->pDriverInfo->SAREASize); } else { @@ -441,7 +442,7 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD) return FALSE; } DRIDrvMsg(pScreen->myNum, X_INFO, "[drm] framebuffer handle = %p\n", - pDRIPriv->pDriverInfo->hFrameBuffer); + (void *) (uintptr_t) pDRIPriv->pDriverInfo->hFrameBuffer); } else { DRIDrvMsg(pScreen->myNum, X_INFO, @@ -454,14 +455,14 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD) /* Add tags for reserved contexts */ if ((reserved = drmGetReservedContextList(pDRIPriv->drmFD, &reserved_count))) { - int i; + int r; void *tag; - for (i = 0; i < reserved_count; i++) { + for (r = 0; r < reserved_count; r++) { tag = DRICreateContextPrivFromHandle(pScreen, - reserved[i], + reserved[r], DRI_CONTEXT_RESERVED); - drmAddContextTag(pDRIPriv->drmFD, reserved[i], tag); + drmAddContextTag(pDRIPriv->drmFD, reserved[r], tag); } drmFreeReservedContextList(reserved); DRIDrvMsg(pScreen->myNum, X_INFO, @@ -512,7 +513,7 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD) pDRIPriv->myContextPriv = pDRIContextPriv; DRIDrvMsg(pScreen->myNum, X_INFO, - "X context handle = %p\n", pDRIPriv->myContext); + "X context handle = %p\n", (void *) (uintptr_t) pDRIPriv->myContext); /* Now that we have created the X server's context, we can grab the * hardware lock for the X server. @@ -661,9 +662,9 @@ DRICloseScreen(ScreenPtr pScreen) pDRIPriv->wrap.ClipNotify = NULL; } if (pDRIInfo->wrap.AdjustFrame) { - ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); + ScrnInfoPtr scrn = xf86ScreenToScrn(pScreen); - pScrn->AdjustFrame = pDRIPriv->wrap.AdjustFrame; + scrn->AdjustFrame = pDRIPriv->wrap.AdjustFrame; pDRIPriv->wrap.AdjustFrame = NULL; } @@ -706,13 +707,13 @@ DRICloseScreen(ScreenPtr pScreen) if (closeMaster || pDRIPriv->hSAREA != pDRIEntPriv->hLSAREA) { DRIDrvMsg(pScreen->myNum, X_INFO, "[drm] unmapping %d bytes of SAREA %p at %p\n", - pDRIInfo->SAREASize, pDRIPriv->hSAREA, pDRIPriv->pSAREA); + (int) pDRIInfo->SAREASize, (void *) (uintptr_t) pDRIPriv->hSAREA, pDRIPriv->pSAREA); if (drmUnmap(pDRIPriv->pSAREA, pDRIInfo->SAREASize)) { DRIDrvMsg(pScreen->myNum, X_ERROR, "[drm] unable to unmap %d bytes" " of SAREA %p at %p\n", - pDRIInfo->SAREASize, - pDRIPriv->hSAREA, pDRIPriv->pSAREA); + (int) pDRIInfo->SAREASize, + (void *) (uintptr_t) pDRIPriv->hSAREA, pDRIPriv->pSAREA); } } else { @@ -736,6 +737,10 @@ DRICloseScreen(ScreenPtr pScreen) static int dri_drm_debug_print(const char *format, va_list ap) + _X_ATTRIBUTE_PRINTF(1,0); + +static int +dri_drm_debug_print(const char *format, va_list ap) { xf86VDrvMsgVerb(-1, X_NONE, DRM_MSG_VERBOSITY, format, ap); return 0; @@ -1018,7 +1023,7 @@ DRICreateContext(ScreenPtr pScreen, VisualPtr visual, } /* track this in case the client dies before cleanup */ - AddResource(context, DRIContextPrivResType, (pointer) pDRIContextPriv); + AddResource(context, DRIContextPrivResType, (void *) pDRIContextPriv); return TRUE; } @@ -1033,7 +1038,7 @@ DRIDestroyContext(ScreenPtr pScreen, XID context) /* DRIContextPrivDelete is called by the resource manager. */ Bool -DRIContextPrivDelete(pointer pResource, XID id) +DRIContextPrivDelete(void *pResource, XID id) { DRIContextPrivPtr pDRIContextPriv = (DRIContextPrivPtr) pResource; DRIScreenPrivPtr pDRIPriv; @@ -1116,7 +1121,7 @@ DRITransitionTo2d(ScreenPtr pScreen) } static int -DRIDCNTreeTraversal(WindowPtr pWin, pointer data) +DRIDCNTreeTraversal(WindowPtr pWin, void *data) { DRIDrawablePrivPtr pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin); @@ -1155,7 +1160,7 @@ DRIDriverClipNotify(ScreenPtr pScreen) if (pDRIPriv->nrWindows > 0) { pDRIPriv->nrWalked = 0; TraverseTree(pScreen->root, DRIDCNTreeTraversal, - (pointer) pDRIWindows); + (void *) pDRIWindows); } pDRIInfo->ClipNotify(pScreen, pDRIWindows, pDRIPriv->nrWindows); @@ -1250,7 +1255,7 @@ DRICreateDrawable(ScreenPtr pScreen, ClientPtr client, DrawablePtr pDrawable, /* track this in case the client dies */ AddResource(FakeClientID(client->index), DRIDrawablePrivResType, - (pointer) (intptr_t) pDrawable->id); + (void *) (intptr_t) pDrawable->id); if (pDRIDrawablePriv->hwDrawable) { drmUpdateDrawableInfo(pDRIPriv->drmFD, @@ -1303,7 +1308,7 @@ DRIDrawablePrivDestroy(WindowPtr pWin) } static Bool -DRIDestroyDrawableCB(pointer value, XID id, pointer data) +DRIDestroyDrawableCB(void *value, XID id, void *data) { if (value == data) { /* This calls back DRIDrawablePrivDelete which frees private area */ @@ -1321,7 +1326,7 @@ DRIDestroyDrawable(ScreenPtr pScreen, ClientPtr client, DrawablePtr pDrawable) if (pDrawable->type == DRAWABLE_WINDOW) { LookupClientResourceComplex(client, DRIDrawablePrivResType, DRIDestroyDrawableCB, - (pointer) (intptr_t) pDrawable->id); + (void *) (intptr_t) pDrawable->id); } else { /* pixmap (or for GLX 1.3, a PBuffer) */ /* NOT_DONE */ @@ -1332,7 +1337,7 @@ DRIDestroyDrawable(ScreenPtr pScreen, ClientPtr client, DrawablePtr pDrawable) } Bool -DRIDrawablePrivDelete(pointer pResource, XID id) +DRIDrawablePrivDelete(void *pResource, XID id) { WindowPtr pWin; int rc; @@ -1591,7 +1596,7 @@ DRIDestroyInfoRec(DRIInfoPtr DRIInfo) } void -DRIWakeupHandler(pointer wakeupData, int result, pointer pReadmask) +DRIWakeupHandler(void *wakeupData, int result, void *pReadmask) { int i; @@ -1606,7 +1611,7 @@ DRIWakeupHandler(pointer wakeupData, int result, pointer pReadmask) } void -DRIBlockHandler(pointer blockData, OSTimePtr pTimeout, pointer pReadmask) +DRIBlockHandler(void *blockData, OSTimePtr pTimeout, void *pReadmask) { int i; @@ -1622,7 +1627,7 @@ DRIBlockHandler(pointer blockData, OSTimePtr pTimeout, pointer pReadmask) void DRIDoWakeupHandler(ScreenPtr pScreen, - unsigned long result, pointer pReadmask) + unsigned long result, void *pReadmask) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); @@ -1640,7 +1645,7 @@ DRIDoWakeupHandler(ScreenPtr pScreen, void DRIDoBlockHandler(ScreenPtr pScreen, - pointer pTimeout, pointer pReadmask) + void *pTimeout, void *pReadmask) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); @@ -1843,7 +1848,7 @@ DRIWindowExposures(WindowPtr pWin, RegionPtr prgn, RegionPtr bsreg) } static int -DRITreeTraversal(WindowPtr pWin, pointer data) +DRITreeTraversal(WindowPtr pWin, void *data) { DRIDrawablePrivPtr pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin); @@ -1903,7 +1908,7 @@ DRICopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) RegionNull(®); pDRIPriv->nrWalked = 0; - TraverseTree(pWin, DRITreeTraversal, (pointer) (®)); + TraverseTree(pWin, DRITreeTraversal, (void *) (®)); if (RegionNotEmpty(®)) { RegionTranslate(®, ptOldOrg.x - pWin->drawable.x, @@ -2189,9 +2194,9 @@ DRILock(ScreenPtr pScreen, int flags) else if (*pDRIPriv->pLockingContext != pDRIPriv->myContext) { DRIDrvMsg(pScreen->myNum, X_ERROR, "[DRI] Locking deadlock.\n" - "\tAlready locked with context %d,\n" - "\ttrying to lock with context %d.\n", - pDRIPriv->pLockingContext, pDRIPriv->myContext); + "\tAlready locked with context %p,\n" + "\ttrying to lock with context %p.\n", + pDRIPriv->pLockingContext, (void *) (uintptr_t) pDRIPriv->myContext); } (*pDRIPriv->pLockRefCount)++; } @@ -2208,8 +2213,8 @@ DRIUnlock(ScreenPtr pScreen) if (pDRIPriv->myContext != *pDRIPriv->pLockingContext) { DRIDrvMsg(pScreen->myNum, X_ERROR, "[DRI] Unlocking inconsistency:\n" - "\tContext %d trying to unlock lock held by context %d\n", - pDRIPriv->pLockingContext, pDRIPriv->myContext); + "\tContext %p trying to unlock lock held by context %p\n", + pDRIPriv->pLockingContext, (void *) (uintptr_t) pDRIPriv->myContext); } (*pDRIPriv->pLockRefCount)--; } diff --git a/xserver/hw/xfree86/dri/dri.h b/xserver/hw/xfree86/dri/dri.h index 3606100b8..fa43a2cc2 100644 --- a/xserver/hw/xfree86/dri/dri.h +++ b/xserver/hw/xfree86/dri/dri.h @@ -151,7 +151,7 @@ typedef struct { int ddxDriverMajorVersion; int ddxDriverMinorVersion; int ddxDriverPatchVersion; - pointer frameBufferPhysicalAddress; + void *frameBufferPhysicalAddress; long frameBufferSize; long frameBufferStride; long SAREASize; @@ -224,7 +224,7 @@ extern _X_EXPORT Bool DRICreateContext(ScreenPtr pScreen, extern _X_EXPORT Bool DRIDestroyContext(ScreenPtr pScreen, XID context); -extern _X_EXPORT Bool DRIContextPrivDelete(pointer pResource, XID id); +extern _X_EXPORT Bool DRIContextPrivDelete(void *pResource, XID id); extern _X_EXPORT Bool DRICreateDrawable(ScreenPtr pScreen, ClientPtr client, @@ -235,7 +235,7 @@ extern _X_EXPORT Bool DRIDestroyDrawable(ScreenPtr pScreen, ClientPtr client, DrawablePtr pDrawable); -extern _X_EXPORT Bool DRIDrawablePrivDelete(pointer pResource, XID id); +extern _X_EXPORT Bool DRIDrawablePrivDelete(void *pResource, XID id); extern _X_EXPORT Bool DRIGetDrawableInfo(ScreenPtr pScreen, DrawablePtr pDrawable, @@ -265,18 +265,18 @@ extern _X_EXPORT void DRIDestroyInfoRec(DRIInfoPtr DRIInfo); extern _X_EXPORT Bool DRIFinishScreenInit(ScreenPtr pScreen); -extern _X_EXPORT void DRIWakeupHandler(pointer wakeupData, - int result, pointer pReadmask); +extern _X_EXPORT void DRIWakeupHandler(void *wakeupData, + int result, void *pReadmask); -extern _X_EXPORT void DRIBlockHandler(pointer blockData, - OSTimePtr pTimeout, pointer pReadmask); +extern _X_EXPORT void DRIBlockHandler(void *blockData, + OSTimePtr pTimeout, void *pReadmask); extern _X_EXPORT void DRIDoWakeupHandler(ScreenPtr pScreen, unsigned long result, - pointer pReadmask); + void *pReadmask); extern _X_EXPORT void DRIDoBlockHandler(ScreenPtr pScreen, - pointer pTimeout, pointer pReadmask); + void *pTimeout, void *pReadmask); extern _X_EXPORT void DRISwapContext(int drmFD, void *oldctx, void *newctx); diff --git a/xserver/hw/xfree86/dri2/Makefile.in b/xserver/hw/xfree86/dri2/Makefile.in index bf2825487..8be3ac22f 100644 --- a/xserver/hw/xfree86/dri2/Makefile.in +++ b/xserver/hw/xfree86/dri2/Makefile.in @@ -192,6 +192,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -236,6 +238,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -338,7 +344,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -347,6 +356,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -413,6 +423,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/hw/xfree86/dri2/dri2.c b/xserver/hw/xfree86/dri2/dri2.c index 0b047f025..6459f11b1 100644 --- a/xserver/hw/xfree86/dri2/dri2.c +++ b/xserver/hw/xfree86/dri2/dri2.c @@ -130,6 +130,7 @@ typedef struct _DRI2Screen { HandleExposuresProcPtr HandleExposures; ConfigNotifyProcPtr ConfigNotify; + SetWindowPixmapProcPtr SetWindowPixmap; DRI2CreateBuffer2ProcPtr CreateBuffer2; DRI2DestroyBuffer2ProcPtr DestroyBuffer2; DRI2CopyRegion2ProcPtr CopyRegion2; @@ -156,11 +157,9 @@ GetScreenPrime(ScreenPtr master, int prime_id) ds = DRI2GetScreen(slave); if (ds->prime_id == prime_id) - break; + return slave; } - if (!slave) - return master; - return slave; + return master; } static DRI2ScreenPtr @@ -354,7 +353,7 @@ DRI2CreateDrawable(ClientPtr client, DrawablePtr pDraw, XID id, } static int -DRI2DrawableGone(pointer p, XID id) +DRI2DrawableGone(void *p, XID id) { DRI2DrawablePtr pPriv = p; DRI2DrawableRefPtr ref, next; @@ -417,18 +416,14 @@ DRI2DrawableGone(pointer p, XID id) } static DRI2BufferPtr -create_buffer(DrawablePtr pDraw, +create_buffer(DRI2ScreenPtr ds, DrawablePtr pDraw, unsigned int attachment, unsigned int format) { - ScreenPtr primeScreen; - DRI2DrawablePtr pPriv; - DRI2ScreenPtr ds; DRI2BufferPtr buffer; - pPriv = DRI2GetDrawable(pDraw); - primeScreen = GetScreenPrime(pDraw->pScreen, pPriv->prime_id); - ds = DRI2GetScreenPrime(pDraw->pScreen, pPriv->prime_id); if (ds->CreateBuffer2) - buffer = (*ds->CreateBuffer2)(primeScreen, pDraw, attachment, format); + buffer = (*ds->CreateBuffer2)(GetScreenPrime(pDraw->pScreen, + DRI2GetDrawable(pDraw)->prime_id), + pDraw, attachment, format); else buffer = (*ds->CreateBuffer)(pDraw, attachment, format); return buffer; @@ -477,7 +472,7 @@ allocate_or_reuse_buffer(DrawablePtr pDraw, DRI2ScreenPtr ds, if ((old_buf < 0) || attachment == DRI2BufferFrontLeft || !dimensions_match || (pPriv->buffers[old_buf]->format != format)) { - *buffer = create_buffer (pDraw, attachment, format); + *buffer = create_buffer(ds, pDraw, attachment, format); return TRUE; } @@ -540,7 +535,7 @@ do_get_buffers(DrawablePtr pDraw, int *width, int *height, return NULL; } - ds = DRI2GetScreen(pDraw->pScreen); + ds = DRI2GetScreenPrime(pDraw->pScreen, pPriv->prime_id); dimensions_match = (pDraw->width == pPriv->width) && (pDraw->height == pPriv->height); @@ -754,7 +749,7 @@ static inline PixmapPtr GetDrawablePixmap(DrawablePtr drawable) * pixmap */ static int -DRI2InvalidateWalk(WindowPtr pWin, pointer data) +DRI2InvalidateWalk(WindowPtr pWin, void *data) { if (pWin->drawable.pScreen->GetWindowPixmap(pWin) != data) return WT_DONTWALKCHILDREN; @@ -1092,6 +1087,14 @@ DRI2SwapBuffers(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc, return BadDrawable; } + /* According to spec, return expected swapbuffers count SBC after this swap + * will complete. This is ignored unless we return Success, but it must be + * initialized on every path where we return Success or the caller will send + * an uninitialized value off the stack to the client. So let's initialize + * it as early as possible, just to be sure. + */ + *swap_target = pPriv->swap_count + pPriv->swapsPending + 1; + for (i = 0; i < pPriv->bufferCount; i++) { if (pPriv->buffers[i]->attachment == DRI2BufferFrontLeft) pDestBuffer = (DRI2BufferPtr) pPriv->buffers[i]; @@ -1149,17 +1152,13 @@ DRI2SwapBuffers(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc, * we have to account for the current swap count, interval, and the * number of pending swaps. */ - *swap_target = pPriv->last_swap_target + pPriv->swap_interval; + target_msc = pPriv->last_swap_target + pPriv->swap_interval; } - else { - /* glXSwapBuffersMscOML could have a 0 target_msc, honor it */ - *swap_target = target_msc; - } pPriv->swapsPending++; ret = (*ds->ScheduleSwap) (client, pDraw, pDestBuffer, pSrcBuffer, - swap_target, divisor, remainder, func, data); + &target_msc, divisor, remainder, func, data); if (!ret) { pPriv->swapsPending--; /* didn't schedule */ xf86DrvMsg(pScreen->myNum, X_ERROR, @@ -1167,12 +1166,7 @@ DRI2SwapBuffers(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc, return BadDrawable; } - pPriv->last_swap_target = *swap_target; - - /* According to spec, return expected swapbuffers count SBC after this swap - * will complete. - */ - *swap_target = pPriv->swap_count + pPriv->swapsPending; + pPriv->last_swap_target = target_msc; DRI2InvalidateDrawableAll(pDraw); @@ -1385,6 +1379,21 @@ DRI2ConfigNotify(WindowPtr pWin, int x, int y, int w, int h, int bw, return Success; } +static void +DRI2SetWindowPixmap(WindowPtr pWin, PixmapPtr pPix) +{ + DrawablePtr pDraw = (DrawablePtr) pWin; + ScreenPtr pScreen = pDraw->pScreen; + DRI2ScreenPtr ds = DRI2GetScreen(pScreen); + + pScreen->SetWindowPixmap = ds->SetWindowPixmap; + (*pScreen->SetWindowPixmap) (pWin, pPix); + ds->SetWindowPixmap = pScreen->SetWindowPixmap; + pScreen->SetWindowPixmap = DRI2SetWindowPixmap; + + DRI2InvalidateDrawableAll(pDraw); +} + #define MAX_PRIME DRI2DriverPrimeMask static int get_prime_id(void) @@ -1531,6 +1540,9 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info) ds->ConfigNotify = pScreen->ConfigNotify; pScreen->ConfigNotify = DRI2ConfigNotify; + ds->SetWindowPixmap = pScreen->SetWindowPixmap; + pScreen->SetWindowPixmap = DRI2SetWindowPixmap; + xf86DrvMsg(pScreen->myNum, X_INFO, "[DRI2] Setup complete\n"); for (i = 0; i < sizeof(driverTypeNames) / sizeof(driverTypeNames[0]); i++) { if (i < ds->numDrivers && ds->driverNames[i]) { @@ -1555,6 +1567,7 @@ DRI2CloseScreen(ScreenPtr pScreen) DRI2ScreenPtr ds = DRI2GetScreen(pScreen); pScreen->ConfigNotify = ds->ConfigNotify; + pScreen->SetWindowPixmap = ds->SetWindowPixmap; if (ds->prime_id) prime_id_allocate_bitmask &= ~(1 << ds->prime_id); @@ -1563,8 +1576,6 @@ DRI2CloseScreen(ScreenPtr pScreen) dixSetPrivate(&pScreen->devPrivates, dri2ScreenPrivateKey, NULL); } -extern Bool DRI2ModuleSetup(void); - /* Called by InitExtensions() */ Bool DRI2ModuleSetup(void) diff --git a/xserver/hw/xfree86/exa/Makefile.in b/xserver/hw/xfree86/exa/Makefile.in index b27e88e08..ecf602edb 100644 --- a/xserver/hw/xfree86/exa/Makefile.in +++ b/xserver/hw/xfree86/exa/Makefile.in @@ -232,6 +232,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -276,6 +278,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -378,7 +384,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -387,6 +396,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -453,6 +463,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/hw/xfree86/exa/examodule.c b/xserver/hw/xfree86/exa/examodule.c index 4e809ea37..76f780ab6 100644 --- a/xserver/hw/xfree86/exa/examodule.c +++ b/xserver/hw/xfree86/exa/examodule.c @@ -128,7 +128,7 @@ exaDDXDriverInit(ScreenPtr pScreen) if (pExaScr->info->flags & EXA_OFFSCREEN_PIXMAPS) { if (!(pExaScr->info->flags & EXA_HANDLES_PIXMAPS) && pExaScr->info->offScreenBase < pExaScr->info->memorySize) { - char *heuristicName; + const char *heuristicName; heuristicName = xf86GetOptValString(pScreenPriv->options, EXAOPT_MIGRATION_HEURISTIC); diff --git a/xserver/hw/xfree86/exa/man/Makefile.in b/xserver/hw/xfree86/exa/man/Makefile.in index 689947de6..98e2150e7 100644 --- a/xserver/hw/xfree86/exa/man/Makefile.in +++ b/xserver/hw/xfree86/exa/man/Makefile.in @@ -160,6 +160,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -204,6 +206,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -268,6 +274,7 @@ MAN_SUBSTS = @MAN_SUBSTS@ -e 's|__logdir__|$(logdir)|g' -e \ 's|__XKB_DFLT_OPTIONS__|$(XKB_DFLT_OPTIONS)|g' -e \ 's|__bundle_id_prefix__|$(BUNDLE_ID_PREFIX)|g' -e \ 's|__modulepath__|$(DEFAULT_MODULE_PATH)|g' -e \ + 's|__suid_wrapper_dir__|$(SUID_WRAPPER_DIR)|g' -e \ 's|__default_font_path__|$(COMPILEDDEFAULTFONTPATH)|g' -e \ '\|$(COMPILEDDEFAULTFONTPATH)| s|/,|/, |g' MISC_MAN_DIR = @MISC_MAN_DIR@ @@ -322,7 +329,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -331,6 +341,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -397,6 +408,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/hw/xfree86/fbdevhw/Makefile.in b/xserver/hw/xfree86/fbdevhw/Makefile.in index 2892bb07b..37b6b020b 100644 --- a/xserver/hw/xfree86/fbdevhw/Makefile.in +++ b/xserver/hw/xfree86/fbdevhw/Makefile.in @@ -235,6 +235,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -279,6 +281,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -381,7 +387,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -390,6 +399,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -456,6 +466,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/hw/xfree86/fbdevhw/fbdevhw.c b/xserver/hw/xfree86/fbdevhw/fbdevhw.c index cbb40930b..0450822ee 100644 --- a/xserver/hw/xfree86/fbdevhw/fbdevhw.c +++ b/xserver/hw/xfree86/fbdevhw/fbdevhw.c @@ -81,15 +81,13 @@ typedef struct { Bool fbdevHWGetRec(ScrnInfoPtr pScrn) { - fbdevHWPtr fPtr; - if (fbdevHWPrivateIndex < 0) fbdevHWPrivateIndex = xf86AllocateScrnInfoPrivateIndex(); if (FBDEVHWPTR(pScrn) != NULL) return TRUE; - fPtr = FBDEVHWPTRLVAL(pScrn) = xnfcalloc(sizeof(fbdevHWRec), 1); + FBDEVHWPTRLVAL(pScrn) = xnfcalloc(sizeof(fbdevHWRec), 1); return TRUE; } @@ -301,7 +299,7 @@ fbdev_open_pci(struct pci_device *pPci, char **namep) } static int -fbdev_open(int scrnIndex, char *dev, char **namep) +fbdev_open(int scrnIndex, const char *dev, char **namep) { struct fb_fix_screeninfo fix; int fd; @@ -497,7 +495,7 @@ fbdevHWSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode, Bool check) void fbdevHWSetVideoModes(ScrnInfoPtr pScrn) { - char **modename; + const char **modename; DisplayModePtr mode, this, last = pScrn->modes; if (NULL == pScrn->display->modes) diff --git a/xserver/hw/xfree86/fbdevhw/man/Makefile.in b/xserver/hw/xfree86/fbdevhw/man/Makefile.in index 36eba871a..de2f00d52 100644 --- a/xserver/hw/xfree86/fbdevhw/man/Makefile.in +++ b/xserver/hw/xfree86/fbdevhw/man/Makefile.in @@ -160,6 +160,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -204,6 +206,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -268,6 +274,7 @@ MAN_SUBSTS = @MAN_SUBSTS@ -e 's|__logdir__|$(logdir)|g' -e \ 's|__XKB_DFLT_OPTIONS__|$(XKB_DFLT_OPTIONS)|g' -e \ 's|__bundle_id_prefix__|$(BUNDLE_ID_PREFIX)|g' -e \ 's|__modulepath__|$(DEFAULT_MODULE_PATH)|g' -e \ + 's|__suid_wrapper_dir__|$(SUID_WRAPPER_DIR)|g' -e \ 's|__default_font_path__|$(COMPILEDDEFAULTFONTPATH)|g' -e \ '\|$(COMPILEDDEFAULTFONTPATH)| s|/,|/, |g' MISC_MAN_DIR = @MISC_MAN_DIR@ @@ -322,7 +329,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -331,6 +341,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -397,6 +408,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/hw/xfree86/glamor_egl/Makefile.am b/xserver/hw/xfree86/glamor_egl/Makefile.am new file mode 100644 index 000000000..85e1c0c06 --- /dev/null +++ b/xserver/hw/xfree86/glamor_egl/Makefile.am @@ -0,0 +1,43 @@ +# Copyright © 2013 Intel Corporation +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice (including the next +# paragraph) shall be included in all copies or substantial portions of the +# Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. + +module_LTLIBRARIES = libglamoregl.la + +libglamoregl_la_SOURCES = \ + $(top_srcdir)/glamor/glamor_egl.c \ + $(top_srcdir)/glamor/glamor_eglmodule.c \ + $(top_srcdir)/glamor/glamor_xv.c \ + $() + +libglamoregl_la_LDFLAGS = \ + -avoid-version \ + $(GBM_LIBS) \ + $() + +libglamoregl_la_LIBADD = \ + $(top_builddir)/glamor/libglamor.la \ + $() + +AM_CPPFLAGS = $(XORG_INCS) \ + -I$(top_srcdir)/dri3 \ + $() + +AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) $(GLAMOR_CFLAGS) $(GBM_CFLAGS) diff --git a/xserver/hw/xfree86/glamor_egl/Makefile.in b/xserver/hw/xfree86/glamor_egl/Makefile.in new file mode 100644 index 000000000..2cb23328f --- /dev/null +++ b/xserver/hw/xfree86/glamor_egl/Makefile.in @@ -0,0 +1,900 @@ +# Makefile.in generated by automake 1.12.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2012 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# Copyright © 2013 Intel Corporation +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice (including the next +# paragraph) shall be included in all copies or substantial portions of the +# Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. + +VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = hw/xfree86/glamor_egl +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(top_srcdir)/depcomp +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/xorg-tls.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ + $(top_builddir)/include/xorg-server.h \ + $(top_builddir)/include/dix-config.h \ + $(top_builddir)/include/xorg-config.h \ + $(top_builddir)/include/xkb-config.h \ + $(top_builddir)/include/xwin-config.h \ + $(top_builddir)/include/kdrive-config.h \ + $(top_builddir)/include/version-config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(moduledir)" +LTLIBRARIES = $(module_LTLIBRARIES) +libglamoregl_la_DEPENDENCIES = $(top_builddir)/glamor/libglamor.la +am_libglamoregl_la_OBJECTS = glamor_egl.lo glamor_eglmodule.lo \ + glamor_xv.lo +libglamoregl_la_OBJECTS = $(am_libglamoregl_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +libglamoregl_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(AM_CFLAGS) $(CFLAGS) $(libglamoregl_la_LDFLAGS) $(LDFLAGS) \ + -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libglamoregl_la_SOURCES) +DIST_SOURCES = $(libglamoregl_la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ +ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ +APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ +APP_MAN_DIR = @APP_MAN_DIR@ +APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BASE_CFLAGS = @BASE_CFLAGS@ +BASE_FONT_PATH = @BASE_FONT_PATH@ +BUILD_DATE = @BUILD_DATE@ +BUILD_TIME = @BUILD_TIME@ +BUNDLE_ID_PREFIX = @BUNDLE_ID_PREFIX@ +CC = @CC@ +CCAS = @CCAS@ +CCASDEPMODE = @CCASDEPMODE@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CHANGELOG_CMD = @CHANGELOG_CMD@ +COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CWARNFLAGS = @CWARNFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DBUS_CFLAGS = @DBUS_CFLAGS@ +DBUS_LIBS = @DBUS_LIBS@ +DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ +DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ +DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ +DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DGA_CFLAGS = @DGA_CFLAGS@ +DGA_LIBS = @DGA_LIBS@ +DIX_CFLAGS = @DIX_CFLAGS@ +DIX_LIB = @DIX_LIB@ +DLLTOOL = @DLLTOOL@ +DLOPEN_LIBS = @DLOPEN_LIBS@ +DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ +DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ +DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ +DMXMODULES_LIBS = @DMXMODULES_LIBS@ +DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ +DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ +DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ +DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ +DOT = @DOT@ +DOXYGEN = @DOXYGEN@ +DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ +DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ +DRI3PROTO_CFLAGS = @DRI3PROTO_CFLAGS@ +DRI3PROTO_LIBS = @DRI3PROTO_LIBS@ +DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ +DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ +DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ +DSYMUTIL = @DSYMUTIL@ +DTRACE = @DTRACE@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +FILE_MAN_DIR = @FILE_MAN_DIR@ +FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ +FONT100DPIDIR = @FONT100DPIDIR@ +FONT75DPIDIR = @FONT75DPIDIR@ +FONTMISCDIR = @FONTMISCDIR@ +FONTOTFDIR = @FONTOTFDIR@ +FONTROOTDIR = @FONTROOTDIR@ +FONTTTFDIR = @FONTTTFDIR@ +FONTTYPE1DIR = @FONTTYPE1DIR@ +FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ +GLX_DEFINES = @GLX_DEFINES@ +GLX_SYS_LIBS = @GLX_SYS_LIBS@ +GLX_TLS = @GLX_TLS@ +GL_CFLAGS = @GL_CFLAGS@ +GL_LIBS = @GL_LIBS@ +GREP = @GREP@ +HAL_CFLAGS = @HAL_CFLAGS@ +HAL_LIBS = @HAL_LIBS@ +HAVE_DOT = @HAVE_DOT@ +INSTALL = @INSTALL@ +INSTALL_CMD = @INSTALL_CMD@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ +KDRIVE_INCS = @KDRIVE_INCS@ +KDRIVE_LIBS = @KDRIVE_LIBS@ +KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ +KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ +KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ +KHRONOS_OPENGL_REGISTRY_CFLAGS = @KHRONOS_OPENGL_REGISTRY_CFLAGS@ +KHRONOS_OPENGL_REGISTRY_LIBS = @KHRONOS_OPENGL_REGISTRY_LIBS@ +KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ +LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ +LIBDRM_LIBS = @LIBDRM_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBSHA1_CFLAGS = @LIBSHA1_CFLAGS@ +LIBSHA1_LIBS = @LIBSHA1_LIBS@ +LIBTOOL = @LIBTOOL@ +LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ +LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ +LIB_MAN_DIR = @LIB_MAN_DIR@ +LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAIN_LIB = @MAIN_LIB@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MAN_SUBSTS = @MAN_SUBSTS@ +MISC_MAN_DIR = @MISC_MAN_DIR@ +MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJC = @OBJC@ +OBJCCLD = @OBJCCLD@ +OBJCDEPMODE = @OBJCDEPMODE@ +OBJCFLAGS = @OBJCFLAGS@ +OBJCLINK = @OBJCLINK@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ +OPENSSL_LIBS = @OPENSSL_LIBS@ +OS_LIB = @OS_LIB@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ +PCIACCESS_LIBS = @PCIACCESS_LIBS@ +PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ +PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ +PIXMAN_LIBS = @PIXMAN_LIBS@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PROJECTROOT = @PROJECTROOT@ +PYTHON3 = @PYTHON3@ +RANLIB = @RANLIB@ +RAWCPP = @RAWCPP@ +RAWCPPFLAGS = @RAWCPPFLAGS@ +RELEASE_DATE = @RELEASE_DATE@ +SDK_REQUIRED_MODULES = @SDK_REQUIRED_MODULES@ +SED = @SED@ +SELINUX_CFLAGS = @SELINUX_CFLAGS@ +SELINUX_LIBS = @SELINUX_LIBS@ +SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ +SET_MAKE = @SET_MAKE@ +SHA1_CFLAGS = @SHA1_CFLAGS@ +SHA1_LIBS = @SHA1_LIBS@ +SHELL = @SHELL@ +SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ +STRICT_CFLAGS = @STRICT_CFLAGS@ +STRIP = @STRIP@ +STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ +SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ +TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ +TSLIB_CFLAGS = @TSLIB_CFLAGS@ +TSLIB_LIBS = @TSLIB_LIBS@ +UDEV_CFLAGS = @UDEV_CFLAGS@ +UDEV_LIBS = @UDEV_LIBS@ +UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ +VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ +VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ +WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ +WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ +WINDRES = @WINDRES@ +X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ +X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ +XDMCP_CFLAGS = @XDMCP_CFLAGS@ +XDMCP_LIBS = @XDMCP_LIBS@ +XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ +XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ +XDMX_CFLAGS = @XDMX_CFLAGS@ +XDMX_LIBS = @XDMX_LIBS@ +XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ +XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ +XEPHYR_INCS = @XEPHYR_INCS@ +XEPHYR_LIBS = @XEPHYR_LIBS@ +XF86CONFIGDIR = @XF86CONFIGDIR@ +XF86CONFIGFILE = @XF86CONFIGFILE@ +XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@ +XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@ +XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ +XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ +XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ +XKB_DFLT_LAYOUT = @XKB_DFLT_LAYOUT@ +XKB_DFLT_MODEL = @XKB_DFLT_MODEL@ +XKB_DFLT_OPTIONS = @XKB_DFLT_OPTIONS@ +XKB_DFLT_RULES = @XKB_DFLT_RULES@ +XKB_DFLT_VARIANT = @XKB_DFLT_VARIANT@ +XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ +XLIB_CFLAGS = @XLIB_CFLAGS@ +XLIB_LIBS = @XLIB_LIBS@ +XMLTO = @XMLTO@ +XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ +XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ +XNEST_LIBS = @XNEST_LIBS@ +XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ +XORG_CFLAGS = @XORG_CFLAGS@ +XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ +XORG_INCS = @XORG_INCS@ +XORG_LIBS = @XORG_LIBS@ +XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ +XORG_MAN_PAGE = @XORG_MAN_PAGE@ +XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ +XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ +XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XORG_SGML_PATH = @XORG_SGML_PATH@ +XORG_SYS_LIBS = @XORG_SYS_LIBS@ +XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ +XPBPROXY_LIBS = @XPBPROXY_LIBS@ +XQUARTZ_LIBS = @XQUARTZ_LIBS@ +XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ +XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ +XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ +XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ +XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ +XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ +XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ +XSERVER_LIBS = @XSERVER_LIBS@ +XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ +XSHMFENCE_CFLAGS = @XSHMFENCE_CFLAGS@ +XSHMFENCE_LIBS = @XSHMFENCE_LIBS@ +XSLTPROC = @XSLTPROC@ +XSL_STYLESHEET = @XSL_STYLESHEET@ +XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ +XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ +XVFB_LIBS = @XVFB_LIBS@ +XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ +XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ +XWINMODULES_LIBS = @XWINMODULES_LIBS@ +XWIN_LIBS = @XWIN_LIBS@ +XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ +XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ +YACC = @YACC@ +YFLAGS = @YFLAGS@ +__XCONFIGDIR__ = @__XCONFIGDIR__@ +__XCONFIGFILE__ = @__XCONFIGFILE__@ +abi_ansic = @abi_ansic@ +abi_extension = @abi_extension@ +abi_videodrv = @abi_videodrv@ +abi_xinput = @abi_xinput@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +driverdir = @driverdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +extdir = @extdir@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +logdir = @logdir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +moduledir = @moduledir@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sdkdir = @sdkdir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +symbol_visibility = @symbol_visibility@ +sysconfdir = @sysconfdir@ +sysconfigdir = @sysconfigdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +module_LTLIBRARIES = libglamoregl.la +libglamoregl_la_SOURCES = \ + $(top_srcdir)/glamor/glamor_egl.c \ + $(top_srcdir)/glamor/glamor_eglmodule.c \ + $(top_srcdir)/glamor/glamor_xv.c \ + $() + +libglamoregl_la_LDFLAGS = \ + -avoid-version \ + $(GBM_LIBS) \ + $() + +libglamoregl_la_LIBADD = \ + $(top_builddir)/glamor/libglamor.la \ + $() + +AM_CPPFLAGS = $(XORG_INCS) \ + -I$(top_srcdir)/dri3 \ + $() + +AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) $(GLAMOR_CFLAGS) $(GBM_CFLAGS) +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/glamor_egl/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign hw/xfree86/glamor_egl/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-moduleLTLIBRARIES: $(module_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(module_LTLIBRARIES)'; test -n "$(moduledir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(moduledir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(moduledir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(moduledir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(moduledir)"; \ + } + +uninstall-moduleLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(module_LTLIBRARIES)'; test -n "$(moduledir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(moduledir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(moduledir)/$$f"; \ + done + +clean-moduleLTLIBRARIES: + -test -z "$(module_LTLIBRARIES)" || rm -f $(module_LTLIBRARIES) + @list='$(module_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } +libglamoregl.la: $(libglamoregl_la_OBJECTS) $(libglamoregl_la_DEPENDENCIES) $(EXTRA_libglamoregl_la_DEPENDENCIES) + $(AM_V_CCLD)$(libglamoregl_la_LINK) -rpath $(moduledir) $(libglamoregl_la_OBJECTS) $(libglamoregl_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor_egl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor_eglmodule.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glamor_xv.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +glamor_egl.lo: $(top_srcdir)/glamor/glamor_egl.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT glamor_egl.lo -MD -MP -MF $(DEPDIR)/glamor_egl.Tpo -c -o glamor_egl.lo `test -f '$(top_srcdir)/glamor/glamor_egl.c' || echo '$(srcdir)/'`$(top_srcdir)/glamor/glamor_egl.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/glamor_egl.Tpo $(DEPDIR)/glamor_egl.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/glamor/glamor_egl.c' object='glamor_egl.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o glamor_egl.lo `test -f '$(top_srcdir)/glamor/glamor_egl.c' || echo '$(srcdir)/'`$(top_srcdir)/glamor/glamor_egl.c + +glamor_eglmodule.lo: $(top_srcdir)/glamor/glamor_eglmodule.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT glamor_eglmodule.lo -MD -MP -MF $(DEPDIR)/glamor_eglmodule.Tpo -c -o glamor_eglmodule.lo `test -f '$(top_srcdir)/glamor/glamor_eglmodule.c' || echo '$(srcdir)/'`$(top_srcdir)/glamor/glamor_eglmodule.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/glamor_eglmodule.Tpo $(DEPDIR)/glamor_eglmodule.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/glamor/glamor_eglmodule.c' object='glamor_eglmodule.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o glamor_eglmodule.lo `test -f '$(top_srcdir)/glamor/glamor_eglmodule.c' || echo '$(srcdir)/'`$(top_srcdir)/glamor/glamor_eglmodule.c + +glamor_xv.lo: $(top_srcdir)/glamor/glamor_xv.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT glamor_xv.lo -MD -MP -MF $(DEPDIR)/glamor_xv.Tpo -c -o glamor_xv.lo `test -f '$(top_srcdir)/glamor/glamor_xv.c' || echo '$(srcdir)/'`$(top_srcdir)/glamor/glamor_xv.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/glamor_xv.Tpo $(DEPDIR)/glamor_xv.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/glamor/glamor_xv.c' object='glamor_xv.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o glamor_xv.lo `test -f '$(top_srcdir)/glamor/glamor_xv.c' || echo '$(srcdir)/'`$(top_srcdir)/glamor/glamor_xv.c + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +cscopelist: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: + for dir in "$(DESTDIR)$(moduledir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-moduleLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-moduleLTLIBRARIES + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-moduleLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-moduleLTLIBRARIES cscopelist ctags \ + distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-moduleLTLIBRARIES \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am \ + uninstall-moduleLTLIBRARIES + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/xserver/hw/xfree86/i2c/Makefile.in b/xserver/hw/xfree86/i2c/Makefile.in index 64cfd9ab3..f97c9a348 100644 --- a/xserver/hw/xfree86/i2c/Makefile.in +++ b/xserver/hw/xfree86/i2c/Makefile.in @@ -245,6 +245,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -289,6 +291,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -391,7 +397,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -400,6 +409,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -466,6 +476,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/hw/xfree86/i2c/bt829.c b/xserver/hw/xfree86/i2c/bt829.c index 070cb2044..991c26eab 100644 --- a/xserver/hw/xfree86/i2c/bt829.c +++ b/xserver/hw/xfree86/i2c/bt829.c @@ -500,6 +500,7 @@ bt829_Detect(I2CBusPtr b, I2CSlaveAddr addr) { BT829Ptr bt; I2CByte a; + char *devname; bt = calloc(1, sizeof(BT829Rec)); if (bt == NULL) @@ -520,31 +521,31 @@ bt829_Detect(I2CBusPtr b, I2CSlaveAddr addr) bt->id = btread(bt, IDCODE); - free(bt->d.DevName); - bt->d.DevName = calloc(200, sizeof(char)); + free((void *) bt->d.DevName); + bt->d.DevName = devname = calloc(200, sizeof(char)); switch (BTVERSION) { case BT815: - sprintf(bt->d.DevName, "bt815a video decoder, revision %d", + sprintf(devname, "bt815a video decoder, revision %d", bt->id & 0xf); break; case BT817: - sprintf(bt->d.DevName, "bt817a video decoder, revision %d", + sprintf(devname, "bt817a video decoder, revision %d", bt->id & 0xf); break; case BT819: - sprintf(bt->d.DevName, "bt819a video decoder, revision %d", + sprintf(devname, "bt819a video decoder, revision %d", bt->id & 0xf); break; case BT827: - sprintf(bt->d.DevName, "bt827a/b video decoder, revision %d", + sprintf(devname, "bt827a/b video decoder, revision %d", bt->id & 0xf); break; case BT829: - sprintf(bt->d.DevName, "bt829a/b video decoder, revision %d", + sprintf(devname, "bt829a/b video decoder, revision %d", bt->id & 0xf); break; default: - sprintf(bt->d.DevName, + sprintf(devname, "bt8xx/unknown video decoder version %d, revision %d", bt->id >> 4, bt->id & 0xf); break; diff --git a/xserver/hw/xfree86/i2c/fi1236.c b/xserver/hw/xfree86/i2c/fi1236.c index 2eb27ba6d..ebd14547d 100644 --- a/xserver/hw/xfree86/i2c/fi1236.c +++ b/xserver/hw/xfree86/i2c/fi1236.c @@ -545,7 +545,7 @@ FI1236_set_tuner_type(FI1236Ptr f, int type) } static CARD32 -AFC_TimerCallback(OsTimerPtr timer, CARD32 time, pointer data) +AFC_TimerCallback(OsTimerPtr timer, CARD32 time, void *data) { FI1236Ptr f = (FI1236Ptr) data; diff --git a/xserver/hw/xfree86/i2c/msp3430.c b/xserver/hw/xfree86/i2c/msp3430.c index 312a2d1d1..a501489ee 100644 --- a/xserver/hw/xfree86/i2c/msp3430.c +++ b/xserver/hw/xfree86/i2c/msp3430.c @@ -163,7 +163,7 @@ DetectMSP3430(I2CBusPtr b, I2CSlaveAddr addr) m->d.ByteTimeout = b->ByteTimeout; if (!I2C_WriteRead(&(m->d), NULL, 0, &a, 1)) { - free(m->d.DevName); + free((void *) m->d.DevName); free(m); return NULL; } @@ -250,12 +250,12 @@ DetectMSP3430(I2CBusPtr b, I2CSlaveAddr addr) supported ? "" : " (unsupported)", rom_version, m->chip_id); if (!supported) { - free(m->d.DevName); + free((void *) m->d.DevName); free(m); return NULL; } if (!I2CDevInit(&(m->d))) { - free(m->d.DevName); + free((void *) m->d.DevName); free(m); return NULL; } diff --git a/xserver/hw/xfree86/i2c/xf86i2c.h b/xserver/hw/xfree86/i2c/xf86i2c.h index e296d7d81..26303ff6f 100644 --- a/xserver/hw/xfree86/i2c/xf86i2c.h +++ b/xserver/hw/xfree86/i2c/xf86i2c.h @@ -66,7 +66,7 @@ extern _X_EXPORT int xf86I2CGetScreenBuses(int scrnIndex, /* I2C slave devices */ typedef struct _I2CDevRec { - char *DevName; + const char *DevName; int BitTimeout; /* usec */ int ByteTimeout; /* usec */ diff --git a/xserver/hw/xfree86/int10/Makefile.in b/xserver/hw/xfree86/int10/Makefile.in index 98833518b..eff2531c4 100644 --- a/xserver/hw/xfree86/int10/Makefile.in +++ b/xserver/hw/xfree86/int10/Makefile.in @@ -211,6 +211,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -255,6 +257,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -357,7 +363,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -366,6 +375,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -432,6 +442,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/hw/xfree86/int10/generic.c b/xserver/hw/xfree86/int10/generic.c index d7594def2..abbd36f3c 100644 --- a/xserver/hw/xfree86/int10/generic.c +++ b/xserver/hw/xfree86/int10/generic.c @@ -20,12 +20,12 @@ #define ALLOC_ENTRIES(x) ((V_RAM / x) - 1) -static CARD8 read_b(xf86Int10InfoPtr pInt, int addr); -static CARD16 read_w(xf86Int10InfoPtr pInt, int addr); -static CARD32 read_l(xf86Int10InfoPtr pInt, int addr); -static void write_b(xf86Int10InfoPtr pInt, int addr, CARD8 val); -static void write_w(xf86Int10InfoPtr pInt, int addr, CARD16 val); -static void write_l(xf86Int10InfoPtr pInt, int addr, CARD32 val); +static uint8_t read_b(xf86Int10InfoPtr pInt, int addr); +static uint16_t read_w(xf86Int10InfoPtr pInt, int addr); +static uint32_t read_l(xf86Int10InfoPtr pInt, int addr); +static void write_b(xf86Int10InfoPtr pInt, int addr, uint8_t val); +static void write_w(xf86Int10InfoPtr pInt, int addr, uint16_t val); +static void write_l(xf86Int10InfoPtr pInt, int addr, uint32_t val); /* * the emulator cannot pass a pointer to the current xf86Int10InfoRec @@ -87,8 +87,8 @@ xf86ExtendedInitInt10(int entityIndex, int Flags) if (!xf86Int10ExecSetup(pInt)) goto error0; pInt->mem = &genericMem; - pInt->private = (pointer) xnfcalloc(1, sizeof(genericInt10Priv)); - INTPriv(pInt)->alloc = (pointer) xnfcalloc(1, ALLOC_ENTRIES(getpagesize())); + pInt->private = (void *) xnfcalloc(1, sizeof(genericInt10Priv)); + INTPriv(pInt)->alloc = (void *) xnfcalloc(1, ALLOC_ENTRIES(getpagesize())); pInt->pScrn = pScrn; base = INTPriv(pInt)->base = xnfalloc(SYS_BIOS); @@ -339,39 +339,39 @@ xf86Int10FreePages(xf86Int10InfoPtr pInt, void *pbase, int num) #define VRAM(addr) ((addr >= V_RAM) && (addr < (V_RAM + VRAM_SIZE))) #define V_ADDR_RB(addr) \ - (VRAM(addr)) ? MMIO_IN8((CARD8*)VRAM_BASE,VRAM_ADDR(addr)) \ - : *(CARD8*) V_ADDR(addr) + (VRAM(addr)) ? MMIO_IN8((uint8_t*)VRAM_BASE,VRAM_ADDR(addr)) \ + : *(uint8_t*) V_ADDR(addr) #define V_ADDR_RW(addr) \ - (VRAM(addr)) ? MMIO_IN16((CARD16*)VRAM_BASE,VRAM_ADDR(addr)) \ - : ldw_u((pointer)V_ADDR(addr)) + (VRAM(addr)) ? MMIO_IN16((uint16_t*)VRAM_BASE,VRAM_ADDR(addr)) \ + : ldw_u((void *)V_ADDR(addr)) #define V_ADDR_RL(addr) \ - (VRAM(addr)) ? MMIO_IN32((CARD32*)VRAM_BASE,VRAM_ADDR(addr)) \ - : ldl_u((pointer)V_ADDR(addr)) + (VRAM(addr)) ? MMIO_IN32((uint32_t*)VRAM_BASE,VRAM_ADDR(addr)) \ + : ldl_u((void *)V_ADDR(addr)) #define V_ADDR_WB(addr,val) \ if(VRAM(addr)) \ - MMIO_OUT8((CARD8*)VRAM_BASE,VRAM_ADDR(addr),val); \ + MMIO_OUT8((uint8_t*)VRAM_BASE,VRAM_ADDR(addr),val); \ else \ - *(CARD8*) V_ADDR(addr) = val; + *(uint8_t*) V_ADDR(addr) = val; #define V_ADDR_WW(addr,val) \ if(VRAM(addr)) \ - MMIO_OUT16((CARD16*)VRAM_BASE,VRAM_ADDR(addr),val); \ + MMIO_OUT16((uint16_t*)VRAM_BASE,VRAM_ADDR(addr),val); \ else \ - stw_u((val),(pointer)(V_ADDR(addr))); + stw_u((val),(void *)(V_ADDR(addr))); #define V_ADDR_WL(addr,val) \ if (VRAM(addr)) \ - MMIO_OUT32((CARD32*)VRAM_BASE,VRAM_ADDR(addr),val); \ + MMIO_OUT32((uint32_t*)VRAM_BASE,VRAM_ADDR(addr),val); \ else \ - stl_u(val,(pointer)(V_ADDR(addr))); + stl_u(val,(void *)(V_ADDR(addr))); -static CARD8 +static uint8_t read_b(xf86Int10InfoPtr pInt, int addr) { return V_ADDR_RB(addr); } -static CARD16 +static uint16_t read_w(xf86Int10InfoPtr pInt, int addr) { #if X_BYTE_ORDER == X_LITTLE_ENDIAN @@ -381,7 +381,7 @@ read_w(xf86Int10InfoPtr pInt, int addr) return V_ADDR_RB(addr) | (V_ADDR_RB(addr + 1) << 8); } -static CARD32 +static uint32_t read_l(xf86Int10InfoPtr pInt, int addr) { #if X_BYTE_ORDER == X_LITTLE_ENDIAN @@ -394,7 +394,7 @@ read_l(xf86Int10InfoPtr pInt, int addr) } static void -write_b(xf86Int10InfoPtr pInt, int addr, CARD8 val) +write_b(xf86Int10InfoPtr pInt, int addr, uint8_t val) { V_ADDR_WB(addr, val); } @@ -412,7 +412,7 @@ write_w(xf86Int10InfoPtr pInt, int addr, CARD16 val) } static void -write_l(xf86Int10InfoPtr pInt, int addr, CARD32 val) +write_l(xf86Int10InfoPtr pInt, int addr, uint32_t val) { #if X_BYTE_ORDER == X_LITTLE_ENDIAN if (OFF(addr + 3) > 2) { @@ -425,8 +425,8 @@ write_l(xf86Int10InfoPtr pInt, int addr, CARD32 val) V_ADDR_WB(addr + 3, val >> 24); } -pointer -xf86int10Addr(xf86Int10InfoPtr pInt, CARD32 addr) +void * +xf86int10Addr(xf86Int10InfoPtr pInt, uint32_t addr) { return V_ADDR(addr); } diff --git a/xserver/hw/xfree86/int10/helper_exec.c b/xserver/hw/xfree86/int10/helper_exec.c index 1c58cf7ae..6a83f422e 100644 --- a/xserver/hw/xfree86/int10/helper_exec.c +++ b/xserver/hw/xfree86/int10/helper_exec.c @@ -37,12 +37,12 @@ #endif #include <pciaccess.h> -static int pciCfg1in(CARD16 addr, CARD32 *val); -static int pciCfg1out(CARD16 addr, CARD32 val); -static int pciCfg1inw(CARD16 addr, CARD16 *val); -static int pciCfg1outw(CARD16 addr, CARD16 val); -static int pciCfg1inb(CARD16 addr, CARD8 *val); -static int pciCfg1outb(CARD16 addr, CARD8 val); +static int pciCfg1in(uint16_t addr, uint32_t *val); +static int pciCfg1out(uint16_t addr, uint32_t val); +static int pciCfg1inw(uint16_t addr, uint16_t *val); +static int pciCfg1outw(uint16_t addr, uint16_t val); +static int pciCfg1inb(uint16_t addr, uint8_t *val); +static int pciCfg1outb(uint16_t addr, uint8_t val); #if defined (_PC) static void SetResetBIOSVars(xf86Int10InfoPtr pInt, Bool set); @@ -58,13 +58,13 @@ setup_int(xf86Int10InfoPtr pInt) return -1; Int10Current = pInt; } - X86_EAX = (CARD32) pInt->ax; - X86_EBX = (CARD32) pInt->bx; - X86_ECX = (CARD32) pInt->cx; - X86_EDX = (CARD32) pInt->dx; - X86_ESI = (CARD32) pInt->si; - X86_EDI = (CARD32) pInt->di; - X86_EBP = (CARD32) pInt->bp; + X86_EAX = (uint32_t) pInt->ax; + X86_EBX = (uint32_t) pInt->bx; + X86_ECX = (uint32_t) pInt->cx; + X86_EDX = (uint32_t) pInt->dx; + X86_ESI = (uint32_t) pInt->si; + X86_EDI = (uint32_t) pInt->di; + X86_EBP = (uint32_t) pInt->bp; X86_ESP = 0x1000; X86_SS = pInt->stackseg >> 4; X86_EIP = 0x0600; @@ -86,15 +86,15 @@ void finish_int(xf86Int10InfoPtr pInt, int sig) { OsReleaseSignals(); - pInt->ax = (CARD32) X86_EAX; - pInt->bx = (CARD32) X86_EBX; - pInt->cx = (CARD32) X86_ECX; - pInt->dx = (CARD32) X86_EDX; - pInt->si = (CARD32) X86_ESI; - pInt->di = (CARD32) X86_EDI; - pInt->es = (CARD16) X86_ES; - pInt->bp = (CARD32) X86_EBP; - pInt->flags = (CARD32) X86_FLAGS; + pInt->ax = (uint32_t) X86_EAX; + pInt->bx = (uint32_t) X86_EBX; + pInt->cx = (uint32_t) X86_ECX; + pInt->dx = (uint32_t) X86_EDX; + pInt->si = (uint32_t) X86_ESI; + pInt->di = (uint32_t) X86_EDI; + pInt->es = (uint16_t) X86_ES; + pInt->bp = (uint32_t) X86_EBP; + pInt->flags = (uint32_t) X86_FLAGS; #if defined (_PC) if (pInt->Flags & RESTORE_BIOS_SCRATCH) SetResetBIOSVars(pInt, FALSE); @@ -102,23 +102,23 @@ finish_int(xf86Int10InfoPtr pInt, int sig) } /* general software interrupt handler */ -CARD32 +uint32_t getIntVect(xf86Int10InfoPtr pInt, int num) { return MEM_RW(pInt, num << 2) + (MEM_RW(pInt, (num << 2) + 2) << 4); } void -pushw(xf86Int10InfoPtr pInt, CARD16 val) +pushw(xf86Int10InfoPtr pInt, uint16_t val) { X86_ESP -= 2; - MEM_WW(pInt, ((CARD32) X86_SS << 4) + X86_SP, val); + MEM_WW(pInt, ((uint32_t) X86_SS << 4) + X86_SP, val); } int run_bios_int(int num, xf86Int10InfoPtr pInt) { - CARD32 eflags; + uint32_t eflags; #ifndef _PC /* check if bios vector is initialized */ @@ -167,10 +167,10 @@ void dump_code(xf86Int10InfoPtr pInt) { int i; - CARD32 lina = SEG_ADR((CARD32), X86_CS, IP); + uint32_t lina = SEG_ADR((uint32_t), X86_CS, IP); xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_INFO, 3, "code at 0x%8.8" PRIx32 ":\n", - lina); + (unsigned) lina); for (i = 0; i < 0x10; i++) xf86ErrorFVerb(3, " %2.2x", MEM_RB(pInt, lina + i)); xf86ErrorFVerb(3, "\n"); @@ -203,8 +203,8 @@ void stack_trace(xf86Int10InfoPtr pInt) { int i = 0; - unsigned long stack = SEG_ADR((CARD32), X86_SS, SP); - unsigned long tail = (CARD32) ((X86_SS << 4) + 0x1000); + unsigned long stack = SEG_ADR((uint32_t), X86_SS, SP); + unsigned long tail = (uint32_t) ((X86_SS << 4) + 0x1000); if (stack >= tail) return; @@ -222,14 +222,14 @@ stack_trace(xf86Int10InfoPtr pInt) int port_rep_inb(xf86Int10InfoPtr pInt, - CARD16 port, CARD32 base, int d_f, CARD32 count) + uint16_t port, uint32_t base, int d_f, uint32_t count) { register int inc = d_f ? -1 : 1; - CARD32 dst = base; + uint32_t dst = base; if (PRINT_PORT && DEBUG_IO_TRACE()) ErrorF(" rep_insb(%#x) %" PRIu32 " bytes at %8.8" PRIx32 " %s\n", - port, count, base, d_f ? "up" : "down"); + port, (unsigned) count, (unsigned) base, d_f ? "up" : "down"); while (count--) { MEM_WB(pInt, dst, x_inb(port)); dst += inc; @@ -239,14 +239,14 @@ port_rep_inb(xf86Int10InfoPtr pInt, int port_rep_inw(xf86Int10InfoPtr pInt, - CARD16 port, CARD32 base, int d_f, CARD32 count) + uint16_t port, uint32_t base, int d_f, uint32_t count) { register int inc = d_f ? -2 : 2; - CARD32 dst = base; + uint32_t dst = base; if (PRINT_PORT && DEBUG_IO_TRACE()) ErrorF(" rep_insw(%#x) %" PRIu32 " bytes at %8.8" PRIx32 " %s\n", - port, count, base, d_f ? "up" : "down"); + port, (unsigned) count, (unsigned) base, d_f ? "up" : "down"); while (count--) { MEM_WW(pInt, dst, x_inw(port)); dst += inc; @@ -256,14 +256,14 @@ port_rep_inw(xf86Int10InfoPtr pInt, int port_rep_inl(xf86Int10InfoPtr pInt, - CARD16 port, CARD32 base, int d_f, CARD32 count) + uint16_t port, uint32_t base, int d_f, uint32_t count) { register int inc = d_f ? -4 : 4; - CARD32 dst = base; + uint32_t dst = base; if (PRINT_PORT && DEBUG_IO_TRACE()) ErrorF(" rep_insl(%#x) %" PRIu32 " bytes at %8.8" PRIx32 " %s\n", - port, count, base, d_f ? "up" : "down"); + port, (unsigned) count, (unsigned) base, d_f ? "up" : "down"); while (count--) { MEM_WL(pInt, dst, x_inl(port)); dst += inc; @@ -273,14 +273,14 @@ port_rep_inl(xf86Int10InfoPtr pInt, int port_rep_outb(xf86Int10InfoPtr pInt, - CARD16 port, CARD32 base, int d_f, CARD32 count) + uint16_t port, uint32_t base, int d_f, uint32_t count) { register int inc = d_f ? -1 : 1; - CARD32 dst = base; + uint32_t dst = base; if (PRINT_PORT && DEBUG_IO_TRACE()) ErrorF(" rep_outb(%#x) %" PRIu32 " bytes at %8.8" PRIx32 " %s\n", - port, count, base, d_f ? "up" : "down"); + port, (unsigned) count, (unsigned) base, d_f ? "up" : "down"); while (count--) { x_outb(port, MEM_RB(pInt, dst)); dst += inc; @@ -290,14 +290,14 @@ port_rep_outb(xf86Int10InfoPtr pInt, int port_rep_outw(xf86Int10InfoPtr pInt, - CARD16 port, CARD32 base, int d_f, CARD32 count) + uint16_t port, uint32_t base, int d_f, uint32_t count) { register int inc = d_f ? -2 : 2; - CARD32 dst = base; + uint32_t dst = base; if (PRINT_PORT && DEBUG_IO_TRACE()) ErrorF(" rep_outw(%#x) %" PRIu32 " bytes at %8.8" PRIx32 " %s\n", - port, count, base, d_f ? "up" : "down"); + port, (unsigned) count, (unsigned) base, d_f ? "up" : "down"); while (count--) { x_outw(port, MEM_RW(pInt, dst)); dst += inc; @@ -307,14 +307,14 @@ port_rep_outw(xf86Int10InfoPtr pInt, int port_rep_outl(xf86Int10InfoPtr pInt, - CARD16 port, CARD32 base, int d_f, CARD32 count) + uint16_t port, uint32_t base, int d_f, uint32_t count) { register int inc = d_f ? -4 : 4; - CARD32 dst = base; + uint32_t dst = base; if (PRINT_PORT && DEBUG_IO_TRACE()) ErrorF(" rep_outl(%#x) %" PRIu32 " bytes at %8.8" PRIx32 " %s\n", - port, count, base, d_f ? "up" : "down"); + port, (unsigned) count, (unsigned) base, d_f ? "up" : "down"); while (count--) { x_outl(port, MEM_RL(pInt, dst)); dst += inc; @@ -322,14 +322,14 @@ port_rep_outl(xf86Int10InfoPtr pInt, return dst - base; } -CARD8 -x_inb(CARD16 port) +uint8_t +x_inb(uint16_t port) { - CARD8 val; + uint8_t val; if (port == 0x40) { Int10Current->inb40time++; - val = (CARD8) (Int10Current->inb40time >> + val = (uint8_t) (Int10Current->inb40time >> ((Int10Current->inb40time & 1) << 3)); if (PRINT_PORT && DEBUG_IO_TRACE()) ErrorF(" inb(%#x) = %2.2x\n", port, val); @@ -353,10 +353,10 @@ x_inb(CARD16 port) return val; } -CARD16 -x_inw(CARD16 port) +uint16_t +x_inw(uint16_t port) { - CARD16 val; + uint16_t val; if (port == 0x5c) { struct timeval tv; @@ -366,7 +366,7 @@ x_inw(CARD16 port) * Approximate this by dividing by 3. */ X_GETTIMEOFDAY(&tv); - val = (CARD16) (tv.tv_usec / 3); + val = (uint16_t) (tv.tv_usec / 3); } else if (!pciCfg1inw(port, &val)) { val = pci_io_read16(Int10Current->io, port); @@ -377,7 +377,7 @@ x_inw(CARD16 port) } void -x_outb(CARD16 port, CARD8 val) +x_outb(uint16_t port, uint8_t val) { if ((port == 0x43) && (val == 0)) { struct timeval tv; @@ -389,7 +389,7 @@ x_outb(CARD16 port, CARD8 val) * the bottom bit as a byte select. See inb(0x40) above. */ X_GETTIMEOFDAY(&tv); - Int10Current->inb40time = (CARD16) (tv.tv_usec | 1); + Int10Current->inb40time = (uint16_t) (tv.tv_usec | 1); if (PRINT_PORT && DEBUG_IO_TRACE()) ErrorF(" outb(%#x, %2.2x)\n", port, val); #ifdef __NOT_YET__ @@ -411,7 +411,7 @@ x_outb(CARD16 port, CARD8 val) } void -x_outw(CARD16 port, CARD16 val) +x_outw(uint16_t port, uint16_t val) { if (!pciCfg1outw(port, val)) { @@ -421,66 +421,66 @@ x_outw(CARD16 port, CARD16 val) } } -CARD32 -x_inl(CARD16 port) +uint32_t +x_inl(uint16_t port) { - CARD32 val; + uint32_t val; if (!pciCfg1in(port, &val)) { val = pci_io_read32(Int10Current->io, port); if (PRINT_PORT && DEBUG_IO_TRACE()) - ErrorF(" inl(%#x) = %8.8" PRIx32 "\n", port, val); + ErrorF(" inl(%#x) = %8.8" PRIx32 "\n", port, (unsigned) val); } return val; } void -x_outl(CARD16 port, CARD32 val) +x_outl(uint16_t port, uint32_t val) { if (!pciCfg1out(port, val)) { if (PRINT_PORT && DEBUG_IO_TRACE()) - ErrorF(" outl(%#x, %8.8" PRIx32 ")\n", port, val); + ErrorF(" outl(%#x, %8.8" PRIx32 ")\n", port, (unsigned) val); pci_io_write32(Int10Current->io, port, val); } } -CARD8 -Mem_rb(CARD32 addr) +uint8_t +Mem_rb(uint32_t addr) { return (*Int10Current->mem->rb) (Int10Current, addr); } -CARD16 -Mem_rw(CARD32 addr) +uint16_t +Mem_rw(uint32_t addr) { return (*Int10Current->mem->rw) (Int10Current, addr); } -CARD32 -Mem_rl(CARD32 addr) +uint32_t +Mem_rl(uint32_t addr) { return (*Int10Current->mem->rl) (Int10Current, addr); } void -Mem_wb(CARD32 addr, CARD8 val) +Mem_wb(uint32_t addr, uint8_t val) { (*Int10Current->mem->wb) (Int10Current, addr, val); } void -Mem_ww(CARD32 addr, CARD16 val) +Mem_ww(uint32_t addr, uint16_t val) { (*Int10Current->mem->ww) (Int10Current, addr, val); } void -Mem_wl(CARD32 addr, CARD32 val) +Mem_wl(uint32_t addr, uint32_t val) { (*Int10Current->mem->wl) (Int10Current, addr, val); } -static CARD32 PciCfg1Addr = 0; +static uint32_t PciCfg1Addr = 0; #define PCI_DOM_FROM_TAG(tag) (((tag) >> 24) & (PCI_DOM_MASK)) #define PCI_BUS_FROM_TAG(tag) (((tag) >> 16) & (PCI_DOMBUS_MASK)) @@ -491,10 +491,10 @@ static CARD32 PciCfg1Addr = 0; #define PCI_TAG(x) ((x) & 0x7fffff00) static struct pci_device * -pci_device_for_cfg_address(CARD32 addr) +pci_device_for_cfg_address(uint32_t addr) { struct pci_device *dev = NULL; - CARD32 tag = PCI_TAG(addr); + uint32_t tag = PCI_TAG(addr); struct pci_slot_match slot_match = { .domain = PCI_DOM_FROM_TAG(tag), @@ -516,7 +516,7 @@ pci_device_for_cfg_address(CARD32 addr) } static int -pciCfg1in(CARD16 addr, CARD32 *val) +pciCfg1in(uint16_t addr, uint32_t *val) { if (addr == 0xCF8) { *val = PciCfg1Addr; @@ -526,15 +526,15 @@ pciCfg1in(CARD16 addr, CARD32 *val) pci_device_cfg_read_u32(pci_device_for_cfg_address(PciCfg1Addr), (uint32_t *) val, PCI_OFFSET(PciCfg1Addr)); if (PRINT_PORT && DEBUG_IO_TRACE()) - ErrorF(" cfg_inl(%#" PRIx32 ") = %8.8" PRIx32 "\n", PciCfg1Addr, - *val); + ErrorF(" cfg_inl(%#" PRIx32 ") = %8.8" PRIx32 "\n", (unsigned) PciCfg1Addr, + (unsigned) *val); return 1; } return 0; } static int -pciCfg1out(CARD16 addr, CARD32 val) +pciCfg1out(uint16_t addr, uint32_t val) { if (addr == 0xCF8) { PciCfg1Addr = val; @@ -542,8 +542,8 @@ pciCfg1out(CARD16 addr, CARD32 val) } if (addr == 0xCFC) { if (PRINT_PORT && DEBUG_IO_TRACE()) - ErrorF(" cfg_outl(%#" PRIx32 ", %8.8" PRIx32 ")\n", PciCfg1Addr, - val); + ErrorF(" cfg_outl(%#" PRIx32 ", %8.8" PRIx32 ")\n", (unsigned) PciCfg1Addr, + (unsigned) val); pci_device_cfg_write_u32(pci_device_for_cfg_address(PciCfg1Addr), val, PCI_OFFSET(PciCfg1Addr)); return 1; @@ -552,7 +552,7 @@ pciCfg1out(CARD16 addr, CARD32 val) } static int -pciCfg1inw(CARD16 addr, CARD16 *val) +pciCfg1inw(uint16_t addr, uint16_t *val) { int shift; @@ -567,30 +567,30 @@ pciCfg1inw(CARD16 addr, CARD16 *val) pci_device_cfg_read_u16(pci_device_for_cfg_address(PciCfg1Addr), val, PCI_OFFSET(PciCfg1Addr) + offset); if (PRINT_PORT && DEBUG_IO_TRACE()) - ErrorF(" cfg_inw(%#" PRIx32 ") = %4.4x\n", PciCfg1Addr + offset, - *val); + ErrorF(" cfg_inw(%#" PRIx32 ") = %4.4x\n", (unsigned) (PciCfg1Addr + offset), + (unsigned) *val); return 1; } return 0; } static int -pciCfg1outw(CARD16 addr, CARD16 val) +pciCfg1outw(uint16_t addr, uint16_t val) { int shift; if ((addr >= 0xCF8) && (addr <= 0xCFB)) { shift = (addr - 0xCF8) * 8; PciCfg1Addr &= ~(0xffff << shift); - PciCfg1Addr |= ((CARD32) val) << shift; + PciCfg1Addr |= ((uint32_t) val) << shift; return 1; } if ((addr >= 0xCFC) && (addr <= 0xCFF)) { const unsigned offset = addr - 0xCFC; if (PRINT_PORT && DEBUG_IO_TRACE()) - ErrorF(" cfg_outw(%#" PRIx32 ", %4.4x)\n", PciCfg1Addr + offset, - val); + ErrorF(" cfg_outw(%#" PRIx32 ", %4.4x)\n", (unsigned) (PciCfg1Addr + offset), + (unsigned) val); pci_device_cfg_write_u16(pci_device_for_cfg_address(PciCfg1Addr), val, PCI_OFFSET(PciCfg1Addr) + offset); return 1; @@ -599,7 +599,7 @@ pciCfg1outw(CARD16 addr, CARD16 val) } static int -pciCfg1inb(CARD16 addr, CARD8 *val) +pciCfg1inb(uint16_t addr, uint8_t *val) { int shift; @@ -614,30 +614,30 @@ pciCfg1inb(CARD16 addr, CARD8 *val) pci_device_cfg_read_u8(pci_device_for_cfg_address(PciCfg1Addr), val, PCI_OFFSET(PciCfg1Addr) + offset); if (PRINT_PORT && DEBUG_IO_TRACE()) - ErrorF(" cfg_inb(%#" PRIx32 ") = %2.2x\n", PciCfg1Addr + offset, - *val); + ErrorF(" cfg_inb(%#" PRIx32 ") = %2.2x\n", (unsigned) (PciCfg1Addr + offset), + (unsigned) *val); return 1; } return 0; } static int -pciCfg1outb(CARD16 addr, CARD8 val) +pciCfg1outb(uint16_t addr, uint8_t val) { int shift; if ((addr >= 0xCF8) && (addr <= 0xCFB)) { shift = (addr - 0xCF8) * 8; PciCfg1Addr &= ~(0xff << shift); - PciCfg1Addr |= ((CARD32) val) << shift; + PciCfg1Addr |= ((uint32_t) val) << shift; return 1; } if ((addr >= 0xCFC) && (addr <= 0xCFF)) { const unsigned offset = addr - 0xCFC; if (PRINT_PORT && DEBUG_IO_TRACE()) - ErrorF(" cfg_outb(%#" PRIx32 ", %2.2x)\n", PciCfg1Addr + offset, - val); + ErrorF(" cfg_outb(%#" PRIx32 ", %2.2x)\n", (unsigned) (PciCfg1Addr + offset), + (unsigned) val); pci_device_cfg_write_u8(pci_device_for_cfg_address(PciCfg1Addr), val, PCI_OFFSET(PciCfg1Addr) + offset); return 1; @@ -645,10 +645,10 @@ pciCfg1outb(CARD16 addr, CARD8 val) return 0; } -CARD8 -bios_checksum(const CARD8 *start, int size) +uint8_t +bios_checksum(const uint8_t *start, int size) { - CARD8 sum = 0; + uint8_t sum = 0; while (size-- > 0) sum += *start++; @@ -682,12 +682,12 @@ LockLegacyVGA(xf86Int10InfoPtr pInt, legacyVGAPtr vga) vga->save_46e8 = pci_io_read8(pInt->io, 0x46E8); #endif vga->save_pos102 = pci_io_read8(pInt->io, 0x0102); - pci_io_write8(pInt->io, 0x03C2, ~(CARD8) 0x03 & vga->save_msr); - pci_io_write8(pInt->io, 0x03C3, ~(CARD8) 0x01 & vga->save_vse); + pci_io_write8(pInt->io, 0x03C2, ~(uint8_t) 0x03 & vga->save_msr); + pci_io_write8(pInt->io, 0x03C3, ~(uint8_t) 0x01 & vga->save_vse); #ifndef __ia64__ - pci_io_write8(pInt->io, 0x46E8, ~(CARD8) 0x08 & vga->save_46e8); + pci_io_write8(pInt->io, 0x46E8, ~(uint8_t) 0x08 & vga->save_46e8); #endif - pci_io_write8(pInt->io, 0x0102, ~(CARD8) 0x01 & vga->save_pos102); + pci_io_write8(pInt->io, 0x0102, ~(uint8_t) 0x01 & vga->save_pos102); } void diff --git a/xserver/hw/xfree86/int10/helper_mem.c b/xserver/hw/xfree86/int10/helper_mem.c index 160c5aedf..1b5960e0c 100644 --- a/xserver/hw/xfree86/int10/helper_mem.c +++ b/xserver/hw/xfree86/int10/helper_mem.c @@ -199,7 +199,7 @@ xf86HandleInt10Options(ScrnInfoPtr pScrn, int entityIndex) OptionInfoPtr options = NULL; if (pEnt->device) { - pointer configOptions = NULL; + void *configOptions = NULL; /* Check if xf86CollectOptions() has already been called */ if (((pEnt->index < 0) || diff --git a/xserver/hw/xfree86/int10/stub.c b/xserver/hw/xfree86/int10/stub.c index 8fd079069..4bbcddeda 100644 --- a/xserver/hw/xfree86/int10/stub.c +++ b/xserver/hw/xfree86/int10/stub.c @@ -62,8 +62,8 @@ xf86ExecX86int10(xf86Int10InfoPtr pInt) return; } -pointer -xf86int10Addr(xf86Int10InfoPtr pInt, CARD32 addr) +void * +xf86int10Addr(xf86Int10InfoPtr pInt, uint32_t addr) { return 0; } diff --git a/xserver/hw/xfree86/int10/xf86int10.h b/xserver/hw/xfree86/int10/xf86int10.h index 6d564fc1a..83bab7e61 100644 --- a/xserver/hw/xfree86/int10/xf86int10.h +++ b/xserver/hw/xfree86/int10/xf86int10.h @@ -21,13 +21,13 @@ /* int10 info structure */ typedef struct { int entityIndex; - CARD16 BIOSseg; - CARD16 inb40time; + uint16_t BIOSseg; + uint16_t inb40time; ScrnInfoPtr pScrn; - pointer cpuRegs; + void *cpuRegs; char *BIOSScratch; int Flags; - pointer private; + void *private; struct _int10Mem *mem; int num; int ax; @@ -45,19 +45,19 @@ typedef struct { } xf86Int10InfoRec, *xf86Int10InfoPtr; typedef struct _int10Mem { - CARD8 (*rb) (xf86Int10InfoPtr, int); - CARD16 (*rw) (xf86Int10InfoPtr, int); - CARD32 (*rl) (xf86Int10InfoPtr, int); - void (*wb) (xf86Int10InfoPtr, int, CARD8); - void (*ww) (xf86Int10InfoPtr, int, CARD16); - void (*wl) (xf86Int10InfoPtr, int, CARD32); + uint8_t (*rb) (xf86Int10InfoPtr, int); + uint16_t (*rw) (xf86Int10InfoPtr, int); + uint32_t (*rl) (xf86Int10InfoPtr, int); + void (*wb) (xf86Int10InfoPtr, int, uint8_t); + void (*ww) (xf86Int10InfoPtr, int, uint16_t); + void (*wl) (xf86Int10InfoPtr, int, uint32_t); } int10MemRec, *int10MemPtr; typedef struct { - CARD8 save_msr; - CARD8 save_pos102; - CARD8 save_vse; - CARD8 save_46e8; + uint8_t save_msr; + uint8_t save_pos102; + uint8_t save_vse; + uint8_t save_46e8; } legacyVGARec, *legacyVGAPtr; /* OS dependent functions */ @@ -69,7 +69,7 @@ extern _X_EXPORT void *xf86Int10AllocPages(xf86Int10InfoPtr pInt, int num, int *off); extern _X_EXPORT void xf86Int10FreePages(xf86Int10InfoPtr pInt, void *pbase, int num); -extern _X_EXPORT pointer xf86int10Addr(xf86Int10InfoPtr pInt, CARD32 addr); +extern _X_EXPORT void *xf86int10Addr(xf86Int10InfoPtr pInt, uint32_t addr); /* x86 executor related functions */ extern _X_EXPORT void xf86ExecX86int10(xf86Int10InfoPtr pInt); @@ -127,13 +127,13 @@ int int_handler(xf86Int10InfoPtr pInt); /* helper_exec.c */ int setup_int(xf86Int10InfoPtr pInt); void finish_int(xf86Int10InfoPtr, int sig); -CARD32 getIntVect(xf86Int10InfoPtr pInt, int num); -void pushw(xf86Int10InfoPtr pInt, CARD16 val); +uint32_t getIntVect(xf86Int10InfoPtr pInt, int num); +void pushw(xf86Int10InfoPtr pInt, uint16_t val); int run_bios_int(int num, xf86Int10InfoPtr pInt); void dump_code(xf86Int10InfoPtr pInt); void dump_registers(xf86Int10InfoPtr pInt); void stack_trace(xf86Int10InfoPtr pInt); -CARD8 bios_checksum(const CARD8 *start, int size); +uint8_t bios_checksum(const uint8_t *start, int size); void LockLegacyVGA(xf86Int10InfoPtr pInt, legacyVGAPtr vga); void UnlockLegacyVGA(xf86Int10InfoPtr pInt, legacyVGAPtr vga); @@ -142,31 +142,31 @@ extern _X_EXPORT void xf86Int10SaveRestoreBIOSVars(xf86Int10InfoPtr pInt, Bool save); #endif int port_rep_inb(xf86Int10InfoPtr pInt, - CARD16 port, CARD32 base, int d_f, CARD32 count); + uint16_t port, uint32_t base, int d_f, uint32_t count); int port_rep_inw(xf86Int10InfoPtr pInt, - CARD16 port, CARD32 base, int d_f, CARD32 count); + uint16_t port, uint32_t base, int d_f, uint32_t count); int port_rep_inl(xf86Int10InfoPtr pInt, - CARD16 port, CARD32 base, int d_f, CARD32 count); + uint16_t port, uint32_t base, int d_f, uint32_t count); int port_rep_outb(xf86Int10InfoPtr pInt, - CARD16 port, CARD32 base, int d_f, CARD32 count); + uint16_t port, uint32_t base, int d_f, uint32_t count); int port_rep_outw(xf86Int10InfoPtr pInt, - CARD16 port, CARD32 base, int d_f, CARD32 count); + uint16_t port, uint32_t base, int d_f, uint32_t count); int port_rep_outl(xf86Int10InfoPtr pInt, - CARD16 port, CARD32 base, int d_f, CARD32 count); - -CARD8 x_inb(CARD16 port); -CARD16 x_inw(CARD16 port); -void x_outb(CARD16 port, CARD8 val); -void x_outw(CARD16 port, CARD16 val); -CARD32 x_inl(CARD16 port); -void x_outl(CARD16 port, CARD32 val); - -CARD8 Mem_rb(CARD32 addr); -CARD16 Mem_rw(CARD32 addr); -CARD32 Mem_rl(CARD32 addr); -void Mem_wb(CARD32 addr, CARD8 val); -void Mem_ww(CARD32 addr, CARD16 val); -void Mem_wl(CARD32 addr, CARD32 val); + uint16_t port, uint32_t base, int d_f, uint32_t count); + +uint8_t x_inb(uint16_t port); +uint16_t x_inw(uint16_t port); +void x_outb(uint16_t port, uint8_t val); +void x_outw(uint16_t port, uint16_t val); +uint32_t x_inl(uint16_t port); +void x_outl(uint16_t port, uint32_t val); + +uint8_t Mem_rb(uint32_t addr); +uint16_t Mem_rw(uint32_t addr); +uint32_t Mem_rl(uint32_t addr); +void Mem_wb(uint32_t addr, uint8_t val); +void Mem_ww(uint32_t addr, uint16_t val); +void Mem_wl(uint32_t addr, uint32_t val); /* helper_mem.c */ void setup_int_vect(xf86Int10InfoPtr pInt); diff --git a/xserver/hw/xfree86/int10/xf86x86emu.c b/xserver/hw/xfree86/int10/xf86x86emu.c index 0f8737b49..4b0a13090 100644 --- a/xserver/hw/xfree86/int10/xf86x86emu.c +++ b/xserver/hw/xfree86/int10/xf86x86emu.c @@ -9,7 +9,6 @@ #include <x86emu.h> #include "xf86.h" -#include "compiler.h" #include "xf86_OSproc.h" #include "xf86Pci.h" #define _INT10_PRIVATE @@ -50,12 +49,12 @@ xf86Int10ExecSetup(xf86Int10InfoPtr pInt) X86EMU_intrFuncs intFuncs[256]; X86EMU_pioFuncs pioFuncs = { - (&x_inb), - (&x_inw), - (&x_inl), - (&x_outb), - (&x_outw), - (&x_outl) + .inb = x_inb, + .inw = x_inw, + .inl = x_inl, + .outb = x_outb, + .outw = x_outw, + .outl = x_outl }; X86EMU_memFuncs memFuncs = { diff --git a/xserver/hw/xfree86/loader/Makefile.in b/xserver/hw/xfree86/loader/Makefile.in index 3323c702c..ba2992f5e 100644 --- a/xserver/hw/xfree86/loader/Makefile.in +++ b/xserver/hw/xfree86/loader/Makefile.in @@ -163,6 +163,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -207,6 +209,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -309,7 +315,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -318,6 +327,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -384,6 +394,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/hw/xfree86/loader/loaderProcs.h b/xserver/hw/xfree86/loader/loaderProcs.h index 8b4b53f28..cfc4d8069 100644 --- a/xserver/hw/xfree86/loader/loaderProcs.h +++ b/xserver/hw/xfree86/loader/loaderProcs.h @@ -72,10 +72,10 @@ typedef struct module_desc { void LoaderInit(void); -ModuleDescPtr LoadDriver(const char *, const char *, int, pointer, int *, +ModuleDescPtr LoadDriver(const char *, const char *, int, void *, int *, int *); ModuleDescPtr LoadModule(const char *, const char *, const char **, - const char **, pointer, const XF86ModReqInfo *, + const char **, void *, const XF86ModReqInfo *, int *, int *); ModuleDescPtr DuplicateModule(ModuleDescPtr mod, ModuleDescPtr parent); void UnloadDriver(ModuleDescPtr); diff --git a/xserver/hw/xfree86/loader/loadmod.c b/xserver/hw/xfree86/loader/loadmod.c index 2347b8e5b..e1f649a74 100644 --- a/xserver/hw/xfree86/loader/loadmod.c +++ b/xserver/hw/xfree86/loader/loadmod.c @@ -81,7 +81,7 @@ static void UnloadModuleOrDriver(ModuleDescPtr mod); static char *LoaderGetCanonicalName(const char *, PatternPtr); static void RemoveChild(ModuleDescPtr); static ModuleDescPtr doLoadModule(const char *, const char *, const char **, - const char **, pointer, + const char **, void *, const XF86ModReqInfo *, int *, int *); const ModuleVersions LoaderVersionInfo = { @@ -482,7 +482,7 @@ FindModule(const char *module, const char *dirname, const char **subdirlist, return name; } -char ** +const char ** LoaderListDirs(const char **subdirlist, const char **patternlist) { char buf[PATH_MAX + 1]; @@ -490,7 +490,7 @@ LoaderListDirs(const char **subdirlist, const char **patternlist) char **elem; const char **subdirs; const char **s; - PatternPtr patterns; + PatternPtr patterns = NULL; PatternPtr p; DIR *d; struct dirent *dp; @@ -571,7 +571,7 @@ LoaderListDirs(const char **subdirlist, const char **patternlist) FreePatterns(patterns); FreeSubdirs(subdirs); FreePathList(pathlist); - return ret; + return (const char **) ret; } void @@ -761,10 +761,10 @@ AddSibling(ModuleDescPtr head, ModuleDescPtr new) return new; } -pointer -LoadSubModule(pointer _parent, const char *module, +void * +LoadSubModule(void *_parent, const char *module, const char **subdirlist, const char **patternlist, - pointer options, const XF86ModReqInfo * modreq, + void *options, const XF86ModReqInfo * modreq, int *errmaj, int *errmin) { ModuleDescPtr submod; @@ -838,12 +838,18 @@ static const char *compiled_in_modules[] = { "extmod", "dri", "dri2", +#if DRI3 + "dri3", +#endif +#if PRESENT + "present", +#endif NULL }; static ModuleDescPtr doLoadModule(const char *module, const char *path, const char **subdirlist, - const char **patternlist, pointer options, + const char **patternlist, void *options, const XF86ModReqInfo * modreq, int *errmaj, int *errmin) { XF86ModuleData *initdata = NULL; @@ -1071,7 +1077,7 @@ doLoadModule(const char *module, const char *path, const char **subdirlist, */ ModuleDescPtr LoadModule(const char *module, const char *path, const char **subdirlist, - const char **patternlist, pointer options, + const char **patternlist, void *options, const XF86ModReqInfo * modreq, int *errmaj, int *errmin) { return doLoadModule(module, path, subdirlist, patternlist, options, @@ -1079,7 +1085,7 @@ LoadModule(const char *module, const char *path, const char **subdirlist, } void -UnloadModule(pointer mod) +UnloadModule(void *mod) { UnloadModuleOrDriver((ModuleDescPtr) mod); } @@ -1115,7 +1121,7 @@ UnloadModuleOrDriver(ModuleDescPtr mod) } void -UnloadSubModule(pointer _mod) +UnloadSubModule(void *_mod) { ModuleDescPtr mod = (ModuleDescPtr) _mod; diff --git a/xserver/hw/xfree86/man/Makefile.am b/xserver/hw/xfree86/man/Makefile.am index 80e22cbab..5da404cbb 100644 --- a/xserver/hw/xfree86/man/Makefile.am +++ b/xserver/hw/xfree86/man/Makefile.am @@ -1,3 +1,10 @@ include $(top_srcdir)/manpages.am appman_PRE = Xorg.man fileman_PRE = xorg.conf.man xorg.conf.d.man + +if SUID_WRAPPER +appman_PRE += Xorg.wrap.man +fileman_PRE += Xwrapper.config.man +else +EXTRA_DIST += Xorg.wrap.man Xwrapper.config.man +endif diff --git a/xserver/hw/xfree86/man/Makefile.in b/xserver/hw/xfree86/man/Makefile.in index 88aa3aa69..312361398 100644 --- a/xserver/hw/xfree86/man/Makefile.in +++ b/xserver/hw/xfree86/man/Makefile.in @@ -52,6 +52,9 @@ build_triplet = @build@ host_triplet = @host@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(top_srcdir)/manpages.am +@SUID_WRAPPER_TRUE@am__append_1 = Xorg.wrap.man +@SUID_WRAPPER_TRUE@am__append_2 = Xwrapper.config.man +@SUID_WRAPPER_FALSE@am__append_3 = Xorg.wrap.man Xwrapper.config.man subdir = hw/xfree86/man ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ @@ -160,6 +163,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -204,6 +209,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -268,6 +277,7 @@ MAN_SUBSTS = @MAN_SUBSTS@ -e 's|__logdir__|$(logdir)|g' -e \ 's|__XKB_DFLT_OPTIONS__|$(XKB_DFLT_OPTIONS)|g' -e \ 's|__bundle_id_prefix__|$(BUNDLE_ID_PREFIX)|g' -e \ 's|__modulepath__|$(DEFAULT_MODULE_PATH)|g' -e \ + 's|__suid_wrapper_dir__|$(SUID_WRAPPER_DIR)|g' -e \ 's|__default_font_path__|$(COMPILEDDEFAULTFONTPATH)|g' -e \ '\|$(COMPILEDDEFAULTFONTPATH)| s|/,|/, |g' MISC_MAN_DIR = @MISC_MAN_DIR@ @@ -322,7 +332,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -331,6 +344,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -397,6 +411,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ @@ -481,11 +499,12 @@ fileman_DATA = $(fileman_PRE:man=$(FILE_MAN_SUFFIX)) # The calling Makefile should only contain man page targets # Otherwise the following three global variables may conflict -EXTRA_DIST = $(appman_PRE) $(driverman_PRE) $(fileman_PRE) +EXTRA_DIST = $(appman_PRE) $(driverman_PRE) $(fileman_PRE) \ + $(am__append_3) CLEANFILES = $(appman_DATA) $(driverman_DATA) $(fileman_DATA) SUFFIXES = .$(APP_MAN_SUFFIX) .$(DRIVER_MAN_SUFFIX) .$(FILE_MAN_SUFFIX) .man -appman_PRE = Xorg.man -fileman_PRE = xorg.conf.man xorg.conf.d.man +appman_PRE = Xorg.man $(am__append_1) +fileman_PRE = xorg.conf.man xorg.conf.d.man $(am__append_2) all: all-am .SUFFIXES: diff --git a/xserver/hw/xfree86/man/Xorg.man b/xserver/hw/xfree86/man/Xorg.man index a48c4e8dd..0d90d4745 100644 --- a/xserver/hw/xfree86/man/Xorg.man +++ b/xserver/hw/xfree86/man/Xorg.man @@ -309,9 +309,11 @@ Use the file called .I filename as the .B Xorg -server log file. The default log file is +server log file. The default log file when running as root is .BI __logdir__/Xorg. n .log -on most platforms, where +and for non root it is +.BI $XDG_DATA_HOME/xorg/Xorg. n .log +where .I n is the display number of the .B Xorg diff --git a/xserver/hw/xfree86/man/Xorg.wrap.man b/xserver/hw/xfree86/man/Xorg.wrap.man new file mode 100644 index 000000000..58937c74b --- /dev/null +++ b/xserver/hw/xfree86/man/Xorg.wrap.man @@ -0,0 +1,67 @@ +.\" Xwrapper.wrap.__appmansuffix__ +.\" +.\" Copyright 2014 Red Hat, Inc. +.\" +.\" Permission to use, copy, modify, distribute, and sell this software and its +.\" documentation for any purpose is hereby granted without fee, provided that +.\" the above copyright notice appear in all copies and that both that +.\" copyright notice and this permission notice appear in supporting +.\" documentation. +.\" +.\" The above copyright notice and this permission notice shall be included +.\" in all copies or substantial portions of the Software. +.\" +.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +.\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +.\" IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +.\" OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +.\" ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +.\" OTHER DEALINGS IN THE SOFTWARE. +.\" +.\" Except as contained in this notice, the name of The Open Group shall +.\" not be used in advertising or otherwise to promote the sale, use or +.\" other dealings in this Software without prior written authorization +.\" from The Open Group. +.\" +.\" shorthand for double quote that works everywhere. +.ds q \N'34' +.TH Xorg.wrap __appmansuffix__ __xorgversion__ +.SH NAME +Xorg.wrap \- Xorg X server binary wrapper +.SH DESCRIPTION +The Xorg X server may need root rights to function properly. To start the +Xorg X server with these rights your system is using a suid root wrapper +installed as __suid_wrapper_dir__/Xorg.wrap which will execute the real +X server which is installed as __suid_wrapper_dir__/Xorg.bin . +.PP +By default Xorg.wrap will autodetect if root rights are necessary, and +if not it will drop its elevated rights before starting the real X server. +By default Xorg.wrap will only allow executing the real X server from login +sessions on a physical console. + +.SH CONFIG FILE +Xorg.wrap's default behavior can be overridden from the +\fI__sysconfdir__/X11/Xwrapper.config\fP config file. Lines starting with a +\fB#\fP in Xwrapper.config are considered comments and will be ignored. Any +other non empty lines must take the form of \fBkey\fP = \fIvalue\fP. +.TP 8 +\fBallowed_users\fP = \fIrootonly\fP|\fIconsole\fP|\fIanybody\fP +Specify which users may start the X server through the wrapper. Use +\fIrootonly\fP to only allow root, use \fIconsole\fP to only allow users +logged into a physical console, and use \fIanybody\fP to allow anybody. +The default is \fIconsole\fP. +.TP 8 +\fBneeds_root_rights\fP = \fIyes\fP|\fIno\fP|\fIauto\fP +Configure if the wrapper should drop its elevated (root) rights before starting +the X server. Use \fIyes\fP to force execution as root, \fIno\fP to force +execution with all suid rights dropped, and \fIauto\fP to letter the wrapper +auto-detect. The default is \fIauto\fP. +.PP +When auto-detecting the wrapper will drop rights if kms graphics are available +and not drop them if no kms graphics are detected. If a system has multiple +graphics cards and some are not kms capable auto-detection may fail, +in this case manual configuration should be used. + +.SH "SEE ALSO" +Xorg X server information: \fIXorg\fP(1) diff --git a/xserver/hw/xfree86/man/Xwrapper.config.man b/xserver/hw/xfree86/man/Xwrapper.config.man new file mode 100644 index 000000000..5c777c940 --- /dev/null +++ b/xserver/hw/xfree86/man/Xwrapper.config.man @@ -0,0 +1 @@ +.so man__appmansuffix__/Xorg.wrap.__appmansuffix__ diff --git a/xserver/hw/xfree86/man/xorg.conf.man b/xserver/hw/xfree86/man/xorg.conf.man index 85f9f2ee1..bc33df197 100644 --- a/xserver/hw/xfree86/man/xorg.conf.man +++ b/xserver/hw/xfree86/man/xorg.conf.man @@ -171,6 +171,7 @@ The section names are: .BR "Extensions " "Extension enabling" .BR "InputDevice " "Input device description" .BR "InputClass " "Input class description" +.BR "OutputClass " "Output class description" .BR "Device " "Graphics device description" .BR "VideoAdaptor " "Xv video adaptor description" .BR "Monitor " "Monitor description" @@ -442,11 +443,15 @@ __modulepath__ .TP 7 .BI "LogFile \*q" path \*q sets the name of the Xorg server log file. -The default log file name is +The default log file name when running as root is .PP .RS 11 .RI __logdir__/Xorg. <n> .log .RE +and for non root it is +.RS 11 +.RI $XDG_DATA_HOME/xorg/Xorg. <n> .log +.RE .PP .RS 7 where @@ -1186,6 +1191,82 @@ entries. This optional entry specifies that the device should be ignored entirely, and not added to the server. This can be useful when the device is handled by another program and no X events should be generated. +.SH "OUTPUTCLASS SECTION" +The config file may have multiple +.B OutputClass +sections. +These sections are optional and are used to provide configuration for a +class of output devices as they are automatically added. +An output device can match more than one +.B OutputClass +section. +Each class can override settings from a previous class, so it is best to +arrange the sections with the most generic matches first. +.PP +.B OutputClass +sections have the following format: +.PP +.RS 4 +.nf +.B "Section \*qOutputClass\*q" +.BI " Identifier \*q" name \*q +.I " entries" +.I " ..." +.B "EndSection" +.fi +.RE +.PP +The +.B Identifier +entry is required in all +.B OutputClass +sections. +All other entries are optional. +.PP +The +.B Identifier +entry specifies the unique name for this output class. +The +.B Driver +entry specifies the name of the driver to use for this output device. +After all classes have been examined, the +.RI \*q outputdriver \*q +module from the first +.B Driver +entry will be enabled when using the loadable server. +.PP +When an output device is automatically added, its characteristics are +checked against all +.B OutputClass +sections. +Each section can contain optional entries to narrow the match of the class. +If none of the optional entries appear, the +.B OutputClass +section is generic and will match any output device. +If more than one of these entries appear, they all must match for the +configuration to apply. +.PP +The following list of tokens can be matched against attributes of the device. +An entry can be constructed to match attributes from different devices by +separating arguments with a '|' character. +.PP +For example: +.PP +.RS 4 +.nf +.B "Section \*qOutputClass\*q" +.B " Identifier \*qMy Class\*q" +.B " # kernel driver must be either foo or bar +.B " MatchDriver \*qfoo|bar\*q +.I " ..." +.B "EndSection" +.fi +.RE +.TP 7 +.BI "MatchDriver \*q" matchdriver \*q +Check the case-sensitive string +.RI \*q matchdriver \*q +against the kernel driver of the device. .SH "DEVICE SECTION" The config file may have multiple .B Device @@ -1374,6 +1455,14 @@ for the regular text mode. The frequency is specified in MHz. This is rarely used. .TP 7 +.BI "MatchSeat " "seat\-id" +Only apply this +.B Device +section if X server was started with +.B -seat +.I seat\-id +option. +.TP 7 .BI "Option \*qModeDebug\*q \*q" boolean \*q Enable printing of additional debugging information about modesetting to the server log. @@ -1896,6 +1985,14 @@ The only case where there is even a choice in this value is for depth 24, where some hardware supports both a packed 24 bit framebuffer layout and a sparse 32 bit framebuffer layout. .TP 7 +.BI "MatchSeat " "seat\-id" +Only apply this +.B Screen +section if X server was started with +.B -seat +.I seat\-id +option. +.TP 7 .B Options Various .B Option @@ -2291,6 +2388,14 @@ and the first two should normally be used to indicate the core pointer and core keyboard devices respectively. .RE .TP 7 +.BI "MatchSeat " "seat\-id" +Only apply this +.B ServerLayout +section if X server was started with +.B -seat +.I seat\-id +option. +.TP 7 .B Options In addition to the following, any option permitted in the .B ServerFlags diff --git a/xserver/hw/xfree86/modes/Makefile.in b/xserver/hw/xfree86/modes/Makefile.in index 678769e49..ffca81526 100644 --- a/xserver/hw/xfree86/modes/Makefile.in +++ b/xserver/hw/xfree86/modes/Makefile.in @@ -199,6 +199,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -243,6 +245,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -345,7 +351,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -354,6 +363,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -420,6 +430,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/hw/xfree86/modes/xf86Crtc.c b/xserver/hw/xfree86/modes/xf86Crtc.c index a441fd16a..87ba0b74e 100644 --- a/xserver/hw/xfree86/modes/xf86Crtc.c +++ b/xserver/hw/xfree86/modes/xf86Crtc.c @@ -185,10 +185,10 @@ xf86CrtcSetScreenSubpixelOrder(ScreenPtr pScreen) Bool has_none = FALSE; ScrnInfoPtr scrn = xf86ScreenToScrn(pScreen); xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); - int c, o; + int icrtc, o; - for (c = 0; c < xf86_config->num_crtc; c++) { - xf86CrtcPtr crtc = xf86_config->crtc[c]; + for (icrtc = 0; icrtc < xf86_config->num_crtc; icrtc++) { + xf86CrtcPtr crtc = xf86_config->crtc[icrtc]; for (o = 0; o < xf86_config->num_output; o++) { xf86OutputPtr output = xf86_config->output[o]; @@ -216,20 +216,20 @@ xf86CrtcSetScreenSubpixelOrder(ScreenPtr pScreen) SubPixelVerticalBGR, }; int rotate; - int c; + int sc; for (rotate = 0; rotate < 4; rotate++) if (crtc->rotation & (1 << rotate)) break; - for (c = 0; c < 4; c++) - if (circle[c] == subpixel_order) + for (sc = 0; sc < 4; sc++) + if (circle[sc] == subpixel_order) break; - c = (c + rotate) & 0x3; - if ((crtc->rotation & RR_Reflect_X) && !(c & 1)) - c ^= 2; - if ((crtc->rotation & RR_Reflect_Y) && (c & 1)) - c ^= 2; - subpixel_order = circle[c]; + sc = (sc + rotate) & 0x3; + if ((crtc->rotation & RR_Reflect_X) && !(sc & 1)) + sc ^= 2; + if ((crtc->rotation & RR_Reflect_Y) && (sc & 1)) + sc ^= 2; + subpixel_order = circle[sc]; break; } } @@ -379,7 +379,7 @@ xf86CrtcSetModeTransform(xf86CrtcPtr crtc, DisplayModePtr mode, crtc->transformPresent = saved_transform_present; } - free(adjusted_mode->name); + free((void *) adjusted_mode->name); free(adjusted_mode); if (didLock) @@ -564,8 +564,8 @@ static const char *direction[4] = { static Rotation xf86OutputInitialRotation(xf86OutputPtr output) { - char *rotate_name = xf86GetOptValString(output->options, - OPTION_ROTATE); + const char *rotate_name = xf86GetOptValString(output->options, + OPTION_ROTATE); int i; if (!rotate_name) { @@ -926,7 +926,6 @@ xf86PickCrtcs(ScrnInfoPtr scrn, xf86OutputPtr output; xf86CrtcPtr crtc; xf86CrtcPtr *crtcs; - xf86CrtcPtr best_crtc; int best_score; int score; int my_score; @@ -939,7 +938,6 @@ xf86PickCrtcs(ScrnInfoPtr scrn, * Compute score with this output disabled */ best_crtcs[n] = NULL; - best_crtc = NULL; best_score = xf86PickCrtcs(scrn, best_crtcs, modes, n + 1, width, height); if (modes[n] == NULL) return best_score; @@ -993,7 +991,6 @@ xf86PickCrtcs(ScrnInfoPtr scrn, score = my_score + xf86PickCrtcs(scrn, crtcs, modes, n + 1, width, height); if (score > best_score) { - best_crtc = crtc; best_score = score; memcpy(best_crtcs, crtcs, config->num_output * sizeof(xf86CrtcPtr)); } @@ -1087,8 +1084,8 @@ xf86UserConfiguredOutputs(ScrnInfoPtr scrn, DisplayModePtr * modes) for (o = 0; o < config->num_output; o++) { xf86OutputPtr output = config->output[o]; - char *position; - char *relative_name; + const char *position; + const char *relative_name; OutputOpts relation; int r; @@ -1145,8 +1142,8 @@ xf86InitialOutputPositions(ScrnInfoPtr scrn, DisplayModePtr * modes) }; xf86OutputPtr output = config->output[o]; xf86OutputPtr relative; - char *relative_name; - char *position; + const char *relative_name; + const char *position; OutputOpts relation; int r; @@ -1306,7 +1303,7 @@ xf86InitialPanning(ScrnInfoPtr scrn) for (o = 0; o < config->num_output; o++) { xf86OutputPtr output = config->output[o]; - char *panning = xf86GetOptValString(output->options, OPTION_PANNING); + const char *panning = xf86GetOptValString(output->options, OPTION_PANNING); int width, height, left, top; int track_width, track_height, track_left, track_top; int brdr[4]; @@ -1389,7 +1386,7 @@ xf86SortModes(DisplayModePtr input) for (o = output; o && (n = o->next); o = n) { if (!strcmp(o->name, n->name) && xf86ModesEqual(o, n)) { o->next = n->next; - free(n->name); + free((void *) n->name); free(n); n = o; } @@ -1403,10 +1400,10 @@ xf86SortModes(DisplayModePtr input) return output; } -static char * +static const char * preferredMode(ScrnInfoPtr pScrn, xf86OutputPtr output) { - char *preferred_mode = NULL; + const char *preferred_mode = NULL; /* Check for a configured preference for a particular mode */ preferred_mode = xf86GetOptValString(output->options, @@ -1610,7 +1607,7 @@ xf86ProbeOutputModes(ScrnInfoPtr scrn, int maxX, int maxY) xf86OutputPtr output = config->output[o]; DisplayModePtr mode; DisplayModePtr config_modes = NULL, output_modes, default_modes = NULL; - char *preferred_mode; + const char *preferred_mode; xf86MonPtr edid_monitor; XF86ConfMonitorPtr conf_monitor; MonRec mon_rec; @@ -1676,6 +1673,7 @@ xf86ProbeOutputModes(ScrnInfoPtr scrn, int maxX, int maxY) if (edid_monitor) { struct det_monrec_parameter p; struct disp_features *features = &edid_monitor->features; + struct cea_data_block *hdmi_db; /* if display is not continuous-frequency, don't add default modes */ if (!GTF_SUPPORTED(features->msc)) @@ -1688,6 +1686,16 @@ xf86ProbeOutputModes(ScrnInfoPtr scrn, int maxX, int maxY) p.sync_source = &sync_source; xf86ForEachDetailedBlock(edid_monitor, handle_detailed_monrec, &p); + + /* Look at the CEA HDMI vendor block for the max TMDS freq */ + hdmi_db = xf86MonitorFindHDMIBlock(edid_monitor); + if (hdmi_db && hdmi_db->len >= 7) { + int tmds_freq = hdmi_db->u.vendor.hdmi.max_tmds_clock * 5000; + xf86DrvMsg(scrn->scrnIndex, X_PROBED, + "HDMI max TMDS frequency %dKHz\n", tmds_freq); + if (tmds_freq > max_clock) + max_clock = tmds_freq; + } } if (xf86GetOptValFreq(output->options, OPTION_MIN_CLOCK, @@ -1833,10 +1841,6 @@ xf86ProbeOutputModes(ScrnInfoPtr scrn, int maxX, int maxY) * Copy one of the output mode lists to the ScrnInfo record */ -/* XXX where does this function belong? Here? */ -void - xf86RandR12GetOriginalVirtualSize(ScrnInfoPtr scrn, int *x, int *y); - static DisplayModePtr biggestMode(DisplayModePtr a, DisplayModePtr b) { @@ -2144,10 +2148,10 @@ xf86TargetPreferred(ScrnInfoPtr scrn, xf86CrtcConfigPtr config, } else { for (mode = output->probed_modes; mode; mode = mode->next) { - Rotation r = output->initial_rotation; + Rotation ir = output->initial_rotation; - if (xf86ModeWidth(mode, r) == pref_width && - xf86ModeHeight(mode, r) == pref_height) { + if (xf86ModeWidth(mode, ir) == pref_width && + xf86ModeHeight(mode, ir) == pref_height) { preferred[o] = mode; match = TRUE; } diff --git a/xserver/hw/xfree86/modes/xf86Crtc.h b/xserver/hw/xfree86/modes/xf86Crtc.h index c127d78af..eebe6f472 100644 --- a/xserver/hw/xfree86/modes/xf86Crtc.h +++ b/xserver/hw/xfree86/modes/xf86Crtc.h @@ -188,12 +188,16 @@ typedef struct _xf86CrtcFuncs { */ void (*load_cursor_image) (xf86CrtcPtr crtc, CARD8 *image); + Bool + (*load_cursor_image_check) (xf86CrtcPtr crtc, CARD8 *image); /** * Load ARGB image */ void (*load_cursor_argb) (xf86CrtcPtr crtc, CARD32 *image); + Bool + (*load_cursor_argb_check) (xf86CrtcPtr crtc, CARD32 *image); /** * Clean up driver-specific bits of the crtc diff --git a/xserver/hw/xfree86/modes/xf86Cursors.c b/xserver/hw/xfree86/modes/xf86Cursors.c index 2b0db3492..379a27a76 100644 --- a/xserver/hw/xfree86/modes/xf86Cursors.c +++ b/xserver/hw/xfree86/modes/xf86Cursors.c @@ -209,9 +209,43 @@ set_bit(CARD8 *image, xf86CursorInfoPtr cursor_info, int x, int y, Bool mask) } /* + * Wrappers to deal with API compatibility with drivers that don't expose + * load_cursor_*_check + */ +static inline Bool +xf86_driver_has_load_cursor_image(xf86CrtcPtr crtc) +{ + return crtc->funcs->load_cursor_image_check || crtc->funcs->load_cursor_image; +} + +static inline Bool +xf86_driver_has_load_cursor_argb(xf86CrtcPtr crtc) +{ + return crtc->funcs->load_cursor_argb_check || crtc->funcs->load_cursor_argb; +} + +static inline Bool +xf86_driver_load_cursor_image(xf86CrtcPtr crtc, CARD8 *cursor_image) +{ + if (crtc->funcs->load_cursor_image_check) + return crtc->funcs->load_cursor_image_check(crtc, cursor_image); + crtc->funcs->load_cursor_image(crtc, cursor_image); + return TRUE; +} + +static inline Bool +xf86_driver_load_cursor_argb(xf86CrtcPtr crtc, CARD32 *cursor_argb) +{ + if (crtc->funcs->load_cursor_argb_check) + return crtc->funcs->load_cursor_argb_check(crtc, cursor_argb); + crtc->funcs->load_cursor_argb(crtc, cursor_argb); + return TRUE; +} + +/* * Load a two color cursor into a driver that supports only ARGB cursors */ -static void +static Bool xf86_crtc_convert_cursor_to_argb(xf86CrtcPtr crtc, unsigned char *src) { ScrnInfoPtr scrn = crtc->scrn; @@ -244,7 +278,7 @@ xf86_crtc_convert_cursor_to_argb(xf86CrtcPtr crtc, unsigned char *src) bits = 0; cursor_image[y * cursor_info->MaxWidth + x] = bits; } - crtc->funcs->load_cursor_argb(crtc, cursor_image); + return xf86_driver_load_cursor_argb(crtc, cursor_image); } /* @@ -269,7 +303,7 @@ xf86_set_cursor_colors(ScrnInfoPtr scrn, int bg, int fg) xf86CrtcPtr crtc = xf86_config->crtc[c]; if (crtc->enabled && !crtc->cursor_argb) { - if (crtc->funcs->load_cursor_image) + if (xf86_driver_has_load_cursor_image(crtc)) crtc->funcs->set_cursor_colors(crtc, bg, fg); else if (bits) xf86_crtc_convert_cursor_to_argb(crtc, bits); @@ -415,7 +449,7 @@ xf86_set_cursor_position(ScrnInfoPtr scrn, int x, int y) /* * Load a two-color cursor into a crtc, performing rotation as needed */ -static void +static Bool xf86_crtc_load_cursor_image(xf86CrtcPtr crtc, CARD8 *src) { ScrnInfoPtr scrn = crtc->scrn; @@ -450,13 +484,13 @@ xf86_crtc_load_cursor_image(xf86CrtcPtr crtc, CARD8 *src) set_bit(cursor_image, cursor_info, x, y, TRUE); } } - crtc->funcs->load_cursor_image(crtc, cursor_image); + return xf86_driver_load_cursor_image(crtc, cursor_image); } /* * Load a cursor image into all active CRTCs */ -static void +static Bool xf86_load_cursor_image(ScrnInfoPtr scrn, unsigned char *src) { xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); @@ -466,12 +500,17 @@ xf86_load_cursor_image(ScrnInfoPtr scrn, unsigned char *src) xf86CrtcPtr crtc = xf86_config->crtc[c]; if (crtc->enabled) { - if (crtc->funcs->load_cursor_image) - xf86_crtc_load_cursor_image(crtc, src); - else if (crtc->funcs->load_cursor_argb) - xf86_crtc_convert_cursor_to_argb(crtc, src); + if (xf86_driver_has_load_cursor_image(crtc)) { + if (!xf86_crtc_load_cursor_image(crtc, src)) + return FALSE; + } else if (xf86_driver_has_load_cursor_argb(crtc)) { + if (!xf86_crtc_convert_cursor_to_argb(crtc, src)) + return FALSE; + } else + return FALSE; } } + return TRUE; } static Bool @@ -516,7 +555,7 @@ xf86_use_hw_cursor_argb(ScreenPtr screen, CursorPtr cursor) return TRUE; } -static void +static Bool xf86_crtc_load_cursor_argb(xf86CrtcPtr crtc, CursorPtr cursor) { ScrnInfoPtr scrn = crtc->scrn; @@ -544,10 +583,10 @@ xf86_crtc_load_cursor_argb(xf86CrtcPtr crtc, CursorPtr cursor) cursor_image[y * image_width + x] = bits; } - crtc->funcs->load_cursor_argb(crtc, cursor_image); + return xf86_driver_load_cursor_argb(crtc, cursor_image); } -static void +static Bool xf86_load_cursor_argb(ScrnInfoPtr scrn, CursorPtr cursor) { xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); @@ -557,8 +596,10 @@ xf86_load_cursor_argb(ScrnInfoPtr scrn, CursorPtr cursor) xf86CrtcPtr crtc = xf86_config->crtc[c]; if (crtc->enabled) - xf86_crtc_load_cursor_argb(crtc, cursor); + if (!xf86_crtc_load_cursor_argb(crtc, cursor)) + return FALSE; } + return TRUE; } Bool @@ -587,14 +628,14 @@ xf86_cursors_init(ScreenPtr screen, int max_width, int max_height, int flags) cursor_info->SetCursorColors = xf86_set_cursor_colors; cursor_info->SetCursorPosition = xf86_set_cursor_position; - cursor_info->LoadCursorImage = xf86_load_cursor_image; + cursor_info->LoadCursorImageCheck = xf86_load_cursor_image; cursor_info->HideCursor = xf86_hide_cursors; cursor_info->ShowCursor = xf86_show_cursors; cursor_info->UseHWCursor = xf86_use_hw_cursor; #ifdef ARGB_CURSOR if (flags & HARDWARE_CURSOR_ARGB) { cursor_info->UseHWCursorARGB = xf86_use_hw_cursor_argb; - cursor_info->LoadCursorARGB = xf86_load_cursor_argb; + cursor_info->LoadCursorARGBCheck = xf86_load_cursor_argb; } #endif @@ -608,6 +649,8 @@ xf86_cursors_init(ScreenPtr screen, int max_width, int max_height, int flags) * Called when anything on the screen is reconfigured. * * Reloads cursor images as needed, then adjusts cursor positions + * @note We assume that all hardware cursors to be loaded have already been + * found to be usable by the hardware. */ void @@ -649,11 +692,11 @@ xf86_reload_cursors(ScreenPtr screen) dixLookupScreenPrivate(&cursor->devPrivates, CursorScreenKey, screen); #ifdef ARGB_CURSOR - if (cursor->bits->argb && cursor_info->LoadCursorARGB) - (*cursor_info->LoadCursorARGB) (scrn, cursor); + if (cursor->bits->argb && xf86DriverHasLoadCursorARGB(cursor_info)) + xf86DriverLoadCursorARGB(cursor_info, cursor); else if (src) #endif - (*cursor_info->LoadCursorImage) (scrn, src); + xf86DriverLoadCursorImage(cursor_info, src); x += scrn->frameX0 + cursor_screen_priv->HotX; y += scrn->frameY0 + cursor_screen_priv->HotY; diff --git a/xserver/hw/xfree86/modes/xf86EdidModes.c b/xserver/hw/xfree86/modes/xf86EdidModes.c index 4ee862da0..6fb0f9b92 100644 --- a/xserver/hw/xfree86/modes/xf86EdidModes.c +++ b/xserver/hw/xfree86/modes/xf86EdidModes.c @@ -162,6 +162,11 @@ quirk_detailed_use_maximum_size(int scrnIndex, xf86MonPtr DDC) DDC->vendor.prod_id == 0x7f01) return TRUE; + /* Sony Vaio Pro 13 */ + if (memcmp(DDC->vendor.name, "MEI", 4) == 0 && + DDC->vendor.prod_id == 0x96a2) + return TRUE; + return FALSE; } @@ -973,11 +978,11 @@ handle_cea_svd(struct cea_video_block *video, void *data) } static DisplayModePtr -DDCModesFromCEAExtension(int scrnIndex, xf86MonPtr MonPtr) +DDCModesFromCEAExtension(int scrnIndex, xf86MonPtr mon_ptr) { DisplayModePtr Modes = NULL; - xf86ForEachVideoBlock(MonPtr, handle_cea_svd, &Modes); + xf86ForEachVideoBlock(mon_ptr, handle_cea_svd, &Modes); return Modes; } diff --git a/xserver/hw/xfree86/modes/xf86Modes.c b/xserver/hw/xfree86/modes/xf86Modes.c index c4a3eb0a3..43b223307 100644 --- a/xserver/hw/xfree86/modes/xf86Modes.c +++ b/xserver/hw/xfree86/modes/xf86Modes.c @@ -129,11 +129,13 @@ void xf86SetModeDefaultName(DisplayModePtr mode) { Bool interlaced = ! !(mode->Flags & V_INTERLACE); + char *tmp; - free(mode->name); + free((void *) mode->name); - XNFasprintf(&mode->name, "%dx%d%s", mode->HDisplay, mode->VDisplay, + XNFasprintf(&tmp, "%dx%d%s", mode->HDisplay, mode->VDisplay, interlaced ? "i" : ""); + mode->name = tmp; } /* diff --git a/xserver/hw/xfree86/modes/xf86RandR12.c b/xserver/hw/xfree86/modes/xf86RandR12.c index 019b41609..4075f6c49 100644 --- a/xserver/hw/xfree86/modes/xf86RandR12.c +++ b/xserver/hw/xfree86/modes/xf86RandR12.c @@ -454,7 +454,6 @@ xf86RandR12GetInfo(ScreenPtr pScreen, Rotation * rotations) ScrnInfoPtr scrp = xf86ScreenToScrn(pScreen); XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); DisplayModePtr mode; - int refresh0 = 60; int maxX = 0, maxY = 0; *rotations = randrp->supported_rotations; @@ -479,8 +478,6 @@ xf86RandR12GetInfo(ScreenPtr pScreen, Rotation * rotations) if (maxY < mode->VDisplay) maxY = mode->VDisplay; } - if (mode == scrp->modes) - refresh0 = refresh; pSize = RRRegisterSize(pScreen, mode->HDisplay, mode->VDisplay, randrp->mmWidth, randrp->mmHeight); @@ -684,7 +681,6 @@ xf86RandR12ScreenSetSize(ScreenPtr pScreen, WindowPtr pRoot = pScreen->root; PixmapPtr pScrnPix; Bool ret = FALSE; - Bool panning = FALSE; int c; if (xf86RandR12Key) { @@ -716,7 +712,6 @@ xf86RandR12ScreenSetSize(ScreenPtr pScreen, crtc->panningTrackingArea.y2 += height - pScreen->height; xf86RandR13VerifyPanningArea(crtc, width, height); xf86RandR13Pan(crtc, randrp->pointerX, randrp->pointerY); - panning = TRUE; } } @@ -947,8 +942,6 @@ xf86RandR12SetRotations(ScreenPtr pScreen, Rotation rotations) void xf86RandR12SetTransformSupport(ScreenPtr pScreen, Bool transforms) { - XF86RandRInfoPtr randrp; - #if RANDR_13_INTERFACE ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); int c; @@ -958,7 +951,6 @@ xf86RandR12SetTransformSupport(ScreenPtr pScreen, Bool transforms) if (xf86RandR12Key == NULL) return; - randrp = XF86RANDRINFO(pScreen); #if RANDR_13_INTERFACE for (c = 0; c < config->num_crtc; c++) { xf86CrtcPtr crtc = config->crtc[c]; @@ -1211,7 +1203,6 @@ xf86RandR12CrtcSet(ScreenPtr pScreen, if (randr_mode) { DisplayModeRec mode; - RRTransformPtr transform = RRCrtcGetTransform(randr_crtc); xf86RandRModeConvert(pScrn, randr_mode, &mode); if (!xf86CrtcSetModeTransform @@ -1266,12 +1257,13 @@ xf86RandR12CrtcSetGamma(ScreenPtr pScreen, RRCrtcPtr randr_crtc) CARD16 *tmp_ptr; tmp_ptr = - realloc(crtc->gamma_red, 3 * crtc->gamma_size * sizeof(CARD16)); + realloc(crtc->gamma_red, + 3 * randr_crtc->gammaSize * sizeof(CARD16)); if (!tmp_ptr) return FALSE; crtc->gamma_red = tmp_ptr; - crtc->gamma_green = crtc->gamma_red + crtc->gamma_size; - crtc->gamma_blue = crtc->gamma_green + crtc->gamma_size; + crtc->gamma_green = crtc->gamma_red + randr_crtc->gammaSize; + crtc->gamma_blue = crtc->gamma_green + randr_crtc->gammaSize; } crtc->gamma_size = randr_crtc->gammaSize; @@ -1456,7 +1448,6 @@ xf86RandR12SetInfo12(ScreenPtr pScreen) RRCrtcPtr *crtcs; int ncrtc; int o, c, l; - RRCrtcPtr randr_crtc; int nclone; clones = malloc(config->num_output * sizeof(RROutputPtr)); @@ -1469,11 +1460,6 @@ xf86RandR12SetInfo12(ScreenPtr pScreen) if (output->possible_crtcs & (1 << c)) crtcs[ncrtc++] = config->crtc[c]->randr_crtc; - if (output->crtc) - randr_crtc = output->crtc->randr_crtc; - else - randr_crtc = NULL; - if (!RROutputSetCrtcs(output->randr_output, crtcs, ncrtc)) { free(crtcs); free(clones); diff --git a/xserver/hw/xfree86/modes/xf86Rotate.c b/xserver/hw/xfree86/modes/xf86Rotate.c index 495af9ba7..0ddd8408e 100644 --- a/xserver/hw/xfree86/modes/xf86Rotate.c +++ b/xserver/hw/xfree86/modes/xf86Rotate.c @@ -229,13 +229,12 @@ xf86RotateRedisplay(ScreenPtr pScreen) static void xf86RotateBlockHandler(ScreenPtr pScreen, - pointer pTimeout, pointer pReadmask) + void *pTimeout, void *pReadmask) { ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); - Bool rotation_active; - rotation_active = xf86RotateRedisplay(pScreen); + xf86RotateRedisplay(pScreen); pScreen->BlockHandler = xf86_config->BlockHandler; (*pScreen->BlockHandler) (pScreen, pTimeout, pReadmask); /* cannot avoid re-wrapping until all wrapping is audited */ @@ -247,7 +246,6 @@ void xf86RotateDestroy(xf86CrtcPtr crtc) { ScrnInfoPtr pScrn = crtc->scrn; - ScreenPtr pScreen = xf86ScrnToScreen(pScrn); xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); int c; @@ -267,9 +265,6 @@ xf86RotateDestroy(xf86CrtcPtr crtc) * Clean up damage structures when no crtcs are rotated */ if (xf86_config->rotation_damage) { - DrawablePtr screenDrawable = NULL; - if (pScreen && pScreen->root) - screenDrawable = &pScreen->root->drawable; /* Free damage structure */ if (xf86_config->rotation_damage_registered) { xf86_config->rotation_damage_registered = FALSE; diff --git a/xserver/hw/xfree86/modes/xf86cvt.c b/xserver/hw/xfree86/modes/xf86cvt.c index de0784493..8b7bb8b03 100644 --- a/xserver/hw/xfree86/modes/xf86cvt.c +++ b/xserver/hw/xfree86/modes/xf86cvt.c @@ -89,6 +89,7 @@ xf86CVTMode(int HDisplay, int VDisplay, float VRefresh, Bool Reduced, int HDisplayRnd, HMargin; int VDisplayRnd, VMargin, VSync; float Interlace; /* Please rename this */ + char *tmp; /* CVT default is 60.0Hz */ if (!VRefresh) @@ -177,6 +178,7 @@ xf86CVTMode(int HDisplay, int VDisplay, float VRefresh, Bool Reduced, /* 10. Find number of lines in back porch */ VBackPorch = VSyncAndBackPorch - VSync; + (void) VBackPorch; /* 11. Find total number of lines in vertical field */ Mode->VTotal = VDisplayRnd + 2 * VMargin + VSyncAndBackPorch + Interlace @@ -282,7 +284,8 @@ xf86CVTMode(int HDisplay, int VDisplay, float VRefresh, Bool Reduced, if (Interlaced) Mode->VTotal *= 2; - XNFasprintf(&Mode->name, "%dx%d", HDisplay, VDisplay); + XNFasprintf(&tmp, "%dx%d", HDisplay, VDisplay); + Mode->name = tmp; if (Reduced) Mode->Flags |= V_PHSYNC | V_NVSYNC; diff --git a/xserver/hw/xfree86/modes/xf86gtf.c b/xserver/hw/xfree86/modes/xf86gtf.c index 23707b481..0a8078415 100644 --- a/xserver/hw/xfree86/modes/xf86gtf.c +++ b/xserver/hw/xfree86/modes/xf86gtf.c @@ -215,6 +215,7 @@ xf86GTFMode(int h_pixels, int v_lines, float freq, int interlaced, int margins) */ v_back_porch = vsync_plus_bp - V_SYNC_RQD; + (void) v_back_porch; /* 10. Find the total number of lines in Vertical field period: * @@ -253,6 +254,7 @@ xf86GTFMode(int h_pixels, int v_lines, float freq, int interlaced, int margins) */ v_frame_rate = interlaced ? v_field_rate / 2.0 : v_field_rate; + (void) v_frame_rate; /* 15. Find number of pixels in left margin: * diff --git a/xserver/hw/xfree86/os-support/Makefile.in b/xserver/hw/xfree86/os-support/Makefile.in index da5f4069a..bb0ca4840 100644 --- a/xserver/hw/xfree86/os-support/Makefile.in +++ b/xserver/hw/xfree86/os-support/Makefile.in @@ -227,6 +227,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -271,6 +273,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -373,7 +379,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -382,6 +391,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -448,6 +458,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/hw/xfree86/os-support/bsd/Makefile.in b/xserver/hw/xfree86/os-support/bsd/Makefile.in index 91667b259..4d956c0a4 100644 --- a/xserver/hw/xfree86/os-support/bsd/Makefile.in +++ b/xserver/hw/xfree86/os-support/bsd/Makefile.in @@ -197,6 +197,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -241,6 +243,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -343,7 +349,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -352,6 +361,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -418,6 +428,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/hw/xfree86/os-support/bsd/alpha_video.c b/xserver/hw/xfree86/os-support/bsd/alpha_video.c index 2da673c10..b1359dcfb 100644 --- a/xserver/hw/xfree86/os-support/bsd/alpha_video.c +++ b/xserver/hw/xfree86/os-support/bsd/alpha_video.c @@ -185,10 +185,10 @@ static int devMemFd = -1; #define DEV_APERTURE "/dev/xf86" #endif -static pointer mapVidMem(int, unsigned long, unsigned long, int); -static void unmapVidMem(int, pointer, unsigned long); -static pointer mapVidMemSparse(int, unsigned long, unsigned long, int); -static void unmapVidMemSparse(int, pointer, unsigned long); +static void *mapVidMem(int, unsigned long, unsigned long, int); +static void unmapVidMem(int, void *, unsigned long); +static void *mapVidMemSparse(int, unsigned long, unsigned long, int); +static void unmapVidMemSparse(int, void *, unsigned long); /* * Check if /dev/mem can be mmap'd. If it can't print a warning when @@ -199,7 +199,7 @@ checkDevMem(Bool warn) { static Bool devMemChecked = FALSE; int fd; - pointer base; + void *base; if (devMemChecked) return; @@ -291,10 +291,10 @@ xf86OSInitVidMem(VidMemInfoPtr pVidMem) pVidMem->initialised = TRUE; } -static pointer +static void * mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags) { - pointer base; + void *base; checkDevMem(FALSE); Base = Base & ((1L << 32) - 1); @@ -332,7 +332,7 @@ mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags) } static void -unmapVidMem(int ScreenNum, pointer Base, unsigned long Size) +unmapVidMem(int ScreenNum, void *Base, unsigned long Size) { munmap((caddr_t) Base, Size); } @@ -420,40 +420,40 @@ xf86DisableIO() #define vuip volatile unsigned int * -static pointer memSBase = 0; -static pointer memBase = 0; +static void *memSBase = 0; +static void *memBase = 0; -extern int readDense8(pointer Base, register unsigned long Offset); -extern int readDense16(pointer Base, register unsigned long Offset); -extern int readDense32(pointer Base, register unsigned long Offset); +extern int readDense8(void *Base, register unsigned long Offset); +extern int readDense16(void *Base, register unsigned long Offset); +extern int readDense32(void *Base, register unsigned long Offset); extern void - writeDenseNB8(int Value, pointer Base, register unsigned long Offset); + writeDenseNB8(int Value, void *Base, register unsigned long Offset); extern void - writeDenseNB16(int Value, pointer Base, register unsigned long Offset); + writeDenseNB16(int Value, void *Base, register unsigned long Offset); extern void - writeDenseNB32(int Value, pointer Base, register unsigned long Offset); + writeDenseNB32(int Value, void *Base, register unsigned long Offset); extern void - writeDense8(int Value, pointer Base, register unsigned long Offset); + writeDense8(int Value, void *Base, register unsigned long Offset); extern void - writeDense16(int Value, pointer Base, register unsigned long Offset); + writeDense16(int Value, void *Base, register unsigned long Offset); extern void - writeDense32(int Value, pointer Base, register unsigned long Offset); + writeDense32(int Value, void *Base, register unsigned long Offset); -static int readSparse8(pointer Base, register unsigned long Offset); -static int readSparse16(pointer Base, register unsigned long Offset); -static int readSparse32(pointer Base, register unsigned long Offset); +static int readSparse8(void *Base, register unsigned long Offset); +static int readSparse16(void *Base, register unsigned long Offset); +static int readSparse32(void *Base, register unsigned long Offset); static void - writeSparseNB8(int Value, pointer Base, register unsigned long Offset); + writeSparseNB8(int Value, void *Base, register unsigned long Offset); static void - writeSparseNB16(int Value, pointer Base, register unsigned long Offset); + writeSparseNB16(int Value, void *Base, register unsigned long Offset); static void - writeSparseNB32(int Value, pointer Base, register unsigned long Offset); + writeSparseNB32(int Value, void *Base, register unsigned long Offset); static void - writeSparse8(int Value, pointer Base, register unsigned long Offset); + writeSparse8(int Value, void *Base, register unsigned long Offset); static void - writeSparse16(int Value, pointer Base, register unsigned long Offset); + writeSparse16(int Value, void *Base, register unsigned long Offset); static void - writeSparse32(int Value, pointer Base, register unsigned long Offset); + writeSparse32(int Value, void *Base, register unsigned long Offset); #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) extern int sysarch(int, void *); @@ -477,7 +477,7 @@ sethae(u_int64_t hae) } #endif -static pointer +static void * mapVidMemSparse(int ScreenNum, unsigned long Base, unsigned long Size, int flags) { @@ -510,16 +510,16 @@ mapVidMemSparse(int ScreenNum, unsigned long Base, unsigned long Size, strerror(errno)); } } - return (pointer) ((unsigned long) memBase + Base); + return (void *) ((unsigned long) memBase + Base); } static void -unmapVidMemSparse(int ScreenNum, pointer Base, unsigned long Size) +unmapVidMemSparse(int ScreenNum, void *Base, unsigned long Size) { } static int -readSparse8(pointer Base, register unsigned long Offset) +readSparse8(void *Base, register unsigned long Offset) { register unsigned long result, shift; register unsigned long msb; @@ -540,7 +540,7 @@ readSparse8(pointer Base, register unsigned long Offset) } static int -readSparse16(pointer Base, register unsigned long Offset) +readSparse16(void *Base, register unsigned long Offset) { register unsigned long result, shift; register unsigned long msb; @@ -562,14 +562,14 @@ readSparse16(pointer Base, register unsigned long Offset) } static int -readSparse32(pointer Base, register unsigned long Offset) +readSparse32(void *Base, register unsigned long Offset) { mem_barrier(); return *(vuip) ((unsigned long) Base + (Offset)); } static void -writeSparse8(int Value, pointer Base, register unsigned long Offset) +writeSparse8(int Value, void *Base, register unsigned long Offset) { register unsigned long msb; register unsigned int b = Value & 0xffU; @@ -587,7 +587,7 @@ writeSparse8(int Value, pointer Base, register unsigned long Offset) } static void -writeSparse16(int Value, pointer Base, register unsigned long Offset) +writeSparse16(int Value, void *Base, register unsigned long Offset) { register unsigned long msb; register unsigned int w = Value & 0xffffU; @@ -607,7 +607,7 @@ writeSparse16(int Value, pointer Base, register unsigned long Offset) } static void -writeSparse32(int Value, pointer Base, register unsigned long Offset) +writeSparse32(int Value, void *Base, register unsigned long Offset) { write_mem_barrier(); *(vuip) ((unsigned long) Base + (Offset)) = Value; @@ -615,7 +615,7 @@ writeSparse32(int Value, pointer Base, register unsigned long Offset) } static void -writeSparseNB8(int Value, pointer Base, register unsigned long Offset) +writeSparseNB8(int Value, void *Base, register unsigned long Offset) { register unsigned long msb; register unsigned int b = Value & 0xffU; @@ -632,7 +632,7 @@ writeSparseNB8(int Value, pointer Base, register unsigned long Offset) } static void -writeSparseNB16(int Value, pointer Base, register unsigned long Offset) +writeSparseNB16(int Value, void *Base, register unsigned long Offset) { register unsigned long msb; register unsigned int w = Value & 0xffffU; @@ -650,29 +650,29 @@ writeSparseNB16(int Value, pointer Base, register unsigned long Offset) } static void -writeSparseNB32(int Value, pointer Base, register unsigned long Offset) +writeSparseNB32(int Value, void *Base, register unsigned long Offset) { *(vuip) ((unsigned long) Base + (Offset)) = Value; return; } -void (*xf86WriteMmio8) (int Value, pointer Base, unsigned long Offset) +void (*xf86WriteMmio8) (int Value, void *Base, unsigned long Offset) = writeDense8; -void (*xf86WriteMmio16) (int Value, pointer Base, unsigned long Offset) +void (*xf86WriteMmio16) (int Value, void *Base, unsigned long Offset) = writeDense16; -void (*xf86WriteMmio32) (int Value, pointer Base, unsigned long Offset) +void (*xf86WriteMmio32) (int Value, void *Base, unsigned long Offset) = writeDense32; -void (*xf86WriteMmioNB8) (int Value, pointer Base, unsigned long Offset) +void (*xf86WriteMmioNB8) (int Value, void *Base, unsigned long Offset) = writeDenseNB8; -void (*xf86WriteMmioNB16) (int Value, pointer Base, unsigned long Offset) +void (*xf86WriteMmioNB16) (int Value, void *Base, unsigned long Offset) = writeDenseNB16; -void (*xf86WriteMmioNB32) (int Value, pointer Base, unsigned long Offset) +void (*xf86WriteMmioNB32) (int Value, void *Base, unsigned long Offset) = writeDenseNB32; -int (*xf86ReadMmio8) (pointer Base, unsigned long Offset) +int (*xf86ReadMmio8) (void *Base, unsigned long Offset) = readDense8; -int (*xf86ReadMmio16) (pointer Base, unsigned long Offset) +int (*xf86ReadMmio16) (void *Base, unsigned long Offset) = readDense16; -int (*xf86ReadMmio32) (pointer Base, unsigned long Offset) +int (*xf86ReadMmio32) (void *Base, unsigned long Offset) = readDense32; /* diff --git a/xserver/hw/xfree86/os-support/bsd/arm_video.c b/xserver/hw/xfree86/os-support/bsd/arm_video.c index ea4e50455..0e66d1477 100644 --- a/xserver/hw/xfree86/os-support/bsd/arm_video.c +++ b/xserver/hw/xfree86/os-support/bsd/arm_video.c @@ -1,5 +1,5 @@ /* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/ppc_video.c,v 1.6 2003/10/07 23:14:55 herrb Exp $ */ -/* $OpenBSD: arm_video.c,v 1.10 2013/06/07 17:28:52 matthieu Exp $ */ +/* $OpenBSD: arm_video.c,v 1.11 2014/09/27 17:53:02 matthieu Exp $ */ /* * Copyright 1992 by Rich Murphey <Rich@Rice.edu> * Copyright 1993 by David Wexelblat <dwex@goblin.org> @@ -87,8 +87,8 @@ #define DEV_MEM "/dev/xf86" #endif -static pointer ppcMapVidMem(int, unsigned long, unsigned long, int flags); -static void ppcUnmapVidMem(int, pointer, unsigned long); +static void* ppcMapVidMem(int, unsigned long, unsigned long, int flags); +static void ppcUnmapVidMem(int, void *, unsigned long); void xf86OSInitVidMem(VidMemInfoPtr pVidMem) @@ -102,11 +102,11 @@ xf86OSInitVidMem(VidMemInfoPtr pVidMem) volatile unsigned char *ioBase = MAP_FAILED; -static pointer +static void* ppcMapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags) { int fd = xf86Info.consoleFd; - pointer base; + void *base; #ifdef DEBUG xf86MsgVerb(X_INFO, 3, "mapVidMem %lx, %lx, fd = %d", Base, Size, fd); @@ -124,7 +124,7 @@ ppcMapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags) } static void -ppcUnmapVidMem(int ScreenNum, pointer Base, unsigned long Size) +ppcUnmapVidMem(int ScreenNum, void *Base, unsigned long Size) { munmap(Base, Size); diff --git a/xserver/hw/xfree86/os-support/bsd/bsd_apm.c b/xserver/hw/xfree86/os-support/bsd/bsd_apm.c index b1938cf0d..1b929625e 100644 --- a/xserver/hw/xfree86/os-support/bsd/bsd_apm.c +++ b/xserver/hw/xfree86/os-support/bsd/bsd_apm.c @@ -14,7 +14,7 @@ #define APM_DEVICE "/dev/apm" -static pointer APMihPtr = NULL; +static void *APMihPtr = NULL; static void bsdCloseAPM(void); static struct { diff --git a/xserver/hw/xfree86/os-support/bsd/bsd_ev56.c b/xserver/hw/xfree86/os-support/bsd/bsd_ev56.c index 645377ed6..320bb23b6 100644 --- a/xserver/hw/xfree86/os-support/bsd/bsd_ev56.c +++ b/xserver/hw/xfree86/os-support/bsd/bsd_ev56.c @@ -22,77 +22,77 @@ */ __asm(".arch ev56"); -int readDense8(pointer Base, register unsigned long Offset); -int readDense16(pointer Base, register unsigned long Offset); -int readDense32(pointer Base, register unsigned long Offset); +int readDense8(void *Base, register unsigned long Offset); +int readDense16(void *Base, register unsigned long Offset); +int readDense32(void *Base, register unsigned long Offset); void - writeDenseNB8(int Value, pointer Base, register unsigned long Offset); + writeDenseNB8(int Value, void *Base, register unsigned long Offset); void - writeDenseNB16(int Value, pointer Base, register unsigned long Offset); + writeDenseNB16(int Value, void *Base, register unsigned long Offset); void - writeDenseNB32(int Value, pointer Base, register unsigned long Offset); + writeDenseNB32(int Value, void *Base, register unsigned long Offset); void - writeDense8(int Value, pointer Base, register unsigned long Offset); + writeDense8(int Value, void *Base, register unsigned long Offset); void - writeDense16(int Value, pointer Base, register unsigned long Offset); + writeDense16(int Value, void *Base, register unsigned long Offset); void - writeDense32(int Value, pointer Base, register unsigned long Offset); + writeDense32(int Value, void *Base, register unsigned long Offset); int -readDense8(pointer Base, register unsigned long Offset) +readDense8(void *Base, register unsigned long Offset) { mem_barrier(); - return (alpha_ldbu((pointer) ((unsigned long) Base + (Offset)))); + return (alpha_ldbu((void *) ((unsigned long) Base + (Offset)))); } int -readDense16(pointer Base, register unsigned long Offset) +readDense16(void *Base, register unsigned long Offset) { mem_barrier(); - return (alpha_ldwu((pointer) ((unsigned long) Base + (Offset)))); + return (alpha_ldwu((void *) ((unsigned long) Base + (Offset)))); } int -readDense32(pointer Base, register unsigned long Offset) +readDense32(void *Base, register unsigned long Offset) { mem_barrier(); return *(volatile CARD32 *) ((unsigned long) Base + (Offset)); } void -writeDenseNB8(int Value, pointer Base, register unsigned long Offset) +writeDenseNB8(int Value, void *Base, register unsigned long Offset) { - alpha_stb((pointer) ((unsigned long) Base + (Offset)), Value); + alpha_stb((void *) ((unsigned long) Base + (Offset)), Value); } void -writeDenseNB16(int Value, pointer Base, register unsigned long Offset) +writeDenseNB16(int Value, void *Base, register unsigned long Offset) { - alpha_stw((pointer) ((unsigned long) Base + (Offset)), Value); + alpha_stw((void *) ((unsigned long) Base + (Offset)), Value); } void -writeDenseNB32(int Value, pointer Base, register unsigned long Offset) +writeDenseNB32(int Value, void *Base, register unsigned long Offset) { *(volatile CARD32 *) ((unsigned long) Base + (Offset)) = Value; } void -writeDense8(int Value, pointer Base, register unsigned long Offset) +writeDense8(int Value, void *Base, register unsigned long Offset) { write_mem_barrier(); - alpha_stb((pointer) ((unsigned long) Base + (Offset)), Value); + alpha_stb((void *) ((unsigned long) Base + (Offset)), Value); } void -writeDense16(int Value, pointer Base, register unsigned long Offset) +writeDense16(int Value, void *Base, register unsigned long Offset) { write_mem_barrier(); - alpha_stw((pointer) ((unsigned long) Base + (Offset)), Value); + alpha_stw((void *) ((unsigned long) Base + (Offset)), Value); } void -writeDense32(int Value, pointer Base, register unsigned long Offset) +writeDense32(int Value, void *Base, register unsigned long Offset) { write_mem_barrier(); *(volatile CARD32 *) ((unsigned long) Base + (Offset)) = Value; diff --git a/xserver/hw/xfree86/os-support/bsd/bsd_kqueue_apm.c b/xserver/hw/xfree86/os-support/bsd/bsd_kqueue_apm.c index 8417c335a..b82c2ff7c 100644 --- a/xserver/hw/xfree86/os-support/bsd/bsd_kqueue_apm.c +++ b/xserver/hw/xfree86/os-support/bsd/bsd_kqueue_apm.c @@ -45,7 +45,7 @@ #define _PATH_APM_DEV "/dev/apm" #define _PATH_APM_CTLDEV "/dev/apmctl" -static pointer APMihPtr = NULL; +static void *APMihPtr = NULL; static int devFd = -1; static int ctlFd = -1; static void bsdCloseAPM(void); diff --git a/xserver/hw/xfree86/os-support/bsd/bsd_sbus.c b/xserver/hw/xfree86/os-support/bsd/bsd_sbus.c index 883b2728a..87a8ddf2b 100644 --- a/xserver/hw/xfree86/os-support/bsd/bsd_sbus.c +++ b/xserver/hw/xfree86/os-support/bsd/bsd_sbus.c @@ -157,14 +157,14 @@ xf86SbusUseBuiltinMode(ScrnInfoPtr pScrn, sbusDevicePtr psdp) pScrn->virtualY = wdf.height; } -_X_EXPORT pointer +_X_EXPORT void * xf86MapSbusMem(sbusDevicePtr psdp, unsigned long Base, unsigned long Size) { return xf86MapVidMem(0, 0, Base, Size); } _X_EXPORT void -xf86UnmapSbusMem(sbusDevicePtr psdp, pointer Base, unsigned long Size) +xf86UnmapSbusMem(sbusDevicePtr psdp, void *Base, unsigned long Size) { xf86UnMapVidMem(0, Base, Size); } diff --git a/xserver/hw/xfree86/os-support/bsd/hppa_video.c b/xserver/hw/xfree86/os-support/bsd/hppa_video.c index 2938b1d26..4f4a1a70a 100644 --- a/xserver/hw/xfree86/os-support/bsd/hppa_video.c +++ b/xserver/hw/xfree86/os-support/bsd/hppa_video.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hppa_video.c,v 1.8 2013/06/07 17:28:52 matthieu Exp $ */ +/* $OpenBSD: hppa_video.c,v 1.9 2014/09/27 17:53:02 matthieu Exp $ */ /* * Copyright 1992 by Rich Murphey <Rich@Rice.edu> * Copyright 1993 by David Wexelblat <dwex@goblin.org> @@ -44,8 +44,8 @@ /* Video Memory Mapping section */ /***************************************************************************/ -static pointer hppaMapVidMem(int, unsigned long, unsigned long, int); -static void hppaUnmapVidMem(int, pointer, unsigned long); +static void *hppaMapVidMem(int, unsigned long, unsigned long, int); +static void hppaUnmapVidMem(int, void *, unsigned long); void @@ -65,11 +65,11 @@ xf86OSInitVidMem(VidMemInfoPtr pVidMem) volatile unsigned char *ioBase = MAP_FAILED; -static pointer +static void * hppaMapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags) { int fd = xf86Info.consoleFd; - pointer base; + void *base; #ifdef DEBUG xf86MsgVerb(X_INFO, 3, "mapVidMem %lx, %lx, fd = %d\n", @@ -86,7 +86,7 @@ hppaMapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags) static void -hppaUnmapVidMem(int ScreenNum, pointer Base, unsigned long Size) +hppaUnmapVidMem(int ScreenNum, void *Base, unsigned long Size) { munmap(Base, Size); diff --git a/xserver/hw/xfree86/os-support/bsd/i386_video.c b/xserver/hw/xfree86/os-support/bsd/i386_video.c index 3141e27c1..359e72ba6 100644 --- a/xserver/hw/xfree86/os-support/bsd/i386_video.c +++ b/xserver/hw/xfree86/os-support/bsd/i386_video.c @@ -84,18 +84,18 @@ static int devMemFd = -1; #define DEV_APERTURE "/dev/xf86" #endif -static pointer mapVidMem(int, unsigned long, unsigned long, int); -static void unmapVidMem(int, pointer, unsigned long); +static void *mapVidMem(int, unsigned long, unsigned long, int); +static void unmapVidMem(int, void *, unsigned long); #ifdef HAS_MTRR_SUPPORT -static pointer setWC(int, unsigned long, unsigned long, Bool, MessageType); -static void undoWC(int, pointer); +static void *setWC(int, unsigned long, unsigned long, Bool, MessageType); +static void undoWC(int, void *); static Bool cleanMTRR(void); #endif #if defined(HAS_MTRR_BUILTIN) && defined(__NetBSD__) -static pointer NetBSDsetWC(int, unsigned long, unsigned long, Bool, +static void *NetBSDsetWC(int, unsigned long, unsigned long, Bool, MessageType); -static void NetBSDundoWC(int, pointer); +static void NetBSDundoWC(int, void *); #endif /* @@ -107,8 +107,8 @@ checkDevMem(Bool warn) { static Bool devMemChecked = FALSE; int fd; - pointer base; - + void *base; + if (devMemChecked) return; devMemChecked = TRUE; @@ -202,11 +202,11 @@ xf86OSInitVidMem(VidMemInfoPtr pVidMem) pVidMem->initialised = TRUE; } -static pointer +static void * mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags) { - pointer base; - + void *base; + checkDevMem(FALSE); if (useDevMem) { @@ -244,7 +244,7 @@ mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags) } static void -unmapVidMem(int ScreenNum, pointer Base, unsigned long Size) +unmapVidMem(int ScreenNum, void *Base, unsigned long Size) { munmap((caddr_t) Base, Size); } @@ -686,7 +686,7 @@ fullCoverage(unsigned long base, unsigned long size, RangePtr overlap) return FALSE; } -static pointer +static void * addWC(int screenNum, unsigned long base, unsigned long size, MessageType from) { RangePtr uc = NULL, wc = NULL, retlist = NULL; @@ -727,7 +727,7 @@ addWC(int screenNum, unsigned long base, unsigned long size, MessageType from) } } -static pointer +static void * delWC(int screenNum, unsigned long base, unsigned long size, MessageType from) { RangePtr uc = NULL, wc = NULL, retlist = NULL; @@ -773,7 +773,7 @@ delWC(int screenNum, unsigned long base, unsigned long size, MessageType from) } } -static pointer +static void * setWC(int screenNum, unsigned long base, unsigned long size, Bool enable, MessageType from) { @@ -784,7 +784,7 @@ setWC(int screenNum, unsigned long base, unsigned long size, Bool enable, } static void -undoWC(int screenNum, pointer list) +undoWC(int screenNum, void *list) { RangePtr rp; struct mem_range_op mro; @@ -832,7 +832,7 @@ undoWC(int screenNum, pointer list) #endif /* HAS_MTRR_SUPPORT */ #if defined(HAS_MTRR_BUILTIN) && defined(__NetBSD__) -static pointer +static void * NetBSDsetWC(int screenNum, unsigned long base, unsigned long size, Bool enable, MessageType from) { @@ -868,7 +868,7 @@ NetBSDsetWC(int screenNum, unsigned long base, unsigned long size, Bool enable, } static void -NetBSDundoWC(int screenNum, pointer list) +NetBSDundoWC(int screenNum, void *list) { struct mtrr *mtrrp = (struct mtrr *) list; int n; diff --git a/xserver/hw/xfree86/os-support/bsd/ppc_video.c b/xserver/hw/xfree86/os-support/bsd/ppc_video.c index 548cb3644..06903692b 100644 --- a/xserver/hw/xfree86/os-support/bsd/ppc_video.c +++ b/xserver/hw/xfree86/os-support/bsd/ppc_video.c @@ -44,8 +44,8 @@ #define DEV_MEM "/dev/xf86" #endif -static pointer ppcMapVidMem(int, unsigned long, unsigned long, int flags); -static void ppcUnmapVidMem(int, pointer, unsigned long); +static void *ppcMapVidMem(int, unsigned long, unsigned long, int flags); +static void ppcUnmapVidMem(int, void *, unsigned long); #ifdef __NetBSD__ Bool xf86EnableIO(void); @@ -69,11 +69,11 @@ xf86OSInitVidMem(VidMemInfoPtr pVidMem) volatile unsigned char *ioBase = MAP_FAILED; -static pointer +static void * ppcMapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags) { int fd = xf86Info.consoleFd; - pointer base; + void *base; #ifdef DEBUG xf86MsgVerb(X_INFO, 3, "mapVidMem %lx, %lx, fd = %d", @@ -92,7 +92,7 @@ ppcMapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags) } static void -ppcUnmapVidMem(int ScreenNum, pointer Base, unsigned long Size) +ppcUnmapVidMem(int ScreenNum, void *Base, unsigned long Size) { munmap(Base, Size); } diff --git a/xserver/hw/xfree86/os-support/bsd/sgi_video.c b/xserver/hw/xfree86/os-support/bsd/sgi_video.c index 66d3d5f3b..ad30b3c27 100644 --- a/xserver/hw/xfree86/os-support/bsd/sgi_video.c +++ b/xserver/hw/xfree86/os-support/bsd/sgi_video.c @@ -42,8 +42,8 @@ /* Video Memory Mapping section */ /***************************************************************************/ -static pointer sgiMapVidMem(int, unsigned long, unsigned long, int); -static void sgiUnmapVidMem(int, pointer, unsigned long); +static void *sgiMapVidMem(int, unsigned long, unsigned long, int); +static void sgiUnmapVidMem(int, void *, unsigned long); void xf86OSInitVidMem(VidMemInfoPtr pVidMem) @@ -54,12 +54,12 @@ xf86OSInitVidMem(VidMemInfoPtr pVidMem) pVidMem->initialised = TRUE; } -static pointer +static void * sgiMapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags) { int fd = xf86Info.consoleFd; - pointer base; + void *base; #ifdef DEBUG xf86MsgVerb(X_INFO, 3, "mapVidMem %lx, %lx, fd = %d", @@ -77,7 +77,7 @@ sgiMapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, } static void -sgiUnmapVidMem(int ScreenNum, pointer Base, unsigned long Size) +sgiUnmapVidMem(int ScreenNum, void *Base, unsigned long Size) { munmap(Base, Size); } diff --git a/xserver/hw/xfree86/os-support/bsd/sparc64_video.c b/xserver/hw/xfree86/os-support/bsd/sparc64_video.c index c500f5e11..c701f4497 100644 --- a/xserver/hw/xfree86/os-support/bsd/sparc64_video.c +++ b/xserver/hw/xfree86/os-support/bsd/sparc64_video.c @@ -38,8 +38,8 @@ /* Video Memory Mapping section */ /***************************************************************************/ -static pointer sparc64MapVidMem(int, unsigned long, unsigned long, int); -static void sparc64UnmapVidMem(int, pointer, unsigned long); +static void *sparc64MapVidMem(int, unsigned long, unsigned long, int); +static void sparc64UnmapVidMem(int, void *, unsigned long); void xf86OSInitVidMem(VidMemInfoPtr pVidMem) @@ -53,12 +53,12 @@ xf86OSInitVidMem(VidMemInfoPtr pVidMem) pVidMem->initialised = TRUE; } -static pointer +static void * sparc64MapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags) { int fd = xf86Info.consoleFd; - pointer base; + void *base; #ifdef DEBUG xf86MsgVerb(X_INFO, 3, "mapVidMem %lx, %lx, fd = %d", Base, Size, fd); @@ -74,7 +74,7 @@ sparc64MapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, } static void -sparc64UnmapVidMem(int ScreenNum, pointer Base, unsigned long Size) +sparc64UnmapVidMem(int ScreenNum, void *Base, unsigned long Size) { munmap(Base, Size); } diff --git a/xserver/hw/xfree86/os-support/bus/Makefile.in b/xserver/hw/xfree86/os-support/bus/Makefile.in index 239093479..fd5e5f880 100644 --- a/xserver/hw/xfree86/os-support/bus/Makefile.in +++ b/xserver/hw/xfree86/os-support/bus/Makefile.in @@ -201,6 +201,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -245,6 +247,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -347,7 +353,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -356,6 +365,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -422,6 +432,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/hw/xfree86/os-support/bus/Sbus.c b/xserver/hw/xfree86/os-support/bus/Sbus.c index 14e6d4bfd..16ce5b58a 100644 --- a/xserver/hw/xfree86/os-support/bus/Sbus.c +++ b/xserver/hw/xfree86/os-support/bus/Sbus.c @@ -641,10 +641,10 @@ sparcPromPathname2Node(const char *pathName) return i; } -pointer +void * xf86MapSbusMem(sbusDevicePtr psdp, unsigned long offset, unsigned long size) { - pointer ret; + void *ret; unsigned long pagemask = getpagesize() - 1; unsigned long off = offset & ~pagemask; unsigned long len = ((offset + size + pagemask) & ~pagemask) - off; @@ -657,26 +657,26 @@ xf86MapSbusMem(sbusDevicePtr psdp, unsigned long offset, unsigned long size) else if (psdp->fd < 0) return NULL; - ret = (pointer) mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_PRIVATE, + ret = (void *) mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_PRIVATE, psdp->fd, off); - if (ret == (pointer) -1) { - ret = (pointer) mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_SHARED, + if (ret == (void *) -1) { + ret = (void *) mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_SHARED, psdp->fd, off); } - if (ret == (pointer) -1) + if (ret == (void *) -1) return NULL; return (char *) ret + (offset - off); } void -xf86UnmapSbusMem(sbusDevicePtr psdp, pointer addr, unsigned long size) +xf86UnmapSbusMem(sbusDevicePtr psdp, void *addr, unsigned long size) { unsigned long mask = getpagesize() - 1; unsigned long base = (unsigned long) addr & ~mask; unsigned long len = (((unsigned long) addr + size + mask) & ~mask) - base; - munmap((pointer) base, len); + munmap((void *) base, len); } /* Tell OS that we are driving the HW cursor ourselves. */ diff --git a/xserver/hw/xfree86/os-support/bus/nobus.c b/xserver/hw/xfree86/os-support/bus/nobus.c index dc36ecd0a..4872c5be8 100644 --- a/xserver/hw/xfree86/os-support/bus/nobus.c +++ b/xserver/hw/xfree86/os-support/bus/nobus.c @@ -1,4 +1,7 @@ -static void +void +__noop_to_appease_ar__(void); + +void __noop_to_appease_ar__(void) { return; diff --git a/xserver/hw/xfree86/os-support/hurd/Makefile.in b/xserver/hw/xfree86/os-support/hurd/Makefile.in index a885f8f8f..0bef8dd26 100644 --- a/xserver/hw/xfree86/os-support/hurd/Makefile.in +++ b/xserver/hw/xfree86/os-support/hurd/Makefile.in @@ -164,6 +164,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -208,6 +210,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -310,7 +316,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -319,6 +328,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -385,6 +395,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/hw/xfree86/os-support/hurd/hurd_video.c b/xserver/hw/xfree86/os-support/hurd/hurd_video.c index b3b94c9f2..dc1a8e670 100644 --- a/xserver/hw/xfree86/os-support/hurd/hurd_video.c +++ b/xserver/hw/xfree86/os-support/hurd/hurd_video.c @@ -42,7 +42,7 @@ /************************************************************************** * Video Memory Mapping section ***************************************************************************/ -static pointer +static void * mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int Flags) { mach_port_t device, mem_dev; @@ -89,11 +89,11 @@ mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int Flags) ("xf86MapVidMem() can't mach_port_deallocate.(mem_dev) (%s)\n", strerror(errno)); } - return (pointer) addr; + return (void *) addr; } static void -unmapVidMem(int ScreenNum, pointer Base, unsigned long Size) +unmapVidMem(int ScreenNum, void *Base, unsigned long Size) { kern_return_t err = vm_deallocate(mach_task_self(), (int) Base, Size); diff --git a/xserver/hw/xfree86/os-support/linux/Makefile.am b/xserver/hw/xfree86/os-support/linux/Makefile.am index 83e7e0027..1686dc2c1 100644 --- a/xserver/hw/xfree86/os-support/linux/Makefile.am +++ b/xserver/hw/xfree86/os-support/linux/Makefile.am @@ -21,6 +21,11 @@ APM_SRCS = lnx_apm.c XORG_CFLAGS += -DHAVE_APM endif +if SYSTEMD_LOGIND +LOGIND_SRCS = systemd-logind.c +XORG_CFLAGS += $(DBUS_CFLAGS) +endif + liblinux_la_SOURCES = lnx_init.c lnx_video.c \ lnx_agp.c lnx_kmod.c lnx_bell.c lnx_platform.c \ $(srcdir)/../shared/bios_mmap.c \ @@ -30,6 +35,7 @@ liblinux_la_SOURCES = lnx_init.c lnx_video.c \ $(srcdir)/../shared/sigio.c \ $(ACPI_SRCS) \ $(APM_SRCS) \ + $(LOGIND_SRCS) \ $(PLATFORM_PCI_SUPPORT) AM_CFLAGS = -DUSESTDRES -DHAVE_SYSV_IPC $(DIX_CFLAGS) $(XORG_CFLAGS) $(PLATFORM_DEFINES) diff --git a/xserver/hw/xfree86/os-support/linux/Makefile.in b/xserver/hw/xfree86/os-support/linux/Makefile.in index 675082a0c..3cff329a0 100644 --- a/xserver/hw/xfree86/os-support/linux/Makefile.in +++ b/xserver/hw/xfree86/os-support/linux/Makefile.in @@ -53,6 +53,7 @@ host_triplet = @host@ @LINUX_ALPHA_TRUE@am__append_1 = liblinuxev56.la @LNXACPI_TRUE@am__append_2 = -DHAVE_ACPI @LNXAPM_TRUE@am__append_3 = -DHAVE_APM +@SYSTEMD_LOGIND_TRUE@am__append_4 = $(DBUS_CFLAGS) subdir = hw/xfree86/os-support/linux DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(top_srcdir)/depcomp @@ -82,14 +83,16 @@ am__liblinux_la_SOURCES_DIST = lnx_init.c lnx_video.c lnx_agp.c \ $(srcdir)/../shared/bios_mmap.c $(srcdir)/../shared/VTsw_usl.c \ $(srcdir)/../shared/posix_tty.c $(srcdir)/../shared/vidmem.c \ $(srcdir)/../shared/sigio.c lnx_acpi.c lnx_apm.c \ - $(srcdir)/lnx_axp.c $(srcdir)/../shared/xf86Axp.c + systemd-logind.c $(srcdir)/lnx_axp.c \ + $(srcdir)/../shared/xf86Axp.c @LNXACPI_TRUE@am__objects_1 = lnx_acpi.lo lnx_apm.lo @LNXAPM_TRUE@am__objects_2 = lnx_apm.lo -@LINUX_ALPHA_TRUE@am__objects_3 = lnx_axp.lo xf86Axp.lo +@SYSTEMD_LOGIND_TRUE@am__objects_3 = systemd-logind.lo +@LINUX_ALPHA_TRUE@am__objects_4 = lnx_axp.lo xf86Axp.lo am_liblinux_la_OBJECTS = lnx_init.lo lnx_video.lo lnx_agp.lo \ lnx_kmod.lo lnx_bell.lo lnx_platform.lo bios_mmap.lo \ VTsw_usl.lo posix_tty.lo vidmem.lo sigio.lo $(am__objects_1) \ - $(am__objects_2) $(am__objects_3) + $(am__objects_2) $(am__objects_3) $(am__objects_4) liblinux_la_OBJECTS = $(am_liblinux_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) @@ -188,6 +191,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -232,6 +237,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -334,7 +343,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -343,6 +355,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -378,7 +391,8 @@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ -XORG_CFLAGS = @XORG_CFLAGS@ $(am__append_2) $(am__append_3) +XORG_CFLAGS = @XORG_CFLAGS@ $(am__append_2) $(am__append_3) \ + $(am__append_4) XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ @@ -409,6 +423,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ @@ -490,6 +508,7 @@ noinst_LTLIBRARIES = liblinux.la $(am__append_1) @LINUX_ALPHA_TRUE@liblinuxev56_la_SOURCES = lnx_ev56.c @LNXACPI_TRUE@ACPI_SRCS = lnx_acpi.c lnx_apm.c @LNXAPM_TRUE@APM_SRCS = lnx_apm.c +@SYSTEMD_LOGIND_TRUE@LOGIND_SRCS = systemd-logind.c liblinux_la_SOURCES = lnx_init.c lnx_video.c \ lnx_agp.c lnx_kmod.c lnx_bell.c lnx_platform.c \ $(srcdir)/../shared/bios_mmap.c \ @@ -499,6 +518,7 @@ liblinux_la_SOURCES = lnx_init.c lnx_video.c \ $(srcdir)/../shared/sigio.c \ $(ACPI_SRCS) \ $(APM_SRCS) \ + $(LOGIND_SRCS) \ $(PLATFORM_PCI_SUPPORT) AM_CFLAGS = -DUSESTDRES -DHAVE_SYSV_IPC $(DIX_CFLAGS) $(XORG_CFLAGS) $(PLATFORM_DEFINES) @@ -577,6 +597,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lnx_video.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/posix_tty.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sigio.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/systemd-logind.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vidmem.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86Axp.Plo@am__quote@ diff --git a/xserver/hw/xfree86/os-support/linux/int10/linux.c b/xserver/hw/xfree86/os-support/linux/int10/linux.c index 8bca37524..6181eb9c5 100644 --- a/xserver/hw/xfree86/os-support/linux/int10/linux.c +++ b/xserver/hw/xfree86/os-support/linux/int10/linux.c @@ -18,7 +18,7 @@ #define DEV_MEM "/dev/mem" #endif #define ALLOC_ENTRIES(x) ((V_RAM / x) - 1) -#define SHMERRORPTR (pointer)(-1) +#define SHMERRORPTR (void *)(-1) #include <fcntl.h> #include <errno.h> @@ -153,9 +153,9 @@ xf86ExtendedInitInt10(int entityIndex, int Flags) goto error0; pInt->mem = &linuxMem; pagesize = getpagesize(); - pInt->private = (pointer) xnfcalloc(1, sizeof(linuxInt10Priv)); + pInt->private = (void *) xnfcalloc(1, sizeof(linuxInt10Priv)); ((linuxInt10Priv *) pInt->private)->alloc = - (pointer) xnfcalloc(1, ALLOC_ENTRIES(pagesize)); + (void *) xnfcalloc(1, ALLOC_ENTRIES(pagesize)); if (!xf86IsEntityPrimary(entityIndex)) { DebugF("Mapping high memory area\n"); @@ -233,10 +233,10 @@ xf86ExtendedInitInt10(int entityIndex, int Flags) * 64K bytes at a time. */ if (!videoBiosMapped) { - memset((pointer) V_BIOS, 0, SYS_BIOS - V_BIOS); + memset((void *) V_BIOS, 0, SYS_BIOS - V_BIOS); DebugF("Reading BIOS\n"); for (cs = V_BIOS; cs < SYS_BIOS; cs += V_BIOS_SIZE) - if (xf86ReadBIOS(cs, 0, (pointer) cs, V_BIOS_SIZE) < V_BIOS_SIZE) + if (xf86ReadBIOS(cs, 0, (void *) cs, V_BIOS_SIZE) < V_BIOS_SIZE) xf86DrvMsg(screen, X_WARNING, "Unable to retrieve all of segment 0x%06lX.\n", (long) cs); @@ -319,7 +319,7 @@ xf86ExtendedInitInt10(int entityIndex, int Flags) Bool MapCurrentInt10(xf86Int10InfoPtr pInt) { - pointer addr; + void *addr; int fd = -1; if (Int10Current) { @@ -327,7 +327,7 @@ MapCurrentInt10(xf86Int10InfoPtr pInt) if (((linuxInt10Priv *) Int10Current->private)->highMem >= 0) shmdt((char *) HIGH_MEM); else - munmap((pointer) V_BIOS, (SYS_BIOS - V_BIOS)); + munmap((void *) V_BIOS, (SYS_BIOS - V_BIOS)); } addr = shmat(((linuxInt10Priv *) pInt->private)->lowMem, (char *) 1, SHM_RND); @@ -392,7 +392,7 @@ xf86FreeInt10(xf86Int10InfoPtr pInt) if (((linuxInt10Priv *) pInt->private)->highMem >= 0) shmdt((char *) HIGH_MEM); else - munmap((pointer) V_BIOS, (SYS_BIOS - V_BIOS)); + munmap((void *) V_BIOS, (SYS_BIOS - V_BIOS)); Int10Current = NULL; } @@ -486,22 +486,22 @@ write_l(xf86Int10InfoPtr pInt, int addr, CARD32 val) *((CARD32 *) (memType) addr) = val; } -pointer +void * xf86int10Addr(xf86Int10InfoPtr pInt, CARD32 addr) { if (addr < V_RAM) return ((linuxInt10Priv *) pInt->private)->base + addr; else if (addr < V_BIOS) - return (pointer) (memType) addr; + return (void *) (memType) addr; else if (addr < SYS_BIOS) { if (((linuxInt10Priv *) pInt->private)->base_high) - return (pointer) (((linuxInt10Priv *) pInt->private)->base_high + return (void *) (((linuxInt10Priv *) pInt->private)->base_high - V_BIOS + addr); else - return (pointer) (memType) addr; + return (void *) (memType) addr; } else - return (pointer) (memType) addr; + return (void *) (memType) addr; } #if defined DoSubModules diff --git a/xserver/hw/xfree86/os-support/linux/lnx_acpi.c b/xserver/hw/xfree86/os-support/linux/lnx_acpi.c index dcaa19ee1..dbd5afe90 100644 --- a/xserver/hw/xfree86/os-support/linux/lnx_acpi.c +++ b/xserver/hw/xfree86/os-support/linux/lnx_acpi.c @@ -33,14 +33,14 @@ #define ACPI_VIDEO_HEAD_END (~0u) static void lnxCloseACPI(void); -static pointer ACPIihPtr = NULL; +static void *ACPIihPtr = NULL; PMClose lnxACPIOpen(void); /* in milliseconds */ #define ACPI_REOPEN_DELAY 1000 static CARD32 -lnxACPIReopen(OsTimerPtr timer, CARD32 time, pointer arg) +lnxACPIReopen(OsTimerPtr timer, CARD32 time, void *arg) { if (lnxACPIOpen()) { TimerFree(timer); @@ -74,13 +74,12 @@ lnxACPIGetEventFromOs(int fd, pmEvent * events, int num) /* Check that we have a video event */ if (!strncmp(ev, "video", 5)) { - char *video = NULL; char *GFX = NULL; char *notify = NULL; char *data = NULL; /* doesn't appear to be used in the kernel */ - unsigned long int notify_l, data_l; + unsigned long int notify_l; - video = strtok(ev, " "); + strtok(ev, " "); if (!(GFX = strtok(NULL, " "))) return 0; @@ -97,8 +96,8 @@ lnxACPIGetEventFromOs(int fd, pmEvent * events, int num) if (!(data = strtok(NULL, " "))) return 0; - data_l = strtoul(data, NULL, 16); #if 0 + data_l = strtoul(data, NULL, 16); ErrorF("data: 0x%lx\n", data_l); #endif diff --git a/xserver/hw/xfree86/os-support/linux/lnx_apm.c b/xserver/hw/xfree86/os-support/linux/lnx_apm.c index 387934099..621691997 100644 --- a/xserver/hw/xfree86/os-support/linux/lnx_apm.c +++ b/xserver/hw/xfree86/os-support/linux/lnx_apm.c @@ -36,7 +36,7 @@ extern PMClose lnxACPIOpen(void); static PMClose lnxAPMOpen(void); static void lnxCloseAPM(void); -static pointer APMihPtr = NULL; +static void *APMihPtr = NULL; static struct { apm_event_t apmLinux; diff --git a/xserver/hw/xfree86/os-support/linux/lnx_ev56.c b/xserver/hw/xfree86/os-support/linux/lnx_ev56.c index 49950705a..b6950009c 100644 --- a/xserver/hw/xfree86/os-support/linux/lnx_ev56.c +++ b/xserver/hw/xfree86/os-support/linux/lnx_ev56.c @@ -6,77 +6,77 @@ #include "xf86.h" #include "compiler.h" -int readDense8(pointer Base, register unsigned long Offset); -int readDense16(pointer Base, register unsigned long Offset); -int readDense32(pointer Base, register unsigned long Offset); +int readDense8(void *Base, register unsigned long Offset); +int readDense16(void *Base, register unsigned long Offset); +int readDense32(void *Base, register unsigned long Offset); void - writeDenseNB8(int Value, pointer Base, register unsigned long Offset); + writeDenseNB8(int Value, void *Base, register unsigned long Offset); void - writeDenseNB16(int Value, pointer Base, register unsigned long Offset); + writeDenseNB16(int Value, void *Base, register unsigned long Offset); void - writeDenseNB32(int Value, pointer Base, register unsigned long Offset); + writeDenseNB32(int Value, void *Base, register unsigned long Offset); void - writeDense8(int Value, pointer Base, register unsigned long Offset); + writeDense8(int Value, void *Base, register unsigned long Offset); void - writeDense16(int Value, pointer Base, register unsigned long Offset); + writeDense16(int Value, void *Base, register unsigned long Offset); void - writeDense32(int Value, pointer Base, register unsigned long Offset); + writeDense32(int Value, void *Base, register unsigned long Offset); int -readDense8(pointer Base, register unsigned long Offset) +readDense8(void *Base, register unsigned long Offset) { mem_barrier(); return *(volatile CARD8 *) ((unsigned long) Base + (Offset)); } int -readDense16(pointer Base, register unsigned long Offset) +readDense16(void *Base, register unsigned long Offset) { mem_barrier(); return *(volatile CARD16 *) ((unsigned long) Base + (Offset)); } int -readDense32(pointer Base, register unsigned long Offset) +readDense32(void *Base, register unsigned long Offset) { mem_barrier(); return *(volatile CARD32 *) ((unsigned long) Base + (Offset)); } void -writeDenseNB8(int Value, pointer Base, register unsigned long Offset) +writeDenseNB8(int Value, void *Base, register unsigned long Offset) { *(volatile CARD8 *) ((unsigned long) Base + (Offset)) = Value; } void -writeDenseNB16(int Value, pointer Base, register unsigned long Offset) +writeDenseNB16(int Value, void *Base, register unsigned long Offset) { *(volatile CARD16 *) ((unsigned long) Base + (Offset)) = Value; } void -writeDenseNB32(int Value, pointer Base, register unsigned long Offset) +writeDenseNB32(int Value, void *Base, register unsigned long Offset) { *(volatile CARD32 *) ((unsigned long) Base + (Offset)) = Value; } void -writeDense8(int Value, pointer Base, register unsigned long Offset) +writeDense8(int Value, void *Base, register unsigned long Offset) { write_mem_barrier(); *(volatile CARD8 *) ((unsigned long) Base + (Offset)) = Value; } void -writeDense16(int Value, pointer Base, register unsigned long Offset) +writeDense16(int Value, void *Base, register unsigned long Offset) { write_mem_barrier(); *(volatile CARD16 *) ((unsigned long) Base + (Offset)) = Value; } void -writeDense32(int Value, pointer Base, register unsigned long Offset) +writeDense32(int Value, void *Base, register unsigned long Offset) { write_mem_barrier(); *(volatile CARD32 *) ((unsigned long) Base + (Offset)) = Value; diff --git a/xserver/hw/xfree86/os-support/linux/lnx_init.c b/xserver/hw/xfree86/os-support/linux/lnx_init.c index bcb039f3f..85709c629 100644 --- a/xserver/hw/xfree86/os-support/linux/lnx_init.c +++ b/xserver/hw/xfree86/os-support/linux/lnx_init.c @@ -79,20 +79,15 @@ switch_to(int vt, const char *from) void xf86OpenConsole(void) { - int i, fd = -1, ret; + int i, fd = -1, ret, current_vt = -1; struct vt_mode VT; struct vt_stat vts; + struct stat st; MessageType from = X_PROBED; - char *tty0[] = { "/dev/tty0", "/dev/vc/0", NULL }; - char *vcs[] = { "/dev/vc/%d", "/dev/tty%d", NULL }; + const char *tty0[] = { "/dev/tty0", "/dev/vc/0", NULL }; + const char *vcs[] = { "/dev/vc/%d", "/dev/tty%d", NULL }; if (serverGeneration == 1) { - - /* when KeepTty check if we're run with euid==0 */ - if (KeepTty && geteuid() != 0) - FatalError("xf86OpenConsole:" - " Server must be suid root for option \"KeepTTY\"\n"); - /* * setup the virtual terminal manager */ @@ -132,6 +127,22 @@ xf86OpenConsole(void) xf86Msg(from, "using VT number %d\n\n", xf86Info.vtno); + /* Some of stdin / stdout / stderr maybe redirected to a file */ + for (i = STDIN_FILENO; i <= STDERR_FILENO; i++) { + ret = fstat(i, &st); + if (ret == 0 && S_ISCHR(st.st_mode) && major(st.st_rdev) == 4) { + current_vt = minor(st.st_rdev); + break; + } + } + + if (!KeepTty && current_vt == xf86Info.vtno) { + xf86Msg(X_PROBED, + "controlling tty is VT number %d, auto-enabling KeepTty\n", + current_vt); + KeepTty = TRUE; + } + if (!KeepTty) { pid_t ppid = getppid(); pid_t ppgid; @@ -155,6 +166,7 @@ xf86OpenConsole(void) i = 0; while (vcs[i] != NULL) { +#pragma GCC diagnostic ignored "-Wformat-nonliteral" snprintf(vtname, sizeof(vtname), vcs[i], xf86Info.vtno); /* /dev/tty1-64 */ if ((xf86Info.consoleFd = open(vtname, O_RDWR | O_NDELAY, 0)) >= 0) break; diff --git a/xserver/hw/xfree86/os-support/linux/lnx_kmod.c b/xserver/hw/xfree86/os-support/linux/lnx_kmod.c index 0a17c2a81..f5917eefb 100644 --- a/xserver/hw/xfree86/os-support/linux/lnx_kmod.c +++ b/xserver/hw/xfree86/os-support/linux/lnx_kmod.c @@ -37,7 +37,7 @@ int xf86LoadKernelModule(const char *modName) { char mpPath[MAX_PATH] = ""; - int fd = -1, status, n; + int fd = -1, status; pid_t pid; /* get the path to the modprobe program */ @@ -76,7 +76,7 @@ xf86LoadKernelModule(const char *modName) "Setting of real/effective user Id to 0/0 failed"); } setenv("PATH", "/sbin", 1); - n = execl(mpPath, "modprobe", modName, NULL); + execl(mpPath, "modprobe", modName, NULL); xf86Msg(X_WARNING, "LoadKernelModule %s\n", strerror(errno)); exit(EXIT_FAILURE); /* if we get here the child's exec failed */ break; diff --git a/xserver/hw/xfree86/os-support/linux/lnx_platform.c b/xserver/hw/xfree86/os-support/linux/lnx_platform.c index 1865b31b9..d660761c5 100644 --- a/xserver/hw/xfree86/os-support/linux/lnx_platform.c +++ b/xserver/hw/xfree86/os-support/linux/lnx_platform.c @@ -18,16 +18,36 @@ #include "xf86Bus.h" #include "hotplug.h" +#include "systemd-logind.h" static Bool get_drm_info(struct OdevAttributes *attribs, char *path, int delayed_index) { drmSetVersion sv; + drmVersionPtr v; char *buf; - int fd; + int major, minor, fd; int err = 0; + Bool paused, server_fd = FALSE; + + major = config_odev_get_int_attribute(attribs, ODEV_ATTRIB_MAJOR, 0); + minor = config_odev_get_int_attribute(attribs, ODEV_ATTRIB_MINOR, 0); + + fd = systemd_logind_take_fd(major, minor, path, &paused); + if (fd != -1) { + if (paused) { + LogMessage(X_ERROR, + "Error systemd-logind returned paused fd for drm node\n"); + systemd_logind_release_fd(major, minor, -1); + return FALSE; + } + config_odev_add_int_attribute(attribs, ODEV_ATTRIB_FD, fd); + server_fd = TRUE; + } + + if (fd == -1) + fd = open(path, O_RDWR, O_CLOEXEC); - fd = open(path, O_RDWR, O_CLOEXEC); if (fd == -1) return FALSE; @@ -38,22 +58,38 @@ get_drm_info(struct OdevAttributes *attribs, char *path, int delayed_index) err = drmSetInterfaceVersion(fd, &sv); if (err) { - ErrorF("setversion 1.4 failed: %s\n", strerror(-err)); - goto out; + xf86Msg(X_ERROR, "%s: failed to set DRM interface version 1.4: %s\n", + path, strerror(-err)); + goto out; } /* for a delayed probe we've already added the device */ if (delayed_index == -1) { - xf86_add_platform_device(attribs); + xf86_add_platform_device(attribs, FALSE); delayed_index = xf86_num_platform_devices - 1; } + if (server_fd) + xf86_platform_devices[delayed_index].flags |= XF86_PDEV_SERVER_FD; + buf = drmGetBusid(fd); xf86_add_platform_device_attrib(delayed_index, ODEV_ATTRIB_BUSID, buf); drmFreeBusid(buf); + + v = drmGetVersion(fd); + if (!v) { + xf86Msg(X_ERROR, "%s: failed to query DRM version\n", path); + goto out; + } + + xf86_add_platform_device_attrib(delayed_index, ODEV_ATTRIB_DRIVER, + v->name); + drmFreeVersion(v); + out: - close(fd); + if (!server_fd) + close(fd); return (err == 0); } @@ -118,17 +154,11 @@ xf86PlatformReprobeDevice(int index, struct OdevAttributes *attribs) void xf86PlatformDeviceProbe(struct OdevAttributes *attribs) { - struct OdevAttribute *attrib; int i; char *path = NULL; Bool ret; - xorg_list_for_each_entry(attrib, &attribs->list, member) { - if (attrib->attrib_id == ODEV_ATTRIB_PATH) { - path = attrib->attrib_name; - break; - } - } + path = config_odev_get_attribute(attribs, ODEV_ATTRIB_PATH); if (!path) goto out_free; @@ -148,8 +178,7 @@ xf86PlatformDeviceProbe(struct OdevAttributes *attribs) if (!xf86VTOwner()) { /* if we don't currently own the VT then don't probe the device, just mark it as unowned for later use */ - attribs->unowned = TRUE; - xf86_add_platform_device(attribs); + xf86_add_platform_device(attribs, TRUE); return; } diff --git a/xserver/hw/xfree86/os-support/linux/lnx_video.c b/xserver/hw/xfree86/os-support/linux/lnx_video.c index 43d0a364a..652f963a2 100644 --- a/xserver/hw/xfree86/os-support/linux/lnx_video.c +++ b/xserver/hw/xfree86/os-support/linux/lnx_video.c @@ -59,7 +59,9 @@ static Bool ExtendedEnabled = FALSE; !defined(__mips__) && \ !defined(__nds32__) && \ !defined(__arm__) && \ - !defined(__aarch64__) + !defined(__aarch64__) && \ + !defined(__arc__) && \ + !defined(__xtensa__) /* * Due to conflicts with "compiler.h", don't rely on <sys/io.h> to declare @@ -80,17 +82,17 @@ extern int iopl(int __level); /* Video Memory Mapping section */ /***************************************************************************/ -static pointer mapVidMem(int, unsigned long, unsigned long, int); -static void unmapVidMem(int, pointer, unsigned long); +static void *mapVidMem(int, unsigned long, unsigned long, int); +static void unmapVidMem(int, void *, unsigned long); #if defined (__alpha__) extern void sethae(unsigned long hae); extern unsigned long _bus_base __P((void)) __attribute__ ((const)); extern unsigned long _bus_base_sparse __P((void)) __attribute__ ((const)); -static pointer mapVidMemSparse(int, unsigned long, unsigned long, int); +static void *mapVidMemSparse(int, unsigned long, unsigned long, int); extern axpDevice lnxGetAXP(void); -static void unmapVidMemSparse(int, pointer, unsigned long); +static void unmapVidMemSparse(int, void *, unsigned long); static axpDevice axpSystem = -1; static Bool needSparse; static unsigned long hae_thresh; @@ -102,8 +104,8 @@ static unsigned long bus_base; #define SPLIT_WC_REGIONS 1 -static pointer setWC(int, unsigned long, unsigned long, Bool, MessageType); -static void undoWC(int, pointer); +static void *setWC(int, unsigned long, unsigned long, Bool, MessageType); +static void undoWC(int, void *); /* The file desc for /proc/mtrr. Once opened, left opened, and the mtrr driver will clean up when we exit. */ @@ -204,7 +206,7 @@ mtrr_cull_wc_region(int screenNum, unsigned long base, unsigned long size, xf86DrvMsgVerb(screenNum, X_WARNING, 0, "Failed to remove MMIO " "write-combining range (0x%lx,0x%lx)\n", - gent.base, (unsigned long) gent.size); + (unsigned long)gent.base, (unsigned long) gent.size); } } return wcreturn; @@ -339,7 +341,7 @@ mtrr_undo_wc_region(int screenNum, struct mtrr_wc_region *wcr) } } -static pointer +static void * setWC(int screenNum, unsigned long base, unsigned long size, Bool enable, MessageType from) { @@ -350,7 +352,7 @@ setWC(int screenNum, unsigned long base, unsigned long size, Bool enable, } static void -undoWC(int screenNum, pointer regioninfo) +undoWC(int screenNum, void *regioninfo) { mtrr_undo_wc_region(screenNum, regioninfo); } @@ -396,16 +398,16 @@ xf86OSInitVidMem(VidMemInfoPtr pVidMem) /* Basically, you simply cannot do this on Sparc. You have to do something portable * like use /dev/fb* or mmap() on /proc/bus/pci/X/Y nodes. -DaveM */ -static pointer +static void * mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags) { return NULL; } #else -static pointer +static void * mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags) { - pointer base; + void *base; int fd; int mapflags = MAP_SHARED; int prot; @@ -460,7 +462,7 @@ mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags) #endif /* !(__sparc__) */ static void -unmapVidMem(int ScreenNum, pointer Base, unsigned long Size) +unmapVidMem(int ScreenNum, void *Base, unsigned long Size) { uintptr_t alignOff = (uintptr_t) Base - ((uintptr_t) Base & ~(getpagesize() - 1)); @@ -565,44 +567,44 @@ xf86DisableIO(void) #define vuip volatile unsigned int * -extern int readDense8(pointer Base, register unsigned long Offset); -extern int readDense16(pointer Base, register unsigned long Offset); -extern int readDense32(pointer Base, register unsigned long Offset); +extern int readDense8(void *Base, register unsigned long Offset); +extern int readDense16(void *Base, register unsigned long Offset); +extern int readDense32(void *Base, register unsigned long Offset); extern void - writeDenseNB8(int Value, pointer Base, register unsigned long Offset); + writeDenseNB8(int Value, void *Base, register unsigned long Offset); extern void - writeDenseNB16(int Value, pointer Base, register unsigned long Offset); + writeDenseNB16(int Value, void *Base, register unsigned long Offset); extern void - writeDenseNB32(int Value, pointer Base, register unsigned long Offset); + writeDenseNB32(int Value, void *Base, register unsigned long Offset); extern void - writeDense8(int Value, pointer Base, register unsigned long Offset); + writeDense8(int Value, void *Base, register unsigned long Offset); extern void - writeDense16(int Value, pointer Base, register unsigned long Offset); + writeDense16(int Value, void *Base, register unsigned long Offset); extern void - writeDense32(int Value, pointer Base, register unsigned long Offset); + writeDense32(int Value, void *Base, register unsigned long Offset); -static int readSparse8(pointer Base, register unsigned long Offset); -static int readSparse16(pointer Base, register unsigned long Offset); -static int readSparse32(pointer Base, register unsigned long Offset); +static int readSparse8(void *Base, register unsigned long Offset); +static int readSparse16(void *Base, register unsigned long Offset); +static int readSparse32(void *Base, register unsigned long Offset); static void - writeSparseNB8(int Value, pointer Base, register unsigned long Offset); + writeSparseNB8(int Value, void *Base, register unsigned long Offset); static void - writeSparseNB16(int Value, pointer Base, register unsigned long Offset); + writeSparseNB16(int Value, void *Base, register unsigned long Offset); static void - writeSparseNB32(int Value, pointer Base, register unsigned long Offset); + writeSparseNB32(int Value, void *Base, register unsigned long Offset); static void - writeSparse8(int Value, pointer Base, register unsigned long Offset); + writeSparse8(int Value, void *Base, register unsigned long Offset); static void - writeSparse16(int Value, pointer Base, register unsigned long Offset); + writeSparse16(int Value, void *Base, register unsigned long Offset); static void - writeSparse32(int Value, pointer Base, register unsigned long Offset); + writeSparse32(int Value, void *Base, register unsigned long Offset); #define DENSE_BASE 0x2ff00000000UL #define SPARSE_BASE 0x30000000000UL static unsigned long msb_set = 0; -static pointer +static void * mapVidMemSparse(int ScreenNum, unsigned long Base, unsigned long Size, int flags) { @@ -689,11 +691,11 @@ mapVidMemSparse(int ScreenNum, unsigned long Base, unsigned long Size, " to DENSE only at 0x%lx\n", Base, Size, ret); #endif - return (pointer) ret; + return (void *) ret; } static void -unmapVidMemSparse(int ScreenNum, pointer Base, unsigned long Size) +unmapVidMemSparse(int ScreenNum, void *Base, unsigned long Size) { unsigned long Offset = (unsigned long) Base - DENSE_BASE; @@ -709,7 +711,7 @@ unmapVidMemSparse(int ScreenNum, pointer Base, unsigned long Size) } static int -readSparse8(pointer Base, register unsigned long Offset) +readSparse8(void *Base, register unsigned long Offset) { register unsigned long result, shift; register unsigned long msb; @@ -733,7 +735,7 @@ readSparse8(pointer Base, register unsigned long Offset) } static int -readSparse16(pointer Base, register unsigned long Offset) +readSparse16(void *Base, register unsigned long Offset) { register unsigned long result, shift; register unsigned long msb; @@ -757,7 +759,7 @@ readSparse16(pointer Base, register unsigned long Offset) } static int -readSparse32(pointer Base, register unsigned long Offset) +readSparse32(void *Base, register unsigned long Offset) { /* NOTE: this is really using DENSE. */ mem_barrier(); @@ -765,7 +767,7 @@ readSparse32(pointer Base, register unsigned long Offset) } static void -writeSparse8(int Value, pointer Base, register unsigned long Offset) +writeSparse8(int Value, void *Base, register unsigned long Offset) { register unsigned long msb; register unsigned int b = Value & 0xffU; @@ -786,7 +788,7 @@ writeSparse8(int Value, pointer Base, register unsigned long Offset) } static void -writeSparse16(int Value, pointer Base, register unsigned long Offset) +writeSparse16(int Value, void *Base, register unsigned long Offset) { register unsigned long msb; register unsigned int w = Value & 0xffffU; @@ -807,7 +809,7 @@ writeSparse16(int Value, pointer Base, register unsigned long Offset) } static void -writeSparse32(int Value, pointer Base, register unsigned long Offset) +writeSparse32(int Value, void *Base, register unsigned long Offset) { /* NOTE: this is really using DENSE. */ write_mem_barrier(); @@ -816,7 +818,7 @@ writeSparse32(int Value, pointer Base, register unsigned long Offset) } static void -writeSparseNB8(int Value, pointer Base, register unsigned long Offset) +writeSparseNB8(int Value, void *Base, register unsigned long Offset) { register unsigned long msb; register unsigned int b = Value & 0xffU; @@ -834,7 +836,7 @@ writeSparseNB8(int Value, pointer Base, register unsigned long Offset) } static void -writeSparseNB16(int Value, pointer Base, register unsigned long Offset) +writeSparseNB16(int Value, void *Base, register unsigned long Offset) { register unsigned long msb; register unsigned int w = Value & 0xffffU; @@ -852,30 +854,30 @@ writeSparseNB16(int Value, pointer Base, register unsigned long Offset) } static void -writeSparseNB32(int Value, pointer Base, register unsigned long Offset) +writeSparseNB32(int Value, void *Base, register unsigned long Offset) { /* NOTE: this is really using DENSE. */ *(vuip) ((unsigned long) Base + (Offset)) = Value; return; } -void (*xf86WriteMmio8) (int Value, pointer Base, unsigned long Offset) +void (*xf86WriteMmio8) (int Value, void *Base, unsigned long Offset) = writeDense8; -void (*xf86WriteMmio16) (int Value, pointer Base, unsigned long Offset) +void (*xf86WriteMmio16) (int Value, void *Base, unsigned long Offset) = writeDense16; -void (*xf86WriteMmio32) (int Value, pointer Base, unsigned long Offset) +void (*xf86WriteMmio32) (int Value, void *Base, unsigned long Offset) = writeDense32; -void (*xf86WriteMmioNB8) (int Value, pointer Base, unsigned long Offset) +void (*xf86WriteMmioNB8) (int Value, void *Base, unsigned long Offset) = writeDenseNB8; -void (*xf86WriteMmioNB16) (int Value, pointer Base, unsigned long Offset) +void (*xf86WriteMmioNB16) (int Value, void *Base, unsigned long Offset) = writeDenseNB16; -void (*xf86WriteMmioNB32) (int Value, pointer Base, unsigned long Offset) +void (*xf86WriteMmioNB32) (int Value, void *Base, unsigned long Offset) = writeDenseNB32; -int (*xf86ReadMmio8) (pointer Base, unsigned long Offset) +int (*xf86ReadMmio8) (void *Base, unsigned long Offset) = readDense8; -int (*xf86ReadMmio16) (pointer Base, unsigned long Offset) +int (*xf86ReadMmio16) (void *Base, unsigned long Offset) = readDense16; -int (*xf86ReadMmio32) (pointer Base, unsigned long Offset) +int (*xf86ReadMmio32) (void *Base, unsigned long Offset) = readDense32; #endif /* __alpha__ */ diff --git a/xserver/hw/xfree86/os-support/linux/systemd-logind.c b/xserver/hw/xfree86/os-support/linux/systemd-logind.c new file mode 100644 index 000000000..73a8d55bf --- /dev/null +++ b/xserver/hw/xfree86/os-support/linux/systemd-logind.c @@ -0,0 +1,608 @@ +/* + * Copyright © 2013 Red Hat Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Author: Hans de Goede <hdegoede@redhat.com> + */ + +#ifdef HAVE_XORG_CONFIG_H +#include <xorg-config.h> +#endif + +#include <dbus/dbus.h> +#include <string.h> +#include <sys/types.h> +#include <unistd.h> + +#include "os.h" +#include "dbus-core.h" +#include "xf86.h" +#include "xf86platformBus.h" +#include "xf86Xinput.h" + +#include "systemd-logind.h" + +#define DBUS_TIMEOUT 500 /* Wait max 0.5 seconds */ + +struct systemd_logind_info { + DBusConnection *conn; + char *session; + Bool active; + Bool vt_active; +}; + +static struct systemd_logind_info logind_info; + +static InputInfoPtr +systemd_logind_find_info_ptr_by_devnum(InputInfoPtr start, + int major, int minor) +{ + InputInfoPtr pInfo; + + for (pInfo = start; pInfo; pInfo = pInfo->next) + if (pInfo->major == major && pInfo->minor == minor && + (pInfo->flags & XI86_SERVER_FD)) + return pInfo; + + return NULL; +} + +static void +systemd_logind_set_input_fd_for_all_devs(int major, int minor, int fd, + Bool enable) +{ + InputInfoPtr pInfo; + + pInfo = systemd_logind_find_info_ptr_by_devnum(xf86InputDevs, major, minor); + while (pInfo) { + pInfo->fd = fd; + pInfo->options = xf86ReplaceIntOption(pInfo->options, "fd", fd); + if (enable) + xf86EnableInputDeviceForVTSwitch(pInfo); + + pInfo = systemd_logind_find_info_ptr_by_devnum(pInfo->next, major, minor); + } +} + +int +systemd_logind_take_fd(int _major, int _minor, const char *path, + Bool *paused_ret) +{ + struct systemd_logind_info *info = &logind_info; + InputInfoPtr pInfo; + DBusError error; + DBusMessage *msg = NULL; + DBusMessage *reply = NULL; + dbus_int32_t major = _major; + dbus_int32_t minor = _minor; + dbus_bool_t paused; + int fd = -1; + + if (!info->session || major == 0) + return -1; + + /* logind does not support mouse devs (with evdev we don't need them) */ + if (strstr(path, "mouse")) + return -1; + + /* Check if we already have an InputInfo entry with this major, minor + * (shared device-nodes happen ie with Wacom tablets). */ + pInfo = systemd_logind_find_info_ptr_by_devnum(xf86InputDevs, major, minor); + if (pInfo) { + LogMessage(X_INFO, "systemd-logind: returning pre-existing fd for %s %u:%u\n", + path, major, minor); + *paused_ret = FALSE; + return pInfo->fd; + } + + dbus_error_init(&error); + + msg = dbus_message_new_method_call("org.freedesktop.login1", info->session, + "org.freedesktop.login1.Session", "TakeDevice"); + if (!msg) { + LogMessage(X_ERROR, "systemd-logind: out of memory\n"); + goto cleanup; + } + + if (!dbus_message_append_args(msg, DBUS_TYPE_UINT32, &major, + DBUS_TYPE_UINT32, &minor, + DBUS_TYPE_INVALID)) { + LogMessage(X_ERROR, "systemd-logind: out of memory\n"); + goto cleanup; + } + + reply = dbus_connection_send_with_reply_and_block(info->conn, msg, + DBUS_TIMEOUT, &error); + if (!reply) { + LogMessage(X_ERROR, "systemd-logind: failed to take device %s: %s\n", + path, error.message); + goto cleanup; + } + + if (!dbus_message_get_args(reply, &error, + DBUS_TYPE_UNIX_FD, &fd, + DBUS_TYPE_BOOLEAN, &paused, + DBUS_TYPE_INVALID)) { + LogMessage(X_ERROR, "systemd-logind: TakeDevice %s: %s\n", + path, error.message); + goto cleanup; + } + + *paused_ret = paused; + + LogMessage(X_INFO, "systemd-logind: got fd for %s %u:%u fd %d paused %d\n", + path, major, minor, fd, paused); + +cleanup: + if (msg) + dbus_message_unref(msg); + if (reply) + dbus_message_unref(reply); + dbus_error_free(&error); + + return fd; +} + +void +systemd_logind_release_fd(int _major, int _minor, int fd) +{ + struct systemd_logind_info *info = &logind_info; + InputInfoPtr pInfo; + DBusError error; + DBusMessage *msg = NULL; + DBusMessage *reply = NULL; + dbus_int32_t major = _major; + dbus_int32_t minor = _minor; + int matches = 0; + + if (!info->session || major == 0) + goto close; + + /* Only release the fd if there is only 1 InputInfo left for this major + * and minor, otherwise other InputInfo's are still referencing the fd. */ + pInfo = systemd_logind_find_info_ptr_by_devnum(xf86InputDevs, major, minor); + while (pInfo) { + matches++; + pInfo = systemd_logind_find_info_ptr_by_devnum(pInfo->next, major, minor); + } + if (matches > 1) { + LogMessage(X_INFO, "systemd-logind: not releasing fd for %u:%u, still in use\n", major, minor); + return; + } + + LogMessage(X_INFO, "systemd-logind: releasing fd for %u:%u\n", major, minor); + + dbus_error_init(&error); + + msg = dbus_message_new_method_call("org.freedesktop.login1", info->session, + "org.freedesktop.login1.Session", "ReleaseDevice"); + if (!msg) { + LogMessage(X_ERROR, "systemd-logind: out of memory\n"); + goto cleanup; + } + + if (!dbus_message_append_args(msg, DBUS_TYPE_UINT32, &major, + DBUS_TYPE_UINT32, &minor, + DBUS_TYPE_INVALID)) { + LogMessage(X_ERROR, "systemd-logind: out of memory\n"); + goto cleanup; + } + + reply = dbus_connection_send_with_reply_and_block(info->conn, msg, + DBUS_TIMEOUT, &error); + if (!reply) + LogMessage(X_ERROR, "systemd-logind: failed to release device: %s\n", + error.message); + +cleanup: + if (msg) + dbus_message_unref(msg); + if (reply) + dbus_message_unref(reply); + dbus_error_free(&error); +close: + if (fd != -1) + close(fd); +} + +int +systemd_logind_controls_session(void) +{ + return logind_info.session ? 1 : 0; +} + +void +systemd_logind_vtenter(void) +{ + struct systemd_logind_info *info = &logind_info; + InputInfoPtr pInfo; + int i; + + if (!info->session) + return; /* Not using systemd-logind */ + + if (!info->active) + return; /* Session not active */ + + if (info->vt_active) + return; /* Already did vtenter */ + + for (i = 0; i < xf86_num_platform_devices; i++) { + if (xf86_platform_devices[i].flags & XF86_PDEV_PAUSED) + break; + } + if (i != xf86_num_platform_devices) + return; /* Some drm nodes are still paused wait for resume */ + + xf86VTEnter(); + info->vt_active = TRUE; + + /* Activate any input devices which were resumed before the drm nodes */ + for (pInfo = xf86InputDevs; pInfo; pInfo = pInfo->next) + if ((pInfo->flags & XI86_SERVER_FD) && pInfo->fd != -1) + xf86EnableInputDeviceForVTSwitch(pInfo); + + /* Do delayed input probing, this must be done after the above enabling */ + xf86InputEnableVTProbe(); +} + +static void +systemd_logind_ack_pause(struct systemd_logind_info *info, + dbus_int32_t minor, dbus_int32_t major) +{ + DBusError error; + DBusMessage *msg = NULL; + DBusMessage *reply = NULL; + + dbus_error_init(&error); + + msg = dbus_message_new_method_call("org.freedesktop.login1", info->session, + "org.freedesktop.login1.Session", "PauseDeviceComplete"); + if (!msg) { + LogMessage(X_ERROR, "systemd-logind: out of memory\n"); + goto cleanup; + } + + if (!dbus_message_append_args(msg, DBUS_TYPE_UINT32, &major, + DBUS_TYPE_UINT32, &minor, + DBUS_TYPE_INVALID)) { + LogMessage(X_ERROR, "systemd-logind: out of memory\n"); + goto cleanup; + } + + reply = dbus_connection_send_with_reply_and_block(info->conn, msg, + DBUS_TIMEOUT, &error); + if (!reply) + LogMessage(X_ERROR, "systemd-logind: failed to ack pause: %s\n", + error.message); + +cleanup: + if (msg) + dbus_message_unref(msg); + if (reply) + dbus_message_unref(reply); + dbus_error_free(&error); +} + +static DBusHandlerResult +message_filter(DBusConnection * connection, DBusMessage * message, void *data) +{ + struct systemd_logind_info *info = data; + struct xf86_platform_device *pdev = NULL; + InputInfoPtr pInfo = NULL; + int ack = 0, pause = 0, fd = -1; + DBusError error; + dbus_int32_t major, minor; + char *pause_str; + + dbus_error_init(&error); + + if (dbus_message_is_signal(message, + "org.freedesktop.DBus", "NameOwnerChanged")) { + char *name, *old_owner, *new_owner; + + dbus_message_get_args(message, &error, + DBUS_TYPE_STRING, &name, + DBUS_TYPE_STRING, &old_owner, + DBUS_TYPE_STRING, &new_owner, DBUS_TYPE_INVALID); + if (dbus_error_is_set(&error)) { + LogMessage(X_ERROR, "systemd-logind: NameOwnerChanged: %s\n", + error.message); + dbus_error_free(&error); + return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; + } + + if (name && strcmp(name, "org.freedesktop.login1") == 0) + FatalError("systemd-logind disappeared (stopped/restarted?)\n"); + + return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; + } + + if (strcmp(dbus_message_get_path(message), info->session) != 0) + return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; + + if (dbus_message_is_signal(message, "org.freedesktop.login1.Session", + "PauseDevice")) { + if (!dbus_message_get_args(message, &error, + DBUS_TYPE_UINT32, &major, + DBUS_TYPE_UINT32, &minor, + DBUS_TYPE_STRING, &pause_str, + DBUS_TYPE_INVALID)) { + LogMessage(X_ERROR, "systemd-logind: PauseDevice: %s\n", + error.message); + dbus_error_free(&error); + return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; + } + + if (strcmp(pause_str, "pause") == 0) { + pause = 1; + ack = 1; + } + else if (strcmp(pause_str, "force") == 0) { + pause = 1; + } + else if (strcmp(pause_str, "gone") == 0) { + /* Device removal is handled through udev */ + return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; + } + else { + LogMessage(X_WARNING, "systemd-logind: unknown pause type: %s\n", + pause_str); + return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; + } + } + else if (dbus_message_is_signal(message, "org.freedesktop.login1.Session", + "ResumeDevice")) { + if (!dbus_message_get_args(message, &error, + DBUS_TYPE_UINT32, &major, + DBUS_TYPE_UINT32, &minor, + DBUS_TYPE_UNIX_FD, &fd, + DBUS_TYPE_INVALID)) { + LogMessage(X_ERROR, "systemd-logind: ResumeDevice: %s\n", + error.message); + dbus_error_free(&error); + return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; + } + } else + return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; + + LogMessage(X_INFO, "systemd-logind: got %s for %u:%u\n", + pause ? "pause" : "resume", major, minor); + + pdev = xf86_find_platform_device_by_devnum(major, minor); + if (!pdev) + pInfo = systemd_logind_find_info_ptr_by_devnum(xf86InputDevs, + major, minor); + if (!pdev && !pInfo) { + LogMessage(X_WARNING, "systemd-logind: could not find dev %u:%u\n", + major, minor); + return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; + } + + if (pause) { + /* Our VT_PROCESS usage guarantees we've already given up the vt */ + info->active = info->vt_active = FALSE; + /* Note the actual vtleave has already been handled by xf86Events.c */ + if (pdev) + pdev->flags |= XF86_PDEV_PAUSED; + else { + close(pInfo->fd); + systemd_logind_set_input_fd_for_all_devs(major, minor, -1, FALSE); + } + if (ack) + systemd_logind_ack_pause(info, major, minor); + } + else { + /* info->vt_active gets set by systemd_logind_vtenter() */ + info->active = TRUE; + + if (pdev) + pdev->flags &= ~XF86_PDEV_PAUSED; + else + systemd_logind_set_input_fd_for_all_devs(major, minor, fd, + info->vt_active); + + /* Always call vtenter(), in case there are only legacy video devs */ + systemd_logind_vtenter(); + } + return DBUS_HANDLER_RESULT_HANDLED; +} + +static void +connect_hook(DBusConnection *connection, void *data) +{ + struct systemd_logind_info *info = data; + DBusError error; + DBusMessage *msg = NULL; + DBusMessage *reply = NULL; + dbus_int32_t arg; + char *session = NULL; + + dbus_error_init(&error); + + msg = dbus_message_new_method_call("org.freedesktop.login1", + "/org/freedesktop/login1", "org.freedesktop.login1.Manager", + "GetSessionByPID"); + if (!msg) { + LogMessage(X_ERROR, "systemd-logind: out of memory\n"); + goto cleanup; + } + + arg = getpid(); + if (!dbus_message_append_args(msg, DBUS_TYPE_UINT32, &arg, + DBUS_TYPE_INVALID)) { + LogMessage(X_ERROR, "systemd-logind: out of memory\n"); + goto cleanup; + } + + reply = dbus_connection_send_with_reply_and_block(connection, msg, + DBUS_TIMEOUT, &error); + if (!reply) { + LogMessage(X_ERROR, "systemd-logind: failed to get session: %s\n", + error.message); + goto cleanup; + } + dbus_message_unref(msg); + + if (!dbus_message_get_args(reply, &error, DBUS_TYPE_OBJECT_PATH, &session, + DBUS_TYPE_INVALID)) { + LogMessage(X_ERROR, "systemd-logind: GetSessionByPID: %s\n", + error.message); + goto cleanup; + } + session = XNFstrdup(session); + + dbus_message_unref(reply); + reply = NULL; + + + msg = dbus_message_new_method_call("org.freedesktop.login1", + session, "org.freedesktop.login1.Session", "TakeControl"); + if (!msg) { + LogMessage(X_ERROR, "systemd-logind: out of memory\n"); + goto cleanup; + } + + arg = FALSE; /* Don't forcibly take over over the session */ + if (!dbus_message_append_args(msg, DBUS_TYPE_BOOLEAN, &arg, + DBUS_TYPE_INVALID)) { + LogMessage(X_ERROR, "systemd-logind: out of memory\n"); + goto cleanup; + } + + reply = dbus_connection_send_with_reply_and_block(connection, msg, + DBUS_TIMEOUT, &error); + if (!reply) { + LogMessage(X_ERROR, "systemd-logind: TakeControl failed: %s\n", + error.message); + goto cleanup; + } + + dbus_bus_add_match(connection, + "type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',path='/org/freedesktop/DBus'", + &error); + if (dbus_error_is_set(&error)) { + LogMessage(X_ERROR, "systemd-logind: could not add match: %s\n", + error.message); + goto cleanup; + } + + /* + * HdG: This is not useful with systemd <= 208 since the signal only + * contains invalidated property names there, rather than property, val + * pairs as it should. Instead we just use the first resume / pause now. + */ +#if 0 + snprintf(match, sizeof(match), + "type='signal',sender='org.freedesktop.login1',interface='org.freedesktop.DBus.Properties',member='PropertiesChanged',path='%s'", + session); + dbus_bus_add_match(connection, match, &error); + if (dbus_error_is_set(&error)) { + LogMessage(X_ERROR, "systemd-logind: could not add match: %s\n", + error.message); + goto cleanup; + } +#endif + + if (!dbus_connection_add_filter(connection, message_filter, info, NULL)) { + LogMessage(X_ERROR, "systemd-logind: could not add filter: %s\n", + error.message); + goto cleanup; + } + + LogMessage(X_INFO, "systemd-logind: took control of session %s\n", + session); + info->conn = connection; + info->session = session; + info->vt_active = info->active = TRUE; /* The server owns the vt during init */ + session = NULL; + +cleanup: + free(session); + if (msg) + dbus_message_unref(msg); + if (reply) + dbus_message_unref(reply); + dbus_error_free(&error); +} + +static void +systemd_logind_release_control(struct systemd_logind_info *info) +{ + DBusError error; + DBusMessage *msg = NULL; + DBusMessage *reply = NULL; + + dbus_error_init(&error); + + msg = dbus_message_new_method_call("org.freedesktop.login1", + info->session, "org.freedesktop.login1.Session", "ReleaseControl"); + if (!msg) { + LogMessage(X_ERROR, "systemd-logind: out of memory\n"); + goto cleanup; + } + + reply = dbus_connection_send_with_reply_and_block(info->conn, msg, + DBUS_TIMEOUT, &error); + if (!reply) { + LogMessage(X_ERROR, "systemd-logind: ReleaseControl failed: %s\n", + error.message); + goto cleanup; + } + +cleanup: + if (msg) + dbus_message_unref(msg); + if (reply) + dbus_message_unref(reply); + dbus_error_free(&error); +} + +static void +disconnect_hook(void *data) +{ + struct systemd_logind_info *info = data; + + free(info->session); + info->session = NULL; + info->conn = NULL; +} + +static struct dbus_core_hook core_hook = { + .connect = connect_hook, + .disconnect = disconnect_hook, + .data = &logind_info, +}; + +int +systemd_logind_init(void) +{ + return dbus_core_add_hook(&core_hook); +} + +void +systemd_logind_fini(void) +{ + if (logind_info.session) + systemd_logind_release_control(&logind_info); + + dbus_core_remove_hook(&core_hook); +} diff --git a/xserver/hw/xfree86/os-support/misc/Makefile.in b/xserver/hw/xfree86/os-support/misc/Makefile.in index 7f58e629e..2808d9c86 100644 --- a/xserver/hw/xfree86/os-support/misc/Makefile.in +++ b/xserver/hw/xfree86/os-support/misc/Makefile.in @@ -162,6 +162,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -206,6 +208,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -308,7 +314,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -317,6 +326,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -383,6 +393,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/hw/xfree86/os-support/shared/posix_tty.c b/xserver/hw/xfree86/os-support/shared/posix_tty.c index af4900473..ce758602d 100644 --- a/xserver/hw/xfree86/os-support/shared/posix_tty.c +++ b/xserver/hw/xfree86/os-support/shared/posix_tty.c @@ -61,9 +61,8 @@ #include "xf86Priv.h" #include "xf86_OSlib.h" - -static int -GetBaud (int baudrate) +static int +GetBaud(int baudrate) { #ifdef B300 if (baudrate == 300) @@ -119,62 +118,67 @@ xf86OpenSerial(XF86OptionPtr options) int fd, i; char *dev; - dev = xf86SetStrOption (options, "Device", NULL); + dev = xf86SetStrOption(options, "Device", NULL); if (!dev) { - xf86Msg (X_ERROR, "xf86OpenSerial: No Device specified.\n"); + xf86Msg(X_ERROR, "xf86OpenSerial: No Device specified.\n"); return -1; } + + fd = xf86CheckIntOption(options, "fd", -1); + + if (fd == -1) #ifndef X_PRIVSEP - SYSCALL (fd = open (dev, O_RDWR | O_NONBLOCK)); + SYSCALL(fd = open(dev, O_RDWR | O_NONBLOCK)); #else - fd = priv_open_device (dev); + fd = priv_open_device(dev); #endif + if (fd == -1) { - xf86Msg (X_ERROR, - "xf86OpenSerial: Cannot open device %s\n\t%s.\n", - dev, strerror (errno)); + xf86Msg(X_ERROR, + "xf86OpenSerial: Cannot open device %s\n\t%s.\n", + dev, strerror(errno)); free(dev); return -1; } - if (!isatty (fd)) { + if (!isatty(fd)) { /* Allow non-tty devices to be opened. */ free(dev); return fd; } /* set up default port parameters */ - SYSCALL (tcgetattr (fd, &t)); - t.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR - |IGNCR|ICRNL|IXON); + SYSCALL(tcgetattr(fd, &t)); + t.c_iflag &= ~(IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR + | IGNCR | ICRNL | IXON); t.c_oflag &= ~OPOST; - t.c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN); - t.c_cflag &= ~(CSIZE|PARENB); - t.c_cflag |= CS8|CLOCAL; - - cfsetispeed (&t, B9600); - cfsetospeed (&t, B9600); + t.c_lflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN); + t.c_cflag &= ~(CSIZE | PARENB); + t.c_cflag |= CS8 | CLOCAL; + + cfsetispeed(&t, B9600); + cfsetospeed(&t, B9600); t.c_cc[VMIN] = 1; t.c_cc[VTIME] = 0; - SYSCALL (tcsetattr (fd, TCSANOW, &t)); + SYSCALL(tcsetattr(fd, TCSANOW, &t)); - if (xf86SetSerial (fd, options) == -1) { - SYSCALL (close (fd)); + if (xf86SetSerial(fd, options) == -1) { + SYSCALL(close(fd)); free(dev); return -1; } - SYSCALL (i = fcntl (fd, F_GETFL, 0)); + SYSCALL(i = fcntl(fd, F_GETFL, 0)); if (i == -1) { - SYSCALL (close (fd)); + SYSCALL(close(fd)); free(dev); return -1; } i &= ~O_NONBLOCK; - SYSCALL (i = fcntl (fd, F_SETFL, i)); + SYSCALL(i = fcntl(fd, F_SETFL, i)); if (i == -1) { - SYSCALL (close (fd)); + SYSCALL(close(fd)); free(dev); return -1; } diff --git a/xserver/hw/xfree86/os-support/shared/vidmem.c b/xserver/hw/xfree86/os-support/shared/vidmem.c index 68ed30e41..f473293c7 100644 --- a/xserver/hw/xfree86/os-support/shared/vidmem.c +++ b/xserver/hw/xfree86/os-support/shared/vidmem.c @@ -51,8 +51,8 @@ typedef struct { unsigned long size; - pointer virtBase; - pointer mtrrInfo; + void *virtBase; + void *mtrrInfo; } MappingRec, *MappingPtr; typedef struct { @@ -104,7 +104,7 @@ newMapping(VidMapPtr vp) } static MappingPtr -findMapping(VidMapPtr vp, pointer vbase, unsigned long size) +findMapping(VidMapPtr vp, void *vbase, unsigned long size) { int i; @@ -165,10 +165,10 @@ xf86InitVidMem(void) } } -pointer +void * xf86MapVidMem(int ScreenNum, int Flags, unsigned long Base, unsigned long Size) { - pointer vbase = NULL; + void *vbase = NULL; VidMapPtr vp; MappingPtr mp; @@ -182,7 +182,7 @@ xf86MapVidMem(int ScreenNum, int Flags, unsigned long Base, unsigned long Size) vbase = vidMemInfo.mapMem(ScreenNum, Base, Size, Flags); - if (!vbase || vbase == (pointer) -1) + if (!vbase || vbase == (void *) -1) return NULL; vp = getVidMapRec(ScreenNum); @@ -208,7 +208,7 @@ xf86MapVidMem(int ScreenNum, int Flags, unsigned long Base, unsigned long Size) } void -xf86UnMapVidMem(int ScreenNum, pointer Base, unsigned long Size) +xf86UnMapVidMem(int ScreenNum, void *Base, unsigned long Size) { VidMapPtr vp; MappingPtr mp; diff --git a/xserver/hw/xfree86/os-support/solaris/Makefile.in b/xserver/hw/xfree86/os-support/solaris/Makefile.in index d0cb0f6b7..cbba4d87e 100644 --- a/xserver/hw/xfree86/os-support/solaris/Makefile.in +++ b/xserver/hw/xfree86/os-support/solaris/Makefile.in @@ -217,6 +217,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -261,6 +263,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -363,7 +369,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -372,6 +381,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -438,6 +448,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/hw/xfree86/os-support/solaris/sun_apm.c b/xserver/hw/xfree86/os-support/solaris/sun_apm.c index b6a1432f6..38fa5ecf2 100644 --- a/xserver/hw/xfree86/os-support/solaris/sun_apm.c +++ b/xserver/hw/xfree86/os-support/solaris/sun_apm.c @@ -90,7 +90,7 @@ typedef struct apm_event_info { #define APM_DEVICE "/dev/srn" #define APM_DEVICE1 "/dev/apm" -static pointer APMihPtr = NULL; +static void *APMihPtr = NULL; static void sunCloseAPM(void); static struct { diff --git a/xserver/hw/xfree86/os-support/solaris/sun_init.c b/xserver/hw/xfree86/os-support/solaris/sun_init.c index 68527a577..16fc1b739 100644 --- a/xserver/hw/xfree86/os-support/solaris/sun_init.c +++ b/xserver/hw/xfree86/os-support/solaris/sun_init.c @@ -316,7 +316,7 @@ xf86CloseConsole(void) " attributes (%s)\n", strerror(errno)); } else { - pointer fbdata; + void *fbdata; fbdata = mmap(NULL, fbattr.fbtype.fb_size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); diff --git a/xserver/hw/xfree86/os-support/solaris/sun_vid.c b/xserver/hw/xfree86/os-support/solaris/sun_vid.c index 67ef17689..fc464871d 100644 --- a/xserver/hw/xfree86/os-support/solaris/sun_vid.c +++ b/xserver/hw/xfree86/os-support/solaris/sun_vid.c @@ -107,10 +107,10 @@ solOpenAperture(void) return TRUE; } -static pointer +static void * solMapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int Flags) { - pointer base; + void *base; int fd; int prot; @@ -144,7 +144,7 @@ solMapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int Flags) /* ARGSUSED */ static void -solUnMapVidMem(int ScreenNum, pointer Base, unsigned long Size) +solUnMapVidMem(int ScreenNum, void *Base, unsigned long Size) { if (munmap(Base, Size) != 0) { xf86DrvMsgVerb(ScreenNum, X_WARNING, 0, diff --git a/xserver/hw/xfree86/os-support/stub/Makefile.in b/xserver/hw/xfree86/os-support/stub/Makefile.in index e99acf66a..4e9ea05ab 100644 --- a/xserver/hw/xfree86/os-support/stub/Makefile.in +++ b/xserver/hw/xfree86/os-support/stub/Makefile.in @@ -164,6 +164,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -208,6 +210,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -310,7 +316,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -319,6 +328,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -385,6 +395,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/hw/xfree86/os-support/xf86OSpriv.h b/xserver/hw/xfree86/os-support/xf86OSpriv.h index bd734f554..7f003e8ce 100644 --- a/xserver/hw/xfree86/os-support/xf86OSpriv.h +++ b/xserver/hw/xfree86/os-support/xf86OSpriv.h @@ -32,12 +32,12 @@ #ifndef _XF86OSPRIV_H #define _XF86OSPRIV_H -typedef pointer (*MapMemProcPtr) (int, unsigned long, unsigned long, int); -typedef void (*UnmapMemProcPtr) (int, pointer, unsigned long); -typedef pointer (*SetWCProcPtr) (int, unsigned long, unsigned long, Bool, +typedef void *(*MapMemProcPtr) (int, unsigned long, unsigned long, int); +typedef void (*UnmapMemProcPtr) (int, void *, unsigned long); +typedef void *(*SetWCProcPtr) (int, unsigned long, unsigned long, Bool, MessageType); -typedef void (*ProtectMemProcPtr) (int, pointer, unsigned long, Bool); -typedef void (*UndoWCProcPtr) (int, pointer); +typedef void (*ProtectMemProcPtr) (int, void *, unsigned long, Bool); +typedef void (*UndoWCProcPtr) (int, void *); typedef struct { Bool initialised; diff --git a/xserver/hw/xfree86/os-support/xf86_OSproc.h b/xserver/hw/xfree86/os-support/xf86_OSproc.h index 106168aba..8d27e8b7b 100644 --- a/xserver/hw/xfree86/os-support/xf86_OSproc.h +++ b/xserver/hw/xfree86/os-support/xf86_OSproc.h @@ -132,9 +132,9 @@ _XFUNCPROTOBEGIN /* public functions */ extern _X_EXPORT Bool xf86LinearVidMem(void); extern _X_EXPORT _X_DEPRECATED Bool xf86CheckMTRR(int); -extern _X_EXPORT _X_DEPRECATED pointer xf86MapVidMem(int, int, unsigned long, +extern _X_EXPORT _X_DEPRECATED void *xf86MapVidMem(int, int, unsigned long, unsigned long); -extern _X_EXPORT _X_DEPRECATED void xf86UnMapVidMem(int, pointer, +extern _X_EXPORT _X_DEPRECATED void xf86UnMapVidMem(int, void *, unsigned long); extern _X_EXPORT int xf86ReadBIOS(unsigned long, unsigned long, unsigned char *, int); diff --git a/xserver/hw/xfree86/parser/Configint.h b/xserver/hw/xfree86/parser/Configint.h index 81cc1fc59..e85322006 100644 --- a/xserver/hw/xfree86/parser/Configint.h +++ b/xserver/hw/xfree86/parser/Configint.h @@ -79,6 +79,8 @@ typedef struct { ParserNumType numType; /* used to enforce correct number formatting */ } LexRec, *LexPtr; +extern LexRec xf86_lex_val; + #ifndef TRUE #define TRUE 1 #endif @@ -90,7 +92,7 @@ typedef struct { #include "configProcs.h" #include <stdlib.h> -#define TestFree(a) if (a) { free (a); a = NULL; } +#define TestFree(a) if (a) { free ((void *) a); a = NULL; } #define parsePrologue(typeptr,typerec) typeptr ptr; \ if( (ptr=calloc(1,sizeof(typerec))) == NULL ) { return NULL; } diff --git a/xserver/hw/xfree86/parser/DRI.c b/xserver/hw/xfree86/parser/DRI.c index e8d26255f..6be32d7ea 100644 --- a/xserver/hw/xfree86/parser/DRI.c +++ b/xserver/hw/xfree86/parser/DRI.c @@ -31,11 +31,11 @@ #include <xorg-config.h> #endif +#include "os.h" #include "xf86Parser.h" #include "xf86tokens.h" #include "Configint.h" -extern LexRec val; static xf86ConfigSymTabRec DRITab[] = { {ENDSECTION, "endsection"}, @@ -59,24 +59,24 @@ xf86parseDRISection(void) switch (token) { case GROUP: if ((token = xf86getSubToken(&(ptr->dri_comment))) == STRING) - ptr->dri_group_name = val.str; + ptr->dri_group_name = xf86_lex_val.str; else if (token == NUMBER) - ptr->dri_group = val.num; + ptr->dri_group = xf86_lex_val.num; else Error(GROUP_MSG); break; case MODE: if (xf86getSubToken(&(ptr->dri_comment)) != NUMBER) Error(NUMBER_MSG, "Mode"); - if (val.numType != PARSE_OCTAL) - Error(MUST_BE_OCTAL_MSG, val.num); - ptr->dri_mode = val.num; + if (xf86_lex_val.numType != PARSE_OCTAL) + Error(MUST_BE_OCTAL_MSG, xf86_lex_val.num); + ptr->dri_mode = xf86_lex_val.num; break; case EOF_TOKEN: Error(UNEXPECTED_EOF_MSG); break; case COMMENT: - ptr->dri_comment = xf86addComment(ptr->dri_comment, val.str); + ptr->dri_comment = xf86addComment(ptr->dri_comment, xf86_lex_val.str); break; default: Error(INVALID_KEYWORD_MSG, xf86tokenString()); diff --git a/xserver/hw/xfree86/parser/Device.c b/xserver/hw/xfree86/parser/Device.c index bb1ba88fb..d3ac29351 100644 --- a/xserver/hw/xfree86/parser/Device.c +++ b/xserver/hw/xfree86/parser/Device.c @@ -60,7 +60,6 @@ #include "xf86tokens.h" #include "Configint.h" -extern LexRec val; static xf86ConfigSymTabRec DeviceTab[] = { @@ -72,6 +71,7 @@ xf86ConfigSymTabRec DeviceTab[] = { {RAMDAC, "ramdac"}, {DACSPEED, "dacspeed"}, {CLOCKS, "clocks"}, + {MATCHSEAT, "matchseat"}, {OPTION, "option"}, {VIDEORAM, "videoram"}, {BIOSBASE, "biosbase"}, @@ -107,45 +107,45 @@ xf86parseDeviceSection(void) while ((token = xf86getToken(DeviceTab)) != ENDSECTION) { switch (token) { case COMMENT: - ptr->dev_comment = xf86addComment(ptr->dev_comment, val.str); + ptr->dev_comment = xf86addComment(ptr->dev_comment, xf86_lex_val.str); break; case IDENTIFIER: if (xf86getSubToken(&(ptr->dev_comment)) != STRING) Error(QUOTE_MSG, "Identifier"); if (has_ident == TRUE) Error(MULTIPLE_MSG, "Identifier"); - ptr->dev_identifier = val.str; + ptr->dev_identifier = xf86_lex_val.str; has_ident = TRUE; break; case VENDOR: if (xf86getSubToken(&(ptr->dev_comment)) != STRING) Error(QUOTE_MSG, "Vendor"); - ptr->dev_vendor = val.str; + ptr->dev_vendor = xf86_lex_val.str; break; case BOARD: if (xf86getSubToken(&(ptr->dev_comment)) != STRING) Error(QUOTE_MSG, "Board"); - ptr->dev_board = val.str; + ptr->dev_board = xf86_lex_val.str; break; case CHIPSET: if (xf86getSubToken(&(ptr->dev_comment)) != STRING) Error(QUOTE_MSG, "Chipset"); - ptr->dev_chipset = val.str; + ptr->dev_chipset = xf86_lex_val.str; break; case CARD: if (xf86getSubToken(&(ptr->dev_comment)) != STRING) Error(QUOTE_MSG, "Card"); - ptr->dev_card = val.str; + ptr->dev_card = xf86_lex_val.str; break; case DRIVER: if (xf86getSubToken(&(ptr->dev_comment)) != STRING) Error(QUOTE_MSG, "Driver"); - ptr->dev_driver = val.str; + ptr->dev_driver = xf86_lex_val.str; break; case RAMDAC: if (xf86getSubToken(&(ptr->dev_comment)) != STRING) Error(QUOTE_MSG, "Ramdac"); - ptr->dev_ramdac = val.str; + ptr->dev_ramdac = xf86_lex_val.str; break; case DACSPEED: for (i = 0; i < CONF_MAXDACSPEEDS; i++) @@ -154,11 +154,11 @@ xf86parseDeviceSection(void) Error(DACSPEED_MSG, CONF_MAXDACSPEEDS); } else { - ptr->dev_dacSpeeds[0] = (int) (val.realnum * 1000.0 + 0.5); + ptr->dev_dacSpeeds[0] = (int) (xf86_lex_val.realnum * 1000.0 + 0.5); for (i = 1; i < CONF_MAXDACSPEEDS; i++) { if (xf86getSubToken(&(ptr->dev_comment)) == NUMBER) ptr->dev_dacSpeeds[i] = (int) - (val.realnum * 1000.0 + 0.5); + (xf86_lex_val.realnum * 1000.0 + 0.5); else { xf86unGetToken(token); break; @@ -169,44 +169,44 @@ xf86parseDeviceSection(void) case VIDEORAM: if (xf86getSubToken(&(ptr->dev_comment)) != NUMBER) Error(NUMBER_MSG, "VideoRam"); - ptr->dev_videoram = val.num; + ptr->dev_videoram = xf86_lex_val.num; break; case BIOSBASE: if (xf86getSubToken(&(ptr->dev_comment)) != NUMBER) Error(NUMBER_MSG, "BIOSBase"); - ptr->dev_bios_base = val.num; + ptr->dev_bios_base = xf86_lex_val.num; break; case MEMBASE: if (xf86getSubToken(&(ptr->dev_comment)) != NUMBER) Error(NUMBER_MSG, "MemBase"); - ptr->dev_mem_base = val.num; + ptr->dev_mem_base = xf86_lex_val.num; break; case IOBASE: if (xf86getSubToken(&(ptr->dev_comment)) != NUMBER) Error(NUMBER_MSG, "IOBase"); - ptr->dev_io_base = val.num; + ptr->dev_io_base = xf86_lex_val.num; break; case CLOCKCHIP: if (xf86getSubToken(&(ptr->dev_comment)) != STRING) Error(QUOTE_MSG, "ClockChip"); - ptr->dev_clockchip = val.str; + ptr->dev_clockchip = xf86_lex_val.str; break; case CHIPID: if (xf86getSubToken(&(ptr->dev_comment)) != NUMBER) Error(NUMBER_MSG, "ChipID"); - ptr->dev_chipid = val.num; + ptr->dev_chipid = xf86_lex_val.num; break; case CHIPREV: if (xf86getSubToken(&(ptr->dev_comment)) != NUMBER) Error(NUMBER_MSG, "ChipRev"); - ptr->dev_chiprev = val.num; + ptr->dev_chiprev = xf86_lex_val.num; break; case CLOCKS: token = xf86getSubToken(&(ptr->dev_comment)); for (i = ptr->dev_clocks; token == NUMBER && i < CONF_MAXCLOCKS; i++) { - ptr->dev_clock[i] = (int) (val.realnum * 1000.0 + 0.5); + ptr->dev_clock[i] = (int) (xf86_lex_val.realnum * 1000.0 + 0.5); token = xf86getSubToken(&(ptr->dev_comment)); } ptr->dev_clocks = i; @@ -215,7 +215,12 @@ xf86parseDeviceSection(void) case TEXTCLOCKFRQ: if ((token = xf86getSubToken(&(ptr->dev_comment))) != NUMBER) Error(NUMBER_MSG, "TextClockFreq"); - ptr->dev_textclockfreq = (int) (val.realnum * 1000.0 + 0.5); + ptr->dev_textclockfreq = (int) (xf86_lex_val.realnum * 1000.0 + 0.5); + break; + case MATCHSEAT: + if (xf86getSubToken(&(ptr->dev_comment)) != STRING) + Error(QUOTE_MSG, "MatchSeat"); + ptr->match_seat = xf86_lex_val.str; break; case OPTION: ptr->dev_option_lst = xf86parseOption(ptr->dev_option_lst); @@ -223,17 +228,17 @@ xf86parseDeviceSection(void) case BUSID: if (xf86getSubToken(&(ptr->dev_comment)) != STRING) Error(QUOTE_MSG, "BusID"); - ptr->dev_busid = val.str; + ptr->dev_busid = xf86_lex_val.str; break; case IRQ: if (xf86getSubToken(&(ptr->dev_comment)) != NUMBER) Error(QUOTE_MSG, "IRQ"); - ptr->dev_irq = val.num; + ptr->dev_irq = xf86_lex_val.num; break; case SCREEN: if (xf86getSubToken(&(ptr->dev_comment)) != NUMBER) Error(NUMBER_MSG, "Screen"); - ptr->dev_screen = val.num; + ptr->dev_screen = xf86_lex_val.num; break; case EOF_TOKEN: Error(UNEXPECTED_EOF_MSG); diff --git a/xserver/hw/xfree86/parser/Extensions.c b/xserver/hw/xfree86/parser/Extensions.c index ec0bda4c0..a6fcb56f0 100644 --- a/xserver/hw/xfree86/parser/Extensions.c +++ b/xserver/hw/xfree86/parser/Extensions.c @@ -35,11 +35,11 @@ #include <xorg-config.h> #endif +#include "os.h" #include "xf86Parser.h" #include "xf86tokens.h" #include "Configint.h" -extern LexRec val; static xf86ConfigSymTabRec ExtensionsTab[] = { {ENDSECTION, "endsection"}, @@ -66,7 +66,7 @@ xf86parseExtensionsSection(void) break; case COMMENT: ptr->extensions_comment = - xf86addComment(ptr->extensions_comment, val.str); + xf86addComment(ptr->extensions_comment, xf86_lex_val.str); break; default: Error(INVALID_KEYWORD_MSG, xf86tokenString()); diff --git a/xserver/hw/xfree86/parser/Files.c b/xserver/hw/xfree86/parser/Files.c index 0d3e47ac5..24940a9c2 100644 --- a/xserver/hw/xfree86/parser/Files.c +++ b/xserver/hw/xfree86/parser/Files.c @@ -60,7 +60,6 @@ #include "xf86tokens.h" #include "Configint.h" -extern LexRec val; static xf86ConfigSymTabRec FilesTab[] = { {ENDSECTION, "endsection"}, @@ -89,16 +88,15 @@ xf86parseFilesSection(void) while ((token = xf86getToken(FilesTab)) != ENDSECTION) { switch (token) { case COMMENT: - ptr->file_comment = xf86addComment(ptr->file_comment, val.str); + ptr->file_comment = xf86addComment(ptr->file_comment, xf86_lex_val.str); break; case FONTPATH: if (xf86getSubToken(&(ptr->file_comment)) != STRING) Error(QUOTE_MSG, "FontPath"); j = FALSE; - str = val.str; + str = xf86_lex_val.str; if (ptr->file_fontpath == NULL) { - ptr->file_fontpath = malloc(1); - ptr->file_fontpath[0] = '\0'; + ptr->file_fontpath = calloc(1, 1); i = strlen(str) + 1; } else { @@ -113,13 +111,13 @@ xf86parseFilesSection(void) strcat(ptr->file_fontpath, ","); strcat(ptr->file_fontpath, str); - free(val.str); + free(xf86_lex_val.str); break; case MODULEPATH: if (xf86getSubToken(&(ptr->file_comment)) != STRING) Error(QUOTE_MSG, "ModulePath"); l = FALSE; - str = val.str; + str = xf86_lex_val.str; if (ptr->file_modulepath == NULL) { ptr->file_modulepath = malloc(1); ptr->file_modulepath[0] = '\0'; @@ -138,17 +136,17 @@ xf86parseFilesSection(void) strcat(ptr->file_modulepath, ","); strcat(ptr->file_modulepath, str); - free(val.str); + free(xf86_lex_val.str); break; case LOGFILEPATH: if (xf86getSubToken(&(ptr->file_comment)) != STRING) Error(QUOTE_MSG, "LogFile"); - ptr->file_logfile = val.str; + ptr->file_logfile = xf86_lex_val.str; break; case XKBDIR: if (xf86getSubToken(&(ptr->file_xkbdir)) != STRING) Error(QUOTE_MSG, "XkbDir"); - ptr->file_xkbdir = val.str; + ptr->file_xkbdir = xf86_lex_val.str; break; case EOF_TOKEN: Error(UNEXPECTED_EOF_MSG); diff --git a/xserver/hw/xfree86/parser/Flags.c b/xserver/hw/xfree86/parser/Flags.c index 2461476d1..71b50acf7 100644 --- a/xserver/hw/xfree86/parser/Flags.c +++ b/xserver/hw/xfree86/parser/Flags.c @@ -62,7 +62,6 @@ #include "Xprintf.h" #include "optionstr.h" -extern LexRec val; static xf86ConfigSymTabRec ServerFlagsTab[] = { {ENDSECTION, "endsection"}, @@ -99,7 +98,7 @@ xf86parseFlagsSection(void) switch (token) { case COMMENT: - ptr->flg_comment = xf86addComment(ptr->flg_comment, val.str); + ptr->flg_comment = xf86addComment(ptr->flg_comment, xf86_lex_val.str); break; /* * these old keywords are turned into standard generic options. @@ -135,12 +134,12 @@ xf86parseFlagsSection(void) if (strvalue) { if (tokentype != STRING) Error(QUOTE_MSG, tmp); - valstr = val.str; + valstr = xf86_lex_val.str; } else { if (tokentype != NUMBER) Error(NUMBER_MSG, tmp); - if (asprintf(&valstr, "%d", val.num) == -1) + if (asprintf(&valstr, "%d", xf86_lex_val.num) == -1) valstr = NULL; } } @@ -189,7 +188,7 @@ xf86printServerFlagsSection(FILE * f, XF86ConfFlagsPtr flags) } static XF86OptionPtr -addNewOption2(XF86OptionPtr head, char *name, char *val, int used) +addNewOption2(XF86OptionPtr head, char *name, char *_val, int used) { XF86OptionPtr new, old = NULL; @@ -202,7 +201,7 @@ addNewOption2(XF86OptionPtr head, char *name, char *val, int used) else new = calloc(1, sizeof(*new)); new->opt_name = name; - new->opt_val = val; + new->opt_val = _val; new->opt_used = used; if (old) @@ -211,9 +210,9 @@ addNewOption2(XF86OptionPtr head, char *name, char *val, int used) } XF86OptionPtr -xf86addNewOption(XF86OptionPtr head, char *name, char *val) +xf86addNewOption(XF86OptionPtr head, char *name, char *_val) { - return addNewOption2(head, name, val, 0); + return addNewOption2(head, name, _val, 0); } void @@ -230,11 +229,11 @@ XF86OptionPtr xf86optionListDup(XF86OptionPtr opt) { XF86OptionPtr newopt = NULL; - char *val; + char *_val; while (opt) { - val = opt->opt_val ? strdup(opt->opt_val) : NULL; - newopt = xf86addNewOption(newopt, strdup(opt->opt_name), val); + _val = opt->opt_val ? strdup(opt->opt_val) : NULL; + newopt = xf86addNewOption(newopt, strdup(opt->opt_name), _val); newopt->opt_used = opt->opt_used; if (opt->opt_comment) newopt->opt_comment = strdup(opt->opt_comment); @@ -435,12 +434,12 @@ xf86parseOption(XF86OptionPtr head) return head; } - name = val.str; + name = xf86_lex_val.str; if ((token = xf86getSubToken(&comment)) == STRING) { - option = xf86newOption(name, val.str); + option = xf86newOption(name, xf86_lex_val.str); option->opt_comment = comment; if ((token = xf86getToken(NULL)) == COMMENT) - option->opt_comment = xf86addComment(option->opt_comment, val.str); + option->opt_comment = xf86addComment(option->opt_comment, xf86_lex_val.str); else xf86unGetToken(token); } @@ -448,7 +447,7 @@ xf86parseOption(XF86OptionPtr head) option = xf86newOption(name, NULL); option->opt_comment = comment; if (token == COMMENT) - option->opt_comment = xf86addComment(option->opt_comment, val.str); + option->opt_comment = xf86addComment(option->opt_comment, xf86_lex_val.str); else xf86unGetToken(token); } diff --git a/xserver/hw/xfree86/parser/Input.c b/xserver/hw/xfree86/parser/Input.c index ff2b9acbc..1bfe5c100 100644 --- a/xserver/hw/xfree86/parser/Input.c +++ b/xserver/hw/xfree86/parser/Input.c @@ -61,7 +61,6 @@ #include "xf86tokens.h" #include "Configint.h" -extern LexRec val; static xf86ConfigSymTabRec InputTab[] = { @@ -85,25 +84,25 @@ xf86parseInputSection(void) while ((token = xf86getToken(InputTab)) != ENDSECTION) { switch (token) { case COMMENT: - ptr->inp_comment = xf86addComment(ptr->inp_comment, val.str); + ptr->inp_comment = xf86addComment(ptr->inp_comment, xf86_lex_val.str); break; case IDENTIFIER: if (xf86getSubToken(&(ptr->inp_comment)) != STRING) Error(QUOTE_MSG, "Identifier"); if (has_ident == TRUE) Error(MULTIPLE_MSG, "Identifier"); - ptr->inp_identifier = val.str; + ptr->inp_identifier = xf86_lex_val.str; has_ident = TRUE; break; case DRIVER: if (xf86getSubToken(&(ptr->inp_comment)) != STRING) Error(QUOTE_MSG, "Driver"); - if (strcmp(val.str, "keyboard") == 0) { + if (strcmp(xf86_lex_val.str, "keyboard") == 0) { ptr->inp_driver = strdup("kbd"); - free(val.str); + free(xf86_lex_val.str); } else - ptr->inp_driver = val.str; + ptr->inp_driver = xf86_lex_val.str; break; case OPTION: ptr->inp_option_lst = xf86parseOption(ptr->inp_option_lst); diff --git a/xserver/hw/xfree86/parser/InputClass.c b/xserver/hw/xfree86/parser/InputClass.c index de6a816ea..c2fbd22a7 100644 --- a/xserver/hw/xfree86/parser/InputClass.c +++ b/xserver/hw/xfree86/parser/InputClass.c @@ -33,7 +33,6 @@ #include "xf86tokens.h" #include "Configint.h" -extern LexRec val; static xf86ConfigSymTabRec InputClassTab[] = { @@ -97,25 +96,25 @@ xf86parseInputClassSection(void) while ((token = xf86getToken(InputClassTab)) != ENDSECTION) { switch (token) { case COMMENT: - ptr->comment = xf86addComment(ptr->comment, val.str); + ptr->comment = xf86addComment(ptr->comment, xf86_lex_val.str); break; case IDENTIFIER: if (xf86getSubToken(&(ptr->comment)) != STRING) Error(QUOTE_MSG, "Identifier"); if (has_ident == TRUE) Error(MULTIPLE_MSG, "Identifier"); - ptr->identifier = val.str; + ptr->identifier = xf86_lex_val.str; has_ident = TRUE; break; case DRIVER: if (xf86getSubToken(&(ptr->comment)) != STRING) Error(QUOTE_MSG, "Driver"); - if (strcmp(val.str, "keyboard") == 0) { + if (strcmp(xf86_lex_val.str, "keyboard") == 0) { ptr->driver = strdup("kbd"); - free(val.str); + free(xf86_lex_val.str); } else - ptr->driver = val.str; + ptr->driver = xf86_lex_val.str; break; case OPTION: ptr->option_lst = xf86parseOption(ptr->option_lst); @@ -124,69 +123,69 @@ xf86parseInputClassSection(void) if (xf86getSubToken(&(ptr->comment)) != STRING) Error(QUOTE_MSG, "MatchProduct"); add_group_entry(&ptr->match_product, - xstrtokenize(val.str, TOKEN_SEP)); - free(val.str); + xstrtokenize(xf86_lex_val.str, TOKEN_SEP)); + free(xf86_lex_val.str); break; case MATCH_VENDOR: if (xf86getSubToken(&(ptr->comment)) != STRING) Error(QUOTE_MSG, "MatchVendor"); add_group_entry(&ptr->match_vendor, - xstrtokenize(val.str, TOKEN_SEP)); - free(val.str); + xstrtokenize(xf86_lex_val.str, TOKEN_SEP)); + free(xf86_lex_val.str); break; case MATCH_DEVICE_PATH: if (xf86getSubToken(&(ptr->comment)) != STRING) Error(QUOTE_MSG, "MatchDevicePath"); add_group_entry(&ptr->match_device, - xstrtokenize(val.str, TOKEN_SEP)); - free(val.str); + xstrtokenize(xf86_lex_val.str, TOKEN_SEP)); + free(xf86_lex_val.str); break; case MATCH_OS: if (xf86getSubToken(&(ptr->comment)) != STRING) Error(QUOTE_MSG, "MatchOS"); - add_group_entry(&ptr->match_os, xstrtokenize(val.str, TOKEN_SEP)); - free(val.str); + add_group_entry(&ptr->match_os, xstrtokenize(xf86_lex_val.str, TOKEN_SEP)); + free(xf86_lex_val.str); break; case MATCH_PNPID: if (xf86getSubToken(&(ptr->comment)) != STRING) Error(QUOTE_MSG, "MatchPnPID"); add_group_entry(&ptr->match_pnpid, - xstrtokenize(val.str, TOKEN_SEP)); - free(val.str); + xstrtokenize(xf86_lex_val.str, TOKEN_SEP)); + free(xf86_lex_val.str); break; case MATCH_USBID: if (xf86getSubToken(&(ptr->comment)) != STRING) Error(QUOTE_MSG, "MatchUSBID"); add_group_entry(&ptr->match_usbid, - xstrtokenize(val.str, TOKEN_SEP)); - free(val.str); + xstrtokenize(xf86_lex_val.str, TOKEN_SEP)); + free(xf86_lex_val.str); break; case MATCH_DRIVER: if (xf86getSubToken(&(ptr->comment)) != STRING) Error(QUOTE_MSG, "MatchDriver"); add_group_entry(&ptr->match_driver, - xstrtokenize(val.str, TOKEN_SEP)); - free(val.str); + xstrtokenize(xf86_lex_val.str, TOKEN_SEP)); + free(xf86_lex_val.str); break; case MATCH_TAG: if (xf86getSubToken(&(ptr->comment)) != STRING) Error(QUOTE_MSG, "MatchTag"); - add_group_entry(&ptr->match_tag, xstrtokenize(val.str, TOKEN_SEP)); - free(val.str); + add_group_entry(&ptr->match_tag, xstrtokenize(xf86_lex_val.str, TOKEN_SEP)); + free(xf86_lex_val.str); break; case MATCH_LAYOUT: if (xf86getSubToken(&(ptr->comment)) != STRING) Error(QUOTE_MSG, "MatchLayout"); add_group_entry(&ptr->match_layout, - xstrtokenize(val.str, TOKEN_SEP)); - free(val.str); + xstrtokenize(xf86_lex_val.str, TOKEN_SEP)); + free(xf86_lex_val.str); break; case MATCH_IS_KEYBOARD: if (xf86getSubToken(&(ptr->comment)) != STRING) Error(QUOTE_MSG, "MatchIsKeyboard"); ptr->is_keyboard.set = xf86getBoolValue(&ptr->is_keyboard.val, - val.str); - free(val.str); + xf86_lex_val.str); + free(xf86_lex_val.str); if (!ptr->is_keyboard.set) Error(BOOL_MSG, "MatchIsKeyboard"); break; @@ -194,8 +193,8 @@ xf86parseInputClassSection(void) if (xf86getSubToken(&(ptr->comment)) != STRING) Error(QUOTE_MSG, "MatchIsPointer"); ptr->is_pointer.set = xf86getBoolValue(&ptr->is_pointer.val, - val.str); - free(val.str); + xf86_lex_val.str); + free(xf86_lex_val.str); if (!ptr->is_pointer.set) Error(BOOL_MSG, "MatchIsPointer"); break; @@ -203,16 +202,16 @@ xf86parseInputClassSection(void) if (xf86getSubToken(&(ptr->comment)) != STRING) Error(QUOTE_MSG, "MatchIsJoystick"); ptr->is_joystick.set = xf86getBoolValue(&ptr->is_joystick.val, - val.str); - free(val.str); + xf86_lex_val.str); + free(xf86_lex_val.str); if (!ptr->is_joystick.set) Error(BOOL_MSG, "MatchIsJoystick"); break; case MATCH_IS_TABLET: if (xf86getSubToken(&(ptr->comment)) != STRING) Error(QUOTE_MSG, "MatchIsTablet"); - ptr->is_tablet.set = xf86getBoolValue(&ptr->is_tablet.val, val.str); - free(val.str); + ptr->is_tablet.set = xf86getBoolValue(&ptr->is_tablet.val, xf86_lex_val.str); + free(xf86_lex_val.str); if (!ptr->is_tablet.set) Error(BOOL_MSG, "MatchIsTablet"); break; @@ -220,8 +219,8 @@ xf86parseInputClassSection(void) if (xf86getSubToken(&(ptr->comment)) != STRING) Error(QUOTE_MSG, "MatchIsTouchpad"); ptr->is_touchpad.set = xf86getBoolValue(&ptr->is_touchpad.val, - val.str); - free(val.str); + xf86_lex_val.str); + free(xf86_lex_val.str); if (!ptr->is_touchpad.set) Error(BOOL_MSG, "MatchIsTouchpad"); break; @@ -229,8 +228,8 @@ xf86parseInputClassSection(void) if (xf86getSubToken(&(ptr->comment)) != STRING) Error(QUOTE_MSG, "MatchIsTouchscreen"); ptr->is_touchscreen.set = xf86getBoolValue(&ptr->is_touchscreen.val, - val.str); - free(val.str); + xf86_lex_val.str); + free(xf86_lex_val.str); if (!ptr->is_touchscreen.set) Error(BOOL_MSG, "MatchIsTouchscreen"); break; diff --git a/xserver/hw/xfree86/parser/Layout.c b/xserver/hw/xfree86/parser/Layout.c index cbd8d247a..994b31ae4 100644 --- a/xserver/hw/xfree86/parser/Layout.c +++ b/xserver/hw/xfree86/parser/Layout.c @@ -65,12 +65,12 @@ /* Needed for auto server layout */ extern int xf86CheckBoolOption(void *optlist, const char *name, int deflt); -extern LexRec val; static xf86ConfigSymTabRec LayoutTab[] = { {ENDSECTION, "endsection"}, {SCREEN, "screen"}, {IDENTIFIER, "identifier"}, + {MATCHSEAT, "matchseat"}, {INACTIVE, "inactive"}, {INPUTDEVICE, "inputdevice"}, {OPTION, "option"}, @@ -100,16 +100,21 @@ xf86parseLayoutSection(void) while ((token = xf86getToken(LayoutTab)) != ENDSECTION) { switch (token) { case COMMENT: - ptr->lay_comment = xf86addComment(ptr->lay_comment, val.str); + ptr->lay_comment = xf86addComment(ptr->lay_comment, xf86_lex_val.str); break; case IDENTIFIER: if (xf86getSubToken(&(ptr->lay_comment)) != STRING) Error(QUOTE_MSG, "Identifier"); if (has_ident == TRUE) Error(MULTIPLE_MSG, "Identifier"); - ptr->lay_identifier = val.str; + ptr->lay_identifier = xf86_lex_val.str; has_ident = TRUE; break; + case MATCHSEAT: + if (xf86getSubToken(&(ptr->lay_comment)) != STRING) + Error(QUOTE_MSG, "MatchSeat"); + ptr->match_seat = xf86_lex_val.str; + break; case INACTIVE: { XF86ConfInactivePtr iptr; @@ -120,7 +125,7 @@ xf86parseLayoutSection(void) free(iptr); Error(INACTIVE_MSG); } - iptr->inactive_device_str = val.str; + iptr->inactive_device_str = xf86_lex_val.str; ptr->lay_inactive_lst = (XF86ConfInactivePtr) xf86addListItem((glp) ptr->lay_inactive_lst, (glp) iptr); } @@ -138,7 +143,7 @@ xf86parseLayoutSection(void) aptr->adj_y = 0; aptr->adj_refscreen = NULL; if ((token = xf86getSubToken(&(ptr->lay_comment))) == NUMBER) - aptr->adj_scrnum = val.num; + aptr->adj_scrnum = xf86_lex_val.num; else xf86unGetToken(token); token = xf86getSubToken(&(ptr->lay_comment)); @@ -146,7 +151,7 @@ xf86parseLayoutSection(void) free(aptr); Error(SCREEN_MSG); } - aptr->adj_screen_str = val.str; + aptr->adj_screen_str = xf86_lex_val.str; token = xf86getSubTokenWithTab(&(ptr->lay_comment), AdjTab); switch (token) { @@ -186,13 +191,13 @@ xf86parseLayoutSection(void) if (absKeyword) token = xf86getSubToken(&(ptr->lay_comment)); if (token == NUMBER) { - aptr->adj_x = val.num; + aptr->adj_x = xf86_lex_val.num; token = xf86getSubToken(&(ptr->lay_comment)); if (token != NUMBER) { free(aptr); Error(INVALID_SCR_MSG); } - aptr->adj_y = val.num; + aptr->adj_y = xf86_lex_val.num; } else { if (absKeyword) { @@ -213,46 +218,46 @@ xf86parseLayoutSection(void) free(aptr); Error(INVALID_SCR_MSG); } - aptr->adj_refscreen = val.str; + aptr->adj_refscreen = xf86_lex_val.str; if (aptr->adj_where == CONF_ADJ_RELATIVE) { token = xf86getSubToken(&(ptr->lay_comment)); if (token != NUMBER) { free(aptr); Error(INVALID_SCR_MSG); } - aptr->adj_x = val.num; + aptr->adj_x = xf86_lex_val.num; token = xf86getSubToken(&(ptr->lay_comment)); if (token != NUMBER) { free(aptr); Error(INVALID_SCR_MSG); } - aptr->adj_y = val.num; + aptr->adj_y = xf86_lex_val.num; } break; case CONF_ADJ_OBSOLETE: /* top */ - aptr->adj_top_str = val.str; + aptr->adj_top_str = xf86_lex_val.str; /* bottom */ if (xf86getSubToken(&(ptr->lay_comment)) != STRING) { free(aptr); Error(SCREEN_MSG); } - aptr->adj_bottom_str = val.str; + aptr->adj_bottom_str = xf86_lex_val.str; /* left */ if (xf86getSubToken(&(ptr->lay_comment)) != STRING) { free(aptr); Error(SCREEN_MSG); } - aptr->adj_left_str = val.str; + aptr->adj_left_str = xf86_lex_val.str; /* right */ if (xf86getSubToken(&(ptr->lay_comment)) != STRING) { free(aptr); Error(SCREEN_MSG); } - aptr->adj_right_str = val.str; + aptr->adj_right_str = xf86_lex_val.str; } ptr->lay_adjacency_lst = (XF86ConfAdjacencyPtr) @@ -270,10 +275,10 @@ xf86parseLayoutSection(void) free(iptr); Error(INPUTDEV_MSG); } - iptr->iref_inputdev_str = val.str; + iptr->iref_inputdev_str = xf86_lex_val.str; while ((token = xf86getSubToken(&(ptr->lay_comment))) == STRING) { iptr->iref_option_lst = - xf86addNewOption(iptr->iref_option_lst, val.str, NULL); + xf86addNewOption(iptr->iref_option_lst, xf86_lex_val.str, NULL); } xf86unGetToken(token); ptr->lay_input_lst = (XF86ConfInputrefPtr) diff --git a/xserver/hw/xfree86/parser/Makefile.am b/xserver/hw/xfree86/parser/Makefile.am index 3bf62e8af..4d0bb4fd8 100644 --- a/xserver/hw/xfree86/parser/Makefile.am +++ b/xserver/hw/xfree86/parser/Makefile.am @@ -14,6 +14,7 @@ INTERNAL_SOURCES= \ Flags.c \ Input.c \ InputClass.c \ + OutputClass.c \ Layout.c \ Module.c \ Video.c \ diff --git a/xserver/hw/xfree86/parser/Makefile.in b/xserver/hw/xfree86/parser/Makefile.in index 96a7ac583..56b4ae003 100644 --- a/xserver/hw/xfree86/parser/Makefile.in +++ b/xserver/hw/xfree86/parser/Makefile.in @@ -105,13 +105,13 @@ LTLIBRARIES = $(lib_LTLIBRARIES) $(noinst_LTLIBRARIES) libxf86config_la_LIBADD = am__objects_1 = libxf86config_la-Device.lo libxf86config_la-Files.lo \ libxf86config_la-Flags.lo libxf86config_la-Input.lo \ - libxf86config_la-InputClass.lo libxf86config_la-Layout.lo \ - libxf86config_la-Module.lo libxf86config_la-Video.lo \ - libxf86config_la-Monitor.lo libxf86config_la-Pointer.lo \ - libxf86config_la-Screen.lo libxf86config_la-Vendor.lo \ - libxf86config_la-read.lo libxf86config_la-scan.lo \ - libxf86config_la-write.lo libxf86config_la-DRI.lo \ - libxf86config_la-Extensions.lo + libxf86config_la-InputClass.lo libxf86config_la-OutputClass.lo \ + libxf86config_la-Layout.lo libxf86config_la-Module.lo \ + libxf86config_la-Video.lo libxf86config_la-Monitor.lo \ + libxf86config_la-Pointer.lo libxf86config_la-Screen.lo \ + libxf86config_la-Vendor.lo libxf86config_la-read.lo \ + libxf86config_la-scan.lo libxf86config_la-write.lo \ + libxf86config_la-DRI.lo libxf86config_la-Extensions.lo am_libxf86config_la_OBJECTS = libxf86config_la-xprintf.lo \ $(am__objects_1) libxf86config_la_OBJECTS = $(am_libxf86config_la_OBJECTS) @@ -127,8 +127,9 @@ libxf86config_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ @INSTALL_LIBXF86CONFIG_TRUE@ $(libdir) libxf86config_internal_la_LIBADD = am__objects_2 = Device.lo Files.lo Flags.lo Input.lo InputClass.lo \ - Layout.lo Module.lo Video.lo Monitor.lo Pointer.lo Screen.lo \ - Vendor.lo read.lo scan.lo write.lo DRI.lo Extensions.lo + OutputClass.lo Layout.lo Module.lo Video.lo Monitor.lo \ + Pointer.lo Screen.lo Vendor.lo read.lo scan.lo write.lo DRI.lo \ + Extensions.lo am_libxf86config_internal_la_OBJECTS = $(am__objects_2) libxf86config_internal_la_OBJECTS = \ $(am_libxf86config_internal_la_OBJECTS) @@ -219,6 +220,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -263,6 +266,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -365,7 +372,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -374,6 +384,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -440,6 +451,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ @@ -525,6 +540,7 @@ INTERNAL_SOURCES = \ Flags.c \ Input.c \ InputClass.c \ + OutputClass.c \ Layout.c \ Module.c \ Video.c \ @@ -663,6 +679,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Layout.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Module.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Monitor.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/OutputClass.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Pointer.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Screen.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Vendor.Plo@am__quote@ @@ -677,6 +694,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libxf86config_la-Layout.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libxf86config_la-Module.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libxf86config_la-Monitor.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libxf86config_la-OutputClass.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libxf86config_la-Pointer.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libxf86config_la-Screen.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libxf86config_la-Vendor.Plo@am__quote@ @@ -752,6 +770,13 @@ libxf86config_la-InputClass.lo: InputClass.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxf86config_la_CFLAGS) $(CFLAGS) -c -o libxf86config_la-InputClass.lo `test -f 'InputClass.c' || echo '$(srcdir)/'`InputClass.c +libxf86config_la-OutputClass.lo: OutputClass.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxf86config_la_CFLAGS) $(CFLAGS) -MT libxf86config_la-OutputClass.lo -MD -MP -MF $(DEPDIR)/libxf86config_la-OutputClass.Tpo -c -o libxf86config_la-OutputClass.lo `test -f 'OutputClass.c' || echo '$(srcdir)/'`OutputClass.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libxf86config_la-OutputClass.Tpo $(DEPDIR)/libxf86config_la-OutputClass.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='OutputClass.c' object='libxf86config_la-OutputClass.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxf86config_la_CFLAGS) $(CFLAGS) -c -o libxf86config_la-OutputClass.lo `test -f 'OutputClass.c' || echo '$(srcdir)/'`OutputClass.c + libxf86config_la-Layout.lo: Layout.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxf86config_la_CFLAGS) $(CFLAGS) -MT libxf86config_la-Layout.lo -MD -MP -MF $(DEPDIR)/libxf86config_la-Layout.Tpo -c -o libxf86config_la-Layout.lo `test -f 'Layout.c' || echo '$(srcdir)/'`Layout.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libxf86config_la-Layout.Tpo $(DEPDIR)/libxf86config_la-Layout.Plo diff --git a/xserver/hw/xfree86/parser/Module.c b/xserver/hw/xfree86/parser/Module.c index 87ddfc635..e2d9120cb 100644 --- a/xserver/hw/xfree86/parser/Module.c +++ b/xserver/hw/xfree86/parser/Module.c @@ -60,7 +60,6 @@ #include "xf86tokens.h" #include "Configint.h" -extern LexRec val; static xf86ConfigSymTabRec SubModuleTab[] = { {ENDSUBSECTION, "endsubsection"}, @@ -95,7 +94,7 @@ xf86parseModuleSubSection(XF86LoadPtr head, char *name) while ((token = xf86getToken(SubModuleTab)) != ENDSUBSECTION) { switch (token) { case COMMENT: - ptr->load_comment = xf86addComment(ptr->load_comment, val.str); + ptr->load_comment = xf86addComment(ptr->load_comment, xf86_lex_val.str); break; case OPTION: ptr->load_opt = xf86parseOption(ptr->load_opt); @@ -126,34 +125,34 @@ xf86parseModuleSection(void) while ((token = xf86getToken(ModuleTab)) != ENDSECTION) { switch (token) { case COMMENT: - ptr->mod_comment = xf86addComment(ptr->mod_comment, val.str); + ptr->mod_comment = xf86addComment(ptr->mod_comment, xf86_lex_val.str); break; case LOAD: if (xf86getSubToken(&(ptr->mod_comment)) != STRING) Error(QUOTE_MSG, "Load"); ptr->mod_load_lst = - xf86addNewLoadDirective(ptr->mod_load_lst, val.str, + xf86addNewLoadDirective(ptr->mod_load_lst, xf86_lex_val.str, XF86_LOAD_MODULE, NULL); break; case DISABLE: if (xf86getSubToken(&(ptr->mod_comment)) != STRING) Error(QUOTE_MSG, "Disable"); ptr->mod_disable_lst = - xf86addNewLoadDirective(ptr->mod_disable_lst, val.str, + xf86addNewLoadDirective(ptr->mod_disable_lst, xf86_lex_val.str, XF86_DISABLE_MODULE, NULL); break; case LOAD_DRIVER: if (xf86getSubToken(&(ptr->mod_comment)) != STRING) Error(QUOTE_MSG, "LoadDriver"); ptr->mod_load_lst = - xf86addNewLoadDirective(ptr->mod_load_lst, val.str, + xf86addNewLoadDirective(ptr->mod_load_lst, xf86_lex_val.str, XF86_LOAD_DRIVER, NULL); break; case SUBSECTION: if (xf86getSubToken(&(ptr->mod_comment)) != STRING) Error(QUOTE_MSG, "SubSection"); ptr->mod_load_lst = - xf86parseModuleSubSection(ptr->mod_load_lst, val.str); + xf86parseModuleSubSection(ptr->mod_load_lst, xf86_lex_val.str); break; case EOF_TOKEN: Error(UNEXPECTED_EOF_MSG); @@ -218,7 +217,7 @@ xf86printModuleSection(FILE * cf, XF86ConfModulePtr ptr) } XF86LoadPtr -xf86addNewLoadDirective(XF86LoadPtr head, char *name, int type, +xf86addNewLoadDirective(XF86LoadPtr head, const char *name, int type, XF86OptionPtr opts) { XF86LoadPtr new; @@ -232,7 +231,7 @@ xf86addNewLoadDirective(XF86LoadPtr head, char *name, int type, new->list.next = NULL; if ((token = xf86getToken(NULL)) == COMMENT) - new->load_comment = xf86addComment(new->load_comment, val.str); + new->load_comment = xf86addComment(new->load_comment, xf86_lex_val.str); else xf86unGetToken(token); diff --git a/xserver/hw/xfree86/parser/Monitor.c b/xserver/hw/xfree86/parser/Monitor.c index 36b4ebe35..8aebce079 100644 --- a/xserver/hw/xfree86/parser/Monitor.c +++ b/xserver/hw/xfree86/parser/Monitor.c @@ -60,7 +60,6 @@ #include "xf86tokens.h" #include "Configint.h" -extern LexRec val; static xf86ConfigSymTabRec MonitorTab[] = { {ENDSECTION, "endsection"}, @@ -140,52 +139,52 @@ xf86parseModeLine(void) /* Identifier */ if (xf86getSubToken(&(ptr->ml_comment)) != STRING) Error("ModeLine identifier expected"); - ptr->ml_identifier = val.str; + ptr->ml_identifier = xf86_lex_val.str; /* DotClock */ if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER) Error("ModeLine dotclock expected"); - ptr->ml_clock = (int) (val.realnum * 1000.0 + 0.5); + ptr->ml_clock = (int) (xf86_lex_val.realnum * 1000.0 + 0.5); /* HDisplay */ if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER) Error("ModeLine Hdisplay expected"); - ptr->ml_hdisplay = val.num; + ptr->ml_hdisplay = xf86_lex_val.num; /* HSyncStart */ if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER) Error("ModeLine HSyncStart expected"); - ptr->ml_hsyncstart = val.num; + ptr->ml_hsyncstart = xf86_lex_val.num; /* HSyncEnd */ if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER) Error("ModeLine HSyncEnd expected"); - ptr->ml_hsyncend = val.num; + ptr->ml_hsyncend = xf86_lex_val.num; /* HTotal */ if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER) Error("ModeLine HTotal expected"); - ptr->ml_htotal = val.num; + ptr->ml_htotal = xf86_lex_val.num; /* VDisplay */ if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER) Error("ModeLine Vdisplay expected"); - ptr->ml_vdisplay = val.num; + ptr->ml_vdisplay = xf86_lex_val.num; /* VSyncStart */ if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER) Error("ModeLine VSyncStart expected"); - ptr->ml_vsyncstart = val.num; + ptr->ml_vsyncstart = xf86_lex_val.num; /* VSyncEnd */ if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER) Error("ModeLine VSyncEnd expected"); - ptr->ml_vsyncend = val.num; + ptr->ml_vsyncend = xf86_lex_val.num; /* VTotal */ if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER) Error("ModeLine VTotal expected"); - ptr->ml_vtotal = val.num; + ptr->ml_vtotal = xf86_lex_val.num; token = xf86getSubTokenWithTab(&(ptr->ml_comment), TimingTab); while ((token == TT_INTERLACE) || (token == TT_PHSYNC) || @@ -226,7 +225,7 @@ xf86parseModeLine(void) case TT_HSKEW: if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER) Error(NUMBER_MSG, "Hskew"); - ptr->ml_hskew = val.num; + ptr->ml_hskew = xf86_lex_val.num; ptr->ml_flags |= XF86CONF_HSKEW; break; case TT_BCAST: @@ -235,7 +234,7 @@ xf86parseModeLine(void) case TT_VSCAN: if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER) Error(NUMBER_MSG, "Vscan"); - ptr->ml_vscan = val.num; + ptr->ml_vscan = xf86_lex_val.num; ptr->ml_flags |= XF86CONF_VSCAN; break; case EOF_TOKEN: @@ -265,58 +264,58 @@ xf86parseVerboseMode(void) if (xf86getSubToken(&(ptr->ml_comment)) != STRING) Error("Mode name expected"); - ptr->ml_identifier = val.str; + ptr->ml_identifier = xf86_lex_val.str; while ((token = xf86getToken(ModeTab)) != ENDMODE) { switch (token) { case COMMENT: - ptr->ml_comment = xf86addComment(ptr->ml_comment, val.str); + ptr->ml_comment = xf86addComment(ptr->ml_comment, xf86_lex_val.str); break; case DOTCLOCK: if ((token = xf86getSubToken(&(ptr->ml_comment))) != NUMBER) Error(NUMBER_MSG, "DotClock"); - ptr->ml_clock = (int) (val.realnum * 1000.0 + 0.5); + ptr->ml_clock = (int) (xf86_lex_val.realnum * 1000.0 + 0.5); had_dotclock = 1; break; case HTIMINGS: if (xf86getSubToken(&(ptr->ml_comment)) == NUMBER) - ptr->ml_hdisplay = val.num; + ptr->ml_hdisplay = xf86_lex_val.num; else Error("Horizontal display expected"); if (xf86getSubToken(&(ptr->ml_comment)) == NUMBER) - ptr->ml_hsyncstart = val.num; + ptr->ml_hsyncstart = xf86_lex_val.num; else Error("Horizontal sync start expected"); if (xf86getSubToken(&(ptr->ml_comment)) == NUMBER) - ptr->ml_hsyncend = val.num; + ptr->ml_hsyncend = xf86_lex_val.num; else Error("Horizontal sync end expected"); if (xf86getSubToken(&(ptr->ml_comment)) == NUMBER) - ptr->ml_htotal = val.num; + ptr->ml_htotal = xf86_lex_val.num; else Error("Horizontal total expected"); had_htimings = 1; break; case VTIMINGS: if (xf86getSubToken(&(ptr->ml_comment)) == NUMBER) - ptr->ml_vdisplay = val.num; + ptr->ml_vdisplay = xf86_lex_val.num; else Error("Vertical display expected"); if (xf86getSubToken(&(ptr->ml_comment)) == NUMBER) - ptr->ml_vsyncstart = val.num; + ptr->ml_vsyncstart = xf86_lex_val.num; else Error("Vertical sync start expected"); if (xf86getSubToken(&(ptr->ml_comment)) == NUMBER) - ptr->ml_vsyncend = val.num; + ptr->ml_vsyncend = xf86_lex_val.num; else Error("Vertical sync end expected"); if (xf86getSubToken(&(ptr->ml_comment)) == NUMBER) - ptr->ml_vtotal = val.num; + ptr->ml_vtotal = xf86_lex_val.num; else Error("Vertical total expected"); had_vtimings = 1; @@ -370,13 +369,13 @@ xf86parseVerboseMode(void) if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER) Error("Horizontal skew expected"); ptr->ml_flags |= XF86CONF_HSKEW; - ptr->ml_hskew = val.num; + ptr->ml_hskew = xf86_lex_val.num; break; case VSCAN: if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER) Error("Vertical scan count expected"); ptr->ml_flags |= XF86CONF_VSCAN; - ptr->ml_vscan = val.num; + ptr->ml_vscan = xf86_lex_val.num; break; case EOF_TOKEN: Error(UNEXPECTED_EOF_MSG); @@ -413,25 +412,25 @@ xf86parseMonitorSection(void) while ((token = xf86getToken(MonitorTab)) != ENDSECTION) { switch (token) { case COMMENT: - ptr->mon_comment = xf86addComment(ptr->mon_comment, val.str); + ptr->mon_comment = xf86addComment(ptr->mon_comment, xf86_lex_val.str); break; case IDENTIFIER: if (xf86getSubToken(&(ptr->mon_comment)) != STRING) Error(QUOTE_MSG, "Identifier"); if (has_ident == TRUE) Error(MULTIPLE_MSG, "Identifier"); - ptr->mon_identifier = val.str; + ptr->mon_identifier = xf86_lex_val.str; has_ident = TRUE; break; case VENDOR: if (xf86getSubToken(&(ptr->mon_comment)) != STRING) Error(QUOTE_MSG, "Vendor"); - ptr->mon_vendor = val.str; + ptr->mon_vendor = xf86_lex_val.str; break; case MODEL: if (xf86getSubToken(&(ptr->mon_comment)) != STRING) Error(QUOTE_MSG, "ModelName"); - ptr->mon_modelname = val.str; + ptr->mon_modelname = xf86_lex_val.str; break; case MODE: HANDLE_LIST(mon_modeline_lst, xf86parseVerboseMode, @@ -444,10 +443,10 @@ xf86parseMonitorSection(void) case DISPLAYSIZE: if (xf86getSubToken(&(ptr->mon_comment)) != NUMBER) Error(DISPLAYSIZE_MSG); - ptr->mon_width = val.realnum; + ptr->mon_width = xf86_lex_val.realnum; if (xf86getSubToken(&(ptr->mon_comment)) != NUMBER) Error(DISPLAYSIZE_MSG); - ptr->mon_height = val.realnum; + ptr->mon_height = xf86_lex_val.realnum; break; case HORIZSYNC: @@ -456,7 +455,7 @@ xf86parseMonitorSection(void) do { if (ptr->mon_n_hsync >= CONF_MAX_HSYNC) Error("Sorry. Too many horizontal sync intervals."); - ptr->mon_hsync[ptr->mon_n_hsync].lo = val.realnum; + ptr->mon_hsync[ptr->mon_n_hsync].lo = xf86_lex_val.realnum; switch (token = xf86getSubToken(&(ptr->mon_comment))) { case COMMA: ptr->mon_hsync[ptr->mon_n_hsync].hi = @@ -464,10 +463,10 @@ xf86parseMonitorSection(void) break; case DASH: if (xf86getSubToken(&(ptr->mon_comment)) != NUMBER || - (float) val.realnum < + (float) xf86_lex_val.realnum < ptr->mon_hsync[ptr->mon_n_hsync].lo) Error(HORIZSYNC_MSG); - ptr->mon_hsync[ptr->mon_n_hsync].hi = val.realnum; + ptr->mon_hsync[ptr->mon_n_hsync].hi = xf86_lex_val.realnum; if ((token = xf86getSubToken(&(ptr->mon_comment))) == COMMA) break; ptr->mon_n_hsync++; @@ -491,7 +490,7 @@ xf86parseMonitorSection(void) if (xf86getSubToken(&(ptr->mon_comment)) != NUMBER) Error(VERTREFRESH_MSG); do { - ptr->mon_vrefresh[ptr->mon_n_vrefresh].lo = val.realnum; + ptr->mon_vrefresh[ptr->mon_n_vrefresh].lo = xf86_lex_val.realnum; switch (token = xf86getSubToken(&(ptr->mon_comment))) { case COMMA: ptr->mon_vrefresh[ptr->mon_n_vrefresh].hi = @@ -499,10 +498,10 @@ xf86parseMonitorSection(void) break; case DASH: if (xf86getSubToken(&(ptr->mon_comment)) != NUMBER || - (float) val.realnum < + (float) xf86_lex_val.realnum < ptr->mon_vrefresh[ptr->mon_n_vrefresh].lo) Error(VERTREFRESH_MSG); - ptr->mon_vrefresh[ptr->mon_n_vrefresh].hi = val.realnum; + ptr->mon_vrefresh[ptr->mon_n_vrefresh].hi = xf86_lex_val.realnum; if ((token = xf86getSubToken(&(ptr->mon_comment))) == COMMA) break; ptr->mon_n_vrefresh++; @@ -530,11 +529,11 @@ xf86parseMonitorSection(void) } else { ptr->mon_gamma_red = ptr->mon_gamma_green = - ptr->mon_gamma_blue = val.realnum; + ptr->mon_gamma_blue = xf86_lex_val.realnum; if (xf86getSubToken(&(ptr->mon_comment)) == NUMBER) { - ptr->mon_gamma_green = val.realnum; + ptr->mon_gamma_green = xf86_lex_val.realnum; if (xf86getSubToken(&(ptr->mon_comment)) == NUMBER) { - ptr->mon_gamma_blue = val.realnum; + ptr->mon_gamma_blue = xf86_lex_val.realnum; } else { Error(INVALID_GAMMA_MSG); @@ -558,7 +557,7 @@ xf86parseMonitorSection(void) referenced here */ mptr = calloc(1, sizeof(XF86ConfModesLinkRec)); mptr->list.next = NULL; - mptr->ml_modes_str = val.str; + mptr->ml_modes_str = xf86_lex_val.str; mptr->ml_modes = NULL; ptr->mon_modes_sect_lst = (XF86ConfModesLinkPtr) xf86addListItem((GenericListPtr) ptr->mon_modes_sect_lst, @@ -599,14 +598,14 @@ xf86parseModesSection(void) while ((token = xf86getToken(ModesTab)) != ENDSECTION) { switch (token) { case COMMENT: - ptr->modes_comment = xf86addComment(ptr->modes_comment, val.str); + ptr->modes_comment = xf86addComment(ptr->modes_comment, xf86_lex_val.str); break; case IDENTIFIER: if (xf86getSubToken(&(ptr->modes_comment)) != STRING) Error(QUOTE_MSG, "Identifier"); if (has_ident == TRUE) Error(MULTIPLE_MSG, "Identifier"); - ptr->modes_identifier = val.str; + ptr->modes_identifier = xf86_lex_val.str; has_ident = TRUE; break; case MODE: diff --git a/xserver/hw/xfree86/parser/OutputClass.c b/xserver/hw/xfree86/parser/OutputClass.c new file mode 100644 index 000000000..7e9a8ac1a --- /dev/null +++ b/xserver/hw/xfree86/parser/OutputClass.c @@ -0,0 +1,167 @@ +/* + * Copyright (c) 2014 NVIDIA Corporation. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifdef HAVE_XORG_CONFIG_H +#include <xorg-config.h> +#endif + +#include "os.h" +#include "xf86Parser.h" +#include "xf86tokens.h" +#include "Configint.h" + +static +xf86ConfigSymTabRec OutputClassTab[] = { + {ENDSECTION, "endsection"}, + {IDENTIFIER, "identifier"}, + {DRIVER, "driver"}, + {MATCH_DRIVER, "matchdriver"}, + {-1, ""}, +}; + +#define CLEANUP xf86freeOutputClassList + +#define TOKEN_SEP "|" + +static void +add_group_entry(struct xorg_list *head, char **values) +{ + xf86MatchGroup *group; + + group = malloc(sizeof(*group)); + if (group) { + group->values = values; + xorg_list_add(&group->entry, head); + } +} + +XF86ConfOutputClassPtr +xf86parseOutputClassSection(void) +{ + int has_ident = FALSE; + int token; + + parsePrologue(XF86ConfOutputClassPtr, XF86ConfOutputClassRec) + + /* Initialize MatchGroup lists */ + xorg_list_init(&ptr->match_driver); + + while ((token = xf86getToken(OutputClassTab)) != ENDSECTION) { + switch (token) { + case COMMENT: + ptr->comment = xf86addComment(ptr->comment, xf86_lex_val.str); + break; + case IDENTIFIER: + if (xf86getSubToken(&(ptr->comment)) != STRING) + Error(QUOTE_MSG, "Identifier"); + if (has_ident == TRUE) + Error(MULTIPLE_MSG, "Identifier"); + ptr->identifier = xf86_lex_val.str; + has_ident = TRUE; + break; + case DRIVER: + if (xf86getSubToken(&(ptr->comment)) != STRING) + Error(QUOTE_MSG, "Driver"); + else + ptr->driver = xf86_lex_val.str; + break; + case MATCH_DRIVER: + if (xf86getSubToken(&(ptr->comment)) != STRING) + Error(QUOTE_MSG, "MatchDriver"); + add_group_entry(&ptr->match_driver, + xstrtokenize(xf86_lex_val.str, TOKEN_SEP)); + free(xf86_lex_val.str); + break; + case EOF_TOKEN: + Error(UNEXPECTED_EOF_MSG); + break; + default: + Error(INVALID_KEYWORD_MSG, xf86tokenString()); + break; + } + } + + if (!has_ident) + Error(NO_IDENT_MSG); + +#ifdef DEBUG + printf("OutputClass section parsed\n"); +#endif + + return ptr; +} +void +xf86printOutputClassSection(FILE * cf, XF86ConfOutputClassPtr ptr) +{ + const xf86MatchGroup *group; + char *const *cur; + + while (ptr) { + fprintf(cf, "Section \"OutputClass\"\n"); + if (ptr->comment) + fprintf(cf, "%s", ptr->comment); + if (ptr->identifier) + fprintf(cf, "\tIdentifier \"%s\"\n", ptr->identifier); + if (ptr->driver) + fprintf(cf, "\tDriver \"%s\"\n", ptr->driver); + + xorg_list_for_each_entry(group, &ptr->match_driver, entry) { + fprintf(cf, "\tMatchDriver \""); + for (cur = group->values; *cur; cur++) + fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP, + *cur); + fprintf(cf, "\"\n"); + } + + fprintf(cf, "EndSection\n\n"); + ptr = ptr->list.next; + } +} + +void +xf86freeOutputClassList(XF86ConfOutputClassPtr ptr) +{ + XF86ConfOutputClassPtr prev; + + while (ptr) { + xf86MatchGroup *group, *next; + char **list; + + TestFree(ptr->identifier); + TestFree(ptr->comment); + TestFree(ptr->driver); + + xorg_list_for_each_entry_safe(group, next, &ptr->match_driver, entry) { + xorg_list_del(&group->entry); + for (list = group->values; *list; list++) + free(*list); + free(group); + } + + prev = ptr; + ptr = ptr->list.next; + free(prev); + } +} diff --git a/xserver/hw/xfree86/parser/Pointer.c b/xserver/hw/xfree86/parser/Pointer.c index ff748d99a..fe60d95aa 100644 --- a/xserver/hw/xfree86/parser/Pointer.c +++ b/xserver/hw/xfree86/parser/Pointer.c @@ -61,7 +61,6 @@ #include "Configint.h" #include "Xprintf.h" -extern LexRec val; static xf86ConfigSymTabRec PointerTab[] = { {PROTOCOL, "protocol"}, @@ -104,19 +103,19 @@ xf86parsePointerSection(void) while ((token = xf86getToken(PointerTab)) != ENDSECTION) { switch (token) { case COMMENT: - ptr->inp_comment = xf86addComment(ptr->inp_comment, val.str); + ptr->inp_comment = xf86addComment(ptr->inp_comment, xf86_lex_val.str); break; case PROTOCOL: if (xf86getSubToken(&(ptr->inp_comment)) != STRING) Error(QUOTE_MSG, "Protocol"); ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, - strdup("Protocol"), val.str); + strdup("Protocol"), xf86_lex_val.str); break; case PDEVICE: if (xf86getSubToken(&(ptr->inp_comment)) != STRING) Error(QUOTE_MSG, "Device"); ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, - strdup("Device"), val.str); + strdup("Device"), xf86_lex_val.str); break; case EMULATE3: ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, @@ -124,9 +123,9 @@ xf86parsePointerSection(void) NULL); break; case EM3TIMEOUT: - if (xf86getSubToken(&(ptr->inp_comment)) != NUMBER || val.num < 0) + if (xf86getSubToken(&(ptr->inp_comment)) != NUMBER || xf86_lex_val.num < 0) Error(POSITIVE_INT_MSG, "Emulate3Timeout"); - s = xf86uLongToString(val.num); + s = xf86uLongToString(xf86_lex_val.num); ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, strdup("Emulate3Timeout"), s); @@ -136,30 +135,30 @@ xf86parsePointerSection(void) strdup("ChordMiddle"), NULL); break; case PBUTTONS: - if (xf86getSubToken(&(ptr->inp_comment)) != NUMBER || val.num < 0) + if (xf86getSubToken(&(ptr->inp_comment)) != NUMBER || xf86_lex_val.num < 0) Error(POSITIVE_INT_MSG, "Buttons"); - s = xf86uLongToString(val.num); + s = xf86uLongToString(xf86_lex_val.num); ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, strdup("Buttons"), s); break; case BAUDRATE: - if (xf86getSubToken(&(ptr->inp_comment)) != NUMBER || val.num < 0) + if (xf86getSubToken(&(ptr->inp_comment)) != NUMBER || xf86_lex_val.num < 0) Error(POSITIVE_INT_MSG, "BaudRate"); - s = xf86uLongToString(val.num); + s = xf86uLongToString(xf86_lex_val.num); ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, strdup("BaudRate"), s); break; case SAMPLERATE: - if (xf86getSubToken(&(ptr->inp_comment)) != NUMBER || val.num < 0) + if (xf86getSubToken(&(ptr->inp_comment)) != NUMBER || xf86_lex_val.num < 0) Error(POSITIVE_INT_MSG, "SampleRate"); - s = xf86uLongToString(val.num); + s = xf86uLongToString(xf86_lex_val.num); ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, strdup("SampleRate"), s); break; case PRESOLUTION: - if (xf86getSubToken(&(ptr->inp_comment)) != NUMBER || val.num < 0) + if (xf86getSubToken(&(ptr->inp_comment)) != NUMBER || xf86_lex_val.num < 0) Error(POSITIVE_INT_MSG, "Resolution"); - s = xf86uLongToString(val.num); + s = xf86uLongToString(xf86_lex_val.num); ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, strdup("Resolution"), s); break; @@ -174,14 +173,14 @@ xf86parsePointerSection(void) case ZAXISMAPPING: switch (xf86getToken(ZMapTab)) { case NUMBER: - if (val.num < 0) + if (xf86_lex_val.num < 0) Error(ZAXISMAPPING_MSG); - val1 = val.num; + val1 = xf86_lex_val.num; if (xf86getSubToken(&(ptr->inp_comment)) != NUMBER || - val.num < 0) { + xf86_lex_val.num < 0) { Error(ZAXISMAPPING_MSG); } - if (asprintf(&s, "%lu %u", val1, val.num) == -1) + if (asprintf(&s, "%lu %u", val1, xf86_lex_val.num) == -1) s = NULL; break; case XAXIS: diff --git a/xserver/hw/xfree86/parser/Screen.c b/xserver/hw/xfree86/parser/Screen.c index f294ec490..0e9746ae5 100644 --- a/xserver/hw/xfree86/parser/Screen.c +++ b/xserver/hw/xfree86/parser/Screen.c @@ -60,7 +60,6 @@ #include "xf86tokens.h" #include "Configint.h" -extern LexRec val; static xf86ConfigSymTabRec DisplayTab[] = { {ENDSUBSECTION, "endsubsection"}, @@ -92,71 +91,71 @@ xf86parseDisplaySubSection(void) while ((token = xf86getToken(DisplayTab)) != ENDSUBSECTION) { switch (token) { case COMMENT: - ptr->disp_comment = xf86addComment(ptr->disp_comment, val.str); + ptr->disp_comment = xf86addComment(ptr->disp_comment, xf86_lex_val.str); break; case VIEWPORT: if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER) Error(VIEWPORT_MSG); - ptr->disp_frameX0 = val.num; + ptr->disp_frameX0 = xf86_lex_val.num; if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER) Error(VIEWPORT_MSG); - ptr->disp_frameY0 = val.num; + ptr->disp_frameY0 = xf86_lex_val.num; break; case VIRTUAL: if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER) Error(VIRTUAL_MSG); - ptr->disp_virtualX = val.num; + ptr->disp_virtualX = xf86_lex_val.num; if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER) Error(VIRTUAL_MSG); - ptr->disp_virtualY = val.num; + ptr->disp_virtualY = xf86_lex_val.num; break; case DEPTH: if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER) Error(NUMBER_MSG, "Display"); - ptr->disp_depth = val.num; + ptr->disp_depth = xf86_lex_val.num; break; case BPP: if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER) Error(NUMBER_MSG, "Display"); - ptr->disp_bpp = val.num; + ptr->disp_bpp = xf86_lex_val.num; break; case VISUAL: if (xf86getSubToken(&(ptr->disp_comment)) != STRING) Error(QUOTE_MSG, "Display"); - ptr->disp_visual = val.str; + ptr->disp_visual = xf86_lex_val.str; break; case WEIGHT: if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER) Error(WEIGHT_MSG); - ptr->disp_weight.red = val.num; + ptr->disp_weight.red = xf86_lex_val.num; if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER) Error(WEIGHT_MSG); - ptr->disp_weight.green = val.num; + ptr->disp_weight.green = xf86_lex_val.num; if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER) Error(WEIGHT_MSG); - ptr->disp_weight.blue = val.num; + ptr->disp_weight.blue = xf86_lex_val.num; break; case BLACK_TOK: if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER) Error(BLACK_MSG); - ptr->disp_black.red = val.num; + ptr->disp_black.red = xf86_lex_val.num; if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER) Error(BLACK_MSG); - ptr->disp_black.green = val.num; + ptr->disp_black.green = xf86_lex_val.num; if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER) Error(BLACK_MSG); - ptr->disp_black.blue = val.num; + ptr->disp_black.blue = xf86_lex_val.num; break; case WHITE_TOK: if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER) Error(WHITE_MSG); - ptr->disp_white.red = val.num; + ptr->disp_white.red = xf86_lex_val.num; if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER) Error(WHITE_MSG); - ptr->disp_white.green = val.num; + ptr->disp_white.green = xf86_lex_val.num; if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER) Error(WHITE_MSG); - ptr->disp_white.blue = val.num; + ptr->disp_white.blue = xf86_lex_val.num; break; case MODES: { @@ -166,7 +165,7 @@ xf86parseDisplaySubSection(void) xf86getSubTokenWithTab(&(ptr->disp_comment), DisplayTab)) == STRING) { mptr = calloc(1, sizeof(XF86ModeRec)); - mptr->mode_name = val.str; + mptr->mode_name = xf86_lex_val.str; mptr->list.next = NULL; ptr->disp_mode_lst = (XF86ModePtr) xf86addListItem((glp) ptr->disp_mode_lst, (glp) mptr); @@ -199,6 +198,7 @@ xf86parseDisplaySubSection(void) static xf86ConfigSymTabRec ScreenTab[] = { {ENDSECTION, "endsection"}, {IDENTIFIER, "identifier"}, + {MATCHSEAT, "matchseat"}, {OBSDRIVER, "driver"}, {MDEVICE, "device"}, {MONITOR, "monitor"}, @@ -227,20 +227,25 @@ xf86parseScreenSection(void) while ((token = xf86getToken(ScreenTab)) != ENDSECTION) { switch (token) { case COMMENT: - ptr->scrn_comment = xf86addComment(ptr->scrn_comment, val.str); + ptr->scrn_comment = xf86addComment(ptr->scrn_comment, xf86_lex_val.str); break; case IDENTIFIER: if (xf86getSubToken(&(ptr->scrn_comment)) != STRING) Error(QUOTE_MSG, "Identifier"); - ptr->scrn_identifier = val.str; + ptr->scrn_identifier = xf86_lex_val.str; if (has_ident || has_driver) Error(ONLY_ONE_MSG, "Identifier or Driver"); has_ident = TRUE; break; + case MATCHSEAT: + if (xf86getSubToken(&(ptr->scrn_comment)) != STRING) + Error(QUOTE_MSG, "MatchSeat"); + ptr->match_seat = xf86_lex_val.str; + break; case OBSDRIVER: if (xf86getSubToken(&(ptr->scrn_comment)) != STRING) Error(QUOTE_MSG, "Driver"); - ptr->scrn_obso_driver = val.str; + ptr->scrn_obso_driver = xf86_lex_val.str; if (has_ident || has_driver) Error(ONLY_ONE_MSG, "Identifier or Driver"); has_driver = TRUE; @@ -248,27 +253,27 @@ xf86parseScreenSection(void) case DEFAULTDEPTH: if (xf86getSubToken(&(ptr->scrn_comment)) != NUMBER) Error(NUMBER_MSG, "DefaultDepth"); - ptr->scrn_defaultdepth = val.num; + ptr->scrn_defaultdepth = xf86_lex_val.num; break; case DEFAULTBPP: if (xf86getSubToken(&(ptr->scrn_comment)) != NUMBER) Error(NUMBER_MSG, "DefaultBPP"); - ptr->scrn_defaultbpp = val.num; + ptr->scrn_defaultbpp = xf86_lex_val.num; break; case DEFAULTFBBPP: if (xf86getSubToken(&(ptr->scrn_comment)) != NUMBER) Error(NUMBER_MSG, "DefaultFbBPP"); - ptr->scrn_defaultfbbpp = val.num; + ptr->scrn_defaultfbbpp = xf86_lex_val.num; break; case MDEVICE: if (xf86getSubToken(&(ptr->scrn_comment)) != STRING) Error(QUOTE_MSG, "Device"); - ptr->scrn_device_str = val.str; + ptr->scrn_device_str = xf86_lex_val.str; break; case MONITOR: if (xf86getSubToken(&(ptr->scrn_comment)) != STRING) Error(QUOTE_MSG, "Monitor"); - ptr->scrn_monitor_str = val.str; + ptr->scrn_monitor_str = xf86_lex_val.str; break; case VIDEOADAPTOR: { @@ -280,13 +285,13 @@ xf86parseScreenSection(void) /* Don't allow duplicates */ for (aptr = ptr->scrn_adaptor_lst; aptr; aptr = (XF86ConfAdaptorLinkPtr) aptr->list.next) - if (xf86nameCompare(val.str, aptr->al_adaptor_str) == 0) + if (xf86nameCompare(xf86_lex_val.str, aptr->al_adaptor_str) == 0) break; if (aptr == NULL) { aptr = calloc(1, sizeof(XF86ConfAdaptorLinkRec)); aptr->list.next = NULL; - aptr->al_adaptor_str = val.str; + aptr->al_adaptor_str = xf86_lex_val.str; ptr->scrn_adaptor_lst = (XF86ConfAdaptorLinkPtr) xf86addListItem((glp) ptr->scrn_adaptor_lst, (glp) aptr); } @@ -295,10 +300,10 @@ xf86parseScreenSection(void) case VIRTUAL: if (xf86getSubToken(&(ptr->scrn_comment)) != NUMBER) Error(VIRTUAL_MSG); - ptr->scrn_virtualX = val.num; + ptr->scrn_virtualX = xf86_lex_val.num; if (xf86getSubToken(&(ptr->scrn_comment)) != NUMBER) Error(VIRTUAL_MSG); - ptr->scrn_virtualY = val.num; + ptr->scrn_virtualY = xf86_lex_val.num; break; case OPTION: ptr->scrn_option_lst = xf86parseOption(ptr->scrn_option_lst); @@ -307,7 +312,7 @@ xf86parseScreenSection(void) if (xf86getSubToken(&(ptr->scrn_comment)) != STRING) Error(QUOTE_MSG, "SubSection"); { - free(val.str); + free(xf86_lex_val.str); HANDLE_LIST(scrn_display_lst, xf86parseDisplaySubSection, XF86ConfDisplayPtr); } diff --git a/xserver/hw/xfree86/parser/Vendor.c b/xserver/hw/xfree86/parser/Vendor.c index 9b7695c8e..2c870ae7f 100644 --- a/xserver/hw/xfree86/parser/Vendor.c +++ b/xserver/hw/xfree86/parser/Vendor.c @@ -60,7 +60,6 @@ #include "xf86tokens.h" #include "Configint.h" -extern LexRec val; static xf86ConfigSymTabRec VendorSubTab[] = { {ENDSUBSECTION, "endsubsection"}, @@ -82,14 +81,14 @@ xf86parseVendorSubSection(void) while ((token = xf86getToken(VendorSubTab)) != ENDSUBSECTION) { switch (token) { case COMMENT: - ptr->vs_comment = xf86addComment(ptr->vs_comment, val.str); + ptr->vs_comment = xf86addComment(ptr->vs_comment, xf86_lex_val.str); break; case IDENTIFIER: if (xf86getSubToken(&(ptr->vs_comment))) Error(QUOTE_MSG, "Identifier"); if (has_ident == TRUE) Error(MULTIPLE_MSG, "Identifier"); - ptr->vs_identifier = val.str; + ptr->vs_identifier = xf86_lex_val.str; has_ident = TRUE; break; case OPTION: @@ -135,14 +134,14 @@ xf86parseVendorSection(void) while ((token = xf86getToken(VendorTab)) != ENDSECTION) { switch (token) { case COMMENT: - ptr->vnd_comment = xf86addComment(ptr->vnd_comment, val.str); + ptr->vnd_comment = xf86addComment(ptr->vnd_comment, xf86_lex_val.str); break; case IDENTIFIER: if (xf86getSubToken(&(ptr->vnd_comment)) != STRING) Error(QUOTE_MSG, "Identifier"); if (has_ident == TRUE) Error(MULTIPLE_MSG, "Identifier"); - ptr->vnd_identifier = val.str; + ptr->vnd_identifier = xf86_lex_val.str; has_ident = TRUE; break; case OPTION: diff --git a/xserver/hw/xfree86/parser/Video.c b/xserver/hw/xfree86/parser/Video.c index 68d611ae7..93209c499 100644 --- a/xserver/hw/xfree86/parser/Video.c +++ b/xserver/hw/xfree86/parser/Video.c @@ -60,7 +60,6 @@ #include "xf86tokens.h" #include "Configint.h" -extern LexRec val; static xf86ConfigSymTabRec VideoPortTab[] = { {ENDSUBSECTION, "endsubsection"}, @@ -97,14 +96,14 @@ xf86parseVideoPortSubSection(void) while ((token = xf86getToken(VideoPortTab)) != ENDSUBSECTION) { switch (token) { case COMMENT: - ptr->vp_comment = xf86addComment(ptr->vp_comment, val.str); + ptr->vp_comment = xf86addComment(ptr->vp_comment, xf86_lex_val.str); break; case IDENTIFIER: if (xf86getSubToken(&(ptr->vp_comment)) != STRING) Error(QUOTE_MSG, "Identifier"); if (has_ident == TRUE) Error(MULTIPLE_MSG, "Identifier"); - ptr->vp_identifier = val.str; + ptr->vp_identifier = xf86_lex_val.str; has_ident = TRUE; break; case OPTION: @@ -154,12 +153,12 @@ xf86parseVideoAdaptorSection(void) while ((token = xf86getToken(VideoAdaptorTab)) != ENDSECTION) { switch (token) { case COMMENT: - ptr->va_comment = xf86addComment(ptr->va_comment, val.str); + ptr->va_comment = xf86addComment(ptr->va_comment, xf86_lex_val.str); break; case IDENTIFIER: if (xf86getSubToken(&(ptr->va_comment)) != STRING) Error(QUOTE_MSG, "Identifier"); - ptr->va_identifier = val.str; + ptr->va_identifier = xf86_lex_val.str; if (has_ident == TRUE) Error(MULTIPLE_MSG, "Identifier"); has_ident = TRUE; @@ -167,22 +166,22 @@ xf86parseVideoAdaptorSection(void) case VENDOR: if (xf86getSubToken(&(ptr->va_comment)) != STRING) Error(QUOTE_MSG, "Vendor"); - ptr->va_vendor = val.str; + ptr->va_vendor = xf86_lex_val.str; break; case BOARD: if (xf86getSubToken(&(ptr->va_comment)) != STRING) Error(QUOTE_MSG, "Board"); - ptr->va_board = val.str; + ptr->va_board = xf86_lex_val.str; break; case BUSID: if (xf86getSubToken(&(ptr->va_comment)) != STRING) Error(QUOTE_MSG, "BusID"); - ptr->va_busid = val.str; + ptr->va_busid = xf86_lex_val.str; break; case DRIVER: if (xf86getSubToken(&(ptr->va_comment)) != STRING) Error(QUOTE_MSG, "Driver"); - ptr->va_driver = val.str; + ptr->va_driver = xf86_lex_val.str; break; case OPTION: ptr->va_option_lst = xf86parseOption(ptr->va_option_lst); diff --git a/xserver/hw/xfree86/parser/configProcs.h b/xserver/hw/xfree86/parser/configProcs.h index 1250f3922..774e2a2da 100644 --- a/xserver/hw/xfree86/parser/configProcs.h +++ b/xserver/hw/xfree86/parser/configProcs.h @@ -57,6 +57,11 @@ XF86ConfInputClassPtr xf86parseInputClassSection(void); void xf86printInputClassSection(FILE * f, XF86ConfInputClassPtr ptr); void xf86freeInputClassList(XF86ConfInputClassPtr ptr); +/* OutputClass.c */ +XF86ConfOutputClassPtr xf86parseOutputClassSection(void); +void xf86printOutputClassSection(FILE * f, XF86ConfOutputClassPtr ptr); +void xf86freeOutputClassList(XF86ConfOutputClassPtr ptr); + /* Layout.c */ XF86ConfLayoutPtr xf86parseLayoutSection(void); void xf86printLayoutSection(FILE * cf, XF86ConfLayoutPtr ptr); @@ -67,7 +72,7 @@ int xf86validateLayout(XF86ConfigPtr p); XF86ConfModulePtr xf86parseModuleSection(void); void xf86printModuleSection(FILE * cf, XF86ConfModulePtr ptr); extern _X_EXPORT XF86LoadPtr xf86addNewLoadDirective(XF86LoadPtr head, - char *name, int type, + const char *name, int type, XF86OptionPtr opts); void xf86freeModules(XF86ConfModulePtr ptr); @@ -141,7 +146,7 @@ xf86freeExtensions(XF86ConfExtensionsPtr ptr); #include <xorg-config.h> #endif -#ifndef IN_XSERVER +#ifndef HAVE_XORG_CONFIG_H /* Externally provided functions */ void ErrorF(const char *f, ...); diff --git a/xserver/hw/xfree86/parser/read.c b/xserver/hw/xfree86/parser/read.c index 6545bcdae..22f6e6af4 100644 --- a/xserver/hw/xfree86/parser/read.c +++ b/xserver/hw/xfree86/parser/read.c @@ -60,7 +60,6 @@ #include "xf86tokens.h" #include "Configint.h" -extern LexRec val; static xf86ConfigSymTabRec TopLevelTab[] = { {SECTION, "section"}, @@ -99,7 +98,7 @@ xf86readConfigFile(void) while ((token = xf86getToken(TopLevelTab)) != EOF_TOKEN) { switch (token) { case COMMENT: - ptr->conf_comment = xf86addComment(ptr->conf_comment, val.str); + ptr->conf_comment = xf86addComment(ptr->conf_comment, xf86_lex_val.str); break; case SECTION: if (xf86getSubToken(&(ptr->conf_comment)) != STRING) { @@ -107,101 +106,107 @@ xf86readConfigFile(void) CLEANUP(ptr); return NULL; } - xf86setSection(val.str); - if (xf86nameCompare(val.str, "files") == 0) { - free(val.str); - val.str = NULL; + xf86setSection(xf86_lex_val.str); + if (xf86nameCompare(xf86_lex_val.str, "files") == 0) { + free(xf86_lex_val.str); + xf86_lex_val.str = NULL; HANDLE_RETURN(conf_files, xf86parseFilesSection()); } - else if (xf86nameCompare(val.str, "serverflags") == 0) { - free(val.str); - val.str = NULL; + else if (xf86nameCompare(xf86_lex_val.str, "serverflags") == 0) { + free(xf86_lex_val.str); + xf86_lex_val.str = NULL; HANDLE_RETURN(conf_flags, xf86parseFlagsSection()); } - else if (xf86nameCompare(val.str, "pointer") == 0) { - free(val.str); - val.str = NULL; + else if (xf86nameCompare(xf86_lex_val.str, "pointer") == 0) { + free(xf86_lex_val.str); + xf86_lex_val.str = NULL; HANDLE_LIST(conf_input_lst, xf86parsePointerSection, XF86ConfInputPtr); } - else if (xf86nameCompare(val.str, "videoadaptor") == 0) { - free(val.str); - val.str = NULL; + else if (xf86nameCompare(xf86_lex_val.str, "videoadaptor") == 0) { + free(xf86_lex_val.str); + xf86_lex_val.str = NULL; HANDLE_LIST(conf_videoadaptor_lst, xf86parseVideoAdaptorSection, XF86ConfVideoAdaptorPtr); } - else if (xf86nameCompare(val.str, "device") == 0) { - free(val.str); - val.str = NULL; + else if (xf86nameCompare(xf86_lex_val.str, "device") == 0) { + free(xf86_lex_val.str); + xf86_lex_val.str = NULL; HANDLE_LIST(conf_device_lst, xf86parseDeviceSection, XF86ConfDevicePtr); } - else if (xf86nameCompare(val.str, "monitor") == 0) { - free(val.str); - val.str = NULL; + else if (xf86nameCompare(xf86_lex_val.str, "monitor") == 0) { + free(xf86_lex_val.str); + xf86_lex_val.str = NULL; HANDLE_LIST(conf_monitor_lst, xf86parseMonitorSection, XF86ConfMonitorPtr); } - else if (xf86nameCompare(val.str, "modes") == 0) { - free(val.str); - val.str = NULL; + else if (xf86nameCompare(xf86_lex_val.str, "modes") == 0) { + free(xf86_lex_val.str); + xf86_lex_val.str = NULL; HANDLE_LIST(conf_modes_lst, xf86parseModesSection, XF86ConfModesPtr); } - else if (xf86nameCompare(val.str, "screen") == 0) { - free(val.str); - val.str = NULL; + else if (xf86nameCompare(xf86_lex_val.str, "screen") == 0) { + free(xf86_lex_val.str); + xf86_lex_val.str = NULL; HANDLE_LIST(conf_screen_lst, xf86parseScreenSection, XF86ConfScreenPtr); } - else if (xf86nameCompare(val.str, "inputdevice") == 0) { - free(val.str); - val.str = NULL; + else if (xf86nameCompare(xf86_lex_val.str, "inputdevice") == 0) { + free(xf86_lex_val.str); + xf86_lex_val.str = NULL; HANDLE_LIST(conf_input_lst, xf86parseInputSection, XF86ConfInputPtr); } - else if (xf86nameCompare(val.str, "inputclass") == 0) { - free(val.str); - val.str = NULL; + else if (xf86nameCompare(xf86_lex_val.str, "inputclass") == 0) { + free(xf86_lex_val.str); + xf86_lex_val.str = NULL; HANDLE_LIST(conf_inputclass_lst, xf86parseInputClassSection, XF86ConfInputClassPtr); } - else if (xf86nameCompare(val.str, "module") == 0) { - free(val.str); - val.str = NULL; + else if (xf86nameCompare(xf86_lex_val.str, "outputclass") == 0) { + free(xf86_lex_val.str); + xf86_lex_val.str = NULL; + HANDLE_LIST(conf_outputclass_lst, xf86parseOutputClassSection, + XF86ConfOutputClassPtr); + } + else if (xf86nameCompare(xf86_lex_val.str, "module") == 0) { + free(xf86_lex_val.str); + xf86_lex_val.str = NULL; HANDLE_RETURN(conf_modules, xf86parseModuleSection()); } - else if (xf86nameCompare(val.str, "serverlayout") == 0) { - free(val.str); - val.str = NULL; + else if (xf86nameCompare(xf86_lex_val.str, "serverlayout") == 0) { + free(xf86_lex_val.str); + xf86_lex_val.str = NULL; HANDLE_LIST(conf_layout_lst, xf86parseLayoutSection, XF86ConfLayoutPtr); } - else if (xf86nameCompare(val.str, "vendor") == 0) { - free(val.str); - val.str = NULL; + else if (xf86nameCompare(xf86_lex_val.str, "vendor") == 0) { + free(xf86_lex_val.str); + xf86_lex_val.str = NULL; HANDLE_LIST(conf_vendor_lst, xf86parseVendorSection, XF86ConfVendorPtr); } - else if (xf86nameCompare(val.str, "dri") == 0) { - free(val.str); - val.str = NULL; + else if (xf86nameCompare(xf86_lex_val.str, "dri") == 0) { + free(xf86_lex_val.str); + xf86_lex_val.str = NULL; HANDLE_RETURN(conf_dri, xf86parseDRISection()); } - else if (xf86nameCompare(val.str, "extensions") == 0) { - free(val.str); - val.str = NULL; + else if (xf86nameCompare(xf86_lex_val.str, "extensions") == 0) { + free(xf86_lex_val.str); + xf86_lex_val.str = NULL; HANDLE_RETURN(conf_extensions, xf86parseExtensionsSection()); } else { - free(val.str); - val.str = NULL; + free(xf86_lex_val.str); + xf86_lex_val.str = NULL; Error(INVALID_SECTION_MSG, xf86tokenString()); } break; default: - free(val.str); - val.str = NULL; + free(xf86_lex_val.str); + xf86_lex_val.str = NULL; Error(INVALID_KEYWORD_MSG, xf86tokenString()); } } diff --git a/xserver/hw/xfree86/parser/scan.c b/xserver/hw/xfree86/parser/scan.c index f852b83ec..a6c12957b 100644 --- a/xserver/hw/xfree86/parser/scan.c +++ b/xserver/hw/xfree86/parser/scan.c @@ -103,7 +103,7 @@ static int numFiles = 0; /* number of config files */ static int curFileIndex = 0; /* index of current config file */ static int pushToken = LOCK_TOKEN; static int eol_seen = 0; /* private state to handle comments */ -LexRec val; +LexRec xf86_lex_val; /* * xf86getNextLine -- @@ -332,7 +332,7 @@ xf86getToken(xf86ConfigSymTabRec * tab) /* XXX no private copy. * Use xf86addComment when setting a comment. */ - val.str = configRBuf; + xf86_lex_val.str = configRBuf; return COMMENT; } @@ -354,15 +354,15 @@ xf86getToken(xf86ConfigSymTabRec * tab) if ((configBuf[configPos] == 'x') || (configBuf[configPos] == 'X')) { base = 16; - val.numType = PARSE_HEX; + xf86_lex_val.numType = PARSE_HEX; } else { base = 8; - val.numType = PARSE_OCTAL; + xf86_lex_val.numType = PARSE_OCTAL; } else { base = 10; - val.numType = PARSE_DECIMAL; + xf86_lex_val.numType = PARSE_DECIMAL; } configRBuf[0] = c; @@ -374,8 +374,8 @@ xf86getToken(xf86ConfigSymTabRec * tab) configRBuf[i++] = c; configPos--; /* GJA -- one too far */ configRBuf[i] = '\0'; - val.num = strtoul(configRBuf, NULL, 0); - val.realnum = atof(configRBuf); + xf86_lex_val.num = strtoul(configRBuf, NULL, 0); + xf86_lex_val.realnum = atof(configRBuf); return NUMBER; } @@ -389,8 +389,8 @@ xf86getToken(xf86ConfigSymTabRec * tab) } while ((c != '\"') && (c != '\n') && (c != '\r') && (c != '\0')); configRBuf[i] = '\0'; - val.str = malloc(strlen(configRBuf) + 1); - strcpy(val.str, configRBuf); /* private copy ! */ + xf86_lex_val.str = malloc(strlen(configRBuf) + 1); + strcpy(xf86_lex_val.str, configRBuf); /* private copy ! */ return STRING; } @@ -452,7 +452,7 @@ xf86getSubToken(char **comment) token = xf86getToken(NULL); if (token == COMMENT) { if (comment) - *comment = xf86addComment(*comment, val.str); + *comment = xf86addComment(*comment, xf86_lex_val.str); } else return token; @@ -468,7 +468,7 @@ xf86getSubTokenWithTab(char **comment, xf86ConfigSymTabRec * tab) token = xf86getToken(tab); if (token == COMMENT) { if (comment) - *comment = xf86addComment(*comment, val.str); + *comment = xf86addComment(*comment, xf86_lex_val.str); } else return token; @@ -820,7 +820,7 @@ static char * OpenConfigDir(const char *path, const char *cmdline, const char *projroot, const char *confname) { - char *dirpath, *pathcopy; + char *dirpath = NULL, *pathcopy; const char *template; Bool found = FALSE; int cmdlineUsed = 0; @@ -1025,7 +1025,7 @@ xf86setSection(const char *section) int xf86getStringToken(xf86ConfigSymTabRec * tab) { - return StringToToken(val.str, tab); + return StringToToken(xf86_lex_val.str, tab); } static int @@ -1078,9 +1078,10 @@ xf86nameCompare(const char *s1, const char *s2) } char * -xf86addComment(char *cur, char *add) +xf86addComment(char *cur, const char *add) { char *str; + const char *cstr; int len, curlen, iscomment, hasnewline = 0, insnewline, endnewline; if (add == NULL || add[0] == '\0') @@ -1095,14 +1096,14 @@ xf86addComment(char *cur, char *add) else curlen = 0; - str = add; + cstr = add; iscomment = 0; - while (*str) { - if (*str != ' ' && *str != '\t') + while (*cstr) { + if (*cstr != ' ' && *cstr != '\t') break; - ++str; + ++cstr; } - iscomment = (*str == '#'); + iscomment = (*cstr == '#'); len = strlen(add); endnewline = add[len - 1] == '\n'; diff --git a/xserver/hw/xfree86/parser/write.c b/xserver/hw/xfree86/parser/write.c index 26739b933..472b27ba1 100644 --- a/xserver/hw/xfree86/parser/write.c +++ b/xserver/hw/xfree86/parser/write.c @@ -114,6 +114,8 @@ doWriteConfigFile(const char *filename, XF86ConfigPtr cptr) xf86printInputClassSection(cf, cptr->conf_inputclass_lst); + xf86printOutputClassSection(cf, cptr->conf_outputclass_lst); + xf86printVideoAdaptorSection(cf, cptr->conf_videoadaptor_lst); xf86printModesSection(cf, cptr->conf_modes_lst); diff --git a/xserver/hw/xfree86/parser/xf86Parser.h b/xserver/hw/xfree86/parser/xf86Parser.h index e7210e811..3fa5b716d 100644 --- a/xserver/hw/xfree86/parser/xf86Parser.h +++ b/xserver/hw/xfree86/parser/xf86Parser.h @@ -85,7 +85,7 @@ typedef struct { typedef struct { GenericListRec list; int load_type; - char *load_name; + const char *load_name; XF86OptionPtr load_opt; char *load_comment; int ignore; @@ -116,7 +116,7 @@ typedef struct { typedef struct { GenericListRec list; - char *ml_identifier; + const char *ml_identifier; int ml_clock; int ml_hdisplay; int ml_hsyncstart; @@ -134,21 +134,21 @@ typedef struct { typedef struct { GenericListRec list; - char *vp_identifier; + const char *vp_identifier; XF86OptionPtr vp_option_lst; char *vp_comment; } XF86ConfVideoPortRec, *XF86ConfVideoPortPtr; typedef struct { GenericListRec list; - char *va_identifier; - char *va_vendor; - char *va_board; - char *va_busid; - char *va_driver; + const char *va_identifier; + const char *va_vendor; + const char *va_board; + const char *va_busid; + const char *va_driver; XF86OptionPtr va_option_lst; XF86ConfVideoPortPtr va_port_lst; - char *va_fwdref; + const char *va_fwdref; char *va_comment; } XF86ConfVideoAdaptorRec, *XF86ConfVideoAdaptorPtr; @@ -165,21 +165,21 @@ typedef struct { typedef struct { GenericListRec list; - char *modes_identifier; + const char *modes_identifier; XF86ConfModeLinePtr mon_modeline_lst; char *modes_comment; } XF86ConfModesRec, *XF86ConfModesPtr; typedef struct { GenericListRec list; - char *ml_modes_str; + const char *ml_modes_str; XF86ConfModesPtr ml_modes; } XF86ConfModesLinkRec, *XF86ConfModesLinkPtr; typedef struct { GenericListRec list; - char *mon_identifier; - char *mon_vendor; + const char *mon_identifier; + const char *mon_vendor; char *mon_modelname; int mon_width; /* in mm */ int mon_height; /* in mm */ @@ -201,21 +201,21 @@ typedef struct { typedef struct { GenericListRec list; - char *dev_identifier; - char *dev_vendor; - char *dev_board; - char *dev_chipset; - char *dev_busid; - char *dev_card; - char *dev_driver; - char *dev_ramdac; + const char *dev_identifier; + const char *dev_vendor; + const char *dev_board; + const char *dev_chipset; + const char *dev_busid; + const char *dev_card; + const char *dev_driver; + const char *dev_ramdac; int dev_dacSpeeds[CONF_MAXDACSPEEDS]; int dev_videoram; int dev_textclockfreq; unsigned long dev_bios_base; unsigned long dev_mem_base; unsigned long dev_io_base; - char *dev_clockchip; + const char *dev_clockchip; int dev_clocks; int dev_clock[CONF_MAXCLOCKS]; int dev_chipid; @@ -224,11 +224,12 @@ typedef struct { int dev_screen; XF86OptionPtr dev_option_lst; char *dev_comment; + char *match_seat; } XF86ConfDeviceRec, *XF86ConfDevicePtr; typedef struct { GenericListRec list; - char *mode_name; + const char *mode_name; } XF86ModeRec, *XF86ModePtr; typedef struct { @@ -239,7 +240,7 @@ typedef struct { int disp_virtualY; int disp_depth; int disp_bpp; - char *disp_visual; + const char *disp_visual; parser_rgb disp_weight; parser_rgb disp_black; parser_rgb disp_white; @@ -255,26 +256,27 @@ typedef struct { typedef struct { GenericListRec list; - char *al_adaptor_str; + const char *al_adaptor_str; XF86ConfVideoAdaptorPtr al_adaptor; } XF86ConfAdaptorLinkRec, *XF86ConfAdaptorLinkPtr; typedef struct { GenericListRec list; - char *scrn_identifier; - char *scrn_obso_driver; + const char *scrn_identifier; + const char *scrn_obso_driver; int scrn_defaultdepth; int scrn_defaultbpp; int scrn_defaultfbbpp; - char *scrn_monitor_str; + const char *scrn_monitor_str; XF86ConfMonitorPtr scrn_monitor; - char *scrn_device_str; + const char *scrn_device_str; XF86ConfDevicePtr scrn_device; XF86ConfAdaptorLinkPtr scrn_adaptor_lst; XF86ConfDisplayPtr scrn_display_lst; XF86OptionPtr scrn_option_lst; char *scrn_comment; int scrn_virtualX, scrn_virtualY; + char *match_seat; } XF86ConfScreenRec, *XF86ConfScreenPtr; typedef struct { @@ -325,6 +327,14 @@ typedef struct { char *comment; } XF86ConfInputClassRec, *XF86ConfInputClassPtr; +typedef struct { + GenericListRec list; + char *identifier; + char *driver; + struct xorg_list match_driver; + char *comment; +} XF86ConfOutputClassRec, *XF86ConfOutputClassPtr; + /* Values for adj_where */ #define CONF_ADJ_OBSOLETE -1 #define CONF_ADJ_ABSOLUTE 0 @@ -338,55 +348,56 @@ typedef struct { GenericListRec list; int adj_scrnum; XF86ConfScreenPtr adj_screen; - char *adj_screen_str; + const char *adj_screen_str; XF86ConfScreenPtr adj_top; - char *adj_top_str; + const char *adj_top_str; XF86ConfScreenPtr adj_bottom; - char *adj_bottom_str; + const char *adj_bottom_str; XF86ConfScreenPtr adj_left; - char *adj_left_str; + const char *adj_left_str; XF86ConfScreenPtr adj_right; - char *adj_right_str; + const char *adj_right_str; int adj_where; int adj_x; int adj_y; - char *adj_refscreen; + const char *adj_refscreen; } XF86ConfAdjacencyRec, *XF86ConfAdjacencyPtr; typedef struct { GenericListRec list; - char *inactive_device_str; + const char *inactive_device_str; XF86ConfDevicePtr inactive_device; } XF86ConfInactiveRec, *XF86ConfInactivePtr; typedef struct { GenericListRec list; - char *lay_identifier; + const char *lay_identifier; XF86ConfAdjacencyPtr lay_adjacency_lst; XF86ConfInactivePtr lay_inactive_lst; XF86ConfInputrefPtr lay_input_lst; XF86OptionPtr lay_option_lst; + char *match_seat; char *lay_comment; } XF86ConfLayoutRec, *XF86ConfLayoutPtr; typedef struct { GenericListRec list; - char *vs_name; - char *vs_identifier; + const char *vs_name; + const char *vs_identifier; XF86OptionPtr vs_option_lst; char *vs_comment; } XF86ConfVendSubRec, *XF86ConfVendSubPtr; typedef struct { GenericListRec list; - char *vnd_identifier; + const char *vnd_identifier; XF86OptionPtr vnd_option_lst; XF86ConfVendSubPtr vnd_sub_lst; char *vnd_comment; } XF86ConfVendorRec, *XF86ConfVendorPtr; typedef struct { - char *dri_group_name; + const char *dri_group_name; int dri_group; int dri_mode; char *dri_comment; @@ -408,6 +419,7 @@ typedef struct { XF86ConfScreenPtr conf_screen_lst; XF86ConfInputPtr conf_input_lst; XF86ConfInputClassPtr conf_inputclass_lst; + XF86ConfOutputClassPtr conf_outputclass_lst; XF86ConfLayoutPtr conf_layout_lst; XF86ConfVendorPtr conf_vendor_lst; XF86ConfDRIPtr conf_dri; @@ -462,7 +474,7 @@ extern _X_EXPORT int xf86itemNotSublist(GenericListPtr list_1, extern _X_EXPORT int xf86pathIsAbsolute(const char *path); extern _X_EXPORT int xf86pathIsSafe(const char *path); -extern _X_EXPORT char *xf86addComment(char *cur, char *add); +extern _X_EXPORT char *xf86addComment(char *cur, const char *add); extern _X_EXPORT Bool xf86getBoolValue(Bool *val, const char *str); #endif /* _xf86Parser_h_ */ diff --git a/xserver/hw/xfree86/parser/xf86tokens.h b/xserver/hw/xfree86/parser/xf86tokens.h index f751b7b0e..5c01ce701 100644 --- a/xserver/hw/xfree86/parser/xf86tokens.h +++ b/xserver/hw/xfree86/parser/xf86tokens.h @@ -87,6 +87,7 @@ typedef enum { VENDOR, DASH, COMMA, + MATCHSEAT, OPTION, COMMENT, diff --git a/xserver/hw/xfree86/ramdac/IBM.c b/xserver/hw/xfree86/ramdac/IBM.c index bc716231a..45876cfb7 100644 --- a/xserver/hw/xfree86/ramdac/IBM.c +++ b/xserver/hw/xfree86/ramdac/IBM.c @@ -570,7 +570,7 @@ IBMramdac640SetCursorColors(ScrnInfoPtr pScrn, int bg, int fg) (*ramdacPtr->WriteData) (pScrn, bg); } -static void +static Bool IBMramdac526LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src) { RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn); @@ -582,9 +582,10 @@ IBMramdac526LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src) */ for (i = 0; i < 1024; i++) (*ramdacPtr->WriteDAC) (pScrn, IBMRGB_curs_array + i, 0x00, (*src++)); + return TRUE; } -static void +static Bool IBMramdac640LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src) { RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn); @@ -596,6 +597,7 @@ IBMramdac640LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src) */ for (i = 0; i < 1024; i++) (*ramdacPtr->WriteDAC) (pScrn, RGB640_CURS_WRITE + i, 0x00, (*src++)); + return TRUE; } static Bool @@ -620,7 +622,7 @@ IBMramdac526HWCursorInit(xf86CursorInfoPtr infoPtr) HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_1; infoPtr->SetCursorColors = IBMramdac526SetCursorColors; infoPtr->SetCursorPosition = IBMramdac526SetCursorPosition; - infoPtr->LoadCursorImage = IBMramdac526LoadCursorImage; + infoPtr->LoadCursorImageCheck = IBMramdac526LoadCursorImage; infoPtr->HideCursor = IBMramdac526HideCursor; infoPtr->ShowCursor = IBMramdac526ShowCursor; infoPtr->UseHWCursor = IBMramdac526UseHWCursor; @@ -636,7 +638,7 @@ IBMramdac640HWCursorInit(xf86CursorInfoPtr infoPtr) HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_1; infoPtr->SetCursorColors = IBMramdac640SetCursorColors; infoPtr->SetCursorPosition = IBMramdac640SetCursorPosition; - infoPtr->LoadCursorImage = IBMramdac640LoadCursorImage; + infoPtr->LoadCursorImageCheck = IBMramdac640LoadCursorImage; infoPtr->HideCursor = IBMramdac640HideCursor; infoPtr->ShowCursor = IBMramdac640ShowCursor; infoPtr->UseHWCursor = IBMramdac640UseHWCursor; diff --git a/xserver/hw/xfree86/ramdac/Makefile.in b/xserver/hw/xfree86/ramdac/Makefile.in index a29e3e16e..8bb4c19fc 100644 --- a/xserver/hw/xfree86/ramdac/Makefile.in +++ b/xserver/hw/xfree86/ramdac/Makefile.in @@ -193,6 +193,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -237,6 +239,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -339,7 +345,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -348,6 +357,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -414,6 +424,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/hw/xfree86/ramdac/TI.c b/xserver/hw/xfree86/ramdac/TI.c index 393b774d4..2492bb531 100644 --- a/xserver/hw/xfree86/ramdac/TI.c +++ b/xserver/hw/xfree86/ramdac/TI.c @@ -642,7 +642,7 @@ TIramdacSetCursorColors(ScrnInfoPtr pScrn, int bg, int fg) (*ramdacPtr->WriteDAC) (pScrn, TIDAC_CURS_COLOR, 0, (fg & 0x000000ff)); } -static void +static Bool TIramdacLoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src) { RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn); @@ -657,6 +657,7 @@ TIramdacLoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src) /* NOT_DONE: might need a delay here */ (*ramdacPtr->WriteDAC) (pScrn, TIDAC_CURS_RAM_DATA, 0, *(src++)); } + return TRUE; } static Bool @@ -675,7 +676,7 @@ TIramdacHWCursorInit(xf86CursorInfoPtr infoPtr) HARDWARE_CURSOR_SOURCE_MASK_NOT_INTERLEAVED; infoPtr->SetCursorColors = TIramdacSetCursorColors; infoPtr->SetCursorPosition = TIramdacSetCursorPosition; - infoPtr->LoadCursorImage = TIramdacLoadCursorImage; + infoPtr->LoadCursorImageCheck = TIramdacLoadCursorImage; infoPtr->HideCursor = TIramdacHideCursor; infoPtr->ShowCursor = TIramdacShowCursor; infoPtr->UseHWCursor = TIramdacUseHWCursor; diff --git a/xserver/hw/xfree86/ramdac/xf86Cursor.c b/xserver/hw/xfree86/ramdac/xf86Cursor.c index 860704e1c..fac682210 100644 --- a/xserver/hw/xfree86/ramdac/xf86Cursor.c +++ b/xserver/hw/xfree86/ramdac/xf86Cursor.c @@ -352,12 +352,13 @@ xf86CursorSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCurs, (*ScreenPriv->spriteFuncs->SetCursor) (pDev, pScreen, NullCursor, x, y); - xf86SetCursor(pScreen, cursor, x, y); - ScreenPriv->SWCursor = FALSE; - ScreenPriv->isUp = TRUE; + if (xf86SetCursor(pScreen, cursor, x, y)) { + ScreenPriv->SWCursor = FALSE; + ScreenPriv->isUp = TRUE; - miPointerSetWaitForUpdate(pScreen, !infoPtr->pScrn->silkenMouse); - return; + miPointerSetWaitForUpdate(pScreen, !infoPtr->pScrn->silkenMouse); + return; + } } miPointerSetWaitForUpdate(pScreen, TRUE); diff --git a/xserver/hw/xfree86/ramdac/xf86Cursor.h b/xserver/hw/xfree86/ramdac/xf86Cursor.h index 5658e7b30..a389a9988 100644 --- a/xserver/hw/xfree86/ramdac/xf86Cursor.h +++ b/xserver/hw/xfree86/ramdac/xf86Cursor.h @@ -13,6 +13,7 @@ typedef struct _xf86CursorInfoRec { void (*SetCursorColors) (ScrnInfoPtr pScrn, int bg, int fg); void (*SetCursorPosition) (ScrnInfoPtr pScrn, int x, int y); void (*LoadCursorImage) (ScrnInfoPtr pScrn, unsigned char *bits); + Bool (*LoadCursorImageCheck) (ScrnInfoPtr pScrn, unsigned char *bits); void (*HideCursor) (ScrnInfoPtr pScrn); void (*ShowCursor) (ScrnInfoPtr pScrn); unsigned char *(*RealizeCursor) (struct _xf86CursorInfoRec *, CursorPtr); @@ -21,10 +22,41 @@ typedef struct _xf86CursorInfoRec { #ifdef ARGB_CURSOR Bool (*UseHWCursorARGB) (ScreenPtr, CursorPtr); void (*LoadCursorARGB) (ScrnInfoPtr, CursorPtr); + Bool (*LoadCursorARGBCheck) (ScrnInfoPtr, CursorPtr); #endif } xf86CursorInfoRec, *xf86CursorInfoPtr; +static inline Bool +xf86DriverHasLoadCursorImage(xf86CursorInfoPtr infoPtr) +{ + return infoPtr->LoadCursorImageCheck || infoPtr->LoadCursorImage; +} + +static inline Bool +xf86DriverLoadCursorImage(xf86CursorInfoPtr infoPtr, unsigned char *bits) +{ + if(infoPtr->LoadCursorImageCheck) + return infoPtr->LoadCursorImageCheck(infoPtr->pScrn, bits); + infoPtr->LoadCursorImage(infoPtr->pScrn, bits); + return TRUE; +} + +static inline Bool +xf86DriverHasLoadCursorARGB(xf86CursorInfoPtr infoPtr) +{ + return infoPtr->LoadCursorARGBCheck || infoPtr->LoadCursorARGB; +} + +static inline Bool +xf86DriverLoadCursorARGB(xf86CursorInfoPtr infoPtr, CursorPtr pCursor) +{ + if(infoPtr->LoadCursorARGBCheck) + return infoPtr->LoadCursorARGBCheck(infoPtr->pScrn, pCursor); + infoPtr->LoadCursorARGB(infoPtr->pScrn, pCursor); + return TRUE; +} + extern _X_EXPORT Bool xf86InitCursor(ScreenPtr pScreen, xf86CursorInfoPtr infoPtr); extern _X_EXPORT xf86CursorInfoPtr xf86CreateCursorInfoRec(void); diff --git a/xserver/hw/xfree86/ramdac/xf86CursorPriv.h b/xserver/hw/xfree86/ramdac/xf86CursorPriv.h index 04be14135..f34c1c7fc 100644 --- a/xserver/hw/xfree86/ramdac/xf86CursorPriv.h +++ b/xserver/hw/xfree86/ramdac/xf86CursorPriv.h @@ -34,10 +34,10 @@ typedef struct { int ForceHWCursorCount; Bool HWCursorForced; - pointer transparentData; + void *transparentData; } xf86CursorScreenRec, *xf86CursorScreenPtr; -void xf86SetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y); +Bool xf86SetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y); void xf86SetTransparentCursor(ScreenPtr pScreen); void xf86MoveCursor(ScreenPtr pScreen, int x, int y); void xf86RecolorCursor(ScreenPtr pScreen, CursorPtr pCurs, Bool displayed); diff --git a/xserver/hw/xfree86/ramdac/xf86HWCurs.c b/xserver/hw/xfree86/ramdac/xf86HWCurs.c index 197abff8f..953c86abc 100644 --- a/xserver/hw/xfree86/ramdac/xf86HWCurs.c +++ b/xserver/hw/xfree86/ramdac/xf86HWCurs.c @@ -87,7 +87,7 @@ xf86InitHardwareCursor(ScreenPtr pScreen, xf86CursorInfoPtr infoPtr) /* These are required for now */ if (!infoPtr->SetCursorPosition || - !infoPtr->LoadCursorImage || + !xf86DriverHasLoadCursorImage(infoPtr) || !infoPtr->HideCursor || !infoPtr->ShowCursor || !infoPtr->SetCursorColors) return FALSE; @@ -119,7 +119,7 @@ xf86InitHardwareCursor(ScreenPtr pScreen, xf86CursorInfoPtr infoPtr) return TRUE; } -void +Bool xf86SetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y) { xf86CursorScreenPtr ScreenPriv = @@ -130,7 +130,7 @@ xf86SetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y) if (pCurs == NullCursor) { (*infoPtr->HideCursor) (infoPtr->pScrn); - return; + return TRUE; } bits = @@ -140,7 +140,7 @@ xf86SetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y) y -= infoPtr->pScrn->frameY0 + ScreenPriv->HotY; #ifdef ARGB_CURSOR - if (!pCurs->bits->argb || !infoPtr->LoadCursorARGB) + if (!pCurs->bits->argb || !xf86DriverHasLoadCursorARGB(infoPtr)) #endif if (!bits) { bits = (*infoPtr->RealizeCursor) (infoPtr, pCurs); @@ -152,18 +152,21 @@ xf86SetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y) (*infoPtr->HideCursor) (infoPtr->pScrn); #ifdef ARGB_CURSOR - if (pCurs->bits->argb && infoPtr->LoadCursorARGB) - (*infoPtr->LoadCursorARGB) (infoPtr->pScrn, pCurs); - else + if (pCurs->bits->argb && xf86DriverHasLoadCursorARGB(infoPtr)) { + if (!xf86DriverLoadCursorARGB (infoPtr, pCurs)) + return FALSE; + } else #endif if (bits) - (*infoPtr->LoadCursorImage) (infoPtr->pScrn, bits); + if (!xf86DriverLoadCursorImage (infoPtr, bits)) + return FALSE; xf86RecolorCursor(pScreen, pCurs, 1); (*infoPtr->SetCursorPosition) (infoPtr->pScrn, x, y); (*infoPtr->ShowCursor) (infoPtr->pScrn); + return TRUE; } void @@ -182,8 +185,8 @@ xf86SetTransparentCursor(ScreenPtr pScreen) (*infoPtr->HideCursor) (infoPtr->pScrn); if (ScreenPriv->transparentData) - (*infoPtr->LoadCursorImage) (infoPtr->pScrn, - ScreenPriv->transparentData); + xf86DriverLoadCursorImage (infoPtr, + ScreenPriv->transparentData); (*infoPtr->ShowCursor) (infoPtr->pScrn); } @@ -462,9 +465,9 @@ RealizeCursorInterleave16(xf86CursorInfoPtr infoPtr, CursorPtr pCurs) } /* 16 bit interleave */ - DstS = (pointer) mem2; + DstS = (void *) mem2; DstM = DstS + (size >> 2); - pntr = (pointer) mem; + pntr = (void *) mem; count = (size >> 1); while (count) { *pntr++ = *DstS++; @@ -497,9 +500,9 @@ RealizeCursorInterleave32(xf86CursorInfoPtr infoPtr, CursorPtr pCurs) } /* 32 bit interleave */ - DstS = (pointer) mem2; + DstS = (void *) mem2; DstM = DstS + (size >> 3); - pntr = (pointer) mem; + pntr = (void *) mem; count = (size >> 2); while (count) { *pntr++ = *DstS++; @@ -532,9 +535,9 @@ RealizeCursorInterleave64(xf86CursorInfoPtr infoPtr, CursorPtr pCurs) } /* 64 bit interleave */ - DstS = (pointer) mem2; + DstS = (void *) mem2; DstM = DstS + (size >> 3); - pntr = (pointer) mem; + pntr = (void *) mem; count = (size >> 2); while (count) { *pntr++ = *DstS++; diff --git a/xserver/hw/xfree86/sdksyms.sh b/xserver/hw/xfree86/sdksyms.sh index ef0c86849..f48078584 100644 --- a/xserver/hw/xfree86/sdksyms.sh +++ b/xserver/hw/xfree86/sdksyms.sh @@ -260,6 +260,7 @@ cat > sdksyms.c << EOF #include "dix.h" #include "dixaccess.h" #include "dixevents.h" +#define _FONTPROTO_H #include "dixfont.h" #include "dixfontstr.h" #include "dixfontstubs.h" diff --git a/xserver/hw/xfree86/shadowfb/Makefile.in b/xserver/hw/xfree86/shadowfb/Makefile.in index 42caa6624..198d5da70 100644 --- a/xserver/hw/xfree86/shadowfb/Makefile.in +++ b/xserver/hw/xfree86/shadowfb/Makefile.in @@ -197,6 +197,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -241,6 +243,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -343,7 +349,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -352,6 +361,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -418,6 +428,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/hw/xfree86/shadowfb/shadow.c b/xserver/hw/xfree86/shadowfb/shadow.c index 614501770..d2481ed8a 100644 --- a/xserver/hw/xfree86/shadowfb/shadow.c +++ b/xserver/hw/xfree86/shadowfb/shadow.c @@ -1,8 +1,8 @@ /* Copyright (C) 1999. The XFree86 Project Inc. + Copyright 2014 Red Hat, Inc. Written by Mark Vojkovich (mvojkovi@ucsd.edu) - Pre-fb-write callbacks and RENDER support - Nolan Leake (nolan@vmware.com) */ @@ -29,107 +29,23 @@ #include "picturestr.h" static Bool ShadowCloseScreen(ScreenPtr pScreen); -static void ShadowCopyWindow(WindowPtr pWin, - DDXPointRec ptOldOrg, RegionPtr prgn); -static Bool ShadowCreateGC(GCPtr pGC); - -static Bool ShadowEnterVT(ScrnInfoPtr pScrn); -static void ShadowLeaveVT(ScrnInfoPtr pScrn); - -static void ShadowComposite(CARD8 op, - PicturePtr pSrc, - PicturePtr pMask, - PicturePtr pDst, - INT16 xSrc, - INT16 ySrc, - INT16 xMask, - INT16 yMask, - INT16 xDst, - INT16 yDst, CARD16 width, CARD16 height); +static Bool ShadowCreateRootWindow(WindowPtr pWin); typedef struct { ScrnInfoPtr pScrn; RefreshAreaFuncPtr preRefresh; RefreshAreaFuncPtr postRefresh; CloseScreenProcPtr CloseScreen; - CopyWindowProcPtr CopyWindow; - CreateGCProcPtr CreateGC; - ModifyPixmapHeaderProcPtr ModifyPixmapHeader; - CompositeProcPtr Composite; - Bool (*EnterVT) (ScrnInfoPtr); - void (*LeaveVT) (ScrnInfoPtr); - Bool vtSema; + CreateWindowProcPtr CreateWindow; } ShadowScreenRec, *ShadowScreenPtr; -typedef struct { - GCOps *ops; - GCFuncs *funcs; -} ShadowGCRec, *ShadowGCPtr; - static DevPrivateKeyRec ShadowScreenKeyRec; -#define ShadowScreenKey (&ShadowScreenKeyRec) - -static DevPrivateKeyRec ShadowGCKeyRec; - -#define ShadowGCKey (&ShadowGCKeyRec) - -#define GET_SCREEN_PRIVATE(pScreen) \ - (ShadowScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, ShadowScreenKey) -#define GET_GC_PRIVATE(pGC) \ - (ShadowGCPtr)dixLookupPrivate(&(pGC)->devPrivates, ShadowGCKey) - -#define SHADOW_GC_FUNC_PROLOGUE(pGC)\ - ShadowGCPtr pGCPriv = GET_GC_PRIVATE(pGC);\ - (pGC)->funcs = pGCPriv->funcs;\ - if(pGCPriv->ops)\ - (pGC)->ops = pGCPriv->ops - -#define SHADOW_GC_FUNC_EPILOGUE(pGC)\ - pGCPriv->funcs = (pGC)->funcs;\ - (pGC)->funcs = &ShadowGCFuncs;\ - if(pGCPriv->ops) {\ - pGCPriv->ops = (pGC)->ops;\ - (pGC)->ops = &ShadowGCOps;\ - } - -#define SHADOW_GC_OP_PROLOGUE(pGC)\ - ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(pGC->pScreen); \ - ShadowGCPtr pGCPriv = GET_GC_PRIVATE(pGC);\ - GCFuncs *oldFuncs = pGC->funcs;\ - pGC->funcs = pGCPriv->funcs;\ - pGC->ops = pGCPriv->ops - -#define SHADOW_GC_OP_EPILOGUE(pGC)\ - pGCPriv->ops = pGC->ops;\ - pGC->funcs = oldFuncs;\ - pGC->ops = &ShadowGCOps - -#define IS_VISIBLE(pWin) (pPriv->vtSema && \ - (((WindowPtr)pWin)->visibility != VisibilityFullyObscured)) - -#define TRIM_BOX(box, pGC) { \ - BoxPtr extents = &pGC->pCompositeClip->extents;\ - if(box.x1 < extents->x1) box.x1 = extents->x1; \ - if(box.x2 > extents->x2) box.x2 = extents->x2; \ - if(box.y1 < extents->y1) box.y1 = extents->y1; \ - if(box.y2 > extents->y2) box.y2 = extents->y2; \ - } - -#define TRANSLATE_BOX(box, pDraw) { \ - box.x1 += pDraw->x; \ - box.x2 += pDraw->x; \ - box.y1 += pDraw->y; \ - box.y2 += pDraw->y; \ - } - -#define TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC) { \ - TRANSLATE_BOX(box, pDraw); \ - TRIM_BOX(box, pGC); \ - } - -#define BOX_NOT_EMPTY(box) \ - (((box.x2 - box.x1) > 0) && ((box.y2 - box.y1) > 0)) +static ShadowScreenPtr +shadowfbGetScreenPrivate(ScreenPtr pScreen) +{ + return dixLookupPrivate(&(pScreen)->devPrivates, &ShadowScreenKeyRec); +} Bool ShadowFBInit2(ScreenPtr pScreen, @@ -138,7 +54,6 @@ ShadowFBInit2(ScreenPtr pScreen, { ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); ShadowScreenPtr pPriv; - PictureScreenPtr ps = GetPictureScreenIfSet(pScreen); if (!preRefreshArea && !postRefreshArea) return FALSE; @@ -146,39 +61,20 @@ ShadowFBInit2(ScreenPtr pScreen, if (!dixRegisterPrivateKey(&ShadowScreenKeyRec, PRIVATE_SCREEN, 0)) return FALSE; - if (!dixRegisterPrivateKey - (&ShadowGCKeyRec, PRIVATE_GC, sizeof(ShadowGCRec))) - return FALSE; - if (!(pPriv = (ShadowScreenPtr) malloc(sizeof(ShadowScreenRec)))) return FALSE; - dixSetPrivate(&pScreen->devPrivates, ShadowScreenKey, pPriv); + dixSetPrivate(&pScreen->devPrivates, &ShadowScreenKeyRec, pPriv); pPriv->pScrn = pScrn; pPriv->preRefresh = preRefreshArea; pPriv->postRefresh = postRefreshArea; - pPriv->vtSema = TRUE; pPriv->CloseScreen = pScreen->CloseScreen; - pPriv->CopyWindow = pScreen->CopyWindow; - pPriv->CreateGC = pScreen->CreateGC; - pPriv->ModifyPixmapHeader = pScreen->ModifyPixmapHeader; - - pPriv->EnterVT = pScrn->EnterVT; - pPriv->LeaveVT = pScrn->LeaveVT; + pPriv->CreateWindow = pScreen->CreateWindow; pScreen->CloseScreen = ShadowCloseScreen; - pScreen->CopyWindow = ShadowCopyWindow; - pScreen->CreateGC = ShadowCreateGC; - - pScrn->EnterVT = ShadowEnterVT; - pScrn->LeaveVT = ShadowLeaveVT; - - if (ps) { - pPriv->Composite = ps->Composite; - ps->Composite = ShadowComposite; - } + pScreen->CreateWindow = ShadowCreateRootWindow; return TRUE; } @@ -189,1451 +85,87 @@ ShadowFBInit(ScreenPtr pScreen, RefreshAreaFuncPtr refreshArea) return ShadowFBInit2(pScreen, NULL, refreshArea); } -/**********************************************************/ - -static Bool -ShadowEnterVT(ScrnInfoPtr pScrn) -{ - Bool ret; - ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(pScrn->pScreen); - - pScrn->EnterVT = pPriv->EnterVT; - ret = (*pPriv->EnterVT) (pScrn); - pPriv->EnterVT = pScrn->EnterVT; - pScrn->EnterVT = ShadowEnterVT; - if (ret) { - pPriv->vtSema = TRUE; - return TRUE; - } - - return FALSE; -} - -static void -ShadowLeaveVT(ScrnInfoPtr pScrn) -{ - ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(pScrn->pScreen); - - pPriv->vtSema = FALSE; - - pScrn->LeaveVT = pPriv->LeaveVT; - (*pPriv->LeaveVT) (pScrn); - pPriv->LeaveVT = pScrn->LeaveVT; - pScrn->LeaveVT = ShadowLeaveVT; -} - -/**********************************************************/ - -static Bool -ShadowCloseScreen(ScreenPtr pScreen) -{ - ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); - ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(pScreen); - PictureScreenPtr ps = GetPictureScreenIfSet(pScreen); - - pScreen->CloseScreen = pPriv->CloseScreen; - pScreen->CopyWindow = pPriv->CopyWindow; - pScreen->CreateGC = pPriv->CreateGC; - pScreen->ModifyPixmapHeader = pPriv->ModifyPixmapHeader; - - pScrn->EnterVT = pPriv->EnterVT; - pScrn->LeaveVT = pPriv->LeaveVT; - - if (ps) { - ps->Composite = pPriv->Composite; - } - - free((pointer) pPriv); - - return (*pScreen->CloseScreen) (pScreen); -} +/* + * Note that we don't do DamageEmpty, or indeed look at the region inside the + * DamagePtr at all. This is an optimization, believe it or not. The + * incoming RegionPtr is the new damage, and if we were to empty the region + * miext/damage would just have to waste time reallocating and re-unioning + * it every time, whereas if we leave it around the union gets fast-pathed + * away. + */ static void -ShadowCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgn) +shadowfbReportPre(DamagePtr damage, RegionPtr reg, void *closure) { - ScreenPtr pScreen = pWin->drawable.pScreen; - ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(pScreen); - int num = 0; - RegionRec rgnDst; - - if (pPriv->vtSema) { - RegionNull(&rgnDst); - RegionCopy(&rgnDst, prgn); - - RegionTranslate(&rgnDst, - pWin->drawable.x - ptOldOrg.x, - pWin->drawable.y - ptOldOrg.y); - RegionIntersect(&rgnDst, &pWin->borderClip, &rgnDst); - if ((num = RegionNumRects(&rgnDst))) { - if (pPriv->preRefresh) - (*pPriv->preRefresh) (pPriv->pScrn, num, RegionRects(&rgnDst)); - } - else { - RegionUninit(&rgnDst); - } - } + ShadowScreenPtr pPriv = closure; - pScreen->CopyWindow = pPriv->CopyWindow; - (*pScreen->CopyWindow) (pWin, ptOldOrg, prgn); - pScreen->CopyWindow = ShadowCopyWindow; + if (!pPriv->pScrn->vtSema) + return; - if (num) { - if (pPriv->postRefresh) - (*pPriv->postRefresh) (pPriv->pScrn, num, RegionRects(&rgnDst)); - RegionUninit(&rgnDst); - } + pPriv->preRefresh(pPriv->pScrn, RegionNumRects(reg), RegionRects(reg)); } static void -ShadowComposite(CARD8 op, - PicturePtr pSrc, - PicturePtr pMask, - PicturePtr pDst, - INT16 xSrc, - INT16 ySrc, - INT16 xMask, - INT16 yMask, - INT16 xDst, INT16 yDst, CARD16 width, CARD16 height) +shadowfbReportPost(DamagePtr damage, RegionPtr reg, void *closure) { - ScreenPtr pScreen = pDst->pDrawable->pScreen; - ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(pScreen); - PictureScreenPtr ps = GetPictureScreen(pScreen); - BoxRec box; - BoxPtr extents; - Bool boxNotEmpty = FALSE; - - if (pPriv->vtSema && pDst->pDrawable->type == DRAWABLE_WINDOW) { - - box.x1 = pDst->pDrawable->x + xDst; - box.y1 = pDst->pDrawable->y + yDst; - box.x2 = box.x1 + width; - box.y2 = box.y1 + height; - - extents = &pDst->pCompositeClip->extents; - if (box.x1 < extents->x1) - box.x1 = extents->x1; - if (box.x2 > extents->x2) - box.x2 = extents->x2; - if (box.y1 < extents->y1) - box.y1 = extents->y1; - if (box.y2 > extents->y2) - box.y2 = extents->y2; - - if (BOX_NOT_EMPTY(box)) { - if (pPriv->preRefresh) - (*pPriv->preRefresh) (pPriv->pScrn, 1, &box); - boxNotEmpty = TRUE; - } - } + ShadowScreenPtr pPriv = closure; - ps->Composite = pPriv->Composite; - (*ps->Composite) (op, pSrc, pMask, pDst, xSrc, ySrc, - xMask, yMask, xDst, yDst, width, height); - ps->Composite = ShadowComposite; + if (!pPriv->pScrn->vtSema) + return; - if (pPriv->postRefresh && boxNotEmpty) { - (*pPriv->postRefresh) (pPriv->pScrn, 1, &box); - } + pPriv->postRefresh(pPriv->pScrn, RegionNumRects(reg), RegionRects(reg)); } -/**********************************************************/ - -static void ShadowValidateGC(GCPtr, unsigned long, DrawablePtr); -static void ShadowChangeGC(GCPtr, unsigned long); -static void ShadowCopyGC(GCPtr, unsigned long, GCPtr); -static void ShadowDestroyGC(GCPtr); -static void ShadowChangeClip(GCPtr, int, pointer, int); -static void ShadowDestroyClip(GCPtr); -static void ShadowCopyClip(GCPtr, GCPtr); - -GCFuncs ShadowGCFuncs = { - ShadowValidateGC, ShadowChangeGC, ShadowCopyGC, ShadowDestroyGC, - ShadowChangeClip, ShadowDestroyClip, ShadowCopyClip -}; - -extern GCOps ShadowGCOps; - static Bool -ShadowCreateGC(GCPtr pGC) +ShadowCreateRootWindow(WindowPtr pWin) { - ScreenPtr pScreen = pGC->pScreen; - ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(pScreen); - ShadowGCPtr pGCPriv = GET_GC_PRIVATE(pGC); Bool ret; + ScreenPtr pScreen = pWin->drawable.pScreen; + ShadowScreenPtr pPriv = shadowfbGetScreenPrivate(pScreen); - pScreen->CreateGC = pPriv->CreateGC; - if ((ret = (*pScreen->CreateGC) (pGC))) { - pGCPriv->ops = NULL; - pGCPriv->funcs = pGC->funcs; - pGC->funcs = &ShadowGCFuncs; - } - pScreen->CreateGC = ShadowCreateGC; - - return ret; -} - -static void -ShadowValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDraw) -{ - SHADOW_GC_FUNC_PROLOGUE(pGC); - (*pGC->funcs->ValidateGC) (pGC, changes, pDraw); - if (pDraw->type == DRAWABLE_WINDOW) - pGCPriv->ops = pGC->ops; /* just so it's not NULL */ - else - pGCPriv->ops = NULL; - SHADOW_GC_FUNC_EPILOGUE(pGC); -} - -static void -ShadowDestroyGC(GCPtr pGC) -{ - SHADOW_GC_FUNC_PROLOGUE(pGC); - (*pGC->funcs->DestroyGC) (pGC); - SHADOW_GC_FUNC_EPILOGUE(pGC); -} - -static void -ShadowChangeGC(GCPtr pGC, unsigned long mask) -{ - SHADOW_GC_FUNC_PROLOGUE(pGC); - (*pGC->funcs->ChangeGC) (pGC, mask); - SHADOW_GC_FUNC_EPILOGUE(pGC); -} - -static void -ShadowCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst) -{ - SHADOW_GC_FUNC_PROLOGUE(pGCDst); - (*pGCDst->funcs->CopyGC) (pGCSrc, mask, pGCDst); - SHADOW_GC_FUNC_EPILOGUE(pGCDst); -} - -static void -ShadowChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects) -{ - SHADOW_GC_FUNC_PROLOGUE(pGC); - (*pGC->funcs->ChangeClip) (pGC, type, pvalue, nrects); - SHADOW_GC_FUNC_EPILOGUE(pGC); -} - -static void -ShadowCopyClip(GCPtr pgcDst, GCPtr pgcSrc) -{ - SHADOW_GC_FUNC_PROLOGUE(pgcDst); - (*pgcDst->funcs->CopyClip) (pgcDst, pgcSrc); - SHADOW_GC_FUNC_EPILOGUE(pgcDst); -} - -static void -ShadowDestroyClip(GCPtr pGC) -{ - SHADOW_GC_FUNC_PROLOGUE(pGC); - (*pGC->funcs->DestroyClip) (pGC); - SHADOW_GC_FUNC_EPILOGUE(pGC); -} - -/**********************************************************/ - -static void -ShadowFillSpans(DrawablePtr pDraw, - GC * pGC, - int nInit, DDXPointPtr pptInit, int *pwidthInit, int fSorted) -{ - SHADOW_GC_OP_PROLOGUE(pGC); - - if (IS_VISIBLE(pDraw) && nInit) { - DDXPointPtr ppt = pptInit; - int *pwidth = pwidthInit; - int i = nInit; - BoxRec box; - Bool boxNotEmpty = FALSE; - - box.x1 = ppt->x; - box.x2 = box.x1 + *pwidth; - box.y2 = box.y1 = ppt->y; - - while (--i) { - ppt++; - pwidth++; - if (box.x1 > ppt->x) - box.x1 = ppt->x; - if (box.x2 < (ppt->x + *pwidth)) - box.x2 = ppt->x + *pwidth; - if (box.y1 > ppt->y) - box.y1 = ppt->y; - else if (box.y2 < ppt->y) - box.y2 = ppt->y; - } - - box.y2++; - - if (!pGC->miTranslate) { - TRANSLATE_BOX(box, pDraw); - } - TRIM_BOX(box, pGC); - - if (BOX_NOT_EMPTY(box)) { - if (pPriv->preRefresh) - (*pPriv->preRefresh) (pPriv->pScrn, 1, &box); - boxNotEmpty = TRUE; - } - - (*pGC->ops->FillSpans) (pDraw, pGC, nInit, pptInit, pwidthInit, - fSorted); - - if (boxNotEmpty && pPriv->postRefresh) - (*pPriv->postRefresh) (pPriv->pScrn, 1, &box); - } - else - (*pGC->ops->FillSpans) (pDraw, pGC, nInit, pptInit, pwidthInit, - fSorted); - - SHADOW_GC_OP_EPILOGUE(pGC); -} - -static void -ShadowSetSpans(DrawablePtr pDraw, - GCPtr pGC, - char *pcharsrc, - DDXPointPtr pptInit, int *pwidthInit, int nspans, int fSorted) -{ - SHADOW_GC_OP_PROLOGUE(pGC); - - if (IS_VISIBLE(pDraw) && nspans) { - DDXPointPtr ppt = pptInit; - int *pwidth = pwidthInit; - int i = nspans; - BoxRec box; - Bool boxNotEmpty = FALSE; - - box.x1 = ppt->x; - box.x2 = box.x1 + *pwidth; - box.y2 = box.y1 = ppt->y; - - while (--i) { - ppt++; - pwidth++; - if (box.x1 > ppt->x) - box.x1 = ppt->x; - if (box.x2 < (ppt->x + *pwidth)) - box.x2 = ppt->x + *pwidth; - if (box.y1 > ppt->y) - box.y1 = ppt->y; - else if (box.y2 < ppt->y) - box.y2 = ppt->y; - } - - box.y2++; - - if (!pGC->miTranslate) { - TRANSLATE_BOX(box, pDraw); - } - TRIM_BOX(box, pGC); - - if (BOX_NOT_EMPTY(box)) { - if (pPriv->preRefresh) - (*pPriv->preRefresh) (pPriv->pScrn, 1, &box); - boxNotEmpty = TRUE; - } - - (*pGC->ops->SetSpans) (pDraw, pGC, pcharsrc, pptInit, - pwidthInit, nspans, fSorted); - - if (boxNotEmpty && pPriv->postRefresh) - (*pPriv->postRefresh) (pPriv->pScrn, 1, &box); - } - else - (*pGC->ops->SetSpans) (pDraw, pGC, pcharsrc, pptInit, - pwidthInit, nspans, fSorted); - - SHADOW_GC_OP_EPILOGUE(pGC); -} - -static void -ShadowPutImage(DrawablePtr pDraw, - GCPtr pGC, - int depth, - int x, int y, int w, int h, - int leftPad, int format, char *pImage) -{ - BoxRec box; - Bool boxNotEmpty = FALSE; + /* paranoia */ + if (pWin != pScreen->root) + ErrorF("ShadowCreateRootWindow called unexpectedly\n"); - SHADOW_GC_OP_PROLOGUE(pGC); + /* call down, but don't hook ourselves back in; we know the first time + * we're called it's for the root window. + */ + pScreen->CreateWindow = pPriv->CreateWindow; + ret = pScreen->CreateWindow(pWin); - if (IS_VISIBLE(pDraw)) { - box.x1 = x + pDraw->x; - box.x2 = box.x1 + w; - box.y1 = y + pDraw->y; - box.y2 = box.y1 + h; + /* this might look like it leaks, but the damage code reaps listeners + * when their drawable disappears. + */ + if (ret) { + DamagePtr damage; - TRIM_BOX(box, pGC); - if (BOX_NOT_EMPTY(box)) { - if (pPriv->preRefresh) - (*pPriv->preRefresh) (pPriv->pScrn, 1, &box); - boxNotEmpty = TRUE; + if (pPriv->preRefresh) { + damage = DamageCreate(shadowfbReportPre, NULL, + DamageReportRawRegion, + TRUE, pScreen, pPriv); + DamageRegister(&pWin->drawable, damage); } - } - - (*pGC->ops->PutImage) (pDraw, pGC, depth, x, y, w, h, - leftPad, format, pImage); - - if (boxNotEmpty && pPriv->postRefresh) - (*pPriv->postRefresh) (pPriv->pScrn, 1, &box); - - SHADOW_GC_OP_EPILOGUE(pGC); - -} - -static RegionPtr -ShadowCopyArea(DrawablePtr pSrc, - DrawablePtr pDst, - GC * pGC, - int srcx, int srcy, int width, int height, int dstx, int dsty) -{ - RegionPtr ret; - BoxRec box; - Bool boxNotEmpty = FALSE; - - SHADOW_GC_OP_PROLOGUE(pGC); - - if (IS_VISIBLE(pDst)) { - box.x1 = dstx + pDst->x; - box.x2 = box.x1 + width; - box.y1 = dsty + pDst->y; - box.y2 = box.y1 + height; - TRIM_BOX(box, pGC); - if (BOX_NOT_EMPTY(box)) { - if (pPriv->preRefresh) - (*pPriv->preRefresh) (pPriv->pScrn, 1, &box); - boxNotEmpty = TRUE; + if (pPriv->postRefresh) { + damage = DamageCreate(shadowfbReportPost, NULL, + DamageReportRawRegion, + TRUE, pScreen, pPriv); + DamageSetReportAfterOp(damage, TRUE); + DamageRegister(&pWin->drawable, damage); } } - ret = (*pGC->ops->CopyArea) (pSrc, pDst, - pGC, srcx, srcy, width, height, dstx, dsty); - - if (boxNotEmpty && pPriv->postRefresh) - (*pPriv->postRefresh) (pPriv->pScrn, 1, &box); - - SHADOW_GC_OP_EPILOGUE(pGC); - return ret; } -static RegionPtr -ShadowCopyPlane(DrawablePtr pSrc, - DrawablePtr pDst, - GCPtr pGC, - int srcx, int srcy, - int width, int height, - int dstx, int dsty, unsigned long bitPlane) -{ - RegionPtr ret; - BoxRec box; - Bool boxNotEmpty = FALSE; - - SHADOW_GC_OP_PROLOGUE(pGC); - - if (IS_VISIBLE(pDst)) { - box.x1 = dstx + pDst->x; - box.x2 = box.x1 + width; - box.y1 = dsty + pDst->y; - box.y2 = box.y1 + height; - - TRIM_BOX(box, pGC); - if (BOX_NOT_EMPTY(box)) { - if (pPriv->preRefresh) - (*pPriv->preRefresh) (pPriv->pScrn, 1, &box); - boxNotEmpty = TRUE; - } - } - - ret = (*pGC->ops->CopyPlane) (pSrc, pDst, - pGC, srcx, srcy, width, height, dstx, dsty, - bitPlane); - - if (boxNotEmpty && pPriv->postRefresh) - (*pPriv->postRefresh) (pPriv->pScrn, 1, &box); - - SHADOW_GC_OP_EPILOGUE(pGC); - - return ret; -} - -static void -ShadowPolyPoint(DrawablePtr pDraw, - GCPtr pGC, int mode, int nptInit, xPoint * pptInit) -{ - BoxRec box; - Bool boxNotEmpty = FALSE; - - SHADOW_GC_OP_PROLOGUE(pGC); - - if (IS_VISIBLE(pDraw) && nptInit) { - xPoint *ppt = pptInit; - int npt = nptInit; - - box.x2 = box.x1 = pptInit->x; - box.y2 = box.y1 = pptInit->y; - - /* this could be slow if the points were spread out */ - - while (--npt) { - ppt++; - if (box.x1 > ppt->x) - box.x1 = ppt->x; - else if (box.x2 < ppt->x) - box.x2 = ppt->x; - if (box.y1 > ppt->y) - box.y1 = ppt->y; - else if (box.y2 < ppt->y) - box.y2 = ppt->y; - } - - box.x2++; - box.y2++; - - TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC); - if (BOX_NOT_EMPTY(box)) { - if (pPriv->preRefresh) - (*pPriv->preRefresh) (pPriv->pScrn, 1, &box); - boxNotEmpty = TRUE; - } - } - - (*pGC->ops->PolyPoint) (pDraw, pGC, mode, nptInit, pptInit); - - if (boxNotEmpty && pPriv->postRefresh) - (*pPriv->postRefresh) (pPriv->pScrn, 1, &box); - - SHADOW_GC_OP_EPILOGUE(pGC); -} - -static void -ShadowPolylines(DrawablePtr pDraw, - GCPtr pGC, int mode, int nptInit, DDXPointPtr pptInit) -{ - BoxRec box; - Bool boxNotEmpty = FALSE; - - SHADOW_GC_OP_PROLOGUE(pGC); - - if (IS_VISIBLE(pDraw) && nptInit) { - DDXPointPtr ppt = pptInit; - int npt = nptInit; - int extra = pGC->lineWidth >> 1; - - box.x2 = box.x1 = pptInit->x; - box.y2 = box.y1 = pptInit->y; - - if (npt > 1) { - if (pGC->joinStyle == JoinMiter) - extra = 6 * pGC->lineWidth; - else if (pGC->capStyle == CapProjecting) - extra = pGC->lineWidth; - } - - if (mode == CoordModePrevious) { - int x = box.x1; - int y = box.y1; - - while (--npt) { - ppt++; - x += ppt->x; - y += ppt->y; - if (box.x1 > x) - box.x1 = x; - else if (box.x2 < x) - box.x2 = x; - if (box.y1 > y) - box.y1 = y; - else if (box.y2 < y) - box.y2 = y; - } - } - else { - while (--npt) { - ppt++; - if (box.x1 > ppt->x) - box.x1 = ppt->x; - else if (box.x2 < ppt->x) - box.x2 = ppt->x; - if (box.y1 > ppt->y) - box.y1 = ppt->y; - else if (box.y2 < ppt->y) - box.y2 = ppt->y; - } - } - - box.x2++; - box.y2++; - - if (extra) { - box.x1 -= extra; - box.x2 += extra; - box.y1 -= extra; - box.y2 += extra; - } - - TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC); - if (BOX_NOT_EMPTY(box)) { - if (pPriv->preRefresh) - (*pPriv->preRefresh) (pPriv->pScrn, 1, &box); - boxNotEmpty = TRUE; - } - } - - (*pGC->ops->Polylines) (pDraw, pGC, mode, nptInit, pptInit); - - if (boxNotEmpty && pPriv->postRefresh) - (*pPriv->postRefresh) (pPriv->pScrn, 1, &box); - - SHADOW_GC_OP_EPILOGUE(pGC); -} - -static void -ShadowPolySegment(DrawablePtr pDraw, - GCPtr pGC, int nsegInit, xSegment * pSegInit) -{ - BoxRec box; - Bool boxNotEmpty = FALSE; - - SHADOW_GC_OP_PROLOGUE(pGC); - - if (IS_VISIBLE(pDraw) && nsegInit) { - int extra = pGC->lineWidth; - xSegment *pSeg = pSegInit; - int nseg = nsegInit; - - if (pGC->capStyle != CapProjecting) - extra >>= 1; - - if (pSeg->x2 > pSeg->x1) { - box.x1 = pSeg->x1; - box.x2 = pSeg->x2; - } - else { - box.x2 = pSeg->x1; - box.x1 = pSeg->x2; - } - - if (pSeg->y2 > pSeg->y1) { - box.y1 = pSeg->y1; - box.y2 = pSeg->y2; - } - else { - box.y2 = pSeg->y1; - box.y1 = pSeg->y2; - } - - while (--nseg) { - pSeg++; - if (pSeg->x2 > pSeg->x1) { - if (pSeg->x1 < box.x1) - box.x1 = pSeg->x1; - if (pSeg->x2 > box.x2) - box.x2 = pSeg->x2; - } - else { - if (pSeg->x2 < box.x1) - box.x1 = pSeg->x2; - if (pSeg->x1 > box.x2) - box.x2 = pSeg->x1; - } - if (pSeg->y2 > pSeg->y1) { - if (pSeg->y1 < box.y1) - box.y1 = pSeg->y1; - if (pSeg->y2 > box.y2) - box.y2 = pSeg->y2; - } - else { - if (pSeg->y2 < box.y1) - box.y1 = pSeg->y2; - if (pSeg->y1 > box.y2) - box.y2 = pSeg->y1; - } - } - - box.x2++; - box.y2++; - - if (extra) { - box.x1 -= extra; - box.x2 += extra; - box.y1 -= extra; - box.y2 += extra; - } - - TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC); - if (BOX_NOT_EMPTY(box)) { - if (pPriv->preRefresh) - (*pPriv->preRefresh) (pPriv->pScrn, 1, &box); - boxNotEmpty = TRUE; - } - } - - (*pGC->ops->PolySegment) (pDraw, pGC, nsegInit, pSegInit); - - if (boxNotEmpty && pPriv->postRefresh) - (*pPriv->postRefresh) (pPriv->pScrn, 1, &box); - - SHADOW_GC_OP_EPILOGUE(pGC); -} - -static void -ShadowPolyRectangle(DrawablePtr pDraw, - GCPtr pGC, int nRectsInit, xRectangle *pRectsInit) -{ - BoxRec box; - BoxPtr pBoxInit = NULL; - Bool boxNotEmpty = FALSE; - int num = 0; - - SHADOW_GC_OP_PROLOGUE(pGC); - - if (IS_VISIBLE(pDraw) && nRectsInit) { - xRectangle *pRects = pRectsInit; - int nRects = nRectsInit; - - if (nRects >= 32) { - int extra = pGC->lineWidth >> 1; - - box.x1 = pRects->x; - box.x2 = box.x1 + pRects->width; - box.y1 = pRects->y; - box.y2 = box.y1 + pRects->height; - - while (--nRects) { - pRects++; - if (box.x1 > pRects->x) - box.x1 = pRects->x; - if (box.x2 < (pRects->x + pRects->width)) - box.x2 = pRects->x + pRects->width; - if (box.y1 > pRects->y) - box.y1 = pRects->y; - if (box.y2 < (pRects->y + pRects->height)) - box.y2 = pRects->y + pRects->height; - } - - if (extra) { - box.x1 -= extra; - box.x2 += extra; - box.y1 -= extra; - box.y2 += extra; - } - - box.x2++; - box.y2++; - - TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC); - if (BOX_NOT_EMPTY(box)) { - if (pPriv->preRefresh) - (*pPriv->preRefresh) (pPriv->pScrn, 1, &box); - boxNotEmpty = TRUE; - } - } - else { - BoxPtr pbox; - int offset1, offset2, offset3; - - offset2 = pGC->lineWidth; - if (!offset2) - offset2 = 1; - offset1 = offset2 >> 1; - offset3 = offset2 - offset1; - - pBoxInit = (BoxPtr) malloc(nRects * 4 * sizeof(BoxRec)); - pbox = pBoxInit; - - while (nRects--) { - pbox->x1 = pRects->x - offset1; - pbox->y1 = pRects->y - offset1; - pbox->x2 = pbox->x1 + pRects->width + offset2; - pbox->y2 = pbox->y1 + offset2; - TRIM_AND_TRANSLATE_BOX((*pbox), pDraw, pGC); - if (BOX_NOT_EMPTY((*pbox))) { - num++; - pbox++; - } - - pbox->x1 = pRects->x - offset1; - pbox->y1 = pRects->y + offset3; - pbox->x2 = pbox->x1 + offset2; - pbox->y2 = pbox->y1 + pRects->height - offset2; - TRIM_AND_TRANSLATE_BOX((*pbox), pDraw, pGC); - if (BOX_NOT_EMPTY((*pbox))) { - num++; - pbox++; - } - - pbox->x1 = pRects->x + pRects->width - offset1; - pbox->y1 = pRects->y + offset3; - pbox->x2 = pbox->x1 + offset2; - pbox->y2 = pbox->y1 + pRects->height - offset2; - TRIM_AND_TRANSLATE_BOX((*pbox), pDraw, pGC); - if (BOX_NOT_EMPTY((*pbox))) { - num++; - pbox++; - } - - pbox->x1 = pRects->x - offset1; - pbox->y1 = pRects->y + pRects->height - offset1; - pbox->x2 = pbox->x1 + pRects->width + offset2; - pbox->y2 = pbox->y1 + offset2; - TRIM_AND_TRANSLATE_BOX((*pbox), pDraw, pGC); - if (BOX_NOT_EMPTY((*pbox))) { - num++; - pbox++; - } - - pRects++; - } - - if (num) { - if (pPriv->preRefresh) - (*pPriv->preRefresh) (pPriv->pScrn, num, pBoxInit); - } - else { - free(pBoxInit); - } - } - } - - (*pGC->ops->PolyRectangle) (pDraw, pGC, nRectsInit, pRectsInit); - - if (boxNotEmpty && pPriv->postRefresh) { - (*pPriv->postRefresh) (pPriv->pScrn, 1, &box); - } - else if (num) { - if (pPriv->postRefresh) - (*pPriv->postRefresh) (pPriv->pScrn, num, pBoxInit); - free(pBoxInit); - } - - SHADOW_GC_OP_EPILOGUE(pGC); - -} - -static void -ShadowPolyArc(DrawablePtr pDraw, GCPtr pGC, int narcsInit, xArc * parcsInit) -{ - BoxRec box; - Bool boxNotEmpty = FALSE; - - SHADOW_GC_OP_PROLOGUE(pGC); - - if (IS_VISIBLE(pDraw) && narcsInit) { - int narcs = narcsInit; - xArc *parcs = parcsInit; - int extra = pGC->lineWidth >> 1; - - box.x1 = parcs->x; - box.x2 = box.x1 + parcs->width; - box.y1 = parcs->y; - box.y2 = box.y1 + parcs->height; - - /* should I break these up instead ? */ - - while (--narcs) { - parcs++; - if (box.x1 > parcs->x) - box.x1 = parcs->x; - if (box.x2 < (parcs->x + parcs->width)) - box.x2 = parcs->x + parcs->width; - if (box.y1 > parcs->y) - box.y1 = parcs->y; - if (box.y2 < (parcs->y + parcs->height)) - box.y2 = parcs->y + parcs->height; - } - - if (extra) { - box.x1 -= extra; - box.x2 += extra; - box.y1 -= extra; - box.y2 += extra; - } - - box.x2++; - box.y2++; - - TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC); - if (BOX_NOT_EMPTY(box)) { - if (pPriv->preRefresh) - (*pPriv->preRefresh) (pPriv->pScrn, 1, &box); - boxNotEmpty = TRUE; - } - } - - (*pGC->ops->PolyArc) (pDraw, pGC, narcsInit, parcsInit); - - if (boxNotEmpty && pPriv->postRefresh) - (*pPriv->postRefresh) (pPriv->pScrn, 1, &box); - - SHADOW_GC_OP_EPILOGUE(pGC); - -} - -static void -ShadowFillPolygon(DrawablePtr pDraw, - GCPtr pGC, - int shape, int mode, int count, DDXPointPtr pptInit) -{ - SHADOW_GC_OP_PROLOGUE(pGC); - - if (IS_VISIBLE(pDraw) && (count > 2)) { - DDXPointPtr ppt = pptInit; - int i = count; - BoxRec box; - Bool boxNotEmpty = FALSE; - - box.x2 = box.x1 = ppt->x; - box.y2 = box.y1 = ppt->y; - - if (mode != CoordModeOrigin) { - int x = box.x1; - int y = box.y1; - - while (--i) { - ppt++; - x += ppt->x; - y += ppt->y; - if (box.x1 > x) - box.x1 = x; - else if (box.x2 < x) - box.x2 = x; - if (box.y1 > y) - box.y1 = y; - else if (box.y2 < y) - box.y2 = y; - } - } - else { - while (--i) { - ppt++; - if (box.x1 > ppt->x) - box.x1 = ppt->x; - else if (box.x2 < ppt->x) - box.x2 = ppt->x; - if (box.y1 > ppt->y) - box.y1 = ppt->y; - else if (box.y2 < ppt->y) - box.y2 = ppt->y; - } - } - - box.x2++; - box.y2++; - - TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC); - if (BOX_NOT_EMPTY(box)) { - if (pPriv->preRefresh) - (*pPriv->preRefresh) (pPriv->pScrn, 1, &box); - boxNotEmpty = TRUE; - } - - (*pGC->ops->FillPolygon) (pDraw, pGC, shape, mode, count, pptInit); - - if (boxNotEmpty && pPriv->postRefresh) - (*pPriv->postRefresh) (pPriv->pScrn, 1, &box); - } - else - (*pGC->ops->FillPolygon) (pDraw, pGC, shape, mode, count, pptInit); - - SHADOW_GC_OP_EPILOGUE(pGC); -} - -static void -ShadowPolyFillRect(DrawablePtr pDraw, - GCPtr pGC, int nRectsInit, xRectangle *pRectsInit) -{ - SHADOW_GC_OP_PROLOGUE(pGC); - - if (IS_VISIBLE(pDraw) && nRectsInit) { - BoxRec box; - Bool boxNotEmpty = FALSE; - xRectangle *pRects = pRectsInit; - int nRects = nRectsInit; - - box.x1 = pRects->x; - box.x2 = box.x1 + pRects->width; - box.y1 = pRects->y; - box.y2 = box.y1 + pRects->height; - - while (--nRects) { - pRects++; - if (box.x1 > pRects->x) - box.x1 = pRects->x; - if (box.x2 < (pRects->x + pRects->width)) - box.x2 = pRects->x + pRects->width; - if (box.y1 > pRects->y) - box.y1 = pRects->y; - if (box.y2 < (pRects->y + pRects->height)) - box.y2 = pRects->y + pRects->height; - } - - /* cfb messes with the pRectsInit so we have to do our - calculations first */ - - TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC); - if (BOX_NOT_EMPTY(box)) { - if (pPriv->preRefresh) - (*pPriv->preRefresh) (pPriv->pScrn, 1, &box); - boxNotEmpty = TRUE; - } - - (*pGC->ops->PolyFillRect) (pDraw, pGC, nRectsInit, pRectsInit); - - if (boxNotEmpty && pPriv->postRefresh) - (*pPriv->postRefresh) (pPriv->pScrn, 1, &box); - } - else - (*pGC->ops->PolyFillRect) (pDraw, pGC, nRectsInit, pRectsInit); - - SHADOW_GC_OP_EPILOGUE(pGC); -} - -static void -ShadowPolyFillArc(DrawablePtr pDraw, GCPtr pGC, int narcsInit, xArc * parcsInit) -{ - BoxRec box; - Bool boxNotEmpty = FALSE; - - SHADOW_GC_OP_PROLOGUE(pGC); - - if (IS_VISIBLE(pDraw) && narcsInit) { - xArc *parcs = parcsInit; - int narcs = narcsInit; - - box.x1 = parcs->x; - box.x2 = box.x1 + parcs->width; - box.y1 = parcs->y; - box.y2 = box.y1 + parcs->height; - - /* should I break these up instead ? */ - - while (--narcs) { - parcs++; - if (box.x1 > parcs->x) - box.x1 = parcs->x; - if (box.x2 < (parcs->x + parcs->width)) - box.x2 = parcs->x + parcs->width; - if (box.y1 > parcs->y) - box.y1 = parcs->y; - if (box.y2 < (parcs->y + parcs->height)) - box.y2 = parcs->y + parcs->height; - } - - TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC); - if (BOX_NOT_EMPTY(box)) { - if (pPriv->preRefresh) - (*pPriv->preRefresh) (pPriv->pScrn, 1, &box); - boxNotEmpty = TRUE; - } - } - - (*pGC->ops->PolyFillArc) (pDraw, pGC, narcsInit, parcsInit); - - if (boxNotEmpty && pPriv->postRefresh) - (*pPriv->postRefresh) (pPriv->pScrn, 1, &box); - - SHADOW_GC_OP_EPILOGUE(pGC); -} - -static void -ShadowTextExtent(FontPtr pFont, int count, char *chars, - FontEncoding fontEncoding, BoxPtr box) -{ - unsigned long n, i; - int w; - CharInfoPtr charinfo[255]; /* encoding only has 1 byte for count */ - - GetGlyphs(pFont, (unsigned long) count, (unsigned char *) chars, - fontEncoding, &n, charinfo); - w = 0; - for (i = 0; i < n; i++) { - w += charinfo[i]->metrics.characterWidth; - } - if (i) { - w += charinfo[i - 1]->metrics.rightSideBearing; - } - - box->x1 = 0; - if (n) { - if (charinfo[0]->metrics.leftSideBearing < 0) { - box->x1 = charinfo[0]->metrics.leftSideBearing; - } - } - box->x2 = w; - box->y1 = -FONTMAXBOUNDS(pFont, ascent); - box->y2 = FONTMAXBOUNDS(pFont, descent); -} - -static void -ShadowFontToBox(BoxPtr BB, DrawablePtr pDrawable, GCPtr pGC, int x, int y, - int count, char *chars, int wide) -{ - FontPtr pFont; - - pFont = pGC->font; - if (pFont->info.constantWidth) { - int ascent, descent, left, right = 0; - - ascent = max(pFont->info.fontAscent, pFont->info.maxbounds.ascent); - descent = max(pFont->info.fontDescent, pFont->info.maxbounds.descent); - left = pFont->info.maxbounds.leftSideBearing; - if (count > 0) { - right = (count - 1) * pFont->info.maxbounds.characterWidth; - } - right += pFont->info.maxbounds.rightSideBearing; - BB->x1 = - max(pDrawable->x + x - left, - RegionExtents(&((WindowPtr) pDrawable)->winSize)->x1); - BB->y1 = - max(pDrawable->y + y - ascent, - RegionExtents(&((WindowPtr) pDrawable)->winSize)->y1); - BB->x2 = - min(pDrawable->x + x + right, - RegionExtents(&((WindowPtr) pDrawable)->winSize)->x2); - BB->y2 = - min(pDrawable->y + y + descent, - RegionExtents(&((WindowPtr) pDrawable)->winSize)->y2); - } - else { - ShadowTextExtent(pFont, count, chars, wide ? (FONTLASTROW(pFont) == 0) - ? Linear16Bit : TwoD16Bit : Linear8Bit, BB); - BB->x1 = - max(pDrawable->x + x + BB->x1, - RegionExtents(&((WindowPtr) pDrawable)->winSize)->x1); - BB->y1 = - max(pDrawable->y + y + BB->y1, - RegionExtents(&((WindowPtr) pDrawable)->winSize)->y1); - BB->x2 = - min(pDrawable->x + x + BB->x2, - RegionExtents(&((WindowPtr) pDrawable)->winSize)->x2); - BB->y2 = - min(pDrawable->y + y + BB->y2, - RegionExtents(&((WindowPtr) pDrawable)->winSize)->y2); - } -} - -static int -ShadowPolyText8(DrawablePtr pDraw, - GCPtr pGC, int x, int y, int count, char *chars) -{ - int width; - BoxRec box; - Bool boxNotEmpty = FALSE; - - SHADOW_GC_OP_PROLOGUE(pGC); - - if (IS_VISIBLE(pDraw)) { - ShadowFontToBox(&box, pDraw, pGC, x, y, count, chars, 0); - - TRIM_BOX(box, pGC); - if (BOX_NOT_EMPTY(box)) { - if (pPriv->preRefresh) - (*pPriv->preRefresh) (pPriv->pScrn, 1, &box); - boxNotEmpty = TRUE; - } - } - - width = (*pGC->ops->PolyText8) (pDraw, pGC, x, y, count, chars); - - if (boxNotEmpty && pPriv->postRefresh) - (*pPriv->postRefresh) (pPriv->pScrn, 1, &box); - - SHADOW_GC_OP_EPILOGUE(pGC); - - return width; -} - -static int -ShadowPolyText16(DrawablePtr pDraw, - GCPtr pGC, int x, int y, int count, unsigned short *chars) -{ - int width; - BoxRec box; - Bool boxNotEmpty = FALSE; - - SHADOW_GC_OP_PROLOGUE(pGC); - - if (IS_VISIBLE(pDraw)) { - ShadowFontToBox(&box, pDraw, pGC, x, y, count, (char *) chars, 1); - - TRIM_BOX(box, pGC); - if (BOX_NOT_EMPTY(box)) { - if (pPriv->preRefresh) - (*pPriv->preRefresh) (pPriv->pScrn, 1, &box); - boxNotEmpty = TRUE; - } - } - - width = (*pGC->ops->PolyText16) (pDraw, pGC, x, y, count, chars); - - if (boxNotEmpty && pPriv->postRefresh) - (*pPriv->postRefresh) (pPriv->pScrn, 1, &box); - - SHADOW_GC_OP_EPILOGUE(pGC); - - return width; -} - -static void -ShadowImageText8(DrawablePtr pDraw, - GCPtr pGC, int x, int y, int count, char *chars) -{ - BoxRec box; - Bool boxNotEmpty = FALSE; - - SHADOW_GC_OP_PROLOGUE(pGC); - - if (IS_VISIBLE(pDraw) && count) { - int top, bot, Min, Max; - - top = max(FONTMAXBOUNDS(pGC->font, ascent), FONTASCENT(pGC->font)); - bot = max(FONTMAXBOUNDS(pGC->font, descent), FONTDESCENT(pGC->font)); - - Min = count * FONTMINBOUNDS(pGC->font, characterWidth); - if (Min > 0) - Min = 0; - Max = count * FONTMAXBOUNDS(pGC->font, characterWidth); - if (Max < 0) - Max = 0; - - /* ugh */ - box.x1 = pDraw->x + x + Min + FONTMINBOUNDS(pGC->font, leftSideBearing); - box.x2 = pDraw->x + x + Max + - FONTMAXBOUNDS(pGC->font, rightSideBearing); - - box.y1 = pDraw->y + y - top; - box.y2 = pDraw->y + y + bot; - - TRIM_BOX(box, pGC); - if (BOX_NOT_EMPTY(box)) { - if (pPriv->preRefresh) - (*pPriv->preRefresh) (pPriv->pScrn, 1, &box); - boxNotEmpty = TRUE; - } - } - - (*pGC->ops->ImageText8) (pDraw, pGC, x, y, count, chars); - - if (boxNotEmpty && pPriv->postRefresh) - (*pPriv->postRefresh) (pPriv->pScrn, 1, &box); - - SHADOW_GC_OP_EPILOGUE(pGC); -} - -static void -ShadowImageText16(DrawablePtr pDraw, - GCPtr pGC, int x, int y, int count, unsigned short *chars) -{ - BoxRec box; - Bool boxNotEmpty = FALSE; - - SHADOW_GC_OP_PROLOGUE(pGC); - - if (IS_VISIBLE(pDraw) && count) { - int top, bot, Min, Max; - - top = max(FONTMAXBOUNDS(pGC->font, ascent), FONTASCENT(pGC->font)); - bot = max(FONTMAXBOUNDS(pGC->font, descent), FONTDESCENT(pGC->font)); - - Min = count * FONTMINBOUNDS(pGC->font, characterWidth); - if (Min > 0) - Min = 0; - Max = count * FONTMAXBOUNDS(pGC->font, characterWidth); - if (Max < 0) - Max = 0; - - /* ugh */ - box.x1 = pDraw->x + x + Min + FONTMINBOUNDS(pGC->font, leftSideBearing); - box.x2 = pDraw->x + x + Max + - FONTMAXBOUNDS(pGC->font, rightSideBearing); - - box.y1 = pDraw->y + y - top; - box.y2 = pDraw->y + y + bot; - - TRIM_BOX(box, pGC); - if (BOX_NOT_EMPTY(box)) { - if (pPriv->preRefresh) - (*pPriv->preRefresh) (pPriv->pScrn, 1, &box); - boxNotEmpty = TRUE; - } - } - - (*pGC->ops->ImageText16) (pDraw, pGC, x, y, count, chars); - - if (boxNotEmpty && pPriv->postRefresh) - (*pPriv->postRefresh) (pPriv->pScrn, 1, &box); - - SHADOW_GC_OP_EPILOGUE(pGC); -} - -static void -ShadowImageGlyphBlt(DrawablePtr pDraw, - GCPtr pGC, - int x, int y, - unsigned int nglyphInit, - CharInfoPtr * ppciInit, pointer pglyphBase) -{ - BoxRec box; - Bool boxNotEmpty = FALSE; - - SHADOW_GC_OP_PROLOGUE(pGC); - - if (IS_VISIBLE(pDraw) && nglyphInit) { - CharInfoPtr *ppci = ppciInit; - unsigned int nglyph = nglyphInit; - int top, bot, width = 0; - - top = max(FONTMAXBOUNDS(pGC->font, ascent), FONTASCENT(pGC->font)); - bot = max(FONTMAXBOUNDS(pGC->font, descent), FONTDESCENT(pGC->font)); - - box.x1 = ppci[0]->metrics.leftSideBearing; - if (box.x1 > 0) - box.x1 = 0; - box.x2 = ppci[nglyph - 1]->metrics.rightSideBearing - - ppci[nglyph - 1]->metrics.characterWidth; - if (box.x2 < 0) - box.x2 = 0; - - box.x2 += pDraw->x + x; - box.x1 += pDraw->x + x; - - while (nglyph--) { - width += (*ppci)->metrics.characterWidth; - ppci++; - } - - if (width > 0) - box.x2 += width; - else - box.x1 += width; - - box.y1 = pDraw->y + y - top; - box.y2 = pDraw->y + y + bot; - - TRIM_BOX(box, pGC); - if (BOX_NOT_EMPTY(box)) { - if (pPriv->preRefresh) - (*pPriv->preRefresh) (pPriv->pScrn, 1, &box); - boxNotEmpty = TRUE; - } - } - - (*pGC->ops->ImageGlyphBlt) (pDraw, pGC, x, y, nglyphInit, - ppciInit, pglyphBase); - - if (boxNotEmpty && pPriv->postRefresh) - (*pPriv->postRefresh) (pPriv->pScrn, 1, &box); - - SHADOW_GC_OP_EPILOGUE(pGC); -} - -static void -ShadowPolyGlyphBlt(DrawablePtr pDraw, - GCPtr pGC, - int x, int y, - unsigned int nglyphInit, - CharInfoPtr * ppciInit, pointer pglyphBase) -{ - BoxRec box; - Bool boxNotEmpty = FALSE; - - SHADOW_GC_OP_PROLOGUE(pGC); - - if (IS_VISIBLE(pDraw) && nglyphInit) { - CharInfoPtr *ppci = ppciInit; - unsigned int nglyph = nglyphInit; - - /* ugh */ - box.x1 = pDraw->x + x + ppci[0]->metrics.leftSideBearing; - box.x2 = pDraw->x + x + ppci[nglyph - 1]->metrics.rightSideBearing; - - if (nglyph > 1) { - int width = 0; - - while (--nglyph) { - width += (*ppci)->metrics.characterWidth; - ppci++; - } - - if (width > 0) - box.x2 += width; - else - box.x1 += width; - } - - box.y1 = pDraw->y + y - FONTMAXBOUNDS(pGC->font, ascent); - box.y2 = pDraw->y + y + FONTMAXBOUNDS(pGC->font, descent); - - TRIM_BOX(box, pGC); - if (BOX_NOT_EMPTY(box)) { - if (pPriv->preRefresh) - (*pPriv->preRefresh) (pPriv->pScrn, 1, &box); - boxNotEmpty = TRUE; - } - } - - (*pGC->ops->PolyGlyphBlt) (pDraw, pGC, x, y, nglyphInit, - ppciInit, pglyphBase); - - if (boxNotEmpty && pPriv->postRefresh) - (*pPriv->postRefresh) (pPriv->pScrn, 1, &box); - - SHADOW_GC_OP_EPILOGUE(pGC); -} - -static void -ShadowPushPixels(GCPtr pGC, - PixmapPtr pBitMap, - DrawablePtr pDraw, int dx, int dy, int xOrg, int yOrg) +static Bool +ShadowCloseScreen(ScreenPtr pScreen) { - BoxRec box; - Bool boxNotEmpty = FALSE; - - SHADOW_GC_OP_PROLOGUE(pGC); - - if (IS_VISIBLE(pDraw)) { - box.x1 = xOrg; - box.y1 = yOrg; - - if (!pGC->miTranslate) { - box.x1 += pDraw->x; - box.y1 += pDraw->y; - } + ShadowScreenPtr pPriv = shadowfbGetScreenPrivate(pScreen); - box.x2 = box.x1 + dx; - box.y2 = box.y1 + dy; - - TRIM_BOX(box, pGC); - if (BOX_NOT_EMPTY(box)) { - if (pPriv->preRefresh) - (*pPriv->preRefresh) (pPriv->pScrn, 1, &box); - boxNotEmpty = TRUE; - } - } - - (*pGC->ops->PushPixels) (pGC, pBitMap, pDraw, dx, dy, xOrg, yOrg); + pScreen->CloseScreen = pPriv->CloseScreen; - if (boxNotEmpty && pPriv->postRefresh) - (*pPriv->postRefresh) (pPriv->pScrn, 1, &box); + free(pPriv); - SHADOW_GC_OP_EPILOGUE(pGC); + return (*pScreen->CloseScreen) (pScreen); } - -GCOps ShadowGCOps = { - ShadowFillSpans, ShadowSetSpans, - ShadowPutImage, ShadowCopyArea, - ShadowCopyPlane, ShadowPolyPoint, - ShadowPolylines, ShadowPolySegment, - ShadowPolyRectangle, ShadowPolyArc, - ShadowFillPolygon, ShadowPolyFillRect, - ShadowPolyFillArc, ShadowPolyText8, - ShadowPolyText16, ShadowImageText8, - ShadowImageText16, ShadowImageGlyphBlt, - ShadowPolyGlyphBlt, ShadowPushPixels, -}; diff --git a/xserver/hw/xfree86/utils/Makefile.in b/xserver/hw/xfree86/utils/Makefile.in index ed94baa8e..7e8c7d22b 100644 --- a/xserver/hw/xfree86/utils/Makefile.in +++ b/xserver/hw/xfree86/utils/Makefile.in @@ -168,6 +168,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -212,6 +214,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -314,7 +320,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -323,6 +332,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -389,6 +399,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/hw/xfree86/utils/cvt/Makefile.in b/xserver/hw/xfree86/utils/cvt/Makefile.in index 29be15fb0..27bf6d9b8 100644 --- a/xserver/hw/xfree86/utils/cvt/Makefile.in +++ b/xserver/hw/xfree86/utils/cvt/Makefile.in @@ -190,6 +190,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -234,6 +236,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -336,7 +342,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -345,6 +354,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -411,6 +421,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/hw/xfree86/utils/cvt/cvt.c b/xserver/hw/xfree86/utils/cvt/cvt.c index 5e2888e94..d5df17fd9 100644 --- a/xserver/hw/xfree86/utils/cvt/cvt.c +++ b/xserver/hw/xfree86/utils/cvt/cvt.c @@ -39,10 +39,10 @@ FatalError(const char *f, ...) } /* xnfalloc implementation used by the server code we built in */ -pointer +void * XNFalloc(unsigned long n) { - pointer r; + void *r; r = malloc(n); if (!r) { @@ -53,10 +53,10 @@ XNFalloc(unsigned long n) } /* xnfcalloc implementation used by the server code we built in */ -pointer +void * XNFcalloc(unsigned long n) { - pointer r; + void *r; r = calloc(1, n); if (!r) { diff --git a/xserver/hw/xfree86/utils/gtf/Makefile.in b/xserver/hw/xfree86/utils/gtf/Makefile.in index 4d2204b9a..fb3b898e4 100644 --- a/xserver/hw/xfree86/utils/gtf/Makefile.in +++ b/xserver/hw/xfree86/utils/gtf/Makefile.in @@ -189,6 +189,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -233,6 +235,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -335,7 +341,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -344,6 +353,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -410,6 +420,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/hw/xfree86/utils/man/Makefile.in b/xserver/hw/xfree86/utils/man/Makefile.in index fdb4f6b0b..0c0450636 100644 --- a/xserver/hw/xfree86/utils/man/Makefile.in +++ b/xserver/hw/xfree86/utils/man/Makefile.in @@ -160,6 +160,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -204,6 +206,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -268,6 +274,7 @@ MAN_SUBSTS = @MAN_SUBSTS@ -e 's|__logdir__|$(logdir)|g' -e \ 's|__XKB_DFLT_OPTIONS__|$(XKB_DFLT_OPTIONS)|g' -e \ 's|__bundle_id_prefix__|$(BUNDLE_ID_PREFIX)|g' -e \ 's|__modulepath__|$(DEFAULT_MODULE_PATH)|g' -e \ + 's|__suid_wrapper_dir__|$(SUID_WRAPPER_DIR)|g' -e \ 's|__default_font_path__|$(COMPILEDDEFAULTFONTPATH)|g' -e \ '\|$(COMPILEDDEFAULTFONTPATH)| s|/,|/, |g' MISC_MAN_DIR = @MISC_MAN_DIR@ @@ -322,7 +329,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -331,6 +341,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -397,6 +408,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/hw/xfree86/vbe/Makefile.in b/xserver/hw/xfree86/vbe/Makefile.in index 040bf0b26..8ad9996e2 100644 --- a/xserver/hw/xfree86/vbe/Makefile.in +++ b/xserver/hw/xfree86/vbe/Makefile.in @@ -195,6 +195,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -239,6 +241,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -341,7 +347,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -350,6 +359,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -416,6 +426,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/hw/xfree86/vbe/vbe.c b/xserver/hw/xfree86/vbe/vbe.c index 39f0cefb6..d41e61ba8 100644 --- a/xserver/hw/xfree86/vbe/vbe.c +++ b/xserver/hw/xfree86/vbe/vbe.c @@ -50,7 +50,7 @@ vbeInfoPtr VBEExtendedInit(xf86Int10InfoPtr pInt, int entityIndex, int Flags) { int RealOff; - pointer page = NULL; + void *page = NULL; ScrnInfoPtr pScrn = xf86FindScreenForEntity(entityIndex); vbeControllerInfoPtr vbe = NULL; Bool init_int10 = FALSE; @@ -259,7 +259,7 @@ static unsigned char * vbeReadEDID(vbeInfoPtr pVbe) { int RealOff = pVbe->real_mode_base; - pointer page = pVbe->memory; + void *page = pVbe->memory; unsigned char *tmp = NULL; Bool novbe = FALSE; Bool noddc = FALSE; @@ -319,7 +319,7 @@ vbeReadEDID(vbeInfoPtr pVbe) } xf86MonPtr -vbeDoEDID(vbeInfoPtr pVbe, pointer unused) +vbeDoEDID(vbeInfoPtr pVbe, void *unused) { unsigned char *DDC_data = NULL; @@ -545,7 +545,7 @@ VBEFreeModeInfo(VbeModeInfoBlock * block) Bool VBESaveRestore(vbeInfoPtr pVbe, vbeSaveRestoreFunction function, - pointer *memory, int *size, int *real_mode_pages) + void **memory, int *size, int *real_mode_pages) { /* Input: @@ -929,7 +929,7 @@ VBEVesaSaveRestore(vbeInfoPtr pVbe, vbeSaveRestorePtr vbe_sr, memcpy(vbe_sr->state, vbe_sr->pstate, vbe_sr->stateSize); ErrorF("VBESaveRestore\n"); if ((VBESaveRestore(pVbe, function, - (pointer) &vbe_sr->state, + (void *) &vbe_sr->state, &vbe_sr->stateSize, &vbe_sr->statePage))) { if (function == MODE_SAVE) { SaveSucc = TRUE; @@ -1055,7 +1055,7 @@ struct vbePanelID * VBEReadPanelID(vbeInfoPtr pVbe) { int RealOff = pVbe->real_mode_base; - pointer page = pVbe->memory; + void *page = pVbe->memory; void *tmp = NULL; int screen = pVbe->pInt10->pScrn->scrnIndex; diff --git a/xserver/hw/xfree86/vbe/vbe.h b/xserver/hw/xfree86/vbe/vbe.h index 3907c53f3..bc3653334 100644 --- a/xserver/hw/xfree86/vbe/vbe.h +++ b/xserver/hw/xfree86/vbe/vbe.h @@ -25,7 +25,7 @@ typedef enum { typedef struct { xf86Int10InfoPtr pInt10; int version; - pointer memory; + void *memory; int real_mode_base; int num_pages; Bool init_int10; @@ -40,7 +40,7 @@ extern _X_EXPORT vbeInfoPtr VBEInit(xf86Int10InfoPtr pInt, int entityIndex); extern _X_EXPORT vbeInfoPtr VBEExtendedInit(xf86Int10InfoPtr pInt, int entityIndex, int Flags); extern _X_EXPORT void vbeFree(vbeInfoPtr pVbe); -extern _X_EXPORT xf86MonPtr vbeDoEDID(vbeInfoPtr pVbe, pointer pDDCModule); +extern _X_EXPORT xf86MonPtr vbeDoEDID(vbeInfoPtr pVbe, void *pDDCModule); #pragma pack(1) @@ -227,7 +227,7 @@ typedef enum { extern _X_EXPORT Bool VBESaveRestore(vbeInfoPtr pVbe, vbeSaveRestoreFunction fuction, - pointer *memory, int *size, int *real_mode_pages); + void **memory, int *size, int *real_mode_pages); /* * INT 5 diff --git a/xserver/hw/xfree86/vbe/vbeModes.c b/xserver/hw/xfree86/vbe/vbeModes.c index 415167d0e..50ac50d2c 100644 --- a/xserver/hw/xfree86/vbe/vbeModes.c +++ b/xserver/hw/xfree86/vbe/vbeModes.c @@ -356,8 +356,10 @@ VBESetModeNames(DisplayModePtr pMode) pMode->name = strdup("BADMODE"); } else { - XNFasprintf(&pMode->name, "%dx%d", + char *tmp; + XNFasprintf(&tmp, "%dx%d", pMode->HDisplay, pMode->VDisplay); + pMode->name = tmp; } } pMode = pMode->next; @@ -433,7 +435,7 @@ VBESetModeParameters(ScrnInfoPtr pScrn, vbeInfoPtr pVbe) */ int VBEValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes, - char **modeNames, ClockRangePtr clockRanges, + const char **modeNames, ClockRangePtr clockRanges, int *linePitches, int minPitch, int maxPitch, int pitchInc, int minHeight, int maxHeight, int virtualX, int virtualY, int apertureSize, LookupModeFlags strategy) diff --git a/xserver/hw/xfree86/vbe/vbeModes.h b/xserver/hw/xfree86/vbe/vbeModes.h index affd5b639..ee0257c15 100644 --- a/xserver/hw/xfree86/vbe/vbeModes.h +++ b/xserver/hw/xfree86/vbe/vbeModes.h @@ -82,7 +82,7 @@ extern _X_EXPORT void VBESetModeParameters(ScrnInfoPtr pScrn, vbeInfoPtr pVbe); */ extern _X_EXPORT int VBEValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes, - char **modeNames, + const char **modeNames, ClockRangePtr clockRanges, int *linePitches, int minPitch, int maxPitch, int pitchInc, int minHeight, diff --git a/xserver/hw/xfree86/vgahw/Makefile.am b/xserver/hw/xfree86/vgahw/Makefile.am index f0b65740c..4b718b489 100644 --- a/xserver/hw/xfree86/vgahw/Makefile.am +++ b/xserver/hw/xfree86/vgahw/Makefile.am @@ -1,5 +1,6 @@ module_LTLIBRARIES = libvgahw.la libvgahw_la_LDFLAGS = -avoid-version +libvgahw_la_LIBADD = $(PCIACCESS_LIBS) libvgahw_la_SOURCES = vgaHW.c vgaHWmodule.c AM_CPPFLAGS = $(XORG_INCS) -I$(srcdir)/../ddc -I$(srcdir)/../i2c AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) diff --git a/xserver/hw/xfree86/vgahw/Makefile.in b/xserver/hw/xfree86/vgahw/Makefile.in index b53750d05..ec4aa6507 100644 --- a/xserver/hw/xfree86/vgahw/Makefile.in +++ b/xserver/hw/xfree86/vgahw/Makefile.in @@ -102,7 +102,8 @@ am__uninstall_files_from_dir = { \ } am__installdirs = "$(DESTDIR)$(moduledir)" "$(DESTDIR)$(sdkdir)" LTLIBRARIES = $(module_LTLIBRARIES) -libvgahw_la_LIBADD = +am__DEPENDENCIES_1 = +libvgahw_la_DEPENDENCIES = $(am__DEPENDENCIES_1) am_libvgahw_la_OBJECTS = vgaHW.lo vgaHWmodule.lo libvgahw_la_OBJECTS = $(am_libvgahw_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) @@ -195,6 +196,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -239,6 +242,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -341,7 +348,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -350,6 +360,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -416,6 +427,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ @@ -490,6 +505,7 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ module_LTLIBRARIES = libvgahw.la libvgahw_la_LDFLAGS = -avoid-version +libvgahw_la_LIBADD = $(PCIACCESS_LIBS) libvgahw_la_SOURCES = vgaHW.c vgaHWmodule.c AM_CPPFLAGS = $(XORG_INCS) -I$(srcdir)/../ddc -I$(srcdir)/../i2c AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) diff --git a/xserver/hw/xfree86/vgahw/vgaCmap.c b/xserver/hw/xfree86/vgahw/vgaCmap.c index e7a0d023e..6e028a7f5 100644 --- a/xserver/hw/xfree86/vgahw/vgaCmap.c +++ b/xserver/hw/xfree86/vgahw/vgaCmap.c @@ -252,7 +252,7 @@ ColormapPtr pmap; if (pmap != GetInstalledmiColormap(pmap->pScreen)) return; - dixLookupResourceByType((pointer *) &defColormap, + dixLookupResourceByType((void **) &defColormap, pmap->pScreen->defColormap, RT_COLORMAP, serverClient, DixInstallAccess); diff --git a/xserver/hw/xfree86/vgahw/vgaHW.h b/xserver/hw/xfree86/vgahw/vgaHW.h index 937a8a507..63a10f42b 100644 --- a/xserver/hw/xfree86/vgahw/vgaHW.h +++ b/xserver/hw/xfree86/vgahw/vgaHW.h @@ -107,18 +107,18 @@ typedef void (*vgaHWMiscProcPtr) (vgaHWPtr hwp); * via the first 17 attribute registers and not the main 8-bit palette. */ typedef struct _vgaHWRec { - pointer Base; /* Address of "VGA" memory */ + void *Base; /* Address of "VGA" memory */ int MapSize; /* Size of "VGA" memory */ unsigned long MapPhys; /* phys location of VGA mem */ int IOBase; /* I/O Base address */ CARD8 *MMIOBase; /* Pointer to MMIO start */ int MMIOOffset; /* base + offset + vgareg = mmioreg */ - pointer FontInfo1; /* save area for fonts in + void *FontInfo1; /* save area for fonts in plane 2 */ - pointer FontInfo2; /* save area for fonts in + void *FontInfo2; /* save area for fonts in plane 3 */ - pointer TextInfo; /* save area for text */ + void *TextInfo; /* save area for text */ vgaRegRec SavedReg; /* saved registers */ vgaRegRec ModeReg; /* register settings for current mode */ @@ -148,7 +148,7 @@ typedef struct _vgaHWRec { vgaHWWriteProcPtr writeDacReadAddr; vgaHWWriteProcPtr writeDacData; vgaHWReadProcPtr readDacData; - pointer ddc; + void *ddc; struct pci_io_handle *io; vgaHWReadProcPtr readEnable; vgaHWWriteProcPtr writeEnable; diff --git a/xserver/hw/xfree86/x86emu/Makefile.in b/xserver/hw/xfree86/x86emu/Makefile.in index 7f53eac65..4fd8b37ec 100644 --- a/xserver/hw/xfree86/x86emu/Makefile.in +++ b/xserver/hw/xfree86/x86emu/Makefile.in @@ -164,6 +164,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -208,6 +210,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -310,7 +316,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -319,6 +328,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -385,6 +395,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/hw/xfree86/x86emu/ops.c b/xserver/hw/xfree86/x86emu/ops.c index 76b83581f..b50badb28 100644 --- a/xserver/hw/xfree86/x86emu/ops.c +++ b/xserver/hw/xfree86/x86emu/ops.c @@ -10189,8 +10189,8 @@ Handles opcode 0xe8 static void x86emuOp_call_near_IMM(u8 X86EMU_UNUSED(op1)) { - s16 ip16; - s32 ip32; + s16 ip16 = 0; + s32 ip32 = 0; START_OF_INSTR(); DECODE_PRINTF("CALL\t"); @@ -11705,38 +11705,38 @@ x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1)) switch (rh) { case 0: /* inc word ptr ... */ if (M.x86.mode & SYSMODE_PREFIX_DATA) { - u32 destval; + u32 destval32; - destval = fetch_data_long(destoffset); + destval32 = fetch_data_long(destoffset); TRACE_AND_STEP(); - destval = inc_long(destval); - store_data_long(destoffset, destval); + destval32 = inc_long(destval32); + store_data_long(destoffset, destval32); } else { - u16 destval; + u16 destval16; - destval = fetch_data_word(destoffset); + destval16 = fetch_data_word(destoffset); TRACE_AND_STEP(); - destval = inc_word(destval); - store_data_word(destoffset, destval); + destval16 = inc_word(destval16); + store_data_word(destoffset, destval16); } break; case 1: /* dec word ptr ... */ if (M.x86.mode & SYSMODE_PREFIX_DATA) { - u32 destval; + u32 destval32; - destval = fetch_data_long(destoffset); + destval32 = fetch_data_long(destoffset); TRACE_AND_STEP(); - destval = dec_long(destval); - store_data_long(destoffset, destval); + destval32 = dec_long(destval32); + store_data_long(destoffset, destval32); } else { - u16 destval; + u16 destval16; - destval = fetch_data_word(destoffset); + destval16 = fetch_data_word(destoffset); TRACE_AND_STEP(); - destval = dec_word(destval); - store_data_word(destoffset, destval); + destval16 = dec_word(destval16); + store_data_word(destoffset, destval16); } break; case 2: /* call word ptr ... */ @@ -11768,18 +11768,18 @@ x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1)) break; case 6: /* push word ptr ... */ if (M.x86.mode & SYSMODE_PREFIX_DATA) { - u32 destval; + u32 destval32; - destval = fetch_data_long(destoffset); + destval32 = fetch_data_long(destoffset); TRACE_AND_STEP(); - push_long(destval); + push_long(destval32); } else { - u16 destval; + u16 destval16; - destval = fetch_data_word(destoffset); + destval16 = fetch_data_word(destoffset); TRACE_AND_STEP(); - push_word(destval); + push_word(destval16); } break; } @@ -11790,38 +11790,38 @@ x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1)) switch (rh) { case 0: if (M.x86.mode & SYSMODE_PREFIX_DATA) { - u32 destval; + u32 destval32; - destval = fetch_data_long(destoffset); + destval32 = fetch_data_long(destoffset); TRACE_AND_STEP(); - destval = inc_long(destval); - store_data_long(destoffset, destval); + destval32 = inc_long(destval32); + store_data_long(destoffset, destval32); } else { - u16 destval; + u16 destval16; - destval = fetch_data_word(destoffset); + destval16 = fetch_data_word(destoffset); TRACE_AND_STEP(); - destval = inc_word(destval); - store_data_word(destoffset, destval); + destval16 = inc_word(destval16); + store_data_word(destoffset, destval16); } break; case 1: if (M.x86.mode & SYSMODE_PREFIX_DATA) { - u32 destval; + u32 destval32; - destval = fetch_data_long(destoffset); + destval32 = fetch_data_long(destoffset); TRACE_AND_STEP(); - destval = dec_long(destval); - store_data_long(destoffset, destval); + destval32 = dec_long(destval32); + store_data_long(destoffset, destval32); } else { - u16 destval; + u16 destval16; - destval = fetch_data_word(destoffset); + destval16 = fetch_data_word(destoffset); TRACE_AND_STEP(); - destval = dec_word(destval); - store_data_word(destoffset, destval); + destval16 = dec_word(destval16); + store_data_word(destoffset, destval16); } break; case 2: /* call word ptr ... */ @@ -11853,18 +11853,18 @@ x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1)) break; case 6: /* push word ptr ... */ if (M.x86.mode & SYSMODE_PREFIX_DATA) { - u32 destval; + u32 destval32; - destval = fetch_data_long(destoffset); + destval32 = fetch_data_long(destoffset); TRACE_AND_STEP(); - push_long(destval); + push_long(destval32); } else { - u16 destval; + u16 destval16; - destval = fetch_data_word(destoffset); + destval16 = fetch_data_word(destoffset); TRACE_AND_STEP(); - push_word(destval); + push_word(destval16); } break; } @@ -11875,38 +11875,38 @@ x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1)) switch (rh) { case 0: if (M.x86.mode & SYSMODE_PREFIX_DATA) { - u32 destval; + u32 destval32; - destval = fetch_data_long(destoffset); + destval32 = fetch_data_long(destoffset); TRACE_AND_STEP(); - destval = inc_long(destval); - store_data_long(destoffset, destval); + destval32 = inc_long(destval32); + store_data_long(destoffset, destval32); } else { - u16 destval; + u16 destval16; - destval = fetch_data_word(destoffset); + destval16 = fetch_data_word(destoffset); TRACE_AND_STEP(); - destval = inc_word(destval); - store_data_word(destoffset, destval); + destval16 = inc_word(destval16); + store_data_word(destoffset, destval16); } break; case 1: if (M.x86.mode & SYSMODE_PREFIX_DATA) { - u32 destval; + u32 destval32; - destval = fetch_data_long(destoffset); + destval32 = fetch_data_long(destoffset); TRACE_AND_STEP(); - destval = dec_long(destval); - store_data_long(destoffset, destval); + destval32 = dec_long(destval32); + store_data_long(destoffset, destval32); } else { - u16 destval; + u16 destval16; - destval = fetch_data_word(destoffset); + destval16 = fetch_data_word(destoffset); TRACE_AND_STEP(); - destval = dec_word(destval); - store_data_word(destoffset, destval); + destval16 = dec_word(destval16); + store_data_word(destoffset, destval16); } break; case 2: /* call word ptr ... */ @@ -11938,18 +11938,18 @@ x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1)) break; case 6: /* push word ptr ... */ if (M.x86.mode & SYSMODE_PREFIX_DATA) { - u32 destval; + u32 destval32; - destval = fetch_data_long(destoffset); + destval32 = fetch_data_long(destoffset); TRACE_AND_STEP(); - push_long(destval); + push_long(destval32); } else { - u16 destval; + u16 destval16; - destval = fetch_data_word(destoffset); + destval16 = fetch_data_word(destoffset); TRACE_AND_STEP(); - push_word(destval); + push_word(destval16); } break; } @@ -11958,38 +11958,38 @@ x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1)) switch (rh) { case 0: if (M.x86.mode & SYSMODE_PREFIX_DATA) { - u32 *destreg; + u32 *destreg32; - destreg = DECODE_RM_LONG_REGISTER(rl); + destreg32 = DECODE_RM_LONG_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); - *destreg = inc_long(*destreg); + *destreg32 = inc_long(*destreg32); } else { - u16 *destreg; + u16 *destreg16; - destreg = DECODE_RM_WORD_REGISTER(rl); + destreg16 = DECODE_RM_WORD_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); - *destreg = inc_word(*destreg); + *destreg16 = inc_word(*destreg16); } break; case 1: if (M.x86.mode & SYSMODE_PREFIX_DATA) { - u32 *destreg; + u32 *destreg32; - destreg = DECODE_RM_LONG_REGISTER(rl); + destreg32 = DECODE_RM_LONG_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); - *destreg = dec_long(*destreg); + *destreg32 = dec_long(*destreg32); } else { - u16 *destreg; + u16 *destreg16; - destreg = DECODE_RM_WORD_REGISTER(rl); + destreg16 = DECODE_RM_WORD_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); - *destreg = dec_word(*destreg); + *destreg16 = dec_word(*destreg16); } break; case 2: /* call word ptr ... */ @@ -12018,20 +12018,20 @@ x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1)) break; case 6: if (M.x86.mode & SYSMODE_PREFIX_DATA) { - u32 *destreg; + u32 *destreg32; - destreg = DECODE_RM_LONG_REGISTER(rl); + destreg32 = DECODE_RM_LONG_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); - push_long(*destreg); + push_long(*destreg32); } else { - u16 *destreg; + u16 *destreg16; - destreg = DECODE_RM_WORD_REGISTER(rl); + destreg16 = DECODE_RM_WORD_REGISTER(rl); DECODE_PRINTF("\n"); TRACE_AND_STEP(); - push_word(*destreg); + push_word(*destreg16); } break; } diff --git a/xserver/hw/xfree86/x86emu/x86emu/regs.h b/xserver/hw/xfree86/x86emu/x86emu/regs.h index 2ecafa047..3a7456e4c 100644 --- a/xserver/hw/xfree86/x86emu/x86emu/regs.h +++ b/xserver/hw/xfree86/x86emu/x86emu/regs.h @@ -39,6 +39,8 @@ #ifndef __X86EMU_REGS_H #define __X86EMU_REGS_H +#include <X11/Xfuncproto.h> + /*---------------------- Macros and type definitions ----------------------*/ #ifdef PACK @@ -337,7 +339,8 @@ extern "C" { /* Use "C" linkage when in C++ mode */ /* Function to log information at runtime */ - void printk(const char *fmt, ...); + void printk(const char *fmt, ...) + _X_ATTRIBUTE_PRINTF(1, 2); #ifdef __cplusplus } /* End of "C" linkage for C++ */ diff --git a/xserver/hw/xfree86/xorg-wrapper.c b/xserver/hw/xfree86/xorg-wrapper.c new file mode 100644 index 000000000..4ea47331b --- /dev/null +++ b/xserver/hw/xfree86/xorg-wrapper.c @@ -0,0 +1,272 @@ +/* + * Copyright © 2014 Red Hat, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Author: Hans de Goede <hdegoede@redhat.com> + */ + +#include "dix-config.h" + +#include <errno.h> +#include <fcntl.h> +#include <limits.h> +#include <stdint.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <sys/ioctl.h> +#include <sys/stat.h> +#include <sys/types.h> +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) +#include <sys/consio.h> +#endif +#include <unistd.h> +#include <drm.h> +#include <xf86drm.h> /* For DRM_DEV_NAME */ + +#define CONFIG_FILE SYSCONFDIR "/X11/Xwrapper.config" + +static const char *progname; + +enum { ROOT_ONLY, CONSOLE_ONLY, ANYBODY }; + +/* KISS non locale / LANG parsing isspace version */ +static int is_space(char c) +{ + return c == ' ' || c == '\t' || c == '\n'; +} + +static char *strip(char *s) +{ + int i; + + /* Strip leading whitespace */ + while (s[0] && is_space(s[0])) + s++; + + /* Strip trailing whitespace */ + i = strlen(s) - 1; + while (i >= 0 && is_space(s[i])) { + s[i] = 0; + i--; + } + + return s; +} + +static void parse_config(int *allowed, int *needs_root_rights) +{ + FILE *f; + char buf[1024]; + char *stripped, *equals, *key, *value; + int line = 0; + + f = fopen(CONFIG_FILE, "r"); + if (!f) + return; + + while (fgets(buf, sizeof(buf), f)) { + line++; + + /* Skip comments and empty lines */ + stripped = strip(buf); + if (stripped[0] == '#' || stripped[0] == 0) + continue; + + /* Split in a key + value pair */ + equals = strchr(stripped, '='); + if (!equals) { + fprintf(stderr, "%s: Syntax error at %s line %d\n", progname, + CONFIG_FILE, line); + exit(1); + } + *equals = 0; + key = strip(stripped); /* To remove trailing whitespace from key */ + value = strip(equals + 1); /* To remove leading whitespace from val */ + if (!key[0]) { + fprintf(stderr, "%s: Missing key at %s line %d\n", progname, + CONFIG_FILE, line); + exit(1); + } + if (!value[0]) { + fprintf(stderr, "%s: Missing value at %s line %d\n", progname, + CONFIG_FILE, line); + exit(1); + } + + /* And finally process */ + if (strcmp(key, "allowed_users") == 0) { + if (strcmp(value, "rootonly") == 0) + *allowed = ROOT_ONLY; + else if (strcmp(value, "console") == 0) + *allowed = CONSOLE_ONLY; + else if (strcmp(value, "anybody") == 0) + *allowed = ANYBODY; + else { + fprintf(stderr, + "%s: Invalid value '%s' for 'allowed_users' at %s line %d\n", + progname, value, CONFIG_FILE, line); + exit(1); + } + } + else if (strcmp(key, "needs_root_rights") == 0) { + if (strcmp(value, "yes") == 0) + *needs_root_rights = 1; + else if (strcmp(value, "no") == 0) + *needs_root_rights = 0; + else if (strcmp(value, "auto") == 0) + *needs_root_rights = -1; + else { + fprintf(stderr, + "%s: Invalid value '%s' for 'needs_root_rights' at %s line %d\n", + progname, value, CONFIG_FILE, line); + exit(1); + } + } + else if (strcmp(key, "nice_value") == 0) { + /* Backward compatibility with older Debian Xwrapper, ignore */ + } + else { + fprintf(stderr, "%s: Invalid key '%s' at %s line %d\n", key, + progname, CONFIG_FILE, line); + exit(1); + } + } + fclose(f); +} + +static int on_console(int fd) +{ +#if defined(__linux__) + struct stat st; + int r; + + r = fstat(fd, &st); + if (r == 0 && S_ISCHR(st.st_mode) && major(st.st_rdev) == 4) + return 1; +#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) + int idx; + + if (ioctl(fd, VT_GETINDEX, &idx) != -1) + return 1; +#else +#warning This program needs porting to your kernel. + static int seen; + + if (!seen) { + fprintf(stderr, "%s: Unable to determine if running on a console\n", + progname); + seen = 1; + } +#endif + + return 0; +} + +int main(int argc, char *argv[]) +{ + struct drm_mode_card_res res; + char buf[PATH_MAX]; + int i, r, fd; + int kms_cards = 0; + int total_cards = 0; + int allowed = CONSOLE_ONLY; + int needs_root_rights = -1; + + progname = argv[0]; + + parse_config(&allowed, &needs_root_rights); + + /* For non root users check if they are allowed to run the X server */ + if (getuid() != 0) { + switch (allowed) { + case ROOT_ONLY: + /* Already checked above */ + fprintf(stderr, "%s: Only root is allowed to run the X server\n", argv[0]); + exit(1); + break; + case CONSOLE_ONLY: + /* Some of stdin / stdout / stderr maybe redirected to a file */ + for (i = STDIN_FILENO; i <= STDERR_FILENO; i++) { + if (on_console(i)) + break; + } + if (i > STDERR_FILENO) { + fprintf(stderr, "%s: Only console users are allowed to run the X server\n", argv[0]); + exit(1); + } + break; + case ANYBODY: + break; + } + } + + /* Detect if we need root rights, except when overriden by the config */ + if (needs_root_rights == -1) { + for (i = 0; i < 16; i++) { + snprintf(buf, sizeof(buf), DRM_DEV_NAME, DRM_DIR_NAME, i); + fd = open(buf, O_RDWR); + if (fd == -1) + continue; + + total_cards++; + + memset(&res, 0, sizeof(struct drm_mode_card_res)); + r = ioctl(fd, DRM_IOCTL_MODE_GETRESOURCES, &res); + if (r == 0 && res.count_connectors > 0) + kms_cards++; + + close(fd); + } + } + + /* If we've found cards, and all cards support kms, drop root rights */ + if (needs_root_rights == 0 || (total_cards && kms_cards == total_cards)) { + gid_t realgid = getgid(); + uid_t realuid = getuid(); + + if (setresgid(-1, realgid, realgid) != 0) { + fprintf(stderr, "%s: Could not drop setgid privileges: %s\n", + progname, strerror(errno)); + exit(1); + } + if (setresuid(-1, realuid, realuid) != 0) { + fprintf(stderr, "%s: Could not drop setuid privileges: %s\n", + progname, strerror(errno)); + exit(1); + } + } + + snprintf(buf, sizeof(buf), "%s/Xorg.bin", SUID_WRAPPER_DIR); + + /* Check if the server is executable by our real uid */ + if (access(buf, X_OK) != 0) { + fprintf(stderr, "%s: Missing execute permissions for %s/Xorg.bin: %s\n", + progname, SUID_WRAPPER_DIR, strerror(errno)); + exit(1); + } + + argv[0] = buf; + (void) execv(argv[0], argv); + fprintf(stderr, "%s: Failed to execute %s/Xorg.bin: %s\n", + progname, SUID_WRAPPER_DIR, strerror(errno)); + exit(1); +} diff --git a/xserver/hw/xnest/Color.c b/xserver/hw/xnest/Color.c index 7ef137d59..95c334308 100644 --- a/xserver/hw/xnest/Color.c +++ b/xserver/hw/xnest/Color.c @@ -137,7 +137,7 @@ xnestDestroyColormap(ColormapPtr pCmap) (xnestWindow(pWin) != None && wColormap(pWin) == icws->cmapIDs[i]) static int -xnestCountInstalledColormapWindows(WindowPtr pWin, pointer ptr) +xnestCountInstalledColormapWindows(WindowPtr pWin, void *ptr) { xnestInstalledColormapWindows *icws = (xnestInstalledColormapWindows *) ptr; int i; @@ -152,7 +152,7 @@ xnestCountInstalledColormapWindows(WindowPtr pWin, pointer ptr) } static int -xnestGetInstalledColormapWindows(WindowPtr pWin, pointer ptr) +xnestGetInstalledColormapWindows(WindowPtr pWin, void *ptr) { xnestInstalledColormapWindows *icws = (xnestInstalledColormapWindows *) ptr; int i; @@ -198,12 +198,12 @@ xnestSetInstalledColormapWindows(ScreenPtr pScreen) sizeof(Colormap)); icws.numCmapIDs = xnestListInstalledColormaps(pScreen, icws.cmapIDs); icws.numWindows = 0; - WalkTree(pScreen, xnestCountInstalledColormapWindows, (pointer) &icws); + WalkTree(pScreen, xnestCountInstalledColormapWindows, (void *) &icws); if (icws.numWindows) { icws.windows = (Window *) malloc((icws.numWindows + 1) * sizeof(Window)); icws.index = 0; - WalkTree(pScreen, xnestGetInstalledColormapWindows, (pointer) &icws); + WalkTree(pScreen, xnestGetInstalledColormapWindows, (void *) &icws); icws.windows[icws.numWindows] = xnestDefaultWindows[pScreen->myNum]; numWindows = icws.numWindows + 1; } @@ -252,11 +252,11 @@ xnestSetInstalledColormapWindows(ScreenPtr pScreen) visual = xnestVisualFromID(pScreen, wVisual(pWin)); if (visual == xnestDefaultVisual(pScreen)) - dixLookupResourceByType((pointer *) &pCmap, wColormap(pWin), + dixLookupResourceByType((void **) &pCmap, wColormap(pWin), RT_COLORMAP, serverClient, DixUseAccess); else - dixLookupResourceByType((pointer *) &pCmap, + dixLookupResourceByType((void **) &pCmap, pScreen->defColormap, RT_COLORMAP, serverClient, DixUseAccess); @@ -309,7 +309,7 @@ xnestDirectInstallColormaps(ScreenPtr pScreen) for (i = 0; i < n; i++) { ColormapPtr pCmap; - dixLookupResourceByType((pointer *) &pCmap, pCmapIDs[i], RT_COLORMAP, + dixLookupResourceByType((void **) &pCmap, pCmapIDs[i], RT_COLORMAP, serverClient, DixInstallAccess); if (pCmap) XInstallColormap(xnestDisplay, xnestColormap(pCmap)); @@ -330,7 +330,7 @@ xnestDirectUninstallColormaps(ScreenPtr pScreen) for (i = 0; i < n; i++) { ColormapPtr pCmap; - dixLookupResourceByType((pointer *) &pCmap, pCmapIDs[i], RT_COLORMAP, + dixLookupResourceByType((void **) &pCmap, pCmapIDs[i], RT_COLORMAP, serverClient, DixUninstallAccess); if (pCmap) XUninstallColormap(xnestDisplay, xnestColormap(pCmap)); @@ -347,10 +347,10 @@ xnestInstallColormap(ColormapPtr pCmap) /* Uninstall pInstalledMap. Notify all interested parties. */ if (pOldCmap != (ColormapPtr) None) - WalkTree(pCmap->pScreen, TellLostMap, (pointer) &pOldCmap->mid); + WalkTree(pCmap->pScreen, TellLostMap, (void *) &pOldCmap->mid); SetInstalledColormap(pCmap->pScreen, pCmap); - WalkTree(pCmap->pScreen, TellGainedMap, (pointer) &pCmap->mid); + WalkTree(pCmap->pScreen, TellGainedMap, (void *) &pCmap->mid); xnestSetInstalledColormapWindows(pCmap->pScreen); xnestDirectInstallColormaps(pCmap->pScreen); @@ -364,7 +364,7 @@ xnestUninstallColormap(ColormapPtr pCmap) if (pCmap == pCurCmap) { if (pCmap->mid != pCmap->pScreen->defColormap) { - dixLookupResourceByType((pointer *) &pCurCmap, + dixLookupResourceByType((void **) &pCurCmap, pCmap->pScreen->defColormap, RT_COLORMAP, serverClient, DixInstallAccess); diff --git a/xserver/hw/xnest/Events.c b/xserver/hw/xnest/Events.c index 447d5a72b..3ff095bb8 100644 --- a/xserver/hw/xnest/Events.c +++ b/xserver/hw/xnest/Events.c @@ -64,15 +64,15 @@ SetTimeSinceLastInputEvent(void) } static Bool -xnestExposurePredicate(Display * display, XEvent * event, char *args) +xnestExposurePredicate(Display * dpy, XEvent * event, char *args) { return event->type == Expose || event->type == ProcessedExpose; } static Bool -xnestNotExposurePredicate(Display * display, XEvent * event, char *args) +xnestNotExposurePredicate(Display * dpy, XEvent * event, char *args) { - return !xnestExposurePredicate(display, event, args); + return !xnestExposurePredicate(dpy, event, args); } void diff --git a/xserver/hw/xnest/Font.c b/xserver/hw/xnest/Font.c index 1e95588ef..ffdfd2497 100644 --- a/xserver/hw/xnest/Font.c +++ b/xserver/hw/xnest/Font.c @@ -35,7 +35,7 @@ int xnestFontPrivateIndex; Bool xnestRealizeFont(ScreenPtr pScreen, FontPtr pFont) { - pointer priv; + void *priv; Atom name_atom, value_atom; int nprops; FontPropPtr props; @@ -64,7 +64,7 @@ xnestRealizeFont(ScreenPtr pScreen, FontPtr pFont) if (!name) return False; - priv = (pointer) malloc(sizeof(xnestPrivFont)); + priv = (void *) malloc(sizeof(xnestPrivFont)); FontSetPrivate(pFont, xnestFontPrivateIndex, priv); xnestFontPriv(pFont)->font_struct = XLoadQueryFont(xnestDisplay, name); diff --git a/xserver/hw/xnest/GC.c b/xserver/hw/xnest/GC.c index cfaf71475..0ec60fcdc 100644 --- a/xserver/hw/xnest/GC.c +++ b/xserver/hw/xnest/GC.c @@ -188,7 +188,7 @@ xnestDestroyGC(GCPtr pGC) } void -xnestChangeClip(GCPtr pGC, int type, pointer pValue, int nRects) +xnestChangeClip(GCPtr pGC, int type, void *pValue, int nRects) { int i, size; BoxPtr pBox; @@ -225,7 +225,7 @@ xnestChangeClip(GCPtr pGC, int type, pointer pValue, int nRects) * current pixmap contents. */ pGC->clientClip = - (pointer) (*pGC->pScreen->BitmapToRegion) ((PixmapPtr) pValue); + (void *) (*pGC->pScreen->BitmapToRegion) ((PixmapPtr) pValue); (*pGC->pScreen->DestroyPixmap) ((PixmapPtr) pValue); pValue = pGC->clientClip; type = CT_REGION; @@ -269,7 +269,7 @@ xnestChangeClip(GCPtr pGC, int type, pointer pValue, int nRects) * other parts of server can only deal with CT_NONE, * CT_PIXMAP and CT_REGION client clips. */ - pGC->clientClip = (pointer) RegionFromRects(nRects, + pGC->clientClip = (void *) RegionFromRects(nRects, (xRectangle *) pValue, type); free(pValue); diff --git a/xserver/hw/xnest/GCOps.c b/xserver/hw/xnest/GCOps.c index d00511d71..e1cf9d65f 100644 --- a/xserver/hw/xnest/GCOps.c +++ b/xserver/hw/xnest/GCOps.c @@ -95,7 +95,7 @@ xnestPutImage(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y, } static int -xnestIgnoreErrorHandler (Display *display, +xnestIgnoreErrorHandler (Display *dpy, XErrorEvent *event) { return False; /* return value is ignored */ @@ -127,7 +127,7 @@ xnestGetImage(DrawablePtr pDrawable, int x, int y, int w, int h, } static Bool -xnestBitBlitPredicate(Display * display, XEvent * event, char *args) +xnestBitBlitPredicate(Display * dpy, XEvent * event, char *args) { return event->type == GraphicsExpose || event->type == NoExpose; } @@ -308,7 +308,7 @@ xnestImageText16(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, void xnestImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y, unsigned int nGlyphs, CharInfoPtr * pCharInfo, - pointer pGlyphBase) + void *pGlyphBase) { ErrorF("xnest warning: function xnestImageGlyphBlt not implemented\n"); } @@ -316,7 +316,7 @@ xnestImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y, void xnestPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y, unsigned int nGlyphs, CharInfoPtr * pCharInfo, - pointer pGlyphBase) + void *pGlyphBase) { ErrorF("xnest warning: function xnestPolyGlyphBlt not implemented\n"); } diff --git a/xserver/hw/xnest/GCOps.h b/xserver/hw/xnest/GCOps.h index b1cad110c..fd1f6bfc2 100644 --- a/xserver/hw/xnest/GCOps.h +++ b/xserver/hw/xnest/GCOps.h @@ -58,10 +58,10 @@ void xnestImageText16(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, unsigned short *string); void xnestImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y, unsigned int nGlyphs, CharInfoPtr * pCharInfo, - pointer pGlyphBase); + void *pGlyphBase); void xnestPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y, unsigned int nGlyphs, CharInfoPtr * pCharInfo, - pointer pGlyphBase); + void *pGlyphBase); void xnestPushPixels(GCPtr pGC, PixmapPtr pBitmap, DrawablePtr pDrawable, int width, int height, int x, int y); diff --git a/xserver/hw/xnest/Handlers.c b/xserver/hw/xnest/Handlers.c index 4605b90bd..05d559d8f 100644 --- a/xserver/hw/xnest/Handlers.c +++ b/xserver/hw/xnest/Handlers.c @@ -32,14 +32,14 @@ is" without express or implied warranty. #include "Handlers.h" void -xnestBlockHandler(pointer blockData, OSTimePtr pTimeout, pointer pReadMask) +xnestBlockHandler(void *blockData, OSTimePtr pTimeout, void *pReadMask) { xnestCollectExposures(); XFlush(xnestDisplay); } void -xnestWakeupHandler(pointer blockData, int result, pointer pReadMask) +xnestWakeupHandler(void *blockData, int result, void *pReadMask) { xnestCollectEvents(); } diff --git a/xserver/hw/xnest/Handlers.h b/xserver/hw/xnest/Handlers.h index 7160bdd13..d4ad6d254 100644 --- a/xserver/hw/xnest/Handlers.h +++ b/xserver/hw/xnest/Handlers.h @@ -15,8 +15,8 @@ is" without express or implied warranty. #ifndef XNESTHANDLERS_H #define XNESTHANDLERS_H -void xnestBlockHandler(pointer blockData, OSTimePtr pTimeout, - pointer pReadMask); -void xnestWakeupHandler(pointer blockData, int result, pointer pReadMask); +void xnestBlockHandler(void *blockData, OSTimePtr pTimeout, + void *pReadMask); +void xnestWakeupHandler(void *blockData, int result, void *pReadMask); #endif /* XNESTHANDLERS_H */ diff --git a/xserver/hw/xnest/Init.c b/xserver/hw/xnest/Init.c index 330b8ca17..d9f490b85 100644 --- a/xserver/hw/xnest/Init.c +++ b/xserver/hw/xnest/Init.c @@ -46,29 +46,29 @@ is" without express or implied warranty. Bool xnestDoFullGeneration = True; void -InitOutput(ScreenInfo * screenInfo, int argc, char *argv[]) +InitOutput(ScreenInfo * screen_info, int argc, char *argv[]) { int i, j; xnestOpenDisplay(argc, argv); - screenInfo->imageByteOrder = ImageByteOrder(xnestDisplay); - screenInfo->bitmapScanlineUnit = BitmapUnit(xnestDisplay); - screenInfo->bitmapScanlinePad = BitmapPad(xnestDisplay); - screenInfo->bitmapBitOrder = BitmapBitOrder(xnestDisplay); + screen_info->imageByteOrder = ImageByteOrder(xnestDisplay); + screen_info->bitmapScanlineUnit = BitmapUnit(xnestDisplay); + screen_info->bitmapScanlinePad = BitmapPad(xnestDisplay); + screen_info->bitmapBitOrder = BitmapBitOrder(xnestDisplay); - screenInfo->numPixmapFormats = 0; + screen_info->numPixmapFormats = 0; for (i = 0; i < xnestNumPixmapFormats; i++) for (j = 0; j < xnestNumDepths; j++) if ((xnestPixmapFormats[i].depth == 1) || (xnestPixmapFormats[i].depth == xnestDepths[j])) { - screenInfo->formats[screenInfo->numPixmapFormats].depth = + screen_info->formats[screen_info->numPixmapFormats].depth = xnestPixmapFormats[i].depth; - screenInfo->formats[screenInfo->numPixmapFormats].bitsPerPixel = + screen_info->formats[screen_info->numPixmapFormats].bitsPerPixel = xnestPixmapFormats[i].bits_per_pixel; - screenInfo->formats[screenInfo->numPixmapFormats].scanlinePad = + screen_info->formats[screen_info->numPixmapFormats].scanlinePad = xnestPixmapFormats[i].scanline_pad; - screenInfo->numPixmapFormats++; + screen_info->numPixmapFormats++; break; } @@ -80,7 +80,7 @@ InitOutput(ScreenInfo * screenInfo, int argc, char *argv[]) for (i = 0; i < xnestNumScreens; i++) AddScreen(xnestOpenScreen, argc, argv); - xnestNumScreens = screenInfo->numScreens; + xnestNumScreens = screen_info->numScreens; xnestDoFullGeneration = xnestFullGeneration; } diff --git a/xserver/hw/xnest/Keyboard.c b/xserver/hw/xnest/Keyboard.c index d013dc91e..2cf16246b 100644 --- a/xserver/hw/xnest/Keyboard.c +++ b/xserver/hw/xnest/Keyboard.c @@ -59,7 +59,7 @@ extern Status XkbGetControls(Display * /* dpy */ , DeviceIntPtr xnestKeyboardDevice = NULL; void -xnestBell(int volume, DeviceIntPtr pDev, pointer ctrl, int cls) +xnestBell(int volume, DeviceIntPtr pDev, void *ctrl, int cls) { XBell(xnestDisplay, volume); } diff --git a/xserver/hw/xnest/Keyboard.h b/xserver/hw/xnest/Keyboard.h index 45d56bc08..dc5eaa2de 100644 --- a/xserver/hw/xnest/Keyboard.h +++ b/xserver/hw/xnest/Keyboard.h @@ -20,7 +20,7 @@ is" without express or implied warranty. extern DeviceIntPtr xnestKeyboardDevice; -void xnestBell(int volume, DeviceIntPtr pDev, pointer ctrl, int cls); +void xnestBell(int volume, DeviceIntPtr pDev, void *ctrl, int cls); void xnestChangeKeyboardControl(DeviceIntPtr pDev, KeybdCtrl * ctrl); int xnestKeyboardProc(DeviceIntPtr pDev, int onoff); void xnestUpdateModifierState(unsigned int state); diff --git a/xserver/hw/xnest/Makefile.am b/xserver/hw/xnest/Makefile.am index 3c099cd6b..eb550c0f7 100644 --- a/xserver/hw/xnest/Makefile.am +++ b/xserver/hw/xnest/Makefile.am @@ -1,7 +1,6 @@ SUBDIRS = man bin_PROGRAMS = Xnest -noinst_LIBRARIES = libfbcmap.a AM_CFLAGS = -DHAVE_XNEST_CONFIG_H \ $(DIX_CFLAGS) \ @@ -42,16 +41,12 @@ SRCS = Args.c \ XNPixmap.h \ XNWindow.h \ xnest-config.h \ - $(top_srcdir)/Xext/dpmsstubs.c \ - $(top_srcdir)/Xi/stubs.c \ $(top_srcdir)/mi/miinitext.c -libfbcmap_a_SOURCES = $(top_srcdir)/fb/fbcmap_mi.c -libfbcmap_a_CFLAGS = $(AM_CFLAGS) - XNEST_LIBS = \ @XNEST_LIBS@ \ - libfbcmap.a + $(top_builddir)/Xext/libXextdpmsstubs.la \ + $(top_builddir)/Xi/libXistubs.la Xnest_SOURCES = $(SRCS) diff --git a/xserver/hw/xnest/Makefile.in b/xserver/hw/xnest/Makefile.in index 563169d64..b53a6595f 100644 --- a/xserver/hw/xnest/Makefile.in +++ b/xserver/hw/xnest/Makefile.in @@ -14,7 +14,6 @@ @SET_MAKE@ - VPATH = @srcdir@ am__make_dryrun = \ { \ @@ -74,16 +73,6 @@ CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/version-config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = -LIBRARIES = $(noinst_LIBRARIES) -ARFLAGS = cru -AM_V_AR = $(am__v_AR_@AM_V@) -am__v_AR_ = $(am__v_AR_@AM_DEFAULT_V@) -am__v_AR_0 = @echo " AR " $@; -am__v_AR_1 = -libfbcmap_a_AR = $(AR) $(ARFLAGS) -libfbcmap_a_LIBADD = -am_libfbcmap_a_OBJECTS = libfbcmap_a-fbcmap_mi.$(OBJEXT) -libfbcmap_a_OBJECTS = $(am_libfbcmap_a_OBJECTS) am__installdirs = "$(DESTDIR)$(bindir)" PROGRAMS = $(bin_PROGRAMS) am__objects_1 = Args.$(OBJEXT) Color.$(OBJEXT) Cursor.$(OBJEXT) \ @@ -91,10 +80,11 @@ am__objects_1 = Args.$(OBJEXT) Color.$(OBJEXT) Cursor.$(OBJEXT) \ GCOps.$(OBJEXT) Handlers.$(OBJEXT) Init.$(OBJEXT) \ Keyboard.$(OBJEXT) Pixmap.$(OBJEXT) Pointer.$(OBJEXT) \ Screen.$(OBJEXT) Visual.$(OBJEXT) Window.$(OBJEXT) \ - dpmsstubs.$(OBJEXT) stubs.$(OBJEXT) miinitext.$(OBJEXT) + miinitext.$(OBJEXT) am_Xnest_OBJECTS = $(am__objects_1) Xnest_OBJECTS = $(am_Xnest_OBJECTS) -am__DEPENDENCIES_1 = libfbcmap.a +am__DEPENDENCIES_1 = $(top_builddir)/Xext/libXextdpmsstubs.la \ + $(top_builddir)/Xi/libXistubs.la am__DEPENDENCIES_2 = AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) @@ -137,8 +127,8 @@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = -SOURCES = $(libfbcmap_a_SOURCES) $(Xnest_SOURCES) -DIST_SOURCES = $(libfbcmap_a_SOURCES) $(Xnest_SOURCES) +SOURCES = $(Xnest_SOURCES) +DIST_SOURCES = $(Xnest_SOURCES) RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ @@ -223,6 +213,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -267,6 +259,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -369,7 +365,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -378,6 +377,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -413,7 +413,8 @@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = \ @XNEST_LIBS@ \ - libfbcmap.a + $(top_builddir)/Xext/libXextdpmsstubs.la \ + $(top_builddir)/Xi/libXistubs.la XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ @@ -447,6 +448,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ @@ -520,7 +525,6 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = man -noinst_LIBRARIES = libfbcmap.a AM_CFLAGS = -DHAVE_XNEST_CONFIG_H \ $(DIX_CFLAGS) \ $(XNESTMODULES_CFLAGS) @@ -560,12 +564,8 @@ SRCS = Args.c \ XNPixmap.h \ XNWindow.h \ xnest-config.h \ - $(top_srcdir)/Xext/dpmsstubs.c \ - $(top_srcdir)/Xi/stubs.c \ $(top_srcdir)/mi/miinitext.c -libfbcmap_a_SOURCES = $(top_srcdir)/fb/fbcmap_mi.c -libfbcmap_a_CFLAGS = $(AM_CFLAGS) Xnest_SOURCES = $(SRCS) Xnest_DEPENDENCIES = $(XNEST_LIBS) Xnest_LDADD = $(XNEST_LIBS) $(XNEST_SYS_LIBS) $(XSERVER_SYS_LIBS) @@ -607,13 +607,6 @@ $(top_srcdir)/configure: $(am__configure_deps) $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): - -clean-noinstLIBRARIES: - -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) -libfbcmap.a: $(libfbcmap_a_OBJECTS) $(libfbcmap_a_DEPENDENCIES) $(EXTRA_libfbcmap_a_DEPENDENCIES) - $(AM_V_at)-rm -f libfbcmap.a - $(AM_V_AR)$(libfbcmap_a_AR) libfbcmap.a $(libfbcmap_a_OBJECTS) $(libfbcmap_a_LIBADD) - $(AM_V_at)$(RANLIB) libfbcmap.a install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ @@ -686,10 +679,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Screen.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Visual.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Window.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dpmsstubs.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfbcmap_a-fbcmap_mi.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/miinitext.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stubs.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @@ -712,48 +702,6 @@ distclean-compile: @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< -libfbcmap_a-fbcmap_mi.o: $(top_srcdir)/fb/fbcmap_mi.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfbcmap_a_CFLAGS) $(CFLAGS) -MT libfbcmap_a-fbcmap_mi.o -MD -MP -MF $(DEPDIR)/libfbcmap_a-fbcmap_mi.Tpo -c -o libfbcmap_a-fbcmap_mi.o `test -f '$(top_srcdir)/fb/fbcmap_mi.c' || echo '$(srcdir)/'`$(top_srcdir)/fb/fbcmap_mi.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libfbcmap_a-fbcmap_mi.Tpo $(DEPDIR)/libfbcmap_a-fbcmap_mi.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/fb/fbcmap_mi.c' object='libfbcmap_a-fbcmap_mi.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfbcmap_a_CFLAGS) $(CFLAGS) -c -o libfbcmap_a-fbcmap_mi.o `test -f '$(top_srcdir)/fb/fbcmap_mi.c' || echo '$(srcdir)/'`$(top_srcdir)/fb/fbcmap_mi.c - -libfbcmap_a-fbcmap_mi.obj: $(top_srcdir)/fb/fbcmap_mi.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfbcmap_a_CFLAGS) $(CFLAGS) -MT libfbcmap_a-fbcmap_mi.obj -MD -MP -MF $(DEPDIR)/libfbcmap_a-fbcmap_mi.Tpo -c -o libfbcmap_a-fbcmap_mi.obj `if test -f '$(top_srcdir)/fb/fbcmap_mi.c'; then $(CYGPATH_W) '$(top_srcdir)/fb/fbcmap_mi.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/fb/fbcmap_mi.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libfbcmap_a-fbcmap_mi.Tpo $(DEPDIR)/libfbcmap_a-fbcmap_mi.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/fb/fbcmap_mi.c' object='libfbcmap_a-fbcmap_mi.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfbcmap_a_CFLAGS) $(CFLAGS) -c -o libfbcmap_a-fbcmap_mi.obj `if test -f '$(top_srcdir)/fb/fbcmap_mi.c'; then $(CYGPATH_W) '$(top_srcdir)/fb/fbcmap_mi.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/fb/fbcmap_mi.c'; fi` - -dpmsstubs.o: $(top_srcdir)/Xext/dpmsstubs.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dpmsstubs.o -MD -MP -MF $(DEPDIR)/dpmsstubs.Tpo -c -o dpmsstubs.o `test -f '$(top_srcdir)/Xext/dpmsstubs.c' || echo '$(srcdir)/'`$(top_srcdir)/Xext/dpmsstubs.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/dpmsstubs.Tpo $(DEPDIR)/dpmsstubs.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/Xext/dpmsstubs.c' object='dpmsstubs.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dpmsstubs.o `test -f '$(top_srcdir)/Xext/dpmsstubs.c' || echo '$(srcdir)/'`$(top_srcdir)/Xext/dpmsstubs.c - -dpmsstubs.obj: $(top_srcdir)/Xext/dpmsstubs.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dpmsstubs.obj -MD -MP -MF $(DEPDIR)/dpmsstubs.Tpo -c -o dpmsstubs.obj `if test -f '$(top_srcdir)/Xext/dpmsstubs.c'; then $(CYGPATH_W) '$(top_srcdir)/Xext/dpmsstubs.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/Xext/dpmsstubs.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/dpmsstubs.Tpo $(DEPDIR)/dpmsstubs.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/Xext/dpmsstubs.c' object='dpmsstubs.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dpmsstubs.obj `if test -f '$(top_srcdir)/Xext/dpmsstubs.c'; then $(CYGPATH_W) '$(top_srcdir)/Xext/dpmsstubs.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/Xext/dpmsstubs.c'; fi` - -stubs.o: $(top_srcdir)/Xi/stubs.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT stubs.o -MD -MP -MF $(DEPDIR)/stubs.Tpo -c -o stubs.o `test -f '$(top_srcdir)/Xi/stubs.c' || echo '$(srcdir)/'`$(top_srcdir)/Xi/stubs.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/stubs.Tpo $(DEPDIR)/stubs.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/Xi/stubs.c' object='stubs.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o stubs.o `test -f '$(top_srcdir)/Xi/stubs.c' || echo '$(srcdir)/'`$(top_srcdir)/Xi/stubs.c - -stubs.obj: $(top_srcdir)/Xi/stubs.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT stubs.obj -MD -MP -MF $(DEPDIR)/stubs.Tpo -c -o stubs.obj `if test -f '$(top_srcdir)/Xi/stubs.c'; then $(CYGPATH_W) '$(top_srcdir)/Xi/stubs.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/Xi/stubs.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/stubs.Tpo $(DEPDIR)/stubs.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/Xi/stubs.c' object='stubs.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o stubs.obj `if test -f '$(top_srcdir)/Xi/stubs.c'; then $(CYGPATH_W) '$(top_srcdir)/Xi/stubs.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/Xi/stubs.c'; fi` - miinitext.o: $(top_srcdir)/mi/miinitext.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT miinitext.o -MD -MP -MF $(DEPDIR)/miinitext.Tpo -c -o miinitext.o `test -f '$(top_srcdir)/mi/miinitext.c' || echo '$(srcdir)/'`$(top_srcdir)/mi/miinitext.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/miinitext.Tpo $(DEPDIR)/miinitext.Po @@ -957,7 +905,7 @@ distdir: $(DISTFILES) done check-am: all-am check: check-recursive -all-am: Makefile $(LIBRARIES) $(PROGRAMS) +all-am: Makefile $(PROGRAMS) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(bindir)"; do \ @@ -995,8 +943,7 @@ maintainer-clean-generic: @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive -clean-am: clean-binPROGRAMS clean-generic clean-libtool \ - clean-noinstLIBRARIES mostlyclean-am +clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive -rm -rf ./$(DEPDIR) @@ -1070,20 +1017,19 @@ uninstall-am: uninstall-binPROGRAMS .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am check check-am clean clean-binPROGRAMS \ - clean-generic clean-libtool clean-noinstLIBRARIES cscopelist \ - cscopelist-recursive ctags ctags-recursive distclean \ - distclean-compile distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am html html-am info info-am \ - install install-am install-binPROGRAMS install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ - install-ps install-ps-am install-strip installcheck \ - installcheck-am installdirs installdirs-am maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags tags-recursive uninstall uninstall-am \ - uninstall-binPROGRAMS + clean-generic clean-libtool cscopelist cscopelist-recursive \ + ctags ctags-recursive distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-binPROGRAMS install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ + uninstall uninstall-am uninstall-binPROGRAMS # -UDPMSExtension for miinitext? can't put into diff --git a/xserver/hw/xnest/Pixmap.c b/xserver/hw/xnest/Pixmap.c index 2902acd56..6514f3b31 100644 --- a/xserver/hw/xnest/Pixmap.c +++ b/xserver/hw/xnest/Pixmap.c @@ -80,7 +80,7 @@ xnestDestroyPixmap(PixmapPtr pPixmap) Bool xnestModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, int depth, - int bitsPerPixel, int devKind, pointer pPixData) + int bitsPerPixel, int devKind, void *pPixData) { if(!xnestPixmapPriv(pPixmap)->pixmap && width > 0 && height > 0) { xnestPixmapPriv(pPixmap)->pixmap = diff --git a/xserver/hw/xnest/Window.c b/xserver/hw/xnest/Window.c index e2b21b58e..fc87e823e 100644 --- a/xserver/hw/xnest/Window.c +++ b/xserver/hw/xnest/Window.c @@ -42,7 +42,7 @@ is" without express or implied warranty. DevPrivateKeyRec xnestWindowPrivateKeyRec; static int -xnestFindWindowMatch(WindowPtr pWin, pointer ptr) +xnestFindWindowMatch(WindowPtr pWin, void *ptr) { xnestWindowMatch *wm = (xnestWindowMatch *) ptr; @@ -64,7 +64,7 @@ xnestWindowPtr(Window window) wm.window = window; for (i = 0; i < xnestNumScreens; i++) { - WalkTree(screenInfo.screens[i], xnestFindWindowMatch, (pointer) &wm); + WalkTree(screenInfo.screens[i], xnestFindWindowMatch, (void *) &wm); if (wm.pWin) break; } @@ -96,7 +96,7 @@ xnestCreateWindow(WindowPtr pWin) xnestVisualFromID(pWin->drawable.pScreen, wVisual(pWin)); mask |= CWColormap; if (pWin->optional->colormap) { - dixLookupResourceByType((pointer *) &pCmap, wColormap(pWin), + dixLookupResourceByType((void **) &pCmap, wColormap(pWin), RT_COLORMAP, serverClient, DixUseAccess); attributes.colormap = xnestColormap(pCmap); @@ -109,7 +109,7 @@ xnestCreateWindow(WindowPtr pWin) } else { /* root windows have their own colormaps at creation time */ visual = xnestVisualFromID(pWin->drawable.pScreen, wVisual(pWin)); - dixLookupResourceByType((pointer *) &pCmap, wColormap(pWin), + dixLookupResourceByType((void **) &pCmap, wColormap(pWin), RT_COLORMAP, serverClient, DixUseAccess); mask |= CWColormap; attributes.colormap = xnestColormap(pCmap); @@ -331,7 +331,7 @@ xnestChangeWindowAttributes(WindowPtr pWin, unsigned long mask) if (mask & CWColormap) { ColormapPtr pCmap; - dixLookupResourceByType((pointer *) &pCmap, wColormap(pWin), + dixLookupResourceByType((void **) &pCmap, wColormap(pWin), RT_COLORMAP, serverClient, DixUseAccess); attributes.colormap = xnestColormap(pCmap); @@ -380,7 +380,7 @@ xnestClipNotify(WindowPtr pWin, int dx, int dy) } static Bool -xnestWindowExposurePredicate(Display * display, XEvent * event, XPointer ptr) +xnestWindowExposurePredicate(Display * dpy, XEvent * event, XPointer ptr) { return (event->type == Expose && event->xexpose.window == *(Window *) ptr); } diff --git a/xserver/hw/xnest/XNGC.h b/xserver/hw/xnest/XNGC.h index c7c25e426..e2f10fb9c 100644 --- a/xserver/hw/xnest/XNGC.h +++ b/xserver/hw/xnest/XNGC.h @@ -35,7 +35,7 @@ void xnestValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable); void xnestChangeGC(GCPtr pGC, unsigned long mask); void xnestCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst); void xnestDestroyGC(GCPtr pGC); -void xnestChangeClip(GCPtr pGC, int type, pointer pValue, int nRects); +void xnestChangeClip(GCPtr pGC, int type, void *pValue, int nRects); void xnestDestroyClip(GCPtr pGC); void xnestDestroyClipHelper(GCPtr pGC); void xnestCopyClip(GCPtr pGCDst, GCPtr pGCSrc); diff --git a/xserver/hw/xnest/XNPixmap.h b/xserver/hw/xnest/XNPixmap.h index 5b2e796fe..b7b10e907 100644 --- a/xserver/hw/xnest/XNPixmap.h +++ b/xserver/hw/xnest/XNPixmap.h @@ -34,7 +34,7 @@ PixmapPtr xnestCreatePixmap(ScreenPtr pScreen, int width, int height, int depth, unsigned usage_hint); Bool xnestDestroyPixmap(PixmapPtr pPixmap); Bool xnestModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, int depth, - int bitsPerPixel, int devKind, pointer pPixData); + int bitsPerPixel, int devKind, void *pPixData); RegionPtr xnestPixmapToRegion(PixmapPtr pPixmap); #endif /* XNESTPIXMAP_H */ diff --git a/xserver/hw/xnest/man/Makefile.in b/xserver/hw/xnest/man/Makefile.in index fd3d74c73..56ec8eae1 100644 --- a/xserver/hw/xnest/man/Makefile.in +++ b/xserver/hw/xnest/man/Makefile.in @@ -160,6 +160,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -204,6 +206,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -268,6 +274,7 @@ MAN_SUBSTS = @MAN_SUBSTS@ -e 's|__logdir__|$(logdir)|g' -e \ 's|__XKB_DFLT_OPTIONS__|$(XKB_DFLT_OPTIONS)|g' -e \ 's|__bundle_id_prefix__|$(BUNDLE_ID_PREFIX)|g' -e \ 's|__modulepath__|$(DEFAULT_MODULE_PATH)|g' -e \ + 's|__suid_wrapper_dir__|$(SUID_WRAPPER_DIR)|g' -e \ 's|__default_font_path__|$(COMPILEDDEFAULTFONTPATH)|g' -e \ '\|$(COMPILEDDEFAULTFONTPATH)| s|/,|/, |g' MISC_MAN_DIR = @MISC_MAN_DIR@ @@ -322,7 +329,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -331,6 +341,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -397,6 +408,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/hw/xquartz/GL/Makefile.in b/xserver/hw/xquartz/GL/Makefile.in index 828438206..f70a9d302 100644 --- a/xserver/hw/xquartz/GL/Makefile.in +++ b/xserver/hw/xquartz/GL/Makefile.in @@ -163,6 +163,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -207,6 +209,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -309,7 +315,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -318,6 +327,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -384,6 +394,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/hw/xquartz/Makefile.am b/xserver/hw/xquartz/Makefile.am index 2ca953cf9..4da896d76 100644 --- a/xserver/hw/xquartz/Makefile.am +++ b/xserver/hw/xquartz/Makefile.am @@ -20,7 +20,6 @@ SUBDIRS = bundle . $(GL_DIR) xpr pbproxy mach-startup man DIST_SUBDIRS = bundle . GL xpr pbproxy mach-startup man libXquartz_la_SOURCES = \ - $(top_srcdir)/fb/fbcmap_mi.c \ $(top_srcdir)/mi/miinitext.c \ X11Application.m \ X11Controller.m \ diff --git a/xserver/hw/xquartz/Makefile.in b/xserver/hw/xquartz/Makefile.in index 25c25539c..6da2977a6 100644 --- a/xserver/hw/xquartz/Makefile.in +++ b/xserver/hw/xquartz/Makefile.in @@ -75,7 +75,7 @@ CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libXquartz_la_DEPENDENCIES = \ $(top_builddir)/pseudoramiX/libPseudoramiX.la -am_libXquartz_la_OBJECTS = fbcmap_mi.lo miinitext.lo X11Application.lo \ +am_libXquartz_la_OBJECTS = miinitext.lo X11Application.lo \ X11Controller.lo applewm.lo darwin.lo darwinEvents.lo \ darwinXinput.lo keysym2ucs.lo quartz.lo quartzCocoa.lo \ quartzKeyboard.lo quartzStartup.lo quartzRandR.lo \ @@ -219,6 +219,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -263,6 +265,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -365,7 +371,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -374,6 +383,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -440,6 +450,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ @@ -529,7 +543,6 @@ AM_CPPFLAGS = \ SUBDIRS = bundle . $(GL_DIR) xpr pbproxy mach-startup man DIST_SUBDIRS = bundle . GL xpr pbproxy mach-startup man libXquartz_la_SOURCES = \ - $(top_srcdir)/fb/fbcmap_mi.c \ $(top_srcdir)/mi/miinitext.c \ X11Application.m \ X11Controller.m \ @@ -623,7 +636,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/darwin.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/darwinEvents.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/darwinXinput.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fbcmap_mi.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/keysym2ucs.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/miinitext.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/quartz.Plo@am__quote@ @@ -653,13 +665,6 @@ distclean-compile: @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< -fbcmap_mi.lo: $(top_srcdir)/fb/fbcmap_mi.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT fbcmap_mi.lo -MD -MP -MF $(DEPDIR)/fbcmap_mi.Tpo -c -o fbcmap_mi.lo `test -f '$(top_srcdir)/fb/fbcmap_mi.c' || echo '$(srcdir)/'`$(top_srcdir)/fb/fbcmap_mi.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fbcmap_mi.Tpo $(DEPDIR)/fbcmap_mi.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/fb/fbcmap_mi.c' object='fbcmap_mi.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o fbcmap_mi.lo `test -f '$(top_srcdir)/fb/fbcmap_mi.c' || echo '$(srcdir)/'`$(top_srcdir)/fb/fbcmap_mi.c - miinitext.lo: $(top_srcdir)/mi/miinitext.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT miinitext.lo -MD -MP -MF $(DEPDIR)/miinitext.Tpo -c -o miinitext.lo `test -f '$(top_srcdir)/mi/miinitext.c' || echo '$(srcdir)/'`$(top_srcdir)/mi/miinitext.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/miinitext.Tpo $(DEPDIR)/miinitext.Plo diff --git a/xserver/hw/xquartz/applewm.c b/xserver/hw/xquartz/applewm.c index 0d734bd88..cc91c9608 100644 --- a/xserver/hw/xquartz/applewm.c +++ b/xserver/hw/xquartz/applewm.c @@ -83,9 +83,9 @@ static XID eventResource; static unsigned int eventMask = 0; static int -WMFreeClient(pointer data, XID id); +WMFreeClient(void *data, XID id); static int -WMFreeEvents(pointer data, XID id); +WMFreeEvents(void *data, XID id); static void SNotifyEvent(xAppleWMNotifyEvent *from, xAppleWMNotifyEvent *to); @@ -175,7 +175,7 @@ updateEventMask(WMEventPtr *pHead) /*ARGSUSED*/ static int -WMFreeClient(pointer data, XID id) +WMFreeClient(void *data, XID id) { WMEventPtr pEvent; WMEventPtr *pHead, pCur, pPrev; @@ -183,7 +183,7 @@ WMFreeClient(pointer data, XID id) pEvent = (WMEventPtr)data; i = dixLookupResourceByType( - (pointer *)&pHead, eventResource, EventType, serverClient, + (void **)&pHead, eventResource, EventType, serverClient, DixReadAccess | DixWriteAccess | DixDestroyAccess); if (i == Success && pHead) { @@ -198,13 +198,13 @@ WMFreeClient(pointer data, XID id) } updateEventMask(pHead); } - free((pointer)pEvent); + free((void *)pEvent); return 1; } /*ARGSUSED*/ static int -WMFreeEvents(pointer data, XID id) +WMFreeEvents(void *data, XID id) { WMEventPtr *pHead, pCur, pNext; @@ -212,9 +212,9 @@ WMFreeEvents(pointer data, XID id) for (pCur = *pHead; pCur; pCur = pNext) { pNext = pCur->next; FreeResource(pCur->clientResource, ClientType); - free((pointer)pCur); + free((void *)pCur); } - free((pointer)pHead); + free((void *)pHead); eventMask = 0; return 1; } @@ -229,7 +229,7 @@ ProcAppleWMSelectInput(register ClientPtr client) REQUEST_SIZE_MATCH(xAppleWMSelectInputReq); i = - dixLookupResourceByType((pointer *)&pHead, eventResource, EventType, + dixLookupResourceByType((void **)&pHead, eventResource, EventType, client, DixWriteAccess); if (stuff->mask != 0) { @@ -257,7 +257,7 @@ ProcAppleWMSelectInput(register ClientPtr client) */ clientResource = FakeClientID(client->index); pNewEvent->clientResource = clientResource; - if (!AddResource(clientResource, ClientType, (pointer)pNewEvent)) + if (!AddResource(clientResource, ClientType, (void *)pNewEvent)) return BadAlloc; /* * create a resource to contain a pointer to the list @@ -268,7 +268,7 @@ ProcAppleWMSelectInput(register ClientPtr client) if (i != Success || !pHead) { pHead = (WMEventPtr *)malloc(sizeof(WMEventPtr)); if (!pHead || - !AddResource(eventResource, EventType, (pointer)pHead)) { + !AddResource(eventResource, EventType, (void *)pHead)) { FreeResource(clientResource, RT_NONE); return BadAlloc; } @@ -317,7 +317,7 @@ AppleWMSendEvent(int type, unsigned int mask, int which, int arg) int i; i = - dixLookupResourceByType((pointer *)&pHead, eventResource, EventType, + dixLookupResourceByType((void **)&pHead, eventResource, EventType, serverClient, DixReadAccess); if (i != Success || !pHead) diff --git a/xserver/hw/xquartz/bundle/Makefile.in b/xserver/hw/xquartz/bundle/Makefile.in index e4d74fb45..83f6c895c 100644 --- a/xserver/hw/xquartz/bundle/Makefile.in +++ b/xserver/hw/xquartz/bundle/Makefile.in @@ -167,6 +167,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -211,6 +213,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -313,7 +319,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -322,6 +331,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -388,6 +398,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/hw/xquartz/mach-startup/Makefile.in b/xserver/hw/xquartz/mach-startup/Makefile.in index f5ffb11ed..406fb3b2b 100644 --- a/xserver/hw/xquartz/mach-startup/Makefile.in +++ b/xserver/hw/xquartz/mach-startup/Makefile.in @@ -198,6 +198,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -242,6 +244,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -344,7 +350,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -353,6 +362,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -419,6 +429,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/hw/xquartz/man/Makefile.in b/xserver/hw/xquartz/man/Makefile.in index 6d69228e2..dae566e92 100644 --- a/xserver/hw/xquartz/man/Makefile.in +++ b/xserver/hw/xquartz/man/Makefile.in @@ -160,6 +160,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -204,6 +206,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -268,6 +274,7 @@ MAN_SUBSTS = @MAN_SUBSTS@ -e 's|__logdir__|$(logdir)|g' -e \ 's|__XKB_DFLT_OPTIONS__|$(XKB_DFLT_OPTIONS)|g' -e \ 's|__bundle_id_prefix__|$(BUNDLE_ID_PREFIX)|g' -e \ 's|__modulepath__|$(DEFAULT_MODULE_PATH)|g' -e \ + 's|__suid_wrapper_dir__|$(SUID_WRAPPER_DIR)|g' -e \ 's|__default_font_path__|$(COMPILEDDEFAULTFONTPATH)|g' -e \ '\|$(COMPILEDDEFAULTFONTPATH)| s|/,|/, |g' MISC_MAN_DIR = @MISC_MAN_DIR@ @@ -322,7 +329,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -331,6 +341,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -397,6 +408,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/hw/xquartz/pbproxy/Makefile.in b/xserver/hw/xquartz/pbproxy/Makefile.in index cd40e3460..28e696b38 100644 --- a/xserver/hw/xquartz/pbproxy/Makefile.in +++ b/xserver/hw/xquartz/pbproxy/Makefile.in @@ -193,6 +193,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -237,6 +239,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -339,7 +345,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -348,6 +357,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -414,6 +424,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/hw/xquartz/quartz.c b/xserver/hw/xquartz/quartz.c index bc6c8d048..d7229cecb 100644 --- a/xserver/hw/xquartz/quartz.c +++ b/xserver/hw/xquartz/quartz.c @@ -164,10 +164,7 @@ static const ExtensionModule quartzExtensions[] = { */ static void QuartzExtensionInit(void) { - int i; - - for (i = 0; i < ARRAY_SIZE(quartzExtensions); i++) - LoadExtension(&quartzExtensions[i], TRUE); + LoadExtensionList(quartzExtensions, ARRAY_SIZE(quartzExtensions), TRUE); } /* diff --git a/xserver/hw/xquartz/quartzCocoa.m b/xserver/hw/xquartz/quartzCocoa.m index db2b3cfd6..d21fb7d91 100644 --- a/xserver/hw/xquartz/quartzCocoa.m +++ b/xserver/hw/xquartz/quartzCocoa.m @@ -48,9 +48,9 @@ * Clean out any autoreleased objects. */ void -QuartzBlockHandler(pointer blockData, +QuartzBlockHandler(void *blockData, OSTimePtr pTimeout, - pointer pReadmask) + void *pReadmask) { static NSAutoreleasePool *aPool = nil; @@ -62,9 +62,9 @@ QuartzBlockHandler(pointer blockData, * QuartzWakeupHandler */ void -QuartzWakeupHandler(pointer blockData, +QuartzWakeupHandler(void *blockData, int result, - pointer pReadmask) + void *pReadmask) { // nothing here } diff --git a/xserver/hw/xquartz/quartzCommon.h b/xserver/hw/xquartz/quartzCommon.h index 813bc7713..308a3f173 100644 --- a/xserver/hw/xquartz/quartzCommon.h +++ b/xserver/hw/xquartz/quartzCommon.h @@ -47,8 +47,8 @@ extern int aquaMenuBarHeight; extern const char *quartzOpenGLBundle; void -QuartzBlockHandler(pointer blockData, OSTimePtr pTimeout, pointer pReadmask); +QuartzBlockHandler(void *blockData, OSTimePtr pTimeout, void *pReadmask); void -QuartzWakeupHandler(pointer blockData, int result, pointer pReadmask); +QuartzWakeupHandler(void *blockData, int result, void *pReadmask); #endif /* _QUARTZCOMMON_H */ diff --git a/xserver/hw/xquartz/xpr/Makefile.in b/xserver/hw/xquartz/xpr/Makefile.in index 5cf1ac7ba..9b427cfdb 100644 --- a/xserver/hw/xquartz/xpr/Makefile.in +++ b/xserver/hw/xquartz/xpr/Makefile.in @@ -164,6 +164,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -208,6 +210,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -310,7 +316,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -319,6 +328,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -385,6 +395,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/hw/xquartz/xpr/dri.c b/xserver/hw/xquartz/xpr/dri.c index adba69cca..014709b04 100644 --- a/xserver/hw/xquartz/xpr/dri.c +++ b/xserver/hw/xquartz/xpr/dri.c @@ -455,7 +455,7 @@ DRICreateSurface(ScreenPtr pScreen, Drawable id, pDRIDrawablePriv->sid), pDRIDrawablePriv); /* track this in case this window is destroyed */ - AddResource(id, DRIDrawablePrivResType, (pointer)pDrawable); + AddResource(id, DRIDrawablePrivResType, (void *)pDrawable); /* Initialize shape */ DRIUpdateSurface(pDRIDrawablePriv, pDrawable); @@ -529,7 +529,7 @@ DRIDestroySurface(ScreenPtr pScreen, Drawable id, DrawablePtr pDrawable, * drops to <= 0, or the window/pixmap is destroyed. */ Bool -DRIDrawablePrivDelete(pointer pResource, XID id) +DRIDrawablePrivDelete(void *pResource, XID id) { DrawablePtr pDrawable = (DrawablePtr)pResource; DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pDrawable->pScreen); @@ -829,7 +829,7 @@ DRICreatePixmap(ScreenPtr pScreen, Drawable id, dixSetPrivate(&pPix->devPrivates, DRIPixmapBufferPrivKey, shared); - AddResource(id, DRIDrawablePrivResType, (pointer)pDrawable); + AddResource(id, DRIDrawablePrivResType, (void *)pDrawable); return TRUE; } @@ -884,7 +884,7 @@ DRIFreePixmapImp(DrawablePtr pDrawable) shm_unlink(shared->shmPath); free(shared); - dixSetPrivate(&pPix->devPrivates, DRIPixmapBufferPrivKey, (pointer)NULL); + dixSetPrivate(&pPix->devPrivates, DRIPixmapBufferPrivKey, (void *)NULL); return TRUE; } diff --git a/xserver/hw/xquartz/xpr/dri.h b/xserver/hw/xquartz/xpr/dri.h index 8717a5186..70cb8b6d6 100644 --- a/xserver/hw/xquartz/xpr/dri.h +++ b/xserver/hw/xquartz/xpr/dri.h @@ -99,7 +99,7 @@ DRIDestroySurface(ScreenPtr pScreen, Drawable id, DrawablePtr pDrawable, void *data), void *notify_data); extern Bool -DRIDrawablePrivDelete(pointer pResource, XID id); +DRIDrawablePrivDelete(void *pResource, XID id); extern DRIWrappedFuncsRec * DRIGetWrappedFuncs(ScreenPtr pScreen); diff --git a/xserver/hw/xquartz/xpr/driWrap.c b/xserver/hw/xquartz/xpr/driWrap.c index 5f9f3abd3..42282d52b 100644 --- a/xserver/hw/xquartz/xpr/driWrap.c +++ b/xserver/hw/xquartz/xpr/driWrap.c @@ -447,7 +447,7 @@ DRIImageText16(DrawablePtr dst, GCPtr pGC, static void DRIImageGlyphBlt(DrawablePtr dst, GCPtr pGC, int x, int y, unsigned int nglyphInit, - CharInfoPtr *ppciInit, pointer unused) + CharInfoPtr *ppciInit, void *unused) { DRISavedDrawableState saved; @@ -465,7 +465,7 @@ DRIImageGlyphBlt(DrawablePtr dst, GCPtr pGC, static void DRIPolyGlyphBlt(DrawablePtr dst, GCPtr pGC, int x, int y, unsigned int nglyph, - CharInfoPtr *ppci, pointer pglyphBase) + CharInfoPtr *ppci, void *pglyphBase) { DRISavedDrawableState saved; diff --git a/xserver/hw/xquartz/xpr/xprScreen.c b/xserver/hw/xquartz/xpr/xprScreen.c index 7aa1ae1df..d0a525ff4 100644 --- a/xserver/hw/xquartz/xpr/xprScreen.c +++ b/xserver/hw/xquartz/xpr/xprScreen.c @@ -169,14 +169,25 @@ displayScreenBounds(CGDirectDisplayID id) (int)frame.size.width, (int)frame.size.height, (int)frame.origin.x, (int)frame.origin.y); - /* Remove menubar to help standard X11 window managers. - * On Mavericks and later, the menu bar is on all displays. - */ - if (XQuartzIsRootless + Boolean spacePerDisplay = false; #if MAC_OS_X_VERSION_MIN_REQUIRED < 1090 - && (NSAppKitVersionNumber >= 1265 || (frame.origin.x == 0 && frame.origin.y == 0)) + if (NSAppKitVersionNumber >= 1265) #endif - ) { + { + Boolean ok; + (void)CFPreferencesAppSynchronize(CFSTR("com.apple.spaces")); + spacePerDisplay = ! CFPreferencesGetAppBooleanValue(CFSTR("spans-displays"), + CFSTR("com.apple.spaces"), + &ok); + if (!ok) + spacePerDisplay = true; + } + + /* Remove menubar to help standard X11 window managers. + * On Mavericks and later, the menu bar is on all displays when spans-displays is false or unset. + */ + if (XQuartzIsRootless && + (spacePerDisplay || (frame.origin.x == 0 && frame.origin.y == 0))) { frame.origin.y += aquaMenuBarHeight; frame.size.height -= aquaMenuBarHeight; } diff --git a/xserver/hw/xwayland/Makefile.am b/xserver/hw/xwayland/Makefile.am new file mode 100644 index 000000000..4e0e1bb00 --- /dev/null +++ b/xserver/hw/xwayland/Makefile.am @@ -0,0 +1,59 @@ +bin_PROGRAMS = Xwayland + +Xwayland_CFLAGS = \ + -I$(top_srcdir)/glamor \ + -I$(top_srcdir)/dri3 \ + -DHAVE_DIX_CONFIG_H \ + $(XWAYLANDMODULES_CFLAGS) \ + $(DIX_CFLAGS) \ + $(GLAMOR_CFLAGS) \ + $(GBM_CFLAGS) + +Xwayland_SOURCES = \ + xwayland.c \ + xwayland-input.c \ + xwayland-cursor.c \ + xwayland-shm.c \ + xwayland-output.c \ + xwayland-cvt.c \ + xwayland.h \ + $(top_srcdir)/Xext/dpmsstubs.c \ + $(top_srcdir)/Xi/stubs.c \ + $(top_srcdir)/mi/miinitext.c + +Xwayland_LDADD = \ + $(glamor_lib) \ + $(XWAYLAND_LIBS) \ + $(XWAYLAND_SYS_LIBS) \ + $(XSERVER_SYS_LIBS) +Xwayland_DEPENDENCIES = $(XWAYLAND_LIBS) +Xwayland_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG) + + +if GLAMOR_EGL +Xwayland_SOURCES += xwayland-glamor.c + +nodist_Xwayland_SOURCES = \ + drm-client-protocol.h \ + drm-protocol.c + +CLEANFILES = $(nodist_Xwayland_SOURCES) + +xwayland-glamor.c : $(nodist_Xwayland_SOURCES) + +glamor_lib = $(top_builddir)/glamor/libglamor.la + +Xwayland_LDADD += $(GLAMOR_LIBS) $(GBM_LIBS) -lEGL -lGL +endif + +EXTRA_DIST = drm.xml + + +relink: + $(AM_V_at)rm -f Xwayland$(EXEEXT) && $(MAKE) Xwayland$(EXEEXT) + +%-protocol.c : %.xml + $(AM_V_GEN)$(WAYLAND_SCANNER) code < $< > $@ + +%-client-protocol.h : %.xml + $(AM_V_GEN)$(WAYLAND_SCANNER) client-header < $< > $@ diff --git a/xserver/hw/xwayland/Makefile.in b/xserver/hw/xwayland/Makefile.in new file mode 100644 index 000000000..fde4d0387 --- /dev/null +++ b/xserver/hw/xwayland/Makefile.in @@ -0,0 +1,1037 @@ +# Makefile.in generated by automake 1.12.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2012 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +bin_PROGRAMS = Xwayland$(EXEEXT) +@GLAMOR_EGL_TRUE@am__append_1 = xwayland-glamor.c +@GLAMOR_EGL_TRUE@am__append_2 = $(GLAMOR_LIBS) $(GBM_LIBS) -lEGL -lGL +subdir = hw/xwayland +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(top_srcdir)/depcomp +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/xorg-tls.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ + $(top_builddir)/include/xorg-server.h \ + $(top_builddir)/include/dix-config.h \ + $(top_builddir)/include/xorg-config.h \ + $(top_builddir)/include/xkb-config.h \ + $(top_builddir)/include/xwin-config.h \ + $(top_builddir)/include/kdrive-config.h \ + $(top_builddir)/include/version-config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__installdirs = "$(DESTDIR)$(bindir)" +PROGRAMS = $(bin_PROGRAMS) +am__Xwayland_SOURCES_DIST = xwayland.c xwayland-input.c \ + xwayland-cursor.c xwayland-shm.c xwayland-output.c \ + xwayland-cvt.c xwayland.h $(top_srcdir)/Xext/dpmsstubs.c \ + $(top_srcdir)/Xi/stubs.c $(top_srcdir)/mi/miinitext.c \ + xwayland-glamor.c +@GLAMOR_EGL_TRUE@am__objects_1 = Xwayland-xwayland-glamor.$(OBJEXT) +am_Xwayland_OBJECTS = Xwayland-xwayland.$(OBJEXT) \ + Xwayland-xwayland-input.$(OBJEXT) \ + Xwayland-xwayland-cursor.$(OBJEXT) \ + Xwayland-xwayland-shm.$(OBJEXT) \ + Xwayland-xwayland-output.$(OBJEXT) \ + Xwayland-xwayland-cvt.$(OBJEXT) Xwayland-dpmsstubs.$(OBJEXT) \ + Xwayland-stubs.$(OBJEXT) Xwayland-miinitext.$(OBJEXT) \ + $(am__objects_1) +@GLAMOR_EGL_TRUE@nodist_Xwayland_OBJECTS = \ +@GLAMOR_EGL_TRUE@ Xwayland-drm-protocol.$(OBJEXT) +Xwayland_OBJECTS = $(am_Xwayland_OBJECTS) $(nodist_Xwayland_OBJECTS) +am__DEPENDENCIES_1 = +@GLAMOR_EGL_TRUE@am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) \ +@GLAMOR_EGL_TRUE@ $(am__DEPENDENCIES_1) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +Xwayland_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(Xwayland_CFLAGS) \ + $(CFLAGS) $(Xwayland_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(Xwayland_SOURCES) $(nodist_Xwayland_SOURCES) +DIST_SOURCES = $(am__Xwayland_SOURCES_DIST) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ +ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ +APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ +APP_MAN_DIR = @APP_MAN_DIR@ +APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BASE_CFLAGS = @BASE_CFLAGS@ +BASE_FONT_PATH = @BASE_FONT_PATH@ +BUILD_DATE = @BUILD_DATE@ +BUILD_TIME = @BUILD_TIME@ +BUNDLE_ID_PREFIX = @BUNDLE_ID_PREFIX@ +CC = @CC@ +CCAS = @CCAS@ +CCASDEPMODE = @CCASDEPMODE@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CHANGELOG_CMD = @CHANGELOG_CMD@ +COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CWARNFLAGS = @CWARNFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DBUS_CFLAGS = @DBUS_CFLAGS@ +DBUS_LIBS = @DBUS_LIBS@ +DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ +DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ +DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ +DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DGA_CFLAGS = @DGA_CFLAGS@ +DGA_LIBS = @DGA_LIBS@ +DIX_CFLAGS = @DIX_CFLAGS@ +DIX_LIB = @DIX_LIB@ +DLLTOOL = @DLLTOOL@ +DLOPEN_LIBS = @DLOPEN_LIBS@ +DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ +DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ +DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ +DMXMODULES_LIBS = @DMXMODULES_LIBS@ +DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ +DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ +DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ +DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ +DOT = @DOT@ +DOXYGEN = @DOXYGEN@ +DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ +DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ +DRI3PROTO_CFLAGS = @DRI3PROTO_CFLAGS@ +DRI3PROTO_LIBS = @DRI3PROTO_LIBS@ +DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ +DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ +DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ +DSYMUTIL = @DSYMUTIL@ +DTRACE = @DTRACE@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +FILE_MAN_DIR = @FILE_MAN_DIR@ +FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ +FONT100DPIDIR = @FONT100DPIDIR@ +FONT75DPIDIR = @FONT75DPIDIR@ +FONTMISCDIR = @FONTMISCDIR@ +FONTOTFDIR = @FONTOTFDIR@ +FONTROOTDIR = @FONTROOTDIR@ +FONTTTFDIR = @FONTTTFDIR@ +FONTTYPE1DIR = @FONTTYPE1DIR@ +FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ +GLX_DEFINES = @GLX_DEFINES@ +GLX_SYS_LIBS = @GLX_SYS_LIBS@ +GLX_TLS = @GLX_TLS@ +GL_CFLAGS = @GL_CFLAGS@ +GL_LIBS = @GL_LIBS@ +GREP = @GREP@ +HAL_CFLAGS = @HAL_CFLAGS@ +HAL_LIBS = @HAL_LIBS@ +HAVE_DOT = @HAVE_DOT@ +INSTALL = @INSTALL@ +INSTALL_CMD = @INSTALL_CMD@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ +KDRIVE_INCS = @KDRIVE_INCS@ +KDRIVE_LIBS = @KDRIVE_LIBS@ +KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ +KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ +KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ +KHRONOS_OPENGL_REGISTRY_CFLAGS = @KHRONOS_OPENGL_REGISTRY_CFLAGS@ +KHRONOS_OPENGL_REGISTRY_LIBS = @KHRONOS_OPENGL_REGISTRY_LIBS@ +KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ +LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ +LIBDRM_LIBS = @LIBDRM_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBSHA1_CFLAGS = @LIBSHA1_CFLAGS@ +LIBSHA1_LIBS = @LIBSHA1_LIBS@ +LIBTOOL = @LIBTOOL@ +LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ +LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ +LIB_MAN_DIR = @LIB_MAN_DIR@ +LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAIN_LIB = @MAIN_LIB@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MAN_SUBSTS = @MAN_SUBSTS@ +MISC_MAN_DIR = @MISC_MAN_DIR@ +MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJC = @OBJC@ +OBJCCLD = @OBJCCLD@ +OBJCDEPMODE = @OBJCDEPMODE@ +OBJCFLAGS = @OBJCFLAGS@ +OBJCLINK = @OBJCLINK@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ +OPENSSL_LIBS = @OPENSSL_LIBS@ +OS_LIB = @OS_LIB@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ +PCIACCESS_LIBS = @PCIACCESS_LIBS@ +PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ +PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ +PIXMAN_LIBS = @PIXMAN_LIBS@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PROJECTROOT = @PROJECTROOT@ +PYTHON3 = @PYTHON3@ +RANLIB = @RANLIB@ +RAWCPP = @RAWCPP@ +RAWCPPFLAGS = @RAWCPPFLAGS@ +RELEASE_DATE = @RELEASE_DATE@ +SDK_REQUIRED_MODULES = @SDK_REQUIRED_MODULES@ +SED = @SED@ +SELINUX_CFLAGS = @SELINUX_CFLAGS@ +SELINUX_LIBS = @SELINUX_LIBS@ +SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ +SET_MAKE = @SET_MAKE@ +SHA1_CFLAGS = @SHA1_CFLAGS@ +SHA1_LIBS = @SHA1_LIBS@ +SHELL = @SHELL@ +SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ +STRICT_CFLAGS = @STRICT_CFLAGS@ +STRIP = @STRIP@ +STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ +SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ +TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ +TSLIB_CFLAGS = @TSLIB_CFLAGS@ +TSLIB_LIBS = @TSLIB_LIBS@ +UDEV_CFLAGS = @UDEV_CFLAGS@ +UDEV_LIBS = @UDEV_LIBS@ +UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ +VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ +VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ +WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ +WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ +WINDRES = @WINDRES@ +X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ +X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ +XDMCP_CFLAGS = @XDMCP_CFLAGS@ +XDMCP_LIBS = @XDMCP_LIBS@ +XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ +XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ +XDMX_CFLAGS = @XDMX_CFLAGS@ +XDMX_LIBS = @XDMX_LIBS@ +XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ +XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ +XEPHYR_INCS = @XEPHYR_INCS@ +XEPHYR_LIBS = @XEPHYR_LIBS@ +XF86CONFIGDIR = @XF86CONFIGDIR@ +XF86CONFIGFILE = @XF86CONFIGFILE@ +XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@ +XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@ +XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ +XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ +XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ +XKB_DFLT_LAYOUT = @XKB_DFLT_LAYOUT@ +XKB_DFLT_MODEL = @XKB_DFLT_MODEL@ +XKB_DFLT_OPTIONS = @XKB_DFLT_OPTIONS@ +XKB_DFLT_RULES = @XKB_DFLT_RULES@ +XKB_DFLT_VARIANT = @XKB_DFLT_VARIANT@ +XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ +XLIB_CFLAGS = @XLIB_CFLAGS@ +XLIB_LIBS = @XLIB_LIBS@ +XMLTO = @XMLTO@ +XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ +XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ +XNEST_LIBS = @XNEST_LIBS@ +XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ +XORG_CFLAGS = @XORG_CFLAGS@ +XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ +XORG_INCS = @XORG_INCS@ +XORG_LIBS = @XORG_LIBS@ +XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ +XORG_MAN_PAGE = @XORG_MAN_PAGE@ +XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ +XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ +XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XORG_SGML_PATH = @XORG_SGML_PATH@ +XORG_SYS_LIBS = @XORG_SYS_LIBS@ +XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ +XPBPROXY_LIBS = @XPBPROXY_LIBS@ +XQUARTZ_LIBS = @XQUARTZ_LIBS@ +XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ +XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ +XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ +XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ +XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ +XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ +XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ +XSERVER_LIBS = @XSERVER_LIBS@ +XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ +XSHMFENCE_CFLAGS = @XSHMFENCE_CFLAGS@ +XSHMFENCE_LIBS = @XSHMFENCE_LIBS@ +XSLTPROC = @XSLTPROC@ +XSL_STYLESHEET = @XSL_STYLESHEET@ +XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ +XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ +XVFB_LIBS = @XVFB_LIBS@ +XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ +XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ +XWINMODULES_LIBS = @XWINMODULES_LIBS@ +XWIN_LIBS = @XWIN_LIBS@ +XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ +XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ +YACC = @YACC@ +YFLAGS = @YFLAGS@ +__XCONFIGDIR__ = @__XCONFIGDIR__@ +__XCONFIGFILE__ = @__XCONFIGFILE__@ +abi_ansic = @abi_ansic@ +abi_extension = @abi_extension@ +abi_videodrv = @abi_videodrv@ +abi_xinput = @abi_xinput@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +driverdir = @driverdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +extdir = @extdir@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +logdir = @logdir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +moduledir = @moduledir@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sdkdir = @sdkdir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +symbol_visibility = @symbol_visibility@ +sysconfdir = @sysconfdir@ +sysconfigdir = @sysconfigdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +Xwayland_CFLAGS = \ + -I$(top_srcdir)/glamor \ + -I$(top_srcdir)/dri3 \ + -DHAVE_DIX_CONFIG_H \ + $(XWAYLANDMODULES_CFLAGS) \ + $(DIX_CFLAGS) \ + $(GLAMOR_CFLAGS) \ + $(GBM_CFLAGS) + +Xwayland_SOURCES = xwayland.c xwayland-input.c xwayland-cursor.c \ + xwayland-shm.c xwayland-output.c xwayland-cvt.c xwayland.h \ + $(top_srcdir)/Xext/dpmsstubs.c $(top_srcdir)/Xi/stubs.c \ + $(top_srcdir)/mi/miinitext.c $(am__append_1) +Xwayland_LDADD = $(glamor_lib) $(XWAYLAND_LIBS) $(XWAYLAND_SYS_LIBS) \ + $(XSERVER_SYS_LIBS) $(am__append_2) +Xwayland_DEPENDENCIES = $(XWAYLAND_LIBS) +Xwayland_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG) +@GLAMOR_EGL_TRUE@nodist_Xwayland_SOURCES = \ +@GLAMOR_EGL_TRUE@ drm-client-protocol.h \ +@GLAMOR_EGL_TRUE@ drm-protocol.c + +@GLAMOR_EGL_TRUE@CLEANFILES = $(nodist_Xwayland_SOURCES) +@GLAMOR_EGL_TRUE@glamor_lib = $(top_builddir)/glamor/libglamor.la +EXTRA_DIST = drm.xml +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xwayland/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign hw/xwayland/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ + fi; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p || test -f $$p1; \ + then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(bindir)" && rm -f $$files + +clean-binPROGRAMS: + @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +Xwayland$(EXEEXT): $(Xwayland_OBJECTS) $(Xwayland_DEPENDENCIES) $(EXTRA_Xwayland_DEPENDENCIES) + @rm -f Xwayland$(EXEEXT) + $(AM_V_CCLD)$(Xwayland_LINK) $(Xwayland_OBJECTS) $(Xwayland_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Xwayland-dpmsstubs.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Xwayland-drm-protocol.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Xwayland-miinitext.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Xwayland-stubs.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Xwayland-xwayland-cursor.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Xwayland-xwayland-cvt.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Xwayland-xwayland-glamor.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Xwayland-xwayland-input.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Xwayland-xwayland-output.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Xwayland-xwayland-shm.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Xwayland-xwayland.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +Xwayland-xwayland.o: xwayland.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -MT Xwayland-xwayland.o -MD -MP -MF $(DEPDIR)/Xwayland-xwayland.Tpo -c -o Xwayland-xwayland.o `test -f 'xwayland.c' || echo '$(srcdir)/'`xwayland.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Xwayland-xwayland.Tpo $(DEPDIR)/Xwayland-xwayland.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='xwayland.c' object='Xwayland-xwayland.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -c -o Xwayland-xwayland.o `test -f 'xwayland.c' || echo '$(srcdir)/'`xwayland.c + +Xwayland-xwayland.obj: xwayland.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -MT Xwayland-xwayland.obj -MD -MP -MF $(DEPDIR)/Xwayland-xwayland.Tpo -c -o Xwayland-xwayland.obj `if test -f 'xwayland.c'; then $(CYGPATH_W) 'xwayland.c'; else $(CYGPATH_W) '$(srcdir)/xwayland.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Xwayland-xwayland.Tpo $(DEPDIR)/Xwayland-xwayland.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='xwayland.c' object='Xwayland-xwayland.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -c -o Xwayland-xwayland.obj `if test -f 'xwayland.c'; then $(CYGPATH_W) 'xwayland.c'; else $(CYGPATH_W) '$(srcdir)/xwayland.c'; fi` + +Xwayland-xwayland-input.o: xwayland-input.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -MT Xwayland-xwayland-input.o -MD -MP -MF $(DEPDIR)/Xwayland-xwayland-input.Tpo -c -o Xwayland-xwayland-input.o `test -f 'xwayland-input.c' || echo '$(srcdir)/'`xwayland-input.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Xwayland-xwayland-input.Tpo $(DEPDIR)/Xwayland-xwayland-input.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='xwayland-input.c' object='Xwayland-xwayland-input.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -c -o Xwayland-xwayland-input.o `test -f 'xwayland-input.c' || echo '$(srcdir)/'`xwayland-input.c + +Xwayland-xwayland-input.obj: xwayland-input.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -MT Xwayland-xwayland-input.obj -MD -MP -MF $(DEPDIR)/Xwayland-xwayland-input.Tpo -c -o Xwayland-xwayland-input.obj `if test -f 'xwayland-input.c'; then $(CYGPATH_W) 'xwayland-input.c'; else $(CYGPATH_W) '$(srcdir)/xwayland-input.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Xwayland-xwayland-input.Tpo $(DEPDIR)/Xwayland-xwayland-input.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='xwayland-input.c' object='Xwayland-xwayland-input.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -c -o Xwayland-xwayland-input.obj `if test -f 'xwayland-input.c'; then $(CYGPATH_W) 'xwayland-input.c'; else $(CYGPATH_W) '$(srcdir)/xwayland-input.c'; fi` + +Xwayland-xwayland-cursor.o: xwayland-cursor.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -MT Xwayland-xwayland-cursor.o -MD -MP -MF $(DEPDIR)/Xwayland-xwayland-cursor.Tpo -c -o Xwayland-xwayland-cursor.o `test -f 'xwayland-cursor.c' || echo '$(srcdir)/'`xwayland-cursor.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Xwayland-xwayland-cursor.Tpo $(DEPDIR)/Xwayland-xwayland-cursor.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='xwayland-cursor.c' object='Xwayland-xwayland-cursor.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -c -o Xwayland-xwayland-cursor.o `test -f 'xwayland-cursor.c' || echo '$(srcdir)/'`xwayland-cursor.c + +Xwayland-xwayland-cursor.obj: xwayland-cursor.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -MT Xwayland-xwayland-cursor.obj -MD -MP -MF $(DEPDIR)/Xwayland-xwayland-cursor.Tpo -c -o Xwayland-xwayland-cursor.obj `if test -f 'xwayland-cursor.c'; then $(CYGPATH_W) 'xwayland-cursor.c'; else $(CYGPATH_W) '$(srcdir)/xwayland-cursor.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Xwayland-xwayland-cursor.Tpo $(DEPDIR)/Xwayland-xwayland-cursor.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='xwayland-cursor.c' object='Xwayland-xwayland-cursor.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -c -o Xwayland-xwayland-cursor.obj `if test -f 'xwayland-cursor.c'; then $(CYGPATH_W) 'xwayland-cursor.c'; else $(CYGPATH_W) '$(srcdir)/xwayland-cursor.c'; fi` + +Xwayland-xwayland-shm.o: xwayland-shm.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -MT Xwayland-xwayland-shm.o -MD -MP -MF $(DEPDIR)/Xwayland-xwayland-shm.Tpo -c -o Xwayland-xwayland-shm.o `test -f 'xwayland-shm.c' || echo '$(srcdir)/'`xwayland-shm.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Xwayland-xwayland-shm.Tpo $(DEPDIR)/Xwayland-xwayland-shm.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='xwayland-shm.c' object='Xwayland-xwayland-shm.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -c -o Xwayland-xwayland-shm.o `test -f 'xwayland-shm.c' || echo '$(srcdir)/'`xwayland-shm.c + +Xwayland-xwayland-shm.obj: xwayland-shm.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -MT Xwayland-xwayland-shm.obj -MD -MP -MF $(DEPDIR)/Xwayland-xwayland-shm.Tpo -c -o Xwayland-xwayland-shm.obj `if test -f 'xwayland-shm.c'; then $(CYGPATH_W) 'xwayland-shm.c'; else $(CYGPATH_W) '$(srcdir)/xwayland-shm.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Xwayland-xwayland-shm.Tpo $(DEPDIR)/Xwayland-xwayland-shm.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='xwayland-shm.c' object='Xwayland-xwayland-shm.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -c -o Xwayland-xwayland-shm.obj `if test -f 'xwayland-shm.c'; then $(CYGPATH_W) 'xwayland-shm.c'; else $(CYGPATH_W) '$(srcdir)/xwayland-shm.c'; fi` + +Xwayland-xwayland-output.o: xwayland-output.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -MT Xwayland-xwayland-output.o -MD -MP -MF $(DEPDIR)/Xwayland-xwayland-output.Tpo -c -o Xwayland-xwayland-output.o `test -f 'xwayland-output.c' || echo '$(srcdir)/'`xwayland-output.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Xwayland-xwayland-output.Tpo $(DEPDIR)/Xwayland-xwayland-output.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='xwayland-output.c' object='Xwayland-xwayland-output.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -c -o Xwayland-xwayland-output.o `test -f 'xwayland-output.c' || echo '$(srcdir)/'`xwayland-output.c + +Xwayland-xwayland-output.obj: xwayland-output.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -MT Xwayland-xwayland-output.obj -MD -MP -MF $(DEPDIR)/Xwayland-xwayland-output.Tpo -c -o Xwayland-xwayland-output.obj `if test -f 'xwayland-output.c'; then $(CYGPATH_W) 'xwayland-output.c'; else $(CYGPATH_W) '$(srcdir)/xwayland-output.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Xwayland-xwayland-output.Tpo $(DEPDIR)/Xwayland-xwayland-output.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='xwayland-output.c' object='Xwayland-xwayland-output.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -c -o Xwayland-xwayland-output.obj `if test -f 'xwayland-output.c'; then $(CYGPATH_W) 'xwayland-output.c'; else $(CYGPATH_W) '$(srcdir)/xwayland-output.c'; fi` + +Xwayland-xwayland-cvt.o: xwayland-cvt.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -MT Xwayland-xwayland-cvt.o -MD -MP -MF $(DEPDIR)/Xwayland-xwayland-cvt.Tpo -c -o Xwayland-xwayland-cvt.o `test -f 'xwayland-cvt.c' || echo '$(srcdir)/'`xwayland-cvt.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Xwayland-xwayland-cvt.Tpo $(DEPDIR)/Xwayland-xwayland-cvt.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='xwayland-cvt.c' object='Xwayland-xwayland-cvt.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -c -o Xwayland-xwayland-cvt.o `test -f 'xwayland-cvt.c' || echo '$(srcdir)/'`xwayland-cvt.c + +Xwayland-xwayland-cvt.obj: xwayland-cvt.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -MT Xwayland-xwayland-cvt.obj -MD -MP -MF $(DEPDIR)/Xwayland-xwayland-cvt.Tpo -c -o Xwayland-xwayland-cvt.obj `if test -f 'xwayland-cvt.c'; then $(CYGPATH_W) 'xwayland-cvt.c'; else $(CYGPATH_W) '$(srcdir)/xwayland-cvt.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Xwayland-xwayland-cvt.Tpo $(DEPDIR)/Xwayland-xwayland-cvt.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='xwayland-cvt.c' object='Xwayland-xwayland-cvt.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -c -o Xwayland-xwayland-cvt.obj `if test -f 'xwayland-cvt.c'; then $(CYGPATH_W) 'xwayland-cvt.c'; else $(CYGPATH_W) '$(srcdir)/xwayland-cvt.c'; fi` + +Xwayland-dpmsstubs.o: $(top_srcdir)/Xext/dpmsstubs.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -MT Xwayland-dpmsstubs.o -MD -MP -MF $(DEPDIR)/Xwayland-dpmsstubs.Tpo -c -o Xwayland-dpmsstubs.o `test -f '$(top_srcdir)/Xext/dpmsstubs.c' || echo '$(srcdir)/'`$(top_srcdir)/Xext/dpmsstubs.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Xwayland-dpmsstubs.Tpo $(DEPDIR)/Xwayland-dpmsstubs.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/Xext/dpmsstubs.c' object='Xwayland-dpmsstubs.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -c -o Xwayland-dpmsstubs.o `test -f '$(top_srcdir)/Xext/dpmsstubs.c' || echo '$(srcdir)/'`$(top_srcdir)/Xext/dpmsstubs.c + +Xwayland-dpmsstubs.obj: $(top_srcdir)/Xext/dpmsstubs.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -MT Xwayland-dpmsstubs.obj -MD -MP -MF $(DEPDIR)/Xwayland-dpmsstubs.Tpo -c -o Xwayland-dpmsstubs.obj `if test -f '$(top_srcdir)/Xext/dpmsstubs.c'; then $(CYGPATH_W) '$(top_srcdir)/Xext/dpmsstubs.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/Xext/dpmsstubs.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Xwayland-dpmsstubs.Tpo $(DEPDIR)/Xwayland-dpmsstubs.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/Xext/dpmsstubs.c' object='Xwayland-dpmsstubs.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -c -o Xwayland-dpmsstubs.obj `if test -f '$(top_srcdir)/Xext/dpmsstubs.c'; then $(CYGPATH_W) '$(top_srcdir)/Xext/dpmsstubs.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/Xext/dpmsstubs.c'; fi` + +Xwayland-stubs.o: $(top_srcdir)/Xi/stubs.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -MT Xwayland-stubs.o -MD -MP -MF $(DEPDIR)/Xwayland-stubs.Tpo -c -o Xwayland-stubs.o `test -f '$(top_srcdir)/Xi/stubs.c' || echo '$(srcdir)/'`$(top_srcdir)/Xi/stubs.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Xwayland-stubs.Tpo $(DEPDIR)/Xwayland-stubs.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/Xi/stubs.c' object='Xwayland-stubs.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -c -o Xwayland-stubs.o `test -f '$(top_srcdir)/Xi/stubs.c' || echo '$(srcdir)/'`$(top_srcdir)/Xi/stubs.c + +Xwayland-stubs.obj: $(top_srcdir)/Xi/stubs.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -MT Xwayland-stubs.obj -MD -MP -MF $(DEPDIR)/Xwayland-stubs.Tpo -c -o Xwayland-stubs.obj `if test -f '$(top_srcdir)/Xi/stubs.c'; then $(CYGPATH_W) '$(top_srcdir)/Xi/stubs.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/Xi/stubs.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Xwayland-stubs.Tpo $(DEPDIR)/Xwayland-stubs.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/Xi/stubs.c' object='Xwayland-stubs.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -c -o Xwayland-stubs.obj `if test -f '$(top_srcdir)/Xi/stubs.c'; then $(CYGPATH_W) '$(top_srcdir)/Xi/stubs.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/Xi/stubs.c'; fi` + +Xwayland-miinitext.o: $(top_srcdir)/mi/miinitext.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -MT Xwayland-miinitext.o -MD -MP -MF $(DEPDIR)/Xwayland-miinitext.Tpo -c -o Xwayland-miinitext.o `test -f '$(top_srcdir)/mi/miinitext.c' || echo '$(srcdir)/'`$(top_srcdir)/mi/miinitext.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Xwayland-miinitext.Tpo $(DEPDIR)/Xwayland-miinitext.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/mi/miinitext.c' object='Xwayland-miinitext.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -c -o Xwayland-miinitext.o `test -f '$(top_srcdir)/mi/miinitext.c' || echo '$(srcdir)/'`$(top_srcdir)/mi/miinitext.c + +Xwayland-miinitext.obj: $(top_srcdir)/mi/miinitext.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -MT Xwayland-miinitext.obj -MD -MP -MF $(DEPDIR)/Xwayland-miinitext.Tpo -c -o Xwayland-miinitext.obj `if test -f '$(top_srcdir)/mi/miinitext.c'; then $(CYGPATH_W) '$(top_srcdir)/mi/miinitext.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/mi/miinitext.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Xwayland-miinitext.Tpo $(DEPDIR)/Xwayland-miinitext.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/mi/miinitext.c' object='Xwayland-miinitext.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -c -o Xwayland-miinitext.obj `if test -f '$(top_srcdir)/mi/miinitext.c'; then $(CYGPATH_W) '$(top_srcdir)/mi/miinitext.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/mi/miinitext.c'; fi` + +Xwayland-xwayland-glamor.o: xwayland-glamor.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -MT Xwayland-xwayland-glamor.o -MD -MP -MF $(DEPDIR)/Xwayland-xwayland-glamor.Tpo -c -o Xwayland-xwayland-glamor.o `test -f 'xwayland-glamor.c' || echo '$(srcdir)/'`xwayland-glamor.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Xwayland-xwayland-glamor.Tpo $(DEPDIR)/Xwayland-xwayland-glamor.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='xwayland-glamor.c' object='Xwayland-xwayland-glamor.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -c -o Xwayland-xwayland-glamor.o `test -f 'xwayland-glamor.c' || echo '$(srcdir)/'`xwayland-glamor.c + +Xwayland-xwayland-glamor.obj: xwayland-glamor.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -MT Xwayland-xwayland-glamor.obj -MD -MP -MF $(DEPDIR)/Xwayland-xwayland-glamor.Tpo -c -o Xwayland-xwayland-glamor.obj `if test -f 'xwayland-glamor.c'; then $(CYGPATH_W) 'xwayland-glamor.c'; else $(CYGPATH_W) '$(srcdir)/xwayland-glamor.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Xwayland-xwayland-glamor.Tpo $(DEPDIR)/Xwayland-xwayland-glamor.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='xwayland-glamor.c' object='Xwayland-xwayland-glamor.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -c -o Xwayland-xwayland-glamor.obj `if test -f 'xwayland-glamor.c'; then $(CYGPATH_W) 'xwayland-glamor.c'; else $(CYGPATH_W) '$(srcdir)/xwayland-glamor.c'; fi` + +Xwayland-drm-protocol.o: drm-protocol.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -MT Xwayland-drm-protocol.o -MD -MP -MF $(DEPDIR)/Xwayland-drm-protocol.Tpo -c -o Xwayland-drm-protocol.o `test -f 'drm-protocol.c' || echo '$(srcdir)/'`drm-protocol.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Xwayland-drm-protocol.Tpo $(DEPDIR)/Xwayland-drm-protocol.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='drm-protocol.c' object='Xwayland-drm-protocol.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -c -o Xwayland-drm-protocol.o `test -f 'drm-protocol.c' || echo '$(srcdir)/'`drm-protocol.c + +Xwayland-drm-protocol.obj: drm-protocol.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -MT Xwayland-drm-protocol.obj -MD -MP -MF $(DEPDIR)/Xwayland-drm-protocol.Tpo -c -o Xwayland-drm-protocol.obj `if test -f 'drm-protocol.c'; then $(CYGPATH_W) 'drm-protocol.c'; else $(CYGPATH_W) '$(srcdir)/drm-protocol.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/Xwayland-drm-protocol.Tpo $(DEPDIR)/Xwayland-drm-protocol.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='drm-protocol.c' object='Xwayland-drm-protocol.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xwayland_CFLAGS) $(CFLAGS) -c -o Xwayland-drm-protocol.obj `if test -f 'drm-protocol.c'; then $(CYGPATH_W) 'drm-protocol.c'; else $(CYGPATH_W) '$(srcdir)/drm-protocol.c'; fi` + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +cscopelist: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) +installdirs: + for dir in "$(DESTDIR)$(bindir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-binPROGRAMS + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binPROGRAMS + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ + clean-generic clean-libtool cscopelist ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-binPROGRAMS install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-binPROGRAMS + + +@GLAMOR_EGL_TRUE@xwayland-glamor.c : $(nodist_Xwayland_SOURCES) + +relink: + $(AM_V_at)rm -f Xwayland$(EXEEXT) && $(MAKE) Xwayland$(EXEEXT) + +%-protocol.c : %.xml + $(AM_V_GEN)$(WAYLAND_SCANNER) code < $< > $@ + +%-client-protocol.h : %.xml + $(AM_V_GEN)$(WAYLAND_SCANNER) client-header < $< > $@ + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/xserver/hw/xwayland/drm.xml b/xserver/hw/xwayland/drm.xml new file mode 100644 index 000000000..8a3ad69b2 --- /dev/null +++ b/xserver/hw/xwayland/drm.xml @@ -0,0 +1,182 @@ +<?xml version="1.0" encoding="UTF-8"?> +<protocol name="drm"> + + <copyright> + Copyright © 2008-2011 Kristian Høgsberg + Copyright © 2010-2011 Intel Corporation + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that\n the above copyright notice appear in + all copies and that both that copyright notice and this permission + notice appear in supporting documentation, and that the name of + the copyright holders not be used in advertising or publicity + pertaining to distribution of the software without specific, + written prior permission. The copyright holders make no + representations about the suitability of this software for any + purpose. It is provided "as is" without express or implied + warranty. + + THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS + SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN + AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF + THIS SOFTWARE. + </copyright> + + <!-- drm support. This object is created by the server and published + using the display's global event. --> + <interface name="wl_drm" version="2"> + <enum name="error"> + <entry name="authenticate_fail" value="0"/> + <entry name="invalid_format" value="1"/> + <entry name="invalid_name" value="2"/> + </enum> + + <enum name="format"> + <!-- The drm format codes match the #defines in drm_fourcc.h. + The formats actually supported by the compositor will be + reported by the format event. --> + <entry name="c8" value="0x20203843"/> + <entry name="rgb332" value="0x38424752"/> + <entry name="bgr233" value="0x38524742"/> + <entry name="xrgb4444" value="0x32315258"/> + <entry name="xbgr4444" value="0x32314258"/> + <entry name="rgbx4444" value="0x32315852"/> + <entry name="bgrx4444" value="0x32315842"/> + <entry name="argb4444" value="0x32315241"/> + <entry name="abgr4444" value="0x32314241"/> + <entry name="rgba4444" value="0x32314152"/> + <entry name="bgra4444" value="0x32314142"/> + <entry name="xrgb1555" value="0x35315258"/> + <entry name="xbgr1555" value="0x35314258"/> + <entry name="rgbx5551" value="0x35315852"/> + <entry name="bgrx5551" value="0x35315842"/> + <entry name="argb1555" value="0x35315241"/> + <entry name="abgr1555" value="0x35314241"/> + <entry name="rgba5551" value="0x35314152"/> + <entry name="bgra5551" value="0x35314142"/> + <entry name="rgb565" value="0x36314752"/> + <entry name="bgr565" value="0x36314742"/> + <entry name="rgb888" value="0x34324752"/> + <entry name="bgr888" value="0x34324742"/> + <entry name="xrgb8888" value="0x34325258"/> + <entry name="xbgr8888" value="0x34324258"/> + <entry name="rgbx8888" value="0x34325852"/> + <entry name="bgrx8888" value="0x34325842"/> + <entry name="argb8888" value="0x34325241"/> + <entry name="abgr8888" value="0x34324241"/> + <entry name="rgba8888" value="0x34324152"/> + <entry name="bgra8888" value="0x34324142"/> + <entry name="xrgb2101010" value="0x30335258"/> + <entry name="xbgr2101010" value="0x30334258"/> + <entry name="rgbx1010102" value="0x30335852"/> + <entry name="bgrx1010102" value="0x30335842"/> + <entry name="argb2101010" value="0x30335241"/> + <entry name="abgr2101010" value="0x30334241"/> + <entry name="rgba1010102" value="0x30334152"/> + <entry name="bgra1010102" value="0x30334142"/> + <entry name="yuyv" value="0x56595559"/> + <entry name="yvyu" value="0x55595659"/> + <entry name="uyvy" value="0x59565955"/> + <entry name="vyuy" value="0x59555956"/> + <entry name="ayuv" value="0x56555941"/> + <entry name="nv12" value="0x3231564e"/> + <entry name="nv21" value="0x3132564e"/> + <entry name="nv16" value="0x3631564e"/> + <entry name="nv61" value="0x3136564e"/> + <entry name="yuv410" value="0x39565559"/> + <entry name="yvu410" value="0x39555659"/> + <entry name="yuv411" value="0x31315559"/> + <entry name="yvu411" value="0x31315659"/> + <entry name="yuv420" value="0x32315559"/> + <entry name="yvu420" value="0x32315659"/> + <entry name="yuv422" value="0x36315559"/> + <entry name="yvu422" value="0x36315659"/> + <entry name="yuv444" value="0x34325559"/> + <entry name="yvu444" value="0x34325659"/> + </enum> + + <!-- Call this request with the magic received from drmGetMagic(). + It will be passed on to the drmAuthMagic() or + DRIAuthConnection() call. This authentication must be + completed before create_buffer could be used. --> + <request name="authenticate"> + <arg name="id" type="uint"/> + </request> + + <!-- Create a wayland buffer for the named DRM buffer. The DRM + surface must have a name using the flink ioctl --> + <request name="create_buffer"> + <arg name="id" type="new_id" interface="wl_buffer"/> + <arg name="name" type="uint"/> + <arg name="width" type="int"/> + <arg name="height" type="int"/> + <arg name="stride" type="uint"/> + <arg name="format" type="uint"/> + </request> + + <!-- Create a wayland buffer for the named DRM buffer. The DRM + surface must have a name using the flink ioctl --> + <request name="create_planar_buffer"> + <arg name="id" type="new_id" interface="wl_buffer"/> + <arg name="name" type="uint"/> + <arg name="width" type="int"/> + <arg name="height" type="int"/> + <arg name="format" type="uint"/> + <arg name="offset0" type="int"/> + <arg name="stride0" type="int"/> + <arg name="offset1" type="int"/> + <arg name="stride1" type="int"/> + <arg name="offset2" type="int"/> + <arg name="stride2" type="int"/> + </request> + + <!-- Create a wayland buffer for the prime fd. Use for regular and planar + buffers. Pass 0 for offset and stride for unused planes. --> + <request name="create_prime_buffer" since="2"> + <arg name="id" type="new_id" interface="wl_buffer"/> + <arg name="name" type="fd"/> + <arg name="width" type="int"/> + <arg name="height" type="int"/> + <arg name="format" type="uint"/> + <arg name="offset0" type="int"/> + <arg name="stride0" type="int"/> + <arg name="offset1" type="int"/> + <arg name="stride1" type="int"/> + <arg name="offset2" type="int"/> + <arg name="stride2" type="int"/> + </request> + + <!-- Notification of the path of the drm device which is used by + the server. The client should use this device for creating + local buffers. Only buffers created from this device should + be be passed to the server using this drm object's + create_buffer request. --> + <event name="device"> + <arg name="name" type="string"/> + </event> + + <event name="format"> + <arg name="format" type="uint"/> + </event> + + <!-- Raised if the authenticate request succeeded --> + <event name="authenticated"/> + + <enum name="capability" since="2"> + <description summary="wl_drm capability bitmask"> + Bitmask of capabilities. + </description> + <entry name="prime" value="1" summary="wl_drm prime available"/> + </enum> + + <event name="capabilities"> + <arg name="value" type="uint"/> + </event> + </interface> + +</protocol> diff --git a/xserver/hw/xwayland/xwayland-cursor.c b/xserver/hw/xwayland/xwayland-cursor.c new file mode 100644 index 000000000..5a9d1fe70 --- /dev/null +++ b/xserver/hw/xwayland/xwayland-cursor.c @@ -0,0 +1,193 @@ +/* + * Copyright © 2014 Intel Corporation + * Copyright © 2011 Kristian Høgsberg + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of the + * copyright holders not be used in advertising or publicity + * pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied + * warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS + * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN + * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING + * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +#include "xwayland.h" + +#include <mipointer.h> + +static DevPrivateKeyRec xwl_cursor_private_key; + +static void +expand_source_and_mask(CursorPtr cursor, CARD32 *data) +{ + CARD32 *p, d, fg, bg; + CursorBitsPtr bits = cursor->bits; + int x, y, stride, i, bit; + + p = data; + fg = ((cursor->foreRed & 0xff00) << 8) | + (cursor->foreGreen & 0xff00) | (cursor->foreGreen >> 8); + bg = ((cursor->backRed & 0xff00) << 8) | + (cursor->backGreen & 0xff00) | (cursor->backGreen >> 8); + stride = (bits->width / 8 + 3) & ~3; + for (y = 0; y < bits->height; y++) + for (x = 0; x < bits->width; x++) { + i = y * stride + x / 8; + bit = 1 << (x & 7); + if (bits->source[i] & bit) + d = fg; + else + d = bg; + if (bits->mask[i] & bit) + d |= 0xff000000; + else + d = 0x00000000; + + *p++ = d; + } +} + +static Bool +xwl_realize_cursor(DeviceIntPtr device, ScreenPtr screen, CursorPtr cursor) +{ + PixmapPtr pixmap; + + pixmap = xwl_shm_create_pixmap(screen, cursor->bits->width, + cursor->bits->height, 32, 0); + dixSetPrivate(&cursor->devPrivates, &xwl_cursor_private_key, pixmap); + + return TRUE; +} + +static Bool +xwl_unrealize_cursor(DeviceIntPtr device, ScreenPtr screen, CursorPtr cursor) +{ + PixmapPtr pixmap; + + pixmap = dixGetPrivate(&cursor->devPrivates, &xwl_cursor_private_key); + + return xwl_shm_destroy_pixmap(pixmap); +} + +void +xwl_seat_set_cursor(struct xwl_seat *xwl_seat) +{ + PixmapPtr pixmap; + CursorPtr cursor; + int stride; + + if (!xwl_seat->wl_pointer) + return; + + if (!xwl_seat->x_cursor) { + wl_pointer_set_cursor(xwl_seat->wl_pointer, + xwl_seat->pointer_enter_serial, NULL, 0, 0); + return; + } + + cursor = xwl_seat->x_cursor; + pixmap = dixGetPrivate(&cursor->devPrivates, &xwl_cursor_private_key); + stride = cursor->bits->width * 4; + if (cursor->bits->argb) + memcpy(pixmap->devPrivate.ptr, + cursor->bits->argb, cursor->bits->height * stride); + else + expand_source_and_mask(cursor, pixmap->devPrivate.ptr); + + wl_pointer_set_cursor(xwl_seat->wl_pointer, + xwl_seat->pointer_enter_serial, + xwl_seat->cursor, + xwl_seat->x_cursor->bits->xhot, + xwl_seat->x_cursor->bits->yhot); + wl_surface_attach(xwl_seat->cursor, + xwl_shm_pixmap_get_wl_buffer(pixmap), 0, 0); + wl_surface_damage(xwl_seat->cursor, 0, 0, + xwl_seat->x_cursor->bits->width, + xwl_seat->x_cursor->bits->height); + wl_surface_commit(xwl_seat->cursor); +} + +static void +xwl_set_cursor(DeviceIntPtr device, + ScreenPtr screen, CursorPtr cursor, int x, int y) +{ + struct xwl_seat *xwl_seat; + + xwl_seat = device->public.devicePrivate; + if (xwl_seat == NULL) + return; + + xwl_seat->x_cursor = cursor; + xwl_seat_set_cursor(xwl_seat); +} + +static void +xwl_move_cursor(DeviceIntPtr device, ScreenPtr screen, int x, int y) +{ +} + +static Bool +xwl_device_cursor_initialize(DeviceIntPtr device, ScreenPtr screen) +{ + return TRUE; +} + +static void +xwl_device_cursor_cleanup(DeviceIntPtr device, ScreenPtr screen) +{ +} + +static miPointerSpriteFuncRec xwl_pointer_sprite_funcs = { + xwl_realize_cursor, + xwl_unrealize_cursor, + xwl_set_cursor, + xwl_move_cursor, + xwl_device_cursor_initialize, + xwl_device_cursor_cleanup +}; + +static Bool +xwl_cursor_off_screen(ScreenPtr *ppScreen, int *x, int *y) +{ + return FALSE; +} + +static void +xwl_cross_screen(ScreenPtr pScreen, Bool entering) +{ +} + +static void +xwl_pointer_warp_cursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y) +{ +} + +static miPointerScreenFuncRec xwl_pointer_screen_funcs = { + xwl_cursor_off_screen, + xwl_cross_screen, + xwl_pointer_warp_cursor +}; + +Bool +xwl_screen_init_cursor(struct xwl_screen *xwl_screen) +{ + if (!dixRegisterPrivateKey(&xwl_cursor_private_key, PRIVATE_CURSOR_BITS, 0)) + return FALSE; + + return miPointerInitialize(xwl_screen->screen, + &xwl_pointer_sprite_funcs, + &xwl_pointer_screen_funcs, TRUE); +} diff --git a/xserver/hw/xwayland/xwayland-cvt.c b/xserver/hw/xwayland/xwayland-cvt.c new file mode 100644 index 000000000..35665597f --- /dev/null +++ b/xserver/hw/xwayland/xwayland-cvt.c @@ -0,0 +1,304 @@ +/* Copied from hw/xfree86/modes/xf86cvt.c into xwayland DDX and + * changed to generate an RRMode */ + +/* + * Copyright 2005-2006 Luc Verhaegen. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +/* + * The reason for having this function in a file of its own is + * so that ../utils/cvt/cvt can link to it, and that xf86CVTMode + * code is shared directly. + */ + +#ifdef HAVE_DIX_CONFIG_H +#include <dix-config.h> +#endif + +#include <string.h> +#include <randrstr.h> +#include "xwayland.h" + +/* + * Generate a CVT standard mode from HDisplay, VDisplay and VRefresh. + * + * These calculations are stolen from the CVT calculation spreadsheet written + * by Graham Loveridge. He seems to be claiming no copyright and there seems to + * be no license attached to this. He apparently just wants to see his name + * mentioned. + * + * This file can be found at http://www.vesa.org/Public/CVT/CVTd6r1.xls + * + * Comments and structure corresponds to the comments and structure of the xls. + * This should ease importing of future changes to the standard (not very + * likely though). + * + * About margins; i'm sure that they are to be the bit between HDisplay and + * HBlankStart, HBlankEnd and HTotal, VDisplay and VBlankStart, VBlankEnd and + * VTotal, where the overscan colour is shown. FB seems to call _all_ blanking + * outside sync "margin" for some reason. Since we prefer seeing proper + * blanking instead of the overscan colour, and since the Crtc* values will + * probably get altered after us, we will disable margins altogether. With + * these calculations, Margins will plainly expand H/VDisplay, and we don't + * want that. -- libv + * + */ +RRModePtr +xwayland_cvt(int HDisplay, int VDisplay, float VRefresh, Bool Reduced, + Bool Interlaced) +{ + /* 1) top/bottom margin size (% of height) - default: 1.8 */ +#define CVT_MARGIN_PERCENTAGE 1.8 + + /* 2) character cell horizontal granularity (pixels) - default 8 */ +#define CVT_H_GRANULARITY 8 + + /* 4) Minimum vertical porch (lines) - default 3 */ +#define CVT_MIN_V_PORCH 3 + + /* 4) Minimum number of vertical back porch lines - default 6 */ +#define CVT_MIN_V_BPORCH 6 + + /* Pixel Clock step (kHz) */ +#define CVT_CLOCK_STEP 250 + + Bool Margins = FALSE; + float VFieldRate, HPeriod; + int HDisplayRnd, HMargin; + int VDisplayRnd, VMargin, VSync; + float Interlace; /* Please rename this */ + char name[128]; + xRRModeInfo modeinfo; + + memset(&modeinfo, 0, sizeof modeinfo); + + /* CVT default is 60.0Hz */ + if (!VRefresh) + VRefresh = 60.0; + + /* 1. Required field rate */ + if (Interlaced) + VFieldRate = VRefresh * 2; + else + VFieldRate = VRefresh; + + /* 2. Horizontal pixels */ + HDisplayRnd = HDisplay - (HDisplay % CVT_H_GRANULARITY); + + /* 3. Determine left and right borders */ + if (Margins) { + /* right margin is actually exactly the same as left */ + HMargin = (((float) HDisplayRnd) * CVT_MARGIN_PERCENTAGE / 100.0); + HMargin -= HMargin % CVT_H_GRANULARITY; + } + else + HMargin = 0; + + /* 4. Find total active pixels */ + modeinfo.width = HDisplayRnd + 2 * HMargin; + + /* 5. Find number of lines per field */ + if (Interlaced) + VDisplayRnd = VDisplay / 2; + else + VDisplayRnd = VDisplay; + + /* 6. Find top and bottom margins */ + /* nope. */ + if (Margins) + /* top and bottom margins are equal again. */ + VMargin = (((float) VDisplayRnd) * CVT_MARGIN_PERCENTAGE / 100.0); + else + VMargin = 0; + + modeinfo.height = VDisplay + 2 * VMargin; + + /* 7. Interlace */ + if (Interlaced) + Interlace = 0.5; + else + Interlace = 0.0; + + /* Determine VSync Width from aspect ratio */ + if (!(VDisplay % 3) && ((VDisplay * 4 / 3) == HDisplay)) + VSync = 4; + else if (!(VDisplay % 9) && ((VDisplay * 16 / 9) == HDisplay)) + VSync = 5; + else if (!(VDisplay % 10) && ((VDisplay * 16 / 10) == HDisplay)) + VSync = 6; + else if (!(VDisplay % 4) && ((VDisplay * 5 / 4) == HDisplay)) + VSync = 7; + else if (!(VDisplay % 9) && ((VDisplay * 15 / 9) == HDisplay)) + VSync = 7; + else /* Custom */ + VSync = 10; + + if (!Reduced) { /* simplified GTF calculation */ + + /* 4) Minimum time of vertical sync + back porch interval (µs) + * default 550.0 */ +#define CVT_MIN_VSYNC_BP 550.0 + + /* 3) Nominal HSync width (% of line period) - default 8 */ +#define CVT_HSYNC_PERCENTAGE 8 + + float HBlankPercentage; + int VSyncAndBackPorch, VBackPorch; + int HBlank; + + /* 8. Estimated Horizontal period */ + HPeriod = ((float) (1000000.0 / VFieldRate - CVT_MIN_VSYNC_BP)) / + (VDisplayRnd + 2 * VMargin + CVT_MIN_V_PORCH + Interlace); + + /* 9. Find number of lines in sync + backporch */ + if (((int) (CVT_MIN_VSYNC_BP / HPeriod) + 1) < + (VSync + CVT_MIN_V_PORCH)) + VSyncAndBackPorch = VSync + CVT_MIN_V_PORCH; + else + VSyncAndBackPorch = (int) (CVT_MIN_VSYNC_BP / HPeriod) + 1; + + /* 10. Find number of lines in back porch */ + VBackPorch = VSyncAndBackPorch - VSync; + (void) VBackPorch; + + /* 11. Find total number of lines in vertical field */ + modeinfo.vTotal = + VDisplayRnd + 2 * VMargin + VSyncAndBackPorch + Interlace + + CVT_MIN_V_PORCH; + + /* 5) Definition of Horizontal blanking time limitation */ + /* Gradient (%/kHz) - default 600 */ +#define CVT_M_FACTOR 600 + + /* Offset (%) - default 40 */ +#define CVT_C_FACTOR 40 + + /* Blanking time scaling factor - default 128 */ +#define CVT_K_FACTOR 128 + + /* Scaling factor weighting - default 20 */ +#define CVT_J_FACTOR 20 + +#define CVT_M_PRIME CVT_M_FACTOR * CVT_K_FACTOR / 256 +#define CVT_C_PRIME (CVT_C_FACTOR - CVT_J_FACTOR) * CVT_K_FACTOR / 256 + \ + CVT_J_FACTOR + + /* 12. Find ideal blanking duty cycle from formula */ + HBlankPercentage = CVT_C_PRIME - CVT_M_PRIME * HPeriod / 1000.0; + + /* 13. Blanking time */ + if (HBlankPercentage < 20) + HBlankPercentage = 20; + + HBlank = modeinfo.width * HBlankPercentage / (100.0 - HBlankPercentage); + HBlank -= HBlank % (2 * CVT_H_GRANULARITY); + + /* 14. Find total number of pixels in a line. */ + modeinfo.hTotal = modeinfo.width + HBlank; + + /* Fill in HSync values */ + modeinfo.hSyncEnd = modeinfo.width + HBlank / 2; + + modeinfo.hSyncStart = modeinfo.hSyncEnd - + (modeinfo.hTotal * CVT_HSYNC_PERCENTAGE) / 100; + modeinfo.hSyncStart += CVT_H_GRANULARITY - + modeinfo.hSyncStart % CVT_H_GRANULARITY; + + /* Fill in VSync values */ + modeinfo.vSyncStart = modeinfo.height + CVT_MIN_V_PORCH; + modeinfo.vSyncEnd = modeinfo.vSyncStart + VSync; + + } + else { /* Reduced blanking */ + /* Minimum vertical blanking interval time (µs) - default 460 */ +#define CVT_RB_MIN_VBLANK 460.0 + + /* Fixed number of clocks for horizontal sync */ +#define CVT_RB_H_SYNC 32.0 + + /* Fixed number of clocks for horizontal blanking */ +#define CVT_RB_H_BLANK 160.0 + + /* Fixed number of lines for vertical front porch - default 3 */ +#define CVT_RB_VFPORCH 3 + + int VBILines; + + /* 8. Estimate Horizontal period. */ + HPeriod = ((float) (1000000.0 / VFieldRate - CVT_RB_MIN_VBLANK)) / + (VDisplayRnd + 2 * VMargin); + + /* 9. Find number of lines in vertical blanking */ + VBILines = ((float) CVT_RB_MIN_VBLANK) / HPeriod + 1; + + /* 10. Check if vertical blanking is sufficient */ + if (VBILines < (CVT_RB_VFPORCH + VSync + CVT_MIN_V_BPORCH)) + VBILines = CVT_RB_VFPORCH + VSync + CVT_MIN_V_BPORCH; + + /* 11. Find total number of lines in vertical field */ + modeinfo.vTotal = VDisplayRnd + 2 * VMargin + Interlace + VBILines; + + /* 12. Find total number of pixels in a line */ + modeinfo.hTotal = modeinfo.width + CVT_RB_H_BLANK; + + /* Fill in HSync values */ + modeinfo.hSyncEnd = modeinfo.width + CVT_RB_H_BLANK / 2; + modeinfo.hSyncStart = modeinfo.hSyncEnd - CVT_RB_H_SYNC; + + /* Fill in VSync values */ + modeinfo.vSyncStart = modeinfo.height + CVT_RB_VFPORCH; + modeinfo.vSyncEnd = modeinfo.vSyncStart + VSync; + } + + /* 15/13. Find pixel clock frequency (kHz for xf86) */ + modeinfo.dotClock = modeinfo.hTotal * 1000.0 / HPeriod; + modeinfo.dotClock -= modeinfo.dotClock % CVT_CLOCK_STEP; + modeinfo.dotClock *= 1000.0; +#if 0 + /* 16/14. Find actual Horizontal Frequency (kHz) */ + modeinfo.hSync = ((float) modeinfo.dotClock) / ((float) modeinfo.hTotal); +#endif + +#if 0 + /* 17/15. Find actual Field rate */ + modeinfo.vRefresh = (1000.0 * ((float) modeinfo.dotClock)) / + ((float) (modeinfo.hTotal * modeinfo.vTotal)); +#endif + + /* 18/16. Find actual vertical frame frequency */ + /* ignore - just set the mode flag for interlaced */ + if (Interlaced) + modeinfo.vTotal *= 2; + + if (Reduced) + modeinfo.modeFlags |= RR_HSyncPositive | RR_VSyncNegative; + else + modeinfo.modeFlags |= RR_HSyncNegative | RR_VSyncPositive; + + if (Interlaced) + modeinfo.modeFlags |= RR_Interlace; + + snprintf(name, sizeof name, "%dx%d@%.1fHz", + modeinfo.width, modeinfo.height, VRefresh); + modeinfo.nameLength = strlen(name); + + return RRModeGet(&modeinfo, name); +} diff --git a/xserver/hw/xwayland/xwayland-glamor.c b/xserver/hw/xwayland/xwayland-glamor.c new file mode 100644 index 000000000..4be883fa3 --- /dev/null +++ b/xserver/hw/xwayland/xwayland-glamor.c @@ -0,0 +1,570 @@ +/* + * Copyright © 2011-2014 Intel Corporation + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of the + * copyright holders not be used in advertising or publicity + * pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied + * warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS + * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN + * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING + * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +#include "xwayland.h" + +#include <fcntl.h> +#include <sys/stat.h> +#include <xf86drm.h> + +#define MESA_EGL_NO_X11_HEADERS +#include <gbm.h> +#include <epoxy/egl.h> +#include <epoxy/gl.h> + +#include <glamor.h> +#include <glamor_context.h> +#include <dri3.h> +#include "drm-client-protocol.h" + +struct xwl_pixmap { + struct wl_buffer *buffer; + struct gbm_bo *bo; + void *image; + unsigned int texture; +}; + +static void +xwl_glamor_egl_make_current(struct glamor_context *glamor_ctx) +{ + eglMakeCurrent(glamor_ctx->display, EGL_NO_SURFACE, + EGL_NO_SURFACE, EGL_NO_CONTEXT); + if (!eglMakeCurrent(glamor_ctx->display, + EGL_NO_SURFACE, EGL_NO_SURFACE, + glamor_ctx->ctx)) + FatalError("Failed to make EGL context current\n"); +} + +static uint32_t +drm_format_for_depth(int depth) +{ + switch (depth) { + case 15: + return WL_DRM_FORMAT_XRGB1555; + case 16: + return WL_DRM_FORMAT_RGB565; + case 24: + return WL_DRM_FORMAT_XRGB8888; + default: + ErrorF("unexpected depth: %d\n", depth); + case 32: + return WL_DRM_FORMAT_ARGB8888; + } +} + +static uint32_t +gbm_format_for_depth(int depth) +{ + switch (depth) { + case 16: + return GBM_FORMAT_RGB565; + case 24: + return GBM_FORMAT_XRGB8888; + default: + ErrorF("unexpected depth: %d\n", depth); + case 32: + return GBM_FORMAT_ARGB8888; + } +} + +void +glamor_egl_screen_init(ScreenPtr screen, struct glamor_context *glamor_ctx) +{ + struct xwl_screen *xwl_screen = xwl_screen_get(screen); + + glamor_ctx->ctx = xwl_screen->egl_context; + glamor_ctx->display = xwl_screen->egl_display; + + glamor_ctx->make_current = xwl_glamor_egl_make_current; + + xwl_screen->glamor_ctx = glamor_ctx; +} + +static PixmapPtr +xwl_glamor_create_pixmap_for_bo(ScreenPtr screen, struct gbm_bo *bo, int depth) +{ + PixmapPtr pixmap; + struct xwl_pixmap *xwl_pixmap; + struct xwl_screen *xwl_screen = xwl_screen_get(screen); + + xwl_pixmap = malloc(sizeof *xwl_pixmap); + if (xwl_pixmap == NULL) + return NULL; + + pixmap = glamor_create_pixmap(screen, + gbm_bo_get_width(bo), + gbm_bo_get_height(bo), + depth, + GLAMOR_CREATE_PIXMAP_NO_TEXTURE); + if (pixmap == NULL) { + free(xwl_pixmap); + return NULL; + } + + if (lastGLContext != xwl_screen->glamor_ctx) { + lastGLContext = xwl_screen->glamor_ctx; + xwl_glamor_egl_make_current(xwl_screen->glamor_ctx); + } + + xwl_pixmap->bo = bo; + xwl_pixmap->buffer = NULL; + xwl_pixmap->image = eglCreateImageKHR(xwl_screen->egl_display, + xwl_screen->egl_context, + EGL_NATIVE_PIXMAP_KHR, + xwl_pixmap->bo, NULL); + + glGenTextures(1, &xwl_pixmap->texture); + glBindTexture(GL_TEXTURE_2D, xwl_pixmap->texture); + glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, xwl_pixmap->image); + glBindTexture(GL_TEXTURE_2D, 0); + + xwl_pixmap_set_private(pixmap, xwl_pixmap); + + glamor_set_pixmap_texture(pixmap, xwl_pixmap->texture); + glamor_set_pixmap_type(pixmap, GLAMOR_TEXTURE_DRM); + + return pixmap; +} + +struct wl_buffer * +xwl_glamor_pixmap_get_wl_buffer(PixmapPtr pixmap) +{ + struct xwl_screen *xwl_screen = xwl_screen_get(pixmap->drawable.pScreen); + struct xwl_pixmap *xwl_pixmap = xwl_pixmap_get(pixmap); + int prime_fd; + + if (xwl_pixmap->buffer) + return xwl_pixmap->buffer; + + prime_fd = gbm_bo_get_fd(xwl_pixmap->bo); + if (prime_fd == -1) + return NULL; + + xwl_pixmap->buffer = + wl_drm_create_prime_buffer(xwl_screen->drm, prime_fd, + pixmap->drawable.width, + pixmap->drawable.height, + drm_format_for_depth(pixmap->drawable.depth), + 0, gbm_bo_get_stride(xwl_pixmap->bo), + 0, 0, + 0, 0); + + close(prime_fd); + + return xwl_pixmap->buffer; +} + +static PixmapPtr +xwl_glamor_create_pixmap(ScreenPtr screen, + int width, int height, int depth, unsigned int hint) +{ + struct xwl_screen *xwl_screen = xwl_screen_get(screen); + struct gbm_bo *bo; + + if (width > 0 && height > 0 && depth >= 15 && + (hint == 0 || + hint == CREATE_PIXMAP_USAGE_BACKING_PIXMAP || + hint == CREATE_PIXMAP_USAGE_SHARED)) { + bo = gbm_bo_create(xwl_screen->gbm, width, height, + gbm_format_for_depth(depth), + GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING); + + if (bo) + return xwl_glamor_create_pixmap_for_bo(screen, bo, depth); + } + + return glamor_create_pixmap(screen, width, height, depth, hint); +} + +static Bool +xwl_glamor_destroy_pixmap(PixmapPtr pixmap) +{ + struct xwl_screen *xwl_screen = xwl_screen_get(pixmap->drawable.pScreen); + struct xwl_pixmap *xwl_pixmap = xwl_pixmap_get(pixmap); + + if (xwl_pixmap && pixmap->refcnt == 1) { + if (xwl_pixmap->buffer) + wl_buffer_destroy(xwl_pixmap->buffer); + + eglDestroyImageKHR(xwl_screen->egl_display, xwl_pixmap->image); + gbm_bo_destroy(xwl_pixmap->bo); + free(xwl_pixmap); + } + + return glamor_destroy_pixmap(pixmap); +} + +static Bool +xwl_glamor_create_screen_resources(ScreenPtr screen) +{ + struct xwl_screen *xwl_screen = xwl_screen_get(screen); + int ret; + + screen->CreateScreenResources = xwl_screen->CreateScreenResources; + ret = (*screen->CreateScreenResources) (screen); + xwl_screen->CreateScreenResources = screen->CreateScreenResources; + screen->CreateScreenResources = xwl_glamor_create_screen_resources; + + if (!ret) + return ret; + + if (xwl_screen->rootless) + screen->devPrivate = + fbCreatePixmap(screen, 0, 0, screen->rootDepth, 0); + else { + screen->devPrivate = + xwl_glamor_create_pixmap(screen, screen->width, screen->height, + screen->rootDepth, + CREATE_PIXMAP_USAGE_BACKING_PIXMAP); + if (screen->devPrivate) + glamor_set_screen_pixmap(screen->devPrivate, NULL); + } + + return screen->devPrivate != NULL; +} + +static char +is_fd_render_node(int fd) +{ + struct stat render; + + if (fstat(fd, &render)) + return 0; + if (!S_ISCHR(render.st_mode)) + return 0; + if (render.st_rdev & 0x80) + return 1; + + return 0; +} + +static void +xwl_drm_init_egl(struct xwl_screen *xwl_screen) +{ + EGLint major, minor; + const char *version; + + if (xwl_screen->egl_display) + return; + + xwl_screen->expecting_event--; + + xwl_screen->gbm = gbm_create_device(xwl_screen->drm_fd); + if (xwl_screen->gbm == NULL) { + ErrorF("couldn't get display device\n"); + return; + } + + xwl_screen->egl_display = eglGetDisplay(xwl_screen->gbm); + if (xwl_screen->egl_display == EGL_NO_DISPLAY) { + ErrorF("eglGetDisplay() failed\n"); + return; + } + + eglBindAPI(EGL_OPENGL_API); + if (!eglInitialize(xwl_screen->egl_display, &major, &minor)) { + ErrorF("eglInitialize() failed\n"); + return; + } + + version = eglQueryString(xwl_screen->egl_display, EGL_VERSION); + ErrorF("glamor: EGL version %s:\n", version); + + xwl_screen->egl_context = eglCreateContext(xwl_screen->egl_display, + NULL, EGL_NO_CONTEXT, NULL); + if (xwl_screen->egl_context == EGL_NO_CONTEXT) { + ErrorF("Failed to create EGL context\n"); + return; + } + + if (!eglMakeCurrent(xwl_screen->egl_display, + EGL_NO_SURFACE, EGL_NO_SURFACE, + xwl_screen->egl_context)) { + ErrorF("Failed to make EGL context current\n"); + return; + } + + if (!epoxy_has_gl_extension("GL_OES_EGL_image")) { + ErrorF("GL_OES_EGL_image no available"); + return; + } + + return; +} + +static void +xwl_drm_handle_device(void *data, struct wl_drm *drm, const char *device) +{ + struct xwl_screen *xwl_screen = data; + drm_magic_t magic; + + xwl_screen->device_name = strdup(device); + if (!xwl_screen->device_name) + return; + + xwl_screen->drm_fd = open(xwl_screen->device_name, O_RDWR | O_CLOEXEC); + if (xwl_screen->drm_fd == -1) { + ErrorF("wayland-egl: could not open %s (%s)", + xwl_screen->device_name, strerror(errno)); + return; + } + + if (is_fd_render_node(xwl_screen->drm_fd)) { + xwl_screen->fd_render_node = 1; + xwl_drm_init_egl(xwl_screen); + } else { + drmGetMagic(xwl_screen->drm_fd, &magic); + wl_drm_authenticate(xwl_screen->drm, magic); + } +} + +static void +xwl_drm_handle_format(void *data, struct wl_drm *drm, uint32_t format) +{ + struct xwl_screen *xwl_screen = data; + + switch (format) { + case WL_DRM_FORMAT_ARGB8888: + xwl_screen->formats |= XWL_FORMAT_ARGB8888; + break; + case WL_DRM_FORMAT_XRGB8888: + xwl_screen->formats |= XWL_FORMAT_XRGB8888; + break; + case WL_DRM_FORMAT_RGB565: + xwl_screen->formats |= XWL_FORMAT_RGB565; + break; + } +} + +static void +xwl_drm_handle_authenticated(void *data, struct wl_drm *drm) +{ + struct xwl_screen *xwl_screen = data; + + if (!xwl_screen->egl_display) + xwl_drm_init_egl(xwl_screen); +} + +static void +xwl_drm_handle_capabilities(void *data, struct wl_drm *drm, uint32_t value) +{ + struct xwl_screen *xwl_screen = data; + + xwl_screen->capabilities = value; +} + +static const struct wl_drm_listener xwl_drm_listener = { + xwl_drm_handle_device, + xwl_drm_handle_format, + xwl_drm_handle_authenticated, + xwl_drm_handle_capabilities +}; + +Bool +xwl_screen_init_glamor(struct xwl_screen *xwl_screen, + uint32_t id, uint32_t version) +{ + if (version < 2) + return FALSE; + + xwl_screen->drm = + wl_registry_bind(xwl_screen->registry, id, &wl_drm_interface, 2); + wl_drm_add_listener(xwl_screen->drm, &xwl_drm_listener, xwl_screen); + xwl_screen->expecting_event++; + + return TRUE; +} + +void +glamor_egl_destroy_textured_pixmap(PixmapPtr pixmap) +{ + glamor_destroy_textured_pixmap(pixmap); +} + +int +glamor_egl_dri3_fd_name_from_tex(ScreenPtr screen, + PixmapPtr pixmap, + unsigned int tex, + Bool want_name, CARD16 *stride, CARD32 *size) +{ + return 0; +} + +unsigned int +glamor_egl_create_argb8888_based_texture(ScreenPtr screen, int w, int h) +{ + return 0; +} + +struct xwl_auth_state { + int fd; + ClientPtr client; +}; + +static void +sync_callback(void *data, struct wl_callback *callback, uint32_t serial) +{ + struct xwl_auth_state *state = data; + + dri3_send_open_reply(state->client, state->fd); + AttendClient(state->client); + free(state); + wl_callback_destroy(callback); +} + +static const struct wl_callback_listener sync_listener = { + sync_callback +}; + +static int +xwl_dri3_open_client(ClientPtr client, + ScreenPtr screen, + RRProviderPtr provider, + int *pfd) +{ + struct xwl_screen *xwl_screen = xwl_screen_get(screen); + struct xwl_auth_state *state; + struct wl_callback *callback; + drm_magic_t magic; + int fd; + + fd = open(xwl_screen->device_name, O_RDWR | O_CLOEXEC); + if (fd < 0) + return BadAlloc; + if (xwl_screen->fd_render_node) { + *pfd = fd; + return Success; + } + + state = malloc(sizeof *state); + if (state == NULL) { + close(fd); + return BadAlloc; + } + + state->client = client; + state->fd = fd; + + if (drmGetMagic(state->fd, &magic) < 0) { + close(state->fd); + free(state); + return BadMatch; + } + + wl_drm_authenticate(xwl_screen->drm, magic); + callback = wl_display_sync(xwl_screen->display); + wl_callback_add_listener(callback, &sync_listener, state); + + IgnoreClient(client); + + return Success; +} + +static PixmapPtr +xwl_dri3_pixmap_from_fd(ScreenPtr screen, int fd, + CARD16 width, CARD16 height, CARD16 stride, + CARD8 depth, CARD8 bpp) +{ + struct xwl_screen *xwl_screen = xwl_screen_get(screen); + struct gbm_import_fd_data data; + struct gbm_bo *bo; + PixmapPtr pixmap; + + if (width == 0 || height == 0 || + depth < 15 || bpp != BitsPerPixel(depth) || stride < width * bpp / 8) + return NULL; + + data.fd = fd; + data.width = width; + data.height = height; + data.stride = stride; + data.format = gbm_format_for_depth(depth); + bo = gbm_bo_import(xwl_screen->gbm, GBM_BO_IMPORT_FD, &data, + GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING); + if (bo == NULL) + return NULL; + + pixmap = xwl_glamor_create_pixmap_for_bo(screen, bo, depth); + if (pixmap == NULL) { + gbm_bo_destroy(bo); + return NULL; + } + + return pixmap; +} + +static int +xwl_dri3_fd_from_pixmap(ScreenPtr screen, PixmapPtr pixmap, + CARD16 *stride, CARD32 *size) +{ + struct xwl_pixmap *xwl_pixmap; + + xwl_pixmap = xwl_pixmap_get(pixmap); + + *stride = gbm_bo_get_stride(xwl_pixmap->bo); + *size = pixmap->drawable.width * *stride; + + return gbm_bo_get_fd(xwl_pixmap->bo); +} + +static dri3_screen_info_rec xwl_dri3_info = { + .version = 1, + .open = NULL, + .pixmap_from_fd = xwl_dri3_pixmap_from_fd, + .fd_from_pixmap = xwl_dri3_fd_from_pixmap, + .open_client = xwl_dri3_open_client, +}; + +Bool +xwl_glamor_init(struct xwl_screen *xwl_screen) +{ + ScreenPtr screen = xwl_screen->screen; + + if (xwl_screen->egl_context == EGL_NO_CONTEXT) { + ErrorF("Disabling glamor and dri3, EGL setup failed\n"); + return FALSE; + } + + if (!glamor_init(xwl_screen->screen, + GLAMOR_INVERTED_Y_AXIS | + GLAMOR_USE_EGL_SCREEN | + GLAMOR_USE_SCREEN | + GLAMOR_USE_PICTURE_SCREEN)) { + ErrorF("Failed to initialize glamor\n"); + return FALSE; + } + + if (!dri3_screen_init(xwl_screen->screen, &xwl_dri3_info)) { + ErrorF("Failed to initialize dri3\n"); + return FALSE; + } + + xwl_screen->CreateScreenResources = screen->CreateScreenResources; + screen->CreateScreenResources = xwl_glamor_create_screen_resources; + screen->CreatePixmap = xwl_glamor_create_pixmap; + screen->DestroyPixmap = xwl_glamor_destroy_pixmap; + + return TRUE; +} diff --git a/xserver/hw/xwayland/xwayland-input.c b/xserver/hw/xwayland/xwayland-input.c new file mode 100644 index 000000000..990cb82d8 --- /dev/null +++ b/xserver/hw/xwayland/xwayland-input.c @@ -0,0 +1,666 @@ +/* + * Copyright © 2014 Intel Corporation + * Copyright © 2008 Kristian Høgsberg + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of the + * copyright holders not be used in advertising or publicity + * pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied + * warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS + * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN + * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING + * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +#include "xwayland.h" + +#include <linux/input.h> + +#include <sys/mman.h> +#include <xkbsrv.h> +#include <xserver-properties.h> +#include <inpututils.h> + +static void +xwl_pointer_control(DeviceIntPtr device, PtrCtrl *ctrl) +{ + /* Nothing to do, dix handles all settings */ +} + +static int +xwl_pointer_proc(DeviceIntPtr device, int what) +{ +#define NBUTTONS 10 +#define NAXES 2 + BYTE map[NBUTTONS + 1]; + int i = 0; + Atom btn_labels[NBUTTONS] = { 0 }; + Atom axes_labels[NAXES] = { 0 }; + + switch (what) { + case DEVICE_INIT: + device->public.on = FALSE; + + for (i = 1; i <= NBUTTONS; i++) + map[i] = i; + + btn_labels[0] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_LEFT); + btn_labels[1] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_MIDDLE); + btn_labels[2] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_RIGHT); + btn_labels[3] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_UP); + btn_labels[4] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_DOWN); + btn_labels[5] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_LEFT); + btn_labels[6] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_RIGHT); + /* don't know about the rest */ + + axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_X); + axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_Y); + + if (!InitValuatorClassDeviceStruct(device, 2, btn_labels, + GetMotionHistorySize(), Absolute)) + return BadValue; + + /* Valuators */ + InitValuatorAxisStruct(device, 0, axes_labels[0], + 0, 0xFFFF, 10000, 0, 10000, Absolute); + InitValuatorAxisStruct(device, 1, axes_labels[1], + 0, 0xFFFF, 10000, 0, 10000, Absolute); + + if (!InitPtrFeedbackClassDeviceStruct(device, xwl_pointer_control)) + return BadValue; + + if (!InitButtonClassDeviceStruct(device, 3, btn_labels, map)) + return BadValue; + + return Success; + + case DEVICE_ON: + device->public.on = TRUE; + return Success; + + case DEVICE_OFF: + case DEVICE_CLOSE: + device->public.on = FALSE; + return Success; + } + + return BadMatch; + +#undef NBUTTONS +#undef NAXES +} + +static void +xwl_keyboard_control(DeviceIntPtr device, KeybdCtrl *ctrl) +{ +} + +static int +xwl_keyboard_proc(DeviceIntPtr device, int what) +{ + struct xwl_seat *xwl_seat = device->public.devicePrivate; + int len; + + switch (what) { + case DEVICE_INIT: + device->public.on = FALSE; + if (xwl_seat->keymap) + len = strnlen(xwl_seat->keymap, xwl_seat->keymap_size); + else + len = 0; + if (!InitKeyboardDeviceStructFromString(device, xwl_seat->keymap, + len, + NULL, xwl_keyboard_control)) + return BadValue; + + return Success; + case DEVICE_ON: + device->public.on = TRUE; + return Success; + + case DEVICE_OFF: + case DEVICE_CLOSE: + device->public.on = FALSE; + return Success; + } + + return BadMatch; +} + +static void +pointer_handle_enter(void *data, struct wl_pointer *pointer, + uint32_t serial, struct wl_surface *surface, + wl_fixed_t sx_w, wl_fixed_t sy_w) +{ + struct xwl_seat *xwl_seat = data; + DeviceIntPtr dev = xwl_seat->pointer; + int i; + int sx = wl_fixed_to_int(sx_w); + int sy = wl_fixed_to_int(sy_w); + ScreenPtr pScreen = xwl_seat->xwl_screen->screen; + ValuatorMask mask; + + xwl_seat->xwl_screen->serial = serial; + xwl_seat->pointer_enter_serial = serial; + + xwl_seat->focus_window = wl_surface_get_user_data(surface); + + (*pScreen->SetCursorPosition) (dev, pScreen, sx, sy, TRUE); + CheckMotion(NULL, GetMaster(dev, MASTER_POINTER)); + + /* Ideally, X clients shouldn't see these button releases. When + * the pointer leaves a window with buttons down, it means that + * the wayland compositor has grabbed the pointer. The button + * release event is consumed by whatever grab in the compositor + * and won't be sent to clients (the X server is a client). + * However, we need to reset X's idea of which buttons are up and + * down, and they're all up (by definition) when the pointer + * enters a window. We should figure out a way to swallow these + * events, perhaps using an X grab whenever the pointer is not in + * any X window, but for now just send the events. */ + valuator_mask_zero(&mask); + for (i = 0; i < dev->button->numButtons; i++) + if (BitIsOn(dev->button->down, i)) + QueuePointerEvents(xwl_seat->pointer, ButtonRelease, i, 0, &mask); +} + +static void +pointer_handle_leave(void *data, struct wl_pointer *pointer, + uint32_t serial, struct wl_surface *surface) +{ + struct xwl_seat *xwl_seat = data; + DeviceIntPtr dev = xwl_seat->pointer; + + xwl_seat->xwl_screen->serial = serial; + + xwl_seat->focus_window = NULL; + CheckMotion(NULL, GetMaster(dev, MASTER_POINTER)); +} + +static void +pointer_handle_motion(void *data, struct wl_pointer *pointer, + uint32_t time, wl_fixed_t sx_w, wl_fixed_t sy_w) +{ + struct xwl_seat *xwl_seat = data; + int32_t dx, dy; + int sx = wl_fixed_to_int(sx_w); + int sy = wl_fixed_to_int(sy_w); + ValuatorMask mask; + + if (!xwl_seat->focus_window) + return; + + dx = xwl_seat->focus_window->window->drawable.x; + dy = xwl_seat->focus_window->window->drawable.y; + + valuator_mask_zero(&mask); + valuator_mask_set(&mask, 0, dx + sx); + valuator_mask_set(&mask, 1, dy + sy); + + QueuePointerEvents(xwl_seat->pointer, MotionNotify, 0, + POINTER_ABSOLUTE | POINTER_SCREEN, &mask); +} + +static void +pointer_handle_button(void *data, struct wl_pointer *pointer, uint32_t serial, + uint32_t time, uint32_t button, uint32_t state) +{ + struct xwl_seat *xwl_seat = data; + int index; + ValuatorMask mask; + + xwl_seat->xwl_screen->serial = serial; + + switch (button) { + case BTN_MIDDLE: + index = 2; + break; + case BTN_RIGHT: + index = 3; + break; + default: + index = button - BTN_LEFT + 1; + break; + } + + valuator_mask_zero(&mask); + QueuePointerEvents(xwl_seat->pointer, + state ? ButtonPress : ButtonRelease, index, 0, &mask); +} + +static void +pointer_handle_axis(void *data, struct wl_pointer *pointer, + uint32_t time, uint32_t axis, wl_fixed_t value) +{ + struct xwl_seat *xwl_seat = data; + int index, count; + int i, val; + const int divisor = 10; + ValuatorMask mask; + + if (time - xwl_seat->scroll_time > 2000) { + xwl_seat->vertical_scroll = 0; + xwl_seat->horizontal_scroll = 0; + } + xwl_seat->scroll_time = time; + + /* FIXME: Need to do proper smooth scrolling here! */ + switch (axis) { + case WL_POINTER_AXIS_VERTICAL_SCROLL: + xwl_seat->vertical_scroll += value / divisor; + val = wl_fixed_to_int(xwl_seat->vertical_scroll); + xwl_seat->vertical_scroll -= wl_fixed_from_int(val); + + if (val <= -1) + index = 4; + else if (val >= 1) + index = 5; + else + return; + break; + case WL_POINTER_AXIS_HORIZONTAL_SCROLL: + xwl_seat->horizontal_scroll += value / divisor; + val = wl_fixed_to_int(xwl_seat->horizontal_scroll); + xwl_seat->horizontal_scroll -= wl_fixed_from_int(val); + + if (val <= -1) + index = 6; + else if (val >= 1) + index = 7; + else + return; + break; + default: + return; + } + + valuator_mask_zero(&mask); + + count = abs(val); + for (i = 0; i < count; i++) { + QueuePointerEvents(xwl_seat->pointer, ButtonPress, index, 0, &mask); + QueuePointerEvents(xwl_seat->pointer, ButtonRelease, index, 0, &mask); + } +} + +static const struct wl_pointer_listener pointer_listener = { + pointer_handle_enter, + pointer_handle_leave, + pointer_handle_motion, + pointer_handle_button, + pointer_handle_axis, +}; + +static void +keyboard_handle_key(void *data, struct wl_keyboard *keyboard, uint32_t serial, + uint32_t time, uint32_t key, uint32_t state) +{ + struct xwl_seat *xwl_seat = data; + uint32_t *k, *end; + ValuatorMask mask; + + xwl_seat->xwl_screen->serial = serial; + + end = (uint32_t *) ((char *) xwl_seat->keys.data + xwl_seat->keys.size); + for (k = xwl_seat->keys.data; k < end; k++) { + if (*k == key) + *k = *--end; + } + xwl_seat->keys.size = (char *) end - (char *) xwl_seat->keys.data; + if (state) { + k = wl_array_add(&xwl_seat->keys, sizeof *k); + *k = key; + } + + valuator_mask_zero(&mask); + QueueKeyboardEvents(xwl_seat->keyboard, + state ? KeyPress : KeyRelease, key + 8, &mask); +} + +static void +keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard, + uint32_t format, int fd, uint32_t size) +{ + struct xwl_seat *xwl_seat = data; + DeviceIntPtr master; + XkbDescPtr xkb; + XkbChangesRec changes = { 0 }; + + if (xwl_seat->keymap) + munmap(xwl_seat->keymap, xwl_seat->keymap_size); + + xwl_seat->keymap_size = size; + xwl_seat->keymap = mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0); + if (xwl_seat->keymap == MAP_FAILED) { + xwl_seat->keymap_size = 0; + xwl_seat->keymap = NULL; + goto out; + } + + xkb = XkbCompileKeymapFromString(xwl_seat->keyboard, xwl_seat->keymap, + strnlen(xwl_seat->keymap, + xwl_seat->keymap_size)); + if (!xkb) + goto out; + + XkbUpdateDescActions(xkb, xkb->min_key_code, XkbNumKeys(xkb), &changes); + + if (xwl_seat->keyboard->key) + /* Keep the current controls */ + XkbCopyControls(xkb, xwl_seat->keyboard->key->xkbInfo->desc); + + XkbDeviceApplyKeymap(xwl_seat->keyboard, xkb); + + master = GetMaster(xwl_seat->keyboard, MASTER_KEYBOARD); + if (master && master->lastSlave == xwl_seat->keyboard) + XkbDeviceApplyKeymap(master, xkb); + + XkbFreeKeyboard(xkb, XkbAllComponentsMask, TRUE); + + out: + close(fd); +} + +static void +keyboard_handle_enter(void *data, struct wl_keyboard *keyboard, + uint32_t serial, + struct wl_surface *surface, struct wl_array *keys) +{ + struct xwl_seat *xwl_seat = data; + ValuatorMask mask; + uint32_t *k; + + xwl_seat->xwl_screen->serial = serial; + xwl_seat->keyboard_focus = surface; + + wl_array_copy(&xwl_seat->keys, keys); + valuator_mask_zero(&mask); + wl_array_for_each(k, &xwl_seat->keys) + QueueKeyboardEvents(xwl_seat->keyboard, KeyPress, *k + 8, &mask); +} + +static void +keyboard_handle_leave(void *data, struct wl_keyboard *keyboard, + uint32_t serial, struct wl_surface *surface) +{ + struct xwl_seat *xwl_seat = data; + ValuatorMask mask; + uint32_t *k; + + xwl_seat->xwl_screen->serial = serial; + + valuator_mask_zero(&mask); + wl_array_for_each(k, &xwl_seat->keys) + QueueKeyboardEvents(xwl_seat->keyboard, KeyRelease, *k + 8, &mask); + + xwl_seat->keyboard_focus = NULL; +} + +static void +keyboard_handle_modifiers(void *data, struct wl_keyboard *keyboard, + uint32_t serial, uint32_t mods_depressed, + uint32_t mods_latched, uint32_t mods_locked, + uint32_t group) +{ + struct xwl_seat *xwl_seat = data; + DeviceIntPtr dev; + XkbStateRec old_state, *new_state; + xkbStateNotify sn; + CARD16 changed; + + /* We don't need any of this while we have keyboard focus since + the regular key event processing already takes care of setting + our internal state correctly. */ + if (xwl_seat->keyboard_focus) + return; + + for (dev = inputInfo.devices; dev; dev = dev->next) { + if (dev != xwl_seat->keyboard && + dev != GetMaster(xwl_seat->keyboard, MASTER_KEYBOARD)) + continue; + + old_state = dev->key->xkbInfo->state; + new_state = &dev->key->xkbInfo->state; + + new_state->locked_group = group & XkbAllGroupsMask; + new_state->locked_mods = mods_locked & XkbAllModifiersMask; + XkbLatchModifiers(dev, XkbAllModifiersMask, + mods_latched & XkbAllModifiersMask); + + XkbComputeDerivedState(dev->key->xkbInfo); + + changed = XkbStateChangedFlags(&old_state, new_state); + if (!changed) + continue; + + sn.keycode = 0; + sn.eventType = 0; + sn.requestMajor = XkbReqCode; + sn.requestMinor = X_kbLatchLockState; /* close enough */ + sn.changed = changed; + XkbSendStateNotify(dev, &sn); + } +} + +static const struct wl_keyboard_listener keyboard_listener = { + keyboard_handle_keymap, + keyboard_handle_enter, + keyboard_handle_leave, + keyboard_handle_key, + keyboard_handle_modifiers, +}; + +static DeviceIntPtr +add_device(struct xwl_seat *xwl_seat, + const char *driver, DeviceProc device_proc) +{ + DeviceIntPtr dev = NULL; + static Atom type_atom; + char name[32]; + + dev = AddInputDevice(serverClient, device_proc, TRUE); + if (dev == NULL) + return NULL; + + if (type_atom == None) + type_atom = MakeAtom(driver, strlen(driver), TRUE); + snprintf(name, sizeof name, "%s:%d", driver, xwl_seat->id); + AssignTypeAndName(dev, type_atom, name); + dev->public.devicePrivate = xwl_seat; + dev->type = SLAVE; + dev->spriteInfo->spriteOwner = FALSE; + + return dev; +} + +static void +seat_handle_capabilities(void *data, struct wl_seat *seat, + enum wl_seat_capability caps) +{ + struct xwl_seat *xwl_seat = data; + + if (caps & WL_SEAT_CAPABILITY_POINTER && xwl_seat->pointer == NULL) { + xwl_seat->wl_pointer = wl_seat_get_pointer(seat); + wl_pointer_add_listener(xwl_seat->wl_pointer, + &pointer_listener, xwl_seat); + xwl_seat_set_cursor(xwl_seat); + xwl_seat->pointer = + add_device(xwl_seat, "xwayland-pointer", xwl_pointer_proc); + } + else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && xwl_seat->pointer) { + wl_pointer_release(xwl_seat->wl_pointer); + RemoveDevice(xwl_seat->pointer, FALSE); + xwl_seat->pointer = NULL; + } + + if (caps & WL_SEAT_CAPABILITY_KEYBOARD && xwl_seat->keyboard == NULL) { + xwl_seat->wl_keyboard = wl_seat_get_keyboard(seat); + wl_keyboard_add_listener(xwl_seat->wl_keyboard, + &keyboard_listener, xwl_seat); + xwl_seat->keyboard = + add_device(xwl_seat, "xwayland-keyboard", xwl_keyboard_proc); + } + else if (!(caps & WL_SEAT_CAPABILITY_KEYBOARD) && xwl_seat->keyboard) { + wl_keyboard_release(xwl_seat->wl_keyboard); + RemoveDevice(xwl_seat->keyboard, FALSE); + xwl_seat->keyboard = NULL; + } + + xwl_seat->xwl_screen->expecting_event--; + /* FIXME: Touch ... */ +} + +static void +seat_handle_name(void *data, struct wl_seat *seat, + const char *name) +{ + +} + +static const struct wl_seat_listener seat_listener = { + seat_handle_capabilities, + seat_handle_name +}; + +static void +create_input_device(struct xwl_screen *xwl_screen, uint32_t id) +{ + struct xwl_seat *xwl_seat; + + xwl_seat = calloc(sizeof *xwl_seat, 1); + if (xwl_seat == NULL) { + ErrorF("create_input ENOMEM"); + return; + } + + xwl_seat->xwl_screen = xwl_screen; + xorg_list_add(&xwl_seat->link, &xwl_screen->seat_list); + + xwl_seat->seat = + wl_registry_bind(xwl_screen->registry, id, &wl_seat_interface, 3); + xwl_seat->id = id; + + xwl_seat->cursor = wl_compositor_create_surface(xwl_screen->compositor); + wl_seat_add_listener(xwl_seat->seat, &seat_listener, xwl_seat); + wl_array_init(&xwl_seat->keys); +} + +void +xwl_seat_destroy(struct xwl_seat *xwl_seat) +{ + RemoveDevice(xwl_seat->pointer, FALSE); + RemoveDevice(xwl_seat->keyboard, FALSE); + wl_seat_destroy(xwl_seat->seat); + wl_surface_destroy(xwl_seat->cursor); + wl_array_release(&xwl_seat->keys); + free(xwl_seat); +} + +static void +input_handler(void *data, struct wl_registry *registry, uint32_t id, + const char *interface, uint32_t version) +{ + struct xwl_screen *xwl_screen = data; + + if (strcmp(interface, "wl_seat") == 0 && version >= 3) { + create_input_device(xwl_screen, id); + xwl_screen->expecting_event++; + } +} + +static void +global_remove(void *data, struct wl_registry *registry, uint32_t name) +{ +} + +static const struct wl_registry_listener input_listener = { + input_handler, + global_remove, +}; + +Bool +LegalModifier(unsigned int key, DeviceIntPtr pDev) +{ + return TRUE; +} + +void +ProcessInputEvents(void) +{ + mieqProcessInputEvents(); +} + +void +DDXRingBell(int volume, int pitch, int duration) +{ +} + +static WindowPtr +xwl_xy_to_window(ScreenPtr screen, SpritePtr sprite, int x, int y) +{ + struct xwl_seat *xwl_seat = NULL; + DeviceIntPtr device; + + for (device = inputInfo.devices; device; device = device->next) { + if (device->deviceProc == xwl_pointer_proc && + device->spriteInfo->sprite == sprite) { + xwl_seat = device->public.devicePrivate; + break; + } + } + + if (xwl_seat == NULL) { + /* XTEST device */ + sprite->spriteTraceGood = 1; + return sprite->spriteTrace[0]; + } + + if (xwl_seat->focus_window) { + sprite->spriteTraceGood = 2; + sprite->spriteTrace[1] = xwl_seat->focus_window->window; + return miSpriteTrace(sprite, x, y); + } + else { + sprite->spriteTraceGood = 1; + return sprite->spriteTrace[0]; + } +} + +void +InitInput(int argc, char *argv[]) +{ + ScreenPtr pScreen = screenInfo.screens[0]; + struct xwl_screen *xwl_screen = xwl_screen_get(pScreen); + + mieqInit(); + + xwl_screen->input_registry = wl_display_get_registry(xwl_screen->display); + wl_registry_add_listener(xwl_screen->input_registry, &input_listener, + xwl_screen); + + xwl_screen->XYToWindow = pScreen->XYToWindow; + pScreen->XYToWindow = xwl_xy_to_window; + + xwl_screen->expecting_event = 0; + wl_display_roundtrip(xwl_screen->display); + while (xwl_screen->expecting_event) + wl_display_roundtrip(xwl_screen->display); +} + +void +CloseInput(void) +{ + mieqFini(); +} diff --git a/xserver/hw/xwayland/xwayland-output.c b/xserver/hw/xwayland/xwayland-output.c new file mode 100644 index 000000000..778914c61 --- /dev/null +++ b/xserver/hw/xwayland/xwayland-output.c @@ -0,0 +1,226 @@ +/* + * Copyright © 2011-2014 Intel Corporation + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of the + * copyright holders not be used in advertising or publicity + * pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied + * warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS + * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN + * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING + * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +#ifdef HAVE_DIX_CONFIG_H +#include <dix-config.h> +#endif + +#include "xwayland.h" +#include <randrstr.h> + +static Rotation +wl_transform_to_xrandr(enum wl_output_transform transform) +{ + switch (transform) { + default: + case WL_OUTPUT_TRANSFORM_NORMAL: + return RR_Rotate_0; + case WL_OUTPUT_TRANSFORM_90: + return RR_Rotate_90; + case WL_OUTPUT_TRANSFORM_180: + return RR_Rotate_180; + case WL_OUTPUT_TRANSFORM_270: + return RR_Rotate_270; + case WL_OUTPUT_TRANSFORM_FLIPPED: + return RR_Reflect_X | RR_Rotate_0; + case WL_OUTPUT_TRANSFORM_FLIPPED_90: + return RR_Reflect_X | RR_Rotate_90; + case WL_OUTPUT_TRANSFORM_FLIPPED_180: + return RR_Reflect_X | RR_Rotate_180; + case WL_OUTPUT_TRANSFORM_FLIPPED_270: + return RR_Reflect_X | RR_Rotate_270; + } +} + +static int +wl_subpixel_to_xrandr(int subpixel) +{ + switch (subpixel) { + default: + case WL_OUTPUT_SUBPIXEL_UNKNOWN: + return SubPixelUnknown; + case WL_OUTPUT_SUBPIXEL_NONE: + return SubPixelNone; + case WL_OUTPUT_SUBPIXEL_HORIZONTAL_RGB: + return SubPixelHorizontalRGB; + case WL_OUTPUT_SUBPIXEL_HORIZONTAL_BGR: + return SubPixelHorizontalBGR; + case WL_OUTPUT_SUBPIXEL_VERTICAL_RGB: + return SubPixelVerticalRGB; + case WL_OUTPUT_SUBPIXEL_VERTICAL_BGR: + return SubPixelVerticalBGR; + } +} + +static void +output_handle_geometry(void *data, struct wl_output *wl_output, int x, int y, + int physical_width, int physical_height, int subpixel, + const char *make, const char *model, int transform) +{ + struct xwl_output *xwl_output = data; + + RROutputSetPhysicalSize(xwl_output->randr_output, + physical_width, physical_height); + RROutputSetSubpixelOrder(xwl_output->randr_output, + wl_subpixel_to_xrandr(subpixel)); + xwl_output->x = x; + xwl_output->y = y; + + xwl_output->rotation = wl_transform_to_xrandr(transform); +} + +static void +output_handle_mode(void *data, struct wl_output *wl_output, uint32_t flags, + int width, int height, int refresh) +{ + struct xwl_output *xwl_output = data; + RRModePtr randr_mode; + + if (!(flags & WL_OUTPUT_MODE_CURRENT)) + return; + + xwl_output->width = width; + xwl_output->height = height; + + randr_mode = xwayland_cvt(width, height, refresh / 1000.0, 0, 0); + + RROutputSetModes(xwl_output->randr_output, &randr_mode, 1, 1); + + RRCrtcNotify(xwl_output->randr_crtc, randr_mode, + xwl_output->x, xwl_output->y, + xwl_output->rotation, NULL, 1, &xwl_output->randr_output); +} + +static void +output_handle_done(void *data, struct wl_output *wl_output) +{ + struct xwl_output *xwl_output = data; + struct xwl_screen *xwl_screen = xwl_output->xwl_screen; + int width, height; + + xorg_list_append(&xwl_output->link, &xwl_screen->output_list); + + width = 0; + height = 0; + xorg_list_for_each_entry(xwl_output, &xwl_screen->output_list, link) { + if (width < xwl_output->x + xwl_output->width) + width = xwl_output->x + xwl_output->width; + if (height < xwl_output->y + xwl_output->height) + height = xwl_output->y + xwl_output->height; + } + + xwl_screen->width = width; + xwl_screen->height = height; + RRScreenSizeNotify(xwl_screen->screen); + + xwl_screen->expecting_event--; +} + +static void +output_handle_scale(void *data, struct wl_output *wl_output, int32_t factor) +{ +} + +static const struct wl_output_listener output_listener = { + output_handle_geometry, + output_handle_mode, + output_handle_done, + output_handle_scale +}; + +struct xwl_output * +xwl_output_create(struct xwl_screen *xwl_screen, uint32_t id) +{ + struct xwl_output *xwl_output; + static int serial; + char name[256]; + + xwl_output = calloc(sizeof *xwl_output, 1); + if (xwl_output == NULL) { + ErrorF("create_output ENOMEM"); + return NULL; + } + + xwl_output->output = wl_registry_bind(xwl_screen->registry, id, + &wl_output_interface, 2); + wl_output_add_listener(xwl_output->output, &output_listener, xwl_output); + + if (snprintf(name, sizeof name, "XWAYLAND%d", serial++) < 0) { + ErrorF("create_output ENOMEM"); + free(xwl_output); + return NULL; + } + + xwl_output->xwl_screen = xwl_screen; + xwl_output->randr_crtc = RRCrtcCreate(xwl_screen->screen, xwl_output); + xwl_output->randr_output = RROutputCreate(xwl_screen->screen, name, + strlen(name), xwl_output); + RRCrtcGammaSetSize(xwl_output->randr_crtc, 256); + RROutputSetCrtcs(xwl_output->randr_output, &xwl_output->randr_crtc, 1); + RROutputSetConnection(xwl_output->randr_output, RR_Connected); + + return xwl_output; +} + +void +xwl_output_destroy(struct xwl_output *xwl_output) +{ + wl_output_destroy(xwl_output->output); + RRCrtcDestroy(xwl_output->randr_crtc); + RROutputDestroy(xwl_output->randr_output); + free(xwl_output); +} + +static Bool +xwl_randr_get_info(ScreenPtr pScreen, Rotation * rotations) +{ + *rotations = 0; + + return TRUE; +} + +static Bool +xwl_randr_set_config(ScreenPtr pScreen, + Rotation rotation, int rate, RRScreenSizePtr pSize) +{ + return FALSE; +} + +Bool +xwl_screen_init_output(struct xwl_screen *xwl_screen) +{ + rrScrPrivPtr rp; + + if (!RRScreenInit(xwl_screen->screen)) + return FALSE; + + RRScreenSetSizeRange(xwl_screen->screen, 320, 200, 8192, 8192); + + rp = rrGetScrPriv(xwl_screen->screen); + rp->rrGetInfo = xwl_randr_get_info; + rp->rrSetConfig = xwl_randr_set_config; + + return TRUE; +} diff --git a/xserver/hw/xwayland/xwayland-shm.c b/xserver/hw/xwayland/xwayland-shm.c new file mode 100644 index 000000000..2d0ce3eb6 --- /dev/null +++ b/xserver/hw/xwayland/xwayland-shm.c @@ -0,0 +1,292 @@ +/* + * Copyright © 2014 Intel Corporation + * Copyright © 2012 Collabora, Ltd. + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of the + * copyright holders not be used in advertising or publicity + * pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied + * warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS + * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN + * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING + * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +#include "xwayland.h" + +#include <sys/mman.h> +#include <sys/types.h> +#include <unistd.h> +#include <fcntl.h> +#include <errno.h> +#include <string.h> +#include <stdlib.h> + +struct xwl_pixmap { + struct wl_buffer *buffer; + int fd; + void *data; + size_t size; +}; + +#ifndef HAVE_MKOSTEMP +static int +set_cloexec_or_close(int fd) +{ + long flags; + + if (fd == -1) + return -1; + + flags = fcntl(fd, F_GETFD); + if (flags == -1) + goto err; + + if (fcntl(fd, F_SETFD, flags | FD_CLOEXEC) == -1) + goto err; + + return fd; + + err: + close(fd); + return -1; +} +#endif + +static int +create_tmpfile_cloexec(char *tmpname) +{ + int fd; + +#ifdef HAVE_MKOSTEMP + fd = mkostemp(tmpname, O_CLOEXEC); + if (fd >= 0) + unlink(tmpname); +#else + fd = mkstemp(tmpname); + if (fd >= 0) { + fd = set_cloexec_or_close(fd); + unlink(tmpname); + } +#endif + + return fd; +} + +/* + * Create a new, unique, anonymous file of the given size, and + * return the file descriptor for it. The file descriptor is set + * CLOEXEC. The file is immediately suitable for mmap()'ing + * the given size at offset zero. + * + * The file should not have a permanent backing store like a disk, + * but may have if XDG_RUNTIME_DIR is not properly implemented in OS. + * + * The file name is deleted from the file system. + * + * The file is suitable for buffer sharing between processes by + * transmitting the file descriptor over Unix sockets using the + * SCM_RIGHTS methods. + * + * If the C library implements posix_fallocate(), it is used to + * guarantee that disk space is available for the file at the + * given size. If disk space is insufficent, errno is set to ENOSPC. + * If posix_fallocate() is not supported, program may receive + * SIGBUS on accessing mmap()'ed file contents instead. + */ +static int +os_create_anonymous_file(off_t size) +{ + static const char template[] = "/weston-shared-XXXXXX"; + const char *path; + char *name; + int fd; + int ret; + + path = getenv("XDG_RUNTIME_DIR"); + if (!path) { + errno = ENOENT; + return -1; + } + + name = malloc(strlen(path) + sizeof(template)); + if (!name) + return -1; + + strcpy(name, path); + strcat(name, template); + + fd = create_tmpfile_cloexec(name); + + free(name); + + if (fd < 0) + return -1; + +#ifdef HAVE_POSIX_FALLOCATE + ret = posix_fallocate(fd, 0, size); + if (ret != 0) { + close(fd); + errno = ret; + return -1; + } +#else + ret = ftruncate(fd, size); + if (ret < 0) { + close(fd); + return -1; + } +#endif + + return fd; +} + +static uint32_t +shm_format_for_depth(int depth) +{ + switch (depth) { + case 32: + return WL_SHM_FORMAT_ARGB8888; + case 24: + default: + return WL_SHM_FORMAT_XRGB8888; +#ifdef WL_SHM_FORMAT_RGB565 + case 16: + /* XXX: Check run-time protocol version too */ + return WL_SHM_FORMAT_RGB565; +#endif + } +} + +PixmapPtr +xwl_shm_create_pixmap(ScreenPtr screen, + int width, int height, int depth, unsigned int hint) +{ + PixmapPtr pixmap; + struct xwl_pixmap *xwl_pixmap; + size_t size, stride; + + if (hint == CREATE_PIXMAP_USAGE_GLYPH_PICTURE || + (width == 0 && height == 0) || depth < 15) + return fbCreatePixmap(screen, width, height, depth, hint); + + pixmap = fbCreatePixmap(screen, 0, 0, depth, hint); + if (!pixmap) + return NULL; + + xwl_pixmap = malloc(sizeof *xwl_pixmap); + if (xwl_pixmap == NULL) + goto err_destroy_pixmap; + + stride = PixmapBytePad(width, depth); + size = stride * height; + xwl_pixmap->buffer = NULL; + xwl_pixmap->size = size; + xwl_pixmap->fd = os_create_anonymous_file(size); + if (xwl_pixmap->fd < 0) + goto err_free_xwl_pixmap; + + xwl_pixmap->data = mmap(NULL, size, PROT_READ | PROT_WRITE, + MAP_SHARED, xwl_pixmap->fd, 0); + if (xwl_pixmap->data == MAP_FAILED) + goto err_close_fd; + + if (!(*screen->ModifyPixmapHeader) (pixmap, width, height, depth, + BitsPerPixel(depth), + stride, xwl_pixmap->data)) + goto err_munmap; + + xwl_pixmap_set_private(pixmap, xwl_pixmap); + + return pixmap; + + err_munmap: + munmap(xwl_pixmap->data, size); + err_close_fd: + close(xwl_pixmap->fd); + err_free_xwl_pixmap: + free(xwl_pixmap); + err_destroy_pixmap: + fbDestroyPixmap(pixmap); + + return NULL; +} + +Bool +xwl_shm_destroy_pixmap(PixmapPtr pixmap) +{ + struct xwl_pixmap *xwl_pixmap = xwl_pixmap_get(pixmap); + + if (xwl_pixmap && pixmap->refcnt == 1) { + if (xwl_pixmap->buffer) + wl_buffer_destroy(xwl_pixmap->buffer); + munmap(xwl_pixmap->data, xwl_pixmap->size); + close(xwl_pixmap->fd); + free(xwl_pixmap); + } + + return fbDestroyPixmap(pixmap); +} + +struct wl_buffer * +xwl_shm_pixmap_get_wl_buffer(PixmapPtr pixmap) +{ + struct xwl_screen *xwl_screen = xwl_screen_get(pixmap->drawable.pScreen); + struct xwl_pixmap *xwl_pixmap = xwl_pixmap_get(pixmap); + struct wl_shm_pool *pool; + uint32_t format; + + if (xwl_pixmap->buffer) + return xwl_pixmap->buffer; + + pool = wl_shm_create_pool(xwl_screen->shm, + xwl_pixmap->fd, xwl_pixmap->size); + + format = shm_format_for_depth(pixmap->drawable.depth); + xwl_pixmap->buffer = wl_shm_pool_create_buffer(pool, 0, + pixmap->drawable.width, + pixmap->drawable.height, + pixmap->devKind, format); + + wl_shm_pool_destroy(pool); + + return xwl_pixmap->buffer; +} + +Bool +xwl_shm_create_screen_resources(ScreenPtr screen) +{ + struct xwl_screen *xwl_screen = xwl_screen_get(screen); + int ret; + + screen->CreateScreenResources = xwl_screen->CreateScreenResources; + ret = (*screen->CreateScreenResources) (screen); + xwl_screen->CreateScreenResources = screen->CreateScreenResources; + screen->CreateScreenResources = xwl_shm_create_screen_resources; + + if (!ret) + return ret; + + if (xwl_screen->rootless) + screen->devPrivate = + fbCreatePixmap(screen, 0, 0, screen->rootDepth, 0); + else + screen->devPrivate = + xwl_shm_create_pixmap(screen, screen->width, screen->height, + screen->rootDepth, + CREATE_PIXMAP_USAGE_BACKING_PIXMAP); + + return screen->devPrivate != NULL; +} diff --git a/xserver/hw/xwayland/xwayland.c b/xserver/hw/xwayland/xwayland.c new file mode 100644 index 000000000..17b7bf7fd --- /dev/null +++ b/xserver/hw/xwayland/xwayland.c @@ -0,0 +1,684 @@ +/* + * Copyright © 2011-2014 Intel Corporation + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of the + * copyright holders not be used in advertising or publicity + * pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied + * warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS + * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN + * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING + * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +#include "xwayland.h" + +#include <stdio.h> + +#include <selection.h> +#include <micmap.h> +#include <misyncshm.h> +#include <compositeext.h> +#include <glx_extinit.h> + +void +ddxGiveUp(enum ExitCode error) +{ +} + +void +AbortDDX(enum ExitCode error) +{ + ddxGiveUp(error); +} + +void +OsVendorInit(void) +{ +} + +void +OsVendorFatalError(const char *f, va_list args) +{ +} + +#if defined(DDXBEFORERESET) +void +ddxBeforeReset(void) +{ + return; +} +#endif + +void +ddxUseMsg(void) +{ + ErrorF("-rootless run rootless, requires wm support\n"); + ErrorF("-wm fd create X client for wm on given fd\n"); + ErrorF("-listen fd add give fd as a listen socket\n"); +} + +int +ddxProcessArgument(int argc, char *argv[], int i) +{ + if (strcmp(argv[i], "-rootless") == 0) { + return 1; + } + else if (strcmp(argv[i], "-listen") == 0) { + NoListenAll = TRUE; + return 2; + } + else if (strcmp(argv[i], "-wm") == 0) { + return 2; + } + else if (strcmp(argv[i], "-shm") == 0) { + return 1; + } + + return 0; +} + +static DevPrivateKeyRec xwl_window_private_key; +static DevPrivateKeyRec xwl_screen_private_key; +static DevPrivateKeyRec xwl_pixmap_private_key; + +struct xwl_screen * +xwl_screen_get(ScreenPtr screen) +{ + return dixLookupPrivate(&screen->devPrivates, &xwl_screen_private_key); +} + +static Bool +xwl_close_screen(ScreenPtr screen) +{ + struct xwl_screen *xwl_screen = xwl_screen_get(screen); + struct xwl_output *xwl_output, *next_xwl_output; + struct xwl_seat *xwl_seat, *next_xwl_seat; + + xorg_list_for_each_entry_safe(xwl_output, next_xwl_output, + &xwl_screen->output_list, link) + xwl_output_destroy(xwl_output); + + xorg_list_for_each_entry_safe(xwl_seat, next_xwl_seat, + &xwl_screen->seat_list, link) + xwl_seat_destroy(xwl_seat); + + wl_display_disconnect(xwl_screen->display); + + screen->CloseScreen = xwl_screen->CloseScreen; + free(xwl_screen); + + return screen->CloseScreen(screen); +} + +static void +damage_report(DamagePtr pDamage, RegionPtr pRegion, void *data) +{ + struct xwl_window *xwl_window = data; + struct xwl_screen *xwl_screen = xwl_window->xwl_screen; + + xorg_list_add(&xwl_window->link_damage, &xwl_screen->damage_window_list); +} + +static void +damage_destroy(DamagePtr pDamage, void *data) +{ +} + +static void +shell_surface_ping(void *data, + struct wl_shell_surface *shell_surface, uint32_t serial) +{ + wl_shell_surface_pong(shell_surface, serial); +} + +static void +shell_surface_configure(void *data, + struct wl_shell_surface *wl_shell_surface, + uint32_t edges, int32_t width, int32_t height) +{ +} + +static void +shell_surface_popup_done(void *data, struct wl_shell_surface *wl_shell_surface) +{ +} + +static const struct wl_shell_surface_listener shell_surface_listener = { + shell_surface_ping, + shell_surface_configure, + shell_surface_popup_done +}; + +void +xwl_pixmap_set_private(PixmapPtr pixmap, struct xwl_pixmap *xwl_pixmap) +{ + dixSetPrivate(&pixmap->devPrivates, &xwl_pixmap_private_key, xwl_pixmap); +} + +struct xwl_pixmap * +xwl_pixmap_get(PixmapPtr pixmap) +{ + return dixLookupPrivate(&pixmap->devPrivates, &xwl_pixmap_private_key); +} + +static void +send_surface_id_event(struct xwl_window *xwl_window) +{ + static const char atom_name[] = "WL_SURFACE_ID"; + static Atom type_atom; + DeviceIntPtr dev; + xEvent e; + + if (type_atom == None) + type_atom = MakeAtom(atom_name, strlen(atom_name), TRUE); + + e.u.u.type = ClientMessage; + e.u.u.detail = 32; + e.u.clientMessage.window = xwl_window->window->drawable.id; + e.u.clientMessage.u.l.type = type_atom; + e.u.clientMessage.u.l.longs0 = + wl_proxy_get_id((struct wl_proxy *) xwl_window->surface); + e.u.clientMessage.u.l.longs1 = 0; + e.u.clientMessage.u.l.longs2 = 0; + e.u.clientMessage.u.l.longs3 = 0; + e.u.clientMessage.u.l.longs4 = 0; + + dev = PickPointer(serverClient); + DeliverEventsToWindow(dev, xwl_window->xwl_screen->screen->root, + &e, 1, SubstructureRedirectMask, NullGrab); +} + +static Bool +xwl_realize_window(WindowPtr window) +{ + ScreenPtr screen = window->drawable.pScreen; + struct xwl_screen *xwl_screen; + struct xwl_window *xwl_window; + struct wl_region *region; + Bool ret; + + xwl_screen = xwl_screen_get(screen); + + screen->RealizeWindow = xwl_screen->RealizeWindow; + ret = (*screen->RealizeWindow) (window); + xwl_screen->RealizeWindow = screen->RealizeWindow; + screen->RealizeWindow = xwl_realize_window; + + if (xwl_screen->rootless && !window->parent) { + RegionNull(&window->clipList); + RegionNull(&window->borderClip); + RegionNull(&window->winSize); + } + + if (xwl_screen->rootless) { + if (window->redirectDraw != RedirectDrawManual) + return ret; + } + else { + if (window->parent) + return ret; + } + + xwl_window = calloc(sizeof *xwl_window, 1); + xwl_window->xwl_screen = xwl_screen; + xwl_window->window = window; + xwl_window->surface = wl_compositor_create_surface(xwl_screen->compositor); + if (xwl_window->surface == NULL) { + ErrorF("wl_display_create_surface failed\n"); + return FALSE; + } + + if (!xwl_screen->rootless) { + xwl_window->shell_surface = + wl_shell_get_shell_surface(xwl_screen->shell, xwl_window->surface); + wl_shell_surface_add_listener(xwl_window->shell_surface, + &shell_surface_listener, xwl_window); + + wl_shell_surface_set_toplevel(xwl_window->shell_surface); + + region = wl_compositor_create_region(xwl_screen->compositor); + wl_region_add(region, 0, 0, + window->drawable.width, window->drawable.height); + wl_surface_set_opaque_region(xwl_window->surface, region); + wl_region_destroy(region); + } + + wl_display_flush(xwl_screen->display); + + send_surface_id_event(xwl_window); + + wl_surface_set_user_data(xwl_window->surface, xwl_window); + + dixSetPrivate(&window->devPrivates, &xwl_window_private_key, xwl_window); + + xwl_window->damage = + DamageCreate(damage_report, damage_destroy, DamageReportNonEmpty, + FALSE, screen, xwl_window); + DamageRegister(&window->drawable, xwl_window->damage); + DamageSetReportAfterOp(xwl_window->damage, TRUE); + + xorg_list_init(&xwl_window->link_damage); + + return ret; +} + +static Bool +xwl_unrealize_window(WindowPtr window) +{ + ScreenPtr screen = window->drawable.pScreen; + struct xwl_screen *xwl_screen; + struct xwl_window *xwl_window; + struct xwl_seat *xwl_seat; + Bool ret; + + xwl_screen = xwl_screen_get(screen); + + xorg_list_for_each_entry(xwl_seat, &xwl_screen->seat_list, link) { + if (!xwl_seat->focus_window) + continue; + if (xwl_seat->focus_window->window == window) + xwl_seat->focus_window = NULL; + } + + screen->UnrealizeWindow = xwl_screen->UnrealizeWindow; + ret = (*screen->UnrealizeWindow) (window); + xwl_screen->UnrealizeWindow = screen->UnrealizeWindow; + screen->UnrealizeWindow = xwl_unrealize_window; + + xwl_window = + dixLookupPrivate(&window->devPrivates, &xwl_window_private_key); + if (!xwl_window) + return ret; + + wl_surface_destroy(xwl_window->surface); + if (RegionNotEmpty(DamageRegion(xwl_window->damage))) + xorg_list_del(&xwl_window->link_damage); + DamageUnregister(xwl_window->damage); + DamageDestroy(xwl_window->damage); + free(xwl_window); + dixSetPrivate(&window->devPrivates, &xwl_window_private_key, NULL); + + return ret; +} + +static Bool +xwl_save_screen(ScreenPtr pScreen, int on) +{ + return TRUE; +} + +static void +xwl_screen_post_damage(struct xwl_screen *xwl_screen) +{ + struct xwl_window *xwl_window; + RegionPtr region; + BoxPtr box; + int count, i; + struct wl_buffer *buffer; + PixmapPtr pixmap; + + xorg_list_for_each_entry(xwl_window, &xwl_screen->damage_window_list, + link_damage) { + region = DamageRegion(xwl_window->damage); + count = RegionNumRects(region); + + pixmap = (*xwl_screen->screen->GetWindowPixmap) (xwl_window->window); + +#if GLAMOR_HAS_GBM + if (xwl_screen->glamor) + buffer = xwl_glamor_pixmap_get_wl_buffer(pixmap); +#endif + if (!xwl_screen->glamor) + buffer = xwl_shm_pixmap_get_wl_buffer(pixmap); + + wl_surface_attach(xwl_window->surface, buffer, 0, 0); + for (i = 0; i < count; i++) { + box = &RegionRects(region)[i]; + wl_surface_damage(xwl_window->surface, + box->x1, box->y1, + box->x2 - box->x1, box->y2 - box->y1); + } + wl_surface_commit(xwl_window->surface); + DamageEmpty(xwl_window->damage); + } + + xorg_list_init(&xwl_screen->damage_window_list); +} + +static void +registry_global(void *data, struct wl_registry *registry, uint32_t id, + const char *interface, uint32_t version) +{ + struct xwl_screen *xwl_screen = data; + + if (strcmp(interface, "wl_compositor") == 0) { + xwl_screen->compositor = + wl_registry_bind(registry, id, &wl_compositor_interface, 1); + } + else if (strcmp(interface, "wl_shm") == 0) { + xwl_screen->shm = wl_registry_bind(registry, id, &wl_shm_interface, 1); + } + else if (strcmp(interface, "wl_shell") == 0) { + xwl_screen->shell = + wl_registry_bind(registry, id, &wl_shell_interface, 1); + } + else if (strcmp(interface, "wl_output") == 0 && version >= 2) { + xwl_output_create(xwl_screen, id); + xwl_screen->expecting_event++; + } +#ifdef GLAMOR_HAS_GBM + else if (xwl_screen->glamor && + strcmp(interface, "wl_drm") == 0 && version >= 2) { + xwl_screen_init_glamor(xwl_screen, id, version); + } +#endif +} + +static void +global_remove(void *data, struct wl_registry *registry, uint32_t name) +{ + /* Nothing to do here, wl_compositor and wl_shm should not be removed */ +} + +static const struct wl_registry_listener registry_listener = { + registry_global, + global_remove +}; + +static void +wakeup_handler(void *data, int err, void *read_mask) +{ + struct xwl_screen *xwl_screen = data; + int ret; + + if (err < 0) + return; + + if (!FD_ISSET(xwl_screen->wayland_fd, (fd_set *) read_mask)) + return; + + ret = wl_display_read_events(xwl_screen->display); + if (ret == -1) + FatalError("failed to dispatch Wayland events: %s\n", strerror(errno)); + + xwl_screen->prepare_read = 0; + + ret = wl_display_dispatch_pending(xwl_screen->display); + if (ret == -1) + FatalError("failed to dispatch Wayland events: %s\n", strerror(errno)); +} + +static void +block_handler(void *data, struct timeval **tv, void *read_mask) +{ + struct xwl_screen *xwl_screen = data; + int ret; + + xwl_screen_post_damage(xwl_screen); + + while (xwl_screen->prepare_read == 0 && + wl_display_prepare_read(xwl_screen->display) == -1) { + ret = wl_display_dispatch_pending(xwl_screen->display); + if (ret == -1) + FatalError("failed to dispatch Wayland events: %s\n", + strerror(errno)); + } + + xwl_screen->prepare_read = 1; + + ret = wl_display_flush(xwl_screen->display); + if (ret == -1) + FatalError("failed to write to XWayland fd: %s\n", strerror(errno)); +} + +static CARD32 +add_client_fd(OsTimerPtr timer, CARD32 time, void *arg) +{ + struct xwl_screen *xwl_screen = arg; + + if (!AddClientOnOpenFD(xwl_screen->wm_fd)) + FatalError("Failed to add wm client\n"); + + TimerFree(timer); + + return 0; +} + +static void +listen_on_fds(struct xwl_screen *xwl_screen) +{ + int i; + + for (i = 0; i < xwl_screen->listen_fd_count; i++) + ListenOnOpenFD(xwl_screen->listen_fds[i], TRUE); +} + +static void +wm_selection_callback(CallbackListPtr *p, void *data, void *arg) +{ + SelectionInfoRec *info = arg; + struct xwl_screen *xwl_screen = data; + static const char atom_name[] = "WM_S0"; + static Atom atom_wm_s0; + + if (atom_wm_s0 == None) + atom_wm_s0 = MakeAtom(atom_name, strlen(atom_name), TRUE); + if (info->selection->selection != atom_wm_s0 || + info->kind != SelectionSetOwner) + return; + + listen_on_fds(xwl_screen); + + DeleteCallback(&SelectionCallback, wm_selection_callback, xwl_screen); +} + +static Bool +xwl_screen_init(ScreenPtr pScreen, int argc, char **argv) +{ + struct xwl_screen *xwl_screen; + Pixel red_mask, blue_mask, green_mask; + int ret, bpc, green_bpc, i; + + xwl_screen = calloc(sizeof *xwl_screen, 1); + xwl_screen->wm_fd = -1; + if (xwl_screen == NULL) + return FALSE; + + if (!dixRegisterPrivateKey(&xwl_screen_private_key, PRIVATE_SCREEN, 0)) + return FALSE; + if (!dixRegisterPrivateKey(&xwl_window_private_key, PRIVATE_WINDOW, 0)) + return FALSE; + if (!dixRegisterPrivateKey(&xwl_pixmap_private_key, PRIVATE_PIXMAP, 0)) + return FALSE; + + dixSetPrivate(&pScreen->devPrivates, &xwl_screen_private_key, xwl_screen); + xwl_screen->screen = pScreen; + +#ifdef GLAMOR_HAS_GBM + xwl_screen->glamor = 1; +#endif + + for (i = 1; i < argc; i++) { + if (strcmp(argv[i], "-rootless") == 0) { + xwl_screen->rootless = 1; + } + else if (strcmp(argv[i], "-wm") == 0) { + xwl_screen->wm_fd = atoi(argv[i + 1]); + i++; + TimerSet(NULL, 0, 1, add_client_fd, xwl_screen); + } + else if (strcmp(argv[i], "-listen") == 0) { + if (xwl_screen->listen_fd_count == + ARRAY_SIZE(xwl_screen->listen_fds)) + FatalError("Too many -listen arguments given, max is %ld\n", + ARRAY_SIZE(xwl_screen->listen_fds)); + + xwl_screen->listen_fds[xwl_screen->listen_fd_count++] = + atoi(argv[i + 1]); + i++; + } + else if (strcmp(argv[i], "-shm") == 0) { + xwl_screen->glamor = 0; + } + } + + if (xwl_screen->listen_fd_count > 0) { + if (xwl_screen->wm_fd >= 0) + AddCallback(&SelectionCallback, wm_selection_callback, xwl_screen); + else + listen_on_fds(xwl_screen); + } + + xorg_list_init(&xwl_screen->output_list); + xorg_list_init(&xwl_screen->seat_list); + xorg_list_init(&xwl_screen->damage_window_list); + xwl_screen->depth = 24; + + xwl_screen->display = wl_display_connect(NULL); + if (xwl_screen->display == NULL) { + ErrorF("could not connect to wayland server\n"); + return FALSE; + } + + if (!xwl_screen_init_output(xwl_screen)) + return FALSE; + + xwl_screen->expecting_event = 0; + xwl_screen->registry = wl_display_get_registry(xwl_screen->display); + wl_registry_add_listener(xwl_screen->registry, + ®istry_listener, xwl_screen); + ret = wl_display_roundtrip(xwl_screen->display); + if (ret == -1) { + ErrorF("could not connect to wayland server\n"); + return FALSE; + } + + while (xwl_screen->expecting_event > 0) + wl_display_roundtrip(xwl_screen->display); + + bpc = xwl_screen->depth / 3; + green_bpc = xwl_screen->depth - 2 * bpc; + blue_mask = (1 << bpc) - 1; + green_mask = ((1 << green_bpc) - 1) << bpc; + red_mask = blue_mask << (green_bpc + bpc); + + miSetVisualTypesAndMasks(xwl_screen->depth, + ((1 << TrueColor) | (1 << DirectColor)), + green_bpc, TrueColor, + red_mask, green_mask, blue_mask); + + miSetPixmapDepths(); + + ret = fbScreenInit(pScreen, NULL, + xwl_screen->width, xwl_screen->height, + 96, 96, 0, + BitsPerPixel(xwl_screen->depth)); + if (!ret) + return FALSE; + + fbPictureInit(pScreen, 0, 0); + +#ifdef HAVE_XSHMFENCE + if (!miSyncShmScreenInit(pScreen)) + return FALSE; +#endif + + xwl_screen->wayland_fd = wl_display_get_fd(xwl_screen->display); + AddGeneralSocket(xwl_screen->wayland_fd); + RegisterBlockAndWakeupHandlers(block_handler, wakeup_handler, xwl_screen); + + pScreen->SaveScreen = xwl_save_screen; + + pScreen->blackPixel = 0; + pScreen->whitePixel = 1; + + ret = fbCreateDefColormap(pScreen); + + if (!xwl_screen_init_cursor(xwl_screen)) + return FALSE; + +#ifdef GLAMOR_HAS_GBM + if (xwl_screen->glamor && !xwl_glamor_init(xwl_screen)) { + ErrorF("Failed to initialize glamor, falling back to sw\n"); + xwl_screen->glamor = 0; + } +#endif + + if (!xwl_screen->glamor) { + xwl_screen->CreateScreenResources = pScreen->CreateScreenResources; + pScreen->CreateScreenResources = xwl_shm_create_screen_resources; + pScreen->CreatePixmap = xwl_shm_create_pixmap; + pScreen->DestroyPixmap = xwl_shm_destroy_pixmap; + } + + xwl_screen->RealizeWindow = pScreen->RealizeWindow; + pScreen->RealizeWindow = xwl_realize_window; + + xwl_screen->UnrealizeWindow = pScreen->UnrealizeWindow; + pScreen->UnrealizeWindow = xwl_unrealize_window; + + xwl_screen->CloseScreen = pScreen->CloseScreen; + pScreen->CloseScreen = xwl_close_screen; + + return ret; +} + +static void _X_ATTRIBUTE_PRINTF(1, 0) +xwl_log_handler(const char *format, va_list args) +{ + char msg[256]; + + vsnprintf(msg, sizeof msg, format, args); + FatalError("%s", msg); +} + +static const ExtensionModule xwayland_extensions[] = { +#ifdef GLXEXT + { GlxExtensionInit, "GLX", &noGlxExtension }, +#endif +}; + +void +InitOutput(ScreenInfo * screen_info, int argc, char **argv) +{ + int depths[] = { 1, 4, 8, 15, 16, 24, 32 }; + int bpp[] = { 1, 8, 8, 16, 16, 32, 32 }; + int i; + + for (i = 0; i < ARRAY_SIZE(depths); i++) { + screen_info->formats[i].depth = depths[i]; + screen_info->formats[i].bitsPerPixel = bpp[i]; + screen_info->formats[i].scanlinePad = BITMAP_SCANLINE_PAD; + } + + screen_info->imageByteOrder = IMAGE_BYTE_ORDER; + screen_info->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT; + screen_info->bitmapScanlinePad = BITMAP_SCANLINE_PAD; + screen_info->bitmapBitOrder = BITMAP_BIT_ORDER; + screen_info->numPixmapFormats = ARRAY_SIZE(depths); + + LoadExtensionList(xwayland_extensions, + ARRAY_SIZE(xwayland_extensions), FALSE); + + /* Cast away warning from missing printf annotation for + * wl_log_func_t. Wayland 1.5 will have the annotation, so we can + * remove the cast and require that when it's released. */ + wl_log_set_handler_client((void *) xwl_log_handler); + + if (AddScreen(xwl_screen_init, argc, argv) == -1) { + FatalError("Couldn't add screen\n"); + } +} diff --git a/xserver/hw/xwayland/xwayland.h b/xserver/hw/xwayland/xwayland.h new file mode 100644 index 000000000..fc6855044 --- /dev/null +++ b/xserver/hw/xwayland/xwayland.h @@ -0,0 +1,181 @@ +/* + * Copyright © 2014 Intel Corporation + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of the + * copyright holders not be used in advertising or publicity + * pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied + * warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS + * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN + * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING + * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +#ifndef XWAYLAND_H +#define XWAYLAND_H + +#include <dix-config.h> +#include <xorg-server.h> + +#include <stdio.h> +#include <unistd.h> +#include <errno.h> + +#include <wayland-client.h> + +#include <X11/X.h> + +#include <fb.h> +#include <input.h> +#include <dix.h> +#include <randrstr.h> +#include <exevents.h> + +struct xwl_screen { + int width; + int height; + int depth; + ScreenPtr screen; + WindowPtr pointer_limbo_window; + int expecting_event; + + int wm_fd; + int listen_fds[5]; + int listen_fd_count; + int rootless; + int glamor; + + CreateScreenResourcesProcPtr CreateScreenResources; + CloseScreenProcPtr CloseScreen; + CreateWindowProcPtr CreateWindow; + DestroyWindowProcPtr DestroyWindow; + RealizeWindowProcPtr RealizeWindow; + UnrealizeWindowProcPtr UnrealizeWindow; + XYToWindowProcPtr XYToWindow; + + struct xorg_list output_list; + struct xorg_list seat_list; + struct xorg_list damage_window_list; + + int wayland_fd; + struct wl_display *display; + struct wl_registry *registry; + struct wl_registry *input_registry; + struct wl_compositor *compositor; + struct wl_shm *shm; + struct wl_shell *shell; + + uint32_t serial; + +#define XWL_FORMAT_ARGB8888 (1 << 0) +#define XWL_FORMAT_XRGB8888 (1 << 1) +#define XWL_FORMAT_RGB565 (1 << 2) + + int prepare_read; + + char *device_name; + int drm_fd; + int fd_render_node; + struct wl_drm *drm; + uint32_t formats; + uint32_t capabilities; + void *egl_display, *egl_context; + struct gbm_device *gbm; + struct glamor_context *glamor_ctx; +}; + +struct xwl_window { + struct xwl_screen *xwl_screen; + struct wl_surface *surface; + struct wl_shell_surface *shell_surface; + WindowPtr window; + DamagePtr damage; + struct xorg_list link_damage; +}; + +#define MODIFIER_META 0x01 + +struct xwl_seat { + DeviceIntPtr pointer; + DeviceIntPtr keyboard; + struct xwl_screen *xwl_screen; + struct wl_seat *seat; + struct wl_pointer *wl_pointer; + struct wl_keyboard *wl_keyboard; + struct wl_array keys; + struct wl_surface *cursor; + struct xwl_window *focus_window; + uint32_t id; + uint32_t pointer_enter_serial; + struct xorg_list link; + CursorPtr x_cursor; + + wl_fixed_t horizontal_scroll; + wl_fixed_t vertical_scroll; + uint32_t scroll_time; + + size_t keymap_size; + char *keymap; + struct wl_surface *keyboard_focus; +}; + +struct xwl_output { + struct xorg_list link; + struct wl_output *output; + struct xwl_screen *xwl_screen; + RROutputPtr randr_output; + RRCrtcPtr randr_crtc; + int32_t x, y, width, height; + Rotation rotation; +}; + +struct xwl_pixmap; + +Bool xwl_screen_init_cursor(struct xwl_screen *xwl_screen); + +struct xwl_screen *xwl_screen_get(ScreenPtr screen); + +void xwl_seat_set_cursor(struct xwl_seat *xwl_seat); + +void xwl_seat_destroy(struct xwl_seat *xwl_seat); + +Bool xwl_screen_init_output(struct xwl_screen *xwl_screen); + +struct xwl_output *xwl_output_create(struct xwl_screen *xwl_screen, + uint32_t id); + +void xwl_output_destroy(struct xwl_output *xwl_output); + +RRModePtr xwayland_cvt(int HDisplay, int VDisplay, + float VRefresh, Bool Reduced, Bool Interlaced); + +void xwl_pixmap_set_private(PixmapPtr pixmap, struct xwl_pixmap *xwl_pixmap); +struct xwl_pixmap *xwl_pixmap_get(PixmapPtr pixmap); + + +Bool xwl_shm_create_screen_resources(ScreenPtr screen); +PixmapPtr xwl_shm_create_pixmap(ScreenPtr screen, int width, int height, + int depth, unsigned int hint); +Bool xwl_shm_destroy_pixmap(PixmapPtr pixmap); +struct wl_buffer *xwl_shm_pixmap_get_wl_buffer(PixmapPtr pixmap); + + +Bool xwl_glamor_init(struct xwl_screen *xwl_screen); + +Bool xwl_screen_init_glamor(struct xwl_screen *xwl_screen, + uint32_t id, uint32_t version); +struct wl_buffer *xwl_glamor_pixmap_get_wl_buffer(PixmapPtr pixmap); + +#endif diff --git a/xserver/hw/xwin/InitInput.c b/xserver/hw/xwin/InitInput.c index 36346b7e1..38203c906 100644 --- a/xserver/hw/xwin/InitInput.c +++ b/xserver/hw/xwin/InitInput.c @@ -108,10 +108,11 @@ InitInput(int argc, char *argv[]) } #endif - g_pwinPointer = AddInputDevice(serverClient, winMouseProc, TRUE); - g_pwinKeyboard = AddInputDevice(serverClient, winKeybdProc, TRUE); - g_pwinPointer->name = strdup("Windows mouse"); - g_pwinKeyboard->name = strdup("Windows keyboard"); + if (AllocDevicePair(serverClient, "Windows", + &g_pwinPointer, &g_pwinKeyboard, + winMouseProc, winKeybdProc, + FALSE) != Success) + FatalError("InitInput - Failed to allocate slave devices.\n"); mieqInit(); diff --git a/xserver/hw/xwin/InitOutput.c b/xserver/hw/xwin/InitOutput.c index b05ca2736..6b5c38d92 100644 --- a/xserver/hw/xwin/InitOutput.c +++ b/xserver/hw/xwin/InitOutput.c @@ -58,8 +58,11 @@ typedef WINAPI HRESULT(*SHGETFOLDERPATHPROC) (HWND hwndOwner, HANDLE hToken, DWORD dwFlags, LPTSTR pszPath); #endif - #include "glx_extinit.h" +#ifdef XWIN_GLX_WINDOWS +#include "glx/glwindows.h" +#endif + /* * References to external symbols */ @@ -160,8 +163,6 @@ static const ExtensionModule xwinExtensions[] = { static void XwinExtensionInit(void) { - int i; - #ifdef XWIN_GLX_WINDOWS if (g_fNativeGl) { /* install the native GL provider */ @@ -169,8 +170,7 @@ void XwinExtensionInit(void) } #endif - for (i = 0; i < ARRAY_SIZE(xwinExtensions); i++) - LoadExtension(&xwinExtensions[i], TRUE); + LoadExtensionList(xwinExtensions, ARRAY_SIZE(xwinExtensions), TRUE); } #if defined(DDXBEFORERESET) @@ -268,10 +268,10 @@ ddxGiveUp(enum ExitCode error) PostQuitMessage(0); { - winDebug("ddxGiveUp - Releasing termination mutex\n"); - int iReturn = pthread_mutex_unlock(&g_pmTerminating); + winDebug("ddxGiveUp - Releasing termination mutex\n"); + if (iReturn != 0) { ErrorF("winMsgWindowProc - pthread_mutex_unlock () failed: %d\n", iReturn); @@ -783,6 +783,9 @@ winUseMsg(void) ErrorF("-fullscreen\n" "\tRun the server in fullscreen mode.\n"); + ErrorF("-hostintitle\n" + "\tIn multiwindow mode, add remote host names to window titles.\n"); + ErrorF("-ignoreinput\n" "\tIgnore keyboard and mouse input.\n"); #ifdef XWIN_MULTIWINDOWEXTWM diff --git a/xserver/hw/xwin/Makefile.am b/xserver/hw/xwin/Makefile.am index 7f0eaf097..4ee963227 100644 --- a/xserver/hw/xwin/Makefile.am +++ b/xserver/hw/xwin/Makefile.am @@ -127,10 +127,7 @@ SRCS = InitInput.c \ winresource.h \ winwindow.h \ XWin.rc \ - $(top_srcdir)/Xext/dpmsstubs.c \ - $(top_srcdir)/Xi/stubs.c \ $(top_srcdir)/mi/miinitext.c \ - $(top_srcdir)/fb/fbcmap_mi.c \ $(SRCS_CLIPBOARD) \ $(SRCS_MULTIWINDOW) \ $(SRCS_MULTIWINDOWEXTWM) \ @@ -153,11 +150,13 @@ XWin_SOURCES = $(SRCS) AM_CPPFLAGS = -I$(top_srcdir)/miext/rootless XWIN_SYS_LIBS += -ldxguid -XWIN_LIBS += $(top_builddir)/pseudoramiX/libPseudoramiX.la - +XWIN_LIBS += $(top_builddir)/pseudoramiX/libPseudoramiX.la \ + $(top_builddir)/Xext/libXextdpmsstubs.la \ + $(top_builddir)/Xi/libXistubs.la XWin_DEPENDENCIES = $(MULTIWINDOWEXTWM_LIBS) $(XWIN_GLX_LIBS) $(XWIN_LIBS) $(XSERVER_LIBS) XWin_LDADD = $(MULTIWINDOW_LIBS) $(MULTIWINDOWEXTWM_LIBS) $(XWIN_GLX_LIBS) $(XWIN_GLX_LINK_FLAGS) $(XWIN_LIBS) $(MAIN_LIB) $(XSERVER_LIBS) $(XSERVER_SYS_LIBS) $(XWIN_SYS_LIBS) -XWin_LDFLAGS = -mwindows -static -Wl,--disable-stdcall-fixup +XWin_LDFLAGS = -mwindows -Wl,--disable-stdcall-fixup $(LD_EXPORT_SYMBOLS_FLAG) + .rc.o: $(AM_V_GEN)$(WINDRES) --use-temp-file -i $< --input-format=rc -o $@ -O coff -I $(top_builddir)/include diff --git a/xserver/hw/xwin/Makefile.in b/xserver/hw/xwin/Makefile.in index e385e9741..65c8a9605 100644 --- a/xserver/hw/xwin/Makefile.in +++ b/xserver/hw/xwin/Makefile.in @@ -89,9 +89,7 @@ am__XWin_SOURCES_DIST = InitInput.c InitOutput.c winallpriv.c \ winconfig.h win.h winglobals.h winkeybd.h winkeynames.h \ winlayouts.h winmessages.h winmonitors.h winmsg.h winms.h \ winmultiwindowclass.h winmultiwindowicons.h winprefs.h \ - winresource.h winwindow.h XWin.rc \ - $(top_srcdir)/Xext/dpmsstubs.c $(top_srcdir)/Xi/stubs.c \ - $(top_srcdir)/mi/miinitext.c $(top_srcdir)/fb/fbcmap_mi.c \ + winresource.h winwindow.h XWin.rc $(top_srcdir)/mi/miinitext.c \ winclipboardinit.c winclipboardtextconv.c winclipboardthread.c \ winclipboardwndproc.c winclipboardwrappers.c \ winclipboardxevents.c winmultiwindowshape.c \ @@ -141,14 +139,15 @@ am__objects_8 = InitInput.$(OBJEXT) InitOutput.$(OBJEXT) \ winshadgdi.$(OBJEXT) wintaskbar.$(OBJEXT) \ wintrayicon.$(OBJEXT) winvalargs.$(OBJEXT) winwakeup.$(OBJEXT) \ winwindow.$(OBJEXT) winwndproc.$(OBJEXT) XWin.$(OBJEXT) \ - dpmsstubs.$(OBJEXT) stubs.$(OBJEXT) miinitext.$(OBJEXT) \ - fbcmap_mi.$(OBJEXT) $(am__objects_1) $(am__objects_2) \ + miinitext.$(OBJEXT) $(am__objects_1) $(am__objects_2) \ $(am__objects_3) $(am__objects_4) $(am__objects_5) \ $(am__objects_6) $(am__objects_7) am_XWin_OBJECTS = $(am__objects_8) XWin_OBJECTS = $(am_XWin_OBJECTS) am__DEPENDENCIES_1 = -am__DEPENDENCIES_2 = $(top_builddir)/pseudoramiX/libPseudoramiX.la +am__DEPENDENCIES_2 = $(top_builddir)/pseudoramiX/libPseudoramiX.la \ + $(top_builddir)/Xext/libXextdpmsstubs.la \ + $(top_builddir)/Xi/libXistubs.la AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent @@ -320,6 +319,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = $(DEFS_CLIPBOARD) \ $(DEFS_GLX_WINDOWS) \ $(DEFS_MULTIWINDOW) \ @@ -372,6 +373,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -474,7 +479,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -483,6 +491,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -549,9 +558,15 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ -XWIN_LIBS = @XWIN_LIBS@ $(top_builddir)/pseudoramiX/libPseudoramiX.la +XWIN_LIBS = @XWIN_LIBS@ $(top_builddir)/pseudoramiX/libPseudoramiX.la \ + $(top_builddir)/Xext/libXextdpmsstubs.la \ + $(top_builddir)/Xi/libXistubs.la XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ -ldxguid YACC = @YACC@ @@ -731,10 +746,7 @@ SRCS = InitInput.c \ winresource.h \ winwindow.h \ XWin.rc \ - $(top_srcdir)/Xext/dpmsstubs.c \ - $(top_srcdir)/Xi/stubs.c \ $(top_srcdir)/mi/miinitext.c \ - $(top_srcdir)/fb/fbcmap_mi.c \ $(SRCS_CLIPBOARD) \ $(SRCS_MULTIWINDOW) \ $(SRCS_MULTIWINDOWEXTWM) \ @@ -747,7 +759,7 @@ XWin_SOURCES = $(SRCS) AM_CPPFLAGS = -I$(top_srcdir)/miext/rootless XWin_DEPENDENCIES = $(MULTIWINDOWEXTWM_LIBS) $(XWIN_GLX_LIBS) $(XWIN_LIBS) $(XSERVER_LIBS) XWin_LDADD = $(MULTIWINDOW_LIBS) $(MULTIWINDOWEXTWM_LIBS) $(XWIN_GLX_LIBS) $(XWIN_GLX_LINK_FLAGS) $(XWIN_LIBS) $(MAIN_LIB) $(XSERVER_LIBS) $(XSERVER_SYS_LIBS) $(XWIN_SYS_LIBS) -XWin_LDFLAGS = -mwindows -static -Wl,--disable-stdcall-fixup +XWin_LDFLAGS = -mwindows -Wl,--disable-stdcall-fixup $(LD_EXPORT_SYMBOLS_FLAG) BUILT_SOURCES = winprefsyacc.h winprefsyacc.c winprefslex.c CLEANFILES = $(BUILT_SOURCES) AM_YFLAGS = -d @@ -860,10 +872,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/InitInput.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/InitOutput.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dpmsstubs.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fbcmap_mi.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/miinitext.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stubs.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winSetAppUserModelID.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winallpriv.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winauth.Po@am__quote@ @@ -948,34 +957,6 @@ distclean-compile: @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< -dpmsstubs.o: $(top_srcdir)/Xext/dpmsstubs.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dpmsstubs.o -MD -MP -MF $(DEPDIR)/dpmsstubs.Tpo -c -o dpmsstubs.o `test -f '$(top_srcdir)/Xext/dpmsstubs.c' || echo '$(srcdir)/'`$(top_srcdir)/Xext/dpmsstubs.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/dpmsstubs.Tpo $(DEPDIR)/dpmsstubs.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/Xext/dpmsstubs.c' object='dpmsstubs.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dpmsstubs.o `test -f '$(top_srcdir)/Xext/dpmsstubs.c' || echo '$(srcdir)/'`$(top_srcdir)/Xext/dpmsstubs.c - -dpmsstubs.obj: $(top_srcdir)/Xext/dpmsstubs.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dpmsstubs.obj -MD -MP -MF $(DEPDIR)/dpmsstubs.Tpo -c -o dpmsstubs.obj `if test -f '$(top_srcdir)/Xext/dpmsstubs.c'; then $(CYGPATH_W) '$(top_srcdir)/Xext/dpmsstubs.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/Xext/dpmsstubs.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/dpmsstubs.Tpo $(DEPDIR)/dpmsstubs.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/Xext/dpmsstubs.c' object='dpmsstubs.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dpmsstubs.obj `if test -f '$(top_srcdir)/Xext/dpmsstubs.c'; then $(CYGPATH_W) '$(top_srcdir)/Xext/dpmsstubs.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/Xext/dpmsstubs.c'; fi` - -stubs.o: $(top_srcdir)/Xi/stubs.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT stubs.o -MD -MP -MF $(DEPDIR)/stubs.Tpo -c -o stubs.o `test -f '$(top_srcdir)/Xi/stubs.c' || echo '$(srcdir)/'`$(top_srcdir)/Xi/stubs.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/stubs.Tpo $(DEPDIR)/stubs.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/Xi/stubs.c' object='stubs.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o stubs.o `test -f '$(top_srcdir)/Xi/stubs.c' || echo '$(srcdir)/'`$(top_srcdir)/Xi/stubs.c - -stubs.obj: $(top_srcdir)/Xi/stubs.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT stubs.obj -MD -MP -MF $(DEPDIR)/stubs.Tpo -c -o stubs.obj `if test -f '$(top_srcdir)/Xi/stubs.c'; then $(CYGPATH_W) '$(top_srcdir)/Xi/stubs.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/Xi/stubs.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/stubs.Tpo $(DEPDIR)/stubs.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/Xi/stubs.c' object='stubs.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o stubs.obj `if test -f '$(top_srcdir)/Xi/stubs.c'; then $(CYGPATH_W) '$(top_srcdir)/Xi/stubs.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/Xi/stubs.c'; fi` - miinitext.o: $(top_srcdir)/mi/miinitext.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT miinitext.o -MD -MP -MF $(DEPDIR)/miinitext.Tpo -c -o miinitext.o `test -f '$(top_srcdir)/mi/miinitext.c' || echo '$(srcdir)/'`$(top_srcdir)/mi/miinitext.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/miinitext.Tpo $(DEPDIR)/miinitext.Po @@ -990,20 +971,6 @@ miinitext.obj: $(top_srcdir)/mi/miinitext.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o miinitext.obj `if test -f '$(top_srcdir)/mi/miinitext.c'; then $(CYGPATH_W) '$(top_srcdir)/mi/miinitext.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/mi/miinitext.c'; fi` -fbcmap_mi.o: $(top_srcdir)/fb/fbcmap_mi.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT fbcmap_mi.o -MD -MP -MF $(DEPDIR)/fbcmap_mi.Tpo -c -o fbcmap_mi.o `test -f '$(top_srcdir)/fb/fbcmap_mi.c' || echo '$(srcdir)/'`$(top_srcdir)/fb/fbcmap_mi.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fbcmap_mi.Tpo $(DEPDIR)/fbcmap_mi.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/fb/fbcmap_mi.c' object='fbcmap_mi.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o fbcmap_mi.o `test -f '$(top_srcdir)/fb/fbcmap_mi.c' || echo '$(srcdir)/'`$(top_srcdir)/fb/fbcmap_mi.c - -fbcmap_mi.obj: $(top_srcdir)/fb/fbcmap_mi.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT fbcmap_mi.obj -MD -MP -MF $(DEPDIR)/fbcmap_mi.Tpo -c -o fbcmap_mi.obj `if test -f '$(top_srcdir)/fb/fbcmap_mi.c'; then $(CYGPATH_W) '$(top_srcdir)/fb/fbcmap_mi.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/fb/fbcmap_mi.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fbcmap_mi.Tpo $(DEPDIR)/fbcmap_mi.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/fb/fbcmap_mi.c' object='fbcmap_mi.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o fbcmap_mi.obj `if test -f '$(top_srcdir)/fb/fbcmap_mi.c'; then $(CYGPATH_W) '$(top_srcdir)/fb/fbcmap_mi.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/fb/fbcmap_mi.c'; fi` - .l.c: $(AM_V_LEX)$(am__skiplex) $(SHELL) $(YLWRAP) $< $(LEX_OUTPUT_ROOT).c $@ -- $(LEXCOMPILE) diff --git a/xserver/hw/xwin/glx/Makefile.in b/xserver/hw/xwin/glx/Makefile.in index 3400aa89a..ceefa104b 100644 --- a/xserver/hw/xwin/glx/Makefile.in +++ b/xserver/hw/xwin/glx/Makefile.in @@ -198,6 +198,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = $(DEFS_MULTIWINDOW) $(DEFS_MULTIWINDOWEXTWM) $(DEFS_GLX_WINDOWS) DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -242,6 +244,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -344,7 +350,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -353,6 +362,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -419,6 +429,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/hw/xwin/glx/gen_gl_wrappers.py b/xserver/hw/xwin/glx/gen_gl_wrappers.py index 683b9d903..cdbba638a 100644 --- a/xserver/hw/xwin/glx/gen_gl_wrappers.py +++ b/xserver/hw/xwin/glx/gen_gl_wrappers.py @@ -43,35 +43,18 @@ thunkdefs=False staticwrappers=False nodebug=False -#exclude base WGL API -WinGDI={key: 1 for key in [ - "wglCopyContext" - ,"wglCreateContext" - ,"wglCreateLayerContext" - ,"wglDeleteContext" - ,"wglGetCurrentContext" - ,"wglGetCurrentDC" - ,"wglGetProcAddress" - ,"wglMakeCurrent" - ,"wglShareLists" - ,"wglUseFontBitmapsA" - ,"wglUseFontBitmapsW" - ,"wglUseFontBitmaps" - ,"SwapBuffers" - ,"wglUseFontOutlinesA" - ,"wglUseFontOutlinesW" - ,"wglUseFontOutlines" - ,"wglDescribeLayerPlane" - ,"wglSetLayerPaletteEntries" - ,"wglGetLayerPaletteEntries" - ,"wglRealizeLayerPalette" - ,"wglSwapLayerBuffers" - ,"wglSwapMultipleBuffers" - ,"ChoosePixelFormat" - ,"DescribePixelFormat" - ,"GetEnhMetaFilePixelFormat" - ,"GetPixelFormat" - ,"SetPixelFormat" +# list of WGL extension functions we use +used_wgl_ext_fns = {key: 1 for key in [ + "wglSwapIntervalEXT", + "wglGetExtensionsStringARB", + "wglDestroyPbufferARB", + "wglGetPbufferDCARB", + "wglReleasePbufferDCARB", + "wglCreatePbufferARB", + "wglMakeContextCurrentARB", + "wglChoosePixelFormatARB", + "wglGetPixelFormatAttribivARB", + "wglGetPixelFormatAttribivARB" ]} if __name__ == '__main__': @@ -162,7 +145,7 @@ class PreResolveOutputGenerator(OutputGenerator): def genCmd(self, cmd, name): OutputGenerator.genCmd(self, cmd, name) - if name in WinGDI: + if prefix == 'wgl' and not name in used_wgl_ext_fns: return self.outFile.write('RESOLVE_DECL(PFN' + name.upper() + 'PROC);\n') @@ -190,7 +173,7 @@ class WrapperOutputGenerator(OutputGenerator): def genCmd(self, cmd, name): OutputGenerator.genCmd(self, cmd, name) - if name in WinGDI: + if prefix == 'wgl' and not name in used_wgl_ext_fns: return proto=noneStr(cmd.elem.find('proto')) diff --git a/xserver/hw/xwin/glx/indirect.c b/xserver/hw/xwin/glx/indirect.c index 3d01bed39..9bfaac03d 100644 --- a/xserver/hw/xwin/glx/indirect.c +++ b/xserver/hw/xwin/glx/indirect.c @@ -832,7 +832,7 @@ glxWinCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc) GLWIN_TRACE_MSG("glxWinCopyWindow pWindow %p", pWindow); - dixLookupResourceByType((pointer) &pGlxDraw, pWindow->drawable.id, + dixLookupResourceByType((void *) &pGlxDraw, pWindow->drawable.id, __glXDrawableRes, NullClient, DixUnknownAccess); /* @@ -929,17 +929,6 @@ glxWinDrawableDestroy(__GLXdrawable * base) { __GLXWinDrawable *glxPriv = (__GLXWinDrawable *) base; - if (glxPriv->drawContext && - (__glXLastContext == &((glxPriv->drawContext)->base))) { - // if this context is current and has unflushed commands, say we have flushed them - // (don't actually flush them, the window is going away anyhow, and an implict flush occurs - // on the next context change) - // (GLX core considers it an error when we try to select a new current context if the old one - // has unflushed commands, but the window has disappeared..) - __glXLastContext->hasUnflushedCommands = FALSE; - __glXLastContext = NULL; - } - if (glxPriv->hPbuffer) if (!wglDestroyPbufferARBWrapper(glxPriv->hPbuffer)) { ErrorF("wglDestroyPbufferARB failed: %s\n", glxWinErrorMessage()); @@ -1542,7 +1531,7 @@ glxWinContextLoseCurrent(__GLXcontext * base) An error seems to be reported if we try to make no context current if there is already no current context, so avoid doing that... */ - if (__glXLastContext != NULL) { + if (wglGetCurrentContext() != NULL) { ret = wglMakeCurrent(NULL, NULL); /* We don't need a DC when setting no current context */ if (!ret) ErrorF("glxWinContextLoseCurrent error: %s\n", @@ -1613,7 +1602,7 @@ glxWinCreateContext(__GLXscreen * screen, glxWinReleaseTexImage }; - context = (__GLXWinContext *) calloc(1, sizeof(__GLXWinContext)); + context = calloc(1, sizeof(__GLXWinContext)); if (!context) return NULL; diff --git a/xserver/hw/xwin/man/Makefile.in b/xserver/hw/xwin/man/Makefile.in index 5c5c72c5b..f7f370757 100644 --- a/xserver/hw/xwin/man/Makefile.in +++ b/xserver/hw/xwin/man/Makefile.in @@ -160,6 +160,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -204,6 +206,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -268,6 +274,7 @@ MAN_SUBSTS = @MAN_SUBSTS@ -e 's|__logdir__|$(logdir)|g' -e \ 's|__XKB_DFLT_OPTIONS__|$(XKB_DFLT_OPTIONS)|g' -e \ 's|__bundle_id_prefix__|$(BUNDLE_ID_PREFIX)|g' -e \ 's|__modulepath__|$(DEFAULT_MODULE_PATH)|g' -e \ + 's|__suid_wrapper_dir__|$(SUID_WRAPPER_DIR)|g' -e \ 's|__default_font_path__|$(COMPILEDDEFAULTFONTPATH)|g' -e \ '\|$(COMPILEDDEFAULTFONTPATH)| s|/,|/, |g' MISC_MAN_DIR = @MISC_MAN_DIR@ @@ -322,7 +329,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -331,6 +341,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -397,6 +408,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/hw/xwin/man/XWin.man b/xserver/hw/xwin/man/XWin.man index 18ee667d4..c71f6a154 100644 --- a/xserver/hw/xwin/man/XWin.man +++ b/xserver/hw/xwin/man/XWin.man @@ -165,6 +165,12 @@ The maximum dimensions of the screen are the dimensions of the \fIWindows\fP vir on its own is equivalent to \fB\-resize=randr\fP .RE +.SH OPTIONS FOR MULTIWINDOW MODE +.TP 8 +.B \-hostintitle +Add the host name to the window title for X applications which are running +on remote hosts, when that information is available and it's useful to do so. + .SH OPTIONS CONTROLLING WINDOWS INTEGRATION .TP 8 .B \-[no]clipboard diff --git a/xserver/hw/xwin/win.h b/xserver/hw/xwin/win.h index ce89348fe..a738a5940 100644 --- a/xserver/hw/xwin/win.h +++ b/xserver/hw/xwin/win.h @@ -609,7 +609,7 @@ typedef struct { #endif typedef struct { - pointer value; + void *value; XID id; } WindowIDPairRec, *WindowIDPairPtr; @@ -751,7 +751,7 @@ Bool winAllocatePrivates(ScreenPtr pScreen); Bool - winInitCmapPrivates(ColormapPtr pCmap, int index); + winInitCmapPrivates(ColormapPtr pCmap, int i); Bool winAllocateCmapPrivates(ColormapPtr pCmap); @@ -773,7 +773,7 @@ void winSetAuthorization(void); void winBlockHandler(ScreenPtr pScreen, - pointer pTimeout, pointer pReadMask); + void *pTimeout, void *pReadMask); #ifdef XWIN_NATIVEGDI /* @@ -1035,7 +1035,7 @@ winModifyPixmapHeaderNativeGDI(PixmapPtr pPixmap, int iWidth, int iHeight, int iDepth, int iBitsPerPixel, - int devKind, pointer pPixData); + int devKind, void *pPixData); #endif #ifdef XWIN_NATIVEGDI @@ -1056,12 +1056,12 @@ Bool winScreenInit(ScreenPtr pScreen, int argc, char **argv); Bool - winFinishScreenInitFB(int index, ScreenPtr pScreen, int argc, char **argv); + winFinishScreenInitFB(int i, ScreenPtr pScreen, int argc, char **argv); #if defined(XWIN_NATIVEGDI) Bool -winFinishScreenInitNativeGDI(int index, +winFinishScreenInitNativeGDI(int i, ScreenPtr pScreen, int argc, char **argv); #endif @@ -1106,7 +1106,7 @@ Bool void winWakeupHandler(ScreenPtr pScreen, - unsigned long ulResult, pointer pReadmask); + unsigned long ulResult, void *pReadmask); /* * winwindow.c @@ -1336,9 +1336,6 @@ void winMWExtWMMoveResizeXWindow(WindowPtr pWin, int x, int y, int w, int h); void - winMWExtWMUpdateIcon(Window id); - -void winMWExtWMUpdateWindowDecoration(win32RootlessWindowPtr pRLWinPriv, winScreenInfoPtr pScreenInfo); diff --git a/xserver/hw/xwin/winallpriv.c b/xserver/hw/xwin/winallpriv.c index cc3b3d1ba..629af92c9 100644 --- a/xserver/hw/xwin/winallpriv.c +++ b/xserver/hw/xwin/winallpriv.c @@ -58,7 +58,7 @@ winAllocatePrivates(ScreenPtr pScreen) } /* Allocate memory for the screen private structure */ - pScreenPriv = (winPrivScreenPtr) malloc(sizeof(winPrivScreenRec)); + pScreenPriv = malloc(sizeof(winPrivScreenRec)); if (!pScreenPriv) { ErrorF("winAllocateScreenPrivates - malloc () failed\n"); return FALSE; @@ -150,7 +150,7 @@ winAllocateCmapPrivates(ColormapPtr pCmap) } /* Allocate memory for our private structure */ - pCmapPriv = (winPrivCmapPtr) malloc(sizeof(winPrivCmapRec)); + pCmapPriv = malloc(sizeof(winPrivCmapRec)); if (!pCmapPriv) { ErrorF("winAllocateCmapPrivates - malloc () failed\n"); return FALSE; diff --git a/xserver/hw/xwin/winauth.c b/xserver/hw/xwin/winauth.c index a6a7366a4..7efa1c00f 100644 --- a/xserver/hw/xwin/winauth.c +++ b/xserver/hw/xwin/winauth.c @@ -97,9 +97,9 @@ MitGenerateCookie(unsigned data_length, static XID GenerateAuthorization(unsigned name_length, - char *name, + const char *name, unsigned data_length, - char *data, + const char *data, unsigned *data_length_return, char **data_return) { return MitGenerateCookie(data_length, data, diff --git a/xserver/hw/xwin/winblock.c b/xserver/hw/xwin/winblock.c index c3ef4becd..07e907828 100644 --- a/xserver/hw/xwin/winblock.c +++ b/xserver/hw/xwin/winblock.c @@ -37,7 +37,7 @@ /* See Porting Layer Definition - p. 6 */ void winBlockHandler(ScreenPtr pScreen, - pointer pTimeout, pointer pReadMask) + void *pTimeout, void *pReadMask) { #if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW) winScreenPriv(pScreen); diff --git a/xserver/hw/xwin/winclipboardinit.c b/xserver/hw/xwin/winclipboardinit.c index 304e6df9f..157006dab 100644 --- a/xserver/hw/xwin/winclipboardinit.c +++ b/xserver/hw/xwin/winclipboardinit.c @@ -77,7 +77,7 @@ winInitClipboard(void) } /* - * Create the Windows window that we use to recieve Windows messages + * Create the Windows window that we use to receive Windows messages */ HWND diff --git a/xserver/hw/xwin/winclipboardxevents.c b/xserver/hw/xwin/winclipboardxevents.c index 226c3f055..7d3c30e85 100644 --- a/xserver/hw/xwin/winclipboardxevents.c +++ b/xserver/hw/xwin/winclipboardxevents.c @@ -248,7 +248,7 @@ winClipboardFlushXEvents(HWND hwnd, (LPCWSTR) pszGlobalData, -1, NULL, 0, NULL, NULL); /* NOTE: iConvertDataLen includes space for null terminator */ - pszConvertData = (char *) malloc(iConvertDataLen); + pszConvertData = malloc(iConvertDataLen); WideCharToMultiByte(CP_UTF8, 0, (LPCWSTR) pszGlobalData, @@ -581,8 +581,7 @@ winClipboardFlushXEvents(HWND hwnd, pszReturnData, -1, NULL, 0); /* Allocate memory for the Unicode string */ - pwszUnicodeStr - = (wchar_t *) malloc(sizeof(wchar_t) * (iUnicodeLen + 1)); + pwszUnicodeStr = malloc(sizeof(wchar_t) * (iUnicodeLen + 1)); if (!pwszUnicodeStr) { ErrorF("winClipboardFlushXEvents - SelectionNotify " "malloc failed for pwszUnicodeStr, aborting.\n"); diff --git a/xserver/hw/xwin/wincmap.c b/xserver/hw/xwin/wincmap.c index 610437ad4..5dcc8bceb 100644 --- a/xserver/hw/xwin/wincmap.c +++ b/xserver/hw/xwin/wincmap.c @@ -177,7 +177,7 @@ winUninstallColormap(ColormapPtr pmap) /* Install the default cmap in place of the cmap to be uninstalled */ if (pmap->mid != pmap->pScreen->defColormap) { - dixLookupResourceByType((pointer) &curpmap, pmap->pScreen->defColormap, + dixLookupResourceByType((void *) &curpmap, pmap->pScreen->defColormap, RT_COLORMAP, NullClient, DixUnknownAccess); (*pmap->pScreen->InstallColormap) (curpmap); } diff --git a/xserver/hw/xwin/winconfig.c b/xserver/hw/xwin/winconfig.c index 9e38113a5..a6d3c0a1f 100644 --- a/xserver/hw/xwin/winconfig.c +++ b/xserver/hw/xwin/winconfig.c @@ -106,7 +106,7 @@ winInfoRec g_winInfo = { #ifdef XWIN_XF86CONFIG serverLayoutRec g_winConfigLayout; -static Bool ParseOptionValue(int scrnIndex, pointer options, OptionInfoPtr p); +static Bool ParseOptionValue(int scrnIndex, void *options, OptionInfoPtr p); static Bool configLayout(serverLayoutPtr, XF86ConfLayoutPtr, char *); static Bool configImpliedLayout(serverLayoutPtr, XF86ConfScreenPtr); static Bool GetBoolValue(OptionInfoPtr p, const char *s); @@ -188,7 +188,7 @@ winReadConfigfile() /* Check if layout is given in the config file */ if (g_xf86configptr->conf_flags != NULL) { char *dfltlayout = NULL; - pointer optlist = g_xf86configptr->conf_flags->flg_option_lst; + void *optlist = g_xf86configptr->conf_flags->flg_option_lst; if (optlist && winFindOption(optlist, "defaultserverlayout")) dfltlayout = @@ -588,7 +588,7 @@ winConfigScreens(void) #ifdef XWIN_XF86CONFIG char * -winSetStrOption(pointer optlist, const char *name, char *deflt) +winSetStrOption(void *optlist, const char *name, char *deflt) { OptionInfoRec o; @@ -603,7 +603,7 @@ winSetStrOption(pointer optlist, const char *name, char *deflt) } int -winSetBoolOption(pointer optlist, const char *name, int deflt) +winSetBoolOption(void *optlist, const char *name, int deflt) { OptionInfoRec o; @@ -615,7 +615,7 @@ winSetBoolOption(pointer optlist, const char *name, int deflt) } int -winSetIntOption(pointer optlist, const char *name, int deflt) +winSetIntOption(void *optlist, const char *name, int deflt) { OptionInfoRec o; @@ -627,7 +627,7 @@ winSetIntOption(pointer optlist, const char *name, int deflt) } double -winSetRealOption(pointer optlist, const char *name, double deflt) +winSetRealOption(void *optlist, const char *name, double deflt) { OptionInfoRec o; @@ -639,7 +639,7 @@ winSetRealOption(pointer optlist, const char *name, double deflt) } double -winSetPercentOption(pointer optlist, const char *name, double deflt) +winSetPercentOption(void *optlist, const char *name, double deflt) { OptionInfoRec o; @@ -734,7 +734,7 @@ winFindOptionValue(XF86OptionPtr list, const char *name) */ static Bool -ParseOptionValue(int scrnIndex, pointer options, OptionInfoPtr p) +ParseOptionValue(int scrnIndex, void *options, OptionInfoPtr p) { char *s, *end; diff --git a/xserver/hw/xwin/winconfig.h b/xserver/hw/xwin/winconfig.h index 94571ff71..798c779a6 100644 --- a/xserver/hw/xwin/winconfig.h +++ b/xserver/hw/xwin/winconfig.h @@ -58,15 +58,15 @@ typedef struct { Bool inUse; int videoRam; int textClockFreq; - pointer options; + void *options; int screen; /* For multi-CRTC cards */ } GDevRec, *GDevPtr; typedef struct { char *identifier; char *driver; - pointer commonOptions; - pointer extraOptions; + void *commonOptions; + void *extraOptions; } IDevRec, *IDevPtr; typedef struct { @@ -81,19 +81,19 @@ typedef struct { rgb whiteColour; int defaultVisual; char **modes; - pointer options; + void *options; } DispRec, *DispPtr; typedef struct _confxvportrec { char *identifier; - pointer options; + void *options; } confXvPortRec, *confXvPortPtr; typedef struct _confxvadaptrec { char *identifier; int numports; confXvPortPtr ports; - pointer options; + void *options; } confXvAdaptorRec, *confXvAdaptorPtr; typedef struct _confscreenrec { @@ -107,7 +107,7 @@ typedef struct _confscreenrec { DispPtr displays; int numxvadaptors; confXvAdaptorPtr xvadaptors; - pointer options; + void *options; } confScreenRec, *confScreenPtr; typedef enum { @@ -142,7 +142,7 @@ typedef struct _serverlayoutrec { screenLayoutPtr screens; GDevPtr inactives; IDevPtr inputs; - pointer options; + void *options; } serverLayoutRec, *serverLayoutPtr; /* @@ -233,11 +233,11 @@ typedef struct { * Function prototypes */ -char *winSetStrOption(pointer optlist, const char *name, char *deflt); -int winSetBoolOption(pointer optlist, const char *name, int deflt); -int winSetIntOption(pointer optlist, const char *name, int deflt); -double winSetRealOption(pointer optlist, const char *name, double deflt); -double winSetPercentOption(pointer optlist, const char *name, double deflt); +char *winSetStrOption(void *optlist, const char *name, char *deflt); +int winSetBoolOption(void *optlist, const char *name, int deflt); +int winSetIntOption(void *optlist, const char *name, int deflt); +double winSetRealOption(void *optlist, const char *name, double deflt); +double winSetPercentOption(void *optlist, const char *name, double deflt); #ifdef XWIN_XF86CONFIG XF86OptionPtr winFindOption(XF86OptionPtr list, const char *name); diff --git a/xserver/hw/xwin/wincursor.c b/xserver/hw/xwin/wincursor.c index a35336a34..f3ac0f7ae 100644 --- a/xserver/hw/xwin/wincursor.c +++ b/xserver/hw/xwin/wincursor.c @@ -255,10 +255,8 @@ winLoadCursor(ScreenPtr pScreen, CursorPtr pCursor, int screen) bi.bV4BlueMask = 0x000000FF; bi.bV4AlphaMask = 0xFF000000; - lpBits = - (uint32_t *) calloc(pScreenPriv->cursor.sm_cx * - pScreenPriv->cursor.sm_cy, - sizeof(uint32_t)); + lpBits = calloc(pScreenPriv->cursor.sm_cx * pScreenPriv->cursor.sm_cy, + sizeof(uint32_t)); if (lpBits) { int y; @@ -302,9 +300,7 @@ winLoadCursor(ScreenPtr pScreen, CursorPtr pCursor, int screen) pbmiColors[2].rgbBlue = pCursor->foreBlue >> 8; pbmiColors[2].rgbReserved = 0; - lpBits = - (uint32_t *) calloc(pScreenPriv->cursor.sm_cx * - pScreenPriv->cursor.sm_cy, sizeof(char)); + lpBits = calloc(pScreenPriv->cursor.sm_cx * pScreenPriv->cursor.sm_cy, 1); pCur = (unsigned char *) lpBits; if (lpBits) { diff --git a/xserver/hw/xwin/windialogs.c b/xserver/hw/xwin/windialogs.c index 054ee95b5..c9af0e203 100644 --- a/xserver/hw/xwin/windialogs.c +++ b/xserver/hw/xwin/windialogs.c @@ -574,10 +574,7 @@ winAboutDlgProc(HWND hwndDialog, UINT message, WPARAM wParam, LPARAM lParam) winInitDialog(hwndDialog); /* Override the URL buttons */ - winOverrideURLButton(hwndDialog, ID_ABOUT_CHANGELOG); winOverrideURLButton(hwndDialog, ID_ABOUT_WEBSITE); - winOverrideURLButton(hwndDialog, ID_ABOUT_UG); - winOverrideURLButton(hwndDialog, ID_ABOUT_FAQ); return TRUE; @@ -608,30 +605,10 @@ winAboutDlgProc(HWND hwndDialog, UINT message, WPARAM wParam, LPARAM lParam) PostMessage(s_pScreenPriv->hwndScreen, WM_NULL, 0, 0); /* Restore window procedures for URL buttons */ - winUnoverrideURLButton(hwndDialog, ID_ABOUT_CHANGELOG); winUnoverrideURLButton(hwndDialog, ID_ABOUT_WEBSITE); - winUnoverrideURLButton(hwndDialog, ID_ABOUT_UG); - winUnoverrideURLButton(hwndDialog, ID_ABOUT_FAQ); return TRUE; - case ID_ABOUT_CHANGELOG: - { - INT_PTR iReturn; - - const char *pszWinPath = "http://x.cygwin.com/" - "devel/server/changelog.html"; - - iReturn = (INT_PTR) ShellExecute(NULL, - "open", - pszWinPath, NULL, NULL, SW_MAXIMIZE); - if (iReturn < 32) { - ErrorF("winAboutDlgProc - WM_COMMAND - ID_ABOUT_CHANGELOG - " - "ShellExecute failed: %d\n", (int)iReturn); - } - } - return TRUE; - case ID_ABOUT_WEBSITE: { const char *pszPath = __VENDORDWEBSUPPORT__; @@ -647,36 +624,6 @@ winAboutDlgProc(HWND hwndDialog, UINT message, WPARAM wParam, LPARAM lParam) } } return TRUE; - - case ID_ABOUT_UG: - { - const char *pszPath = "http://x.cygwin.com/docs/ug/"; - INT_PTR iReturn; - - iReturn = (INT_PTR) ShellExecute(NULL, - "open", - pszPath, NULL, NULL, SW_MAXIMIZE); - if (iReturn < 32) { - ErrorF("winAboutDlgProc - WM_COMMAND - ID_ABOUT_UG - " - "ShellExecute failed: %d\n", (int)iReturn); - } - } - return TRUE; - - case ID_ABOUT_FAQ: - { - const char *pszPath = "http://x.cygwin.com/docs/faq/"; - INT_PTR iReturn; - - iReturn = (INT_PTR) ShellExecute(NULL, - "open", - pszPath, NULL, NULL, SW_MAXIMIZE); - if (iReturn < 32) { - ErrorF("winAboutDlgProc - WM_COMMAND - ID_ABOUT_FAQ - " - "ShellExecute failed: %d\n", (int)iReturn); - } - } - return TRUE; } break; @@ -690,10 +637,7 @@ winAboutDlgProc(HWND hwndDialog, UINT message, WPARAM wParam, LPARAM lParam) PostMessage(s_pScreenPriv->hwndScreen, WM_NULL, 0, 0); /* Restore window procedures for URL buttons */ - winUnoverrideURLButton(hwndDialog, ID_ABOUT_CHANGELOG); winUnoverrideURLButton(hwndDialog, ID_ABOUT_WEBSITE); - winUnoverrideURLButton(hwndDialog, ID_ABOUT_UG); - winUnoverrideURLButton(hwndDialog, ID_ABOUT_FAQ); return TRUE; } diff --git a/xserver/hw/xwin/wingc.c b/xserver/hw/xwin/wingc.c index 814d53113..5986e0a47 100644 --- a/xserver/hw/xwin/wingc.c +++ b/xserver/hw/xwin/wingc.c @@ -56,7 +56,7 @@ static void #if 0 static void - winChangeClipNativeGDI(GCPtr pGC, int nType, pointer pValue, int nRects); + winChangeClipNativeGDI(GCPtr pGC, int nType, void *pValue, int nRects); static void winDestroyClipNativeGDI(GCPtr pGC); @@ -214,7 +214,7 @@ winDestroyGCNativeGDI(GCPtr pGC) #if 0 /* See Porting Layer Definition - p. 46 */ static void -winChangeClipNativeGDI(GCPtr pGC, int nType, pointer pValue, int nRects) +winChangeClipNativeGDI(GCPtr pGC, int nType, void *pValue, int nRects) { } diff --git a/xserver/hw/xwin/winglobals.c b/xserver/hw/xwin/winglobals.c index d28132247..b9ad294d5 100644 --- a/xserver/hw/xwin/winglobals.c +++ b/xserver/hw/xwin/winglobals.c @@ -78,6 +78,7 @@ Bool g_fNoHelpMessageBox = FALSE; Bool g_fSoftwareCursor = FALSE; Bool g_fSilentDupError = FALSE; Bool g_fNativeGl = TRUE; +Bool g_fHostInTitle = FALSE; pthread_mutex_t g_pmTerminating = PTHREAD_MUTEX_INITIALIZER; #ifdef XWIN_CLIPBOARD diff --git a/xserver/hw/xwin/winglobals.h b/xserver/hw/xwin/winglobals.h index 58a919c65..60c00da42 100644 --- a/xserver/hw/xwin/winglobals.h +++ b/xserver/hw/xwin/winglobals.h @@ -54,6 +54,7 @@ extern Bool g_fXdmcpEnabled; extern Bool g_fNoHelpMessageBox; extern Bool g_fSilentDupError; extern Bool g_fNativeGl; +extern Bool g_fHostInTitle; extern HWND g_hDlgDepthChange; extern HWND g_hDlgExit; diff --git a/xserver/hw/xwin/winkeybd.c b/xserver/hw/xwin/winkeybd.c index 9c5d4e9cd..3a75ab268 100644 --- a/xserver/hw/xwin/winkeybd.c +++ b/xserver/hw/xwin/winkeybd.c @@ -51,7 +51,7 @@ static Bool g_winKeyState[NUM_KEYCODES]; */ static void - winKeybdBell(int iPercent, DeviceIntPtr pDeviceInt, pointer pCtrl, int iClass); + winKeybdBell(int iPercent, DeviceIntPtr pDeviceInt, void *pCtrl, int iClass); static void winKeybdCtrl(DeviceIntPtr pDevice, KeybdCtrl * pCtrl); @@ -120,7 +120,7 @@ winTranslateKey(WPARAM wParam, LPARAM lParam) /* Ring the keyboard bell (system speaker on PCs) */ static void -winKeybdBell(int iPercent, DeviceIntPtr pDeviceInt, pointer pCtrl, int iClass) +winKeybdBell(int iPercent, DeviceIntPtr pDeviceInt, void *pCtrl, int iClass) { /* * We can't use Beep () here because it uses the PC speaker @@ -128,7 +128,7 @@ winKeybdBell(int iPercent, DeviceIntPtr pDeviceInt, pointer pCtrl, int iClass) * sound on systems with a sound card or it will beep the PC speaker * on systems that do not have a sound card. */ - MessageBeep(MB_OK); + if (iPercent > 0) MessageBeep(MB_OK); } /* Change some keyboard configuration parameters */ diff --git a/xserver/hw/xwin/winmonitors.h b/xserver/hw/xwin/winmonitors.h index 8201e47f4..5fe3ecd52 100644 --- a/xserver/hw/xwin/winmonitors.h +++ b/xserver/hw/xwin/winmonitors.h @@ -40,4 +40,4 @@ struct GetMonitorInfoData { HMONITOR monitorHandle; }; -Bool QueryMonitor(int index, struct GetMonitorInfoData *data); +Bool QueryMonitor(int i, struct GetMonitorInfoData *data); diff --git a/xserver/hw/xwin/winmsgwindow.c b/xserver/hw/xwin/winmsgwindow.c index 8067c693c..59f1da503 100644 --- a/xserver/hw/xwin/winmsgwindow.c +++ b/xserver/hw/xwin/winmsgwindow.c @@ -22,6 +22,10 @@ * */ +#ifdef HAVE_XWIN_CONFIG_H +#include <xwin-config.h> +#endif + #include "win.h" /* diff --git a/xserver/hw/xwin/winmultiwindowicons.c b/xserver/hw/xwin/winmultiwindowicons.c index 0531ad6c7..93d389d46 100644 --- a/xserver/hw/xwin/winmultiwindowicons.c +++ b/xserver/hw/xwin/winmultiwindowicons.c @@ -372,13 +372,12 @@ winXIconToHICON(Display * pDisplay, Window id, int iconSize) unsigned char *mask, *image = NULL, *imageMask; unsigned char *dst, *src; int planes, bpp, i; - int biggest_size = 0; + unsigned int biggest_size = 0; HDC hDC; ICONINFO ii; XWMHints *hints; HICON hIcon = NULL; uint32_t *biggest_icon = NULL; - static Atom _XA_NET_WM_ICON; static int generation; uint32_t *icon, *icon_data = NULL; @@ -405,10 +404,25 @@ winXIconToHICON(Display * pDisplay, Window id, int iconSize) (icon_data != NULL)) { for (icon = icon_data; icon < &icon_data[size] && *icon; icon = &icon[icon[0] * icon[1] + 2]) { - /* Find an exact match to the size we require... */ + winDebug("winXIconToHICON: %u x %u NetIcon\n", icon[0], icon[1]); + + /* Icon data size will overflow an int and thus is bigger than the + property can possibly be */ + if ((INT_MAX/icon[0]) < icon[1]) { + winDebug("winXIconToHICON: _NET_WM_ICON icon data size overflow\n"); + break; + } + + /* Icon data size is bigger than amount of data remaining */ + if (&icon[icon[0] * icon[1] + 2] > &icon_data[size]) { + winDebug("winXIconToHICON: _NET_WM_ICON data is malformed\n"); + break; + } + + /* Found an exact match to the size we require... */ if (icon[0] == iconSize && icon[1] == iconSize) { - winDebug("winXIconToHICON: found %lu x %lu NetIcon\n", icon[0], - icon[1]); + winDebug("winXIconToHICON: selected %d x %d NetIcon\n", + iconSize, iconSize); hIcon = NetWMToWinIcon(bpp, icon); break; } @@ -421,7 +435,7 @@ winXIconToHICON(Display * pDisplay, Window id, int iconSize) if (!hIcon && biggest_icon) { winDebug - ("winXIconToHICON: selected %lu x %lu NetIcon for scaling to %u x %u\n", + ("winXIconToHICON: selected %u x %u NetIcon for scaling to %d x %d\n", biggest_icon[0], biggest_icon[1], iconSize, iconSize); hIcon = NetWMToWinIcon(bpp, biggest_icon); diff --git a/xserver/hw/xwin/winmultiwindowwindow.c b/xserver/hw/xwin/winmultiwindowwindow.c index 44ad19302..f2e7907b8 100644 --- a/xserver/hw/xwin/winmultiwindowwindow.c +++ b/xserver/hw/xwin/winmultiwindowwindow.c @@ -53,7 +53,7 @@ static void winUpdateWindowsWindow(WindowPtr pWin); static void - winFindWindow(pointer value, XID id, pointer cdata); + winFindWindow(void *value, XID id, void *cdata); static void @@ -724,7 +724,7 @@ winGetWindowID(WindowPtr pWin) */ static void -winFindWindow(pointer value, XID id, pointer cdata) +winFindWindow(void *value, XID id, void *cdata) { WindowIDPairPtr wi = (WindowIDPairPtr) cdata; @@ -813,7 +813,7 @@ winMinimizeWindow(Window id) ErrorF("winMinimizeWindow\n"); #endif - dixLookupResourceByType((pointer) &pWin, id, RT_WINDOW, NullClient, + dixLookupResourceByType((void *) &pWin, id, RT_WINDOW, NullClient, DixUnknownAccess); if (!pWin) { ErrorF("%s: NULL pWin. Leaving\n", __FUNCTION__); diff --git a/xserver/hw/xwin/winmultiwindowwm.c b/xserver/hw/xwin/winmultiwindowwm.c index 1dd8ba5b3..618e38121 100644 --- a/xserver/hw/xwin/winmultiwindowwm.c +++ b/xserver/hw/xwin/winmultiwindowwm.c @@ -60,6 +60,7 @@ #include "window.h" #include "pixmapstr.h" #include "windowstr.h" +#include "winglobals.h" #ifdef XWIN_MULTIWINDOWEXTWM #include <X11/extensions/windowswmstr.h> @@ -69,6 +70,10 @@ #define WINDOWSWM_NATIVE_HWND "_WINDOWSWM_NATIVE_HWND" #endif +#ifndef HOST_NAME_MAX +#define HOST_NAME_MAX 255 +#endif + extern void winDebug(const char *format, ...); extern void winReshapeMultiWindow(WindowPtr pWin); extern void winUpdateRgnMultiWindow(WindowPtr pWin); @@ -111,6 +116,7 @@ typedef struct _WMInfo { WMMsgQueueRec wmMsgQueue; Atom atmWmProtos; Atom atmWmDelete; + Atom atmWmTakeFocus; Atom atmPrivMap; Bool fAllowOtherWM; } WMInfoRec, *WMInfoPtr; @@ -405,7 +411,7 @@ Xutf8TextPropertyToString(Display * pDisplay, XTextProperty * xtp) for (i = 0; i < nNum; i++) iLen += strlen(ppList[i]); - pszReturnData = (char *) malloc(iLen + 1); + pszReturnData = malloc(iLen + 1); pszReturnData[0] = '\0'; for (i = 0; i < nNum; i++) strcat(pszReturnData, ppList[i]); @@ -413,7 +419,7 @@ Xutf8TextPropertyToString(Display * pDisplay, XTextProperty * xtp) XFreeStringList(ppList); } else { - pszReturnData = (char *) malloc(1); + pszReturnData = malloc(1); pszReturnData[0] = '\0'; } @@ -429,7 +435,10 @@ GetWindowName(Display * pDisplay, Window iWin, char **ppWindowName) { int nResult; XTextProperty xtpWindowName; + XTextProperty xtpClientMachine; char *pszWindowName; + char *pszClientMachine; + char hostname[HOST_NAME_MAX + 1]; #if CYGMULTIWINDOW_DEBUG ErrorF("GetWindowName\n"); @@ -449,10 +458,66 @@ GetWindowName(Display * pDisplay, Window iWin, char **ppWindowName) pszWindowName = Xutf8TextPropertyToString(pDisplay, &xtpWindowName); XFree(xtpWindowName.value); + + if (g_fHostInTitle) { + /* Try to get client machine name */ + nResult = XGetWMClientMachine(pDisplay, iWin, &xtpClientMachine); + if (nResult && xtpClientMachine.value && xtpClientMachine.nitems) { + pszClientMachine = + Xutf8TextPropertyToString(pDisplay, &xtpClientMachine); + XFree(xtpClientMachine.value); + + /* + If we have a client machine name + and it's not the local host name + and it's not already in the window title... + */ + if (strlen(pszClientMachine) && + !gethostname(hostname, HOST_NAME_MAX + 1) && + strcmp(hostname, pszClientMachine) && + (strstr(pszWindowName, pszClientMachine) == 0)) { + /* ... add '@<clientmachine>' to end of window name */ + *ppWindowName = + malloc(strlen(pszWindowName) + + strlen(pszClientMachine) + 2); + strcpy(*ppWindowName, pszWindowName); + strcat(*ppWindowName, "@"); + strcat(*ppWindowName, pszClientMachine); + + free(pszWindowName); + free(pszClientMachine); + + return; + } + } + } + + /* otherwise just return the window name */ *ppWindowName = pszWindowName; } /* + * Does the client support the specified WM_PROTOCOLS protocol? + */ + +static Bool +IsWmProtocolAvailable(Display * pDisplay, Window iWindow, Atom atmProtocol) +{ + int i, n, found = 0; + Atom *protocols; + + if (XGetWMProtocols(pDisplay, iWindow, &protocols, &n)) { + for (i = 0; i < n; ++i) + if (protocols[i] == atmProtocol) + ++found; + + XFree(protocols); + } + + return found > 0; +} + +/* * Send a message to the X server from the WM thread */ @@ -537,7 +602,7 @@ UpdateName(WMInfoPtr pWMInfo, Window iWindow) int iLen = MultiByteToWideChar(CP_UTF8, 0, pszWindowName, -1, NULL, 0); wchar_t *pwszWideWindowName = - (wchar_t *) malloc(sizeof(wchar_t) * (iLen + 1)); + malloc(sizeof(wchar_t)*(iLen + 1)); MultiByteToWideChar(CP_UTF8, 0, pszWindowName, -1, pwszWideWindowName, iLen); @@ -805,21 +870,10 @@ winMultiWindowWMProc(void *pArg) ErrorF("\tWM_WM_KILL\n"); #endif { - int i, n, found = 0; - Atom *protocols; - - /* --- */ - if (XGetWMProtocols(pWMInfo->pDisplay, - pNode->msg.iWindow, &protocols, &n)) { - for (i = 0; i < n; ++i) - if (protocols[i] == pWMInfo->atmWmDelete) - ++found; - - XFree(protocols); - } - /* --- */ - if (found) + if (IsWmProtocolAvailable(pWMInfo->pDisplay, + pNode->msg.iWindow, + pWMInfo->atmWmDelete)) SendXMessage(pWMInfo->pDisplay, pNode->msg.iWindow, pWMInfo->atmWmProtos, pWMInfo->atmWmDelete); @@ -832,11 +886,39 @@ winMultiWindowWMProc(void *pArg) #if CYGMULTIWINDOW_DEBUG ErrorF("\tWM_WM_ACTIVATE\n"); #endif - /* Set the input focus */ - XSetInputFocus(pWMInfo->pDisplay, - pNode->msg.iWindow, - RevertToPointerRoot, CurrentTime); + + /* + ICCCM 4.1.7 is pretty opaque, but it appears that the rules are + actually quite simple: + -- the WM_HINTS input field determines whether the WM should call + XSetInputFocus() + -- independently, the WM_TAKE_FOCUS protocol determines whether + the WM should send a WM_TAKE_FOCUS ClientMessage. + */ + { + Bool neverFocus = FALSE; + XWMHints *hints = XGetWMHints(pWMInfo->pDisplay, pNode->msg.iWindow); + + if (hints) { + if (hints->flags & InputHint) + neverFocus = !hints->input; + XFree(hints); + } + + if (!neverFocus) + XSetInputFocus(pWMInfo->pDisplay, + pNode->msg.iWindow, + RevertToPointerRoot, CurrentTime); + + if (IsWmProtocolAvailable(pWMInfo->pDisplay, + pNode->msg.iWindow, + pWMInfo->atmWmTakeFocus)) + SendXMessage(pWMInfo->pDisplay, + pNode->msg.iWindow, + pWMInfo->atmWmProtos, pWMInfo->atmWmTakeFocus); + + } break; case WM_WM_NAME_EVENT: @@ -1237,9 +1319,9 @@ winInitWM(void **ppWMInfo, pthread_mutex_t * ppmServerStarted, int dwScreen, HWND hwndScreen, BOOL allowOtherWM) { - WMProcArgPtr pArg = (WMProcArgPtr) malloc(sizeof(WMProcArgRec)); - WMInfoPtr pWMInfo = (WMInfoPtr) malloc(sizeof(WMInfoRec)); - XMsgProcArgPtr pXMsgArg = (XMsgProcArgPtr) malloc(sizeof(XMsgProcArgRec)); + WMProcArgPtr pArg = malloc(sizeof(WMProcArgRec)); + WMInfoPtr pWMInfo = malloc(sizeof(WMInfoRec)); + XMsgProcArgPtr pXMsgArg = malloc(sizeof(XMsgProcArgRec)); /* Bail if the input parameters are bad */ if (pArg == NULL || pWMInfo == NULL || pXMsgArg == NULL) { @@ -1404,6 +1486,8 @@ winInitMultiWindowWM(WMInfoPtr pWMInfo, WMProcArgPtr pProcArg) "WM_PROTOCOLS", False); pWMInfo->atmWmDelete = XInternAtom(pWMInfo->pDisplay, "WM_DELETE_WINDOW", False); + pWMInfo->atmWmTakeFocus = XInternAtom(pWMInfo->pDisplay, + "WM_TAKE_FOCUS", False); pWMInfo->atmPrivMap = XInternAtom(pWMInfo->pDisplay, WINDOWSWM_NATIVE_HWND, False); @@ -1432,7 +1516,7 @@ winSendMessageToWM(void *pWMInfo, winWMMessagePtr pMsg) ErrorF("winSendMessageToWM ()\n"); #endif - pNode = (WMMsgNodePtr) malloc(sizeof(WMMsgNodeRec)); + pNode = malloc(sizeof(WMMsgNodeRec)); if (pNode != NULL) { memcpy(&pNode->msg, pMsg, sizeof(winWMMessageRec)); PushMessage(&((WMInfoPtr) pWMInfo)->wmMsgQueue, pNode); @@ -1577,10 +1661,10 @@ winDeinitMultiWindowWM(void) } /* Windows window styles */ -#define HINT_NOFRAME (1l<<0) +#define HINT_NOFRAME (1L<<0) #define HINT_BORDER (1L<<1) -#define HINT_SIZEBOX (1l<<2) -#define HINT_CAPTION (1l<<3) +#define HINT_SIZEBOX (1L<<2) +#define HINT_CAPTION (1L<<3) #define HINT_NOMAXIMIZE (1L<<4) #define HINT_NOMINIMIZE (1L<<5) #define HINT_NOSYSMENU (1L<<6) diff --git a/xserver/hw/xwin/winmultiwindowwndproc.c b/xserver/hw/xwin/winmultiwindowwndproc.c index abb87ee4b..17823baf2 100644 --- a/xserver/hw/xwin/winmultiwindowwndproc.c +++ b/xserver/hw/xwin/winmultiwindowwndproc.c @@ -316,6 +316,7 @@ winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) static Bool s_fTracking = FALSE; Bool needRestack = FALSE; LRESULT ret; + static Bool hasEnteredSizeMove = FALSE; #if CYGDEBUG winDebugWin32Message("winTopLevelWindowProc", hwnd, message, wParam, @@ -837,7 +838,7 @@ winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) break; case WM_CLOSE: - /* Removep AppUserModelID property */ + /* Remove AppUserModelID property */ winSetAppUserModelID(hwnd, NULL); /* Branch on if the window was killed in X already */ if (pWinPriv->fXKilled) { @@ -872,7 +873,9 @@ winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) case WM_MOVE: /* Adjust the X Window to the moved Windows window */ - winAdjustXWindow(pWin, hwnd); + if (!hasEnteredSizeMove) + winAdjustXWindow(pWin, hwnd); + /* else: Wait for WM_EXITSIZEMOVE */ return 0; case WM_SHOWWINDOW: @@ -1005,6 +1008,16 @@ winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) */ break; + case WM_ENTERSIZEMOVE: + hasEnteredSizeMove = TRUE; + return 0; + + case WM_EXITSIZEMOVE: + /* Adjust the X Window to the moved Windows window */ + hasEnteredSizeMove = FALSE; + winAdjustXWindow(pWin, hwnd); + return 0; + case WM_SIZE: /* see dix/window.c */ #if CYGWINDOWING_DEBUG @@ -1029,8 +1042,11 @@ winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) (int) (GetTickCount())); } #endif - /* Adjust the X Window to the moved Windows window */ - winAdjustXWindow(pWin, hwnd); + if (!hasEnteredSizeMove) { + /* Adjust the X Window to the moved Windows window */ + winAdjustXWindow(pWin, hwnd); + } + /* else: wait for WM_EXITSIZEMOVE */ return 0; /* end of WM_SIZE handler */ case WM_STYLECHANGING: diff --git a/xserver/hw/xwin/winnativegdi.c b/xserver/hw/xwin/winnativegdi.c index a2a5123a0..1859698a0 100644 --- a/xserver/hw/xwin/winnativegdi.c +++ b/xserver/hw/xwin/winnativegdi.c @@ -344,8 +344,7 @@ winCreateDIBNativeGDI(int iWidth, int iHeight, int iDepth, } /* Allocate bitmap info header */ - pbmih = (BITMAPINFOHEADER *) malloc(sizeof(BITMAPINFOHEADER) - + 256 * sizeof(RGBQUAD)); + pbmih = malloc(sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD)); if (pbmih == NULL) { ErrorF("winCreateDIBNativeGDI - malloc () failed\n"); return FALSE; diff --git a/xserver/hw/xwin/winpfbdd.c b/xserver/hw/xwin/winpfbdd.c index f87000726..010616101 100644 --- a/xserver/hw/xwin/winpfbdd.c +++ b/xserver/hw/xwin/winpfbdd.c @@ -306,7 +306,7 @@ winCloseScreenPrimaryDD(ScreenPtr pScreen) pScreenInfo->pScreen = NULL; /* Free the screen privates for this screen */ - free((pointer) pScreenPriv); + free((void *) pScreenPriv); return fReturn; } diff --git a/xserver/hw/xwin/winpixmap.c b/xserver/hw/xwin/winpixmap.c index d8a12d58e..ef158c854 100644 --- a/xserver/hw/xwin/winpixmap.c +++ b/xserver/hw/xwin/winpixmap.c @@ -178,7 +178,7 @@ Bool winModifyPixmapHeaderNativeGDI(PixmapPtr pPixmap, int iWidth, int iHeight, int iDepth, - int iBitsPerPixel, int devKind, pointer pPixData) + int iBitsPerPixel, int devKind, void *pPixData) { FatalError("winModifyPixmapHeaderNativeGDI ()\n"); return TRUE; diff --git a/xserver/hw/xwin/winprefslex.l b/xserver/hw/xwin/winprefslex.l index 15f707766..fd13edc05 100644 --- a/xserver/hw/xwin/winprefslex.l +++ b/xserver/hw/xwin/winprefslex.l @@ -45,7 +45,7 @@ extern void ErrorF (const char* /*f*/, ...); static char *makestr(char *str) { char *ptr; - ptr = (char*)malloc (strlen(str)+1); + ptr = malloc(strlen(str)+1); if (!ptr) { ErrorF ("winMultiWindowLex:makestr() out of memory\n"); @@ -90,6 +90,7 @@ ALWAYSONTOP { return ALWAYSONTOP; } DEBUG { return DEBUGOUTPUT; } RELOAD { return RELOAD; } TRAYICON { return TRAYICON; } +FORCEEXIT { return FORCEEXIT; } SILENTEXIT { return SILENTEXIT; } "{" { return LB; } "}" { return RB; } diff --git a/xserver/hw/xwin/winprefsyacc.y b/xserver/hw/xwin/winprefsyacc.y index 3b376b3e7..683fc44ca 100644 --- a/xserver/hw/xwin/winprefsyacc.y +++ b/xserver/hw/xwin/winprefsyacc.y @@ -311,10 +311,9 @@ static void AddMenuLine (char *text, MENUCOMMANDTYPE cmd, char *param) { if (menu.menuItem==NULL) - menu.menuItem = (MENUITEM*)malloc(sizeof(MENUITEM)); + menu.menuItem = malloc(sizeof(MENUITEM)); else - menu.menuItem = (MENUITEM*) - realloc(menu.menuItem, sizeof(MENUITEM)*(menu.menuItems+1)); + menu.menuItem = realloc(menu.menuItem, sizeof(MENUITEM)*(menu.menuItems+1)); strncpy (menu.menuItem[menu.menuItems].text, text, MENU_MAX); menu.menuItem[menu.menuItems].text[MENU_MAX] = 0; @@ -339,10 +338,9 @@ CloseMenu (void) } if (pref.menuItems) - pref.menu = (MENUPARSED*) - realloc (pref.menu, (pref.menuItems+1)*sizeof(MENUPARSED)); + pref.menu = realloc (pref.menu, (pref.menuItems+1)*sizeof(MENUPARSED)); else - pref.menu = (MENUPARSED*)malloc (sizeof(MENUPARSED)); + pref.menu = malloc (sizeof(MENUPARSED)); memcpy (pref.menu+pref.menuItems, &menu, sizeof(MENUPARSED)); pref.menuItems++; @@ -365,10 +363,9 @@ static void AddIconLine (char *matchstr, char *iconfile) { if (pref.icon==NULL) - pref.icon = (ICONITEM*)malloc(sizeof(ICONITEM)); + pref.icon = malloc(sizeof(ICONITEM)); else - pref.icon = (ICONITEM*) - realloc(pref.icon, sizeof(ICONITEM)*(pref.iconItems+1)); + pref.icon = realloc(pref.icon, sizeof(ICONITEM)*(pref.iconItems+1)); strncpy(pref.icon[pref.iconItems].match, matchstr, MENU_MAX); pref.icon[pref.iconItems].match[MENU_MAX] = 0; @@ -401,10 +398,9 @@ static void AddStyleLine (char *matchstr, unsigned long style) { if (pref.style==NULL) - pref.style = (STYLEITEM*)malloc(sizeof(STYLEITEM)); + pref.style = malloc(sizeof(STYLEITEM)); else - pref.style = (STYLEITEM*) - realloc(pref.style, sizeof(STYLEITEM)*(pref.styleItems+1)); + pref.style = realloc(pref.style, sizeof(STYLEITEM)*(pref.styleItems+1)); strncpy(pref.style[pref.styleItems].match, matchstr, MENU_MAX); pref.style[pref.styleItems].match[MENU_MAX] = 0; @@ -434,10 +430,9 @@ static void AddSysMenuLine (char *matchstr, char *menuname, int pos) { if (pref.sysMenu==NULL) - pref.sysMenu = (SYSMENUITEM*)malloc(sizeof(SYSMENUITEM)); + pref.sysMenu = malloc(sizeof(SYSMENUITEM)); else - pref.sysMenu = (SYSMENUITEM*) - realloc(pref.sysMenu, sizeof(SYSMENUITEM)*(pref.sysMenuItems+1)); + pref.sysMenu = realloc(pref.sysMenu, sizeof(SYSMENUITEM)*(pref.sysMenuItems+1)); strncpy (pref.sysMenu[pref.sysMenuItems].match, matchstr, MENU_MAX); pref.sysMenu[pref.sysMenuItems].match[MENU_MAX] = 0; diff --git a/xserver/hw/xwin/winprocarg.c b/xserver/hw/xwin/winprocarg.c index 858be4a56..f2bf05bad 100644 --- a/xserver/hw/xwin/winprocarg.c +++ b/xserver/hw/xwin/winprocarg.c @@ -1074,6 +1074,11 @@ ddxProcessArgument(int argc, char *argv[], int i) return 1; } + if (IS_OPTION("-hostintitle")) { + g_fHostInTitle = TRUE; + return 1; + } + return 0; } diff --git a/xserver/hw/xwin/winresource.h b/xserver/hw/xwin/winresource.h index a14d402e1..afbf9f28d 100644 --- a/xserver/hw/xwin/winresource.h +++ b/xserver/hw/xwin/winresource.h @@ -44,9 +44,6 @@ #define ID_APP_ALWAYS_ON_TOP 202 #define ID_APP_ABOUT 203 -#define ID_ABOUT_UG 300 -#define ID_ABOUT_FAQ 301 -#define ID_ABOUT_CHANGELOG 302 #define ID_ABOUT_WEBSITE 303 #endif diff --git a/xserver/hw/xwin/winshaddd.c b/xserver/hw/xwin/winshaddd.c index 2e7060838..5f3b658fb 100644 --- a/xserver/hw/xwin/winshaddd.c +++ b/xserver/hw/xwin/winshaddd.c @@ -676,7 +676,7 @@ winCloseScreenShadowDD(ScreenPtr pScreen) pScreenInfo->pScreen = NULL; /* Free the screen privates for this screen */ - free((pointer) pScreenPriv); + free((void *) pScreenPriv); return fReturn; } diff --git a/xserver/hw/xwin/winshadddnl.c b/xserver/hw/xwin/winshadddnl.c index 01097f295..55af5c383 100644 --- a/xserver/hw/xwin/winshadddnl.c +++ b/xserver/hw/xwin/winshadddnl.c @@ -703,7 +703,7 @@ winCloseScreenShadowDDNL(ScreenPtr pScreen) pScreenInfo->pScreen = NULL; /* Free the screen privates for this screen */ - free((pointer) pScreenPriv); + free((void *) pScreenPriv); return fReturn; } diff --git a/xserver/hw/xwin/winshadgdi.c b/xserver/hw/xwin/winshadgdi.c index ebc233924..5c815eb73 100644 --- a/xserver/hw/xwin/winshadgdi.c +++ b/xserver/hw/xwin/winshadgdi.c @@ -184,8 +184,7 @@ winQueryRGBBitsAndMasks(ScreenPtr pScreen) } /* Allocate a bitmap header and color table */ - pbmih = (BITMAPINFOHEADER *) malloc(sizeof(BITMAPINFOHEADER) - + 256 * sizeof(RGBQUAD)); + pbmih = malloc(sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD)); if (pbmih == NULL) { ErrorF("winQueryRGBBitsAndMasks - malloc failed\n"); return FALSE; @@ -545,8 +544,7 @@ winInitScreenShadowGDI(ScreenPtr pScreen) pScreenPriv->hdcShadow = CreateCompatibleDC(pScreenPriv->hdcScreen); /* Allocate bitmap info header */ - pScreenPriv->pbmih = (BITMAPINFOHEADER *) malloc(sizeof(BITMAPINFOHEADER) - + 256 * sizeof(RGBQUAD)); + pScreenPriv->pbmih = malloc(sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD)); if (pScreenPriv->pbmih == NULL) { ErrorF("winInitScreenShadowGDI - malloc () failed\n"); return FALSE; @@ -629,7 +627,7 @@ winCloseScreenShadowGDI(ScreenPtr pScreen) pScreenInfo->pScreen = NULL; /* Free the screen privates for this screen */ - free((pointer) pScreenPriv); + free((void *) pScreenPriv); return fReturn; } diff --git a/xserver/hw/xwin/winwakeup.c b/xserver/hw/xwin/winwakeup.c index 795221a1a..ebcb0fad9 100644 --- a/xserver/hw/xwin/winwakeup.c +++ b/xserver/hw/xwin/winwakeup.c @@ -39,7 +39,7 @@ /* See Porting Layer Definition - p. 7 */ void winWakeupHandler(ScreenPtr pScreen, - unsigned long ulResult, pointer pReadmask) + unsigned long ulResult, void *pReadmask) { MSG msg; diff --git a/xserver/hw/xwin/winwin32rootless.c b/xserver/hw/xwin/winwin32rootless.c index 724976a84..660a78f2d 100644 --- a/xserver/hw/xwin/winwin32rootless.c +++ b/xserver/hw/xwin/winwin32rootless.c @@ -39,7 +39,6 @@ #include <winuser.h> #define _WINDOWSWM_SERVER_ #include <X11/extensions/windowswmstr.h> -#include "dixevents.h" #include "winmultiwindowclass.h" #include <X11/Xatom.h> @@ -184,8 +183,8 @@ InitWin32RootlessEngine(win32RootlessWindowPtr pRLWinPriv) /* Allocate bitmap info header */ pRLWinPriv->pbmihShadow = - (BITMAPINFOHEADER *) malloc(sizeof(BITMAPINFOHEADER) - + 256 * sizeof(RGBQUAD)); + malloc(sizeof(BITMAPINFOHEADER) + + 256 * sizeof(RGBQUAD)); if (pRLWinPriv->pbmihShadow == NULL) { ErrorF("InitWin32RootlessEngine - malloc () failed\n"); return; @@ -214,8 +213,7 @@ winMWExtWMCreateFrame(RootlessWindowPtr pFrame, ScreenPtr pScreen, newX, newY, pFrame->width, pFrame->height); #endif - pRLWinPriv = - (win32RootlessWindowPtr) malloc(sizeof(win32RootlessWindowRec)); + pRLWinPriv = malloc(sizeof(win32RootlessWindowRec)); pRLWinPriv->pFrame = pFrame; pRLWinPriv->pfb = NULL; pRLWinPriv->hbmpShadow = NULL; diff --git a/xserver/hw/xwin/winwindow.c b/xserver/hw/xwin/winwindow.c index 029bd855d..8c1c28f2a 100644 --- a/xserver/hw/xwin/winwindow.c +++ b/xserver/hw/xwin/winwindow.c @@ -39,7 +39,7 @@ */ static int - winAddRgn(WindowPtr pWindow, pointer data); + winAddRgn(WindowPtr pWindow, void *data); static void @@ -155,7 +155,7 @@ winCopyWindowNativeGDI(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) nbox = RegionNumRects(prgnDst); /* Allocate source points for each box */ - if (!(pptSrc = (DDXPointPtr) malloc(nbox * sizeof(DDXPointRec)))) + if (!(pptSrc = malloc(nbox * sizeof(DDXPointRec)))) return; /* Set an iterator pointer */ @@ -456,7 +456,7 @@ winSetShapeRootless(WindowPtr pWin, int kind) static int -winAddRgn(WindowPtr pWin, pointer data) +winAddRgn(WindowPtr pWin, void *data) { int iX, iY, iWidth, iHeight, iBorder; HRGN hRgn = *(HRGN *) data; diff --git a/xserver/hw/xwin/winwindowswm.c b/xserver/hw/xwin/winwindowswm.c index be43265e0..2805ff7ce 100644 --- a/xserver/hw/xwin/winwindowswm.c +++ b/xserver/hw/xwin/winwindowswm.c @@ -53,8 +53,8 @@ static XID eventResource; /* Currently selected events */ static unsigned int eventMask = 0; -static int WMFreeClient(pointer data, XID id); -static int WMFreeEvents(pointer data, XID id); +static int WMFreeClient(void *data, XID id); +static int WMFreeEvents(void *data, XID id); static void SNotifyEvent(xWindowsWMNotifyEvent * from, xWindowsWMNotifyEvent * to); @@ -99,13 +99,13 @@ updateEventMask(WMEventPtr * pHead) } /*ARGSUSED*/ static int -WMFreeClient(pointer data, XID id) +WMFreeClient(void *data, XID id) { WMEventPtr pEvent; WMEventPtr *pHead, pCur, pPrev; pEvent = (WMEventPtr) data; - dixLookupResourceByType((pointer) &pHead, eventResource, eventResourceType, + dixLookupResourceByType((void *) &pHead, eventResource, eventResourceType, NullClient, DixUnknownAccess); if (pHead) { pPrev = 0; @@ -119,12 +119,12 @@ WMFreeClient(pointer data, XID id) } updateEventMask(pHead); } - free((pointer) pEvent); + free((void *) pEvent); return 1; } /*ARGSUSED*/ static int -WMFreeEvents(pointer data, XID id) +WMFreeEvents(void *data, XID id) { WMEventPtr *pHead, pCur, pNext; @@ -132,9 +132,9 @@ WMFreeEvents(pointer data, XID id) for (pCur = *pHead; pCur; pCur = pNext) { pNext = pCur->next; FreeResource(pCur->clientResource, ClientType); - free((pointer) pCur); + free((void *) pCur); } - free((pointer) pHead); + free((void *) pHead); eventMask = 0; return 1; } @@ -147,7 +147,7 @@ ProcWindowsWMSelectInput(ClientPtr client) XID clientResource; REQUEST_SIZE_MATCH(xWindowsWMSelectInputReq); - dixLookupResourceByType((pointer) &pHead, eventResource, eventResourceType, + dixLookupResourceByType((void *) &pHead, eventResource, eventResourceType, client, DixWriteAccess); if (stuff->mask != 0) { if (pHead) { @@ -162,7 +162,7 @@ ProcWindowsWMSelectInput(ClientPtr client) } /* build the entry */ - pNewEvent = (WMEventPtr) malloc(sizeof(WMEventRec)); + pNewEvent = malloc(sizeof(WMEventRec)); if (!pNewEvent) return BadAlloc; pNewEvent->next = 0; @@ -174,7 +174,7 @@ ProcWindowsWMSelectInput(ClientPtr client) */ clientResource = FakeClientID(client->index); pNewEvent->clientResource = clientResource; - if (!AddResource(clientResource, ClientType, (pointer) pNewEvent)) + if (!AddResource(clientResource, ClientType, (void *) pNewEvent)) return BadAlloc; /* * create a resource to contain a pointer to the list @@ -183,9 +183,9 @@ ProcWindowsWMSelectInput(ClientPtr client) * done through the resource database. */ if (!pHead) { - pHead = (WMEventPtr *) malloc(sizeof(WMEventPtr)); + pHead = malloc(sizeof(WMEventPtr)); if (!pHead || - !AddResource(eventResource, eventResourceType, (pointer) pHead)) + !AddResource(eventResource, eventResourceType, (void *) pHead)) { FreeResource(clientResource, RT_NONE); return BadAlloc; @@ -239,7 +239,7 @@ winWindowsWMSendEvent(int type, unsigned int mask, int which, int arg, ErrorF("winWindowsWMSendEvent %d %d %d %d, %d %d - %d %d\n", type, mask, which, arg, x, y, w, h); #endif - dixLookupResourceByType((pointer) &pHead, eventResource, eventResourceType, + dixLookupResourceByType((void *) &pHead, eventResource, eventResourceType, NullClient, DixUnknownAccess); if (!pHead) return; diff --git a/xserver/hw/xwin/winwndproc.c b/xserver/hw/xwin/winwndproc.c index c73a75c6f..bee223de7 100644 --- a/xserver/hw/xwin/winwndproc.c +++ b/xserver/hw/xwin/winwndproc.c @@ -955,11 +955,11 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) wShift = (GetKeyState(VK_SHIFT) & 0x8000) ? MK_SHIFT : 0; wCtrl = (GetKeyState(VK_CONTROL) & 0x8000) ? MK_CONTROL : 0; lPos = MAKELPARAM(point.x, point.y); - if (g_fButton[0] & !wL) + if (g_fButton[0] && !wL) PostMessage(hwnd, WM_LBUTTONUP, wCtrl | wM | wR | wShift, lPos); - if (g_fButton[1] & !wM) + if (g_fButton[1] && !wM) PostMessage(hwnd, WM_MBUTTONUP, wCtrl | wL | wR | wShift, lPos); - if (g_fButton[2] & !wR) + if (g_fButton[2] && !wR) PostMessage(hwnd, WM_RBUTTONUP, wCtrl | wL | wM | wShift, lPos); } } diff --git a/xserver/include/Makefile.am b/xserver/include/Makefile.am index 93d8616f2..6578038a5 100644 --- a/xserver/include/Makefile.am +++ b/xserver/include/Makefile.am @@ -68,8 +68,9 @@ endif AM_CFLAGS = $(DIX_CFLAGS) EXTRA_DIST = \ - busfault.h \ + busfault.h dbus-core.h \ dix-config-apple-verbatim.h \ dixfontstubs.h eventconvert.h eventstr.h inpututils.h \ protocol-versions.h \ + systemd-logind.h \ xsha1.h diff --git a/xserver/include/Makefile.in b/xserver/include/Makefile.in index bcf35820c..5f5e9c02b 100644 --- a/xserver/include/Makefile.in +++ b/xserver/include/Makefile.in @@ -172,6 +172,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -216,6 +218,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -318,7 +324,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -327,6 +336,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -393,6 +403,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ @@ -531,10 +545,11 @@ top_srcdir = @top_srcdir@ @XORG_TRUE@nodist_sdk_HEADERS = xorg-server.h AM_CFLAGS = $(DIX_CFLAGS) EXTRA_DIST = \ - busfault.h \ + busfault.h dbus-core.h \ dix-config-apple-verbatim.h \ dixfontstubs.h eventconvert.h eventstr.h inpututils.h \ protocol-versions.h \ + systemd-logind.h \ xsha1.h all: do-not-use-config.h xorg-server.h dix-config.h xorg-config.h xkb-config.h xwin-config.h kdrive-config.h version-config.h diff --git a/xserver/include/callback.h b/xserver/include/callback.h index b42708960..df638c0d4 100644 --- a/xserver/include/callback.h +++ b/xserver/include/callback.h @@ -62,21 +62,21 @@ typedef struct _CallbackList *CallbackListPtr; /* also in misc.h */ #define _XTYPEDEF_CALLBACKLISTPTR #endif -typedef void (*CallbackProcPtr) (CallbackListPtr *, pointer, pointer); +typedef void (*CallbackProcPtr) (CallbackListPtr *, void *, void *); extern _X_EXPORT Bool AddCallback(CallbackListPtr * /*pcbl */ , CallbackProcPtr /*callback */ , - pointer /*data */ ); + void */*data */ ); extern _X_EXPORT Bool DeleteCallback(CallbackListPtr * /*pcbl */ , CallbackProcPtr /*callback */ , - pointer /*data */ ); + void */*data */ ); extern _X_EXPORT void _CallCallbacks(CallbackListPtr * /*pcbl */ , - pointer /*call_data */ ); + void */*call_data */ ); static inline void -CallCallbacks(CallbackListPtr *pcbl, pointer call_data) +CallCallbacks(CallbackListPtr *pcbl, void *call_data) { if (!pcbl || !*pcbl) return; diff --git a/xserver/include/closestr.h b/xserver/include/closestr.h index c6aa1295f..60e6f09bc 100644 --- a/xserver/include/closestr.h +++ b/xserver/include/closestr.h @@ -47,7 +47,7 @@ typedef struct _OFclosure { Mask flags; /* XXX -- get these from request buffer instead? */ - char *origFontName; + const char *origFontName; int origFontNameLen; XID fontid; char *fontname; @@ -64,7 +64,7 @@ typedef struct _LFWIstate { int current_fpe; int max_names; Bool list_started; - pointer private; + void *private; } LFWIstateRec, *LFWIstatePtr; typedef struct _LFWIclosure { diff --git a/xserver/include/colormap.h b/xserver/include/colormap.h index 8996cfec5..22229ca84 100644 --- a/xserver/include/colormap.h +++ b/xserver/include/colormap.h @@ -82,14 +82,14 @@ extern _X_EXPORT int CreateColormap(Colormap /*mid */ , int /*alloc */ , int /*client */ ); -extern _X_EXPORT int FreeColormap(pointer /*pmap */ , +extern _X_EXPORT int FreeColormap(void */*pmap */ , XID /*mid */ ); extern _X_EXPORT int TellLostMap(WindowPtr /*pwin */ , - pointer /* Colormap *pmid */ ); + void */* Colormap *pmid */ ); extern _X_EXPORT int TellGainedMap(WindowPtr /*pwin */ , - pointer /* Colormap *pmid */ ); + void */* Colormap *pmid */ ); extern _X_EXPORT int CopyColormapAndFree(Colormap /*mid */ , ColormapPtr /*pSrc */ , @@ -126,7 +126,7 @@ extern _X_EXPORT int QueryColors(ColormapPtr /*pmap */ , xrgb * /*prgbList */ , ClientPtr client); -extern _X_EXPORT int FreeClientPixels(pointer /*pcr */ , +extern _X_EXPORT int FreeClientPixels(void */*pcr */ , XID /*fakeid */ ); extern _X_EXPORT int AllocColorCells(int /*client */ , diff --git a/xserver/include/cursor.h b/xserver/include/cursor.h index 89a650fc5..9da08affd 100644 --- a/xserver/include/cursor.h +++ b/xserver/include/cursor.h @@ -68,7 +68,7 @@ extern _X_EXPORT DevScreenPrivateKeyRec cursorScreenDevPriv; extern _X_EXPORT CursorPtr rootCursor; -extern _X_EXPORT int FreeCursor(pointer /*pCurs */ , +extern _X_EXPORT int FreeCursor(void */*pCurs */ , XID /*cid */ ); extern _X_EXPORT CursorPtr RefCursor(CursorPtr /* cursor */); diff --git a/xserver/include/dbus-core.h b/xserver/include/dbus-core.h new file mode 100644 index 000000000..b2d6d1b9e --- /dev/null +++ b/xserver/include/dbus-core.h @@ -0,0 +1,56 @@ +/* + * Copyright © 2013 Red Hat, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Author: Hans de Goede <hdegoede@redhat.com> + */ + +#ifndef DBUS_CORE_H +#define DBUS_CORE_H + +#ifdef NEED_DBUS +typedef struct DBusConnection DBusConnection; + +typedef void (*dbus_core_connect_hook) (DBusConnection * connection, + void *data); +typedef void (*dbus_core_disconnect_hook) (void *data); + +struct dbus_core_hook { + dbus_core_connect_hook connect; + dbus_core_disconnect_hook disconnect; + void *data; + + struct dbus_core_hook *next; +}; + +int dbus_core_init(void); +void dbus_core_fini(void); +int dbus_core_add_hook(struct dbus_core_hook *hook); +void dbus_core_remove_hook(struct dbus_core_hook *hook); + +#else + +#define dbus_core_init() +#define dbus_core_fini() + +#endif + +#endif diff --git a/xserver/include/dix-config.h.in b/xserver/include/dix-config.h.in index f5cfc4c6d..8f5d17a67 100644 --- a/xserver/include/dix-config.h.in +++ b/xserver/include/dix-config.h.in @@ -199,6 +199,9 @@ /* Define to 1 if you have the `strndup' function. */ #undef HAVE_STRNDUP +/* Define to 1 if libsystemd-daemon is available */ +#undef HAVE_SYSTEMD_DAEMON + /* Define to 1 if SYSV IPC is available */ #undef HAVE_SYSV_IPC @@ -285,9 +288,15 @@ /* Support SHAPE extension */ #undef SHAPE +/* Where to install Xorg.bin and Xorg.wrap */ +#undef SUID_WRAPPER_DIR + /* Define to 1 on systems derived from System V Release 4 */ #undef SVR4 +/* sysconfdir */ +#undef SYSCONFDIR + /* Support TCP socket connections */ #undef TCPCONN @@ -411,15 +420,15 @@ /* Use udev_enumerate_add_match_tag() */ #undef HAVE_UDEV_ENUMERATE_ADD_MATCH_TAG -/* Use D-Bus for input hotplug */ -#undef CONFIG_NEED_DBUS - -/* Support the D-Bus hotplug API */ -#undef CONFIG_DBUS_API +/* Enable D-Bus core */ +#undef NEED_DBUS /* Support HAL for hotplug */ #undef CONFIG_HAL +/* Enable systemd-logind integration */ +#undef SYSTEMD_LOGIND 1 + /* Use wscons for input auto configuration */ #undef CONFIG_WSCONS @@ -475,4 +484,19 @@ /* Directory for shared memory temp files */ #undef SHMDIR +/* Don't let Xdefs.h define 'pointer' */ +#define _XTYPEDEF_POINTER 1 + +/* Don't let XIproto define 'Pointer' */ +#define _XITYPEDEF_POINTER 1 + +/* Ask fontsproto to make font path element names const */ +#define FONT_PATH_ELEMENT_NAME_CONST 1 + +/* Build GLAMOR */ +#undef GLAMOR + +/* Build glamor's GBM-based EGL support */ +#undef GLAMOR_HAS_GBM + #endif /* _DIX_CONFIG_H_ */ diff --git a/xserver/include/dix.h b/xserver/include/dix.h index fa7ccd4a3..f42e23655 100644 --- a/xserver/include/dix.h +++ b/xserver/include/dix.h @@ -147,14 +147,14 @@ extern _X_EXPORT void UpdateCurrentTime(void); extern _X_EXPORT void UpdateCurrentTimeIf(void); -extern _X_EXPORT int dixDestroyPixmap(pointer /*value */ , +extern _X_EXPORT int dixDestroyPixmap(void */*value */ , XID /*pid */ ); extern _X_EXPORT void InitClient(ClientPtr /*client */ , int /*i */ , - pointer /*ospriv */ ); + void */*ospriv */ ); -extern _X_EXPORT ClientPtr NextAvailableClient(pointer /*ospriv */ ); +extern _X_EXPORT ClientPtr NextAvailableClient(void */*ospriv */ ); extern _X_EXPORT void SendErrorToClient(ClientPtr /*client */ , unsigned int /*majorCode */ , @@ -203,11 +203,11 @@ extern _X_EXPORT int AlterSaveSetForClient(ClientPtr /*client */ , extern _X_EXPORT void DeleteWindowFromAnySaveSet(WindowPtr /*pWin */ ); -extern _X_EXPORT void BlockHandler(pointer /*pTimeout */ , - pointer /*pReadmask */ ); +extern _X_EXPORT void BlockHandler(void */*pTimeout */ , + void */*pReadmask */ ); extern _X_EXPORT void WakeupHandler(int /*result */ , - pointer /*pReadmask */ ); + void */*pReadmask */ ); void EnableLimitedSchedulingLatency(void); @@ -215,21 +215,21 @@ void void DisableLimitedSchedulingLatency(void); -typedef void (*WakeupHandlerProcPtr) (pointer /* blockData */ , +typedef void (*WakeupHandlerProcPtr) (void */* blockData */ , int /* result */ , - pointer /* pReadmask */ ); + void */* pReadmask */ ); extern _X_EXPORT Bool RegisterBlockAndWakeupHandlers(BlockHandlerProcPtr /*blockHandler */ , WakeupHandlerProcPtr /*wakeupHandler */ , - pointer /*blockData */ ); + void */*blockData */ ); extern _X_EXPORT void RemoveBlockAndWakeupHandlers(BlockHandlerProcPtr /*blockHandler */ , WakeupHandlerProcPtr /*wakeupHandler */ , - pointer /*blockData */ ); + void */*blockData */ ); extern _X_EXPORT void InitBlockAndWakeupHandlers(void); @@ -241,18 +241,18 @@ extern _X_EXPORT Bool QueueWorkProc(Bool (* /*function */ )( ClientPtr /*clientUnused */ , - pointer + void * /*closure */ ), ClientPtr /*client */ , - pointer /*closure */ + void */*closure */ ); typedef Bool (*ClientSleepProcPtr) (ClientPtr /*client */ , - pointer /*closure */ ); + void */*closure */ ); extern _X_EXPORT Bool ClientSleep(ClientPtr /*client */ , ClientSleepProcPtr /* function */ , - pointer /*closure */ ); + void */*closure */ ); #ifndef ___CLIENTSIGNAL_DEFINED___ #define ___CLIENTSIGNAL_DEFINED___ @@ -289,7 +289,10 @@ extern _X_EXPORT void SetVendorRelease(int release); extern _X_EXPORT void -SetVendorString(char *string); +SetVendorString(const char *string); + +int +dix_main(int argc, char *argv[], char *envp[]); /* events.c */ @@ -441,7 +444,7 @@ extern void RecalculateDeliverableEvents(WindowPtr /* pWin */ ); extern _X_EXPORT int -OtherClientGone(pointer /* value */ , +OtherClientGone(void */* value */ , XID /* id */ ); extern void @@ -605,4 +608,6 @@ CorePointerProc(DeviceIntPtr dev, int what); extern _X_HIDDEN int CoreKeyboardProc(DeviceIntPtr dev, int what); +extern _X_EXPORT void *lastGLContext; + #endif /* DIX_H */ diff --git a/xserver/include/dixfont.h b/xserver/include/dixfont.h index 0a5f105c0..40d80c141 100644 --- a/xserver/include/dixfont.h +++ b/xserver/include/dixfont.h @@ -34,23 +34,23 @@ SOFTWARE. typedef struct _DIXFontProp *DIXFontPropPtr; -extern _X_EXPORT Bool SetDefaultFont(char * /*defaultfontname */ ); +extern _X_EXPORT Bool SetDefaultFont(const char * /*defaultfontname */ ); extern _X_EXPORT void QueueFontWakeup(FontPathElementPtr /*fpe */ ); extern _X_EXPORT void RemoveFontWakeup(FontPathElementPtr /*fpe */ ); -extern _X_EXPORT void FontWakeup(pointer /*data */ , +extern _X_EXPORT void FontWakeup(void */*data */ , int /*count */ , - pointer /*LastSelectMask */ ); + void */*LastSelectMask */ ); extern _X_EXPORT int OpenFont(ClientPtr /*client */ , XID /*fid */ , Mask /*flags */ , unsigned /*lenfname */ , - char * /*pfontname */ ); + const char * /*pfontname */ ); -extern _X_EXPORT int CloseFont(pointer /*pfont */ , +extern _X_EXPORT int CloseFont(void */*pfont */ , XID /*fid */ ); typedef struct _xQueryFontReply *xQueryFontReplyPtr; @@ -99,7 +99,7 @@ extern _X_EXPORT int SetFontPath(ClientPtr /*client */ , int /*npaths */ , unsigned char * /*paths */ ); -extern _X_EXPORT int SetDefaultFontPath(char * /*path */ ); +extern _X_EXPORT int SetDefaultFontPath(const char * /*path */ ); extern _X_EXPORT int GetFontPath(ClientPtr client, int *count, diff --git a/xserver/include/dixfontstubs.h b/xserver/include/dixfontstubs.h index 0454ffa6c..535d312e6 100644 --- a/xserver/include/dixfontstubs.h +++ b/xserver/include/dixfontstubs.h @@ -11,8 +11,6 @@ extern _X_EXPORT int client_auth_generation(ClientPtr client); extern _X_EXPORT void DeleteFontClientID(Font id); -extern _X_EXPORT FontResolutionPtr GetClientResolutions(int *num); - extern _X_EXPORT int GetDefaultPointSize(void); extern _X_EXPORT Font GetNewFontClientID(void); diff --git a/xserver/include/dixgrabs.h b/xserver/include/dixgrabs.h index ca3c95be7..d78d8127b 100644 --- a/xserver/include/dixgrabs.h +++ b/xserver/include/dixgrabs.h @@ -47,7 +47,7 @@ extern GrabPtr CreateGrab(int /* client */ , WindowPtr /* confineTo */ , CursorPtr /* cursor */ ); -extern _X_EXPORT int DeletePassiveGrab(pointer /* value */ , +extern _X_EXPORT int DeletePassiveGrab(void */* value */ , XID /* id */ ); extern _X_EXPORT Bool GrabMatchesSecond(GrabPtr /* pFirstGrab */ , diff --git a/xserver/include/dixstruct.h b/xserver/include/dixstruct.h index 6f5667fcb..6c13895d7 100644 --- a/xserver/include/dixstruct.h +++ b/xserver/include/dixstruct.h @@ -74,8 +74,8 @@ typedef struct _saveSet { #define SaveSetAssignMap(ss,m) ((ss).map = (m)) typedef struct _Client { - pointer requestBuffer; - pointer osPrivate; /* for OS layer, including scheduler */ + void *requestBuffer; + void *osPrivate; /* for OS layer, including scheduler */ Mask clientAsMask; short index; unsigned char majorOp, minorOp; @@ -106,7 +106,6 @@ typedef struct _Client { int smart_start_tick; int smart_stop_tick; - int smart_check_tick; DeviceIntPtr clientPtr; ClientIdPtr clientIds; @@ -149,10 +148,10 @@ SmartScheduleInit(void); typedef struct _WorkQueue { struct _WorkQueue *next; Bool (*function) (ClientPtr /* pClient */ , - pointer /* closure */ + void * /* closure */ ); ClientPtr client; - pointer closure; + void *closure; } WorkQueueRec; extern _X_EXPORT TimeStamp currentTime; @@ -166,7 +165,7 @@ ClientTimeToServerTime(CARD32 /*c */ ); typedef struct _CallbackRec { CallbackProcPtr proc; - pointer data; + void *data; Bool deleted; struct _CallbackRec *next; } CallbackRec, *CallbackPtr; diff --git a/xserver/include/do-not-use-config.h.in b/xserver/include/do-not-use-config.h.in index 9a70b8d97..34b79d0ff 100644 --- a/xserver/include/do-not-use-config.h.in +++ b/xserver/include/do-not-use-config.h.in @@ -36,15 +36,9 @@ /* Support Composite Extension */ #undef COMPOSITE -/* Use the D-Bus input configuration API */ -#undef CONFIG_DBUS_API - /* Use the HAL hotplug API */ #undef CONFIG_HAL -/* Use D-Bus for input hotplug */ -#undef CONFIG_NEED_DBUS - /* Use libudev for input hotplug */ #undef CONFIG_UDEV @@ -87,12 +81,18 @@ /* Default log location */ #undef DEFAULT_LOGDIR -/* Default log location */ +/* Default logfile prefix */ #undef DEFAULT_LOGPREFIX /* Default module search path */ #undef DEFAULT_MODULE_PATH +/* Default XDG_DATA dir under HOME */ +#undef DEFAULT_XDG_DATA_HOME + +/* Default log dir under XDG_DATA_HOME */ +#undef DEFAULT_XDG_DATA_HOME_LOGDIR + /* Support DGA extension */ #undef DGA @@ -111,6 +111,12 @@ /* Default DRI driver path */ #undef DRI_DRIVER_PATH +/* Build glamor */ +#undef GLAMOR + +/* Build glamor with GBM-based EGL support */ +#undef GLAMOR_HAS_GBM + /* Build GLX extension */ #undef GLXEXT @@ -322,6 +328,9 @@ /* Define to 1 if you have the <stropts.h> header file. */ #undef HAVE_STROPTS_H +/* Define to 1 if libsystemd-daemon is available */ +#undef HAVE_SYSTEMD_DAEMON + /* Define to 1 if SYSV IPC is available */ #undef HAVE_SYSV_IPC @@ -344,6 +353,9 @@ /* Define to 1 if you have the <sys/memrange.h> header file. */ #undef HAVE_SYS_MEMRANGE_H +/* Define to 1 if you have the <sys/mkdev.h> header file. */ +#undef HAVE_SYS_MKDEV_H + /* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'. */ #undef HAVE_SYS_NDIR_H @@ -419,6 +431,9 @@ /* Have monotonic clock from clock_gettime() */ #undef MONOTONIC_CLOCK +/* Enable D-Bus core */ +#undef NEED_DBUS + /* Need XFree86 helper functions */ #undef NEED_XF86_PROTOTYPES @@ -521,15 +536,21 @@ /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS +/* Where to install Xorg.bin and Xorg.wrap */ +#undef SUID_WRAPPER_DIR + /* Define to 1 on systems derived from System V Release 4 */ #undef SVR4 -/* Location of system.XWinrc */ +/* sysconfdir */ #undef SYSCONFDIR /* System has syscons console */ #undef SYSCONS_SUPPORT +/* Enable systemd-logind integration */ +#undef SYSTEMD_LOGIND + /* Support TCP socket connections */ #undef TCPCONN diff --git a/xserver/include/eventstr.h b/xserver/include/eventstr.h index 3950584d5..cce903d04 100644 --- a/xserver/include/eventstr.h +++ b/xserver/include/eventstr.h @@ -176,7 +176,7 @@ struct _DeviceChangedEvent { struct { uint32_t min; /**< Minimum value */ uint32_t max; /**< Maximum value */ - double value; /**< Current value */; + double value; /**< Current value */ /* FIXME: frac parts of min/max */ uint32_t resolution; /**< Resolution counts/m */ uint8_t mode; /**< Relative or Absolute */ diff --git a/xserver/include/extension.h b/xserver/include/extension.h index acc6addb7..7c09af150 100644 --- a/xserver/include/extension.h +++ b/xserver/include/extension.h @@ -97,6 +97,7 @@ extern _X_EXPORT void InitExtensions(int argc, char **argv); extern _X_EXPORT void CloseDownExtensions(void); -extern _X_EXPORT void LoadExtension(const ExtensionModule *ext, Bool external); +extern _X_EXPORT void LoadExtensionList(const ExtensionModule ext[], + int listSize, Bool external); #endif /* EXTENSION_H */ diff --git a/xserver/include/extnsionst.h b/xserver/include/extnsionst.h index e82523698..fbdb73c53 100644 --- a/xserver/include/extnsionst.h +++ b/xserver/include/extnsionst.h @@ -58,15 +58,15 @@ typedef struct _ExtensionEntry { int index; void (*CloseDown) ( /* called at server shutdown */ struct _ExtensionEntry * /* extension */ ); - char *name; /* extension name */ + const char *name; /* extension name */ int base; /* base request number */ int eventBase; int eventLast; int errorBase; int errorLast; int num_aliases; - char **aliases; - pointer extPrivate; + const char **aliases; + void *extPrivate; unsigned short (*MinorOpcode) ( /* called for errors */ ClientPtr /* client */ ); PrivateRec *devPrivates; diff --git a/xserver/include/gc.h b/xserver/include/gc.h index 6e5b92da2..ecaa257bb 100644 --- a/xserver/include/gc.h +++ b/xserver/include/gc.h @@ -88,7 +88,7 @@ extern _X_EXPORT void ValidateGC(DrawablePtr /*pDraw */ , typedef union { CARD32 val; - pointer ptr; + void *ptr; } ChangeGCVal, *ChangeGCValPtr; extern int ChangeGCXIDs(ClientPtr /*client */ , @@ -112,7 +112,7 @@ extern _X_EXPORT int CopyGC(GCPtr /*pgcSrc */ , GCPtr /*pgcDst */ , BITS32 /*mask */ ); -extern _X_EXPORT int FreeGC(pointer /*pGC */ , +extern _X_EXPORT int FreeGC(void */*pGC */ , XID /*gid */ ); extern _X_EXPORT void FreeGCperDepth(int /*screenNum */ ); diff --git a/xserver/include/gcstruct.h b/xserver/include/gcstruct.h index 7621ceb11..c830ccde7 100644 --- a/xserver/include/gcstruct.h +++ b/xserver/include/gcstruct.h @@ -78,7 +78,7 @@ typedef struct _GCFuncs { void (*ChangeClip) (GCPtr /*pGC */ , int /*type */ , - pointer /*pvalue */ , + void */*pvalue */ , int /*nrects */ ); void (*DestroyClip) (GCPtr /*pGC */ ); @@ -216,7 +216,7 @@ typedef struct _GCOps { int /*y */ , unsigned int /*nglyph */ , CharInfoPtr * /*ppci */ , - pointer /*pglyphBase */ ); + void */*pglyphBase */ ); void (*PolyGlyphBlt) (DrawablePtr /*pDrawable */ , GCPtr /*pGC */ , @@ -224,7 +224,7 @@ typedef struct _GCOps { int /*y */ , unsigned int /*nglyph */ , CharInfoPtr * /*ppci */ , - pointer /*pglyphBase */ ); + void */*pglyphBase */ ); void (*PushPixels) (GCPtr /*pGC */ , PixmapPtr /*pBitMap */ , @@ -273,11 +273,11 @@ typedef struct _GC { DDXPointRec patOrg; /* origin for (tile, stipple) */ struct _Font *font; DDXPointRec clipOrg; - pointer clientClip; + void *clientClip; unsigned long stateChanges; /* masked with GC_<kind> */ unsigned long serialNumber; - GCFuncs *funcs; - GCOps *ops; + const GCFuncs *funcs; + const GCOps *ops; PrivateRec *devPrivates; /* * The following were moved here from private storage to allow device- diff --git a/xserver/include/globals.h b/xserver/include/globals.h index 7786987a4..858c9a375 100644 --- a/xserver/include/globals.h +++ b/xserver/include/globals.h @@ -18,7 +18,7 @@ extern _X_EXPORT CARD32 ScreenSaverInterval; extern _X_EXPORT Bool screenSaverSuspended; #endif -extern _X_EXPORT char *defaultFontPath; +extern _X_EXPORT const char *defaultFontPath; extern _X_EXPORT int monitorResolution; extern _X_EXPORT int defaultColorVisualClass; diff --git a/xserver/include/hotplug.h b/xserver/include/hotplug.h index 29a22c4da..4c2fa970c 100644 --- a/xserver/include/hotplug.h +++ b/xserver/include/hotplug.h @@ -32,27 +32,46 @@ extern _X_EXPORT void config_pre_init(void); extern _X_EXPORT void config_init(void); extern _X_EXPORT void config_fini(void); +enum { ODEV_ATTRIB_UNKNOWN = -1, ODEV_ATTRIB_STRING = 0, ODEV_ATTRIB_INT }; + struct OdevAttribute { struct xorg_list member; int attrib_id; - char *attrib_name; + union { + char *attrib_name; + int attrib_value; + }; + int attrib_type; }; struct OdevAttributes { struct xorg_list list; - Bool unowned; }; +/* Note starting with xserver 1.16 this function never fails */ struct OdevAttributes * config_odev_allocate_attribute_list(void); void config_odev_free_attribute_list(struct OdevAttributes *attribs); +/* Note starting with xserver 1.16 this function never fails */ Bool config_odev_add_attribute(struct OdevAttributes *attribs, int attrib, const char *attrib_name); +char * +config_odev_get_attribute(struct OdevAttributes *attribs, int attrib_id); + +/* Note starting with xserver 1.16 this function never fails */ +Bool +config_odev_add_int_attribute(struct OdevAttributes *attribs, int attrib, + int attrib_value); + +int +config_odev_get_int_attribute(struct OdevAttributes *attribs, int attrib, + int def); + void config_odev_free_attributes(struct OdevAttributes *attribs); @@ -62,6 +81,14 @@ config_odev_free_attributes(struct OdevAttributes *attribs); #define ODEV_ATTRIB_SYSPATH 2 /* DRI-style bus id */ #define ODEV_ATTRIB_BUSID 3 +/* Server managed FD */ +#define ODEV_ATTRIB_FD 4 +/* Major number of the device node pointed to by ODEV_ATTRIB_PATH */ +#define ODEV_ATTRIB_MAJOR 5 +/* Minor number of the device node pointed to by ODEV_ATTRIB_PATH */ +#define ODEV_ATTRIB_MINOR 6 +/* kernel driver name */ +#define ODEV_ATTRIB_DRIVER 7 typedef void (*config_odev_probe_proc_ptr)(struct OdevAttributes *attribs); void config_odev_probe(config_odev_probe_proc_ptr probe_callback); @@ -72,4 +99,8 @@ void DeleteGPUDeviceRequest(struct OdevAttributes *attribs); #endif #define ServerIsNotSeat0() (SeatId && strcmp(SeatId, "seat0")) + +struct xf86_platform_device * +xf86_find_platform_device_by_devnum(int major, int minor); + #endif /* HOTPLUG_H */ diff --git a/xserver/include/input.h b/xserver/include/input.h index 2d5e531ef..cbf949b53 100644 --- a/xserver/include/input.h +++ b/xserver/include/input.h @@ -95,8 +95,8 @@ SOFTWARE. #define NO_AXIS_LIMITS -1 -#define MAP_LENGTH 256 -#define DOWN_LENGTH 32 /* 256/8 => number of bytes to hold 256 bits */ +#define MAP_LENGTH MAX_BUTTONS +#define DOWN_LENGTH (MAX_BUTTONS/8) /* 256/8 => number of bytes to hold 256 bits */ #define NullGrab ((GrabPtr)NULL) #define PointerRootWin ((WindowPtr)PointerRoot) #define NoneWin ((WindowPtr)None) @@ -163,7 +163,7 @@ typedef Bool (*PointerAccelSchemeInitProc) (DeviceIntPtr /*dev */ , /*protoScheme */ ); typedef struct _DeviceRec { - pointer devicePrivate; + void *devicePrivate; ProcessInputProc processInputProc; /* current */ ProcessInputProc realInputProc; /* deliver */ ProcessInputProc enqueueInputProc; /* enqueue */ @@ -316,7 +316,7 @@ extern _X_EXPORT Bool InitTouchClassDeviceStruct(DeviceIntPtr /*device */ , typedef void (*BellProcPtr) (int /*percent */ , DeviceIntPtr /*device */ , - pointer /*ctrl */ , + void */*ctrl */ , int); typedef void (*KbdCtrlProcPtr) (DeviceIntPtr /*device */ , @@ -385,6 +385,12 @@ extern _X_EXPORT Bool InitKeyboardDeviceStruct(DeviceIntPtr /*device */ , KbdCtrlProcPtr /*controlProc */ ); +extern _X_EXPORT Bool InitKeyboardDeviceStructFromString(DeviceIntPtr dev, + const char *keymap, + int keymap_length, + BellProcPtr bell_func, + KbdCtrlProcPtr ctrl_func); + extern int ApplyPointerMapping(DeviceIntPtr /* pDev */ , CARD8 * /* map */ , int /* len */ , @@ -601,6 +607,7 @@ extern int GetXI2MaskByte(XI2Mask *mask, DeviceIntPtr dev, int event_type); void FixUpEventFromWindow(SpritePtr pSprite, xEvent *xE, WindowPtr pWin, Window child, Bool calcChild); +extern Bool PointInBorderSize(WindowPtr pWin, int x, int y); extern WindowPtr XYToWindow(SpritePtr pSprite, int x, int y); extern int EventIsDeliverable(DeviceIntPtr dev, int evtype, WindowPtr win); extern Bool ActivatePassiveGrab(DeviceIntPtr dev, GrabPtr grab, diff --git a/xserver/include/inputstr.h b/xserver/include/inputstr.h index dc36c5d8d..f6cfb049d 100644 --- a/xserver/include/inputstr.h +++ b/xserver/include/inputstr.h @@ -447,7 +447,7 @@ typedef struct _XIPropertyValue { Atom type; /* ignored by server */ short format; /* format of data for swapping - 8,16,32 */ long size; /* size of data in (format/8) bytes */ - pointer data; /* private to client */ + void *data; /* private to client */ } XIPropertyValueRec; typedef struct _XIProperty { diff --git a/xserver/include/miscstruct.h b/xserver/include/miscstruct.h index 0820e1e81..dbab10f08 100644 --- a/xserver/include/miscstruct.h +++ b/xserver/include/miscstruct.h @@ -56,10 +56,10 @@ typedef xPoint DDXPointRec; typedef struct pixman_box16 BoxRec; typedef union _DevUnion { - pointer ptr; + void *ptr; long val; unsigned long uval; - pointer (*fptr) (void); + void *(*fptr) (void); } DevUnion; #endif /* MISCSTRUCT_H */ diff --git a/xserver/include/opaque.h b/xserver/include/opaque.h index b76ab6e6b..a2c54aa6a 100644 --- a/xserver/include/opaque.h +++ b/xserver/include/opaque.h @@ -33,8 +33,8 @@ from The Open Group. #include "globals.h" -extern _X_EXPORT char *defaultTextFont; -extern _X_EXPORT char *defaultCursorFont; +extern _X_EXPORT const char *defaultTextFont; +extern _X_EXPORT const char *defaultCursorFont; extern _X_EXPORT int MaxClients; extern _X_EXPORT volatile char isItTimeToYield; extern _X_EXPORT volatile char dispatchException; @@ -49,12 +49,14 @@ extern _X_EXPORT int ScreenSaverBlanking; extern _X_EXPORT int ScreenSaverAllowExposures; extern _X_EXPORT int defaultScreenSaverBlanking; extern _X_EXPORT int defaultScreenSaverAllowExposures; -extern _X_EXPORT char *display; +extern _X_EXPORT const char *display; extern _X_EXPORT int displayfd; +extern _X_EXPORT Bool explicit_display; extern _X_EXPORT int defaultBackingStore; extern _X_EXPORT Bool disableBackingStore; extern _X_EXPORT Bool enableBackingStore; +extern _X_EXPORT Bool enableIndirectGLX; extern _X_EXPORT Bool PartialNetwork; extern _X_EXPORT Bool RunFromSigStopParent; @@ -74,5 +76,6 @@ extern _X_EXPORT Bool whiteRoot; extern _X_EXPORT Bool bgNoneRoot; extern _X_EXPORT Bool CoreDump; +extern _X_EXPORT Bool NoListenAll; #endif /* OPAQUE_H */ diff --git a/xserver/include/os.h b/xserver/include/os.h index f2ee9da12..7bae5b67f 100644 --- a/xserver/include/os.h +++ b/xserver/include/os.h @@ -70,12 +70,12 @@ typedef struct _NewClientRec *NewClientPtr; #ifndef xalloc #define xnfalloc(size) XNFalloc((unsigned long)(size)) #define xnfcalloc(_num, _size) XNFcalloc((unsigned long)(_num)*(unsigned long)(_size)) -#define xnfrealloc(ptr, size) XNFrealloc((pointer)(ptr), (unsigned long)(size)) +#define xnfrealloc(ptr, size) XNFrealloc((void *)(ptr), (unsigned long)(size)) #define xalloc(size) Xalloc((unsigned long)(size)) #define xcalloc(_num, _size) Xcalloc((unsigned long)(_num)*(unsigned long)(_size)) -#define xrealloc(ptr, size) Xrealloc((pointer)(ptr), (unsigned long)(size)) -#define xfree(ptr) Xfree((pointer)(ptr)) +#define xrealloc(ptr, size) Xrealloc((void *)(ptr), (unsigned long)(size)) +#define xfree(ptr) Xfree((void *)(ptr)) #define xstrdup(s) Xstrdup(s) #define xnfstrdup(s) XNFstrdup(s) #endif @@ -140,7 +140,7 @@ extern _X_EXPORT const char *ClientAuthorized(ClientPtr /*client */ , char * /*auth_string */ ); extern _X_EXPORT Bool EstablishNewConnections(ClientPtr /*clientUnused */ , - pointer /*closure */ ); + void */*closure */ ); extern _X_EXPORT void CheckConnections(void); @@ -166,21 +166,21 @@ extern _X_EXPORT void MakeClientGrabImpervious(ClientPtr /*client */ ); extern _X_EXPORT void MakeClientGrabPervious(ClientPtr /*client */ ); -#ifdef XQUARTZ -extern void ListenOnOpenFD(int /* fd */ , int /* noxauth */ ); -#endif +extern _X_EXPORT void ListenOnOpenFD(int /* fd */ , int /* noxauth */ ); + +extern _X_EXPORT Bool AddClientOnOpenFD(int /* fd */ ); extern _X_EXPORT CARD32 GetTimeInMillis(void); extern _X_EXPORT CARD64 GetTimeInMicros(void); -extern _X_EXPORT void AdjustWaitForDelay(pointer /*waitTime */ , +extern _X_EXPORT void AdjustWaitForDelay(void */*waitTime */ , unsigned long /*newdelay */ ); typedef struct _OsTimerRec *OsTimerPtr; typedef CARD32 (*OsTimerCallback) (OsTimerPtr /* timer */ , CARD32 /* time */ , - pointer /* arg */ ); + void */* arg */ ); extern _X_EXPORT void TimerInit(void); @@ -193,7 +193,7 @@ extern _X_EXPORT OsTimerPtr TimerSet(OsTimerPtr /* timer */ , int /* flags */ , CARD32 /* millis */ , OsTimerCallback /* func */ , - pointer /* arg */ ); + void */* arg */ ); extern _X_EXPORT void TimerCheck(void); extern _X_EXPORT void TimerCancel(OsTimerPtr /* pTimer */ ); @@ -212,7 +212,7 @@ extern _X_EXPORT void ProcessCommandLine(int /*argc */ , char * /*argv */ []); extern _X_EXPORT int set_font_authorizations(char ** /* authorizations */ , int * /*authlen */ , - pointer /* client */ ); + void */* client */ ); #ifndef _HAVE_XALLOC_DECLS #define _HAVE_XALLOC_DECLS @@ -366,14 +366,14 @@ OsAbort(void) #if !defined(WIN32) extern _X_EXPORT int System(const char *); -extern _X_EXPORT pointer +extern _X_EXPORT void * Popen(const char *, const char *); extern _X_EXPORT int -Pclose(pointer); -extern _X_EXPORT pointer +Pclose(void *); +extern _X_EXPORT void * Fopen(const char *, const char *); extern _X_EXPORT int -Fclose(pointer); +Fclose(void *); #else extern const char * @@ -402,17 +402,17 @@ ForEachHostInFamily(int /*family */ , Bool (* /*func */ )( unsigned char * /* addr */ , short /* len */ , - pointer /* closure */ ), - pointer /*closure */ ); + void */* closure */ ), + void */*closure */ ); extern _X_EXPORT int RemoveHost(ClientPtr /*client */ , int /*family */ , unsigned /*length */ , - pointer /*pAddr */ ); + void */*pAddr */ ); extern _X_EXPORT int -GetHosts(pointer * /*data */ , +GetHosts(void ** /*data */ , int * /*pnHosts */ , int * /*pLen */ , BOOL * /*pEnabled */ ); @@ -455,7 +455,7 @@ extern _X_EXPORT void AddLocalHosts(void); extern _X_EXPORT void -ResetHosts(char *display); +ResetHosts(const char *display); extern _X_EXPORT void EnableLocalHost(void); @@ -471,14 +471,14 @@ DefineSelf(int /*fd */ ); #if XDMCP extern _X_EXPORT void -AugmentSelf(pointer /*from */ , int /*len */ ); +AugmentSelf(void */*from */ , int /*len */ ); extern _X_EXPORT void RegisterAuthorizations(void); #endif extern _X_EXPORT void -InitAuthorization(char * /*filename */ ); +InitAuthorization(const char * /*filename */ ); /* extern int LoadAuthorization(void); */ diff --git a/xserver/include/pixmap.h b/xserver/include/pixmap.h index 921a94d1e..46ec3f5a2 100644 --- a/xserver/include/pixmap.h +++ b/xserver/include/pixmap.h @@ -99,7 +99,7 @@ extern _X_EXPORT PixmapPtr GetScratchPixmapHeader(ScreenPtr /*pScreen */ , int /*depth */ , int /*bitsPerPixel */ , int /*devKind */ , - pointer /*pPixData */ ); + void */*pPixData */ ); extern _X_EXPORT void FreeScratchPixmapHeader(PixmapPtr /*pPixmap */ ); diff --git a/xserver/include/privates.h b/xserver/include/privates.h index 0abdce784..7d1461cdb 100644 --- a/xserver/include/privates.h +++ b/xserver/include/privates.h @@ -142,10 +142,10 @@ dixGetPrivate(PrivatePtr *privates, const DevPrivateKey key) * dixLookupPrivate(privates, key) will return 'val'. */ static inline void -dixSetPrivate(PrivatePtr *privates, const DevPrivateKey key, pointer val) +dixSetPrivate(PrivatePtr *privates, const DevPrivateKey key, void *val) { assert(key->size == 0); - *(pointer *) dixGetPrivateAddr(privates, key) = val; + *(void **) dixGetPrivateAddr(privates, key) = val; } #include "dix.h" @@ -158,7 +158,7 @@ dixSetPrivate(PrivatePtr *privates, const DevPrivateKey key, pointer val) * storage. For privates without defined storage, return the pointer * contents */ -static inline pointer +static inline void * dixLookupPrivate(PrivatePtr *privates, const DevPrivateKey key) { if (key->size) @@ -173,11 +173,11 @@ dixLookupPrivate(PrivatePtr *privates, const DevPrivateKey key) * This returns the place where the private pointer is stored, * which is only valid for privates without predefined storage. */ -static inline pointer * +static inline void ** dixLookupPrivateAddr(PrivatePtr *privates, const DevPrivateKey key) { assert(key->size == 0); - return (pointer *) dixGetPrivateAddr(privates, key); + return (void **) dixGetPrivateAddr(privates, key); } extern _X_EXPORT Bool @@ -204,19 +204,19 @@ dixGetScreenPrivate(PrivatePtr *privates, const DevScreenPrivateKey key, static inline void dixSetScreenPrivate(PrivatePtr *privates, const DevScreenPrivateKey key, - ScreenPtr pScreen, pointer val) + ScreenPtr pScreen, void *val) { dixSetPrivate(privates, _dixGetScreenPrivateKey(key, pScreen), val); } -static inline pointer +static inline void * dixLookupScreenPrivate(PrivatePtr *privates, const DevScreenPrivateKey key, ScreenPtr pScreen) { return dixLookupPrivate(privates, _dixGetScreenPrivateKey(key, pScreen)); } -static inline pointer * +static inline void ** dixLookupScreenPrivateAddr(PrivatePtr *privates, const DevScreenPrivateKey key, ScreenPtr pScreen) { diff --git a/xserver/include/property.h b/xserver/include/property.h index 4219fc487..3b8ea8b2d 100644 --- a/xserver/include/property.h +++ b/xserver/include/property.h @@ -64,7 +64,7 @@ extern _X_EXPORT int dixChangeWindowProperty(ClientPtr /*pClient */ , int /*format */ , int /*mode */ , unsigned long /*len */ , - pointer /*value */ , + void */*value */ , Bool /*sendevent */ ); extern _X_EXPORT int ChangeWindowProperty(WindowPtr /*pWin */ , @@ -73,7 +73,7 @@ extern _X_EXPORT int ChangeWindowProperty(WindowPtr /*pWin */ , int /*format */ , int /*mode */ , unsigned long /*len */ , - pointer /*value */ , + void */*value */ , Bool /*sendevent */ ); extern _X_EXPORT int DeleteProperty(ClientPtr /*client */ , diff --git a/xserver/include/propertyst.h b/xserver/include/propertyst.h index c12c71af6..da995769c 100644 --- a/xserver/include/propertyst.h +++ b/xserver/include/propertyst.h @@ -59,7 +59,7 @@ typedef struct _Property { ATOM type; /* ignored by server */ uint32_t format; /* format of data for swapping - 8,16,32 */ uint32_t size; /* size of data in (format/8) bytes */ - pointer data; /* private to client */ + void *data; /* private to client */ PrivateRec *devPrivates; } PropertyRec; diff --git a/xserver/include/resource.h b/xserver/include/resource.h index 4a8dc3169..db44aefad 100644 --- a/xserver/include/resource.h +++ b/xserver/include/resource.h @@ -133,24 +133,24 @@ typedef struct { ResourceState state; XID id; RESTYPE type; - pointer value; + void *value; } ResourceStateInfoRec; -typedef int (*DeleteType) (pointer /*value */ , +typedef int (*DeleteType) (void */*value */ , XID /*id */ ); -typedef void (*FindResType) (pointer /*value */ , +typedef void (*FindResType) (void */*value */ , XID /*id */ , - pointer /*cdata */ ); + void */*cdata */ ); -typedef void (*FindAllRes) (pointer /*value */ , +typedef void (*FindAllRes) (void */*value */ , XID /*id */ , RESTYPE /*type */ , - pointer /*cdata */ ); + void */*cdata */ ); -typedef Bool (*FindComplexResType) (pointer /*value */ , +typedef Bool (*FindComplexResType) (void */*value */ , XID /*id */ , - pointer /*cdata */ ); + void */*cdata */ ); /* Structure for estimating resource memory usage. Memory usage * consists of space allocated for the resource itself and of @@ -166,16 +166,16 @@ typedef struct { unsigned long refCnt; } ResourceSizeRec, *ResourceSizePtr; -typedef void (*SizeType)(pointer /*value*/, +typedef void (*SizeType)(void */*value*/, XID /*id*/, ResourceSizePtr /*size*/); extern _X_EXPORT RESTYPE CreateNewResourceType(DeleteType /*deleteFunc */ , const char * /*name */ ); -typedef void (*FindTypeSubResources)(pointer /* value */, +typedef void (*FindTypeSubResources)(void */* value */, FindAllRes /* func */, - pointer /* cdata */); + void */* cdata */); extern _X_EXPORT SizeType GetResourceTypeSizeFunc( RESTYPE /*type*/); @@ -202,7 +202,7 @@ extern _X_EXPORT XID FakeClientID(int /*client */ ); #endif extern _X_EXPORT Bool AddResource(XID /*id */ , RESTYPE /*type */ , - pointer /*value */ ); + void */*value */ ); extern _X_EXPORT void FreeResource(XID /*id */ , RESTYPE /*skipDeleteFuncType */ ); @@ -213,25 +213,25 @@ extern _X_EXPORT void FreeResourceByType(XID /*id */ , extern _X_EXPORT Bool ChangeResourceValue(XID /*id */ , RESTYPE /*rtype */ , - pointer /*value */ ); + void */*value */ ); extern _X_EXPORT void FindClientResourcesByType(ClientPtr /*client */ , RESTYPE /*type */ , FindResType /*func */ , - pointer /*cdata */ ); + void */*cdata */ ); extern _X_EXPORT void FindAllClientResources(ClientPtr /*client */ , FindAllRes /*func */ , - pointer /*cdata */ ); + void */*cdata */ ); /** @brief Iterate through all subresources of a resource. @note The XID argument provided to the FindAllRes function may be 0 for subresources that don't have an XID */ -extern _X_EXPORT void FindSubResources(pointer /*resource*/, +extern _X_EXPORT void FindSubResources(void */*resource*/, RESTYPE /*type*/, FindAllRes /*func*/, - pointer /*cdata*/); + void */*cdata*/); extern _X_EXPORT void FreeClientNeverRetainResources(ClientPtr /*client */ ); @@ -242,18 +242,18 @@ extern _X_EXPORT void FreeAllResources(void); extern _X_EXPORT Bool LegalNewID(XID /*id */ , ClientPtr /*client */ ); -extern _X_EXPORT pointer LookupClientResourceComplex(ClientPtr client, +extern _X_EXPORT void *LookupClientResourceComplex(ClientPtr client, RESTYPE type, FindComplexResType func, - pointer cdata); + void *cdata); -extern _X_EXPORT int dixLookupResourceByType(pointer *result, +extern _X_EXPORT int dixLookupResourceByType(void **result, XID id, RESTYPE rtype, ClientPtr client, Mask access_mode); -extern _X_EXPORT int dixLookupResourceByClass(pointer *result, +extern _X_EXPORT int dixLookupResourceByClass(void **result, XID id, RESTYPE rclass, ClientPtr client, diff --git a/xserver/include/scrnintstr.h b/xserver/include/scrnintstr.h index df7407391..6acdadd7a 100644 --- a/xserver/include/scrnintstr.h +++ b/xserver/include/scrnintstr.h @@ -260,12 +260,12 @@ typedef void (*SendGraphicsExposeProcPtr) (ClientPtr /*client */ , int /*minor */ ); typedef void (*ScreenBlockHandlerProcPtr) (ScreenPtr /*pScreen*/ , - pointer /*pTimeout */ , - pointer /*pReadmask */ ); + void */*pTimeout */ , + void */*pReadmask */ ); typedef void (*ScreenWakeupHandlerProcPtr) (ScreenPtr /*pScreen*/ , unsigned long /*result */ , - pointer /*pReadMask */ ); + void */*pReadMask */ ); typedef Bool (*CreateScreenResourcesProcPtr) (ScreenPtr /*pScreen */ ); @@ -275,7 +275,7 @@ typedef Bool (*ModifyPixmapHeaderProcPtr) (PixmapPtr /*pPixmap */ , int /*depth */ , int /*bitsPerPixel */ , int /*devKind */ , - pointer /*pPixData */ ); + void */*pPixData */ ); typedef PixmapPtr (*GetWindowPixmapProcPtr) (WindowPtr /*pWin */ ); @@ -353,6 +353,11 @@ typedef Bool (*StopPixmapTrackingProcPtr)(PixmapPtr, PixmapPtr); typedef Bool (*ReplaceScanoutPixmapProcPtr)(DrawablePtr, PixmapPtr, Bool); +typedef WindowPtr (*XYToWindowProcPtr)(ScreenPtr pScreen, + SpritePtr pSprite, int x, int y); + +typedef int (*NameWindowPixmapProcPtr)(WindowPtr, PixmapPtr, CARD32); + typedef struct _Screen { int myNum; /* index of this instance in Screens[] */ ATOM id; @@ -375,7 +380,7 @@ typedef struct _Screen { a standard one. */ PixmapPtr PixmapPerDepth[1]; - pointer devPrivate; + void *devPrivate; short numVisuals; VisualPtr visuals; WindowPtr root; @@ -463,6 +468,7 @@ typedef struct _Screen { SetWindowPixmapProcPtr SetWindowPixmap; GetScreenPixmapProcPtr GetScreenPixmap; SetScreenPixmapProcPtr SetScreenPixmap; + NameWindowPixmapProcPtr NameWindowPixmap; PixmapPtr pScratchPixmap; /* scratch pixmap "pool" */ @@ -513,6 +519,7 @@ typedef struct _Screen { struct xorg_list offload_head; ReplaceScanoutPixmapProcPtr ReplaceScanoutPixmap; + XYToWindowProcPtr XYToWindow; } ScreenRec; static inline RegionPtr diff --git a/xserver/include/servermd.h b/xserver/include/servermd.h index 91f476efd..eeabaa997 100644 --- a/xserver/include/servermd.h +++ b/xserver/include/servermd.h @@ -134,8 +134,13 @@ SOFTWARE. #if defined(__powerpc__) || defined(__ppc__) || defined(__ppc64__) -#define IMAGE_BYTE_ORDER MSBFirst -#define BITMAP_BIT_ORDER MSBFirst +#if defined(__LITTLE_ENDIAN__) +#define IMAGE_BYTE_ORDER LSBFirst +#define BITMAP_BIT_ORDER LSBFirst +#else +#define IMAGE_BYTE_ORDER MSBFirst +#define BITMAP_BIT_ORDER MSBFirst +#endif #define GLYPHPADBYTES 4 #endif /* PowerPC */ @@ -343,6 +348,33 @@ SOFTWARE. #endif /* __aarch64__ */ +#if defined(__arc__) + +#if defined(__BIG_ENDIAN__) +#define IMAGE_BYTE_ORDER MSBFirst +#define BITMAP_BIT_ORDER MSBFirst +#else +#define IMAGE_BYTE_ORDER LSBFirst +#define BITMAP_BIT_ORDER LSBFirst +#endif +#define GLYPHPADBYTES 4 + +#endif /* ARC */ + +#ifdef __xtensa__ + +#ifdef __XTENSA_EL__ +#define IMAGE_BYTE_ORDER LSBFirst +#define BITMAP_BIT_ORDER LSBFirst +#endif +#ifdef __XTENSA_EB__ +#define IMAGE_BYTE_ORDER MSBFirst +#define BITMAP_BIT_ORDER MSBFirst +#endif +#define GLYPHPADBYTES 4 + +#endif /* __xtensa__ */ + /* size of buffer to use with GetImage, measured in bytes. There's obviously * a trade-off between the amount of heap used and the number of times the * ddx routine has to be called. diff --git a/xserver/include/systemd-logind.h b/xserver/include/systemd-logind.h new file mode 100644 index 000000000..a4067d097 --- /dev/null +++ b/xserver/include/systemd-logind.h @@ -0,0 +1,45 @@ +/* + * Copyright © 2013 Red Hat, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Author: Hans de Goede <hdegoede@redhat.com> + */ + +#ifndef SYSTEMD_LOGIND_H +#define SYSTEMD_LOGIND_H + +#ifdef SYSTEMD_LOGIND +int systemd_logind_init(void); +void systemd_logind_fini(void); +int systemd_logind_take_fd(int major, int minor, const char *path, Bool *paus); +void systemd_logind_release_fd(int major, int minor, int fd); +int systemd_logind_controls_session(void); +void systemd_logind_vtenter(void); +#else +#define systemd_logind_init() +#define systemd_logind_fini() +#define systemd_logind_take_fd(major, minor, path, paus) -1 +#define systemd_logind_release_fd(major, minor, fd) close(fd) +#define systemd_logind_controls_session() 0 +#define systemd_logind_vtenter() +#endif + +#endif diff --git a/xserver/include/window.h b/xserver/include/window.h index b6d61c339..b5a937eef 100644 --- a/xserver/include/window.h +++ b/xserver/include/window.h @@ -73,15 +73,15 @@ typedef struct _BackingStore *BackingStorePtr; typedef struct _Window *WindowPtr; typedef int (*VisitWindowProcPtr) (WindowPtr /*pWin */ , - pointer /*data */ ); + void */*data */ ); extern _X_EXPORT int TraverseTree(WindowPtr /*pWin */ , VisitWindowProcPtr /*func */ , - pointer /*data */ ); + void */*data */ ); extern _X_EXPORT int WalkTree(ScreenPtr /*pScreen */ , VisitWindowProcPtr /*func */ , - pointer /*data */ ); + void */*data */ ); extern _X_EXPORT Bool CreateRootWindow(ScreenPtr /*pScreen */ ); @@ -108,7 +108,7 @@ extern _X_EXPORT WindowPtr CreateWindow(Window /*wid */ , VisualID /*visual */ , int * /*error */ ); -extern _X_EXPORT int DeleteWindow(pointer /*pWin */ , +extern _X_EXPORT int DeleteWindow(void */*pWin */ , XID /*wid */ ); extern _X_EXPORT int DestroySubwindows(WindowPtr /*pWin */ , diff --git a/xserver/include/windowstr.h b/xserver/include/windowstr.h index a1e608f09..6b79bbd2e 100644 --- a/xserver/include/windowstr.h +++ b/xserver/include/windowstr.h @@ -144,7 +144,7 @@ typedef struct _Window { Mask eventMask; /* mask from the creating client */ PixUnion background; PixUnion border; - pointer backStorage; /* null when BS disabled */ + void *backStorage; /* null when BS disabled */ WindowOptPtr optional; unsigned backgroundState:2; /* None, Relative, Pixel, Pixmap */ unsigned borderIsPixel:1; diff --git a/xserver/include/xkbrules.h b/xserver/include/xkbrules.h index d21731884..ab5b4b266 100644 --- a/xserver/include/xkbrules.h +++ b/xserver/include/xkbrules.h @@ -38,32 +38,32 @@ typedef struct _XkbRMLVOSet { } XkbRMLVOSet; typedef struct _XkbRF_VarDefs { - char *model; - char *layout; - char *variant; - char *options; + const char *model; + const char *layout; + const char *variant; + const char *options; } XkbRF_VarDefsRec, *XkbRF_VarDefsPtr; typedef struct _XkbRF_Rule { int number; int layout_num; int variant_num; - char *model; - char *layout; - char *variant; - char *option; + const char *model; + const char *layout; + const char *variant; + const char *option; /* yields */ - char *keycodes; - char *symbols; - char *types; - char *compat; - char *geometry; + const char *keycodes; + const char *symbols; + const char *types; + const char *compat; + const char *geometry; unsigned flags; } XkbRF_RuleRec, *XkbRF_RulePtr; typedef struct _XkbRF_Group { int number; - char *name; + const char *name; char *words; } XkbRF_GroupRec, *XkbRF_GroupPtr; diff --git a/xserver/include/xkbsrv.h b/xserver/include/xkbsrv.h index 346ebccf0..229de2194 100644 --- a/xserver/include/xkbsrv.h +++ b/xserver/include/xkbsrv.h @@ -281,7 +281,7 @@ extern _X_EXPORT DevPrivateKeyRec xkbDevicePrivateKeyRec; #define XKBDEVICEINFO(dev) ((xkbDeviceInfoPtr)dixLookupPrivate(&(dev)->devPrivates, xkbDevicePrivateKey)) -extern void xkbUnwrapProc(DeviceIntPtr, DeviceHandleProc, pointer); +extern void xkbUnwrapProc(DeviceIntPtr, DeviceHandleProc, void *); /***====================================================================***/ @@ -600,7 +600,7 @@ extern _X_EXPORT void XkbHandleBell(BOOL /* force */ , BOOL /* eventOnly */ , DeviceIntPtr /* kbd */ , CARD8 /* percent */ , - pointer /* ctrl */ , + void */* ctrl */ , CARD8 /* class */ , Atom /* name */ , WindowPtr /* pWin */ , @@ -638,6 +638,10 @@ extern _X_EXPORT void XkbHandleActions(DeviceIntPtr /* dev */ , DeviceEvent * /* event */ ); +extern void XkbPushLockedStateToSlaves(DeviceIntPtr /* master */, + int /* evtype */, + int /* key */); + extern _X_EXPORT Bool XkbEnableDisableControls(XkbSrvInfoPtr /* xkbi */ , unsigned long /* change */ , unsigned long /* newValues */ , @@ -738,6 +742,14 @@ extern _X_EXPORT void XkbClearAllLatchesAndLocks(DeviceIntPtr /* dev */ , XkbEventCausePtr /* cause */ ); +extern _X_EXPORT void XkbInitRules(XkbRMLVOSet * /* rmlvo */, + const char * /* rules */, + const char * /* model */, + const char * /* layout */, + const char * /* variant */, + const char * /* options */ + ) ; + extern _X_EXPORT void XkbGetRulesDflts(XkbRMLVOSet * /* rmlvo */ ); @@ -812,8 +824,11 @@ extern _X_EXPORT void XkbSendNewKeyboardNotify(DeviceIntPtr /* kbd */ , extern Bool XkbCopyKeymap(XkbDescPtr /* dst */ , XkbDescPtr /* src */ ); -extern _X_EXPORT Bool XkbCopyDeviceKeymap(DeviceIntPtr /* dst */ , - DeviceIntPtr /* src */ ); +extern _X_EXPORT Bool XkbCopyDeviceKeymap(DeviceIntPtr /* dst */, + DeviceIntPtr /* src */); + +extern _X_EXPORT Bool XkbDeviceApplyKeymap(DeviceIntPtr /* dst */ , + XkbDescPtr /* src */ ); extern void XkbFilterEvents(ClientPtr /* pClient */ , int /* nEvents */ , @@ -829,6 +844,9 @@ extern void XkbFakeDeviceButton(DeviceIntPtr /* dev */ , int /* press */ , int /* button */ ); +extern _X_EXPORT void XkbCopyControls(XkbDescPtr /* dst */ , + XkbDescPtr /* src */ ); + #include "xkbfile.h" #include "xkbrules.h" @@ -852,7 +870,7 @@ extern _X_EXPORT unsigned int XkbDDXLoadKeymapByNames(DeviceIntPtr /* keybd */ , ); extern _X_EXPORT Bool XkbDDXNamesFromRules(DeviceIntPtr /* keybd */ , - char * /* rules */ , + const char * /* rules */ , XkbRF_VarDefsPtr /* defs */ , XkbComponentNamesPtr /* names */ ); @@ -861,4 +879,8 @@ extern _X_EXPORT XkbDescPtr XkbCompileKeymap(DeviceIntPtr /* dev */ , XkbRMLVOSet * /* rmlvo */ ); +extern _X_EXPORT XkbDescPtr XkbCompileKeymapFromString(DeviceIntPtr dev, + const char *keymap, + int keymap_length); + #endif /* _XKBSRV_H_ */ diff --git a/xserver/include/xorg-config.h.in b/xserver/include/xorg-config.h.in index e6b49b857..fc50eb88b 100644 --- a/xserver/include/xorg-config.h.in +++ b/xserver/include/xorg-config.h.in @@ -45,9 +45,18 @@ /* Path to installed libraries. */ #undef DEFAULT_LIBRARY_PATH -/* Path to server log file. */ +/* Default log location */ +#undef DEFAULT_LOGDIR + +/* Default logfile prefix */ #undef DEFAULT_LOGPREFIX +/* Default XDG_DATA dir under HOME */ +#undef DEFAULT_XDG_DATA_HOME + +/* Default log dir under XDG_DATA_HOME */ +#undef DEFAULT_XDG_DATA_HOME_LOGDIR + /* Building DRI-capable DDX. */ #undef XF86DRI @@ -118,6 +127,9 @@ /* Have execinfo.h */ #undef HAVE_EXECINFO_H +/* Define to 1 if you have the <sys/mkdev.h> header file. */ +#undef HAVE_SYS_MKDEV_H + /* Path to text files containing PCI IDs */ #undef PCI_TXT_IDS_PATH diff --git a/xserver/include/xorg-server.h.in b/xserver/include/xorg-server.h.in index 372243cd3..27fdc29fd 100644 --- a/xserver/include/xorg-server.h.in +++ b/xserver/include/xorg-server.h.in @@ -227,4 +227,7 @@ /* Use XTrans FD passing support */ #undef XTRANS_SEND_FDS +/* Ask fontsproto to make font path element names const */ +#define FONT_PATH_ELEMENT_NAME_CONST 1 + #endif /* _XORG_SERVER_H_ */ diff --git a/xserver/include/xwin-config.h.in b/xserver/include/xwin-config.h.in index c5119f268..176c01980 100644 --- a/xserver/include/xwin-config.h.in +++ b/xserver/include/xwin-config.h.in @@ -26,9 +26,6 @@ /* Vendor web address for support */ #undef __VENDORDWEBSUPPORT__ -/* Location of system.XWinrc */ -#undef SYSCONFDIR - /* Default log location */ #undef DEFAULT_LOGDIR diff --git a/xserver/m4/xorg-tls.m4 b/xserver/m4/xorg-tls.m4 index e04f1ff56..57687758f 100644 --- a/xserver/m4/xorg-tls.m4 +++ b/xserver/m4/xorg-tls.m4 @@ -28,7 +28,7 @@ AC_DEFUN([XORG_TLS], [ ac_cv_tls=none keywords="__thread __declspec(thread)" for kw in $keywords ; do - AC_TRY_COMPILE([int $kw test;], [], ac_cv_tls=$kw ; break ;) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[int $kw test;]], [])], ac_cv_tls=$kw ; break ;) done ]) AC_MSG_RESULT($ac_cv_tls) @@ -38,7 +38,7 @@ AC_DEFUN([XORG_TLS], [ AC_CACHE_VAL(ac_cv_tls_model, [ save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $STRICT_CFLAGS" - AC_TRY_COMPILE([int $ac_cv_tls __attribute__((tls_model("initial-exec"))) test;], [], + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[int $ac_cv_tls __attribute__((tls_model("initial-exec"))) test;]], [])], ac_cv_tls_model=yes, ac_cv_tls_model=no) CFLAGS="$save_CFLAGS" ]) diff --git a/xserver/man/Makefile.in b/xserver/man/Makefile.in index 70c5fb57d..519f9823b 100644 --- a/xserver/man/Makefile.in +++ b/xserver/man/Makefile.in @@ -164,6 +164,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -208,6 +210,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -272,6 +278,7 @@ MAN_SUBSTS = @MAN_SUBSTS@ -e 's|__logdir__|$(logdir)|g' -e \ 's|__XKB_DFLT_OPTIONS__|$(XKB_DFLT_OPTIONS)|g' -e \ 's|__bundle_id_prefix__|$(BUNDLE_ID_PREFIX)|g' -e \ 's|__modulepath__|$(DEFAULT_MODULE_PATH)|g' -e \ + 's|__suid_wrapper_dir__|$(SUID_WRAPPER_DIR)|g' -e \ 's|__default_font_path__|$(COMPILEDDEFAULTFONTPATH)|g' -e \ '\|$(COMPILEDDEFAULTFONTPATH)| s|/,|/, |g' MISC_MAN_DIR = @MISC_MAN_DIR@ @@ -326,7 +333,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -335,6 +345,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -401,6 +412,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/manpages.am b/xserver/manpages.am index dfd671915..648210b4e 100644 --- a/xserver/manpages.am +++ b/xserver/manpages.am @@ -31,6 +31,7 @@ MAN_SUBSTS += -e 's|__logdir__|$(logdir)|g' \ -e 's|__XKB_DFLT_OPTIONS__|$(XKB_DFLT_OPTIONS)|g' \ -e 's|__bundle_id_prefix__|$(BUNDLE_ID_PREFIX)|g' \ -e 's|__modulepath__|$(DEFAULT_MODULE_PATH)|g' \ + -e 's|__suid_wrapper_dir__|$(SUID_WRAPPER_DIR)|g' \ -e 's|__default_font_path__|$(COMPILEDDEFAULTFONTPATH)|g' \ -e '\|$(COMPILEDDEFAULTFONTPATH)| s|/,|/, |g' diff --git a/xserver/mi/Makefile.in b/xserver/mi/Makefile.in index f5ef44c02..2271fc1a5 100644 --- a/xserver/mi/Makefile.in +++ b/xserver/mi/Makefile.in @@ -202,6 +202,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -246,6 +248,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -348,7 +354,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -357,6 +366,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -423,6 +433,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/mi/mi.h b/xserver/mi/mi.h index 638fc6bc7..1209a16c4 100644 --- a/xserver/mi/mi.h +++ b/xserver/mi/mi.h @@ -271,7 +271,7 @@ extern _X_EXPORT void miPolyGlyphBlt(DrawablePtr /*pDrawable */ , int /*y */ , unsigned int /*nglyph */ , CharInfoPtr * /*ppci */ , - pointer /*pglyphBase */ + void */*pglyphBase */ ); extern _X_EXPORT void miImageGlyphBlt(DrawablePtr /*pDrawable */ , @@ -280,7 +280,7 @@ extern _X_EXPORT void miImageGlyphBlt(DrawablePtr /*pDrawable */ , int /*y */ , unsigned int /*nglyph */ , CharInfoPtr * /*ppci */ , - pointer /*pglyphBase */ + void */*pglyphBase */ ); /* mipoly.c */ @@ -387,7 +387,7 @@ extern _X_EXPORT Bool miModifyPixmapHeader(PixmapPtr /*pPixmap */ , int /*depth */ , int /*bitsPerPixel */ , int /*devKind */ , - pointer /*pPixData */ + void */*pPixData */ ); extern _X_EXPORT Bool miCreateScreenResources(ScreenPtr /*pScreen */ @@ -395,11 +395,11 @@ extern _X_EXPORT Bool miCreateScreenResources(ScreenPtr /*pScreen */ extern _X_EXPORT Bool miScreenDevPrivateInit(ScreenPtr /*pScreen */ , int /*width */ , - pointer /*pbits */ + void */*pbits */ ); extern _X_EXPORT Bool miScreenInit(ScreenPtr /*pScreen */ , - pointer /*pbits */ , + void */*pbits */ , int /*xsize */ , int /*ysize */ , int /*dpix */ , @@ -507,6 +507,10 @@ extern _X_EXPORT void miMarkUnrealizedWindow(WindowPtr /*pChild */ , extern _X_EXPORT void miSegregateChildren(WindowPtr pWin, RegionPtr pReg, int depth); +extern _X_EXPORT WindowPtr miSpriteTrace(SpritePtr pSprite, int x, int y); + +extern _X_EXPORT WindowPtr miXYToWindow(ScreenPtr pScreen, SpritePtr pSprite, int x, int y); + /* mizerarc.c */ extern _X_EXPORT void miZeroPolyArc(DrawablePtr /*pDraw */ , diff --git a/xserver/mi/miarc.c b/xserver/mi/miarc.c index 0f6448bc1..0f56c7db3 100644 --- a/xserver/mi/miarc.c +++ b/xserver/mi/miarc.c @@ -1489,7 +1489,7 @@ miGetArcPts(SppArcPtr parc, /* points to an arc */ count++; cdt = 2 * miDcos(dt); - if (!(poly = (SppPointPtr) realloc((pointer) *ppPts, + if (!(poly = (SppPointPtr) realloc((void *) *ppPts, (cpt + count) * sizeof(SppPointRec)))) return 0; *ppPts = poly; diff --git a/xserver/mi/mibitblt.c b/xserver/mi/mibitblt.c index b0d14ae55..3ed4ed1cc 100644 --- a/xserver/mi/mibitblt.c +++ b/xserver/mi/mibitblt.c @@ -730,7 +730,7 @@ miPutImage(DrawablePtr pDraw, GCPtr pGC, int depth, ChangeGC(NullClient, pGC, GCForeground | GCBackground, gcv); bytesPer = (long) h *BitmapBytePad(w + leftPad); - for (i = 1 << (depth - 1); i != 0; i >>= 1, pImage += bytesPer) { + for (i = (unsigned long) 1 << (depth - 1); i != 0; i >>= 1, pImage += bytesPer) { if (i & oldPlanemask) { gcv[0].val = (XID) i; ChangeGC(NullClient, pGC, GCPlaneMask, gcv); diff --git a/xserver/mi/micmap.c b/xserver/mi/micmap.c index 3ef0c8c70..4648b9a70 100644 --- a/xserver/mi/micmap.c +++ b/xserver/mi/micmap.c @@ -75,7 +75,7 @@ miUninstallColormap(ColormapPtr pmap) if (pmap == curpmap) { if (pmap->mid != pmap->pScreen->defColormap) { - dixLookupResourceByType((pointer *) &curpmap, + dixLookupResourceByType((void **) &curpmap, pmap->pScreen->defColormap, RT_COLORMAP, serverClient, DixUseAccess); (*pmap->pScreen->InstallColormap) (curpmap); diff --git a/xserver/mi/midispcur.c b/xserver/mi/midispcur.c index edca9696f..8cca5fe6e 100644 --- a/xserver/mi/midispcur.c +++ b/xserver/mi/midispcur.c @@ -79,7 +79,7 @@ typedef struct { (miDCBufferPtr)dixLookupScreenPrivate(&GetMaster(dev, MASTER_POINTER)->devPrivates, miDCDeviceKey, screen)) /* - * The core pointer buffer will point to the index of the virtual core pointer + * The core pointer buffer will point to the index of the virtual pointer * in the pCursorBuffers array. */ typedef struct { @@ -114,7 +114,7 @@ miDCInitialize(ScreenPtr pScreen, miPointerScreenFuncPtr screenFuncs) dixSetPrivate(&pScreen->devPrivates, miDCScreenKey, pScreenPriv); if (!miSpriteInitialize(pScreen, screenFuncs)) { - free((pointer) pScreenPriv); + free((void *) pScreenPriv); return FALSE; } return TRUE; @@ -152,7 +152,7 @@ miDCCloseScreen(ScreenPtr pScreen) pScreen->CloseScreen = pScreenPriv->CloseScreen; miDCSwitchScreenCursor(pScreen, NULL, NULL, NULL, NULL); - free((pointer) pScreenPriv); + free((void *) pScreenPriv); return (*pScreen->CloseScreen) (pScreen); } diff --git a/xserver/mi/mieq.c b/xserver/mi/mieq.c index 4c0748054..8907a6ea1 100644 --- a/xserver/mi/mieq.c +++ b/xserver/mi/mieq.c @@ -286,7 +286,7 @@ mieqEnqueue(DeviceIntPtr pDev, InternalEvent *e) else if (miEventQueue.dropped % QUEUE_DROP_BACKTRACE_FREQUENCY == 0 && miEventQueue.dropped / QUEUE_DROP_BACKTRACE_FREQUENCY <= QUEUE_DROP_BACKTRACE_MAX) { - ErrorFSigSafe("[mi] EQ overflow continuing. %u events have been " + ErrorFSigSafe("[mi] EQ overflow continuing. %zu events have been " "dropped.\n", miEventQueue.dropped); if (miEventQueue.dropped / QUEUE_DROP_BACKTRACE_FREQUENCY == QUEUE_DROP_BACKTRACE_MAX) { @@ -515,6 +515,10 @@ mieqProcessDeviceEvent(DeviceIntPtr dev, InternalEvent *event, ScreenPtr screen) verify_internal_event(event); + /* refuse events from disabled devices */ + if (dev && !dev->enabled) + return; + /* Custom event handler */ handler = miEventQueue.handlers[event->any.type]; @@ -585,7 +589,7 @@ mieqProcessInputEvents(void) if (n_enqueued >= (miEventQueue.nevents - (2 * QUEUE_RESERVED_SIZE)) && miEventQueue.nevents < QUEUE_MAXIMUM_SIZE) { ErrorF("[mi] Increasing EQ size to %lu to prevent dropped events.\n", - miEventQueue.nevents << 1); + (unsigned long) (miEventQueue.nevents << 1)); if (!mieqGrowQueue(&miEventQueue, miEventQueue.nevents << 1)) { ErrorF("[mi] Increasing the size of EQ failed.\n"); } @@ -593,7 +597,7 @@ mieqProcessInputEvents(void) if (miEventQueue.dropped) { ErrorF("[mi] EQ processing has resumed after %lu dropped events.\n", - miEventQueue.dropped); + (unsigned long) miEventQueue.dropped); ErrorF ("[mi] This may be caused my a misbehaving driver monopolizing the server's resources.\n"); miEventQueue.dropped = 0; diff --git a/xserver/mi/miexpose.c b/xserver/mi/miexpose.c index 8b7c93fb8..198c4332f 100644 --- a/xserver/mi/miexpose.c +++ b/xserver/mi/miexpose.c @@ -610,7 +610,7 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what) gcmask |= GCPlaneMask; #endif gcval[c++].val = FillTiled; - gcval[c++].ptr = (pointer) fill.pixmap; + gcval[c++].ptr = (void *) fill.pixmap; gcval[c++].val = tile_x_off; gcval[c++].val = tile_y_off; gcmask |= GCFillStyle | GCTile | GCTileStipXOrigin | GCTileStipYOrigin; diff --git a/xserver/mi/migc.c b/xserver/mi/migc.c index c9cdd12af..9bbe8846e 100644 --- a/xserver/mi/migc.c +++ b/xserver/mi/migc.c @@ -72,12 +72,12 @@ miDestroyClip(GCPtr pGC) } void -miChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects) +miChangeClip(GCPtr pGC, int type, void *pvalue, int nrects) { (*pGC->funcs->DestroyClip) (pGC); if (type == CT_PIXMAP) { /* convert the pixmap to a region */ - pGC->clientClip = (pointer) BitmapToRegion(pGC->pScreen, + pGC->clientClip = (void *) BitmapToRegion(pGC->pScreen, (PixmapPtr) pvalue); (*pGC->pScreen->DestroyPixmap) (pvalue); } @@ -86,7 +86,7 @@ miChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects) pGC->clientClip = pvalue; } else if (type != CT_NONE) { - pGC->clientClip = (pointer) RegionFromRects(nrects, + pGC->clientClip = (void *) RegionFromRects(nrects, (xRectangle *) pvalue, type); free(pvalue); @@ -112,7 +112,7 @@ miCopyClip(GCPtr pgcDst, GCPtr pgcSrc) case CT_REGION: prgnNew = RegionCreate(NULL, 1); RegionCopy(prgnNew, (RegionPtr) (pgcSrc->clientClip)); - (*pgcDst->funcs->ChangeClip) (pgcDst, CT_REGION, (pointer) prgnNew, 0); + (*pgcDst->funcs->ChangeClip) (pgcDst, CT_REGION, (void *) prgnNew, 0); break; } } diff --git a/xserver/mi/migc.h b/xserver/mi/migc.h index 8c13b2e53..8d06a6f9f 100644 --- a/xserver/mi/migc.h +++ b/xserver/mi/migc.h @@ -26,31 +26,24 @@ from The Open Group. */ -extern _X_EXPORT void miChangeGC(GCPtr /*pGC */ , - unsigned long /*mask */ - ); - -extern _X_EXPORT void miDestroyGC(GCPtr /*pGC */ - ); - -extern _X_EXPORT void miDestroyClip(GCPtr /*pGC */ - ); - -extern _X_EXPORT void miChangeClip(GCPtr /*pGC */ , - int /*type */ , - pointer /*pvalue */ , - int /*nrects */ - ); - -extern _X_EXPORT void miCopyClip(GCPtr /*pgcDst */ , - GCPtr /*pgcSrc */ - ); - -extern _X_EXPORT void miCopyGC(GCPtr /*pGCSrc */ , - unsigned long /*changes */ , - GCPtr /*pGCDst */ - ); - -extern _X_EXPORT void miComputeCompositeClip(GCPtr /*pGC */ , - DrawablePtr /*pDrawable */ - ); +extern _X_EXPORT void miChangeGC(GCPtr pGC, + unsigned long mask); + +extern _X_EXPORT void miDestroyGC(GCPtr pGC); + +extern _X_EXPORT void miDestroyClip(GCPtr pGC); + +extern _X_EXPORT void miChangeClip(GCPtr pGC, + int type, + void *pvalue, + int nrects); + +extern _X_EXPORT void miCopyClip(GCPtr pgcDst, + GCPtr pgcSrc); + +extern _X_EXPORT void miCopyGC(GCPtr pGCSrc, + unsigned long changes, + GCPtr pGCDst); + +extern _X_EXPORT void miComputeCompositeClip(GCPtr pGC, + DrawablePtr pDrawable); diff --git a/xserver/mi/miglblt.c b/xserver/mi/miglblt.c index 1a70911fa..b53ab9c0e 100644 --- a/xserver/mi/miglblt.c +++ b/xserver/mi/miglblt.c @@ -81,7 +81,7 @@ with the sample server. void miPolyGlyphBlt(DrawablePtr pDrawable, GC * pGC, int x, int y, unsigned int nglyph, CharInfoPtr * ppci, /* array of character info */ - pointer pglyphBase /* start of array of glyphs */ + void *pglyphBase /* start of array of glyphs */ ) { int width, height; @@ -182,7 +182,7 @@ miPolyGlyphBlt(DrawablePtr pDrawable, GC * pGC, int x, int y, unsigned int nglyp void miImageGlyphBlt(DrawablePtr pDrawable, GC * pGC, int x, int y, unsigned int nglyph, CharInfoPtr * ppci, /* array of character info */ - pointer pglyphBase /* start of array of glyphs */ + void *pglyphBase /* start of array of glyphs */ ) { ExtentInfoRec info; /* used by QueryGlyphExtents() */ diff --git a/xserver/mi/miinitext.c b/xserver/mi/miinitext.c index 67511b8d0..1d905167e 100644 --- a/xserver/mi/miinitext.c +++ b/xserver/mi/miinitext.c @@ -234,7 +234,7 @@ EnableDisableExtensionError(const char *name, Bool enable) } /* List of built-in (statically linked) extensions */ -static ExtensionModule staticExtensions[] = { +static const ExtensionModule staticExtensions[] = { {GEExtensionInit, "Generic Event Extension", &noGEExtension}, {ShapeExtensionInit, "SHAPE", NULL}, #ifdef MITSHM @@ -312,15 +312,13 @@ static void AddStaticExtensions(void) { static Bool listInitialised = FALSE; - int i; if (listInitialised) return; listInitialised = TRUE; /* Add built-in extensions to the list. */ - for (i = 0; i < ARRAY_SIZE(staticExtensions); i++) - LoadExtension(&staticExtensions[i], TRUE); + LoadExtensionList(staticExtensions, ARRAY_SIZE(staticExtensions), TRUE); } void @@ -331,7 +329,7 @@ InitExtensions(int argc, char *argv[]) AddStaticExtensions(); - for (i = 0; ExtensionModuleList[i].name != NULL; i++) { + for (i = 0; i < numExtensionModules; i++) { ext = &ExtensionModuleList[i]; if (ext->initFunc != NULL && (ext->disablePtr == NULL || !*ext->disablePtr)) { @@ -341,50 +339,44 @@ InitExtensions(int argc, char *argv[]) } static ExtensionModule * -NewExtensionModule(void) +NewExtensionModuleList(int size) { ExtensionModule *save = ExtensionModuleList; int n; - /* Make sure built-in extensions get added to the list before those - * in modules. */ - AddStaticExtensions(); - /* Sanity check */ if (!ExtensionModuleList) numExtensionModules = 0; - n = numExtensionModules + 1; + n = numExtensionModules + size; ExtensionModuleList = realloc(ExtensionModuleList, - (n + 1) * sizeof(ExtensionModule)); + n * sizeof(ExtensionModule)); if (ExtensionModuleList == NULL) { ExtensionModuleList = save; return NULL; } else { - numExtensionModules++; - ExtensionModuleList[numExtensionModules].name = NULL; - return ExtensionModuleList + (numExtensionModules - 1); + numExtensionModules += size; + return ExtensionModuleList + (numExtensionModules - size); } } void -LoadExtension(const ExtensionModule * e, Bool builtin) +LoadExtensionList(const ExtensionModule ext[], int size, Bool builtin) { ExtensionModule *newext; + int i; - if (e == NULL || e->name == NULL) - return; + /* Make sure built-in extensions get added to the list before those + * in modules. */ + AddStaticExtensions(); - if (!(newext = NewExtensionModule())) + if (!(newext = NewExtensionModuleList(size))) return; - if (builtin) - ErrorF("Initializing built-in extension %s\n", e->name); - else - ErrorF("Loading extension %s\n", e->name); - - newext->name = e->name; - newext->initFunc = e->initFunc; - newext->disablePtr = e->disablePtr; + for (i = 0; i < size; i++, newext++) { + newext->name = ext[i].name; + newext->initFunc = ext[i].initFunc; + newext->disablePtr = ext[i].disablePtr; + } } diff --git a/xserver/mi/mioverlay.c b/xserver/mi/mioverlay.c index 2bfd5e401..7f502fa37 100644 --- a/xserver/mi/mioverlay.c +++ b/xserver/mi/mioverlay.c @@ -1050,7 +1050,7 @@ typedef struct { } miOverlayTwoRegions; static int -miOverlayRecomputeExposures(WindowPtr pWin, pointer value) +miOverlayRecomputeExposures(WindowPtr pWin, void *value) { miOverlayTwoRegions *pValid = (miOverlayTwoRegions *) value; miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin); @@ -1404,7 +1404,7 @@ miOverlayResizeWindow(WindowPtr pWin, TwoRegions.under = gravitate2[g]; TraverseTree(pChild, miOverlayRecomputeExposures, - (pointer) (&TwoRegions)); + (void *) (&TwoRegions)); } /* diff --git a/xserver/mi/mipointer.c b/xserver/mi/mipointer.c index 5d591a1dc..6fa416d9d 100644 --- a/xserver/mi/mipointer.c +++ b/xserver/mi/mipointer.c @@ -152,7 +152,7 @@ miPointerCloseScreen(ScreenPtr pScreen) SetupScreen(pScreen); pScreen->CloseScreen = pScreenPriv->CloseScreen; - free((pointer) pScreenPriv); + free((void *) pScreenPriv); FreeEventList(mipointermove_events, GetMaximumEventsNum()); mipointermove_events = NULL; return (*pScreen->CloseScreen) (pScreen); @@ -352,7 +352,6 @@ miPointerWarpCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y) miPointerPtr pPointer; BOOL changedScreen = FALSE; - SetupScreen(pScreen); pPointer = MIPOINTER(pDev); if (pPointer->pScreen != pScreen) { @@ -465,14 +464,12 @@ miPointerUpdateSprite(DeviceIntPtr pDev) void miPointerSetScreen(DeviceIntPtr pDev, int screen_no, int x, int y) { - miPointerScreenPtr pScreenPriv; ScreenPtr pScreen; miPointerPtr pPointer; pPointer = MIPOINTER(pDev); pScreen = screenInfo.screens[screen_no]; - pScreenPriv = GetScreenPrivate(pScreen); mieqSwitchScreen(pDev, pScreen, FALSE); NewCurrentScreen(pDev, pScreen, x, y); diff --git a/xserver/mi/mipolyrect.c b/xserver/mi/mipolyrect.c index a0e88d2f2..e316ae053 100644 --- a/xserver/mi/mipolyrect.c +++ b/xserver/mi/mipolyrect.c @@ -148,7 +148,7 @@ miPolyRectangle(DrawablePtr pDraw, GCPtr pGC, int nrects, xRectangle *pRects) } } (*pGC->ops->PolyFillRect) (pDraw, pGC, t - tmp, tmp); - free((pointer) tmp); + free((void *) tmp); } else { diff --git a/xserver/mi/miscrinit.c b/xserver/mi/miscrinit.c index 4698b532f..00c15f713 100644 --- a/xserver/mi/miscrinit.c +++ b/xserver/mi/miscrinit.c @@ -53,14 +53,14 @@ from The Open Group. */ typedef struct { - pointer pbits; /* pointer to framebuffer */ + void *pbits; /* pointer to framebuffer */ int width; /* delta to add to a framebuffer addr to move one row down */ } miScreenInitParmsRec, *miScreenInitParmsPtr; /* this plugs into pScreen->ModifyPixmapHeader */ Bool miModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, int depth, - int bitsPerPixel, int devKind, pointer pPixData) + int bitsPerPixel, int devKind, void *pPixData) { if (!pPixmap) return FALSE; @@ -135,7 +135,7 @@ Bool miCreateScreenResources(ScreenPtr pScreen) { miScreenInitParmsPtr pScrInitParms; - pointer value; + void *value; pScrInitParms = (miScreenInitParmsPtr) pScreen->devPrivate; @@ -161,7 +161,7 @@ miCreateScreenResources(ScreenPtr pScreen) pScreen->rootDepth), pScrInitParms->pbits)) return FALSE; - value = (pointer) pPixmap; + value = (void *) pPixmap; } else { value = pScrInitParms->pbits; @@ -172,7 +172,7 @@ miCreateScreenResources(ScreenPtr pScreen) } Bool -miScreenDevPrivateInit(ScreenPtr pScreen, int width, pointer pbits) +miScreenDevPrivateInit(ScreenPtr pScreen, int width, void *pbits) { miScreenInitParmsPtr pScrInitParms; @@ -185,7 +185,7 @@ miScreenDevPrivateInit(ScreenPtr pScreen, int width, pointer pbits) return FALSE; pScrInitParms->pbits = pbits; pScrInitParms->width = width; - pScreen->devPrivate = (pointer) pScrInitParms; + pScreen->devPrivate = (void *) pScrInitParms; return TRUE; } @@ -199,11 +199,11 @@ static void miSetScreenPixmap(PixmapPtr pPix) { if (pPix) - pPix->drawable.pScreen->devPrivate = (pointer) pPix; + pPix->drawable.pScreen->devPrivate = (void *) pPix; } Bool -miScreenInit(ScreenPtr pScreen, pointer pbits, /* pointer to screen bits */ +miScreenInit(ScreenPtr pScreen, void *pbits, /* pointer to screen bits */ int xsize, int ysize, /* in pixels */ int dpix, int dpiy, /* dots per inch */ int width, /* pixel width of frame buffer */ @@ -272,6 +272,7 @@ miScreenInit(ScreenPtr pScreen, pointer pbits, /* pointer to screen bits */ pScreen->ChangeBorderWidth = miChangeBorderWidth; pScreen->SetShape = miSetShape; pScreen->MarkUnrealizedWindow = miMarkUnrealizedWindow; + pScreen->XYToWindow = miXYToWindow; miSetZeroLineBias(pScreen, DEFAULTZEROLINEBIAS); diff --git a/xserver/mi/misprite.c b/xserver/mi/misprite.c index 85ca022ed..eea731a15 100644 --- a/xserver/mi/misprite.c +++ b/xserver/mi/misprite.c @@ -199,7 +199,7 @@ static void miSpriteSourceValidate(DrawablePtr pDrawable, int x, int y, static void miSpriteCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc); static void miSpriteBlockHandler(ScreenPtr pScreen, - pointer pTimeout, pointer pReadMask); + void *pTimeout, void *pReadMask); static void miSpriteInstallColormap(ColormapPtr pMap); static void miSpriteStoreColors(ColormapPtr pMap, int ndef, xColorItem * pdef); @@ -512,8 +512,8 @@ miSpriteCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc) } static void -miSpriteBlockHandler(ScreenPtr pScreen, pointer pTimeout, - pointer pReadmask) +miSpriteBlockHandler(ScreenPtr pScreen, void *pTimeout, + void *pReadmask) { miSpriteScreenPtr pPriv = GetSpriteScreen(pScreen); DeviceIntPtr pDev; diff --git a/xserver/mi/miwindow.c b/xserver/mi/miwindow.c index 8dd99dbf0..57de91bab 100644 --- a/xserver/mi/miwindow.c +++ b/xserver/mi/miwindow.c @@ -57,6 +57,7 @@ SOFTWARE. #include "scrnintstr.h" #include "pixmapstr.h" #include "mivalidate.h" +#include "inputstr.h" void miClearToBackground(WindowPtr pWin, @@ -305,7 +306,7 @@ miMoveWindow(WindowPtr pWin, int x, int y, WindowPtr pNextSib, VTKind kind) */ static int -miRecomputeExposures(WindowPtr pWin, pointer value) +miRecomputeExposures(WindowPtr pWin, void *value) { /* must conform to VisitWindowProcPtr */ RegionPtr pValid = (RegionPtr) value; @@ -584,7 +585,7 @@ miSlideAndSizeWindow(WindowPtr pWin, if (pChild->winGravity != g) continue; RegionIntersect(pRegion, &pChild->borderClip, gravitate[g]); - TraverseTree(pChild, miRecomputeExposures, (pointer) pRegion); + TraverseTree(pChild, miRecomputeExposures, (void *) pRegion); } /* @@ -758,3 +759,68 @@ miSegregateChildren(WindowPtr pWin, RegionPtr pReg, int depth) miSegregateChildren(pChild, pReg, depth); } } + +WindowPtr +miSpriteTrace(SpritePtr pSprite, int x, int y) +{ + WindowPtr pWin; + BoxRec box; + + pWin = DeepestSpriteWin(pSprite)->firstChild; + while (pWin) { + if ((pWin->mapped) && + (x >= pWin->drawable.x - wBorderWidth(pWin)) && + (x < pWin->drawable.x + (int) pWin->drawable.width + + wBorderWidth(pWin)) && + (y >= pWin->drawable.y - wBorderWidth(pWin)) && + (y < pWin->drawable.y + (int) pWin->drawable.height + + wBorderWidth(pWin)) + /* When a window is shaped, a further check + * is made to see if the point is inside + * borderSize + */ + && (!wBoundingShape(pWin) || PointInBorderSize(pWin, x, y)) + && (!wInputShape(pWin) || + RegionContainsPoint(wInputShape(pWin), + x - pWin->drawable.x, + y - pWin->drawable.y, &box)) +#ifdef ROOTLESS + /* In rootless mode windows may be offscreen, even when + * they're in X's stack. (E.g. if the native window system + * implements some form of virtual desktop system). + */ + && !pWin->rootlessUnhittable +#endif + ) { + if (pSprite->spriteTraceGood >= pSprite->spriteTraceSize) { + pSprite->spriteTraceSize += 10; + pSprite->spriteTrace = realloc(pSprite->spriteTrace, + pSprite->spriteTraceSize * + sizeof(WindowPtr)); + } + pSprite->spriteTrace[pSprite->spriteTraceGood++] = pWin; + pWin = pWin->firstChild; + } + else + pWin = pWin->nextSib; + } + return DeepestSpriteWin(pSprite); +} + +/** + * Traversed from the root window to the window at the position x/y. While + * traversing, it sets up the traversal history in the spriteTrace array. + * After completing, the spriteTrace history is set in the following way: + * spriteTrace[0] ... root window + * spriteTrace[1] ... top level window that encloses x/y + * ... + * spriteTrace[spriteTraceGood - 1] ... window at x/y + * + * @returns the window at the given coordinates. + */ +WindowPtr +miXYToWindow(ScreenPtr pScreen, SpritePtr pSprite, int x, int y) +{ + pSprite->spriteTraceGood = 1; /* root window still there */ + return miSpriteTrace(pSprite, x, y); +} diff --git a/xserver/miext/Makefile.in b/xserver/miext/Makefile.in index 99b349d27..d0042637c 100644 --- a/xserver/miext/Makefile.in +++ b/xserver/miext/Makefile.in @@ -169,6 +169,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -213,6 +215,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -315,7 +321,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -324,6 +333,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -390,6 +400,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/miext/damage/Makefile.in b/xserver/miext/damage/Makefile.in index 5d7680dd2..0b4fc0d24 100644 --- a/xserver/miext/damage/Makefile.in +++ b/xserver/miext/damage/Makefile.in @@ -193,6 +193,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -237,6 +239,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -339,7 +345,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -348,6 +357,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -414,6 +424,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/miext/damage/damage.c b/xserver/miext/damage/damage.c index 173fe5070..9bd9c84e7 100644 --- a/xserver/miext/damage/damage.c +++ b/xserver/miext/damage/damage.c @@ -326,7 +326,7 @@ static void damageValidateGC(GCPtr, unsigned long, DrawablePtr); static void damageChangeGC(GCPtr, unsigned long); static void damageCopyGC(GCPtr, unsigned long, GCPtr); static void damageDestroyGC(GCPtr); -static void damageChangeClip(GCPtr, int, pointer, int); +static void damageChangeClip(GCPtr, int, void *, int); static void damageDestroyClip(GCPtr); static void damageCopyClip(GCPtr, GCPtr); @@ -359,7 +359,7 @@ damageCreateGC(GCPtr pGC) #define DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable) \ damageGCPriv(pGC); \ - GCFuncs *oldFuncs = pGC->funcs; \ + const GCFuncs *oldFuncs = pGC->funcs; \ unwrap(pGCPriv, pGC, funcs); \ unwrap(pGCPriv, pGC, ops); \ @@ -379,7 +379,6 @@ damageCreateGC(GCPtr pGC) static void damageValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable) { - drawableDamage(pDrawable); DAMAGE_GC_FUNC_PROLOGUE(pGC); (*pGC->funcs->ValidateGC) (pGC, changes, pDrawable); pGCPriv->ops = pGC->ops; /* just so it's not NULL */ @@ -411,7 +410,7 @@ damageCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst) } static void -damageChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects) +damageChangeClip(GCPtr pGC, int type, void *pvalue, int nrects) { DAMAGE_GC_FUNC_PROLOGUE(pGC); (*pGC->funcs->ChangeClip) (pGC, type, pvalue, nrects); @@ -1367,7 +1366,7 @@ damageImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y, - unsigned int nglyph, CharInfoPtr * ppci, pointer pglyphBase) + unsigned int nglyph, CharInfoPtr * ppci, void *pglyphBase) { DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable); damageDamageChars(pDrawable, pGC->font, x + pDrawable->x, y + pDrawable->y, @@ -1382,7 +1381,7 @@ damagePolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y, - unsigned int nglyph, CharInfoPtr * ppci, pointer pglyphBase) + unsigned int nglyph, CharInfoPtr * ppci, void *pglyphBase) { DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable); damageDamageChars(pDrawable, pGC->font, x + pDrawable->x, y + pDrawable->y, diff --git a/xserver/miext/damage/damagestr.h b/xserver/miext/damage/damagestr.h index 36753ee20..278615634 100644 --- a/xserver/miext/damage/damagestr.h +++ b/xserver/miext/damage/damagestr.h @@ -76,8 +76,8 @@ typedef struct _damageScrPriv { } DamageScrPrivRec, *DamageScrPrivPtr; typedef struct _damageGCPriv { - GCOps *ops; - GCFuncs *funcs; + const GCOps *ops; + const GCFuncs *funcs; } DamageGCPrivRec, *DamageGCPrivPtr; /* XXX should move these into damage.c, damageScrPrivateIndex is static */ diff --git a/xserver/miext/rootless/Makefile.in b/xserver/miext/rootless/Makefile.in index 5dde41557..70a3893ea 100644 --- a/xserver/miext/rootless/Makefile.in +++ b/xserver/miext/rootless/Makefile.in @@ -163,6 +163,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -207,6 +209,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -309,7 +315,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -318,6 +327,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -384,6 +394,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/miext/rootless/rootlessCommon.c b/xserver/miext/rootless/rootlessCommon.c index d8f43bd1b..504362790 100644 --- a/xserver/miext/rootless/rootlessCommon.c +++ b/xserver/miext/rootless/rootlessCommon.c @@ -202,7 +202,7 @@ RootlessStartDrawing(WindowPtr pWindow) * damaged regions are flushed to the screen. */ static int -RestorePreDrawingPixmapVisitor(WindowPtr pWindow, pointer data) +RestorePreDrawingPixmapVisitor(WindowPtr pWindow, void *data) { RootlessWindowRec *winRec = (RootlessWindowRec *) data; ScreenPtr pScreen = pWindow->drawable.pScreen; @@ -249,7 +249,7 @@ RootlessStopDrawing(WindowPtr pWindow, Bool flush) SCREENREC(pScreen)->imp->StopDrawing(winRec->wid, flush); FreeScratchPixmapHeader(winRec->pixmap); - TraverseTree(top, RestorePreDrawingPixmapVisitor, (pointer) winRec); + TraverseTree(top, RestorePreDrawingPixmapVisitor, (void *) winRec); winRec->pixmap = NULL; winRec->is_drawing = FALSE; diff --git a/xserver/miext/rootless/rootlessGC.c b/xserver/miext/rootless/rootlessGC.c index 932899591..23ff3934e 100644 --- a/xserver/miext/rootless/rootlessGC.c +++ b/xserver/miext/rootless/rootlessGC.c @@ -55,7 +55,7 @@ static void RootlessValidateGC(GCPtr pGC, unsigned long changes, static void RootlessChangeGC(GCPtr pGC, unsigned long mask); static void RootlessCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst); static void RootlessDestroyGC(GCPtr pGC); -static void RootlessChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects); +static void RootlessChangeClip(GCPtr pGC, int type, void *pvalue, int nrects); static void RootlessDestroyClip(GCPtr pGC); static void RootlessCopyClip(GCPtr pgcDst, GCPtr pgcSrc); @@ -113,10 +113,10 @@ static void RootlessImageText16(DrawablePtr dst, GCPtr pGC, int x, int y, int count, unsigned short *chars); static void RootlessImageGlyphBlt(DrawablePtr dst, GCPtr pGC, int x, int y, unsigned int nglyphInit, - CharInfoPtr * ppciInit, pointer unused); + CharInfoPtr * ppciInit, void *unused); static void RootlessPolyGlyphBlt(DrawablePtr dst, GCPtr pGC, int x, int y, unsigned int nglyph, CharInfoPtr * ppci, - pointer pglyphBase); + void *pglyphBase); static void RootlessPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr dst, int dx, int dy, int xOrg, int yOrg); @@ -368,7 +368,7 @@ RootlessDestroyGC(GCPtr pGC) } static void -RootlessChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects) +RootlessChangeClip(GCPtr pGC, int type, void *pvalue, int nrects) { GCFUNC_UNWRAP(pGC); pGC->funcs->ChangeClip(pGC, type, pvalue, nrects); @@ -1356,7 +1356,7 @@ RootlessPolyText16(DrawablePtr dst, GCPtr pGC, static void RootlessImageGlyphBlt(DrawablePtr dst, GCPtr pGC, int x, int y, unsigned int nglyphInit, - CharInfoPtr * ppciInit, pointer unused) + CharInfoPtr * ppciInit, void *unused) { GC_SAVE(pGC); GCOP_UNWRAP(pGC); @@ -1419,7 +1419,7 @@ RootlessImageGlyphBlt(DrawablePtr dst, GCPtr pGC, static void RootlessPolyGlyphBlt(DrawablePtr dst, GCPtr pGC, int x, int y, unsigned int nglyph, - CharInfoPtr * ppci, pointer pglyphBase) + CharInfoPtr * ppci, void *pglyphBase) { GCOP_UNWRAP(pGC); RL_DEBUG_MSG("polyglyph start "); diff --git a/xserver/miext/rootless/rootlessScreen.c b/xserver/miext/rootless/rootlessScreen.c index a1af3e7ac..6226ee84a 100644 --- a/xserver/miext/rootless/rootlessScreen.c +++ b/xserver/miext/rootless/rootlessScreen.c @@ -603,7 +603,7 @@ RootlessQueueRedisplay(ScreenPtr pScreen) * on select(). */ static void -RootlessBlockHandler(pointer pbdata, OSTimePtr pTimeout, pointer pReadmask) +RootlessBlockHandler(void *pbdata, OSTimePtr pTimeout, void *pReadmask) { ScreenPtr pScreen = pbdata; RootlessScreenRec *screenRec = SCREENREC(pScreen); @@ -616,7 +616,7 @@ RootlessBlockHandler(pointer pbdata, OSTimePtr pTimeout, pointer pReadmask) } static void -RootlessWakeupHandler(pointer data, int i, pointer LastSelectMask) +RootlessWakeupHandler(void *data, int i, void *LastSelectMask) { // nothing here } @@ -728,7 +728,7 @@ RootlessInit(ScreenPtr pScreen, RootlessFrameProcsPtr procs) if (!RegisterBlockAndWakeupHandlers(RootlessBlockHandler, RootlessWakeupHandler, - (pointer) pScreen)) { + (void *) pScreen)) { return FALSE; } diff --git a/xserver/miext/rootless/rootlessWindow.c b/xserver/miext/rootless/rootlessWindow.c index 7e3c28130..3dbd5886a 100644 --- a/xserver/miext/rootless/rootlessWindow.c +++ b/xserver/miext/rootless/rootlessWindow.c @@ -625,7 +625,7 @@ RootlessRestackWindow(WindowPtr pWin, WindowPtr pOldNextSib) */ // Globals needed during window resize and move. -static pointer gResizeDeathBits = NULL; +static void *gResizeDeathBits = NULL; static int gResizeDeathCount = 0; static PixmapPtr gResizeDeathPix[2] = { NULL, NULL }; diff --git a/xserver/miext/shadow/Makefile.in b/xserver/miext/shadow/Makefile.in index 6c5b9dba3..7ef4d8b95 100644 --- a/xserver/miext/shadow/Makefile.in +++ b/xserver/miext/shadow/Makefile.in @@ -199,6 +199,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -243,6 +245,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -345,7 +351,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -354,6 +363,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -420,6 +430,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/miext/shadow/shadow.c b/xserver/miext/shadow/shadow.c index 1a9088c43..522e21bd0 100644 --- a/xserver/miext/shadow/shadow.c +++ b/xserver/miext/shadow/shadow.c @@ -65,7 +65,7 @@ shadowRedisplay(ScreenPtr pScreen) } static void -shadowBlockHandler(pointer data, OSTimePtr pTimeout, pointer pRead) +shadowBlockHandler(void *data, OSTimePtr pTimeout, void *pRead) { ScreenPtr pScreen = (ScreenPtr) data; @@ -73,7 +73,7 @@ shadowBlockHandler(pointer data, OSTimePtr pTimeout, pointer pRead) } static void -shadowWakeupHandler(pointer data, int i, pointer LastSelectMask) +shadowWakeupHandler(void *data, int i, void *LastSelectMask) { } @@ -183,7 +183,7 @@ shadowAdd(ScreenPtr pScreen, PixmapPtr pPixmap, ShadowUpdateProc update, shadowBuf(pScreen); if (!RegisterBlockAndWakeupHandlers(shadowBlockHandler, shadowWakeupHandler, - (pointer) pScreen)) + (void *) pScreen)) return FALSE; /* @@ -228,7 +228,7 @@ shadowRemove(ScreenPtr pScreen, PixmapPtr pPixmap) } RemoveBlockAndWakeupHandlers(shadowBlockHandler, shadowWakeupHandler, - (pointer) pScreen); + (void *) pScreen); } Bool diff --git a/xserver/miext/sync/Makefile.in b/xserver/miext/sync/Makefile.in index 6ed8d7fc2..09822d2c8 100644 --- a/xserver/miext/sync/Makefile.in +++ b/xserver/miext/sync/Makefile.in @@ -198,6 +198,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -242,6 +244,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -344,7 +350,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -353,6 +362,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -419,6 +429,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/miext/sync/misyncstr.h b/xserver/miext/sync/misyncstr.h index b5bf6fd91..ad69e8eca 100644 --- a/xserver/miext/sync/misyncstr.h +++ b/xserver/miext/sync/misyncstr.h @@ -29,6 +29,7 @@ #define _MISYNCSTR_H_ #include "dix.h" +#include "misync.h" #include "scrnintstr.h" #include <X11/extensions/syncconst.h> diff --git a/xserver/os/Makefile.in b/xserver/os/Makefile.in index 8257f11b5..fcdb81bd2 100644 --- a/xserver/os/Makefile.in +++ b/xserver/os/Makefile.in @@ -195,6 +195,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -239,6 +241,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -341,7 +347,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -350,6 +359,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -416,6 +426,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/os/WaitFor.c b/xserver/os/WaitFor.c index 39fedd9a2..3eb15b9b8 100644 --- a/xserver/os/WaitFor.c +++ b/xserver/os/WaitFor.c @@ -118,7 +118,7 @@ struct _OsTimerRec { CARD32 expires; CARD32 delta; OsTimerCallback callback; - pointer arg; + void *arg; }; static void DoTimer(OsTimerPtr timer, CARD32 now, OsTimerPtr *prev); @@ -212,7 +212,7 @@ WaitForSomething(int *pClientsReady) XFD_COPYSET(&AllSockets, &LastSelectMask); } - BlockHandler((pointer) &wt, (pointer) &LastSelectMask); + BlockHandler((void *) &wt, (void *) &LastSelectMask); if (NewOutputPending) FlushAllOutput(); /* keep this check close to select() call to minimize race */ @@ -226,7 +226,7 @@ WaitForSomething(int *pClientsReady) i = Select(MaxClients, &LastSelectMask, NULL, NULL, wt); } selecterr = GetErrno(); - WakeupHandler(i, (pointer) &LastSelectMask); + WakeupHandler(i, (void *) &LastSelectMask); if (i <= 0) { /* An error or timeout occurred */ if (dispatchException) return 0; @@ -303,7 +303,7 @@ WaitForSomething(int *pClientsReady) XFD_ANDSET(&tmp_set, &LastSelectMask, &WellKnownConnections); if (XFD_ANYSET(&tmp_set)) QueueWorkProc(EstablishNewConnections, NULL, - (pointer) &LastSelectMask); + (void *) &LastSelectMask); if (XFD_ANYSET(&devicesReadable) || XFD_ANYSET(&clientsReadable)) break; @@ -416,7 +416,7 @@ DoTimer(OsTimerPtr timer, CARD32 now, OsTimerPtr *prev) OsTimerPtr TimerSet(OsTimerPtr timer, int flags, CARD32 millis, - OsTimerCallback func, pointer arg) + OsTimerCallback func, void *arg) { register OsTimerPtr *prev; CARD32 now = GetTimeInMillis(); @@ -564,7 +564,7 @@ NextDPMSTimeout(INT32 timeout) #endif /* DPMSExtension */ static CARD32 -ScreenSaverTimeoutExpire(OsTimerPtr timer, CARD32 now, pointer arg) +ScreenSaverTimeoutExpire(OsTimerPtr timer, CARD32 now, void *arg) { INT32 timeout = now - LastEventTime(XIAllDevices).milliseconds; CARD32 nextTimeout = 0; diff --git a/xserver/os/access.c b/xserver/os/access.c index 6d991b362..e8c0781f2 100644 --- a/xserver/os/access.c +++ b/xserver/os/access.c @@ -186,7 +186,7 @@ Bool defeatAccessControl = FALSE; static int ConvertAddr(struct sockaddr * /*saddr */ , int * /*len */ , - pointer * /*addr */ ); + void ** /*addr */ ); static int CheckAddr(int /*family */ , const void * /*pAddr */ , @@ -226,7 +226,7 @@ static int LocalHostRequested = FALSE; static int UsingXdmcp = FALSE; /* FamilyServerInterpreted implementation */ -static Bool siAddrMatch(int family, pointer addr, int len, HOST * host, +static Bool siAddrMatch(int family, void *addr, int len, HOST * host, ClientPtr client); static int siCheckAddr(const char *addrString, int length); static void siTypesInitialize(void); @@ -258,7 +258,7 @@ DisableLocalHost(void) for (self = selfhosts; self; self = self->next) { if (!self->requested) /* Fix for XFree86 bug #156 */ (void) RemoveHost((ClientPtr) NULL, self->family, self->len, - (pointer) self->addr); + (void *) self->addr); } } @@ -382,7 +382,7 @@ DefineSelf(int fd) default: goto DefineLocalHost; } - family = ConvertAddr(&(saddr.sa), &len, (pointer *) &addr); + family = ConvertAddr(&(saddr.sa), &len, (void **) &addr); if (family != -1 && family != FamilyLocal) { for (host = selfhosts; host && !addrEqual(family, addr, len, host); @@ -545,7 +545,7 @@ DefineSelf(int fd) #define IFR_IFR_NAME ifr->ifr_name #endif - if (ifioctl(fd, IFC_IOCTL_REQ, (pointer) &ifc) < 0) + if (ifioctl(fd, IFC_IOCTL_REQ, (void *) &ifc) < 0) ErrorF("Getting interface configuration (4): %s\n", strerror(errno)); cplim = (char *) IFC_IFC_REQ + IFC_IFC_LEN; @@ -554,7 +554,7 @@ DefineSelf(int fd) ifr = (ifr_type *) cp; len = ifraddr_size(IFR_IFR_ADDR); family = ConvertAddr((struct sockaddr *) &IFR_IFR_ADDR, - &len, (pointer *) &addr); + &len, (void **) &addr); if (family == -1 || family == FamilyLocal) continue; #if defined(IPv6) && defined(AF_INET6) @@ -649,12 +649,12 @@ DefineSelf(int fd) struct ifreq broad_req; broad_req = *ifr; - if (ifioctl(fd, SIOCGIFFLAGS, (pointer) &broad_req) != -1 && + if (ifioctl(fd, SIOCGIFFLAGS, (void *) &broad_req) != -1 && (broad_req.ifr_flags & IFF_BROADCAST) && (broad_req.ifr_flags & IFF_UP) ) { broad_req = *ifr; - if (ifioctl(fd, SIOCGIFBRDADDR, (pointer) &broad_req) != -1) + if (ifioctl(fd, SIOCGIFBRDADDR, (void *) &broad_req) != -1) broad_addr = broad_req.ifr_addr; else continue; @@ -679,7 +679,7 @@ DefineSelf(int fd) continue; len = sizeof(*(ifr->ifa_addr)); family = ConvertAddr((struct sockaddr *) ifr->ifa_addr, &len, - (pointer *) &addr); + (void **) &addr); if (family == -1 || family == FamilyLocal) continue; #if defined(IPv6) && defined(AF_INET6) @@ -775,13 +775,13 @@ DefineSelf(int fd) #ifdef XDMCP void -AugmentSelf(pointer from, int len) +AugmentSelf(void *from, int len) { int family; - pointer addr; + void *addr; register HOST *host; - family = ConvertAddr(from, &len, (pointer *) &addr); + family = ConvertAddr(from, &len, (void **) &addr); if (family == -1 || family == FamilyLocal) return; for (host = selfhosts; host; host = host->next) { @@ -814,7 +814,7 @@ AddLocalHosts(void) /* Reset access control list to initial hosts */ void -ResetHosts(char *display) +ResetHosts(const char *display) { register HOST *host; char lhostname[120], ohostname[120]; @@ -835,7 +835,7 @@ ResetHosts(char *display) } saddr; #endif int family = 0; - pointer addr; + void *addr; int len; siTypesInitialize(); @@ -927,7 +927,7 @@ ResetHosts(char *display) for (a = addresses; a != NULL; a = a->ai_next) { len = a->ai_addrlen; f = ConvertAddr(a->ai_addr, &len, - (pointer *) &addr); + (void **) &addr); if ((family == f) || ((family == FamilyWild) && (f != -1))) { NewHost(f, addr, len, FALSE); @@ -950,15 +950,15 @@ ResetHosts(char *display) len = sizeof(saddr.sa); if ((family = ConvertAddr(&saddr.sa, &len, - (pointer *) &addr)) != -1) { + (void **) &addr)) != -1) { #ifdef h_addr /* new 4.3bsd version of gethostent */ char **list; /* iterate over the addresses */ for (list = hp->h_addr_list; *list; list++) - (void) NewHost(family, (pointer) *list, len, FALSE); + (void) NewHost(family, (void *) *list, len, FALSE); #else - (void) NewHost(family, (pointer) hp->h_addr, len, + (void) NewHost(family, (void *) hp->h_addr, len, FALSE); #endif } @@ -978,7 +978,7 @@ ComputeLocalClient(ClientPtr client) { int alen, family, notused; Xtransaddr *from = NULL; - pointer addr; + void *addr; register HOST *host; OsCommPtr oc = (OsCommPtr) client->osPrivate; @@ -987,7 +987,7 @@ ComputeLocalClient(ClientPtr client) if (!_XSERVTransGetPeerAddr(oc->trans_conn, ¬used, &alen, &from)) { family = ConvertAddr((struct sockaddr *) from, - &alen, (pointer *) &addr); + &alen, (void **) &addr); if (family == -1) { free(from); return FALSE; @@ -1219,8 +1219,8 @@ AddHost(ClientPtr client, int family, unsigned length, /* of bytes in pAddr */ Bool ForEachHostInFamily(int family, Bool (*func) (unsigned char * /* addr */ , short /* len */ , - pointer /* closure */ ), - pointer closure) + void */* closure */ ), + void *closure) { HOST *host; @@ -1264,7 +1264,7 @@ NewHost(int family, const void *addr, int len, int addingLocalHosts) int RemoveHost(ClientPtr client, int family, unsigned length, /* of bytes in pAddr */ - pointer pAddr) + void *pAddr) { int rc, len; register HOST *host, **prev; @@ -1311,7 +1311,7 @@ RemoveHost(ClientPtr client, int family, unsigned length, /* of bytes in p /* Get all hosts in the access control list */ int -GetHosts(pointer *data, int *pnHosts, int *pLen, BOOL * pEnabled) +GetHosts(void **data, int *pnHosts, int *pLen, BOOL * pEnabled) { int len; register int n = 0; @@ -1386,12 +1386,12 @@ int InvalidHost(register struct sockaddr *saddr, int len, ClientPtr client) { int family; - pointer addr; + void *addr; register HOST *selfhost, *host; if (!AccessEnabled) /* just let them in */ return 0; - family = ConvertAddr(saddr, &len, (pointer *) &addr); + family = ConvertAddr(saddr, &len, (void **) &addr); if (family == -1) return 1; if (family == FamilyLocal) { @@ -1427,7 +1427,7 @@ InvalidHost(register struct sockaddr *saddr, int len, ClientPtr client) } static int -ConvertAddr(register struct sockaddr *saddr, int *len, pointer *addr) +ConvertAddr(register struct sockaddr *saddr, int *len, void **addr) { if (*len == 0) return FamilyLocal; @@ -1444,7 +1444,7 @@ ConvertAddr(register struct sockaddr *saddr, int *len, pointer *addr) return FamilyLocal; #endif *len = sizeof(struct in_addr); - *addr = (pointer) &(((struct sockaddr_in *) saddr)->sin_addr); + *addr = (void *) &(((struct sockaddr_in *) saddr)->sin_addr); return FamilyInternet; #if defined(IPv6) && defined(AF_INET6) case AF_INET6: @@ -1453,12 +1453,12 @@ ConvertAddr(register struct sockaddr *saddr, int *len, pointer *addr) if (IN6_IS_ADDR_V4MAPPED(&(saddr6->sin6_addr))) { *len = sizeof(struct in_addr); - *addr = (pointer) &(saddr6->sin6_addr.s6_addr[12]); + *addr = (void *) &(saddr6->sin6_addr.s6_addr[12]); return FamilyInternet; } else { *len = sizeof(struct in6_addr); - *addr = (pointer) &(saddr6->sin6_addr); + *addr = (void *) &(saddr6->sin6_addr); return FamilyInternet6; } } @@ -1505,7 +1505,7 @@ GetAccessControl(void) * future to enable loading additional host types, but that was not done for * the initial implementation. */ -typedef Bool (*siAddrMatchFunc) (int family, pointer addr, int len, +typedef Bool (*siAddrMatchFunc) (int family, void *addr, int len, const char *siAddr, int siAddrlen, ClientPtr client, void *siTypePriv); typedef int (*siCheckAddrFunc) (const char *addrString, int length, @@ -1558,7 +1558,7 @@ siTypeAdd(const char *typeName, siAddrMatchFunc addrMatch, /* Checks to see if a host matches a server-interpreted host entry */ static Bool -siAddrMatch(int family, pointer addr, int len, HOST * host, ClientPtr client) +siAddrMatch(int family, void *addr, int len, HOST * host, ClientPtr client) { Bool matches = FALSE; struct siType *s; @@ -1659,7 +1659,7 @@ siCheckAddr(const char *addrString, int length) #endif static Bool -siHostnameAddrMatch(int family, pointer addr, int len, +siHostnameAddrMatch(int family, void *addr, int len, const char *siAddr, int siAddrLen, ClientPtr client, void *typePriv) { @@ -1675,7 +1675,7 @@ siHostnameAddrMatch(int family, pointer addr, int len, struct addrinfo *addresses; struct addrinfo *a; int f, hostaddrlen; - pointer hostaddr; + void *hostaddr; if (siAddrLen >= sizeof(hostname)) return FALSE; @@ -1704,7 +1704,7 @@ siHostnameAddrMatch(int family, pointer addr, int len, #endif char hostname[SI_HOSTNAME_MAXLEN]; int f, hostaddrlen; - pointer hostaddr; + void *hostaddr; const char **addrlist; if (siAddrLen >= sizeof(hostname)) @@ -1808,7 +1808,7 @@ siHostnameCheckAddr(const char *valueString, int length, void *typePriv) #define SI_IPv6_MAXLEN INET6_ADDRSTRLEN static Bool -siIPv6AddrMatch(int family, pointer addr, int len, +siIPv6AddrMatch(int family, void *addr, int len, const char *siAddr, int siAddrlen, ClientPtr client, void *typePriv) { @@ -1934,7 +1934,7 @@ siLocalCredGetId(const char *addr, int len, siLocalCredPrivPtr lcPriv, int *id) } static Bool -siLocalCredAddrMatch(int family, pointer addr, int len, +siLocalCredAddrMatch(int family, void *addr, int len, const char *siAddr, int siAddrlen, ClientPtr client, void *typePriv) { diff --git a/xserver/os/auth.c b/xserver/os/auth.c index ac20de47d..5fcb538c4 100644 --- a/xserver/os/auth.c +++ b/xserver/os/auth.c @@ -96,12 +96,12 @@ static struct protocol protocols[] = { * specified authorization file */ -static char *authorization_file = (char *) NULL; +static const char *authorization_file = NULL; static Bool ShouldLoadAuth = TRUE; void -InitAuthorization(char *file_name) +InitAuthorization(const char *file_name) { authorization_file = file_name; } diff --git a/xserver/os/busfault.c b/xserver/os/busfault.c index 43bb6ea8a..ac0268fd5 100644 --- a/xserver/os/busfault.c +++ b/xserver/os/busfault.c @@ -142,6 +142,7 @@ busfault_init(void) act.sa_sigaction = busfault_sigaction; act.sa_flags = SA_SIGINFO; + sigemptyset(&act.sa_mask); if (sigaction(SIGBUS, &act, &old_act) < 0) return FALSE; previous_busfault_sigaction = old_act.sa_sigaction; diff --git a/xserver/os/connection.c b/xserver/os/connection.c index 029b75cfe..ad5cf34e4 100644 --- a/xserver/os/connection.c +++ b/xserver/os/connection.c @@ -26,13 +26,13 @@ Copyright 1987, 1989 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in +both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. +software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL @@ -138,6 +138,7 @@ fd_set OutputPending; /* clients with reply/event data ready to go */ int MaxClients = 0; Bool NewOutputPending; /* not yet attempted to write some new output */ Bool AnyClientsWriteBlocked; /* true if some client blocked on write */ +Bool NoListenAll; /* Don't establish any listening sockets */ static Bool RunFromSmartParent; /* send SIGUSR1 to parent process */ Bool RunFromSigStopParent; /* send SIGSTOP to our own process; Upstart (or @@ -354,10 +355,13 @@ void NotifyParentProcess(void) { #if !defined(WIN32) - if (dynamic_display[0]) { - write(displayfd, dynamic_display, strlen(dynamic_display)); - write(displayfd, "\n", 1); + if (displayfd >= 0) { + if (write(displayfd, display, strlen(display)) != strlen(display)) + FatalError("Cannot write display number to fd %d\n", displayfd); + if (write(displayfd, "\n", 1) != 1) + FatalError("Cannot write display number to fd %d\n", displayfd); close(displayfd); + displayfd = -1; } if (RunFromSmartParent) { if (ParentProcess > 1) { @@ -411,15 +415,18 @@ CreateWellKnownSockets(void) FD_ZERO(&WellKnownConnections); /* display is initialized to "0" by main(). It is then set to the display - * number if specified on the command line, or to NULL when the -displayfd - * option is used. */ - if (display) { + * number if specified on the command line. */ + + if (NoListenAll) { + ListenTransCount = 0; + } + else if ((displayfd < 0) || explicit_display) { if (TryCreateSocket(atoi(display), &partial) && ListenTransCount >= 1) if (!PartialNetwork && partial) FatalError ("Failed to establish all listening sockets"); } - else { /* -displayfd */ + else { /* -displayfd and no explicit display number */ Bool found = 0; for (i = 0; i < 65535 - X_TCP_PORT; i++) { if (TryCreateSocket(i, &partial) && !partial) { @@ -447,9 +454,10 @@ CreateWellKnownSockets(void) DefineSelf (fd); } - if (!XFD_ANYSET(&WellKnownConnections)) + if (!XFD_ANYSET(&WellKnownConnections) && !NoListenAll) FatalError ("Cannot establish any listening sockets - Make sure an X server isn't already running"); + #if !defined(WIN32) OsSignal(SIGPIPE, SIG_IGN); OsSignal(SIGHUP, AutoResetServer); @@ -647,8 +655,8 @@ AuthorizationIDOfClient(ClientPtr client) * CARD8 byteOrder; * BYTE pad; * CARD16 majorVersion, minorVersion; - * CARD16 nbytesAuthProto; - * CARD16 nbytesAuthString; + * CARD16 nbytesAuthProto; + * CARD16 nbytesAuthString; * } xConnClientPrefix; * * It is hoped that eventually one protocol will be agreed upon. In the @@ -767,7 +775,7 @@ AllocNewConnection(XtransConnInfo trans_conn, int fd, CARD32 conn_time) oc->output = (ConnectionOutputPtr) NULL; oc->auth_id = None; oc->conn_time = conn_time; - if (!(client = NextAvailableClient((pointer) oc))) { + if (!(client = NextAvailableClient((void *) oc))) { free(oc); return NullClient; } @@ -805,7 +813,7 @@ AllocNewConnection(XtransConnInfo trans_conn, int fd, CARD32 conn_time) *****************/ /*ARGSUSED*/ Bool -EstablishNewConnections(ClientPtr clientUnused, pointer closure) +EstablishNewConnections(ClientPtr clientUnused, void *closure) { fd_set readyconnections; /* set of listeners that are ready */ int curconn; /* fd of listener that's ready */ @@ -973,7 +981,7 @@ CloseDownFileDescriptor(OsCommPtr oc) /***************** * CheckConnections - * Some connection has died, go find which one and shut it down + * Some connection has died, go find which one and shut it down * The file descriptor has been closed, but is still in AllClients. * If would truly be wonderful if select() would put the bogus * file descriptors in the exception mask, but nooooo. So we have @@ -1034,7 +1042,7 @@ CheckConnections(void) /***************** * CloseDownConnection - * Delete client from AllClients and free resources + * Delete client from AllClients and free resources *****************/ void @@ -1053,7 +1061,7 @@ CloseDownConnection(ClientPtr client) CloseDownFileDescriptor(oc); FreeOsBuffers(oc); free(client->osPrivate); - client->osPrivate = (pointer) NULL; + client->osPrivate = (void *) NULL; if (auditTrailLevel > 1) AuditF("client %d disconnected\n", client->index); } @@ -1260,8 +1268,7 @@ MakeClientGrabPervious(ClientPtr client) } } -#ifdef XQUARTZ -/* Add a fd (from launchd) to our listeners */ +/* Add a fd (from launchd or similar) to our listeners */ void ListenOnOpenFD(int fd, int noxauth) { @@ -1283,7 +1290,7 @@ ListenOnOpenFD(int fd, int noxauth) */ ciptr = _XSERVTransReopenCOTSServer(5, fd, port); if (ciptr == NULL) { - ErrorF("Got NULL while trying to Reopen launchd port.\n"); + ErrorF("Got NULL while trying to Reopen listen port.\n"); return; } @@ -1307,13 +1314,31 @@ ListenOnOpenFD(int fd, int noxauth) /* Increment the count */ ListenTransCount++; - - /* This *might* not be needed... /shrug */ - ResetAuthorization(); - ResetHosts(display); -#ifdef XDMCP - XdmcpReset(); -#endif } -#endif +/* based on TRANS(SocketUNIXAccept) (XtransConnInfo ciptr, int *status) */ +Bool +AddClientOnOpenFD(int fd) +{ + XtransConnInfo ciptr; + CARD32 connect_time; + char port[20]; + + snprintf(port, sizeof(port), ":%d", atoi(display)); + ciptr = _XSERVTransReopenCOTSServer(5, fd, port); + if (ciptr == NULL) + return FALSE; + + _XSERVTransSetOption(ciptr, TRANS_NONBLOCKING, 1); + ciptr->flags |= TRANS_NOXAUTH; + + connect_time = GetTimeInMillis(); + + if (!AllocNewConnection(ciptr, fd, connect_time)) { + ErrorConnMax(ciptr); + _XSERVTransClose(ciptr); + return FALSE; + } + + return TRUE; +} diff --git a/xserver/os/io.c b/xserver/os/io.c index 922a8eb02..8181a8639 100644 --- a/xserver/os/io.c +++ b/xserver/os/io.c @@ -102,12 +102,17 @@ typedef struct _connectionOutput { static ConnectionInputPtr AllocateInputBuffer(void); static ConnectionOutputPtr AllocateOutputBuffer(void); -/* check for both EAGAIN and EWOULDBLOCK, because some supposedly POSIX +/* If EAGAIN and EWOULDBLOCK are distinct errno values, then we check errno + * for both EAGAIN and EWOULDBLOCK, because some supposedly POSIX * systems are broken and return EWOULDBLOCK when they should return EAGAIN */ #ifndef WIN32 -#define ETEST(err) (err == EAGAIN || err == EWOULDBLOCK) -#else /* WIN32 The socket errorcodes differ from the normal errors */ +# if (EAGAIN != EWOULDBLOCK) +# define ETEST(err) (err == EAGAIN || err == EWOULDBLOCK) +# else +# define ETEST(err) (err == EAGAIN) +# endif +#else /* WIN32 The socket errorcodes differ from the normal errors */ #define ETEST(err) (err == EAGAIN || err == WSAEWOULDBLOCK) #endif @@ -481,7 +486,7 @@ ReadRequestFromClient(ClientPtr client) oci->lenLastReq -= (sizeof(xBigReq) - sizeof(xReq)); client->req_len -= bytes_to_int32(sizeof(xBigReq) - sizeof(xReq)); } - client->requestBuffer = (pointer) oci->bufptr; + client->requestBuffer = (void *) oci->bufptr; #ifdef DEBUG_COMMUNICATION { xReq *req = client->requestBuffer; @@ -809,7 +814,7 @@ WriteToClient(ClientPtr who, int count, const void *__buf) who->replyBytesRemaining -= count + padBytes; replyinfo.startOfReply = FALSE; replyinfo.bytesRemaining = who->replyBytesRemaining; - CallCallbacks((&ReplyCallback), (pointer) &replyinfo); + CallCallbacks((&ReplyCallback), (void *) &replyinfo); } else if (who->clientState == ClientStateRunning && buf[0] == X_Reply) { /* start of new reply */ CARD32 replylen; @@ -821,7 +826,7 @@ WriteToClient(ClientPtr who, int count, const void *__buf) bytesleft = (replylen * 4) + SIZEOF(xReply) - count - padBytes; replyinfo.startOfReply = TRUE; replyinfo.bytesRemaining = who->replyBytesRemaining = bytesleft; - CallCallbacks((&ReplyCallback), (pointer) &replyinfo); + CallCallbacks((&ReplyCallback), (void *) &replyinfo); } } #ifdef DEBUG_COMMUNICATION diff --git a/xserver/os/log.c b/xserver/os/log.c index 53b358629..2a721b948 100644 --- a/xserver/os/log.c +++ b/xserver/os/log.c @@ -195,6 +195,9 @@ LogInit(const char *fname, const char *backup) char *logFileName = NULL; if (fname && *fname) { +#if __GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ > 2 +#pragma GCC diagnostic ignored "-Wformat-nonliteral" +#endif if (asprintf(&logFileName, fname, display) == -1) FatalError("Cannot allocate space for the log file name\n"); @@ -205,6 +208,9 @@ LogInit(const char *fname, const char *backup) char *suffix; char *oldLog; +#if __GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ > 2 +#pragma GCC diagnostic ignored "-Wformat-nonliteral" +#endif if ((asprintf(&suffix, backup, display) == -1) || (asprintf(&oldLog, "%s%s", logFileName, suffix) == -1)) FatalError("Cannot allocate space for the log file name\n"); @@ -336,7 +342,7 @@ out: * which directives you use. */ static int -pnprintf(char *string, size_t size, const char *f, va_list args) +vpnprintf(char *string, int size_in, const char *f, va_list args) { int f_idx = 0; int s_idx = 0; @@ -347,6 +353,7 @@ pnprintf(char *string, size_t size, const char *f, va_list args) int i; uint64_t ui; int64_t si; + size_t size = size_in; for (; f_idx < f_len && s_idx < size - 1; f_idx++) { int length_modifier = 0; @@ -478,6 +485,19 @@ pnprintf(char *string, size_t size, const char *f, va_list args) return s_idx; } +static int +pnprintf(char *string, int size, const char *f, ...) +{ + int rc; + va_list args; + + va_start(args, f); + rc = vpnprintf(string, size, f, args); + va_end(args); + + return rc; +} + /* This function does the actual log message writes. It must be signal safe. * When attempting to call non-signal-safe functions, guard them with a check * of the inSignalContext global variable. */ @@ -485,13 +505,14 @@ static void LogSWrite(int verb, const char *buf, size_t len, Bool end_line) { static Bool newline = TRUE; + int ret; if (verb < 0 || logVerbosity >= verb) - write(2, buf, len); + ret = write(2, buf, len); if (verb < 0 || logFileVerbosity >= verb) { if (inSignalContext && logFileFd >= 0) { - write(logFileFd, buf, len); + ret = write(logFileFd, buf, len); #ifndef WIN32 if (logFlush && logSync) fsync(logFileFd); @@ -523,6 +544,11 @@ LogSWrite(int verb, const char *buf, size_t len, Bool end_line) bufferPos += len; } } + + /* There's no place to log an error message if the log write + * fails... + */ + (void) ret; } void @@ -585,7 +611,6 @@ LogMessageTypeVerbString(MessageType type, int verb) void LogVMessageVerb(MessageType type, int verb, const char *format, va_list args) { - static unsigned int warned; const char *type_str; char buf[1024]; const size_t size = sizeof(buf); @@ -593,17 +618,8 @@ LogVMessageVerb(MessageType type, int verb, const char *format, va_list args) size_t len = 0; if (inSignalContext) { - if (warned < 3) { - BUG_WARN_MSG(inSignalContext, - "Warning: attempting to log data in a signal unsafe " - "manner while in signal context.\nPlease update to check " - "inSignalContext and/or use LogMessageVerbSigSafe() or " - "ErrorFSigSafe().\nThe offending log format message is:\n" - "%s\n", format); - warned++; - if (warned == 3) - LogMessageVerbSigSafe(X_WARNING, -1, "Warned %u times about sigsafe logging. Will be quiet now.\n", warned); - } + LogVMessageVerbSigSafe(type, verb, format, args); + return; } type_str = LogMessageTypeVerbString(type, verb); @@ -675,13 +691,13 @@ LogVMessageVerbSigSafe(MessageType type, int verb, const char *format, va_list a LogSWrite(verb, " ", 1, FALSE); } - len = pnprintf(buf, sizeof(buf), format, args); + len = vpnprintf(buf, sizeof(buf), format, args); /* Force '\n' at end of truncated line */ if (sizeof(buf) - len == 1) buf[len - 1] = '\n'; - newline = (buf[len - 1] == '\n'); + newline = (len > 0 && buf[len - 1] == '\n'); LogSWrite(verb, buf, len, newline); } @@ -689,40 +705,37 @@ void LogVHdrMessageVerb(MessageType type, int verb, const char *msg_format, va_list msg_args, const char *hdr_format, va_list hdr_args) { - static unsigned int warned; const char *type_str; char buf[1024]; const size_t size = sizeof(buf); Bool newline; size_t len = 0; - - if (inSignalContext) { - if (warned < 3) { - BUG_WARN_MSG(inSignalContext, - "Warning: attempting to log data in a signal unsafe " - "manner while in signal context.\nPlease update to check " - "inSignalContext and/or use LogMessageVerbSigSafe().\nThe " - "offending header and log message formats are:\n%s %s\n", - hdr_format, msg_format); - warned++; - if (warned == 3) - LogMessageVerbSigSafe(X_WARNING, -1, "Warned %u times about sigsafe logging. Will be quiet now.\n", warned); - } - } + int (*vprintf_func)(char *, int, const char* _X_RESTRICT_KYWD f, va_list args) + _X_ATTRIBUTE_PRINTF(3, 0); + int (*printf_func)(char *, int, const char* _X_RESTRICT_KYWD f, ...) + _X_ATTRIBUTE_PRINTF(3, 4); type_str = LogMessageTypeVerbString(type, verb); if (!type_str) return; + if (inSignalContext) { + vprintf_func = vpnprintf; + printf_func = pnprintf; + } else { + vprintf_func = Xvscnprintf; + printf_func = Xscnprintf; + } + /* if type_str is not "", prepend it and ' ', to message */ if (type_str[0] != '\0') - len += Xscnprintf(&buf[len], size - len, "%s ", type_str); + len += printf_func(&buf[len], size - len, "%s ", type_str); if (hdr_format && size - len > 1) - len += Xvscnprintf(&buf[len], size - len, hdr_format, hdr_args); + len += vprintf_func(&buf[len], size - len, hdr_format, hdr_args); if (msg_format && size - len > 1) - len += Xvscnprintf(&buf[len], size - len, msg_format, msg_args); + len += vprintf_func(&buf[len], size - len, msg_format, msg_args); /* Force '\n' at end of truncated line */ if (size - len == 1) @@ -826,7 +839,7 @@ AuditF(const char *f, ...) } static CARD32 -AuditFlush(OsTimerPtr timer, CARD32 now, pointer arg) +AuditFlush(OsTimerPtr timer, CARD32 now, void *arg) { char *prefix; diff --git a/xserver/os/osinit.c b/xserver/os/osinit.c index f34b4363e..d4a94896c 100644 --- a/xserver/os/osinit.c +++ b/xserver/os/osinit.c @@ -222,33 +222,32 @@ OsInit(void) dup2(devnullfd, STDOUT_FILENO); close(devnullfd); # elif !defined(__CYGWIN__) - fclose(stdin); fclose(stdout); # endif - /* - * If a write of zero bytes to stderr returns non-zero, i.e. -1, - * then writing to stderr failed, and we'll write somewhere else - * instead. (Apparently this never happens in the Real World.) - */ - if (write (2, fname, 0) == -1) { - FILE *err; - - if (strlen (display) + strlen (ADMPATH) + 1 < sizeof fname) - snprintf (fname, sizeof(fname), ADMPATH, display); - else - strlcpy (fname, devnull, sizeof(fname)); - /* - * uses stdio to avoid os dependencies here, - * a real os would use - * open (fname, O_WRONLY|O_APPEND|O_CREAT, 0666) - */ - if (!(err = fopen (fname, "a+"))) - err = fopen (devnull, "w"); - if (err && (fileno(err) != 2)) { - dup2 (fileno (err), 2); - fclose (err); - } + /* + * If a write of zero bytes to stderr returns non-zero, i.e. -1, + * then writing to stderr failed, and we'll write somewhere else + * instead. (Apparently this never happens in the Real World.) + */ + if (write(2, fname, 0) == -1) { + FILE *err; + + if (strlen(display) + strlen(ADMPATH) + 1 < sizeof fname) + snprintf(fname, sizeof(fname), ADMPATH, display); + else + strlcpy(fname, devnull, sizeof(fname)); + /* + * uses stdio to avoid os dependencies here, + * a real os would use + * open (fname, O_WRONLY|O_APPEND|O_CREAT, 0666) + */ + if (!(err = fopen(fname, "a+"))) + err = fopen(devnull, "w"); + if (err && (fileno(err) != 2)) { + dup2(fileno(err), 2); + fclose(err); + } #if defined(SYSV) || defined(SVR4) || defined(WIN32) || defined(__CYGWIN__) { static char buf[BUFSIZ]; diff --git a/xserver/os/rpcauth.c b/xserver/os/rpcauth.c index bd219acfa..d60ea3518 100644 --- a/xserver/os/rpcauth.c +++ b/xserver/os/rpcauth.c @@ -113,7 +113,7 @@ authdes_ezdecode(const char *inmsg, int len) static XID rpc_id = (XID) ~0L; static Bool -CheckNetName(unsigned char *addr, short len, pointer closure) +CheckNetName(unsigned char *addr, short len, void *closure) { return (len == strlen((char *) closure) && strncmp((char *) addr, (char *) closure, len) == 0); @@ -159,7 +159,7 @@ _X_HIDDEN int SecureRPCAdd(unsigned short data_length, const char *data, XID id) { if (data_length) - AddHost((pointer) 0, FamilyNetname, data_length, data); + AddHost((void *) 0, FamilyNetname, data_length, data); rpc_id = id; return 1; } diff --git a/xserver/os/utils.c b/xserver/os/utils.c index 25a410c24..0c1d4b7a9 100644 --- a/xserver/os/utils.c +++ b/xserver/os/utils.c @@ -194,6 +194,8 @@ Bool noGEExtension = FALSE; Bool CoreDump; +Bool enableIndirectGLX = TRUE; + #ifdef PANORAMIX Bool PanoramiXExtensionDisabledHack = FALSE; #endif @@ -270,7 +272,7 @@ LockServer(void) int len; char port[20]; - if (nolock) + if (nolock || NoListenAll) return; /* * Path names @@ -313,7 +315,8 @@ LockServer(void) if (lfd < 0) FatalError("Could not create lock file in %s\n", tmp); snprintf(pid_str, sizeof(pid_str), "%10ld\n", (long) getpid()); - (void) write(lfd, pid_str, 11); + if (write(lfd, pid_str, 11) != 11) + FatalError("Could not write pid to lock file in %s\n", tmp); #ifdef __OpenBSD__ /* if possible give away the lock file to the real uid/gid */ fchown(lfd, getuid(), getgid()); @@ -394,7 +397,7 @@ LockServer(void) void UnlockServer(void) { - if (nolock) + if (nolock || NoListenAll) return; if (!StillLocking) { @@ -502,7 +505,7 @@ GetTimeInMicros(void) #endif void -AdjustWaitForDelay(pointer waitTime, unsigned long newdelay) +AdjustWaitForDelay(void *waitTime, unsigned long newdelay) { static struct timeval delay_val; struct timeval **wt = (struct timeval **) waitTime; @@ -538,6 +541,7 @@ UseMsg(void) ErrorF("-cc int default color visual class\n"); ErrorF("-nocursor disable the cursor\n"); ErrorF("-core generate core dump on fatal error\n"); + ErrorF("-displayfd fd file descriptor to write display number to when ready to connect\n"); ErrorF("-dpi int screen resolution in dots per inch\n"); #ifdef DPMSExtension ErrorF("-dpms disables VESA DPMS monitor control\n"); @@ -549,6 +553,8 @@ UseMsg(void) ErrorF("-fn string default font name\n"); ErrorF("-fp string default font path\n"); ErrorF("-help prints message with these options\n"); + ErrorF("+iglx Allow creating indirect GLX contexts (default)\n"); + ErrorF("-iglx Prohibit creating indirect GLX contexts\n"); ErrorF("-I ignore all remaining arguments\n"); #ifdef RLIMIT_DATA ErrorF("-ld int limit data space to N Kb\n"); @@ -682,6 +688,7 @@ ProcessCommandLine(int argc, char *argv[]) else if (argv[i][0] == ':') { /* initialize display */ display = argv[i]; + explicit_display = TRUE; display++; if (!VerifyDisplayName(display)) { ErrorF("Bad display name: %s\n", display); @@ -752,7 +759,6 @@ ProcessCommandLine(int argc, char *argv[]) else if (strcmp(argv[i], "-displayfd") == 0) { if (++i < argc) { displayfd = atoi(argv[i]); - display = NULL; #ifdef LOCK_SERVER nolock = TRUE; #endif @@ -799,6 +805,10 @@ ProcessCommandLine(int argc, char *argv[]) UseMsg(); exit(0); } + else if (strcmp(argv[i], "+iglx") == 0) + enableIndirectGLX = TRUE; + else if (strcmp(argv[i], "-iglx") == 0) + enableIndirectGLX = FALSE; else if ((skip = XkbProcessArguments(argc, argv, i)) != 0) { if (skip > 0) i += skip - 1; @@ -1034,7 +1044,7 @@ ProcessCommandLine(int argc, char *argv[]) /* Implement a simple-minded font authorization scheme. The authorization name is "hp-hostname-1", the contents are simply the host name. */ int -set_font_authorizations(char **authorizations, int *authlen, pointer client) +set_font_authorizations(char **authorizations, int *authlen, void *client) { #define AUTHORIZATION_NAME "hp-hostname-1" #if defined(TCPCONN) || defined(STREAMSCONN) @@ -1433,7 +1443,7 @@ static struct pid { OsSigHandlerPtr old_alarm = NULL; /* XXX horrible awful hack */ -pointer +void * Popen(const char *command, const char *type) { struct pid *cur; @@ -1521,7 +1531,7 @@ Popen(const char *command, const char *type) } /* fopen that drops privileges */ -pointer +void * Fopen(const char *file, const char *type) { FILE *iop; @@ -1616,7 +1626,7 @@ Fopen(const char *file, const char *type) } int -Pclose(pointer iop) +Pclose(void *iop) { struct pid *cur, *last; int pstat; @@ -1653,7 +1663,7 @@ Pclose(pointer iop) } int -Fclose(pointer iop) +Fclose(void *iop) { #ifdef HAS_SAVED_IDS_AND_SETEUID return fclose(iop); diff --git a/xserver/os/xdmauth.c b/xserver/os/xdmauth.c index 28584d2e8..f11cbb997 100644 --- a/xserver/os/xdmauth.c +++ b/xserver/os/xdmauth.c @@ -62,7 +62,7 @@ static XdmAuthKeyRec privateKey; static char XdmAuthenticationName[] = "XDM-AUTHENTICATION-1"; #define XdmAuthenticationNameLen (sizeof XdmAuthenticationName - 1) -static XdmAuthKeyRec rho; +static XdmAuthKeyRec global_rho; static Bool XdmAuthenticationValidator(ARRAY8Ptr privateData, ARRAY8Ptr incomingData, @@ -77,7 +77,7 @@ XdmAuthenticationValidator(ARRAY8Ptr privateData, ARRAY8Ptr incomingData, return FALSE; incoming = (XdmAuthKeyPtr) incomingData->data; XdmcpDecrementKey(incoming); - return XdmcpCompareKeys(incoming, &rho); + return XdmcpCompareKeys(incoming, &global_rho); } return FALSE; } @@ -90,7 +90,7 @@ XdmAuthenticationGenerator(ARRAY8Ptr privateData, ARRAY8Ptr outgoingData, outgoingData->data = 0; if (packet_type == REQUEST) { if (XdmcpAllocARRAY8(outgoingData, 8)) - XdmcpWrap((unsigned char *) &rho, (unsigned char *) &privateKey, + XdmcpWrap((unsigned char *) &global_rho, (unsigned char *) &privateKey, outgoingData->data, 8); } return TRUE; @@ -150,10 +150,10 @@ XdmAuthenticationInit(const char *cookie, int cookie_len) cookie_len = 7; memmove(privateKey.data + 1, cookie, cookie_len); } - XdmcpGenerateKey(&rho); + XdmcpGenerateKey(&global_rho); XdmcpRegisterAuthentication(XdmAuthenticationName, XdmAuthenticationNameLen, - (char *) &rho, - sizeof(rho), + (char *) &global_rho, + sizeof(global_rho), (ValidatorFunc) XdmAuthenticationValidator, (GeneratorFunc) XdmAuthenticationGenerator, (AddAuthorFunc) XdmAuthenticationAddAuth); @@ -328,7 +328,7 @@ XdmAddCookie(unsigned short data_length, const char *data, XID id) if (authFromXDMCP) { /* R5 xdm sent bogus authorization data in the accept packet, * but we can recover */ - rho_bits = rho.data; + rho_bits = global_rho.data; key_bits = (unsigned char *) data; key_bits[0] = '\0'; } @@ -341,7 +341,7 @@ XdmAddCookie(unsigned short data_length, const char *data, XID id) break; #ifdef XDMCP case 8: /* auth from XDMCP is 8 bytes long */ - rho_bits = rho.data; + rho_bits = global_rho.data; key_bits = (unsigned char *) data; break; #endif @@ -466,7 +466,7 @@ XdmRemoveCookie(unsigned short data_length, const char *data) break; #ifdef XDMCP case 8: - rho_bits = ρ + rho_bits = &global_rho; key_bits = (XdmAuthKeyPtr) data; break; #endif diff --git a/xserver/os/xdmcp.c b/xserver/os/xdmcp.c index 11f11333d..99616d94b 100644 --- a/xserver/os/xdmcp.c +++ b/xserver/os/xdmcp.c @@ -145,43 +145,46 @@ static void get_xdmcp_sock(void); static void send_query_msg(void); -static void recv_willing_msg(struct sockaddr * /*from */ , - int /*fromlen */ , - unsigned /*length */ ); +static void recv_willing_msg(struct sockaddr *from, + int fromlen, + unsigned length); static void send_request_msg(void); -static void recv_accept_msg(unsigned /*length */ ); +static void recv_accept_msg(unsigned length); -static void recv_decline_msg(unsigned /*length */ ); +static void recv_decline_msg(unsigned length); static void send_manage_msg(void); -static void recv_refuse_msg(unsigned /*length */ ); +static void recv_refuse_msg(unsigned length); -static void recv_failed_msg(unsigned /*length */ ); +static void recv_failed_msg(unsigned length); static void send_keepalive_msg(void); -static void recv_alive_msg(unsigned /*length */ ); +static void recv_alive_msg(unsigned length ); -static void XdmcpFatal(const char * /*type */ , - ARRAY8Ptr /*status */ ); +static void XdmcpFatal(const char *type, + ARRAY8Ptr status); -static void XdmcpWarning(const char * /*str */ ); +static void XdmcpWarning(const char *str); -static void get_manager_by_name(int /*argc */ , - char ** /*argv */ , - int /*i */ ); +static void get_manager_by_name(int argc, + char **argv, + int i); -static void get_fromaddr_by_name(int /*argc */ , char ** /*argv */ , - int /*i */ ); +static void get_fromaddr_by_name(int argc, + char **argv, + int i); #if defined(IPv6) && defined(AF_INET6) -static int get_mcast_options(int /*argc */ , char ** /*argv */ , int /*i */ ); +static int get_mcast_options(int argc, + char **argv, + int i); #endif -static void receive_packet(int /*socketfd */ ); +static void receive_packet(int socketfd); static void send_packet(void); @@ -189,13 +192,13 @@ static void timeout(void); static void restart(void); -static void XdmcpBlockHandler(pointer /*data */ , - struct timeval ** /*wt */ , - pointer /*LastSelectMask */ ); +static void XdmcpBlockHandler(void *data , + struct timeval **wt, + void *LastSelectMask); -static void XdmcpWakeupHandler(pointer /*data */ , - int /*i */ , - pointer /*LastSelectMask */ ); +static void XdmcpWakeupHandler(void *data, + int i, + void *LastSelectMask); /* * Register the Manufacturer display ID @@ -578,7 +581,7 @@ XdmcpInit(void) strlen(defaultDisplayClass)); AccessUsingXdmcp(); RegisterBlockAndWakeupHandlers(XdmcpBlockHandler, XdmcpWakeupHandler, - (pointer) 0); + (void *) 0); timeOutRtx = 0; DisplayNumber = (CARD16) atoi(display); get_xdmcp_sock(); @@ -592,7 +595,7 @@ XdmcpReset(void) state = XDM_INIT_STATE; if (state != XDM_OFF) { RegisterBlockAndWakeupHandlers(XdmcpBlockHandler, XdmcpWakeupHandler, - (pointer) 0); + (void *) 0); timeOutRtx = 0; send_packet(); } @@ -635,18 +638,18 @@ XdmcpCloseDisplay(int sock) */ /*ARGSUSED*/ static void -XdmcpBlockHandler(pointer data, /* unused */ - struct timeval **wt, pointer pReadmask) +XdmcpBlockHandler(void *data, /* unused */ + struct timeval **wt, void *pReadmask) { - fd_set *LastSelectMask = (fd_set *) pReadmask; + fd_set *last_select_mask = (fd_set *) pReadmask; CARD32 millisToGo; if (state == XDM_OFF) return; - FD_SET(xdmcpSocket, LastSelectMask); + FD_SET(xdmcpSocket, last_select_mask); #if defined(IPv6) && defined(AF_INET6) if (xdmcpSocket6 >= 0) - FD_SET(xdmcpSocket6, LastSelectMask); + FD_SET(xdmcpSocket6, last_select_mask); #endif if (timeOutTime == 0) return; @@ -663,26 +666,26 @@ XdmcpBlockHandler(pointer data, /* unused */ */ /*ARGSUSED*/ static void -XdmcpWakeupHandler(pointer data, /* unused */ - int i, pointer pReadmask) +XdmcpWakeupHandler(void *data, /* unused */ + int i, void *pReadmask) { - fd_set *LastSelectMask = (fd_set *) pReadmask; + fd_set *last_select_mask = (fd_set *) pReadmask; fd_set devicesReadable; if (state == XDM_OFF) return; if (i > 0) { - if (FD_ISSET(xdmcpSocket, LastSelectMask)) { + if (FD_ISSET(xdmcpSocket, last_select_mask)) { receive_packet(xdmcpSocket); - FD_CLR(xdmcpSocket, LastSelectMask); + FD_CLR(xdmcpSocket, last_select_mask); } #if defined(IPv6) && defined(AF_INET6) - if (xdmcpSocket6 >= 0 && FD_ISSET(xdmcpSocket6, LastSelectMask)) { + if (xdmcpSocket6 >= 0 && FD_ISSET(xdmcpSocket6, last_select_mask)) { receive_packet(xdmcpSocket6); - FD_CLR(xdmcpSocket6, LastSelectMask); + FD_CLR(xdmcpSocket6, last_select_mask); } #endif - XFD_ANDSET(&devicesReadable, LastSelectMask, &EnabledDevices); + XFD_ANDSET(&devicesReadable, last_select_mask, &EnabledDevices); if (XFD_ANYSET(&devicesReadable)) { if (state == XDM_AWAIT_USER_INPUT) restart(); @@ -709,12 +712,12 @@ XdmcpWakeupHandler(pointer data, /* unused */ static void XdmcpSelectHost(const struct sockaddr *host_sockaddr, - int host_len, ARRAY8Ptr AuthenticationName) + int host_len, ARRAY8Ptr auth_name) { state = XDM_START_CONNECTION; memmove(&req_sockaddr, host_sockaddr, host_len); req_socklen = host_len; - XdmcpSetAuthentication(AuthenticationName); + XdmcpSetAuthentication(auth_name); send_packet(); } @@ -727,9 +730,9 @@ XdmcpSelectHost(const struct sockaddr *host_sockaddr, /*ARGSUSED*/ static void XdmcpAddHost(const struct sockaddr *from, int fromlen, - ARRAY8Ptr AuthenticationName, ARRAY8Ptr hostname, ARRAY8Ptr status) + ARRAY8Ptr auth_name, ARRAY8Ptr hostname, ARRAY8Ptr status) { - XdmcpSelectHost(from, fromlen, AuthenticationName); + XdmcpSelectHost(from, fromlen, auth_name); } /* @@ -1055,8 +1058,6 @@ send_query_msg(void) XdmcpWriteHeader(&buffer, &header); XdmcpWriteARRAYofARRAY8(&buffer, &AuthenticationNames); if (broadcast) { - int i; - for (i = 0; i < NumBroadcastAddresses; i++) XdmcpFlush(xdmcpSocket, &buffer, (XdmcpNetaddr) &BroadcastAddresses[i], diff --git a/xserver/present/Makefile.in b/xserver/present/Makefile.in index a448d6be5..9e3a880b2 100644 --- a/xserver/present/Makefile.in +++ b/xserver/present/Makefile.in @@ -194,6 +194,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -238,6 +240,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -340,7 +346,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -349,6 +358,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -415,6 +425,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/present/present.c b/xserver/present/present.c index 30cd3b936..3aea0d7c6 100644 --- a/xserver/present/present.c +++ b/xserver/present/present.c @@ -42,6 +42,9 @@ static struct xorg_list present_flip_queue; #define DebugPresent(x) #endif +static void +present_execute(present_vblank_ptr vblank, uint64_t ust, uint64_t crtc_msc); + /* * Copies the update region from a pixmap to the target drawable */ @@ -78,6 +81,20 @@ present_copy_region(DrawablePtr drawable, FreeScratchGC(gc); } +static inline PixmapPtr +present_flip_pending_pixmap(ScreenPtr screen) +{ + present_screen_priv_ptr screen_priv = present_screen_priv(screen); + + if (!screen_priv) + return NULL; + + if (!screen_priv->flip_pending) + return NULL; + + return screen_priv->flip_pending->pixmap; +} + static Bool present_check_flip(RRCrtcPtr crtc, WindowPtr window, @@ -88,6 +105,7 @@ present_check_flip(RRCrtcPtr crtc, int16_t y_off) { ScreenPtr screen = window->drawable.pScreen; + PixmapPtr window_pixmap; WindowPtr root = screen->root; present_screen_priv_ptr screen_priv = present_screen_priv(screen); @@ -104,19 +122,11 @@ present_check_flip(RRCrtcPtr crtc, if (!screen_priv->info->flip) return FALSE; - /* Can't pend a flip while unflipping */ - if (screen_priv->unflip_event_id) { - return FALSE; - } - - /* Can't have two pending flips at the same time */ - if (screen_priv->flip_pending) { - return FALSE; - } - /* Make sure the window hasn't been redirected with Composite */ - if (screen->GetWindowPixmap(window) != screen->GetScreenPixmap(screen) && - screen->GetWindowPixmap(window) != screen_priv->flip_pixmap) + window_pixmap = screen->GetWindowPixmap(window); + if (window_pixmap != screen->GetScreenPixmap(screen) && + window_pixmap != screen_priv->flip_pixmap && + window_pixmap != present_flip_pending_pixmap(screen)) return FALSE; /* Check for full-screen window */ @@ -147,6 +157,7 @@ present_check_flip(RRCrtcPtr crtc, /* Ask the driver for permission */ if (screen_priv->info->check_flip) { if (!(*screen_priv->info->check_flip) (crtc, window, pixmap, sync_flip)) { + DebugPresent(("\td %08lx -> %08lx\n", window->drawable.id, pixmap ? pixmap->drawable.id : 0)); return FALSE; } } @@ -188,8 +199,10 @@ present_pixmap_idle(PixmapPtr pixmap, WindowPtr window, CARD32 serial, struct pr { if (present_fence) present_fence_set_triggered(present_fence); - if (window) + if (window) { + DebugPresent(("\ti %08lx\n", pixmap ? pixmap->drawable.id : 0)); present_send_idle_notify(window, serial, pixmap, present_fence); + } } RRCrtcPtr @@ -227,9 +240,8 @@ present_query_capabilities(RRCrtcPtr crtc) } static int -present_get_ust_msc(WindowPtr window, RRCrtcPtr crtc, uint64_t *ust, uint64_t *msc) +present_get_ust_msc(ScreenPtr screen, RRCrtcPtr crtc, uint64_t *ust, uint64_t *msc) { - ScreenPtr screen = window->drawable.pScreen; present_screen_priv_ptr screen_priv = present_screen_priv(screen); if (crtc == NULL) @@ -283,7 +295,7 @@ present_window_to_crtc_msc(WindowPtr window, RRCrtcPtr crtc, uint64_t window_msc * we'll just use whatever previous MSC we'd seen from this CRTC */ - if (present_get_ust_msc(window, window_priv->crtc, &old_ust, &old_msc) != Success) + if (present_get_ust_msc(window->drawable.pScreen, window_priv->crtc, &old_ust, &old_msc) != Success) old_msc = window_priv->msc; window_priv->msc_offset += new_msc - old_msc; @@ -293,6 +305,34 @@ present_window_to_crtc_msc(WindowPtr window, RRCrtcPtr crtc, uint64_t window_msc return window_msc + window_priv->msc_offset; } +/* + * When the wait fence or previous flip is completed, it's time + * to re-try the request + */ +static void +present_re_execute(present_vblank_ptr vblank) +{ + uint64_t ust = 0, crtc_msc = 0; + + if (vblank->crtc) + (void) present_get_ust_msc(vblank->screen, vblank->crtc, &ust, &crtc_msc); + + present_execute(vblank, ust, crtc_msc); +} + +static void +present_flip_try_ready(ScreenPtr screen) +{ + present_vblank_ptr vblank, tmp; + + xorg_list_for_each_entry_safe(vblank, tmp, &present_exec_queue, event_queue) { + if (vblank->flip_ready) { + present_re_execute(vblank); + return; + } + } +} + static void present_flip_idle(ScreenPtr screen) { @@ -318,7 +358,7 @@ struct pixmap_visit { }; static int -present_set_tree_pixmap_visit(WindowPtr window, pointer data) +present_set_tree_pixmap_visit(WindowPtr window, void *data) { struct pixmap_visit *visit = data; ScreenPtr screen = window->drawable.pScreen; @@ -343,6 +383,24 @@ present_set_tree_pixmap(WindowPtr window, PixmapPtr pixmap) } static void +present_set_abort_flip(ScreenPtr screen) +{ + present_screen_priv_ptr screen_priv = present_screen_priv(screen); + + /* Switch back to using the screen pixmap now to avoid + * 2D applications drawing to the wrong pixmap. + */ + + if (screen_priv->flip_window) + present_set_tree_pixmap(screen_priv->flip_window, + (*screen->GetScreenPixmap)(screen)); + + present_set_tree_pixmap(screen->root, (*screen->GetScreenPixmap)(screen)); + + screen_priv->flip_pending->abort_flip = TRUE; +} + +static void present_unflip(ScreenPtr screen) { present_screen_priv_ptr screen_priv = present_screen_priv(screen); @@ -369,16 +427,14 @@ present_unflip(ScreenPtr screen) } static void -present_execute(present_vblank_ptr vblank, uint64_t ust, uint64_t crtc_msc); - -static void present_flip_notify(present_vblank_ptr vblank, uint64_t ust, uint64_t crtc_msc) { ScreenPtr screen = vblank->screen; present_screen_priv_ptr screen_priv = present_screen_priv(screen); - DebugPresent(("\tn %p %8lld: %08lx -> %08lx\n", vblank, vblank->target_msc, - vblank->pixmap ? vblank->pixmap->drawable.id : 0, + DebugPresent(("\tn %lld %p %8lld: %08lx -> %08lx\n", + vblank->event_id, vblank, vblank->target_msc, + vblank->pixmap ? vblank->pixmap->drawable.id : 0, vblank->window->drawable.id)); assert (vblank == screen_priv->flip_pending); @@ -404,6 +460,8 @@ present_flip_notify(present_vblank_ptr vblank, uint64_t ust, uint64_t crtc_msc) present_vblank_notify(vblank, PresentCompleteKindPixmap, PresentCompleteModeFlip, ust, crtc_msc); present_vblank_destroy(vblank); + + present_flip_try_ready(screen); } void @@ -436,6 +494,7 @@ present_event_notify(uint64_t event_id, uint64_t ust, uint64_t msc) DebugPresent(("\tun %lld\n", event_id)); screen_priv->unflip_event_id = 0; present_flip_idle(screen); + present_flip_try_ready(screen); return; } } @@ -470,7 +529,7 @@ present_check_flip_window (WindowPtr window) if (flip_pending->window == window) { if (!present_check_flip(flip_pending->crtc, window, flip_pending->pixmap, flip_pending->sync_flip, NULL, 0, 0)) - flip_pending->abort_flip = TRUE; + present_set_abort_flip(screen); } } else { /* @@ -498,15 +557,7 @@ static void present_wait_fence_triggered(void *param) { present_vblank_ptr vblank = param; - WindowPtr window = vblank->window; - uint64_t ust = 0, crtc_msc = 0; - - if (window) { - present_window_priv_ptr window_priv = present_get_window_priv(window, TRUE); - if (window_priv) - (void) present_get_ust_msc(window, window_priv->crtc, &ust, &crtc_msc); - } - present_execute(vblank, ust, crtc_msc); + present_re_execute(vblank); } /* @@ -534,14 +585,28 @@ present_execute(present_vblank_ptr vblank, uint64_t ust, uint64_t crtc_msc) } } + if (vblank->flip && vblank->pixmap && vblank->window) { + if (screen_priv->flip_pending || screen_priv->unflip_event_id) { + DebugPresent(("\tr %lld %p (pending %p unflip %lld)\n", + vblank->event_id, vblank, + screen_priv->flip_pending, screen_priv->unflip_event_id)); + vblank->flip_ready = TRUE; + return; + } + } + xorg_list_del(&vblank->event_queue); + xorg_list_del(&vblank->window_list); vblank->queued = FALSE; if (vblank->pixmap && vblank->window) { - if (vblank->flip && screen_priv->flip_pending == NULL && !screen_priv->unflip_event_id) { + if (vblank->flip) { + + DebugPresent(("\tf %lld %p %8lld: %08lx -> %08lx\n", + vblank->event_id, vblank, crtc_msc, + vblank->pixmap->drawable.id, vblank->window->drawable.id)); - DebugPresent(("\tf %p %8lld: %08lx -> %08lx\n", vblank, crtc_msc, vblank->pixmap->drawable.id, vblank->window->drawable.id)); /* Prepare to flip by placing it in the flip queue and * and sticking it into the flip_pending field */ @@ -587,7 +652,7 @@ present_execute(present_vblank_ptr vblank, uint64_t ust, uint64_t crtc_msc) /* Check pending flip */ if (window == screen_priv->flip_pending->window) - screen_priv->flip_pending->abort_flip = TRUE; + present_set_abort_flip(screen); } else if (!screen_priv->unflip_event_id) { /* Check current flip @@ -644,7 +709,7 @@ present_pixmap(WindowPtr window, uint64_t target_msc; uint64_t crtc_msc; int ret; - present_vblank_ptr vblank; + present_vblank_ptr vblank, tmp; ScreenPtr screen = window->drawable.pScreen; present_window_priv_ptr window_priv = present_get_window_priv(window, TRUE); present_screen_priv_ptr screen_priv = present_screen_priv(screen); @@ -664,7 +729,7 @@ present_pixmap(WindowPtr window, target_crtc = present_get_crtc(window); } - present_get_ust_msc(window, target_crtc, &ust, &crtc_msc); + present_get_ust_msc(screen, target_crtc, &ust, &crtc_msc); target_msc = present_window_to_crtc_msc(window, target_crtc, window_msc, crtc_msc); @@ -698,7 +763,7 @@ present_pixmap(WindowPtr window, */ if (!update) { - xorg_list_for_each_entry(vblank, &window_priv->vblank, window_list) { + xorg_list_for_each_entry_safe(vblank, tmp, &window_priv->vblank, window_list) { if (!vblank->pixmap) continue; @@ -710,7 +775,7 @@ present_pixmap(WindowPtr window, continue; DebugPresent(("\tx %lld %p %8lld: %08lx -> %08lx (crtc %p)\n", - vblank->event_id, vblank, target_msc, + vblank->event_id, vblank, vblank->target_msc, vblank->pixmap->drawable.id, vblank->window->drawable.id, vblank->crtc)); @@ -720,6 +785,9 @@ present_pixmap(WindowPtr window, vblank->pixmap = NULL; vblank->idle_fence = NULL; + vblank->flip = FALSE; + if (vblank->flip_ready) + present_re_execute(vblank); } } @@ -866,7 +934,7 @@ present_flip_destroy(ScreenPtr screen) /* Do the actual cleanup once the flip has been performed by the hardware */ if (screen_priv->flip_pending) - screen_priv->flip_pending->abort_flip = TRUE; + present_set_abort_flip(screen); } void @@ -875,7 +943,8 @@ present_vblank_destroy(present_vblank_ptr vblank) /* Remove vblank from window and screen lists */ xorg_list_del(&vblank->window_list); - DebugPresent(("\td %p %8lld: %08lx -> %08lx\n", vblank, vblank->target_msc, + DebugPresent(("\td %lld %p %8lld: %08lx -> %08lx\n", + vblank->event_id, vblank, vblank->target_msc, vblank->pixmap ? vblank->pixmap->drawable.id : 0, vblank->window->drawable.id)); diff --git a/xserver/present/present_event.c b/xserver/present/present_event.c index f0d509ed4..e9b827651 100644 --- a/xserver/present/present_event.c +++ b/xserver/present/present_event.c @@ -29,7 +29,7 @@ RESTYPE present_event_type; static int -present_free_event(pointer data, XID id) +present_free_event(void *data, XID id) { present_event_ptr present_event = (present_event_ptr) data; present_window_priv_ptr window_priv = present_window_priv(present_event->window); @@ -41,7 +41,7 @@ present_free_event(pointer data, XID id) break; } } - free((pointer) present_event); + free((void *) present_event); return 1; } @@ -173,7 +173,7 @@ present_send_complete_notify(WindowPtr window, CARD8 kind, CARD8 mode, CARD32 se } } } - if (complete_notify) + if (complete_notify && kind == PresentCompleteKindPixmap) (*complete_notify)(window, mode, serial, ust, msc); } @@ -229,7 +229,7 @@ present_select_input(ClientPtr client, XID eid, WindowPtr window, CARD32 mask) event->next = window_priv->events; window_priv->events = event; - if (!AddResource(event->id, present_event_type, (pointer) event)) + if (!AddResource(event->id, present_event_type, (void *) event)) return BadAlloc; return Success; diff --git a/xserver/present/present_fake.c b/xserver/present/present_fake.c index e550e98f8..4985c81e3 100644 --- a/xserver/present/present_fake.c +++ b/xserver/present/present_fake.c @@ -58,7 +58,7 @@ present_fake_notify(ScreenPtr screen, uint64_t event_id) static CARD32 present_fake_do_timer(OsTimerPtr timer, CARD32 time, - pointer arg) + void *arg) { present_fake_vblank_ptr fake_vblank = arg; diff --git a/xserver/present/present_priv.h b/xserver/present/present_priv.h index 8d3e0079c..d8569a2b6 100644 --- a/xserver/present/present_priv.h +++ b/xserver/present/present_priv.h @@ -71,6 +71,7 @@ struct present_vblank { int num_notifies; Bool queued; /* on present_exec_queue */ Bool flip; /* planning on using flip */ + Bool flip_ready; /* wants to flip, but waiting for previous flip or unflip */ Bool sync_flip; /* do flip synchronous to vblank */ Bool abort_flip; /* aborting this flip */ }; diff --git a/xserver/present/present_request.c b/xserver/present/present_request.c index 1064dcb3b..835890d28 100644 --- a/xserver/present/present_request.c +++ b/xserver/present/present_request.c @@ -89,7 +89,7 @@ proc_present_pixmap(ClientPtr client) ret = dixLookupWindow(&window, stuff->window, client, DixWriteAccess); if (ret != Success) return ret; - ret = dixLookupResourceByType((pointer *) &pixmap, stuff->pixmap, RT_PIXMAP, client, DixReadAccess); + ret = dixLookupResourceByType((void **) &pixmap, stuff->pixmap, RT_PIXMAP, client, DixReadAccess); if (ret != Success) return ret; diff --git a/xserver/pseudoramiX/Makefile.in b/xserver/pseudoramiX/Makefile.in index 6eb7e99ec..bc831c228 100644 --- a/xserver/pseudoramiX/Makefile.in +++ b/xserver/pseudoramiX/Makefile.in @@ -164,6 +164,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -208,6 +210,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -310,7 +316,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -319,6 +328,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -385,6 +395,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/pseudoramiX/pseudoramiX.c b/xserver/pseudoramiX/pseudoramiX.c index 23dbc7328..f47c7836d 100644 --- a/xserver/pseudoramiX/pseudoramiX.c +++ b/xserver/pseudoramiX/pseudoramiX.c @@ -100,6 +100,10 @@ static unsigned long pseudoramiXGeneration = 0; static void PseudoramiXTrace(const char *format, ...) + _X_ATTRIBUTE_PRINTF(1, 2); + +static void +PseudoramiXTrace(const char *format, ...) { va_list ap; @@ -110,6 +114,10 @@ PseudoramiXTrace(const char *format, ...) static void PseudoramiXDebug(const char *format, ...) + _X_ATTRIBUTE_PRINTF(1, 2); + +static void +PseudoramiXDebug(const char *format, ...) { va_list ap; diff --git a/xserver/randr/Makefile.in b/xserver/randr/Makefile.in index e773f7f51..6019676e1 100644 --- a/xserver/randr/Makefile.in +++ b/xserver/randr/Makefile.in @@ -203,6 +203,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -247,6 +249,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -349,7 +355,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -358,6 +367,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -424,6 +434,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/randr/randr.c b/xserver/randr/randr.c index 3c5142771..6e3f14b4e 100644 --- a/xserver/randr/randr.c +++ b/xserver/randr/randr.c @@ -60,7 +60,7 @@ DevPrivateKeyRec RRClientPrivateKeyRec; DevPrivateKeyRec rrPrivKeyRec; static void -RRClientCallback(CallbackListPtr *list, pointer closure, pointer data) +RRClientCallback(CallbackListPtr *list, void *closure, void *data) { NewClientInfoRec *clientinfo = (NewClientInfoRec *) data; ClientPtr pClient = clientinfo->client; @@ -338,7 +338,7 @@ RRScreenInit(ScreenPtr pScreen) } /*ARGSUSED*/ static int -RRFreeClient(pointer data, XID id) +RRFreeClient(void *data, XID id) { RREventPtr pRREvent; WindowPtr pWin; @@ -346,7 +346,7 @@ RRFreeClient(pointer data, XID id) pRREvent = (RREventPtr) data; pWin = pRREvent->window; - dixLookupResourceByType((pointer *) &pHead, pWin->drawable.id, + dixLookupResourceByType((void **) &pHead, pWin->drawable.id, RREventType, serverClient, DixDestroyAccess); if (pHead) { pPrev = 0; @@ -359,12 +359,12 @@ RRFreeClient(pointer data, XID id) *pHead = pRREvent->next; } } - free((pointer) pRREvent); + free((void *) pRREvent); return 1; } /*ARGSUSED*/ static int -RRFreeEvents(pointer data, XID id) +RRFreeEvents(void *data, XID id) { RREventPtr *pHead, pCur, pNext; @@ -372,9 +372,9 @@ RRFreeEvents(pointer data, XID id) for (pCur = *pHead; pCur; pCur = pNext) { pNext = pCur->next; FreeResource(pCur->clientResource, RRClientType); - free((pointer) pCur); + free((void *) pCur); } - free((pointer) pHead); + free((void *) pHead); return 1; } @@ -447,7 +447,7 @@ RRDeliverResourceEvent(ClientPtr client, WindowPtr pWin) } static int -TellChanged(WindowPtr pWin, pointer value) +TellChanged(WindowPtr pWin, void *value) { RREventPtr *pHead, pRREvent; ClientPtr client; @@ -458,7 +458,7 @@ TellChanged(WindowPtr pWin, pointer value) rrScrPriv(pScreen); int i; - dixLookupResourceByType((pointer *) &pHead, pWin->drawable.id, + dixLookupResourceByType((void **) &pHead, pWin->drawable.id, RREventType, serverClient, DixReadAccess); if (!pHead) return WT_WALKCHILDREN; @@ -589,7 +589,7 @@ RRTellChanged(ScreenPtr pScreen) pScrPriv->changed = FALSE; mastersp->changed = FALSE; - WalkTree(master, TellChanged, (pointer) master); + WalkTree(master, TellChanged, (void *) master); mastersp->resourcesChanged = FALSE; @@ -679,7 +679,7 @@ static int SProcRRDispatch(ClientPtr client) { REQUEST(xReq); - if (stuff->data >= RRNumberRequests || !ProcRandrVector[stuff->data]) + if (stuff->data >= RRNumberRequests || !SProcRandrVector[stuff->data]) return BadRequest; return (*SProcRandrVector[stuff->data]) (client); } diff --git a/xserver/randr/randrstr.h b/xserver/randr/randrstr.h index 15299fd6d..e14223201 100644 --- a/xserver/randr/randrstr.h +++ b/xserver/randr/randrstr.h @@ -92,7 +92,7 @@ struct _rrPropertyValue { Atom type; /* ignored by server */ short format; /* format of data for swapping - 8,16,32 */ long size; /* size of data in (format/8) bytes */ - pointer data; /* private to client */ + void *data; /* private to client */ }; struct _rrProperty { @@ -385,7 +385,7 @@ extern _X_EXPORT RESTYPE RRCrtcType, RRModeType, RROutputType, RRProviderType; #define VERIFY_RR_OUTPUT(id, ptr, a)\ {\ - int rc = dixLookupResourceByType((pointer *)&(ptr), id,\ + int rc = dixLookupResourceByType((void **)&(ptr), id,\ RROutputType, client, a);\ if (rc != Success) {\ client->errorValue = id;\ @@ -395,7 +395,7 @@ extern _X_EXPORT RESTYPE RRCrtcType, RRModeType, RROutputType, RRProviderType; #define VERIFY_RR_CRTC(id, ptr, a)\ {\ - int rc = dixLookupResourceByType((pointer *)&(ptr), id,\ + int rc = dixLookupResourceByType((void **)&(ptr), id,\ RRCrtcType, client, a);\ if (rc != Success) {\ client->errorValue = id;\ @@ -405,7 +405,7 @@ extern _X_EXPORT RESTYPE RRCrtcType, RRModeType, RROutputType, RRProviderType; #define VERIFY_RR_MODE(id, ptr, a)\ {\ - int rc = dixLookupResourceByType((pointer *)&(ptr), id,\ + int rc = dixLookupResourceByType((void **)&(ptr), id,\ RRModeType, client, a);\ if (rc != Success) {\ client->errorValue = id;\ @@ -415,7 +415,7 @@ extern _X_EXPORT RESTYPE RRCrtcType, RRModeType, RROutputType, RRProviderType; #define VERIFY_RR_PROVIDER(id, ptr, a)\ {\ - int rc = dixLookupResourceByType((pointer *)&(ptr), id,\ + int rc = dixLookupResourceByType((void **)&(ptr), id,\ RRProviderType, client, a);\ if (rc != Success) {\ client->errorValue = id;\ @@ -871,7 +871,7 @@ extern _X_EXPORT int RRChangeOutputProperty(RROutputPtr output, Atom property, Atom type, int format, int mode, unsigned long len, - pointer value, Bool sendevent, Bool pending); + void *value, Bool sendevent, Bool pending); extern _X_EXPORT int @@ -948,7 +948,7 @@ extern _X_EXPORT void extern _X_EXPORT int RRChangeProviderProperty(RRProviderPtr provider, Atom property, Atom type, int format, int mode, unsigned long len, - pointer value, Bool sendevent, Bool pending); + void *value, Bool sendevent, Bool pending); extern _X_EXPORT int RRConfigureProviderProperty(RRProviderPtr provider, Atom property, diff --git a/xserver/randr/rrcrtc.c b/xserver/randr/rrcrtc.c index 99b3dca08..69b3ecf0f 100644 --- a/xserver/randr/rrcrtc.c +++ b/xserver/randr/rrcrtc.c @@ -95,7 +95,7 @@ RRCrtcCreate(ScreenPtr pScreen, void *devPrivate) pixman_f_transform_init_identity(&crtc->f_transform); pixman_f_transform_init_identity(&crtc->f_inverse); - if (!AddResource(crtc->id, RRCrtcType, (pointer) crtc)) + if (!AddResource(crtc->id, RRCrtcType, (void *) crtc)) return NULL; /* attach the screen and crtc together */ @@ -475,24 +475,25 @@ rrCheckPixmapBounding(ScreenPtr pScreen, } xorg_list_for_each_entry(slave, &pScreen->output_slave_list, output_head) { - rrScrPriv(slave); - for (c = 0; c < pScrPriv->numCrtcs; c++) - if (pScrPriv->crtcs[c] == rr_crtc) { + rrScrPrivPtr slave_priv = rrGetScrPriv(slave); + for (c = 0; c < slave_priv->numCrtcs; c++) { + if (slave_priv->crtcs[c] == rr_crtc) { newbox.x1 = x; newbox.x2 = x + w; newbox.y1 = y; newbox.y2 = y + h; } else { - if (!pScrPriv->crtcs[c]->mode) + if (!slave_priv->crtcs[c]->mode) continue; - newbox.x1 = pScrPriv->crtcs[c]->x; - newbox.x2 = pScrPriv->crtcs[c]->x + pScrPriv->crtcs[c]->mode->mode.width; - newbox.y1 = pScrPriv->crtcs[c]->y; - newbox.y2 = pScrPriv->crtcs[c]->y + pScrPriv->crtcs[c]->mode->mode.height; + newbox.x1 = slave_priv->crtcs[c]->x; + newbox.x2 = slave_priv->crtcs[c]->x + slave_priv->crtcs[c]->mode->mode.width; + newbox.y1 = slave_priv->crtcs[c]->y; + newbox.y2 = slave_priv->crtcs[c]->y + slave_priv->crtcs[c]->mode->mode.height; } - RegionInit(&new_crtc_region, &newbox, 1); - RegionUnion(&total_region, &total_region, &new_crtc_region); + RegionInit(&new_crtc_region, &newbox, 1); + RegionUnion(&total_region, &total_region, &new_crtc_region); + } } newsize = RegionExtents(&total_region); @@ -503,7 +504,6 @@ rrCheckPixmapBounding(ScreenPtr pScreen, new_height == screen_pixmap->drawable.height) { ErrorF("adjust shatters %d %d\n", newsize->x1, newsize->x2); } else { - rrScrPriv(pScreen); pScrPriv->rrScreenSetSize(pScreen, new_width, new_height, 0, 0); } @@ -523,9 +523,19 @@ RRCrtcSet(RRCrtcPtr crtc, ScreenPtr pScreen = crtc->pScreen; Bool ret = FALSE; Bool recompute = TRUE; + Bool crtcChanged; + int o; rrScrPriv(pScreen); + crtcChanged = FALSE; + for (o = 0; o < numOutputs; o++) { + if (outputs[o] && outputs[o]->crtc != crtc) { + crtcChanged = TRUE; + break; + } + } + /* See if nothing changed */ if (crtc->mode == mode && crtc->x == x && @@ -533,7 +543,8 @@ RRCrtcSet(RRCrtcPtr crtc, crtc->rotation == rotation && crtc->numOutputs == numOutputs && !memcmp(crtc->outputs, outputs, numOutputs * sizeof(RROutputPtr)) && - !RRCrtcPendingProperties(crtc) && !RRCrtcPendingTransform(crtc)) { + !RRCrtcPendingProperties(crtc) && !RRCrtcPendingTransform(crtc) && + !crtcChanged) { recompute = FALSE; ret = TRUE; } @@ -605,7 +616,6 @@ RRCrtcSet(RRCrtcPtr crtc, #endif } if (ret) { - int o; RRTellChanged(pScreen); @@ -654,7 +664,7 @@ RRCrtcDestroy(RRCrtcPtr crtc) } static int -RRCrtcDestroyResource(pointer value, XID pid) +RRCrtcDestroyResource(void *value, XID pid) { RRCrtcPtr crtc = (RRCrtcPtr) value; ScreenPtr pScreen = crtc->pScreen; @@ -1026,7 +1036,7 @@ ProcRRSetCrtcConfig(ClientPtr client) outputIds = (RROutput *) (stuff + 1); for (i = 0; i < numOutputs; i++) { - ret = dixLookupResourceByType((pointer *) (outputs + i), outputIds[i], + ret = dixLookupResourceByType((void **) (outputs + i), outputIds[i], RROutputType, client, DixSetAttrAccess); if (ret != Success) { free(outputs); diff --git a/xserver/randr/rrdispatch.c b/xserver/randr/rrdispatch.c index 7fbc9f01c..b9346d3f9 100644 --- a/xserver/randr/rrdispatch.c +++ b/xserver/randr/rrdispatch.c @@ -83,7 +83,7 @@ ProcRRSelectInput(ClientPtr client) rc = dixLookupWindow(&pWin, stuff->window, client, DixReceiveAccess); if (rc != Success) return rc; - rc = dixLookupResourceByType((pointer *) &pHead, pWin->drawable.id, + rc = dixLookupResourceByType((void **) &pHead, pWin->drawable.id, RREventType, client, DixWriteAccess); if (rc != Success && rc != BadValue) return rc; @@ -120,7 +120,7 @@ ProcRRSelectInput(ClientPtr client) */ clientResource = FakeClientID(client->index); pRREvent->clientResource = clientResource; - if (!AddResource(clientResource, RRClientType, (pointer) pRREvent)) + if (!AddResource(clientResource, RRClientType, (void *) pRREvent)) return BadAlloc; /* * create a resource to contain a pointer to the list @@ -132,7 +132,7 @@ ProcRRSelectInput(ClientPtr client) pHead = (RREventPtr *) malloc(sizeof(RREventPtr)); if (!pHead || !AddResource(pWin->drawable.id, RREventType, - (pointer) pHead)) { + (void *) pHead)) { FreeResource(clientResource, RT_NONE); return BadAlloc; } diff --git a/xserver/randr/rrmode.c b/xserver/randr/rrmode.c index f5d3f9e54..befac4741 100644 --- a/xserver/randr/rrmode.c +++ b/xserver/randr/rrmode.c @@ -89,7 +89,7 @@ RRModeCreate(xRRModeInfo * modeInfo, const char *name, ScreenPtr userScreen) } mode->mode.id = FakeClientID(0); - if (!AddResource(mode->mode.id, RRModeType, (pointer) mode)) { + if (!AddResource(mode->mode.id, RRModeType, (void *) mode)) { free(newModes); return NULL; } @@ -250,7 +250,7 @@ RRModeDestroy(RRModePtr mode) } static int -RRModeDestroyResource(pointer value, XID pid) +RRModeDestroyResource(void *value, XID pid) { RRModeDestroy((RRModePtr) value); return 1; diff --git a/xserver/randr/rroutput.c b/xserver/randr/rroutput.c index 2b0b82f4c..f824f50ed 100644 --- a/xserver/randr/rroutput.c +++ b/xserver/randr/rroutput.c @@ -97,7 +97,7 @@ RROutputCreate(ScreenPtr pScreen, output->changed = FALSE; output->devPrivate = devPrivate; - if (!AddResource(output->id, RROutputType, (pointer) output)) + if (!AddResource(output->id, RROutputType, (void *) output)) return NULL; pScrPriv->outputs[pScrPriv->numOutputs++] = output; @@ -337,7 +337,7 @@ RROutputDestroy(RROutputPtr output) } static int -RROutputDestroyResource(pointer value, XID pid) +RROutputDestroyResource(void *value, XID pid) { RROutputPtr output = (RROutputPtr) value; ScreenPtr pScreen = output->pScreen; diff --git a/xserver/randr/rrproperty.c b/xserver/randr/rrproperty.c index 67b546728..e385e15ab 100644 --- a/xserver/randr/rrproperty.c +++ b/xserver/randr/rrproperty.c @@ -30,7 +30,7 @@ DeliverPropertyEvent(WindowPtr pWin, void *value) xRROutputPropertyNotifyEvent *event = value; RREventPtr *pHead, pRREvent; - dixLookupResourceByType((pointer *) &pHead, pWin->drawable.id, + dixLookupResourceByType((void **) &pHead, pWin->drawable.id, RREventType, serverClient, DixReadAccess); if (!pHead) return WT_WALKCHILDREN; @@ -135,7 +135,7 @@ RRDeleteOutputProperty(RROutputPtr output, Atom property) int RRChangeOutputProperty(RROutputPtr output, Atom property, Atom type, int format, int mode, unsigned long len, - pointer value, Bool sendevent, Bool pending) + void *value, Bool sendevent, Bool pending) { RRPropertyPtr prop; rrScrPrivPtr pScrPriv = rrGetScrPriv(output->pScreen); @@ -178,10 +178,10 @@ RRChangeOutputProperty(RROutputPtr output, Atom property, Atom type, total_len = prop_value->size + len; if (mode == PropModeReplace || len > 0) { - pointer new_data = NULL, old_data = NULL; + void *new_data = NULL, *old_data = NULL; total_size = total_len * size_in_bytes; - new_value.data = (pointer) malloc(total_size); + new_value.data = (void *) malloc(total_size); if (!new_value.data && total_size) { if (add) RRDestroyOutputProperty(prop); @@ -197,13 +197,13 @@ RRChangeOutputProperty(RROutputPtr output, Atom property, Atom type, old_data = NULL; break; case PropModeAppend: - new_data = (pointer) (((char *) new_value.data) + + new_data = (void *) (((char *) new_value.data) + (prop_value->size * size_in_bytes)); old_data = new_value.data; break; case PropModePrepend: new_data = new_value.data; - old_data = (pointer) (((char *) new_value.data) + + old_data = (void *) (((char *) new_value.data) + (prop_value->size * size_in_bytes)); break; } @@ -538,7 +538,7 @@ ProcRRChangeOutputProperty(ClientPtr client) err = RRChangeOutputProperty(output, stuff->property, stuff->type, (int) format, - (int) mode, len, (pointer) &stuff[1], TRUE, + (int) mode, len, (void *) &stuff[1], TRUE, TRUE); if (err != Success) return err; diff --git a/xserver/randr/rrprovider.c b/xserver/randr/rrprovider.c index 2334ad277..4507ba894 100644 --- a/xserver/randr/rrprovider.c +++ b/xserver/randr/rrprovider.c @@ -285,7 +285,7 @@ ProcRRSetProviderOutputSource(ClientPtr client) RRProviderPtr provider, source_provider = NULL; ScreenPtr pScreen; - REQUEST_AT_LEAST_SIZE(xRRSetProviderOutputSourceReq); + REQUEST_SIZE_MATCH(xRRSetProviderOutputSourceReq); VERIFY_RR_PROVIDER(stuff->provider, provider, DixReadAccess); @@ -320,7 +320,7 @@ ProcRRSetProviderOffloadSink(ClientPtr client) RRProviderPtr provider, sink_provider = NULL; ScreenPtr pScreen; - REQUEST_AT_LEAST_SIZE(xRRSetProviderOffloadSinkReq); + REQUEST_SIZE_MATCH(xRRSetProviderOffloadSinkReq); VERIFY_RR_PROVIDER(stuff->provider, provider, DixReadAccess); if (!(provider->capabilities & RR_Capability_SourceOffload)) @@ -365,7 +365,7 @@ RRProviderCreate(ScreenPtr pScreen, const char *name, provider->name[nameLength] = '\0'; provider->changed = FALSE; - if (!AddResource (provider->id, RRProviderType, (pointer) provider)) + if (!AddResource (provider->id, RRProviderType, (void *) provider)) return NULL; pScrPriv->provider = provider; return provider; @@ -387,7 +387,7 @@ RRProviderSetCapabilities(RRProviderPtr provider, uint32_t capabilities) } static int -RRProviderDestroyResource (pointer value, XID pid) +RRProviderDestroyResource (void *value, XID pid) { RRProviderPtr provider = (RRProviderPtr)value; ScreenPtr pScreen = provider->pScreen; diff --git a/xserver/randr/rrproviderproperty.c b/xserver/randr/rrproviderproperty.c index ab601da9a..ff2c614d0 100644 --- a/xserver/randr/rrproviderproperty.c +++ b/xserver/randr/rrproviderproperty.c @@ -30,7 +30,7 @@ DeliverPropertyEvent(WindowPtr pWin, void *value) xRRProviderPropertyNotifyEvent *event = value; RREventPtr *pHead, pRREvent; - dixLookupResourceByType((pointer *) &pHead, pWin->drawable.id, + dixLookupResourceByType((void **) &pHead, pWin->drawable.id, RREventType, serverClient, DixReadAccess); if (!pHead) return WT_WALKCHILDREN; @@ -135,7 +135,7 @@ RRDeleteProviderProperty(RRProviderPtr provider, Atom property) int RRChangeProviderProperty(RRProviderPtr provider, Atom property, Atom type, int format, int mode, unsigned long len, - pointer value, Bool sendevent, Bool pending) + void *value, Bool sendevent, Bool pending) { RRPropertyPtr prop; rrScrPrivPtr pScrPriv = rrGetScrPriv(provider->pScreen); @@ -178,10 +178,10 @@ RRChangeProviderProperty(RRProviderPtr provider, Atom property, Atom type, total_len = prop_value->size + len; if (mode == PropModeReplace || len > 0) { - pointer new_data = NULL, old_data = NULL; + void *new_data = NULL, *old_data = NULL; total_size = total_len * size_in_bytes; - new_value.data = (pointer) malloc(total_size); + new_value.data = (void *) malloc(total_size); if (!new_value.data && total_size) { if (add) RRDestroyProviderProperty(prop); @@ -197,13 +197,13 @@ RRChangeProviderProperty(RRProviderPtr provider, Atom property, Atom type, old_data = NULL; break; case PropModeAppend: - new_data = (pointer) (((char *) new_value.data) + + new_data = (void *) (((char *) new_value.data) + (prop_value->size * size_in_bytes)); old_data = new_value.data; break; case PropModePrepend: new_data = new_value.data; - old_data = (pointer) (((char *) new_value.data) + + old_data = (void *) (((char *) new_value.data) + (prop_value->size * size_in_bytes)); break; } @@ -534,7 +534,7 @@ ProcRRChangeProviderProperty(ClientPtr client) err = RRChangeProviderProperty(provider, stuff->property, stuff->type, (int) format, - (int) mode, len, (pointer) &stuff[1], TRUE, + (int) mode, len, (void *) &stuff[1], TRUE, TRUE); if (err != Success) return err; diff --git a/xserver/randr/rrsdispatch.c b/xserver/randr/rrsdispatch.c index 9968c7f81..08c3b6abe 100644 --- a/xserver/randr/rrsdispatch.c +++ b/xserver/randr/rrsdispatch.c @@ -434,6 +434,133 @@ SProcRRGetOutputPrimary(ClientPtr client) return ProcRandrVector[stuff->randrReqType] (client); } +static int SProcRRGetProviders(ClientPtr client) +{ + REQUEST(xRRGetProvidersReq); + + REQUEST_SIZE_MATCH(xRRGetProvidersReq); + swaps(&stuff->length); + swapl(&stuff->window); + return ProcRandrVector[stuff->randrReqType] (client); +} + +static int SProcRRGetProviderInfo(ClientPtr client) +{ + REQUEST(xRRGetProviderInfoReq); + + REQUEST_SIZE_MATCH(xRRGetProviderInfoReq); + swaps(&stuff->length); + swapl(&stuff->provider); + swapl(&stuff->configTimestamp); + return ProcRandrVector[stuff->randrReqType] (client); +} + +static int SProcRRSetProviderOffloadSink(ClientPtr client) +{ + REQUEST(xRRSetProviderOffloadSinkReq); + + REQUEST_SIZE_MATCH(xRRSetProviderOffloadSinkReq); + swaps(&stuff->length); + swapl(&stuff->provider); + swapl(&stuff->sink_provider); + swapl(&stuff->configTimestamp); + return ProcRandrVector[stuff->randrReqType] (client); +} + +static int SProcRRSetProviderOutputSource(ClientPtr client) +{ + REQUEST(xRRSetProviderOutputSourceReq); + + REQUEST_SIZE_MATCH(xRRSetProviderOutputSourceReq); + swaps(&stuff->length); + swapl(&stuff->provider); + swapl(&stuff->source_provider); + swapl(&stuff->configTimestamp); + return ProcRandrVector[stuff->randrReqType] (client); +} + +static int SProcRRListProviderProperties(ClientPtr client) +{ + REQUEST(xRRListProviderPropertiesReq); + + REQUEST_SIZE_MATCH(xRRListProviderPropertiesReq); + swaps(&stuff->length); + swapl(&stuff->provider); + return ProcRandrVector[stuff->randrReqType] (client); +} + +static int SProcRRQueryProviderProperty(ClientPtr client) +{ + REQUEST(xRRQueryProviderPropertyReq); + + REQUEST_SIZE_MATCH(xRRQueryProviderPropertyReq); + swaps(&stuff->length); + swapl(&stuff->provider); + swapl(&stuff->property); + return ProcRandrVector[stuff->randrReqType] (client); +} + +static int SProcRRConfigureProviderProperty(ClientPtr client) +{ + REQUEST(xRRConfigureProviderPropertyReq); + + REQUEST_AT_LEAST_SIZE(xRRConfigureProviderPropertyReq); + swaps(&stuff->length); + swapl(&stuff->provider); + swapl(&stuff->property); + /* TODO: no way to specify format? */ + SwapRestL(stuff); + return ProcRandrVector[stuff->randrReqType] (client); +} + +static int SProcRRChangeProviderProperty(ClientPtr client) +{ + REQUEST(xRRChangeProviderPropertyReq); + + REQUEST_AT_LEAST_SIZE(xRRChangeProviderPropertyReq); + swaps(&stuff->length); + swapl(&stuff->provider); + swapl(&stuff->property); + swapl(&stuff->type); + swapl(&stuff->nUnits); + switch (stuff->format) { + case 8: + break; + case 16: + SwapRestS(stuff); + break; + case 32: + SwapRestL(stuff); + break; + } + return ProcRandrVector[stuff->randrReqType] (client); +} + +static int SProcRRDeleteProviderProperty(ClientPtr client) +{ + REQUEST(xRRDeleteProviderPropertyReq); + + REQUEST_SIZE_MATCH(xRRDeleteProviderPropertyReq); + swaps(&stuff->length); + swapl(&stuff->provider); + swapl(&stuff->property); + return ProcRandrVector[stuff->randrReqType] (client); +} + +static int SProcRRGetProviderProperty(ClientPtr client) +{ + REQUEST(xRRGetProviderPropertyReq); + + REQUEST_SIZE_MATCH(xRRGetProviderPropertyReq); + swaps(&stuff->length); + swapl(&stuff->provider); + swapl(&stuff->property); + swapl(&stuff->type); + swapl(&stuff->longOffset); + swapl(&stuff->longLength); + return ProcRandrVector[stuff->randrReqType] (client); +} + int (*SProcRandrVector[RRNumberRequests]) (ClientPtr) = { SProcRRQueryVersion, /* 0 */ /* we skip 1 to make old clients fail pretty immediately */ @@ -472,4 +599,15 @@ int (*SProcRandrVector[RRNumberRequests]) (ClientPtr) = { SProcRRSetPanning, /* 29 */ SProcRRSetOutputPrimary, /* 30 */ SProcRRGetOutputPrimary, /* 31 */ +/* V1.4 additions */ + SProcRRGetProviders, /* 32 */ + SProcRRGetProviderInfo, /* 33 */ + SProcRRSetProviderOffloadSink, /* 34 */ + SProcRRSetProviderOutputSource, /* 35 */ + SProcRRListProviderProperties, /* 36 */ + SProcRRQueryProviderProperty, /* 37 */ + SProcRRConfigureProviderProperty, /* 38 */ + SProcRRChangeProviderProperty, /* 39 */ + SProcRRDeleteProviderProperty, /* 40 */ + SProcRRGetProviderProperty, /* 41 */ }; diff --git a/xserver/record/Makefile.in b/xserver/record/Makefile.in index 68d1fecfc..f98d029f4 100644 --- a/xserver/record/Makefile.in +++ b/xserver/record/Makefile.in @@ -162,6 +162,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -206,6 +208,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -308,7 +314,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -317,6 +326,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -383,6 +393,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/record/record.c b/xserver/record/record.c index 2c70460e8..c9002196f 100644 --- a/xserver/record/record.c +++ b/xserver/record/record.c @@ -130,15 +130,14 @@ static int numEnabledRCAPs; * returns an error. */ #define VERIFY_CONTEXT(_pContext, _contextid, _client) { \ - int rc = dixLookupResourceByType((pointer *)&(_pContext), _contextid, \ + int rc = dixLookupResourceByType((void **)&(_pContext), _contextid, \ RTContext, _client, DixUseAccess); \ if (rc != Success) \ return rc; \ } -static int RecordDeleteContext(pointer /*value */ , - XID /*id */ - ); +static int RecordDeleteContext(void *value, + XID id); /***************************************************************************/ @@ -232,7 +231,7 @@ RecordFindContextOnAllContexts(RecordContextPtr pContext) */ static void RecordFlushReplyBuffer(RecordContextPtr pContext, - pointer data1, int len1, pointer data2, int len2) + void *data1, int len1, void *data2, int len2) { if (!pContext->pRecordingClient || pContext->pRecordingClient->clientGone || pContext->inFlush) @@ -279,7 +278,7 @@ RecordFlushReplyBuffer(RecordContextPtr pContext, */ static void RecordAProtocolElement(RecordContextPtr pContext, ClientPtr pClient, - int category, pointer data, int datalen, int padlen, + int category, void *data, int datalen, int padlen, int futurelen) { CARD32 elemHeaderData[2]; @@ -390,8 +389,8 @@ RecordAProtocolElement(RecordContextPtr pContext, ClientPtr pClient, } } else { - RecordFlushReplyBuffer(pContext, (pointer) elemHeaderData, - numElemHeaders, (pointer) data, + RecordFlushReplyBuffer(pContext, (void *) elemHeaderData, + numElemHeaders, (void *) data, datalen - padlen); } } /* RecordAProtocolElement */ @@ -463,20 +462,20 @@ RecordABigRequest(RecordContextPtr pContext, ClientPtr client, xReq * stuff) /* record the request header */ bytesLeft = client->req_len << 2; RecordAProtocolElement(pContext, client, XRecordFromClient, - (pointer) stuff, SIZEOF(xReq), 0, bytesLeft); + (void *) stuff, SIZEOF(xReq), 0, bytesLeft); /* reinsert the extended length field that was squished out */ bigLength = client->req_len + bytes_to_int32(sizeof(bigLength)); if (client->swapped) swapl(&bigLength); RecordAProtocolElement(pContext, client, XRecordFromClient, - (pointer) &bigLength, sizeof(bigLength), 0, + (void *) &bigLength, sizeof(bigLength), 0, /* continuation */ -1); bytesLeft -= sizeof(bigLength); /* record the rest of the request after the length */ RecordAProtocolElement(pContext, client, XRecordFromClient, - (pointer) (stuff + 1), bytesLeft, 0, + (void *) (stuff + 1), bytesLeft, 0, /* continuation */ -1); } /* RecordABigRequest */ @@ -520,7 +519,7 @@ RecordARequest(ClientPtr client) RecordABigRequest(pContext, client, stuff); else RecordAProtocolElement(pContext, client, XRecordFromClient, - (pointer) stuff, + (void *) stuff, client->req_len << 2, 0, 0); } else { /* extension, check minor opcode */ @@ -543,7 +542,7 @@ RecordARequest(ClientPtr client) else RecordAProtocolElement(pContext, client, XRecordFromClient, - (pointer) stuff, + (void *) stuff, client->req_len << 2, 0, 0); break; } @@ -576,7 +575,7 @@ RecordARequest(ClientPtr client) * chunk of data belonging to this reply, it is set to 0. */ static void -RecordAReply(CallbackListPtr *pcbl, pointer nulldata, pointer calldata) +RecordAReply(CallbackListPtr *pcbl, void *nulldata, void *calldata) { RecordContextPtr pContext; RecordClientsAndProtocolPtr pRCAP; @@ -592,7 +591,7 @@ RecordAReply(CallbackListPtr *pcbl, pointer nulldata, pointer calldata) if (pContext->continuedReply) { RecordAProtocolElement(pContext, client, XRecordFromServer, - (pointer) pri->replyData, + (void *) pri->replyData, pri->dataLenBytes, pri->padBytes, /* continuation */ -1); if (!pri->bytesRemaining) @@ -602,7 +601,7 @@ RecordAReply(CallbackListPtr *pcbl, pointer nulldata, pointer calldata) RecordIsMemberOfSet(pRCAP->pReplyMajorOpSet, majorop)) { if (majorop <= 127) { /* core reply */ RecordAProtocolElement(pContext, client, XRecordFromServer, - (pointer) pri->replyData, + (void *) pri->replyData, pri->dataLenBytes, 0, pri->bytesRemaining); if (pri->bytesRemaining) @@ -625,7 +624,7 @@ RecordAReply(CallbackListPtr *pcbl, pointer nulldata, pointer calldata) minorop)) { RecordAProtocolElement(pContext, client, XRecordFromServer, - (pointer) pri->replyData, + (void *) pri->replyData, pri->dataLenBytes, 0, pri->bytesRemaining); if (pri->bytesRemaining) @@ -655,8 +654,8 @@ RecordAReply(CallbackListPtr *pcbl, pointer nulldata, pointer calldata) * it for this client. */ static void -RecordADeliveredEventOrError(CallbackListPtr *pcbl, pointer nulldata, - pointer calldata) +RecordADeliveredEventOrError(CallbackListPtr *pcbl, void *nulldata, + void *calldata) { EventInfoRec *pei = (EventInfoRec *) calldata; RecordContextPtr pContext; @@ -766,7 +765,7 @@ RecordSendProtocolEvents(RecordClientsAndProtocolPtr pRCAP, * it for this client. */ static void -RecordADeviceEvent(CallbackListPtr *pcbl, pointer nulldata, pointer calldata) +RecordADeviceEvent(CallbackListPtr *pcbl, void *nulldata, void *calldata) { DeviceEventInfoRec *pei = (DeviceEventInfoRec *) calldata; RecordContextPtr pContext; @@ -812,7 +811,7 @@ RecordADeviceEvent(CallbackListPtr *pcbl, pointer nulldata, pointer calldata) */ static void RecordFlushAllContexts(CallbackListPtr *pcbl, - pointer nulldata, pointer calldata) + void *nulldata, void *calldata) { int eci; /* enabled context index */ RecordContextPtr pContext; @@ -1143,7 +1142,7 @@ RecordSanityCheckClientSpecifiers(ClientPtr client, XID *clientspecs, int i; int clientIndex; int rc; - pointer value; + void *value; for (i = 0; i < nspecs; i++) { if (clientspecs[i] == XRecordCurrentClients || @@ -1880,7 +1879,7 @@ ProcRecordCreateContext(ClientPtr client) return Success; } else { - RecordDeleteContext((pointer) pContext, pContext->id); + RecordDeleteContext((void *) pContext, pContext->id); return BadAlloc; } bailout: @@ -2416,7 +2415,7 @@ ProcRecordDisableContext(ClientPtr client) * it from the ppAllContexts array. */ static int -RecordDeleteContext(pointer value, XID id) +RecordDeleteContext(void *value, XID id) { int i; RecordContextPtr pContext = (RecordContextPtr) value; @@ -2535,7 +2534,7 @@ SProcRecordCreateContext(ClientPtr client) swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xRecordCreateContextReq); - if ((status = SwapCreateRegister((pointer) stuff)) != Success) + if ((status = SwapCreateRegister((void *) stuff)) != Success) return status; return ProcRecordCreateContext(client); } /* SProcRecordCreateContext */ @@ -2548,7 +2547,7 @@ SProcRecordRegisterClients(ClientPtr client) swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xRecordRegisterClientsReq); - if ((status = SwapCreateRegister((pointer) stuff)) != Success) + if ((status = SwapCreateRegister((void *) stuff)) != Success) return status; return ProcRecordRegisterClients(client); } /* SProcRecordRegisterClients */ @@ -2664,7 +2663,7 @@ RecordConnectionSetupInfo(RecordContextPtr pContext, NewClientInfoRec * pci) SwapConnSetupInfo((char *) pci->setup, (char *) (pConnSetup + prefixsize)); RecordAProtocolElement(pContext, pci->client, XRecordClientStarted, - (pointer) pConnSetup, prefixsize + restsize, 0, + (void *) pConnSetup, prefixsize + restsize, 0, 0); free(pConnSetup); } @@ -2673,9 +2672,9 @@ RecordConnectionSetupInfo(RecordContextPtr pContext, NewClientInfoRec * pci) * data in two pieces */ RecordAProtocolElement(pContext, pci->client, XRecordClientStarted, - (pointer) pci->prefix, prefixsize, 0, restsize); + (void *) pci->prefix, prefixsize, 0, restsize); RecordAProtocolElement(pContext, pci->client, XRecordClientStarted, - (pointer) pci->setup, restsize, 0, + (void *) pci->setup, restsize, 0, /* continuation */ -1); } } /* RecordConnectionSetupInfo */ @@ -2704,8 +2703,8 @@ RecordConnectionSetupInfo(RecordContextPtr pContext, NewClientInfoRec * pci) */ static void -RecordAClientStateChange(CallbackListPtr *pcbl, pointer nulldata, - pointer calldata) +RecordAClientStateChange(CallbackListPtr *pcbl, void *nulldata, + void *calldata) { NewClientInfoRec *pci = (NewClientInfoRec *) calldata; int i; diff --git a/xserver/render/Makefile.in b/xserver/render/Makefile.in index 345267993..aafe4285a 100644 --- a/xserver/render/Makefile.in +++ b/xserver/render/Makefile.in @@ -195,6 +195,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -239,6 +241,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -341,7 +347,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -350,6 +359,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -416,6 +426,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/render/animcur.c b/xserver/render/animcur.c index 038c5b9be..69f9f887c 100644 --- a/xserver/render/animcur.c +++ b/xserver/render/animcur.c @@ -136,7 +136,7 @@ AnimCurCursorLimits(DeviceIntPtr pDev, static void AnimCurScreenBlockHandler(ScreenPtr pScreen, - pointer pTimeout, pointer pReadmask) + void *pTimeout, void *pReadmask) { AnimCurScreenPtr as = GetAnimCurScreen(pScreen); DeviceIntPtr dev; diff --git a/xserver/render/glyph.c b/xserver/render/glyph.c index e1dc66291..ae3812171 100644 --- a/xserver/render/glyph.c +++ b/xserver/render/glyph.c @@ -97,7 +97,7 @@ GlyphUninit(ScreenPtr pScreen) glyph = globalGlyphs[fdepth].table[i].glyph; if (glyph && glyph != DeletedGlyph) { if (GetGlyphPicture(glyph, pScreen)) { - FreePicture((pointer) GetGlyphPicture(glyph, pScreen), 0); + FreePicture((void *) GetGlyphPicture(glyph, pScreen), 0); SetGlyphPicture(glyph, pScreen, NULL); } (*ps->UnrealizeGlyph) (pScreen, glyph); @@ -237,7 +237,7 @@ FreeGlyphPicture(GlyphPtr glyph) ScreenPtr pScreen = screenInfo.screens[i]; if (GetGlyphPicture(glyph, pScreen)) - FreePicture((pointer) GetGlyphPicture(glyph, pScreen), 0); + FreePicture((void *) GetGlyphPicture(glyph, pScreen), 0); ps = GetPictureScreenIfSet(pScreen); if (ps) @@ -467,7 +467,7 @@ AllocateGlyphSet(int fdepth, PictFormatPtr format) } int -FreeGlyphSet(pointer value, XID gid) +FreeGlyphSet(void *value, XID gid) { GlyphSetPtr glyphSet = (GlyphSetPtr) value; @@ -678,7 +678,7 @@ miGlyphs(CARD8 op, pDst, xSrc + x - xDst, ySrc + y - yDst, 0, 0, x, y, width, height); - FreePicture((pointer) pMask, (XID) 0); + FreePicture((void *) pMask, (XID) 0); (*pScreen->DestroyPixmap) (pMaskPixmap); } } diff --git a/xserver/render/glyphstr.h b/xserver/render/glyphstr.h index 7d178be01..835c1a74e 100644 --- a/xserver/render/glyphstr.h +++ b/xserver/render/glyphstr.h @@ -131,7 +131,7 @@ extern _X_EXPORT Bool extern _X_EXPORT GlyphSetPtr AllocateGlyphSet(int fdepth, PictFormatPtr format); extern _X_EXPORT int - FreeGlyphSet(pointer value, XID gid); + FreeGlyphSet(void *value, XID gid); #define GLYPH_HAS_GLYPH_PICTURE_ACCESSOR 1 /* used for api compat */ extern _X_EXPORT PicturePtr diff --git a/xserver/render/mipict.c b/xserver/render/mipict.c index 2e64b20ff..3959fc415 100644 --- a/xserver/render/mipict.c +++ b/xserver/render/mipict.c @@ -69,17 +69,17 @@ miDestroyPictureClip(PicturePtr pPicture) } int -miChangePictureClip(PicturePtr pPicture, int type, pointer value, int n) +miChangePictureClip(PicturePtr pPicture, int type, void *value, int n) { ScreenPtr pScreen = pPicture->pDrawable->pScreen; PictureScreenPtr ps = GetPictureScreen(pScreen); - pointer clientClip; + void *clientClip; int clientClipType; switch (type) { case CT_PIXMAP: /* convert the pixmap to a region */ - clientClip = (pointer) BitmapToRegion(pScreen, (PixmapPtr) value); + clientClip = (void *) BitmapToRegion(pScreen, (PixmapPtr) value); if (!clientClip) return BadAlloc; clientClipType = CT_REGION; @@ -94,7 +94,7 @@ miChangePictureClip(PicturePtr pPicture, int type, pointer value, int n) clientClipType = CT_NONE; break; default: - clientClip = (pointer) RegionFromRects(n, (xRectangle *) value, type); + clientClip = (void *) RegionFromRects(n, (xRectangle *) value, type); if (!clientClip) return BadAlloc; clientClipType = CT_REGION; diff --git a/xserver/render/mipict.h b/xserver/render/mipict.h index 943622888..a16dd3112 100644 --- a/xserver/render/mipict.h +++ b/xserver/render/mipict.h @@ -57,7 +57,7 @@ extern _X_EXPORT void miDestroyPictureClip(PicturePtr pPicture); extern _X_EXPORT int - miChangePictureClip(PicturePtr pPicture, int type, pointer value, int n); + miChangePictureClip(PicturePtr pPicture, int type, void *value, int n); extern _X_EXPORT void miChangePicture(PicturePtr pPicture, Mask mask); diff --git a/xserver/render/mirect.c b/xserver/render/mirect.c index 357d52860..4e76972d1 100644 --- a/xserver/render/mirect.c +++ b/xserver/render/mirect.c @@ -156,7 +156,7 @@ miCompositeRects(CARD8 op, rects++; } - FreePicture((pointer) pSrc, 0); + FreePicture((void *) pSrc, 0); bail4: FreeScratchGC(pGC); bail3: diff --git a/xserver/render/picture.c b/xserver/render/picture.c index 2908b7629..7da93102b 100644 --- a/xserver/render/picture.c +++ b/xserver/render/picture.c @@ -70,7 +70,7 @@ PictureDestroyWindow(WindowPtr pWindow) SetPictureWindow(pWindow, pPicture->pNext); if (pPicture->id) FreeResource(pPicture->id, PictureType); - FreePicture((pointer) pPicture, pPicture->id); + FreePicture((void *) pPicture, pPicture->id); } pScreen->DestroyWindow = ps->DestroyWindow; ret = (*pScreen->DestroyWindow) (pWindow); @@ -445,7 +445,7 @@ PictureInitIndexedFormat(ScreenPtr pScreen, PictFormatPtr format) return TRUE; if (format->index.vid == pScreen->rootVisual) { - dixLookupResourceByType((pointer *) &format->index.pColormap, + dixLookupResourceByType((void **) &format->index.pColormap, pScreen->defColormap, RT_COLORMAP, serverClient, DixGetAttrAccess); } @@ -601,7 +601,7 @@ PictureParseCmapPolicy(const char *name) /** @see GetDefaultBytes */ static void -GetPictureBytes(pointer value, XID id, ResourceSizePtr size) +GetPictureBytes(void *value, XID id, ResourceSizePtr size) { PicturePtr picture = value; @@ -655,7 +655,7 @@ PictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats) } for (n = 0; n < nformats; n++) { if (!AddResource - (formats[n].id, PictFormatType, (pointer) (formats + n))) { + (formats[n].id, PictFormatType, (void *) (formats + n))) { free(formats); return FALSE; } @@ -1054,7 +1054,7 @@ ChangePicture(PicturePtr pPicture, if (pid == None) pAlpha = 0; else { - error = dixLookupResourceByType((pointer *) &pAlpha, pid, + error = dixLookupResourceByType((void **) &pAlpha, pid, PictureType, client, DixReadAccess); if (error != Success) { @@ -1075,7 +1075,7 @@ ChangePicture(PicturePtr pPicture, if (pAlpha && pAlpha->pDrawable->type == DRAWABLE_PIXMAP) pAlpha->refcnt++; if (pPicture->alphaMap) - FreePicture((pointer) pPicture->alphaMap, (XID) 0); + FreePicture((void *) pPicture->alphaMap, (XID) 0); pPicture->alphaMap = pAlpha; } } @@ -1113,7 +1113,7 @@ ChangePicture(PicturePtr pPicture, } else { clipType = CT_PIXMAP; - error = dixLookupResourceByType((pointer *) &pPixmap, pid, + error = dixLookupResourceByType((void **) &pPixmap, pid, RT_PIXMAP, client, DixReadAccess); if (error != Success) { @@ -1143,7 +1143,7 @@ ChangePicture(PicturePtr pPicture, } } error = (*ps->ChangePictureClip) (pPicture, clipType, - (pointer) pPixmap, 0); + (void *) pPixmap, 0); break; } case CPGraphicsExposure: @@ -1240,7 +1240,7 @@ SetPictureClipRects(PicturePtr pPicture, if (!clientClip) return BadAlloc; result = (*ps->ChangePictureClip) (pPicture, CT_REGION, - (pointer) clientClip, 0); + (void *) clientClip, 0); if (result == Success) { pPicture->clipOrigin.x = xOrigin; pPicture->clipOrigin.y = yOrigin; @@ -1276,7 +1276,7 @@ SetPictureClipRegion(PicturePtr pPicture, clientClip = 0; } - result = (*ps->ChangePictureClip) (pPicture, type, (pointer) clientClip, 0); + result = (*ps->ChangePictureClip) (pPicture, type, (void *) clientClip, 0); if (result == Success) { pPicture->clipOrigin.x = xOrigin; pPicture->clipOrigin.y = yOrigin; @@ -1354,7 +1354,7 @@ CopyPicture(PicturePtr pSrc, Mask mask, PicturePtr pDst) pSrc->alphaMap->pDrawable->type == DRAWABLE_PIXMAP) pSrc->alphaMap->refcnt++; if (pDst->alphaMap) - FreePicture((pointer) pDst->alphaMap, (XID) 0); + FreePicture((void *) pDst->alphaMap, (XID) 0); pDst->alphaMap = pSrc->alphaMap; break; case CPAlphaXOrigin: @@ -1435,7 +1435,7 @@ ValidatePicture(PicturePtr pPicture) } int -FreePicture(pointer value, XID pid) +FreePicture(void *value, XID pid) { PicturePtr pPicture = (PicturePtr) value; @@ -1454,7 +1454,7 @@ FreePicture(pointer value, XID pid) PictureScreenPtr ps = GetPictureScreen(pScreen); if (pPicture->alphaMap) - FreePicture((pointer) pPicture->alphaMap, (XID) 0); + FreePicture((void *) pPicture->alphaMap, (XID) 0); (*ps->DestroyPicture) (pPicture); (*ps->DestroyPictureClip) (pPicture); if (pPicture->pDrawable->type == DRAWABLE_WINDOW) { @@ -1480,7 +1480,7 @@ FreePicture(pointer value, XID pid) } int -FreePictFormat(pointer pPictFormat, XID pid) +FreePictFormat(void *pPictFormat, XID pid) { return Success; } diff --git a/xserver/render/picturestr.h b/xserver/render/picturestr.h index 5644f28cf..8c8100d81 100644 --- a/xserver/render/picturestr.h +++ b/xserver/render/picturestr.h @@ -145,7 +145,7 @@ typedef struct _Picture { DDXPointRec alphaOrigin; DDXPointRec clipOrigin; - pointer clientClip; + void *clientClip; unsigned long serialNumber; @@ -189,7 +189,7 @@ typedef struct { typedef int (*CreatePictureProcPtr) (PicturePtr pPicture); typedef void (*DestroyPictureProcPtr) (PicturePtr pPicture); typedef int (*ChangePictureClipProcPtr) (PicturePtr pPicture, - int clipType, pointer value, int n); + int clipType, void *value, int n); typedef void (*DestroyPictureClipProcPtr) (PicturePtr pPicture); typedef int (*ChangePictureTransformProcPtr) (PicturePtr pPicture, @@ -363,7 +363,7 @@ extern _X_EXPORT RESTYPE GlyphSetType; #define SetPictureWindow(w,p) dixSetPrivate(&(w)->devPrivates, PictureWindowPrivateKey, p) #define VERIFY_PICTURE(pPicture, pid, client, mode) {\ - int tmprc = dixLookupResourceByType((pointer)&(pPicture), pid,\ + int tmprc = dixLookupResourceByType((void *)&(pPicture), pid,\ PictureType, client, mode);\ if (tmprc != Success)\ return tmprc;\ @@ -482,10 +482,10 @@ extern _X_EXPORT void ValidatePicture(PicturePtr pPicture); extern _X_EXPORT int - FreePicture(pointer pPicture, XID pid); + FreePicture(void *pPicture, XID pid); extern _X_EXPORT int - FreePictFormat(pointer pPictFormat, XID pid); + FreePictFormat(void *pPictFormat, XID pid); extern _X_EXPORT void diff --git a/xserver/render/render.c b/xserver/render/render.c index 51f75ae7e..9ac4a98e7 100644 --- a/xserver/render/render.c +++ b/xserver/render/render.c @@ -220,7 +220,7 @@ typedef struct _RenderClient { #define GetRenderClient(pClient) ((RenderClientPtr)dixLookupPrivate(&(pClient)->devPrivates, RenderClientPrivateKey)) static void -RenderClientCallback(CallbackListPtr *list, pointer closure, pointer data) +RenderClientCallback(CallbackListPtr *list, void *closure, void *data) { NewClientInfoRec *clientinfo = (NewClientInfoRec *) data; ClientPtr pClient = clientinfo->client; @@ -520,7 +520,7 @@ ProcRenderQueryPictIndexValues(ClientPtr client) REQUEST_AT_LEAST_SIZE(xRenderQueryPictIndexValuesReq); - rc = dixLookupResourceByType((pointer *) &pFormat, stuff->format, + rc = dixLookupResourceByType((void **) &pFormat, stuff->format, PictFormatType, client, DixReadAccess); if (rc != Success) return rc; @@ -587,7 +587,7 @@ ProcRenderCreatePicture(ClientPtr client) if (rc != Success) return rc; - rc = dixLookupResourceByType((pointer *) &pFormat, stuff->format, + rc = dixLookupResourceByType((void **) &pFormat, stuff->format, PictFormatType, client, DixReadAccess); if (rc != Success) return rc; @@ -604,7 +604,7 @@ ProcRenderCreatePicture(ClientPtr client) stuff->mask, (XID *) (stuff + 1), client, &error); if (!pPicture) return error; - if (!AddResource(stuff->pid, PictureType, (pointer) pPicture)) + if (!AddResource(stuff->pid, PictureType, (void *) pPicture)) return BadAlloc; return Success; } @@ -638,7 +638,7 @@ ProcRenderSetPictureClipRectangles(ClientPtr client) REQUEST_AT_LEAST_SIZE(xRenderSetPictureClipRectanglesReq); VERIFY_PICTURE(pPicture, stuff->picture, client, DixSetAttrAccess); if (!pPicture->pDrawable) - return BadDrawable; + return RenderErrBase + BadPicture; nr = (client->req_len << 2) - sizeof(xRenderSetPictureClipRectanglesReq); if (nr & 4) @@ -744,7 +744,7 @@ ProcRenderTrapezoids(ClientPtr client) if (pSrc->pDrawable && pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen) return BadMatch; if (stuff->maskFormat) { - rc = dixLookupResourceByType((pointer *) &pFormat, stuff->maskFormat, + rc = dixLookupResourceByType((void **) &pFormat, stuff->maskFormat, PictFormatType, client, DixReadAccess); if (rc != Success) return rc; @@ -783,7 +783,7 @@ ProcRenderTriangles(ClientPtr client) if (pSrc->pDrawable && pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen) return BadMatch; if (stuff->maskFormat) { - rc = dixLookupResourceByType((pointer *) &pFormat, stuff->maskFormat, + rc = dixLookupResourceByType((void **) &pFormat, stuff->maskFormat, PictFormatType, client, DixReadAccess); if (rc != Success) return rc; @@ -822,7 +822,7 @@ ProcRenderTriStrip(ClientPtr client) if (pSrc->pDrawable && pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen) return BadMatch; if (stuff->maskFormat) { - rc = dixLookupResourceByType((pointer *) &pFormat, stuff->maskFormat, + rc = dixLookupResourceByType((void **) &pFormat, stuff->maskFormat, PictFormatType, client, DixReadAccess); if (rc != Success) return rc; @@ -861,7 +861,7 @@ ProcRenderTriFan(ClientPtr client) if (pSrc->pDrawable && pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen) return BadMatch; if (stuff->maskFormat) { - rc = dixLookupResourceByType((pointer *) &pFormat, stuff->maskFormat, + rc = dixLookupResourceByType((void **) &pFormat, stuff->maskFormat, PictFormatType, client, DixReadAccess); if (rc != Success) return rc; @@ -909,7 +909,7 @@ ProcRenderCreateGlyphSet(ClientPtr client) REQUEST_SIZE_MATCH(xRenderCreateGlyphSetReq); LEGAL_NEW_RESOURCE(stuff->gsid, client); - rc = dixLookupResourceByType((pointer *) &format, stuff->format, + rc = dixLookupResourceByType((void **) &format, stuff->format, PictFormatType, client, DixReadAccess); if (rc != Success) return rc; @@ -943,7 +943,7 @@ ProcRenderCreateGlyphSet(ClientPtr client) glyphSet, RT_NONE, NULL, DixCreateAccess); if (rc != Success) return rc; - if (!AddResource(stuff->gsid, GlyphSetType, (pointer) glyphSet)) + if (!AddResource(stuff->gsid, GlyphSetType, (void *) glyphSet)) return BadAlloc; return Success; } @@ -960,14 +960,14 @@ ProcRenderReferenceGlyphSet(ClientPtr client) LEGAL_NEW_RESOURCE(stuff->gsid, client); - rc = dixLookupResourceByType((pointer *) &glyphSet, stuff->existing, + rc = dixLookupResourceByType((void **) &glyphSet, stuff->existing, GlyphSetType, client, DixGetAttrAccess); if (rc != Success) { client->errorValue = stuff->existing; return rc; } glyphSet->refcnt++; - if (!AddResource(stuff->gsid, GlyphSetType, (pointer) glyphSet)) + if (!AddResource(stuff->gsid, GlyphSetType, (void *) glyphSet)) return BadAlloc; return Success; } @@ -984,7 +984,7 @@ ProcRenderFreeGlyphSet(ClientPtr client) REQUEST(xRenderFreeGlyphSetReq); REQUEST_SIZE_MATCH(xRenderFreeGlyphSetReq); - rc = dixLookupResourceByType((pointer *) &glyphSet, stuff->glyphset, + rc = dixLookupResourceByType((void **) &glyphSet, stuff->glyphset, GlyphSetType, client, DixDestroyAccess); if (rc != Success) { client->errorValue = stuff->glyphset; @@ -1024,7 +1024,7 @@ ProcRenderAddGlyphs(ClientPtr client) REQUEST_AT_LEAST_SIZE(xRenderAddGlyphsReq); err = - dixLookupResourceByType((pointer *) &glyphSet, stuff->glyphset, + dixLookupResourceByType((void **) &glyphSet, stuff->glyphset, GlyphSetType, client, DixAddAccess); if (err != Success) { client->errorValue = stuff->glyphset; @@ -1157,7 +1157,7 @@ ProcRenderAddGlyphs(ClientPtr client) pSrc, None, pDst, 0, 0, 0, 0, 0, 0, width, height); - FreePicture((pointer) pSrc, 0); + FreePicture((void *) pSrc, 0); pSrc = NULL; FreeScratchPixmapHeader(pSrcPix); pSrcPix = NULL; @@ -1189,7 +1189,7 @@ ProcRenderAddGlyphs(ClientPtr client) return Success; bail: if (pSrc) - FreePicture((pointer) pSrc, 0); + FreePicture((void *) pSrc, 0); if (pSrcPix) FreeScratchPixmapHeader(pSrcPix); for (i = 0; i < nglyphs; i++) @@ -1216,7 +1216,7 @@ ProcRenderFreeGlyphs(ClientPtr client) CARD32 glyph; REQUEST_AT_LEAST_SIZE(xRenderFreeGlyphsReq); - rc = dixLookupResourceByType((pointer *) &glyphSet, stuff->glyphset, + rc = dixLookupResourceByType((void **) &glyphSet, stuff->glyphset, GlyphSetType, client, DixRemoveAccess); if (rc != Success) { client->errorValue = stuff->glyphset; @@ -1282,7 +1282,7 @@ ProcRenderCompositeGlyphs(ClientPtr client) if (pSrc->pDrawable && pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen) return BadMatch; if (stuff->maskFormat) { - rc = dixLookupResourceByType((pointer *) &pFormat, stuff->maskFormat, + rc = dixLookupResourceByType((void **) &pFormat, stuff->maskFormat, PictFormatType, client, DixReadAccess); if (rc != Success) return rc; @@ -1290,7 +1290,7 @@ ProcRenderCompositeGlyphs(ClientPtr client) else pFormat = 0; - rc = dixLookupResourceByType((pointer *) &glyphSet, stuff->glyphset, + rc = dixLookupResourceByType((void **) &glyphSet, stuff->glyphset, GlyphSetType, client, DixUseAccess); if (rc != Success) return rc; @@ -1341,7 +1341,7 @@ ProcRenderCompositeGlyphs(ClientPtr client) if (elt->len == 0xff) { if (buffer + sizeof(GlyphSet) < end) { memcpy(&gs, buffer, sizeof(GlyphSet)); - rc = dixLookupResourceByType((pointer *) &glyphSet, gs, + rc = dixLookupResourceByType((void **) &glyphSet, gs, GlyphSetType, client, DixUseAccess); if (rc != Success) @@ -1508,7 +1508,7 @@ ProcRenderCreateCursor(ClientPtr client) if (pSrc->format == PICT_a8r8g8b8) { (*pScreen->GetImage) (pSrc->pDrawable, 0, 0, width, height, ZPixmap, - 0xffffffff, (pointer) argbbits); + 0xffffffff, (void *) argbbits); } else { PixmapPtr pPixmap; @@ -1544,7 +1544,7 @@ ProcRenderCreateCursor(ClientPtr client) pSrc, 0, pPicture, 0, 0, 0, 0, 0, 0, width, height); (*pScreen->GetImage) (pPicture->pDrawable, 0, 0, width, height, ZPixmap, - 0xffffffff, (pointer) argbbits); + 0xffffffff, (void *) argbbits); FreePicture(pPicture, 0); } /* @@ -1633,7 +1633,7 @@ ProcRenderCreateCursor(ClientPtr client) &pCursor, client, stuff->cid); if (rc != Success) goto bail; - if (!AddResource(stuff->cid, RT_CURSOR, (pointer) pCursor)) { + if (!AddResource(stuff->cid, RT_CURSOR, (void *) pCursor)) { rc = BadAlloc; goto bail; } @@ -1799,7 +1799,7 @@ ProcRenderCreateAnimCursor(ClientPtr client) deltas = (CARD32 *) (cursors + ncursor); elt = (xAnimCursorElt *) (stuff + 1); for (i = 0; i < ncursor; i++) { - ret = dixLookupResourceByType((pointer *) (cursors + i), elt->cursor, + ret = dixLookupResourceByType((void **) (cursors + i), elt->cursor, RT_CURSOR, client, DixReadAccess); if (ret != Success) { free(cursors); @@ -1814,7 +1814,7 @@ ProcRenderCreateAnimCursor(ClientPtr client) if (ret != Success) return ret; - if (AddResource(stuff->cid, RT_CURSOR, (pointer) pCursor)) + if (AddResource(stuff->cid, RT_CURSOR, (void *) pCursor)) return Success; return BadAlloc; } @@ -1861,7 +1861,7 @@ ProcRenderCreateSolidFill(ClientPtr client) pPicture, RT_NONE, NULL, DixCreateAccess); if (error != Success) return error; - if (!AddResource(stuff->pid, PictureType, (pointer) pPicture)) + if (!AddResource(stuff->pid, PictureType, (void *) pPicture)) return BadAlloc; return Success; } @@ -1900,7 +1900,7 @@ ProcRenderCreateLinearGradient(ClientPtr client) pPicture, RT_NONE, NULL, DixCreateAccess); if (error != Success) return error; - if (!AddResource(stuff->pid, PictureType, (pointer) pPicture)) + if (!AddResource(stuff->pid, PictureType, (void *) pPicture)) return BadAlloc; return Success; } @@ -1938,7 +1938,7 @@ ProcRenderCreateRadialGradient(ClientPtr client) pPicture, RT_NONE, NULL, DixCreateAccess); if (error != Success) return error; - if (!AddResource(stuff->pid, PictureType, (pointer) pPicture)) + if (!AddResource(stuff->pid, PictureType, (void *) pPicture)) return BadAlloc; return Success; } @@ -1975,7 +1975,7 @@ ProcRenderCreateConicalGradient(ClientPtr client) pPicture, RT_NONE, NULL, DixCreateAccess); if (error != Success) return error; - if (!AddResource(stuff->pid, PictureType, (pointer) pPicture)) + if (!AddResource(stuff->pid, PictureType, (void *) pPicture)) return BadAlloc; return Success; } @@ -2566,7 +2566,7 @@ SProcRenderDispatch(ClientPtr client) #ifdef PANORAMIX #define VERIFY_XIN_PICTURE(pPicture, pid, client, mode) {\ - int rc = dixLookupResourceByType((pointer *)&(pPicture), pid,\ + int rc = dixLookupResourceByType((void **)&(pPicture), pid,\ XRT_PICTURE, client, mode);\ if (rc != Success)\ return rc;\ @@ -2590,7 +2590,7 @@ PanoramiXRenderCreatePicture(ClientPtr client) int result, j; REQUEST_AT_LEAST_SIZE(xRenderCreatePictureReq); - result = dixLookupResourceByClass((pointer *) &refDraw, stuff->drawable, + result = dixLookupResourceByClass((void **) &refDraw, stuff->drawable, XRC_DRAWABLE, client, DixWriteAccess); if (result != Success) return (result == BadValue) ? BadDrawable : result; diff --git a/xserver/test-driver b/xserver/test-driver index 32bf39e83..d30605660 100644 --- a/xserver/test-driver +++ b/xserver/test-driver @@ -1,7 +1,7 @@ #! /bin/sh # test-driver - basic testsuite driver script. -scriptversion=2012-06-27.10; # UTC +scriptversion=2013-07-13.22; # UTC # Copyright (C) 2011-2013 Free Software Foundation, Inc. # @@ -44,13 +44,12 @@ print_usage () Usage: test-driver --test-name=NAME --log-file=PATH --trs-file=PATH [--expect-failure={yes|no}] [--color-tests={yes|no}] - [--enable-hard-errors={yes|no}] [--] TEST-SCRIPT + [--enable-hard-errors={yes|no}] [--] + TEST-SCRIPT [TEST-SCRIPT-ARGUMENTS] The '--test-name', '--log-file' and '--trs-file' options are mandatory. END } -# TODO: better error handling in option parsing (in particular, ensure -# TODO: $log_file, $trs_file and $test_name are defined). test_name= # Used for reporting. log_file= # Where to save the output of the test script. trs_file= # Where to save the metadata of the test run. @@ -69,10 +68,23 @@ while test $# -gt 0; do --enable-hard-errors) enable_hard_errors=$2; shift;; --) shift; break;; -*) usage_error "invalid option: '$1'";; + *) break;; esac shift done +missing_opts= +test x"$test_name" = x && missing_opts="$missing_opts --test-name" +test x"$log_file" = x && missing_opts="$missing_opts --log-file" +test x"$trs_file" = x && missing_opts="$missing_opts --trs-file" +if test x"$missing_opts" != x; then + usage_error "the following mandatory options are missing:$missing_opts" +fi + +if test $# -eq 0; then + usage_error "missing argument" +fi + if test $color_tests = yes; then # Keep this in sync with 'lib/am/check.am:$(am__tty_colors)'. red='[0;31m' # Red. diff --git a/xserver/test/Makefile.am b/xserver/test/Makefile.am index 2852bb3e0..32edc7a3b 100644 --- a/xserver/test/Makefile.am +++ b/xserver/test/Makefile.am @@ -30,19 +30,18 @@ endif xkb_LDADD=$(TEST_LDADD) input_LDADD=$(TEST_LDADD) xtest_LDADD=$(TEST_LDADD) -list_LDADD=$(TEST_LDADD) misc_LDADD=$(TEST_LDADD) fixes_LDADD=$(TEST_LDADD) xfree86_LDADD=$(TEST_LDADD) touch_LDADD=$(TEST_LDADD) signal_logging_LDADD=$(TEST_LDADD) -hashtabletest_LDADD=$(TEST_LDADD) $(top_srcdir)/Xext/hashtable.c +hashtabletest_LDADD=$(TEST_LDADD) os_LDADD=$(TEST_LDADD) libxservertest_la_LIBADD = $(XSERVER_LIBS) if XORG -nodist_libxservertest_la_SOURCES = $(top_builddir)/hw/xfree86/sdksyms.c +nodist_libxservertest_la_SOURCES = sdksyms.c libxservertest_la_LIBADD += \ $(top_builddir)/hw/xfree86/loader/libloader.la \ $(top_builddir)/hw/xfree86/os-support/libxorgos.la \ @@ -56,6 +55,12 @@ libxservertest_la_LIBADD += \ $(top_builddir)/hw/xfree86/dixmods/libxorgxkb.la \ @XORG_LIBS@ +BUILT_SOURCES = sdksyms.c +CLEANFILES = sdksyms.c + +sdksyms.c: $(top_builddir)/hw/xfree86/sdksyms.c + $(AM_V_GEN)$(LN_S) $(top_builddir)/hw/xfree86/sdksyms.c + if DRI libxservertest_la_LIBADD += $(top_builddir)/hw/xfree86/dri/libdri.la endif @@ -71,9 +76,7 @@ endif else nodist_libxservertest_la_SOURCES = \ ddxstubs.c \ - $(top_srcdir)/mi/miinitext.c \ - $(top_srcdir)/Xext/dpmsstubs.c \ - $(top_srcdir)/Xi/stubs.c + $(top_srcdir)/mi/miinitext.c libxservertest_la_LIBADD += \ $(top_builddir)/damageext/libdamageext.la \ @@ -84,7 +87,9 @@ libxservertest_la_LIBADD += \ $(top_builddir)/randr/librandr.la \ $(top_builddir)/render/librender.la \ $(top_builddir)/Xext/libXext.la \ + $(top_builddir)/Xext/libXextdpmsstubs.la \ $(top_builddir)/Xi/libXi.la \ + $(top_builddir)/Xi/libXistubs.la \ $(top_builddir)/xfixes/libxfixes.la \ $(top_builddir)/xkb/libxkb.la \ $(top_builddir)/xkb/libxkbstubs.la diff --git a/xserver/test/Makefile.in b/xserver/test/Makefile.in index 4375866eb..d81cbd01b 100644 --- a/xserver/test/Makefile.in +++ b/xserver/test/Makefile.in @@ -88,7 +88,9 @@ host_triplet = @host@ @ENABLE_UNIT_TESTS_TRUE@@XORG_FALSE@ $(top_builddir)/randr/librandr.la \ @ENABLE_UNIT_TESTS_TRUE@@XORG_FALSE@ $(top_builddir)/render/librender.la \ @ENABLE_UNIT_TESTS_TRUE@@XORG_FALSE@ $(top_builddir)/Xext/libXext.la \ +@ENABLE_UNIT_TESTS_TRUE@@XORG_FALSE@ $(top_builddir)/Xext/libXextdpmsstubs.la \ @ENABLE_UNIT_TESTS_TRUE@@XORG_FALSE@ $(top_builddir)/Xi/libXi.la \ +@ENABLE_UNIT_TESTS_TRUE@@XORG_FALSE@ $(top_builddir)/Xi/libXistubs.la \ @ENABLE_UNIT_TESTS_TRUE@@XORG_FALSE@ $(top_builddir)/xfixes/libxfixes.la \ @ENABLE_UNIT_TESTS_TRUE@@XORG_FALSE@ $(top_builddir)/xkb/libxkb.la \ @ENABLE_UNIT_TESTS_TRUE@@XORG_FALSE@ $(top_builddir)/xkb/libxkbstubs.la @@ -149,8 +151,7 @@ am__DEPENDENCIES_1 = @ENABLE_UNIT_TESTS_TRUE@@XORG_TRUE@ $(top_builddir)/hw/xfree86/i2c/libi2c.la \ @ENABLE_UNIT_TESTS_TRUE@@XORG_TRUE@ $(top_builddir)/hw/xfree86/dixmods/libxorgxkb.la @ENABLE_UNIT_TESTS_TRUE@@XORG_FALSE@nodist_libxservertest_la_OBJECTS = \ -@ENABLE_UNIT_TESTS_TRUE@@XORG_FALSE@ ddxstubs.lo miinitext.lo \ -@ENABLE_UNIT_TESTS_TRUE@@XORG_FALSE@ dpmsstubs.lo stubs.lo +@ENABLE_UNIT_TESTS_TRUE@@XORG_FALSE@ ddxstubs.lo miinitext.lo @ENABLE_UNIT_TESTS_TRUE@@XORG_TRUE@nodist_libxservertest_la_OBJECTS = \ @ENABLE_UNIT_TESTS_TRUE@@XORG_TRUE@ sdksyms.lo libxservertest_la_OBJECTS = $(nodist_libxservertest_la_OBJECTS) @@ -184,14 +185,13 @@ fixes_OBJECTS = fixes.$(OBJEXT) hashtabletest_SOURCES = hashtabletest.c hashtabletest_OBJECTS = hashtabletest.$(OBJEXT) @ENABLE_UNIT_TESTS_TRUE@hashtabletest_DEPENDENCIES = \ -@ENABLE_UNIT_TESTS_TRUE@ $(am__DEPENDENCIES_4) \ -@ENABLE_UNIT_TESTS_TRUE@ $(top_srcdir)/Xext/hashtable.c +@ENABLE_UNIT_TESTS_TRUE@ $(am__DEPENDENCIES_4) input_SOURCES = input.c input_OBJECTS = input.$(OBJEXT) @ENABLE_UNIT_TESTS_TRUE@input_DEPENDENCIES = $(am__DEPENDENCIES_4) list_SOURCES = list.c list_OBJECTS = list.$(OBJEXT) -@ENABLE_UNIT_TESTS_TRUE@list_DEPENDENCIES = $(am__DEPENDENCIES_4) +list_LDADD = $(LDADD) misc_SOURCES = misc.c misc_OBJECTS = misc.$(OBJEXT) @ENABLE_UNIT_TESTS_TRUE@misc_DEPENDENCIES = $(am__DEPENDENCIES_4) @@ -344,6 +344,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -388,6 +390,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -490,7 +496,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -499,6 +508,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -565,6 +575,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ @@ -652,13 +666,12 @@ top_srcdir = @top_srcdir@ @ENABLE_UNIT_TESTS_TRUE@xkb_LDADD = $(TEST_LDADD) @ENABLE_UNIT_TESTS_TRUE@input_LDADD = $(TEST_LDADD) @ENABLE_UNIT_TESTS_TRUE@xtest_LDADD = $(TEST_LDADD) -@ENABLE_UNIT_TESTS_TRUE@list_LDADD = $(TEST_LDADD) @ENABLE_UNIT_TESTS_TRUE@misc_LDADD = $(TEST_LDADD) @ENABLE_UNIT_TESTS_TRUE@fixes_LDADD = $(TEST_LDADD) @ENABLE_UNIT_TESTS_TRUE@xfree86_LDADD = $(TEST_LDADD) @ENABLE_UNIT_TESTS_TRUE@touch_LDADD = $(TEST_LDADD) @ENABLE_UNIT_TESTS_TRUE@signal_logging_LDADD = $(TEST_LDADD) -@ENABLE_UNIT_TESTS_TRUE@hashtabletest_LDADD = $(TEST_LDADD) $(top_srcdir)/Xext/hashtable.c +@ENABLE_UNIT_TESTS_TRUE@hashtabletest_LDADD = $(TEST_LDADD) @ENABLE_UNIT_TESTS_TRUE@os_LDADD = $(TEST_LDADD) @ENABLE_UNIT_TESTS_TRUE@libxservertest_la_LIBADD = $(XSERVER_LIBS) \ @ENABLE_UNIT_TESTS_TRUE@ $(am__append_5) $(am__append_6) \ @@ -669,14 +682,15 @@ top_srcdir = @top_srcdir@ @ENABLE_UNIT_TESTS_TRUE@ $(am__append_15) $(am__append_17) @ENABLE_UNIT_TESTS_TRUE@@XORG_FALSE@nodist_libxservertest_la_SOURCES = \ @ENABLE_UNIT_TESTS_TRUE@@XORG_FALSE@ ddxstubs.c \ -@ENABLE_UNIT_TESTS_TRUE@@XORG_FALSE@ $(top_srcdir)/mi/miinitext.c \ -@ENABLE_UNIT_TESTS_TRUE@@XORG_FALSE@ $(top_srcdir)/Xext/dpmsstubs.c \ -@ENABLE_UNIT_TESTS_TRUE@@XORG_FALSE@ $(top_srcdir)/Xi/stubs.c +@ENABLE_UNIT_TESTS_TRUE@@XORG_FALSE@ $(top_srcdir)/mi/miinitext.c -@ENABLE_UNIT_TESTS_TRUE@@XORG_TRUE@nodist_libxservertest_la_SOURCES = $(top_builddir)/hw/xfree86/sdksyms.c +@ENABLE_UNIT_TESTS_TRUE@@XORG_TRUE@nodist_libxservertest_la_SOURCES = sdksyms.c +@ENABLE_UNIT_TESTS_TRUE@@XORG_TRUE@BUILT_SOURCES = sdksyms.c +@ENABLE_UNIT_TESTS_TRUE@@XORG_TRUE@CLEANFILES = sdksyms.c @ENABLE_UNIT_TESTS_TRUE@libxservertest_la_DEPENDENCIES = $(libxservertest_la_LIBADD) EXTRA_DIST = ddxstubs.c -all: all-recursive +all: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: .SUFFIXES: .c .lo .o .obj @@ -776,7 +790,6 @@ distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ddxstubs.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dpmsstubs.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fixes.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hashtabletest.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/input.Po@am__quote@ @@ -787,7 +800,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sdksyms.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/signal-logging.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/string.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stubs.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/touch.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xfree86.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xkb.Po@am__quote@ @@ -821,27 +833,6 @@ miinitext.lo: $(top_srcdir)/mi/miinitext.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o miinitext.lo `test -f '$(top_srcdir)/mi/miinitext.c' || echo '$(srcdir)/'`$(top_srcdir)/mi/miinitext.c -dpmsstubs.lo: $(top_srcdir)/Xext/dpmsstubs.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dpmsstubs.lo -MD -MP -MF $(DEPDIR)/dpmsstubs.Tpo -c -o dpmsstubs.lo `test -f '$(top_srcdir)/Xext/dpmsstubs.c' || echo '$(srcdir)/'`$(top_srcdir)/Xext/dpmsstubs.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/dpmsstubs.Tpo $(DEPDIR)/dpmsstubs.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/Xext/dpmsstubs.c' object='dpmsstubs.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dpmsstubs.lo `test -f '$(top_srcdir)/Xext/dpmsstubs.c' || echo '$(srcdir)/'`$(top_srcdir)/Xext/dpmsstubs.c - -stubs.lo: $(top_srcdir)/Xi/stubs.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT stubs.lo -MD -MP -MF $(DEPDIR)/stubs.Tpo -c -o stubs.lo `test -f '$(top_srcdir)/Xi/stubs.c' || echo '$(srcdir)/'`$(top_srcdir)/Xi/stubs.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/stubs.Tpo $(DEPDIR)/stubs.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/Xi/stubs.c' object='stubs.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o stubs.lo `test -f '$(top_srcdir)/Xi/stubs.c' || echo '$(srcdir)/'`$(top_srcdir)/Xi/stubs.c - -sdksyms.lo: $(top_builddir)/hw/xfree86/sdksyms.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT sdksyms.lo -MD -MP -MF $(DEPDIR)/sdksyms.Tpo -c -o sdksyms.lo `test -f '$(top_builddir)/hw/xfree86/sdksyms.c' || echo '$(srcdir)/'`$(top_builddir)/hw/xfree86/sdksyms.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/sdksyms.Tpo $(DEPDIR)/sdksyms.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_builddir)/hw/xfree86/sdksyms.c' object='sdksyms.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sdksyms.lo `test -f '$(top_builddir)/hw/xfree86/sdksyms.c' || echo '$(srcdir)/'`$(top_builddir)/hw/xfree86/sdksyms.c - mostlyclean-libtool: -rm -f *.lo @@ -1125,11 +1116,13 @@ distdir: $(DISTFILES) check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_LTLIBRARIES) $(MAKE) $(AM_MAKEFLAGS) check-TESTS -check: check-recursive +check: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) check-recursive all-am: Makefile $(PROGRAMS) installdirs: installdirs-recursive installdirs-am: -install: install-recursive +install: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive @@ -1151,6 +1144,7 @@ install-strip: mostlyclean-generic: clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) @@ -1159,6 +1153,7 @@ distclean-generic: maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." + -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) clean: clean-recursive clean-am: clean-checkLTLIBRARIES clean-generic clean-libtool \ @@ -1230,9 +1225,9 @@ ps-am: uninstall-am: -.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) check-am \ - cscopelist-recursive ctags-recursive install-am install-strip \ - tags-recursive +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all check \ + check-am cscopelist-recursive ctags-recursive install \ + install-am install-strip tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am check check-TESTS check-am clean \ @@ -1251,6 +1246,9 @@ uninstall-am: tags tags-recursive uninstall uninstall-am +@ENABLE_UNIT_TESTS_TRUE@@XORG_TRUE@sdksyms.c: $(top_builddir)/hw/xfree86/sdksyms.c +@ENABLE_UNIT_TESTS_TRUE@@XORG_TRUE@ $(AM_V_GEN)$(LN_S) $(top_builddir)/hw/xfree86/sdksyms.c + # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/xserver/test/hashtabletest.c b/xserver/test/hashtabletest.c index 6af14a8e6..86a0c58c6 100644 --- a/xserver/test/hashtabletest.c +++ b/xserver/test/hashtabletest.c @@ -12,7 +12,7 @@ static void print_xid(void* ptr, void* v) { XID *x = v; - printf("%ld", *x); + printf("%ld", (long)(*x)); } static void @@ -26,7 +26,6 @@ static int test1(void) { HashTable h; - XID id; int c; int ok = 1; const int numKeys = 420; @@ -36,7 +35,7 @@ test1(void) for (c = 0; c < numKeys; ++c) { int *dest; - id = c; + XID id = c; dest = ht_add(h, &id); if (dest) { *dest = 2 * c; @@ -85,7 +84,6 @@ static int test2(void) { HashTable h; - XID id; int c; int ok = 1; const int numKeys = 420; @@ -94,7 +92,7 @@ test2(void) h = ht_create(sizeof(XID), 0, ht_resourceid_hash, ht_resourceid_compare, NULL); for (c = 0; c < numKeys; ++c) { - id = c; + XID id = c; ht_add(h, &id); } diff --git a/xserver/test/input.c b/xserver/test/input.c index df20f8235..a4615c9c9 100644 --- a/xserver/test/input.c +++ b/xserver/test/input.c @@ -1180,50 +1180,54 @@ cmp_attr_fields(InputAttributes * attr1, InputAttributes * attr2) static void dix_input_attributes(void) { - InputAttributes orig = { 0 }; + InputAttributes *orig; InputAttributes *new; - char *tags[4] = { "tag1", "tag2", "tag2", NULL }; new = DuplicateInputAttributes(NULL); assert(!new); - new = DuplicateInputAttributes(&orig); - assert(memcmp(&orig, new, sizeof(InputAttributes)) == 0); + orig = calloc(1, sizeof(InputAttributes)); + assert(orig); - orig.product = "product name"; - new = DuplicateInputAttributes(&orig); - cmp_attr_fields(&orig, new); + new = DuplicateInputAttributes(orig); + assert(memcmp(orig, new, sizeof(InputAttributes)) == 0); + + orig->product = xnfstrdup("product name"); + new = DuplicateInputAttributes(orig); + cmp_attr_fields(orig, new); FreeInputAttributes(new); - orig.vendor = "vendor name"; - new = DuplicateInputAttributes(&orig); - cmp_attr_fields(&orig, new); + orig->vendor = xnfstrdup("vendor name"); + new = DuplicateInputAttributes(orig); + cmp_attr_fields(orig, new); FreeInputAttributes(new); - orig.device = "device path"; - new = DuplicateInputAttributes(&orig); - cmp_attr_fields(&orig, new); + orig->device = xnfstrdup("device path"); + new = DuplicateInputAttributes(orig); + cmp_attr_fields(orig, new); FreeInputAttributes(new); - orig.pnp_id = "PnPID"; - new = DuplicateInputAttributes(&orig); - cmp_attr_fields(&orig, new); + orig->pnp_id = xnfstrdup("PnPID"); + new = DuplicateInputAttributes(orig); + cmp_attr_fields(orig, new); FreeInputAttributes(new); - orig.usb_id = "USBID"; - new = DuplicateInputAttributes(&orig); - cmp_attr_fields(&orig, new); + orig->usb_id = xnfstrdup("USBID"); + new = DuplicateInputAttributes(orig); + cmp_attr_fields(orig, new); FreeInputAttributes(new); - orig.flags = 0xF0; - new = DuplicateInputAttributes(&orig); - cmp_attr_fields(&orig, new); + orig->flags = 0xF0; + new = DuplicateInputAttributes(orig); + cmp_attr_fields(orig, new); FreeInputAttributes(new); - orig.tags = tags; - new = DuplicateInputAttributes(&orig); - cmp_attr_fields(&orig, new); + orig->tags = xstrtokenize("tag1 tag2 tag3", " "); + new = DuplicateInputAttributes(orig); + cmp_attr_fields(orig, new); FreeInputAttributes(new); + + FreeInputAttributes(orig); } static void @@ -1386,8 +1390,8 @@ dix_valuator_alloc(void) assert(v->numAxes == num_axes); #if !defined(__i386__) && !defined(__m68k__) && !defined(__sh__) /* must be double-aligned on 64 bit */ - assert(((void *) v->axisVal - (void *) v) % sizeof(double) == 0); - assert(((void *) v->axes - (void *) v) % sizeof(double) == 0); + assert(offsetof(struct _ValuatorClassRec, axisVal) % sizeof(double) == 0); + assert(offsetof(struct _ValuatorClassRec, axes) % sizeof(double) == 0); #endif num_axes++; } @@ -1708,6 +1712,18 @@ mieq_test_event_handler(int screenNum, InternalEvent *ie, DeviceIntPtr dev) static void _mieq_test_generate_events(uint32_t start, uint32_t count) { + static DeviceIntRec dev; + static SpriteInfoRec spriteInfo; + static SpriteRec sprite; + + memset(&dev, 0, sizeof(dev)); + memset(&spriteInfo, 0, sizeof(spriteInfo)); + memset(&sprite, 0, sizeof(sprite)); + dev.spriteInfo = &spriteInfo; + spriteInfo.sprite = &sprite; + + dev.enabled = 1; + count += start; while (start < count) { RawDeviceEvent e = { 0 }; @@ -1717,7 +1733,7 @@ _mieq_test_generate_events(uint32_t start, uint32_t count) e.time = GetTimeInMillis(); e.flags = start; - mieqEnqueue(NULL, (InternalEvent *) &e); + mieqEnqueue(&dev, (InternalEvent *) &e); start++; } diff --git a/xserver/test/os.c b/xserver/test/os.c index 2d005a0d4..d85dcffbe 100644 --- a/xserver/test/os.c +++ b/xserver/test/os.c @@ -150,10 +150,10 @@ static void block_sigio_test_nested(void) tail guard must be hit. */ void (*old_handler)(int); - old_handler = signal(SIGIO, sighandler); + old_handler = OsSignal(SIGIO, sighandler); expect_signal = 1; assert(raise(SIGIO) == 0); - assert(signal(SIGIO, old_handler) == sighandler); + assert(OsSignal(SIGIO, old_handler) == sighandler); #endif } diff --git a/xserver/test/signal-logging.c b/xserver/test/signal-logging.c index a03c5acbe..432012195 100644 --- a/xserver/test/signal-logging.c +++ b/xserver/test/signal-logging.c @@ -56,7 +56,7 @@ check_signed_number_format_test(long int number) FormatInt64(number, string); if(strncmp(string, expected, 21) != 0) { fprintf(stderr, "Failed to convert %jd to decimal string (expected %s but got %s)\n", - number, expected, string); + (intmax_t) number, expected, string); return FALSE; } @@ -93,7 +93,7 @@ check_number_format_test(long unsigned int number) FormatUInt64(number, string); if(strncmp(string, expected, 21) != 0) { fprintf(stderr, "Failed to convert %ju to decimal string (%s vs %s)\n", - number, expected, string); + (intmax_t) number, expected, string); return FALSE; } @@ -101,7 +101,7 @@ check_number_format_test(long unsigned int number) FormatUInt64Hex(number, string); if(strncmp(string, expected, 17) != 0) { fprintf(stderr, "Failed to convert %ju to hexadecimal string (%s vs %s)\n", - number, expected, string); + (intmax_t) number, expected, string); return FALSE; } @@ -117,6 +117,8 @@ static void number_formatting(void) { int i; +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Woverflow" long unsigned int unsigned_tests[] = { 0,/* Zero */ 5, /* Single digit number */ 12, /* Two digit decimal number */ @@ -139,6 +141,7 @@ number_formatting(void) -0x15D027BF211B37A, /* Large > 32 bit number */ -0x7FFFFFFFFFFFFFFF, /* Maximum 64-bit signed number */ } ; +#pragma GCC diagnostic pop for (i = 0; i < sizeof(unsigned_tests) / sizeof(unsigned_tests[0]); i++) assert(check_number_format_test(unsigned_tests[i])); @@ -152,6 +155,8 @@ number_formatting(void) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wformat-security" +#pragma GCC diagnostic ignored "-Wformat" +#pragma GCC diagnostic ignored "-Wformat-extra-args" static void logging_format(void) { const char *log_file_path = "/tmp/Xorg-logging-test.log"; @@ -173,9 +178,14 @@ static void logging_format(void) LogInit(log_file_path, NULL); assert(f = fopen(log_file_path, "r")); -#define read_log_msg(msg) \ - fgets(read_buf, sizeof(read_buf), f); \ - msg = strchr(read_buf, ']') + 2; /* advance past [time.stamp] */ +#define read_log_msg(msg) do { \ + msg = fgets(read_buf, sizeof(read_buf), f); \ + assert(msg != NULL); \ + msg = strchr(read_buf, ']'); \ + assert(msg != NULL); \ + assert(strlen(msg) > 2); \ + msg = msg + 2; /* advance past [time.stamp] */ \ + } while (0) /* boring test message */ LogMessageVerbSigSafe(X_ERROR, -1, "test message\n"); @@ -220,14 +230,12 @@ static void logging_format(void) assert(strcmp(logmsg, "(EE) substituted string\n") == 0); /* Invalid format */ -#warning Ignore compiler warning below "lacks type at end of format". This is intentional. LogMessageVerbSigSafe(X_ERROR, -1, "%4", 4); read_log_msg(logmsg); assert(strcmp(logmsg, "(EE) ") == 0); LogMessageVerbSigSafe(X_ERROR, -1, "\n"); fseek(f, 0, SEEK_END); -#warning Ignore compiler warning below "unknown conversion type character". This is intentional. /* %hld is bogus */ LogMessageVerbSigSafe(X_ERROR, -1, "%hld\n", 4); read_log_msg(logmsg); @@ -343,7 +351,11 @@ static void logging_format(void) ptr = 1; do { char expected[30]; +#ifdef __sun /* Solaris doesn't autoadd "0x" to %p format */ + sprintf(expected, "(EE) 0x%p\n", (void*)ptr); +#else sprintf(expected, "(EE) %p\n", (void*)ptr); +#endif LogMessageVerbSigSafe(X_ERROR, -1, "%p\n", (void*)ptr); read_log_msg(logmsg); assert(strcmp(logmsg, expected) == 0); diff --git a/xserver/test/touch.c b/xserver/test/touch.c index df1db11de..981c694b6 100644 --- a/xserver/test/touch.c +++ b/xserver/test/touch.c @@ -40,7 +40,7 @@ touch_grow_queue(void) int i; memset(&dev, 0, sizeof(dev)); - dev.name = "test device"; + dev.name = xnfstrdup("test device"); dev.id = 2; dev.valuator = &val; val.numAxes = 5; @@ -82,6 +82,8 @@ touch_grow_queue(void) assert(t->client_id == 0); assert(t->ddx_id == 0); } + + free(dev.name); } static void @@ -95,7 +97,7 @@ touch_find_ddxid(void) int i; memset(&dev, 0, sizeof(dev)); - dev.name = "test device"; + dev.name = xnfstrdup("test device"); dev.id = 2; dev.valuator = &val; val.numAxes = 5; @@ -150,6 +152,8 @@ touch_find_ddxid(void) ProcessWorkQueue(); ti = TouchFindByDDXID(&dev, 40, TRUE); assert(ti == &dev.last.touches[size]); + + free(dev.name); } static void @@ -164,7 +168,7 @@ touch_begin_ddxtouch(void) int size = 5; memset(&dev, 0, sizeof(dev)); - dev.name = "test device"; + dev.name = xnfstrdup("test device"); dev.id = 2; dev.valuator = &val; val.numAxes = 5; @@ -195,6 +199,8 @@ touch_begin_ddxtouch(void) assert(ti->client_id > last_client_id); assert(!ti->emulate_pointer); last_client_id = ti->client_id; + + free(dev.name); } static void @@ -212,7 +218,7 @@ touch_begin_touch(void) screenInfo.screens[0] = &screen; memset(&dev, 0, sizeof(dev)); - dev.name = "test device"; + dev.name = xnfstrdup("test device"); dev.id = 2; memset(&sprite, 0, sizeof(sprite)); @@ -237,6 +243,8 @@ touch_begin_touch(void) assert(ti->emulate_pointer); assert(touch.num_touches == 1); + + free(dev.name); } static void @@ -251,7 +259,7 @@ touch_init(void) screenInfo.screens[0] = &screen; memset(&dev, 0, sizeof(dev)); - dev.name = "test device"; + dev.name = xnfstrdup("test device"); memset(&sprite, 0, sizeof(sprite)); dev.spriteInfo = &sprite; @@ -264,6 +272,8 @@ touch_init(void) rc = InitTouchClassDeviceStruct(&dev, 1, XIDirectTouch, 2); assert(rc == TRUE); assert(dev.touch); + + free(dev.name); } int diff --git a/xserver/test/xfree86.c b/xserver/test/xfree86.c index f9892e68e..a98671183 100644 --- a/xserver/test/xfree86.c +++ b/xserver/test/xfree86.c @@ -73,7 +73,8 @@ xfree86_option_list_duplicate(void) static void xfree86_add_comment(void) { - char *current = NULL, *comment; + char *current = NULL; + const char *comment; char compare[1024] = { 0 }; comment = "# foo"; diff --git a/xserver/test/xi2/Makefile.in b/xserver/test/xi2/Makefile.in index f9ccbb1bf..4b97bd0f4 100644 --- a/xserver/test/xi2/Makefile.in +++ b/xserver/test/xi2/Makefile.in @@ -317,6 +317,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -361,6 +363,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -463,7 +469,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -472,6 +481,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -538,6 +548,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/test/xi2/protocol-common.c b/xserver/test/xi2/protocol-common.c index e2b0b8ba3..9a429e49f 100644 --- a/xserver/test/xi2/protocol-common.c +++ b/xserver/test/xi2/protocol-common.c @@ -41,10 +41,7 @@ WindowRec root; WindowRec window; static ClientRec server_client; -void *userdata; - -extern int CorePointerProc(DeviceIntPtr pDev, int what); -extern int CoreKeyboardProc(DeviceIntPtr pDev, int what); +void *global_userdata; static void fake_init_sprite(DeviceIntPtr dev) @@ -139,34 +136,34 @@ struct devices init_devices(void) { ClientRec client; - struct devices devices; + struct devices local_devices; client = init_client(0, NULL); - AllocDevicePair(&client, "Virtual core", &devices.vcp, &devices.vck, + AllocDevicePair(&client, "Virtual core", &local_devices.vcp, &local_devices.vck, CorePointerProc, CoreKeyboardProc, TRUE); - inputInfo.pointer = devices.vcp; + inputInfo.pointer = local_devices.vcp; - inputInfo.keyboard = devices.vck; - ActivateDevice(devices.vcp, FALSE); - ActivateDevice(devices.vck, FALSE); - EnableDevice(devices.vcp, FALSE); - EnableDevice(devices.vck, FALSE); + inputInfo.keyboard = local_devices.vck; + ActivateDevice(local_devices.vcp, FALSE); + ActivateDevice(local_devices.vck, FALSE); + EnableDevice(local_devices.vcp, FALSE); + EnableDevice(local_devices.vck, FALSE); - AllocDevicePair(&client, "", &devices.mouse, &devices.kbd, + AllocDevicePair(&client, "", &local_devices.mouse, &local_devices.kbd, TestPointerProc, CoreKeyboardProc, FALSE); - ActivateDevice(devices.mouse, FALSE); - ActivateDevice(devices.kbd, FALSE); - EnableDevice(devices.mouse, FALSE); - EnableDevice(devices.kbd, FALSE); + ActivateDevice(local_devices.mouse, FALSE); + ActivateDevice(local_devices.kbd, FALSE); + EnableDevice(local_devices.mouse, FALSE); + EnableDevice(local_devices.kbd, FALSE); - devices.num_devices = 4; - devices.num_master_devices = 2; + local_devices.num_devices = 4; + local_devices.num_master_devices = 2; - fake_init_sprite(devices.mouse); - fake_init_sprite(devices.vcp); + fake_init_sprite(local_devices.mouse); + fake_init_sprite(local_devices.vcp); - return devices; + return local_devices; } /* Create minimal client, with the given buffer and len as request buffer */ @@ -190,20 +187,20 @@ init_client(int len, void *data) } void -init_window(WindowPtr window, WindowPtr parent, int id) +init_window(WindowPtr local_window, WindowPtr parent, int id) { - memset(window, 0, sizeof(*window)); + memset(local_window, 0, sizeof(*local_window)); - window->drawable.id = id; + local_window->drawable.id = id; if (parent) { - window->drawable.x = 30; - window->drawable.y = 50; - window->drawable.width = 100; - window->drawable.height = 200; + local_window->drawable.x = 30; + local_window->drawable.y = 50; + local_window->drawable.width = 100; + local_window->drawable.height = 200; } - window->parent = parent; - window->optional = calloc(1, sizeof(WindowOptRec)); - assert(window->optional); + local_window->parent = parent; + local_window->optional = calloc(1, sizeof(WindowOptRec)); + assert(local_window->optional); } extern DevPrivateKeyRec miPointerScreenKeyRec; @@ -211,18 +208,18 @@ extern DevPrivateKeyRec miPointerPrivKeyRec; /* Needed for the screen setup, otherwise we crash during sprite initialization */ static Bool -device_cursor_init(DeviceIntPtr dev, ScreenPtr screen) +device_cursor_init(DeviceIntPtr dev, ScreenPtr local_screen) { return TRUE; } static void -device_cursor_cleanup(DeviceIntPtr dev, ScreenPtr screen) +device_cursor_cleanup(DeviceIntPtr dev, ScreenPtr local_screen) { } static Bool -set_cursor_pos(DeviceIntPtr dev, ScreenPtr screen, int x, int y, Bool event) +set_cursor_pos(DeviceIntPtr dev, ScreenPtr local_screen, int x, int y, Bool event) { return TRUE; } @@ -254,7 +251,7 @@ init_simple(void) init_window(&window, &root, CLIENT_WINDOW_ID); serverClient = &server_client; - InitClient(serverClient, 0, (pointer) NULL); + InitClient(serverClient, 0, (void *) NULL); if (!InitClientResources(serverClient)) /* for root resources */ FatalError("couldn't init server resources"); SyncExtensionInit(); @@ -267,5 +264,5 @@ __wrap_WriteToClient(ClientPtr client, int len, void *data) { assert(reply_handler != NULL); - (*reply_handler) (client, len, data, userdata); + (*reply_handler) (client, len, data, global_userdata); } diff --git a/xserver/test/xi2/protocol-common.h b/xserver/test/xi2/protocol-common.h index f27f248c6..f8504787f 100644 --- a/xserver/test/xi2/protocol-common.h +++ b/xserver/test/xi2/protocol-common.h @@ -91,7 +91,7 @@ extern struct devices devices; /** * test-specific userdata, passed into the reply handler. */ -extern void *userdata; +extern void *global_userdata; /** * The reply handler called from WriteToClient. Set this handler if you need @@ -148,7 +148,7 @@ int __wrap_dixLookupWindow(WindowPtr *win, XID id, ClientPtr client, Mask access); int __real_dixLookupWindow(WindowPtr *win, XID id, ClientPtr client, Mask access); -Bool __wrap_AddResource(XID id, RESTYPE type, pointer value); +Bool __wrap_AddResource(XID id, RESTYPE type, void *value); int __wrap_dixLookupClient(ClientPtr *c, XID id, ClientPtr client, Mask access); int __real_dixLookupClient(ClientPtr *c, XID id, ClientPtr client, Mask access); diff --git a/xserver/test/xi2/protocol-xigetselectedevents.c b/xserver/test/xi2/protocol-xigetselectedevents.c index fc33aa554..bedc217b1 100644 --- a/xserver/test/xi2/protocol-xigetselectedevents.c +++ b/xserver/test/xi2/protocol-xigetselectedevents.c @@ -82,7 +82,7 @@ __wrap_dixLookupWindow(WindowPtr *win, XID id, ClientPtr client, Mask access) /* AddResource is called from XISetSEventMask, we don't need this */ Bool -__wrap_AddResource(XID id, RESTYPE type, pointer value) +__wrap_AddResource(XID id, RESTYPE type, void *value) { return TRUE; } diff --git a/xserver/test/xi2/protocol-xipassivegrabdevice.c b/xserver/test/xi2/protocol-xipassivegrabdevice.c index dd51757ff..c747ddf03 100644 --- a/xserver/test/xi2/protocol-xipassivegrabdevice.c +++ b/xserver/test/xi2/protocol-xipassivegrabdevice.c @@ -136,7 +136,7 @@ request_XIPassiveGrabDevice(ClientPtr client, xXIPassiveGrabDeviceReq * req, int error, int errval) { int rc; - int modifiers; + int local_modifiers; int mask_len; rc = ProcXIPassiveGrabDevice(&client_request); @@ -152,13 +152,13 @@ request_XIPassiveGrabDevice(ClientPtr client, xXIPassiveGrabDeviceReq * req, swapl(&req->cursor); swapl(&req->detail); swaps(&req->deviceid); - modifiers = req->num_modifiers; + local_modifiers = req->num_modifiers; swaps(&req->num_modifiers); mask_len = req->mask_len; swaps(&req->mask_len); - while (modifiers--) { - CARD32 *mod = ((CARD32 *) (req + 1)) + mask_len + modifiers; + while (local_modifiers--) { + CARD32 *mod = (CARD32 *) (req + 1) + mask_len + local_modifiers; swapl(mod); } diff --git a/xserver/test/xi2/protocol-xiquerydevice.c b/xserver/test/xi2/protocol-xiquerydevice.c index c066daa35..deef1f180 100644 --- a/xserver/test/xi2/protocol-xiquerydevice.c +++ b/xserver/test/xi2/protocol-xiquerydevice.c @@ -312,7 +312,7 @@ test_XIQueryDevice(void) struct test_data data; reply_handler = reply_XIQueryDevice; - userdata = &data; + global_userdata = &data; request_init(&request, XIQueryDevice); printf("Testing XIAllDevices.\n"); diff --git a/xserver/test/xi2/protocol-xiqueryversion.c b/xserver/test/xi2/protocol-xiqueryversion.c index ed75c89db..3749b3041 100644 --- a/xserver/test/xi2/protocol-xiqueryversion.c +++ b/xserver/test/xi2/protocol-xiqueryversion.c @@ -113,7 +113,7 @@ request_XIQueryVersion(int smaj, int smin, int cmaj, int cmin, int error) request_init(&request, XIQueryVersion); client = init_client(request.length, &request); - userdata = (void *) &versions; + global_userdata = (void *) &versions; /* Change the server to support smaj.smin */ XIVersion.major_version = smaj; @@ -206,7 +206,7 @@ test_XIQueryVersion_multiple(void) XIVersion.minor_version = 2; reply_handler = reply_XIQueryVersion_multiple; - userdata = (void *) &versions; + global_userdata = (void *) &versions; /* run 1 */ diff --git a/xserver/test/xkb.c b/xserver/test/xkb.c index 955e72dff..9047f594c 100644 --- a/xserver/test/xkb.c +++ b/xserver/test/xkb.c @@ -82,15 +82,17 @@ xkb_get_rules_test(void) static void xkb_set_rules_test(void) { - XkbRMLVOSet rmlvo = { - .rules = "test-rules", - .model = "test-model", - .layout = "test-layout", - .variant = "test-variant", - .options = "test-options" - }; + XkbRMLVOSet rmlvo; XkbRMLVOSet rmlvo_new = { NULL }; + XkbInitRules(&rmlvo, "test-rules", "test-model", "test-layout", + "test-variant", "test-options"); + assert(rmlvo.rules); + assert(rmlvo.model); + assert(rmlvo.layout); + assert(rmlvo.variant); + assert(rmlvo.options); + XkbSetRulesDflts(&rmlvo); XkbGetRulesDflts(&rmlvo_new); @@ -106,6 +108,8 @@ xkb_set_rules_test(void) assert(strcmp(rmlvo.layout, rmlvo_new.layout) == 0); assert(strcmp(rmlvo.variant, rmlvo_new.variant) == 0); assert(strcmp(rmlvo.options, rmlvo_new.options) == 0); + + XkbFreeRMLVOSet(&rmlvo, FALSE); } /** diff --git a/xserver/test/xtest.c b/xserver/test/xtest.c index e5e5241b7..e9fabfbb9 100644 --- a/xserver/test/xtest.c +++ b/xserver/test/xtest.c @@ -71,7 +71,7 @@ xtest_init_devices(void) screen.DeviceCursorCleanup = device_cursor_cleanup; dixResetPrivates(); serverClient = &server_client; - InitClient(serverClient, 0, (pointer) NULL); + InitClient(serverClient, 0, (void *) NULL); if (!InitClientResources(serverClient)) /* for root resources */ FatalError("couldn't init server resources"); InitAtoms(); diff --git a/xserver/xfixes/Makefile.in b/xserver/xfixes/Makefile.in index 335e6ccdc..5c0b6a017 100644 --- a/xserver/xfixes/Makefile.in +++ b/xserver/xfixes/Makefile.in @@ -194,6 +194,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -238,6 +240,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -340,7 +346,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -349,6 +358,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -415,6 +425,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/xfixes/cursor.c b/xserver/xfixes/cursor.c index 753d5f7bc..31a408fac 100644 --- a/xserver/xfixes/cursor.c +++ b/xserver/xfixes/cursor.c @@ -72,7 +72,7 @@ static void deleteCursorHideCountsForScreen(ScreenPtr pScreen); #define VERIFY_CURSOR(pCursor, cursor, client, access) \ do { \ int err; \ - err = dixLookupResourceByType((pointer *) &pCursor, cursor, \ + err = dixLookupResourceByType((void **) &pCursor, cursor, \ RT_CURSOR, client, access); \ if (err != Success) { \ client->errorValue = cursor; \ @@ -195,7 +195,7 @@ static int XFixesSelectCursorInput(ClientPtr pClient, WindowPtr pWindow, CARD32 eventMask) { CursorEventPtr *prev, e; - pointer val; + void *val; int rc; for (prev = &cursorEvents; (e = *prev); prev = &e->next) { @@ -228,12 +228,12 @@ XFixesSelectCursorInput(ClientPtr pClient, WindowPtr pWindow, CARD32 eventMask) DixGetAttrAccess); if (rc != Success) if (!AddResource(pWindow->drawable.id, CursorWindowType, - (pointer) pWindow)) { + (void *) pWindow)) { free(e); return BadAlloc; } - if (!AddResource(e->clientResource, CursorClientType, (pointer) e)) + if (!AddResource(e->clientResource, CursorClientType, (void *) e)) return BadAlloc; *prev = e; @@ -568,13 +568,13 @@ SProcXFixesGetCursorImageAndName(ClientPtr client) * whether it should be replaced with a reference to pCursor. */ -typedef Bool (*TestCursorFunc) (CursorPtr pOld, pointer closure); +typedef Bool (*TestCursorFunc) (CursorPtr pOld, void *closure); typedef struct { RESTYPE type; TestCursorFunc testCursor; CursorPtr pNew; - pointer closure; + void *closure; } ReplaceCursorLookupRec, *ReplaceCursorLookupPtr; static const RESTYPE CursorRestypes[] = { @@ -584,7 +584,7 @@ static const RESTYPE CursorRestypes[] = { #define NUM_CURSOR_RESTYPES (sizeof (CursorRestypes) / sizeof (CursorRestypes[0])) static Bool -ReplaceCursorLookup(pointer value, XID id, pointer closure) +ReplaceCursorLookup(void *value, XID id, void *closure) { ReplaceCursorLookupPtr rcl = (ReplaceCursorLookupPtr) closure; WindowPtr pWin; @@ -626,7 +626,7 @@ ReplaceCursorLookup(pointer value, XID id, pointer closure) } static void -ReplaceCursor(CursorPtr pCursor, TestCursorFunc testCursor, pointer closure) +ReplaceCursor(CursorPtr pCursor, TestCursorFunc testCursor, void *closure) { int clientIndex; int resIndex; @@ -652,7 +652,7 @@ ReplaceCursor(CursorPtr pCursor, TestCursorFunc testCursor, pointer closure) */ LookupClientResourceComplex(clients[clientIndex], rcl.type, - ReplaceCursorLookup, (pointer) &rcl); + ReplaceCursorLookup, (void *) &rcl); } } /* this "knows" that WindowHasNewCursor doesn't depend on it's argument */ @@ -660,7 +660,7 @@ ReplaceCursor(CursorPtr pCursor, TestCursorFunc testCursor, pointer closure) } static Bool -TestForCursor(CursorPtr pCursor, pointer closure) +TestForCursor(CursorPtr pCursor, void *closure) { return (pCursor == (CursorPtr) closure); } @@ -678,7 +678,7 @@ ProcXFixesChangeCursor(ClientPtr client) VERIFY_CURSOR(pDestination, stuff->destination, client, DixWriteAccess | DixSetAttrAccess); - ReplaceCursor(pSource, TestForCursor, (pointer) pDestination); + ReplaceCursor(pSource, TestForCursor, (void *) pDestination); return Success; } @@ -695,7 +695,7 @@ SProcXFixesChangeCursor(ClientPtr client) } static Bool -TestForCursorName(CursorPtr pCursor, pointer closure) +TestForCursorName(CursorPtr pCursor, void *closure) { Atom *pName = closure; @@ -776,7 +776,7 @@ createCursorHideCount(ClientPtr pClient, ScreenPtr pScreen) * Create a resource for this element so it can be deleted * when the client goes away. */ - if (!AddResource(pChc->resource, CursorHideCountType, (pointer) pChc)) { + if (!AddResource(pChc->resource, CursorHideCountType, (void *) pChc)) { free(pChc); return BadAlloc; } @@ -841,7 +841,7 @@ ProcXFixesHideCursor(ClientPtr client) REQUEST_SIZE_MATCH(xXFixesHideCursorReq); - ret = dixLookupResourceByType((pointer *) &pWin, stuff->window, RT_WINDOW, + ret = dixLookupResourceByType((void **) &pWin, stuff->window, RT_WINDOW, client, DixGetAttrAccess); if (ret != Success) { client->errorValue = stuff->window; @@ -905,7 +905,7 @@ ProcXFixesShowCursor(ClientPtr client) REQUEST_SIZE_MATCH(xXFixesShowCursorReq); - rc = dixLookupResourceByType((pointer *) &pWin, stuff->window, RT_WINDOW, + rc = dixLookupResourceByType((void **) &pWin, stuff->window, RT_WINDOW, client, DixGetAttrAccess); if (rc != Success) { client->errorValue = stuff->window; @@ -946,7 +946,7 @@ SProcXFixesShowCursor(ClientPtr client) } static int -CursorFreeClient(pointer data, XID id) +CursorFreeClient(void *data, XID id) { CursorEventPtr old = (CursorEventPtr) data; CursorEventPtr *prev, e; @@ -962,7 +962,7 @@ CursorFreeClient(pointer data, XID id) } static int -CursorFreeHideCount(pointer data, XID id) +CursorFreeHideCount(void *data, XID id) { CursorHideCountPtr pChc = (CursorHideCountPtr) data; ScreenPtr pScreen = pChc->pScreen; @@ -978,7 +978,7 @@ CursorFreeHideCount(pointer data, XID id) } static int -CursorFreeWindow(pointer data, XID id) +CursorFreeWindow(void *data, XID id) { WindowPtr pWindow = (WindowPtr) data; CursorEventPtr e, next; @@ -1056,6 +1056,8 @@ XFixesCursorInit(void) if (party_like_its_1989) CursorVisible = EnableCursor; + else + CursorVisible = FALSE; if (!dixRegisterPrivateKey(&CursorScreenPrivateKeyRec, PRIVATE_SCREEN, 0)) return FALSE; diff --git a/xserver/xfixes/region.c b/xserver/xfixes/region.c index 14a02ba1d..f9de52542 100644 --- a/xserver/xfixes/region.c +++ b/xserver/xfixes/region.c @@ -35,7 +35,7 @@ RESTYPE RegionResType; static int -RegionResFree(pointer data, XID id) +RegionResFree(void *data, XID id) { RegionPtr pRegion = (RegionPtr) data; @@ -85,7 +85,7 @@ ProcXFixesCreateRegion(ClientPtr client) pRegion = RegionFromRects(things, (xRectangle *) (stuff + 1), CT_UNSORTED); if (!pRegion) return BadAlloc; - if (!AddResource(stuff->region, RegionResType, (pointer) pRegion)) + if (!AddResource(stuff->region, RegionResType, (void *) pRegion)) return BadAlloc; return Success; @@ -115,7 +115,7 @@ ProcXFixesCreateRegionFromBitmap(ClientPtr client) REQUEST_SIZE_MATCH(xXFixesCreateRegionFromBitmapReq); LEGAL_NEW_RESOURCE(stuff->region, client); - rc = dixLookupResourceByType((pointer *) &pPixmap, stuff->bitmap, RT_PIXMAP, + rc = dixLookupResourceByType((void **) &pPixmap, stuff->bitmap, RT_PIXMAP, client, DixReadAccess); if (rc != Success) { client->errorValue = stuff->bitmap; @@ -129,7 +129,7 @@ ProcXFixesCreateRegionFromBitmap(ClientPtr client) if (!pRegion) return BadAlloc; - if (!AddResource(stuff->region, RegionResType, (pointer) pRegion)) + if (!AddResource(stuff->region, RegionResType, (void *) pRegion)) return BadAlloc; return Success; @@ -159,7 +159,7 @@ ProcXFixesCreateRegionFromWindow(ClientPtr client) REQUEST_SIZE_MATCH(xXFixesCreateRegionFromWindowReq); LEGAL_NEW_RESOURCE(stuff->region, client); - rc = dixLookupResourceByType((pointer *) &pWin, stuff->window, RT_WINDOW, + rc = dixLookupResourceByType((void **) &pWin, stuff->window, RT_WINDOW, client, DixGetAttrAccess); if (rc != Success) { client->errorValue = stuff->window; @@ -188,7 +188,7 @@ ProcXFixesCreateRegionFromWindow(ClientPtr client) pRegion = XFixesRegionCopy(pRegion); if (!pRegion) return BadAlloc; - if (!AddResource(stuff->region, RegionResType, (pointer) pRegion)) + if (!AddResource(stuff->region, RegionResType, (void *) pRegion)) return BadAlloc; return Success; @@ -238,7 +238,7 @@ ProcXFixesCreateRegionFromGC(ClientPtr client) return BadImplementation; /* assume sane server bits */ } - if (!AddResource(stuff->region, RegionResType, (pointer) pRegion)) + if (!AddResource(stuff->region, RegionResType, (void *) pRegion)) return BadAlloc; return Success; @@ -269,6 +269,9 @@ ProcXFixesCreateRegionFromPicture(ClientPtr client) VERIFY_PICTURE(pPicture, stuff->picture, client, DixGetAttrAccess); + if (!pPicture->pDrawable) + return RenderErrBase + BadPicture; + switch (pPicture->clientClipType) { case CT_PIXMAP: pRegion = BitmapToRegion(pPicture->pDrawable->pScreen, @@ -285,7 +288,7 @@ ProcXFixesCreateRegionFromPicture(ClientPtr client) return BadImplementation; /* assume sane server bits */ } - if (!AddResource(stuff->region, RegionResType, (pointer) pRegion)) + if (!AddResource(stuff->region, RegionResType, (void *) pRegion)) return BadAlloc; return Success; @@ -629,7 +632,7 @@ ProcXFixesSetGCClipRegion(ClientPtr client) vals[1].val = stuff->yOrigin; ChangeGC(NullClient, pGC, GCClipXOrigin | GCClipYOrigin, vals); (*pGC->funcs->ChangeClip) (pGC, pRegion ? CT_REGION : CT_NONE, - (pointer) pRegion, 0); + (void *) pRegion, 0); return Success; } @@ -661,7 +664,7 @@ ProcXFixesSetWindowShapeRegion(ClientPtr client) REQUEST(xXFixesSetWindowShapeRegionReq); REQUEST_SIZE_MATCH(xXFixesSetWindowShapeRegionReq); - rc = dixLookupResourceByType((pointer *) &pWin, stuff->dest, RT_WINDOW, + rc = dixLookupResourceByType((void **) &pWin, stuff->dest, RT_WINDOW, client, DixSetAttrAccess); if (rc != Success) { client->errorValue = stuff->dest; @@ -750,6 +753,9 @@ ProcXFixesSetPictureClipRegion(ClientPtr client) VERIFY_PICTURE(pPicture, stuff->picture, client, DixSetAttrAccess); VERIFY_REGION_OR_NONE(pRegion, stuff->region, client, DixReadAccess); + if (!pPicture->pDrawable) + return RenderErrBase + BadPicture; + return SetPictureClipRegion(pPicture, stuff->xOrigin, stuff->yOrigin, pRegion); } diff --git a/xserver/xfixes/select.c b/xserver/xfixes/select.c index ee8ed6f68..c088ed3de 100644 --- a/xserver/xfixes/select.c +++ b/xserver/xfixes/select.c @@ -51,7 +51,7 @@ typedef struct _SelectionEvent { static SelectionEventPtr selectionEvents; static void -XFixesSelectionCallback(CallbackListPtr *callbacks, pointer data, pointer args) +XFixesSelectionCallback(CallbackListPtr *callbacks, void *data, void *args) { SelectionEventPtr e; SelectionInfoRec *info = (SelectionInfoRec *) args; @@ -119,7 +119,7 @@ static int XFixesSelectSelectionInput(ClientPtr pClient, Atom selection, WindowPtr pWindow, CARD32 eventMask) { - pointer val; + void *val; int rc; SelectionEventPtr *prev, e; @@ -159,12 +159,12 @@ XFixesSelectSelectionInput(ClientPtr pClient, DixGetAttrAccess); if (rc != Success) if (!AddResource(pWindow->drawable.id, SelectionWindowType, - (pointer) pWindow)) { + (void *) pWindow)) { free(e); return BadAlloc; } - if (!AddResource(e->clientResource, SelectionClientType, (pointer) e)) + if (!AddResource(e->clientResource, SelectionClientType, (void *) e)) return BadAlloc; *prev = e; @@ -222,7 +222,7 @@ SXFixesSelectionNotifyEvent(xXFixesSelectionNotifyEvent * from, } static int -SelectionFreeClient(pointer data, XID id) +SelectionFreeClient(void *data, XID id) { SelectionEventPtr old = (SelectionEventPtr) data; SelectionEventPtr *prev, e; @@ -239,7 +239,7 @@ SelectionFreeClient(pointer data, XID id) } static int -SelectionFreeWindow(pointer data, XID id) +SelectionFreeWindow(void *data, XID id) { WindowPtr pWindow = (WindowPtr) data; SelectionEventPtr e, next; diff --git a/xserver/xfixes/xfixes.c b/xserver/xfixes/xfixes.c index 48af9ea6e..3307f874b 100644 --- a/xserver/xfixes/xfixes.c +++ b/xserver/xfixes/xfixes.c @@ -213,7 +213,7 @@ SProcXFixesDispatch(ClientPtr client) } static void -XFixesClientCallback(CallbackListPtr *list, pointer closure, pointer data) +XFixesClientCallback(CallbackListPtr *list, void *closure, void *data) { NewClientInfoRec *clientinfo = (NewClientInfoRec *) data; ClientPtr pClient = clientinfo->client; diff --git a/xserver/xfixes/xfixes.h b/xserver/xfixes/xfixes.h index 98828710f..fdcf44f3f 100644 --- a/xserver/xfixes/xfixes.h +++ b/xserver/xfixes/xfixes.h @@ -35,7 +35,7 @@ extern _X_EXPORT int XFixesErrorBase; #define VERIFY_REGION(pRegion, rid, client, mode) \ do { \ int err; \ - err = dixLookupResourceByType((pointer *) &pRegion, rid, \ + err = dixLookupResourceByType((void **) &pRegion, rid, \ RegionResType, client, mode); \ if (err != Success) { \ client->errorValue = rid; \ diff --git a/xserver/xkb/Makefile.in b/xserver/xkb/Makefile.in index b6995ee14..ddf9a4b40 100644 --- a/xserver/xkb/Makefile.in +++ b/xserver/xkb/Makefile.in @@ -202,6 +202,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ +DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DGA_CFLAGS = @DGA_CFLAGS@ @@ -246,6 +248,10 @@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ +GBM_CFLAGS = @GBM_CFLAGS@ +GBM_LIBS = @GBM_LIBS@ +GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ +GLAMOR_LIBS = @GLAMOR_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_SYS_LIBS = @GLX_SYS_LIBS@ @@ -348,7 +354,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ SYSCONFDIR = @SYSCONFDIR@ +SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ +SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ @@ -357,6 +366,7 @@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ @@ -423,6 +433,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_LIBS = @XVFB_LIBS@ XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ +XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ +XWAYLAND_LIBS = @XWAYLAND_LIBS@ +XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ XWINMODULES_LIBS = @XWINMODULES_LIBS@ XWIN_LIBS = @XWIN_LIBS@ diff --git a/xserver/xkb/ddxBeep.c b/xserver/xkb/ddxBeep.c index f95d0ee81..caf78c94d 100644 --- a/xserver/xkb/ddxBeep.c +++ b/xserver/xkb/ddxBeep.c @@ -113,7 +113,7 @@ _XkbDDXBeepInitAtoms(void) } static CARD32 -_XkbDDXBeepExpire(OsTimerPtr timer, CARD32 now, pointer arg) +_XkbDDXBeepExpire(OsTimerPtr timer, CARD32 now, void *arg) { DeviceIntPtr dev = (DeviceIntPtr) arg; KbdFeedbackPtr feed; @@ -300,11 +300,11 @@ _XkbDDXBeepExpire(OsTimerPtr timer, CARD32 now, pointer arg) ctrl->bell_duration = duration; ctrl->bell_pitch = pitch; if (xkbInfo->beepCount == 0) { - XkbHandleBell(0, 0, dev, ctrl->bell, (pointer) ctrl, + XkbHandleBell(0, 0, dev, ctrl->bell, (void *) ctrl, KbdFeedbackClass, name, None, NULL); } else if (xkbInfo->desc->ctrls->enabled_ctrls & XkbAudibleBellMask) { - (*dev->kbdfeed->BellProc) (ctrl->bell, dev, (pointer) ctrl, + (*dev->kbdfeed->BellProc) (ctrl->bell, dev, (void *) ctrl, KbdFeedbackClass); } ctrl->bell_duration = oldDuration; @@ -340,11 +340,11 @@ XkbDDXAccessXBeep(DeviceIntPtr dev, unsigned what, unsigned which) xkbInfo->beepType = what; xkbInfo->beepCount = 0; - next = _XkbDDXBeepExpire(NULL, 0, (pointer) dev); + next = _XkbDDXBeepExpire(NULL, 0, (void *) dev); if (next > 0) { xkbInfo->beepTimer = TimerSet(xkbInfo->beepTimer, 0, next, - _XkbDDXBeepExpire, (pointer) dev); + _XkbDDXBeepExpire, (void *) dev); } return 1; } diff --git a/xserver/xkb/ddxLoad.c b/xserver/xkb/ddxLoad.c index d462957f4..1dc0e4eee 100644 --- a/xserver/xkb/ddxLoad.c +++ b/xserver/xkb/ddxLoad.c @@ -68,6 +68,9 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #define PATHSEPARATOR "/" #endif +static unsigned +LoadXKM(unsigned want, unsigned need, const char *keymap, XkbDescPtr *xkbRtrn); + static void OutputDirectory(char *outdir, size_t size) { @@ -90,11 +93,17 @@ OutputDirectory(char *outdir, size_t size) } } -static Bool -XkbDDXCompileKeymapByNames(XkbDescPtr xkb, - XkbComponentNamesPtr names, - unsigned want, - unsigned need, char *nameRtrn, int nameRtrnLen) +/** + * Callback invoked by XkbRunXkbComp. Write to out to talk to xkbcomp. + */ +typedef void (*xkbcomp_buffer_callback)(FILE *out, void *userdata); + +/** + * Start xkbcomp, let the callback write into xkbcomp's stdin. When done, + * return a strdup'd copy of the file name we've written to. + */ +static char * +RunXkbComp(xkbcomp_buffer_callback callback, void *userdata) { FILE *out; char *buf = NULL, keymap[PATH_MAX], xkm_output_dir[PATH_MAX]; @@ -155,7 +164,7 @@ XkbDDXCompileKeymapByNames(XkbDescPtr xkb, if (!buf) { LogMessage(X_ERROR, "XKB: Could not invoke xkbcomp: not enough memory\n"); - return FALSE; + return NULL; } #ifndef WIN32 @@ -165,13 +174,9 @@ XkbDDXCompileKeymapByNames(XkbDescPtr xkb, #endif if (out != NULL) { -#ifdef DEBUG - if (xkbDebugFlags) { - ErrorF("[xkb] XkbDDXCompileKeymapByNames compiling keymap:\n"); - XkbWriteXKBKeymapForNames(stderr, names, xkb, want, need); - } -#endif - XkbWriteXKBKeymapForNames(out, names, xkb, want, need); + /* Now write to xkbcomp */ + (*callback)(out, userdata); + #ifndef WIN32 if (Pclose(out) == 0) #else @@ -180,14 +185,11 @@ XkbDDXCompileKeymapByNames(XkbDescPtr xkb, { if (xkbDebugFlags) DebugF("[xkb] xkb executes: %s\n", buf); - if (nameRtrn) { - strlcpy(nameRtrn, keymap, nameRtrnLen); - } free(buf); #ifdef WIN32 unlink(tmpname); #endif - return TRUE; + return xnfstrdup(keymap); } else LogMessage(X_ERROR, "Error compiling keymap (%s)\n", keymap); @@ -203,14 +205,101 @@ XkbDDXCompileKeymapByNames(XkbDescPtr xkb, LogMessage(X_ERROR, "Could not open file %s\n", tmpname); #endif } - if (nameRtrn) - nameRtrn[0] = '\0'; free(buf); - return FALSE; + return NULL; +} + +typedef struct { + XkbDescPtr xkb; + XkbComponentNamesPtr names; + unsigned int want; + unsigned int need; +} XkbKeymapNamesCtx; + +static void +xkb_write_keymap_for_names_cb(FILE *out, void *userdata) +{ + XkbKeymapNamesCtx *ctx = userdata; +#ifdef DEBUG + if (xkbDebugFlags) { + ErrorF("[xkb] XkbDDXCompileKeymapByNames compiling keymap:\n"); + XkbWriteXKBKeymapForNames(stderr, ctx->names, ctx->xkb, ctx->want, ctx->need); + } +#endif + XkbWriteXKBKeymapForNames(out, ctx->names, ctx->xkb, ctx->want, ctx->need); +} + +static Bool +XkbDDXCompileKeymapByNames(XkbDescPtr xkb, + XkbComponentNamesPtr names, + unsigned want, + unsigned need, char *nameRtrn, int nameRtrnLen) +{ + char *keymap; + Bool rc = FALSE; + XkbKeymapNamesCtx ctx = { + .xkb = xkb, + .names = names, + .want = want, + .need = need + }; + + keymap = RunXkbComp(xkb_write_keymap_for_names_cb, &ctx); + + if (keymap) { + if(nameRtrn) + strlcpy(nameRtrn, keymap, nameRtrnLen); + + free(keymap); + rc = TRUE; + } else if (nameRtrn) + *nameRtrn = '\0'; + + return rc; +} + +typedef struct { + const char *keymap; + size_t len; +} XkbKeymapString; + +static void +xkb_write_keymap_string_cb(FILE *out, void *userdata) +{ + XkbKeymapString *s = userdata; + fwrite(s->keymap, s->len, 1, out); +} + +static unsigned int +XkbDDXLoadKeymapFromString(DeviceIntPtr keybd, + const char *keymap, int keymap_length, + unsigned int want, + unsigned int need, + XkbDescPtr *xkbRtrn) +{ + unsigned int have; + char *map_name; + XkbKeymapString map = { + .keymap = keymap, + .len = keymap_length + }; + + *xkbRtrn = NULL; + + map_name = RunXkbComp(xkb_write_keymap_string_cb, &map); + if (!map_name) { + LogMessage(X_ERROR, "XKB: Couldn't compile keymap\n"); + return 0; + } + + have = LoadXKM(want, need, map_name, xkbRtrn); + free(map_name); + + return have; } static FILE * -XkbDDXOpenConfigFile(char *mapName, char *fileNameRtrn, int fileNameRtrnLen) +XkbDDXOpenConfigFile(const char *mapName, char *fileNameRtrn, int fileNameRtrnLen) { char buf[PATH_MAX], xkm_output_dir[PATH_MAX]; FILE *file; @@ -245,6 +334,35 @@ XkbDDXOpenConfigFile(char *mapName, char *fileNameRtrn, int fileNameRtrnLen) return file; } +static unsigned +LoadXKM(unsigned want, unsigned need, const char *keymap, XkbDescPtr *xkbRtrn) +{ + FILE *file; + char fileName[PATH_MAX]; + unsigned missing; + + file = XkbDDXOpenConfigFile(keymap, fileName, PATH_MAX); + if (file == NULL) { + LogMessage(X_ERROR, "Couldn't open compiled keymap file %s\n", + fileName); + return 0; + } + missing = XkmReadFile(file, need, want, xkbRtrn); + if (*xkbRtrn == NULL) { + LogMessage(X_ERROR, "Error loading keymap %s\n", fileName); + fclose(file); + (void) unlink(fileName); + return 0; + } + else { + DebugF("Loaded XKB keymap %s, defined=0x%x\n", fileName, + (*xkbRtrn)->defined); + } + fclose(file); + (void) unlink(fileName); + return (need | want) & (~missing); +} + unsigned XkbDDXLoadKeymapByNames(DeviceIntPtr keybd, XkbComponentNamesPtr names, @@ -253,9 +371,6 @@ XkbDDXLoadKeymapByNames(DeviceIntPtr keybd, XkbDescPtr *xkbRtrn, char *nameRtrn, int nameRtrnLen) { XkbDescPtr xkb; - FILE *file; - char fileName[PATH_MAX]; - unsigned missing; *xkbRtrn = NULL; if ((keybd == NULL) || (keybd->key == NULL) || @@ -275,31 +390,13 @@ XkbDDXLoadKeymapByNames(DeviceIntPtr keybd, LogMessage(X_ERROR, "XKB: Couldn't compile keymap\n"); return 0; } - file = XkbDDXOpenConfigFile(nameRtrn, fileName, PATH_MAX); - if (file == NULL) { - LogMessage(X_ERROR, "Couldn't open compiled keymap file %s\n", - fileName); - return 0; - } - missing = XkmReadFile(file, need, want, xkbRtrn); - if (*xkbRtrn == NULL) { - LogMessage(X_ERROR, "Error loading keymap %s\n", fileName); - fclose(file); - (void) unlink(fileName); - return 0; - } - else { - DebugF("Loaded XKB keymap %s, defined=0x%x\n", fileName, - (*xkbRtrn)->defined); - } - fclose(file); - (void) unlink(fileName); - return (need | want) & (~missing); + + return LoadXKM(want, need, nameRtrn, xkbRtrn); } Bool XkbDDXNamesFromRules(DeviceIntPtr keybd, - char *rules_name, + const char *rules_name, XkbRF_VarDefsPtr defs, XkbComponentNamesPtr names) { char buf[PATH_MAX]; @@ -390,6 +487,29 @@ XkbCompileKeymapForDevice(DeviceIntPtr dev, XkbRMLVOSet * rmlvo, int need) return xkb; } +static XkbDescPtr +KeymapOrDefaults(DeviceIntPtr dev, XkbDescPtr xkb) +{ + XkbRMLVOSet dflts; + + if (xkb) + return xkb; + + /* we didn't get what we really needed. And that will likely leave + * us with a keyboard that doesn't work. Use the defaults instead */ + LogMessage(X_ERROR, "XKB: Failed to load keymap. Loading default " + "keymap instead.\n"); + + XkbGetRulesDflts(&dflts); + + xkb = XkbCompileKeymapForDevice(dev, &dflts, 0); + + XkbFreeRMLVOSet(&dflts, FALSE); + + return xkb; +} + + XkbDescPtr XkbCompileKeymap(DeviceIntPtr dev, XkbRMLVOSet * rmlvo) { @@ -407,20 +527,34 @@ XkbCompileKeymap(DeviceIntPtr dev, XkbRMLVOSet * rmlvo) xkb = XkbCompileKeymapForDevice(dev, rmlvo, need); - if (!xkb) { - XkbRMLVOSet dflts; - - /* we didn't get what we really needed. And that will likely leave - * us with a keyboard that doesn't work. Use the defaults instead */ - LogMessage(X_ERROR, "XKB: Failed to load keymap. Loading default " - "keymap instead.\n"); + return KeymapOrDefaults(dev, xkb); +} - XkbGetRulesDflts(&dflts); +XkbDescPtr +XkbCompileKeymapFromString(DeviceIntPtr dev, + const char *keymap, int keymap_length) +{ + XkbDescPtr xkb; + unsigned int need, provided; - xkb = XkbCompileKeymapForDevice(dev, &dflts, 0); + if (!dev || !keymap) { + LogMessage(X_ERROR, "XKB: No device or keymap specified\n"); + return NULL; + } - XkbFreeRMLVOSet(&dflts, FALSE); + /* These are the components we really really need */ + need = XkmSymbolsMask | XkmCompatMapMask | XkmTypesMask | + XkmKeyNamesMask | XkmVirtualModsMask; + + provided = + XkbDDXLoadKeymapFromString(dev, keymap, keymap_length, + XkmAllIndicesMask, need, &xkb); + if ((need & provided) != need) { + if (xkb) { + XkbFreeKeyboard(xkb, 0, TRUE); + xkb = NULL; + } } - return xkb; + return KeymapOrDefaults(dev, xkb); } diff --git a/xserver/xkb/maprules.c b/xserver/xkb/maprules.c index 5462763d1..6f5f8ccf3 100644 --- a/xserver/xkb/maprules.c +++ b/xserver/xkb/maprules.c @@ -218,10 +218,10 @@ typedef struct _FileSpec { } FileSpec; typedef struct { - char *model; - char *layout[XkbNumKbdGroups + 1]; - char *variant[XkbNumKbdGroups + 1]; - char *options; + const char *model; + const char *layout[XkbNumKbdGroups + 1]; + const char *variant[XkbNumKbdGroups + 1]; + const char *options; } XkbRF_MultiDefsRec, *XkbRF_MultiDefsPtr; #define NDX_BUFF_SIZE 4 @@ -343,9 +343,9 @@ SetUpRemap(InputLine * line, RemapSpec * remap) } static Bool -MatchOneOf(char *wanted, char *vals_defined) +MatchOneOf(const char *wanted, const char *vals_defined) { - char *str, *next; + const char *str, *next; int want_len = strlen(wanted); for (str = vals_defined, next = NULL; str != NULL; str = next) { @@ -469,7 +469,7 @@ CheckLine(InputLine * line, } static char * -_Concat(char *str1, char *str2) +_Concat(char *str1, const char *str2) { int len; @@ -498,12 +498,13 @@ squeeze_spaces(char *p1) static Bool MakeMultiDefs(XkbRF_MultiDefsPtr mdefs, XkbRF_VarDefsPtr defs) { - + char *options; memset((char *) mdefs, 0, sizeof(XkbRF_MultiDefsRec)); mdefs->model = defs->model; - mdefs->options = Xstrdup(defs->options); - if (mdefs->options) - squeeze_spaces(mdefs->options); + options = Xstrdup(defs->options); + if (options) + squeeze_spaces(options); + mdefs->options = options; if (defs->layout) { if (!strchr(defs->layout, ',')) { @@ -511,13 +512,15 @@ MakeMultiDefs(XkbRF_MultiDefsPtr mdefs, XkbRF_VarDefsPtr defs) } else { char *p; + char *layout; int i; - mdefs->layout[1] = Xstrdup(defs->layout); - if (mdefs->layout[1] == NULL) + layout = Xstrdup(defs->layout); + if (layout == NULL) return FALSE; - squeeze_spaces(mdefs->layout[1]); - p = mdefs->layout[1]; + squeeze_spaces(layout); + mdefs->layout[1] = layout; + p = layout; for (i = 2; i <= XkbNumKbdGroups; i++) { if ((p = strchr(p, ','))) { *p++ = '\0'; @@ -538,13 +541,15 @@ MakeMultiDefs(XkbRF_MultiDefsPtr mdefs, XkbRF_VarDefsPtr defs) } else { char *p; + char *variant; int i; - mdefs->variant[1] = Xstrdup(defs->variant); - if (mdefs->variant[1] == NULL) + variant = Xstrdup(defs->variant); + if (variant == NULL) return FALSE; - squeeze_spaces(mdefs->variant[1]); - p = mdefs->variant[1]; + squeeze_spaces(variant); + mdefs->variant[1] = variant; + p = variant; for (i = 2; i <= XkbNumKbdGroups; i++) { if ((p = strchr(p, ','))) { *p++ = '\0'; @@ -564,13 +569,13 @@ MakeMultiDefs(XkbRF_MultiDefsPtr mdefs, XkbRF_VarDefsPtr defs) static void FreeMultiDefs(XkbRF_MultiDefsPtr defs) { - free(defs->options); - free(defs->layout[1]); - free(defs->variant[1]); + free((void *) defs->options); + free((void *) defs->layout[1]); + free((void *) defs->variant[1]); } static void -Apply(char *src, char **dst) +Apply(const char *src, char **dst) { if (src) { if (*src == '+' || *src == '!') { @@ -596,7 +601,7 @@ XkbRF_ApplyRule(XkbRF_RulePtr rule, XkbComponentNamesPtr names) } static Bool -CheckGroup(XkbRF_RulesPtr rules, char *group_name, char *name) +CheckGroup(XkbRF_RulesPtr rules, const char *group_name, const char *name) { int i; char *p; @@ -1013,15 +1018,15 @@ XkbRF_Free(XkbRF_RulesPtr rules, Bool freeRules) return; if (rules->rules) { for (i = 0, rule = rules->rules; i < rules->num_rules; i++, rule++) { - free(rule->model); - free(rule->layout); - free(rule->variant); - free(rule->option); - free(rule->keycodes); - free(rule->symbols); - free(rule->types); - free(rule->compat); - free(rule->geometry); + free((void *) rule->model); + free((void *) rule->layout); + free((void *) rule->variant); + free((void *) rule->option); + free((void *) rule->keycodes); + free((void *) rule->symbols); + free((void *) rule->types); + free((void *) rule->compat); + free((void *) rule->geometry); memset((char *) rule, 0, sizeof(XkbRF_RuleRec)); } free(rules->rules); @@ -1031,7 +1036,7 @@ XkbRF_Free(XkbRF_RulesPtr rules, Bool freeRules) if (rules->groups) { for (i = 0, group = rules->groups; i < rules->num_groups; i++, group++) { - free(group->name); + free((void *) group->name); free(group->words); } free(rules->groups); diff --git a/xserver/xkb/xkb.c b/xserver/xkb/xkb.c index c78aceb78..dc570f0e5 100644 --- a/xserver/xkb/xkb.c +++ b/xserver/xkb/xkb.c @@ -370,7 +370,7 @@ _XkbBell(ClientPtr client, DeviceIntPtr dev, WindowPtr pWin, int percent, int forceSound, int eventOnly, Atom name) { int base; - pointer ctrl; + void *ctrl; int oldPitch, oldDuration; int newPercent; @@ -390,7 +390,7 @@ _XkbBell(ClientPtr client, DeviceIntPtr dev, WindowPtr pWin, return BadValue; } base = k->ctrl.bell; - ctrl = (pointer) &(k->ctrl); + ctrl = (void *) &(k->ctrl); oldPitch = k->ctrl.bell_pitch; oldDuration = k->ctrl.bell_duration; if (pitch != 0) { @@ -422,7 +422,7 @@ _XkbBell(ClientPtr client, DeviceIntPtr dev, WindowPtr pWin, return BadValue; } base = b->ctrl.percent; - ctrl = (pointer) &(b->ctrl); + ctrl = (void *) &(b->ctrl); oldPitch = b->ctrl.pitch; oldDuration = b->ctrl.duration; if (pitch != 0) { @@ -4419,7 +4419,7 @@ ProcXkbSetNames(ClientPtr client) * (swapped) 16 bit string length, non-zero terminated. */ static char * -XkbWriteCountedString(char *wire, char *str, Bool swap) +XkbWriteCountedString(char *wire, const char *str, Bool swap) { CARD16 len, *pLen, paddedLen; @@ -5950,25 +5950,13 @@ ProcXkbGetKbdByName(ClientPtr client) if (rep.loaded) { XkbDescPtr old_xkb; xkbNewKeyboardNotify nkn; - int i, nG, nTG; old_xkb = xkb; xkb = new; dev->key->xkbInfo->desc = xkb; new = old_xkb; /* so it'll get freed automatically */ - *xkb->ctrls = *old_xkb->ctrls; - for (nG = nTG = 0, i = xkb->min_key_code; i <= xkb->max_key_code; i++) { - nG = XkbKeyNumGroups(xkb, i); - if (nG >= XkbNumKbdGroups) { - nTG = XkbNumKbdGroups; - break; - } - if (nG > nTG) { - nTG = nG; - } - } - xkb->ctrls->num_groups = nTG; + XkbCopyControls(xkb, old_xkb); nkn.deviceID = nkn.oldDeviceID = dev->id; nkn.minKeyCode = new->min_key_code; @@ -5991,7 +5979,7 @@ ProcXkbGetKbdByName(ClientPtr client) continue; if (tmpd != dev) - XkbCopyDeviceKeymap(tmpd, dev); + XkbDeviceApplyKeymap(tmpd, xkb); if (tmpd->kbdfeed && tmpd->kbdfeed->xkb_sli) { old_sli = tmpd->kbdfeed->xkb_sli; @@ -6820,7 +6808,7 @@ ProcXkbDispatch(ClientPtr client) } static int -XkbClientGone(pointer data, XID id) +XkbClientGone(void *data, XID id) { DevicePtr pXDev = (DevicePtr) data; diff --git a/xserver/xkb/xkbAccessX.c b/xserver/xkb/xkbAccessX.c index 13051e034..5f3de0d9e 100644 --- a/xserver/xkb/xkbAccessX.c +++ b/xserver/xkb/xkbAccessX.c @@ -279,7 +279,7 @@ AccessXStickyKeysTurnOff(DeviceIntPtr dev, xkbControlsNotify * pCN) } /* AccessXStickyKeysTurnOff */ static CARD32 -AccessXKRGExpire(OsTimerPtr timer, CARD32 now, pointer arg) +AccessXKRGExpire(OsTimerPtr timer, CARD32 now, void *arg) { xkbControlsNotify cn; DeviceIntPtr dev = arg; @@ -309,7 +309,7 @@ AccessXKRGExpire(OsTimerPtr timer, CARD32 now, pointer arg) } static CARD32 -AccessXRepeatKeyExpire(OsTimerPtr timer, CARD32 now, pointer arg) +AccessXRepeatKeyExpire(OsTimerPtr timer, CARD32 now, void *arg) { DeviceIntPtr dev = (DeviceIntPtr) arg; XkbSrvInfoPtr xkbi = dev->key->xkbInfo; @@ -331,7 +331,7 @@ AccessXCancelRepeatKey(XkbSrvInfoPtr xkbi, KeyCode key) } static CARD32 -AccessXSlowKeyExpire(OsTimerPtr timer, CARD32 now, pointer arg) +AccessXSlowKeyExpire(OsTimerPtr timer, CARD32 now, void *arg) { DeviceIntPtr keybd; XkbSrvInfoPtr xkbi; @@ -370,7 +370,7 @@ AccessXSlowKeyExpire(OsTimerPtr timer, CARD32 now, pointer arg) xkbi->repeatKeyTimer = TimerSet(xkbi->repeatKeyTimer, 0, ctrls->repeat_delay, AccessXRepeatKeyExpire, - (pointer) keybd); + (void *) keybd); } } } @@ -378,7 +378,7 @@ AccessXSlowKeyExpire(OsTimerPtr timer, CARD32 now, pointer arg) } static CARD32 -AccessXBounceKeyExpire(OsTimerPtr timer, CARD32 now, pointer arg) +AccessXBounceKeyExpire(OsTimerPtr timer, CARD32 now, void *arg) { XkbSrvInfoPtr xkbi = ((DeviceIntPtr) arg)->key->xkbInfo; @@ -387,7 +387,7 @@ AccessXBounceKeyExpire(OsTimerPtr timer, CARD32 now, pointer arg) } static CARD32 -AccessXTimeoutExpire(OsTimerPtr timer, CARD32 now, pointer arg) +AccessXTimeoutExpire(OsTimerPtr timer, CARD32 now, void *arg) { DeviceIntPtr dev = (DeviceIntPtr) arg; XkbSrvInfoPtr xkbi = dev->key->xkbInfo; @@ -467,12 +467,12 @@ AccessXFilterPressEvent(DeviceEvent *event, DeviceIntPtr keybd) if (XkbAX_NeedFeedback(ctrls, XkbAX_SlowWarnFBMask)) { xkbi->krgTimerActive = _KRG_WARN_TIMER; xkbi->krgTimer = TimerSet(xkbi->krgTimer, 0, 4000, - AccessXKRGExpire, (pointer) keybd); + AccessXKRGExpire, (void *) keybd); } else { xkbi->krgTimerActive = _KRG_TIMER; xkbi->krgTimer = TimerSet(xkbi->krgTimer, 0, 8000, - AccessXKRGExpire, (pointer) keybd); + AccessXKRGExpire, (void *) keybd); } if (!(ctrls->enabled_ctrls & XkbSlowKeysMask)) { CARD32 now = GetTimeInMillis(); @@ -514,7 +514,7 @@ AccessXFilterPressEvent(DeviceEvent *event, DeviceIntPtr keybd) xkbi->slowKey = key; xkbi->slowKeysTimer = TimerSet(xkbi->slowKeysTimer, 0, ctrls->slow_keys_delay, - AccessXSlowKeyExpire, (pointer) keybd); + AccessXSlowKeyExpire, (void *) keybd); ignoreKeyEvent = TRUE; } @@ -546,7 +546,7 @@ AccessXFilterPressEvent(DeviceEvent *event, DeviceIntPtr keybd) xkbi->repeatKeyTimer = TimerSet(xkbi->repeatKeyTimer, 0, ctrls->repeat_delay, AccessXRepeatKeyExpire, - (pointer) keybd); + (void *) keybd); } } } @@ -608,7 +608,7 @@ AccessXFilterReleaseEvent(DeviceEvent *event, DeviceIntPtr keybd) xkbi->bounceKeysTimer = TimerSet(xkbi->bounceKeysTimer, 0, ctrls->debounce_delay, AccessXBounceKeyExpire, - (pointer) keybd); + (void *) keybd); } /* Don't transmit the KeyRelease if SlowKeys is turned on and @@ -651,7 +651,7 @@ AccessXFilterReleaseEvent(DeviceEvent *event, DeviceIntPtr keybd) xkbi->lastPtrEventTime = 0; xkbi->krgTimer = TimerSet(xkbi->krgTimer, 0, ctrls->ax_timeout * 1000, - AccessXTimeoutExpire, (pointer) keybd); + AccessXTimeoutExpire, (void *) keybd); xkbi->krgTimerActive = _ALL_TIMEOUT_TIMER; } else if (xkbi->krgTimerActive != _OFF_TIMER) { @@ -711,7 +711,7 @@ ProcessPointerEvent(InternalEvent *ev, DeviceIntPtr mouse) xkbDeviceInfoPtr xkbPrivPtr = XKBDEVICEINFO(mouse); DeviceEvent *event = &ev->device_event; - dev = (IsMaster(mouse) || IsFloating(mouse)) ? mouse : GetMaster(mouse, MASTER_KEYBOARD); + dev = IsFloating(mouse) ? mouse : GetMaster(mouse, MASTER_KEYBOARD); if (dev && dev->key) { xkbi = dev->key->xkbInfo; diff --git a/xserver/xkb/xkbActions.c b/xserver/xkb/xkbActions.c index e32005cf6..c44f44bc1 100644 --- a/xserver/xkb/xkbActions.c +++ b/xserver/xkb/xkbActions.c @@ -51,7 +51,7 @@ static void XkbFakePointerMotion(DeviceIntPtr dev, unsigned flags, int x, int y); void -xkbUnwrapProc(DeviceIntPtr device, DeviceHandleProc proc, pointer data) +xkbUnwrapProc(DeviceIntPtr device, DeviceHandleProc proc, void *data) { xkbDeviceInfoPtr xkbPrivPtr = XKBDEVICEINFO(device); ProcessInputProc backupproc; @@ -470,7 +470,7 @@ _XkbFilterISOLock(XkbSrvInfoPtr xkbi, } static CARD32 -_XkbPtrAccelExpire(OsTimerPtr timer, CARD32 now, pointer arg) +_XkbPtrAccelExpire(OsTimerPtr timer, CARD32 now, void *arg) { XkbSrvInfoPtr xkbi = (XkbSrvInfoPtr) arg; XkbControlsPtr ctrls = xkbi->desc->ctrls; @@ -540,7 +540,7 @@ _XkbFilterPointerMove(XkbSrvInfoPtr xkbi, xkbi->mouseKeysDY = XkbPtrActionY(&pAction->ptr); xkbi->mouseKeyTimer = TimerSet(xkbi->mouseKeyTimer, 0, xkbi->desc->ctrls->mk_delay, - _XkbPtrAccelExpire, (pointer) xkbi); + _XkbPtrAccelExpire, (void *) xkbi); } else if (filter->keycode == keycode) { filter->active = 0; @@ -1127,13 +1127,78 @@ _XkbApplyFilters(XkbSrvInfoPtr xkbi, unsigned kc, XkbAction *pAction) return send; } +static int +_XkbEnsureStateChange(XkbSrvInfoPtr xkbi) +{ + Bool genStateNotify = FALSE; + + /* The state may change, so if we're not in the middle of sending a state + * notify, prepare for it */ + if ((xkbi->flags & _XkbStateNotifyInProgress) == 0) { + xkbi->prev_state = xkbi->state; + xkbi->flags |= _XkbStateNotifyInProgress; + genStateNotify = TRUE; + } + + return genStateNotify; +} + +static void +_XkbApplyState(DeviceIntPtr dev, Bool genStateNotify, int evtype, int key) +{ + XkbSrvInfoPtr xkbi = dev->key->xkbInfo; + int changed; + + XkbComputeDerivedState(xkbi); + + changed = XkbStateChangedFlags(&xkbi->prev_state, &xkbi->state); + if (genStateNotify) { + if (changed) { + xkbStateNotify sn; + + sn.keycode = key; + sn.eventType = evtype; + sn.requestMajor = sn.requestMinor = 0; + sn.changed = changed; + XkbSendStateNotify(dev, &sn); + } + xkbi->flags &= ~_XkbStateNotifyInProgress; + } + + changed = XkbIndicatorsToUpdate(dev, changed, FALSE); + if (changed) { + XkbEventCauseRec cause; + XkbSetCauseKey(&cause, key, evtype); + XkbUpdateIndicators(dev, changed, FALSE, NULL, &cause); + } +} + +void +XkbPushLockedStateToSlaves(DeviceIntPtr master, int evtype, int key) +{ + DeviceIntPtr dev; + Bool genStateNotify; + + nt_list_for_each_entry(dev, inputInfo.devices, next) { + if (!dev->key || GetMaster(dev, MASTER_KEYBOARD) != master) + continue; + + genStateNotify = _XkbEnsureStateChange(dev->key->xkbInfo); + + dev->key->xkbInfo->state.locked_mods = + master->key->xkbInfo->state.locked_mods; + + _XkbApplyState(dev, genStateNotify, evtype, key); + } +} + void XkbHandleActions(DeviceIntPtr dev, DeviceIntPtr kbd, DeviceEvent *event) { int key, bit, i; XkbSrvInfoPtr xkbi; KeyClassPtr keyc; - int changed, sendEvent; + int sendEvent; Bool genStateNotify; XkbAction act; XkbFilterPtr filter; @@ -1146,15 +1211,8 @@ XkbHandleActions(DeviceIntPtr dev, DeviceIntPtr kbd, DeviceEvent *event) keyc = kbd->key; xkbi = keyc->xkbInfo; key = event->detail.key; - /* The state may change, so if we're not in the middle of sending a state - * notify, prepare for it */ - if ((xkbi->flags & _XkbStateNotifyInProgress) == 0) { - xkbi->prev_state = xkbi->state; - xkbi->flags |= _XkbStateNotifyInProgress; - genStateNotify = TRUE; - } - else - genStateNotify = FALSE; + + genStateNotify = _XkbEnsureStateChange(xkbi); xkbi->clearMods = xkbi->setMods = 0; xkbi->groupChange = 0; @@ -1287,28 +1345,8 @@ XkbHandleActions(DeviceIntPtr dev, DeviceIntPtr kbd, DeviceEvent *event) FixKeyState(event, dev); } - XkbComputeDerivedState(xkbi); - changed = XkbStateChangedFlags(&xkbi->prev_state, &xkbi->state); - if (genStateNotify) { - if (changed) { - xkbStateNotify sn; - - sn.keycode = key; - sn.eventType = event->type; - sn.requestMajor = sn.requestMinor = 0; - sn.changed = changed; - XkbSendStateNotify(dev, &sn); - } - xkbi->flags &= ~_XkbStateNotifyInProgress; - } - changed = XkbIndicatorsToUpdate(dev, changed, FALSE); - if (changed) { - XkbEventCauseRec cause; - - XkbSetCauseKey(&cause, key, event->type); - XkbUpdateIndicators(dev, changed, FALSE, NULL, &cause); - } - return; + _XkbApplyState(dev, genStateNotify, event->type, key); + XkbPushLockedStateToSlaves(dev, event->type, key); } int diff --git a/xserver/xkb/xkbEvents.c b/xserver/xkb/xkbEvents.c index 87a4485eb..210d8ebe4 100644 --- a/xserver/xkb/xkbEvents.c +++ b/xserver/xkb/xkbEvents.c @@ -482,7 +482,7 @@ XkbHandleBell(BOOL force, BOOL eventOnly, DeviceIntPtr kbd, CARD8 percent, - pointer pCtrl, + void *pCtrl, CARD8 class, Atom name, WindowPtr pWin, ClientPtr pClient) { xkbBellNotify bn; @@ -502,7 +502,7 @@ XkbHandleBell(BOOL force, if ((force || (xkbi->desc->ctrls->enabled_ctrls & XkbAudibleBellMask)) && (!eventOnly)) { if (kbd->kbdfeed->BellProc) - (*kbd->kbdfeed->BellProc) (percent, kbd, (pointer) pCtrl, class); + (*kbd->kbdfeed->BellProc) (percent, kbd, (void *) pCtrl, class); } interest = kbd->xkb_interest; if ((!interest) || (force)) diff --git a/xserver/xkb/xkbInit.c b/xserver/xkb/xkbInit.c index f72655fc3..06ec46e81 100644 --- a/xserver/xkb/xkbInit.c +++ b/xserver/xkb/xkbInit.c @@ -142,7 +142,7 @@ XkbFreeRMLVOSet(XkbRMLVOSet * rmlvo, Bool freeRMLVO) } static Bool -XkbWriteRulesProp(ClientPtr client, pointer closure) +XkbWriteRulesProp(ClientPtr client, void *closure) { int len, out; Atom name; @@ -206,6 +206,21 @@ XkbWriteRulesProp(ClientPtr client, pointer closure) return TRUE; } +void +XkbInitRules(XkbRMLVOSet *rmlvo, + const char *rules, + const char *model, + const char *layout, + const char *variant, + const char *options) +{ + rmlvo->rules = rules ? xnfstrdup(rules) : NULL; + rmlvo->model = model ? xnfstrdup(model) : NULL; + rmlvo->layout = layout ? xnfstrdup(layout) : NULL; + rmlvo->variant = variant ? xnfstrdup(variant) : NULL; + rmlvo->options = options ? xnfstrdup(options) : NULL; +} + static void XkbSetRulesUsed(XkbRMLVOSet * rmlvo) { @@ -490,9 +505,10 @@ XkbInitControls(DeviceIntPtr pXDev, XkbSrvInfoPtr xkbi) return Success; } -_X_EXPORT Bool -InitKeyboardDeviceStruct(DeviceIntPtr dev, XkbRMLVOSet * rmlvo, - BellProcPtr bell_func, KbdCtrlProcPtr ctrl_func) +static Bool +InitKeyboardDeviceStructInternal(DeviceIntPtr dev, XkbRMLVOSet * rmlvo, + const char *keymap, int keymap_length, + BellProcPtr bell_func, KbdCtrlProcPtr ctrl_func) { int i; unsigned int check; @@ -506,8 +522,9 @@ InitKeyboardDeviceStruct(DeviceIntPtr dev, XkbRMLVOSet * rmlvo, BUG_RETURN_VAL(dev == NULL, FALSE); BUG_RETURN_VAL(dev->key != NULL, FALSE); BUG_RETURN_VAL(dev->kbdfeed != NULL, FALSE); + BUG_RETURN_VAL(rmlvo && keymap, FALSE); - if (!rmlvo) { + if (!rmlvo && !keymap) { rmlvo = &rmlvo_dflts; XkbGetRulesDflts(rmlvo); } @@ -535,7 +552,7 @@ InitKeyboardDeviceStruct(DeviceIntPtr dev, XkbRMLVOSet * rmlvo, } dev->key->xkbInfo = xkbi; - if (xkb_cached_map && !XkbCompareUsedRMLVO(rmlvo)) { + if (xkb_cached_map && (keymap || (rmlvo && !XkbCompareUsedRMLVO(rmlvo)))) { XkbFreeKeyboard(xkb_cached_map, XkbAllComponentsMask, TRUE); xkb_cached_map = NULL; } @@ -543,7 +560,11 @@ InitKeyboardDeviceStruct(DeviceIntPtr dev, XkbRMLVOSet * rmlvo, if (xkb_cached_map) LogMessageVerb(X_INFO, 4, "XKB: Reusing cached keymap\n"); else { - xkb_cached_map = XkbCompileKeymap(dev, rmlvo); + if (rmlvo) + xkb_cached_map = XkbCompileKeymap(dev, rmlvo); + else + xkb_cached_map = XkbCompileKeymapFromString(dev, keymap, keymap_length); + if (!xkb_cached_map) { ErrorF("XKB: Failed to compile keymap\n"); goto unwind_info; @@ -612,8 +633,10 @@ InitKeyboardDeviceStruct(DeviceIntPtr dev, XkbRMLVOSet * rmlvo, dev->kbdfeed->CtrlProc(dev, &dev->kbdfeed->ctrl); - XkbSetRulesDflts(rmlvo); - XkbSetRulesUsed(rmlvo); + if (rmlvo) { + XkbSetRulesDflts(rmlvo); + XkbSetRulesUsed(rmlvo); + } XkbFreeRMLVOSet(&rmlvo_dflts, FALSE); return TRUE; @@ -632,6 +655,24 @@ InitKeyboardDeviceStruct(DeviceIntPtr dev, XkbRMLVOSet * rmlvo, return FALSE; } +_X_EXPORT Bool +InitKeyboardDeviceStruct(DeviceIntPtr dev, XkbRMLVOSet * rmlvo, + BellProcPtr bell_func, KbdCtrlProcPtr ctrl_func) +{ + return InitKeyboardDeviceStructInternal(dev, rmlvo, + NULL, 0, bell_func, ctrl_func); +} + +_X_EXPORT Bool +InitKeyboardDeviceStructFromString(DeviceIntPtr dev, + const char *keymap, int keymap_length, + BellProcPtr bell_func, KbdCtrlProcPtr ctrl_func) +{ + return InitKeyboardDeviceStructInternal(dev, NULL, + keymap, keymap_length, + bell_func, ctrl_func); +} + /***====================================================================***/ /* diff --git a/xserver/xkb/xkbUtils.c b/xserver/xkb/xkbUtils.c index 6c6af60f0..c14a790df 100644 --- a/xserver/xkb/xkbUtils.c +++ b/xserver/xkb/xkbUtils.c @@ -1999,34 +1999,40 @@ XkbCopyKeymap(XkbDescPtr dst, XkbDescPtr src) } Bool -XkbCopyDeviceKeymap(DeviceIntPtr dst, DeviceIntPtr src) +XkbDeviceApplyKeymap(DeviceIntPtr dst, XkbDescPtr desc) { xkbNewKeyboardNotify nkn; Bool ret; - if (!dst->key || !src->key) + if (!dst->key || !desc) return FALSE; memset(&nkn, 0, sizeof(xkbNewKeyboardNotify)); nkn.oldMinKeyCode = dst->key->xkbInfo->desc->min_key_code; nkn.oldMaxKeyCode = dst->key->xkbInfo->desc->max_key_code; nkn.deviceID = dst->id; - nkn.oldDeviceID = dst->id; /* maybe src->id? */ - nkn.minKeyCode = src->key->xkbInfo->desc->min_key_code; - nkn.maxKeyCode = src->key->xkbInfo->desc->max_key_code; + nkn.oldDeviceID = dst->id; + nkn.minKeyCode = desc->min_key_code; + nkn.maxKeyCode = desc->max_key_code; nkn.requestMajor = XkbReqCode; nkn.requestMinor = X_kbSetMap; /* Near enough's good enough. */ nkn.changed = XkbNKN_KeycodesMask; - if (src->key->xkbInfo->desc->geom) + if (desc->geom) nkn.changed |= XkbNKN_GeometryMask; - ret = XkbCopyKeymap(dst->key->xkbInfo->desc, src->key->xkbInfo->desc); + ret = XkbCopyKeymap(dst->key->xkbInfo->desc, desc); if (ret) XkbSendNewKeyboardNotify(dst, &nkn); return ret; } +Bool +XkbCopyDeviceKeymap(DeviceIntPtr dst, DeviceIntPtr src) +{ + return XkbDeviceApplyKeymap(dst, src->key->xkbInfo->desc); +} + int XkbGetEffectiveGroup(XkbSrvInfoPtr xkbi, XkbStatePtr xkbState, CARD8 keycode) { @@ -2090,3 +2096,26 @@ XkbMergeLockedPtrBtns(DeviceIntPtr master) xkbi->lockedPtrButtons |= d->key->xkbInfo->lockedPtrButtons; } } + +void +XkbCopyControls(XkbDescPtr dst, XkbDescPtr src) +{ + int i, nG, nTG; + + if (!dst || !src) + return; + + *dst->ctrls = *src->ctrls; + + for (nG = nTG = 0, i = dst->min_key_code; i <= dst->max_key_code; i++) { + nG = XkbKeyNumGroups(dst, i); + if (nG >= XkbNumKbdGroups) { + nTG = XkbNumKbdGroups; + break; + } + if (nG > nTG) { + nTG = nG; + } + } + dst->ctrls->num_groups = nTG; +} diff --git a/xserver/xkb/xkbtext.c b/xserver/xkb/xkbtext.c index 08b129fe6..308e119f5 100644 --- a/xserver/xkb/xkbtext.c +++ b/xserver/xkb/xkbtext.c @@ -6,19 +6,19 @@ fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting - documentation, and that the name of Silicon Graphics not be - used in advertising or publicity pertaining to distribution + documentation, and that the name of Silicon Graphics not be + used in advertising or publicity pertaining to distribution of the software without specific prior written permission. - Silicon Graphics makes no representation about the suitability + Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. - - SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS - SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + + SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS + SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON - GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL - DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE + GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL + DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. @@ -144,18 +144,18 @@ char * XkbVModMaskText(XkbDescPtr xkb, unsigned modMask, unsigned mask, unsigned format) { -register int i,bit; -int len; -char *mm,*rtrn; -char *str,buf[BUFFER_SIZE]; + register int i, bit; + int len; + char *mm, *rtrn; + char *str, buf[BUFFER_SIZE]; -if ((modMask == 0) && (mask == 0)) { - rtrn = tbGetBuffer(5); - if (format == XkbCFile) - snprintf(rtrn, 5, "0"); - else - snprintf(rtrn, 5, "none"); - return rtrn; + if ((modMask == 0) && (mask == 0)) { + rtrn = tbGetBuffer(5); + if (format == XkbCFile) + snprintf(rtrn, 5, "0"); + else + snprintf(rtrn, 5, "none"); + return rtrn; } if (modMask != 0) mm = XkbModMaskText(modMask, format); @@ -165,36 +165,38 @@ if ((modMask == 0) && (mask == 0)) { str = buf; buf[0] = '\0'; if (mask) { - char *tmp; - for (i = 0, bit = 1; i < XkbNumVirtualMods; i++, bit <<= 1) { - if (mask&bit) { - tmp = XkbVModIndexText(xkb, i, format); - len = strlen(tmp) + 1 + (str == buf ? 0 : 1); - if (format == XkbCFile) - len += 4; - if ((str - (buf + len)) <= BUFFER_SIZE) { - if (str != buf) { - if (format == XkbCFile) + char *tmp; + + for (i = 0, bit = 1; i < XkbNumVirtualMods; i++, bit <<= 1) { + if (mask & bit) { + tmp = XkbVModIndexText(xkb, i, format); + len = strlen(tmp) + 1 + (str == buf ? 0 : 1); + if (format == XkbCFile) + len += 4; + if ((str - (buf + len)) <= BUFFER_SIZE) { + if (str != buf) { + if (format == XkbCFile) *str++ = '|'; - else + else *str++ = '+'; - len--; - } - } - if (format == XkbCFile) - snprintf(str, BUFFER_SIZE - len, "%sMask", tmp); - else + len--; + } + } + if (format == XkbCFile) + snprintf(str, BUFFER_SIZE - len, "%sMask", tmp); + else strcpy(str, tmp); - str = &str[len-1]; - } - } - str = buf; + str = &str[len - 1]; + } + } + str = buf; } - else str = NULL; + else + str = NULL; if (mm) - len = strlen(mm); + len = strlen(mm); else - len= 0; + len = 0; if (str) len += strlen(str) + (mm == NULL ? 0 : 1); if (len >= BUFFER_SIZE) diff --git a/xserver/xkb/xkmread.c b/xserver/xkb/xkmread.c index 258bb91b5..b6241b5c7 100644 --- a/xserver/xkb/xkmread.c +++ b/xserver/xkb/xkmread.c @@ -1204,7 +1204,8 @@ XkmReadTOC(FILE * file, xkmFileInfo * file_info, int max_toc, } return 0; } - fread(file_info, SIZEOF(xkmFileInfo), 1, file); + if (fread(file_info, SIZEOF(xkmFileInfo), 1, file) != 1) + return 0; size_toc = file_info->num_toc; if (size_toc > max_toc) { DebugF("Warning! Too many TOC entries; last %d ignored\n", @@ -1212,7 +1213,8 @@ XkmReadTOC(FILE * file, xkmFileInfo * file_info, int max_toc, size_toc = max_toc; } for (i = 0; i < size_toc; i++) { - fread(&toc[i], SIZEOF(xkmSectionInfo), 1, file); + if (fread(&toc[i], SIZEOF(xkmSectionInfo), 1, file) != 1) + return 0; } return 1; } |