[PATCH 11/36] xfree86: add framework for provider support in ddx.

Keith Packard keithp at keithp.com
Mon Jul 2 12:07:34 PDT 2012


Dave Airlie <airlied at gmail.com> writes:

> +xf86ProviderPtr
> +xf86ProviderCreate(ScrnInfoPtr scrn,
> +                   const xf86ProviderFuncsRec *funcs, const char *name)
> +{
> +    xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
> +    xf86ProviderPtr provider;
> +    int len;
> +
> +    if (xf86_config->provider)
> +        return xf86_config->provider;

A 'create' function shouldn't return an existing object; that's more
like a 'get' function. Do you expect callers to not know if the object
exists yet?

> +struct _xf86Provider {
> +    /**
> +     * ABI versioning
> +     */
> +    int version;
> +
> +    ScrnInfoPtr scrn;
> +
> +    /** Provider name */
> +    char *name;
> +
> +    /** provider-specific functions */
> +    const xf86ProviderFuncsRec *funcs;
> +#ifdef RANDR_12_INTERFACE
> +    RRProviderPtr randr_provider;
> +#else
> +    void *randr_provider;
> +#endif
> +};
> +
>  typedef struct _xf86CrtcConfigFuncs {
>      /**
>       * Requests that the driver resize the screen.
> @@ -681,6 +731,7 @@ typedef struct _xf86CrtcConfig {
>      /* callback when crtc configuration changes */
>      xf86_crtc_notify_proc_ptr xf86_crtc_notify;
>  
> +    xf86ProviderPtr provider;
>  } xf86CrtcConfigRec, *xf86CrtcConfigPtr;

Could the elements of 'provider' just become members of the crtc config rec?

> @@ -1552,6 +1552,19 @@ xf86RandR12CreateObjects12(ScreenPtr pScreen)
>              output->funcs->create_resources(output);
>          RRPostPendingProperties(output->randr_output);
>      }
> +
> +    {
> +        xf86ProviderPtr provider = config->provider;
> +        provider->randr_provider = RRProviderCreate(pScreen, provider->name,
> +                                                    strlen(provider->name), provider);
> +
> +        if (provider->scrn->is_gpu) {
> +            RRProviderSetRolesAbilities(provider->randr_provider, provider->scrn->roles,
> +                                        provider->scrn->abilities);
> +            RRProviderSetCurrentRole(provider->randr_provider, provider->scrn->current_role);
> +        }
> +    }
> +

Ok, I'm lost here -- this assumes that config->provider exists, and yet
xf86ProviderCreate isn't being called with some default values in case
the driver doesn't do that yet.

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


More information about the xorg-devel mailing list