3
* Copyright © 2004 Franco Catrin
5
* Permission to use, copy, modify, distribute, and sell this software and its
6
* documentation for any purpose is hereby granted without fee, provided that
7
* the above copyright notice appear in all copies and that both that
8
* copyright notice and this permission notice appear in supporting
9
* documentation, and that the name of Franco Catrin not be used in
10
* advertising or publicity pertaining to distribution of the software without
11
* specific, written prior permission. Franco Catrin makes no
12
* representations about the suitability of this software for any purpose. It
13
* is provided "as is" without express or implied warranty.
15
* FRANCO CATRIN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
16
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
17
* EVENT SHALL FRANCO CATRIN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
18
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
19
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
20
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
21
* PERFORMANCE OF THIS SOFTWARE.
25
#include <kdrive-config.h>
31
#include "scrnintstr.h"
32
#include "pixmapstr.h"
33
#include "regionstr.h"
35
#include "dixfontstr.h"
39
#include "picturestr.h"
42
NeoScreenInfo *screen;
48
0x000000, /* GXclear */
50
0x040000, /* GXandReverse */
51
0x0c0000, /* GXcopy */
52
0x020000, /* GXandInvert */
53
0x0a0000, /* GXnoop */
57
0x090000, /* GXequiv */
58
0x050000, /* GXinvert */
59
0x0d0000, /* GXorReverse */
60
0x030000, /* GXcopyInvert */
61
0x0b0000, /* GXorInverted */
62
0x070000, /* GXnand */
66
static void neoWaitIdle(NeoCardInfo *neoc)
68
// if MMIO is not working it may halt the machine
70
while ((mmio->bltStat & 1) && ++i<100000);
73
static void neoWaitMarker (ScreenPtr pScreen, int marker)
75
KdScreenPriv(pScreen);
76
neoCardInfo(pScreenPriv);
82
static Bool neoPrepareSolid(PixmapPtr pPixmap,
87
FbBits depthMask = FbFullMask(pPixmap->drawable.depth);
88
if ((pm & depthMask) != depthMask) {
92
if (alu!=3) DBGOUT("used ROP %i\n", alu);
98
static void neoSolid (int x1, int y1, int x2, int y2)
106
mmio->fgColor = fgColor;
110
NEO_BC3_SKIP_MAPPING | rop;
111
mmio->dstStart = y * screen->pitch + x * screen->depth;
113
mmio->xyExt = (unsigned long)(h << 16) | (w & 0xffff);
118
static void neoDoneSolid(void)
122
static Bool neoPrepareCopy (PixmapPtr pSrcPixpam, PixmapPtr pDstPixmap,
123
int dx, int dy, int alu, Pixel pm)
129
static void neoCopy (int srcX, int srcY, int dstX, int dstY, int w, int h)
133
if ((dstY < srcY) || ((dstY == srcY) && (dstX < srcX))) {
136
NEO_BC3_SKIP_MAPPING | rop;
137
mmio->srcStart = srcY * screen->pitch + srcX * screen->depth;
138
mmio->dstStart = dstY * screen->pitch + dstX * screen->depth;
140
mmio->xyExt = (unsigned long)(h << 16) | (w & 0xffff);
142
mmio->bltCntl = NEO_BC0_X_DEC |
146
NEO_BC3_SKIP_MAPPING | rop;
151
mmio->srcStart = srcY * screen->pitch + srcX * screen->depth;
152
mmio->dstStart = dstY * screen->pitch + dstX * screen->depth;
153
mmio->xyExt = (unsigned long)(h << 16) | (w & 0xffff);
158
static void neoDoneCopy (void)
163
Bool neoDrawInit (ScreenPtr pScreen)
165
KdScreenPriv(pScreen);
166
neoScreenInfo(pScreenPriv);
170
memset(&neos->kaa, 0, sizeof(KaaScreenInfoRec));
171
neos->kaa.waitMarker = neoWaitMarker;
172
neos->kaa.PrepareSolid = neoPrepareSolid;
173
neos->kaa.Solid = neoSolid;
174
neos->kaa.DoneSolid = neoDoneSolid;
175
neos->kaa.PrepareCopy = neoPrepareCopy;
176
neos->kaa.Copy = neoCopy;
177
neos->kaa.DoneCopy = neoDoneCopy;
179
if (!kaaDrawInit (pScreen, &neos->kaa)) {
186
void neoDrawEnable (ScreenPtr pScreen)
193
screen->depth = (screen->backendScreen.mode.BitsPerPixel+7)/8;
194
screen->pitch = screen->backendScreen.mode.BytesPerScanLine;
195
DBGOUT("NEO depth=%x, pitch=%x\n", screen->depth, screen->pitch);
199
void neoDrawDisable (ScreenPtr pScreen)
205
void neoDrawFini (ScreenPtr pScreen)