annotate vidix/drivers/mach64_vid.c @ 4721:e441ca06638d

Works with YUY2 fourcc
author nick
date Sat, 16 Feb 2002 07:55:44 +0000
parents 9c23a7497a6d
children 39f3bfae472c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4691
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
1 /*
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
2 mach64_vid - VIDIX based video driver for Mach64 and 3DRage chips
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
3 Copyrights 2002 Nick Kurshev. This file is based on sources from
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
4 GATOS (gatos.sf.net) and X11 (www.xfree86.org)
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
5 Licence: GPL
4721
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
6 WARNING: THIS DRIVER IS IN BETTA STAGE AND DOESN'T WORK WITH PLANAR FOURCCS!
4691
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
7 */
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
8 #include <errno.h>
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
9 #include <stdio.h>
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
10 #include <stdlib.h>
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
11 #include <string.h>
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
12 #include <math.h>
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
13 #include <inttypes.h>
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
14 #include <fcntl.h>
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
15
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
16 #include "../vidix.h"
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
17 #include "../fourcc.h"
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
18 #include "../../libdha/libdha.h"
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
19 #include "../../libdha/pci_ids.h"
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
20 #include "../../libdha/pci_names.h"
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
21
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
22 #include "mach64.h"
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
23
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
24 #define UNUSED(x) ((void)(x)) /**< Removes warning about unused arguments */
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
25
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
26 static void *mach64_mmio_base = 0;
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
27 static void *mach64_mem_base = 0;
4721
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
28 static int32_t mach64_overlay_offset = 0;
4691
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
29 static uint32_t mach64_ram_size = 0;
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
30
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
31 pciinfo_t pci_info;
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
32 static int probed = 0;
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
33 static int __verbose = 0;
4721
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
34
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
35 typedef struct bes_registers_s
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
36 {
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
37 /* base address of yuv framebuffer */
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
38 uint32_t yuv_base;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
39 uint32_t fourcc;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
40 /* YUV BES registers */
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
41 uint32_t reg_load_cntl;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
42 uint32_t scale_inc;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
43 uint32_t y_x_start;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
44 uint32_t y_x_end;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
45 uint32_t vid_buf_pitch;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
46 uint32_t height_width;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
47 uint32_t vid_buf0_base_adrs;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
48 uint32_t vid_buf1_base_adrs;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
49 uint32_t vid_buf2_base_adrs;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
50 uint32_t vid_buf3_base_adrs;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
51 uint32_t vid_buf4_base_adrs;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
52 uint32_t vid_buf5_base_adrs;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
53
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
54 uint32_t scale_cntl;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
55 uint32_t exclusive_horz;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
56 uint32_t auto_flip_cntl;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
57 uint32_t filter_cntl;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
58 uint32_t key_cntl;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
59 uint32_t test;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
60 /* Configurable stuff */
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
61 int double_buff;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
62
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
63 int brightness;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
64 int saturation;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
65
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
66 int ckey_on;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
67 uint32_t graphics_key_clr;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
68 uint32_t graphics_key_msk;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
69
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
70 int deinterlace_on;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
71 uint32_t deinterlace_pattern;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
72
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
73 } bes_registers_t;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
74
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
75 static bes_registers_t besr;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
76
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
77 typedef struct video_registers_s
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
78 {
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
79 const char * sname;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
80 uint32_t name;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
81 uint32_t value;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
82 }video_registers_t;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
83
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
84 static bes_registers_t besr;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
85 #define DECLARE_VREG(name) { #name, name, 0 }
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
86 static video_registers_t vregs[] =
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
87 {
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
88 DECLARE_VREG(OVERLAY_SCALE_INC),
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
89 DECLARE_VREG(OVERLAY_Y_X_START),
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
90 DECLARE_VREG(OVERLAY_Y_X_END),
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
91 DECLARE_VREG(OVERLAY_SCALE_CNTL),
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
92 DECLARE_VREG(OVERLAY_EXCLUSIVE_HORZ),
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
93 DECLARE_VREG(OVERLAY_EXCLUSIVE_VERT),
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
94 DECLARE_VREG(OVERLAY_TEST),
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
95 DECLARE_VREG(SCALER_BUF_PITCH),
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
96 DECLARE_VREG(SCALER_HEIGHT_WIDTH),
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
97 DECLARE_VREG(SCALER_BUF0_OFFSET),
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
98 DECLARE_VREG(SCALER_BUF0_OFFSET_U),
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
99 DECLARE_VREG(SCALER_BUF0_OFFSET_V),
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
100 DECLARE_VREG(SCALER_BUF1_OFFSET),
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
101 DECLARE_VREG(SCALER_BUF1_OFFSET_U),
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
102 DECLARE_VREG(SCALER_BUF1_OFFSET_V),
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
103 DECLARE_VREG(SCALER_H_COEFF0),
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
104 DECLARE_VREG(SCALER_H_COEFF1),
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
105 DECLARE_VREG(SCALER_H_COEFF2),
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
106 DECLARE_VREG(SCALER_H_COEFF3),
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
107 DECLARE_VREG(SCALER_H_COEFF4),
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
108 DECLARE_VREG(SCALER_COLOUR_CNTL),
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
109 DECLARE_VREG(SCALER_THRESHOLD),
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
110 DECLARE_VREG(VIDEO_FORMAT),
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
111 DECLARE_VREG(VIDEO_CONFIG),
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
112 DECLARE_VREG(VIDEO_SYNC_TEST),
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
113 DECLARE_VREG(VIDEO_SYNC_TEST_B)
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
114 };
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
115
4691
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
116 /* VIDIX exports */
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
117
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
118 /* MMIO space*/
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
119 #define GETREG(TYPE,PTR,OFFZ) (*((volatile TYPE*)((PTR)+(OFFZ))))
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
120 #define SETREG(TYPE,PTR,OFFZ,VAL) (*((volatile TYPE*)((PTR)+(OFFZ))))=VAL
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
121
4721
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
122 #define INREG8(addr) GETREG(uint8_t,(uint32_t)mach64_mmio_base,((addr)^0x100)<<2)
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
123 #define OUTREG8(addr,val) SETREG(uint8_t,(uint32_t)mach64_mmio_base,((addr)^0x100)<<2,val)
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
124 #define INREG(addr) GETREG(uint32_t,(uint32_t)mach64_mmio_base,((addr)^0x100)<<2)
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
125 #define OUTREG(addr,val) SETREG(uint32_t,(uint32_t)mach64_mmio_base,((addr)^0x100)<<2,val)
4691
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
126
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
127 #define OUTREGP(addr,val,mask) \
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
128 do { \
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
129 unsigned int _tmp = INREG(addr); \
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
130 _tmp &= (mask); \
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
131 _tmp |= (val); \
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
132 OUTREG(addr, _tmp); \
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
133 } while (0)
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
134
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
135 static __inline__ uint32_t INPLL(uint32_t addr)
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
136 {
4721
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
137 uint32_t res;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
138
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
139 /* write addr byte */
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
140 OUTREG8(CLOCK_CNTL + 1, (addr << 2));
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
141 /* read the register value */
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
142 res = INREG(CLOCK_CNTL + 2);
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
143 return res;
4691
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
144 }
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
145
4721
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
146 static __inline__ void OUTPLL(uint32_t addr,uint32_t val)
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
147 {
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
148 /* write addr byte */
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
149 OUTREG8(CLOCK_CNTL + 1, (addr << 2) | PLL_WR_EN);
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
150 /* write the register value */
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
151 OUTREG(CLOCK_CNTL + 2, val);
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
152 OUTREG8(CLOCK_CNTL + 1, (addr << 2) & ~PLL_WR_EN);
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
153 }
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
154
4691
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
155 #define OUTPLLP(addr,val,mask) \
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
156 do { \
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
157 unsigned int _tmp = INPLL(addr); \
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
158 _tmp &= (mask); \
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
159 _tmp |= (val); \
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
160 OUTPLL(addr, _tmp); \
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
161 } while (0)
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
162
4721
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
163 static void mach64_fifo_wait(unsigned n)
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
164 {
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
165 while ((INREG(FIFO_STAT) & 0xffff) > ((uint32_t)(0x8000 >> n)));
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
166 }
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
167
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
168 static void mach64_wait_for_idle( void )
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
169 {
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
170 mach64_fifo_wait(16);
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
171 while ((INREG(GUI_STAT) & 1)!= 0);
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
172 }
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
173
4691
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
174 static vidix_capability_t mach64_cap =
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
175 {
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
176 "BES driver for Mach64/3DRage cards",
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
177 "Nick Kurshev",
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
178 TYPE_OUTPUT,
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
179 { 0, 0, 0, 0 },
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
180 2048,
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
181 2048,
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
182 4,
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
183 4,
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
184 -1,
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
185 FLAG_UPSCALER|FLAG_DOWNSCALER,
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
186 VENDOR_ATI,
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
187 -1,
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
188 { 0, 0, 0, 0 }
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
189 };
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
190
4721
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
191 static uint32_t mach64_vid_get_dbpp( void )
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
192 {
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
193 uint32_t dbpp,retval;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
194 dbpp = (INREG(CRTC_GEN_CNTL)>>8)& 0x7;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
195 switch(dbpp)
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
196 {
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
197 case 1: retval = 4; break;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
198 case 2: retval = 8; break;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
199 case 3: retval = 15; break;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
200 case 4: retval = 16; break;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
201 case 5: retval = 24; break;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
202 default: retval=32; break;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
203 }
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
204 return retval;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
205 }
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
206
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
207 static int mach64_is_dbl_scan( void )
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
208 {
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
209 return INREG(CRTC_GEN_CNTL) & CRTC_DBL_SCAN_EN;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
210 }
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
211
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
212 static int mach64_is_interlace( void )
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
213 {
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
214 return INREG(CRTC_GEN_CNTL) & CRTC_INTERLACE_EN;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
215 }
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
216
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
217 static uint32_t mach64_get_xres( void )
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
218 {
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
219 /* FIXME: currently we extract that from CRTC!!!*/
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
220 uint32_t xres,h_total;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
221 h_total = INREG(CRTC_H_TOTAL_DISP);
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
222 xres = (h_total >> 16) & 0xffff;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
223 return (xres + 1)*8;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
224 }
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
225
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
226 static uint32_t mach64_get_yres( void )
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
227 {
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
228 /* FIXME: currently we extract that from CRTC!!!*/
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
229 uint32_t yres,v_total;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
230 v_total = INREG(CRTC_V_TOTAL_DISP);
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
231 yres = (v_total >> 16) & 0xffff;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
232 return yres + 1;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
233 }
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
234
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
235 static void mach64_vid_make_default()
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
236 {
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
237 mach64_fifo_wait(2);
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
238 OUTREG(SCALER_COLOUR_CNTL,0x0010103f);
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
239 }
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
240
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
241 static void mach64_vid_dump_regs( void )
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
242 {
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
243 size_t i;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
244 printf("[mach64] *** Begin of DRIVER variables dump ***\n");
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
245 printf("[mach64] mach64_mmio_base=%p\n",mach64_mmio_base);
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
246 printf("[mach64] mach64_mem_base=%p\n",mach64_mem_base);
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
247 printf("[mach64] mach64_overlay_off=%08X\n",mach64_overlay_offset);
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
248 printf("[mach64] mach64_ram_size=%08X\n",mach64_ram_size);
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
249 printf("[mach64] video mode: %ux%u@%u\n",mach64_get_xres(),mach64_get_yres(),mach64_vid_get_dbpp());
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
250 printf("[mach64] *** Begin of OV0 registers dump ***\n");
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
251 for(i=0;i<sizeof(vregs)/sizeof(video_registers_t);i++)
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
252 {
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
253 mach64_wait_for_idle();
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
254 printf("[mach64] %s = %08X\n",vregs[i].sname,INREG(vregs[i].name));
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
255 }
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
256 printf("[mach64] *** End of OV0 registers dump ***\n");
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
257 }
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
258
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
259
4691
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
260 unsigned int vixGetVersion(void)
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
261 {
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
262 return(VIDIX_VERSION);
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
263 }
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
264
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
265 static unsigned short ati_card_ids[] =
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
266 {
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
267 DEVICE_ATI_215CT_MACH64_CT,
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
268 DEVICE_ATI_210888CX_MACH64_CX,
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
269 DEVICE_ATI_210888ET_MACH64_ET,
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
270 DEVICE_ATI_MACH64_VT,
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
271 DEVICE_ATI_210888GX_MACH64_GX,
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
272 DEVICE_ATI_264LT_MACH64_LT,
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
273 DEVICE_ATI_264VT_MACH64_VT,
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
274 DEVICE_ATI_264VT3_MACH64_VT3,
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
275 DEVICE_ATI_264VT4_MACH64_VT4,
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
276 /**/
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
277 DEVICE_ATI_3D_RAGE_PRO,
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
278 DEVICE_ATI_3D_RAGE_PRO2,
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
279 DEVICE_ATI_3D_RAGE_PRO3,
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
280 DEVICE_ATI_3D_RAGE_PRO4,
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
281 DEVICE_ATI_RAGE_XC,
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
282 DEVICE_ATI_RAGE_XL_AGP,
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
283 DEVICE_ATI_RAGE_XC_AGP,
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
284 DEVICE_ATI_RAGE_XL,
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
285 DEVICE_ATI_3D_RAGE_PRO5,
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
286 DEVICE_ATI_3D_RAGE_PRO6,
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
287 DEVICE_ATI_RAGE_XL2,
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
288 DEVICE_ATI_RAGE_XC2,
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
289 DEVICE_ATI_3D_RAGE_I_II,
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
290 DEVICE_ATI_3D_RAGE_II,
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
291 DEVICE_ATI_3D_RAGE_IIC,
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
292 DEVICE_ATI_3D_RAGE_IIC2,
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
293 DEVICE_ATI_3D_RAGE_IIC3,
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
294 DEVICE_ATI_3D_RAGE_IIC4,
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
295 DEVICE_ATI_3D_RAGE_LT,
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
296 DEVICE_ATI_3D_RAGE_LT2,
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
297 DEVICE_ATI_RAGE_MOBILITY_M3,
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
298 DEVICE_ATI_RAGE_MOBILITY_M32,
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
299 DEVICE_ATI_3D_RAGE_LT_G,
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
300 DEVICE_ATI_3D_RAGE_LT3,
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
301 DEVICE_ATI_RAGE_MOBILITY_P_M,
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
302 DEVICE_ATI_RAGE_MOBILITY_L,
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
303 DEVICE_ATI_3D_RAGE_LT4,
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
304 DEVICE_ATI_3D_RAGE_LT5,
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
305 DEVICE_ATI_RAGE_MOBILITY_P_M2,
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
306 DEVICE_ATI_RAGE_MOBILITY_L2
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
307 };
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
308
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
309 static int find_chip(unsigned chip_id)
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
310 {
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
311 unsigned i;
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
312 for(i = 0;i < sizeof(ati_card_ids)/sizeof(unsigned short);i++)
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
313 {
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
314 if(chip_id == ati_card_ids[i]) return i;
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
315 }
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
316 return -1;
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
317 }
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
318
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
319 int vixProbe(int verbose,int force)
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
320 {
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
321 pciinfo_t lst[MAX_PCI_DEVICES];
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
322 unsigned i,num_pci;
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
323 int err;
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
324 __verbose = verbose;
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
325 err = pci_scan(lst,&num_pci);
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
326 if(err)
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
327 {
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
328 printf("[mach64] Error occured during pci scan: %s\n",strerror(err));
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
329 return err;
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
330 }
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
331 else
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
332 {
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
333 err = ENXIO;
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
334 for(i=0;i<num_pci;i++)
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
335 {
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
336 if(lst[i].vendor == VENDOR_ATI)
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
337 {
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
338 int idx;
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
339 const char *dname;
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
340 idx = find_chip(lst[i].device);
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
341 if(idx == -1 && force == PROBE_NORMAL) continue;
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
342 dname = pci_device_name(VENDOR_ATI,lst[i].device);
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
343 dname = dname ? dname : "Unknown chip";
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
344 printf("[mach64] Found chip: %s\n",dname);
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
345 if(force > PROBE_NORMAL)
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
346 {
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
347 printf("[mach64] Driver was forced. Was found %sknown chip\n",idx == -1 ? "un" : "");
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
348 if(idx == -1)
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
349 printf("[mach64] Assuming it as Mach64\n");
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
350 }
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
351 mach64_cap.device_id = lst[i].device;
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
352 err = 0;
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
353 memcpy(&pci_info,&lst[i],sizeof(pciinfo_t));
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
354 probed=1;
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
355 break;
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
356 }
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
357 }
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
358 }
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
359 if(err && verbose) printf("[mach64] Can't find chip\n");
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
360 return err;
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
361 }
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
362
4721
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
363 static void reset_regs( void )
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
364 {
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
365 size_t i;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
366 for(i=0;i<sizeof(vregs)/sizeof(video_registers_t);i++)
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
367 {
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
368 mach64_fifo_wait(2);
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
369 OUTREG(vregs[i].name,-1);
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
370 }
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
371 }
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
372
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
373
4691
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
374 int vixInit(void)
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
375 {
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
376 int err;
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
377 if(!probed)
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
378 {
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
379 printf("[mach64] Driver was not probed but is being initializing\n");
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
380 return EINTR;
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
381 }
4721
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
382 if((mach64_mmio_base = map_phys_mem(pci_info.base2,0x4000))==(void *)-1) return ENOMEM;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
383 mach64_wait_for_idle();
4691
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
384 mach64_ram_size = INREG(MEM_CNTL) & CTL_MEM_SIZEB;
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
385 if (mach64_ram_size < 8) mach64_ram_size = (mach64_ram_size + 1) * 512;
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
386 else if (mach64_ram_size < 12) mach64_ram_size = (mach64_ram_size - 3) * 1024;
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
387 else mach64_ram_size = (mach64_ram_size - 7) * 2048;
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
388 mach64_ram_size *= 0x400; /* KB -> bytes */
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
389 if((mach64_mem_base = map_phys_mem(pci_info.base0,mach64_ram_size))==(void *)-1) return ENOMEM;
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
390 // memset(&besr,0,sizeof(bes_registers_t));
4721
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
391 mach64_vid_make_default();
4691
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
392 printf("[mach64] Video memory = %uMb\n",mach64_ram_size/0x100000);
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
393 err = mtrr_set_type(pci_info.base0,mach64_ram_size,MTRR_TYPE_WRCOMB);
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
394 if(!err) printf("[mach64] Set write-combining type of video memory\n");
4721
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
395 reset_regs();
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
396 mach64_vid_dump_regs();
4691
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
397 return 0;
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
398 }
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
399
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
400 void vixDestroy(void)
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
401 {
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
402 unmap_phys_mem(mach64_mem_base,mach64_ram_size);
4721
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
403 unmap_phys_mem(mach64_mmio_base,0x4000);
4691
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
404 }
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
405
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
406 int vixGetCapability(vidix_capability_t *to)
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
407 {
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
408 memcpy(to, &mach64_cap, sizeof(vidix_capability_t));
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
409 return 0;
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
410 }
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
411
4721
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
412 static unsigned mach64_query_pitch(unsigned fourcc,const vidix_yuv_t *spitch)
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
413 {
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
414 unsigned pitch,spy,spv,spu;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
415 spy = spv = spu = 0;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
416 switch(spitch->y)
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
417 {
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
418 case 16:
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
419 case 32:
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
420 case 64:
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
421 case 128:
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
422 case 256: spy = spitch->y; break;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
423 default: break;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
424 }
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
425 switch(spitch->u)
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
426 {
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
427 case 16:
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
428 case 32:
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
429 case 64:
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
430 case 128:
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
431 case 256: spu = spitch->u; break;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
432 default: break;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
433 }
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
434 switch(spitch->v)
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
435 {
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
436 case 16:
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
437 case 32:
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
438 case 64:
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
439 case 128:
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
440 case 256: spv = spitch->v; break;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
441 default: break;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
442 }
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
443 switch(fourcc)
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
444 {
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
445 /* 4:2:0 */
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
446 case IMGFMT_IYUV:
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
447 case IMGFMT_YV12:
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
448 case IMGFMT_I420:
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
449 if(spy > 16 && spu == spy/2 && spv == spy/2) pitch = spy;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
450 else pitch = 32;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
451 break;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
452 default:
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
453 if(spy > 16) pitch = spy;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
454 else pitch = 32;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
455 break;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
456 }
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
457 return pitch;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
458 }
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
459
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
460 static void mach64_compute_framesize(vidix_playback_t *info)
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
461 {
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
462 unsigned pitch,awidth;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
463 pitch = mach64_query_pitch(info->fourcc,&info->src.pitch);
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
464 switch(info->fourcc)
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
465 {
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
466 case IMGFMT_I420:
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
467 case IMGFMT_YV12:
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
468 case IMGFMT_IYUV:
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
469 awidth = (info->src.w + (pitch-1)) & ~(pitch-1);
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
470 info->frame_size = awidth*(info->src.h+info->src.h/2);
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
471 break;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
472 case IMGFMT_RGB32:
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
473 case IMGFMT_BGR32:
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
474 awidth = (info->src.w*4 + (pitch-1)) & ~(pitch-1);
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
475 info->frame_size = (awidth*info->src.h);
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
476 break;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
477 /* YUY2 YVYU, RGB15, RGB16 */
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
478 default:
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
479 awidth = (info->src.w*2 + (pitch-1)) & ~(pitch-1);
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
480 info->frame_size = (awidth*info->src.h);
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
481 break;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
482 }
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
483 }
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
484
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
485 static void mach64_vid_stop_video( void )
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
486 {
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
487 mach64_fifo_wait(14);
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
488 OUTREG(OVERLAY_SCALE_CNTL, 0x80000000);
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
489 OUTREG(OVERLAY_EXCLUSIVE_HORZ, 0);
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
490 OUTREG(OVERLAY_EXCLUSIVE_VERT, 0);
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
491 OUTREG(SCALER_H_COEFF0, 0x00002000);
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
492 OUTREG(SCALER_H_COEFF1, 0x0D06200D);
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
493 OUTREG(SCALER_H_COEFF2, 0x0D0A1C0D);
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
494 OUTREG(SCALER_H_COEFF3, 0x0C0E1A0C);
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
495 OUTREG(SCALER_H_COEFF4, 0x0C14140C);
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
496 OUTREG(VIDEO_FORMAT, 0xB000B);
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
497 OUTREG(OVERLAY_GRAPHICS_KEY_MSK, 0);
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
498 OUTREG(OVERLAY_GRAPHICS_KEY_CLR, 0);
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
499 OUTREG(OVERLAY_KEY_CNTL, 0x50);
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
500 OUTREG(OVERLAY_TEST, 0x0);
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
501 }
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
502
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
503 static void mach64_vid_display_video( void )
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
504 {
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
505 uint32_t vf;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
506 mach64_fifo_wait(14);
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
507
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
508 OUTREG(OVERLAY_Y_X_START, besr.y_x_start);
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
509 OUTREG(OVERLAY_Y_X_END, besr.y_x_end);
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
510 OUTREG(OVERLAY_SCALE_INC, besr.scale_inc);
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
511 OUTREG(SCALER_BUF_PITCH, besr.vid_buf_pitch);
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
512 OUTREG(SCALER_HEIGHT_WIDTH, besr.height_width);
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
513 OUTREG(SCALER_BUF0_OFFSET, besr.vid_buf0_base_adrs);
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
514 OUTREG(SCALER_BUF0_OFFSET_U, besr.vid_buf1_base_adrs);
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
515 OUTREG(SCALER_BUF0_OFFSET_V, besr.vid_buf2_base_adrs);
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
516 OUTREG(SCALER_BUF1_OFFSET, besr.vid_buf3_base_adrs);
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
517 OUTREG(SCALER_BUF1_OFFSET_U, besr.vid_buf4_base_adrs);
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
518 OUTREG(SCALER_BUF1_OFFSET_V, besr.vid_buf5_base_adrs);
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
519 OUTREG(OVERLAY_SCALE_CNTL, 0x04000001 | (3<<30));
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
520 mach64_wait_for_idle();
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
521 vf = INREG(VIDEO_FORMAT);
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
522 switch(besr.fourcc)
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
523 {
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
524 /* 4:2:0 */
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
525 case IMGFMT_IYUV:
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
526 case IMGFMT_I420:
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
527 case IMGFMT_YV12: OUTREG(VIDEO_FORMAT, (vf & ~0xF000) | 0xA000); break;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
528 /* 4:2:2 */
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
529 case IMGFMT_YVYU:
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
530 case IMGFMT_UYVY: OUTREG(VIDEO_FORMAT, (vf & ~0xF000) | 0xB000); break;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
531 case IMGFMT_YUY2:
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
532 default: OUTREG(VIDEO_FORMAT, (vf & ~0xF000) | 0xC000); break;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
533 }
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
534 // OUTPLL(PLL_SCALER_LOCK_EN, 0);
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
535 if(__verbose > 1) mach64_vid_dump_regs();
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
536 }
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
537
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
538 static int mach64_vid_init_video( vidix_playback_t *config )
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
539 {
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
540 uint32_t src_w,src_h,dest_w,dest_h,pitch,h_inc,v_inc,left,leftUV,top,ecp;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
541 int is_420,best_pitch,mpitch;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
542 mach64_vid_stop_video();
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
543 left = config->src.x << 16;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
544 top = config->src.y << 16;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
545 src_h = config->src.h;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
546 src_w = config->src.w;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
547 is_420 = 0;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
548 if(config->fourcc == IMGFMT_YV12 ||
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
549 config->fourcc == IMGFMT_I420 ||
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
550 config->fourcc == IMGFMT_IYUV) is_420 = 1;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
551 best_pitch = mach64_query_pitch(config->fourcc,&config->src.pitch);
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
552 mpitch = best_pitch-1;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
553 switch(config->fourcc)
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
554 {
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
555 /* 4:2:0 */
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
556 case IMGFMT_IYUV:
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
557 case IMGFMT_YV12:
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
558 case IMGFMT_I420: pitch = (src_w + mpitch) & ~mpitch;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
559 config->dest.pitch.y =
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
560 config->dest.pitch.u =
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
561 config->dest.pitch.v = best_pitch;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
562 break;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
563 /* RGB 4:4:4:4 */
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
564 case IMGFMT_RGB32:
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
565 case IMGFMT_BGR32: pitch = (src_w*4 + mpitch) & ~mpitch;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
566 config->dest.pitch.y =
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
567 config->dest.pitch.u =
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
568 config->dest.pitch.v = best_pitch;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
569 break;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
570 /* 4:2:2 */
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
571 default: /* RGB15, RGB16, YVYU, UYVY, YUY2 */
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
572 pitch = ((src_w*2) + mpitch) & ~mpitch;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
573 config->dest.pitch.y =
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
574 config->dest.pitch.u =
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
575 config->dest.pitch.v = best_pitch;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
576 break;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
577 }
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
578 dest_w = config->dest.w;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
579 dest_h = config->dest.h;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
580 besr.fourcc = config->fourcc;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
581 ecp = (INPLL(PLL_VCLK_CNTL) & PLL_ECP_DIV) >> 4;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
582 v_inc = (src_h << (12
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
583 +(mach64_is_interlace()?1:0)
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
584 -(mach64_is_dbl_scan()?1:0)
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
585 )) / dest_h;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
586 h_inc = (src_w << (12+ecp)) / dest_w;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
587 v_inc /= 2;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
588 /* keep everything in 16.16 */
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
589 config->offsets[0] = 0;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
590 config->offsets[1] = config->frame_size;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
591 if(is_420)
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
592 {
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
593 uint32_t d1line,d2line,d3line;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
594 d1line = top*pitch;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
595 d2line = src_h*pitch+(d1line>>2);
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
596 d3line = d2line+((src_h*pitch)>>2);
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
597 d1line += (left >> 16) & ~15;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
598 d2line += (left >> 17) & ~15;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
599 d3line += (left >> 17) & ~15;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
600 config->offset.y = d1line & ~15;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
601 config->offset.v = d2line & ~15;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
602 config->offset.u = d3line & ~15;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
603 besr.vid_buf0_base_adrs=((mach64_overlay_offset+config->offsets[0]+config->offset.y)&~15);
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
604 besr.vid_buf1_base_adrs=((mach64_overlay_offset+config->offsets[0]+config->offset.v)&~15);
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
605 besr.vid_buf2_base_adrs=((mach64_overlay_offset+config->offsets[0]+config->offset.u)&~15);
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
606 besr.vid_buf3_base_adrs=((mach64_overlay_offset+config->offsets[1]+config->offset.y)&~15);
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
607 besr.vid_buf4_base_adrs=((mach64_overlay_offset+config->offsets[1]+config->offset.v)&~15);
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
608 besr.vid_buf5_base_adrs=((mach64_overlay_offset+config->offsets[1]+config->offset.u)&~15);
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
609 config->offset.y = ((besr.vid_buf0_base_adrs)&~15) - mach64_overlay_offset;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
610 config->offset.v = ((besr.vid_buf1_base_adrs)&~15) - mach64_overlay_offset;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
611 config->offset.u = ((besr.vid_buf2_base_adrs)&~15) - mach64_overlay_offset;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
612 if(besr.fourcc == IMGFMT_I420 || besr.fourcc == IMGFMT_IYUV)
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
613 {
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
614 uint32_t tmp;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
615 tmp = config->offset.u;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
616 config->offset.u = config->offset.v;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
617 config->offset.v = tmp;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
618 }
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
619 }
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
620 else
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
621 {
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
622 besr.vid_buf0_base_adrs = mach64_overlay_offset;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
623 config->offset.y = config->offset.u = config->offset.v = ((left & ~7) << 1)&~15;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
624 besr.vid_buf0_base_adrs += config->offset.y;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
625 besr.vid_buf1_base_adrs = besr.vid_buf0_base_adrs;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
626 besr.vid_buf2_base_adrs = besr.vid_buf0_base_adrs;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
627 besr.vid_buf3_base_adrs = besr.vid_buf0_base_adrs+config->frame_size;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
628 besr.vid_buf4_base_adrs = besr.vid_buf0_base_adrs+config->frame_size;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
629 besr.vid_buf5_base_adrs = besr.vid_buf0_base_adrs+config->frame_size;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
630 }
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
631
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
632 leftUV = (left >> 17) & 15;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
633 left = (left >> 16) & 15;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
634 besr.scale_inc = ( h_inc << 16 ) | v_inc;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
635 besr.y_x_start = config->dest.y | (config->dest.x << 16);
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
636 besr.y_x_end = (config->dest.y + dest_h) | ((config->dest.x + dest_w) << 16);
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
637 besr.height_width = ((src_w - left)<<16) | (src_h - top);
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
638 besr.vid_buf_pitch = pitch;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
639 return 0;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
640 }
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
641
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
642
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
643 uint32_t supported_fourcc[] =
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
644 {
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
645 IMGFMT_YV12, IMGFMT_I420, IMGFMT_IYUV,
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
646 IMGFMT_UYVY, IMGFMT_YUY2, IMGFMT_YVYU
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
647 };
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
648
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
649 __inline__ static int is_supported_fourcc(uint32_t fourcc)
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
650 {
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
651 unsigned i;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
652 for(i=0;i<sizeof(supported_fourcc)/sizeof(uint32_t);i++)
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
653 {
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
654 if(fourcc==supported_fourcc[i]) return 1;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
655 }
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
656 return 0;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
657 }
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
658
4691
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
659 int vixQueryFourcc(vidix_fourcc_t *to)
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
660 {
4721
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
661 if(is_supported_fourcc(to->fourcc))
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
662 {
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
663 to->depth = VID_DEPTH_1BPP | VID_DEPTH_2BPP |
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
664 VID_DEPTH_4BPP | VID_DEPTH_8BPP |
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
665 VID_DEPTH_12BPP| VID_DEPTH_15BPP|
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
666 VID_DEPTH_16BPP| VID_DEPTH_24BPP|
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
667 VID_DEPTH_32BPP;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
668 to->flags = VID_CAP_EXPAND | VID_CAP_SHRINK;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
669 return 0;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
670 }
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
671 else to->depth = to->flags = 0;
4691
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
672 return ENOSYS;
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
673 }
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
674
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
675 int vixConfigPlayback(vidix_playback_t *info)
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
676 {
4721
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
677 if(!is_supported_fourcc(info->fourcc)) return ENOSYS;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
678 if(info->num_frames>2) info->num_frames=2;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
679 if(info->num_frames==1) besr.double_buff=0;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
680 else besr.double_buff=1;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
681 mach64_compute_framesize(info);
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
682 mach64_overlay_offset = mach64_ram_size - info->frame_size*info->num_frames;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
683 mach64_overlay_offset &= 0xffff0000;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
684 if(mach64_overlay_offset < 0) return EINVAL;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
685 info->dga_addr = (char *)mach64_mem_base + mach64_overlay_offset;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
686 mach64_vid_init_video(info);
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
687 return 0;
4691
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
688 }
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
689
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
690 int vixPlaybackOn(void)
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
691 {
4721
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
692 mach64_vid_display_video();
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
693 return 0;
4691
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
694 }
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
695
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
696 int vixPlaybackOff(void)
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
697 {
4721
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
698 mach64_vid_stop_video();
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
699 return 0;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
700 }
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
701
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
702 static void mach64_wait_vsync( void )
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
703 {
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
704 #warning MACH64 VSYNC WAS NOT IMPLEMENTED!!!
4691
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
705 }
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
706
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
707 int vixPlaybackFrameSelect(unsigned int frame)
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
708 {
4721
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
709 uint32_t off[6];
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
710 /*
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
711 buf3-5 always should point onto second buffer for better
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
712 deinterlacing and TV-in
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
713 */
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
714 if(!besr.double_buff) return 0;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
715 if((frame%2))
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
716 {
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
717 off[0] = besr.vid_buf3_base_adrs;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
718 off[1] = besr.vid_buf4_base_adrs;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
719 off[2] = besr.vid_buf5_base_adrs;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
720 off[3] = besr.vid_buf0_base_adrs;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
721 off[4] = besr.vid_buf1_base_adrs;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
722 off[5] = besr.vid_buf2_base_adrs;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
723 }
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
724 else
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
725 {
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
726 off[0] = besr.vid_buf0_base_adrs;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
727 off[1] = besr.vid_buf1_base_adrs;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
728 off[2] = besr.vid_buf2_base_adrs;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
729 off[3] = besr.vid_buf3_base_adrs;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
730 off[4] = besr.vid_buf4_base_adrs;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
731 off[5] = besr.vid_buf5_base_adrs;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
732 }
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
733
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
734 mach64_wait_vsync();
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
735 mach64_wait_for_idle();
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
736 mach64_fifo_wait(7);
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
737 OUTREG(SCALER_BUF0_OFFSET, off[0]);
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
738 OUTREG(SCALER_BUF0_OFFSET_U, off[1]);
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
739 OUTREG(SCALER_BUF0_OFFSET_V, off[2]);
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
740 OUTREG(SCALER_BUF1_OFFSET, off[3]);
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
741 OUTREG(SCALER_BUF1_OFFSET_U, off[4]);
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
742 OUTREG(SCALER_BUF1_OFFSET_V, off[5]);
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
743 if(__verbose > 1) mach64_vid_dump_regs();
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
744 return 0;
4691
9c23a7497a6d Scratch for volunteers
nick
parents:
diff changeset
745 }
4721
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
746
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
747 vidix_video_eq_t equal =
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
748 {
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
749 VEQ_CAP_BRIGHTNESS | VEQ_CAP_SATURATION
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
750 ,
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
751 0, 0, 0, 0, 0, 0, 0, 0 };
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
752
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
753 int vixPlaybackGetEq( vidix_video_eq_t * eq)
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
754 {
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
755 memcpy(eq,&equal,sizeof(vidix_video_eq_t));
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
756 return 0;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
757 }
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
758
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
759 int vixPlaybackSetEq( const vidix_video_eq_t * eq)
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
760 {
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
761 int br,sat;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
762 if(eq->cap & VEQ_CAP_BRIGHTNESS) equal.brightness = eq->brightness;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
763 if(eq->cap & VEQ_CAP_CONTRAST) equal.contrast = eq->contrast;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
764 if(eq->cap & VEQ_CAP_SATURATION) equal.saturation = eq->saturation;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
765 if(eq->cap & VEQ_CAP_HUE) equal.hue = eq->hue;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
766 if(eq->cap & VEQ_CAP_RGB_INTENSITY)
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
767 {
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
768 equal.red_intensity = eq->red_intensity;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
769 equal.green_intensity = eq->green_intensity;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
770 equal.blue_intensity = eq->blue_intensity;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
771 }
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
772 equal.flags = eq->flags;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
773 br = equal.brightness * 64 / 1000;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
774 if(br < -64) br = -64; if(br > 63) br = 63;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
775 sat = (equal.saturation + 1000) * 16 / 1000;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
776 if(sat < 0) sat = 0; if(sat > 31) sat = 31;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
777 OUTREG(SCALER_COLOUR_CNTL, (br & 0x7f) | (sat << 8) | (sat << 16));
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
778 return 0;
e441ca06638d Works with YUY2 fourcc
nick
parents: 4691
diff changeset
779 }