(!1714) xfree86: dri: use window destructor hook
Wrapping ScreenRec's function pointers is problematic for many reasons, so use the new window destructor hook instead. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
		
							parent
							
								
									bb77211dd4
								
							
						
					
					
						commit
						c38ac237ed
					
				| 
						 | 
					@ -46,7 +46,6 @@ typedef struct dri3_dmabuf_format {
 | 
				
			||||||
typedef struct dri3_screen_priv {
 | 
					typedef struct dri3_screen_priv {
 | 
				
			||||||
    CloseScreenProcPtr          CloseScreen;
 | 
					    CloseScreenProcPtr          CloseScreen;
 | 
				
			||||||
    ConfigNotifyProcPtr         ConfigNotify;
 | 
					    ConfigNotifyProcPtr         ConfigNotify;
 | 
				
			||||||
    DestroyWindowProcPtr        DestroyWindow;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Bool                        formats_cached;
 | 
					    Bool                        formats_cached;
 | 
				
			||||||
    CARD32                      num_formats;
 | 
					    CARD32                      num_formats;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -48,6 +48,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 | 
				
			||||||
#include <X11/Xproto.h>
 | 
					#include <X11/Xproto.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "dix/dix_priv.h"
 | 
					#include "dix/dix_priv.h"
 | 
				
			||||||
 | 
					#include "dix/screen_hooks_priv.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "xf86.h"
 | 
					#include "xf86.h"
 | 
				
			||||||
#include "xf86drm.h"
 | 
					#include "xf86drm.h"
 | 
				
			||||||
| 
						 | 
					@ -644,7 +645,7 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD)
 | 
				
			||||||
    return TRUE;
 | 
					    return TRUE;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static Bool DRIDestroyWindow(WindowPtr pWin);
 | 
					static void DRIWindowDestroy(CallbackListPtr *pcbl, ScreenPtr pScreen, WindowPtr pWin);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Bool
 | 
					Bool
 | 
				
			||||||
DRIFinishScreenInit(ScreenPtr pScreen)
 | 
					DRIFinishScreenInit(ScreenPtr pScreen)
 | 
				
			||||||
| 
						 | 
					@ -660,8 +661,7 @@ DRIFinishScreenInit(ScreenPtr pScreen)
 | 
				
			||||||
        pScreen->WindowExposures = pDRIInfo->wrap.WindowExposures;
 | 
					        pScreen->WindowExposures = pDRIInfo->wrap.WindowExposures;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pDRIPriv->DestroyWindow = pScreen->DestroyWindow;
 | 
					    dixScreenHookWindowDestroy(pScreen, DRIWindowDestroy);
 | 
				
			||||||
    pScreen->DestroyWindow = DRIDestroyWindow;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pDRIPriv->xf86_crtc_notify = xf86_wrap_crtc_notify(pScreen,
 | 
					    pDRIPriv->xf86_crtc_notify = xf86_wrap_crtc_notify(pScreen,
 | 
				
			||||||
                                                       dri_crtc_notify);
 | 
					                                                       dri_crtc_notify);
 | 
				
			||||||
| 
						 | 
					@ -708,11 +708,8 @@ DRICloseScreen(ScreenPtr pScreen)
 | 
				
			||||||
                pScreen->WindowExposures = pDRIPriv->wrap.WindowExposures;
 | 
					                pScreen->WindowExposures = pDRIPriv->wrap.WindowExposures;
 | 
				
			||||||
                pDRIPriv->wrap.WindowExposures = NULL;
 | 
					                pDRIPriv->wrap.WindowExposures = NULL;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            if (pDRIPriv->DestroyWindow) {
 | 
					 | 
				
			||||||
                pScreen->DestroyWindow = pDRIPriv->DestroyWindow;
 | 
					 | 
				
			||||||
                pDRIPriv->DestroyWindow = NULL;
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            dixScreenUnhookWindowDestroy(pScreen, DRIWindowDestroy);
 | 
				
			||||||
            xf86_unwrap_crtc_notify(pScreen, pDRIPriv->xf86_crtc_notify);
 | 
					            xf86_unwrap_crtc_notify(pScreen, pDRIPriv->xf86_crtc_notify);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (pDRIInfo->wrap.CopyWindow) {
 | 
					            if (pDRIInfo->wrap.CopyWindow) {
 | 
				
			||||||
| 
						 | 
					@ -1990,29 +1987,9 @@ DRITreeTraversal(WindowPtr pWin, void *data)
 | 
				
			||||||
    return WT_WALKCHILDREN;
 | 
					    return WT_WALKCHILDREN;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static Bool
 | 
					static void DRIWindowDestroy(CallbackListPtr *pcbl, ScreenPtr pScreen, WindowPtr pWin)
 | 
				
			||||||
DRIDestroyWindow(WindowPtr pWin)
 | 
					 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    ScreenPtr pScreen = pWin->drawable.pScreen;
 | 
					 | 
				
			||||||
    DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
 | 
					 | 
				
			||||||
    Bool retval = TRUE;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    DRIDrawablePrivDestroy(pWin);
 | 
					    DRIDrawablePrivDestroy(pWin);
 | 
				
			||||||
 | 
					 | 
				
			||||||
    /* call lower wrapped functions */
 | 
					 | 
				
			||||||
    if (pDRIPriv->DestroyWindow) {
 | 
					 | 
				
			||||||
        /* unwrap */
 | 
					 | 
				
			||||||
        pScreen->DestroyWindow = pDRIPriv->DestroyWindow;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        /* call lower layers */
 | 
					 | 
				
			||||||
        retval = (*pScreen->DestroyWindow) (pWin);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        /* rewrap */
 | 
					 | 
				
			||||||
        pDRIPriv->DestroyWindow = pScreen->DestroyWindow;
 | 
					 | 
				
			||||||
        pScreen->DestroyWindow = DRIDestroyWindow;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    return retval;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void
 | 
					void
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -86,7 +86,6 @@ typedef struct _DRIScreenPrivRec {
 | 
				
			||||||
    DrawablePtr fullscreen;     /* pointer to fullscreen drawable */
 | 
					    DrawablePtr fullscreen;     /* pointer to fullscreen drawable */
 | 
				
			||||||
    drm_clip_rect_t fullscreen_rect;    /* fake rect for fullscreen mode */
 | 
					    drm_clip_rect_t fullscreen_rect;    /* fake rect for fullscreen mode */
 | 
				
			||||||
    DRIWrappedFuncsRec wrap;
 | 
					    DRIWrappedFuncsRec wrap;
 | 
				
			||||||
    DestroyWindowProcPtr DestroyWindow;
 | 
					 | 
				
			||||||
    DrawablePtr DRIDrawables[SAREA_MAX_DRAWABLES];
 | 
					    DrawablePtr DRIDrawables[SAREA_MAX_DRAWABLES];
 | 
				
			||||||
    DRIContextPrivPtr dummyCtxPriv;     /* Pointer to dummy context */
 | 
					    DRIContextPrivPtr dummyCtxPriv;     /* Pointer to dummy context */
 | 
				
			||||||
    Bool createDummyCtx;
 | 
					    Bool createDummyCtx;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue