-/* $XFree86: xc/lib/GL/mesa/src/drv/gamma/gamma_span.c,v 1.4 2002/11/05 17:46:07 tsi Exp $ */
-#include "gamma_context.h"
+#include "gammacontext.h"
#include "gamma_lock.h"
#include "colormac.h"
gmesa->drawOffset + \
(dPriv->x * gammascrn->cpp) + \
(dPriv->y * pitch)); \
- char *read_buf = (char *)(sPriv->pFB + \
- gmesa->readOffset + \
- (dPriv->x * gammascrn->cpp) + \
- (dPriv->y * pitch)); \
GLuint p; \
- (void) read_buf; (void) buf; (void) p
+ (void) buf; (void) p
/* FIXME! Depth/Stencil read/writes don't work ! */
#define LOCAL_DEPTH_VARS \
#define LOCAL_STENCIL_VARS LOCAL_DEPTH_VARS
-
-#define CLIPPIXEL( _x, _y ) \
- ((_x >= minx) && (_x < maxx) && (_y >= miny) && (_y < maxy))
-
-
-#define CLIPSPAN( _x, _y, _n, _x1, _n1, _i ) \
- if ( _y < miny || _y >= maxy ) { \
- _n1 = 0, _x1 = x; \
- } else { \
- _n1 = _n; \
- _x1 = _x; \
- if ( _x1 < minx ) _i += (minx-_x1), n1 -= (minx-_x1), _x1 = minx; \
- if ( _x1 + _n1 >= maxx ) n1 -= (_x1 + n1 - maxx); \
- }
-
#define Y_FLIP( _y ) (height - _y - 1)
#define HW_LOCK() \
gammaGetLock( gmesa, DRM_LOCK_FLUSH | DRM_LOCK_QUIESCENT ); \
GAMMAHW_LOCK( gmesa );
-#define HW_CLIPLOOP() \
- do { \
- __DRIdrawablePrivate *dPriv = gmesa->driDrawable; \
- int _nc = dPriv->numClipRects; \
- \
- while ( _nc-- ) { \
- int minx = dPriv->pClipRects[_nc].x1 - dPriv->x; \
- int miny = dPriv->pClipRects[_nc].y1 - dPriv->y; \
- int maxx = dPriv->pClipRects[_nc].x2 - dPriv->x; \
- int maxy = dPriv->pClipRects[_nc].y2 - dPriv->y;
-
-#define HW_ENDCLIPLOOP() \
- } \
- } while (0)
-
#define HW_UNLOCK() GAMMAHW_UNLOCK( gmesa )
#define READ_RGBA( rgba, _x, _y ) \
do { \
- GLushort p = *(GLushort *)(read_buf + _x*2 + _y*pitch); \
+ GLushort p = *(GLushort *)(buf + _x*2 + _y*pitch); \
rgba[0] = (p >> 8) & 0xf8; \
rgba[1] = (p >> 3) & 0xfc; \
rgba[2] = (p << 3) & 0xf8; \
#define READ_RGBA( rgba, _x, _y ) \
do { \
- GLuint p = *(GLuint *)(read_buf + _x*4 + _y*pitch); \
+ GLuint p = *(GLuint *)(buf + _x*4 + _y*pitch); \
rgba[0] = (p >> 16) & 0xff; \
rgba[1] = (p >> 8) & 0xff; \
rgba[2] = (p >> 0) & 0xff; \
/* 16 bit depthbuffer functions.
*/
+#define VALUE_TYPE GLushort
+
#define WRITE_DEPTH( _x, _y, d ) \
- *(GLushort *)(buf + _x*2 + _y*pitch) = d;
+ *(GLushort *)(buf + (_x)*2 + (_y)*pitch) = d;
#define READ_DEPTH( d, _x, _y ) \
- d = *(GLushort *)(buf + _x*2 + _y*pitch);
+ d = *(GLushort *)(buf + (_x)*2 + (_y)*pitch);
#define TAG(x) gamma##x##_16
#include "depthtmp.h"
-
#if 0 /* Unused */
/* 32 bit depthbuffer functions.
*/
+#define VALUE_TYPE GLuint
+
#define WRITE_DEPTH( _x, _y, d ) \
- *(GLuint *)(buf + _x*4 + _y*pitch) = d;
+ *(GLuint *)(buf + (_x)*4 + (_y)*pitch) = d;
#define READ_DEPTH( d, _x, _y ) \
- d = *(GLuint *)(buf + _x*4 + _y*pitch);
+ d = *(GLuint *)(buf + (_x)*4 + (_y)*pitch);
#define TAG(x) gamma##x##_32
#include "depthtmp.h"
/* 24/8 bit interleaved depth/stencil functions
*/
+#define VALUE_TYPE GLuint
+
#define WRITE_DEPTH( _x, _y, d ) { \
- GLuint tmp = *(GLuint *)(buf + _x*4 + _y*pitch); \
+ GLuint tmp = *(GLuint *)(buf + (_x)*4 + (_y)*pitch); \
tmp &= 0xff; \
tmp |= (d) & 0xffffff00; \
- *(GLuint *)(buf + _x*4 + _y*pitch) = tmp; \
+ *(GLuint *)(buf + (_x)*4 + (_y)*pitch) = tmp; \
}
#define READ_DEPTH( d, _x, _y ) \
- d = *(GLuint *)(buf + _x*4 + _y*pitch) & ~0xff;
+ d = *(GLuint *)(buf + (_x)*4 + (_y)*pitch) & ~0xff;
#define TAG(x) gamma##x##_24_8
{
gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
gammaScreenPtr gammascrn = gmesa->gammaScreen;
- CARD32 dwords1, dwords2, i = 0;
+ uint32_t dwords1, dwords2, i = 0;
char *src = (char *)rgba[0];
GLuint read = n * gammascrn->cpp; /* Number of bytes we are expecting */
- CARD32 data;
+ uint32_t data;
FLUSH_DMA_BUFFER(gmesa);
CHECK_DMA_BUFFER(gmesa, 16);
moredata:
- dwords1 = *(volatile CARD32*)(void *)(((CARD8*)gammascrn->regions[0].map) + (GlintOutFIFOWords));
- dwords2 = *(volatile CARD32*)(void *)(((CARD8*)gammascrn->regions[2].map) + (GlintOutFIFOWords));
+ dwords1 = *(volatile uint32_t*)(void *)(((uint8_t*)gammascrn->regions[0].map) + (GlintOutFIFOWords));
+ dwords2 = *(volatile uint32_t*)(void *)(((uint8_t*)gammascrn->regions[2].map) + (GlintOutFIFOWords));
if (dwords1) {
memcpy(src, (char*)gammascrn->regions[1].map + 0x1000, dwords1 << 2);
gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
switch ( bufferBit ) {
- case FRONT_LEFT_BIT:
+ case BUFFER_BIT_FRONT_LEFT:
gmesa->readOffset = 0;
break;
- case BACK_LEFT_BIT:
+ case BUFFER_BIT_BACK_LEFT:
gmesa->readOffset = gmesa->driScreen->fbHeight * gmesa->driScreen->fbWidth * gmesa->gammaScreen->cpp;
break;
+ default:
+ _mesa_problem(ctx, "Unexpected buffer 0x%x in gammaSetBuffer()", bufferBit);
}
}