Skip to content

Commit

Permalink
randr: set error numbers of resource types in RRExtenstionInit() (V2)
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Keith Packard <[email protected]>
Signed-off-by: Keith Packard <[email protected]>
  • Loading branch information
dro123 authored and keith-packard committed Sep 29, 2010
1 parent 72a9c68 commit c7e4222
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 3 deletions.
5 changes: 5 additions & 0 deletions randr/randr.c
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,11 @@ RRExtensionInit (void)
SRRScreenChangeNotifyEvent;
EventSwapVector[RREventBase + RRNotify] = (EventSwapPtr)
SRRNotifyEvent;

RRModeInitErrorValue();
RRCrtcInitErrorValue();
RROutputInitErrorValue();

#ifdef PANORAMIX
RRXineramaExtensionInit();
#endif
Expand Down
18 changes: 18 additions & 0 deletions randr/randrstr.h
Original file line number Diff line number Diff line change
Expand Up @@ -700,6 +700,12 @@ RRCrtcTransformSet (RRCrtcPtr crtc,
extern _X_EXPORT Bool
RRCrtcInit (void);

/*
* Initialize crtc type error value
*/
extern _X_EXPORT void
RRCrtcInitErrorValue (void);

/*
* Crtc dispatch
*/
Expand Down Expand Up @@ -762,6 +768,12 @@ RRModesForScreen (ScreenPtr pScreen, int *num_ret);
*/
extern _X_EXPORT Bool
RRModeInit (void);

/*
* Initialize mode type error value
*/
extern _X_EXPORT void
RRModeInitErrorValue (void);

extern _X_EXPORT int
ProcRRCreateMode (ClientPtr client);
Expand Down Expand Up @@ -856,6 +868,12 @@ ProcRRGetOutputPrimary (ClientPtr client);
*/
extern _X_EXPORT Bool
RROutputInit (void);

/*
* Initialize output type error value
*/
extern _X_EXPORT void
RROutputInitErrorValue (void);

/* rrpointer.c */
extern _X_EXPORT void
Expand Down
11 changes: 10 additions & 1 deletion randr/rrcrtc.c
Original file line number Diff line number Diff line change
Expand Up @@ -631,10 +631,19 @@ RRCrtcInit (void)
RRCrtcType = CreateNewResourceType (RRCrtcDestroyResource, "CRTC");
if (!RRCrtcType)
return FALSE;
SetResourceTypeErrorValue(RRCrtcType, RRErrorBase + BadRRCrtc);

return TRUE;
}

/*
* Initialize crtc type error value
*/
void
RRCrtcInitErrorValue(void)
{
SetResourceTypeErrorValue(RRCrtcType, RRErrorBase + BadRRCrtc);
}

int
ProcRRGetCrtcInfo (ClientPtr client)
{
Expand Down
14 changes: 13 additions & 1 deletion randr/rrmode.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,9 @@ RRModeDestroyResource (pointer value, XID pid)
return 1;
}

/*
* Initialize mode type
*/
Bool
RRModeInit (void)
{
Expand All @@ -268,10 +271,19 @@ RRModeInit (void)
RRModeType = CreateNewResourceType (RRModeDestroyResource, "MODE");
if (!RRModeType)
return FALSE;
SetResourceTypeErrorValue(RRModeType, RRErrorBase + BadRRMode);

return TRUE;
}

/*
* Initialize mode type error value
*/
void
RRModeInitErrorValue(void)
{
SetResourceTypeErrorValue(RRModeType, RRErrorBase + BadRRMode);
}

int
ProcRRCreateMode (ClientPtr client)
{
Expand Down
11 changes: 10 additions & 1 deletion randr/rroutput.c
Original file line number Diff line number Diff line change
Expand Up @@ -418,10 +418,19 @@ RROutputInit (void)
RROutputType = CreateNewResourceType (RROutputDestroyResource, "OUTPUT");
if (!RROutputType)
return FALSE;
SetResourceTypeErrorValue(RROutputType, RRErrorBase + BadRROutput);

return TRUE;
}

/*
* Initialize output type error value
*/
void
RROutputInitErrorValue(void)
{
SetResourceTypeErrorValue(RROutputType, RRErrorBase + BadRROutput);
}

#define OutputInfoExtra (SIZEOF(xRRGetOutputInfoReply) - 32)

int
Expand Down

0 comments on commit c7e4222

Please sign in to comment.