diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2014-05-02 19:27:52 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2014-05-02 19:27:52 +0000 |
commit | b9676a49e5a29d619bcd8402e4541d7749197922 (patch) | |
tree | 67cdb12cda42de5facadc0a36125a32354b3bc29 /xserver/miext | |
parent | fbf6414f58c54aab6ef37e4d066bb2699f118269 (diff) |
Update to xserver 1.15.1.
Tested by at least ajacoutot@, dcoppa@ & jasper@
Diffstat (limited to 'xserver/miext')
27 files changed, 1290 insertions, 203 deletions
diff --git a/xserver/miext/Makefile.in b/xserver/miext/Makefile.in index ec48d3ca2..99b349d27 100644 --- a/xserver/miext/Makefile.in +++ b/xserver/miext/Makefile.in @@ -185,9 +185,12 @@ 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@ @@ -219,6 +222,7 @@ 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@ @@ -248,6 +252,8 @@ 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@ @@ -291,6 +297,7 @@ 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@ @@ -304,12 +311,12 @@ SET_MAKE = @SET_MAKE@ SHA1_CFLAGS = @SHA1_CFLAGS@ SHA1_LIBS = @SHA1_LIBS@ SHELL = @SHELL@ -SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ SYSCONFDIR = @SYSCONFDIR@ +TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ UDEV_CFLAGS = @UDEV_CFLAGS@ @@ -375,6 +382,8 @@ 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@ diff --git a/xserver/miext/damage/Makefile.am b/xserver/miext/damage/Makefile.am index 767a65aee..a7f432a61 100644 --- a/xserver/miext/damage/Makefile.am +++ b/xserver/miext/damage/Makefile.am @@ -2,7 +2,7 @@ noinst_LTLIBRARIES = libdamage.la AM_CFLAGS = $(DIX_CFLAGS) -INCLUDES = -I$(srcdir)/../cw +AM_CPPFLAGS = -I$(srcdir)/../cw if XORG sdk_HEADERS = damage.h damagestr.h diff --git a/xserver/miext/damage/Makefile.in b/xserver/miext/damage/Makefile.in index fdcd1d9d2..5d7680dd2 100644 --- a/xserver/miext/damage/Makefile.in +++ b/xserver/miext/damage/Makefile.in @@ -209,9 +209,12 @@ 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@ @@ -243,6 +246,7 @@ 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@ @@ -272,6 +276,8 @@ 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@ @@ -315,6 +321,7 @@ 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@ @@ -328,12 +335,12 @@ SET_MAKE = @SET_MAKE@ SHA1_CFLAGS = @SHA1_CFLAGS@ SHA1_LIBS = @SHA1_LIBS@ SHELL = @SHELL@ -SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ SYSCONFDIR = @SYSCONFDIR@ +TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ UDEV_CFLAGS = @UDEV_CFLAGS@ @@ -399,6 +406,8 @@ 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@ @@ -479,7 +488,7 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ noinst_LTLIBRARIES = libdamage.la AM_CFLAGS = $(DIX_CFLAGS) -INCLUDES = -I$(srcdir)/../cw +AM_CPPFLAGS = -I$(srcdir)/../cw @XORG_TRUE@sdk_HEADERS = damage.h damagestr.h libdamage_la_SOURCES = \ damage.c \ diff --git a/xserver/miext/damage/damage.c b/xserver/miext/damage/damage.c index 3dc3180f3..173fe5070 100644 --- a/xserver/miext/damage/damage.c +++ b/xserver/miext/damage/damage.c @@ -119,51 +119,6 @@ getDrawableDamageRef(DrawablePtr pDrawable) DamagePtr *pPrev = (DamagePtr *) \ dixLookupPrivateAddr(&(pWindow)->devPrivates, damageWinPrivateKey) -static void -damageReportDamagePostRendering(DamagePtr pDamage, RegionPtr pOldDamage, - RegionPtr pDamageRegion) -{ - BoxRec tmpBox; - RegionRec tmpRegion, newDamage; - Bool was_empty; - - RegionUnion(&newDamage, pOldDamage, pDamageRegion); - - switch (pDamage->damageLevel) { - case DamageReportRawRegion: - (*pDamage->damageReportPostRendering) (pDamage, pDamageRegion, - pDamage->closure); - break; - case DamageReportDeltaRegion: - RegionNull(&tmpRegion); - RegionSubtract(&tmpRegion, pDamageRegion, pOldDamage); - if (RegionNotEmpty(&tmpRegion)) { - (*pDamage->damageReportPostRendering) (pDamage, &tmpRegion, - pDamage->closure); - } - RegionUninit(&tmpRegion); - break; - case DamageReportBoundingBox: - tmpBox = *RegionExtents(pOldDamage); - if (!BOX_SAME(&tmpBox, RegionExtents(&newDamage))) { - (*pDamage->damageReportPostRendering) (pDamage, &newDamage, - pDamage->closure); - } - break; - case DamageReportNonEmpty: - was_empty = !RegionNotEmpty(pOldDamage); - if (was_empty && RegionNotEmpty(&newDamage)) { - (*pDamage->damageReportPostRendering) (pDamage, &newDamage, - pDamage->closure); - } - break; - case DamageReportNone: - break; - } - - RegionUninit(&newDamage); -} - #if DAMAGE_DEBUG_ENABLE static void _damageRegionAppend(DrawablePtr pDrawable, RegionPtr pRegion, Bool clip, @@ -299,14 +254,10 @@ damageRegionAppend(DrawablePtr pDrawable, RegionPtr pRegion, Bool clip, RegionTranslate(pDamageRegion, -draw_x, -draw_y); /* Store damage region if needed after submission. */ - if (pDamage->reportAfter || pDamage->damageMarker) + if (pDamage->reportAfter) RegionUnion(&pDamage->pendingDamage, &pDamage->pendingDamage, pDamageRegion); - /* Duplicate current damage if needed. */ - if (pDamage->damageMarker) - RegionCopy(&pDamage->backupDamage, &pDamage->damage); - /* Report damage now, if desired. */ if (!pDamage->reportAfter) { if (pDamage->damageReport) @@ -335,12 +286,6 @@ damageRegionProcessPending(DrawablePtr pDrawable) drawableDamage(pDrawable); for (; pDamage != NULL; pDamage = pDamage->pNext) { - /* submit damage marker whenever possible. */ - if (pDamage->damageMarker) - (*pDamage->damageMarker) (pDrawable, pDamage, - &pDamage->backupDamage, - &pDamage->pendingDamage, - pDamage->closure); if (pDamage->reportAfter) { /* It's possible that there is only interest in postRendering reporting. */ if (pDamage->damageReport) @@ -350,10 +295,8 @@ damageRegionProcessPending(DrawablePtr pDrawable) &pDamage->pendingDamage); } - if (pDamage->reportAfter || pDamage->damageMarker) + if (pDamage->reportAfter) RegionEmpty(&pDamage->pendingDamage); - if (pDamage->damageMarker) - RegionEmpty(&pDamage->backupDamage); } } @@ -1333,7 +1276,7 @@ damageDamageChars(DrawablePtr pDrawable, #define TT_POLY16 2 #define TT_IMAGE16 3 -static int +static void damageText(DrawablePtr pDrawable, GCPtr pGC, int x, @@ -1342,39 +1285,29 @@ damageText(DrawablePtr pDrawable, char *chars, FontEncoding fontEncoding, Bool textType) { CharInfoPtr *charinfo; - CharInfoPtr *info; unsigned long i; unsigned int n; - int w; Bool imageblt; imageblt = (textType == TT_IMAGE8) || (textType == TT_IMAGE16); + if (!checkGCDamage(pDrawable, pGC)) + return; + charinfo = malloc(count * sizeof(CharInfoPtr)); if (!charinfo) - return x; + return; GetGlyphs(pGC->font, count, (unsigned char *) chars, fontEncoding, &i, charinfo); n = (unsigned int) i; - w = 0; - if (!imageblt) - for (info = charinfo; i--; info++) - w += (*info)->metrics.characterWidth; if (n != 0) { damageDamageChars(pDrawable, pGC->font, x + pDrawable->x, y + pDrawable->y, n, charinfo, imageblt, pGC->subWindowMode); - if (imageblt) - (*pGC->ops->ImageGlyphBlt) (pDrawable, pGC, x, y, n, charinfo, - FONTGLYPHS(pGC->font)); - else - (*pGC->ops->PolyGlyphBlt) (pDrawable, pGC, x, y, n, charinfo, - FONTGLYPHS(pGC->font)); } free(charinfo); - return x + w; } static int @@ -1382,12 +1315,9 @@ damagePolyText8(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, char *chars) { DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable); - - if (checkGCDamage(pDrawable, pGC)) - x = damageText(pDrawable, pGC, x, y, (unsigned long) count, chars, - Linear8Bit, TT_POLY8); - else - x = (*pGC->ops->PolyText8) (pDrawable, pGC, x, y, count, chars); + damageText(pDrawable, pGC, x, y, (unsigned long) count, chars, Linear8Bit, + TT_POLY8); + x = (*pGC->ops->PolyText8) (pDrawable, pGC, x, y, count, chars); damageRegionProcessPending(pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); return x; @@ -1398,14 +1328,10 @@ damagePolyText16(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, unsigned short *chars) { DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable); - - if (checkGCDamage(pDrawable, pGC)) - x = damageText(pDrawable, pGC, x, y, (unsigned long) count, - (char *) chars, - FONTLASTROW(pGC->font) == 0 ? Linear16Bit : TwoD16Bit, - TT_POLY16); - else - x = (*pGC->ops->PolyText16) (pDrawable, pGC, x, y, count, chars); + damageText(pDrawable, pGC, x, y, (unsigned long) count, (char *) chars, + FONTLASTROW(pGC->font) == 0 ? Linear16Bit : TwoD16Bit, + TT_POLY16); + x = (*pGC->ops->PolyText16) (pDrawable, pGC, x, y, count, chars); damageRegionProcessPending(pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); return x; @@ -1416,12 +1342,9 @@ damageImageText8(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, char *chars) { DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable); - - if (checkGCDamage(pDrawable, pGC)) - damageText(pDrawable, pGC, x, y, (unsigned long) count, chars, - Linear8Bit, TT_IMAGE8); - else - (*pGC->ops->ImageText8) (pDrawable, pGC, x, y, count, chars); + damageText(pDrawable, pGC, x, y, (unsigned long) count, chars, Linear8Bit, + TT_IMAGE8); + (*pGC->ops->ImageText8) (pDrawable, pGC, x, y, count, chars); damageRegionProcessPending(pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); } @@ -1431,13 +1354,10 @@ damageImageText16(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, unsigned short *chars) { DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable); - - if (checkGCDamage(pDrawable, pGC)) - damageText(pDrawable, pGC, x, y, (unsigned long) count, (char *) chars, - FONTLASTROW(pGC->font) == 0 ? Linear16Bit : TwoD16Bit, - TT_IMAGE16); - else - (*pGC->ops->ImageText16) (pDrawable, pGC, x, y, count, chars); + damageText(pDrawable, pGC, x, y, (unsigned long) count, (char *) chars, + FONTLASTROW(pGC->font) == 0 ? Linear16Bit : TwoD16Bit, + TT_IMAGE16); + (*pGC->ops->ImageText16) (pDrawable, pGC, x, y, count, chars); damageRegionProcessPending(pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); } @@ -1634,7 +1554,6 @@ damageDestroyWindow(WindowPtr pWindow) damageScrPriv(pScreen); while ((pDamage = damageGetWinPriv(pWindow))) { - DamageUnregister(&pWindow->drawable, pDamage); DamageDestroy(pDamage); } unwrap(pScrPriv, pScreen, DestroyWindow); @@ -1783,9 +1702,7 @@ DamageCreate(DamageReportFunc damageReport, pDamage->reportAfter = FALSE; pDamage->damageReport = damageReport; - pDamage->damageReportPostRendering = NULL; pDamage->damageDestroy = damageDestroy; - pDamage->damageMarker = NULL; pDamage->pScreen = pScreen; (*pScrPriv->funcs.Create) (pDamage); @@ -1841,8 +1758,9 @@ DamageDrawInternal(ScreenPtr pScreen, Bool enable) } void -DamageUnregister(DrawablePtr pDrawable, DamagePtr pDamage) +DamageUnregister(DamagePtr pDamage) { + DrawablePtr pDrawable = pDamage->pDrawable; ScreenPtr pScreen = pDrawable->pScreen; damageScrPriv(pScreen); @@ -1885,6 +1803,9 @@ DamageDestroy(DamagePtr pDamage) damageScrPriv(pScreen); + if (pDamage->pDrawable) + DamageUnregister(pDamage); + if (pDamage->damageDestroy) (*pDamage->damageDestroy) (pDamage, pDamage->closure); (*pScrPriv->funcs.Destroy) (pDamage); @@ -1953,17 +1874,6 @@ DamageRegionProcessPending(DrawablePtr pDrawable) damageRegionProcessPending(pDrawable); } -/* If a damage marker is provided, then this function must be called after rendering is done. */ -/* Please do call back so any future enhancements can assume this function is called. */ -/* There are no strict timing requirements for calling this function, just as soon as (is cheaply) possible. */ -void -DamageRegionRendered(DrawablePtr pDrawable, DamagePtr pDamage, - RegionPtr pOldDamage, RegionPtr pRegion) -{ - if (pDamage->damageReportPostRendering) - damageReportDamagePostRendering(pDamage, pOldDamage, pRegion); -} - /* This call is very odd, i'm leaving it intact for API sake, but please don't use it. */ void DamageDamageRegion(DrawablePtr pDrawable, RegionPtr pRegion) @@ -1983,15 +1893,6 @@ DamageSetReportAfterOp(DamagePtr pDamage, Bool reportAfter) pDamage->reportAfter = reportAfter; } -void -DamageSetPostRenderingFunctions(DamagePtr pDamage, - DamageReportFunc damageReportPostRendering, - DamageMarkerFunc damageMarker) -{ - pDamage->damageReportPostRendering = damageReportPostRendering; - pDamage->damageMarker = damageMarker; -} - DamageScreenFuncsPtr DamageGetScreenFuncs(ScreenPtr pScreen) { diff --git a/xserver/miext/damage/damage.h b/xserver/miext/damage/damage.h index c2c313a15..525b2db5d 100644 --- a/xserver/miext/damage/damage.h +++ b/xserver/miext/damage/damage.h @@ -41,12 +41,6 @@ typedef void (*DamageReportFunc) (DamagePtr pDamage, RegionPtr pRegion, void *closure); typedef void (*DamageDestroyFunc) (DamagePtr pDamage, void *closure); -/* It's the responsibility of the driver to duplicate both regions. */ -/* At some point DamageRegionRendered() must be called. */ -typedef void (*DamageMarkerFunc) (DrawablePtr pDrawable, DamagePtr pDamage, - RegionPtr pOldDamage, RegionPtr pRegion, - void *closure); - typedef void (*DamageScreenCreateFunc) (DamagePtr); typedef void (*DamageScreenRegisterFunc) (DrawablePtr, DamagePtr); typedef void (*DamageScreenUnregisterFunc) (DrawablePtr, DamagePtr); @@ -80,7 +74,7 @@ extern _X_EXPORT void DamageRegister(DrawablePtr pDrawable, DamagePtr pDamage); extern _X_EXPORT void - DamageUnregister(DrawablePtr pDrawable, DamagePtr pDamage); + DamageUnregister(DamagePtr pDamage); extern _X_EXPORT void DamageDestroy(DamagePtr pDamage); @@ -105,12 +99,6 @@ extern _X_EXPORT void extern _X_EXPORT void DamageRegionProcessPending(DrawablePtr pDrawable); -/* Call this some time after rendering is done, only relevant when a damageMarker is provided. */ -extern _X_EXPORT void - -DamageRegionRendered(DrawablePtr pDrawable, DamagePtr pDamage, - RegionPtr pOldDamage, RegionPtr pRegion); - /* Call this when you create a new Damage and you wish to send an initial damage message (to it). */ extern _X_EXPORT void DamageReportDamage(DamagePtr pDamage, RegionPtr pDamageRegion); @@ -122,12 +110,6 @@ extern _X_EXPORT void extern _X_EXPORT void DamageSetReportAfterOp(DamagePtr pDamage, Bool reportAfter); -extern _X_EXPORT void - -DamageSetPostRenderingFunctions(DamagePtr pDamage, - DamageReportFunc damageReportPostRendering, - DamageMarkerFunc damageMarker); - extern _X_EXPORT DamageScreenFuncsPtr DamageGetScreenFuncs(ScreenPtr); #endif /* _DAMAGE_H_ */ diff --git a/xserver/miext/damage/damagestr.h b/xserver/miext/damage/damagestr.h index 89189905e..36753ee20 100644 --- a/xserver/miext/damage/damagestr.h +++ b/xserver/miext/damage/damagestr.h @@ -44,13 +44,10 @@ typedef struct _damage { DrawablePtr pDrawable; DamageReportFunc damageReport; - DamageReportFunc damageReportPostRendering; DamageDestroyFunc damageDestroy; - DamageMarkerFunc damageMarker; Bool reportAfter; RegionRec pendingDamage; /* will be flushed post submission at the latest */ - RegionRec backupDamage; /* for use with damageMarker */ ScreenPtr pScreen; PrivateRec *devPrivates; } DamageRec; diff --git a/xserver/miext/rootless/Makefile.in b/xserver/miext/rootless/Makefile.in index 33f7c5253..5dde41557 100644 --- a/xserver/miext/rootless/Makefile.in +++ b/xserver/miext/rootless/Makefile.in @@ -179,9 +179,12 @@ 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@ @@ -213,6 +216,7 @@ 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@ @@ -242,6 +246,8 @@ 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@ @@ -285,6 +291,7 @@ 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@ @@ -298,12 +305,12 @@ SET_MAKE = @SET_MAKE@ SHA1_CFLAGS = @SHA1_CFLAGS@ SHA1_LIBS = @SHA1_LIBS@ SHELL = @SHELL@ -SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ SYSCONFDIR = @SYSCONFDIR@ +TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ UDEV_CFLAGS = @UDEV_CFLAGS@ @@ -369,6 +376,8 @@ 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@ diff --git a/xserver/miext/rootless/rootlessWindow.c b/xserver/miext/rootless/rootlessWindow.c index cfcb6e558..7e3c28130 100644 --- a/xserver/miext/rootless/rootlessWindow.c +++ b/xserver/miext/rootless/rootlessWindow.c @@ -684,7 +684,7 @@ RootlessResizeCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, if (gResizeDeathCount == 1) { /* Simple case, we only have a single source pixmap. */ - fbCopyRegion(&gResizeDeathPix[0]->drawable, + miCopyRegion(&gResizeDeathPix[0]->drawable, &pScreen->GetWindowPixmap(pWin)->drawable, 0, &rgnDst, dx, dy, fbCopyWindowProc, 0, 0); } @@ -700,7 +700,7 @@ RootlessResizeCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionNull(&clipped); RegionIntersect(&rgnDst, &clip, &clipped); - fbCopyRegion(&gResizeDeathPix[i]->drawable, + miCopyRegion(&gResizeDeathPix[i]->drawable, &pScreen->GetWindowPixmap(pWin)->drawable, 0, &clipped, dx, dy, fbCopyWindowProc, 0, 0); @@ -778,7 +778,7 @@ RootlessCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) else { RootlessStartDrawing(pWin); - fbCopyRegion((DrawablePtr) pWin, (DrawablePtr) pWin, + miCopyRegion((DrawablePtr) pWin, (DrawablePtr) pWin, 0, &rgnDst, dx, dy, fbCopyWindowProc, 0, 0); /* prgnSrc has been translated to dst position */ diff --git a/xserver/miext/shadow/Makefile.am b/xserver/miext/shadow/Makefile.am index 30f7bda96..27cf41422 100644 --- a/xserver/miext/shadow/Makefile.am +++ b/xserver/miext/shadow/Makefile.am @@ -7,9 +7,14 @@ sdk_HEADERS = shadow.h endif libshadow_la_SOURCES = \ + c2p_core.h \ shadow.c \ shadow.h \ + shafb4.c \ + shafb8.c \ shalloc.c \ + shiplan2p4.c \ + shiplan2p8.c \ shpacked.c \ shplanar8.c \ shplanar.c \ diff --git a/xserver/miext/shadow/Makefile.in b/xserver/miext/shadow/Makefile.in index 7655cdec7..6c5b9dba3 100644 --- a/xserver/miext/shadow/Makefile.in +++ b/xserver/miext/shadow/Makefile.in @@ -75,8 +75,9 @@ CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libshadow_la_LIBADD = -am_libshadow_la_OBJECTS = shadow.lo shalloc.lo shpacked.lo \ - shplanar8.lo shplanar.lo shrot16pack_180.lo shrot16pack_270.lo \ +am_libshadow_la_OBJECTS = shadow.lo shafb4.lo shafb8.lo shalloc.lo \ + shiplan2p4.lo shiplan2p8.lo shpacked.lo shplanar8.lo \ + shplanar.lo shrot16pack_180.lo shrot16pack_270.lo \ shrot16pack_270YX.lo shrot16pack_90.lo shrot16pack_90YX.lo \ shrot16pack.lo shrot32pack_180.lo shrot32pack_270.lo \ shrot32pack_90.lo shrot32pack.lo shrot8pack_180.lo \ @@ -214,9 +215,12 @@ 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@ @@ -248,6 +252,7 @@ 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@ @@ -277,6 +282,8 @@ 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@ @@ -320,6 +327,7 @@ 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@ @@ -333,12 +341,12 @@ SET_MAKE = @SET_MAKE@ SHA1_CFLAGS = @SHA1_CFLAGS@ SHA1_LIBS = @SHA1_LIBS@ SHELL = @SHELL@ -SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ SYSCONFDIR = @SYSCONFDIR@ +TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ UDEV_CFLAGS = @UDEV_CFLAGS@ @@ -404,6 +412,8 @@ 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@ @@ -486,9 +496,14 @@ noinst_LTLIBRARIES = libshadow.la AM_CFLAGS = $(DIX_CFLAGS) @XORG_TRUE@sdk_HEADERS = shadow.h libshadow_la_SOURCES = \ + c2p_core.h \ shadow.c \ shadow.h \ + shafb4.c \ + shafb8.c \ shalloc.c \ + shiplan2p4.c \ + shiplan2p8.c \ shpacked.c \ shplanar8.c \ shplanar.c \ @@ -565,7 +580,11 @@ distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shadow.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shafb4.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shafb8.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shalloc.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shiplan2p4.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shiplan2p8.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shpacked.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shplanar.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shplanar8.Plo@am__quote@ diff --git a/xserver/miext/shadow/c2p_core.h b/xserver/miext/shadow/c2p_core.h new file mode 100644 index 000000000..5b9ea066c --- /dev/null +++ b/xserver/miext/shadow/c2p_core.h @@ -0,0 +1,187 @@ +/* + * Fast C2P (Chunky-to-Planar) Conversion + * + * NOTES: + * - This code was inspired by Scout's C2P tutorial + * - It assumes to run on a big endian system + * + * Copyright © 2003-2008 Geert Uytterhoeven + * + * 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. + */ + + + /* + * Basic transpose step + */ + +static inline void _transp(CARD32 d[], unsigned int i1, unsigned int i2, + unsigned int shift, CARD32 mask) +{ + CARD32 t = (d[i1] ^ (d[i2] >> shift)) & mask; + + d[i1] ^= t; + d[i2] ^= t << shift; +} + + +static inline void c2p_unsupported(void) { + BUG_WARN(1); +} + +static inline CARD32 get_mask(unsigned int n) +{ + switch (n) { + case 1: + return 0x55555555; + + case 2: + return 0x33333333; + + case 4: + return 0x0f0f0f0f; + + case 8: + return 0x00ff00ff; + + case 16: + return 0x0000ffff; + } + + c2p_unsupported(); + return 0; +} + + + /* + * Transpose operations on 8 32-bit words + */ + +static inline void transp8(CARD32 d[], unsigned int n, unsigned int m) +{ + CARD32 mask = get_mask(n); + + switch (m) { + case 1: + /* First n x 1 block */ + _transp(d, 0, 1, n, mask); + /* Second n x 1 block */ + _transp(d, 2, 3, n, mask); + /* Third n x 1 block */ + _transp(d, 4, 5, n, mask); + /* Fourth n x 1 block */ + _transp(d, 6, 7, n, mask); + return; + + case 2: + /* First n x 2 block */ + _transp(d, 0, 2, n, mask); + _transp(d, 1, 3, n, mask); + /* Second n x 2 block */ + _transp(d, 4, 6, n, mask); + _transp(d, 5, 7, n, mask); + return; + + case 4: + /* Single n x 4 block */ + _transp(d, 0, 4, n, mask); + _transp(d, 1, 5, n, mask); + _transp(d, 2, 6, n, mask); + _transp(d, 3, 7, n, mask); + return; + } + + c2p_unsupported(); +} + + + /* + * Transpose operations on 4 32-bit words + */ + +static inline void transp4(CARD32 d[], unsigned int n, unsigned int m) +{ + CARD32 mask = get_mask(n); + + switch (m) { + case 1: + /* First n x 1 block */ + _transp(d, 0, 1, n, mask); + /* Second n x 1 block */ + _transp(d, 2, 3, n, mask); + return; + + case 2: + /* Single n x 2 block */ + _transp(d, 0, 2, n, mask); + _transp(d, 1, 3, n, mask); + return; + } + + c2p_unsupported(); +} + + + /* + * Transpose operations on 4 32-bit words (reverse order) + */ + +static inline void transp4x(CARD32 d[], unsigned int n, unsigned int m) +{ + CARD32 mask = get_mask(n); + + switch (m) { + case 2: + /* Single n x 2 block */ + _transp(d, 2, 0, n, mask); + _transp(d, 3, 1, n, mask); + return; + } + + c2p_unsupported(); +} + + + /* + * Transpose operations on 2 32-bit words + */ + +static inline void transp2(CARD32 d[], unsigned int n) +{ + CARD32 mask = get_mask(n); + + /* Single n x 1 block */ + _transp(d, 0, 1, n, mask); + return; +} + + + /* + * Transpose operations on 2 32-bit words (reverse order) + */ + +static inline void transp2x(CARD32 d[], unsigned int n) +{ + CARD32 mask = get_mask(n); + + /* Single n x 1 block */ + _transp(d, 1, 0, n, mask); + return; +} diff --git a/xserver/miext/shadow/shadow.c b/xserver/miext/shadow/shadow.c index 2d869e54b..1a9088c43 100644 --- a/xserver/miext/shadow/shadow.c +++ b/xserver/miext/shadow/shadow.c @@ -219,7 +219,7 @@ shadowRemove(ScreenPtr pScreen, PixmapPtr pPixmap) shadowBuf(pScreen); if (pBuf->pPixmap) { - DamageUnregister(&pBuf->pPixmap->drawable, pBuf->pDamage); + DamageUnregister(pBuf->pDamage); pBuf->update = 0; pBuf->window = 0; pBuf->randr = 0; diff --git a/xserver/miext/shadow/shadow.h b/xserver/miext/shadow/shadow.h index 83de22ccc..421ae96a6 100644 --- a/xserver/miext/shadow/shadow.h +++ b/xserver/miext/shadow/shadow.h @@ -96,6 +96,18 @@ shadowInit(ScreenPtr pScreen, ShadowUpdateProc update, ShadowWindowProc window); extern _X_EXPORT void *shadowAlloc(int width, int height, int bpp); extern _X_EXPORT void + shadowUpdateAfb4(ScreenPtr pScreen, shadowBufPtr pBuf); + +extern _X_EXPORT void + shadowUpdateAfb8(ScreenPtr pScreen, shadowBufPtr pBuf); + +extern _X_EXPORT void + shadowUpdateIplan2p4(ScreenPtr pScreen, shadowBufPtr pBuf); + +extern _X_EXPORT void + shadowUpdateIplan2p8(ScreenPtr pScreen, shadowBufPtr pBuf); + +extern _X_EXPORT void shadowUpdatePacked(ScreenPtr pScreen, shadowBufPtr pBuf); extern _X_EXPORT void diff --git a/xserver/miext/shadow/shafb4.c b/xserver/miext/shadow/shafb4.c new file mode 100644 index 000000000..d88ae1c2c --- /dev/null +++ b/xserver/miext/shadow/shafb4.c @@ -0,0 +1,139 @@ +/* + * Copyright © 2013 Geert Uytterhoeven + * + * 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. + * + * Based on shpacked.c, which is Copyright © 2000 Keith Packard + */ + +#ifdef HAVE_DIX_CONFIG_H +#include <dix-config.h> +#endif + +#include <stdlib.h> + +#include <X11/X.h> +#include "scrnintstr.h" +#include "windowstr.h" +#include <X11/fonts/font.h> +#include "dixfontstr.h" +#include <X11/fonts/fontstruct.h> +#include "mi.h" +#include "regionstr.h" +#include "globals.h" +#include "gcstruct.h" +#include "shadow.h" +#include "fb.h" +#include "c2p_core.h" + + + /* + * Perform a full C2P step on 32 4-bit pixels, stored in 4 32-bit words + * containing + * - 32 4-bit chunky pixels on input + * - permutated planar data (1 plane per 32-bit word) on output + */ + +static void c2p_32x4(CARD32 d[4]) +{ + transp4(d, 16, 2); + transp4(d, 8, 1); + transp4(d, 4, 2); + transp4(d, 2, 1); + transp4(d, 1, 2); +} + + + /* + * Store a full block of permutated planar data after c2p conversion + */ + +static inline void store_afb4(void *dst, unsigned int stride, + const CARD32 d[4]) +{ + CARD8 *p = dst; + + *(CARD32 *)p = d[3]; p += stride; + *(CARD32 *)p = d[1]; p += stride; + *(CARD32 *)p = d[2]; p += stride; + *(CARD32 *)p = d[0]; p += stride; +} + + +void +shadowUpdateAfb4(ScreenPtr pScreen, shadowBufPtr pBuf) +{ + RegionPtr damage = shadowDamage(pBuf); + PixmapPtr pShadow = pBuf->pPixmap; + int nbox = RegionNumRects(damage); + BoxPtr pbox = RegionRects(damage); + FbBits *shaBase; + CARD32 *shaLine, *sha; + FbStride shaStride; + int scrLine; + _X_UNUSED int shaBpp, shaXoff, shaYoff; + int x, y, w, h; + int i, n; + CARD32 *win; + CARD32 off, winStride; + union { + CARD8 bytes[16]; + CARD32 words[4]; + } d; + + fbGetDrawable(&pShadow->drawable, shaBase, shaStride, shaBpp, shaXoff, + shaYoff); + if (sizeof(FbBits) != sizeof(CARD32)) + shaStride = shaStride * sizeof(FbBits) / sizeof(CARD32); + + while (nbox--) { + x = pbox->x1; + y = pbox->y1; + w = pbox->x2 - pbox->x1; + h = pbox->y2 - pbox->y1; + + scrLine = (x & -32) / 2; + shaLine = (CARD32 *)shaBase + y * shaStride + scrLine / sizeof(CARD32); + + off = scrLine / 4; /* byte offset in bitplane scanline */ + n = ((x & 31) + w + 31) / 32; /* number of c2p units in scanline */ + + while (h--) { + sha = shaLine; + win = (CARD32 *) (*pBuf->window) (pScreen, + y, + off, + SHADOW_WINDOW_WRITE, + &winStride, + pBuf->closure); + if (!win) + return; + for (i = 0; i < n; i++) { + memcpy(d.bytes, sha, sizeof(d.bytes)); + c2p_32x4(d.words); + store_afb4(win++, winStride, d.words); + sha += sizeof(d.bytes) / sizeof(*sha); + } + shaLine += shaStride; + y++; + } + pbox++; + } +} diff --git a/xserver/miext/shadow/shafb8.c b/xserver/miext/shadow/shafb8.c new file mode 100644 index 000000000..8d84bfa01 --- /dev/null +++ b/xserver/miext/shadow/shafb8.c @@ -0,0 +1,143 @@ +/* + * Copyright © 2013 Geert Uytterhoeven + * + * 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. + * + * Based on shpacked.c, which is Copyright © 2000 Keith Packard + */ + +#ifdef HAVE_DIX_CONFIG_H +#include <dix-config.h> +#endif + +#include <stdlib.h> + +#include <X11/X.h> +#include "scrnintstr.h" +#include "windowstr.h" +#include <X11/fonts/font.h> +#include "dixfontstr.h" +#include <X11/fonts/fontstruct.h> +#include "mi.h" +#include "regionstr.h" +#include "globals.h" +#include "gcstruct.h" +#include "shadow.h" +#include "fb.h" +#include "c2p_core.h" + + + /* + * Perform a full C2P step on 32 8-bit pixels, stored in 8 32-bit words + * containing + * - 32 8-bit chunky pixels on input + * - permutated planar data (1 plane per 32-bit word) on output + */ + +static void c2p_32x8(CARD32 d[8]) +{ + transp8(d, 16, 4); + transp8(d, 8, 2); + transp8(d, 4, 1); + transp8(d, 2, 4); + transp8(d, 1, 2); +} + + + /* + * Store a full block of permutated planar data after c2p conversion + */ + +static inline void store_afb8(void *dst, unsigned int stride, + const CARD32 d[8]) +{ + CARD8 *p = dst; + + *(CARD32 *)p = d[7]; p += stride; + *(CARD32 *)p = d[5]; p += stride; + *(CARD32 *)p = d[3]; p += stride; + *(CARD32 *)p = d[1]; p += stride; + *(CARD32 *)p = d[6]; p += stride; + *(CARD32 *)p = d[4]; p += stride; + *(CARD32 *)p = d[2]; p += stride; + *(CARD32 *)p = d[0]; p += stride; +} + + +void +shadowUpdateAfb8(ScreenPtr pScreen, shadowBufPtr pBuf) +{ + RegionPtr damage = shadowDamage(pBuf); + PixmapPtr pShadow = pBuf->pPixmap; + int nbox = RegionNumRects(damage); + BoxPtr pbox = RegionRects(damage); + FbBits *shaBase; + CARD32 *shaLine, *sha; + FbStride shaStride; + int scrLine; + _X_UNUSED int shaBpp, shaXoff, shaYoff; + int x, y, w, h; + int i, n; + CARD32 *win; + CARD32 off, winStride; + union { + CARD8 bytes[32]; + CARD32 words[8]; + } d; + + fbGetDrawable(&pShadow->drawable, shaBase, shaStride, shaBpp, shaXoff, + shaYoff); + if (sizeof(FbBits) != sizeof(CARD32)) + shaStride = shaStride * sizeof(FbBits) / sizeof(CARD32); + + while (nbox--) { + x = pbox->x1; + y = pbox->y1; + w = pbox->x2 - pbox->x1; + h = pbox->y2 - pbox->y1; + + scrLine = x & -32; + shaLine = (CARD32 *)shaBase + y * shaStride + scrLine / sizeof(CARD32); + + off = scrLine / 8; /* byte offset in bitplane scanline */ + n = ((x & 31) + w + 31) / 32; /* number of c2p units in scanline */ + + while (h--) { + sha = shaLine; + win = (CARD32 *) (*pBuf->window) (pScreen, + y, + off, + SHADOW_WINDOW_WRITE, + &winStride, + pBuf->closure); + if (!win) + return; + for (i = 0; i < n; i++) { + memcpy(d.bytes, sha, sizeof(d.bytes)); + c2p_32x8(d.words); + store_afb8(win++, winStride, d.words); + sha += sizeof(d.bytes) / sizeof(*sha); + } + shaLine += shaStride; + y++; + } + pbox++; + } +} diff --git a/xserver/miext/shadow/shiplan2p4.c b/xserver/miext/shadow/shiplan2p4.c new file mode 100644 index 000000000..0e46bae7a --- /dev/null +++ b/xserver/miext/shadow/shiplan2p4.c @@ -0,0 +1,136 @@ +/* + * Copyright © 2013 Geert Uytterhoeven + * + * 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. + * + * Based on shpacked.c, which is Copyright © 2000 Keith Packard + */ + +#ifdef HAVE_DIX_CONFIG_H +#include <dix-config.h> +#endif + +#include <stdlib.h> + +#include <X11/X.h> +#include "scrnintstr.h" +#include "windowstr.h" +#include <X11/fonts/font.h> +#include "dixfontstr.h" +#include <X11/fonts/fontstruct.h> +#include "mi.h" +#include "regionstr.h" +#include "globals.h" +#include "gcstruct.h" +#include "shadow.h" +#include "fb.h" +#include "c2p_core.h" + + + /* + * Perform a full C2P step on 16 4-bit pixels, stored in 2 32-bit words + * containing + * - 16 4-bit chunky pixels on input + * - permutated planar data (2 planes per 32-bit word) on output + */ + +static void c2p_16x4(CARD32 d[2]) +{ + transp2(d, 8); + transp2(d, 2); + transp2x(d, 1); + transp2(d, 16); + transp2(d, 4); + transp2(d, 1); +} + + + /* + * Store a full block of iplan2p4 data after c2p conversion + */ + +static inline void store_iplan2p4(void *dst, const CARD32 d[2]) +{ + CARD32 *p = dst; + + *p++ = d[0]; + *p++ = d[1]; +} + + +void +shadowUpdateIplan2p4(ScreenPtr pScreen, shadowBufPtr pBuf) +{ + RegionPtr damage = shadowDamage(pBuf); + PixmapPtr pShadow = pBuf->pPixmap; + int nbox = RegionNumRects(damage); + BoxPtr pbox = RegionRects(damage); + FbBits *shaBase; + CARD16 *shaLine, *sha; + FbStride shaStride; + int scrLine; + _X_UNUSED int shaBpp, shaXoff, shaYoff; + int x, y, w, h; + int i, n; + CARD16 *win; + _X_UNUSED CARD32 winSize; + union { + CARD8 bytes[8]; + CARD32 words[2]; + } d; + + fbGetDrawable(&pShadow->drawable, shaBase, shaStride, shaBpp, shaXoff, + shaYoff); + shaStride *= sizeof(FbBits) / sizeof(CARD16); + + while (nbox--) { + x = pbox->x1; + y = pbox->y1; + w = pbox->x2 - pbox->x1; + h = pbox->y2 - pbox->y1; + + scrLine = (x & -16) / 2; + shaLine = (CARD16 *)shaBase + y * shaStride + scrLine / sizeof(CARD16); + + n = ((x & 15) + w + 15) / 16; /* number of c2p units in scanline */ + + while (h--) { + sha = shaLine; + win = (CARD16 *) (*pBuf->window) (pScreen, + y, + scrLine, + SHADOW_WINDOW_WRITE, + &winSize, + pBuf->closure); + if (!win) + return; + for (i = 0; i < n; i++) { + memcpy(d.bytes, sha, sizeof(d.bytes)); + c2p_16x4(d.words); + store_iplan2p4(win, d.words); + sha += sizeof(d.bytes) / sizeof(*sha); + win += sizeof(d.bytes) / sizeof(*win); + } + shaLine += shaStride; + y++; + } + pbox++; + } +} diff --git a/xserver/miext/shadow/shiplan2p8.c b/xserver/miext/shadow/shiplan2p8.c new file mode 100644 index 000000000..17d6a132e --- /dev/null +++ b/xserver/miext/shadow/shiplan2p8.c @@ -0,0 +1,137 @@ +/* + * Copyright © 2013 Geert Uytterhoeven + * + * 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. + * + * Based on shpacked.c, which is Copyright © 2000 Keith Packard + */ + +#ifdef HAVE_DIX_CONFIG_H +#include <dix-config.h> +#endif + +#include <stdlib.h> + +#include <X11/X.h> +#include "scrnintstr.h" +#include "windowstr.h" +#include <X11/fonts/font.h> +#include "dixfontstr.h" +#include <X11/fonts/fontstruct.h> +#include "mi.h" +#include "regionstr.h" +#include "globals.h" +#include "gcstruct.h" +#include "shadow.h" +#include "fb.h" +#include "c2p_core.h" + + + /* + * Perform a full C2P step on 16 8-bit pixels, stored in 4 32-bit words + * containing + * - 16 8-bit chunky pixels on input + * - permutated planar data (2 planes per 32-bit word) on output + */ + +static void c2p_16x8(CARD32 d[4]) +{ + transp4(d, 8, 2); + transp4(d, 1, 2); + transp4x(d, 16, 2); + transp4x(d, 2, 2); + transp4(d, 4, 1); +} + + + /* + * Store a full block of permutated iplan2p8 data after c2p conversion + */ + +static inline void store_iplan2p8(void *dst, const CARD32 d[4]) +{ + CARD32 *p = dst; + + *p++ = d[1]; + *p++ = d[3]; + *p++ = d[0]; + *p++ = d[2]; +} + + +void +shadowUpdateIplan2p8(ScreenPtr pScreen, shadowBufPtr pBuf) +{ + RegionPtr damage = shadowDamage(pBuf); + PixmapPtr pShadow = pBuf->pPixmap; + int nbox = RegionNumRects(damage); + BoxPtr pbox = RegionRects(damage); + FbBits *shaBase; + CARD16 *shaLine, *sha; + FbStride shaStride; + int scrLine; + _X_UNUSED int shaBpp, shaXoff, shaYoff; + int x, y, w, h; + int i, n; + CARD16 *win; + _X_UNUSED CARD32 winSize; + union { + CARD8 bytes[16]; + CARD32 words[4]; + } d; + + fbGetDrawable(&pShadow->drawable, shaBase, shaStride, shaBpp, shaXoff, + shaYoff); + shaStride *= sizeof(FbBits) / sizeof(CARD16); + + while (nbox--) { + x = pbox->x1; + y = pbox->y1; + w = pbox->x2 - pbox->x1; + h = pbox->y2 - pbox->y1; + + scrLine = x & -16; + shaLine = (CARD16 *)shaBase + y * shaStride + scrLine / sizeof(CARD16); + + n = ((x & 15) + w + 15) / 16; /* number of c2p units in scanline */ + + while (h--) { + sha = shaLine; + win = (CARD16 *) (*pBuf->window) (pScreen, + y, + scrLine, + SHADOW_WINDOW_WRITE, + &winSize, + pBuf->closure); + if (!win) + return; + for (i = 0; i < n; i++) { + memcpy(d.bytes, sha, sizeof(d.bytes)); + c2p_16x8(d.words); + store_iplan2p8(win, d.words); + sha += sizeof(d.bytes) / sizeof(*sha); + win += sizeof(d.bytes) / sizeof(*win); + } + shaLine += shaStride; + y++; + } + pbox++; + } +} diff --git a/xserver/miext/shadow/shpacked.c b/xserver/miext/shadow/shpacked.c index d2b2e5e24..5ef18f86d 100644 --- a/xserver/miext/shadow/shpacked.c +++ b/xserver/miext/shadow/shpacked.c @@ -98,7 +98,6 @@ shadowUpdatePacked(ScreenPtr pScreen, shadowBufPtr pBuf) i = width; width -= i; scr += i; -#define PickBit(a,i) (((a) >> (i)) & 1) memcpy(win, sha, i * sizeof(FbBits)); sha += i; } diff --git a/xserver/miext/sync/Makefile.am b/xserver/miext/sync/Makefile.am index 36b2816d7..34961d5ff 100644 --- a/xserver/miext/sync/Makefile.am +++ b/xserver/miext/sync/Makefile.am @@ -2,13 +2,20 @@ noinst_LTLIBRARIES = libsync.la AM_CFLAGS = $(DIX_CFLAGS) -INCLUDES = +AM_CPPFLAGS = if XORG -sdk_HEADERS = misync.h misyncstr.h +sdk_HEADERS = misync.h misyncstr.h misyncshm.h misyncfd.h endif +XSHMFENCE_SRCS = misyncshm.c + libsync_la_SOURCES = \ misync.c \ misync.h \ + misyncfd.c \ misyncstr.h + +if XSHMFENCE +libsync_la_SOURCES += $(XSHMFENCE_SRCS) +endif diff --git a/xserver/miext/sync/Makefile.in b/xserver/miext/sync/Makefile.in index cb45746f2..6ed8d7fc2 100644 --- a/xserver/miext/sync/Makefile.in +++ b/xserver/miext/sync/Makefile.in @@ -51,6 +51,7 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ +@XSHMFENCE_TRUE@am__append_1 = $(XSHMFENCE_SRCS) subdir = miext/sync DIST_COMMON = $(am__sdk_HEADERS_DIST) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(top_srcdir)/depcomp @@ -75,7 +76,11 @@ CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libsync_la_LIBADD = -am_libsync_la_OBJECTS = misync.lo +am__libsync_la_SOURCES_DIST = misync.c misync.h misyncfd.c misyncstr.h \ + misyncshm.c +am__objects_1 = misyncshm.lo +@XSHMFENCE_TRUE@am__objects_2 = $(am__objects_1) +am_libsync_la_OBJECTS = misync.lo misyncfd.lo $(am__objects_2) libsync_la_OBJECTS = $(am_libsync_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) @@ -116,13 +121,13 @@ am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libsync_la_SOURCES) -DIST_SOURCES = $(libsync_la_SOURCES) +DIST_SOURCES = $(am__libsync_la_SOURCES_DIST) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac -am__sdk_HEADERS_DIST = misync.h misyncstr.h +am__sdk_HEADERS_DIST = misync.h misyncstr.h misyncshm.h misyncfd.h am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ @@ -209,9 +214,12 @@ 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@ @@ -243,6 +251,7 @@ 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@ @@ -272,6 +281,8 @@ 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@ @@ -315,6 +326,7 @@ 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@ @@ -328,12 +340,12 @@ SET_MAKE = @SET_MAKE@ SHA1_CFLAGS = @SHA1_CFLAGS@ SHA1_LIBS = @SHA1_LIBS@ SHELL = @SHELL@ -SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ SYSCONFDIR = @SYSCONFDIR@ +TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ UDEV_CFLAGS = @UDEV_CFLAGS@ @@ -399,6 +411,8 @@ 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@ @@ -479,13 +493,11 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ noinst_LTLIBRARIES = libsync.la AM_CFLAGS = $(DIX_CFLAGS) -INCLUDES = -@XORG_TRUE@sdk_HEADERS = misync.h misyncstr.h -libsync_la_SOURCES = \ - misync.c \ - misync.h \ - misyncstr.h - +AM_CPPFLAGS = +@XORG_TRUE@sdk_HEADERS = misync.h misyncstr.h misyncshm.h misyncfd.h +XSHMFENCE_SRCS = misyncshm.c +libsync_la_SOURCES = misync.c misync.h misyncfd.c misyncstr.h \ + $(am__append_1) all: all-am .SUFFIXES: @@ -541,6 +553,8 @@ distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/misync.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/misyncfd.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/misyncshm.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< diff --git a/xserver/miext/sync/misync.c b/xserver/miext/sync/misync.c index d24921a18..3d03d1b59 100644 --- a/xserver/miext/sync/misync.c +++ b/xserver/miext/sync/misync.c @@ -29,20 +29,7 @@ #include "misync.h" #include "misyncstr.h" -static DevPrivateKeyRec syncScreenPrivateKeyRec; -static DevPrivateKey syncScreenPrivateKey = &syncScreenPrivateKeyRec; - -#define SYNC_SCREEN_PRIV(pScreen) \ - (SyncScreenPrivPtr) dixLookupPrivate(&pScreen->devPrivates, \ - syncScreenPrivateKey) - -typedef struct _syncScreenPriv { - /* Wrappable sync-specific screen functions */ - SyncScreenFuncsRec funcs; - - /* Wrapped screen functions */ - CloseScreenProcPtr CloseScreen; -} SyncScreenPrivRec, *SyncScreenPrivPtr; +DevPrivateKeyRec miSyncScreenPrivateKey; /* Default implementations of the sync screen functions */ void @@ -62,25 +49,25 @@ miSyncScreenDestroyFence(ScreenPtr pScreen, SyncFence * pFence) } /* Default implementations of the per-object functions */ -static void +void miSyncFenceSetTriggered(SyncFence * pFence) { pFence->triggered = TRUE; } -static void +void miSyncFenceReset(SyncFence * pFence) { pFence->triggered = FALSE; } -static Bool +Bool miSyncFenceCheckTriggered(SyncFence * pFence) { return pFence->triggered; } -static void +void miSyncFenceAddTrigger(SyncTrigger * pTrigger) { (void) pTrigger; @@ -88,7 +75,7 @@ miSyncFenceAddTrigger(SyncTrigger * pTrigger) return; } -static void +void miSyncFenceDeleteTrigger(SyncTrigger * pTrigger) { (void) pTrigger; @@ -182,20 +169,21 @@ miSyncSetup(ScreenPtr pScreen) &miSyncScreenDestroyFence }; - if (dixPrivateKeyRegistered(syncScreenPrivateKey)) - return TRUE; - - if (!dixRegisterPrivateKey(syncScreenPrivateKey, PRIVATE_SCREEN, - sizeof(SyncScreenPrivRec))) - return FALSE; + if (!dixPrivateKeyRegistered(&miSyncScreenPrivateKey)) { + if (!dixRegisterPrivateKey(&miSyncScreenPrivateKey, PRIVATE_SCREEN, + sizeof(SyncScreenPrivRec))) + return FALSE; + } pScreenPriv = SYNC_SCREEN_PRIV(pScreen); - pScreenPriv->funcs = miSyncScreenFuncs; + if (!pScreenPriv->funcs.CreateFence) { + pScreenPriv->funcs = miSyncScreenFuncs; - /* Wrap CloseScreen to clean up */ - pScreenPriv->CloseScreen = pScreen->CloseScreen; - pScreen->CloseScreen = SyncCloseScreen; + /* Wrap CloseScreen to clean up */ + pScreenPriv->CloseScreen = pScreen->CloseScreen; + pScreen->CloseScreen = SyncCloseScreen; + } return TRUE; } diff --git a/xserver/miext/sync/misync.h b/xserver/miext/sync/misync.h index deebb82bc..dc78c5fdb 100644 --- a/xserver/miext/sync/misync.h +++ b/xserver/miext/sync/misync.h @@ -42,8 +42,8 @@ typedef struct _syncScreenFuncs { SyncScreenDestroyFenceFunc DestroyFence; } SyncScreenFuncsRec, *SyncScreenFuncsPtr; -extern _X_EXPORT void +extern _X_EXPORT void miSyncScreenCreateFence(ScreenPtr pScreen, SyncFence * pFence, Bool initially_triggered); extern _X_EXPORT void @@ -76,4 +76,25 @@ extern _X_EXPORT SyncScreenFuncsPtr miSyncGetScreenFuncs(ScreenPtr pScreen); extern _X_EXPORT Bool miSyncSetup(ScreenPtr pScreen); +Bool +miSyncFenceCheckTriggered(SyncFence * pFence); + +void +miSyncFenceSetTriggered(SyncFence * pFence); + +void +miSyncFenceReset(SyncFence * pFence); + +void +miSyncFenceAddTrigger(SyncTrigger * pTrigger); + +void +miSyncFenceDeleteTrigger(SyncTrigger * pTrigger); + +int +miSyncInitFenceFromFD(DrawablePtr pDraw, SyncFence *pFence, int fd, BOOL initially_triggered); + +int +miSyncFDFromFence(DrawablePtr pDraw, SyncFence *pFence); + #endif /* _MISYNC_H_ */ diff --git a/xserver/miext/sync/misyncfd.c b/xserver/miext/sync/misyncfd.c new file mode 100644 index 000000000..93ff85fa8 --- /dev/null +++ b/xserver/miext/sync/misyncfd.c @@ -0,0 +1,99 @@ +/* + * Copyright © 2013 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. + */ + +#ifdef HAVE_DIX_CONFIG_H +#include <dix-config.h> +#endif + +#include "scrnintstr.h" +#include "misync.h" +#include "misyncstr.h" +#include "misyncfd.h" +#include "pixmapstr.h" + +static DevPrivateKeyRec syncFdScreenPrivateKey; + +typedef struct _SyncFdScreenPrivate { + SyncFdScreenFuncsRec funcs; +} SyncFdScreenPrivateRec, *SyncFdScreenPrivatePtr; + +static inline SyncFdScreenPrivatePtr sync_fd_screen_priv(ScreenPtr pScreen) +{ + if (!dixPrivateKeyRegistered(&syncFdScreenPrivateKey)) + return NULL; + return dixLookupPrivate(&pScreen->devPrivates, &syncFdScreenPrivateKey); +} + +int +miSyncInitFenceFromFD(DrawablePtr pDraw, SyncFence *pFence, int fd, BOOL initially_triggered) + +{ + SyncFdScreenPrivatePtr priv = sync_fd_screen_priv(pDraw->pScreen); + + if (!priv) + return BadMatch; + + return (*priv->funcs.CreateFenceFromFd)(pDraw->pScreen, pFence, fd, initially_triggered); +} + +int +miSyncFDFromFence(DrawablePtr pDraw, SyncFence *pFence) +{ + SyncFdScreenPrivatePtr priv = sync_fd_screen_priv(pDraw->pScreen); + + if (!priv) + return -1; + + return (*priv->funcs.GetFenceFd)(pDraw->pScreen, pFence); +} + +_X_EXPORT Bool miSyncFdScreenInit(ScreenPtr pScreen, + const SyncFdScreenFuncsRec *funcs) +{ + SyncFdScreenPrivatePtr priv; + + /* Check to see if we've already been initialized */ + if (sync_fd_screen_priv(pScreen) != NULL) + return FALSE; + + if (!miSyncSetup(pScreen)) + return FALSE; + + if (!dixPrivateKeyRegistered(&syncFdScreenPrivateKey)) { + if (!dixRegisterPrivateKey(&syncFdScreenPrivateKey, PRIVATE_SCREEN, 0)) + return FALSE; + } + + priv = calloc(1, sizeof (SyncFdScreenPrivateRec)); + if (!priv) + return FALSE; + + /* Will require version checks when there are multiple versions + * of the funcs structure + */ + + priv->funcs = *funcs; + + dixSetPrivate(&pScreen->devPrivates, &syncFdScreenPrivateKey, priv); + + return TRUE; +} diff --git a/xserver/miext/sync/misyncfd.h b/xserver/miext/sync/misyncfd.h new file mode 100644 index 000000000..c1d05f948 --- /dev/null +++ b/xserver/miext/sync/misyncfd.h @@ -0,0 +1,45 @@ +/* + * Copyright © 2013 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 _MISYNCFD_H_ +#define _MISYNCFD_H_ + +typedef int (*SyncScreenCreateFenceFromFdFunc) (ScreenPtr screen, + SyncFence *fence, + int fd, + Bool initially_triggered); + +typedef int (*SyncScreenGetFenceFdFunc) (ScreenPtr screen, + SyncFence *fence); + +#define SYNC_FD_SCREEN_FUNCS_VERSION 1 + +typedef struct _syncFdScreenFuncs { + int version; + SyncScreenCreateFenceFromFdFunc CreateFenceFromFd; + SyncScreenGetFenceFdFunc GetFenceFd; +} SyncFdScreenFuncsRec, *SyncFdScreenFuncsPtr; + +extern _X_EXPORT Bool miSyncFdScreenInit(ScreenPtr pScreen, + const SyncFdScreenFuncsRec *funcs); + +#endif /* _MISYNCFD_H_ */ diff --git a/xserver/miext/sync/misyncshm.c b/xserver/miext/sync/misyncshm.c new file mode 100644 index 000000000..01f82fc00 --- /dev/null +++ b/xserver/miext/sync/misyncshm.c @@ -0,0 +1,186 @@ +/* + * Copyright © 2013 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. + */ + +#ifdef HAVE_DIX_CONFIG_H +#include <dix-config.h> +#endif + +#include "scrnintstr.h" +#include "misync.h" +#include "misyncstr.h" +#include "misyncshm.h" +#include "misyncfd.h" +#include "pixmapstr.h" +#include <sys/mman.h> +#include <unistd.h> +#include <fcntl.h> +#include <X11/xshmfence.h> + +static DevPrivateKeyRec syncShmFencePrivateKey; + +typedef struct _SyncShmFencePrivate { + struct xshmfence *fence; + int fd; +} SyncShmFencePrivateRec, *SyncShmFencePrivatePtr; + +#define SYNC_FENCE_PRIV(pFence) \ + (SyncShmFencePrivatePtr) dixLookupPrivate(&pFence->devPrivates, &syncShmFencePrivateKey) + +static void +miSyncShmFenceSetTriggered(SyncFence * pFence) +{ + SyncShmFencePrivatePtr pPriv = SYNC_FENCE_PRIV(pFence); + + if (pPriv->fence) + xshmfence_trigger(pPriv->fence); + miSyncFenceSetTriggered(pFence); +} + +static void +miSyncShmFenceReset(SyncFence * pFence) +{ + SyncShmFencePrivatePtr pPriv = SYNC_FENCE_PRIV(pFence); + + if (pPriv->fence) + xshmfence_reset(pPriv->fence); + miSyncFenceReset(pFence); +} + +static Bool +miSyncShmFenceCheckTriggered(SyncFence * pFence) +{ + SyncShmFencePrivatePtr pPriv = SYNC_FENCE_PRIV(pFence); + + if (pPriv->fence) + return xshmfence_query(pPriv->fence); + else + return miSyncFenceCheckTriggered(pFence); +} + +static void +miSyncShmFenceAddTrigger(SyncTrigger * pTrigger) +{ + miSyncFenceAddTrigger(pTrigger); +} + +static void +miSyncShmFenceDeleteTrigger(SyncTrigger * pTrigger) +{ + miSyncFenceDeleteTrigger(pTrigger); +} + +static const SyncFenceFuncsRec miSyncShmFenceFuncs = { + &miSyncShmFenceSetTriggered, + &miSyncShmFenceReset, + &miSyncShmFenceCheckTriggered, + &miSyncShmFenceAddTrigger, + &miSyncShmFenceDeleteTrigger +}; + +static void +miSyncShmScreenCreateFence(ScreenPtr pScreen, SyncFence * pFence, + Bool initially_triggered) +{ + SyncShmFencePrivatePtr pPriv = SYNC_FENCE_PRIV(pFence); + + pPriv->fence = NULL; + miSyncScreenCreateFence(pScreen, pFence, initially_triggered); + pFence->funcs = miSyncShmFenceFuncs; +} + +static void +miSyncShmScreenDestroyFence(ScreenPtr pScreen, SyncFence * pFence) +{ + SyncShmFencePrivatePtr pPriv = SYNC_FENCE_PRIV(pFence); + + if (pPriv->fence) { + xshmfence_trigger(pPriv->fence); + xshmfence_unmap_shm(pPriv->fence); + close(pPriv->fd); + } + miSyncScreenDestroyFence(pScreen, pFence); +} + +static int +miSyncShmCreateFenceFromFd(ScreenPtr pScreen, SyncFence *pFence, int fd, Bool initially_triggered) +{ + SyncShmFencePrivatePtr pPriv = SYNC_FENCE_PRIV(pFence); + + miSyncInitFence(pScreen, pFence, initially_triggered); + + fd = os_move_fd(fd); + pPriv->fence = xshmfence_map_shm(fd); + if (pPriv->fence) { + pPriv->fd = fd; + return Success; + } + else + close(fd); + return BadValue; +} + +static int +miSyncShmGetFenceFd(ScreenPtr pScreen, SyncFence *pFence) +{ + SyncShmFencePrivatePtr pPriv = SYNC_FENCE_PRIV(pFence); + + if (!pPriv->fence) { + pPriv->fd = xshmfence_alloc_shm(); + if (pPriv->fd < 0) + return -1; + pPriv->fd = os_move_fd(pPriv->fd); + pPriv->fence = xshmfence_map_shm(pPriv->fd); + if (!pPriv->fence) { + close (pPriv->fd); + return -1; + } + } + return pPriv->fd; +} + +static const SyncFdScreenFuncsRec miSyncShmScreenFuncs = { + .version = SYNC_FD_SCREEN_FUNCS_VERSION, + .CreateFenceFromFd = miSyncShmCreateFenceFromFd, + .GetFenceFd = miSyncShmGetFenceFd +}; + +_X_EXPORT Bool miSyncShmScreenInit(ScreenPtr pScreen) +{ + SyncScreenFuncsPtr funcs; + + if (!miSyncFdScreenInit(pScreen, &miSyncShmScreenFuncs)) + return FALSE; + + if (!dixPrivateKeyRegistered(&syncShmFencePrivateKey)) { + if (!dixRegisterPrivateKey(&syncShmFencePrivateKey, PRIVATE_SYNC_FENCE, + sizeof(SyncShmFencePrivateRec))) + return FALSE; + } + + funcs = miSyncGetScreenFuncs(pScreen); + + funcs->CreateFence = miSyncShmScreenCreateFence; + funcs->DestroyFence = miSyncShmScreenDestroyFence; + + return TRUE; +} + diff --git a/xserver/miext/sync/misyncshm.h b/xserver/miext/sync/misyncshm.h new file mode 100644 index 000000000..23c001ab1 --- /dev/null +++ b/xserver/miext/sync/misyncshm.h @@ -0,0 +1,28 @@ +/* + * Copyright © 2013 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 _MISYNCSHM_H_ +#define _MISYNCSHM_H_ + +extern _X_EXPORT Bool miSyncShmScreenInit(ScreenPtr pScreen); + +#endif /* _MISYNCSHM_H_ */ diff --git a/xserver/miext/sync/misyncstr.h b/xserver/miext/sync/misyncstr.h index e19256fee..b5bf6fd91 100644 --- a/xserver/miext/sync/misyncstr.h +++ b/xserver/miext/sync/misyncstr.h @@ -29,6 +29,7 @@ #define _MISYNCSTR_H_ #include "dix.h" +#include "scrnintstr.h" #include <X11/extensions/syncconst.h> #define CARD64 XSyncValue /* XXX temporary! need real 64 bit values for Alpha */ @@ -79,4 +80,18 @@ typedef struct _SyncTriggerList { struct _SyncTriggerList *next; } SyncTriggerList; +extern DevPrivateKeyRec miSyncScreenPrivateKey; + +#define SYNC_SCREEN_PRIV(pScreen) \ + (SyncScreenPrivPtr) dixLookupPrivate(&pScreen->devPrivates, \ + &miSyncScreenPrivateKey) + +typedef struct _syncScreenPriv { + /* Wrappable sync-specific screen functions */ + SyncScreenFuncsRec funcs; + + /* Wrapped screen functions */ + CloseScreenProcPtr CloseScreen; +} SyncScreenPrivRec, *SyncScreenPrivPtr; + #endif /* _MISYNCSTR_H_ */ |