annotate vidix/drivers/unichrome_vid.c @ 17386:54519db088ee

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