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 #include "via_context.h"
31 void viaEmitPrim(viaContextPtr vmesa
);
32 void viaFlushPrims(viaContextPtr vmesa
);
33 void viaFlushPrimsLocked(viaContextPtr vmesa
);
35 void viaDmaFinish(viaContextPtr vmesa
);
36 void viaRegetLockQuiescent(viaContextPtr vmesa
);
37 void viaInitIoctlFuncs(GLcontext
*ctx
);
38 void viaCopyBuffer(const __DRIdrawablePrivate
*dpriv
);
39 void viaPageFlip(const __DRIdrawablePrivate
*dpriv
);
40 int via_check_copy(int fd
);
41 void viaFillFrontBuffer(viaContextPtr vmesa
);
42 void viaFillFrontBufferSaam(viaContextPtr vmesa
);
43 void viaFillFrontPBuffer(viaContextPtr vmesa
);
44 void viaFillBackBuffer(viaContextPtr vmesa
);
45 void viaFillDepthBuffer(viaContextPtr vmesa
, GLuint pixel
);
46 void viaFillStencilBuffer(viaContextPtr vmesa
, GLuint pixel
);
47 void viaFillStencilDepthBuffer(viaContextPtr vmesa
, GLuint pixel
);
48 void viaDoSwapBuffers(viaContextPtr vmesa
);
49 void viaDoSwapBuffersSaam(viaContextPtr vmesa
);
50 void viaDoSwapPBuffers(viaContextPtr vmesa
);
52 int flush_agp(viaContextPtr vmesa
, drm_via_flush_agp_t
* agpCmd
);
53 int flush_agp_saam(viaContextPtr vmesa
, drm_via_flush_agp_t
* agpCmd
);
54 int flush_sys(viaContextPtr vmesa
, drm_via_flush_sys_t
* buf
);
56 #define VIA_STATECHANGE(vmesa, flag) \
58 if (vmesa->dmaLow != vmesa->dmaLastPrim) \
59 viaFlushPrims(vmesa); \
60 vmesa->dirty |= flag; \
64 #define VIA_FIREVERTICES(vmesa) \
66 if (vmesa->dmaLow) { \
67 viaFlushPrims(vmesa); \
72 static __inline GLuint
*viaCheckDma(viaContextPtr vmesa
, int bytes
)
74 if (vmesa
->dmaLow
+ bytes
> vmesa
->dmaHigh
) {
76 if (VIA_DEBUG
) fprintf(stderr
, "buffer overflow in check dma = %d + %d = %d\n", vmesa
->dmaLow
, bytes
, vmesa
->dmaLow
+ bytes
);
82 GLuint
*start
= (GLuint
*)(vmesa
->dmaAddr
+ vmesa
->dmaLow
);