annotate vidix/drivers/unichrome_vid.c @ 13605:c971585ddcab

CLE266 Vidix driver initial patch by Timothy Lee <timothy@siriushk.com>, doxygen comments by Benjamin Zores <ben@tutuxclan.org>
author faust3
date Sun, 10 Oct 2004 19:22:38 +0000
parents
children be030b3627a1
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
c971585ddcab CLE266 Vidix driver initial patch by Timothy Lee <timothy@siriushk.com>, doxygen comments by Benjamin Zores <ben@tutuxclan.org>
faust3
parents:
diff changeset
22 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
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>)
c971585ddcab CLE266 Vidix driver initial patch by Timothy Lee <timothy@siriushk.com>, doxygen comments by Benjamin Zores <ben@tutuxclan.org>
faust3
parents:
diff changeset
29
c971585ddcab CLE266 Vidix driver initial patch by Timothy Lee <timothy@siriushk.com>, doxygen comments by Benjamin Zores <ben@tutuxclan.org>
faust3
parents:
diff changeset
30 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
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
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 #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
34 #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
35 #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
36 #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
37 #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
38 #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
39
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 "../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
41 #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
42 #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
43 #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
44 #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
45 #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
46
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 "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
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 /**
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 * @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
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 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
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 /**
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 * @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
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 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
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 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
60 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
61 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
62 uint8_t mclk_save[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
63
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 #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
65 #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
66 #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
67 #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
68 #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
69 #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
70
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 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
72 #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
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 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
75 #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
76 (((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
77
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 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
79 #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
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 #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
82 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
83 #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
84 #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
85 #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
86 #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
87
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 /**
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 * @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
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 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
92 "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
93 "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
94 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
95 {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
96 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
97 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
98 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
99 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
100 -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
101 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
102 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
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 {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
105 };
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
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 /**
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 * @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
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 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
111 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
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
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 /**
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 * @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
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 * @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
118 */
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 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
120 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
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 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
123 }
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 /**
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 * @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
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 * @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
129 *
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 * @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
131 * -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
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 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
134 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
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 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
137 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
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 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
140 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
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 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
143 }
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 /**
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 * @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
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 * @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
149 * @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
150 * @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
151 * @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
152 *
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 * @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
154 * 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
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 * @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
157 * 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
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 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
160 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
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 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
163 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
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 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
166 {
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 /* 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
168 }
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 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
170 {
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 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
172 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
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 *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
175 *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
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 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
178 {
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 /* 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
180 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
181 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
182 {
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 >>= 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
184 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
185 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
186 }
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 (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
188 {
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 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
190 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
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
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 *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
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 /* 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
196 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
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 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
199 *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
200 *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
201 }
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 }
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
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 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
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 /**
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 * @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
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 * @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
211 * @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
212 * @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
213 * @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
214 * @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
215 * @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
216 *
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 * @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
218 * 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
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 * @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
221 * 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
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 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
224 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
225 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
226 {
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 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
228 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
229 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
230
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 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
232 *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
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 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
235 {
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 /* 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
237 }
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 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
239 {
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 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
241 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
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 *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
244 *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
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 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
247 {
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 /* 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
249 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
250 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
251 {
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 >>= 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
253 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
254 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
255 }
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 (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
257 {
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 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
259 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
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
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 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
263 *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
264 *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
265 *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
266
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 /* 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
268 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
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 /* 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
271 /* 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
272 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
273 *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
274 }
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 }
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
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 *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
278 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
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
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 /**
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 * @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
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 * @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
285 * @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
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 * @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
288 *
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 * @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
290 * @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
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 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
293 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
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 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
296
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 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
298 {
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 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
300 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
301 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
302 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
303 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
304 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
305 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
306 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
307 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
308 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
309 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
310 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
311 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
312 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
313 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
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 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
316 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
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 }
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
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 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
321 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
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 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
324 }
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 /**
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 * @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
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 * @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
330 *
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 * @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
332 *
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 * @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
334 */
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 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
336 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
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 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
339 {
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 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
341 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
342 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
343 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
344 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
345 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
346 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
347 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
348 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
349 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
350 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
351 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
352 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
353 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
354 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
355 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
356 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
357 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
358 }
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 }
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
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 * @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
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 * @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
365 * @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
366 * @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
367 * @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
368 * @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
369 * @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
370 */
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 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
372 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
373 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
374 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
375 {
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 *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
377
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 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
379 {
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 *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
381 }
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 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
383 {
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 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
385 {
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 *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
387 }
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 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
389 {
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 *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
391 }
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
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 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
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 /* 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
397 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
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 *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
400 }
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 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
402 {
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 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
404 *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
405 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
406 *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
407 }
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 }
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 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
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 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
412 {
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 *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
414 }
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 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
416 {
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 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
418 *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
419 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
420 *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
421 }
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 }
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 }
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 * @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
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 * @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
429 * @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
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 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
432 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
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 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
435 {
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 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
437 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
438 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
439 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
440 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
441 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
442 *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
443 }
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 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
445 {
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 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
447 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
448 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
449 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
450 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
451 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
452 *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
453 }
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 }
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
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 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
457 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
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 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
460 & (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
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
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 /**
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 * @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
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 * @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
467 * @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
468 * 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
469 *
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 * @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
471 * 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
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 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
474 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
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 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
477 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
478 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
479 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
480 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
481 {
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 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
483 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
484 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
485 }
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 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
487 {
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 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
489 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
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 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
492 {
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 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
494 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
495 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
496 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
497 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
498 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
499 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
500 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
501 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
502 {
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] 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
504 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
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 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
507 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
508 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
509 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
510 }
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 }
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 }
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 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
515 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
516 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
517 }
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
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 /**
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 * @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
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 * @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
523 * 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
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 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
526 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
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 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
529 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
530 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
531
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 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
533 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
534 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
535
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 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
537 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
538 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
539 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
540 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
541 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
542
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 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
544 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
545 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
546
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 #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
548 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
549 #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
550 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
551 }
c971585ddcab CLE266 Vidix driver initial patch by Timothy Lee <timothy@siriushk.com>, doxygen comments by Benjamin Zores <ben@tutuxclan.org>
faust3
parents:
diff changeset
552
c971585ddcab CLE266 Vidix driver initial patch by Timothy Lee <timothy@siriushk.com>, doxygen comments by Benjamin Zores <ben@tutuxclan.org>
faust3
parents:
diff changeset
553 /**
c971585ddcab CLE266 Vidix driver initial patch by Timothy Lee <timothy@siriushk.com>, doxygen comments by Benjamin Zores <ben@tutuxclan.org>
faust3
parents:
diff changeset
554 * @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
555 */
c971585ddcab CLE266 Vidix driver initial patch by Timothy Lee <timothy@siriushk.com>, doxygen comments by Benjamin Zores <ben@tutuxclan.org>
faust3
parents:
diff changeset
556 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
557 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
558 {
c971585ddcab CLE266 Vidix driver initial patch by Timothy Lee <timothy@siriushk.com>, doxygen comments by Benjamin Zores <ben@tutuxclan.org>
faust3
parents:
diff changeset
559 #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
560 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
561 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
562 #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
563 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
564 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
565 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
566 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
567 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
568 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
569
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 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
571 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
572 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
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 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
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 * @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
579 *
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 * @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
581 */
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 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
583 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
584 {
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 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
586 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
587 }
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
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 /**
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 * @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
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 * @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
593 *
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 * @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
595 * 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
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 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
598 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
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 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
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 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
603 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
604 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
605 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
606 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
607 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
608 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
609 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
610 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
611 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
612 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
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 }
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 /**
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 * @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
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 * @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
620 *
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 * @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
622 * 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
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 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
625 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
626 {
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 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
628 {
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 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
630 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
631 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
632 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
633 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
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 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
637 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
638 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
639 }
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 /**
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 * @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
643 *
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 * @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
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 * @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
647 */
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 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
649 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
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 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
652 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
653 }
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
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 /**
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 * @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
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 * @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
659 *
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 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
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 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
663 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
664 {
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 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
666 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
667 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
668 {
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 /* 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
670 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
671 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
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 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
674 | ((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
675 | ((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
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 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
678 {
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 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
680 | (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
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 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
683 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
684 }
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
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 /* 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
687 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
688 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
689 }
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 /**
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 * @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
693 */
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 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
695 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
696 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
697 };
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
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 * @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
702 *
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 * @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
704 *
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 * @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
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 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
708 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
709 {
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 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
711 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
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 /**
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 * @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
716 *
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 * @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
718 *
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 * @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
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 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
722 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
723 {
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 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
725 }
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 /**
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 * @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
729 */
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 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
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 /**
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 * @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
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 * @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
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 * @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
738 * -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
739 */
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 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
741 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
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 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
744 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
745 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
746 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
747 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
748 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
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 /* 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
751 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
752 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
753 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
754 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
755 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
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 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
758 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
759
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 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
761 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
762
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 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
764 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
765
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 /* 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
767 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
768
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 /* Get image format, FIFO size, etc. */
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 uc_ovl_map_v1_control (info->fourcc, src_w, 3, 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 &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
772
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 /* 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
774 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
775 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
776
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 /* 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
778 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
779 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
780 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
781 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
782 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
783
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 /* 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
785 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
786 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
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 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
789 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
790 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
791 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
792 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
793 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
794 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
795 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
796
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 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
798 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
799 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
800 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
801 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
802 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
803
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 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
805 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
806 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
807 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
808 }
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 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
810 (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
811 {
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 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
813 }
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
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 /* 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
816 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
817 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
818 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
819 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
820 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
821 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
822 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
823
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 /* 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
825 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
826 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
827 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
828
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 /* 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
830 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
831 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
832
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 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
834 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
835 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
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 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
838 {
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->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
840 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
841 }
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
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 /* 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
844 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
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 /* 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
847 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
848 {
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 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
850 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
851 }
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
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 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
854 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
855
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 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
857 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
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 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
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 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
862 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
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 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
865 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
866
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 /* 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
868 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
869
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 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
871 }
c971585ddcab CLE266 Vidix driver initial patch by Timothy Lee <timothy@siriushk.com>, doxygen comments by Benjamin Zores <ben@tutuxclan.org>
faust3
parents:
diff changeset
872
c971585ddcab CLE266 Vidix driver initial patch by Timothy Lee <timothy@siriushk.com>, doxygen comments by Benjamin Zores <ben@tutuxclan.org>
faust3
parents:
diff changeset
873 /**
c971585ddcab CLE266 Vidix driver initial patch by Timothy Lee <timothy@siriushk.com>, doxygen comments by Benjamin Zores <ben@tutuxclan.org>
faust3
parents:
diff changeset
874 * @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
875 *
c971585ddcab CLE266 Vidix driver initial patch by Timothy Lee <timothy@siriushk.com>, doxygen comments by Benjamin Zores <ben@tutuxclan.org>
faust3
parents:
diff changeset
876 * @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
877 */
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 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
879 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
880 {
c971585ddcab CLE266 Vidix driver initial patch by Timothy Lee <timothy@siriushk.com>, doxygen comments by Benjamin Zores <ben@tutuxclan.org>
faust3
parents:
diff changeset
881 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
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 /* 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
884 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
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 /* 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
887 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
888 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
889
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 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
891 }
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
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 * @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
895 *
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 * @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
897 */
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 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
899 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
900 {
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 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
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 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
904
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 /* 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
906 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
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 /* 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
909 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
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 /* 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
912 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
913 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
914
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 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
916 }
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
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 /**
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 * @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
920 *
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 * @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
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 * @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
924 *
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 * @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
926 * 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
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 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
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 ("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
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 /* 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
936 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
937 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
938 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
939
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 /* 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
941 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
942 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
943
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 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
945 }