summaryrefslogtreecommitdiff
path: root/randr/rroutput.c
diff options
context:
space:
mode:
authorKeith Packard <keithp@mandolin.keithp.com>2006-11-08 21:36:35 -0800
committerKeith Packard <keithp@mandolin.keithp.com>2006-11-08 21:36:35 -0800
commitec77a95a02329a2ee3a94d7de9d2a234aecb9ca0 (patch)
tree205413395daca04433d8d97b67ca702425d35479 /randr/rroutput.c
parent20e9144c0746943624ff77a61791b8596f3f8458 (diff)
Allow RandR objects to be created before the associated ScreenRec.
xf86 drivers need to create RandR object in the PreInit stage, before the ScreenRec is allocated. Changing the RandR DIX code to permit this required the addition of functions that later associate the objects with the related screen. An additional change is that modes are now global, and no longer associated with a specific screen. This change actually makes mode management cleaner as there is no more per-screen list of modes to deal with. This changes the RandR 1.2 ABI/API for drivers.
Diffstat (limited to 'randr/rroutput.c')
-rw-r--r--randr/rroutput.c44
1 files changed, 27 insertions, 17 deletions
diff --git a/randr/rroutput.c b/randr/rroutput.c
index 1f6f33030..1b0ecab93 100644
--- a/randr/rroutput.c
+++ b/randr/rroutput.c
@@ -42,30 +42,17 @@ RROutputChanged (RROutputPtr output)
*/
RROutputPtr
-RROutputCreate (ScreenPtr pScreen,
- const char *name,
+RROutputCreate (const char *name,
int nameLength,
void *devPrivate)
{
- rrScrPriv (pScreen);
RROutputPtr output;
- RROutputPtr *outputs;
output = xalloc (sizeof (RROutputRec) + nameLength + 1);
if (!output)
return NULL;
- if (pScrPriv->numOutputs)
- outputs = xrealloc (pScrPriv->outputs,
- (pScrPriv->numOutputs + 1) * sizeof (RROutputPtr));
- else
- outputs = xalloc (sizeof (RROutputPtr));
- if (!outputs)
- {
- xfree (output);
- return NULL;
- }
output->id = FakeClientID (0);
- output->pScreen = pScreen;
+ output->pScreen = NULL;
output->name = (char *) (output + 1);
output->nameLength = nameLength;
memcpy (output->name, name, nameLength);
@@ -91,12 +78,35 @@ RROutputCreate (ScreenPtr pScreen,
if (!AddResource (output->id, RROutputType, (pointer) output))
return NULL;
+ return output;
+}
+
+/*
+ * Attach an Output to a screen. This is done as a separate step
+ * so that an xf86-based driver can create Outputs in PreInit
+ * before the Screen has been created
+ */
+
+Bool
+RROutputAttachScreen (RROutputPtr output, ScreenPtr pScreen)
+{
+ rrScrPriv (pScreen);
+ RROutputPtr *outputs;
+
+ if (pScrPriv->numOutputs)
+ outputs = xrealloc (pScrPriv->outputs,
+ (pScrPriv->numOutputs + 1) * sizeof (RROutputPtr));
+ else
+ outputs = xalloc (sizeof (RROutputPtr));
+ if (!outputs)
+ return FALSE;
+ output->pScreen = pScreen;
pScrPriv->outputs = outputs;
pScrPriv->outputs[pScrPriv->numOutputs++] = output;
RROutputChanged (output);
- return output;
+ return TRUE;
}
-
+
/*
* Notify extension that output parameters have been changed
*/