Add RRInit function to create resource types for RR objects.
To allow RandR objects to be created before the screen object exists, the resource types must be registered with the resource database. A driver wishing to create RandR objects must call RRInit before doing so. Also, fix a segfault when setting Output data before it is associated with a screen.
This commit is contained in:
parent
ec77a95a02
commit
0dee48b8af
|
@ -39,8 +39,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define RR_VALIDATE
|
#define RR_VALIDATE
|
||||||
int RRGeneration;
|
static int RRNScreens;
|
||||||
int RRNScreens;
|
|
||||||
|
|
||||||
#define wrap(priv,real,mem,func) {\
|
#define wrap(priv,real,mem,func) {\
|
||||||
priv->mem = real->mem; \
|
priv->mem = real->mem; \
|
||||||
|
@ -198,10 +197,10 @@ SRRNotifyEvent (xEvent *from,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Bool RRScreenInit(ScreenPtr pScreen)
|
static int RRGeneration;
|
||||||
{
|
|
||||||
rrScrPrivPtr pScrPriv;
|
|
||||||
|
|
||||||
|
Bool RRInit (void)
|
||||||
|
{
|
||||||
if (RRGeneration != serverGeneration)
|
if (RRGeneration != serverGeneration)
|
||||||
{
|
{
|
||||||
if (!RRModeInit ())
|
if (!RRModeInit ())
|
||||||
|
@ -210,9 +209,25 @@ Bool RRScreenInit(ScreenPtr pScreen)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (!RROutputInit ())
|
if (!RROutputInit ())
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
RRGeneration = serverGeneration;
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int RRScreenGeneration;
|
||||||
|
|
||||||
|
Bool RRScreenInit(ScreenPtr pScreen)
|
||||||
|
{
|
||||||
|
rrScrPrivPtr pScrPriv;
|
||||||
|
|
||||||
|
if (!RRInit ())
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
if (RRScreenGeneration != serverGeneration)
|
||||||
|
{
|
||||||
if ((rrPrivIndex = AllocateScreenPrivateIndex()) < 0)
|
if ((rrPrivIndex = AllocateScreenPrivateIndex()) < 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
RRGeneration = serverGeneration;
|
RRScreenGeneration = serverGeneration;
|
||||||
}
|
}
|
||||||
|
|
||||||
pScrPriv = (rrScrPrivPtr) xalloc (sizeof (rrScrPrivRec));
|
pScrPriv = (rrScrPrivPtr) xalloc (sizeof (rrScrPrivRec));
|
||||||
|
|
|
@ -384,6 +384,8 @@ RRTellChanged (ScreenPtr pScreen);
|
||||||
Bool
|
Bool
|
||||||
RRGetInfo (ScreenPtr pScreen);
|
RRGetInfo (ScreenPtr pScreen);
|
||||||
|
|
||||||
|
Bool RRInit (void);
|
||||||
|
|
||||||
Bool RRScreenInit(ScreenPtr pScreen);
|
Bool RRScreenInit(ScreenPtr pScreen);
|
||||||
|
|
||||||
RROutputPtr
|
RROutputPtr
|
||||||
|
|
|
@ -31,11 +31,14 @@ void
|
||||||
RROutputChanged (RROutputPtr output)
|
RROutputChanged (RROutputPtr output)
|
||||||
{
|
{
|
||||||
ScreenPtr pScreen = output->pScreen;
|
ScreenPtr pScreen = output->pScreen;
|
||||||
rrScrPriv (pScreen);
|
|
||||||
|
|
||||||
output->changed = TRUE;
|
output->changed = TRUE;
|
||||||
|
if (pScreen)
|
||||||
|
{
|
||||||
|
rrScrPriv (pScreen);
|
||||||
pScrPriv->changed = TRUE;
|
pScrPriv->changed = TRUE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create an output
|
* Create an output
|
||||||
|
@ -335,6 +338,9 @@ RROutputDestroyResource (pointer value, XID pid)
|
||||||
{
|
{
|
||||||
RROutputPtr output = (RROutputPtr) value;
|
RROutputPtr output = (RROutputPtr) value;
|
||||||
ScreenPtr pScreen = output->pScreen;
|
ScreenPtr pScreen = output->pScreen;
|
||||||
|
|
||||||
|
if (pScreen)
|
||||||
|
{
|
||||||
rrScrPriv(pScreen);
|
rrScrPriv(pScreen);
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -348,6 +354,7 @@ RROutputDestroyResource (pointer value, XID pid)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (output->modes)
|
if (output->modes)
|
||||||
xfree (output->modes);
|
xfree (output->modes);
|
||||||
if (output->crtcs)
|
if (output->crtcs)
|
||||||
|
@ -481,4 +488,3 @@ ProcRRGetOutputInfo (ClientPtr client)
|
||||||
|
|
||||||
return client->noClientException;
|
return client->noClientException;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue