randr: add output source setup
This adds the output sources to the associated list and adds the protocol handler for the randr SetProviderOutputSource. 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
bec4cb72c5
commit
4c92eb00f9
|
@ -164,6 +164,7 @@ struct _rrProvider {
|
|||
int nameLength;
|
||||
RRPropertyPtr properties;
|
||||
Bool pendingProperties;
|
||||
struct _rrProvider *output_source;
|
||||
};
|
||||
|
||||
#if RANDR_12_INTERFACE
|
||||
|
@ -221,6 +222,10 @@ typedef Bool (*RRProviderSetPropertyProcPtr) (ScreenPtr pScreen,
|
|||
typedef Bool (*RRGetInfoProcPtr) (ScreenPtr pScreen, Rotation * rotations);
|
||||
typedef Bool (*RRCloseScreenProcPtr) (ScreenPtr pscreen);
|
||||
|
||||
typedef Bool (*RRProviderSetOutputSourceProcPtr)(ScreenPtr pScreen,
|
||||
RRProviderPtr provider,
|
||||
RRProviderPtr output_source);
|
||||
|
||||
/* These are for 1.0 compatibility */
|
||||
|
||||
typedef struct _rrRefresh {
|
||||
|
@ -272,6 +277,7 @@ typedef struct _rrScrPriv {
|
|||
/* TODO #if RANDR_15_INTERFACE */
|
||||
RRCrtcSetScanoutPixmapProcPtr rrCrtcSetScanoutPixmap;
|
||||
|
||||
RRProviderSetOutputSourceProcPtr rrProviderSetOutputSource;
|
||||
RRProviderGetPropertyProcPtr rrProviderGetProperty;
|
||||
RRProviderSetPropertyProcPtr rrProviderSetProperty;
|
||||
/*
|
||||
|
@ -879,6 +885,8 @@ ProcRRGetProviders(ClientPtr client);
|
|||
extern _X_EXPORT int
|
||||
ProcRRGetProviderInfo(ClientPtr client);
|
||||
|
||||
extern _X_EXPORT int
|
||||
ProcRRSetProviderOutputSource(ClientPtr client);
|
||||
|
||||
extern _X_EXPORT Bool
|
||||
RRProviderInit(void);
|
||||
|
|
|
@ -246,7 +246,7 @@ int (*ProcRandrVector[RRNumberRequests]) (ClientPtr) = {
|
|||
ProcRRGetProviders, /* 32 */
|
||||
ProcRRGetProviderInfo, /* 33 */
|
||||
NULL, /* 34 */
|
||||
NULL, /* 35 */
|
||||
ProcRRSetProviderOutputSource, /* 35 */
|
||||
ProcRRListProviderProperties, /* 36 */
|
||||
ProcRRQueryProviderProperty, /* 37 */
|
||||
ProcRRConfigureProviderProperty, /* 38 */
|
||||
|
|
|
@ -137,7 +137,7 @@ ProcRRGetProviderInfo (ClientPtr client)
|
|||
{
|
||||
REQUEST(xRRGetProviderInfoReq);
|
||||
xRRGetProviderInfoReply rep;
|
||||
rrScrPrivPtr pScrPriv;
|
||||
rrScrPrivPtr pScrPriv, pScrProvPriv;
|
||||
RRProviderPtr provider;
|
||||
ScreenPtr pScreen;
|
||||
CARD8 *extra;
|
||||
|
@ -168,6 +168,10 @@ ProcRRGetProviderInfo (ClientPtr client)
|
|||
|
||||
/* count associated providers */
|
||||
rep.nAssociatedProviders = 0;
|
||||
if (provider->output_source)
|
||||
rep.nAssociatedProviders++;
|
||||
xorg_list_for_each_entry(provscreen, &pScreen->output_slave_list, output_head)
|
||||
rep.nAssociatedProviders++;
|
||||
rep.length = (pScrPriv->numCrtcs + pScrPriv->numOutputs +
|
||||
(rep.nAssociatedProviders * 2) + bytes_to_int32(rep.nameLength));
|
||||
|
||||
|
@ -198,6 +202,26 @@ ProcRRGetProviderInfo (ClientPtr client)
|
|||
swapl(&outputs[i]);
|
||||
}
|
||||
|
||||
i = 0;
|
||||
if (provider->output_source) {
|
||||
providers[i] = provider->output_source->id;
|
||||
if (client->swapped)
|
||||
swapl(&providers[i]);
|
||||
prov_cap[i] = RR_Capability_SourceOutput;
|
||||
swapl(&prov_cap[i]);
|
||||
i++;
|
||||
}
|
||||
xorg_list_for_each_entry(provscreen, &pScreen->output_slave_list, output_head) {
|
||||
pScrProvPriv = rrGetScrPriv(provscreen);
|
||||
providers[i] = pScrProvPriv->provider->id;
|
||||
if (client->swapped)
|
||||
swapl(&providers[i]);
|
||||
prov_cap[i] = RR_Capability_SinkOutput;
|
||||
if (client->swapped)
|
||||
swapl(&prov_cap[i]);
|
||||
i++;
|
||||
}
|
||||
|
||||
memcpy(name, provider->name, rep.nameLength);
|
||||
if (client->swapped) {
|
||||
swaps(&rep.sequenceNumber);
|
||||
|
@ -216,6 +240,38 @@ ProcRRGetProviderInfo (ClientPtr client)
|
|||
return Success;
|
||||
}
|
||||
|
||||
int
|
||||
ProcRRSetProviderOutputSource(ClientPtr client)
|
||||
{
|
||||
REQUEST(xRRSetProviderOutputSourceReq);
|
||||
rrScrPrivPtr pScrPriv;
|
||||
RRProviderPtr provider, source_provider = NULL;
|
||||
ScreenPtr pScreen;
|
||||
|
||||
REQUEST_AT_LEAST_SIZE(xRRSetProviderOutputSourceReq);
|
||||
|
||||
VERIFY_RR_PROVIDER(stuff->provider, provider, DixReadAccess);
|
||||
|
||||
if (!(provider->capabilities & RR_Capability_SinkOutput))
|
||||
return BadValue;
|
||||
|
||||
if (stuff->source_provider) {
|
||||
VERIFY_RR_PROVIDER(stuff->source_provider, source_provider, DixReadAccess);
|
||||
|
||||
if (!(source_provider->capabilities & RR_Capability_SourceOutput))
|
||||
return BadValue;
|
||||
}
|
||||
|
||||
pScreen = provider->pScreen;
|
||||
pScrPriv = rrGetScrPriv(pScreen);
|
||||
|
||||
pScrPriv->rrProviderSetOutputSource(pScreen, provider, source_provider);
|
||||
|
||||
RRTellChanged (pScreen);
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
RRProviderPtr
|
||||
RRProviderCreate(ScreenPtr pScreen, const char *name,
|
||||
int nameLength)
|
||||
|
|
Loading…
Reference in New Issue
Block a user