2 * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
3 * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sub license,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice (including the
13 * next paragraph) shall be included in all copies or substantial portions
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
19 * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
28 * \author John Sheng (presumably of either VIA Technologies or S3 Graphics)
29 * \author Others at VIA Technologies?
30 * \author Others at S3 Graphics?
36 #include "simple_list.h"
37 #include "extensions.h"
39 #include "swrast/swrast.h"
40 #include "swrast_setup/swrast_setup.h"
42 #include "array_cache/acache.h"
44 #include "tnl/t_pipeline.h"
46 #include "drivers/common/driverfuncs.h"
48 #include "via_screen.h"
51 #include "via_state.h"
56 #include "via_ioctl.h"
63 #define DRIVER_DATE "20041215"
74 * Return various strings for \c glGetString.
78 static const GLubyte
*viaGetString(GLcontext
*ctx
, GLenum name
)
80 static char buffer
[128];
86 return (GLubyte
*)"VIA Technology";
89 static const char * const chipset_names
[] = {
91 "CastleRock (CLE266)",
94 "UniChrome (PM8x0/CN400)",
96 const viaContext
* const via
= VIA_CONTEXT(ctx
);
97 const unsigned id
= via
->viaScreen
->deviceID
;
99 offset
= driGetRendererString( buffer
,
100 chipset_names
[(id
> VIA_PM800
) ? 0 : id
],
102 return (GLubyte
*)buffer
;
112 * Calculate a width that satisfies the hardware's alignment requirements.
113 * On the Unichrome hardware, each scanline must be aligned to a multiple of
116 * \param width Minimum buffer width, in pixels.
118 * \returns A pixel width that meets the alignment requirements.
120 static __inline__
unsigned
121 buffer_align( unsigned width
)
123 return (width
+ 0x0f) & ~0x0f;
128 * Calculate the framebuffer parameters for all buffers (front, back, depth,
129 * and stencil) associated with the specified context.
132 * This function also calls \c AllocateBuffer to actually allocate the
138 calculate_buffer_parameters( viaContextPtr vmesa
)
140 const unsigned shift
= vmesa
->viaScreen
->bitsPerPixel
/ 16;
141 const unsigned extra
= 32;
145 /* Allocate front-buffer */
146 if (vmesa
->drawType
== GLX_PBUFFER_BIT
) {
147 w
= vmesa
->driDrawable
->w
;
148 h
= vmesa
->driDrawable
->h
;
150 vmesa
->front
.bpp
= vmesa
->viaScreen
->bitsPerPixel
;
151 vmesa
->front
.pitch
= buffer_align( w
) << shift
;
152 vmesa
->front
.size
= vmesa
->front
.pitch
* h
;
154 if (vmesa
->front
.map
)
155 via_free_draw_buffer(vmesa
, &vmesa
->front
);
156 if (!via_alloc_draw_buffer(vmesa
, &vmesa
->front
))
161 w
= vmesa
->viaScreen
->width
;
162 h
= vmesa
->viaScreen
->height
;
164 vmesa
->front
.bpp
= vmesa
->viaScreen
->bitsPerPixel
;
165 vmesa
->front
.pitch
= buffer_align( w
) << shift
;
166 vmesa
->front
.size
= vmesa
->front
.pitch
* h
;
167 vmesa
->front
.offset
= 0;
168 vmesa
->front
.map
= (char *) vmesa
->driScreen
->pFB
;
172 /* Allocate back-buffer */
173 if (vmesa
->hasBack
) {
174 vmesa
->back
.bpp
= vmesa
->viaScreen
->bitsPerPixel
;
175 vmesa
->back
.pitch
= (buffer_align( vmesa
->driDrawable
->w
) << shift
) + extra
;
176 vmesa
->back
.size
= vmesa
->back
.pitch
* vmesa
->driDrawable
->h
;
178 via_free_draw_buffer(vmesa
, &vmesa
->back
);
179 if (!via_alloc_draw_buffer(vmesa
, &vmesa
->back
))
183 /* KW: mem leak if vmesa->hasBack ever changes:
185 (void) memset( &vmesa
->back
, 0, sizeof( vmesa
->back
) );
189 /* Allocate depth-buffer */
190 if ( vmesa
->hasStencil
|| vmesa
->hasDepth
) {
191 vmesa
->depth
.bpp
= vmesa
->depthBits
;
192 if (vmesa
->depth
.bpp
== 24)
193 vmesa
->depth
.bpp
= 32;
195 vmesa
->depth
.pitch
= (buffer_align( vmesa
->driDrawable
->w
) * (vmesa
->depth
.bpp
/8)) + extra
;
196 vmesa
->depth
.size
= vmesa
->depth
.pitch
* vmesa
->driDrawable
->h
;
198 if (vmesa
->depth
.map
)
199 via_free_draw_buffer(vmesa
, &vmesa
->depth
);
200 if (!via_alloc_draw_buffer(vmesa
, &vmesa
->depth
)) {
205 /* KW: mem leak if vmesa->hasStencil/hasDepth ever changes:
207 (void) memset( & vmesa
->depth
, 0, sizeof( vmesa
->depth
) );
210 /*=* John Sheng [2003.5.31] flip *=*/
211 if( vmesa
->viaScreen
->width
== vmesa
->driDrawable
->w
&&
212 vmesa
->viaScreen
->height
== vmesa
->driDrawable
->h
) {
213 #define ALLOW_EXPERIMENTAL_PAGEFLIP 0
214 #if ALLOW_EXPERIMENTAL_PAGEFLIP
215 vmesa
->doPageFlip
= GL_TRUE
;
217 vmesa
->doPageFlip
= GL_FALSE
;
219 /* vmesa->currentPage = 0; */
220 assert(vmesa
->back
.pitch
== vmesa
->front
.pitch
);
223 vmesa
->doPageFlip
= GL_FALSE
;
229 void viaReAllocateBuffers(GLframebuffer
*drawbuffer
)
231 GET_CURRENT_CONTEXT(ctx
);
232 viaContextPtr vmesa
= VIA_CONTEXT(ctx
);
234 _swrast_alloc_buffers( drawbuffer
);
235 calculate_buffer_parameters( vmesa
);
238 static void viaBufferSize(GLframebuffer
*buffer
, GLuint
*width
, GLuint
*height
)
240 GET_CURRENT_CONTEXT(ctx
);
241 viaContextPtr vmesa
= VIA_CONTEXT(ctx
);
242 *width
= vmesa
->driDrawable
->w
;
243 *height
= vmesa
->driDrawable
->h
;
246 /* Extension strings exported by the Unichrome driver.
248 static const char * const card_extensions
[] =
250 "GL_ARB_multitexture",
251 "GL_ARB_point_parameters",
252 "GL_ARB_texture_env_add",
253 "GL_ARB_texture_env_combine",
254 "GL_ARB_texture_env_dot3",
255 "GL_ARB_texture_mirrored_repeat",
256 "GL_EXT_stencil_wrap",
257 "GL_EXT_texture_env_combine",
258 "GL_EXT_texture_env_dot3",
259 "GL_EXT_texture_lod_bias",
260 "GL_NV_blend_square",
264 extern const struct tnl_pipeline_stage _via_fastrender_stage
;
265 extern const struct tnl_pipeline_stage _via_render_stage
;
267 static const struct tnl_pipeline_stage
*via_pipeline
[] = {
268 &_tnl_vertex_transform_stage
,
269 &_tnl_normal_transform_stage
,
270 &_tnl_lighting_stage
,
271 &_tnl_fog_coordinate_stage
,
273 &_tnl_texture_transform_stage
,
274 /* REMOVE: point attenuation stage */
275 &_via_fastrender_stage
, /* ADD: unclipped rastersetup-to-dma */
282 AllocateDmaBuffer(const GLvisual
*visual
, viaContextPtr vmesa
)
285 via_free_dma_buffer(vmesa
);
287 if (!via_alloc_dma_buffer(vmesa
))
291 vmesa
->dmaCliprectAddr
= 0;
296 FreeBuffer(viaContextPtr vmesa
)
298 if (vmesa
->front
.map
)
299 via_free_draw_buffer(vmesa
, &vmesa
->front
);
302 via_free_draw_buffer(vmesa
, &vmesa
->back
);
304 if (vmesa
->depth
.map
)
305 via_free_draw_buffer(vmesa
, &vmesa
->depth
);
308 via_free_dma_buffer(vmesa
);
312 get_ust_nop( int64_t * ust
)
319 viaCreateContext(const __GLcontextModes
*mesaVis
,
320 __DRIcontextPrivate
*driContextPriv
,
321 void *sharedContextPrivate
)
323 GLcontext
*ctx
, *shareCtx
;
325 __DRIscreenPrivate
*sPriv
= driContextPriv
->driScreenPriv
;
326 viaScreenPrivate
*viaScreen
= (viaScreenPrivate
*)sPriv
->private;
327 drm_via_sarea_t
*saPriv
= (drm_via_sarea_t
*)
328 (((GLubyte
*)sPriv
->pSAREA
) + viaScreen
->sareaPrivOffset
);
329 struct dd_function_table functions
;
331 /* Allocate via context */
332 vmesa
= (viaContextPtr
) CALLOC_STRUCT(via_context_t
);
336 if (VIA_DEBUG
) fprintf(stderr
, "%s - in\n", __FUNCTION__
);
338 /* Parse configuration files.
340 driParseConfigFiles (&vmesa
->optionCache
, &viaScreen
->optionCache
,
341 sPriv
->myNum
, "via");
343 /* pick back buffer */
344 vmesa
->hasBack
= mesaVis
->doubleBufferMode
;
346 switch(mesaVis
->depthBits
) {
348 vmesa
->hasDepth
= GL_FALSE
;
349 vmesa
->depthBits
= 0;
350 vmesa
->depth_max
= 1.0;
353 vmesa
->hasDepth
= GL_TRUE
;
354 vmesa
->depthBits
= mesaVis
->depthBits
;
355 vmesa
->have_hw_stencil
= GL_FALSE
;
356 vmesa
->depth_max
= (GLfloat
)0xffff;
357 vmesa
->depth_clear_mask
= 0xf << 28;
358 vmesa
->ClearDepth
= 0xffff;
361 vmesa
->hasDepth
= GL_TRUE
;
362 vmesa
->depthBits
= mesaVis
->depthBits
;
363 vmesa
->depth_max
= (GLfloat
) 0xffffff;
364 vmesa
->depth_clear_mask
= 0xe << 28;
365 vmesa
->ClearDepth
= 0xffffff00;
367 assert(mesaVis
->haveStencilBuffer
);
368 assert(mesaVis
->stencilBits
== 8);
370 vmesa
->have_hw_stencil
= GL_TRUE
;
371 vmesa
->stencilBits
= mesaVis
->stencilBits
;
372 vmesa
->stencil_clear_mask
= 0x1 << 28;
375 vmesa
->hasDepth
= GL_TRUE
;
376 vmesa
->depthBits
= mesaVis
->depthBits
;
377 assert(!mesaVis
->haveStencilBuffer
);
378 vmesa
->have_hw_stencil
= GL_FALSE
;
379 vmesa
->depth_max
= (GLfloat
)0xffffffff;
380 vmesa
->depth_clear_mask
= 0;
381 vmesa
->ClearDepth
= 0xffffffff;
382 vmesa
->depth_clear_mask
= 0xf << 28;
390 _mesa_init_driver_functions(&functions
);
391 viaInitTextureFuncs(&functions
);
393 /* Allocate the Mesa context */
394 if (sharedContextPrivate
)
395 shareCtx
= ((viaContextPtr
) sharedContextPrivate
)->glCtx
;
399 vmesa
->glCtx
= _mesa_create_context(mesaVis
, shareCtx
, &functions
, (void*) vmesa
);
401 vmesa
->shareCtx
= shareCtx
;
407 driContextPriv
->driverPrivate
= vmesa
;
411 ctx
->Const
.MaxTextureLevels
= 10;
412 ctx
->Const
.MaxTextureUnits
= 2;
413 ctx
->Const
.MaxTextureImageUnits
= ctx
->Const
.MaxTextureUnits
;
414 ctx
->Const
.MaxTextureCoordUnits
= ctx
->Const
.MaxTextureUnits
;
416 ctx
->Const
.MinLineWidth
= 1.0;
417 ctx
->Const
.MinLineWidthAA
= 1.0;
418 ctx
->Const
.MaxLineWidth
= 1.0;
419 ctx
->Const
.MaxLineWidthAA
= 1.0;
420 ctx
->Const
.LineWidthGranularity
= 1.0;
422 ctx
->Const
.MinPointSize
= 1.0;
423 ctx
->Const
.MinPointSizeAA
= 1.0;
424 ctx
->Const
.MaxPointSize
= 1.0;
425 ctx
->Const
.MaxPointSizeAA
= 1.0;
426 ctx
->Const
.PointSizeGranularity
= 1.0;
428 ctx
->Driver
.GetBufferSize
= viaBufferSize
;
429 /* ctx->Driver.ResizeBuffers = _swrast_alloc_buffers; *//* FIXME ?? */
430 ctx
->Driver
.GetString
= viaGetString
;
432 ctx
->DriverCtx
= (void *)vmesa
;
435 /* Initialize the software rasterizer and helper modules.
437 _swrast_CreateContext(ctx
);
438 _ac_CreateContext(ctx
);
439 _tnl_CreateContext(ctx
);
440 _swsetup_CreateContext(ctx
);
442 /* Install the customized pipeline:
444 _tnl_destroy_pipeline(ctx
);
445 _tnl_install_pipeline(ctx
, via_pipeline
);
447 /* Configure swrast and T&L to match hardware characteristics:
449 _swrast_allow_pixel_fog(ctx
, GL_FALSE
);
450 _swrast_allow_vertex_fog(ctx
, GL_TRUE
);
451 _tnl_allow_pixel_fog(ctx
, GL_FALSE
);
452 _tnl_allow_vertex_fog(ctx
, GL_TRUE
);
454 /* vmesa->display = dpy; */
455 vmesa
->display
= sPriv
->display
;
457 vmesa
->hHWContext
= driContextPriv
->hHWContext
;
458 vmesa
->driFd
= sPriv
->fd
;
459 vmesa
->driHwLock
= &sPriv
->pSAREA
->lock
;
461 vmesa
->viaScreen
= viaScreen
;
462 vmesa
->driScreen
= sPriv
;
463 vmesa
->sarea
= saPriv
;
464 vmesa
->glBuffer
= NULL
;
466 vmesa
->texHeap
= mmInit(0, viaScreen
->textureSize
);
467 vmesa
->renderIndex
= ~0;
469 make_empty_list(&vmesa
->TexObjList
);
470 make_empty_list(&vmesa
->SwappedOut
);
472 vmesa
->CurrentTexObj
[0] = 0;
473 vmesa
->CurrentTexObj
[1] = 0;
475 _math_matrix_ctr(&vmesa
->ViewportMatrix
);
477 /* Do this early, before VIA_FLUSH_DMA can be called:
479 if (!AllocateDmaBuffer(mesaVis
, vmesa
)) {
480 fprintf(stderr
,"AllocateDmaBuffer fail\n");
486 driInitExtensions( ctx
, card_extensions
, GL_TRUE
);
487 viaInitStateFuncs(ctx
);
488 viaInitTextures(ctx
);
489 viaInitTriFuncs(ctx
);
490 viaInitSpanFuncs(ctx
);
491 viaInitIoctlFuncs(ctx
);
496 if (getenv("VIA_DEBUG"))
502 if (getenv("VIA_NO_RAST"))
503 FALLBACK(vmesa
, VIA_FALLBACK_USER_DISABLE
, 1);
507 /* I don't understand why this isn't working:
509 vmesa
->vblank_flags
=
510 vmesa
->viaScreen
->irqEnabled
?
511 driGetDefaultVBlankFlags(&vmesa
->optionCache
) : VBLANK_FLAG_NO_IRQ
;
513 /* Hack this up in its place:
515 vmesa
->vblank_flags
= getenv("VIA_VSYNC") ? VBLANK_FLAG_SYNC
: VBLANK_FLAG_NO_IRQ
;
518 vmesa
->get_ust
= (PFNGLXGETUSTPROC
) glXGetProcAddress( (const GLubyte
*) "__glXGetUST" );
519 if ( vmesa
->get_ust
== NULL
) {
520 vmesa
->get_ust
= get_ust_nop
;
522 vmesa
->get_ust( &vmesa
->swap_ust
);
525 vmesa
->regMMIOBase
= (GLuint
*)((GLuint
)viaScreen
->reg
);
526 vmesa
->pnGEMode
= (GLuint
*)((GLuint
)viaScreen
->reg
+ 0x4);
527 vmesa
->regEngineStatus
= (GLuint
*)((GLuint
)viaScreen
->reg
+ 0x400);
528 vmesa
->regTranSet
= (GLuint
*)((GLuint
)viaScreen
->reg
+ 0x43C);
529 vmesa
->regTranSpace
= (GLuint
*)((GLuint
)viaScreen
->reg
+ 0x440);
530 vmesa
->agpBase
= viaScreen
->agpBase
;
532 fprintf(stderr
, "regEngineStatus = %x\n", *vmesa
->regEngineStatus
);
535 if (VIA_DEBUG
) fprintf(stderr
, "%s - out\n", __FUNCTION__
);
540 viaDestroyContext(__DRIcontextPrivate
*driContextPriv
)
542 viaContextPtr vmesa
= (viaContextPtr
)driContextPriv
->driverPrivate
;
543 if (VIA_DEBUG
) fprintf(stderr
, "%s - in\n", __FUNCTION__
);
544 assert(vmesa
); /* should never be null */
547 /*=* John Sheng [2003.5.31] agp tex *=*/
549 if(VIA_DEBUG
) fprintf(stderr
, "agpFullCount = %d\n", vmesa
->agpFullCount
);
551 _swsetup_DestroyContext(vmesa
->glCtx
);
552 _tnl_DestroyContext(vmesa
->glCtx
);
553 _ac_DestroyContext(vmesa
->glCtx
);
554 _swrast_DestroyContext(vmesa
->glCtx
);
555 viaFreeVB(vmesa
->glCtx
);
557 /* free the Mesa context */
558 _mesa_destroy_context(vmesa
->glCtx
);
559 vmesa
->glCtx
->DriverCtx
= NULL
;
563 if (VIA_DEBUG
) fprintf(stderr
, "%s - out\n", __FUNCTION__
);
567 void viaXMesaWindowMoved(viaContextPtr vmesa
)
569 __DRIdrawablePrivate
*dPriv
= vmesa
->driDrawable
;
570 GLuint bytePerPixel
= vmesa
->viaScreen
->bitsPerPixel
>> 3;
575 switch (vmesa
->glCtx
->Color
._DrawDestMask
[0]) {
576 case DD_FRONT_LEFT_BIT
:
577 if (dPriv
->numBackClipRects
== 0) {
578 vmesa
->numClipRects
= dPriv
->numClipRects
;
579 vmesa
->pClipRects
= dPriv
->pClipRects
;
582 vmesa
->numClipRects
= dPriv
->numBackClipRects
;
583 vmesa
->pClipRects
= dPriv
->pBackClipRects
;
586 case DD_BACK_LEFT_BIT
:
587 vmesa
->numClipRects
= dPriv
->numClipRects
;
588 vmesa
->pClipRects
= dPriv
->pClipRects
;
591 vmesa
->numClipRects
= 0;
595 if (vmesa
->drawW
!= dPriv
->w
||
596 vmesa
->drawH
!= dPriv
->h
)
597 calculate_buffer_parameters( vmesa
);
599 vmesa
->drawXoff
= (GLuint
)(((dPriv
->x
* bytePerPixel
) & 0x1f) / bytePerPixel
);
600 vmesa
->drawX
= dPriv
->x
- vmesa
->drawXoff
;
601 vmesa
->drawY
= dPriv
->y
;
602 vmesa
->drawW
= dPriv
->w
;
603 vmesa
->drawH
= dPriv
->h
;
605 vmesa
->front
.orig
= (vmesa
->front
.offset
+
606 vmesa
->drawY
* vmesa
->front
.pitch
+
607 vmesa
->drawX
* bytePerPixel
);
609 vmesa
->front
.origMap
= (vmesa
->front
.map
+
610 vmesa
->drawY
* vmesa
->front
.pitch
+
611 vmesa
->drawX
* bytePerPixel
);
613 vmesa
->back
.orig
= vmesa
->back
.offset
;
614 vmesa
->depth
.orig
= vmesa
->depth
.offset
;
615 vmesa
->back
.origMap
= vmesa
->back
.map
;
616 vmesa
->depth
.origMap
= vmesa
->depth
.map
;
618 viaCalcViewport(vmesa
->glCtx
);
622 viaUnbindContext(__DRIcontextPrivate
*driContextPriv
)
624 if (VIA_DEBUG
) fprintf(stderr
, "%s - in\n", __FUNCTION__
);
625 if (VIA_DEBUG
) fprintf(stderr
, "%s - out\n", __FUNCTION__
);
630 viaMakeCurrent(__DRIcontextPrivate
*driContextPriv
,
631 __DRIdrawablePrivate
*driDrawPriv
,
632 __DRIdrawablePrivate
*driReadPriv
)
634 if (VIA_DEBUG
) fprintf(stderr
, "%s - in\n", __FUNCTION__
);
637 fprintf(stderr
, "driContextPriv = %08x\n", (GLuint
)driContextPriv
);
638 fprintf(stderr
, "driContextPriv = %08x\n", (GLuint
)driDrawPriv
);
639 fprintf(stderr
, "driContextPriv = %08x\n", (GLuint
)driReadPriv
);
642 if (driContextPriv
) {
643 viaContextPtr vmesa
= (viaContextPtr
)driContextPriv
->driverPrivate
;
644 GLcontext
*ctx
= vmesa
->glCtx
;
646 if (VIA_DEBUG
) fprintf(stderr
, "viaMakeCurrent: w = %d\n", vmesa
->driDrawable
->w
);
648 if ( vmesa
->driDrawable
!= driDrawPriv
) {
649 driDrawableInitVBlank( driDrawPriv
, vmesa
->vblank_flags
);
650 vmesa
->driDrawable
= driDrawPriv
;
651 if ( ! calculate_buffer_parameters( vmesa
) ) {
654 ctx
->Driver
.DrawBuffer( ctx
, ctx
->Color
.DrawBuffer
[0] );
657 _mesa_make_current2(vmesa
->glCtx
,
658 (GLframebuffer
*)driDrawPriv
->driverPrivate
,
659 (GLframebuffer
*)driReadPriv
->driverPrivate
);
660 if (VIA_DEBUG
) fprintf(stderr
, "Context %d MakeCurrent\n", vmesa
->hHWContext
);
661 viaXMesaWindowMoved(vmesa
);
666 _mesa_make_current(0,0);
669 if (VIA_DEBUG
) fprintf(stderr
, "%s - out\n", __FUNCTION__
);
673 void viaGetLock(viaContextPtr vmesa
, GLuint flags
)
675 __DRIdrawablePrivate
*dPriv
= vmesa
->driDrawable
;
676 __DRIscreenPrivate
*sPriv
= vmesa
->driScreen
;
678 drmGetLock(vmesa
->driFd
, vmesa
->hHWContext
, flags
);
680 DRI_VALIDATE_DRAWABLE_INFO( sPriv
, dPriv
);
682 if (vmesa
->sarea
->ctxOwner
!= vmesa
->hHWContext
) {
683 vmesa
->sarea
->ctxOwner
= vmesa
->hHWContext
;
684 vmesa
->newState
= ~0;
687 if (vmesa
->lastStamp
!= dPriv
->lastStamp
) {
688 viaXMesaWindowMoved(vmesa
);
689 vmesa
->lastStamp
= dPriv
->lastStamp
;
695 viaSwapBuffers(__DRIdrawablePrivate
*drawablePrivate
)
697 __DRIdrawablePrivate
*dPriv
= (__DRIdrawablePrivate
*)drawablePrivate
;
698 if (VIA_DEBUG
) fprintf(stderr
, "%s - in\n", __FUNCTION__
);
699 if (dPriv
&& dPriv
->driContextPriv
&& dPriv
->driContextPriv
->driverPrivate
) {
703 vmesa
= (viaContextPtr
)dPriv
->driContextPriv
->driverPrivate
;
705 if (ctx
->Visual
.doubleBufferMode
) {
706 _mesa_notifySwapBuffers(ctx
);
707 if (vmesa
->doPageFlip
) {
711 viaCopyBuffer(dPriv
);
715 VIA_FLUSH_DMA(vmesa
);
718 _mesa_problem(NULL
, "viaSwapBuffers: drawable has no context!\n");
720 if (VIA_DEBUG
) fprintf(stderr
, "%s - out\n", __FUNCTION__
);