xserver: Branch 'wip/jeremyhu-debug' - 15 commits
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Jan 2 16:42:13 UTC 2023
Rebased ref, commits from common ancestor:
commit 3497e3932a756ebec510ec32d43c32cecd174aa0
Author: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
Date: Wed Dec 14 23:46:42 2022 -0800
XQuartz debugging
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
(cherry picked from commit 7ea888380aca2e681a4abc6f3266bf30dc7c1ea1)
diff --git a/fb/fbpict.c b/fb/fbpict.c
index 4f0e8a5fc..ac3c5f477 100644
--- a/fb/fbpict.c
+++ b/fb/fbpict.c
@@ -137,10 +137,25 @@ create_bits_picture(PicturePtr pict, Bool has_clip)
fbGetDrawable (pict->pDrawable, bits, stride, bpp, xoff, yoff);
+ ErrorF("=== create_bits_picture ===\n");
+ xorg_backtrace();
+
+ ErrorF(" fbGetDrawable: pDrawable %p (%d,%d %dx%d): bits base: %p stride: %u bpp: %d xoff: %d yoff: %d\n",
+ pict->pDrawable, pict->pDrawable->x, pict->pDrawable->y, pict->pDrawable->width, pict->pDrawable->height,
+ bits, stride, bpp, xoff, yoff);
+
bits = (FbBits*)((CARD8*)bits +
(pict->pDrawable->y + yoff) * stride * sizeof(FbBits) +
(pict->pDrawable->x + xoff) * (bpp / 8));
+ FbBits *end = (FbBits*)((CARD8*)bits +
+ (pict->pDrawable->height - 1) * stride * sizeof(FbBits) +
+ (pict->pDrawable->width - 1) * (bpp / 8));
+
+ ErrorF(" adjusted bits: %p\n", bits);
+ ErrorF(" value: %u\n", (unsigned)*bits);
+ ErrorF(" end value: %u\n", (unsigned)*end);
+
image = pixman_image_create_bits((pixman_format_code_t) pict->format,
pict->pDrawable->width,
pict->pDrawable->height, (uint32_t *) bits,
diff --git a/fb/fbscreen.c b/fb/fbscreen.c
index 39666f4cc..0615c9f3c 100644
--- a/fb/fbscreen.c
+++ b/fb/fbscreen.c
@@ -26,6 +26,8 @@
#include "fb.h"
+extern unsigned long RootlessWID(WindowPtr pWindow);
+
Bool
fbCloseScreen(ScreenPtr pScreen)
{
@@ -86,6 +88,12 @@ _fbGetWindowPixmap(WindowPtr pWindow)
void
_fbSetWindowPixmap(WindowPtr pWindow, PixmapPtr pPixmap)
{
+ ErrorF("_fbSetWindowPixmap: window=%p (%lu) pixmap=%p bits=%p (%d,%d %dx%d %d)\n",
+ pWindow, RootlessWID(pWindow), pPixmap, pPixmap->devPrivate.ptr,
+ pPixmap->drawable.x, pPixmap->drawable.y, pPixmap->drawable.width,
+ pPixmap->drawable.height, pPixmap->drawable.bitsPerPixel);
+
+ xorg_backtrace();
dixSetPrivate(&pWindow->devPrivates, fbGetWinPrivateKey(pWindow), pPixmap);
}
diff --git a/hw/xquartz/bundle/X11.sh b/hw/xquartz/bundle/X11.sh
index 3b8b6799c..3b314a159 100755
--- a/hw/xquartz/bundle/X11.sh
+++ b/hw/xquartz/bundle/X11.sh
@@ -2,10 +2,23 @@
set "$(dirname "$0")"/X11.bin "${@}"
+if [ ! -f "${HOME}/Library/Preferences/org.xquartz.X11.plist" ] ; then
+ # Try migrating preferences
+ if [ -f "${HOME}/Library/Preferences/org.macosforge.xquartz.X11.plist" ] ; then
+ cp "${HOME}/Library/Preferences/org.macosforge.xquartz.X11.plist" "${HOME}/Library/Preferences/org.xquartz.X11.plist"
+ elif [ -f "${HOME}/Library/Preferences/org.x.X11.plist" ] ; then
+ cp "${HOME}/Library/Preferences/org.x.X11.plist" "${HOME}/Library/Preferences/org.xquartz.X11.plist"
+ elif [ -f "${HOME}/Library/Preferences/com.apple.X11.plist" ] ; then
+ cp "${HOME}/Library/Preferences/com.apple.X11.plist" "${HOME}/Library/Preferences/org.xquartz.X11.plist"
+ fi
+fi
+
if [ -x ~/.x11run ]; then
exec ~/.x11run "${@}"
fi
+export DYLD_LIBRARY_PATH=/tmp/Xplugin.dst/usr/lib
+
case $(basename "${SHELL}") in
bash) exec -l "${SHELL}" --login -c 'exec "${@}"' - "${@}" ;;
ksh|sh|zsh) exec -l "${SHELL}" -c 'exec "${@}"' - "${@}" ;;
diff --git a/hw/xquartz/xpr/xprAppleWM.c b/hw/xquartz/xpr/xprAppleWM.c
index 126661766..cdcf465f9 100644
--- a/hw/xquartz/xpr/xprAppleWM.c
+++ b/hw/xquartz/xpr/xprAppleWM.c
@@ -129,6 +129,9 @@ xprFrameDraw(WindowPtr pWin,
if (wid == 0)
return BadWindow;
+ ErrorF("=== xp_frame_draw %d ===\n", (int)x_cvt_vptr_to_uint(wid));
+ xorg_backtrace();
+
if (xp_frame_draw(wid, class, attr, outer, inner,
title_len, title_bytes) != Success) {
return BadValue;
diff --git a/hw/xquartz/xpr/xprFrame.c b/hw/xquartz/xpr/xprFrame.c
index 57d16d42f..68c476420 100644
--- a/hw/xquartz/xpr/xprFrame.c
+++ b/hw/xquartz/xpr/xprFrame.c
@@ -45,6 +45,8 @@
#include <dispatch/dispatch.h>
+#define DEBUG_XP_LOCK_WINDOW 1
+
#define DEFINE_ATOM_HELPER(func, atom_name) \
static Atom func(void) { \
static int generation; \
@@ -353,15 +355,19 @@ xprStartDrawing(RootlessFrameID wid, char **pixelData, int *bytesPerRow)
xorg_backtrace();
#endif
- err = xp_lock_window(x_cvt_vptr_to_uint(
- wid), NULL, NULL, data, rowbytes, NULL);
+ xp_box out_box;
+ err = xp_lock_window(x_cvt_vptr_to_uint(wid), NULL, NULL, data, rowbytes, &out_box);
if (err != Success)
FatalError("Could not lock window %d for drawing (%d).",
- (int)x_cvt_vptr_to_uint(
- wid), (int)err);
+ (int)x_cvt_vptr_to_uint(wid), (int)err);
#ifdef DEBUG_XP_LOCK_WINDOW
- ErrorF(" bits: %p\n", *data);
+ ErrorF(" bits: %p box: (%d,%d %d,%d) rowbytes: %u\n", *data, (int)out_box.x1, (int)out_box.y1, (int)out_box.x2, (int)out_box.y2, *rowbytes);
+ char *bytes = *data;
+ ErrorF(" bytes[0] = %d\n", bytes[0]);
+ //int size = out_box.y2 * (*rowbytes) + out_box.x2*4;
+ //ErrorF(" size = %d\n", size);
+ //ErrorF(" bytes[%d] = %d\n", size-1, bytes[size-1]);
#endif
*pixelData = data[0];
diff --git a/include/meson.build b/include/meson.build
index 6c1c1dcd4..49d4e8bc2 100644
--- a/include/meson.build
+++ b/include/meson.build
@@ -33,6 +33,9 @@ cc.compiles('''
#ifndef CLOCK_MONOTONIC
#error CLOCK_MONOTONIC not defined
#endif
+ #ifdef __x86_64__
+ #error "x86_64 needs to support 10.9+, so disabling"
+ #endif
''',
name: 'CLOCK_MONOTONIC') ? '1' : false)
@@ -150,7 +153,14 @@ conf_data.set('HAVE_GETPEERUCRED', cc.has_function('getpeerucred') ? '1' : false
conf_data.set('HAVE_GETPROGNAME', cc.has_function('getprogname') ? '1' : false)
conf_data.set('HAVE_GETZONEID', cc.has_function('getzoneid') ? '1' : false)
conf_data.set('HAVE_MEMFD_CREATE', cc.has_function('memfd_create') ? '1' : false)
-conf_data.set('HAVE_MKOSTEMP', cc.has_function('mkostemp') ? '1' : false)
+#conf_data.set('HAVE_MKOSTEMP', cc.has_function('mkostemp') ? '1' : false)
+conf_data.set('HAVE_MKOSTEMP', cc.has_function('mkostemp') and
+cc.compiles('''
+ #ifdef __x86_64__
+ #error "x86_64 needs to support 10.9+, so disabling"
+ #endif
+''',
+ name: 'HAVE_MKOSTEMP') ? '1' : false)
conf_data.set('HAVE_MMAP', cc.has_function('mmap') ? '1' : false)
conf_data.set('HAVE_OPEN_DEVICE', cc.has_function('open_device') ? '1' : false)
conf_data.set('HAVE_POLL', cc.has_function('poll') ? '1' : false)
diff --git a/miext/damage/damage.c b/miext/damage/damage.c
index f3ae4ebbc..f3fee2eee 100644
--- a/miext/damage/damage.c
+++ b/miext/damage/damage.c
@@ -41,6 +41,8 @@
#include "damage.h"
#include "damagestr.h"
+extern unsigned long RootlessWID(WindowPtr pWindow);
+
#define wrap(priv, real, mem, func) {\
priv->mem = real->mem; \
real->mem = func; \
@@ -1550,10 +1552,20 @@ damageSetWindowPixmap(WindowPtr pWindow, PixmapPtr pPixmap)
DamagePtr pDamage;
ScreenPtr pScreen = pWindow->drawable.pScreen;
+ ErrorF("damageSetWindowPixmap(%p %lu, %p %p) (%d,%d %dx%d %d)\n",
+ pWindow, RootlessWID(pWindow), pPixmap, pPixmap->devPrivate.ptr,
+ pPixmap->drawable.x, pPixmap->drawable.y, pPixmap->drawable.width,
+ pPixmap->drawable.height, pPixmap->drawable.bitsPerPixel);
+
damageScrPriv(pScreen);
if ((pDamage = damageGetWinPriv(pWindow))) {
PixmapPtr pOldPixmap = (*pScreen->GetWindowPixmap) (pWindow);
+
+ ErrorF("pOldPixmap: %p %p (%d,%d %dx%d %d)\n", pOldPixmap, pOldPixmap->devPrivate.ptr,
+ pOldPixmap->drawable.x, pOldPixmap->drawable.y, pOldPixmap->drawable.width,
+ pOldPixmap->drawable.height, pOldPixmap->drawable.bitsPerPixel);
+
DamagePtr *pPrev = getPixmapDamageRef(pOldPixmap);
while (pDamage) {
diff --git a/miext/rootless/rootlessCommon.c b/miext/rootless/rootlessCommon.c
index 44c2c3789..2adf07c14 100644
--- a/miext/rootless/rootlessCommon.c
+++ b/miext/rootless/rootlessCommon.c
@@ -196,10 +196,11 @@ RootlessStartDrawing(WindowPtr pWindow)
SetPixmapBaseToScreen(winRec->pixmap,
top->drawable.x - bw, top->drawable.y - bw);
- RL_DEBUG_MSG("After SetPixmapBaseToScreen(%d %d %d): %p (%d,%d %dx%d %d) for wid=%lu\n",
+ RL_DEBUG_MSG("After SetPixmapBaseToScreen(%d %d %d): %p (%d,%d %dx%d %d) for wid=%lu (which is %d,%d %dx%d=%dx%d)\n",
top->drawable.x, top->drawable.y, bw, winRec->pixmap->devPrivate.ptr, winRec->pixmap->drawable.x,
winRec->pixmap->drawable.y, winRec->pixmap->drawable.width, winRec->pixmap->drawable.height,
- winRec->pixmap->drawable.bitsPerPixel, RootlessWID(pWindow));
+ winRec->pixmap->drawable.bitsPerPixel, RootlessWID(pWindow),
+ pWindow->drawable.x, pWindow->drawable.y, pWindow->drawable.width, pWindow->drawable.height, winRec->width, winRec->height);
winRec->is_drawing = TRUE;
} else {
diff --git a/miext/rootless/rootlessConfig.h b/miext/rootless/rootlessConfig.h
index 6f2bfe4bd..31af6b071 100644
--- a/miext/rootless/rootlessConfig.h
+++ b/miext/rootless/rootlessConfig.h
@@ -38,7 +38,7 @@
// #define ROOTLESS_RESIZE_GRAVITY TRUE
#endif
-/*# define ROOTLESSDEBUG*/
+# define ROOTLESSDEBUG
#define ROOTLESS_PROTECT_ALPHA TRUE
#define ROOTLESS_REDISPLAY_DELAY 10
commit a650ee1d11326dfb3a86ccc3991db4d04b39e899
Author: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
Date: Sat May 31 13:14:20 2014 -0700
fb: Revert fb changes that broke XQuartz
http://bugs.freedesktop.org/show_bug.cgi?id=26124
Revert "Use new pixman_glyph_cache_t API that will be in pixman 0.28.0"
Revert "fb: Fix origin of source picture in fbGlyphs"
Revert "fb: Publish fbGlyphs and fbUnrealizeGlyph"
This reverts commit 9cbcb5bd6a5360a128d15b77a02d8d3351f74366.
This reverts commit 983e30361f49a67252d0b5d82630e70724d69dbf.
This reverts commit 3c2c59eed3c68c0e5a93c38cf01eedad015e3157.
diff --git a/fb/fb.h b/fb/fb.h
index 4546c6382..bc1bc0196 100644
--- a/fb/fb.h
+++ b/fb/fb.h
@@ -952,9 +952,6 @@ extern _X_EXPORT void
extern _X_EXPORT Bool
fbPictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats);
-extern _X_EXPORT void
-fbDestroyGlyphCache(void);
-
/*
* fbpixmap.c
*/
diff --git a/fb/fbpict.c b/fb/fbpict.c
index e5e176143..4f0e8a5fc 100644
--- a/fb/fbpict.c
+++ b/fb/fbpict.c
@@ -65,152 +65,6 @@ fbComposite(CARD8 op,
free_pixman_pict(pDst, dest);
}
-static pixman_glyph_cache_t *glyphCache;
-
-void
-fbDestroyGlyphCache(void)
-{
- if (glyphCache)
- {
- pixman_glyph_cache_destroy (glyphCache);
- glyphCache = NULL;
- }
-}
-
-static void
-fbUnrealizeGlyph(ScreenPtr pScreen,
- GlyphPtr pGlyph)
-{
- if (glyphCache)
- pixman_glyph_cache_remove (glyphCache, pGlyph, NULL);
-}
-
-void
-fbGlyphs(CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc, int nlist,
- GlyphListPtr list,
- GlyphPtr *glyphs)
-{
-#define N_STACK_GLYPHS 512
- ScreenPtr pScreen = pDst->pDrawable->pScreen;
- pixman_glyph_t stack_glyphs[N_STACK_GLYPHS];
- pixman_glyph_t *pglyphs = stack_glyphs;
- pixman_image_t *srcImage, *dstImage;
- int srcXoff, srcYoff, dstXoff, dstYoff;
- GlyphPtr glyph;
- int n_glyphs;
- int x, y;
- int i, n;
- int xDst = list->xOff, yDst = list->yOff;
-
- miCompositeSourceValidate(pSrc);
-
- n_glyphs = 0;
- for (i = 0; i < nlist; ++i)
- n_glyphs += list[i].len;
-
- if (!glyphCache)
- glyphCache = pixman_glyph_cache_create();
-
- pixman_glyph_cache_freeze (glyphCache);
-
- if (n_glyphs > N_STACK_GLYPHS) {
- if (!(pglyphs = xallocarray(n_glyphs, sizeof(pixman_glyph_t))))
- goto out;
- }
-
- i = 0;
- x = y = 0;
- while (nlist--) {
- x += list->xOff;
- y += list->yOff;
- n = list->len;
- while (n--) {
- const void *g;
-
- glyph = *glyphs++;
-
- if (!(g = pixman_glyph_cache_lookup (glyphCache, glyph, NULL))) {
- pixman_image_t *glyphImage;
- PicturePtr pPicture;
- int xoff, yoff;
-
- pPicture = GetGlyphPicture(glyph, pScreen);
- if (!pPicture) {
- n_glyphs--;
- goto next;
- }
-
- if (!(glyphImage = image_from_pict(pPicture, FALSE, &xoff, &yoff)))
- goto out;
-
- g = pixman_glyph_cache_insert(glyphCache, glyph, NULL,
- glyph->info.x,
- glyph->info.y,
- glyphImage);
-
- free_pixman_pict(pPicture, glyphImage);
-
- if (!g)
- goto out;
- }
-
- pglyphs[i].x = x;
- pglyphs[i].y = y;
- pglyphs[i].glyph = g;
- i++;
-
- next:
- x += glyph->info.xOff;
- y += glyph->info.yOff;
- }
- list++;
- }
-
- if (!(srcImage = image_from_pict(pSrc, FALSE, &srcXoff, &srcYoff)))
- goto out;
-
- if (!(dstImage = image_from_pict(pDst, TRUE, &dstXoff, &dstYoff)))
- goto out_free_src;
-
- if (maskFormat) {
- pixman_format_code_t format;
- pixman_box32_t extents;
-
- format = maskFormat->format | (maskFormat->depth << 24);
-
- pixman_glyph_get_extents(glyphCache, n_glyphs, pglyphs, &extents);
-
- pixman_composite_glyphs(op, srcImage, dstImage, format,
- xSrc + srcXoff + extents.x1 - xDst, ySrc + srcYoff + extents.y1 - yDst,
- extents.x1, extents.y1,
- extents.x1 + dstXoff, extents.y1 + dstYoff,
- extents.x2 - extents.x1,
- extents.y2 - extents.y1,
- glyphCache, n_glyphs, pglyphs);
- }
- else {
- pixman_composite_glyphs_no_mask(op, srcImage, dstImage,
- xSrc + srcXoff - xDst, ySrc + srcYoff - yDst,
- dstXoff, dstYoff,
- glyphCache, n_glyphs, pglyphs);
- }
-
- free_pixman_pict(pDst, dstImage);
-
-out_free_src:
- free_pixman_pict(pSrc, srcImage);
-
-out:
- pixman_glyph_cache_thaw(glyphCache);
- if (pglyphs != stack_glyphs)
- free(pglyphs);
-}
-
static pixman_image_t *
create_solid_fill_image(PicturePtr pict)
{
@@ -460,8 +314,7 @@ fbPictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats)
return FALSE;
ps = GetPictureScreen(pScreen);
ps->Composite = fbComposite;
- ps->Glyphs = fbGlyphs;
- ps->UnrealizeGlyph = fbUnrealizeGlyph;
+ ps->Glyphs = miGlyphs;
ps->CompositeRects = miCompositeRects;
ps->RasterizeTrapezoid = fbRasterizeTrapezoid;
ps->AddTraps = fbAddTraps;
diff --git a/fb/fbpict.h b/fb/fbpict.h
index 201ea092e..b62b74787 100644
--- a/fb/fbpict.h
+++ b/fb/fbpict.h
@@ -60,20 +60,11 @@ 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
-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/fb/fbscreen.c b/fb/fbscreen.c
index 4ab807ab5..39666f4cc 100644
--- a/fb/fbscreen.c
+++ b/fb/fbscreen.c
@@ -32,7 +32,6 @@ fbCloseScreen(ScreenPtr pScreen)
int d;
DepthPtr depths = pScreen->allowedDepths;
- fbDestroyGlyphCache();
for (d = 0; d < pScreen->numDepths; d++)
free(depths[d].vids);
free(depths);
commit ba3e5835c54870b0ab5d24f7c131a122dd913331
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date: Fri Feb 12 19:48:52 2010 -0800
fb: Revert fb changes that broke XQuartz
http://bugs.freedesktop.org/show_bug.cgi?id=26124
Revert "Fix source pictures getting random transforms after 2d6a8f668342a5190cdf43b5."
Revert "fb: Adjust transform or composite coordinates for pixman operations"
http://bugs.freedesktop.org/26124
This reverts commit a72c65e9176c51de95db2fdbf4c5d946a4911695.
This reverts commit a6bd5d2e482a5aa84acb3d4932e2a166d8670ef1.
Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
diff --git a/fb/fb.h b/fb/fb.h
index 8ab050d0f..4546c6382 100644
--- a/fb/fb.h
+++ b/fb/fb.h
@@ -1149,8 +1149,7 @@ fbFillRegionSolid(DrawablePtr pDrawable,
RegionPtr pRegion, FbBits and, FbBits xor);
extern _X_EXPORT pixman_image_t *image_from_pict(PicturePtr pict,
- Bool has_clip,
- int *xoff, int *yoff);
+ Bool has_clip);
extern _X_EXPORT void free_pixman_pict(PicturePtr, pixman_image_t *);
diff --git a/fb/fbpict.c b/fb/fbpict.c
index 577604574..e5e176143 100644
--- a/fb/fbpict.c
+++ b/fb/fbpict.c
@@ -46,23 +46,18 @@ fbComposite(CARD8 op,
INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height)
{
pixman_image_t *src, *mask, *dest;
- int src_xoff, src_yoff;
- int msk_xoff, msk_yoff;
- int dst_xoff, dst_yoff;
-
miCompositeSourceValidate(pSrc);
if (pMask)
miCompositeSourceValidate(pMask);
- src = image_from_pict(pSrc, FALSE, &src_xoff, &src_yoff);
- mask = image_from_pict(pMask, FALSE, &msk_xoff, &msk_yoff);
- dest = image_from_pict(pDst, TRUE, &dst_xoff, &dst_yoff);
+ src = image_from_pict(pSrc, TRUE);
+ mask = image_from_pict(pMask, TRUE);
+ dest = image_from_pict(pDst, TRUE);
if (src && dest && !(pMask && !mask)) {
pixman_image_composite(op, src, mask, dest,
- xSrc + src_xoff, ySrc + src_yoff,
- xMask + msk_xoff, yMask + msk_yoff,
- xDst + dst_xoff, yDst + dst_yoff, width, height);
+ xSrc, ySrc, xMask, yMask, xDst, yDst,
+ width, height);
}
free_pixman_pict(pSrc, src);
@@ -279,20 +274,22 @@ create_conical_gradient_image(PictGradient * gradient)
}
static pixman_image_t *
-create_bits_picture(PicturePtr pict, Bool has_clip, int *xoff, int *yoff)
+create_bits_picture(PicturePtr pict, Bool has_clip)
{
- PixmapPtr pixmap;
FbBits *bits;
FbStride stride;
- int bpp;
+ int bpp, xoff, yoff;
pixman_image_t *image;
- fbGetDrawablePixmap(pict->pDrawable, pixmap, *xoff, *yoff);
- fbGetPixmapBitsData(pixmap, bits, stride, bpp);
+ fbGetDrawable (pict->pDrawable, bits, stride, bpp, xoff, yoff);
+
+ bits = (FbBits*)((CARD8*)bits +
+ (pict->pDrawable->y + yoff) * stride * sizeof(FbBits) +
+ (pict->pDrawable->x + xoff) * (bpp / 8));
image = pixman_image_create_bits((pixman_format_code_t) pict->format,
- pixmap->drawable.width,
- pixmap->drawable.height, (uint32_t *) bits,
+ pict->pDrawable->width,
+ pict->pDrawable->height, (uint32_t *) bits,
stride * sizeof(FbStride));
if (!image)
@@ -311,28 +308,21 @@ create_bits_picture(PicturePtr pict, Bool has_clip, int *xoff, int *yoff)
if (pict->clientClip)
pixman_image_set_has_client_clip(image, TRUE);
- if (*xoff || *yoff)
- pixman_region_translate(pict->pCompositeClip, *xoff, *yoff);
+ pixman_region_translate (pict->pCompositeClip, - pict->pDrawable->x, - pict->pDrawable->y);
pixman_image_set_clip_region(image, pict->pCompositeClip);
- if (*xoff || *yoff)
- pixman_region_translate(pict->pCompositeClip, -*xoff, -*yoff);
+ pixman_region_translate (pict->pCompositeClip, pict->pDrawable->x, pict->pDrawable->y);
}
/* Indexed table */
if (pict->pFormat->index.devPrivate)
pixman_image_set_indexed(image, pict->pFormat->index.devPrivate);
- /* Add in drawable origin to position within the image */
- *xoff += pict->pDrawable->x;
- *yoff += pict->pDrawable->y;
-
return image;
}
static pixman_image_t *image_from_pict_internal(PicturePtr pict, Bool has_clip,
- int *xoff, int *yoff,
Bool is_alpha_map);
static void image_destroy(pixman_image_t *image, void *data)
@@ -341,32 +331,13 @@ static void image_destroy(pixman_image_t *image, void *data)
}
static void
-set_image_properties(pixman_image_t * image, PicturePtr pict, Bool has_clip,
- int *xoff, int *yoff, Bool is_alpha_map)
+set_image_properties(pixman_image_t * image, PicturePtr pict, Bool is_alpha_map)
{
pixman_repeat_t repeat;
pixman_filter_t filter;
if (pict->transform) {
- /* For source images, adjust the transform to account
- * for the drawable offset within the pixman image,
- * then set the offset to 0 as it will be used
- * to compute positions within the transformed image.
- */
- if (!has_clip) {
- struct pixman_transform adjusted;
-
- adjusted = *pict->transform;
- pixman_transform_translate(&adjusted,
- NULL,
- pixman_int_to_fixed(*xoff),
- pixman_int_to_fixed(*yoff));
- pixman_image_set_transform(image, &adjusted);
- *xoff = 0;
- *yoff = 0;
- }
- else
- pixman_image_set_transform(image, pict->transform);
+ pixman_image_set_transform(image, pict->transform);
}
switch (pict->repeatType) {
@@ -394,10 +365,8 @@ set_image_properties(pixman_image_t * image, PicturePtr pict, Bool has_clip,
* as the alpha map for this operation
*/
if (pict->alphaMap && !is_alpha_map) {
- int alpha_xoff, alpha_yoff;
pixman_image_t *alpha_map =
- image_from_pict_internal(pict->alphaMap, FALSE, &alpha_xoff,
- &alpha_yoff, TRUE);
+ image_from_pict_internal(pict->alphaMap, TRUE, TRUE);
pixman_image_set_alpha_map(image, alpha_map, pict->alphaOrigin.x,
pict->alphaOrigin.y);
@@ -435,8 +404,7 @@ set_image_properties(pixman_image_t * image, PicturePtr pict, Bool has_clip,
}
static pixman_image_t *
-image_from_pict_internal(PicturePtr pict, Bool has_clip, int *xoff, int *yoff,
- Bool is_alpha_map)
+image_from_pict_internal(PicturePtr pict, Bool has_clip, Bool is_alpha_map)
{
pixman_image_t *image = NULL;
@@ -444,7 +412,7 @@ image_from_pict_internal(PicturePtr pict, Bool has_clip, int *xoff, int *yoff,
return NULL;
if (pict->pDrawable) {
- image = create_bits_picture(pict, has_clip, xoff, yoff);
+ image = create_bits_picture(pict, has_clip);
}
else if (pict->pSourcePict) {
SourcePict *sp = pict->pSourcePict;
@@ -462,19 +430,17 @@ image_from_pict_internal(PicturePtr pict, Bool has_clip, int *xoff, int *yoff,
else if (sp->type == SourcePictTypeConical)
image = create_conical_gradient_image(gradient);
}
- *xoff = *yoff = 0;
}
if (image)
- set_image_properties(image, pict, has_clip, xoff, yoff, is_alpha_map);
-
+ set_image_properties (image, pict, is_alpha_map);
return image;
}
pixman_image_t *
-image_from_pict(PicturePtr pict, Bool has_clip, int *xoff, int *yoff)
+image_from_pict (PicturePtr pict, Bool has_clip)
{
- return image_from_pict_internal(pict, has_clip, xoff, yoff, FALSE);
+ return image_from_pict_internal (pict, has_clip, FALSE);
}
void
diff --git a/fb/fbtrap.c b/fb/fbtrap.c
index bf82f8f2c..0145ce926 100644
--- a/fb/fbtrap.c
+++ b/fb/fbtrap.c
@@ -36,13 +36,12 @@ fbAddTraps(PicturePtr pPicture,
INT16 x_off, INT16 y_off, int ntrap, xTrap * traps)
{
pixman_image_t *image;
- int dst_xoff, dst_yoff;
- if (!(image = image_from_pict(pPicture, FALSE, &dst_xoff, &dst_yoff)))
- return;
-
- pixman_add_traps(image, x_off + dst_xoff, y_off + dst_yoff,
- ntrap, (pixman_trap_t *) traps);
+ if (!(image = image_from_pict (pPicture, FALSE)))
+ return;
+
+ pixman_add_traps(image, x_off, y_off,
+ ntrap, (pixman_trap_t *)traps);
free_pixman_pict(pPicture, image);
}
@@ -52,13 +51,12 @@ fbRasterizeTrapezoid(PicturePtr pPicture,
xTrapezoid * trap, int x_off, int y_off)
{
pixman_image_t *image;
- int dst_xoff, dst_yoff;
- if (!(image = image_from_pict(pPicture, FALSE, &dst_xoff, &dst_yoff)))
+ if (!(image = image_from_pict (pPicture, FALSE)))
return;
- pixman_rasterize_trapezoid(image, (pixman_trapezoid_t *) trap,
- x_off + dst_xoff, y_off + dst_yoff);
+ pixman_rasterize_trapezoid(image, (pixman_trapezoid_t *)trap,
+ x_off, y_off);
free_pixman_pict(pPicture, image);
}
@@ -68,14 +66,12 @@ fbAddTriangles(PicturePtr pPicture,
INT16 x_off, INT16 y_off, int ntri, xTriangle * tris)
{
pixman_image_t *image;
- int dst_xoff, dst_yoff;
- if (!(image = image_from_pict(pPicture, FALSE, &dst_xoff, &dst_yoff)))
+ if (!(image = image_from_pict (pPicture, FALSE)))
return;
-
- pixman_add_triangles(image,
- dst_xoff + x_off, dst_yoff + y_off,
- ntri, (pixman_triangle_t *) tris);
+
+ pixman_add_triangles(image, x_off, y_off, ntri,
+ (pixman_triangle_t *)tris);
free_pixman_pict(pPicture, image);
}
@@ -98,13 +94,11 @@ fbShapes(CompositeShapesFunc composite,
int16_t ySrc, int nshapes, int shape_size, const uint8_t * shapes)
{
pixman_image_t *src, *dst;
- int src_xoff, src_yoff;
- int dst_xoff, dst_yoff;
miCompositeSourceValidate(pSrc);
- src = image_from_pict(pSrc, FALSE, &src_xoff, &src_yoff);
- dst = image_from_pict(pDst, TRUE, &dst_xoff, &dst_yoff);
+ src = image_from_pict(pSrc, FALSE);
+ dst = image_from_pict(pDst, TRUE);
if (src && dst) {
pixman_format_code_t format;
@@ -121,9 +115,8 @@ fbShapes(CompositeShapesFunc composite,
for (i = 0; i < nshapes; ++i) {
composite(op, src, dst, format,
- xSrc + src_xoff,
- ySrc + src_yoff,
- dst_xoff, dst_yoff, 1, shapes + i * shape_size);
+ xSrc, ySrc, 0, 0,
+ 1, shapes + i * shape_size);
}
}
else {
@@ -143,8 +136,8 @@ fbShapes(CompositeShapesFunc composite,
}
composite(op, src, dst, format,
- xSrc + src_xoff,
- ySrc + src_yoff, dst_xoff, dst_yoff, nshapes, shapes);
+ xSrc, ySrc, 0, 0,
+ nshapes, shapes);
}
DamageRegionProcessPending(pDst->pDrawable);
commit ca48a53b5fc726bde5c67dcf46b65a10b1ee8a29
Author: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
Date: Sat Nov 2 11:00:23 2013 -0700
Use old miTrapezoids and miTriangles routines
Reverts commits:
788ccb9a8bcf6a4fb4054c507111eec3338fb969
566f1931ee2916269e164e114bffaf2da1d039d1
http://xquartz.macosforge.org/trac/ticket/525
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
diff --git a/fb/fbpict.c b/fb/fbpict.c
index 9797447b4..577604574 100644
--- a/fb/fbpict.c
+++ b/fb/fbpict.c
@@ -498,10 +498,8 @@ fbPictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats)
ps->UnrealizeGlyph = fbUnrealizeGlyph;
ps->CompositeRects = miCompositeRects;
ps->RasterizeTrapezoid = fbRasterizeTrapezoid;
- ps->Trapezoids = fbTrapezoids;
ps->AddTraps = fbAddTraps;
ps->AddTriangles = fbAddTriangles;
- ps->Triangles = fbTriangles;
return TRUE;
}
diff --git a/render/mipict.c b/render/mipict.c
index 7fb03435b..7062c6eed 100644
--- a/render/mipict.c
+++ b/render/mipict.c
@@ -573,8 +573,8 @@ miPictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats)
ps->Composite = 0; /* requires DDX support */
ps->Glyphs = miGlyphs;
ps->CompositeRects = miCompositeRects;
- ps->Trapezoids = 0;
- ps->Triangles = 0;
+ ps->Trapezoids = miTrapezoids;
+ ps->Triangles = miTriangles;
ps->RasterizeTrapezoid = 0; /* requires DDX support */
ps->AddTraps = 0; /* requires DDX support */
diff --git a/render/mipict.h b/render/mipict.h
index 3241be4b9..8ee7a8ae3 100644
--- a/render/mipict.h
+++ b/render/mipict.h
@@ -101,9 +101,36 @@ miCompositeRects(CARD8 op,
PicturePtr pDst,
xRenderColor * color, int nRect, xRectangle *rects);
+extern _X_EXPORT void
+miTriangles (CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc,
+ INT16 ySrc,
+ int ntri,
+ xTriangle *tris);
+
+extern _X_EXPORT PicturePtr
+miCreateAlphaPicture (ScreenPtr pScreen,
+ PicturePtr pDst,
+ PictFormatPtr pPictFormat,
+ CARD16 width,
+ CARD16 height);
+
extern _X_EXPORT void
miTrapezoidBounds(int ntrap, xTrapezoid * traps, BoxPtr box);
+extern _X_EXPORT void
+miTrapezoids (CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc,
+ INT16 ySrc,
+ int ntrap,
+ xTrapezoid *traps);
+
extern _X_EXPORT void
miPointFixedBounds(int npoint, xPointFixed * points, BoxPtr bounds);
diff --git a/render/mitrap.c b/render/mitrap.c
index 17b6dcd1c..71c1857da 100644
--- a/render/mitrap.c
+++ b/render/mitrap.c
@@ -34,6 +34,55 @@
#include "picturestr.h"
#include "mipict.h"
+PicturePtr
+miCreateAlphaPicture (ScreenPtr pScreen,
+ PicturePtr pDst,
+ PictFormatPtr pPictFormat,
+ CARD16 width,
+ CARD16 height)
+{
+ PixmapPtr pPixmap;
+ PicturePtr pPicture;
+ GCPtr pGC;
+ int error;
+ xRectangle rect;
+
+ if (width > 32767 || height > 32767)
+ return 0;
+
+ if (!pPictFormat)
+ {
+ if (pDst->polyEdge == PolyEdgeSharp)
+ pPictFormat = PictureMatchFormat (pScreen, 1, PICT_a1);
+ else
+ pPictFormat = PictureMatchFormat (pScreen, 8, PICT_a8);
+ if (!pPictFormat)
+ return 0;
+ }
+
+ pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height,
+ pPictFormat->depth, 0);
+ if (!pPixmap)
+ return 0;
+ pGC = GetScratchGC (pPixmap->drawable.depth, pScreen);
+ if (!pGC)
+ {
+ (*pScreen->DestroyPixmap) (pPixmap);
+ return 0;
+ }
+ ValidateGC (&pPixmap->drawable, pGC);
+ rect.x = 0;
+ rect.y = 0;
+ rect.width = width;
+ rect.height = height;
+ (*pGC->ops->PolyFillRect)(&pPixmap->drawable, pGC, 1, &rect);
+ FreeScratchGC (pGC);
+ pPicture = CreatePicture (0, &pPixmap->drawable, pPictFormat,
+ 0, 0, serverClient, &error);
+ (*pScreen->DestroyPixmap) (pPixmap);
+ return pPicture;
+}
+
static xFixed
miLineFixedX(xLineFixed * l, xFixed y, Bool ceil)
{
@@ -79,3 +128,65 @@ miTrapezoidBounds(int ntrap, xTrapezoid * traps, BoxPtr box)
box->x2 = x2;
}
}
+
+
+void
+miTrapezoids (CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc,
+ INT16 ySrc,
+ int ntrap,
+ xTrapezoid *traps)
+{
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+
+ /*
+ * Check for solid alpha add
+ */
+ if (op == PictOpAdd && miIsSolidAlpha (pSrc))
+ {
+ for (; ntrap; ntrap--, traps++)
+ (*ps->RasterizeTrapezoid) (pDst, traps, 0, 0);
+ }
+ else if (maskFormat)
+ {
+ PicturePtr pPicture;
+ BoxRec bounds;
+ INT16 xDst, yDst;
+ INT16 xRel, yRel;
+
+ xDst = traps[0].left.p1.x >> 16;
+ yDst = traps[0].left.p1.y >> 16;
+
+ miTrapezoidBounds (ntrap, traps, &bounds);
+ if (bounds.y1 >= bounds.y2 || bounds.x1 >= bounds.x2)
+ return;
+ pPicture = miCreateAlphaPicture (pScreen, pDst, maskFormat,
+ bounds.x2 - bounds.x1,
+ bounds.y2 - bounds.y1);
+ if (!pPicture)
+ return;
+ for (; ntrap; ntrap--, traps++)
+ (*ps->RasterizeTrapezoid) (pPicture, traps,
+ -bounds.x1, -bounds.y1);
+ xRel = bounds.x1 + xSrc - xDst;
+ yRel = bounds.y1 + ySrc - yDst;
+ CompositePicture (op, pSrc, pPicture, pDst,
+ xRel, yRel, 0, 0, bounds.x1, bounds.y1,
+ bounds.x2 - bounds.x1,
+ bounds.y2 - bounds.y1);
+ FreePicture (pPicture, 0);
+ }
+ else
+ {
+ if (pDst->polyEdge == PolyEdgeSharp)
+ maskFormat = PictureMatchFormat (pScreen, 1, PICT_a1);
+ else
+ maskFormat = PictureMatchFormat (pScreen, 8, PICT_a8);
+ for (; ntrap; ntrap--, traps++)
+ miTrapezoids (op, pSrc, pDst, maskFormat, xSrc, ySrc, 1, traps);
+ }
+}
diff --git a/render/mitri.c b/render/mitri.c
index 922f22a6a..bdca9ca5f 100644
--- a/render/mitri.c
+++ b/render/mitri.c
@@ -65,3 +65,64 @@ miTriangleBounds(int ntri, xTriangle * tris, BoxPtr bounds)
{
miPointFixedBounds(ntri * 3, (xPointFixed *) tris, bounds);
}
+
+
+void
+miTriangles (CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc,
+ INT16 ySrc,
+ int ntri,
+ xTriangle *tris)
+{
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+
+ /*
+ * Check for solid alpha add
+ */
+ if (op == PictOpAdd && miIsSolidAlpha (pSrc))
+ {
+ (*ps->AddTriangles) (pDst, 0, 0, ntri, tris);
+ }
+ else if (maskFormat)
+ {
+ BoxRec bounds;
+ PicturePtr pPicture;
+ INT16 xDst, yDst;
+ INT16 xRel, yRel;
+
+ xDst = tris[0].p1.x >> 16;
+ yDst = tris[0].p1.y >> 16;
+
+ miTriangleBounds (ntri, tris, &bounds);
+ if (bounds.x2 <= bounds.x1 || bounds.y2 <= bounds.y1)
+ return;
+ pPicture = miCreateAlphaPicture (pScreen, pDst, maskFormat,
+ bounds.x2 - bounds.x1,
+ bounds.y2 - bounds.y1);
+ if (!pPicture)
+ return;
+ (*ps->AddTriangles) (pPicture, -bounds.x1, -bounds.y1, ntri, tris);
+
+ xRel = bounds.x1 + xSrc - xDst;
+ yRel = bounds.y1 + ySrc - yDst;
+ CompositePicture (op, pSrc, pPicture, pDst,
+ xRel, yRel, 0, 0, bounds.x1, bounds.y1,
+ bounds.x2 - bounds.x1, bounds.y2 - bounds.y1);
+ FreePicture (pPicture, 0);
+ }
+ else
+ {
+ if (pDst->polyEdge == PolyEdgeSharp)
+ maskFormat = PictureMatchFormat (pScreen, 1, PICT_a1);
+ else
+ maskFormat = PictureMatchFormat (pScreen, 8, PICT_a8);
+
+ for (; ntri; ntri--, tris++)
+ miTriangles (op, pSrc, pDst, maskFormat, xSrc, ySrc, 1, tris);
+ }
+}
+
commit 1eeb86734214f0dbc67cea8ccc3d7aa2390a8d08
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date: Fri Apr 30 13:08:25 2010 -0700
Workaround the GC clipping problem in miPaintWindow and add some debugging output.
Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
diff --git a/mi/miexpose.c b/mi/miexpose.c
index 660951877..4833394e3 100644
--- a/mi/miexpose.c
+++ b/mi/miexpose.c
@@ -401,7 +401,8 @@ void RootlessSetPixmapOfAncestors(WindowPtr pWin);
void RootlessStartDrawing(WindowPtr pWin);
void RootlessDamageRegion(WindowPtr pWin, RegionPtr prgn);
Bool IsFramedWindow(WindowPtr pWin);
-#endif
+#include "../fb/fb.h"
+#endif
void
miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
@@ -430,20 +431,32 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
Bool solid = TRUE;
DrawablePtr drawable = &pWin->drawable;
+#ifdef XQUARTZ_CLIP_DEBUG
+ ErrorF("START %d BS %d (pR = %ld)\n", what, pWin->backgroundState, ParentRelative);
+ ErrorF(" Rgn: %d %d %d %d\n", prgn->extents.x1, prgn->extents.y1,
+ prgn->extents.x2 - prgn->extents.x1,
+ prgn->extents.y2 - prgn->extents.y1);
+ ErrorF(" Win: %d %d (%d %d) %d %d\n", pWin->origin.x, pWin->origin.y,
+ pWin->winSize.extents.x1, pWin->winSize.extents.y1,
+ pWin->winSize.extents.x2 - pWin->winSize.extents.x1,
+ pWin->winSize.extents.y2 - pWin->winSize.extents.y1);
+ ErrorF(" Draw: %d %d %d %d\n", pWin->drawable.x, pWin->drawable.y,
+ pWin->drawable.width, pWin->drawable.height);
+#endif
+
+ if (what == PW_BACKGROUND)
+ {
#ifdef ROOTLESS
- if (IsFramedWindow(pWin)) {
- RootlessStartDrawing(pWin);
- RootlessDamageRegion(pWin, prgn);
+ if(IsFramedWindow(pWin)) {
+ RootlessStartDrawing(pWin);
+ RootlessDamageRegion(pWin, prgn);
- if (pWin->backgroundState == ParentRelative) {
- if ((what == PW_BACKGROUND) ||
- (what == PW_BORDER && !pWin->borderIsPixel))
+ if(pWin->backgroundState == ParentRelative) {
RootlessSetPixmapOfAncestors(pWin);
+ }
}
- }
#endif
- if (what == PW_BACKGROUND) {
while (pWin->backgroundState == ParentRelative)
pWin = pWin->parent;
@@ -468,6 +481,18 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
else {
PixmapPtr pixmap;
+#ifdef ROOTLESS
+ if(IsFramedWindow(pWin)) {
+ RootlessStartDrawing(pWin);
+ RootlessDamageRegion(pWin, prgn);
+
+ if(!pWin->borderIsPixel &&
+ pWin->backgroundState == ParentRelative) {
+ RootlessSetPixmapOfAncestors(pWin);
+ }
+ }
+#endif
+
fill = pWin->border;
solid = pWin->borderIsPixel;
@@ -477,6 +502,11 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
pixmap = (*pScreen->GetWindowPixmap) ((WindowPtr) drawable);
drawable = &pixmap->drawable;
+#ifdef XQUARTZ_CLIP_DEBUG
+ ErrorF(" Draw: %d %d %d %d\n",
+ drawable->x, drawable->y, drawable->width, drawable->height);
+#endif
+
while (pWin->backgroundState == ParentRelative)
pWin = pWin->parent;
@@ -546,6 +576,57 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
ChangeGC(NullClient, pGC, gcmask, gcval);
ValidateGC(drawable, pGC);
+#ifdef XQUARTZ_CLIP_DEBUG
+ ErrorF(" GC: %d %d %d %d\n",
+ pGC->pCompositeClip->extents.x1, pGC->pCompositeClip->extents.y1,
+ pGC->pCompositeClip->extents.x2 - pGC->pCompositeClip->extents.x1,
+ pGC->pCompositeClip->extents.y2 - pGC->pCompositeClip->extents.y1);
+#endif
+
+#ifdef XQUARTZ
+ /* Looks like our clipping isn't set right for some reason:
+ * http://xquartz.macosforge.org/trac/ticket/290
+ */
+ if(what == PW_BORDER) {
+
+#if 0
+ if(solid) {
+#if 1
+ fbFillRegionSolid(&pWin->drawable,
+ prgn,
+ 0,
+ fbReplicatePixel(fill.pixel,
+ pWin->drawable.bitsPerPixel));
+#else
+ fbFillRegionSolid(drawable,
+ prgn,
+ 0,
+ fbReplicatePixel(fill.pixel,
+ drawable->bitsPerPixel));
+#endif
+ return;
+ }
+#endif
+
+ pGC->pCompositeClip->extents.x1 += prgn->extents.x1;
+ pGC->pCompositeClip->extents.y1 += prgn->extents.y1;
+ pGC->pCompositeClip->extents.x2 += prgn->extents.x1;
+ pGC->pCompositeClip->extents.y2 += prgn->extents.y1;
+
+ if(pGC->pCompositeClip->extents.x2 > drawable->pScreen->width)
+ pGC->pCompositeClip->extents.x2 = drawable->pScreen->width;
+ if(pGC->pCompositeClip->extents.y2 > drawable->pScreen->height)
+ pGC->pCompositeClip->extents.y2 = drawable->pScreen->height;
+ }
+#endif
+
+#ifdef XQUARTZ_CLIP_DEBUG
+ ErrorF(" GC: %d %d %d %d\n",
+ pGC->pCompositeClip->extents.x1, pGC->pCompositeClip->extents.y1,
+ pGC->pCompositeClip->extents.x2 - pGC->pCompositeClip->extents.x1,
+ pGC->pCompositeClip->extents.y2 - pGC->pCompositeClip->extents.y1);
+#endif
+
numRects = RegionNumRects(prgn);
pbox = RegionRects(prgn);
for (i = numRects; --i >= 0; pbox++, prect++) {
commit a637b8582b92e6addba861bad14f301d780d5dbd
Author: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
Date: Sat Dec 26 10:56:52 2015 -0800
Revert "dix: Restore PaintWindow screen hook"
This reverts commit cbd3cfbad3f07b20e90ea9498110f255813eb441.
diff --git a/composite/compwindow.c b/composite/compwindow.c
index 73a1871a0..13216f6c7 100644
--- a/composite/compwindow.c
+++ b/composite/compwindow.c
@@ -112,7 +112,7 @@ compRepaintBorder(ClientPtr pClient, void *closure)
RegionNull(&exposed);
RegionSubtract(&exposed, &pWindow->borderClip, &pWindow->winSize);
- pWindow->drawable.pScreen->PaintWindow(pWindow, &exposed, PW_BORDER);
+ miPaintWindow(pWindow, &exposed, PW_BORDER);
RegionUninit(&exposed);
}
return TRUE;
diff --git a/dix/window.c b/dix/window.c
index 284aa6dd7..592c1df22 100644
--- a/dix/window.c
+++ b/dix/window.c
@@ -1584,7 +1584,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client)
RegionNull(&exposed);
RegionSubtract(&exposed, &pWin->borderClip, &pWin->winSize);
- pWin->drawable.pScreen->PaintWindow(pWin, &exposed, PW_BORDER);
+ miPaintWindow(pWin, &exposed, PW_BORDER);
RegionUninit(&exposed);
}
return error;
@@ -3144,7 +3144,7 @@ dixSaveScreens(ClientPtr client, int on, int mode)
/* make it look like screen saver is off, so that
* NotClippedByChildren will compute a clip list
- * for the root window, so PaintWindow works
+ * for the root window, so miPaintWindow works
*/
screenIsSaved = SCREEN_SAVER_OFF;
diff --git a/hw/xquartz/quartz.c b/hw/xquartz/quartz.c
index 4bbe56b93..af87bf328 100644
--- a/hw/xquartz/quartz.c
+++ b/hw/xquartz/quartz.c
@@ -308,8 +308,8 @@ QuartzUpdateScreens(void)
quartzProcs->UpdateScreen(pScreen);
- /* PaintWindow needs to be called after RootlessUpdateScreenPixmap (from xprUpdateScreen) */
- pScreen->PaintWindow(pRoot, &pRoot->borderClip, PW_BACKGROUND);
+ /* miPaintWindow needs to be called after RootlessUpdateScreenPixmap (from xprUpdateScreen) */
+ miPaintWindow(pRoot, &pRoot->borderClip, PW_BACKGROUND);
/* Tell RandR about the new size, so new connections get the correct info */
RRScreenSizeNotify(pScreen);
diff --git a/hw/xwin/winrandr.c b/hw/xwin/winrandr.c
index 038d63bde..1b6a333e3 100644
--- a/hw/xwin/winrandr.c
+++ b/hw/xwin/winrandr.c
@@ -133,7 +133,7 @@ winDoRandRScreenSetSize(ScreenPtr pScreen,
SetRootClip(pScreen, ROOT_CLIP_FULL);
// and arrange for it to be repainted
- pScreen->PaintWindow(pRoot, &pRoot->borderClip, PW_BACKGROUND);
+ miPaintWindow(pRoot, &pRoot->borderClip, PW_BACKGROUND);
// Set mode to current display size
pRRScrPriv = rrGetScrPriv(pScreen);
diff --git a/include/scrnintstr.h b/include/scrnintstr.h
index 98f47bf51..83edf8716 100644
--- a/include/scrnintstr.h
+++ b/include/scrnintstr.h
@@ -158,10 +158,6 @@ typedef void (*PostValidateTreeProcPtr) (WindowPtr /*pParent */ ,
typedef void (*WindowExposuresProcPtr) (WindowPtr /*pWindow */ ,
RegionPtr /*prgn */);
-typedef void (*PaintWindowProcPtr) (WindowPtr /*pWindow*/,
- RegionPtr /*pRegion*/,
- int /*what*/);
-
typedef void (*CopyWindowProcPtr) (WindowPtr /*pWindow */ ,
DDXPointRec /*ptOldOrg */ ,
RegionPtr /*prgnSrc */ );
@@ -544,7 +540,6 @@ typedef struct _Screen {
ClearToBackgroundProcPtr ClearToBackground;
ClipNotifyProcPtr ClipNotify;
RestackWindowProcPtr RestackWindow;
- PaintWindowProcPtr PaintWindow;
/* Pixmap procedures */
diff --git a/mi/miexpose.c b/mi/miexpose.c
index e54b18b30..660951877 100644
--- a/mi/miexpose.c
+++ b/mi/miexpose.c
@@ -261,11 +261,10 @@ miHandleExposures(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
RegionTranslate(&rgnExposed, pDstDrawable->x, pDstDrawable->y);
if (extents) {
- /* PaintWindow doesn't clip, so we have to */
+ /* miPaintWindow doesn't clip, so we have to */
RegionIntersect(&rgnExposed, &rgnExposed, &pWin->clipList);
}
- pDstDrawable->pScreen->PaintWindow((WindowPtr) pDstDrawable,
- &rgnExposed, PW_BACKGROUND);
+ miPaintWindow((WindowPtr) pDstDrawable, &rgnExposed, PW_BACKGROUND);
if (extents) {
RegionReset(&rgnExposed, &expBox);
@@ -377,14 +376,16 @@ miWindowExposures(WindowPtr pWin, RegionPtr prgn)
* work overall, on both client and server. This is cheating, but
* isn't prohibited by the protocol ("spontaneous combustion" :-).
*/
- BoxRec box = *RegionExtents(prgn);
+ BoxRec box;
+
+ box = *RegionExtents(prgn);
exposures = &expRec;
RegionInit(exposures, &box, 1);
RegionReset(prgn, &box);
/* miPaintWindow doesn't clip, so we have to */
RegionIntersect(prgn, prgn, &pWin->clipList);
}
- pWin->drawable.pScreen->PaintWindow(pWin, prgn, PW_BACKGROUND);
+ miPaintWindow(pWin, prgn, PW_BACKGROUND);
if (clientInterested)
miSendExposures(pWin, exposures,
pWin->drawable.x, pWin->drawable.y);
@@ -394,6 +395,14 @@ miWindowExposures(WindowPtr pWin, RegionPtr prgn)
}
}
+#ifdef ROOTLESS
+/* Ugly, ugly, but we lost our hooks into miPaintWindow... =/ */
+void RootlessSetPixmapOfAncestors(WindowPtr pWin);
+void RootlessStartDrawing(WindowPtr pWin);
+void RootlessDamageRegion(WindowPtr pWin, RegionPtr prgn);
+Bool IsFramedWindow(WindowPtr pWin);
+#endif
+
void
miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
{
@@ -421,6 +430,19 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
Bool solid = TRUE;
DrawablePtr drawable = &pWin->drawable;
+#ifdef ROOTLESS
+ if (IsFramedWindow(pWin)) {
+ RootlessStartDrawing(pWin);
+ RootlessDamageRegion(pWin, prgn);
+
+ if (pWin->backgroundState == ParentRelative) {
+ if ((what == PW_BACKGROUND) ||
+ (what == PW_BORDER && !pWin->borderIsPixel))
+ RootlessSetPixmapOfAncestors(pWin);
+ }
+ }
+#endif
+
if (what == PW_BACKGROUND) {
while (pWin->backgroundState == ParentRelative)
pWin = pWin->parent;
diff --git a/mi/mioverlay.c b/mi/mioverlay.c
index b8b7a5ba8..a2715e9d7 100644
--- a/mi/mioverlay.c
+++ b/mi/mioverlay.c
@@ -844,8 +844,8 @@ miOverlayHandleExposures(WindowPtr pWin)
if ((mival = pTree->valdata)) {
if (!((*pPriv->InOverlay) (pTree->pWin))) {
if (RegionNotEmpty(&mival->borderExposed)) {
- pScreen->PaintWindow(pTree->pWin, &mival->borderExposed,
- PW_BORDER);
+ miPaintWindow(pTree->pWin, &mival->borderExposed,
+ PW_BORDER);
}
RegionUninit(&mival->borderExposed);
@@ -883,8 +883,7 @@ miOverlayHandleExposures(WindowPtr pWin)
}
else {
if (RegionNotEmpty(&val->after.borderExposed)) {
- pScreen->PaintWindow(pChild, &val->after.borderExposed,
- PW_BORDER);
+ miPaintWindow(pChild, &val->after.borderExposed, PW_BORDER);
}
(*WindowExposures) (pChild, &val->after.exposed);
}
@@ -1008,7 +1007,7 @@ miOverlayWindowExposures(WindowPtr pWin, RegionPtr prgn)
else
RegionIntersect(prgn, prgn, &pWin->clipList);
}
- pScreen->PaintWindow(pWin, prgn, PW_BACKGROUND);
+ miPaintWindow(pWin, prgn, PW_BACKGROUND);
if (clientInterested)
miSendExposures(pWin, exposures,
pWin->drawable.x, pWin->drawable.y);
@@ -1607,7 +1606,7 @@ miOverlayClearToBackground(WindowPtr pWin,
if (generateExposures)
(*pScreen->WindowExposures) (pWin, ®);
else if (pWin->backgroundState != None)
- pScreen->PaintWindow(pWin, ®, PW_BACKGROUND);
+ miPaintWindow(pWin, ®, PW_BACKGROUND);
RegionUninit(®);
}
diff --git a/mi/miscrinit.c b/mi/miscrinit.c
index 3bb52b1bc..e4270fe79 100644
--- a/mi/miscrinit.c
+++ b/mi/miscrinit.c
@@ -268,7 +268,6 @@ miScreenInit(ScreenPtr pScreen, void *pbits, /* pointer to screen bits */
pScreen->ClearToBackground = miClearToBackground;
pScreen->ClipNotify = (ClipNotifyProcPtr) 0;
pScreen->RestackWindow = (RestackWindowProcPtr) 0;
- pScreen->PaintWindow = miPaintWindow;
/* CreatePixmap, DestroyPixmap */
/* RealizeFont, UnrealizeFont */
/* CreateGC */
diff --git a/mi/miwindow.c b/mi/miwindow.c
index 39c279e18..2fc7cfb79 100644
--- a/mi/miwindow.c
+++ b/mi/miwindow.c
@@ -113,7 +113,7 @@ miClearToBackground(WindowPtr pWin,
if (generateExposures)
(*pWin->drawable.pScreen->WindowExposures) (pWin, ®);
else if (pWin->backgroundState != None)
- pWin->drawable.pScreen->PaintWindow(pWin, ®, PW_BACKGROUND);
+ miPaintWindow(pWin, ®, PW_BACKGROUND);
RegionUninit(®);
}
@@ -219,9 +219,7 @@ miHandleValidateExposures(WindowPtr pWin)
while (1) {
if ((val = pChild->valdata)) {
if (RegionNotEmpty(&val->after.borderExposed))
- pWin->drawable.pScreen->PaintWindow(pChild,
- &val->after.borderExposed,
- PW_BORDER);
+ miPaintWindow(pChild, &val->after.borderExposed, PW_BORDER);
RegionUninit(&val->after.borderExposed);
(*WindowExposures) (pChild, &val->after.exposed);
RegionUninit(&val->after.exposed);
diff --git a/miext/rootless/rootlessCommon.h b/miext/rootless/rootlessCommon.h
index d9a4d05e9..8016662cf 100644
--- a/miext/rootless/rootlessCommon.h
+++ b/miext/rootless/rootlessCommon.h
@@ -94,7 +94,6 @@ typedef struct _RootlessScreenRec {
ChangeBorderWidthProcPtr ChangeBorderWidth;
PositionWindowProcPtr PositionWindow;
ChangeWindowAttributesProcPtr ChangeWindowAttributes;
- PaintWindowProcPtr PaintWindow;
CreateGCProcPtr CreateGC;
CopyWindowProcPtr CopyWindow;
diff --git a/miext/rootless/rootlessScreen.c b/miext/rootless/rootlessScreen.c
index 79fe3507b..7f0926c20 100644
--- a/miext/rootless/rootlessScreen.c
+++ b/miext/rootless/rootlessScreen.c
@@ -466,7 +466,7 @@ expose_1(WindowPtr pWin)
if (!pWin->realized)
return;
- pWin->drawable.pScreen->PaintWindow(pWin, &pWin->borderClip, PW_BACKGROUND);
+ miPaintWindow(pWin, &pWin->borderClip, PW_BACKGROUND);
/* FIXME: comments in windowstr.h indicate that borderClip doesn't
include subwindow visibility. But I'm not so sure.. so we may
@@ -662,7 +662,6 @@ RootlessWrap(ScreenPtr pScreen)
WRAP(CloseScreen);
WRAP(CreateGC);
WRAP(CopyWindow);
- WRAP(PaintWindow);
WRAP(GetImage);
WRAP(SourceValidate);
WRAP(CreateWindow);
diff --git a/miext/rootless/rootlessWindow.c b/miext/rootless/rootlessWindow.c
index 5cecfdff5..f1de09a40 100644
--- a/miext/rootless/rootlessWindow.c
+++ b/miext/rootless/rootlessWindow.c
@@ -720,7 +720,7 @@ RootlessResizeCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg,
/*
* RootlessCopyWindow
* Update *new* location of window. Old location is redrawn with
- * PaintWindow. Cloned from fbCopyWindow.
+ * miPaintWindow. Cloned from fbCopyWindow.
* The original always draws on the root pixmap, which we don't have.
* Instead, draw on the parent window's pixmap.
*/
@@ -794,27 +794,6 @@ RootlessCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
RL_DEBUG_MSG("copywindowFB end\n");
}
-void
-RootlessPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
-
- if (IsFramedWindow(pWin)) {
- RootlessStartDrawing(pWin);
- RootlessDamageRegion(pWin, prgn);
-
- if (pWin->backgroundState == ParentRelative) {
- if ((what == PW_BACKGROUND) ||
- (what == PW_BORDER && !pWin->borderIsPixel))
- RootlessSetPixmapOfAncestors(pWin);
- }
- }
-
- SCREEN_UNWRAP(pScreen, PaintWindow);
- pScreen->PaintWindow(pWin, prgn, what);
- SCREEN_WRAP(pScreen, PaintWindow);
-}
-
/*
* Window resize procedures
*/
diff --git a/miext/rootless/rootlessWindow.h b/miext/rootless/rootlessWindow.h
index 4fd34d54d..d3955fc89 100644
--- a/miext/rootless/rootlessWindow.h
+++ b/miext/rootless/rootlessWindow.h
@@ -48,7 +48,6 @@ Bool RootlessUnrealizeWindow(WindowPtr pWin);
void RootlessRestackWindow(WindowPtr pWin, WindowPtr pOldNextSib);
void RootlessCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg,
RegionPtr prgnSrc);
-void RootlessPaintWindow(WindowPtr pWin, RegionPtr prgn, int what);
void RootlessMoveWindow(WindowPtr pWin, int x, int y, WindowPtr pSib,
VTKind kind);
void RootlessResizeWindow(WindowPtr pWin, int x, int y, unsigned int w,
commit f314a1fa9411f83f74af697370ce618d280e4a4a
Author: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
Date: Sun Jan 1 23:15:00 2023 -0800
HAX: Disable gravity in RootlessResizeWindow because it's not working right now...
diff --git a/miext/rootless/rootlessWindow.c b/miext/rootless/rootlessWindow.c
index fe09c7fe5..5cecfdff5 100644
--- a/miext/rootless/rootlessWindow.c
+++ b/miext/rootless/rootlessWindow.c
@@ -1284,7 +1284,7 @@ RootlessResizeWindow(WindowPtr pWin, int x, int y,
newW = w + 2 * newBW;
newH = h + 2 * newBW;
- resize_after = StartFrameResize(pWin, TRUE,
+ resize_after = StartFrameResize(pWin, FALSE,
oldX, oldY, oldW, oldH, oldBW,
newX, newY, newW, newH, newBW);
}
@@ -1296,7 +1296,7 @@ RootlessResizeWindow(WindowPtr pWin, int x, int y,
NORMAL_ROOT(pWin);
if (winRec) {
- FinishFrameResize(pWin, TRUE, oldX, oldY, oldW, oldH, oldBW,
+ FinishFrameResize(pWin, FALSE, oldX, oldY, oldW, oldH, oldBW,
newX, newY, newW, newH, newBW, resize_after);
}
}
commit b1abd4e2da9a566e0948bb5e2edb592e97c8ac61
Author: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
Date: Sun Jan 1 23:18:13 2023 -0800
HAX: Disable ROOTLESS_RESIZE_GRAVITY for now
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
diff --git a/miext/rootless/rootlessConfig.h b/miext/rootless/rootlessConfig.h
index 4c464b9f5..6f2bfe4bd 100644
--- a/miext/rootless/rootlessConfig.h
+++ b/miext/rootless/rootlessConfig.h
@@ -35,7 +35,7 @@
#define _ROOTLESSCONFIG_H
#ifdef __APPLE__
-#define ROOTLESS_RESIZE_GRAVITY TRUE
+// #define ROOTLESS_RESIZE_GRAVITY TRUE
#endif
/*# define ROOTLESSDEBUG*/
commit 2d4f726885f205fe2f7f1f8c3b673d2997639f39
Author: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
Date: Tue Jun 14 11:03:31 2022 -0700
Revert "os/WaitFor: Check timers on every iteration"
Workaround a performance issue that this introduces in XQuartz
Fixes: https://github.com/XQuartz/XQuartz/issues/166
This reverts commit ac7a4bf44c68c5f323375974b208d4530fb5b60f.
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
diff --git a/os/WaitFor.c b/os/WaitFor.c
index ff1d376e9..8f93845e0 100644
--- a/os/WaitFor.c
+++ b/os/WaitFor.c
@@ -192,11 +192,12 @@ WaitForSomething(Bool are_ready)
ProcessWorkQueue();
}
- timeout = check_timers();
are_ready = clients_are_ready();
if (are_ready)
timeout = 0;
+ else
+ timeout = check_timers();
BlockHandler(&timeout);
if (NewOutputPending)
commit 1572e05ff0e381bed50b59b87edf17e3a9ec5587
Author: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
Date: Sun Sep 11 02:19:19 2016 -0700
randr: Initialize RandR even if there are currently no screens attached
Failure to do so causes an overvlow in RRClientCallback().
=================================================================
==41262==ERROR: AddressSanitizer: global-buffer-overflow on address 0x000103ccfbc8 at pc 0x0001034f32b9 bp 0x7000035a94c0 sp 0x7000035a94b8
WRITE of size 4 at 0x000103ccfbc8 thread T6
#0 0x1034f32b8 in RRClientCallback randr.c:72
#1 0x1038c75e3 in _CallCallbacks dixutils.c:737
#2 0x10388f406 in CallCallbacks callback.h:83
#3 0x1038bc49a in NextAvailableClient dispatch.c:3562
#4 0x103ad094c in AllocNewConnection connection.c:777
#5 0x103ad1695 in EstablishNewConnections connection.c:863
#6 0x1038c6630 in ProcessWorkQueue dixutils.c:523
#7 0x103ab2dbf in WaitForSomething WaitFor.c:175
#8 0x103880836 in Dispatch dispatch.c:411
#9 0x1038c2141 in dix_main main.c:301
#10 0x1032ac75a in server_thread quartzStartup.c:66
#11 0x7fffc5f16aaa in _pthread_body (libsystem_pthread.dylib+0x3aaa)
#12 0x7fffc5f169f6 in _pthread_start (libsystem_pthread.dylib+0x39f6)
#13 0x7fffc5f161fc in thread_start (libsystem_pthread.dylib+0x31fc)
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
(cherry picked from commit f9235000d67a61b0de951598146b4b5e0032384e)
diff --git a/randr/randr.c b/randr/randr.c
index 6d02c2577..a8e4d1514 100644
--- a/randr/randr.c
+++ b/randr/randr.c
@@ -414,9 +414,6 @@ RRExtensionInit(void)
{
ExtensionEntry *extEntry;
- if (RRNScreens == 0)
- return;
-
if (!dixRegisterPrivateKey(&RRClientPrivateKeyRec, PRIVATE_CLIENT,
sizeof(RRClientRec) +
screenInfo.numScreens * sizeof(RRTimesRec)))
commit 88e111f033ceb65ba4ecbd30f7a033384569e73b
Author: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
Date: Sun Sep 11 02:47:00 2016 -0700
glx: Initialize glx even if there are currently no screens attached
Failure to do so causes an overvlow in glxClientCallback
Application Specific Information:
X.Org X Server 1.18.99.1 Build Date: 20160911
=================================================================
==52118==ERROR: AddressSanitizer: SEGV on unknown address 0x000102b27b80 (pc 0x000103433245 bp 0x70000de67c20 sp 0x70000de67c00 T6)
#0 0x103433244 in __asan::asan_free(void*, __sanitizer::BufferedStackTrace*, __asan::AllocType) (libclang_rt.asan_osx_dynamic.dylib+0x3244)
#1 0x10347aeee in wrap_free (libclang_rt.asan_osx_dynamic.dylib+0x4aeee)
#2 0x102e6a5ed in glxClientCallback glxext.c:301
#3 0x102b672a3 in _CallCallbacks dixutils.c:737
#4 0x102b2f0c6 in CallCallbacks callback.h:83
#5 0x102b5c15a in NextAvailableClient dispatch.c:3562
#6 0x102d7060c in AllocNewConnection connection.c:777
#7 0x102d71355 in EstablishNewConnections connection.c:863
#8 0x102b662f0 in ProcessWorkQueue dixutils.c:523
#9 0x102d52a7f in WaitForSomething WaitFor.c:175
#10 0x102b204f6 in Dispatch dispatch.c:411
#11 0x102b61e01 in dix_main main.c:301
#12 0x10254c42a in server_thread quartzStartup.c:66
#13 0x7fffc5f16aaa in _pthread_body (libsystem_pthread.dylib+0x3aaa)
#14 0x7fffc5f169f6 in _pthread_start (libsystem_pthread.dylib+0x39f6)
#15 0x7fffc5f161fc in thread_start (libsystem_pthread.dylib+0x31fc)
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
(cherry picked from commit 1d2293101fca46c9a68c553f1be8e815c40de69a)
diff --git a/glx/glxext.c b/glx/glxext.c
index 99f866104..9a0493388 100644
--- a/glx/glxext.c
+++ b/glx/glxext.c
@@ -281,24 +281,6 @@ 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) &&
- screen->visuals[j].nplanes > 12)
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
static void
GetGLXDrawableBytes(void *value, XID id, ResourceSizePtr size)
{
@@ -472,10 +454,6 @@ static Bool
xorgGlxServerPreInit(const ExtensionEntry *extEntry)
{
if (glxGeneration != serverGeneration) {
- /* Mesa requires at least one True/DirectColor visual */
- if (!checkScreenVisuals())
- return FALSE;
-
__glXContextRes = CreateNewResourceType((DeleteType) ContextGone,
"GLXContext");
__glXDrawableRes = CreateNewResourceType((DeleteType) DrawableGone,
commit 89bad0227b4f9502f6f7013a68dedb58cc2d925f
Author: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
Date: Thu Dec 22 08:37:10 2022 -0800
Set thread priorities to user interactive or user initiated as appropriate
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index dd96e89f7..752ddc3f6 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -735,6 +735,9 @@ create_thread(void *(*func)(void *), void *arg)
pthread_attr_init(&attr);
pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+ if (&pthread_attr_set_qos_class_np) {
+ pthread_attr_set_qos_class_np(&attr, QOS_CLASS_USER_INITIATED, 0);
+ }
pthread_create(&tid, &attr, func, arg);
pthread_attr_destroy(&attr);
diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c
index fd87e968b..15c1bc5d8 100644
--- a/hw/xquartz/darwinEvents.c
+++ b/hw/xquartz/darwinEvents.c
@@ -129,6 +129,9 @@ create_thread(void *(*func)(void *), void *arg)
pthread_attr_init(&attr);
pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+ if (&pthread_attr_set_qos_class_np) {
+ pthread_attr_set_qos_class_np(&attr, QOS_CLASS_USER_INITIATED, 0);
+ }
pthread_create(&tid, &attr, func, arg);
pthread_attr_destroy(&attr);
diff --git a/hw/xquartz/quartzStartup.c b/hw/xquartz/quartzStartup.c
index 732eba983..9137edb66 100644
--- a/hw/xquartz/quartzStartup.c
+++ b/hw/xquartz/quartzStartup.c
@@ -74,6 +74,9 @@ create_thread(void *func, void *arg)
pthread_attr_init(&attr);
pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+ if (&pthread_attr_set_qos_class_np) {
+ pthread_attr_set_qos_class_np(&attr, QOS_CLASS_USER_INTERACTIVE, 0);
+ }
pthread_create(&tid, &attr, func, arg);
pthread_attr_destroy(&attr);
diff --git a/os/inputthread.c b/os/inputthread.c
index 3469cfc1c..bd0a8335f 100644
--- a/os/inputthread.c
+++ b/os/inputthread.c
@@ -479,6 +479,12 @@ InputThreadInit(void)
if (pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM) != 0)
ErrorF("input-thread: error setting thread scope\n");
+#ifdef __APPLE__
+ if (&pthread_attr_set_qos_class_np) {
+ pthread_attr_set_qos_class_np(&attr, QOS_CLASS_USER_INTERACTIVE, 0);
+ }
+#endif
+
DebugF("input-thread: creating thread\n");
pthread_create(&inputThreadInfo->thread, &attr,
&InputThreadDoWork, NULL);
commit 3c4b6d118ae11406de6689ed6dd3b7c62960ea51
Author: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
Date: Sun Nov 27 22:25:49 2022 -0800
Revert "meson: Don't build COMPOSITE for XQuartz"
This will allow us to remove build-time conditionalization on COMPOSITE
while still allowing XQuartz to disable it and use ROOTLESS.
This reverts commit 9c0373366988cc0b909ba31e61c43cc46e054b40.
diff --git a/include/meson.build b/include/meson.build
index 1ca0e76cf..6c1c1dcd4 100644
--- a/include/meson.build
+++ b/include/meson.build
@@ -199,9 +199,7 @@ conf_data.set('UNIXCONN', host_machine.system() != 'windows' ? '1' : false)
conf_data.set('IPv6', build_ipv6 ? '1' : false)
conf_data.set('BIGREQS', '1')
-if build_composite
- conf_data.set('COMPOSITE', '1')
-endif
+conf_data.set('COMPOSITE', '1')
conf_data.set('DAMAGE', '1')
conf_data.set('DBE', '1')
conf_data.set('DGA', build_dga ? '1' : false)
diff --git a/meson.build b/meson.build
index dc77b85a3..fd85ad86a 100644
--- a/meson.build
+++ b/meson.build
@@ -276,10 +276,8 @@ else
build_xquartz = get_option('xquartz') == 'true'
endif
-build_composite = true
build_rootless = false
if build_xquartz
- build_composite = false
build_rootless = true
endif
@@ -770,9 +768,7 @@ subdir('fb')
subdir('mi')
subdir('os')
# X extensions
-if build_composite
- subdir('composite')
-endif
+subdir('composite')
subdir('damageext')
subdir('dbe')
subdir('miext/damage')
@@ -806,6 +802,7 @@ libxserver = [
libxserver_mi,
libxserver_dix,
+ libxserver_composite,
libxserver_damageext,
libxserver_dbe,
libxserver_randr,
@@ -822,10 +819,6 @@ libxserver = [
libxserver_os,
]
-if build_composite
- libxserver += libxserver_composite
-endif
-
libxserver += libxserver_dri3
subdir('hw')
commit 261cfd22ff687f2e4b3291351477a67563679ef3
Author: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
Date: Sun Nov 27 22:23:43 2022 -0800
xquartz: Disable COMPOSITE at runtime
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
diff --git a/hw/xquartz/mach-startup/bundle-main.c b/hw/xquartz/mach-startup/bundle-main.c
index 353e1d2bc..de82e2280 100644
--- a/hw/xquartz/mach-startup/bundle-main.c
+++ b/hw/xquartz/mach-startup/bundle-main.c
@@ -72,6 +72,10 @@ FatalError(const char *f, ...) _X_ATTRIBUTE_PRINTF(1, 2) _X_NORETURN;
extern int noPanoramiXExtension;
+#ifdef COMPOSITE
+extern Bool noCompositeExtension;
+#endif
+
#define DEFAULT_CLIENT X11BINDIR "/xterm"
#define DEFAULT_STARTX X11BINDIR "/startx -- " X11BINDIR "/Xquartz"
#define DEFAULT_SHELL "/bin/sh"
@@ -635,6 +639,11 @@ main(int argc, char **argv, char **envp)
/* The server must not run the PanoramiX operations. */
noPanoramiXExtension = TRUE;
+#ifdef COMPOSITE
+ /* https://gitlab.freedesktop.org/xorg/xserver/-/issues/1409 */
+ noCompositeExtension = TRUE;
+#endif
+
/* Setup the initial crasherporter info */
strlcpy(__crashreporter_info_buff__, __crashreporter_info__base,
sizeof(__crashreporter_info_buff__));
commit f25cd21ff7f2fce0da0c5c2c40cb06e9a25107d3
Author: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
Date: Sun Jan 1 10:47:17 2023 -0800
rootless: Fixup some format errors in debug logging
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
diff --git a/miext/rootless/rootlessCommon.h b/miext/rootless/rootlessCommon.h
index 83dec3bb7..d9a4d05e9 100644
--- a/miext/rootless/rootlessCommon.h
+++ b/miext/rootless/rootlessCommon.h
@@ -282,4 +282,5 @@ void RootlessDisableRoot(ScreenPtr pScreen);
void RootlessSetPixmapOfAncestors(WindowPtr pWin);
+unsigned long RootlessWID(WindowPtr pWindow);
#endif /* _ROOTLESSCOMMON_H */
diff --git a/miext/rootless/rootlessGC.c b/miext/rootless/rootlessGC.c
index 52d9df9ce..5af18a4a0 100644
--- a/miext/rootless/rootlessGC.c
+++ b/miext/rootless/rootlessGC.c
@@ -549,7 +549,7 @@ RootlessCopyArea(DrawablePtr pSrc, DrawablePtr dst, GCPtr pGC,
GC_SAVE(pGC);
GCOP_UNWRAP(pGC);
- RL_DEBUG_MSG("copy area start (src 0x%x, dst 0x%x)", pSrc, dst);
+ RL_DEBUG_MSG("copy area start (src %p, dst %p)", pSrc, dst);
if (pSrc->type == DRAWABLE_WINDOW && IsFramedWindow((WindowPtr) pSrc)) {
/* If both source and dest are windows, and we're doing
@@ -800,7 +800,7 @@ static void
RootlessPolySegment(DrawablePtr dst, GCPtr pGC, int nseg, xSegment * pSeg)
{
GCOP_UNWRAP(pGC);
- RL_DEBUG_MSG("poly segment start (win 0x%x)", dst);
+ RL_DEBUG_MSG("poly segment start (dst %p)", dst);
RootlessStartDrawing((WindowPtr) dst);
pGC->ops->PolySegment(dst, pGC, nseg, pSeg);
@@ -998,7 +998,7 @@ RootlessFillPolygon(DrawablePtr dst, GCPtr pGC,
{
GC_SAVE(pGC);
GCOP_UNWRAP(pGC);
- RL_DEBUG_MSG("fill poly start (win 0x%x, fillStyle 0x%x)", dst,
+ RL_DEBUG_MSG("fill poly start (dst %p, fillStyle 0x%x)", dst,
pGC->fillStyle);
if (count <= 2) {
@@ -1072,7 +1072,7 @@ RootlessPolyFillRect(DrawablePtr dst, GCPtr pGC,
{
GC_SAVE(pGC);
GCOP_UNWRAP(pGC);
- RL_DEBUG_MSG("fill rect start (win 0x%x, fillStyle 0x%x)", dst,
+ RL_DEBUG_MSG("fill rect start (dst %p, fillStyle 0x%x)", dst,
pGC->fillStyle);
if (nRectsInit <= 0) {
diff --git a/miext/rootless/rootlessWindow.c b/miext/rootless/rootlessWindow.c
index 106d4320e..fe09c7fe5 100644
--- a/miext/rootless/rootlessWindow.c
+++ b/miext/rootless/rootlessWindow.c
@@ -325,7 +325,7 @@ RootlessPositionWindow(WindowPtr pWin, int x, int y)
RootlessWindowRec *winRec = WINREC(pWin);
Bool result;
- RL_DEBUG_MSG("positionwindow start (win 0x%x @ %i, %i)\n", pWin, x, y);
+ RL_DEBUG_MSG("positionwindow start (win %p (%lu) @ %i, %i)\n", pWin, RootlessWID(pWin), x, y);
if (winRec) {
if (winRec->is_drawing) {
@@ -441,7 +441,7 @@ RootlessRealizeWindow(WindowPtr pWin)
RegionRec saveRoot;
ScreenPtr pScreen = pWin->drawable.pScreen;
- RL_DEBUG_MSG("realizewindow start (win 0x%x) ", pWin);
+ RL_DEBUG_MSG("realizewindow start (win %p (%lu)) ", pWin, RootlessWID(pWin));
if ((IsTopLevel(pWin) && pWin->drawable.class == InputOutput)) {
RootlessWindowRec *winRec;
@@ -664,7 +664,7 @@ RootlessResizeCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg,
RegionRec rgnDst;
int dx, dy;
- RL_DEBUG_MSG("resizecopywindowFB start (win 0x%x) ", pWin);
+ RL_DEBUG_MSG("resizecopywindowFB start (win %p (%lu)) ", pWin, RootlessWID(pWin));
/* Don't unwrap pScreen->CopyWindow.
The bogus rewrap with RootlessCopyWindow causes a crash if
@@ -733,7 +733,7 @@ RootlessCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
BoxPtr extents;
int area;
- RL_DEBUG_MSG("copywindowFB start (win 0x%x) ", pWin);
+ RL_DEBUG_MSG("copywindowFB start (win %p (%lu)) ", pWin, RootlessWID(pWin));
SCREEN_UNWRAP(pScreen, CopyWindow);
@@ -1268,7 +1268,7 @@ RootlessResizeWindow(WindowPtr pWin, int x, int y,
Bool resize_after = FALSE;
RegionRec saveRoot;
- RL_DEBUG_MSG("resizewindow start (win 0x%x) ", pWin);
+ RL_DEBUG_MSG("resizewindow start (win %p (%lu)) ", pWin, RootlessWID(pWin));
if (pWin->parent) {
if (winRec) {
@@ -1649,7 +1649,7 @@ RootlessSetPixmapOfAncestors(WindowPtr pWin)
XID pixel = 0;
ChangeWindowAttributes(pWin, CWBackPixel, &pixel, serverClient);
- RL_DEBUG_MSG("Cleared ParentRelative on 0x%x.\n", pWin);
+ RL_DEBUG_MSG("Cleared ParentRelative on %p (%lu).\n", pWin, RootlessWID(pWin));
break;
}
More information about the xorg-commit
mailing list