randr: set error numbers of resource types in RRExtenstionInit() (V2)

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=30367

Currently the ddx calls xf86RandR12Init()
  (-> RRScreenInit()
     -> RRInit()
       -> RRModeInit()
       -> RRCrtcInit()
       -> RROutputInit())
before RRExtensionInit() is called. This causes RRErrorBase
being 0 while setting resource type error values (resource types:
RROutput, RRMode and RRCrtc). The fix moves the setting of error
values to own functions which are called in RRExtensionInit()
to get the right RRErrorBase.

V2: With header file

Signed-off-by: Tobias Droste <tdroste@gmx.de>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
Tobias Droste 2010-09-29 22:51:48 +02:00 committed by Keith Packard
parent 72a9c686d7
commit c7e4222c9a
5 changed files with 56 additions and 3 deletions

View File

@ -354,6 +354,11 @@ RRExtensionInit (void)
SRRScreenChangeNotifyEvent; SRRScreenChangeNotifyEvent;
EventSwapVector[RREventBase + RRNotify] = (EventSwapPtr) EventSwapVector[RREventBase + RRNotify] = (EventSwapPtr)
SRRNotifyEvent; SRRNotifyEvent;
RRModeInitErrorValue();
RRCrtcInitErrorValue();
RROutputInitErrorValue();
#ifdef PANORAMIX #ifdef PANORAMIX
RRXineramaExtensionInit(); RRXineramaExtensionInit();
#endif #endif

View File

@ -700,6 +700,12 @@ RRCrtcTransformSet (RRCrtcPtr crtc,
extern _X_EXPORT Bool extern _X_EXPORT Bool
RRCrtcInit (void); RRCrtcInit (void);
/*
* Initialize crtc type error value
*/
extern _X_EXPORT void
RRCrtcInitErrorValue (void);
/* /*
* Crtc dispatch * Crtc dispatch
*/ */
@ -763,6 +769,12 @@ RRModesForScreen (ScreenPtr pScreen, int *num_ret);
extern _X_EXPORT Bool extern _X_EXPORT Bool
RRModeInit (void); RRModeInit (void);
/*
* Initialize mode type error value
*/
extern _X_EXPORT void
RRModeInitErrorValue (void);
extern _X_EXPORT int extern _X_EXPORT int
ProcRRCreateMode (ClientPtr client); ProcRRCreateMode (ClientPtr client);
@ -857,6 +869,12 @@ ProcRRGetOutputPrimary (ClientPtr client);
extern _X_EXPORT Bool extern _X_EXPORT Bool
RROutputInit (void); RROutputInit (void);
/*
* Initialize output type error value
*/
extern _X_EXPORT void
RROutputInitErrorValue (void);
/* rrpointer.c */ /* rrpointer.c */
extern _X_EXPORT void extern _X_EXPORT void
RRPointerMoved (ScreenPtr pScreen, int x, int y); RRPointerMoved (ScreenPtr pScreen, int x, int y);

View File

@ -631,10 +631,19 @@ RRCrtcInit (void)
RRCrtcType = CreateNewResourceType (RRCrtcDestroyResource, "CRTC"); RRCrtcType = CreateNewResourceType (RRCrtcDestroyResource, "CRTC");
if (!RRCrtcType) if (!RRCrtcType)
return FALSE; return FALSE;
SetResourceTypeErrorValue(RRCrtcType, RRErrorBase + BadRRCrtc);
return TRUE; return TRUE;
} }
/*
* Initialize crtc type error value
*/
void
RRCrtcInitErrorValue(void)
{
SetResourceTypeErrorValue(RRCrtcType, RRErrorBase + BadRRCrtc);
}
int int
ProcRRGetCrtcInfo (ClientPtr client) ProcRRGetCrtcInfo (ClientPtr client)
{ {

View File

@ -260,6 +260,9 @@ RRModeDestroyResource (pointer value, XID pid)
return 1; return 1;
} }
/*
* Initialize mode type
*/
Bool Bool
RRModeInit (void) RRModeInit (void)
{ {
@ -268,10 +271,19 @@ RRModeInit (void)
RRModeType = CreateNewResourceType (RRModeDestroyResource, "MODE"); RRModeType = CreateNewResourceType (RRModeDestroyResource, "MODE");
if (!RRModeType) if (!RRModeType)
return FALSE; return FALSE;
SetResourceTypeErrorValue(RRModeType, RRErrorBase + BadRRMode);
return TRUE; return TRUE;
} }
/*
* Initialize mode type error value
*/
void
RRModeInitErrorValue(void)
{
SetResourceTypeErrorValue(RRModeType, RRErrorBase + BadRRMode);
}
int int
ProcRRCreateMode (ClientPtr client) ProcRRCreateMode (ClientPtr client)
{ {

View File

@ -418,10 +418,19 @@ RROutputInit (void)
RROutputType = CreateNewResourceType (RROutputDestroyResource, "OUTPUT"); RROutputType = CreateNewResourceType (RROutputDestroyResource, "OUTPUT");
if (!RROutputType) if (!RROutputType)
return FALSE; return FALSE;
SetResourceTypeErrorValue(RROutputType, RRErrorBase + BadRROutput);
return TRUE; return TRUE;
} }
/*
* Initialize output type error value
*/
void
RROutputInitErrorValue(void)
{
SetResourceTypeErrorValue(RROutputType, RRErrorBase + BadRROutput);
}
#define OutputInfoExtra (SIZEOF(xRRGetOutputInfoReply) - 32) #define OutputInfoExtra (SIZEOF(xRRGetOutputInfoReply) - 32)
int int