[PATCH v2 29/42] Add static extensions before those in modules

Peter Hutterer peter.hutterer at who-t.net
Tue Dec 6 16:07:39 PST 2011


On Fri, Dec 02, 2011 at 11:27:37AM +0000, Daniel Stone wrote:
> Make sure we add static extensions before anything in a module.  This is
> more or less a no-op at the moment, but will come in handy later when
> extension dependency sorting is removed.
> 
> Signed-off-by: Daniel Stone <daniel at fooishbar.org>
> ---

you're welcome (it's 4 patches btw. 29-33 :)

Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

Cheers,
  Peter

> 
> v2: New, fixes GLX vs. Composite visual creation.
> 
>  hw/xfree86/common/xf86Module.h |    5 +++++
>  hw/xfree86/loader/loadext.c    |    4 ++++
>  mi/miinitext.c                 |   33 +++++++++++++++++++++------------
>  3 files changed, 30 insertions(+), 12 deletions(-)
> 
> diff --git a/hw/xfree86/common/xf86Module.h b/hw/xfree86/common/xf86Module.h
> index 422934e..f9bccb1 100644
> --- a/hw/xfree86/common/xf86Module.h
> +++ b/hw/xfree86/common/xf86Module.h
> @@ -180,6 +180,11 @@ typedef struct {
>  
>  extern _X_EXPORT ExtensionModule *ExtensionModuleList;
>  
> +/* This really shouldn't be here, but gets moved in about three commits'
> + * time.  So odds are the only people who ever see this comment are doing
> + * patch review, in which case, thanks! */
> +extern _X_EXPORT void AddStaticExtensions(void);
> +
>  /* Prototypes for Loader functions that are exported to modules */
>  extern _X_EXPORT pointer LoadSubModule(pointer, const char *, const char **,
>  		      const char **, pointer, const XF86ModReqInfo *,
> diff --git a/hw/xfree86/loader/loadext.c b/hw/xfree86/loader/loadext.c
> index 4078b77..a9811ba 100644
> --- a/hw/xfree86/loader/loadext.c
> +++ b/hw/xfree86/loader/loadext.c
> @@ -49,6 +49,10 @@ NewExtensionModule(void)
>      ExtensionModule *save = ExtensionModuleList;
>      int n;
>  
> +    /* Make sure built-in extensions get added to the list before those
> +     * in modules. */
> +    AddStaticExtensions();
> +
>      /* Sanity check */
>      if (!ExtensionModuleList)
>  	numExtensionModules = 0;
> diff --git a/mi/miinitext.c b/mi/miinitext.c
> index a6705d4..195a656 100644
> --- a/mi/miinitext.c
> +++ b/mi/miinitext.c
> @@ -375,28 +375,37 @@ static ExtensionModule staticExtensions[] = {
>  #endif
>      { NULL, NULL, NULL, NULL, NULL }
>  };
> -    
> +
> +void
> +AddStaticExtensions(void)
> +{
> +    static Bool listInitialised = FALSE;
> +    int i;
> +
> +    if (listInitialised)
> +        return;
> +    listInitialised = TRUE;
> +
> +    /* Add built-in extensions to the list. */
> +    for (i = 0; staticExtensions[i].name; i++)
> +        LoadExtension(&staticExtensions[i], TRUE);
> +}
> +
>  /*ARGSUSED*/
>  void
>  InitExtensions(int argc, char *argv[])
>  {
>      int i;
>      ExtensionModule *ext;
> -    static Bool listInitialised = FALSE;
> -
> -    if (!listInitialised) {
> -	/* Add built-in extensions to the list. */
> -	for (i = 0; staticExtensions[i].name; i++)
> -	    LoadExtension(&staticExtensions[i], TRUE);
>  
> -	/* Sort the extensions according the init dependencies. */
> -	LoaderSortExtensions();
> -	listInitialised = TRUE;
> -    }
> +    /* Make sure all static extensions have been added, then sort the
> +     * extensions according to their init dependencies. */
> +    AddStaticExtensions();
> +    LoaderSortExtensions();
>  
>      for (i = 0; ExtensionModuleList[i].name != NULL; i++) {
>  	ext = &ExtensionModuleList[i];
> -	if (ext->initFunc != NULL && 
> +	if (ext->initFunc != NULL &&
>  	    (ext->disablePtr == NULL || !*ext->disablePtr)) {
>  	    (ext->initFunc)();
>  	}
> -- 
> 1.7.7.3
> 
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
> 


More information about the xorg-devel mailing list