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.
34 #include "swrast/swrast.h"
38 #include "savagecontext.h"
39 #include "savageioctl.h"
40 #include "savage_bci.h"
41 #include "savagestate.h"
42 #include "savagespan.h"
45 #include <sys/ioctl.h>
46 #include <sys/timeb.h>
48 #define DEPTH_SCALE_16 ((1<<16)-1)
49 #define DEPTH_SCALE_24 ((1<<24)-1)
52 void savageGetDMABuffer( savageContextPtr imesa
)
60 assert (imesa
->savageScreen
->bufs
);
62 if (SAVAGE_DEBUG
& DEBUG_DMA
)
63 fprintf(stderr
, "Getting dma buffer\n");
65 dma
.context
= imesa
->hHWContext
;
68 dma
.send_sizes
= NULL
;
70 dma
.request_count
= 1;
71 dma
.request_size
= imesa
->bufferSize
;
72 dma
.request_list
= &idx
;
73 dma
.request_sizes
= &size
;
74 dma
.granted_count
= 0;
77 if (SAVAGE_DEBUG
& DEBUG_DMA
)
78 fprintf(stderr
, "drmDMA (get) ctx %d count %d size 0x%x\n",
79 dma
.context
, dma
.request_count
,
83 retcode
= drmDMA(imesa
->driFd
, &dma
);
85 if (SAVAGE_DEBUG
& DEBUG_DMA
)
86 fprintf(stderr
, "retcode %d sz %d idx %d count %d\n",
93 dma
.request_sizes
[0] &&
97 if (SAVAGE_DEBUG
& DEBUG_DMA
)
98 fprintf(stderr
, "\n\nflush");
101 buf
= &(imesa
->savageScreen
->bufs
->list
[idx
]);
103 if (SAVAGE_DEBUG
& DEBUG_DMA
)
105 "drmDMA (get) returns size[0] 0x%x idx[0] %d\n"
106 "dma_buffer now: buf idx: %d size: %d used: %d addr %p\n",
107 dma
.request_sizes
[0], dma
.request_list
[0],
108 buf
->idx
, buf
->total
,
109 buf
->used
, buf
->address
);
111 imesa
->dmaVtxBuf
.total
= buf
->total
/ 4;
112 imesa
->dmaVtxBuf
.used
= 0;
113 imesa
->dmaVtxBuf
.flushed
= 0;
114 imesa
->dmaVtxBuf
.idx
= buf
->idx
;
115 imesa
->dmaVtxBuf
.buf
= (u_int32_t
*)buf
->address
;
117 if (SAVAGE_DEBUG
& DEBUG_DMA
)
118 fprintf(stderr
, "finished getbuffer\n");
122 /* Still keeping this around because it demonstrates page flipping and
123 * automatic z-clear. */
124 static void savage_BCI_clear(GLcontext
*ctx
, drm_savage_clear_t
*pclear
)
126 savageContextPtr imesa
= SAVAGE_CONTEXT(ctx
);
127 int nbox
= imesa
->sarea
->nbox
;
128 drm_clip_rect_t
*pbox
= imesa
->sarea
->boxes
;
132 if (nbox
> SAVAGE_NR_SAREA_CLIPRECTS
)
133 nbox
= SAVAGE_NR_SAREA_CLIPRECTS
;
135 for (i
= 0 ; i
< nbox
; i
++, pbox
++) {
136 unsigned int x
= pbox
->x1
;
137 unsigned int y
= pbox
->y1
;
138 unsigned int width
= pbox
->x2
- x
;
139 unsigned int height
= pbox
->y2
- y
;
142 if (pbox
->x1
> pbox
->x2
||
143 pbox
->y1
> pbox
->y2
||
144 pbox
->x2
> imesa
->savageScreen
->width
||
145 pbox
->y2
> imesa
->savageScreen
->height
)
148 if ( pclear
->flags
& SAVAGE_FRONT
) {
149 bciptr
= savageDMAAlloc (imesa
, 8);
150 WRITE_CMD((bciptr
) , 0x4BCC8C00,u_int32_t
);
151 WRITE_CMD((bciptr
) , imesa
->savageScreen
->frontOffset
,u_int32_t
);
152 WRITE_CMD((bciptr
) , imesa
->savageScreen
->frontBitmapDesc
,u_int32_t
);
153 WRITE_CMD((bciptr
) , pclear
->clear_color
,u_int32_t
);
154 WRITE_CMD((bciptr
) , (y
<<16) | x
,u_int32_t
);
155 WRITE_CMD((bciptr
) , (height
<< 16) | width
,u_int32_t
);
156 savageDMACommit (imesa
, bciptr
);
158 if ( pclear
->flags
& SAVAGE_BACK
) {
159 bciptr
= savageDMAAlloc (imesa
, 8);
160 WRITE_CMD((bciptr
) , 0x4BCC8C00,u_int32_t
);
161 WRITE_CMD((bciptr
) , imesa
->savageScreen
->backOffset
,u_int32_t
);
162 WRITE_CMD((bciptr
) , imesa
->savageScreen
->backBitmapDesc
,u_int32_t
);
163 WRITE_CMD((bciptr
) , pclear
->clear_color
,u_int32_t
);
164 WRITE_CMD((bciptr
) , (y
<<16) | x
,u_int32_t
);
165 WRITE_CMD((bciptr
) , (height
<< 16) | width
,u_int32_t
);
166 savageDMACommit (imesa
, bciptr
);
169 if ( pclear
->flags
& (SAVAGE_DEPTH
|SAVAGE_STENCIL
) ) {
170 u_int32_t writeMask
= 0x0;
171 if(imesa
->hw_stencil
)
173 if(pclear
->flags
& SAVAGE_STENCIL
)
176 writeMask
|= 0xFF000000;
178 if(pclear
->flags
& SAVAGE_DEPTH
)
180 writeMask
|= 0x00FFFFFF;
183 if(imesa
->IsFullScreen
&& imesa
->NotFirstFrame
&&
184 imesa
->savageScreen
->chipset
>= S3_SAVAGE4
)
186 imesa
->regs
.s4
.zBufCtrl
.ni
.autoZEnable
= GL_TRUE
;
187 imesa
->regs
.s4
.zBufCtrl
.ni
.frameID
=
188 ~imesa
->regs
.s4
.zBufCtrl
.ni
.frameID
;
190 imesa
->dirty
|= SAVAGE_UPLOAD_GLOBAL
;
194 if(imesa
->IsFullScreen
)
195 imesa
->NotFirstFrame
= GL_TRUE
;
197 if(imesa
->hw_stencil
)
199 bciptr
= savageDMAAlloc (imesa
, 10);
200 if(writeMask
!= 0xFFFFFFFF)
202 WRITE_CMD((bciptr
) , 0x960100D7,u_int32_t
);
203 WRITE_CMD((bciptr
) , writeMask
,u_int32_t
);
208 bciptr
= savageDMAAlloc (imesa
, 6);
211 WRITE_CMD((bciptr
) , 0x4BCC8C00,u_int32_t
);
212 WRITE_CMD((bciptr
) , imesa
->savageScreen
->depthOffset
,u_int32_t
);
213 WRITE_CMD((bciptr
) , imesa
->savageScreen
->depthBitmapDesc
,u_int32_t
);
214 WRITE_CMD((bciptr
) , pclear
->clear_depth
,u_int32_t
);
215 WRITE_CMD((bciptr
) , (y
<<16) | x
,u_int32_t
);
216 WRITE_CMD((bciptr
) , (height
<< 16) | width
,u_int32_t
);
217 if(imesa
->hw_stencil
)
219 if(writeMask
!= 0xFFFFFFFF)
221 WRITE_CMD((bciptr
) , 0x960100D7,u_int32_t
);
222 WRITE_CMD((bciptr
) , 0xFFFFFFFF,u_int32_t
);
225 savageDMACommit (imesa
, bciptr
);
229 /* FK: Make sure that the clear stuff is emitted. Otherwise a
230 software fallback may get overwritten by a delayed clear. */
231 savageDMAFlush (imesa
);
234 static void savage_BCI_swap(savageContextPtr imesa
)
236 int nbox
= imesa
->sarea
->nbox
;
237 drm_clip_rect_t
*pbox
= imesa
->sarea
->boxes
;
239 volatile u_int32_t
*bciptr
;
241 if (nbox
> SAVAGE_NR_SAREA_CLIPRECTS
)
242 nbox
= SAVAGE_NR_SAREA_CLIPRECTS
;
243 savageDMAFlush (imesa
);
245 if(imesa
->IsFullScreen
)
248 tmp0
= imesa
->savageScreen
->frontOffset
;
249 imesa
->savageScreen
->frontOffset
= imesa
->savageScreen
->backOffset
;
250 imesa
->savageScreen
->backOffset
= tmp0
;
252 if(imesa
->toggle
== TARGET_BACK
)
253 imesa
->toggle
= TARGET_FRONT
;
255 imesa
->toggle
= TARGET_BACK
;
257 driFlipRenderbuffers(imesa
->glCtx
->DrawBuffer
,
258 imesa
->toggle
!= TARGET_FRONT
);
260 imesa
->regs
.s4
.destCtrl
.ni
.offset
= imesa
->savageScreen
->backOffset
>>11;
261 imesa
->dirty
|= SAVAGE_UPLOAD_GLOBAL
;
262 bciptr
= SAVAGE_GET_BCI_POINTER(imesa
,3);
263 *(bciptr
) = 0x960100B0;
264 *(bciptr
) = (imesa
->savageScreen
->frontOffset
);
265 *(bciptr
) = 0xA0000000;
269 { /* Use bitblt copy from back to front buffer*/
271 for (i
= 0 ; i
< nbox
; i
++, pbox
++)
273 unsigned int w
= pbox
->x2
- pbox
->x1
;
274 unsigned int h
= pbox
->y2
- pbox
->y1
;
276 if (pbox
->x1
> pbox
->x2
||
277 pbox
->y1
> pbox
->y2
||
278 pbox
->x2
> imesa
->savageScreen
->width
||
279 pbox
->y2
> imesa
->savageScreen
->height
)
282 bciptr
= SAVAGE_GET_BCI_POINTER(imesa
,6);
284 *(bciptr
) = 0x4BCC00C0;
286 *(bciptr
) = imesa
->savageScreen
->backOffset
;
287 *(bciptr
) = imesa
->savageScreen
->backBitmapDesc
;
288 *(bciptr
) = (pbox
->y1
<<16) | pbox
->x1
; /*x0, y0*/
289 *(bciptr
) = (pbox
->y1
<<16) | pbox
->x1
;
290 *(bciptr
) = (h
<< 16) | w
;
298 static GLboolean
intersect_rect( drm_clip_rect_t
*out
,
299 const drm_clip_rect_t
*a
,
300 const drm_clip_rect_t
*b
)
303 if (b
->x1
> out
->x1
) out
->x1
= b
->x1
;
304 if (b
->y1
> out
->y1
) out
->y1
= b
->y1
;
305 if (b
->x2
< out
->x2
) out
->x2
= b
->x2
;
306 if (b
->y2
< out
->y2
) out
->y2
= b
->y2
;
308 return ((out
->x1
< out
->x2
) && (out
->y1
< out
->y2
));
312 static GLuint
savageIntersectClipRects(drm_clip_rect_t
*dest
,
313 const drm_clip_rect_t
*src
,
315 const drm_clip_rect_t
*clip
)
319 for (i
= 0, ndest
= 0; i
< nsrc
; ++i
, ++src
) {
320 if (intersect_rect(dest
, src
, clip
)) {
330 static void savageDDClear( GLcontext
*ctx
, GLbitfield mask
, GLboolean all
,
331 GLint cx
, GLint cy
, GLint cw
, GLint ch
)
333 savageContextPtr imesa
= SAVAGE_CONTEXT( ctx
);
334 GLuint colorMask
, depthMask
, clearColor
, clearDepth
, flags
;
336 if (SAVAGE_DEBUG
& DEBUG_VERBOSE_MSG
)
337 fprintf (stderr
, "%s\n", __FUNCTION__
);
339 clearColor
= imesa
->ClearColor
;
340 if (imesa
->float_depth
) {
341 if (imesa
->savageScreen
->zpp
== 2)
342 clearDepth
= savageEncodeFloat16(1.0 - ctx
->Depth
.Clear
);
344 clearDepth
= savageEncodeFloat24(1.0 - ctx
->Depth
.Clear
);
346 if (imesa
->savageScreen
->zpp
== 2)
347 clearDepth
= (GLuint
) ((1.0 - ctx
->Depth
.Clear
) * DEPTH_SCALE_16
);
349 clearDepth
= (GLuint
) ((1.0 - ctx
->Depth
.Clear
) * DEPTH_SCALE_24
);
354 switch (imesa
->savageScreen
->cpp
) {
356 colorMask
= PACK_COLOR_565(ctx
->Color
.ColorMask
[0],
357 ctx
->Color
.ColorMask
[1],
358 ctx
->Color
.ColorMask
[2]);
361 colorMask
= PACK_COLOR_8888(ctx
->Color
.ColorMask
[3],
362 ctx
->Color
.ColorMask
[2],
363 ctx
->Color
.ColorMask
[1],
364 ctx
->Color
.ColorMask
[0]);
370 if (mask
& BUFFER_BIT_FRONT_LEFT
) {
371 flags
|= SAVAGE_FRONT
;
372 mask
&= ~BUFFER_BIT_FRONT_LEFT
;
375 if (mask
& BUFFER_BIT_BACK_LEFT
) {
376 flags
|= SAVAGE_BACK
;
377 mask
&= ~BUFFER_BIT_BACK_LEFT
;
380 if ((mask
& BUFFER_BIT_DEPTH
) && ctx
->Depth
.Mask
) {
381 flags
|= SAVAGE_DEPTH
;
383 (imesa
->savageScreen
->zpp
== 2) ? 0xffffffff : 0x00ffffff;
384 mask
&= ~BUFFER_BIT_DEPTH
;
387 if((mask
& BUFFER_BIT_STENCIL
) && imesa
->hw_stencil
)
389 flags
|= SAVAGE_DEPTH
;
390 depthMask
|= 0xff000000;
391 mask
&= ~BUFFER_BIT_STENCIL
;
394 savageFlushVertices(imesa
);
397 GLboolean depthCleared
= GL_FALSE
;
398 if (flags
& (SAVAGE_FRONT
|SAVAGE_BACK
)) {
399 drm_savage_cmd_header_t
*cmd
;
400 cmd
= savageAllocCmdBuf(imesa
, sizeof(drm_savage_cmd_header_t
));
401 cmd
[0].clear0
.cmd
= SAVAGE_CMD_CLEAR
;
402 if ((flags
& SAVAGE_DEPTH
) &&
403 clearDepth
== clearColor
&& depthMask
== colorMask
) {
404 cmd
[0].clear0
.flags
= flags
;
405 depthCleared
= GL_TRUE
;
407 cmd
[0].clear0
.flags
= flags
& (SAVAGE_FRONT
|SAVAGE_BACK
);
408 cmd
[1].clear1
.mask
= colorMask
;
409 cmd
[1].clear1
.value
= clearColor
;
412 if ((flags
& SAVAGE_DEPTH
) && !depthCleared
) {
413 drm_savage_cmd_header_t
*cmd
;
414 cmd
= savageAllocCmdBuf(imesa
, sizeof(drm_savage_cmd_header_t
));
415 cmd
[0].clear0
.cmd
= SAVAGE_CMD_CLEAR
;
416 cmd
[0].clear0
.flags
= SAVAGE_DEPTH
;
417 cmd
[1].clear1
.mask
= depthMask
;
418 cmd
[1].clear1
.value
= clearDepth
;
423 _swrast_Clear( ctx
, mask
, all
, cx
, cy
, cw
, ch
);
427 * Copy the back buffer to the front buffer.
429 void savageSwapBuffers( __DRIdrawablePrivate
*dPriv
)
431 savageContextPtr imesa
;
433 if (SAVAGE_DEBUG
& DEBUG_VERBOSE_MSG
)
434 fprintf (stderr
, "%s\n================================\n", __FUNCTION__
);
437 assert(dPriv
->driContextPriv
);
438 assert(dPriv
->driContextPriv
->driverPrivate
);
440 imesa
= (savageContextPtr
) dPriv
->driContextPriv
->driverPrivate
;
442 _mesa_notifySwapBuffers( imesa
->glCtx
);
446 if (imesa
->sync_frames
)
447 imesa
->lastSwap
= savageEmitEvent( imesa
, 0 );
449 if (imesa
->lastSwap
!= 0)
450 savageWaitEvent( imesa
, imesa
->lastSwap
);
453 drm_savage_cmd_header_t
*cmd
= savageAllocCmdBuf(imesa
, 0);
454 cmd
->cmd
.cmd
= SAVAGE_CMD_SWAP
;
455 imesa
->inSwap
= GL_TRUE
; /* ignore scissors in savageFlushCmdBuf */
456 savageFlushCmdBuf(imesa
, GL_FALSE
);
457 imesa
->inSwap
= GL_FALSE
;
460 if (!imesa
->sync_frames
)
461 /* don't sync, but limit the lag to one frame. */
462 imesa
->lastSwap
= savageEmitEvent( imesa
, 0 );
465 unsigned int savageEmitEventLocked( savageContextPtr imesa
, unsigned int flags
)
467 drm_savage_event_emit_t event
;
471 ret
= drmCommandWriteRead( imesa
->driFd
, DRM_SAVAGE_BCI_EVENT_EMIT
,
472 &event
, sizeof(event
) );
474 fprintf (stderr
, "emit event returned %d\n", ret
);
479 unsigned int savageEmitEvent( savageContextPtr imesa
, unsigned int flags
)
482 LOCK_HARDWARE( imesa
);
483 ret
= savageEmitEventLocked( imesa
, flags
);
484 UNLOCK_HARDWARE( imesa
);
489 void savageWaitEvent( savageContextPtr imesa
, unsigned int count
)
491 drm_savage_event_wait_t event
;
495 ret
= drmCommandWriteRead( imesa
->driFd
, DRM_SAVAGE_BCI_EVENT_WAIT
,
496 &event
, sizeof(event
) );
498 fprintf (stderr
, "wait event returned %d\n", ret
);
504 void savageFlushVertices( savageContextPtr imesa
)
506 struct savage_vtxbuf_t
*buffer
= imesa
->vtxBuf
;
508 if (SAVAGE_DEBUG
& DEBUG_VERBOSE_MSG
)
509 fprintf (stderr
, "%s\n", __FUNCTION__
);
514 if (buffer
->used
> buffer
->flushed
) {
515 drm_savage_cmd_header_t
*cmd
;
516 /* State must be updated "per primitive" because hardware
517 * culling must be disabled for unfilled primitives, points
519 savageEmitChangedState (imesa
);
520 cmd
= savageAllocCmdBuf(imesa
, 0);
521 cmd
->prim
.cmd
= buffer
== &imesa
->dmaVtxBuf
?
522 SAVAGE_CMD_DMA_PRIM
: SAVAGE_CMD_VB_PRIM
;
523 cmd
->prim
.prim
= imesa
->HwPrim
;
524 cmd
->prim
.skip
= imesa
->skip
;
525 cmd
->prim
.start
= buffer
->flushed
/ imesa
->HwVertexSize
;
526 cmd
->prim
.count
= buffer
->used
/ imesa
->HwVertexSize
- cmd
->prim
.start
;
527 buffer
->flushed
= buffer
->used
;
531 void savageFlushCmdBufLocked( savageContextPtr imesa
, GLboolean discard
)
533 __DRIdrawablePrivate
*dPriv
= imesa
->driDrawable
;
535 if (!imesa
->dmaVtxBuf
.total
)
538 /* complete indexed drawing commands */
539 savageFlushElts(imesa
);
541 if (imesa
->cmdBuf
.write
!= imesa
->cmdBuf
.start
|| discard
) {
542 drm_savage_cmdbuf_t cmdbuf
;
543 drm_savage_cmd_header_t
*start
;
546 /* If we lost the context we must restore the initial state (at
547 * the start of the command buffer). */
548 if (imesa
->lostContext
) {
549 start
= imesa
->cmdBuf
.base
;
550 imesa
->lostContext
= GL_FALSE
;
552 start
= imesa
->cmdBuf
.start
;
554 if ((SAVAGE_DEBUG
& DEBUG_DMA
) && discard
)
555 fprintf (stderr
, "Discarding DMA buffer, used=%u\n",
556 imesa
->dmaVtxBuf
.used
);
558 cmdbuf
.dma_idx
= imesa
->dmaVtxBuf
.idx
;
559 cmdbuf
.discard
= discard
;
560 cmdbuf
.vb_addr
= imesa
->clientVtxBuf
.buf
;
561 cmdbuf
.vb_size
= imesa
->clientVtxBuf
.total
*4;
562 cmdbuf
.vb_stride
= imesa
->HwVertexSize
;
563 cmdbuf
.cmd_addr
= start
;
564 cmdbuf
.size
= (imesa
->cmdBuf
.write
- start
);
565 if (!imesa
->inSwap
&& imesa
->scissor
.enabled
) {
566 drm_clip_rect_t
*box
= dPriv
->pClipRects
, *ibox
;
567 drm_clip_rect_t scissor
;
568 GLuint nbox
= dPriv
->numClipRects
, nibox
;
569 /* transform and clip scissor to viewport */
570 scissor
.x1
= MAX2(imesa
->scissor
.x
, 0) + dPriv
->x
;
571 scissor
.y1
= MAX2(dPriv
->h
- imesa
->scissor
.y
- imesa
->scissor
.h
,
573 scissor
.x2
= MIN2(imesa
->scissor
.x
+ imesa
->scissor
.w
,
574 dPriv
->w
) + dPriv
->x
;
575 scissor
.y2
= MIN2(dPriv
->h
- imesa
->scissor
.y
,
576 dPriv
->h
) + dPriv
->y
;
577 /* intersect cliprects with scissor */
578 ibox
= malloc(dPriv
->numClipRects
*sizeof(drm_clip_rect_t
));
580 fprintf(stderr
, "Out of memory.\n");
583 nibox
= savageIntersectClipRects(ibox
, box
, nbox
, &scissor
);
585 cmdbuf
.box_addr
= ibox
;
587 cmdbuf
.nbox
= dPriv
->numClipRects
;
588 cmdbuf
.box_addr
= dPriv
->pClipRects
;
591 ret
= drmCommandWrite( imesa
->driFd
, DRM_SAVAGE_BCI_CMDBUF
,
592 &cmdbuf
, sizeof(cmdbuf
) );
594 fprintf (stderr
, "cmdbuf ioctl returned %d\n", ret
);
598 if (cmdbuf
.box_addr
!= dPriv
->pClipRects
) {
599 free(cmdbuf
.box_addr
);
602 /* Save the current state at the start of the command buffer. That
603 * state will only be emitted, if the context was lost since the
604 * last command buffer. */
605 imesa
->cmdBuf
.write
= imesa
->cmdBuf
.base
;
606 savageEmitOldState(imesa
);
607 imesa
->cmdBuf
.start
= imesa
->cmdBuf
.write
;
611 assert (!savageHaveIndexedVerts(imesa
));
612 imesa
->dmaVtxBuf
.total
= 0;
613 imesa
->dmaVtxBuf
.used
= 0;
614 imesa
->dmaVtxBuf
.flushed
= 0;
616 if (!savageHaveIndexedVerts(imesa
)) {
617 imesa
->clientVtxBuf
.used
= 0;
618 imesa
->clientVtxBuf
.flushed
= 0;
623 void savageFlushCmdBuf( savageContextPtr imesa
, GLboolean discard
)
625 if (SAVAGE_DEBUG
& DEBUG_VERBOSE_MSG
)
626 fprintf (stderr
, "%s\n", __FUNCTION__
);
627 LOCK_HARDWARE(imesa
);
628 savageFlushCmdBufLocked (imesa
, discard
);
629 UNLOCK_HARDWARE(imesa
);
633 static void savageDDFlush( GLcontext
*ctx
)
635 savageContextPtr imesa
= SAVAGE_CONTEXT(ctx
);
636 if (SAVAGE_DEBUG
& DEBUG_VERBOSE_MSG
)
637 fprintf (stderr
, "%s\n", __FUNCTION__
);
638 savageFlushVertices (imesa
);
639 savageFlushCmdBuf(imesa
, GL_FALSE
);
642 static void savageDDFinish( GLcontext
*ctx
)
644 savageContextPtr imesa
= SAVAGE_CONTEXT(ctx
);
645 if (SAVAGE_DEBUG
& DEBUG_VERBOSE_MSG
)
646 fprintf (stderr
, "%s\n", __FUNCTION__
);
647 savageFlushVertices (imesa
);
648 savageFlushCmdBuf(imesa
, GL_FALSE
);
649 WAIT_IDLE_EMPTY(imesa
);
652 void savageDDInitIoctlFuncs( GLcontext
*ctx
)
654 ctx
->Driver
.Clear
= savageDDClear
;
655 ctx
->Driver
.Flush
= savageDDFlush
;
656 ctx
->Driver
.Finish
= savageDDFinish
;