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

Dave Airlie airlied at gmail.com
Wed Jun 13 08:03:12 PDT 2012


On Wed, Jun 13, 2012 at 3:52 PM, walter harms <wharms at bfs.de> wrote:
>
>
> Am 13.06.2012 15:53, schrieb Dave Airlie:
>> From: Dave Airlie <airlied at redhat.com>
>>
>> This adds the framework for DDX provider support.
>>
>> Signed-off-by: Dave Airlie <airlied at redhat.com>
>> ---
>>  hw/xfree86/common/xf86str.h    |    4 +++
>>  hw/xfree86/modes/xf86Crtc.c    |   46 ++++++++++++++++++++++++++++++
>>  hw/xfree86/modes/xf86Crtc.h    |   58 ++++++++++++++++++++++++++++++++++++++
>>  hw/xfree86/modes/xf86RandR12.c |   60 ++++++++++++++++++++++++++++++++++++++++
>>  4 files changed, 168 insertions(+)
>>
>> diff --git a/hw/xfree86/common/xf86str.h b/hw/xfree86/common/xf86str.h
>> index 6bd6a62..56397f1 100644
>> --- a/hw/xfree86/common/xf86str.h
>> +++ b/hw/xfree86/common/xf86str.h
>> @@ -814,6 +814,10 @@ typedef struct _ScrnInfoRec {
>>      funcPointer reservedFuncs[NUM_RESERVED_FUNCS];
>>
>>      Bool is_gpu;
>> +    uint32_t roles;
>> +    uint32_t abilities;
>> +    uint32_t current_role;
>> +
>>  } ScrnInfoRec;
>>
>>  typedef struct {
>> diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
>> index 2c8878f..238fb91 100644
>> --- a/hw/xfree86/modes/xf86Crtc.c
>> +++ b/hw/xfree86/modes/xf86Crtc.c
>> @@ -3202,3 +3202,49 @@ xf86_crtc_supports_gamma(ScrnInfoPtr pScrn)
>>
>>      return FALSE;
>>  }
>> +
>> +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;
>> +
>> +    if (name)
>> +        len = strlen(name) + 1;
>> +    else
>> +        len = 0;
>> +
>> +    provider = calloc(sizeof(xf86ProviderRec) + len, 1);
>> +    if (!provider)
>> +        return NULL;
>> +
>> +    provider->scrn = scrn;
>> +    provider->funcs = funcs;
>> +    if (name) {
>> +        provider->name = (char *) (provider + 1);
>> +        strcpy(provider->name, name);
>> +    }
>> +#ifdef RANDR_12_INTERFACE
>> +    provider->randr_provider = NULL;
>> +#endif
>> +
>> +    xf86_config->provider = provider;
>> +    return provider;
>> +}
>> +
>
> Is it possible to make this more simple
> by using a char name[80] or strdup() (keeping it char *) ?

Its the same as the other crtc/output implementations and I rather not diverge
unless we repair all of them the same way.

Dave.


More information about the xorg-devel mailing list