6 #include "i810screen.h"
10 #include "i810ioctl.h"
11 #include "swrast/swrast.h"
17 i810ContextPtr imesa = I810_CONTEXT(ctx); \
18 __DRIdrawablePrivate *dPriv = imesa->driDrawable; \
19 driRenderbuffer *drb = (driRenderbuffer *) rb; \
20 GLuint pitch = drb->pitch; \
21 GLuint height = dPriv->h; \
23 char *buf = (char *)(drb->flippedData + \
28 #define LOCAL_DEPTH_VARS \
29 i810ContextPtr imesa = I810_CONTEXT(ctx); \
30 __DRIdrawablePrivate *dPriv = imesa->driDrawable; \
31 driRenderbuffer *drb = (driRenderbuffer *) rb; \
32 GLuint pitch = drb->pitch; \
33 GLuint height = dPriv->h; \
34 char *buf = (char *)(drb->Base.Data + \
38 #define INIT_MONO_PIXEL(p, color) \
39 p = PACK_COLOR_565( color[0], color[1], color[2] )
41 #define Y_FLIP(_y) (height - _y - 1)
47 /* 16 bit, 565 rgb color spanline and pixel functions
49 #define WRITE_RGBA( _x, _y, r, g, b, a ) \
50 *(GLushort *)(buf + _x*2 + _y*pitch) = ( (((int)r & 0xf8) << 8) | \
51 (((int)g & 0xfc) << 3) | \
52 (((int)b & 0xf8) >> 3))
53 #define WRITE_PIXEL( _x, _y, p ) \
54 *(GLushort *)(buf + _x*2 + _y*pitch) = p
56 #define READ_RGBA( rgba, _x, _y ) \
58 GLushort p = *(GLushort *)(buf + _x*2 + _y*pitch); \
59 rgba[0] = ((p >> 8) & 0xf8) * 255 / 0xf8; \
60 rgba[1] = ((p >> 3) & 0xfc) * 255 / 0xfc; \
61 rgba[2] = ((p << 3) & 0xf8) * 255 / 0xf8; \
65 #define TAG(x) i810##x##_565
68 /* 16 bit depthbuffer functions.
70 #define WRITE_DEPTH( _x, _y, d ) \
71 *(GLushort *)(buf + (_x)*2 + (_y)*pitch) = d;
73 #define READ_DEPTH( d, _x, _y ) \
74 d = *(GLushort *)(buf + (_x)*2 + (_y)*pitch);
76 #define TAG(x) i810##x##_z16
80 /* Move locking out to get reasonable span performance.
82 void i810SpanRenderStart( GLcontext
*ctx
)
84 i810ContextPtr imesa
= I810_CONTEXT(ctx
);
85 I810_FIREVERTICES(imesa
);
87 i810RegetLockQuiescent( imesa
);
90 void i810SpanRenderFinish( GLcontext
*ctx
)
92 i810ContextPtr imesa
= I810_CONTEXT( ctx
);
94 UNLOCK_HARDWARE( imesa
);
97 void i810InitSpanFuncs( GLcontext
*ctx
)
99 struct swrast_device_driver
*swdd
= _swrast_GetDeviceDriverReference(ctx
);
100 swdd
->SpanRenderStart
= i810SpanRenderStart
;
101 swdd
->SpanRenderFinish
= i810SpanRenderFinish
;
107 * Plug in the Get/Put routines for the given driRenderbuffer.
110 i810SetSpanFunctions(driRenderbuffer
*drb
, const GLvisual
*vis
)
112 if (drb
->Base
.InternalFormat
== GL_RGBA
) {
114 i810InitPointers_565(&drb
->Base
);
116 else if (drb
->Base
.InternalFormat
== GL_DEPTH_COMPONENT16
) {
117 i810InitDepthPointers_z16(&drb
->Base
);
119 else if (drb
->Base
.InternalFormat
== GL_DEPTH_COMPONENT24
) {
120 /* should never get here */
121 drb
->Base
.GetRow
= NULL
;
122 drb
->Base
.GetValues
= NULL
;
123 drb
->Base
.PutRow
= NULL
;
124 drb
->Base
.PutMonoRow
= NULL
;
125 drb
->Base
.PutValues
= NULL
;
126 drb
->Base
.PutMonoValues
= NULL
;
128 else if (drb
->Base
.InternalFormat
== GL_STENCIL_INDEX8_EXT
) {
129 drb
->Base
.GetRow
= NULL
;
130 drb
->Base
.GetValues
= NULL
;
131 drb
->Base
.PutRow
= NULL
;
132 drb
->Base
.PutMonoRow
= NULL
;
133 drb
->Base
.PutValues
= NULL
;
134 drb
->Base
.PutMonoValues
= NULL
;