Mercurial > mplayer.hg
annotate vidix/drivers/sis_vid.c @ 11046:761f81ffe198
new XML build system
author | diego |
---|---|
date | Wed, 08 Oct 2003 02:11:59 +0000 |
parents | 3bac281db5a1 |
children | e16982ed6708 |
rev | line source |
---|---|
11038
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1 /** |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
2 VIDIX driver for SiS 300 and 310/325 series chips. |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
3 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
4 Copyright 2003 Jake Page, Sugar Media. |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
5 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
6 Based on SiS Xv driver: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
7 Copyright 2002-2003 by Thomas Winischhofer, Vienna, Austria. |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
8 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
9 This program is free software; you can redistribute it and/or modify |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
10 it under the terms of the GNU General Public License as published by |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
11 the Free Software Foundation; either version 2 of the License, or |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
12 (at your option) any later version. |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
13 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
14 This program is distributed in the hope that it will be useful, |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
15 but WITHOUT ANY WARRANTY; without even the implied warranty of |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
17 GNU General Public License for more details. |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
18 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
19 You should have received a copy of the GNU General Public License |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
20 along with this program; if not, write to the Free Software |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
21 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
22 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
23 2003/10/08 integrated into mplayer/vidix architecture -- Alex Beregszaszi |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
24 **/ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
25 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
26 #include <errno.h> |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
27 #include <stdio.h> |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
28 #include <stdlib.h> |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
29 #include <string.h> |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
30 #include <inttypes.h> |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
31 #include <unistd.h> |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
32 #include <sys/io.h> |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
33 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
34 #include "../vidix.h" |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
35 #include "../fourcc.h" |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
36 #include "../../libdha/libdha.h" |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
37 #include "../../libdha/pci_ids.h" |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
38 #include "../../libdha/pci_names.h" |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
39 #include "../../config.h" |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
40 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
41 #include "sis_regs.h" |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
42 #include "sis_defs.h" |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
43 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
44 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
45 /** Random defines **/ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
46 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
47 #define WATCHDOG_DELAY 500000 /* Watchdog counter for retrace waiting */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
48 #define IMAGE_MIN_WIDTH 32 /* Min and max source image sizes */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
49 #define IMAGE_MIN_HEIGHT 24 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
50 #define IMAGE_MAX_WIDTH 720 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
51 #define IMAGE_MAX_HEIGHT 576 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
52 #define IMAGE_MAX_WIDTH_M650 1920 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
53 #define IMAGE_MAX_HEIGHT_M650 1080 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
54 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
55 #define OVERLAY_MIN_WIDTH 32 /* Minimum overlay sizes */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
56 #define OVERLAY_MIN_HEIGHT 24 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
57 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
58 #define DISPMODE_SINGLE1 0x1 /* TW: CRT1 only */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
59 #define DISPMODE_SINGLE2 0x2 /* TW: CRT2 only */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
60 #define DISPMODE_MIRROR 0x4 /* TW: CRT1 + CRT2 MIRROR */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
61 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
62 #define VMODE_INTERLACED 0x1 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
63 #define VMODE_DOUBLESCAN 0x2 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
64 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
65 typedef struct { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
66 short x1, y1, x2, y2; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
67 } BoxRec; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
68 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
69 typedef struct { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
70 int pixelFormat; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
71 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
72 uint16_t pitch; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
73 uint16_t origPitch; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
74 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
75 uint8_t keyOP; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
76 uint16_t HUSF; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
77 uint16_t VUSF; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
78 uint8_t IntBit; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
79 uint8_t wHPre; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
80 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
81 uint16_t srcW; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
82 uint16_t srcH; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
83 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
84 BoxRec dstBox; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
85 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
86 uint32_t PSY; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
87 uint32_t PSV; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
88 uint32_t PSU; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
89 uint8_t bobEnable; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
90 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
91 uint8_t contrastCtrl; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
92 uint8_t contrastFactor; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
93 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
94 uint8_t lineBufSize; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
95 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
96 uint8_t(*VBlankActiveFunc) (); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
97 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
98 uint16_t SCREENheight; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
99 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
100 } SISOverlayRec, *SISOverlayPtr; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
101 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
102 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
103 /** static variable definitions **/ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
104 static int sis_probed = 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
105 static pciinfo_t pci_info; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
106 unsigned int sis_verbose = 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
107 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
108 static void *sis_mem_base; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
109 /* static void *sis_reg_base; */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
110 unsigned short sis_iobase; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
111 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
112 unsigned int sis_vga_engine = UNKNOWN_VGA; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
113 static unsigned int sis_displaymode = DISPMODE_SINGLE1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
114 static unsigned int sis_has_two_overlays = 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
115 static unsigned int sis_bridge_is_slave = 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
116 static unsigned int sis_shift_value = 1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
117 static unsigned int sis_vmode = 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
118 unsigned int sis_vbflags = DISPTYPE_DISP1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
119 unsigned int sis_overlay_on_crt1 = 1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
120 unsigned int sis_crt1_off = -1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
121 unsigned int sis_detected_crt2_devices; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
122 unsigned int sis_force_crt2_type = CRT2_DEFAULT; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
123 unsigned int sis_device_id = -1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
124 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
125 static int sis_format; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
126 static int sis_Yoff = 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
127 static int sis_Voff = 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
128 static int sis_Uoff = 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
129 static int sis_screen_width = 640; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
130 static int sis_screen_height = 480; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
131 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
132 static int sis_frames[VID_PLAY_MAXFRAMES]; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
133 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
134 static vidix_grkey_t sis_grkey; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
135 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
136 static vidix_capability_t sis_cap = { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
137 "SiS 300/310/325 Video Driver", |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
138 "Jake Page", |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
139 TYPE_OUTPUT, |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
140 {0, 0, 0, 0}, |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
141 2048, |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
142 2048, |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
143 4, |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
144 4, |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
145 -1, |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
146 FLAG_UPSCALER | FLAG_DOWNSCALER | FLAG_EQUALIZER, |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
147 VENDOR_SIS, |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
148 -1, |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
149 {0, 0, 0, 0} |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
150 }; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
151 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
152 vidix_video_eq_t sis_equal = { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
153 VEQ_CAP_BRIGHTNESS | VEQ_CAP_CONTRAST, |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
154 200, 0, 0, 0, 0, 0, 0, 0 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
155 }; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
156 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
157 static unsigned short sis_card_ids[] = { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
158 DEVICE_SIS_300, |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
159 DEVICE_SIS_315H, |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
160 DEVICE_SIS_315, |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
161 DEVICE_SIS_315PRO, |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
162 DEVICE_SIS_330, |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
163 DEVICE_SIS_540_VGA, |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
164 DEVICE_SIS_550_VGA, |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
165 DEVICE_SIS_630_VGA, |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
166 DEVICE_SIS_650_VGA |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
167 }; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
168 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
169 /** function declarations **/ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
170 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
171 extern void sis_init_video_bridge(); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
172 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
173 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
174 static void set_overlay(SISOverlayPtr pOverlay, int index); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
175 static void close_overlay(); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
176 static void calc_scale_factor(SISOverlayPtr pOverlay, |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
177 int index, int iscrt2); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
178 static void set_line_buf_size(SISOverlayPtr pOverlay); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
179 static void merge_line_buf(int enable); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
180 static void set_format(SISOverlayPtr pOverlay); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
181 static void set_colorkey(); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
182 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
183 static void set_brightness(uint8_t brightness); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
184 static void set_contrast(uint8_t contrast); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
185 static void set_saturation(char saturation); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
186 static void set_hue(uint8_t hue); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
187 #if 0 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
188 static void set_alpha(uint8_t alpha); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
189 #endif |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
190 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
191 /* IO Port access functions */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
192 static uint8_t getvideoreg(uint8_t reg) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
193 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
194 uint8_t ret; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
195 inSISIDXREG(SISVID, reg, ret); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
196 return (ret); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
197 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
198 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
199 static void setvideoreg(uint8_t reg, uint8_t data) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
200 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
201 outSISIDXREG(SISVID, reg, data); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
202 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
203 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
204 static void setvideoregmask(uint8_t reg, uint8_t data, uint8_t mask) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
205 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
206 uint8_t old; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
207 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
208 inSISIDXREG(SISVID, reg, old); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
209 data = (data & mask) | (old & (~mask)); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
210 outSISIDXREG(SISVID, reg, data); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
211 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
212 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
213 static void setsrregmask(uint8_t reg, uint8_t data, uint8_t mask) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
214 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
215 uint8_t old; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
216 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
217 inSISIDXREG(SISSR, reg, old); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
218 data = (data & mask) | (old & (~mask)); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
219 outSISIDXREG(SISSR, reg, data); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
220 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
221 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
222 /* vblank checking*/ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
223 static uint8_t vblank_active_CRT1() |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
224 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
225 /* this may be too simplistic? */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
226 return (inSISREG(SISINPSTAT) & 0x08); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
227 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
228 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
229 static uint8_t vblank_active_CRT2() |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
230 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
231 uint8_t ret; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
232 if (sis_vga_engine == SIS_315_VGA) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
233 inSISIDXREG(SISPART1, Index_310_CRT2_FC_VR, ret); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
234 } else { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
235 inSISIDXREG(SISPART1, Index_CRT2_FC_VR, ret); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
236 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
237 return ((ret & 0x02) ^ 0x02); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
238 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
239 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
240 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
241 unsigned int vixGetVersion(void) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
242 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
243 return (VIDIX_VERSION); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
244 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
245 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
246 static int find_chip(unsigned chip_id) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
247 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
248 unsigned i; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
249 for (i = 0; i < sizeof(sis_card_ids) / sizeof(unsigned short); i++) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
250 if (chip_id == sis_card_ids[i]) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
251 return i; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
252 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
253 return -1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
254 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
255 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
256 int vixProbe(int verbose, int force) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
257 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
258 pciinfo_t lst[MAX_PCI_DEVICES]; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
259 unsigned i, num_pci; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
260 int err; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
261 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
262 sis_verbose = verbose; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
263 force = force; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
264 err = pci_scan(lst, &num_pci); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
265 if (err) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
266 printf("[SiS] Error occured during pci scan: %s\n", strerror(err)); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
267 return err; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
268 } else { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
269 err = ENXIO; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
270 for (i = 0; i < num_pci; i++) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
271 if (lst[i].vendor == VENDOR_SIS) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
272 int idx; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
273 const char *dname; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
274 idx = find_chip(lst[i].device); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
275 if (idx == -1) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
276 continue; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
277 dname = pci_device_name(VENDOR_SIS, lst[i].device); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
278 dname = dname ? dname : "Unknown chip"; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
279 if (sis_verbose > 0) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
280 printf("[SiS] Found chip: %s (0x%X)\n", |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
281 dname, lst[i].device); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
282 sis_device_id = sis_cap.device_id = lst[i].device; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
283 err = 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
284 memcpy(&pci_info, &lst[i], sizeof(pciinfo_t)); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
285 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
286 sis_has_two_overlays = 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
287 switch (sis_cap.device_id) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
288 case DEVICE_SIS_300: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
289 case DEVICE_SIS_630_VGA: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
290 sis_has_two_overlays = 1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
291 case DEVICE_SIS_540_VGA: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
292 sis_vga_engine = SIS_300_VGA; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
293 break; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
294 case DEVICE_SIS_330: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
295 case DEVICE_SIS_550_VGA: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
296 sis_has_two_overlays = 1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
297 case DEVICE_SIS_315H: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
298 case DEVICE_SIS_315: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
299 case DEVICE_SIS_315PRO: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
300 case DEVICE_SIS_650_VGA: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
301 /* M650 & 651 have 2 overlays */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
302 /* JCP: I think this works, but not really tested yet */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
303 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
304 unsigned char CR5F; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
305 unsigned char tempreg1, tempreg2; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
306 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
307 inSISIDXREG(SISCR, 0x5F, CR5F); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
308 CR5F &= 0xf0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
309 andSISIDXREG(SISCR, 0x5c, 0x07); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
310 inSISIDXREG(SISCR, 0x5c, tempreg1); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
311 tempreg1 &= 0xf8; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
312 setSISIDXREG(SISCR, 0x5c, 0x07, 0xf8); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
313 inSISIDXREG(SISCR, 0x5c, tempreg2); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
314 tempreg2 &= 0xf8; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
315 if ((!tempreg1) || (tempreg2)) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
316 if (CR5F & 0x80) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
317 sis_has_two_overlays = 1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
318 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
319 } else { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
320 sis_has_two_overlays = 1; /* ? */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
321 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
322 if (sis_has_two_overlays) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
323 if (sis_verbose > 0) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
324 printf |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
325 ("[SiS] detected M650/651 with 2 overlays\n"); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
326 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
327 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
328 sis_vga_engine = SIS_315_VGA; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
329 break; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
330 default: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
331 /* should never get here */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
332 sis_vga_engine = UNKNOWN_VGA; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
333 break; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
334 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
335 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
336 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
337 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
338 if (err && sis_verbose) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
339 printf("[SiS] Can't find chip\n"); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
340 } else { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
341 sis_probed = 1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
342 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
343 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
344 return err; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
345 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
346 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
347 int vixInit(void) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
348 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
349 uint8_t sr_data, cr_data, cr_data2; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
350 char *env_overlay_crt; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
351 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
352 if (!sis_probed) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
353 printf("[SiS] driver was not probed but is being initialized\n"); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
354 return (EINTR); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
355 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
356 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
357 /* JCP: this is WRONG. Need to coordinate w/ sisfb to use correct mem */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
358 /* map 16MB scary hack for now. */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
359 sis_mem_base = map_phys_mem(pci_info.base0, 0x1000000); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
360 /* sis_reg_base = map_phys_mem(pci_info.base1, 0x20000); */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
361 sis_iobase = pci_info.base2 & 0xFFFC; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
362 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
363 /* would like to use fb ioctl - or some other method - here to get |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
364 current resolution. */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
365 inSISIDXREG(SISCR, 0x12, cr_data); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
366 inSISIDXREG(SISCR, 0x07, cr_data2); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
367 sis_screen_height = |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
368 ((cr_data & 0xff) | ((uint16_t) (cr_data2 & 0x02) << 7) | |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
369 ((uint16_t) (cr_data2 & 0x40) << 3) | ((uint16_t) (sr_data & 0x02) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
370 << 9)) + 1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
371 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
372 inSISIDXREG(SISSR, 0x0b, sr_data); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
373 inSISIDXREG(SISCR, 0x01, cr_data); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
374 sis_screen_width = (((cr_data & 0xff) | |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
375 ((uint16_t) (sr_data & 0x0C) << 6)) + 1) * 8; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
376 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
377 inSISIDXREG(SISSR, Index_SR_Graphic_Mode, sr_data); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
378 if (sr_data & 0x20) /* interlaced mode */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
379 sis_vmode |= VMODE_INTERLACED; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
380 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
381 #if 0 /* getting back false data here... */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
382 /* CR9 bit 7 set = double scan active */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
383 inSISIDXREG(SISCR, 0x09, cr_data); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
384 if (cr_data & 0x40) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
385 sis_vmode |= VMODE_DOUBLESCAN; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
386 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
387 #endif |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
388 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
389 /* JCP: eventually I'd like to replace this with a call to sisfb |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
390 SISFB_GET_INFO ioctl to get video bridge info. Not for now, |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
391 since it requires a very new and not widely distributed version. */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
392 sis_init_video_bridge(); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
393 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
394 env_overlay_crt = getenv("VIDIX_CRT"); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
395 if (env_overlay_crt) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
396 int crt = atoi(env_overlay_crt); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
397 if (crt == 1 || crt == 2) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
398 sis_overlay_on_crt1 = (crt == 1); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
399 if (sis_verbose > 0) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
400 printf |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
401 ("[SiS] override: using overlay on CRT%d from VIDIX_CRT\n", |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
402 crt); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
403 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
404 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
405 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
406 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
407 return 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
408 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
409 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
410 void vixDestroy(void) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
411 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
412 /* unmap_phys_mem(sis_reg_base, 0x20000); */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
413 /* JCP: see above, hence also a hack. */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
414 unmap_phys_mem(sis_mem_base, 0x1000000); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
415 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
416 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
417 int vixGetCapability(vidix_capability_t * to) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
418 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
419 memcpy(to, &sis_cap, sizeof(vidix_capability_t)); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
420 return 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
421 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
422 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
423 static int is_supported_fourcc(uint32_t fourcc) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
424 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
425 switch (fourcc) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
426 case IMGFMT_YV12: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
427 case IMGFMT_I420: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
428 case IMGFMT_UYVY: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
429 case IMGFMT_YUY2: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
430 case IMGFMT_RGB15: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
431 case IMGFMT_RGB16: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
432 return 1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
433 default: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
434 return 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
435 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
436 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
437 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
438 int vixQueryFourcc(vidix_fourcc_t * to) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
439 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
440 if (is_supported_fourcc(to->fourcc)) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
441 to->depth = VID_DEPTH_8BPP | VID_DEPTH_16BPP | VID_DEPTH_32BPP; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
442 to->flags = VID_CAP_EXPAND | VID_CAP_SHRINK | VID_CAP_COLORKEY; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
443 return 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
444 } else |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
445 to->depth = to->flags = 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
446 return ENOSYS; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
447 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
448 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
449 static int bridge_in_slave_mode() |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
450 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
451 unsigned char usScratchP1_00; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
452 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
453 if (!(sis_vbflags & VB_VIDEOBRIDGE)) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
454 return 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
455 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
456 inSISIDXREG(SISPART1, 0x00, usScratchP1_00); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
457 if (((sis_vga_engine == SIS_300_VGA) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
458 && (usScratchP1_00 & 0xa0) == 0x20) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
459 || ((sis_vga_engine == SIS_315_VGA) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
460 && (usScratchP1_00 & 0x50) == 0x10)) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
461 return 1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
462 } else { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
463 return 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
464 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
465 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
466 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
467 /* This does not handle X dual head mode, since 1) vidix doesn't support it |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
468 and 2) it doesn't make sense for other gfx drivers */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
469 static void set_dispmode() |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
470 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
471 sis_bridge_is_slave = 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
472 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
473 if (bridge_in_slave_mode()) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
474 sis_bridge_is_slave = 1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
475 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
476 if ((sis_vbflags & VB_DISPMODE_MIRROR) || |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
477 (sis_bridge_is_slave && (sis_vbflags & DISPTYPE_DISP2))) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
478 if (sis_has_two_overlays) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
479 sis_displaymode = DISPMODE_MIRROR; /* TW: CRT1+CRT2 (2 overlays) */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
480 else if (!sis_overlay_on_crt1) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
481 sis_displaymode = DISPMODE_SINGLE2; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
482 else |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
483 sis_displaymode = DISPMODE_SINGLE1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
484 } else { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
485 if (sis_vbflags & DISPTYPE_DISP1) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
486 sis_displaymode = DISPMODE_SINGLE1; /* TW: CRT1 only */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
487 } else { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
488 sis_displaymode = DISPMODE_SINGLE2; /* TW: CRT2 only */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
489 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
490 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
491 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
492 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
493 static void set_disptype_regs() |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
494 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
495 switch (sis_displaymode) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
496 case DISPMODE_SINGLE1: /* TW: CRT1 only */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
497 if (sis_verbose > 2) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
498 printf("[SiS] Setting up overlay on CRT1\n"); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
499 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
500 if (sis_has_two_overlays) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
501 setsrregmask(0x06, 0x00, 0xc0); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
502 setsrregmask(0x32, 0x00, 0xc0); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
503 } else { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
504 setsrregmask(0x06, 0x00, 0xc0); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
505 setsrregmask(0x32, 0x00, 0xc0); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
506 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
507 break; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
508 case DISPMODE_SINGLE2: /* TW: CRT2 only */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
509 if (sis_verbose > 2) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
510 printf("[SiS] Setting up overlay on CRT2\n"); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
511 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
512 if (sis_has_two_overlays) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
513 setsrregmask(0x06, 0x80, 0xc0); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
514 setsrregmask(0x32, 0x80, 0xc0); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
515 } else { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
516 setsrregmask(0x06, 0x40, 0xc0); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
517 setsrregmask(0x32, 0x40, 0xc0); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
518 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
519 break; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
520 case DISPMODE_MIRROR: /* TW: CRT1 + CRT2 */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
521 default: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
522 if (sis_verbose > 2) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
523 printf("[SiS] Setting up overlay on CRT1 AND CRT2!\n"); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
524 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
525 setsrregmask(0x06, 0x80, 0xc0); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
526 setsrregmask(0x32, 0x80, 0xc0); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
527 break; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
528 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
529 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
530 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
531 static void init_overlay() |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
532 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
533 /* Initialize first overlay (CRT1) */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
534 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
535 /* Write-enable video registers */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
536 setvideoregmask(Index_VI_Control_Misc2, 0x80, 0x81); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
537 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
538 /* Disable overlay */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
539 setvideoregmask(Index_VI_Control_Misc0, 0x00, 0x02); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
540 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
541 /* Disable bobEnable */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
542 setvideoregmask(Index_VI_Control_Misc1, 0x02, 0x02); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
543 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
544 /* Reset scale control and contrast */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
545 setvideoregmask(Index_VI_Scale_Control, 0x60, 0x60); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
546 setvideoregmask(Index_VI_Contrast_Enh_Ctrl, 0x04, 0x1F); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
547 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
548 setvideoreg(Index_VI_Disp_Y_Buf_Preset_Low, 0x00); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
549 setvideoreg(Index_VI_Disp_Y_Buf_Preset_Middle, 0x00); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
550 setvideoreg(Index_VI_UV_Buf_Preset_Low, 0x00); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
551 setvideoreg(Index_VI_UV_Buf_Preset_Middle, 0x00); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
552 setvideoreg(Index_VI_Disp_Y_UV_Buf_Preset_High, 0x00); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
553 setvideoreg(Index_VI_Play_Threshold_Low, 0x00); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
554 setvideoreg(Index_VI_Play_Threshold_High, 0x00); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
555 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
556 /* may not want to init these here, could already be set to other |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
557 values by app? */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
558 setvideoregmask(Index_VI_Control_Misc2, 0x00, 0x01); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
559 setvideoregmask(Index_VI_Contrast_Enh_Ctrl, 0x04, 0x07); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
560 setvideoreg(Index_VI_Brightness, 0x20); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
561 if (sis_vga_engine == SIS_315_VGA) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
562 setvideoreg(Index_VI_Hue, 0x00); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
563 setvideoreg(Index_VI_Saturation, 0x00); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
564 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
565 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
566 /* Initialize second overlay (CRT2) */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
567 if (sis_has_two_overlays) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
568 /* Write-enable video registers */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
569 setvideoregmask(Index_VI_Control_Misc2, 0x81, 0x81); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
570 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
571 /* Disable overlay */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
572 setvideoregmask(Index_VI_Control_Misc0, 0x00, 0x02); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
573 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
574 /* Disable bobEnable */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
575 setvideoregmask(Index_VI_Control_Misc1, 0x02, 0x02); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
576 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
577 /* Reset scale control and contrast */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
578 setvideoregmask(Index_VI_Scale_Control, 0x60, 0x60); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
579 setvideoregmask(Index_VI_Contrast_Enh_Ctrl, 0x04, 0x1F); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
580 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
581 setvideoreg(Index_VI_Disp_Y_Buf_Preset_Low, 0x00); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
582 setvideoreg(Index_VI_Disp_Y_Buf_Preset_Middle, 0x00); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
583 setvideoreg(Index_VI_UV_Buf_Preset_Low, 0x00); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
584 setvideoreg(Index_VI_UV_Buf_Preset_Middle, 0x00); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
585 setvideoreg(Index_VI_Disp_Y_UV_Buf_Preset_High, 0x00); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
586 setvideoreg(Index_VI_Play_Threshold_Low, 0x00); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
587 setvideoreg(Index_VI_Play_Threshold_High, 0x00); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
588 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
589 setvideoregmask(Index_VI_Control_Misc2, 0x01, 0x01); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
590 setvideoregmask(Index_VI_Contrast_Enh_Ctrl, 0x04, 0x07); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
591 setvideoreg(Index_VI_Brightness, 0x20); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
592 if (sis_vga_engine == SIS_315_VGA) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
593 setvideoreg(Index_VI_Hue, 0x00); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
594 setvideoreg(Index_VI_Saturation, 0x00); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
595 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
596 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
597 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
598 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
599 int vixConfigPlayback(vidix_playback_t * info) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
600 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
601 SISOverlayRec overlay; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
602 int srcOffsetX = 0, srcOffsetY = 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
603 int sx, sy; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
604 int index = 0, iscrt2 = 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
605 int total_size; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
606 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
607 short src_w, drw_w; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
608 short src_h, drw_h; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
609 short src_x, drw_x; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
610 short src_y, drw_y; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
611 long dga_offset; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
612 int pitch; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
613 unsigned int i; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
614 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
615 if (!is_supported_fourcc(info->fourcc)) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
616 return -1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
617 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
618 /* set chipset/engine.dependent config info */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
619 /* which CRT to use, etc.? */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
620 switch (sis_vga_engine) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
621 case SIS_315_VGA: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
622 sis_shift_value = 1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
623 sis_equal.cap |= VEQ_CAP_SATURATION | VEQ_CAP_HUE; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
624 break; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
625 case SIS_300_VGA: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
626 default: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
627 sis_shift_value = 2; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
628 break; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
629 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
630 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
631 sis_displaymode = DISPMODE_SINGLE1; /* xV driver code in set_dispmode() */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
632 set_dispmode(); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
633 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
634 set_disptype_regs(); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
635 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
636 init_overlay(); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
637 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
638 /* get basic dimension info */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
639 src_x = info->src.x; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
640 src_y = info->src.y; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
641 src_w = info->src.w; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
642 src_h = info->src.h; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
643 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
644 drw_x = info->dest.x; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
645 drw_y = info->dest.y; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
646 drw_w = info->dest.w; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
647 drw_h = info->dest.h; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
648 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
649 switch (info->fourcc) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
650 case IMGFMT_YV12: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
651 case IMGFMT_I420: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
652 pitch = (src_w + 7) & ~7; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
653 total_size = (pitch * src_h * 3) >> 1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
654 break; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
655 case IMGFMT_YUY2: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
656 case IMGFMT_UYVY: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
657 case IMGFMT_RGB15: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
658 case IMGFMT_RGB16: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
659 pitch = ((src_w << 1) + 3) & ~3; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
660 total_size = pitch * src_h; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
661 break; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
662 default: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
663 return -1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
664 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
665 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
666 /* "allocate" memory for overlay! */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
667 /* start at 8MB = sisfb's "dri reserved space" - |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
668 really shouldn't hardcode though */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
669 /* XXX: JCP - this can use the sisfb FBIO_ALLOC ioctl to safely |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
670 allocate "video heap" memory... */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
671 dga_offset = 0x800000; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
672 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
673 /* use 7MB for now. need to calc/get real info from sisfb? */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
674 /* this can result in a LOT of frames - probably not necessary */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
675 info->num_frames = 0x700000 / (total_size * 2); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
676 if (info->num_frames > VID_PLAY_MAXFRAMES) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
677 info->num_frames = VID_PLAY_MAXFRAMES; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
678 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
679 info->dga_addr = sis_mem_base + dga_offset; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
680 info->dest.pitch.y = 16; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
681 info->dest.pitch.u = 16; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
682 info->dest.pitch.v = 16; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
683 info->offset.y = 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
684 info->offset.u = 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
685 info->offset.v = 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
686 info->frame_size = (total_size * 2); /* why times 2 ? */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
687 for (i = 0; i < info->num_frames; i++) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
688 info->offsets[i] = info->frame_size * i; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
689 /* save ptrs to mem buffers */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
690 sis_frames[i] = (dga_offset + info->offsets[i]); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
691 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
692 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
693 memset(&overlay, 0, sizeof(overlay)); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
694 overlay.pixelFormat = sis_format = info->fourcc; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
695 overlay.pitch = overlay.origPitch = pitch; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
696 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
697 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
698 overlay.keyOP = (sis_grkey.ckey.op == CKEY_TRUE ? |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
699 VI_ROP_DestKey : VI_ROP_Always); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
700 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
701 overlay.bobEnable = 0x00; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
702 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
703 overlay.SCREENheight = sis_screen_height; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
704 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
705 /* probably will not support X virtual screen > phys very well? */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
706 overlay.dstBox.x1 = drw_x; /* - pScrn->frameX0; */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
707 overlay.dstBox.x2 = drw_x + drw_w; /* - pScrn->frameX0; ??? */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
708 overlay.dstBox.y1 = drw_y; /* - pScrn->frameY0; */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
709 overlay.dstBox.y2 = drw_y + drw_h; /* - pScrn->frameY0; ??? */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
710 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
711 if ((overlay.dstBox.x1 > overlay.dstBox.x2) || |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
712 (overlay.dstBox.y1 > overlay.dstBox.y2)) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
713 return -1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
714 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
715 if ((overlay.dstBox.x2 < 0) || (overlay.dstBox.y2 < 0)) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
716 return -1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
717 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
718 if (overlay.dstBox.x1 < 0) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
719 srcOffsetX = src_w * (-overlay.dstBox.x1) / drw_w; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
720 overlay.dstBox.x1 = 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
721 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
722 if (overlay.dstBox.y1 < 0) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
723 srcOffsetY = src_h * (-overlay.dstBox.y1) / drw_h; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
724 overlay.dstBox.y1 = 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
725 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
726 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
727 switch (info->fourcc) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
728 case IMGFMT_YV12: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
729 info->dest.pitch.y = 16; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
730 sx = (src_x + srcOffsetX) & ~7; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
731 sy = (src_y + srcOffsetY) & ~1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
732 info->offset.y = sis_Yoff = sx + sy * pitch; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
733 /* JCP: NOTE reversed u & v here! Not sure why this is needed. |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
734 maybe mplayer & sis define U & V differently?? */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
735 info->offset.u = sis_Voff = |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
736 src_h * pitch + ((sx + sy * pitch / 2) >> 1); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
737 info->offset.v = sis_Uoff = |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
738 src_h * pitch * 5 / 4 + ((sx + sy * pitch / 2) >> 1); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
739 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
740 overlay.PSY = (sis_frames[0] + sis_Yoff) >> sis_shift_value; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
741 overlay.PSV = (sis_frames[0] + sis_Voff) >> sis_shift_value; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
742 overlay.PSU = (sis_frames[0] + sis_Uoff) >> sis_shift_value; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
743 break; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
744 case IMGFMT_I420: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
745 sx = (src_x + srcOffsetX) & ~7; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
746 sy = (src_y + srcOffsetY) & ~1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
747 info->offset.y = sis_Yoff = sx + sy * pitch; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
748 /* JCP: see above... */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
749 info->offset.u = sis_Voff = |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
750 src_h * pitch * 5 / 4 + ((sx + sy * pitch / 2) >> 1); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
751 info->offset.v = sis_Uoff = |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
752 src_h * pitch + ((sx + sy * pitch / 2) >> 1); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
753 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
754 overlay.PSY = (sis_frames[0] + sis_Yoff) >> sis_shift_value; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
755 overlay.PSV = (sis_frames[0] + sis_Voff) >> sis_shift_value; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
756 overlay.PSU = (sis_frames[0] + sis_Uoff) >> sis_shift_value; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
757 break; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
758 case IMGFMT_YUY2: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
759 case IMGFMT_UYVY: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
760 case IMGFMT_RGB16: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
761 case IMGFMT_RGB15: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
762 default: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
763 sx = (src_x + srcOffsetX) & ~1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
764 sy = (src_y + srcOffsetY); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
765 info->offset.y = sis_Yoff = sx * 2 + sy * pitch; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
766 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
767 overlay.PSY = (sis_frames[0] + sis_Yoff) >> sis_shift_value; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
768 break; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
769 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
770 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
771 /* FIXME: is it possible that srcW < 0? */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
772 overlay.srcW = src_w - (sx - src_x); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
773 overlay.srcH = src_h - (sy - src_y); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
774 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
775 /* JCP: what to do about this? */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
776 #if 0 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
777 if ((pPriv->oldx1 != overlay.dstBox.x1) || |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
778 (pPriv->oldx2 != overlay.dstBox.x2) || |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
779 (pPriv->oldy1 != overlay.dstBox.y1) || |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
780 (pPriv->oldy2 != overlay.dstBox.y2)) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
781 pPriv->mustwait = 1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
782 pPriv->oldx1 = overlay.dstBox.x1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
783 pPriv->oldx2 = overlay.dstBox.x2; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
784 pPriv->oldy1 = overlay.dstBox.y1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
785 pPriv->oldy2 = overlay.dstBox.y2; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
786 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
787 #endif |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
788 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
789 /* set merge line buffer */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
790 merge_line_buf(overlay.srcW > 384); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
791 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
792 /* calculate line buffer length */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
793 set_line_buf_size(&overlay); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
794 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
795 if (sis_displaymode == DISPMODE_SINGLE2) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
796 if (sis_has_two_overlays) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
797 /* TW: On chips with two overlays we use |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
798 * overlay 2 for CRT2 */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
799 index = 1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
800 iscrt2 = 1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
801 } else { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
802 /* TW: On chips with only one overlay we |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
803 * use that only overlay for CRT2 */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
804 index = 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
805 iscrt2 = 1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
806 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
807 overlay.VBlankActiveFunc = vblank_active_CRT2; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
808 /* overlay.GetScanLineFunc = get_scanline_CRT2; */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
809 } else { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
810 index = 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
811 iscrt2 = 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
812 overlay.VBlankActiveFunc = vblank_active_CRT1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
813 /* overlay.GetScanLineFunc = get_scanline_CRT1; */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
814 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
815 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
816 /* calc scale factor (to use below) */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
817 calc_scale_factor(&overlay, index, iscrt2); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
818 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
819 /* Select video1 (used for CRT1) or video2 (used for CRT2) */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
820 setvideoregmask(Index_VI_Control_Misc2, index, 0x01); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
821 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
822 set_format(&overlay); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
823 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
824 set_colorkey(); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
825 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
826 vixPlaybackSetEq(&sis_equal); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
827 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
828 /* set up video overlay registers */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
829 set_overlay(&overlay, index); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
830 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
831 /* prevent badness if bits are not at default setting */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
832 setvideoregmask(Index_VI_Control_Misc1, 0x00, 0x01); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
833 setvideoregmask(Index_VI_Control_Misc2, 0x00, 0x04); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
834 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
835 /* JCP: Xv driver implementation loops back over above code to |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
836 setup mirror CRT2 */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
837 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
838 return 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
839 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
840 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
841 int vixPlaybackOn(void) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
842 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
843 setvideoregmask(Index_VI_Control_Misc0, 0x02, 0x02); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
844 return 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
845 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
846 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
847 int vixPlaybackOff(void) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
848 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
849 unsigned char sridx, cridx; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
850 sridx = inSISREG(SISSR); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
851 cridx = inSISREG(SISCR); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
852 close_overlay(); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
853 outSISREG(SISSR, sridx); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
854 outSISREG(SISCR, cridx); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
855 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
856 return 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
857 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
858 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
859 int vixPlaybackFrameSelect(unsigned int frame) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
860 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
861 uint8_t data; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
862 int index = 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
863 uint32_t PSY; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
864 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
865 if (sis_displaymode == DISPMODE_SINGLE2 && sis_has_two_overlays) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
866 index = 1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
867 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
868 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
869 PSY = (sis_frames[frame] + sis_Yoff) >> sis_shift_value; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
870 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
871 /* Unlock address registers */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
872 data = getvideoreg(Index_VI_Control_Misc1); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
873 setvideoreg(Index_VI_Control_Misc1, data | 0x20); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
874 /* TEST: Is this required? */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
875 setvideoreg(Index_VI_Control_Misc1, data | 0x20); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
876 /* TEST end */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
877 /* TEST: Is this required? */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
878 if (sis_vga_engine == SIS_315_VGA) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
879 setvideoreg(Index_VI_Control_Misc3, 0x00); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
880 /* TEST end */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
881 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
882 /* set Y start address */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
883 setvideoreg(Index_VI_Disp_Y_Buf_Start_Low, (uint8_t) (PSY)); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
884 setvideoreg(Index_VI_Disp_Y_Buf_Start_Middle, (uint8_t) ((PSY) >> 8)); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
885 setvideoreg(Index_VI_Disp_Y_Buf_Start_High, (uint8_t) ((PSY) >> 16)); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
886 /* set 310/325 series overflow bits for Y plane */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
887 if (sis_vga_engine == SIS_315_VGA) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
888 setvideoreg(Index_VI_Y_Buf_Start_Over, |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
889 ((uint8_t) ((PSY) >> 24) & 0x01)); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
890 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
891 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
892 /* Set U/V data if using plane formats */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
893 if ((sis_format == IMGFMT_YV12) || (sis_format == IMGFMT_I420)) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
894 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
895 uint32_t PSU, PSV; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
896 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
897 PSU = (sis_frames[frame] + sis_Uoff) >> sis_shift_value; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
898 PSV = (sis_frames[frame] + sis_Voff) >> sis_shift_value; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
899 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
900 /* set U/V start address */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
901 setvideoreg(Index_VI_U_Buf_Start_Low, (uint8_t) PSU); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
902 setvideoreg(Index_VI_U_Buf_Start_Middle, (uint8_t) (PSU >> 8)); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
903 setvideoreg(Index_VI_U_Buf_Start_High, (uint8_t) (PSU >> 16)); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
904 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
905 setvideoreg(Index_VI_V_Buf_Start_Low, (uint8_t) PSV); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
906 setvideoreg(Index_VI_V_Buf_Start_Middle, (uint8_t) (PSV >> 8)); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
907 setvideoreg(Index_VI_V_Buf_Start_High, (uint8_t) (PSV >> 16)); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
908 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
909 /* 310/325 series overflow bits */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
910 if (sis_vga_engine == SIS_315_VGA) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
911 setvideoreg(Index_VI_U_Buf_Start_Over, |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
912 ((uint8_t) (PSU >> 24) & 0x01)); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
913 setvideoreg(Index_VI_V_Buf_Start_Over, |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
914 ((uint8_t) (PSV >> 24) & 0x01)); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
915 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
916 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
917 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
918 if (sis_vga_engine == SIS_315_VGA) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
919 /* Trigger register copy for 310 series */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
920 setvideoreg(Index_VI_Control_Misc3, 1 << index); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
921 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
922 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
923 /* Lock the address registers */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
924 setvideoregmask(Index_VI_Control_Misc1, 0x00, 0x20); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
925 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
926 return 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
927 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
928 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
929 int vixGetGrKeys(vidix_grkey_t * grkey) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
930 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
931 memcpy(grkey, &sis_grkey, sizeof(vidix_grkey_t)); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
932 return 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
933 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
934 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
935 int vixSetGrKeys(const vidix_grkey_t * grkey) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
936 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
937 memcpy(&sis_grkey, grkey, sizeof(vidix_grkey_t)); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
938 set_colorkey(); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
939 return 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
940 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
941 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
942 int vixPlaybackGetEq(vidix_video_eq_t * eq) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
943 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
944 memcpy(eq, &sis_equal, sizeof(vidix_video_eq_t)); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
945 return 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
946 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
947 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
948 int vixPlaybackSetEq(const vidix_video_eq_t * eq) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
949 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
950 int br, sat, cr, hue; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
951 if (eq->cap & VEQ_CAP_BRIGHTNESS) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
952 sis_equal.brightness = eq->brightness; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
953 if (eq->cap & VEQ_CAP_CONTRAST) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
954 sis_equal.contrast = eq->contrast; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
955 if (eq->cap & VEQ_CAP_SATURATION) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
956 sis_equal.saturation = eq->saturation; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
957 if (eq->cap & VEQ_CAP_HUE) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
958 sis_equal.hue = eq->hue; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
959 if (eq->cap & VEQ_CAP_RGB_INTENSITY) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
960 sis_equal.red_intensity = eq->red_intensity; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
961 sis_equal.green_intensity = eq->green_intensity; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
962 sis_equal.blue_intensity = eq->blue_intensity; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
963 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
964 sis_equal.flags = eq->flags; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
965 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
966 cr = (sis_equal.contrast + 1000) * 7 / 2000; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
967 if (cr < 0) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
968 cr = 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
969 if (cr > 7) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
970 cr = 7; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
971 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
972 br = sis_equal.brightness * 127 / 1000; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
973 if (br < -128) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
974 br = -128; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
975 if (br > 127) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
976 br = 127; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
977 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
978 sat = (sis_equal.saturation * 7) / 1000; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
979 if (sat < -7) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
980 sat = -7; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
981 if (sat > 7) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
982 sat = 7; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
983 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
984 hue = sis_equal.hue * 7 / 1000; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
985 if (hue < -8) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
986 hue = -8; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
987 if (hue > 7) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
988 hue = 7; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
989 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
990 set_brightness(br); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
991 set_contrast(cr); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
992 if (sis_vga_engine == SIS_315_VGA) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
993 set_saturation(sat); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
994 set_hue(hue); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
995 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
996 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
997 return 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
998 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
999 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1000 static void set_overlay(SISOverlayPtr pOverlay, int index) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1001 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1002 uint16_t pitch = 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1003 uint8_t h_over = 0, v_over = 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1004 uint16_t top, bottom, left, right; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1005 uint16_t screenX = sis_screen_width; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1006 uint16_t screenY = sis_screen_height; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1007 uint8_t data; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1008 uint32_t watchdog; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1009 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1010 top = pOverlay->dstBox.y1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1011 bottom = pOverlay->dstBox.y2; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1012 if (bottom > screenY) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1013 bottom = screenY; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1014 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1015 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1016 left = pOverlay->dstBox.x1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1017 right = pOverlay->dstBox.x2; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1018 if (right > screenX) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1019 right = screenX; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1020 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1021 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1022 /* JCP: these aren't really tested... */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1023 /* TW: DoubleScan modes require Y coordinates * 2 */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1024 if (sis_vmode & VMODE_DOUBLESCAN) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1025 top <<= 1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1026 bottom <<= 1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1027 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1028 /* TW: Interlace modes require Y coordinates / 2 */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1029 if (sis_vmode & VMODE_INTERLACED) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1030 top >>= 1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1031 bottom >>= 1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1032 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1033 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1034 h_over = (((left >> 8) & 0x0f) | ((right >> 4) & 0xf0)); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1035 v_over = (((top >> 8) & 0x0f) | ((bottom >> 4) & 0xf0)); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1036 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1037 pitch = pOverlay->pitch >> sis_shift_value; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1038 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1039 /* set line buffer size */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1040 setvideoreg(Index_VI_Line_Buffer_Size, pOverlay->lineBufSize); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1041 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1042 /* set color key mode */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1043 setvideoregmask(Index_VI_Key_Overlay_OP, pOverlay->keyOP, 0x0F); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1044 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1045 /* TW: We don't have to wait for vertical retrace in all cases */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1046 /* JCP: be safe for now. */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1047 if (1 /*pPriv->mustwait */ ) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1048 watchdog = WATCHDOG_DELAY; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1049 while (pOverlay->VBlankActiveFunc() && --watchdog); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1050 watchdog = WATCHDOG_DELAY; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1051 while ((!pOverlay->VBlankActiveFunc()) && --watchdog); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1052 if (!watchdog && sis_verbose > 0) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1053 printf("[SiS]: timed out waiting for vertical retrace\n"); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1054 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1055 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1056 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1057 /* Unlock address registers */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1058 data = getvideoreg(Index_VI_Control_Misc1); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1059 setvideoreg(Index_VI_Control_Misc1, data | 0x20); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1060 /* TEST: Is this required? */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1061 setvideoreg(Index_VI_Control_Misc1, data | 0x20); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1062 /* TEST end */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1063 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1064 /* TEST: Is this required? */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1065 if (sis_vga_engine == SIS_315_VGA) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1066 setvideoreg(Index_VI_Control_Misc3, 0x00); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1067 /* TEST end */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1068 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1069 /* Set Y buf pitch */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1070 setvideoreg(Index_VI_Disp_Y_Buf_Pitch_Low, (uint8_t) (pitch)); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1071 setvideoregmask(Index_VI_Disp_Y_UV_Buf_Pitch_Middle, |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1072 (uint8_t) (pitch >> 8), 0x0f); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1073 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1074 /* Set Y start address */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1075 setvideoreg(Index_VI_Disp_Y_Buf_Start_Low, (uint8_t) (pOverlay->PSY)); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1076 setvideoreg(Index_VI_Disp_Y_Buf_Start_Middle, |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1077 (uint8_t) ((pOverlay->PSY) >> 8)); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1078 setvideoreg(Index_VI_Disp_Y_Buf_Start_High, |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1079 (uint8_t) ((pOverlay->PSY) >> 16)); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1080 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1081 /* set 310/325 series overflow bits for Y plane */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1082 if (sis_vga_engine == SIS_315_VGA) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1083 setvideoreg(Index_VI_Disp_Y_Buf_Pitch_High, |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1084 (uint8_t) (pitch >> 12)); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1085 setvideoreg(Index_VI_Y_Buf_Start_Over, |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1086 ((uint8_t) ((pOverlay->PSY) >> 24) & 0x01)); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1087 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1088 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1089 /* Set U/V data if using plane formats */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1090 if ((pOverlay->pixelFormat == IMGFMT_YV12) || |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1091 (pOverlay->pixelFormat == IMGFMT_I420)) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1092 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1093 uint32_t PSU, PSV; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1094 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1095 PSU = pOverlay->PSU; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1096 PSV = pOverlay->PSV; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1097 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1098 /* Set U/V pitch */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1099 setvideoreg(Index_VI_Disp_UV_Buf_Pitch_Low, |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1100 (uint8_t) (pitch >> 1)); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1101 setvideoregmask(Index_VI_Disp_Y_UV_Buf_Pitch_Middle, |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1102 (uint8_t) (pitch >> 5), 0xf0); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1103 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1104 /* set U/V start address */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1105 setvideoreg(Index_VI_U_Buf_Start_Low, (uint8_t) PSU); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1106 setvideoreg(Index_VI_U_Buf_Start_Middle, (uint8_t) (PSU >> 8)); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1107 setvideoreg(Index_VI_U_Buf_Start_High, (uint8_t) (PSU >> 16)); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1108 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1109 setvideoreg(Index_VI_V_Buf_Start_Low, (uint8_t) PSV); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1110 setvideoreg(Index_VI_V_Buf_Start_Middle, (uint8_t) (PSV >> 8)); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1111 setvideoreg(Index_VI_V_Buf_Start_High, (uint8_t) (PSV >> 16)); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1112 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1113 /* 310/325 series overflow bits */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1114 if (sis_vga_engine == SIS_315_VGA) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1115 setvideoreg(Index_VI_Disp_UV_Buf_Pitch_High, |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1116 (uint8_t) (pitch >> 13)); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1117 setvideoreg(Index_VI_U_Buf_Start_Over, |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1118 ((uint8_t) (PSU >> 24) & 0x01)); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1119 setvideoreg(Index_VI_V_Buf_Start_Over, |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1120 ((uint8_t) (PSV >> 24) & 0x01)); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1121 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1122 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1123 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1124 if (sis_vga_engine == SIS_315_VGA) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1125 /* Trigger register copy for 310 series */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1126 setvideoreg(Index_VI_Control_Misc3, 1 << index); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1127 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1128 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1129 /* set scale factor */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1130 setvideoreg(Index_VI_Hor_Post_Up_Scale_Low, |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1131 (uint8_t) (pOverlay->HUSF)); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1132 setvideoreg(Index_VI_Hor_Post_Up_Scale_High, |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1133 (uint8_t) ((pOverlay->HUSF) >> 8)); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1134 setvideoreg(Index_VI_Ver_Up_Scale_Low, (uint8_t) (pOverlay->VUSF)); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1135 setvideoreg(Index_VI_Ver_Up_Scale_High, |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1136 (uint8_t) ((pOverlay->VUSF) >> 8)); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1137 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1138 setvideoregmask(Index_VI_Scale_Control, (pOverlay->IntBit << 3) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1139 | (pOverlay->wHPre), 0x7f); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1140 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1141 /* set destination window position */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1142 setvideoreg(Index_VI_Win_Hor_Disp_Start_Low, (uint8_t) left); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1143 setvideoreg(Index_VI_Win_Hor_Disp_End_Low, (uint8_t) right); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1144 setvideoreg(Index_VI_Win_Hor_Over, (uint8_t) h_over); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1145 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1146 setvideoreg(Index_VI_Win_Ver_Disp_Start_Low, (uint8_t) top); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1147 setvideoreg(Index_VI_Win_Ver_Disp_End_Low, (uint8_t) bottom); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1148 setvideoreg(Index_VI_Win_Ver_Over, (uint8_t) v_over); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1149 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1150 setvideoregmask(Index_VI_Control_Misc1, pOverlay->bobEnable, 0x1a); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1151 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1152 /* Lock the address registers */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1153 setvideoregmask(Index_VI_Control_Misc1, 0x00, 0x20); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1154 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1155 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1156 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1157 /* TW: Overlay MUST NOT be switched off while beam is over it */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1158 static void close_overlay() |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1159 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1160 uint32_t watchdog; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1161 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1162 if ((sis_displaymode == DISPMODE_SINGLE2) || |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1163 (sis_displaymode == DISPMODE_MIRROR)) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1164 if (sis_has_two_overlays) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1165 setvideoregmask(Index_VI_Control_Misc2, 0x01, 0x01); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1166 watchdog = WATCHDOG_DELAY; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1167 while (vblank_active_CRT2() && --watchdog); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1168 watchdog = WATCHDOG_DELAY; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1169 while ((!vblank_active_CRT2()) && --watchdog); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1170 setvideoregmask(Index_VI_Control_Misc0, 0x00, 0x02); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1171 watchdog = WATCHDOG_DELAY; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1172 while (vblank_active_CRT2() && --watchdog); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1173 watchdog = WATCHDOG_DELAY; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1174 while ((!vblank_active_CRT2()) && --watchdog); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1175 } else if (sis_displaymode == DISPMODE_SINGLE2) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1176 setvideoregmask(Index_VI_Control_Misc2, 0x00, 0x01); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1177 watchdog = WATCHDOG_DELAY; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1178 while (vblank_active_CRT1() && --watchdog); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1179 watchdog = WATCHDOG_DELAY; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1180 while ((!vblank_active_CRT1()) && --watchdog); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1181 setvideoregmask(Index_VI_Control_Misc0, 0x00, 0x02); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1182 watchdog = WATCHDOG_DELAY; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1183 while (vblank_active_CRT1() && --watchdog); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1184 watchdog = WATCHDOG_DELAY; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1185 while ((!vblank_active_CRT1()) && --watchdog); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1186 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1187 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1188 if ((sis_displaymode == DISPMODE_SINGLE1) || |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1189 (sis_displaymode == DISPMODE_MIRROR)) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1190 setvideoregmask(Index_VI_Control_Misc2, 0x00, 0x01); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1191 watchdog = WATCHDOG_DELAY; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1192 while (vblank_active_CRT1() && --watchdog); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1193 watchdog = WATCHDOG_DELAY; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1194 while ((!vblank_active_CRT1()) && --watchdog); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1195 setvideoregmask(Index_VI_Control_Misc0, 0x00, 0x02); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1196 watchdog = WATCHDOG_DELAY; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1197 while (vblank_active_CRT1() && --watchdog); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1198 watchdog = WATCHDOG_DELAY; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1199 while ((!vblank_active_CRT1()) && --watchdog); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1200 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1201 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1202 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1203 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1204 static void |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1205 calc_scale_factor(SISOverlayPtr pOverlay, int index, int iscrt2) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1206 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1207 uint32_t i = 0, mult = 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1208 int flag = 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1209 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1210 int dstW = pOverlay->dstBox.x2 - pOverlay->dstBox.x1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1211 int dstH = pOverlay->dstBox.y2 - pOverlay->dstBox.y1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1212 int srcW = pOverlay->srcW; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1213 int srcH = pOverlay->srcH; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1214 /* uint16_t LCDheight = pSiS->LCDheight; */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1215 int srcPitch = pOverlay->origPitch; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1216 int origdstH = dstH; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1217 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1218 /* get rid of warnings for now */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1219 index = index; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1220 iscrt2 = iscrt2; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1221 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1222 #if 0 /* JCP: don't bother with this for now. */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1223 /* TW: Stretch image due to idiotic LCD "auto"-scaling on LVDS (and 630+301B) */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1224 if (pSiS->VBFlags & CRT2_LCD) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1225 if (sis_bridge_is_slave) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1226 if (pSiS->VBFlags & VB_LVDS) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1227 dstH = (dstH * LCDheight) / pOverlay->SCREENheight; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1228 } else if ((sis_vga_engine == SIS_300_VGA) && |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1229 (pSiS-> |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1230 VBFlags & (VB_301B | VB_302B | VB_301LV | |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1231 VB_302LV))) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1232 dstH = (dstH * LCDheight) / pOverlay->SCREENheight; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1233 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1234 } else if (iscrt2) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1235 if (pSiS->VBFlags & VB_LVDS) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1236 dstH = (dstH * LCDheight) / pOverlay->SCREENheight; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1237 if (sis_displaymode == DISPMODE_MIRROR) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1238 flag = 1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1239 } else if ((sis_vga_engine == SIS_300_VGA) && |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1240 (pSiS-> |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1241 VBFlags & (VB_301B | VB_302B | VB_301LV | |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1242 VB_302LV))) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1243 dstH = (dstH * LCDheight) / pOverlay->SCREENheight; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1244 if (sis_displaymode == DISPMODE_MIRROR) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1245 flag = 1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1246 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1247 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1248 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1249 #endif |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1250 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1251 /* TW: For double scan modes, we need to double the height |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1252 * (Perhaps we also need to scale LVDS, but I'm not sure.) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1253 * On 310/325 series, we need to double the width as well. |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1254 * Interlace mode vice versa. |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1255 */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1256 if (sis_vmode & VMODE_DOUBLESCAN) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1257 dstH = origdstH << 1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1258 flag = 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1259 if (sis_vga_engine == SIS_315_VGA) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1260 dstW <<= 1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1261 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1262 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1263 if (sis_vmode & VMODE_INTERLACED) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1264 dstH = origdstH >> 1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1265 flag = 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1266 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1267 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1268 if (dstW < OVERLAY_MIN_WIDTH) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1269 dstW = OVERLAY_MIN_WIDTH; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1270 if (dstW == srcW) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1271 pOverlay->HUSF = 0x00; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1272 pOverlay->IntBit = 0x05; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1273 pOverlay->wHPre = 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1274 } else if (dstW > srcW) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1275 dstW += 2; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1276 pOverlay->HUSF = (srcW << 16) / dstW; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1277 pOverlay->IntBit = 0x04; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1278 pOverlay->wHPre = 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1279 } else { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1280 int tmpW = dstW; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1281 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1282 /* TW: It seems, the hardware can't scale below factor .125 (=1/8) if the |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1283 pitch isn't a multiple of 256. |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1284 TODO: Test this on the 310/325 series! |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1285 */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1286 if ((srcPitch % 256) || (srcPitch < 256)) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1287 if (((dstW * 1000) / srcW) < 125) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1288 dstW = tmpW = ((srcW * 125) / 1000) + 1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1289 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1290 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1291 i = 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1292 pOverlay->IntBit = 0x01; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1293 while (srcW >= tmpW) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1294 tmpW <<= 1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1295 i++; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1296 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1297 pOverlay->wHPre = (uint8_t) (i - 1); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1298 dstW <<= (i - 1); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1299 if ((srcW % dstW)) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1300 pOverlay->HUSF = ((srcW - dstW) << 16) / dstW; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1301 else |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1302 pOverlay->HUSF = 0x00; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1303 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1304 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1305 if (dstH < OVERLAY_MIN_HEIGHT) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1306 dstH = OVERLAY_MIN_HEIGHT; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1307 if (dstH == srcH) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1308 pOverlay->VUSF = 0x00; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1309 pOverlay->IntBit |= 0x0A; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1310 } else if (dstH > srcH) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1311 dstH += 0x02; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1312 pOverlay->VUSF = (srcH << 16) / dstH; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1313 pOverlay->IntBit |= 0x08; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1314 } else { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1315 uint32_t realI; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1316 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1317 i = realI = srcH / dstH; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1318 pOverlay->IntBit |= 0x02; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1319 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1320 if (i < 2) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1321 pOverlay->VUSF = ((srcH - dstH) << 16) / dstH; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1322 /* TW: Needed for LCD-scaling modes */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1323 if ((flag) && (mult = (srcH / origdstH)) >= 2) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1324 pOverlay->pitch /= mult; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1325 } else { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1326 #if 0 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1327 if (((pOverlay->bobEnable & 0x08) == 0x00) && |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1328 (((srcPitch * i) >> 2) > 0xFFF)) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1329 pOverlay->bobEnable |= 0x08; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1330 srcPitch >>= 1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1331 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1332 #endif |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1333 if (((srcPitch * i) >> 2) > 0xFFF) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1334 i = (0xFFF * 2 / srcPitch); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1335 pOverlay->VUSF = 0xFFFF; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1336 } else { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1337 dstH = i * dstH; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1338 if (srcH % dstH) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1339 pOverlay->VUSF = ((srcH - dstH) << 16) / dstH; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1340 else |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1341 pOverlay->VUSF = 0x00; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1342 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1343 /* set video frame buffer offset */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1344 pOverlay->pitch = (uint16_t) (srcPitch * i); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1345 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1346 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1347 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1348 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1349 static void set_line_buf_size(SISOverlayPtr pOverlay) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1350 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1351 uint8_t preHIDF; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1352 uint32_t i; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1353 uint32_t line = pOverlay->srcW; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1354 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1355 if ((pOverlay->pixelFormat == IMGFMT_YV12) || |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1356 (pOverlay->pixelFormat == IMGFMT_I420)) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1357 preHIDF = pOverlay->wHPre & 0x07; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1358 switch (preHIDF) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1359 case 3: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1360 if ((line & 0xffffff00) == line) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1361 i = (line >> 8); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1362 else |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1363 i = (line >> 8) + 1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1364 pOverlay->lineBufSize = (uint8_t) (i * 32 - 1); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1365 break; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1366 case 4: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1367 if ((line & 0xfffffe00) == line) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1368 i = (line >> 9); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1369 else |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1370 i = (line >> 9) + 1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1371 pOverlay->lineBufSize = (uint8_t) (i * 64 - 1); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1372 break; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1373 case 5: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1374 if ((line & 0xfffffc00) == line) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1375 i = (line >> 10); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1376 else |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1377 i = (line >> 10) + 1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1378 pOverlay->lineBufSize = (uint8_t) (i * 128 - 1); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1379 break; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1380 case 6: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1381 if ((line & 0xfffff800) == line) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1382 i = (line >> 11); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1383 else |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1384 i = (line >> 11) + 1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1385 pOverlay->lineBufSize = (uint8_t) (i * 256 - 1); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1386 break; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1387 default: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1388 if ((line & 0xffffff80) == line) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1389 i = (line >> 7); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1390 else |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1391 i = (line >> 7) + 1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1392 pOverlay->lineBufSize = (uint8_t) (i * 16 - 1); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1393 break; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1394 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1395 } else { /* YUV2, UYVY */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1396 if ((line & 0xffffff8) == line) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1397 i = (line >> 3); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1398 else |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1399 i = (line >> 3) + 1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1400 pOverlay->lineBufSize = (uint8_t) (i - 1); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1401 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1402 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1403 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1404 static void merge_line_buf(int enable) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1405 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1406 if (enable) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1407 switch (sis_displaymode) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1408 case DISPMODE_SINGLE1: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1409 if (sis_has_two_overlays) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1410 /* dual line merge */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1411 setvideoregmask(Index_VI_Control_Misc2, 0x10, 0x11); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1412 setvideoregmask(Index_VI_Control_Misc1, 0x00, 0x04); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1413 } else { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1414 setvideoregmask(Index_VI_Control_Misc2, 0x10, 0x11); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1415 setvideoregmask(Index_VI_Control_Misc1, 0x00, 0x04); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1416 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1417 break; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1418 case DISPMODE_SINGLE2: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1419 if (sis_has_two_overlays) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1420 /* line merge */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1421 setvideoregmask(Index_VI_Control_Misc2, 0x01, 0x11); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1422 setvideoregmask(Index_VI_Control_Misc1, 0x04, 0x04); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1423 } else { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1424 setvideoregmask(Index_VI_Control_Misc2, 0x10, 0x11); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1425 setvideoregmask(Index_VI_Control_Misc1, 0x00, 0x04); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1426 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1427 break; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1428 case DISPMODE_MIRROR: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1429 default: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1430 /* line merge */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1431 setvideoregmask(Index_VI_Control_Misc2, 0x00, 0x11); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1432 setvideoregmask(Index_VI_Control_Misc1, 0x04, 0x04); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1433 if (sis_has_two_overlays) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1434 /* line merge */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1435 setvideoregmask(Index_VI_Control_Misc2, 0x01, 0x11); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1436 setvideoregmask(Index_VI_Control_Misc1, 0x04, 0x04); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1437 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1438 break; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1439 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1440 } else { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1441 switch (sis_displaymode) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1442 case DISPMODE_SINGLE1: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1443 setvideoregmask(Index_VI_Control_Misc2, 0x00, 0x11); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1444 setvideoregmask(Index_VI_Control_Misc1, 0x00, 0x04); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1445 break; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1446 case DISPMODE_SINGLE2: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1447 if (sis_has_two_overlays) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1448 setvideoregmask(Index_VI_Control_Misc2, 0x01, 0x11); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1449 setvideoregmask(Index_VI_Control_Misc1, 0x00, 0x04); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1450 } else { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1451 setvideoregmask(Index_VI_Control_Misc2, 0x00, 0x11); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1452 setvideoregmask(Index_VI_Control_Misc1, 0x00, 0x04); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1453 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1454 break; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1455 case DISPMODE_MIRROR: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1456 default: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1457 setvideoregmask(Index_VI_Control_Misc2, 0x00, 0x11); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1458 setvideoregmask(Index_VI_Control_Misc1, 0x00, 0x04); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1459 if (sis_has_two_overlays) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1460 setvideoregmask(Index_VI_Control_Misc2, 0x01, 0x11); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1461 setvideoregmask(Index_VI_Control_Misc1, 0x00, 0x04); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1462 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1463 break; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1464 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1465 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1466 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1467 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1468 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1469 static void set_format(SISOverlayPtr pOverlay) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1470 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1471 uint8_t fmt; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1472 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1473 switch (pOverlay->pixelFormat) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1474 case IMGFMT_YV12: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1475 case IMGFMT_I420: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1476 fmt = 0x0c; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1477 break; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1478 case IMGFMT_YUY2: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1479 fmt = 0x28; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1480 break; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1481 case IMGFMT_UYVY: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1482 fmt = 0x08; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1483 break; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1484 case IMGFMT_RGB15: /* D[5:4] : 00 RGB555, 01 RGB 565 */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1485 fmt = 0x00; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1486 break; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1487 case IMGFMT_RGB16: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1488 fmt = 0x10; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1489 break; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1490 default: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1491 fmt = 0x00; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1492 break; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1493 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1494 setvideoregmask(Index_VI_Control_Misc0, fmt, 0x7c); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1495 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1496 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1497 static void set_colorkey() |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1498 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1499 uint8_t r, g, b; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1500 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1501 b = (uint8_t) sis_grkey.ckey.blue; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1502 g = (uint8_t) sis_grkey.ckey.green; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1503 r = (uint8_t) sis_grkey.ckey.red; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1504 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1505 /* set color key mode */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1506 setvideoregmask(Index_VI_Key_Overlay_OP, |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1507 sis_grkey.ckey.op == CKEY_TRUE ? |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1508 VI_ROP_DestKey : VI_ROP_Always, 0x0F); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1509 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1510 /* set colorkey values */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1511 setvideoreg(Index_VI_Overlay_ColorKey_Blue_Min, (uint8_t) b); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1512 setvideoreg(Index_VI_Overlay_ColorKey_Green_Min, (uint8_t) g); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1513 setvideoreg(Index_VI_Overlay_ColorKey_Red_Min, (uint8_t) r); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1514 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1515 setvideoreg(Index_VI_Overlay_ColorKey_Blue_Max, (uint8_t) b); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1516 setvideoreg(Index_VI_Overlay_ColorKey_Green_Max, (uint8_t) g); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1517 setvideoreg(Index_VI_Overlay_ColorKey_Red_Max, (uint8_t) r); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1518 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1519 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1520 static void set_brightness(uint8_t brightness) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1521 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1522 setvideoreg(Index_VI_Brightness, brightness); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1523 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1524 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1525 static void set_contrast(uint8_t contrast) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1526 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1527 setvideoregmask(Index_VI_Contrast_Enh_Ctrl, contrast, 0x07); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1528 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1529 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1530 /* Next 3 functions are 310/325 series only */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1531 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1532 static void set_saturation(char saturation) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1533 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1534 uint8_t temp = 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1535 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1536 if (saturation < 0) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1537 temp |= 0x88; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1538 saturation = -saturation; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1539 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1540 temp |= (saturation & 0x07); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1541 temp |= ((saturation & 0x07) << 4); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1542 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1543 setvideoreg(Index_VI_Saturation, temp); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1544 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1545 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1546 static void set_hue(uint8_t hue) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1547 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1548 setvideoreg(Index_VI_Hue, (hue & 0x08) ? (hue ^ 0x07) : hue); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1549 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1550 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1551 #if 0 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1552 /* JCP: not used (I don't think it's correct anyway) */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1553 static void set_alpha(uint8_t alpha) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1554 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1555 uint8_t data; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1556 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1557 data = getvideoreg(Index_VI_Key_Overlay_OP); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1558 data &= 0x0F; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1559 setvideoreg(Index_VI_Key_Overlay_OP, data | (alpha << 4)); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1560 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1561 #endif |