~ubuntu-branches/ubuntu/precise/xorg-server/precise-updates

« back to all changes in this revision

Viewing changes to randr/mirandr.c

Tags: 2:1.10.1-2
* Build xserver-xorg-core-udeb on hurd-i386.  Thanks, Samuel Thibault!
* Upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Copyright © 2000 Compaq Computer Corporation
3
 
 * Copyright © 2002 Hewlett-Packard Company
4
 
 * Copyright © 2006 Intel Corporation
5
 
 *
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.
15
 
 *
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.
23
 
 *
24
 
 * Author:  Jim Gettys, Hewlett-Packard Company, Inc.
25
 
 *          Keith Packard, Intel Corporation
26
 
 */
27
 
 
28
 
#ifdef HAVE_DIX_CONFIG_H
29
 
#include <dix-config.h>
30
 
#endif
31
 
 
32
 
#include "scrnintstr.h"
33
 
#include "mi.h"
34
 
#include "randrstr.h"
35
 
#include <stdio.h>
36
 
 
37
 
Bool
38
 
miRRGetInfo (ScreenPtr pScreen, Rotation *rotations)
39
 
{
40
 
    return TRUE;
41
 
}
42
 
 
43
 
/*
44
 
 * Any hardware that can actually change anything will need something
45
 
 * different here
46
 
 */
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)
56
 
{
57
 
    return TRUE;
58
 
}
59
 
 
60
 
static Bool
61
 
miRRCrtcSetGamma (ScreenPtr     pScreen,
62
 
                  RRCrtcPtr     crtc)
63
 
{
64
 
    return TRUE;
65
 
}
66
 
 
67
 
Bool
68
 
miRROutputSetProperty (ScreenPtr            pScreen,
69
 
                       RROutputPtr          output,
70
 
                       Atom                 property,
71
 
                       RRPropertyValuePtr   value)
72
 
{
73
 
    return TRUE;
74
 
}
75
 
 
76
 
Bool
77
 
miRROutputGetProperty (ScreenPtr            pScreen,
78
 
                       RROutputPtr          output,
79
 
                       Atom                 property)
80
 
{
81
 
        return TRUE;
82
 
}
83
 
 
84
 
Bool
85
 
miRROutputValidateMode (ScreenPtr           pScreen,
86
 
                        RROutputPtr         output,
87
 
                        RRModePtr           mode)
88
 
{
89
 
    return FALSE;
90
 
}
91
 
 
92
 
void
93
 
miRRModeDestroy (ScreenPtr  pScreen,
94
 
                 RRModePtr  mode)
95
 
{
96
 
}
97
 
 
98
 
/*
99
 
 * This function assumes that only a single depth can be
100
 
 * displayed at a time, but that all visuals of that depth
101
 
 * can be displayed simultaneously.  It further assumes that
102
 
 * only a single size is available.  Hardware providing
103
 
 * additional capabilties should use different code.
104
 
 * XXX what to do here....
105
 
 */
106
 
 
107
 
Bool
108
 
miRandRInit (ScreenPtr pScreen)
109
 
{
110
 
    rrScrPrivPtr    pScrPriv;
111
 
#if RANDR_12_INTERFACE
112
 
    RRModePtr   mode;
113
 
    RRCrtcPtr   crtc;
114
 
    RROutputPtr output;
115
 
    xRRModeInfo modeInfo;
116
 
    char        name[64];
117
 
#endif
118
 
    
119
 
    if (!RRScreenInit (pScreen))
120
 
        return FALSE;
121
 
    pScrPriv = rrGetScrPriv(pScreen);
122
 
    pScrPriv->rrGetInfo = miRRGetInfo;
123
 
#if RANDR_12_INTERFACE
124
 
    pScrPriv->rrCrtcSet = miRRCrtcSet;
125
 
    pScrPriv->rrCrtcSetGamma = miRRCrtcSetGamma;
126
 
    pScrPriv->rrOutputSetProperty = miRROutputSetProperty;
127
 
#if RANDR_13_INTERFACE
128
 
    pScrPriv->rrOutputGetProperty = miRROutputGetProperty;
129
 
#endif
130
 
    pScrPriv->rrOutputValidateMode = miRROutputValidateMode;
131
 
    pScrPriv->rrModeDestroy = miRRModeDestroy;
132
 
    
133
 
    RRScreenSetSizeRange (pScreen,
134
 
                          pScreen->width, pScreen->height,
135
 
                          pScreen->width, pScreen->height);
136
 
 
137
 
    sprintf (name, "%dx%d", pScreen->width, pScreen->height);
138
 
    memset (&modeInfo, '\0', sizeof (modeInfo));
139
 
    modeInfo.width = pScreen->width;
140
 
    modeInfo.height = pScreen->height;
141
 
    modeInfo.nameLength = strlen (name);
142
 
    
143
 
    mode = RRModeGet (&modeInfo, name);
144
 
    if (!mode)
145
 
        return FALSE;
146
 
    
147
 
    crtc = RRCrtcCreate (pScreen, NULL);
148
 
    if (!crtc)
149
 
        return FALSE;
150
 
    
151
 
    output = RROutputCreate (pScreen, "screen", 6, NULL);
152
 
    if (!output)
153
 
        return FALSE;
154
 
    if (!RROutputSetClones (output, NULL, 0))
155
 
        return FALSE;
156
 
    if (!RROutputSetModes (output, &mode, 1, 0))
157
 
        return FALSE;
158
 
    if (!RROutputSetCrtcs (output, &crtc, 1))
159
 
        return FALSE;
160
 
    if (!RROutputSetConnection (output, RR_Connected))
161
 
        return FALSE;
162
 
    RRCrtcNotify (crtc, mode, 0, 0, RR_Rotate_0, NULL, 1, &output);
163
 
#endif
164
 
    return TRUE;
165
 
}