annotate vidix/unichrome_vid.c @ 23046:82216ef041e0

updated vidix files headers whenever it's possible to have a clear GPL statement
author ben
date Sun, 22 Apr 2007 14:05:41 +0000
parents f34e5d778267
children 7d3914646699
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1 /*
23046
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22905
diff changeset
2 * VIDIX driver for VIA CLE266/Unichrome chipsets.
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22905
diff changeset
3 * Copyright (C) 2004 Timothy Lee
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22905
diff changeset
4 *
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22905
diff changeset
5 * This file is part of MPlayer.
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22905
diff changeset
6 *
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22905
diff changeset
7 * MPlayer is free software; you can redistribute it and/or modify
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22905
diff changeset
8 * it under the terms of the GNU General Public License as published by
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22905
diff changeset
9 * the Free Software Foundation; either version 2 of the License, or
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22905
diff changeset
10 * (at your option) any later version.
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22905
diff changeset
11 *
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22905
diff changeset
12 * MPlayer is distributed in the hope that it will be useful,
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22905
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22905
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22905
diff changeset
15 * GNU General Public License for more details.
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22905
diff changeset
16 *
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22905
diff changeset
17 * You should have received a copy of the GNU General Public License
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22905
diff changeset
18 * along with MPlayer; if not, write to the Free Software
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22905
diff changeset
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22905
diff changeset
20 *
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22905
diff changeset
21 * Thanks to Gilles Frattini for bugfixes
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22905
diff changeset
22 *
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22905
diff changeset
23 * Changes:
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22905
diff changeset
24 * 2004-03-10
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22905
diff changeset
25 * Initial version
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22905
diff changeset
26 * 2004-10-09
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22905
diff changeset
27 * Added Doxygen documentation (Benjamin Zores <ben@geexbox.org>)
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22905
diff changeset
28 * 2004-11-08
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22905
diff changeset
29 * Added h/w revision detection (Timothy Lee <timothy.lee@siriushk.com>)
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22905
diff changeset
30 */
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
31
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
32 #include <errno.h>
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
33 #include <stdio.h>
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
34 #include <stdlib.h>
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
35 #include <string.h>
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
36 #include <inttypes.h>
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
37 #include <unistd.h>
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
38
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
39 #include "vidix.h"
22857
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
40 #include "vidixlib.h"
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
41 #include "fourcc.h"
22901
a7605669b114 renamed libdha.[hc] to dha.[hc]
ben
parents: 22900
diff changeset
42 #include "dha.h"
22900
a9e111b88c4a merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents: 22874
diff changeset
43 #include "pci_ids.h"
a9e111b88c4a merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents: 22874
diff changeset
44 #include "pci_names.h"
22905
f34e5d778267 consistent include paths for config.h et al.
diego
parents: 22901
diff changeset
45 #include "config.h"
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
46
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
47 #include "unichrome_regs.h"
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
48
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
49 /**
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
50 * @brief Information on PCI device.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
51 */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
52 pciinfo_t pci_info;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
53
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
54 /**
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
55 * @brief Unichrome driver colorkey settings.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
56 */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
57 static vidix_grkey_t uc_grkey;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
58
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
59 static int frames[VID_PLAY_MAXFRAMES];
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
60 uint8_t *vio;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
61 uint8_t *uc_mem;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
62 uint8_t mclk_save[3];
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
63 uint8_t hwrev;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
64
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
65 #define VIA_OUT(hwregs, reg, val) *(volatile uint32_t *)((hwregs) + (reg)) = (val)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
66 #define VIA_IN(hwregs, reg) *(volatile uint32_t *)((hwregs) + (reg))
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
67 #define VGA_OUT8(hwregs, reg, val) *(volatile uint8_t *)((hwregs) + (reg) + 0x8000) = (val)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
68 #define VGA_IN8(hwregs, reg) *(volatile uint8_t *)((hwregs) + (reg) + 0x8000)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
69 #define VIDEO_OUT(hwregs, reg, val) VIA_OUT((hwregs)+0x200, reg, val)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
70 #define VIDEO_IN(hwregs, reg) VIA_IN((hwregs)+0x200, reg)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
71
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
72 #define outb(val,reg) OUTPORT8(reg,val)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
73 #define inb(reg) INPORT8(reg)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
74
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
75 #define ALIGN_TO(v, n) (((v) + (n-1)) & ~(n-1))
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
76 #define UC_MAP_V1_FIFO_CONTROL(depth, pre_thr, thr) \
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
77 (((depth)-1) | ((thr) << 8) | ((pre_thr) << 24))
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
78
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
79 #define VIDEOMEMORY_SIZE (8 * 1024 * 1024)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
80 #define FRAMEBUFFER_SIZE 0x200000
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
81 #define FRAMEBUFFER_START (VIDEOMEMORY_SIZE - FRAMEBUFFER_SIZE)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
82
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
83 #ifdef DEBUG_LOGFILE
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
84 FILE *logfile = 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
85 #define LOGWRITE(x) {if(logfile) fprintf(logfile,x);}
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
86 #else
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
87 #define LOGWRITE(x)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
88 #endif
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
89
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
90 /**
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
91 * @brief Unichrome driver vidix capabilities.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
92 */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
93 static vidix_capability_t uc_cap = {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
94 "VIA CLE266 Unichrome driver",
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
95 "Timothy Lee <timothy@siriushk.com>",
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
96 TYPE_OUTPUT,
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
97 {0, 0, 0, 0},
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
98 4096,
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
99 4096,
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
100 4,
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
101 4,
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
102 -1,
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
103 FLAG_UPSCALER | FLAG_DOWNSCALER,
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
104 VENDOR_VIA2,
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
105 -1,
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
106 {0, 0, 0, 0}
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
107 };
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
108
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
109 /**
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
110 * @brief list of card IDs compliant with the Unichrome driver .
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
111 */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
112 static unsigned short uc_card_ids[] = {
22874
9a8f6901e888 updated pci ids list, fixed vidix drivers compilation and added nearly exhaustive pci ids for nvidia driver
ben
parents: 22866
diff changeset
113 DEVICE_VIA2_VT8623_APOLLO_CLE266,
9a8f6901e888 updated pci ids list, fixed vidix drivers compilation and added nearly exhaustive pci ids for nvidia driver
ben
parents: 22866
diff changeset
114 DEVICE_VIA2_VT8378_S3_UNICHROME
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
115 };
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
116
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
117 /**
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
118 * @brief Find chip index in Unichrome compliant devices list.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
119 *
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
120 * @param chip_id PCI device ID.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
121 *
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
122 * @returns index position in uc_card_ids if successful.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
123 * -1 if chip_id is not a compliant chipset ID.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
124 */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
125 static int
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
126 find_chip (unsigned chip_id)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
127 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
128 unsigned i;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
129 for (i = 0; i < sizeof (uc_card_ids) / sizeof (unsigned short); i++)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
130 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
131 if (chip_id == uc_card_ids[i])
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
132 return i;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
133 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
134 return -1;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
135 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
136
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
137 /**
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
138 * @brief Map hardware settings for vertical scaling.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
139 *
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
140 * @param sh source height.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
141 * @param dh destination height.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
142 * @param zoom will hold vertical setting of zoom register.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
143 * @param mini will hold vertical setting of mini register.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
144 *
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
145 * @returns 1 if successful.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
146 * 0 if the zooming factor is too large or small.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
147 *
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
148 * @note Derived from VIA's V4L driver.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
149 * See ddover.c, DDOVER_HQVCalcZoomHeight()
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
150 */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
151 static int
22866
234c5f92d585 killed warnings in unichrome driver
ben
parents: 22858
diff changeset
152 uc_ovl_map_vzoom (uint32_t sh, uint32_t dh, uint32_t * zoom, uint32_t * mini)
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
153 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
154 uint32_t sh1, tmp, d;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
155 int zoom_ok = 1;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
156
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
157 if (sh == dh) /* No zoom */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
158 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
159 /* Do nothing */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
160 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
161 else if (sh < dh) /* Zoom in */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
162 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
163 tmp = (sh * 0x0400) / dh;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
164 zoom_ok = !(tmp > 0x3ff);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
165
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
166 *zoom |= (tmp & 0x3ff) | V1_Y_ZOOM_ENABLE;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
167 *mini |= V1_Y_INTERPOLY | V1_YCBCR_INTERPOLY;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
168 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
169 else /* sw > dh - Zoom out */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
170 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
171 /* Find a suitable divider (1 << d) = {2, 4, 8 or 16} */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
172 sh1 = sh;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
173 for (d = 1; d < 5; d++)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
174 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
175 sh1 >>= 1;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
176 if (sh1 <= dh)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
177 break;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
178 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
179 if (d == 5) /* too small */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
180 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
181 d = 4;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
182 zoom_ok = 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
183 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
184
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
185 *mini |= ((d << 1) - 1) << 16; /* <= {1,3,5,7} << 16 */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
186
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
187 /* Add scaling */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
188 if (sh1 < dh)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
189 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
190 tmp = (sh1 * 0x400) / dh;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
191 *zoom |= ((tmp & 0x3ff) | V1_Y_ZOOM_ENABLE);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
192 *mini |= V1_Y_INTERPOLY | V1_YCBCR_INTERPOLY;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
193 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
194 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
195
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
196 return zoom_ok;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
197 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
198
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
199 /**
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
200 * @brief Map hardware settings for horizontal scaling.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
201 *
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
202 * @param sw source width.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
203 * @param dw destination width.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
204 * @param zoom will hold horizontal setting of zoom register.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
205 * @param mini will hold horizontal setting of mini register.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
206 * @param falign will hold fetch aligment.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
207 * @param dcount will hold display count.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
208 *
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
209 * @returns 1 if successful.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
210 * 0 if the zooming factor is too large or small.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
211 *
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
212 * @note Derived from VIA's V4L driver.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
213 * See ddover.c, DDOVER_HQVCalcZoomWidth() and DDOver_GetDisplayCount()
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
214 */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
215 static int
22866
234c5f92d585 killed warnings in unichrome driver
ben
parents: 22858
diff changeset
216 uc_ovl_map_hzoom (uint32_t sw, uint32_t dw, uint32_t * zoom, uint32_t * mini,
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
217 int *falign, int *dcount)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
218 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
219 uint32_t tmp, sw1, d;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
220 int md; /* Minify-divider */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
221 int zoom_ok = 1;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
222
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
223 md = 1;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
224 *falign = 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
225
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
226 if (sw == dw) /* no zoom */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
227 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
228 /* Do nothing */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
229 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
230 else if (sw < dw) /* zoom in */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
231 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
232 tmp = (sw * 0x0800) / dw;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
233 zoom_ok = !(tmp > 0x7ff);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
234
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
235 *zoom |= ((tmp & 0x7ff) << 16) | V1_X_ZOOM_ENABLE;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
236 *mini |= V1_X_INTERPOLY;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
237 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
238 else /* sw > dw - Zoom out */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
239 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
240 /* Find a suitable divider (1 << d) = {2, 4, 8 or 16} */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
241 sw1 = sw;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
242 for (d = 1; d < 5; d++)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
243 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
244 sw1 >>= 1;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
245 if (sw1 <= dw)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
246 break;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
247 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
248 if (d == 5) /* too small */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
249 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
250 d = 4;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
251 zoom_ok = 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
252 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
253
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
254 md = 1 << d; /* <= {2,4,8,16} */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
255 *falign = ((md << 1) - 1) & 0xf; /* <= {3,7,15,15} */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
256 *mini |= V1_X_INTERPOLY;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
257 *mini |= ((d << 1) - 1) << 24; /* <= {1,3,5,7} << 24 */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
258
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
259 /* Add scaling */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
260 if (sw1 < dw)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
261 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
262 /* CLE bug */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
263 /* tmp = sw1*0x0800 / dw; */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
264 tmp = (sw1 - 2) * 0x0800 / dw;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
265 *zoom |= ((tmp & 0x7ff) << 16) | V1_X_ZOOM_ENABLE;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
266 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
267 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
268
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
269 *dcount = sw - md;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
270 return zoom_ok;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
271 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
272
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
273 /**
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
274 * @brief qword fetch register setting.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
275 *
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
276 * @param format overlay pixel format.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
277 * @param sw source width.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
278 *
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
279 * @return qword fetch register setting
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
280 *
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
281 * @note Derived from VIA's V4L driver. See ddover.c, DDOver_GetFetch()
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
282 * @note Only call after uc_ovl_map_hzoom()
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
283 */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
284 static uint32_t
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
285 uc_ovl_map_qwfetch (uint32_t format, int sw)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
286 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
287 uint32_t fetch = 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
288
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
289 switch (format)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
290 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
291 case IMGFMT_YV12:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
292 case IMGFMT_I420:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
293 fetch = ALIGN_TO (sw, 32) >> 4;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
294 break;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
295 case IMGFMT_UYVY:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
296 case IMGFMT_YVYU:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
297 case IMGFMT_YUY2:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
298 fetch = (ALIGN_TO (sw << 1, 16) >> 4) + 1;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
299 break;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
300 case IMGFMT_BGR15:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
301 case IMGFMT_BGR16:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
302 fetch = (ALIGN_TO (sw << 1, 16) >> 4) + 1;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
303 break;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
304 case IMGFMT_BGR32:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
305 fetch = (ALIGN_TO (sw << 2, 16) >> 4) + 1;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
306 break;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
307 default:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
308 printf ("[unichrome] Unexpected pixelformat!");
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
309 break;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
310 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
311
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
312 if (fetch < 4)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
313 fetch = 4;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
314
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
315 return fetch;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
316 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
317
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
318 /**
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
319 * @brief Map pixel format.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
320 *
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
321 * @param format pixel format.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
322 *
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
323 * @return the mapped pixel format.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
324 *
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
325 * @note Derived from VIA's V4L driver. See ddover.c, DDOver_GetV1Format()
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
326 */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
327 static uint32_t
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
328 uc_ovl_map_format (uint32_t format)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
329 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
330 switch (format)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
331 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
332 case IMGFMT_UYVY:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
333 case IMGFMT_YVYU:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
334 case IMGFMT_YUY2:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
335 return V1_COLORSPACE_SIGN | V1_YUV422;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
336 case IMGFMT_IYUV:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
337 return V1_COLORSPACE_SIGN | V1_YCbCr420 | V1_SWAP_SW;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
338 case IMGFMT_YV12:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
339 case IMGFMT_I420:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
340 return V1_COLORSPACE_SIGN | V1_YCbCr420;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
341 case IMGFMT_BGR15:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
342 return V1_RGB15;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
343 case IMGFMT_BGR16:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
344 return V1_RGB16;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
345 case IMGFMT_BGR32:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
346 return V1_RGB32;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
347 default:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
348 printf ("[unichrome] Unexpected pixelformat!");
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
349 return V1_YUV422;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
350 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
351 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
352
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
353 /**
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
354 * @brief Calculate V1 control and fifo-control register values.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
355 *
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
356 * @param format pixel format.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
357 * @param sw source width.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
358 * @param hwrev CLE266 hardware revision.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
359 * @param extfifo_on set this 1 if the extended FIFO is enabled.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
360 * @param control will hold value for V1_CONTROL.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
361 * @param fifo will hold value for V1_FIFO_CONTROL.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
362 */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
363 static void
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
364 uc_ovl_map_v1_control (uint32_t format, int sw,
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
365 int hwrev, int extfifo_on,
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
366 uint32_t * control, uint32_t * fifo)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
367 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
368 *control = V1_BOB_ENABLE | uc_ovl_map_format (format);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
369
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
370 if (hwrev == 0x10)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
371 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
372 *control |= V1_EXPIRE_NUM_F;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
373 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
374 else
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
375 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
376 if (extfifo_on)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
377 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
378 *control |= V1_EXPIRE_NUM_A | V1_FIFO_EXTENDED;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
379 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
380 else
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
381 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
382 *control |= V1_EXPIRE_NUM;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
383 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
384 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
385
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
386 if ((format == IMGFMT_YV12) || (format == IMGFMT_I420))
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
387 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
388 /* Minified video will be skewed without this workaround. */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
389 if (sw <= 80) /* Fetch count <= 5 */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
390 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
391 *fifo = UC_MAP_V1_FIFO_CONTROL (16, 0, 0);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
392 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
393 else
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
394 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
395 if (hwrev == 0x10)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
396 *fifo = UC_MAP_V1_FIFO_CONTROL (64, 56, 56);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
397 else
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
398 *fifo = UC_MAP_V1_FIFO_CONTROL (16, 12, 8);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
399 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
400 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
401 else
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
402 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
403 if (hwrev == 0x10)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
404 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
405 *fifo = UC_MAP_V1_FIFO_CONTROL (64, 56, 56); /* Default rev 0x10 */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
406 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
407 else
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
408 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
409 if (extfifo_on)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
410 *fifo = UC_MAP_V1_FIFO_CONTROL (48, 40, 40);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
411 else
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
412 *fifo = UC_MAP_V1_FIFO_CONTROL (32, 29, 16); /* Default */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
413 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
414 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
415 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
416
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
417 /**
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
418 * @brief Setup extended FIFO.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
419 *
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
420 * @param extfifo_on pointer determining if extended fifo is enable or not.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
421 * @param dst_w destination width.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
422 */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
423 static void
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
424 uc_ovl_setup_fifo (int *extfifo_on, int dst_w)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
425 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
426 if (dst_w <= 1024) /* Disable extended FIFO */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
427 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
428 outb (0x16, 0x3c4);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
429 outb (mclk_save[0], 0x3c5);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
430 outb (0x17, 0x3c4);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
431 outb (mclk_save[1], 0x3c5);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
432 outb (0x18, 0x3c4);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
433 outb (mclk_save[2], 0x3c5);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
434 *extfifo_on = 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
435 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
436 else /* Enable extended FIFO */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
437 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
438 outb (0x17, 0x3c4);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
439 outb (0x2f, 0x3c5);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
440 outb (0x16, 0x3c4);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
441 outb ((mclk_save[0] & 0xf0) | 0x14, 0x3c5);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
442 outb (0x18, 0x3c4);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
443 outb (0x56, 0x3c5);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
444 *extfifo_on = 1;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
445 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
446 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
447
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
448 static void
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
449 uc_ovl_vcmd_wait (volatile uint8_t * vio)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
450 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
451 while ((VIDEO_IN (vio, V_COMPOSE_MODE)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
452 & (V1_COMMAND_FIRE | V3_COMMAND_FIRE)));
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
453 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
454
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
455 /**
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
456 * @brief Probe hardware to find some useable chipset.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
457 *
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
458 * @param verbose specifies verbose level.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
459 * @param force specifies force mode : driver should ignore
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
460 * device_id (danger but useful for new devices)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
461 *
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
462 * @returns 0 if it can handle something in PC.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
463 * a negative error code otherwise.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
464 */
22857
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
465 static int
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
466 unichrome_probe (int verbose, int force)
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
467 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
468 pciinfo_t lst[MAX_PCI_DEVICES];
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
469 unsigned i, num_pci;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
470 int err;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
471 err = pci_scan (lst, &num_pci);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
472 if (err)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
473 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
474 printf ("[unichrome] Error occurred during pci scan: %s\n",
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
475 strerror (err));
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
476 return err;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
477 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
478 else
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
479 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
480 err = ENXIO;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
481 for (i = 0; i < num_pci; i++)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
482 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
483 if (lst[i].vendor == VENDOR_VIA2)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
484 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
485 int idx;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
486 const char *dname;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
487 idx = find_chip (lst[i].device);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
488 if (idx == -1)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
489 continue;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
490 dname = pci_device_name (VENDOR_VIA2, lst[i].device);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
491 dname = dname ? dname : "Unknown chip";
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
492 printf ("[unichrome] Found chip: %s\n", dname);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
493 if ((lst[i].command & PCI_COMMAND_IO) == 0)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
494 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
495 printf ("[unichrome] Device is disabled, ignoring\n");
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
496 continue;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
497 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
498 uc_cap.device_id = lst[i].device;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
499 err = 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
500 memcpy (&pci_info, &lst[i], sizeof (pciinfo_t));
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
501 break;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
502 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
503 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
504 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
505
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
506 if (err && verbose)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
507 printf ("[unichrome] Can't find chip\n");
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
508 return err;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
509 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
510
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
511 /**
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
512 * @brief Initializes driver.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
513 *
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
514 * @returns 0 if ok.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
515 * a negative error code otherwise.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
516 */
22857
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
517 static int
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
518 unichrome_init (void)
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
519 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
520 long tmp;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
521 uc_mem = map_phys_mem (pci_info.base0, VIDEOMEMORY_SIZE);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
522 enable_app_io ();
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
523
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
524 outb (0x2f, 0x3c4);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
525 tmp = inb (0x3c5) << 0x18;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
526 vio = map_phys_mem (tmp, 0x1000);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
527
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
528 outb (0x16, 0x3c4);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
529 mclk_save[0] = inb (0x3c5);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
530 outb (0x17, 0x3c4);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
531 mclk_save[1] = inb (0x3c5);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
532 outb (0x18, 0x3c4);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
533 mclk_save[2] = inb (0x3c5);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
534
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
535 uc_grkey.ckey.blue = 0x00;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
536 uc_grkey.ckey.green = 0x00;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
537 uc_grkey.ckey.red = 0x00;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
538
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
539 /* Detect whether we have a CLE266Ax or CLE266Cx */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
540 outb (0x4f, 0x3d4);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
541 tmp = inb (0x3d5);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
542 outb (0x4f, 0x3d4);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
543 outb (0x55, 0x3d5);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
544 outb (0x4f, 0x3d4);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
545 if (0x55 == inb (0x3d5))
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
546 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
547 /* Only CLE266Cx supports CR4F */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
548 hwrev = 0x11;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
549 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
550 else
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
551 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
552 /* Otherwise assume to be a CLE266Ax */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
553 hwrev = 0x00;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
554 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
555 outb (0x4f, 0x3d4);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
556 outb (tmp, 0x3d5);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
557
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
558 #ifdef DEBUG_LOGFILE
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
559 logfile = fopen ("/tmp/uc_vidix.log", "w");
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
560 #endif
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
561 return 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
562 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
563
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
564 /**
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
565 * @brief Destroys driver.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
566 */
22857
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
567 static void
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
568 unichrome_destroy (void)
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
569 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
570 #ifdef DEBUG_LOGFILE
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
571 if (logfile)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
572 fclose (logfile);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
573 #endif
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
574 outb (0x16, 0x3c4);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
575 outb (mclk_save[0], 0x3c5);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
576 outb (0x17, 0x3c4);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
577 outb (mclk_save[1], 0x3c5);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
578 outb (0x18, 0x3c4);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
579 outb (mclk_save[2], 0x3c5);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
580
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
581 disable_app_io ();
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
582 unmap_phys_mem (uc_mem, VIDEOMEMORY_SIZE);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
583 unmap_phys_mem (vio, 0x1000);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
584 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
585
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
586 /**
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
587 * @brief Get chipset's hardware capabilities.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
588 *
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
589 * @param to Pointer to the vidix_capability_t structure to be filled.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
590 *
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
591 * @returns 0.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
592 */
22857
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
593 static int
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
594 unichrome_get_caps (vidix_capability_t * to)
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
595 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
596 memcpy (to, &uc_cap, sizeof (vidix_capability_t));
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
597 return 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
598 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
599
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
600 /**
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
601 * @brief Report if the video FourCC is supported by hardware.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
602 *
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
603 * @param fourcc input image format.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
604 *
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
605 * @returns 1 if the fourcc is supported.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
606 * 0 otherwise.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
607 */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
608 static int
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
609 is_supported_fourcc (uint32_t fourcc)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
610 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
611 switch (fourcc)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
612 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
613 case IMGFMT_YV12:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
614 case IMGFMT_I420:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
615 case IMGFMT_UYVY:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
616 case IMGFMT_YVYU:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
617 case IMGFMT_YUY2:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
618 case IMGFMT_BGR15:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
619 case IMGFMT_BGR16:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
620 case IMGFMT_BGR32:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
621 return 1;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
622 default:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
623 return 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
624 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
625 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
626
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
627 /**
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
628 * @brief Try to configure video memory for given fourcc.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
629 *
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
630 * @param to Pointer to the vidix_fourcc_t structure to be filled.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
631 *
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
632 * @returns 0 if ok.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
633 * errno otherwise.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
634 */
22857
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
635 static int
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
636 unichrome_query_fourcc (vidix_fourcc_t * to)
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
637 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
638 if (is_supported_fourcc (to->fourcc))
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
639 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
640 to->depth = VID_DEPTH_1BPP | VID_DEPTH_2BPP |
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
641 VID_DEPTH_4BPP | VID_DEPTH_8BPP |
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
642 VID_DEPTH_12BPP | VID_DEPTH_15BPP |
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
643 VID_DEPTH_16BPP | VID_DEPTH_24BPP | VID_DEPTH_32BPP;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
644 to->flags = VID_CAP_EXPAND | VID_CAP_SHRINK | VID_CAP_COLORKEY;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
645 return 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
646 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
647 else
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
648 to->depth = to->flags = 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
649 return ENOSYS;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
650 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
651
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
652 /**
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
653 * @brief Get the GrKeys
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
654 *
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
655 * @param grkey Pointer to the vidix_grkey_t structure to be filled by driver.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
656 *
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
657 * @return 0.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
658 */
22857
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
659 static int
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
660 unichrome_get_gkey (vidix_grkey_t * grkey)
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
661 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
662 memcpy (grkey, &uc_grkey, sizeof (vidix_grkey_t));
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
663 return (0);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
664 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
665
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
666 /**
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
667 * @brief Set the GrKeys
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
668 *
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
669 * @param grkey Colorkey to be set.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
670 *
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
671 * @return 0.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
672 */
22857
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
673 static int
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
674 unichrome_set_gkey (const vidix_grkey_t * grkey)
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
675 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
676 unsigned long dwCompose = VIDEO_IN (vio, V_COMPOSE_MODE) & ~0x0f;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
677 memcpy (&uc_grkey, grkey, sizeof (vidix_grkey_t));
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
678 if (uc_grkey.ckey.op != CKEY_FALSE)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
679 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
680 /* Set colorkey (how do I detect BPP in hardware ??) */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
681 unsigned long ckey;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
682 if (1) /* Assume 16-bit graphics */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
683 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
684 ckey = (grkey->ckey.blue & 0x1f)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
685 | ((grkey->ckey.green & 0x3f) << 5)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
686 | ((grkey->ckey.red & 0x1f) << 11);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
687 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
688 else
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
689 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
690 ckey = (grkey->ckey.blue)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
691 | (grkey->ckey.green << 8) | (grkey->ckey.red << 16);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
692 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
693 VIDEO_OUT (vio, V_COLOR_KEY, ckey);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
694 dwCompose |= SELECT_VIDEO_IF_COLOR_KEY;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
695 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
696
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
697 /* Execute the changes */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
698 VIDEO_OUT (vio, V_COMPOSE_MODE, dwCompose | V1_COMMAND_FIRE);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
699 return (0);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
700 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
701
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
702 /**
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
703 * @brief Unichrome driver equalizer capabilities.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
704 */
22857
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
705 static vidix_video_eq_t equal = {
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
706 VEQ_CAP_BRIGHTNESS | VEQ_CAP_SATURATION | VEQ_CAP_HUE,
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
707 300, 100, 0, 0, 0, 0, 0, 0
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
708 };
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
709
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
710
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
711 /**
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
712 * @brief Get the equalizer capabilities.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
713 *
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
714 * @param eq Pointer to the vidix_video_eq_t structure to be filled by driver.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
715 *
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
716 * @return 0.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
717 */
22857
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
718 static int
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
719 unichrome_get_eq (vidix_video_eq_t * eq)
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
720 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
721 memcpy (eq, &equal, sizeof (vidix_video_eq_t));
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
722 return 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
723 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
724
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
725 /**
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
726 * @brief Set the equalizer capabilities for color correction
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
727 *
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
728 * @param eq equalizer capabilities to be set.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
729 *
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
730 * @return 0.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
731 */
22857
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
732 static int
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
733 unichrome_set_eq (const vidix_video_eq_t * eq)
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
734 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
735 return 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
736 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
737
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
738 /**
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
739 * @brief Y, U, V offsets.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
740 */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
741 static int YOffs, UOffs, VOffs;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
742
22857
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
743 static int unichrome_frame_select (unsigned int frame);
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
744
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
745 /**
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
746 * @brief Configure driver for playback. Driver should prepare BES.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
747 *
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
748 * @param info configuration description for playback.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
749 *
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
750 * @returns 0 in case of success.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
751 * -1 otherwise.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
752 */
22857
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
753 static int
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
754 unichrome_config_playback (vidix_playback_t * info)
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
755 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
756 int src_w, drw_w;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
757 int src_h, drw_h;
22866
234c5f92d585 killed warnings in unichrome driver
ben
parents: 22858
diff changeset
758 long base0, pitch = 0;
234c5f92d585 killed warnings in unichrome driver
ben
parents: 22858
diff changeset
759 int uv_size = 0, swap_uv;
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
760 unsigned int i;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
761 int extfifo_on;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
762
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
763 /* Overlay register settings */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
764 uint32_t win_start, win_end;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
765 uint32_t zoom, mini;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
766 uint32_t dcount, falign, qwfetch;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
767 uint32_t v_ctrl, fifo_ctrl;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
768
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
769 if (!is_supported_fourcc (info->fourcc))
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
770 return -1;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
771
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
772 src_w = info->src.w;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
773 src_h = info->src.h;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
774
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
775 drw_w = info->dest.w;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
776 drw_h = info->dest.h;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
777
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
778 /* Setup FIFO */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
779 uc_ovl_setup_fifo (&extfifo_on, src_w);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
780
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
781 /* Get image format, FIFO size, etc. */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
782 uc_ovl_map_v1_control (info->fourcc, src_w, hwrev, extfifo_on,
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
783 &v_ctrl, &fifo_ctrl);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
784
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
785 /* Setup layer window */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
786 win_start = (info->dest.x << 16) | info->dest.y;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
787 win_end = ((info->dest.x + drw_w - 1) << 16) | (info->dest.y + drw_h - 1);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
788
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
789 /* Get scaling and data-fetch parameters */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
790 zoom = 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
791 mini = 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
792 uc_ovl_map_vzoom (src_h, drw_h, &zoom, &mini);
22866
234c5f92d585 killed warnings in unichrome driver
ben
parents: 22858
diff changeset
793 uc_ovl_map_hzoom (src_w, drw_w, &zoom, &mini, (int *) &falign, (int *) &dcount);
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
794 qwfetch = uc_ovl_map_qwfetch (info->fourcc, src_w);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
795
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
796 /* Calculate buffer sizes */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
797 swap_uv = 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
798 switch (info->fourcc)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
799 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
800 case IMGFMT_YV12:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
801 swap_uv = 1;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
802 case IMGFMT_I420:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
803 case IMGFMT_UYVY:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
804 case IMGFMT_YVYU:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
805 pitch = ALIGN_TO (src_w, 32);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
806 uv_size = (pitch >> 1) * (src_h >> 1);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
807 break;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
808
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
809 case IMGFMT_YUY2:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
810 case IMGFMT_BGR15:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
811 case IMGFMT_BGR16:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
812 pitch = ALIGN_TO (src_w << 1, 32);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
813 uv_size = 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
814 break;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
815
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
816 case IMGFMT_BGR32:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
817 pitch = ALIGN_TO (src_w << 2, 32);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
818 uv_size = 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
819 break;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
820 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
821 if ((src_w > 4096) || (src_h > 4096) ||
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
822 (src_w < 32) || (src_h < 1) || (pitch > 0x1fff))
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
823 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
824 printf ("[unichrome] Layer size out of bounds\n");
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
825 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
826
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
827 /* Calculate offsets */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
828 info->offset.y = 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
829 info->offset.v = info->offset.y + pitch * src_h;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
830 info->offset.u = info->offset.v + uv_size;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
831 info->frame_size = info->offset.u + uv_size;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
832 YOffs = info->offset.y;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
833 UOffs = (swap_uv ? info->offset.v : info->offset.u);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
834 VOffs = (swap_uv ? info->offset.u : info->offset.v);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
835
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
836 /* Assume we have 2 MB to play with */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
837 info->num_frames = FRAMEBUFFER_SIZE / info->frame_size;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
838 if (info->num_frames > VID_PLAY_MAXFRAMES)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
839 info->num_frames = VID_PLAY_MAXFRAMES;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
840
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
841 /* Start at 6 MB. Let's hope it's not in use. */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
842 base0 = FRAMEBUFFER_START;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
843 info->dga_addr = uc_mem + base0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
844
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
845 info->dest.pitch.y = 32;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
846 info->dest.pitch.u = 32;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
847 info->dest.pitch.v = 32;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
848
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
849 for (i = 0; i < info->num_frames; i++)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
850 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
851 info->offsets[i] = info->frame_size * i;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
852 frames[i] = base0 + info->offsets[i];
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
853 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
854
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
855 /* Write to the hardware */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
856 uc_ovl_vcmd_wait (vio);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
857
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
858 /* Configure diy_pitchlay parameters now */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
859 if (v_ctrl & V1_COLORSPACE_SIGN)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
860 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
861 if (hwrev >= 0x10)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
862 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
863 VIDEO_OUT (vio, V1_ColorSpaceReg_2, ColorSpaceValue_2_3123C0);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
864 VIDEO_OUT (vio, V1_ColorSpaceReg_1, ColorSpaceValue_1_3123C0);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
865 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
866 else
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
867 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
868 VIDEO_OUT (vio, V1_ColorSpaceReg_2, ColorSpaceValue_2);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
869 VIDEO_OUT (vio, V1_ColorSpaceReg_1, ColorSpaceValue_1);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
870 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
871 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
872
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
873 VIDEO_OUT (vio, V1_CONTROL, v_ctrl);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
874 VIDEO_OUT (vio, V_FIFO_CONTROL, fifo_ctrl);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
875
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
876 VIDEO_OUT (vio, V1_WIN_START_Y, win_start);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
877 VIDEO_OUT (vio, V1_WIN_END_Y, win_end);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
878
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
879 VIDEO_OUT (vio, V1_SOURCE_HEIGHT, (src_h << 16) | dcount);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
880
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
881 VIDEO_OUT (vio, V12_QWORD_PER_LINE, qwfetch << 20);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
882 VIDEO_OUT (vio, V1_STRIDE, pitch | ((pitch >> 1) << 16));
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
883
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
884 VIDEO_OUT (vio, V1_MINI_CONTROL, mini);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
885 VIDEO_OUT (vio, V1_ZOOM_CONTROL, zoom);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
886
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
887 /* Configure buffer address and execute the changes now! */
22857
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
888 unichrome_frame_select (0);
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
889
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
890 return 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
891 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
892
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
893 /**
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
894 * @brief Set playback on : driver should activate BES on this call.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
895 *
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
896 * @return 0.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
897 */
22857
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
898 static int
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
899 unichrome_playback_on (void)
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
900 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
901 LOGWRITE ("Enable overlay\n");
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
902
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
903 /* Turn on overlay */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
904 VIDEO_OUT (vio, V1_CONTROL, VIDEO_IN (vio, V1_CONTROL) | V1_ENABLE);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
905
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
906 /* Execute the changes */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
907 VIDEO_OUT (vio, V_COMPOSE_MODE,
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
908 VIDEO_IN (vio, V_COMPOSE_MODE) | V1_COMMAND_FIRE);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
909
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
910 return 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
911 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
912
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
913 /**
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
914 * @brief Set playback off : driver should deactivate BES on this call.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
915 *
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
916 * @return 0.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
917 */
22857
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
918 static int
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
919 unichrome_playback_off (void)
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
920 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
921 LOGWRITE ("Disable overlay\n");
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
922
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
923 uc_ovl_vcmd_wait (vio);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
924
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
925 /* Restore FIFO */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
926 VIDEO_OUT (vio, V_FIFO_CONTROL, UC_MAP_V1_FIFO_CONTROL (16, 12, 8));
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
927
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
928 /* Turn off overlay */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
929 VIDEO_OUT (vio, V1_CONTROL, VIDEO_IN (vio, V1_CONTROL) & ~V1_ENABLE);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
930
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
931 /* Execute the changes */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
932 VIDEO_OUT (vio, V_COMPOSE_MODE,
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
933 VIDEO_IN (vio, V_COMPOSE_MODE) | V1_COMMAND_FIRE);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
934
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
935 return 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
936 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
937
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
938 /**
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
939 * @brief Driver should prepare and activate corresponded frame.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
940 *
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
941 * @param frame the frame index.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
942 *
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
943 * @return 0.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
944 *
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
945 * @note This function is used only for double and triple buffering
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
946 * and never used for single buffering playback.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
947 */
22857
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
948 static int
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
949 unichrome_frame_select (unsigned int frame)
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
950 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
951 LOGWRITE ("Frame select\n");
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
952
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
953 uc_ovl_vcmd_wait (vio);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
954
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
955 /* Configure buffer address */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
956 VIDEO_OUT (vio, V1_STARTADDR_Y0, frames[frame] + YOffs);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
957 VIDEO_OUT (vio, V1_STARTADDR_CB0, frames[frame] + UOffs);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
958 VIDEO_OUT (vio, V1_STARTADDR_CR0, frames[frame] + VOffs);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
959
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
960 /* Execute the changes */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
961 VIDEO_OUT (vio, V_COMPOSE_MODE,
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
962 VIDEO_IN (vio, V_COMPOSE_MODE) | V1_COMMAND_FIRE);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
963
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
964 return 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
965 }
22857
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
966
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
967 VDXDriver unichrome_drv = {
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
968 "unichrome",
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
969 NULL,
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
970 .probe = unichrome_probe,
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
971 .get_caps = unichrome_get_caps,
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
972 .query_fourcc = unichrome_query_fourcc,
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
973 .init = unichrome_init,
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
974 .destroy = unichrome_destroy,
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
975 .config_playback = unichrome_config_playback,
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
976 .playback_on = unichrome_playback_on,
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
977 .playback_off = unichrome_playback_off,
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
978 .frame_sel = unichrome_frame_select,
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
979 .get_eq = unichrome_get_eq,
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
980 .set_eq = unichrome_set_eq,
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
981 .get_gkey = unichrome_get_gkey,
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
982 .set_gkey = unichrome_set_gkey,
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
983 };