Simplfy clear() and swapbuffers() code.
Fix various mishandling of cliprects. Allow multiple primitives to be emitted to a single dma buffer, which was largely impossible previously. Re-enable the fast unclipped render stage.
This commit is contained in:
parent
ef494c06b6
commit
490e764d7a
|
@ -68,39 +68,7 @@
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
GLuint VIA_DEBUG = 0;
|
GLuint VIA_DEBUG = 0;
|
||||||
#endif
|
#endif
|
||||||
#define DMA_SIZE 2
|
|
||||||
|
|
||||||
/*=* John Sheng [2003.5.31] agp tex *=*/
|
|
||||||
|
|
||||||
static GLboolean
|
|
||||||
AllocateBuffer(viaContextPtr vmesa)
|
|
||||||
{
|
|
||||||
vmesa->front_base = vmesa->driScreen->pFB;
|
|
||||||
if (vmesa->drawType == GLX_PBUFFER_BIT) {
|
|
||||||
if (vmesa->front.map)
|
|
||||||
via_free_front_buffer(vmesa);
|
|
||||||
if (!via_alloc_front_buffer(vmesa))
|
|
||||||
return GL_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (vmesa->hasBack) {
|
|
||||||
if (vmesa->back.map)
|
|
||||||
via_free_back_buffer(vmesa);
|
|
||||||
if (!via_alloc_back_buffer(vmesa))
|
|
||||||
return GL_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (vmesa->hasDepth || vmesa->hasStencil) {
|
|
||||||
if (vmesa->depth.map)
|
|
||||||
via_free_depth_buffer(vmesa);
|
|
||||||
if (!via_alloc_depth_buffer(vmesa)) {
|
|
||||||
via_free_depth_buffer(vmesa);
|
|
||||||
return GL_FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return GL_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return various strings for \c glGetString.
|
* Return various strings for \c glGetString.
|
||||||
|
@ -170,38 +138,53 @@ static GLboolean
|
||||||
calculate_buffer_parameters( viaContextPtr vmesa )
|
calculate_buffer_parameters( viaContextPtr vmesa )
|
||||||
{
|
{
|
||||||
const unsigned shift = vmesa->viaScreen->bitsPerPixel / 16;
|
const unsigned shift = vmesa->viaScreen->bitsPerPixel / 16;
|
||||||
const unsigned extra = (vmesa->drawType == GLX_PBUFFER_BIT) ? 0 : 32;
|
const unsigned extra = 32;
|
||||||
unsigned w;
|
unsigned w;
|
||||||
unsigned h;
|
unsigned h;
|
||||||
|
|
||||||
|
/* Allocate front-buffer */
|
||||||
if (vmesa->drawType == GLX_PBUFFER_BIT) {
|
if (vmesa->drawType == GLX_PBUFFER_BIT) {
|
||||||
w = vmesa->driDrawable->w;
|
w = vmesa->driDrawable->w;
|
||||||
h = vmesa->driDrawable->h;
|
h = vmesa->driDrawable->h;
|
||||||
|
|
||||||
|
vmesa->front.bpp = vmesa->viaScreen->bitsPerPixel;
|
||||||
|
vmesa->front.pitch = buffer_align( w ) << shift;
|
||||||
|
vmesa->front.size = vmesa->front.pitch * h;
|
||||||
|
|
||||||
|
if (vmesa->front.map)
|
||||||
|
via_free_draw_buffer(vmesa, &vmesa->front);
|
||||||
|
if (!via_alloc_draw_buffer(vmesa, &vmesa->front))
|
||||||
|
return GL_FALSE;
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
w = vmesa->viaScreen->width;
|
w = vmesa->viaScreen->width;
|
||||||
h = vmesa->viaScreen->height;
|
h = vmesa->viaScreen->height;
|
||||||
|
|
||||||
|
vmesa->front.bpp = vmesa->viaScreen->bitsPerPixel;
|
||||||
|
vmesa->front.pitch = buffer_align( w ) << shift;
|
||||||
|
vmesa->front.size = vmesa->front.pitch * h;
|
||||||
vmesa->front.offset = 0;
|
vmesa->front.offset = 0;
|
||||||
vmesa->front.map = (char *) vmesa->driScreen->pFB;
|
vmesa->front.map = (char *) vmesa->driScreen->pFB;
|
||||||
}
|
}
|
||||||
|
|
||||||
vmesa->front.pitch = buffer_align( w ) << shift;
|
|
||||||
vmesa->front.size = vmesa->front.pitch * h;
|
|
||||||
|
|
||||||
|
|
||||||
/* Allocate back-buffer */
|
/* Allocate back-buffer */
|
||||||
|
if (vmesa->hasBack) {
|
||||||
vmesa->back.pitch = (buffer_align( vmesa->driDrawable->w ) << shift)
|
vmesa->back.bpp = vmesa->viaScreen->bitsPerPixel;
|
||||||
+ extra;
|
vmesa->back.pitch = (buffer_align( vmesa->driDrawable->w ) << shift) + extra;
|
||||||
vmesa->back.size = vmesa->back.pitch * vmesa->driDrawable->h;
|
vmesa->back.size = vmesa->back.pitch * vmesa->driDrawable->h;
|
||||||
|
if (vmesa->back.map)
|
||||||
|
via_free_draw_buffer(vmesa, &vmesa->back);
|
||||||
|
if (!via_alloc_draw_buffer(vmesa, &vmesa->back))
|
||||||
|
return GL_FALSE;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
/* KW: mem leak if vmesa->hasBack ever changes:
|
||||||
|
*/
|
||||||
|
(void) memset( &vmesa->back, 0, sizeof( vmesa->back ) );
|
||||||
|
}
|
||||||
|
|
||||||
if (VIA_DEBUG) fprintf(stderr, "%s backbuffer: w = %d h = %d bpp = %d sizs = %d\n",
|
|
||||||
__FUNCTION__,
|
|
||||||
vmesa->back.pitch,
|
|
||||||
vmesa->driDrawable->h,
|
|
||||||
8 << shift,
|
|
||||||
vmesa->back.size);
|
|
||||||
|
|
||||||
/* Allocate depth-buffer */
|
/* Allocate depth-buffer */
|
||||||
if ( vmesa->hasStencil || vmesa->hasDepth ) {
|
if ( vmesa->hasStencil || vmesa->hasDepth ) {
|
||||||
|
@ -211,18 +194,19 @@ calculate_buffer_parameters( viaContextPtr vmesa )
|
||||||
|
|
||||||
vmesa->depth.pitch = (buffer_align( vmesa->driDrawable->w ) * (vmesa->depth.bpp/8)) + extra;
|
vmesa->depth.pitch = (buffer_align( vmesa->driDrawable->w ) * (vmesa->depth.bpp/8)) + extra;
|
||||||
vmesa->depth.size = vmesa->depth.pitch * vmesa->driDrawable->h;
|
vmesa->depth.size = vmesa->depth.pitch * vmesa->driDrawable->h;
|
||||||
|
|
||||||
|
if (vmesa->depth.map)
|
||||||
|
via_free_draw_buffer(vmesa, &vmesa->depth);
|
||||||
|
if (!via_alloc_draw_buffer(vmesa, &vmesa->depth)) {
|
||||||
|
return GL_FALSE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
/* KW: mem leak if vmesa->hasStencil/hasDepth ever changes:
|
||||||
|
*/
|
||||||
(void) memset( & vmesa->depth, 0, sizeof( vmesa->depth ) );
|
(void) memset( & vmesa->depth, 0, sizeof( vmesa->depth ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (VIA_DEBUG) fprintf(stderr, "%s depthbuffer: w = %d h = %d bpp = %d sizs = %d\n",
|
|
||||||
__FUNCTION__,
|
|
||||||
vmesa->depth.pitch,
|
|
||||||
vmesa->driDrawable->h,
|
|
||||||
vmesa->depth.bpp,
|
|
||||||
vmesa->depth.size);
|
|
||||||
|
|
||||||
/*=* John Sheng [2003.5.31] flip *=*/
|
/*=* John Sheng [2003.5.31] flip *=*/
|
||||||
if( vmesa->viaScreen->width == vmesa->driDrawable->w &&
|
if( vmesa->viaScreen->width == vmesa->driDrawable->w &&
|
||||||
vmesa->viaScreen->height == vmesa->driDrawable->h ) {
|
vmesa->viaScreen->height == vmesa->driDrawable->h ) {
|
||||||
|
@ -232,14 +216,11 @@ calculate_buffer_parameters( viaContextPtr vmesa )
|
||||||
#else
|
#else
|
||||||
vmesa->doPageFlip = GL_FALSE;
|
vmesa->doPageFlip = GL_FALSE;
|
||||||
#endif
|
#endif
|
||||||
vmesa->currentPage = 0;
|
/* vmesa->currentPage = 0; */
|
||||||
vmesa->back.pitch = vmesa->front.pitch;
|
assert(vmesa->back.pitch == vmesa->front.pitch);
|
||||||
}
|
|
||||||
|
|
||||||
if (!AllocateBuffer(vmesa)) {
|
|
||||||
FREE(vmesa);
|
|
||||||
return GL_FALSE;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
vmesa->doPageFlip = GL_FALSE;
|
||||||
|
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
}
|
}
|
||||||
|
@ -250,20 +231,8 @@ void viaReAllocateBuffers(GLframebuffer *drawbuffer)
|
||||||
GET_CURRENT_CONTEXT(ctx);
|
GET_CURRENT_CONTEXT(ctx);
|
||||||
viaContextPtr vmesa = VIA_CONTEXT(ctx);
|
viaContextPtr vmesa = VIA_CONTEXT(ctx);
|
||||||
|
|
||||||
ctx->DrawBuffer->Width = drawbuffer->Width;
|
_swrast_alloc_buffers( drawbuffer );
|
||||||
ctx->DrawBuffer->Height = drawbuffer->Height;
|
|
||||||
|
|
||||||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
|
|
||||||
ctx->DrawBuffer->Accum = 0;
|
|
||||||
|
|
||||||
vmesa->driDrawable->w = ctx->DrawBuffer->Width;
|
|
||||||
vmesa->driDrawable->h = ctx->DrawBuffer->Height;
|
|
||||||
|
|
||||||
LOCK_HARDWARE(vmesa);
|
|
||||||
calculate_buffer_parameters( vmesa );
|
calculate_buffer_parameters( vmesa );
|
||||||
UNLOCK_HARDWARE(vmesa);
|
|
||||||
|
|
||||||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void viaBufferSize(GLframebuffer *buffer, GLuint *width, GLuint *height)
|
static void viaBufferSize(GLframebuffer *buffer, GLuint *width, GLuint *height)
|
||||||
|
@ -303,9 +272,7 @@ static const struct tnl_pipeline_stage *via_pipeline[] = {
|
||||||
&_tnl_texgen_stage,
|
&_tnl_texgen_stage,
|
||||||
&_tnl_texture_transform_stage,
|
&_tnl_texture_transform_stage,
|
||||||
/* REMOVE: point attenuation stage */
|
/* REMOVE: point attenuation stage */
|
||||||
#if 0
|
|
||||||
&_via_fastrender_stage, /* ADD: unclipped rastersetup-to-dma */
|
&_via_fastrender_stage, /* ADD: unclipped rastersetup-to-dma */
|
||||||
#endif
|
|
||||||
&_tnl_render_stage,
|
&_tnl_render_stage,
|
||||||
0,
|
0,
|
||||||
};
|
};
|
||||||
|
@ -314,39 +281,14 @@ static const struct tnl_pipeline_stage *via_pipeline[] = {
|
||||||
static GLboolean
|
static GLboolean
|
||||||
AllocateDmaBuffer(const GLvisual *visual, viaContextPtr vmesa)
|
AllocateDmaBuffer(const GLvisual *visual, viaContextPtr vmesa)
|
||||||
{
|
{
|
||||||
GLuint *addr;
|
|
||||||
|
|
||||||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
|
|
||||||
if (vmesa->dma)
|
if (vmesa->dma)
|
||||||
via_free_dma_buffer(vmesa);
|
via_free_dma_buffer(vmesa);
|
||||||
|
|
||||||
if (!via_alloc_dma_buffer(vmesa)) {
|
if (!via_alloc_dma_buffer(vmesa))
|
||||||
if (vmesa->front.map)
|
|
||||||
via_free_front_buffer(vmesa);
|
|
||||||
if (vmesa->back.map)
|
|
||||||
via_free_back_buffer(vmesa);
|
|
||||||
if (vmesa->depth.map)
|
|
||||||
via_free_depth_buffer(vmesa);
|
|
||||||
|
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
|
||||||
|
|
||||||
/* Insert placeholder for a cliprect:
|
vmesa->dmaLow = 0;
|
||||||
*/
|
vmesa->dmaCliprectAddr = 0;
|
||||||
addr = (GLuint *)vmesa->dma;
|
|
||||||
addr[0] = HC_HEADER2;
|
|
||||||
addr[1] = (HC_ParaType_NotTex << 16);
|
|
||||||
addr[2] = HC_DUMMY;
|
|
||||||
addr[3] = HC_DUMMY;
|
|
||||||
addr[4] = HC_DUMMY;
|
|
||||||
addr[5] = HC_DUMMY;
|
|
||||||
addr[6] = HC_DUMMY;
|
|
||||||
addr[7] = HC_DUMMY;
|
|
||||||
|
|
||||||
vmesa->dmaLow = DMA_OFFSET;
|
|
||||||
vmesa->dmaAddr = (unsigned char *)vmesa->dma;
|
|
||||||
|
|
||||||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__);
|
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -354,13 +296,13 @@ static void
|
||||||
FreeBuffer(viaContextPtr vmesa)
|
FreeBuffer(viaContextPtr vmesa)
|
||||||
{
|
{
|
||||||
if (vmesa->front.map)
|
if (vmesa->front.map)
|
||||||
via_free_front_buffer(vmesa);
|
via_free_draw_buffer(vmesa, &vmesa->front);
|
||||||
|
|
||||||
if (vmesa->back.map)
|
if (vmesa->back.map)
|
||||||
via_free_back_buffer(vmesa);
|
via_free_draw_buffer(vmesa, &vmesa->back);
|
||||||
|
|
||||||
if (vmesa->depth.map)
|
if (vmesa->depth.map)
|
||||||
via_free_depth_buffer(vmesa);
|
via_free_draw_buffer(vmesa, &vmesa->depth);
|
||||||
|
|
||||||
if (vmesa->dma)
|
if (vmesa->dma)
|
||||||
via_free_dma_buffer(vmesa);
|
via_free_dma_buffer(vmesa);
|
||||||
|
@ -536,6 +478,7 @@ viaCreateContext(const __GLcontextModes *mesaVis,
|
||||||
*/
|
*/
|
||||||
if (!AllocateDmaBuffer(mesaVis, vmesa)) {
|
if (!AllocateDmaBuffer(mesaVis, vmesa)) {
|
||||||
fprintf(stderr ,"AllocateDmaBuffer fail\n");
|
fprintf(stderr ,"AllocateDmaBuffer fail\n");
|
||||||
|
FreeBuffer(vmesa);
|
||||||
FREE(vmesa);
|
FREE(vmesa);
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
@ -576,7 +519,7 @@ viaCreateContext(const __GLcontextModes *mesaVis,
|
||||||
if ( vmesa->get_ust == NULL ) {
|
if ( vmesa->get_ust == NULL ) {
|
||||||
vmesa->get_ust = get_ust_nop;
|
vmesa->get_ust = get_ust_nop;
|
||||||
}
|
}
|
||||||
(*vmesa->get_ust)( & vmesa->swap_ust );
|
vmesa->get_ust( &vmesa->swap_ust );
|
||||||
|
|
||||||
|
|
||||||
vmesa->regMMIOBase = (GLuint *)((GLuint)viaScreen->reg);
|
vmesa->regMMIOBase = (GLuint *)((GLuint)viaScreen->reg);
|
||||||
|
@ -620,64 +563,59 @@ viaDestroyContext(__DRIcontextPrivate *driContextPriv)
|
||||||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__);
|
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void viaXMesaSetFrontClipRects(viaContextPtr vmesa)
|
|
||||||
{
|
|
||||||
__DRIdrawablePrivate *dPriv = vmesa->driDrawable;
|
|
||||||
|
|
||||||
if (!dPriv)
|
|
||||||
return;
|
|
||||||
|
|
||||||
vmesa->numClipRects = dPriv->numClipRects;
|
|
||||||
vmesa->pClipRects = dPriv->pClipRects;
|
|
||||||
vmesa->drawX = dPriv->x;
|
|
||||||
vmesa->drawY = dPriv->y;
|
|
||||||
vmesa->drawW = dPriv->w;
|
|
||||||
vmesa->drawH = dPriv->h;
|
|
||||||
|
|
||||||
{
|
|
||||||
GLuint bytePerPixel = vmesa->viaScreen->bitsPerPixel >> 3;
|
|
||||||
vmesa->drawXoff = (GLuint)(((vmesa->drawX * bytePerPixel) & 0x1f) / bytePerPixel);
|
|
||||||
}
|
|
||||||
|
|
||||||
viaCalcViewport(vmesa->glCtx);
|
|
||||||
}
|
|
||||||
|
|
||||||
void viaXMesaSetBackClipRects(viaContextPtr vmesa)
|
|
||||||
{
|
|
||||||
__DRIdrawablePrivate *dPriv = vmesa->driDrawable;
|
|
||||||
|
|
||||||
if (!dPriv)
|
|
||||||
return;
|
|
||||||
|
|
||||||
/*=* John Sheng [2003.6.9] fix glxgears dirty screen */
|
|
||||||
vmesa->numClipRects = dPriv->numClipRects;
|
|
||||||
vmesa->pClipRects = dPriv->pClipRects;
|
|
||||||
vmesa->drawX = dPriv->x;
|
|
||||||
vmesa->drawY = dPriv->y;
|
|
||||||
vmesa->drawW = dPriv->w;
|
|
||||||
vmesa->drawH = dPriv->h;
|
|
||||||
|
|
||||||
|
|
||||||
vmesa->drawXoff = 0;
|
|
||||||
|
|
||||||
viaCalcViewport(vmesa->glCtx);
|
|
||||||
}
|
|
||||||
|
|
||||||
void viaXMesaWindowMoved(viaContextPtr vmesa)
|
void viaXMesaWindowMoved(viaContextPtr vmesa)
|
||||||
{
|
{
|
||||||
|
__DRIdrawablePrivate *dPriv = vmesa->driDrawable;
|
||||||
|
GLuint bytePerPixel = vmesa->viaScreen->bitsPerPixel >> 3;
|
||||||
|
|
||||||
|
if (!dPriv)
|
||||||
|
return;
|
||||||
|
|
||||||
switch (vmesa->glCtx->Color._DrawDestMask[0]) {
|
switch (vmesa->glCtx->Color._DrawDestMask[0]) {
|
||||||
case DD_FRONT_LEFT_BIT:
|
case DD_FRONT_LEFT_BIT:
|
||||||
viaXMesaSetFrontClipRects(vmesa);
|
if (dPriv->numBackClipRects == 0) {
|
||||||
|
vmesa->numClipRects = dPriv->numClipRects;
|
||||||
|
vmesa->pClipRects = dPriv->pClipRects;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
vmesa->numClipRects = dPriv->numBackClipRects;
|
||||||
|
vmesa->pClipRects = dPriv->pBackClipRects;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case DD_BACK_LEFT_BIT:
|
case DD_BACK_LEFT_BIT:
|
||||||
viaXMesaSetBackClipRects(vmesa);
|
vmesa->numClipRects = dPriv->numClipRects;
|
||||||
|
vmesa->pClipRects = dPriv->pClipRects;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
viaXMesaSetFrontClipRects(vmesa);
|
vmesa->numClipRects = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (vmesa->drawW != dPriv->w ||
|
||||||
|
vmesa->drawH != dPriv->h)
|
||||||
|
calculate_buffer_parameters( vmesa );
|
||||||
|
|
||||||
|
vmesa->drawXoff = (GLuint)(((dPriv->x * bytePerPixel) & 0x1f) / bytePerPixel);
|
||||||
|
vmesa->drawX = dPriv->x - vmesa->drawXoff;
|
||||||
|
vmesa->drawY = dPriv->y;
|
||||||
|
vmesa->drawW = dPriv->w;
|
||||||
|
vmesa->drawH = dPriv->h;
|
||||||
|
|
||||||
|
vmesa->front.orig = (vmesa->front.offset +
|
||||||
|
vmesa->drawY * vmesa->front.pitch +
|
||||||
|
vmesa->drawX * bytePerPixel);
|
||||||
|
|
||||||
|
vmesa->front.origMap = (vmesa->front.map +
|
||||||
|
vmesa->drawY * vmesa->front.pitch +
|
||||||
|
vmesa->drawX * bytePerPixel);
|
||||||
|
|
||||||
|
vmesa->back.orig = vmesa->back.offset;
|
||||||
|
vmesa->depth.orig = vmesa->depth.offset;
|
||||||
|
vmesa->back.origMap = vmesa->back.map;
|
||||||
|
vmesa->depth.origMap = vmesa->depth.map;
|
||||||
|
|
||||||
|
viaCalcViewport(vmesa->glCtx);
|
||||||
}
|
}
|
||||||
|
|
||||||
GLboolean
|
GLboolean
|
||||||
|
@ -736,30 +674,20 @@ void viaGetLock(viaContextPtr vmesa, GLuint flags)
|
||||||
{
|
{
|
||||||
__DRIdrawablePrivate *dPriv = vmesa->driDrawable;
|
__DRIdrawablePrivate *dPriv = vmesa->driDrawable;
|
||||||
__DRIscreenPrivate *sPriv = vmesa->driScreen;
|
__DRIscreenPrivate *sPriv = vmesa->driScreen;
|
||||||
drm_via_sarea_t *sarea = vmesa->sarea;
|
|
||||||
int me = vmesa->hHWContext;
|
|
||||||
__DRIdrawablePrivate *pdp;
|
|
||||||
__DRIscreenPrivate *psp;
|
|
||||||
pdp = dPriv;
|
|
||||||
psp = sPriv;
|
|
||||||
if (VIA_DEBUG) {
|
|
||||||
fprintf(stderr, "%s - in\n", __FUNCTION__);
|
|
||||||
fprintf(stderr, "is: %x non-contend: %x want: %x\n",
|
|
||||||
*(GLuint *)vmesa->driHwLock, vmesa->hHWContext,
|
|
||||||
(DRM_LOCK_HELD|vmesa->hHWContext));
|
|
||||||
}
|
|
||||||
|
|
||||||
drmGetLock(vmesa->driFd, vmesa->hHWContext, flags);
|
drmGetLock(vmesa->driFd, vmesa->hHWContext, flags);
|
||||||
|
|
||||||
DRI_VALIDATE_DRAWABLE_INFO( sPriv, dPriv );
|
DRI_VALIDATE_DRAWABLE_INFO( sPriv, dPriv );
|
||||||
|
|
||||||
if (sarea->ctxOwner != me) {
|
if (vmesa->sarea->ctxOwner != vmesa->hHWContext) {
|
||||||
sarea->ctxOwner = me;
|
vmesa->sarea->ctxOwner = vmesa->hHWContext;
|
||||||
vmesa->newState = ~0;
|
vmesa->newState = ~0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (vmesa->lastStamp != dPriv->lastStamp) {
|
||||||
viaXMesaWindowMoved(vmesa);
|
viaXMesaWindowMoved(vmesa);
|
||||||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__);
|
vmesa->lastStamp = dPriv->lastStamp;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -768,7 +696,7 @@ viaSwapBuffers(__DRIdrawablePrivate *drawablePrivate)
|
||||||
{
|
{
|
||||||
__DRIdrawablePrivate *dPriv = (__DRIdrawablePrivate *)drawablePrivate;
|
__DRIdrawablePrivate *dPriv = (__DRIdrawablePrivate *)drawablePrivate;
|
||||||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
|
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
|
||||||
if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) {
|
if (dPriv && dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) {
|
||||||
viaContextPtr vmesa;
|
viaContextPtr vmesa;
|
||||||
GLcontext *ctx;
|
GLcontext *ctx;
|
||||||
|
|
||||||
|
|
|
@ -52,9 +52,12 @@ typedef struct via_texture_object_t *viaTextureObjectPtr;
|
||||||
#define VIA_FALLBACK_BLEND_FUNC 0x400
|
#define VIA_FALLBACK_BLEND_FUNC 0x400
|
||||||
#define VIA_FALLBACK_USER_DISABLE 0x800
|
#define VIA_FALLBACK_USER_DISABLE 0x800
|
||||||
|
|
||||||
#define VIA_DMA_BUFSIZ 500000
|
#define VIA_DMA_BUFSIZ 5000
|
||||||
#define VIA_DMA_HIGHWATER (VIA_DMA_BUFSIZ - 256)
|
#define VIA_DMA_HIGHWATER (VIA_DMA_BUFSIZ - 256)
|
||||||
|
|
||||||
|
#define VIA_NO_CLIPRECTS 0x1
|
||||||
|
|
||||||
|
|
||||||
/* Use the templated vertex formats:
|
/* Use the templated vertex formats:
|
||||||
*/
|
*/
|
||||||
#define TAG(x) via##x
|
#define TAG(x) via##x
|
||||||
|
@ -74,6 +77,10 @@ typedef struct {
|
||||||
GLuint pitch;
|
GLuint pitch;
|
||||||
GLuint bpp;
|
GLuint bpp;
|
||||||
char *map;
|
char *map;
|
||||||
|
GLuint orig; /* The drawing origin,
|
||||||
|
* at (drawX,drawY) in screen space.
|
||||||
|
*/
|
||||||
|
char *origMap;
|
||||||
} viaBuffer, *viaBufferPtr;
|
} viaBuffer, *viaBufferPtr;
|
||||||
|
|
||||||
|
|
||||||
|
@ -81,7 +88,6 @@ struct via_context_t {
|
||||||
GLint refcount;
|
GLint refcount;
|
||||||
GLcontext *glCtx;
|
GLcontext *glCtx;
|
||||||
GLcontext *shareCtx;
|
GLcontext *shareCtx;
|
||||||
unsigned char* front_base;
|
|
||||||
viaBuffer front;
|
viaBuffer front;
|
||||||
viaBuffer back;
|
viaBuffer back;
|
||||||
viaBuffer depth;
|
viaBuffer depth;
|
||||||
|
@ -98,7 +104,7 @@ struct via_context_t {
|
||||||
GLuint stencil_clear_mask;
|
GLuint stencil_clear_mask;
|
||||||
GLfloat depth_max;
|
GLfloat depth_max;
|
||||||
|
|
||||||
GLuint *dma;
|
GLubyte *dma;
|
||||||
viaRegion tex;
|
viaRegion tex;
|
||||||
|
|
||||||
GLuint isAGP;
|
GLuint isAGP;
|
||||||
|
@ -127,8 +133,8 @@ struct via_context_t {
|
||||||
|
|
||||||
/* drmBufPtr dma_buffer;
|
/* drmBufPtr dma_buffer;
|
||||||
*/
|
*/
|
||||||
unsigned char* dmaAddr;
|
|
||||||
GLuint dmaLow;
|
GLuint dmaLow;
|
||||||
|
GLuint dmaCliprectAddr;
|
||||||
GLuint dmaLastPrim;
|
GLuint dmaLastPrim;
|
||||||
GLboolean useAgp;
|
GLboolean useAgp;
|
||||||
|
|
||||||
|
@ -202,7 +208,6 @@ struct via_context_t {
|
||||||
int vertexSize;
|
int vertexSize;
|
||||||
int vertexFormat;
|
int vertexFormat;
|
||||||
GLint lastStamp;
|
GLint lastStamp;
|
||||||
GLboolean stippleInHw;
|
|
||||||
|
|
||||||
GLenum TexEnvImageFmt[2];
|
GLenum TexEnvImageFmt[2];
|
||||||
GLuint ClearColor;
|
GLuint ClearColor;
|
||||||
|
@ -213,16 +218,15 @@ struct via_context_t {
|
||||||
GLboolean doPageFlip;
|
GLboolean doPageFlip;
|
||||||
/*=* John Sheng [2003.5.31] flip *=*/
|
/*=* John Sheng [2003.5.31] flip *=*/
|
||||||
GLuint currentPage;
|
GLuint currentPage;
|
||||||
char *drawMap; /* draw buffer address in virtual mem */
|
|
||||||
char *readMap;
|
viaBuffer *drawBuffer;
|
||||||
|
viaBuffer *readBuffer;
|
||||||
int drawX; /* origin of drawable in draw buffer */
|
int drawX; /* origin of drawable in draw buffer */
|
||||||
int drawY;
|
int drawY;
|
||||||
|
|
||||||
int drawW;
|
int drawW;
|
||||||
int drawH;
|
int drawH;
|
||||||
|
|
||||||
int drawPitch;
|
|
||||||
int readPitch;
|
|
||||||
int drawXoff;
|
int drawXoff;
|
||||||
GLuint numClipRects; /* cliprects for that buffer */
|
GLuint numClipRects; /* cliprects for that buffer */
|
||||||
drm_clip_rect_t *pClipRects;
|
drm_clip_rect_t *pClipRects;
|
||||||
|
@ -325,6 +329,8 @@ extern void viaXMesaWindowMoved(viaContextPtr vmesa);
|
||||||
extern void viaTexCombineState(viaContextPtr vmesa,
|
extern void viaTexCombineState(viaContextPtr vmesa,
|
||||||
const struct gl_tex_env_combine_state * combine, unsigned unit );
|
const struct gl_tex_env_combine_state * combine, unsigned unit );
|
||||||
|
|
||||||
|
/* Via hw already adjusted for GL pixel centers:
|
||||||
|
*/
|
||||||
#define SUBPIXEL_X 0
|
#define SUBPIXEL_X 0
|
||||||
#define SUBPIXEL_Y 0
|
#define SUBPIXEL_Y 0
|
||||||
|
|
||||||
|
|
|
@ -31,126 +31,37 @@
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
|
|
||||||
GLboolean
|
GLboolean
|
||||||
via_alloc_back_buffer(viaContextPtr vmesa)
|
via_alloc_draw_buffer(viaContextPtr vmesa, viaBuffer *buf)
|
||||||
{
|
{
|
||||||
drm_via_mem_t fb;
|
drm_via_mem_t mem;
|
||||||
unsigned char *pFB;
|
mem.context = vmesa->hHWContext;
|
||||||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
|
mem.size = buf->size;
|
||||||
fb.context = vmesa->hHWContext;
|
mem.type = VIDEO;
|
||||||
fb.size = vmesa->back.size;
|
|
||||||
fb.type = VIDEO;
|
if (ioctl(vmesa->driFd, DRM_IOCTL_VIA_ALLOCMEM, &mem))
|
||||||
if (VIA_DEBUG) fprintf(stderr, "context = %d, size =%d, type = %d\n", fb.context, fb.size, fb.type);
|
|
||||||
if (ioctl(vmesa->driFd, DRM_IOCTL_VIA_ALLOCMEM, &fb))
|
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
|
|
||||||
pFB = vmesa->driScreen->pFB;
|
|
||||||
|
|
||||||
vmesa->back.offset = fb.offset;
|
buf->offset = mem.offset;
|
||||||
vmesa->back.map = (char *)(fb.offset + (GLuint)pFB);
|
buf->map = (char *)vmesa->driScreen->pFB + mem.offset;
|
||||||
vmesa->back.index = fb.index;
|
buf->index = mem.index;
|
||||||
if (VIA_DEBUG) {
|
|
||||||
fprintf(stderr, "back offset = %08x\n", vmesa->back.offset);
|
|
||||||
fprintf(stderr, "back index = %d\n", vmesa->back.index);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__);
|
|
||||||
return GL_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
GLboolean
|
|
||||||
via_alloc_front_buffer(viaContextPtr vmesa)
|
|
||||||
{
|
|
||||||
drm_via_mem_t fb;
|
|
||||||
unsigned char *pFB;
|
|
||||||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
|
|
||||||
fb.context = vmesa->hHWContext;
|
|
||||||
fb.size = vmesa->back.size;
|
|
||||||
fb.type = VIDEO;
|
|
||||||
if (VIA_DEBUG) fprintf(stderr, "context = %d, size =%d, type = %d\n", fb.context, fb.size, fb.type);
|
|
||||||
if (ioctl(vmesa->driFd, DRM_IOCTL_VIA_ALLOCMEM, &fb))
|
|
||||||
return GL_FALSE;
|
|
||||||
|
|
||||||
pFB = vmesa->driScreen->pFB;
|
|
||||||
|
|
||||||
vmesa->front.offset = fb.offset;
|
|
||||||
vmesa->front.map = (char *)(fb.offset + (GLuint)pFB);
|
|
||||||
vmesa->front.index = fb.index;
|
|
||||||
if (VIA_DEBUG) {
|
|
||||||
fprintf(stderr, "front offset = %08x\n", vmesa->front.offset);
|
|
||||||
fprintf(stderr, "front index = %d\n", vmesa->front.index);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__);
|
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
via_free_back_buffer(viaContextPtr vmesa)
|
via_free_draw_buffer(viaContextPtr vmesa, viaBuffer *buf)
|
||||||
{
|
{
|
||||||
drm_via_mem_t fb;
|
drm_via_mem_t mem;
|
||||||
|
|
||||||
if (!vmesa) return;
|
if (!vmesa) return;
|
||||||
fb.context = vmesa->hHWContext;
|
|
||||||
fb.index = vmesa->back.index;
|
mem.context = vmesa->hHWContext;
|
||||||
fb.type = VIDEO;
|
mem.index = buf->index;
|
||||||
ioctl(vmesa->driFd, DRM_IOCTL_VIA_FREEMEM, &fb);
|
mem.type = VIDEO;
|
||||||
vmesa->back.map = NULL;
|
ioctl(vmesa->driFd, DRM_IOCTL_VIA_FREEMEM, &mem);
|
||||||
|
buf->map = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
via_free_front_buffer(viaContextPtr vmesa)
|
|
||||||
{
|
|
||||||
drm_via_mem_t fb;
|
|
||||||
|
|
||||||
if (!vmesa) return;
|
|
||||||
fb.context = vmesa->hHWContext;
|
|
||||||
fb.index = vmesa->front.index;
|
|
||||||
fb.type = VIDEO;
|
|
||||||
ioctl(vmesa->driFd, DRM_IOCTL_VIA_FREEMEM, &fb);
|
|
||||||
vmesa->front.map = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
GLboolean
|
|
||||||
via_alloc_depth_buffer(viaContextPtr vmesa)
|
|
||||||
{
|
|
||||||
drm_via_mem_t fb;
|
|
||||||
unsigned char *pFB;
|
|
||||||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
|
|
||||||
fb.context = vmesa->hHWContext;
|
|
||||||
fb.size = vmesa->depth.size;
|
|
||||||
fb.type = VIDEO;
|
|
||||||
|
|
||||||
if (ioctl(vmesa->driFd, DRM_IOCTL_VIA_ALLOCMEM, &fb)) {
|
|
||||||
return GL_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
pFB = vmesa->driScreen->pFB;
|
|
||||||
|
|
||||||
vmesa->depth.offset = fb.offset;
|
|
||||||
vmesa->depth.map = (char *)(fb.offset + (GLuint)pFB);
|
|
||||||
vmesa->depth.index = fb.index;
|
|
||||||
if (VIA_DEBUG) {
|
|
||||||
fprintf(stderr, "depth offset = %08x\n", vmesa->depth.offset);
|
|
||||||
fprintf(stderr, "depth index = %d\n", vmesa->depth.index);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__);
|
|
||||||
return GL_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
via_free_depth_buffer(viaContextPtr vmesa)
|
|
||||||
{
|
|
||||||
drm_via_mem_t fb;
|
|
||||||
|
|
||||||
if (!vmesa) return;
|
|
||||||
fb.context = vmesa->hHWContext;
|
|
||||||
fb.index = vmesa->depth.index;
|
|
||||||
fb.type = VIDEO;
|
|
||||||
ioctl(vmesa->driFd, DRM_IOCTL_VIA_FREEMEM, &fb);
|
|
||||||
vmesa->depth.map = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
GLboolean
|
GLboolean
|
||||||
via_alloc_dma_buffer(viaContextPtr vmesa)
|
via_alloc_dma_buffer(viaContextPtr vmesa)
|
||||||
|
@ -158,7 +69,7 @@ via_alloc_dma_buffer(viaContextPtr vmesa)
|
||||||
drmVIADMAInit init;
|
drmVIADMAInit init;
|
||||||
|
|
||||||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
|
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
|
||||||
vmesa->dma = (GLuint *) malloc(VIA_DMA_BUFSIZ);
|
vmesa->dma = (GLubyte *) malloc(VIA_DMA_BUFSIZ);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check whether AGP DMA has been initialized.
|
* Check whether AGP DMA has been initialized.
|
||||||
|
|
|
@ -25,18 +25,14 @@
|
||||||
#ifndef _VIAFB_INC
|
#ifndef _VIAFB_INC
|
||||||
#define _VIAFB_INC
|
#define _VIAFB_INC
|
||||||
|
|
||||||
#include "mtypes.h"
|
#include "via_context.h"
|
||||||
#include "swrast/swrast.h"
|
|
||||||
extern GLboolean via_alloc_front_buffer(viaContextPtr vmesa);
|
extern GLboolean via_alloc_draw_buffer(viaContextPtr vmesa, viaBuffer *buf);
|
||||||
extern GLboolean via_alloc_back_buffer(viaContextPtr vmesa);
|
|
||||||
extern void via_free_back_buffer(viaContextPtr vmesa);
|
|
||||||
extern void via_free_front_buffer(viaContextPtr vmesa);
|
|
||||||
extern GLboolean via_alloc_depth_buffer(viaContextPtr vmesa);
|
|
||||||
extern void via_free_depth_buffer(viaContextPtr vmesa);
|
|
||||||
extern GLboolean via_alloc_dma_buffer(viaContextPtr vmesa);
|
extern GLboolean via_alloc_dma_buffer(viaContextPtr vmesa);
|
||||||
extern void via_free_dma_buffer(viaContextPtr vmesa);
|
|
||||||
extern GLboolean via_alloc_texture(viaContextPtr vmesa, viaTextureObjectPtr t);
|
extern GLboolean via_alloc_texture(viaContextPtr vmesa, viaTextureObjectPtr t);
|
||||||
/*=* John Sheng [2003.5.31] agp tex *=*/
|
|
||||||
extern GLboolean via_alloc_texture_agp(viaContextPtr vmesa, viaTextureObjectPtr t);
|
extern GLboolean via_alloc_texture_agp(viaContextPtr vmesa, viaTextureObjectPtr t);
|
||||||
|
|
||||||
|
extern void via_free_draw_buffer(viaContextPtr vmesa, viaBuffer *buf);
|
||||||
|
extern void via_free_dma_buffer(viaContextPtr vmesa);
|
||||||
extern void via_free_texture(viaContextPtr vmesa, viaTextureObjectPtr t);
|
extern void via_free_texture(viaContextPtr vmesa, viaTextureObjectPtr t);
|
||||||
#endif
|
#endif
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -29,18 +29,12 @@
|
||||||
|
|
||||||
|
|
||||||
void viaFinishPrimitive(viaContextPtr vmesa);
|
void viaFinishPrimitive(viaContextPtr vmesa);
|
||||||
void viaFlushPrims(viaContextPtr vmesa);
|
void viaFlushDma(viaContextPtr vmesa);
|
||||||
void viaFlushPrimsLocked(viaContextPtr vmesa);
|
void viaFlushDmaLocked(viaContextPtr vmesa, GLuint flags);
|
||||||
|
|
||||||
void viaInitIoctlFuncs(GLcontext *ctx);
|
void viaInitIoctlFuncs(GLcontext *ctx);
|
||||||
void viaCopyBuffer(const __DRIdrawablePrivate *dpriv);
|
void viaCopyBuffer(const __DRIdrawablePrivate *dpriv);
|
||||||
void viaPageFlip(const __DRIdrawablePrivate *dpriv);
|
void viaPageFlip(const __DRIdrawablePrivate *dpriv);
|
||||||
void viaFillFrontBuffer(viaContextPtr vmesa);
|
|
||||||
void viaFillFrontPBuffer(viaContextPtr vmesa);
|
|
||||||
void viaFillBackBuffer(viaContextPtr vmesa);
|
|
||||||
void viaFillDepthBuffer(viaContextPtr vmesa, GLuint pixel, GLuint mask);
|
|
||||||
void viaDoSwapBuffers(viaContextPtr vmesa);
|
|
||||||
void viaDoSwapPBuffers(viaContextPtr vmesa);
|
|
||||||
void viaCheckDma(viaContextPtr vmesa, GLuint bytes);
|
void viaCheckDma(viaContextPtr vmesa, GLuint bytes);
|
||||||
|
|
||||||
#define VIA_FINISH_PRIM(vmesa) do { \
|
#define VIA_FINISH_PRIM(vmesa) do { \
|
||||||
|
@ -50,8 +44,8 @@ void viaCheckDma(viaContextPtr vmesa, GLuint bytes);
|
||||||
|
|
||||||
#define VIA_FLUSH_DMA(vmesa) do { \
|
#define VIA_FLUSH_DMA(vmesa) do { \
|
||||||
VIA_FINISH_PRIM(vmesa); \
|
VIA_FINISH_PRIM(vmesa); \
|
||||||
if (vmesa->dmaLow != DMA_OFFSET) \
|
if (vmesa->dmaLow) \
|
||||||
viaFlushPrims(vmesa); \
|
viaFlushDma(vmesa); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
|
||||||
|
@ -59,12 +53,6 @@ GLuint *viaAllocDmaFunc(viaContextPtr vmesa, int bytes, const char *func, int li
|
||||||
#define viaAllocDma( v, b ) viaAllocDmaFunc(v, b, __FUNCTION__, __LINE__)
|
#define viaAllocDma( v, b ) viaAllocDmaFunc(v, b, __FUNCTION__, __LINE__)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Room for the cliprect and other preamble at the head of each dma
|
|
||||||
* buffer: (What about buffers which only contain blits?)
|
|
||||||
*/
|
|
||||||
#define DMA_OFFSET 32
|
|
||||||
|
|
||||||
#define RING_VARS GLuint *_vb = 0, _nr, _x;
|
#define RING_VARS GLuint *_vb = 0, _nr, _x;
|
||||||
|
|
||||||
#define BEGIN_RING(n) do { \
|
#define BEGIN_RING(n) do { \
|
||||||
|
@ -76,7 +64,7 @@ GLuint *viaAllocDmaFunc(viaContextPtr vmesa, int bytes, const char *func, int li
|
||||||
|
|
||||||
#define BEGIN_RING_NOCHECK(n) do { \
|
#define BEGIN_RING_NOCHECK(n) do { \
|
||||||
if (_vb != 0) abort(); \
|
if (_vb != 0) abort(); \
|
||||||
_vb = (GLuint *)(vmesa->dmaAddr + vmesa->dmaLow); \
|
_vb = (GLuint *)(vmesa->dma + vmesa->dmaLow); \
|
||||||
vmesa->dmaLow += (n) * sizeof(GLuint); \
|
vmesa->dmaLow += (n) * sizeof(GLuint); \
|
||||||
_nr = (n); \
|
_nr = (n); \
|
||||||
_x = 0; \
|
_x = 0; \
|
||||||
|
|
|
@ -36,9 +36,9 @@
|
||||||
#define LOCAL_DEPTH_VARS \
|
#define LOCAL_DEPTH_VARS \
|
||||||
__DRIdrawablePrivate *dPriv = vmesa->driDrawable; \
|
__DRIdrawablePrivate *dPriv = vmesa->driDrawable; \
|
||||||
viaScreenPrivate *viaScreen = vmesa->viaScreen; \
|
viaScreenPrivate *viaScreen = vmesa->viaScreen; \
|
||||||
GLuint pitch = viaScreen->backPitch; \
|
GLuint depth_pitch = vmesa->depth.pitch; \
|
||||||
GLuint height = dPriv->h; \
|
GLuint height = dPriv->h; \
|
||||||
char *buf = (char *)(vmesa->depth.map)
|
char *buf = (char *)(vmesa->depth.map + (vmesa->drawXoff * vmesa->depth.bpp/8))
|
||||||
|
|
||||||
#define CLIPPIXEL(_x,_y) (_x >= minx && _x < maxx && \
|
#define CLIPPIXEL(_x,_y) (_x >= minx && _x < maxx && \
|
||||||
_y >= miny && _y < maxy)
|
_y >= miny && _y < maxy)
|
||||||
|
@ -63,10 +63,10 @@
|
||||||
__DRIdrawablePrivate *dPriv = vmesa->driDrawable; \
|
__DRIdrawablePrivate *dPriv = vmesa->driDrawable; \
|
||||||
int _nc = dPriv->numClipRects; \
|
int _nc = dPriv->numClipRects; \
|
||||||
while (_nc--) { \
|
while (_nc--) { \
|
||||||
int minx = dPriv->pClipRects[_nc].x1 - dPriv->x; \
|
int minx = dPriv->pClipRects[_nc].x1 - vmesa->drawX; \
|
||||||
int miny = dPriv->pClipRects[_nc].y1 - dPriv->y; \
|
int miny = dPriv->pClipRects[_nc].y1 - vmesa->drawY; \
|
||||||
int maxx = dPriv->pClipRects[_nc].x2 - dPriv->x; \
|
int maxx = dPriv->pClipRects[_nc].x2 - vmesa->drawX; \
|
||||||
int maxy = dPriv->pClipRects[_nc].y2 - dPriv->y;
|
int maxy = dPriv->pClipRects[_nc].y2 - vmesa->drawY;
|
||||||
|
|
||||||
|
|
||||||
#define HW_ENDCLIPLOOP() \
|
#define HW_ENDCLIPLOOP() \
|
||||||
|
@ -81,38 +81,28 @@
|
||||||
#define LOCAL_VARS \
|
#define LOCAL_VARS \
|
||||||
viaContextPtr vmesa = VIA_CONTEXT(ctx); \
|
viaContextPtr vmesa = VIA_CONTEXT(ctx); \
|
||||||
__DRIdrawablePrivate *dPriv = vmesa->driDrawable; \
|
__DRIdrawablePrivate *dPriv = vmesa->driDrawable; \
|
||||||
GLuint pitch = vmesa->drawPitch; \
|
GLuint draw_pitch = vmesa->drawBuffer->pitch; \
|
||||||
|
GLuint read_pitch = vmesa->readBuffer->pitch; \
|
||||||
GLuint height = dPriv->h; \
|
GLuint height = dPriv->h; \
|
||||||
GLushort p; \
|
GLushort p = 0; \
|
||||||
char *buf, *read_buf; \
|
char *buf = (char *)(vmesa->drawBuffer->origMap + vmesa->drawXoff * 2); \
|
||||||
p = 0; \
|
char *read_buf = (char *)(vmesa->readBuffer->origMap + vmesa->drawXoff * 2); \
|
||||||
if (vmesa->glCtx->Color._DrawDestMask[0] == DD_BACK_LEFT_BIT) { \
|
(void) (read_pitch && draw_pitch && buf && read_buf && p);
|
||||||
buf = (char *)(vmesa->drawMap); \
|
|
||||||
read_buf = (char *)(vmesa->readMap); \
|
|
||||||
} \
|
|
||||||
else { \
|
|
||||||
buf = (char *)(vmesa->drawMap + \
|
|
||||||
dPriv->x * 2 + \
|
|
||||||
dPriv->y * pitch); \
|
|
||||||
read_buf = (char *)(vmesa->readMap + \
|
|
||||||
dPriv->x * 2 + \
|
|
||||||
dPriv->y * pitch); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define INIT_MONO_PIXEL(p, color) \
|
#define INIT_MONO_PIXEL(p, color) \
|
||||||
p = PACK_COLOR_565(color[0], color[1], color[2])
|
p = PACK_COLOR_565(color[0], color[1], color[2])
|
||||||
|
|
||||||
#define WRITE_RGBA(_x, _y, r, g, b, a) \
|
#define WRITE_RGBA(_x, _y, r, g, b, a) \
|
||||||
*(GLushort *)(buf + _x * 2 + _y * pitch) = ((((int)r & 0xf8) << 8) | \
|
*(GLushort *)(buf + _x * 2 + _y * draw_pitch) = ((((int)r & 0xf8) << 8) | \
|
||||||
(((int)g & 0xfc) << 3) | \
|
(((int)g & 0xfc) << 3) | \
|
||||||
(((int)b & 0xf8) >> 3))
|
(((int)b & 0xf8) >> 3))
|
||||||
|
|
||||||
#define WRITE_PIXEL(_x, _y, p) \
|
#define WRITE_PIXEL(_x, _y, p) \
|
||||||
*(GLushort *)(buf + _x * 2 + _y * pitch) = p
|
*(GLushort *)(buf + _x * 2 + _y * draw_pitch) = p
|
||||||
|
|
||||||
#define READ_RGBA(rgba, _x, _y) \
|
#define READ_RGBA(rgba, _x, _y) \
|
||||||
do { \
|
do { \
|
||||||
GLushort p = *(GLushort *)(read_buf + _x * 2 + _y * pitch); \
|
GLushort p = *(GLushort *)(read_buf + _x * 2 + _y * read_pitch); \
|
||||||
rgba[0] = ((p >> 8) & 0xf8) * 255 / 0xf8; \
|
rgba[0] = ((p >> 8) & 0xf8) * 255 / 0xf8; \
|
||||||
rgba[1] = ((p >> 3) & 0xfc) * 255 / 0xfc; \
|
rgba[1] = ((p >> 3) & 0xfc) * 255 / 0xfc; \
|
||||||
rgba[2] = ((p << 3) & 0xf8) * 255 / 0xf8; \
|
rgba[2] = ((p << 3) & 0xf8) * 255 / 0xf8; \
|
||||||
|
@ -133,26 +123,16 @@
|
||||||
#define LOCAL_VARS \
|
#define LOCAL_VARS \
|
||||||
viaContextPtr vmesa = VIA_CONTEXT(ctx); \
|
viaContextPtr vmesa = VIA_CONTEXT(ctx); \
|
||||||
__DRIdrawablePrivate *dPriv = vmesa->driDrawable; \
|
__DRIdrawablePrivate *dPriv = vmesa->driDrawable; \
|
||||||
GLuint pitch = vmesa->drawPitch; \
|
GLuint draw_pitch = vmesa->drawBuffer->pitch; \
|
||||||
|
GLuint read_pitch = vmesa->readBuffer->pitch; \
|
||||||
GLuint height = dPriv->h; \
|
GLuint height = dPriv->h; \
|
||||||
GLuint p; \
|
GLuint p = 0; \
|
||||||
char *buf, *read_buf; \
|
char *buf = (char *)(vmesa->drawBuffer->origMap + vmesa->drawXoff * 4); \
|
||||||
p = 0; \
|
char *read_buf = (char *)(vmesa->readBuffer->origMap + vmesa->drawXoff * 4); \
|
||||||
if (vmesa->glCtx->Color._DrawDestMask[0] == DD_BACK_LEFT_BIT) { \
|
(void) (read_pitch && draw_pitch && buf && read_buf && p);
|
||||||
buf = (char *)(vmesa->drawMap); \
|
|
||||||
read_buf = (char *)(vmesa->readMap); \
|
|
||||||
} \
|
|
||||||
else { \
|
|
||||||
buf = (char *)(vmesa->drawMap + \
|
|
||||||
dPriv->x * 4 + \
|
|
||||||
dPriv->y * pitch); \
|
|
||||||
read_buf = (char *)(vmesa->readMap + \
|
|
||||||
dPriv->x * 4 + \
|
|
||||||
dPriv->y * pitch); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define GET_SRC_PTR(_x, _y) (read_buf + _x * 4 + _y * pitch)
|
#define GET_SRC_PTR(_x, _y) (read_buf + _x * 4 + _y * read_pitch)
|
||||||
#define GET_DST_PTR(_x, _y) ( buf + _x * 4 + _y * pitch)
|
#define GET_DST_PTR(_x, _y) ( buf + _x * 4 + _y * draw_pitch)
|
||||||
#define SPANTMP_PIXEL_FMT GL_BGRA
|
#define SPANTMP_PIXEL_FMT GL_BGRA
|
||||||
#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_INT_8_8_8_8_REV
|
#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_INT_8_8_8_8_REV
|
||||||
|
|
||||||
|
@ -166,7 +146,7 @@
|
||||||
#define LOCAL_DEPTH_VARS \
|
#define LOCAL_DEPTH_VARS \
|
||||||
viaContextPtr vmesa = VIA_CONTEXT(ctx); \
|
viaContextPtr vmesa = VIA_CONTEXT(ctx); \
|
||||||
__DRIdrawablePrivate *dPriv = vmesa->driDrawable; \
|
__DRIdrawablePrivate *dPriv = vmesa->driDrawable; \
|
||||||
GLuint pitch = vmesa->depth.pitch; \
|
GLuint depth_pitch = vmesa->depth.pitch; \
|
||||||
GLuint height = dPriv->h; \
|
GLuint height = dPriv->h; \
|
||||||
char *buf = (char *)(vmesa->depth.map)
|
char *buf = (char *)(vmesa->depth.map)
|
||||||
|
|
||||||
|
@ -174,10 +154,10 @@
|
||||||
|
|
||||||
|
|
||||||
#define WRITE_DEPTH(_x, _y, d) \
|
#define WRITE_DEPTH(_x, _y, d) \
|
||||||
*(GLushort *)(buf + _x * 2 + _y * pitch) = d;
|
*(GLushort *)(buf + _x * 2 + _y * depth_pitch) = d;
|
||||||
|
|
||||||
#define READ_DEPTH(d, _x, _y) \
|
#define READ_DEPTH(d, _x, _y) \
|
||||||
d = *(GLushort *)(buf + _x * 2 + _y * pitch);
|
d = *(GLushort *)(buf + _x * 2 + _y * depth_pitch);
|
||||||
|
|
||||||
#define TAG(x) via##x##_16
|
#define TAG(x) via##x##_16
|
||||||
#include "depthtmp.h"
|
#include "depthtmp.h"
|
||||||
|
@ -185,10 +165,10 @@
|
||||||
/* 32 bit depthbuffer functions.
|
/* 32 bit depthbuffer functions.
|
||||||
*/
|
*/
|
||||||
#define WRITE_DEPTH(_x, _y, d) \
|
#define WRITE_DEPTH(_x, _y, d) \
|
||||||
*(GLuint *)(buf + _x * 4 + _y * pitch) = d;
|
*(GLuint *)(buf + _x * 4 + _y * depth_pitch) = d;
|
||||||
|
|
||||||
#define READ_DEPTH(d, _x, _y) \
|
#define READ_DEPTH(d, _x, _y) \
|
||||||
d = *(GLuint *)(buf + _x * 4 + _y * pitch);
|
d = *(GLuint *)(buf + _x * 4 + _y * depth_pitch);
|
||||||
|
|
||||||
#define TAG(x) via##x##_32
|
#define TAG(x) via##x##_32
|
||||||
#include "depthtmp.h"
|
#include "depthtmp.h"
|
||||||
|
@ -198,28 +178,28 @@
|
||||||
/* 24/8 bit interleaved depth/stencil functions
|
/* 24/8 bit interleaved depth/stencil functions
|
||||||
*/
|
*/
|
||||||
#define WRITE_DEPTH( _x, _y, d ) { \
|
#define WRITE_DEPTH( _x, _y, d ) { \
|
||||||
GLuint tmp = *(GLuint *)(buf + (_x)*4 + (_y)*pitch); \
|
GLuint tmp = *(GLuint *)(buf + (_x)*4 + (_y)*depth_pitch); \
|
||||||
tmp &= 0x000000ff; \
|
tmp &= 0x000000ff; \
|
||||||
tmp |= ((d)<<8); \
|
tmp |= ((d)<<8); \
|
||||||
*(GLuint *)(buf + (_x)*4 + (_y)*pitch) = tmp; \
|
*(GLuint *)(buf + (_x)*4 + (_y)*depth_pitch) = tmp; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define READ_DEPTH( d, _x, _y ) \
|
#define READ_DEPTH( d, _x, _y ) \
|
||||||
d = (*(GLuint *)(buf + (_x)*4 + (_y)*pitch)) >> 8;
|
d = (*(GLuint *)(buf + (_x)*4 + (_y)*depth_pitch)) >> 8;
|
||||||
|
|
||||||
|
|
||||||
#define TAG(x) via##x##_24_8
|
#define TAG(x) via##x##_24_8
|
||||||
#include "depthtmp.h"
|
#include "depthtmp.h"
|
||||||
|
|
||||||
#define WRITE_STENCIL( _x, _y, d ) { \
|
#define WRITE_STENCIL( _x, _y, d ) { \
|
||||||
GLuint tmp = *(GLuint *)(buf + (_x)*4 + (_y)*pitch); \
|
GLuint tmp = *(GLuint *)(buf + (_x)*4 + (_y)*depth_pitch); \
|
||||||
tmp &= 0xffffff00; \
|
tmp &= 0xffffff00; \
|
||||||
tmp |= (d); \
|
tmp |= (d); \
|
||||||
*(GLuint *)(buf + (_x)*4 + (_y)*pitch) = tmp; \
|
*(GLuint *)(buf + (_x)*4 + (_y)*depth_pitch) = tmp; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define READ_STENCIL( d, _x, _y ) \
|
#define READ_STENCIL( d, _x, _y ) \
|
||||||
d = *(GLuint *)(buf + (_x)*4 + (_y)*pitch) & 0xff;
|
d = *(GLuint *)(buf + (_x)*4 + (_y)*depth_pitch) & 0xff;
|
||||||
|
|
||||||
#define TAG(x) via##x##_24_8
|
#define TAG(x) via##x##_24_8
|
||||||
#include "stenciltmp.h"
|
#include "stenciltmp.h"
|
||||||
|
@ -230,23 +210,16 @@ static void viaSetBuffer(GLcontext *ctx, GLframebuffer *colorBuffer,
|
||||||
GLuint bufferBit)
|
GLuint bufferBit)
|
||||||
{
|
{
|
||||||
viaContextPtr vmesa = VIA_CONTEXT(ctx);
|
viaContextPtr vmesa = VIA_CONTEXT(ctx);
|
||||||
if (VIA_DEBUG) fprintf(stderr, "%s in\n", __FUNCTION__);
|
|
||||||
if (bufferBit == DD_FRONT_LEFT_BIT) {
|
if (bufferBit == DD_FRONT_LEFT_BIT) {
|
||||||
vmesa->drawMap = (char *)vmesa->driScreen->pFB;
|
vmesa->drawBuffer = vmesa->readBuffer = &vmesa->front;
|
||||||
vmesa->readMap = (char *)vmesa->driScreen->pFB;
|
|
||||||
vmesa->drawPitch = vmesa->front.pitch;
|
|
||||||
vmesa->readPitch = vmesa->front.pitch;
|
|
||||||
}
|
}
|
||||||
else if (bufferBit == DD_BACK_LEFT_BIT) {
|
else if (bufferBit == DD_BACK_LEFT_BIT) {
|
||||||
vmesa->drawMap = vmesa->back.map;
|
vmesa->drawBuffer = vmesa->readBuffer = &vmesa->back;
|
||||||
vmesa->readMap = vmesa->back.map;
|
|
||||||
vmesa->drawPitch = vmesa->back.pitch;
|
|
||||||
vmesa->readPitch = vmesa->back.pitch;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ASSERT(0);
|
ASSERT(0);
|
||||||
}
|
}
|
||||||
if (VIA_DEBUG) fprintf(stderr, "%s out\n", __FUNCTION__);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Move locking out to get reasonable span performance.
|
/* Move locking out to get reasonable span performance.
|
||||||
|
@ -256,7 +229,7 @@ void viaSpanRenderStart( GLcontext *ctx )
|
||||||
viaContextPtr vmesa = VIA_CONTEXT(ctx);
|
viaContextPtr vmesa = VIA_CONTEXT(ctx);
|
||||||
VIA_FINISH_PRIM(vmesa);
|
VIA_FINISH_PRIM(vmesa);
|
||||||
LOCK_HARDWARE(vmesa);
|
LOCK_HARDWARE(vmesa);
|
||||||
viaFlushPrimsLocked(vmesa);
|
viaFlushDmaLocked(vmesa, 0);
|
||||||
WAIT_IDLE(vmesa);
|
WAIT_IDLE(vmesa);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -642,21 +642,13 @@ static void viaDrawBuffer(GLcontext *ctx, GLenum mode)
|
||||||
if (VIA_DEBUG) fprintf(stderr, "%s in\n", __FUNCTION__);
|
if (VIA_DEBUG) fprintf(stderr, "%s in\n", __FUNCTION__);
|
||||||
if (mode == GL_FRONT) {
|
if (mode == GL_FRONT) {
|
||||||
VIA_FLUSH_DMA(vmesa);
|
VIA_FLUSH_DMA(vmesa);
|
||||||
vmesa->drawMap = (char *)vmesa->driScreen->pFB;
|
vmesa->drawBuffer = vmesa->readBuffer = &vmesa->front;
|
||||||
vmesa->readMap = (char *)vmesa->driScreen->pFB;
|
|
||||||
vmesa->drawPitch = vmesa->front.pitch;
|
|
||||||
vmesa->readPitch = vmesa->front.pitch;
|
|
||||||
viaXMesaSetFrontClipRects(vmesa);
|
|
||||||
FALLBACK(vmesa, VIA_FALLBACK_DRAW_BUFFER, GL_FALSE);
|
FALLBACK(vmesa, VIA_FALLBACK_DRAW_BUFFER, GL_FALSE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (mode == GL_BACK) {
|
else if (mode == GL_BACK) {
|
||||||
VIA_FLUSH_DMA(vmesa);
|
VIA_FLUSH_DMA(vmesa);
|
||||||
vmesa->drawMap = vmesa->back.map;
|
vmesa->drawBuffer = vmesa->readBuffer = &vmesa->back;
|
||||||
vmesa->readMap = vmesa->back.map;
|
|
||||||
vmesa->drawPitch = vmesa->back.pitch;
|
|
||||||
vmesa->readPitch = vmesa->back.pitch;
|
|
||||||
viaXMesaSetBackClipRects(vmesa);
|
|
||||||
FALLBACK(vmesa, VIA_FALLBACK_DRAW_BUFFER, GL_FALSE);
|
FALLBACK(vmesa, VIA_FALLBACK_DRAW_BUFFER, GL_FALSE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -665,6 +657,8 @@ static void viaDrawBuffer(GLcontext *ctx, GLenum mode)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
viaXMesaWindowMoved(vmesa);
|
||||||
|
|
||||||
/* We want to update the s/w rast state too so that r200SetBuffer()
|
/* We want to update the s/w rast state too so that r200SetBuffer()
|
||||||
* gets called.
|
* gets called.
|
||||||
*/
|
*/
|
||||||
|
@ -693,6 +687,10 @@ static void viaClearColor(GLcontext *ctx, const GLfloat color[4])
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/* Using drawXoff like this is incorrect outside of locked regions.
|
||||||
|
* This hardware just isn't capable of private back buffers without
|
||||||
|
* glitches and/or a hefty locking scheme.
|
||||||
|
*/
|
||||||
void viaCalcViewport(GLcontext *ctx)
|
void viaCalcViewport(GLcontext *ctx)
|
||||||
{
|
{
|
||||||
viaContextPtr vmesa = VIA_CONTEXT(ctx);
|
viaContextPtr vmesa = VIA_CONTEXT(ctx);
|
||||||
|
@ -1550,6 +1548,8 @@ void viaValidateState( GLcontext *ctx )
|
||||||
viaChooseStencilState(ctx);
|
viaChooseStencilState(ctx);
|
||||||
|
|
||||||
if (!vmesa->Fallback) {
|
if (!vmesa->Fallback) {
|
||||||
|
viaChooseVertexState(ctx);
|
||||||
|
viaChooseRenderState(ctx);
|
||||||
via_emit_state(vmesa);
|
via_emit_state(vmesa);
|
||||||
vmesa->newState = 0;
|
vmesa->newState = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -555,7 +555,7 @@ static void viaFastRenderClippedPoly(GLcontext *ctx, const GLuint *elts,
|
||||||
#define ANY_FALLBACK_FLAGS (POINT_FALLBACK|LINE_FALLBACK|TRI_FALLBACK)
|
#define ANY_FALLBACK_FLAGS (POINT_FALLBACK|LINE_FALLBACK|TRI_FALLBACK)
|
||||||
#define ANY_RASTER_FLAGS (DD_TRI_LIGHT_TWOSIDE|DD_TRI_OFFSET|DD_TRI_UNFILLED)
|
#define ANY_RASTER_FLAGS (DD_TRI_LIGHT_TWOSIDE|DD_TRI_OFFSET|DD_TRI_UNFILLED)
|
||||||
|
|
||||||
static void viaChooseRenderState(GLcontext *ctx)
|
void viaChooseRenderState(GLcontext *ctx)
|
||||||
{
|
{
|
||||||
TNLcontext *tnl = TNL_CONTEXT(ctx);
|
TNLcontext *tnl = TNL_CONTEXT(ctx);
|
||||||
viaContextPtr vmesa = VIA_CONTEXT(ctx);
|
viaContextPtr vmesa = VIA_CONTEXT(ctx);
|
||||||
|
@ -633,11 +633,6 @@ static void viaRunPipeline(GLcontext *ctx)
|
||||||
|
|
||||||
if (vmesa->newState) {
|
if (vmesa->newState) {
|
||||||
viaValidateState( ctx );
|
viaValidateState( ctx );
|
||||||
|
|
||||||
if (!vmesa->Fallback) {
|
|
||||||
viaChooseVertexState(ctx);
|
|
||||||
viaChooseRenderState(ctx);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_tnl_run_pipeline(ctx);
|
_tnl_run_pipeline(ctx);
|
||||||
|
@ -677,8 +672,7 @@ void viaRasterPrimitive(GLcontext *ctx,
|
||||||
_mesa_lookup_enum_by_nr(hwprim));
|
_mesa_lookup_enum_by_nr(hwprim));
|
||||||
|
|
||||||
VIA_FINISH_PRIM(vmesa);
|
VIA_FINISH_PRIM(vmesa);
|
||||||
|
viaCheckDma( vmesa, 1024 ); /* Ensure no wrapping inside this function */
|
||||||
vmesa->renderPrimitive = glprim;
|
|
||||||
|
|
||||||
regCmdB = vmesa->regCmdB;
|
regCmdB = vmesa->regCmdB;
|
||||||
|
|
||||||
|
@ -738,7 +732,24 @@ void viaRasterPrimitive(GLcontext *ctx,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert((vmesa->dmaLow & 0x4) == 0);
|
/* assert((vmesa->dmaLow & 0x4) == 0); */
|
||||||
|
|
||||||
|
if (vmesa->dmaCliprectAddr == 0) {
|
||||||
|
if (VIA_DEBUG) fprintf(stderr, "reserve cliprect space at %x\n", vmesa->dmaLow);
|
||||||
|
assert(vmesa->dmaLow);
|
||||||
|
vmesa->dmaCliprectAddr = vmesa->dmaLow;
|
||||||
|
BEGIN_RING(8);
|
||||||
|
OUT_RING( HC_HEADER2 );
|
||||||
|
OUT_RING( (HC_ParaType_NotTex << 16) );
|
||||||
|
OUT_RING( 0xCCCCCCCC );
|
||||||
|
OUT_RING( 0xCCCCCCCC );
|
||||||
|
OUT_RING( 0xCCCCCCCC );
|
||||||
|
OUT_RING( 0xCCCCCCCC );
|
||||||
|
OUT_RING( 0xCCCCCCCC );
|
||||||
|
OUT_RING( 0xCCCCCCCC );
|
||||||
|
ADVANCE_RING();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
BEGIN_RING(8);
|
BEGIN_RING(8);
|
||||||
OUT_RING( HC_HEADER2 );
|
OUT_RING( HC_HEADER2 );
|
||||||
|
@ -752,8 +763,10 @@ void viaRasterPrimitive(GLcontext *ctx,
|
||||||
OUT_RING( vmesa->regCmdA_End );
|
OUT_RING( vmesa->regCmdA_End );
|
||||||
ADVANCE_RING();
|
ADVANCE_RING();
|
||||||
|
|
||||||
vmesa->dmaLastPrim = vmesa->dmaLow;
|
|
||||||
|
vmesa->renderPrimitive = glprim;
|
||||||
vmesa->hwPrimitive = hwprim;
|
vmesa->hwPrimitive = hwprim;
|
||||||
|
vmesa->dmaLastPrim = vmesa->dmaLow;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Callback for mesa:
|
/* Callback for mesa:
|
||||||
|
@ -766,6 +779,8 @@ static void viaRenderPrimitive( GLcontext *ctx, GLuint prim )
|
||||||
|
|
||||||
void viaFinishPrimitive(viaContextPtr vmesa)
|
void viaFinishPrimitive(viaContextPtr vmesa)
|
||||||
{
|
{
|
||||||
|
if (VIA_DEBUG) fprintf(stderr, "%s\n", __FUNCTION__);
|
||||||
|
|
||||||
if (!vmesa->dmaLastPrim) {
|
if (!vmesa->dmaLastPrim) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -788,13 +803,21 @@ void viaFinishPrimitive(viaContextPtr vmesa)
|
||||||
}
|
}
|
||||||
vmesa->dmaLastPrim = 0;
|
vmesa->dmaLastPrim = 0;
|
||||||
|
|
||||||
if (1 || vmesa->dmaLow > VIA_DMA_HIGHWATER)
|
if (vmesa->dmaLow > VIA_DMA_HIGHWATER)
|
||||||
viaFlushPrims( vmesa );
|
viaFlushDma( vmesa );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
assert(vmesa->dmaLow >= (32 + DMA_OFFSET));
|
/* Remove the primitive header:
|
||||||
vmesa->dmaLow -= 32;
|
*/
|
||||||
vmesa->dmaLastPrim = 0;
|
vmesa->dmaLastPrim = 0;
|
||||||
|
vmesa->dmaLow -= 8 * sizeof(GLuint);
|
||||||
|
|
||||||
|
/* Maybe remove the cliprect as well:
|
||||||
|
*/
|
||||||
|
if (vmesa->dmaCliprectAddr == vmesa->dmaLow - 8 * sizeof(GLuint)) {
|
||||||
|
vmesa->dmaLow -= 8 * sizeof(GLuint);
|
||||||
|
vmesa->dmaCliprectAddr = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -86,9 +86,11 @@ static struct {
|
||||||
#define HAVE_TEX3_VERTICES 0
|
#define HAVE_TEX3_VERTICES 0
|
||||||
#define HAVE_PTEX_VERTICES 0
|
#define HAVE_PTEX_VERTICES 0
|
||||||
|
|
||||||
#define UNVIEWPORT_VARS GLfloat h = VIA_CONTEXT(ctx)->driDrawable->h, \
|
#define UNVIEWPORT_VARS \
|
||||||
depth_max = VIA_CONTEXT(ctx)->depth_max;
|
viaContextPtr vmesa = VIA_CONTEXT(ctx); \
|
||||||
#define UNVIEWPORT_X(x) x - SUBPIXEL_X
|
GLfloat h = vmesa->driDrawable->h, depth_max = vmesa->depth_max, xoff = vmesa->drawXoff;
|
||||||
|
|
||||||
|
#define UNVIEWPORT_X(x) x - (SUBPIXEL_X + xoff)
|
||||||
#define UNVIEWPORT_Y(y) - y + h + SUBPIXEL_Y
|
#define UNVIEWPORT_Y(y) - y + h + SUBPIXEL_Y
|
||||||
#define UNVIEWPORT_Z(z) z * (float)depth_max
|
#define UNVIEWPORT_Z(z) z * (float)depth_max
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue