annotate vidix/drivers/mga_vid.c @ 22594:e138932c8b9b

Remove Darwin AltiVec CFLAGS settings, configure handles this.
author diego
date Thu, 15 Mar 2007 13:19:22 +0000
parents 61cc20df7f3e
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1 /*
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
2 Matrox MGA driver
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
3
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
4 ported to VIDIX by Alex Beregszaszi
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
5
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
6 YUY2 support (see config.format) added by A'rpi/ESP-team
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
7 double buffering added by A'rpi/ESP-team
4272
68a40de07167 cleaned some parts, tested and working with g400/450, g200 is buggy :(
alex
parents: 4250
diff changeset
8
6600
1f0acc9106a8 equalizer (brightness/contrast) support
alex
parents: 4482
diff changeset
9 Brightness/contrast support by Nick Kurshev/Dariush Pietrzak (eyck) and me
4272
68a40de07167 cleaned some parts, tested and working with g400/450, g200 is buggy :(
alex
parents: 4250
diff changeset
10
68a40de07167 cleaned some parts, tested and working with g400/450, g200 is buggy :(
alex
parents: 4250
diff changeset
11 TODO:
4326
870cec859f92 upgraded to newest vidix interface. in eq: return if g200 moved to the beginning of seteq
alex
parents: 4318
diff changeset
12 * fix memory size detection (current reading pci userconfig isn't
870cec859f92 upgraded to newest vidix interface. in eq: return if g200 moved to the beginning of seteq
alex
parents: 4318
diff changeset
13 working as requested - returns the max avail. ram on arch?)
4272
68a40de07167 cleaned some parts, tested and working with g400/450, g200 is buggy :(
alex
parents: 4250
diff changeset
14 * translate all non-english comments to english
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
15 */
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
16
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
17 /*
4239
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
18 * Original copyright:
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
19 *
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
20 * mga_vid.c
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
21 *
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
22 * Copyright (C) 1999 Aaron Holtzman
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
23 *
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
24 * Module skeleton based on gutted agpgart module by Jeff Hartmann
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
25 * <slicer@ionet.net>
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
26 *
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
27 * Matrox MGA G200/G400 YUV Video Interface module Version 0.1.0
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
28 *
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
29 * BES == Back End Scaler
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
30 *
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
31 * This software has been released under the terms of the GNU Public
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
32 * license. See http://www.gnu.org/copyleft/gpl.html for details.
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
33 */
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
34
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
35 //#define CRTC2
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
36
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
37 // Set this value, if autodetection fails! (video ram size in megabytes)
6648
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
38 //#define MGA_MEMORY_SIZE 16
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
39
4326
870cec859f92 upgraded to newest vidix interface. in eq: return if g200 moved to the beginning of seteq
alex
parents: 4318
diff changeset
40 /* No irq support in userspace implemented yet, do not enable this! */
4239
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
41 /* disable irq */
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
42 #undef MGA_ALLOW_IRQ
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
43
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
44 #define MGA_VSYNC_POS 2
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
45
4279
4301c4adbcf7 reported working at 1600x1200 too, pciconfig stuff fixed, you can enable it with #define MGA_PCICONFIG_MEMDETECT
alex
parents: 4273
diff changeset
46 #undef MGA_PCICONFIG_MEMDETECT
4301c4adbcf7 reported working at 1600x1200 too, pciconfig stuff fixed, you can enable it with #define MGA_PCICONFIG_MEMDETECT
alex
parents: 4273
diff changeset
47
6648
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
48 #define MGA_DEFAULT_FRAMES 4
4326
870cec859f92 upgraded to newest vidix interface. in eq: return if g200 moved to the beginning of seteq
alex
parents: 4318
diff changeset
49
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
50 #include <errno.h>
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
51 #include <stdio.h>
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
52 #include <stdlib.h>
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
53 #include <string.h>
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
54 #include <math.h>
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
55 #include <inttypes.h>
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
56
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
57 #include "../vidix.h"
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
58 #include "../fourcc.h"
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
59 #include "../../libdha/libdha.h"
4239
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
60 #include "../../libdha/pci_ids.h"
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
61 #include "../../libdha/pci_names.h"
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
62
10983
590355444f47 workaround for mingw
faust3
parents: 9767
diff changeset
63 #ifdef __MINGW32__
590355444f47 workaround for mingw
faust3
parents: 9767
diff changeset
64 #define ENOTSUP 134
590355444f47 workaround for mingw
faust3
parents: 9767
diff changeset
65 #endif
590355444f47 workaround for mingw
faust3
parents: 9767
diff changeset
66
4163
d0678176b98c BSD fix by Steven M. Schultz <sms@2BSD.COM>
arpi
parents: 4144
diff changeset
67 #if !defined(ENOTSUP) && defined(EOPNOTSUPP)
d0678176b98c BSD fix by Steven M. Schultz <sms@2BSD.COM>
arpi
parents: 4144
diff changeset
68 #define ENOTSUP EOPNOTSUPP
d0678176b98c BSD fix by Steven M. Schultz <sms@2BSD.COM>
arpi
parents: 4144
diff changeset
69 #endif
d0678176b98c BSD fix by Steven M. Schultz <sms@2BSD.COM>
arpi
parents: 4144
diff changeset
70
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
71 /* from radeon_vid */
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
72 #define GETREG(TYPE,PTR,OFFZ) (*((volatile TYPE*)((PTR)+(OFFZ))))
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
73 #define SETREG(TYPE,PTR,OFFZ,VAL) (*((volatile TYPE*)((PTR)+(OFFZ))))=VAL
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
74
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
75 #define readb(addr) GETREG(uint8_t,(uint32_t)(addr),0)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
76 #define writeb(val,addr) SETREG(uint8_t,(uint32_t)(addr),0,val)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
77 #define readl(addr) GETREG(uint32_t,(uint32_t)(addr),0)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
78 #define writel(val,addr) SETREG(uint32_t,(uint32_t)(addr),0,val)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
79
4272
68a40de07167 cleaned some parts, tested and working with g400/450, g200 is buggy :(
alex
parents: 4250
diff changeset
80 static int mga_verbose = 0;
4239
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
81
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
82 /* for device detection */
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
83 static int probed = 0;
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
84 static pciinfo_t pci_info;
4239
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
85
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
86 /* internal booleans */
4326
870cec859f92 upgraded to newest vidix interface. in eq: return if g200 moved to the beginning of seteq
alex
parents: 4318
diff changeset
87 static int mga_vid_in_use = 0;
870cec859f92 upgraded to newest vidix interface. in eq: return if g200 moved to the beginning of seteq
alex
parents: 4318
diff changeset
88 static int is_g400 = 0;
870cec859f92 upgraded to newest vidix interface. in eq: return if g200 moved to the beginning of seteq
alex
parents: 4318
diff changeset
89 static int vid_src_ready = 0;
870cec859f92 upgraded to newest vidix interface. in eq: return if g200 moved to the beginning of seteq
alex
parents: 4318
diff changeset
90 static int vid_overlay_on = 0;
4239
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
91
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
92 /* mapped physical addresses */
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
93 static uint8_t *mga_mmio_base = 0;
7127
1e47c2e7aa8e mostly compiler warning fixes, some small bugfix
arpi
parents: 6805
diff changeset
94 static uint8_t *mga_mem_base = 0;
4239
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
95
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
96 static int mga_src_base = 0; /* YUV buffer position in video memory */
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
97
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
98 static uint32_t mga_ram_size = 0; /* how much megabytes videoram we have */
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
99
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
100 /* Graphic keys */
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
101 static vidix_grkey_t mga_grkey;
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
102
4272
68a40de07167 cleaned some parts, tested and working with g400/450, g200 is buggy :(
alex
parents: 4250
diff changeset
103 static int colkey_saved = 0;
68a40de07167 cleaned some parts, tested and working with g400/450, g200 is buggy :(
alex
parents: 4250
diff changeset
104 static int colkey_on = 0;
4239
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
105 static unsigned char colkey_color[4];
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
106 static unsigned char colkey_mask[4];
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
107
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
108 /* for IRQ */
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
109 static int mga_irq = -1;
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
110
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
111 static int mga_next_frame = 0;
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
112
4239
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
113 static vidix_capability_t mga_cap =
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
114 {
6648
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
115 "Matrox MGA G200/G4x0/G5x0 YUV Video",
4326
870cec859f92 upgraded to newest vidix interface. in eq: return if g200 moved to the beginning of seteq
alex
parents: 4318
diff changeset
116 "Aaron Holtzman, Arpad Gereoffy, Alex Beregszaszi, Nick Kurshev",
4239
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
117 TYPE_OUTPUT,
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
118 { 0, 0, 0, 0 },
6648
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
119 2048,
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
120 2048,
4239
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
121 4,
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
122 4,
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
123 -1,
6600
1f0acc9106a8 equalizer (brightness/contrast) support
alex
parents: 4482
diff changeset
124 FLAG_UPSCALER | FLAG_DOWNSCALER | FLAG_EQUALIZER,
4239
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
125 VENDOR_MATROX,
4326
870cec859f92 upgraded to newest vidix interface. in eq: return if g200 moved to the beginning of seteq
alex
parents: 4318
diff changeset
126 -1, /* will be set in vixProbe */
4239
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
127 { 0, 0, 0, 0}
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
128 };
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
129
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
130 /* MATROX BES registers */
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
131 typedef struct bes_registers_s
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
132 {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
133 //BES Control
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
134 uint32_t besctl;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
135 //BES Global control
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
136 uint32_t besglobctl;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
137 //Luma control (brightness and contrast)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
138 uint32_t beslumactl;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
139 //Line pitch
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
140 uint32_t bespitch;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
141
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
142 //Buffer A-1 Chroma 3 plane org
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
143 uint32_t besa1c3org;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
144 //Buffer A-1 Chroma org
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
145 uint32_t besa1corg;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
146 //Buffer A-1 Luma org
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
147 uint32_t besa1org;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
148
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
149 //Buffer A-2 Chroma 3 plane org
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
150 uint32_t besa2c3org;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
151 //Buffer A-2 Chroma org
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
152 uint32_t besa2corg;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
153 //Buffer A-2 Luma org
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
154 uint32_t besa2org;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
155
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
156 //Buffer B-1 Chroma 3 plane org
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
157 uint32_t besb1c3org;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
158 //Buffer B-1 Chroma org
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
159 uint32_t besb1corg;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
160 //Buffer B-1 Luma org
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
161 uint32_t besb1org;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
162
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
163 //Buffer B-2 Chroma 3 plane org
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
164 uint32_t besb2c3org;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
165 //Buffer B-2 Chroma org
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
166 uint32_t besb2corg;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
167 //Buffer B-2 Luma org
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
168 uint32_t besb2org;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
169
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
170 //BES Horizontal coord
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
171 uint32_t beshcoord;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
172 //BES Horizontal inverse scaling [5.14]
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
173 uint32_t beshiscal;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
174 //BES Horizontal source start [10.14] (for scaling)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
175 uint32_t beshsrcst;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
176 //BES Horizontal source ending [10.14] (for scaling)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
177 uint32_t beshsrcend;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
178 //BES Horizontal source last
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
179 uint32_t beshsrclst;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
180
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
181
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
182 //BES Vertical coord
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
183 uint32_t besvcoord;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
184 //BES Vertical inverse scaling [5.14]
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
185 uint32_t besviscal;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
186 //BES Field 1 vertical source last position
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
187 uint32_t besv1srclst;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
188 //BES Field 1 weight start
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
189 uint32_t besv1wght;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
190 //BES Field 2 vertical source last position
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
191 uint32_t besv2srclst;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
192 //BES Field 2 weight start
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
193 uint32_t besv2wght;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
194
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
195 } bes_registers_t;
4272
68a40de07167 cleaned some parts, tested and working with g400/450, g200 is buggy :(
alex
parents: 4250
diff changeset
196 static bes_registers_t regs;
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
197
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
198 #ifdef CRTC2
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
199 typedef struct crtc2_registers_s
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
200 {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
201 uint32_t c2ctl;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
202 uint32_t c2datactl;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
203 uint32_t c2misc;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
204 uint32_t c2hparam;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
205 uint32_t c2hsync;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
206 uint32_t c2offset;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
207 uint32_t c2pl2startadd0;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
208 uint32_t c2pl2startadd1;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
209 uint32_t c2pl3startadd0;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
210 uint32_t c2pl3startadd1;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
211 uint32_t c2preload;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
212 uint32_t c2spicstartadd0;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
213 uint32_t c2spicstartadd1;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
214 uint32_t c2startadd0;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
215 uint32_t c2startadd1;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
216 uint32_t c2subpiclut;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
217 uint32_t c2vcount;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
218 uint32_t c2vparam;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
219 uint32_t c2vsync;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
220 } crtc2_registers_t;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
221 static crtc2_registers_t cregs;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
222 #endif
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
223
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
224 //All register offsets are converted to word aligned offsets (32 bit)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
225 //because we want all our register accesses to be 32 bits
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
226 #define VCOUNT 0x1e20
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
227
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
228 #define PALWTADD 0x3c00 // Index register for X_DATAREG port
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
229 #define X_DATAREG 0x3c0a
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
230
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
231 #define XMULCTRL 0x19
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
232 #define BPP_8 0x00
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
233 #define BPP_15 0x01
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
234 #define BPP_16 0x02
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
235 #define BPP_24 0x03
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
236 #define BPP_32_DIR 0x04
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
237 #define BPP_32_PAL 0x07
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
238
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
239 #define XCOLMSK 0x40
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
240 #define X_COLKEY 0x42
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
241 #define XKEYOPMODE 0x51
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
242 #define XCOLMSK0RED 0x52
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
243 #define XCOLMSK0GREEN 0x53
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
244 #define XCOLMSK0BLUE 0x54
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
245 #define XCOLKEY0RED 0x55
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
246 #define XCOLKEY0GREEN 0x56
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
247 #define XCOLKEY0BLUE 0x57
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
248
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
249 #ifdef CRTC2
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
250 /*CRTC2 registers*/
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
251 #define XMISCCTRL 0x1e
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
252 #define C2CTL 0x3c10
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
253 #define C2DATACTL 0x3c4c
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
254 #define C2MISC 0x3c44
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
255 #define C2HPARAM 0x3c14
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
256 #define C2HSYNC 0x3c18
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
257 #define C2OFFSET 0x3c40
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
258 #define C2PL2STARTADD0 0x3c30 // like BESA1CORG
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
259 #define C2PL2STARTADD1 0x3c34 // like BESA2CORG
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
260 #define C2PL3STARTADD0 0x3c38 // like BESA1C3ORG
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
261 #define C2PL3STARTADD1 0x3c3c // like BESA2C3ORG
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
262 #define C2PRELOAD 0x3c24
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
263 #define C2SPICSTARTADD0 0x3c54
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
264 #define C2SPICSTARTADD1 0x3c58
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
265 #define C2STARTADD0 0x3c28 // like BESA1ORG
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
266 #define C2STARTADD1 0x3c2c // like BESA2ORG
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
267 #define C2SUBPICLUT 0x3c50
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
268 #define C2VCOUNT 0x3c48
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
269 #define C2VPARAM 0x3c1c
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
270 #define C2VSYNC 0x3c20
4272
68a40de07167 cleaned some parts, tested and working with g400/450, g200 is buggy :(
alex
parents: 4250
diff changeset
271 #endif /* CRTC2 */
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
272
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
273 // Backend Scaler registers
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
274 #define BESCTL 0x3d20
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
275 #define BESGLOBCTL 0x3dc0
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
276 #define BESLUMACTL 0x3d40
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
277 #define BESPITCH 0x3d24
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
278
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
279 #define BESA1C3ORG 0x3d60
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
280 #define BESA1CORG 0x3d10
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
281 #define BESA1ORG 0x3d00
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
282
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
283 #define BESA2C3ORG 0x3d64
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
284 #define BESA2CORG 0x3d14
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
285 #define BESA2ORG 0x3d04
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
286
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
287 #define BESB1C3ORG 0x3d68
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
288 #define BESB1CORG 0x3d18
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
289 #define BESB1ORG 0x3d08
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
290
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
291 #define BESB2C3ORG 0x3d6C
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
292 #define BESB2CORG 0x3d1C
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
293 #define BESB2ORG 0x3d0C
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
294
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
295 #define BESHCOORD 0x3d28
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
296 #define BESHISCAL 0x3d30
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
297 #define BESHSRCEND 0x3d3C
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
298 #define BESHSRCLST 0x3d50
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
299 #define BESHSRCST 0x3d38
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
300 #define BESV1WGHT 0x3d48
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
301 #define BESV2WGHT 0x3d4c
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
302 #define BESV1SRCLST 0x3d54
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
303 #define BESV2SRCLST 0x3d58
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
304 #define BESVISCAL 0x3d34
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
305 #define BESVCOORD 0x3d2c
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
306 #define BESSTATUS 0x3dc4
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
307
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
308 #define CRTCX 0x1fd4
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
309 #define CRTCD 0x1fd5
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
310 #define IEN 0x1e1c
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
311 #define ICLEAR 0x1e18
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
312 #define STATUS 0x1e14
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
313
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
314
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
315 #ifdef CRTC2
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
316 static void crtc2_frame_sel(int frame)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
317 {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
318 switch(frame) {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
319 case 0:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
320 cregs.c2pl2startadd0=regs.besa1corg;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
321 cregs.c2pl3startadd0=regs.besa1c3org;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
322 cregs.c2startadd0=regs.besa1org;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
323 break;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
324 case 1:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
325 cregs.c2pl2startadd0=regs.besa2corg;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
326 cregs.c2pl3startadd0=regs.besa2c3org;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
327 cregs.c2startadd0=regs.besa2org;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
328 break;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
329 case 2:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
330 cregs.c2pl2startadd0=regs.besb1corg;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
331 cregs.c2pl3startadd0=regs.besb1c3org;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
332 cregs.c2startadd0=regs.besb1org;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
333 break;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
334 case 3:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
335 cregs.c2pl2startadd0=regs.besb2corg;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
336 cregs.c2pl3startadd0=regs.besb2c3org;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
337 cregs.c2startadd0=regs.besb2org;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
338 break;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
339 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
340 writel(cregs.c2startadd0, mga_mmio_base + C2STARTADD0);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
341 writel(cregs.c2pl2startadd0, mga_mmio_base + C2PL2STARTADD0);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
342 writel(cregs.c2pl3startadd0, mga_mmio_base + C2PL3STARTADD0);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
343 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
344 #endif
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
345
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
346 int vixPlaybackFrameSelect(unsigned int frame)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
347 {
6648
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
348 mga_next_frame = frame;
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
349 if (mga_verbose>1) printf("[mga] frameselect: %d\n", mga_next_frame);
4239
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
350 #if MGA_ALLOW_IRQ
6648
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
351 if (mga_irq == -1)
4239
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
352 #endif
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
353 {
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
354 //we don't need the vcount protection as we're only hitting
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
355 //one register (and it doesn't seem to be double buffered)
6648
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
356 regs.besctl = (regs.besctl & ~0x07000000) + (mga_next_frame << 25);
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
357 writel( regs.besctl, mga_mmio_base + BESCTL );
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
358
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
359 // writel( regs.besglobctl + ((readl(mga_mmio_base + VCOUNT)+2)<<16),
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
360 writel( regs.besglobctl + (MGA_VSYNC_POS<<16),
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
361 mga_mmio_base + BESGLOBCTL);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
362 #ifdef CRTC2
6648
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
363 crtc2_frame_sel(mga_next_frame);
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
364 #endif
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
365 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
366
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
367 return(0);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
368 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
369
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
370
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
371 static void mga_vid_write_regs(int restore)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
372 {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
373 //Make sure internal registers don't get updated until we're done
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
374 writel( (readl(mga_mmio_base + VCOUNT)-1)<<16,
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
375 mga_mmio_base + BESGLOBCTL);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
376
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
377 // color or coordinate keying
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
378
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
379 if(restore && colkey_saved){
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
380 // restore it
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
381 colkey_saved=0;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
382
11217
a9d632bed925 -nocolorkey support
alex
parents: 10983
diff changeset
383 // printf("[mga] Restoring colorkey (ON: %d %02X:%02X:%02X)\n",
a9d632bed925 -nocolorkey support
alex
parents: 10983
diff changeset
384 // colkey_on,colkey_color[0],colkey_color[1],colkey_color[2]);
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
385
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
386 // Set color key registers:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
387 writeb( XKEYOPMODE, mga_mmio_base + PALWTADD);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
388 writeb( colkey_on, mga_mmio_base + X_DATAREG);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
389
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
390 writeb( XCOLKEY0RED, mga_mmio_base + PALWTADD);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
391 writeb( colkey_color[0], mga_mmio_base + X_DATAREG);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
392 writeb( XCOLKEY0GREEN, mga_mmio_base + PALWTADD);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
393 writeb( colkey_color[1], mga_mmio_base + X_DATAREG);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
394 writeb( XCOLKEY0BLUE, mga_mmio_base + PALWTADD);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
395 writeb( colkey_color[2], mga_mmio_base + X_DATAREG);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
396 writeb( X_COLKEY, mga_mmio_base + PALWTADD);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
397 writeb( colkey_color[3], mga_mmio_base + X_DATAREG);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
398
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
399 writeb( XCOLMSK0RED, mga_mmio_base + PALWTADD);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
400 writeb( colkey_mask[0], mga_mmio_base + X_DATAREG);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
401 writeb( XCOLMSK0GREEN, mga_mmio_base + PALWTADD);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
402 writeb( colkey_mask[1], mga_mmio_base + X_DATAREG);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
403 writeb( XCOLMSK0BLUE, mga_mmio_base + PALWTADD);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
404 writeb( colkey_mask[2], mga_mmio_base + X_DATAREG);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
405 writeb( XCOLMSK, mga_mmio_base + PALWTADD);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
406 writeb( colkey_mask[3], mga_mmio_base + X_DATAREG);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
407
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
408 } else if(!colkey_saved){
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
409 // save it
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
410 colkey_saved=1;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
411 // Get color key registers:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
412 writeb( XKEYOPMODE, mga_mmio_base + PALWTADD);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
413 colkey_on=(unsigned char)readb(mga_mmio_base + X_DATAREG) & 1;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
414
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
415 writeb( XCOLKEY0RED, mga_mmio_base + PALWTADD);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
416 colkey_color[0]=(unsigned char)readb(mga_mmio_base + X_DATAREG);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
417 writeb( XCOLKEY0GREEN, mga_mmio_base + PALWTADD);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
418 colkey_color[1]=(unsigned char)readb(mga_mmio_base + X_DATAREG);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
419 writeb( XCOLKEY0BLUE, mga_mmio_base + PALWTADD);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
420 colkey_color[2]=(unsigned char)readb(mga_mmio_base + X_DATAREG);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
421 writeb( X_COLKEY, mga_mmio_base + PALWTADD);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
422 colkey_color[3]=(unsigned char)readb(mga_mmio_base + X_DATAREG);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
423
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
424 writeb( XCOLMSK0RED, mga_mmio_base + PALWTADD);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
425 colkey_mask[0]=(unsigned char)readb(mga_mmio_base + X_DATAREG);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
426 writeb( XCOLMSK0GREEN, mga_mmio_base + PALWTADD);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
427 colkey_mask[1]=(unsigned char)readb(mga_mmio_base + X_DATAREG);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
428 writeb( XCOLMSK0BLUE, mga_mmio_base + PALWTADD);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
429 colkey_mask[2]=(unsigned char)readb(mga_mmio_base + X_DATAREG);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
430 writeb( XCOLMSK, mga_mmio_base + PALWTADD);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
431 colkey_mask[3]=(unsigned char)readb(mga_mmio_base + X_DATAREG);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
432
11217
a9d632bed925 -nocolorkey support
alex
parents: 10983
diff changeset
433 // printf("[mga] Saved colorkey (ON: %d %02X:%02X:%02X)\n",
a9d632bed925 -nocolorkey support
alex
parents: 10983
diff changeset
434 // colkey_on,colkey_color[0],colkey_color[1],colkey_color[2]);
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
435
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
436 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
437
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
438 if(!restore){
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
439 writeb( XKEYOPMODE, mga_mmio_base + PALWTADD);
4239
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
440 writeb( mga_grkey.ckey.op == CKEY_TRUE, mga_mmio_base + X_DATAREG);
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
441 if ( mga_grkey.ckey.op == CKEY_TRUE )
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
442 {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
443 uint32_t r=0, g=0, b=0;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
444
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
445 writeb( XMULCTRL, mga_mmio_base + PALWTADD);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
446 switch (readb (mga_mmio_base + X_DATAREG))
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
447 {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
448 case BPP_8:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
449 /* Need to look up the color index, just using
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
450 color 0 for now. */
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
451 break;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
452
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
453 case BPP_15:
4239
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
454 r = mga_grkey.ckey.red >> 3;
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
455 g = mga_grkey.ckey.green >> 3;
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
456 b = mga_grkey.ckey.blue >> 3;
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
457 break;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
458
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
459 case BPP_16:
4239
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
460 r = mga_grkey.ckey.red >> 3;
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
461 g = mga_grkey.ckey.green >> 2;
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
462 b = mga_grkey.ckey.blue >> 3;
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
463 break;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
464
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
465 case BPP_24:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
466 case BPP_32_DIR:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
467 case BPP_32_PAL:
4239
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
468 r = mga_grkey.ckey.red;
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
469 g = mga_grkey.ckey.green;
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
470 b = mga_grkey.ckey.blue;
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
471 break;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
472 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
473
11217
a9d632bed925 -nocolorkey support
alex
parents: 10983
diff changeset
474 // Enable colorkeying
a9d632bed925 -nocolorkey support
alex
parents: 10983
diff changeset
475 writeb( XKEYOPMODE, mga_mmio_base + PALWTADD);
a9d632bed925 -nocolorkey support
alex
parents: 10983
diff changeset
476 writeb( 1, mga_mmio_base + X_DATAREG);
a9d632bed925 -nocolorkey support
alex
parents: 10983
diff changeset
477
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
478 // Disable color keying on alpha channel
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
479 writeb( XCOLMSK, mga_mmio_base + PALWTADD);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
480 writeb( 0x00, mga_mmio_base + X_DATAREG);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
481 writeb( X_COLKEY, mga_mmio_base + PALWTADD);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
482 writeb( 0x00, mga_mmio_base + X_DATAREG);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
483
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
484
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
485 // Set up color key registers
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
486 writeb( XCOLKEY0RED, mga_mmio_base + PALWTADD);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
487 writeb( r, mga_mmio_base + X_DATAREG);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
488 writeb( XCOLKEY0GREEN, mga_mmio_base + PALWTADD);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
489 writeb( g, mga_mmio_base + X_DATAREG);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
490 writeb( XCOLKEY0BLUE, mga_mmio_base + PALWTADD);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
491 writeb( b, mga_mmio_base + X_DATAREG);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
492
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
493 // Set up color key mask registers
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
494 writeb( XCOLMSK0RED, mga_mmio_base + PALWTADD);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
495 writeb( 0xff, mga_mmio_base + X_DATAREG);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
496 writeb( XCOLMSK0GREEN, mga_mmio_base + PALWTADD);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
497 writeb( 0xff, mga_mmio_base + X_DATAREG);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
498 writeb( XCOLMSK0BLUE, mga_mmio_base + PALWTADD);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
499 writeb( 0xff, mga_mmio_base + X_DATAREG);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
500 }
11217
a9d632bed925 -nocolorkey support
alex
parents: 10983
diff changeset
501 else
a9d632bed925 -nocolorkey support
alex
parents: 10983
diff changeset
502 {
a9d632bed925 -nocolorkey support
alex
parents: 10983
diff changeset
503 // Disable colorkeying
a9d632bed925 -nocolorkey support
alex
parents: 10983
diff changeset
504 writeb( XKEYOPMODE, mga_mmio_base + PALWTADD);
a9d632bed925 -nocolorkey support
alex
parents: 10983
diff changeset
505 writeb( 0, mga_mmio_base + X_DATAREG);
a9d632bed925 -nocolorkey support
alex
parents: 10983
diff changeset
506 }
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
507 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
508
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
509 // Backend Scaler
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
510 writel( regs.besctl, mga_mmio_base + BESCTL);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
511 if(is_g400)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
512 writel( regs.beslumactl, mga_mmio_base + BESLUMACTL);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
513 writel( regs.bespitch, mga_mmio_base + BESPITCH);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
514
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
515 writel( regs.besa1org, mga_mmio_base + BESA1ORG);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
516 writel( regs.besa1corg, mga_mmio_base + BESA1CORG);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
517 writel( regs.besa2org, mga_mmio_base + BESA2ORG);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
518 writel( regs.besa2corg, mga_mmio_base + BESA2CORG);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
519 writel( regs.besb1org, mga_mmio_base + BESB1ORG);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
520 writel( regs.besb1corg, mga_mmio_base + BESB1CORG);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
521 writel( regs.besb2org, mga_mmio_base + BESB2ORG);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
522 writel( regs.besb2corg, mga_mmio_base + BESB2CORG);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
523 if(is_g400)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
524 {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
525 writel( regs.besa1c3org, mga_mmio_base + BESA1C3ORG);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
526 writel( regs.besa2c3org, mga_mmio_base + BESA2C3ORG);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
527 writel( regs.besb1c3org, mga_mmio_base + BESB1C3ORG);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
528 writel( regs.besb2c3org, mga_mmio_base + BESB2C3ORG);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
529 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
530
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
531 writel( regs.beshcoord, mga_mmio_base + BESHCOORD);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
532 writel( regs.beshiscal, mga_mmio_base + BESHISCAL);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
533 writel( regs.beshsrcst, mga_mmio_base + BESHSRCST);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
534 writel( regs.beshsrcend, mga_mmio_base + BESHSRCEND);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
535 writel( regs.beshsrclst, mga_mmio_base + BESHSRCLST);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
536
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
537 writel( regs.besvcoord, mga_mmio_base + BESVCOORD);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
538 writel( regs.besviscal, mga_mmio_base + BESVISCAL);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
539
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
540 writel( regs.besv1srclst, mga_mmio_base + BESV1SRCLST);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
541 writel( regs.besv1wght, mga_mmio_base + BESV1WGHT);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
542 writel( regs.besv2srclst, mga_mmio_base + BESV2SRCLST);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
543 writel( regs.besv2wght, mga_mmio_base + BESV2WGHT);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
544
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
545 //update the registers somewhere between 1 and 2 frames from now.
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
546 writel( regs.besglobctl + ((readl(mga_mmio_base + VCOUNT)+2)<<16),
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
547 mga_mmio_base + BESGLOBCTL);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
548
6648
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
549 if (mga_verbose > 1)
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
550 {
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
551 printf("[mga] wrote BES registers\n");
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
552 printf("[mga] BESCTL = 0x%08x\n",
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
553 readl(mga_mmio_base + BESCTL));
6648
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
554 printf("[mga] BESGLOBCTL = 0x%08x\n",
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
555 readl(mga_mmio_base + BESGLOBCTL));
6648
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
556 printf("[mga] BESSTATUS= 0x%08x\n",
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
557 readl(mga_mmio_base + BESSTATUS));
6648
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
558 }
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
559 #ifdef CRTC2
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
560 // printf("c2ctl:0x%08x c2datactl:0x%08x\n",readl(mga_mmio_base + C2CTL),readl(mga_mmio_base + C2DATACTL));
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
561 // printf("c2misc:0x%08x\n",readl(mga_mmio_base + C2MISC));
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
562 // printf("c2ctl:0x%08x c2datactl:0x%08x\n",cregs.c2ctl,cregs.c2datactl);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
563
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
564 // writel(cregs.c2ctl, mga_mmio_base + C2CTL);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
565
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
566 writel(((readl(mga_mmio_base + C2CTL) & ~0x03e00000) + (cregs.c2ctl & 0x03e00000)), mga_mmio_base + C2CTL);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
567 writel(((readl(mga_mmio_base + C2DATACTL) & ~0x000000ff) + (cregs.c2datactl & 0x000000ff)), mga_mmio_base + C2DATACTL);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
568 // ctrc2
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
569 // disable CRTC2 acording to specs
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
570 // writel(cregs.c2ctl & 0xfffffff0, mga_mmio_base + C2CTL);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
571 // je to treba ???
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
572 // writeb((readb(mga_mmio_base + XMISCCTRL) & 0x19) | 0xa2, mga_mmio_base + XMISCCTRL); // MAFC - mfcsel & vdoutsel
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
573 // writeb((readb(mga_mmio_base + XMISCCTRL) & 0x19) | 0x92, mga_mmio_base + XMISCCTRL);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
574 // writeb((readb(mga_mmio_base + XMISCCTRL) & ~0xe9) + 0xa2, mga_mmio_base + XMISCCTRL);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
575 // writel(cregs.c2datactl, mga_mmio_base + C2DATACTL);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
576 // writel(cregs.c2hparam, mga_mmio_base + C2HPARAM);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
577 // writel(cregs.c2hsync, mga_mmio_base + C2HSYNC);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
578 // writel(cregs.c2vparam, mga_mmio_base + C2VPARAM);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
579 // writel(cregs.c2vsync, mga_mmio_base + C2VSYNC);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
580 writel(cregs.c2misc, mga_mmio_base + C2MISC);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
581
6648
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
582 if (mga_verbose > 1) printf("[mga] c2offset = %d\n",cregs.c2offset);
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
583
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
584 writel(cregs.c2offset, mga_mmio_base + C2OFFSET);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
585 writel(cregs.c2startadd0, mga_mmio_base + C2STARTADD0);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
586 // writel(cregs.c2startadd1, mga_mmio_base + C2STARTADD1);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
587 writel(cregs.c2pl2startadd0, mga_mmio_base + C2PL2STARTADD0);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
588 // writel(cregs.c2pl2startadd1, mga_mmio_base + C2PL2STARTADD1);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
589 writel(cregs.c2pl3startadd0, mga_mmio_base + C2PL3STARTADD0);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
590 // writel(cregs.c2pl3startadd1, mga_mmio_base + C2PL3STARTADD1);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
591 writel(cregs.c2spicstartadd0, mga_mmio_base + C2SPICSTARTADD0);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
592 // writel(cregs.c2spicstartadd1, mga_mmio_base + C2SPICSTARTADD1);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
593 // writel(cregs.c2subpiclut, mga_mmio_base + C2SUBPICLUT);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
594 // writel(cregs.c2preload, mga_mmio_base + C2PRELOAD);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
595 // finaly enable everything
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
596 // writel(cregs.c2ctl, mga_mmio_base + C2CTL);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
597 // printf("c2ctl:0x%08x c2datactl:0x%08x\n",readl(mga_mmio_base + C2CTL),readl(mga_mmio_base + C2DATACTL));
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
598 // printf("c2misc:0x%08x\n", readl(mga_mmio_base + C2MISC));
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
599 #endif
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
600 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
601
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
602 #ifdef MGA_ALLOW_IRQ
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
603 static void enable_irq(){
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
604 long int cc;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
605
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
606 cc = readl(mga_mmio_base + IEN);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
607 // printf("*** !!! IRQREG = %d\n", (int)(cc&0xff));
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
608
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
609 writeb( 0x11, mga_mmio_base + CRTCX);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
610
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
611 writeb(0x20, mga_mmio_base + CRTCD ); /* clear 0, enable off */
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
612 writeb(0x00, mga_mmio_base + CRTCD ); /* enable on */
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
613 writeb(0x10, mga_mmio_base + CRTCD ); /* clear = 1 */
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
614
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
615 writel( regs.besglobctl , mga_mmio_base + BESGLOBCTL);
6648
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
616
4239
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
617 return;
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
618 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
619
4239
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
620 static void disable_irq()
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
621 {
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
622 writeb( 0x11, mga_mmio_base + CRTCX);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
623 writeb(0x20, mga_mmio_base + CRTCD ); /* clear 0, enable off */
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
624
4239
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
625 return;
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
626 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
627
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
628 void mga_handle_irq(int irq, void *dev_id/*, struct pt_regs *pregs*/) {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
629 // static int frame=0;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
630 // static int counter=0;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
631 long int cc;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
632 // if ( ! mga_enabled_flag ) return;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
633
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
634 // printf("vcount = %d\n",readl(mga_mmio_base + VCOUNT));
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
635
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
636 //printf("mga_interrupt #%d\n", irq);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
637
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
638 if ( irq != -1 ) {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
639
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
640 cc = readl(mga_mmio_base + STATUS);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
641 if ( ! (cc & 0x10) ) return; /* vsyncpen */
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
642 // debug_irqcnt++;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
643 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
644
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
645 // if ( debug_irqignore ) {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
646 // debug_irqignore = 0;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
647
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
648
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
649 /*
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
650 if ( mga_conf_deinterlace ) {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
651 if ( mga_first_field ) {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
652 // printf("mga_interrupt first field\n");
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
653 if ( syncfb_interrupt() )
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
654 mga_first_field = 0;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
655 } else {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
656 // printf("mga_interrupt second field\n");
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
657 mga_select_buffer( mga_current_field | 2 );
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
658 mga_first_field = 1;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
659 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
660 } else {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
661 syncfb_interrupt();
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
662 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
663 */
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
664
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
665 // frame=(frame+1)&1;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
666 regs.besctl = (regs.besctl & ~0x07000000) + (mga_next_frame << 25);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
667 writel( regs.besctl, mga_mmio_base + BESCTL );
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
668
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
669 #ifdef CRTC2
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
670 // sem pridat vyber obrazku !!!!
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
671 crtc2_frame_sel(mga_next_frame);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
672 #endif
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
673
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
674 #if 0
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
675 ++counter;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
676 if(!(counter&63)){
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
677 printf("mga irq counter = %d\n",counter);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
678 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
679 #endif
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
680
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
681 // } else {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
682 // debug_irqignore = 1;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
683 // }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
684
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
685 if ( irq != -1 ) {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
686 writeb( 0x11, mga_mmio_base + CRTCX);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
687 writeb( 0, mga_mmio_base + CRTCD );
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
688 writeb( 0x10, mga_mmio_base + CRTCD );
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
689 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
690
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
691 // writel( regs.besglobctl, mga_mmio_base + BESGLOBCTL);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
692
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
693
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
694 return;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
695
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
696 }
4239
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
697 #endif /* MGA_ALLOW_IRQ */
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
698
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
699 int vixConfigPlayback(vidix_playback_t *config)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
700 {
7127
1e47c2e7aa8e mostly compiler warning fixes, some small bugfix
arpi
parents: 6805
diff changeset
701 unsigned int i;
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
702 int x, y, sw, sh, dw, dh;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
703 int besleft, bestop, ifactor, ofsleft, ofstop, baseadrofs, weight, weights;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
704 #ifdef CRTC2
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
705 #define right_margin 0
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
706 #define left_margin 18
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
707 #define hsync_len 46
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
708 #define lower_margin 10
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
709 #define vsync_len 4
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
710 #define upper_margin 39
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
711
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
712 unsigned int hdispend = (config->src.w + 31) & ~31;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
713 unsigned int hsyncstart = hdispend + (right_margin & ~7);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
714 unsigned int hsyncend = hsyncstart + (hsync_len & ~7);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
715 unsigned int htotal = hsyncend + (left_margin & ~7);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
716 unsigned int vdispend = config->src.h;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
717 unsigned int vsyncstart = vdispend + lower_margin;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
718 unsigned int vsyncend = vsyncstart + vsync_len;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
719 unsigned int vtotal = vsyncend + upper_margin;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
720 #endif
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
721
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
722 if ((config->num_frames < 1) || (config->num_frames > 4))
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
723 {
4326
870cec859f92 upgraded to newest vidix interface. in eq: return if g200 moved to the beginning of seteq
alex
parents: 4318
diff changeset
724 printf("[mga] illegal num_frames: %d, setting to %d\n",
870cec859f92 upgraded to newest vidix interface. in eq: return if g200 moved to the beginning of seteq
alex
parents: 4318
diff changeset
725 config->num_frames, MGA_DEFAULT_FRAMES);
870cec859f92 upgraded to newest vidix interface. in eq: return if g200 moved to the beginning of seteq
alex
parents: 4318
diff changeset
726 config->num_frames = MGA_DEFAULT_FRAMES;
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
727 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
728
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
729 x = config->dest.x;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
730 y = config->dest.y;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
731 sw = config->src.w;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
732 sh = config->src.h;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
733 dw = config->dest.w;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
734 dh = config->dest.h;
4144
501620ec9b40 fixed to get something - needs a major rewrite
arpi
parents: 4139
diff changeset
735
501620ec9b40 fixed to get something - needs a major rewrite
arpi
parents: 4139
diff changeset
736 config->dest.pitch.y=32;
9604
cfce34685fc4 fixed chroma pitch
arpi
parents: 8123
diff changeset
737 config->dest.pitch.u=config->dest.pitch.v=32;
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
738
6648
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
739 if (mga_verbose) printf("[mga] Setting up a %dx%d-%dx%d video window (src %dx%d) format %X\n",
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
740 dw, dh, x, y, sw, sh, config->fourcc);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
741
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
742 if ((sw < 4) || (sh < 4) || (dw < 4) || (dh < 4))
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
743 {
4326
870cec859f92 upgraded to newest vidix interface. in eq: return if g200 moved to the beginning of seteq
alex
parents: 4318
diff changeset
744 printf("[mga] Invalid src/dest dimensions\n");
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
745 return(EINVAL);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
746 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
747
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
748 //FIXME check that window is valid and inside desktop
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
749
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
750 // printf("[mga] vcount = %d\n", readl(mga_mmio_base + VCOUNT));
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
751
6648
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
752 sw+=sw&1;
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
753 switch(config->fourcc)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
754 {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
755 case IMGFMT_I420:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
756 case IMGFMT_IYUV:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
757 case IMGFMT_YV12:
6648
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
758 sh+=sh&1;
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
759 config->frame_size = ((sw + 31) & ~31) * sh + (((sw + 31) & ~31) * sh) / 2;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
760 break;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
761 case IMGFMT_YUY2:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
762 case IMGFMT_UYVY:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
763 config->frame_size = ((sw + 31) & ~31) * sh * 2;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
764 break;
4326
870cec859f92 upgraded to newest vidix interface. in eq: return if g200 moved to the beginning of seteq
alex
parents: 4318
diff changeset
765 default:
870cec859f92 upgraded to newest vidix interface. in eq: return if g200 moved to the beginning of seteq
alex
parents: 4318
diff changeset
766 printf("[mga] Unsupported pixel format: %x\n", config->fourcc);
870cec859f92 upgraded to newest vidix interface. in eq: return if g200 moved to the beginning of seteq
alex
parents: 4318
diff changeset
767 return(ENOTSUP);
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
768 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
769
6648
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
770 config->offsets[0] = 0;
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
771 // config->offsets[1] = config->frame_size;
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
772 // config->offsets[2] = 2*config->frame_size;
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
773 // config->offsets[3] = 3*config->frame_size;
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
774 for (i = 1; i < config->num_frames+1; i++)
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
775 config->offsets[i] = i*config->frame_size;
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
776
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
777 config->offset.y=0;
13227
45f25ea0c5fa fix for i420 format, initial patch by Aurelien Jacobs <aurel at gnuage.org> from the Geexbox mplayer patchset, some modification by me
faust3
parents: 11678
diff changeset
778 if(config->fourcc == IMGFMT_I420 || config->fourcc == IMGFMT_IYUV)
45f25ea0c5fa fix for i420 format, initial patch by Aurelien Jacobs <aurel at gnuage.org> from the Geexbox mplayer patchset, some modification by me
faust3
parents: 11678
diff changeset
779 {
45f25ea0c5fa fix for i420 format, initial patch by Aurelien Jacobs <aurel at gnuage.org> from the Geexbox mplayer patchset, some modification by me
faust3
parents: 11678
diff changeset
780 config->offset.u=((sw + 31) & ~31) * sh;
45f25ea0c5fa fix for i420 format, initial patch by Aurelien Jacobs <aurel at gnuage.org> from the Geexbox mplayer patchset, some modification by me
faust3
parents: 11678
diff changeset
781 config->offset.v=config->offset.u+((sw + 31) & ~31) * sh /4;
45f25ea0c5fa fix for i420 format, initial patch by Aurelien Jacobs <aurel at gnuage.org> from the Geexbox mplayer patchset, some modification by me
faust3
parents: 11678
diff changeset
782 }
45f25ea0c5fa fix for i420 format, initial patch by Aurelien Jacobs <aurel at gnuage.org> from the Geexbox mplayer patchset, some modification by me
faust3
parents: 11678
diff changeset
783 else {
45f25ea0c5fa fix for i420 format, initial patch by Aurelien Jacobs <aurel at gnuage.org> from the Geexbox mplayer patchset, some modification by me
faust3
parents: 11678
diff changeset
784 config->offset.v=((sw + 31) & ~31) * sh;
45f25ea0c5fa fix for i420 format, initial patch by Aurelien Jacobs <aurel at gnuage.org> from the Geexbox mplayer patchset, some modification by me
faust3
parents: 11678
diff changeset
785 config->offset.u=config->offset.v+((sw + 31) & ~31) * sh /4;
45f25ea0c5fa fix for i420 format, initial patch by Aurelien Jacobs <aurel at gnuage.org> from the Geexbox mplayer patchset, some modification by me
faust3
parents: 11678
diff changeset
786 }
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
787
4272
68a40de07167 cleaned some parts, tested and working with g400/450, g200 is buggy :(
alex
parents: 4250
diff changeset
788 //FIXME figure out a better way to allocate memory on card
68a40de07167 cleaned some parts, tested and working with g400/450, g200 is buggy :(
alex
parents: 4250
diff changeset
789 //allocate 2 megs
68a40de07167 cleaned some parts, tested and working with g400/450, g200 is buggy :(
alex
parents: 4250
diff changeset
790 //mga_src_base = mga_mem_base + (MGA_VIDMEM_SIZE-2) * 0x100000;
68a40de07167 cleaned some parts, tested and working with g400/450, g200 is buggy :(
alex
parents: 4250
diff changeset
791 //mga_src_base = (MGA_VIDMEM_SIZE-3) * 0x100000;
4144
501620ec9b40 fixed to get something - needs a major rewrite
arpi
parents: 4139
diff changeset
792
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
793 mga_src_base = (mga_ram_size*0x100000-config->num_frames*config->frame_size);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
794 if (mga_src_base < 0)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
795 {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
796 printf("[mga] not enough memory for frames!\n");
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
797 return(EFAULT);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
798 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
799 mga_src_base &= (~0xFFFF); /* 64k boundary */
8123
9fc45fe0d444 *HUGE* set of compiler warning fixes, unused variables removal
arpi
parents: 7127
diff changeset
800 if (mga_verbose > 1) printf("[mga] YUV buffer base: %#x\n", mga_src_base);
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
801
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
802 config->dga_addr = mga_mem_base + mga_src_base;
4238
9eada2812ed3 i think, it's better [playback->offsets and offset implemented/corrected]
alex
parents: 4191
diff changeset
803
4326
870cec859f92 upgraded to newest vidix interface. in eq: return if g200 moved to the beginning of seteq
alex
parents: 4318
diff changeset
804 /* for G200 set Interleaved UV planes */
870cec859f92 upgraded to newest vidix interface. in eq: return if g200 moved to the beginning of seteq
alex
parents: 4318
diff changeset
805 if (!is_g400)
870cec859f92 upgraded to newest vidix interface. in eq: return if g200 moved to the beginning of seteq
alex
parents: 4318
diff changeset
806 config->flags = VID_PLAY_INTERLEAVED_UV | INTERLEAVING_UV;
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
807
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
808 //Setup the BES registers for a three plane 4:2:0 video source
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
809
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
810 regs.besglobctl = 0;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
811
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
812 switch(config->fourcc)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
813 {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
814 case IMGFMT_YV12:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
815 case IMGFMT_I420:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
816 case IMGFMT_IYUV:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
817 regs.besctl = 1 // BES enabled
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
818 + (0<<6) // even start polarity
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
819 + (1<<10) // x filtering enabled
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
820 + (1<<11) // y filtering enabled
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
821 + (1<<16) // chroma upsampling
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
822 + (1<<17) // 4:2:0 mode
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
823 + (1<<18); // dither enabled
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
824 #if 0
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
825 if(is_g400)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
826 {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
827 //zoom disabled, zoom filter disabled, 420 3 plane format, proc amp
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
828 //disabled, rgb mode disabled
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
829 regs.besglobctl = (1<<5);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
830 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
831 else
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
832 {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
833 //zoom disabled, zoom filter disabled, Cb samples in 0246, Cr
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
834 //in 1357, BES register update on besvcnt
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
835 regs.besglobctl = 0;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
836 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
837 #endif
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
838 break;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
839
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
840 case IMGFMT_YUY2:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
841 regs.besctl = 1 // BES enabled
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
842 + (0<<6) // even start polarity
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
843 + (1<<10) // x filtering enabled
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
844 + (1<<11) // y filtering enabled
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
845 + (1<<16) // chroma upsampling
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
846 + (0<<17) // 4:2:2 mode
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
847 + (1<<18); // dither enabled
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
848
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
849 regs.besglobctl = 0; // YUY2 format selected
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
850 break;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
851
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
852 case IMGFMT_UYVY:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
853 regs.besctl = 1 // BES enabled
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
854 + (0<<6) // even start polarity
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
855 + (1<<10) // x filtering enabled
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
856 + (1<<11) // y filtering enabled
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
857 + (1<<16) // chroma upsampling
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
858 + (0<<17) // 4:2:2 mode
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
859 + (1<<18); // dither enabled
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
860
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
861 regs.besglobctl = 1<<6; // UYVY format selected
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
862 break;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
863
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
864 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
865
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
866 //Disable contrast and brightness control
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
867 regs.besglobctl |= (1<<5) + (1<<7);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
868 regs.beslumactl = (0x7f << 16) + (0x80<<0);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
869 regs.beslumactl = 0x80<<0;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
870
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
871 //Setup destination window boundaries
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
872 besleft = x > 0 ? x : 0;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
873 bestop = y > 0 ? y : 0;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
874 regs.beshcoord = (besleft<<16) + (x + dw-1);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
875 regs.besvcoord = (bestop<<16) + (y + dh-1);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
876
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
877 //Setup source dimensions
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
878 regs.beshsrclst = (sw - 1) << 16;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
879 regs.bespitch = (sw + 31) & ~31 ;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
880
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
881 //Setup horizontal scaling
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
882 ifactor = ((sw-1)<<14)/(dw-1);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
883 ofsleft = besleft - x;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
884
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
885 regs.beshiscal = ifactor<<2;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
886 regs.beshsrcst = (ofsleft*ifactor)<<2;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
887 regs.beshsrcend = regs.beshsrcst + (((dw - ofsleft - 1) * ifactor) << 2);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
888
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
889 //Setup vertical scaling
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
890 ifactor = ((sh-1)<<14)/(dh-1);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
891 ofstop = bestop - y;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
892
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
893 regs.besviscal = ifactor<<2;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
894
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
895 baseadrofs = ((ofstop*regs.besviscal)>>16)*regs.bespitch;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
896 //frame_size = ((sw + 31) & ~31) * sh + (((sw + 31) & ~31) * sh) / 2;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
897 regs.besa1org = (uint32_t) mga_src_base + baseadrofs;
4272
68a40de07167 cleaned some parts, tested and working with g400/450, g200 is buggy :(
alex
parents: 4250
diff changeset
898 regs.besa2org = (uint32_t) mga_src_base + baseadrofs + 1*config->frame_size;
68a40de07167 cleaned some parts, tested and working with g400/450, g200 is buggy :(
alex
parents: 4250
diff changeset
899 regs.besb1org = (uint32_t) mga_src_base + baseadrofs + 2*config->frame_size;
68a40de07167 cleaned some parts, tested and working with g400/450, g200 is buggy :(
alex
parents: 4250
diff changeset
900 regs.besb2org = (uint32_t) mga_src_base + baseadrofs + 3*config->frame_size;
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
901
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
902 if(config->fourcc==IMGFMT_YV12
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
903 ||config->fourcc==IMGFMT_IYUV
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
904 ||config->fourcc==IMGFMT_I420
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
905 ){
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
906 // planar YUV frames:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
907 if (is_g400)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
908 baseadrofs = (((ofstop*regs.besviscal)/4)>>16)*regs.bespitch;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
909 else
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
910 baseadrofs = (((ofstop*regs.besviscal)/2)>>16)*regs.bespitch;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
911
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
912 if(config->fourcc==IMGFMT_YV12){
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
913 regs.besa1corg = (uint32_t) mga_src_base + baseadrofs + regs.bespitch * sh ;
4272
68a40de07167 cleaned some parts, tested and working with g400/450, g200 is buggy :(
alex
parents: 4250
diff changeset
914 regs.besa2corg = (uint32_t) mga_src_base + baseadrofs + 1*config->frame_size + regs.bespitch * sh;
68a40de07167 cleaned some parts, tested and working with g400/450, g200 is buggy :(
alex
parents: 4250
diff changeset
915 regs.besb1corg = (uint32_t) mga_src_base + baseadrofs + 2*config->frame_size + regs.bespitch * sh;
68a40de07167 cleaned some parts, tested and working with g400/450, g200 is buggy :(
alex
parents: 4250
diff changeset
916 regs.besb2corg = (uint32_t) mga_src_base + baseadrofs + 3*config->frame_size + regs.bespitch * sh;
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
917 regs.besa1c3org = regs.besa1corg + ((regs.bespitch * sh) / 4);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
918 regs.besa2c3org = regs.besa2corg + ((regs.bespitch * sh) / 4);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
919 regs.besb1c3org = regs.besb1corg + ((regs.bespitch * sh) / 4);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
920 regs.besb2c3org = regs.besb2corg + ((regs.bespitch * sh) / 4);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
921 } else {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
922 regs.besa1c3org = (uint32_t) mga_src_base + baseadrofs + regs.bespitch * sh ;
4272
68a40de07167 cleaned some parts, tested and working with g400/450, g200 is buggy :(
alex
parents: 4250
diff changeset
923 regs.besa2c3org = (uint32_t) mga_src_base + baseadrofs + 1*config->frame_size + regs.bespitch * sh;
68a40de07167 cleaned some parts, tested and working with g400/450, g200 is buggy :(
alex
parents: 4250
diff changeset
924 regs.besb1c3org = (uint32_t) mga_src_base + baseadrofs + 2*config->frame_size + regs.bespitch * sh;
68a40de07167 cleaned some parts, tested and working with g400/450, g200 is buggy :(
alex
parents: 4250
diff changeset
925 regs.besb2c3org = (uint32_t) mga_src_base + baseadrofs + 3*config->frame_size + regs.bespitch * sh;
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
926 regs.besa1corg = regs.besa1c3org + ((regs.bespitch * sh) / 4);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
927 regs.besa2corg = regs.besa2c3org + ((regs.bespitch * sh) / 4);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
928 regs.besb1corg = regs.besb1c3org + ((regs.bespitch * sh) / 4);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
929 regs.besb2corg = regs.besb2c3org + ((regs.bespitch * sh) / 4);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
930 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
931
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
932 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
933
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
934 weight = ofstop * (regs.besviscal >> 2);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
935 weights = weight < 0 ? 1 : 0;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
936 regs.besv2wght = regs.besv1wght = (weights << 16) + ((weight & 0x3FFF) << 2);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
937 regs.besv2srclst = regs.besv1srclst = sh - 1 - (((ofstop * regs.besviscal) >> 16) & 0x03FF);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
938
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
939 #ifdef CRTC2
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
940 // pridat hlavni registry - tj. casovani ...
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
941
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
942
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
943 switch(config->fourcc){
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
944 case IMGFMT_YV12:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
945 case IMGFMT_I420:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
946 case IMGFMT_IYUV:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
947 cregs.c2ctl = 1 // CRTC2 enabled
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
948 + (1<<1) // external clock
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
949 + (0<<2) // external clock
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
950 + (1<<3) // pixel clock enable - not needed ???
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
951 + (0<<4) // high prioryty req
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
952 + (1<<5) // high prioryty req
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
953 + (0<<6) // high prioryty req
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
954 + (1<<8) // high prioryty req max
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
955 + (0<<9) // high prioryty req max
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
956 + (0<<10) // high prioryty req max
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
957 + (0<<20) // CRTC1 to DAC
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
958 + (1<<21) // 420 mode
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
959 + (1<<22) // 420 mode
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
960 + (1<<23) // 420 mode
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
961 + (0<<24) // single chroma line for 420 mode - need to be corrected
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
962 + (0<<25) /*/ interlace mode - need to be corrected*/
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
963 + (0<<26) // field legth polariry
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
964 + (0<<27) // field identification polariry
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
965 + (1<<28) // VIDRST detection mode
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
966 + (0<<29) // VIDRST detection mode
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
967 + (1<<30) // Horizontal counter preload
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
968 + (1<<31) // Vertical counter preload
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
969 ;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
970 cregs.c2datactl = 1 // disable dither - propably not needed, we are already in YUV mode
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
971 + (1<<1) // Y filter enable
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
972 + (1<<2) // CbCr filter enable
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
973 + (0<<3) // subpicture enable (disabled)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
974 + (0<<4) // NTSC enable (disabled - PAL)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
975 + (0<<5) // C2 static subpicture enable (disabled)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
976 + (0<<6) // C2 subpicture offset division (disabled)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
977 + (0<<7) // 422 subformat selection !
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
978 /* + (0<<8) // 15 bpp high alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
979 + (0<<9) // 15 bpp high alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
980 + (0<<10) // 15 bpp high alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
981 + (0<<11) // 15 bpp high alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
982 + (0<<12) // 15 bpp high alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
983 + (0<<13) // 15 bpp high alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
984 + (0<<14) // 15 bpp high alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
985 + (0<<15) // 15 bpp high alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
986 + (0<<16) // 15 bpp low alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
987 + (0<<17) // 15 bpp low alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
988 + (0<<18) // 15 bpp low alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
989 + (0<<19) // 15 bpp low alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
990 + (0<<20) // 15 bpp low alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
991 + (0<<21) // 15 bpp low alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
992 + (0<<22) // 15 bpp low alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
993 + (0<<23) // 15 bpp low alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
994 + (0<<24) // static subpicture key
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
995 + (0<<25) // static subpicture key
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
996 + (0<<26) // static subpicture key
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
997 + (0<<27) // static subpicture key
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
998 + (0<<28) // static subpicture key
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
999 */ ;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1000 break;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1001
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1002 case IMGFMT_YUY2:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1003 cregs.c2ctl = 1 // CRTC2 enabled
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1004 + (1<<1) // external clock
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1005 + (0<<2) // external clock
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1006 + (1<<3) // pixel clock enable - not needed ???
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1007 + (0<<4) // high prioryty req - acc to spec
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1008 + (1<<5) // high prioryty req
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1009 + (0<<6) // high prioryty req
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1010 // 7 reserved
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1011 + (1<<8) // high prioryty req max
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1012 + (0<<9) // high prioryty req max
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1013 + (0<<10) // high prioryty req max
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1014 // 11-19 reserved
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1015 + (0<<20) // CRTC1 to DAC
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1016 + (1<<21) // 422 mode
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1017 + (0<<22) // 422 mode
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1018 + (1<<23) // 422 mode
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1019 + (0<<24) // single chroma line for 420 mode - need to be corrected
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1020 + (0<<25) /*/ interlace mode - need to be corrected*/
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1021 + (0<<26) // field legth polariry
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1022 + (0<<27) // field identification polariry
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1023 + (1<<28) // VIDRST detection mode
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1024 + (0<<29) // VIDRST detection mode
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1025 + (1<<30) // Horizontal counter preload
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1026 + (1<<31) // Vertical counter preload
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1027 ;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1028 cregs.c2datactl = 1 // disable dither - propably not needed, we are already in YUV mode
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1029 + (1<<1) // Y filter enable
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1030 + (1<<2) // CbCr filter enable
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1031 + (0<<3) // subpicture enable (disabled)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1032 + (0<<4) // NTSC enable (disabled - PAL)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1033 + (0<<5) // C2 static subpicture enable (disabled)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1034 + (0<<6) // C2 subpicture offset division (disabled)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1035 + (0<<7) // 422 subformat selection !
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1036 /* + (0<<8) // 15 bpp high alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1037 + (0<<9) // 15 bpp high alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1038 + (0<<10) // 15 bpp high alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1039 + (0<<11) // 15 bpp high alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1040 + (0<<12) // 15 bpp high alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1041 + (0<<13) // 15 bpp high alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1042 + (0<<14) // 15 bpp high alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1043 + (0<<15) // 15 bpp high alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1044 + (0<<16) // 15 bpp low alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1045 + (0<<17) // 15 bpp low alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1046 + (0<<18) // 15 bpp low alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1047 + (0<<19) // 15 bpp low alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1048 + (0<<20) // 15 bpp low alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1049 + (0<<21) // 15 bpp low alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1050 + (0<<22) // 15 bpp low alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1051 + (0<<23) // 15 bpp low alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1052 + (0<<24) // static subpicture key
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1053 + (0<<25) // static subpicture key
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1054 + (0<<26) // static subpicture key
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1055 + (0<<27) // static subpicture key
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1056 + (0<<28) // static subpicture key
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1057 */ ;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1058 break;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1059
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1060 case IMGFMT_UYVY:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1061 cregs.c2ctl = 1 // CRTC2 enabled
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1062 + (1<<1) // external clock
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1063 + (0<<2) // external clock
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1064 + (1<<3) // pixel clock enable - not needed ???
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1065 + (0<<4) // high prioryty req
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1066 + (1<<5) // high prioryty req
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1067 + (0<<6) // high prioryty req
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1068 + (1<<8) // high prioryty req max
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1069 + (0<<9) // high prioryty req max
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1070 + (0<<10) // high prioryty req max
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1071 + (0<<20) // CRTC1 to DAC
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1072 + (1<<21) // 422 mode
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1073 + (0<<22) // 422 mode
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1074 + (1<<23) // 422 mode
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1075 + (1<<24) // single chroma line for 420 mode - need to be corrected
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1076 + (1<<25) /*/ interlace mode - need to be corrected*/
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1077 + (0<<26) // field legth polariry
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1078 + (0<<27) // field identification polariry
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1079 + (1<<28) // VIDRST detection mode
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1080 + (0<<29) // VIDRST detection mode
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1081 + (1<<30) // Horizontal counter preload
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1082 + (1<<31) // Vertical counter preload
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1083 ;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1084 cregs.c2datactl = 0 // enable dither - propably not needed, we are already in YUV mode
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1085 + (1<<1) // Y filter enable
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1086 + (1<<2) // CbCr filter enable
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1087 + (0<<3) // subpicture enable (disabled)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1088 + (0<<4) // NTSC enable (disabled - PAL)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1089 + (0<<5) // C2 static subpicture enable (disabled)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1090 + (0<<6) // C2 subpicture offset division (disabled)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1091 + (1<<7) // 422 subformat selection !
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1092 /* + (0<<8) // 15 bpp high alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1093 + (0<<9) // 15 bpp high alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1094 + (0<<10) // 15 bpp high alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1095 + (0<<11) // 15 bpp high alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1096 + (0<<12) // 15 bpp high alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1097 + (0<<13) // 15 bpp high alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1098 + (0<<14) // 15 bpp high alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1099 + (0<<15) // 15 bpp high alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1100 + (0<<16) // 15 bpp low alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1101 + (0<<17) // 15 bpp low alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1102 + (0<<18) // 15 bpp low alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1103 + (0<<19) // 15 bpp low alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1104 + (0<<20) // 15 bpp low alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1105 + (0<<21) // 15 bpp low alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1106 + (0<<22) // 15 bpp low alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1107 + (0<<23) // 15 bpp low alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1108 + (0<<24) // static subpicture key
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1109 + (0<<25) // static subpicture key
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1110 + (0<<26) // static subpicture key
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1111 + (0<<27) // static subpicture key
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1112 + (0<<28) // static subpicture key
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1113 */ ;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1114 break;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1115 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1116
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1117 cregs.c2hparam=((hdispend - 8) << 16) | (htotal - 8);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1118 cregs.c2hsync=((hsyncend - 8) << 16) | (hsyncstart - 8);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1119
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1120 cregs.c2misc=0 // CRTCV2 656 togg f0
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1121 +(0<<1) // CRTCV2 656 togg f0
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1122 +(0<<2) // CRTCV2 656 togg f0
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1123 +(0<<4) // CRTCV2 656 togg f1
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1124 +(0<<5) // CRTCV2 656 togg f1
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1125 +(0<<6) // CRTCV2 656 togg f1
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1126 +(0<<8) // Hsync active high
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1127 +(0<<9) // Vsync active high
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1128 // 16-27 c2vlinecomp - nevim co tam dat
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1129 ;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1130 cregs.c2offset=(regs.bespitch << 1);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1131
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1132 cregs.c2pl2startadd0=regs.besa1corg;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1133 // cregs.c2pl2startadd1=regs.besa2corg;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1134 cregs.c2pl3startadd0=regs.besa1c3org;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1135 // cregs.c2pl3startadd1=regs.besa2c3org;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1136
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1137 cregs.c2preload=(vsyncstart << 16) | (hsyncstart); // from
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1138
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1139 cregs.c2spicstartadd0=0; // not used
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1140 // cregs.c2spicstartadd1=0; // not used
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1141
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1142 cregs.c2startadd0=regs.besa1org;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1143 // cregs.c2startadd1=regs.besa2org;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1144
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1145 cregs.c2subpiclut=0; //not used
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1146
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1147 cregs.c2vparam=((vdispend - 1) << 16) | (vtotal - 1);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1148 cregs.c2vsync=((vsyncend - 1) << 16) | (vsyncstart - 1);
4272
68a40de07167 cleaned some parts, tested and working with g400/450, g200 is buggy :(
alex
parents: 4250
diff changeset
1149 #endif /* CRTC2 */
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1150
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1151 mga_vid_write_regs(0);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1152 return(0);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1153 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1154
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1155 int vixPlaybackOn(void)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1156 {
6648
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
1157 if (mga_verbose) printf("[mga] playback on\n");
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1158
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1159 vid_src_ready = 1;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1160 if(vid_overlay_on)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1161 {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1162 regs.besctl |= 1;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1163 mga_vid_write_regs(0);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1164 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1165 #ifdef MGA_ALLOW_IRQ
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1166 if (mga_irq != -1)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1167 enable_irq();
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1168 #endif
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1169 mga_next_frame=0;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1170
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1171 return(0);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1172 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1173
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1174 int vixPlaybackOff(void)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1175 {
6648
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
1176 if (mga_verbose) printf("[mga] playback off\n");
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1177
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1178 vid_src_ready = 0;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1179 #ifdef MGA_ALLOW_IRQ
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1180 if (mga_irq != -1)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1181 disable_irq();
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1182 #endif
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1183 regs.besctl &= ~1;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1184 regs.besglobctl &= ~(1<<6); /* UYVY format selected */
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1185 mga_vid_write_regs(0);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1186
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1187 return(0);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1188 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1189
4191
62a6135d090e + new features and possibility
nick
parents: 4163
diff changeset
1190 int vixProbe(int verbose,int force)
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1191 {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1192 pciinfo_t lst[MAX_PCI_DEVICES];
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1193 unsigned int i, num_pci;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1194 int err;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1195
6648
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
1196 if (verbose) printf("[mga] probe\n");
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1197
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1198 mga_verbose = verbose;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1199
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1200 is_g400 = -1;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1201
7127
1e47c2e7aa8e mostly compiler warning fixes, some small bugfix
arpi
parents: 6805
diff changeset
1202 err = pci_scan(lst, &num_pci);
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1203 if (err)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1204 {
11678
972d1998bde9 occured --> occurred typo patch by Clinton Roy <croy@dstc.edu.au>
diego
parents: 11463
diff changeset
1205 printf("[mga] Error occurred during pci scan: %s\n", strerror(err));
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1206 return(err);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1207 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1208
6648
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
1209 if (mga_verbose)
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1210 printf("[mga] found %d pci devices\n", num_pci);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1211
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1212 for (i = 0; i < num_pci; i++)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1213 {
6648
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
1214 if (mga_verbose > 1)
4279
4301c4adbcf7 reported working at 1600x1200 too, pciconfig stuff fixed, you can enable it with #define MGA_PCICONFIG_MEMDETECT
alex
parents: 4273
diff changeset
1215 printf("[mga] pci[%d] vendor: %d device: %d\n",
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1216 i, lst[i].vendor, lst[i].device);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1217 if (lst[i].vendor == VENDOR_MATROX)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1218 {
9767
f6d2772efca3 Ignore disabled cards. (Jon Burgess <jburgess@uklinux.net>)
ranma
parents: 9604
diff changeset
1219 if ((lst[i].command & PCI_COMMAND_IO) == 0)
f6d2772efca3 Ignore disabled cards. (Jon Burgess <jburgess@uklinux.net>)
ranma
parents: 9604
diff changeset
1220 {
f6d2772efca3 Ignore disabled cards. (Jon Burgess <jburgess@uklinux.net>)
ranma
parents: 9604
diff changeset
1221 printf("[mga] Device is disabled, ignoring\n");
f6d2772efca3 Ignore disabled cards. (Jon Burgess <jburgess@uklinux.net>)
ranma
parents: 9604
diff changeset
1222 continue;
f6d2772efca3 Ignore disabled cards. (Jon Burgess <jburgess@uklinux.net>)
ranma
parents: 9604
diff changeset
1223 }
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1224 switch(lst[i].device)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1225 {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1226 case DEVICE_MATROX_MGA_G550_AGP:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1227 printf("[mga] Found MGA G550\n");
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1228 is_g400 = 1;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1229 goto card_found;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1230 case DEVICE_MATROX_MGA_G400_AGP:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1231 printf("[mga] Found MGA G400/G450\n");
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1232 is_g400 = 1;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1233 goto card_found;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1234 case DEVICE_MATROX_MGA_G200_AGP:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1235 printf("[mga] Found MGA G200 AGP\n");
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1236 is_g400 = 0;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1237 goto card_found;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1238 case DEVICE_MATROX_MGA_G200:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1239 printf("[mga] Found MGA G200 PCI\n");
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1240 is_g400 = 0;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1241 goto card_found;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1242 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1243 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1244 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1245
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1246 if (is_g400 == -1)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1247 {
11463
d379e392a132 message made similar to other vidix drivers' (and only print if -v)
gabucino
parents: 11217
diff changeset
1248 if (verbose) printf("[mga] Can't find chip\n");
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1249 return(ENXIO);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1250 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1251
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1252 card_found:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1253 probed = 1;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1254 memcpy(&pci_info, &lst[i], sizeof(pciinfo_t));
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1255
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1256 mga_cap.device_id = pci_info.device; /* set device id in capabilites */
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1257
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1258 return(0);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1259 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1260
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1261 int vixInit(void)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1262 {
4279
4301c4adbcf7 reported working at 1600x1200 too, pciconfig stuff fixed, you can enable it with #define MGA_PCICONFIG_MEMDETECT
alex
parents: 4273
diff changeset
1263 unsigned int card_option = 0;
4482
9c6ab57cfdde using MTRR
nick
parents: 4326
diff changeset
1264 int err;
6648
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
1265
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
1266 if (mga_verbose) printf("[mga] init\n");
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1267
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1268 mga_vid_in_use = 0;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1269
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1270 printf("Matrox MGA G200/G400/G450 YUV Video interface v2.01 (c) Aaron Holtzman & A'rpi\n");
6648
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
1271 #ifdef CRCT2
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
1272 printf("Driver compiled with TV-out (second-head) support\n");
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
1273 #endif
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1274
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1275 if (!probed)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1276 {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1277 printf("[mga] driver was not probed but is being initializing\n");
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1278 return(EINTR);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1279 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1280
4279
4301c4adbcf7 reported working at 1600x1200 too, pciconfig stuff fixed, you can enable it with #define MGA_PCICONFIG_MEMDETECT
alex
parents: 4273
diff changeset
1281 #ifdef MGA_PCICONFIG_MEMDETECT
4272
68a40de07167 cleaned some parts, tested and working with g400/450, g200 is buggy :(
alex
parents: 4250
diff changeset
1282 pci_config_read(pci_info.bus, pci_info.card, pci_info.func,
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1283 0x40, 4, &card_option);
6648
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
1284 if (mga_verbose > 1) printf("[mga] OPTION word: 0x%08X mem: 0x%02X %s\n", card_option,
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1285 (card_option>>10)&0x17, ((card_option>>14)&1)?"SGRAM":"SDRAM");
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1286 #endif
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1287
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1288 if (mga_ram_size)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1289 {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1290 printf("[mga] RAMSIZE forced to %d MB\n", mga_ram_size);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1291 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1292 else
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1293 {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1294 #ifdef MGA_MEMORY_SIZE
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1295 mga_ram_size = MGA_MEMORY_SIZE;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1296 printf("[mga] hard-coded RAMSIZE is %d MB\n", (unsigned int) mga_ram_size);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1297 #else
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1298 if (is_g400)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1299 {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1300 switch((card_option>>10)&0x17)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1301 {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1302 // SDRAM:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1303 case 0x00:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1304 case 0x04: mga_ram_size = 16; break;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1305 case 0x03: mga_ram_size = 32; break;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1306 // SGRAM:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1307 case 0x10:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1308 case 0x14: mga_ram_size = 32; break;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1309 case 0x11:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1310 case 0x12: mga_ram_size = 16; break;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1311 default:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1312 mga_ram_size = 16;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1313 printf("[mga] Couldn't detect RAMSIZE, assuming 16MB!\n");
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1314 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1315 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1316 else
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1317 {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1318 switch((card_option>>10)&0x17)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1319 {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1320 // case 0x10:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1321 // case 0x13: mga_ram_size = 8; break;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1322 default: mga_ram_size = 8;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1323 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1324 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1325
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1326 #if 0
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1327 // printf("List resources -----------\n");
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1328 for(temp=0;temp<DEVICE_COUNT_RESOURCE;temp++){
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1329 struct resource *res=&pci_dev->resource[temp];
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1330 if(res->flags){
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1331 int size=(1+res->end-res->start)>>20;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1332 printf("res %d: start: 0x%X end: 0x%X (%d MB) flags=0x%X\n",temp,res->start,res->end,size,res->flags);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1333 if(res->flags&(IORESOURCE_MEM|IORESOURCE_PREFETCH)){
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1334 if(size>mga_ram_size && size<=64) mga_ram_size=size;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1335 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1336 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1337 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1338 #endif
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1339
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1340 printf("[mga] detected RAMSIZE is %d MB\n", (unsigned int) mga_ram_size);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1341 #endif
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1342 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1343
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1344 if (mga_ram_size)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1345 {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1346 if ((mga_ram_size < 4) || (mga_ram_size > 64))
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1347 {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1348 printf("[mga] invalid RAMSIZE: %d MB\n", mga_ram_size);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1349 return(EINVAL);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1350 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1351 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1352
8123
9fc45fe0d444 *HUGE* set of compiler warning fixes, unused variables removal
arpi
parents: 7127
diff changeset
1353 if (mga_verbose > 1) printf("[mga] hardware addresses: mmio: %#x, framebuffer: %#x\n",
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1354 pci_info.base1, pci_info.base0);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1355
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1356 mga_mmio_base = map_phys_mem(pci_info.base1,0x4000);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1357 mga_mem_base = map_phys_mem(pci_info.base0,mga_ram_size*1024*1024);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1358
6648
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
1359 if (mga_verbose > 1) printf("[mga] MMIO at %p, IRQ: %d, framebuffer: %p\n",
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1360 mga_mmio_base, mga_irq, mga_mem_base);
4482
9c6ab57cfdde using MTRR
nick
parents: 4326
diff changeset
1361 err = mtrr_set_type(pci_info.base0,mga_ram_size*1024*1024,MTRR_TYPE_WRCOMB);
9c6ab57cfdde using MTRR
nick
parents: 4326
diff changeset
1362 if(!err) printf("[mga] Set write-combining type of video memory\n");
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1363 #ifdef MGA_ALLOW_IRQ
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1364 if (mga_irq != -1)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1365 {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1366 int tmp = request_irq(mga_irq, mga_handle_irq, SA_INTERRUPT | SA_SHIRQ, "Syncfb Time Base", &mga_irq);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1367 if (tmp)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1368 {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1369 printf("syncfb (mga): cannot register irq %d (Err: %d)\n", mga_irq, tmp);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1370 mga_irq=-1;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1371 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1372 else
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1373 {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1374 printf("syncfb (mga): registered irq %d\n", mga_irq);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1375 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1376 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1377 else
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1378 {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1379 printf("syncfb (mga): No valid irq was found\n");
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1380 mga_irq=-1;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1381 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1382 #else
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1383 printf("syncfb (mga): IRQ disabled in mga_vid.c\n");
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1384 mga_irq=-1;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1385 #endif
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1386
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1387 return(0);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1388 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1389
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1390 void vixDestroy(void)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1391 {
6648
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
1392 if (mga_verbose) printf("[mga] destroy\n");
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1393
6648
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
1394 /* FIXME turn off BES */
4272
68a40de07167 cleaned some parts, tested and working with g400/450, g200 is buggy :(
alex
parents: 4250
diff changeset
1395 vid_src_ready = 0;
68a40de07167 cleaned some parts, tested and working with g400/450, g200 is buggy :(
alex
parents: 4250
diff changeset
1396 regs.besctl &= ~1;
68a40de07167 cleaned some parts, tested and working with g400/450, g200 is buggy :(
alex
parents: 4250
diff changeset
1397 regs.besglobctl &= ~(1<<6); // UYVY format selected
68a40de07167 cleaned some parts, tested and working with g400/450, g200 is buggy :(
alex
parents: 4250
diff changeset
1398 // mga_config.colkey_on=0; //!!!
68a40de07167 cleaned some parts, tested and working with g400/450, g200 is buggy :(
alex
parents: 4250
diff changeset
1399 mga_vid_write_regs(1);
68a40de07167 cleaned some parts, tested and working with g400/450, g200 is buggy :(
alex
parents: 4250
diff changeset
1400 mga_vid_in_use = 0;
68a40de07167 cleaned some parts, tested and working with g400/450, g200 is buggy :(
alex
parents: 4250
diff changeset
1401
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1402 #ifdef MGA_ALLOW_IRQ
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1403 if (mga_irq != -1)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1404 free_irq(mga_irq, &mga_irq);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1405 #endif
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1406
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1407 if (mga_mmio_base)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1408 unmap_phys_mem(mga_mmio_base, 0x4000);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1409 if (mga_mem_base)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1410 unmap_phys_mem(mga_mem_base, mga_ram_size);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1411 return;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1412 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1413
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1414 int vixQueryFourcc(vidix_fourcc_t *to)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1415 {
6648
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
1416 if (mga_verbose) printf("[mga] query fourcc (%x)\n", to->fourcc);
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1417
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1418 switch(to->fourcc)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1419 {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1420 case IMGFMT_YV12:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1421 case IMGFMT_IYUV:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1422 case IMGFMT_I420:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1423 case IMGFMT_YUY2:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1424 case IMGFMT_UYVY:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1425 break;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1426 default:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1427 to->depth = to->flags = 0;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1428 return(ENOTSUP);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1429 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1430
4239
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
1431 to->depth = VID_DEPTH_12BPP |
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
1432 VID_DEPTH_15BPP | VID_DEPTH_16BPP |
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
1433 VID_DEPTH_24BPP | VID_DEPTH_32BPP;
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
1434 to->flags = VID_CAP_EXPAND | VID_CAP_SHRINK | VID_CAP_COLORKEY;
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1435 return(0);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1436 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1437
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1438 unsigned int vixGetVersion(void)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1439 {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1440 return(VIDIX_VERSION);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1441 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1442
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1443 int vixGetCapability(vidix_capability_t *to)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1444 {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1445 memcpy(to, &mga_cap, sizeof(vidix_capability_t));
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1446 return(0);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1447 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1448
4239
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
1449 int vixGetGrKeys(vidix_grkey_t *grkey)
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
1450 {
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
1451 memcpy(grkey, &mga_grkey, sizeof(vidix_grkey_t));
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
1452 return(0);
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
1453 }
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
1454
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
1455 int vixSetGrKeys(const vidix_grkey_t *grkey)
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
1456 {
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
1457 memcpy(&mga_grkey, grkey, sizeof(vidix_grkey_t));
17248
61cc20df7f3e fix setting colorkey in vidix mga_vid
ods15
parents: 13227
diff changeset
1458 mga_vid_write_regs(0);
4239
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
1459 return(0);
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
1460 }
4250
49746d2bfda7 gamma correction (preliminary version).
nick
parents: 4239
diff changeset
1461
6600
1f0acc9106a8 equalizer (brightness/contrast) support
alex
parents: 4482
diff changeset
1462 int vixPlaybackSetEq( const vidix_video_eq_t * eq)
4318
693e4cfd2b84 intense -> intensity + capability extension
nick
parents: 4279
diff changeset
1463 {
6600
1f0acc9106a8 equalizer (brightness/contrast) support
alex
parents: 4482
diff changeset
1464 /* contrast and brightness control isn't supported on G200 - alex */
4326
870cec859f92 upgraded to newest vidix interface. in eq: return if g200 moved to the beginning of seteq
alex
parents: 4318
diff changeset
1465 if (!is_g400)
870cec859f92 upgraded to newest vidix interface. in eq: return if g200 moved to the beginning of seteq
alex
parents: 4318
diff changeset
1466 {
6648
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
1467 if (mga_verbose) printf("[mga] equalizer isn't supported with G200\n");
6600
1f0acc9106a8 equalizer (brightness/contrast) support
alex
parents: 4482
diff changeset
1468 return(ENOTSUP);
1f0acc9106a8 equalizer (brightness/contrast) support
alex
parents: 4482
diff changeset
1469 }
6755
a31b9f15cbff - fix audio equalizer
pontscho
parents: 6648
diff changeset
1470
6805
963f266ce7cc vide EQ fixed - lumactl register is not readable!
arpi
parents: 6755
diff changeset
1471 // only brightness&contrast are supported:
963f266ce7cc vide EQ fixed - lumactl register is not readable!
arpi
parents: 6755
diff changeset
1472 if(!(eq->cap & (VEQ_CAP_BRIGHTNESS|VEQ_CAP_CONTRAST)))
963f266ce7cc vide EQ fixed - lumactl register is not readable!
arpi
parents: 6755
diff changeset
1473 return(ENOTSUP);
963f266ce7cc vide EQ fixed - lumactl register is not readable!
arpi
parents: 6755
diff changeset
1474
963f266ce7cc vide EQ fixed - lumactl register is not readable!
arpi
parents: 6755
diff changeset
1475 //regs.beslumactl = readl(mga_mmio_base + BESLUMACTL);
963f266ce7cc vide EQ fixed - lumactl register is not readable!
arpi
parents: 6755
diff changeset
1476 // printf("LUMA = %08X \n",regs.beslumactl);
963f266ce7cc vide EQ fixed - lumactl register is not readable!
arpi
parents: 6755
diff changeset
1477 if (eq->cap & VEQ_CAP_BRIGHTNESS) {
963f266ce7cc vide EQ fixed - lumactl register is not readable!
arpi
parents: 6755
diff changeset
1478 regs.beslumactl &= 0xFFFF;
963f266ce7cc vide EQ fixed - lumactl register is not readable!
arpi
parents: 6755
diff changeset
1479 regs.beslumactl |= (eq->brightness*255/2000)<<16;
963f266ce7cc vide EQ fixed - lumactl register is not readable!
arpi
parents: 6755
diff changeset
1480 }
963f266ce7cc vide EQ fixed - lumactl register is not readable!
arpi
parents: 6755
diff changeset
1481 if (eq->cap & VEQ_CAP_CONTRAST) {
963f266ce7cc vide EQ fixed - lumactl register is not readable!
arpi
parents: 6755
diff changeset
1482 regs.beslumactl &= 0xFFFF0000;
963f266ce7cc vide EQ fixed - lumactl register is not readable!
arpi
parents: 6755
diff changeset
1483 regs.beslumactl |= (128+eq->contrast*255/2000)&0xFFFF;
963f266ce7cc vide EQ fixed - lumactl register is not readable!
arpi
parents: 6755
diff changeset
1484 }
963f266ce7cc vide EQ fixed - lumactl register is not readable!
arpi
parents: 6755
diff changeset
1485 writel(regs.beslumactl,mga_mmio_base + BESLUMACTL);
6755
a31b9f15cbff - fix audio equalizer
pontscho
parents: 6648
diff changeset
1486
6600
1f0acc9106a8 equalizer (brightness/contrast) support
alex
parents: 4482
diff changeset
1487 return(0);
1f0acc9106a8 equalizer (brightness/contrast) support
alex
parents: 4482
diff changeset
1488 }
1f0acc9106a8 equalizer (brightness/contrast) support
alex
parents: 4482
diff changeset
1489
1f0acc9106a8 equalizer (brightness/contrast) support
alex
parents: 4482
diff changeset
1490 int vixPlaybackGetEq( vidix_video_eq_t * eq)
1f0acc9106a8 equalizer (brightness/contrast) support
alex
parents: 4482
diff changeset
1491 {
1f0acc9106a8 equalizer (brightness/contrast) support
alex
parents: 4482
diff changeset
1492 /* contrast and brightness control isn't supported on G200 - alex */
1f0acc9106a8 equalizer (brightness/contrast) support
alex
parents: 4482
diff changeset
1493 if (!is_g400)
1f0acc9106a8 equalizer (brightness/contrast) support
alex
parents: 4482
diff changeset
1494 {
6648
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
1495 if (mga_verbose) printf("[mga] equalizer isn't supported with G200\n");
6600
1f0acc9106a8 equalizer (brightness/contrast) support
alex
parents: 4482
diff changeset
1496 return(ENOTSUP);
4326
870cec859f92 upgraded to newest vidix interface. in eq: return if g200 moved to the beginning of seteq
alex
parents: 4318
diff changeset
1497 }
870cec859f92 upgraded to newest vidix interface. in eq: return if g200 moved to the beginning of seteq
alex
parents: 4318
diff changeset
1498
6805
963f266ce7cc vide EQ fixed - lumactl register is not readable!
arpi
parents: 6755
diff changeset
1499 // regs.beslumactl = readl(mga_mmio_base + BESLUMACTL);
4326
870cec859f92 upgraded to newest vidix interface. in eq: return if g200 moved to the beginning of seteq
alex
parents: 4318
diff changeset
1500
6805
963f266ce7cc vide EQ fixed - lumactl register is not readable!
arpi
parents: 6755
diff changeset
1501 eq->brightness = (signed short int)(regs.beslumactl >> 16) * 1000 / 128;
963f266ce7cc vide EQ fixed - lumactl register is not readable!
arpi
parents: 6755
diff changeset
1502 eq->contrast = (signed short int)(regs.beslumactl & 0xFFFF) * 1000 / 128 - 1000;
6600
1f0acc9106a8 equalizer (brightness/contrast) support
alex
parents: 4482
diff changeset
1503 eq->cap = VEQ_CAP_BRIGHTNESS | VEQ_CAP_CONTRAST;
6805
963f266ce7cc vide EQ fixed - lumactl register is not readable!
arpi
parents: 6755
diff changeset
1504
963f266ce7cc vide EQ fixed - lumactl register is not readable!
arpi
parents: 6755
diff changeset
1505 printf("MGA GET_EQ: br=%d c=%d \n",eq->brightness,eq->contrast);
4273
dca74cbbe70c equalizer is only supported by g400
alex
parents: 4272
diff changeset
1506
6600
1f0acc9106a8 equalizer (brightness/contrast) support
alex
parents: 4482
diff changeset
1507 return(0);
4250
49746d2bfda7 gamma correction (preliminary version).
nick
parents: 4239
diff changeset
1508 }