2 Haiku S3 Virge driver adapted from the X.org S3 Virge driver.
4 Copyright (C) 1994-1999 The XFree86 Project, Inc. All Rights Reserved.
6 Copyright 2007-2008 Haiku, Inc. All rights reserved.
7 Distributed under the terms of the MIT license.
10 Gerald Zajac 2007-2008
19 #define CURSOR_BYTES 1024 // bytes used for cursor image in video memory
21 // Miscellaneous registers.
22 #define SUBSYS_STAT_REG 0x8504
23 #define SYSTEM_CONTROL_REG 0x83DA
24 #define DDC_REG 0xFF20
26 // Memory port controller registers.
27 #define FIFO_CONTROL_REG 0x8200
30 #define SRC_BASE 0xA4D4
31 #define DEST_BASE 0xA4D8
32 #define CLIP_L_R 0xA4DC
33 #define CLIP_T_B 0xA4E0
34 #define DEST_SRC_STR 0xA4E4
35 #define MONO_PAT_0 0xA4E8
36 #define MONO_PAT_1 0xA4EC
37 #define PAT_BG_CLR 0xA4F0
38 #define PAT_FG_CLR 0xA4F4
39 #define CMD_SET 0xA500
40 #define RWIDTH_HEIGHT 0xA504
41 #define RSRC_XY 0xA508
42 #define RDEST_XY 0xA50C
45 #define CMD_OP_MSK (0xf << 27)
46 #define CMD_BITBLT (0x0 << 27)
47 #define CMD_RECT ((0x2 << 27) | 0x0100)
48 #define CMD_LINE (0x3 << 27)
49 #define CMD_POLYFILL (0x5 << 27)
50 #define CMD_NOP (0xf << 27)
54 // Destination Color Format.
56 #define DST_16BPP 0x04
57 #define DST_24BPP 0x08
59 // X Positive, Y Positive (Bit BLT).
60 #define CMD_XP 0x02000000
61 #define CMD_YP 0x04000000
64 #define IN_SUBSYS_STAT() (ReadReg32(SUBSYS_STAT_REG))
67 static inline void VerticalRetraceWait()
69 if (ReadCrtcReg(0x17) & 0x80) {
71 while ((ReadReg8(SYSTEM_CONTROL_REG
) & 0x08) == 0x08 && i
--) ;
73 while ((ReadReg8(SYSTEM_CONTROL_REG
) & 0x08) == 0x00 && i
--) ;