summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2012-07-05 15:41:22 +0100
committerDave Airlie <airlied@redhat.com>2012-07-07 10:37:11 +0100
commit4c92eb00f97f7b8258de8e366226880382cc9ce9 (patch)
tree829811ff50ab60864d19d82f3041344299cb18ab
parentbec4cb72c55bb6dee09c65c0844af201067a090f (diff)
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>
-rw-r--r--randr/randrstr.h8
-rw-r--r--randr/rrdispatch.c2
-rw-r--r--randr/rrprovider.c58
3 files changed, 66 insertions, 2 deletions
diff --git a/randr/randrstr.h b/randr/randrstr.h
index ac93414cc..5ca8830de 100644
--- a/randr/randrstr.h
+++ b/randr/randrstr.h
@@ -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);
diff --git a/randr/rrdispatch.c b/randr/rrdispatch.c
index 054e47a7a..6fe51c77a 100644
--- a/randr/rrdispatch.c
+++ b/randr/rrdispatch.c
@@ -246,7 +246,7 @@ int (*ProcRandrVector[RRNumberRequests]) (ClientPtr) = {
ProcRRGetProviders, /* 32 */
ProcRRGetProviderInfo, /* 33 */
NULL, /* 34 */
- NULL, /* 35 */
+ ProcRRSetProviderOutputSource, /* 35 */
ProcRRListProviderProperties, /* 36 */
ProcRRQueryProviderProperty, /* 37 */
ProcRRConfigureProviderProperty, /* 38 */
diff --git a/randr/rrprovider.c b/randr/rrprovider.c
index 377320032..f35ca6a1d 100644
--- a/randr/rrprovider.c
+++ b/randr/rrprovider.c
@@ -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)