rootless: Add additional debug logging to help triage XQuartz fb/rootless/damage crashes
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
(cherry picked from commit 07ed1a623a)
			
			
This commit is contained in:
		
							parent
							
								
									264272f3d7
								
							
						
					
					
						commit
						a0216de236
					
				| 
						 | 
				
			
			@ -134,6 +134,23 @@ RootlessResolveColormap(ScreenPtr pScreen, int first_color,
 | 
			
		|||
    return TRUE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
unsigned long RootlessWID(WindowPtr pWindow) {
 | 
			
		||||
    ScreenPtr pScreen = pWindow->drawable.pScreen;
 | 
			
		||||
    WindowPtr top = TopLevelParent(pWindow);
 | 
			
		||||
    RootlessWindowRec *winRec;
 | 
			
		||||
    PixmapPtr curPixmap;
 | 
			
		||||
 | 
			
		||||
    if (top == NULL) {
 | 
			
		||||
        return 0;
 | 
			
		||||
    }
 | 
			
		||||
    winRec = WINREC(top);
 | 
			
		||||
    if (winRec == NULL) {
 | 
			
		||||
        return 0;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return (unsigned long)(uintptr_t)winRec->wid;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * RootlessStartDrawing
 | 
			
		||||
 *  Prepare a window for direct access to its backing buffer.
 | 
			
		||||
| 
						 | 
				
			
			@ -148,11 +165,15 @@ RootlessStartDrawing(WindowPtr pWindow)
 | 
			
		|||
    RootlessWindowRec *winRec;
 | 
			
		||||
    PixmapPtr curPixmap;
 | 
			
		||||
 | 
			
		||||
    if (top == NULL)
 | 
			
		||||
    if (top == NULL) {
 | 
			
		||||
        RL_DEBUG_MSG("RootlessStartDrawing is a no-op because top == NULL.\n");
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
    winRec = WINREC(top);
 | 
			
		||||
    if (winRec == NULL)
 | 
			
		||||
    if (winRec == NULL) {
 | 
			
		||||
        RL_DEBUG_MSG("RootlessStartDrawing is a no-op because winRec == NULL.\n");
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // Make sure the window's top-level parent is prepared for drawing.
 | 
			
		||||
    if (!winRec->is_drawing) {
 | 
			
		||||
| 
						 | 
				
			
			@ -166,10 +187,23 @@ RootlessStartDrawing(WindowPtr pWindow)
 | 
			
		|||
                                   top->drawable.depth,
 | 
			
		||||
                                   top->drawable.bitsPerPixel,
 | 
			
		||||
                                   winRec->bytesPerRow, winRec->pixelData);
 | 
			
		||||
 | 
			
		||||
        RL_DEBUG_MSG("GetScratchPixmapHeader gave us %p %p (%d,%d %dx%d %d) for wid=%lu\n",
 | 
			
		||||
                     winRec->pixmap, 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));
 | 
			
		||||
 | 
			
		||||
        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",
 | 
			
		||||
                     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->is_drawing = TRUE;
 | 
			
		||||
    } else {
 | 
			
		||||
        RL_DEBUG_MSG("Skipped call to xprStartDrawing (wid: %lu) because winRec->is_drawing says we already did.\n", RootlessWID(pWindow));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    curPixmap = pScreen->GetWindowPixmap(pWindow);
 | 
			
		||||
| 
						 | 
				
			
			@ -181,6 +215,10 @@ RootlessStartDrawing(WindowPtr pWindow)
 | 
			
		|||
        PixmapPtr oldPixmap =
 | 
			
		||||
            dixLookupPrivate(&pWindow->devPrivates,
 | 
			
		||||
                             rootlessWindowOldPixmapPrivateKey);
 | 
			
		||||
 | 
			
		||||
        RL_DEBUG_MSG("curPixmap is %p %p for wid=%lu\n", curPixmap, curPixmap ? curPixmap->devPrivate.ptr : NULL, RootlessWID(pWindow));
 | 
			
		||||
        RL_DEBUG_MSG("oldPixmap is %p %p for wid=%lu\n", oldPixmap, oldPixmap ? oldPixmap->devPrivate.ptr : NULL, RootlessWID(pWindow));
 | 
			
		||||
 | 
			
		||||
        if (oldPixmap != NULL) {
 | 
			
		||||
            if (oldPixmap == curPixmap)
 | 
			
		||||
                RL_DEBUG_MSG
 | 
			
		||||
| 
						 | 
				
			
			@ -277,7 +315,7 @@ RootlessDamageRegion(WindowPtr pWindow, RegionPtr pRegion)
 | 
			
		|||
    WindowPtr pTop;
 | 
			
		||||
    BoxPtr b1, b2;
 | 
			
		||||
 | 
			
		||||
    RL_DEBUG_MSG("Damaged win 0x%x ", pWindow);
 | 
			
		||||
    RL_DEBUG_MSG("Damaged win %p\n", pWindow);
 | 
			
		||||
 | 
			
		||||
    pTop = TopLevelParent(pWindow);
 | 
			
		||||
    if (pTop == NULL)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue