[PATCH] randr: set error numbers of resource types in RRExtenstionInit() #30367

Keith Packard keithp at keithp.com
Tue Sep 28 16:04:19 PDT 2010


On Tue, 28 Sep 2010 18:44:53 +0200, Tobias Droste <tdroste at gmx.de> wrote:
> Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=30367
> 
> Currently the ddx calls RROutputInit() before RRExtensionInit() is
> called. This causes RRErrorBase being 0 while setting resource type
> error (resource types RROutput, RRMode and RRCrtc).
> The fix moves the setting of error numbers to RRExtensionInit() to get
> the right RRErrorBase.
> 
> Signed-off-by: Tobias Droste <tdroste at gmx.de>

Reviewed-by: Keith Packard <keithp at keithp.com>

> ---
>  randr/randr.c    |    5 +++++
>  randr/rrcrtc.c   |   11 ++++++++++-
>  randr/rrmode.c   |   14 +++++++++++++-
>  randr/rroutput.c |   11 ++++++++++-
>  4 files changed, 38 insertions(+), 3 deletions(-)
> 
> diff --git a/randr/randr.c b/randr/randr.c
> index f52a46a..6077705 100644
> --- a/randr/randr.c
> +++ b/randr/randr.c
> @@ -354,6 +354,11 @@ RRExtensionInit (void)
>  	SRRScreenChangeNotifyEvent;
>      EventSwapVector[RREventBase + RRNotify] = (EventSwapPtr)
>  	SRRNotifyEvent;
> +
> +    RRModeInitErrorValue();
> +    RRCrtcInitErrorValue();
> +    RROutputInitErrorValue();
> +
>  #ifdef PANORAMIX
>      RRXineramaExtensionInit();
>  #endif
> diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c
> index 14f6e45..839f3cd 100644
> --- a/randr/rrcrtc.c
> +++ b/randr/rrcrtc.c
> @@ -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()
> +{
> +    SetResourceTypeErrorValue(RRCrtcType, RRErrorBase + BadRRCrtc);
> +}
> +
>  int
>  ProcRRGetCrtcInfo (ClientPtr client)
>  {
> diff --git a/randr/rrmode.c b/randr/rrmode.c
> index deddd3c..361d17d 100644
> --- a/randr/rrmode.c
> +++ b/randr/rrmode.c
> @@ -260,6 +260,9 @@ RRModeDestroyResource (pointer value, XID pid)
>      return 1;
>  }
>  
> +/*
> + * Initialize mode type
> + */
>  Bool
>  RRModeInit (void)
>  {
> @@ -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()
> +{
> +    SetResourceTypeErrorValue(RRModeType, RRErrorBase + BadRRMode);
> +}
> +
>  int
>  ProcRRCreateMode (ClientPtr client)
>  {
> diff --git a/randr/rroutput.c b/randr/rroutput.c
> index 937b14d..1d65c11 100644
> --- a/randr/rroutput.c
> +++ b/randr/rroutput.c
> @@ -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()
> +{
> +    SetResourceTypeErrorValue(RROutputType, RRErrorBase + BadRROutput);
> +}
> +
>  #define OutputInfoExtra	(SIZEOF(xRRGetOutputInfoReply) - 32)
>  
>  int
> -- 
> 1.7.1
> 

-- 
keith.packard at intel.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg-devel/attachments/20100928/0641ee34/attachment.pgp>


More information about the xorg-devel mailing list