Commit 426bc0a2 authored by Dave Airlie's avatar Dave Airlie

randr: add hooks for offload sink provider protocol

This adds the protocol handler and associated providers handling
for the offload slaves, it allows two providers to be connected as
offload sink/source.
Reviewed-by: Keith Packard's avatarKeith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson's avatarAdam Jackson <ajax@redhat.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent 12905dfa
......@@ -164,6 +164,7 @@ struct _rrProvider {
int nameLength;
RRPropertyPtr properties;
Bool pendingProperties;
struct _rrProvider *offload_sink;
struct _rrProvider *output_source;
};
......@@ -226,6 +227,11 @@ typedef Bool (*RRProviderSetOutputSourceProcPtr)(ScreenPtr pScreen,
RRProviderPtr provider,
RRProviderPtr output_source);
typedef Bool (*RRProviderSetOffloadSinkProcPtr)(ScreenPtr pScreen,
RRProviderPtr provider,
RRProviderPtr offload_sink);
/* These are for 1.0 compatibility */
typedef struct _rrRefresh {
......@@ -278,6 +284,7 @@ typedef struct _rrScrPriv {
RRCrtcSetScanoutPixmapProcPtr rrCrtcSetScanoutPixmap;
RRProviderSetOutputSourceProcPtr rrProviderSetOutputSource;
RRProviderSetOffloadSinkProcPtr rrProviderSetOffloadSink;
RRProviderGetPropertyProcPtr rrProviderGetProperty;
RRProviderSetPropertyProcPtr rrProviderSetProperty;
/*
......@@ -888,6 +895,9 @@ ProcRRGetProviderInfo(ClientPtr client);
extern _X_EXPORT int
ProcRRSetProviderOutputSource(ClientPtr client);
extern _X_EXPORT int
ProcRRSetProviderOffloadSink(ClientPtr client);
extern _X_EXPORT Bool
RRProviderInit(void);
......
......@@ -245,7 +245,7 @@ int (*ProcRandrVector[RRNumberRequests]) (ClientPtr) = {
/* V1.4 additions */
ProcRRGetProviders, /* 32 */
ProcRRGetProviderInfo, /* 33 */
NULL, /* 34 */
ProcRRSetProviderOffloadSink, /* 34 */
ProcRRSetProviderOutputSource, /* 35 */
ProcRRListProviderProperties, /* 36 */
ProcRRQueryProviderProperty, /* 37 */
......
......@@ -175,10 +175,15 @@ ProcRRGetProviderInfo (ClientPtr client)
/* count associated providers */
rep.nAssociatedProviders = 0;
if (provider->offload_sink)
rep.nAssociatedProviders++;
if (provider->output_source)
rep.nAssociatedProviders++;
xorg_list_for_each_entry(provscreen, &pScreen->output_slave_list, output_head)
rep.nAssociatedProviders++;
xorg_list_for_each_entry(provscreen, &pScreen->offload_slave_list, offload_head)
rep.nAssociatedProviders++;
rep.length = (pScrPriv->numCrtcs + pScrPriv->numOutputs +
(rep.nAssociatedProviders * 2) + bytes_to_int32(rep.nameLength));
......@@ -210,6 +215,15 @@ ProcRRGetProviderInfo (ClientPtr client)
}
i = 0;
if (provider->offload_sink) {
providers[i] = provider->offload_sink->id;
if (client->swapped)
swapl(&providers[i]);
prov_cap[i] = RR_Capability_SinkOffload;
if (client->swapped)
swapl(&prov_cap[i]);
i++;
}
if (provider->output_source) {
providers[i] = provider->output_source->id;
if (client->swapped)
......@@ -228,6 +242,17 @@ ProcRRGetProviderInfo (ClientPtr client)
swapl(&prov_cap[i]);
i++;
}
xorg_list_for_each_entry(provscreen, &pScreen->offload_slave_list, offload_head) {
pScrProvPriv = rrGetScrPriv(provscreen);
providers[i] = pScrProvPriv->provider->id;
if (client->swapped)
swapl(&providers[i]);
prov_cap[i] = RR_Capability_SourceOffload;
if (client->swapped)
swapl(&prov_cap[i]);
i++;
}
memcpy(name, provider->name, rep.nameLength);
if (client->swapped) {
......@@ -279,6 +304,35 @@ ProcRRSetProviderOutputSource(ClientPtr client)
return Success;
}
int
ProcRRSetProviderOffloadSink(ClientPtr client)
{
REQUEST(xRRSetProviderOffloadSinkReq);
rrScrPrivPtr pScrPriv;
RRProviderPtr provider, sink_provider = NULL;
ScreenPtr pScreen;
REQUEST_AT_LEAST_SIZE(xRRSetProviderOffloadSinkReq);
VERIFY_RR_PROVIDER(stuff->provider, provider, DixReadAccess);
if (!(provider->capabilities & RR_Capability_SourceOffload))
return BadValue;
if (stuff->sink_provider) {
VERIFY_RR_PROVIDER(stuff->sink_provider, sink_provider, DixReadAccess);
if (!(sink_provider->capabilities & RR_Capability_SinkOffload))
return BadValue;
}
pScreen = provider->pScreen;
pScrPriv = rrGetScrPriv(pScreen);
pScrPriv->rrProviderSetOffloadSink(pScreen, provider, sink_provider);
RRTellChanged (pScreen);
return Success;
}
RRProviderPtr
RRProviderCreate(ScreenPtr pScreen, const char *name,
int nameLength)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment