1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
|
/*
* Acceleration for the Creator and Creator3D framebuffer - Get spans.
*
* Copyright (C) 1998,1999 Jakub Jelinek (jakub@redhat.com)
* Copyright (C) 1999 David S. Miller (davem@redhat.com)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* JAKUB JELINEK OR DAVID MILLER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
/* $XFree86$ */
#include "ffb.h"
#include "ffb_regs.h"
#include "ffb_rcache.h"
#include "ffb_fifo.h"
#include "pixmapstr.h"
#include "scrnintstr.h"
#define PSZ 8
#include "cfb.h"
#undef PSZ
#include "cfb32.h"
void
CreatorGetSpans(DrawablePtr pDrawable, int wMax, DDXPointPtr ppt,
int *pwidth, int nspans, char *pchardstStart)
{
FFBPtr pFfb = GET_FFB_FROM_SCREEN (pDrawable->pScreen);
ffb_fbcPtr ffb = pFfb->regs;
char *addrp;
FFBLOG(("CreatorGetSpans: wmax(%d) nspans(%d)\n", wMax, nspans));
/* Punt early for this case. */
if(pDrawable->bitsPerPixel == 1) {
mfbGetSpans(pDrawable, wMax, ppt, pwidth,
nspans, pchardstStart);
return;
}
/* This code only works when sucking bits directly from
* the framebuffer.
*/
if(pDrawable->type != DRAWABLE_WINDOW) {
if (pDrawable->bitsPerPixel == 8)
cfbGetSpans(pDrawable, wMax, ppt, pwidth,
nspans, pchardstStart);
else
cfb32GetSpans(pDrawable, wMax, ppt, pwidth,
nspans, pchardstStart);
return;
}
/*
* XFree86 DDX empties the root borderClip when the VT is
* switched away; this checks for that case
*/
if (!cfbDrawableEnabled(pDrawable))
return;
/* We're just reading pixels from SFB, but we could be using
* a different read buffer when double-buffering.
*/
FFB_ATTR_SFB_VAR_WIN(pFfb, 0x00ffffff, GXcopy, (WindowPtr)pDrawable);
FFBWait(pFfb, ffb);
if (pDrawable->bitsPerPixel == 32) {
unsigned int *pdst = (unsigned int *)pchardstStart;
addrp = (char *) pFfb->sfb32;
if ((nspans == 1) && (*pwidth == 1)) {
*pdst = *(unsigned int *)(addrp + (ppt->y << 13) + (ppt->x << 2));
return;
}
while(nspans--) {
int w = min(ppt->x + *pwidth, 2048) - ppt->x;
unsigned int *psrc = (unsigned int *) (addrp +
(ppt->y << 13) +
(ppt->x << 2));
unsigned int *pdstNext = pdst + w;
while (w--)
*psrc++ = *pdst++;
pdst = pdstNext;
ppt++;
pwidth++;
}
} else {
unsigned char *pdst = (unsigned char *)pchardstStart;
addrp = (char *) pFfb->sfb8r;
if ((nspans == 1) && (*pwidth == 1)) {
*pdst = *(unsigned char *)(addrp + (ppt->y << 11) + (ppt->x << 0));
return;
}
while(nspans--) {
int w = min(ppt->x + *pwidth, 2048) - ppt->x;
unsigned char *psrc = (unsigned char *) (addrp +
(ppt->y << 11) +
(ppt->x << 0));
unsigned char *pdstNext = pdst + w;
while (w--)
*psrc++ = *pdst++;
pdst = pdstNext;
ppt++;
pwidth++;
}
}
}
|