Initial commit
[xorg_rtime.git] / xorg-server-1.4 / randr / mirandr.c
blob3c4991e5abb3ba38f8742fbe9e17df321e1cd9ed
1 /*
2 * Copyright © 2000 Compaq Computer Corporation
3 * Copyright © 2002 Hewlett-Packard Company
4 * Copyright © 2006 Intel Corporation
6 * Permission to use, copy, modify, distribute, and sell this software and its
7 * documentation for any purpose is hereby granted without fee, provided that
8 * the above copyright notice appear in all copies and that both that copyright
9 * notice and this permission notice appear in supporting documentation, and
10 * that the name of the copyright holders not be used in advertising or
11 * publicity pertaining to distribution of the software without specific,
12 * written prior permission. The copyright holders make no representations
13 * about the suitability of this software for any purpose. It is provided "as
14 * is" without express or implied warranty.
16 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
17 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
18 * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
19 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
20 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
21 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
22 * OF THIS SOFTWARE.
24 * Author: Jim Gettys, Hewlett-Packard Company, Inc.
25 * Keith Packard, Intel Corporation
28 #ifdef HAVE_DIX_CONFIG_H
29 #include <dix-config.h>
30 #endif
32 #include "scrnintstr.h"
33 #include "mi.h"
34 #include "randrstr.h"
35 #include <stdio.h>
37 Bool
38 miRRGetInfo (ScreenPtr pScreen, Rotation *rotations)
40 return TRUE;
44 * Any hardware that can actually change anything will need something
45 * different here
47 Bool
48 miRRCrtcSet (ScreenPtr pScreen,
49 RRCrtcPtr crtc,
50 RRModePtr mode,
51 int x,
52 int y,
53 Rotation rotation,
54 int numOutput,
55 RROutputPtr *outputs)
57 return TRUE;
60 static Bool
61 miRRCrtcSetGamma (ScreenPtr pScreen,
62 RRCrtcPtr crtc)
64 return TRUE;
67 Bool
68 miRROutputSetProperty (ScreenPtr pScreen,
69 RROutputPtr output,
70 Atom property,
71 RRPropertyValuePtr value)
73 return TRUE;
76 Bool
77 miRROutputValidateMode (ScreenPtr pScreen,
78 RROutputPtr output,
79 RRModePtr mode)
81 return FALSE;
84 void
85 miRRModeDestroy (ScreenPtr pScreen,
86 RRModePtr mode)
91 * This function assumes that only a single depth can be
92 * displayed at a time, but that all visuals of that depth
93 * can be displayed simultaneously. It further assumes that
94 * only a single size is available. Hardware providing
95 * additional capabilties should use different code.
96 * XXX what to do here....
99 Bool
100 miRandRInit (ScreenPtr pScreen)
102 rrScrPrivPtr pScrPriv;
103 #if RANDR_12_INTERFACE
104 RRModePtr mode;
105 RRCrtcPtr crtc;
106 RROutputPtr output;
107 xRRModeInfo modeInfo;
108 char name[64];
109 #endif
111 if (!RRScreenInit (pScreen))
112 return FALSE;
113 pScrPriv = rrGetScrPriv(pScreen);
114 pScrPriv->rrGetInfo = miRRGetInfo;
115 #if RANDR_12_INTERFACE
116 pScrPriv->rrCrtcSet = miRRCrtcSet;
117 pScrPriv->rrCrtcSetGamma = miRRCrtcSetGamma;
118 pScrPriv->rrOutputSetProperty = miRROutputSetProperty;
119 pScrPriv->rrOutputValidateMode = miRROutputValidateMode;
120 pScrPriv->rrModeDestroy = miRRModeDestroy;
122 RRScreenSetSizeRange (pScreen,
123 pScreen->width, pScreen->height,
124 pScreen->width, pScreen->height);
126 sprintf (name, "%dx%d", pScreen->width, pScreen->height);
127 memset (&modeInfo, '\0', sizeof (modeInfo));
128 modeInfo.width = pScreen->width;
129 modeInfo.height = pScreen->height;
130 modeInfo.nameLength = strlen (name);
132 mode = RRModeGet (&modeInfo, name);
133 if (!mode)
134 return FALSE;
136 crtc = RRCrtcCreate (pScreen, NULL);
137 if (!crtc)
138 return FALSE;
140 output = RROutputCreate (pScreen, "screen", 6, NULL);
141 if (!output)
142 return FALSE;
143 if (!RROutputSetClones (output, NULL, 0))
144 return FALSE;
145 if (!RROutputSetModes (output, &mode, 1, 0))
146 return FALSE;
147 if (!RROutputSetCrtcs (output, &crtc, 1))
148 return FALSE;
149 if (!RROutputSetConnection (output, RR_Connected))
150 return FALSE;
151 RRCrtcNotify (crtc, mode, 0, 0, RR_Rotate_0, 1, &output);
152 #endif
153 return TRUE;