X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Fmesa%2Fdrivers%2Fdri%2Funichrome%2Fvia_ioctl.c;h=116adda18ea2d74168acd2461a2199cefc3f89a7;hb=0b77d57394a3712851ec271aa7ad353d56f302a1;hp=dd2e93b286f8e3db72351d35ad1958b488d21441;hpb=a5676795cfe2e24979b5da65c2f499049ab009d9;p=mesa.git diff --git a/src/mesa/drivers/dri/unichrome/via_ioctl.c b/src/mesa/drivers/dri/unichrome/via_ioctl.c index dd2e93b286f..116adda18ea 100644 --- a/src/mesa/drivers/dri/unichrome/via_ioctl.c +++ b/src/mesa/drivers/dri/unichrome/via_ioctl.c @@ -24,17 +24,16 @@ #include #include -#include "glheader.h" -#include "mtypes.h" -#include "macros.h" -#include "dd.h" +#include "main/glheader.h" +#include "main/mtypes.h" +#include "main/macros.h" +#include "main/dd.h" #include "swrast/swrast.h" -#include "mm.h" +#include "main/mm.h" #include "via_context.h" #include "via_tris.h" #include "via_ioctl.h" -#include "via_state.h" #include "via_fb.h" #include "via_3d_reg.h" @@ -182,12 +181,12 @@ static void viaFillBuffer(struct via_context *vmesa, GLuint i; for (i = 0; i < nboxes ; i++) { - int x = pbox[i].x1 - vmesa->drawX; - int y = pbox[i].y1 - vmesa->drawY; + int x = pbox[i].x1 - buffer->drawX; + int y = pbox[i].y1 - buffer->drawY; int w = pbox[i].x2 - pbox[i].x1; int h = pbox[i].y2 - pbox[i].y1; - int offset = (buffer->orig + + int offset = (buffer->offset + y * buffer->pitch + x * bytePerPixel); @@ -202,10 +201,12 @@ static void viaFillBuffer(struct via_context *vmesa, -static void viaClear(GLcontext *ctx, GLbitfield mask) +static void viaClear(struct gl_context *ctx, GLbitfield mask) { struct via_context *vmesa = VIA_CONTEXT(ctx); - __DRIdrawablePrivate *dPriv = vmesa->driDrawable; + __DRIdrawable *dPriv = vmesa->driDrawable; + struct via_renderbuffer *const vrb = + (struct via_renderbuffer *) dPriv->driverPrivate; int flag = 0; GLuint i = 0; GLuint clear_depth_mask = 0xf << 28; @@ -274,8 +275,8 @@ static void viaClear(GLcontext *ctx, GLbitfield mask) /* flip top to bottom */ cy = dPriv->h - cy - ch; - cx += vmesa->drawX + vmesa->drawXoff; - cy += vmesa->drawY; + cx += vrb->drawX; + cy += vrb->drawY; if (!all) { drm_clip_rect_t *b = vmesa->pClipRects; @@ -352,13 +353,13 @@ static void viaDoSwapBuffers(struct via_context *vmesa, GLuint i; for (i = 0; i < nbox; i++, b++) { - GLint x = b->x1 - vmesa->drawX; - GLint y = b->y1 - vmesa->drawY; + GLint x = b->x1 - back->drawX; + GLint y = b->y1 - back->drawY; GLint w = b->x2 - b->x1; GLint h = b->y2 - b->y1; - GLuint src = back->orig + y * back->pitch + x * bytePerPixel; - GLuint dest = front->orig + y * front->pitch + x * bytePerPixel; + GLuint src = back->offset + y * back->pitch + x * bytePerPixel; + GLuint dest = front->offset + y * front->pitch + x * bytePerPixel; viaBlit(vmesa, bytePerPixel << 3, @@ -505,11 +506,12 @@ void viaWaitIdleLocked( struct via_context *vmesa, GLboolean light ) * except that WAIT_IDLE() will spin the CPU polling, while this is * IRQ driven. */ -static void viaWaitIdleVBlank( const __DRIdrawablePrivate *dPriv, +static void viaWaitIdleVBlank( __DRIdrawable *dPriv, struct via_context *vmesa, GLuint value ) { GLboolean missed_target; + __DRIscreen *psp = dPriv->driScreenPriv; VIA_FLUSH_DMA(vmesa); @@ -521,11 +523,10 @@ static void viaWaitIdleVBlank( const __DRIdrawablePrivate *dPriv, vmesa->thrashing) viaSwapOutWork(vmesa); - driWaitForVBlank( dPriv, & vmesa->vbl_seq, - vmesa->vblank_flags, & missed_target ); + driWaitForVBlank( dPriv, & missed_target ); if ( missed_target ) { vmesa->swap_missed_count++; - (*dri_interface->getUST)( &vmesa->swap_missed_ust ); + (*psp->systemTime->getUST)( &vmesa->swap_missed_ust ); } } while (!viaCheckBreadcrumb(vmesa, value)); @@ -589,10 +590,11 @@ void viaResetPageFlippingLocked(struct via_context *vmesa) /* * Copy the back buffer to the front buffer. */ -void viaCopyBuffer(const __DRIdrawablePrivate *dPriv) +void viaCopyBuffer(__DRIdrawable *dPriv) { struct via_context *vmesa = (struct via_context *)dPriv->driContextPriv->driverPrivate; + __DRIscreen *psp = dPriv->driScreenPriv; if (VIA_DEBUG & DEBUG_IOCTL) fprintf(stderr, @@ -605,7 +607,7 @@ void viaCopyBuffer(const __DRIdrawablePrivate *dPriv) VIA_FLUSH_DMA(vmesa); - if (vmesa->vblank_flags == VBLANK_FLAG_SYNC && + if (dPriv->vblFlags == VBLANK_FLAG_SYNC && vmesa->lastBreadcrumbWrite > 1) viaWaitIdleVBlank(dPriv, vmesa, vmesa->lastBreadcrumbWrite-1); else @@ -628,18 +630,19 @@ void viaCopyBuffer(const __DRIdrawablePrivate *dPriv) viaEmitBreadcrumbLocked(vmesa); UNLOCK_HARDWARE(vmesa); - (*dri_interface->getUST)( &vmesa->swap_ust ); + (*psp->systemTime->getUST)( &vmesa->swap_ust ); } -void viaPageFlip(const __DRIdrawablePrivate *dPriv) +void viaPageFlip(__DRIdrawable *dPriv) { struct via_context *vmesa = (struct via_context *)dPriv->driContextPriv->driverPrivate; struct via_renderbuffer buffer_tmp; + __DRIscreen *psp = dPriv->driScreenPriv; VIA_FLUSH_DMA(vmesa); - if (vmesa->vblank_flags == VBLANK_FLAG_SYNC && + if (dPriv->vblFlags == VBLANK_FLAG_SYNC && vmesa->lastBreadcrumbWrite > 1) viaWaitIdleVBlank(dPriv, vmesa, vmesa->lastBreadcrumbWrite - 1); else @@ -652,7 +655,7 @@ void viaPageFlip(const __DRIdrawablePrivate *dPriv) viaEmitBreadcrumbLocked(vmesa); UNLOCK_HARDWARE(vmesa); - (*dri_interface->getUST)( &vmesa->swap_ust ); + (*psp->systemTime->getUST)( &vmesa->swap_ust ); /* KW: FIXME: When buffers are freed, could free frontbuffer by @@ -745,7 +748,7 @@ static void via_emit_cliprect(struct via_context *vmesa, : HC_HDBFM_RGB565); GLuint pitch = buffer->pitch; - GLuint offset = buffer->orig; + GLuint offset = buffer->offset; if (0) fprintf(stderr, "emit cliprect for box %d,%d %d,%d\n", @@ -754,6 +757,8 @@ static void via_emit_cliprect(struct via_context *vmesa, vb[0] = HC_HEADER2; vb[1] = (HC_ParaType_NotTex << 16); + assert(vmesa->driDrawable); + if (vmesa->driDrawable->w == 0 || vmesa->driDrawable->h == 0) { vb[2] = (HC_SubA_HClipTB << 24) | 0x0; vb[3] = (HC_SubA_HClipLR << 24) | 0x0; @@ -766,7 +771,7 @@ static void via_emit_cliprect(struct via_context *vmesa, vb[4] = (HC_SubA_HDBBasL << 24) | (offset & 0xFFFFFF); vb[5] = (HC_SubA_HDBBasH << 24) | ((offset & 0xFF000000) >> 24); - vb[6] = (HC_SubA_HSPXYOS << 24) | ((31-vmesa->drawXoff) << HC_HSPXOS_SHIFT); + vb[6] = (HC_SubA_HSPXYOS << 24); vb[7] = (HC_SubA_HDBFM << 24) | HC_HDBLoc_Local | format | pitch; } @@ -881,22 +886,19 @@ void viaFlushDmaLocked(struct via_context *vmesa, GLuint flags) } else if (vmesa->numClipRects) { drm_clip_rect_t *pbox = vmesa->pClipRects; - + for (i = 0; i < vmesa->numClipRects; i++) { drm_clip_rect_t b; - b.x1 = pbox[i].x1 - (vmesa->drawX + vmesa->drawXoff); - b.x2 = pbox[i].x2 - (vmesa->drawX + vmesa->drawXoff); - b.y1 = pbox[i].y1 - vmesa->drawY; - b.y2 = pbox[i].y2 - vmesa->drawY; + b.x1 = pbox[i].x1; + b.x2 = pbox[i].x2; + b.y1 = pbox[i].y1; + b.y2 = pbox[i].y2; if (vmesa->scissor && !intersect_rect(&b, &b, &vmesa->scissorRect)) continue; - b.x1 += vmesa->drawXoff; - b.x2 += vmesa->drawXoff; - via_emit_cliprect(vmesa, &b); if (fire_buffer(vmesa) != 0) { @@ -949,25 +951,25 @@ void viaFlushDma(struct via_context *vmesa) } } -static void viaFlush(GLcontext *ctx) +static void viaFlush(struct gl_context *ctx) { struct via_context *vmesa = VIA_CONTEXT(ctx); VIA_FLUSH_DMA(vmesa); } -static void viaFinish(GLcontext *ctx) +static void viaFinish(struct gl_context *ctx) { struct via_context *vmesa = VIA_CONTEXT(ctx); VIA_FLUSH_DMA(vmesa); viaWaitIdle(vmesa, GL_FALSE); } -static void viaClearStencil(GLcontext *ctx, int s) +static void viaClearStencil(struct gl_context *ctx, int s) { return; } -void viaInitIoctlFuncs(GLcontext *ctx) +void viaInitIoctlFuncs(struct gl_context *ctx) { ctx->Driver.Flush = viaFlush; ctx->Driver.Clear = viaClear;