2 Haiku S3 Savage driver adapted from the X.org Savage driver.
4 Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
5 Copyright (c) 2003-2006, X.Org Foundation
7 Copyright 2007-2008 Haiku, Inc. All rights reserved.
8 Distributed under the terms of the MIT license.
11 Gerald Zajac 2006-2008
21 Savage_FillRectangle(engine_token
*et
, uint32 color
, fill_rect_params
*pList
, uint32 count
)
23 int cmd
= BCI_CMD_RECT
| BCI_CMD_RECT_XP
| BCI_CMD_RECT_YP
24 | BCI_CMD_DEST_PBD_NEW
| BCI_CMD_SRC_SOLID
| BCI_CMD_SEND_COLOR
;
26 (void)et
; // avoid compiler warning for unused arg
28 BCI_CMD_SET_ROP(cmd
, 0xF0); // use GXcopy for rop
33 int w
= pList
->right
- x
+ 1;
34 int h
= pList
->bottom
- y
+ 1;
41 BCI_SEND(gInfo
.sharedInfo
->frameBufferOffset
);
42 BCI_SEND(gInfo
.sharedInfo
->globalBitmapDesc
);
45 BCI_SEND(BCI_X_Y(x
, y
));
46 BCI_SEND(BCI_W_H(w
, h
));
54 Savage_FillSpan(engine_token
*et
, uint32 color
, uint16
*pList
, uint32 count
)
56 int cmd
= BCI_CMD_RECT
| BCI_CMD_RECT_XP
| BCI_CMD_RECT_YP
57 | BCI_CMD_DEST_PBD_NEW
| BCI_CMD_SRC_SOLID
| BCI_CMD_SEND_COLOR
;
59 (void)et
; // avoid compiler warning for unused arg
61 BCI_CMD_SET_ROP(cmd
, 0xF0); // use GXcopy for rop
66 int w
= *pList
++ - x
+ 1;
70 // The MediaPlayer in Zeta 1.21 displays a window which has 2 zero width
71 // spans which the Savage chips display as a line completely across the
72 // screen; thus, the following if statement discards any span with zero
81 BCI_SEND(gInfo
.sharedInfo
->frameBufferOffset
);
82 BCI_SEND(gInfo
.sharedInfo
->globalBitmapDesc
);
85 BCI_SEND(BCI_X_Y(x
, y
));
86 BCI_SEND(BCI_W_H(w
, 1));
92 Savage_InvertRectangle(engine_token
*et
, fill_rect_params
*pList
, uint32 count
)
94 int cmd
= BCI_CMD_RECT
| BCI_CMD_RECT_XP
| BCI_CMD_RECT_YP
95 | BCI_CMD_DEST_PBD_NEW
;
97 (void)et
; // avoid compiler warning for unused arg
99 BCI_CMD_SET_ROP(cmd
, 0x55); // use GXinvert for rop
104 int w
= pList
->right
- x
+ 1;
105 int h
= pList
->bottom
- y
+ 1;
112 BCI_SEND(gInfo
.sharedInfo
->frameBufferOffset
);
113 BCI_SEND(gInfo
.sharedInfo
->globalBitmapDesc
);
115 BCI_SEND(BCI_X_Y(x
, y
));
116 BCI_SEND(BCI_W_H(w
, h
));
124 Savage_ScreenToScreenBlit(engine_token
*et
, blit_params
*pList
, uint32 count
)
126 (void)et
; // avoid compiler warning for unused arg
130 int src_x
= pList
->src_left
;
131 int src_y
= pList
->src_top
;
132 int dest_x
= pList
->dest_left
;
133 int dest_y
= pList
->dest_top
;
134 int width
= pList
->width
;
135 int height
= pList
->height
;
139 cmd
= BCI_CMD_RECT
| BCI_CMD_DEST_PBD_NEW
| BCI_CMD_SRC_SBD_COLOR_NEW
;
140 BCI_CMD_SET_ROP(cmd
, 0xCC); // use GXcopy for rop
142 if (dest_x
<= src_x
) {
143 cmd
|= BCI_CMD_RECT_XP
;
149 if (dest_y
<= src_y
) {
150 cmd
|= BCI_CMD_RECT_YP
;
160 BCI_SEND(gInfo
.sharedInfo
->frameBufferOffset
);
161 BCI_SEND(gInfo
.sharedInfo
->globalBitmapDesc
);
163 BCI_SEND(gInfo
.sharedInfo
->frameBufferOffset
);
164 BCI_SEND(gInfo
.sharedInfo
->globalBitmapDesc
);
166 BCI_SEND(BCI_X_Y(src_x
, src_y
));
167 BCI_SEND(BCI_X_Y(dest_x
, dest_y
));
168 BCI_SEND(BCI_W_H(width
+ 1, height
+ 1));