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.
26 #ifndef SAVAGE_IOCTL_H
27 #define SAVAGE_IOCTL_H
29 #include "savagecontext.h"
30 #include "savagedma.h"
32 void savageGetGeneralDmaBufferLocked( savageContextPtr mmesa
);
34 void savageFlushVertices( savageContextPtr mmesa
);
35 void savageFlushVerticesLocked( savageContextPtr mmesa
);
37 void savageFlushGeneralLocked( savageContextPtr imesa
);
38 void savageWaitAgeLocked( savageContextPtr imesa
, int age
);
39 void savageWaitAge( savageContextPtr imesa
, int age
);
41 void savageDmaFinish( savageContextPtr imesa
);
43 void savageRegetLockQuiescent( savageContextPtr imesa
);
45 void savageDDInitIoctlFuncs( GLcontext
*ctx
);
47 void savageSwapBuffers( __DRIdrawablePrivate
*dPriv
);
49 int savage_check_copy(int fd
);
51 extern GLboolean (*savagePagePending
)( savageContextPtr imesa
);
52 extern void (*savageWaitForFIFO
)( savageContextPtr imesa
, unsigned count
);
53 extern void (*savageWaitIdleEmpty
)( savageContextPtr imesa
);
55 #define PAGE_PENDING(result) do { \
56 result = savagePagePending(imesa); \
58 #define WAIT_FOR_FIFO(count) do { \
59 savageWaitForFIFO(imesa, count); \
61 #define WAIT_IDLE_EMPTY do { \
62 savageWaitIdleEmpty(imesa); \
66 int savageAllocDMABuffer(savageContextPtr imesa
, drm_savage_alloc_cont_mem_t
*req
);
67 GLuint
savageGetPhyAddress(savageContextPtr imesa
,void * pointer
);
68 int savageFreeDMABuffer(savageContextPtr
, drm_savage_alloc_cont_mem_t
*);
71 #define FLUSH_BATCH(imesa) do { \
72 if (imesa->vertex_dma_buffer) savageFlushVertices(imesa); \
76 uint32_t *savageAllocDmaLow( savageContextPtr imesa
, GLuint bytes
)
80 if (!imesa
->vertex_dma_buffer
) {
82 imesa
->vertex_dma_buffer
= savageFakeGetBuffer (imesa
);
83 UNLOCK_HARDWARE(imesa
);
84 } else if (imesa
->vertex_dma_buffer
->used
+ bytes
>
85 imesa
->vertex_dma_buffer
->total
) {
87 savageFlushVerticesLocked( imesa
);
88 imesa
->vertex_dma_buffer
= savageFakeGetBuffer (imesa
);
89 UNLOCK_HARDWARE(imesa
);
92 head
= (uint32_t *)((uint8_t *)imesa
->vertex_dma_buffer
->address
+
93 imesa
->vertex_dma_buffer
->used
);
95 imesa
->vertex_dma_buffer
->used
+= bytes
;