Mercurial > mplayer.hg
annotate vidix/drivers/sis_vid.c @ 21749:f26334cd77fd
audio.xml & bugreports.xml synced with r21764
author | Gabrov |
---|---|
date | Mon, 25 Dec 2006 00:26:18 +0000 |
parents | f580a7755ac5 |
children | 8f9d757af58e |
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 |
17367
401b440a6d76
Update licensing information: The FSF changed postal address.
diego
parents:
11678
diff
changeset
|
21 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
11038
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 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
33 #include "../vidix.h" |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
34 #include "../fourcc.h" |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
35 #include "../../libdha/libdha.h" |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
36 #include "../../libdha/pci_ids.h" |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
37 #include "../../libdha/pci_names.h" |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
38 #include "../../config.h" |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
39 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
40 #include "sis_regs.h" |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
41 #include "sis_defs.h" |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
42 |
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 /** Random defines **/ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
45 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
46 #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
|
47 #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
|
48 #define IMAGE_MIN_HEIGHT 24 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
49 #define IMAGE_MAX_WIDTH 720 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
50 #define IMAGE_MAX_HEIGHT 576 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
51 #define IMAGE_MAX_WIDTH_M650 1920 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
52 #define IMAGE_MAX_HEIGHT_M650 1080 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
53 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
54 #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
|
55 #define OVERLAY_MIN_HEIGHT 24 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
56 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
57 #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
|
58 #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
|
59 #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
|
60 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
61 #define VMODE_INTERLACED 0x1 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
62 #define VMODE_DOUBLESCAN 0x2 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
63 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
64 typedef struct { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
65 short x1, y1, x2, y2; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
66 } BoxRec; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
67 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
68 typedef struct { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
69 int pixelFormat; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
70 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
71 uint16_t pitch; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
72 uint16_t origPitch; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
73 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
74 uint8_t keyOP; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
75 uint16_t HUSF; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
76 uint16_t VUSF; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
77 uint8_t IntBit; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
78 uint8_t wHPre; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
79 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
80 uint16_t srcW; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
81 uint16_t srcH; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
82 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
83 BoxRec dstBox; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
84 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
85 uint32_t PSY; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
86 uint32_t PSV; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
87 uint32_t PSU; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
88 uint8_t bobEnable; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
89 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
90 uint8_t contrastCtrl; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
91 uint8_t contrastFactor; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
92 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
93 uint8_t lineBufSize; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
94 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
95 uint8_t(*VBlankActiveFunc) (); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
96 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
97 uint16_t SCREENheight; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
98 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
99 } SISOverlayRec, *SISOverlayPtr; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
100 |
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 /** static variable definitions **/ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
103 static int sis_probed = 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
104 static pciinfo_t pci_info; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
105 unsigned int sis_verbose = 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
106 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
107 static void *sis_mem_base; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
108 /* static void *sis_reg_base; */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
109 unsigned short sis_iobase; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
110 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
111 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
|
112 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
|
113 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
|
114 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
|
115 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
|
116 static unsigned int sis_vmode = 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
117 unsigned int sis_vbflags = DISPTYPE_DISP1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
118 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
|
119 unsigned int sis_crt1_off = -1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
120 unsigned int sis_detected_crt2_devices; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
121 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
|
122 unsigned int sis_device_id = -1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
123 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
124 static int sis_format; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
125 static int sis_Yoff = 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
126 static int sis_Voff = 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
127 static int sis_Uoff = 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
128 static int sis_screen_width = 640; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
129 static int sis_screen_height = 480; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
130 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
131 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
|
132 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
133 static vidix_grkey_t sis_grkey; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
134 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
135 static vidix_capability_t sis_cap = { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
136 "SiS 300/310/325 Video Driver", |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
137 "Jake Page", |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
138 TYPE_OUTPUT, |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
139 {0, 0, 0, 0}, |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
140 2048, |
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 4, |
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 -1, |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
145 FLAG_UPSCALER | FLAG_DOWNSCALER | FLAG_EQUALIZER, |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
146 VENDOR_SIS, |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
147 -1, |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
148 {0, 0, 0, 0} |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
149 }; |
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 vidix_video_eq_t sis_equal = { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
152 VEQ_CAP_BRIGHTNESS | VEQ_CAP_CONTRAST, |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
153 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
|
154 }; |
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 static unsigned short sis_card_ids[] = { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
157 DEVICE_SIS_300, |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
158 DEVICE_SIS_315H, |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
159 DEVICE_SIS_315, |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
160 DEVICE_SIS_315PRO, |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
161 DEVICE_SIS_330, |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
162 DEVICE_SIS_540_VGA, |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
163 DEVICE_SIS_550_VGA, |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
164 DEVICE_SIS_630_VGA, |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
165 DEVICE_SIS_650_VGA |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
166 }; |
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 /** function declarations **/ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
169 |
17566
f580a7755ac5
Patch by Stefan Huehner / stefan % huehner ! org \
rathann
parents:
17367
diff
changeset
|
170 extern void sis_init_video_bridge(void); |
11038
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
171 |
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 static void set_overlay(SISOverlayPtr pOverlay, int index); |
17566
f580a7755ac5
Patch by Stefan Huehner / stefan % huehner ! org \
rathann
parents:
17367
diff
changeset
|
174 static void close_overlay(void); |
11038
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
175 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
|
176 int index, int iscrt2); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
177 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
|
178 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
|
179 static void set_format(SISOverlayPtr pOverlay); |
17566
f580a7755ac5
Patch by Stefan Huehner / stefan % huehner ! org \
rathann
parents:
17367
diff
changeset
|
180 static void set_colorkey(void); |
11038
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
181 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
182 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
|
183 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
|
184 static void set_saturation(char saturation); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
185 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
|
186 #if 0 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
187 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
|
188 #endif |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
189 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
190 /* IO Port access functions */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
191 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
|
192 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
193 uint8_t ret; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
194 inSISIDXREG(SISVID, reg, ret); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
195 return (ret); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
196 } |
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 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
|
199 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
200 outSISIDXREG(SISVID, reg, data); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
201 } |
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 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
|
204 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
205 uint8_t old; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
206 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
207 inSISIDXREG(SISVID, reg, old); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
208 data = (data & mask) | (old & (~mask)); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
209 outSISIDXREG(SISVID, reg, data); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
210 } |
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 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
|
213 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
214 uint8_t old; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
215 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
216 inSISIDXREG(SISSR, reg, old); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
217 data = (data & mask) | (old & (~mask)); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
218 outSISIDXREG(SISSR, reg, data); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
219 } |
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 /* vblank checking*/ |
17566
f580a7755ac5
Patch by Stefan Huehner / stefan % huehner ! org \
rathann
parents:
17367
diff
changeset
|
222 static uint8_t vblank_active_CRT1(void) |
11038
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
223 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
224 /* this may be too simplistic? */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
225 return (inSISREG(SISINPSTAT) & 0x08); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
226 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
227 |
17566
f580a7755ac5
Patch by Stefan Huehner / stefan % huehner ! org \
rathann
parents:
17367
diff
changeset
|
228 static uint8_t vblank_active_CRT2(void) |
11038
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
229 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
230 uint8_t ret; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
231 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
|
232 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
|
233 } else { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
234 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
|
235 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
236 return ((ret & 0x02) ^ 0x02); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
237 } |
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 unsigned int vixGetVersion(void) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
241 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
242 return (VIDIX_VERSION); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
243 } |
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 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
|
246 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
247 unsigned i; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
248 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
|
249 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
|
250 return i; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
251 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
252 return -1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
253 } |
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 int vixProbe(int verbose, int force) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
256 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
257 pciinfo_t lst[MAX_PCI_DEVICES]; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
258 unsigned i, num_pci; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
259 int err; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
260 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
261 sis_verbose = verbose; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
262 force = force; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
263 err = pci_scan(lst, &num_pci); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
264 if (err) { |
11678
972d1998bde9
occured --> occurred typo patch by Clinton Roy <croy@dstc.edu.au>
diego
parents:
11066
diff
changeset
|
265 printf("[SiS] Error occurred during pci scan: %s\n", strerror(err)); |
11038
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
266 return err; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
267 } else { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
268 err = ENXIO; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
269 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
|
270 if (lst[i].vendor == VENDOR_SIS) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
271 int idx; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
272 const char *dname; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
273 idx = find_chip(lst[i].device); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
274 if (idx == -1) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
275 continue; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
276 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
|
277 dname = dname ? dname : "Unknown chip"; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
278 if (sis_verbose > 0) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
279 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
|
280 dname, lst[i].device); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
281 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
|
282 err = 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
283 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
|
284 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
285 sis_has_two_overlays = 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
286 switch (sis_cap.device_id) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
287 case DEVICE_SIS_300: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
288 case DEVICE_SIS_630_VGA: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
289 sis_has_two_overlays = 1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
290 case DEVICE_SIS_540_VGA: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
291 sis_vga_engine = SIS_300_VGA; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
292 break; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
293 case DEVICE_SIS_330: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
294 case DEVICE_SIS_550_VGA: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
295 sis_has_two_overlays = 1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
296 case DEVICE_SIS_315H: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
297 case DEVICE_SIS_315: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
298 case DEVICE_SIS_315PRO: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
299 case DEVICE_SIS_650_VGA: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
300 /* M650 & 651 have 2 overlays */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
301 /* 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
|
302 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
303 unsigned char CR5F; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
304 unsigned char tempreg1, tempreg2; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
305 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
306 inSISIDXREG(SISCR, 0x5F, CR5F); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
307 CR5F &= 0xf0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
308 andSISIDXREG(SISCR, 0x5c, 0x07); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
309 inSISIDXREG(SISCR, 0x5c, tempreg1); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
310 tempreg1 &= 0xf8; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
311 setSISIDXREG(SISCR, 0x5c, 0x07, 0xf8); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
312 inSISIDXREG(SISCR, 0x5c, tempreg2); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
313 tempreg2 &= 0xf8; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
314 if ((!tempreg1) || (tempreg2)) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
315 if (CR5F & 0x80) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
316 sis_has_two_overlays = 1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
317 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
318 } else { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
319 sis_has_two_overlays = 1; /* ? */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
320 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
321 if (sis_has_two_overlays) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
322 if (sis_verbose > 0) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
323 printf |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
324 ("[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
|
325 } |
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 sis_vga_engine = SIS_315_VGA; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
328 break; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
329 default: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
330 /* should never get here */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
331 sis_vga_engine = UNKNOWN_VGA; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
332 break; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
333 } |
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 if (err && sis_verbose) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
338 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
|
339 } else { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
340 sis_probed = 1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
341 } |
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 return err; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
344 } |
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 int vixInit(void) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
347 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
348 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
|
349 char *env_overlay_crt; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
350 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
351 if (!sis_probed) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
352 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
|
353 return (EINTR); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
354 } |
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 /* 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
|
357 /* map 16MB scary hack for now. */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
358 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
|
359 /* 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
|
360 sis_iobase = pci_info.base2 & 0xFFFC; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
361 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
362 /* 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
|
363 current resolution. */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
364 inSISIDXREG(SISCR, 0x12, cr_data); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
365 inSISIDXREG(SISCR, 0x07, cr_data2); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
366 sis_screen_height = |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
367 ((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
|
368 ((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
|
369 << 9)) + 1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
370 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
371 inSISIDXREG(SISSR, 0x0b, sr_data); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
372 inSISIDXREG(SISCR, 0x01, cr_data); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
373 sis_screen_width = (((cr_data & 0xff) | |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
374 ((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
|
375 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
376 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
|
377 if (sr_data & 0x20) /* interlaced mode */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
378 sis_vmode |= VMODE_INTERLACED; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
379 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
380 #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
|
381 /* 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
|
382 inSISIDXREG(SISCR, 0x09, cr_data); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
383 if (cr_data & 0x40) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
384 sis_vmode |= VMODE_DOUBLESCAN; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
385 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
386 #endif |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
387 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
388 /* 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
|
389 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
|
390 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
|
391 sis_init_video_bridge(); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
392 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
393 env_overlay_crt = getenv("VIDIX_CRT"); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
394 if (env_overlay_crt) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
395 int crt = atoi(env_overlay_crt); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
396 if (crt == 1 || crt == 2) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
397 sis_overlay_on_crt1 = (crt == 1); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
398 if (sis_verbose > 0) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
399 printf |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
400 ("[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
|
401 crt); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
402 } |
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 return 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
407 } |
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 void vixDestroy(void) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
410 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
411 /* 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
|
412 /* 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
|
413 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
|
414 } |
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 int vixGetCapability(vidix_capability_t * to) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
417 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
418 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
|
419 return 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
420 } |
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 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
|
423 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
424 switch (fourcc) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
425 case IMGFMT_YV12: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
426 case IMGFMT_I420: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
427 case IMGFMT_UYVY: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
428 case IMGFMT_YUY2: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
429 case IMGFMT_RGB15: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
430 case IMGFMT_RGB16: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
431 return 1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
432 default: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
433 return 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
434 } |
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 int vixQueryFourcc(vidix_fourcc_t * to) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
438 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
439 if (is_supported_fourcc(to->fourcc)) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
440 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
|
441 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
|
442 return 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
443 } else |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
444 to->depth = to->flags = 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
445 return ENOSYS; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
446 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
447 |
17566
f580a7755ac5
Patch by Stefan Huehner / stefan % huehner ! org \
rathann
parents:
17367
diff
changeset
|
448 static int bridge_in_slave_mode(void) |
11038
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
449 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
450 unsigned char usScratchP1_00; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
451 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
452 if (!(sis_vbflags & VB_VIDEOBRIDGE)) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
453 return 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
454 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
455 inSISIDXREG(SISPART1, 0x00, usScratchP1_00); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
456 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
|
457 && (usScratchP1_00 & 0xa0) == 0x20) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
458 || ((sis_vga_engine == SIS_315_VGA) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
459 && (usScratchP1_00 & 0x50) == 0x10)) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
460 return 1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
461 } else { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
462 return 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
463 } |
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 /* 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
|
467 and 2) it doesn't make sense for other gfx drivers */ |
17566
f580a7755ac5
Patch by Stefan Huehner / stefan % huehner ! org \
rathann
parents:
17367
diff
changeset
|
468 static void set_dispmode(void) |
11038
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
469 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
470 sis_bridge_is_slave = 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
471 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
472 if (bridge_in_slave_mode()) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
473 sis_bridge_is_slave = 1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
474 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
475 if ((sis_vbflags & VB_DISPMODE_MIRROR) || |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
476 (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
|
477 if (sis_has_two_overlays) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
478 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
|
479 else if (!sis_overlay_on_crt1) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
480 sis_displaymode = DISPMODE_SINGLE2; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
481 else |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
482 sis_displaymode = DISPMODE_SINGLE1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
483 } else { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
484 if (sis_vbflags & DISPTYPE_DISP1) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
485 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
|
486 } else { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
487 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
|
488 } |
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 |
17566
f580a7755ac5
Patch by Stefan Huehner / stefan % huehner ! org \
rathann
parents:
17367
diff
changeset
|
492 static void set_disptype_regs(void) |
11038
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
493 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
494 switch (sis_displaymode) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
495 case DISPMODE_SINGLE1: /* TW: CRT1 only */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
496 if (sis_verbose > 2) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
497 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
|
498 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
499 if (sis_has_two_overlays) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
500 setsrregmask(0x06, 0x00, 0xc0); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
501 setsrregmask(0x32, 0x00, 0xc0); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
502 } else { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
503 setsrregmask(0x06, 0x00, 0xc0); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
504 setsrregmask(0x32, 0x00, 0xc0); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
505 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
506 break; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
507 case DISPMODE_SINGLE2: /* TW: CRT2 only */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
508 if (sis_verbose > 2) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
509 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
|
510 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
511 if (sis_has_two_overlays) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
512 setsrregmask(0x06, 0x80, 0xc0); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
513 setsrregmask(0x32, 0x80, 0xc0); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
514 } else { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
515 setsrregmask(0x06, 0x40, 0xc0); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
516 setsrregmask(0x32, 0x40, 0xc0); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
517 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
518 break; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
519 case DISPMODE_MIRROR: /* TW: CRT1 + CRT2 */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
520 default: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
521 if (sis_verbose > 2) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
522 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
|
523 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
524 setsrregmask(0x06, 0x80, 0xc0); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
525 setsrregmask(0x32, 0x80, 0xc0); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
526 break; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
527 } |
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 |
17566
f580a7755ac5
Patch by Stefan Huehner / stefan % huehner ! org \
rathann
parents:
17367
diff
changeset
|
530 static void init_overlay(void) |
11038
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
531 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
532 /* Initialize first overlay (CRT1) */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
533 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
534 /* Write-enable video registers */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
535 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
|
536 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
537 /* Disable overlay */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
538 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
|
539 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
540 /* Disable bobEnable */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
541 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
|
542 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
543 /* Reset scale control and contrast */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
544 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
|
545 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
|
546 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
547 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
|
548 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
|
549 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
|
550 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
|
551 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
|
552 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
|
553 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
|
554 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
555 /* 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
|
556 values by app? */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
557 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
|
558 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
|
559 setvideoreg(Index_VI_Brightness, 0x20); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
560 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
|
561 setvideoreg(Index_VI_Hue, 0x00); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
562 setvideoreg(Index_VI_Saturation, 0x00); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
563 } |
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 /* Initialize second overlay (CRT2) */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
566 if (sis_has_two_overlays) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
567 /* Write-enable video registers */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
568 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
|
569 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
570 /* Disable overlay */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
571 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
|
572 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
573 /* Disable bobEnable */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
574 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
|
575 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
576 /* Reset scale control and contrast */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
577 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
|
578 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
|
579 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
580 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
|
581 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
|
582 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
|
583 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
|
584 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
|
585 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
|
586 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
|
587 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
588 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
|
589 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
|
590 setvideoreg(Index_VI_Brightness, 0x20); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
591 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
|
592 setvideoreg(Index_VI_Hue, 0x00); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
593 setvideoreg(Index_VI_Saturation, 0x00); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
594 } |
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 int vixConfigPlayback(vidix_playback_t * info) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
599 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
600 SISOverlayRec overlay; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
601 int srcOffsetX = 0, srcOffsetY = 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
602 int sx, sy; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
603 int index = 0, iscrt2 = 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
604 int total_size; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
605 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
606 short src_w, drw_w; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
607 short src_h, drw_h; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
608 short src_x, drw_x; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
609 short src_y, drw_y; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
610 long dga_offset; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
611 int pitch; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
612 unsigned int i; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
613 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
614 if (!is_supported_fourcc(info->fourcc)) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
615 return -1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
616 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
617 /* set chipset/engine.dependent config info */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
618 /* which CRT to use, etc.? */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
619 switch (sis_vga_engine) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
620 case SIS_315_VGA: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
621 sis_shift_value = 1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
622 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
|
623 break; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
624 case SIS_300_VGA: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
625 default: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
626 sis_shift_value = 2; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
627 break; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
628 } |
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 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
|
631 set_dispmode(); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
632 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
633 set_disptype_regs(); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
634 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
635 init_overlay(); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
636 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
637 /* get basic dimension info */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
638 src_x = info->src.x; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
639 src_y = info->src.y; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
640 src_w = info->src.w; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
641 src_h = info->src.h; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
642 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
643 drw_x = info->dest.x; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
644 drw_y = info->dest.y; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
645 drw_w = info->dest.w; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
646 drw_h = info->dest.h; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
647 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
648 switch (info->fourcc) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
649 case IMGFMT_YV12: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
650 case IMGFMT_I420: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
651 pitch = (src_w + 7) & ~7; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
652 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
|
653 break; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
654 case IMGFMT_YUY2: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
655 case IMGFMT_UYVY: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
656 case IMGFMT_RGB15: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
657 case IMGFMT_RGB16: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
658 pitch = ((src_w << 1) + 3) & ~3; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
659 total_size = pitch * src_h; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
660 break; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
661 default: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
662 return -1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
663 } |
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 /* "allocate" memory for overlay! */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
666 /* 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
|
667 really shouldn't hardcode though */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
668 /* 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
|
669 allocate "video heap" memory... */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
670 dga_offset = 0x800000; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
671 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
672 /* 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
|
673 /* 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
|
674 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
|
675 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
|
676 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 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
678 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
|
679 info->dest.pitch.y = 16; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
680 info->dest.pitch.u = 16; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
681 info->dest.pitch.v = 16; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
682 info->offset.y = 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
683 info->offset.u = 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
684 info->offset.v = 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
685 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
|
686 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
|
687 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
|
688 /* save ptrs to mem buffers */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
689 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
|
690 } |
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 memset(&overlay, 0, sizeof(overlay)); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
693 overlay.pixelFormat = sis_format = info->fourcc; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
694 overlay.pitch = overlay.origPitch = pitch; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
695 |
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 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
|
698 VI_ROP_DestKey : VI_ROP_Always); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
699 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
700 overlay.bobEnable = 0x00; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
701 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
702 overlay.SCREENheight = sis_screen_height; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
703 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
704 /* 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
|
705 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
|
706 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
|
707 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
|
708 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
|
709 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
710 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
|
711 (overlay.dstBox.y1 > overlay.dstBox.y2)) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
712 return -1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
713 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
714 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
|
715 return -1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
716 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
717 if (overlay.dstBox.x1 < 0) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
718 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
|
719 overlay.dstBox.x1 = 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
720 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
721 if (overlay.dstBox.y1 < 0) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
722 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
|
723 overlay.dstBox.y1 = 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
724 } |
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 switch (info->fourcc) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
727 case IMGFMT_YV12: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
728 info->dest.pitch.y = 16; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
729 sx = (src_x + srcOffsetX) & ~7; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
730 sy = (src_y + srcOffsetY) & ~1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
731 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
|
732 /* 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
|
733 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
|
734 info->offset.u = sis_Voff = |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
735 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
|
736 info->offset.v = sis_Uoff = |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
737 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
|
738 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
739 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
|
740 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
|
741 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
|
742 break; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
743 case IMGFMT_I420: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
744 sx = (src_x + srcOffsetX) & ~7; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
745 sy = (src_y + srcOffsetY) & ~1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
746 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
|
747 /* JCP: see above... */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
748 info->offset.u = sis_Voff = |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
749 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
|
750 info->offset.v = sis_Uoff = |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
751 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
|
752 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
753 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
|
754 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
|
755 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
|
756 break; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
757 case IMGFMT_YUY2: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
758 case IMGFMT_UYVY: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
759 case IMGFMT_RGB16: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
760 case IMGFMT_RGB15: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
761 default: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
762 sx = (src_x + srcOffsetX) & ~1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
763 sy = (src_y + srcOffsetY); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
764 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
|
765 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
766 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
|
767 break; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
768 } |
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 /* 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
|
771 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
|
772 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
|
773 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
774 /* JCP: what to do about this? */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
775 #if 0 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
776 if ((pPriv->oldx1 != overlay.dstBox.x1) || |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
777 (pPriv->oldx2 != overlay.dstBox.x2) || |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
778 (pPriv->oldy1 != overlay.dstBox.y1) || |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
779 (pPriv->oldy2 != overlay.dstBox.y2)) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
780 pPriv->mustwait = 1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
781 pPriv->oldx1 = overlay.dstBox.x1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
782 pPriv->oldx2 = overlay.dstBox.x2; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
783 pPriv->oldy1 = overlay.dstBox.y1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
784 pPriv->oldy2 = overlay.dstBox.y2; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
785 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
786 #endif |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
787 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
788 /* set merge line buffer */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
789 merge_line_buf(overlay.srcW > 384); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
790 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
791 /* calculate line buffer length */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
792 set_line_buf_size(&overlay); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
793 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
794 if (sis_displaymode == DISPMODE_SINGLE2) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
795 if (sis_has_two_overlays) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
796 /* 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
|
797 * overlay 2 for CRT2 */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
798 index = 1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
799 iscrt2 = 1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
800 } else { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
801 /* 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
|
802 * use that only overlay for CRT2 */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
803 index = 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
804 iscrt2 = 1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
805 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
806 overlay.VBlankActiveFunc = vblank_active_CRT2; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
807 /* overlay.GetScanLineFunc = get_scanline_CRT2; */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
808 } else { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
809 index = 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
810 iscrt2 = 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
811 overlay.VBlankActiveFunc = vblank_active_CRT1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
812 /* overlay.GetScanLineFunc = get_scanline_CRT1; */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
813 } |
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 /* calc scale factor (to use below) */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
816 calc_scale_factor(&overlay, index, iscrt2); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
817 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
818 /* 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
|
819 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
|
820 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
821 set_format(&overlay); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
822 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
823 set_colorkey(); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
824 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
825 vixPlaybackSetEq(&sis_equal); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
826 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
827 /* set up video overlay registers */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
828 set_overlay(&overlay, index); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
829 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
830 /* 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
|
831 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
|
832 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
|
833 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
834 /* 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
|
835 setup mirror CRT2 */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
836 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
837 return 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
838 } |
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 int vixPlaybackOn(void) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
841 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
842 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
|
843 return 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
844 } |
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 int vixPlaybackOff(void) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
847 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
848 unsigned char sridx, cridx; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
849 sridx = inSISREG(SISSR); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
850 cridx = inSISREG(SISCR); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
851 close_overlay(); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
852 outSISREG(SISSR, sridx); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
853 outSISREG(SISCR, cridx); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
854 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
855 return 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
856 } |
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 int vixPlaybackFrameSelect(unsigned int frame) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
859 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
860 uint8_t data; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
861 int index = 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
862 uint32_t PSY; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
863 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
864 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
|
865 index = 1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
866 } |
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 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
|
869 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
870 /* Unlock address registers */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
871 data = getvideoreg(Index_VI_Control_Misc1); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
872 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
|
873 /* TEST: Is this required? */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
874 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
|
875 /* TEST end */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
876 /* TEST: Is this required? */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
877 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
|
878 setvideoreg(Index_VI_Control_Misc3, 0x00); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
879 /* TEST end */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
880 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
881 /* set Y start address */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
882 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
|
883 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
|
884 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
|
885 /* 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
|
886 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
|
887 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
|
888 ((uint8_t) ((PSY) >> 24) & 0x01)); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
889 } |
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 /* 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
|
892 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
|
893 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
894 uint32_t PSU, PSV; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
895 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
896 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
|
897 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
|
898 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
899 /* set U/V start address */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
900 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
|
901 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
|
902 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
|
903 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
904 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
|
905 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
|
906 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
|
907 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
908 /* 310/325 series overflow bits */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
909 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
|
910 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
|
911 ((uint8_t) (PSU >> 24) & 0x01)); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
912 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
|
913 ((uint8_t) (PSV >> 24) & 0x01)); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
914 } |
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 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
|
918 /* Trigger register copy for 310 series */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
919 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
|
920 } |
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 /* Lock the address registers */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
923 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
|
924 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
925 return 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
926 } |
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 int vixGetGrKeys(vidix_grkey_t * grkey) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
929 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
930 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
|
931 return 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
932 } |
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 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
|
935 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
936 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
|
937 set_colorkey(); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
938 return 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
939 } |
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 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
|
942 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
943 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
|
944 return 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
945 } |
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 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
|
948 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
949 int br, sat, cr, hue; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
950 if (eq->cap & VEQ_CAP_BRIGHTNESS) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
951 sis_equal.brightness = eq->brightness; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
952 if (eq->cap & VEQ_CAP_CONTRAST) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
953 sis_equal.contrast = eq->contrast; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
954 if (eq->cap & VEQ_CAP_SATURATION) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
955 sis_equal.saturation = eq->saturation; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
956 if (eq->cap & VEQ_CAP_HUE) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
957 sis_equal.hue = eq->hue; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
958 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
|
959 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
|
960 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
|
961 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
|
962 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
963 sis_equal.flags = eq->flags; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
964 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
965 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
|
966 if (cr < 0) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
967 cr = 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
968 if (cr > 7) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
969 cr = 7; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
970 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
971 br = sis_equal.brightness * 127 / 1000; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
972 if (br < -128) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
973 br = -128; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
974 if (br > 127) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
975 br = 127; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
976 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
977 sat = (sis_equal.saturation * 7) / 1000; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
978 if (sat < -7) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
979 sat = -7; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
980 if (sat > 7) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
981 sat = 7; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
982 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
983 hue = sis_equal.hue * 7 / 1000; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
984 if (hue < -8) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
985 hue = -8; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
986 if (hue > 7) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
987 hue = 7; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
988 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
989 set_brightness(br); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
990 set_contrast(cr); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
991 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
|
992 set_saturation(sat); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
993 set_hue(hue); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
994 } |
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 return 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
997 } |
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 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
|
1000 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1001 uint16_t pitch = 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1002 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
|
1003 uint16_t top, bottom, left, right; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1004 uint16_t screenX = sis_screen_width; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1005 uint16_t screenY = sis_screen_height; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1006 uint8_t data; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1007 uint32_t watchdog; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1008 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1009 top = pOverlay->dstBox.y1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1010 bottom = pOverlay->dstBox.y2; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1011 if (bottom > screenY) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1012 bottom = screenY; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1013 } |
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 left = pOverlay->dstBox.x1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1016 right = pOverlay->dstBox.x2; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1017 if (right > screenX) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1018 right = screenX; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1019 } |
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 /* JCP: these aren't really tested... */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1022 /* 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
|
1023 if (sis_vmode & VMODE_DOUBLESCAN) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1024 top <<= 1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1025 bottom <<= 1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1026 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1027 /* 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
|
1028 if (sis_vmode & VMODE_INTERLACED) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1029 top >>= 1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1030 bottom >>= 1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1031 } |
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 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
|
1034 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
|
1035 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1036 pitch = pOverlay->pitch >> sis_shift_value; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1037 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1038 /* set line buffer size */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1039 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
|
1040 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1041 /* set color key mode */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1042 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
|
1043 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1044 /* 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
|
1045 /* JCP: be safe for now. */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1046 if (1 /*pPriv->mustwait */ ) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1047 watchdog = WATCHDOG_DELAY; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1048 while (pOverlay->VBlankActiveFunc() && --watchdog); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1049 watchdog = WATCHDOG_DELAY; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1050 while ((!pOverlay->VBlankActiveFunc()) && --watchdog); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1051 if (!watchdog && sis_verbose > 0) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1052 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
|
1053 } |
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 /* Unlock address registers */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1057 data = getvideoreg(Index_VI_Control_Misc1); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1058 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
|
1059 /* TEST: Is this required? */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1060 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
|
1061 /* TEST end */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1062 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1063 /* TEST: Is this required? */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1064 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
|
1065 setvideoreg(Index_VI_Control_Misc3, 0x00); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1066 /* TEST end */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1067 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1068 /* Set Y buf pitch */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1069 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
|
1070 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
|
1071 (uint8_t) (pitch >> 8), 0x0f); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1072 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1073 /* Set Y start address */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1074 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
|
1075 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
|
1076 (uint8_t) ((pOverlay->PSY) >> 8)); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1077 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
|
1078 (uint8_t) ((pOverlay->PSY) >> 16)); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1079 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1080 /* 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
|
1081 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
|
1082 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
|
1083 (uint8_t) (pitch >> 12)); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1084 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
|
1085 ((uint8_t) ((pOverlay->PSY) >> 24) & 0x01)); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1086 } |
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 /* 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
|
1089 if ((pOverlay->pixelFormat == IMGFMT_YV12) || |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1090 (pOverlay->pixelFormat == IMGFMT_I420)) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1091 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1092 uint32_t PSU, PSV; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1093 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1094 PSU = pOverlay->PSU; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1095 PSV = pOverlay->PSV; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1096 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1097 /* Set U/V pitch */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1098 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
|
1099 (uint8_t) (pitch >> 1)); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1100 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
|
1101 (uint8_t) (pitch >> 5), 0xf0); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1102 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1103 /* set U/V start address */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1104 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
|
1105 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
|
1106 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
|
1107 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1108 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
|
1109 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
|
1110 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
|
1111 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1112 /* 310/325 series overflow bits */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1113 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
|
1114 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
|
1115 (uint8_t) (pitch >> 13)); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1116 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
|
1117 ((uint8_t) (PSU >> 24) & 0x01)); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1118 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
|
1119 ((uint8_t) (PSV >> 24) & 0x01)); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1120 } |
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 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
|
1124 /* Trigger register copy for 310 series */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1125 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
|
1126 } |
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 /* set scale factor */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1129 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
|
1130 (uint8_t) (pOverlay->HUSF)); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1131 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
|
1132 (uint8_t) ((pOverlay->HUSF) >> 8)); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1133 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
|
1134 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
|
1135 (uint8_t) ((pOverlay->VUSF) >> 8)); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1136 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1137 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
|
1138 | (pOverlay->wHPre), 0x7f); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1139 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1140 /* set destination window position */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1141 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
|
1142 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
|
1143 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
|
1144 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1145 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
|
1146 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
|
1147 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
|
1148 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1149 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
|
1150 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1151 /* Lock the address registers */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1152 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
|
1153 } |
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 /* TW: Overlay MUST NOT be switched off while beam is over it */ |
17566
f580a7755ac5
Patch by Stefan Huehner / stefan % huehner ! org \
rathann
parents:
17367
diff
changeset
|
1157 static void close_overlay(void) |
11038
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1158 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1159 uint32_t watchdog; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1160 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1161 if ((sis_displaymode == DISPMODE_SINGLE2) || |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1162 (sis_displaymode == DISPMODE_MIRROR)) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1163 if (sis_has_two_overlays) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1164 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
|
1165 watchdog = WATCHDOG_DELAY; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1166 while (vblank_active_CRT2() && --watchdog); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1167 watchdog = WATCHDOG_DELAY; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1168 while ((!vblank_active_CRT2()) && --watchdog); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1169 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
|
1170 watchdog = WATCHDOG_DELAY; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1171 while (vblank_active_CRT2() && --watchdog); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1172 watchdog = WATCHDOG_DELAY; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1173 while ((!vblank_active_CRT2()) && --watchdog); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1174 } else if (sis_displaymode == DISPMODE_SINGLE2) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1175 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
|
1176 watchdog = WATCHDOG_DELAY; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1177 while (vblank_active_CRT1() && --watchdog); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1178 watchdog = WATCHDOG_DELAY; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1179 while ((!vblank_active_CRT1()) && --watchdog); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1180 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
|
1181 watchdog = WATCHDOG_DELAY; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1182 while (vblank_active_CRT1() && --watchdog); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1183 watchdog = WATCHDOG_DELAY; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1184 while ((!vblank_active_CRT1()) && --watchdog); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1185 } |
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 if ((sis_displaymode == DISPMODE_SINGLE1) || |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1188 (sis_displaymode == DISPMODE_MIRROR)) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1189 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
|
1190 watchdog = WATCHDOG_DELAY; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1191 while (vblank_active_CRT1() && --watchdog); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1192 watchdog = WATCHDOG_DELAY; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1193 while ((!vblank_active_CRT1()) && --watchdog); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1194 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
|
1195 watchdog = WATCHDOG_DELAY; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1196 while (vblank_active_CRT1() && --watchdog); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1197 watchdog = WATCHDOG_DELAY; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1198 while ((!vblank_active_CRT1()) && --watchdog); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1199 } |
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 static void |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1204 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
|
1205 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1206 uint32_t i = 0, mult = 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1207 int flag = 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1208 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1209 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
|
1210 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
|
1211 int srcW = pOverlay->srcW; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1212 int srcH = pOverlay->srcH; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1213 /* uint16_t LCDheight = pSiS->LCDheight; */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1214 int srcPitch = pOverlay->origPitch; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1215 int origdstH = dstH; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1216 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1217 /* get rid of warnings for now */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1218 index = index; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1219 iscrt2 = iscrt2; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1220 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1221 #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
|
1222 /* 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
|
1223 if (pSiS->VBFlags & CRT2_LCD) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1224 if (sis_bridge_is_slave) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1225 if (pSiS->VBFlags & VB_LVDS) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1226 dstH = (dstH * LCDheight) / pOverlay->SCREENheight; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1227 } 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
|
1228 (pSiS-> |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1229 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
|
1230 VB_302LV))) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1231 dstH = (dstH * LCDheight) / pOverlay->SCREENheight; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1232 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1233 } else if (iscrt2) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1234 if (pSiS->VBFlags & VB_LVDS) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1235 dstH = (dstH * LCDheight) / pOverlay->SCREENheight; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1236 if (sis_displaymode == DISPMODE_MIRROR) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1237 flag = 1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1238 } 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
|
1239 (pSiS-> |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1240 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
|
1241 VB_302LV))) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1242 dstH = (dstH * LCDheight) / pOverlay->SCREENheight; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1243 if (sis_displaymode == DISPMODE_MIRROR) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1244 flag = 1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1245 } |
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 #endif |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1249 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1250 /* 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
|
1251 * (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
|
1252 * 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
|
1253 * Interlace mode vice versa. |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1254 */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1255 if (sis_vmode & VMODE_DOUBLESCAN) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1256 dstH = origdstH << 1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1257 flag = 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1258 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
|
1259 dstW <<= 1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1260 } |
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 if (sis_vmode & VMODE_INTERLACED) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1263 dstH = origdstH >> 1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1264 flag = 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1265 } |
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 if (dstW < OVERLAY_MIN_WIDTH) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1268 dstW = OVERLAY_MIN_WIDTH; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1269 if (dstW == srcW) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1270 pOverlay->HUSF = 0x00; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1271 pOverlay->IntBit = 0x05; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1272 pOverlay->wHPre = 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1273 } else if (dstW > srcW) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1274 dstW += 2; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1275 pOverlay->HUSF = (srcW << 16) / dstW; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1276 pOverlay->IntBit = 0x04; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1277 pOverlay->wHPre = 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1278 } else { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1279 int tmpW = dstW; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1280 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1281 /* 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
|
1282 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
|
1283 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
|
1284 */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1285 if ((srcPitch % 256) || (srcPitch < 256)) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1286 if (((dstW * 1000) / srcW) < 125) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1287 dstW = tmpW = ((srcW * 125) / 1000) + 1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1288 } |
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 i = 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1291 pOverlay->IntBit = 0x01; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1292 while (srcW >= tmpW) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1293 tmpW <<= 1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1294 i++; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1295 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1296 pOverlay->wHPre = (uint8_t) (i - 1); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1297 dstW <<= (i - 1); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1298 if ((srcW % dstW)) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1299 pOverlay->HUSF = ((srcW - dstW) << 16) / dstW; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1300 else |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1301 pOverlay->HUSF = 0x00; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1302 } |
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 if (dstH < OVERLAY_MIN_HEIGHT) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1305 dstH = OVERLAY_MIN_HEIGHT; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1306 if (dstH == srcH) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1307 pOverlay->VUSF = 0x00; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1308 pOverlay->IntBit |= 0x0A; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1309 } else if (dstH > srcH) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1310 dstH += 0x02; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1311 pOverlay->VUSF = (srcH << 16) / dstH; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1312 pOverlay->IntBit |= 0x08; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1313 } else { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1314 uint32_t realI; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1315 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1316 i = realI = srcH / dstH; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1317 pOverlay->IntBit |= 0x02; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1318 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1319 if (i < 2) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1320 pOverlay->VUSF = ((srcH - dstH) << 16) / dstH; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1321 /* TW: Needed for LCD-scaling modes */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1322 if ((flag) && (mult = (srcH / origdstH)) >= 2) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1323 pOverlay->pitch /= mult; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1324 } else { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1325 #if 0 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1326 if (((pOverlay->bobEnable & 0x08) == 0x00) && |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1327 (((srcPitch * i) >> 2) > 0xFFF)) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1328 pOverlay->bobEnable |= 0x08; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1329 srcPitch >>= 1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1330 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1331 #endif |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1332 if (((srcPitch * i) >> 2) > 0xFFF) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1333 i = (0xFFF * 2 / srcPitch); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1334 pOverlay->VUSF = 0xFFFF; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1335 } else { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1336 dstH = i * dstH; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1337 if (srcH % dstH) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1338 pOverlay->VUSF = ((srcH - dstH) << 16) / dstH; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1339 else |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1340 pOverlay->VUSF = 0x00; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1341 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1342 /* set video frame buffer offset */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1343 pOverlay->pitch = (uint16_t) (srcPitch * i); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1344 } |
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 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
|
1349 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1350 uint8_t preHIDF; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1351 uint32_t i; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1352 uint32_t line = pOverlay->srcW; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1353 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1354 if ((pOverlay->pixelFormat == IMGFMT_YV12) || |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1355 (pOverlay->pixelFormat == IMGFMT_I420)) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1356 preHIDF = pOverlay->wHPre & 0x07; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1357 switch (preHIDF) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1358 case 3: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1359 if ((line & 0xffffff00) == line) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1360 i = (line >> 8); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1361 else |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1362 i = (line >> 8) + 1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1363 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
|
1364 break; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1365 case 4: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1366 if ((line & 0xfffffe00) == line) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1367 i = (line >> 9); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1368 else |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1369 i = (line >> 9) + 1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1370 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
|
1371 break; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1372 case 5: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1373 if ((line & 0xfffffc00) == line) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1374 i = (line >> 10); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1375 else |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1376 i = (line >> 10) + 1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1377 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
|
1378 break; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1379 case 6: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1380 if ((line & 0xfffff800) == line) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1381 i = (line >> 11); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1382 else |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1383 i = (line >> 11) + 1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1384 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
|
1385 break; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1386 default: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1387 if ((line & 0xffffff80) == line) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1388 i = (line >> 7); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1389 else |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1390 i = (line >> 7) + 1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1391 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
|
1392 break; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1393 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1394 } else { /* YUV2, UYVY */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1395 if ((line & 0xffffff8) == line) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1396 i = (line >> 3); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1397 else |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1398 i = (line >> 3) + 1; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1399 pOverlay->lineBufSize = (uint8_t) (i - 1); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1400 } |
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 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
|
1404 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1405 if (enable) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1406 switch (sis_displaymode) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1407 case DISPMODE_SINGLE1: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1408 if (sis_has_two_overlays) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1409 /* dual line merge */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1410 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
|
1411 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
|
1412 } else { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1413 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
|
1414 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
|
1415 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1416 break; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1417 case DISPMODE_SINGLE2: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1418 if (sis_has_two_overlays) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1419 /* line merge */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1420 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
|
1421 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
|
1422 } else { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1423 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
|
1424 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
|
1425 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1426 break; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1427 case DISPMODE_MIRROR: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1428 default: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1429 /* line merge */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1430 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
|
1431 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
|
1432 if (sis_has_two_overlays) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1433 /* line merge */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1434 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
|
1435 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
|
1436 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1437 break; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1438 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1439 } else { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1440 switch (sis_displaymode) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1441 case DISPMODE_SINGLE1: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1442 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
|
1443 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
|
1444 break; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1445 case DISPMODE_SINGLE2: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1446 if (sis_has_two_overlays) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1447 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
|
1448 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
|
1449 } else { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1450 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
|
1451 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
|
1452 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1453 break; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1454 case DISPMODE_MIRROR: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1455 default: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1456 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
|
1457 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
|
1458 if (sis_has_two_overlays) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1459 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
|
1460 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
|
1461 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1462 break; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1463 } |
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 static void set_format(SISOverlayPtr pOverlay) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1469 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1470 uint8_t fmt; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1471 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1472 switch (pOverlay->pixelFormat) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1473 case IMGFMT_YV12: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1474 case IMGFMT_I420: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1475 fmt = 0x0c; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1476 break; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1477 case IMGFMT_YUY2: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1478 fmt = 0x28; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1479 break; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1480 case IMGFMT_UYVY: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1481 fmt = 0x08; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1482 break; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1483 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
|
1484 fmt = 0x00; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1485 break; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1486 case IMGFMT_RGB16: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1487 fmt = 0x10; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1488 break; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1489 default: |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1490 fmt = 0x00; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1491 break; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1492 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1493 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
|
1494 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1495 |
17566
f580a7755ac5
Patch by Stefan Huehner / stefan % huehner ! org \
rathann
parents:
17367
diff
changeset
|
1496 static void set_colorkey(void) |
11038
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1497 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1498 uint8_t r, g, b; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1499 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1500 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
|
1501 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
|
1502 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
|
1503 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1504 /* set color key mode */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1505 setvideoregmask(Index_VI_Key_Overlay_OP, |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1506 sis_grkey.ckey.op == CKEY_TRUE ? |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1507 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
|
1508 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1509 /* set colorkey values */ |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1510 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
|
1511 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
|
1512 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
|
1513 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1514 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
|
1515 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
|
1516 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
|
1517 } |
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 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
|
1520 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1521 setvideoreg(Index_VI_Brightness, brightness); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1522 } |
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 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
|
1525 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1526 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
|
1527 } |
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 /* 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
|
1530 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1531 static void set_saturation(char saturation) |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1532 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1533 uint8_t temp = 0; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1534 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1535 if (saturation < 0) { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1536 temp |= 0x88; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1537 saturation = -saturation; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1538 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1539 temp |= (saturation & 0x07); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1540 temp |= ((saturation & 0x07) << 4); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1541 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1542 setvideoreg(Index_VI_Saturation, temp); |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1543 } |
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 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
|
1546 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1547 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
|
1548 } |
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 #if 0 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1551 /* 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
|
1552 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
|
1553 { |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1554 uint8_t data; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1555 |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1556 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
|
1557 data &= 0x0F; |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1558 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
|
1559 } |
3bac281db5a1
SiS 650/651/740/etc driver by Jake Page <jake@CS.Stanford.EDU>
alex
parents:
diff
changeset
|
1560 #endif |