xfree86: crtc: use CloseScreen hook
Wrapping ScreenRec's function pointers is problematic for many reasons, so use the new screen close notify hook instead. This one doesn't look so trivial at first glance, but I've checked that other functions called by xf86CrtcCloseScreen() just free'ing up some memory and removing the CRTCs from some lists - thus a change in execution order really shouldn't matter at all. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
parent
cc847cc43a
commit
866afe931a
|
@ -29,6 +29,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "dix/screen_hooks_priv.h"
|
||||||
#include "randr/randrstr_priv.h"
|
#include "randr/randrstr_priv.h"
|
||||||
|
|
||||||
#include "xf86.h"
|
#include "xf86.h"
|
||||||
|
@ -768,9 +769,11 @@ xf86CrtcCreateScreenResources(ScreenPtr screen)
|
||||||
/*
|
/*
|
||||||
* Clean up config on server reset
|
* Clean up config on server reset
|
||||||
*/
|
*/
|
||||||
static Bool
|
static void xf86CrtcCloseScreen(CallbackListPtr *pcbl,
|
||||||
xf86CrtcCloseScreen(ScreenPtr screen)
|
ScreenPtr screen, void *unused)
|
||||||
{
|
{
|
||||||
|
dixScreenUnhookClose(screen, xf86CrtcCloseScreen);
|
||||||
|
|
||||||
ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
|
ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
|
||||||
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
|
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
|
||||||
int o, c;
|
int o, c;
|
||||||
|
@ -791,20 +794,15 @@ xf86CrtcCloseScreen(ScreenPtr screen)
|
||||||
crtc->randr_crtc = NULL;
|
crtc->randr_crtc = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
screen->CloseScreen = config->CloseScreen;
|
|
||||||
|
|
||||||
xf86RotateCloseScreen(screen);
|
xf86RotateCloseScreen(screen);
|
||||||
|
|
||||||
xf86RandR12CloseScreen(screen);
|
xf86RandR12CloseScreen(screen);
|
||||||
|
|
||||||
screen->CloseScreen(screen);
|
|
||||||
|
|
||||||
/* detach any providers */
|
/* detach any providers */
|
||||||
if (config->randr_provider) {
|
if (config->randr_provider) {
|
||||||
RRProviderDestroy(config->randr_provider);
|
RRProviderDestroy(config->randr_provider);
|
||||||
config->randr_provider = NULL;
|
config->randr_provider = NULL;
|
||||||
}
|
}
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -846,8 +844,7 @@ xf86CrtcScreenInit(ScreenPtr screen)
|
||||||
config->CreateScreenResources = screen->CreateScreenResources;
|
config->CreateScreenResources = screen->CreateScreenResources;
|
||||||
screen->CreateScreenResources = xf86CrtcCreateScreenResources;
|
screen->CreateScreenResources = xf86CrtcCreateScreenResources;
|
||||||
|
|
||||||
config->CloseScreen = screen->CloseScreen;
|
dixScreenHookClose(screen, xf86CrtcCloseScreen);
|
||||||
screen->CloseScreen = xf86CrtcCloseScreen;
|
|
||||||
|
|
||||||
/* This might still be marked wrapped from a previous generation */
|
/* This might still be marked wrapped from a previous generation */
|
||||||
config->BlockHandler = NULL;
|
config->BlockHandler = NULL;
|
||||||
|
|
|
@ -799,8 +799,6 @@ typedef struct _xf86CrtcConfig {
|
||||||
|
|
||||||
CreateScreenResourcesProcPtr CreateScreenResources;
|
CreateScreenResourcesProcPtr CreateScreenResources;
|
||||||
|
|
||||||
CloseScreenProcPtr CloseScreen;
|
|
||||||
|
|
||||||
/* Cursor information */
|
/* Cursor information */
|
||||||
xf86CursorInfoPtr cursor_info;
|
xf86CursorInfoPtr cursor_info;
|
||||||
CursorPtr cursor;
|
CursorPtr cursor;
|
||||||
|
|
Loading…
Reference in New Issue