1
/* Copyrightg (c) 2006 Advanced Micro Devices, Inc.
3
* Permission is hereby granted, free of charge, to any person obtaining a copy
4
* of this software and associated documentation files (the "Software"), to
5
* deal in the Software without restriction, including without limitation the
6
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7
* sell copies of the Software, and to permit persons to whom the Software is
8
* furnished to do so, subject to the following conditions:
10
* The above copyright notice and this permission notice shall be included in
11
* all copies or substantial portions of the Software.
13
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21
* Neither the name of the Advanced Micro Devices, Inc. nor the names of its
22
* contributors may be used to endorse or promote products derived from this
23
* software without specific prior written permission.
35
GXWindowLinear(ScreenPtr pScreen, CARD32 row, CARD32 offset, int mode,
36
CARD32 *size, void *closure)
38
ScrnInfoPtr pScrni = xf86ScreenToScrn(pScreen);
39
GeodeRec *pGeode = GEODEPTR(pScrni);
41
*size = pGeode->displayPitch;
43
return (pGeode->FBBase + pGeode->displayOffset) +
44
row * pGeode->displayPitch + offset;
48
GXUpdate(ScreenPtr pScreen, shadowBufPtr pBuf)
50
ScrnInfoPtr pScrni = xf86ScreenToScrn(pScreen);
51
GeodeRec *pGeode = GEODEPTR(pScrni);
52
int rotate = pGeode->rotation;
57
if (pScrni->bitsPerPixel == 8)
58
shadowUpdateRotate8_90(pScreen, pBuf);
59
else if (pScrni->bitsPerPixel == 16)
60
shadowUpdateRotate16_90(pScreen, pBuf);
62
shadowUpdateRotate32_90(pScreen, pBuf);
68
if (pScrni->bitsPerPixel == 8)
69
shadowUpdateRotate8_180(pScreen, pBuf);
70
else if (pScrni->bitsPerPixel == 16)
71
shadowUpdateRotate16_180(pScreen, pBuf);
73
shadowUpdateRotate32_180(pScreen, pBuf);
78
if (pScrni->bitsPerPixel == 8)
79
shadowUpdateRotate8_270(pScreen, pBuf);
80
else if (pScrni->bitsPerPixel == 16)
81
shadowUpdateRotate16_270(pScreen, pBuf);
83
shadowUpdateRotate32_270(pScreen, pBuf);
90
GXRotate(ScrnInfoPtr pScrni, DisplayModePtr mode)
92
GeodeRec *pGeode = GEODEPTR(pScrni);
93
Rotation curr = pGeode->rotation;
94
unsigned int curdw = pScrni->displayWidth;
98
pPixmap = pScrni->pScreen->GetScreenPixmap(pScrni->pScreen);
99
pGeode->rotation = GXGetRotation(pScrni->pScreen);
101
/* Leave if we have nothing to do */
103
if (pGeode->rotation == curr && pGeode->curMode == mode) {
107
shadowRemove(pScrni->pScreen, NULL);
109
switch (pGeode->rotation) {
111
ErrorF("Rotate to 0 degrees\n");
112
pScrni->displayWidth = pGeode->displayWidth;
113
pGeode->Pitch = pGeode->displayPitch;
117
ErrorF("Rotate to 90 degrees\n");
118
pScrni->displayWidth = pScrni->pScreen->width;
122
ErrorF("Rotate to 180 degrees\n");
123
pScrni->displayWidth = pGeode->displayWidth;
127
ErrorF("Rotate to 270 degrees\n");
128
pScrni->displayWidth = pScrni->pScreen->width;
132
if (pGeode->rotation != RR_Rotate_0) {
135
shadowAdd(pScrni->pScreen, pPixmap, GXUpdate, GXWindowLinear,
136
pGeode->rotation, NULL);
139
ErrorF("shadowAdd failed\n");
144
if (pGeode->rotation == RR_Rotate_0)
145
pScrni->fbOffset = pGeode->displayOffset;
147
pScrni->fbOffset = pGeode->shadowOffset;
149
pScrni->pScreen->ModifyPixmapHeader(pPixmap,
150
pScrni->pScreen->width,
151
pScrni->pScreen->height,
152
pScrni->pScreen->rootDepth,
153
pScrni->bitsPerPixel,
154
PixmapBytePad(pScrni->displayWidth,
157
(pointer) (pGeode->FBBase +
160
/* Don't use XAA pixmap cache or offscreen pixmaps when rotated */
162
if (pGeode->AccelInfoRec) {
163
if (pGeode->rotation == RR_Rotate_0) {
164
pGeode->AccelInfoRec->Flags =
165
LINEAR_FRAMEBUFFER | OFFSCREEN_PIXMAPS | PIXMAP_CACHE;
166
pGeode->AccelInfoRec->UsingPixmapCache = TRUE;
167
pGeode->AccelInfoRec->maxOffPixWidth = 0;
168
pGeode->AccelInfoRec->maxOffPixHeight = 0;
171
pGeode->AccelInfoRec->Flags = LINEAR_FRAMEBUFFER;
172
pGeode->AccelInfoRec->UsingPixmapCache = FALSE;
173
pGeode->AccelInfoRec->maxOffPixWidth = 1;
174
pGeode->AccelInfoRec->maxOffPixHeight = 1;
182
/* Restore the old rotation */
183
pScrni->displayWidth = curdw;
185
if (curr & (RR_Rotate_0 | RR_Rotate_180)) {
186
pScrni->pScreen->width = pScrni->virtualX;
187
pScrni->pScreen->height = pScrni->virtualY;
190
pScrni->pScreen->width = pScrni->virtualY;
191
pScrni->pScreen->height = pScrni->virtualX;
194
pGeode->rotation = curr;