xfree86: add framework for provider support in ddx. (v4)
This adds the framework for DDX provider support. v2: as per keithp's suggestion remove the xf86 provider object and just store it in the toplevel object. v3: update for new protocol v4: drop devPrivate, free name Reviewed-by: Keith Packard <keithp@keithp.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
parent
66d92afeae
commit
9b5cf2ed76
|
@ -814,6 +814,7 @@ typedef struct _ScrnInfoRec {
|
|||
funcPointer reservedFuncs[NUM_RESERVED_FUNCS];
|
||||
|
||||
Bool is_gpu;
|
||||
uint32_t capabilities;
|
||||
} ScrnInfoRec;
|
||||
|
||||
typedef struct {
|
||||
|
|
|
@ -738,6 +738,7 @@ xf86CrtcCloseScreen(ScreenPtr screen)
|
|||
}
|
||||
xf86RandR12CloseScreen(screen);
|
||||
|
||||
free(config->name);
|
||||
return screen->CloseScreen(screen);
|
||||
}
|
||||
|
||||
|
@ -3202,3 +3203,20 @@ xf86_crtc_supports_gamma(ScrnInfoPtr pScrn)
|
|||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
xf86ProviderSetup(ScrnInfoPtr scrn,
|
||||
const xf86ProviderFuncsRec *funcs, const char *name)
|
||||
{
|
||||
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
|
||||
|
||||
assert(!xf86_config->name);
|
||||
assert(name);
|
||||
|
||||
xf86_config->name = strdup(name);
|
||||
xf86_config->provider_funcs = funcs;
|
||||
#ifdef RANDR_12_INTERFACE
|
||||
xf86_config->randr_provider = NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -607,6 +607,29 @@ struct _xf86Output {
|
|||
INT16 initialBorder[4];
|
||||
};
|
||||
|
||||
typedef struct _xf86ProviderFuncs {
|
||||
/**
|
||||
* Called to allow the provider a chance to create properties after the
|
||||
* RandR objects have been created.
|
||||
*/
|
||||
void
|
||||
(*create_resources) (ScrnInfoPtr scrn);
|
||||
|
||||
/**
|
||||
* Callback when an provider's property has changed.
|
||||
*/
|
||||
Bool
|
||||
(*set_property) (ScrnInfoPtr scrn,
|
||||
Atom property, RRPropertyValuePtr value);
|
||||
|
||||
/**
|
||||
* Callback to get an updated property value
|
||||
*/
|
||||
Bool
|
||||
(*get_property) (ScrnInfoPtr provider, Atom property);
|
||||
|
||||
} xf86ProviderFuncsRec, *xf86ProviderFuncsPtr;
|
||||
|
||||
typedef struct _xf86CrtcConfigFuncs {
|
||||
/**
|
||||
* Requests that the driver resize the screen.
|
||||
|
@ -681,6 +704,13 @@ typedef struct _xf86CrtcConfig {
|
|||
/* callback when crtc configuration changes */
|
||||
xf86_crtc_notify_proc_ptr xf86_crtc_notify;
|
||||
|
||||
char *name;
|
||||
const xf86ProviderFuncsRec *provider_funcs;
|
||||
#ifdef RANDR_12_INTERFACE
|
||||
RRProviderPtr randr_provider;
|
||||
#else
|
||||
void *randr_provider;
|
||||
#endif
|
||||
} xf86CrtcConfigRec, *xf86CrtcConfigPtr;
|
||||
|
||||
extern _X_EXPORT int xf86CrtcConfigPrivateIndex;
|
||||
|
@ -975,4 +1005,8 @@ extern _X_EXPORT void
|
|||
extern _X_EXPORT Bool
|
||||
xf86_crtc_supports_gamma(ScrnInfoPtr pScrn);
|
||||
|
||||
extern _X_EXPORT void
|
||||
xf86ProviderSetup(ScrnInfoPtr scrn,
|
||||
const xf86ProviderFuncsRec * funcs, const char *name);
|
||||
|
||||
#endif /* _XF86CRTC_H_ */
|
||||
|
|
|
@ -1552,6 +1552,14 @@ xf86RandR12CreateObjects12(ScreenPtr pScreen)
|
|||
output->funcs->create_resources(output);
|
||||
RRPostPendingProperties(output->randr_output);
|
||||
}
|
||||
|
||||
if (config->name) {
|
||||
config->randr_provider = RRProviderCreate(pScreen, config->name,
|
||||
strlen(config->name));
|
||||
|
||||
RRProviderSetCapabilities(config->randr_provider, pScrn->capabilities);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -1745,6 +1753,42 @@ xf86RandR12EnterVT(ScrnInfoPtr pScrn)
|
|||
return RRGetInfo(pScreen, TRUE); /* force a re-probe of outputs and notify clients about changes */
|
||||
}
|
||||
|
||||
static Bool
|
||||
xf86RandR14ProviderSetProperty(ScreenPtr pScreen,
|
||||
RRProviderPtr randr_provider,
|
||||
Atom property, RRPropertyValuePtr value)
|
||||
{
|
||||
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
|
||||
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
|
||||
|
||||
/* If we don't have any property handler, then we don't care what the
|
||||
* user is setting properties to.
|
||||
*/
|
||||
if (config->provider_funcs->set_property == NULL)
|
||||
return TRUE;
|
||||
|
||||
/*
|
||||
* This function gets called even when vtSema is FALSE, as
|
||||
* drivers will need to remember the correct value to apply
|
||||
* when the VT switch occurs
|
||||
*/
|
||||
return config->provider_funcs->set_property(pScrn, property, value);
|
||||
}
|
||||
|
||||
static Bool
|
||||
xf86RandR14ProviderGetProperty(ScreenPtr pScreen,
|
||||
RRProviderPtr randr_provider, Atom property)
|
||||
{
|
||||
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
|
||||
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
|
||||
|
||||
if (config->provider_funcs->get_property == NULL)
|
||||
return TRUE;
|
||||
|
||||
/* Should be safe even w/o vtSema */
|
||||
return config->provider_funcs->get_property(pScrn, property);
|
||||
}
|
||||
|
||||
static Bool
|
||||
xf86RandR12Init12(ScreenPtr pScreen)
|
||||
{
|
||||
|
@ -1767,6 +1811,10 @@ xf86RandR12Init12(ScreenPtr pScreen)
|
|||
#endif
|
||||
rp->rrModeDestroy = xf86RandR12ModeDestroy;
|
||||
rp->rrSetConfig = NULL;
|
||||
|
||||
rp->rrProviderSetProperty = xf86RandR14ProviderSetProperty;
|
||||
rp->rrProviderGetProperty = xf86RandR14ProviderGetProperty;
|
||||
|
||||
pScrn->PointerMoved = xf86RandR12PointerMoved;
|
||||
pScrn->ChangeGamma = xf86RandR12ChangeGamma;
|
||||
|
||||
|
|
Loading…
Reference in New Issue