annotate vidix/drivers/mga_vid.c @ 8609:1d98280b9ad1

The following patch allows the MPlayer "cdparanoia" support to work on NetBSD-1.6_STABLE, both "cdda://NN" and "cddb://NN" URI's. The CDROM ioctl's are actually more like OpenBSD's than FreeBSD's. I went with the "/dev/cdrom" symlink as the default device, though, as it otherwise gets messy fast... The first CDROM is "/dev/rcd0d" on NetBSD/i386, but "/dev/rcd0c" on all other NetBSD ports, and only the cdda_identify_scsi() form seems to work on NetBSD. (I searched the web in vain for the Paranoia API, so I'm left to hacking. ;-)) Frederick Bruckman <fredb@immanent.net>
author arpi
date Sat, 28 Dec 2002 14:04:54 +0000
parents 9fc45fe0d444
children cfce34685fc4
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
4163
d0678176b98c BSD fix by Steven M. Schultz <sms@2BSD.COM>
arpi
parents: 4144
diff changeset
63 #if !defined(ENOTSUP) && defined(EOPNOTSUPP)
d0678176b98c BSD fix by Steven M. Schultz <sms@2BSD.COM>
arpi
parents: 4144
diff changeset
64 #define ENOTSUP EOPNOTSUPP
d0678176b98c BSD fix by Steven M. Schultz <sms@2BSD.COM>
arpi
parents: 4144
diff changeset
65 #endif
d0678176b98c BSD fix by Steven M. Schultz <sms@2BSD.COM>
arpi
parents: 4144
diff changeset
66
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
67 /* from radeon_vid */
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
68 #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
69 #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
70
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
71 #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
72 #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
73 #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
74 #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
75
4272
68a40de07167 cleaned some parts, tested and working with g400/450, g200 is buggy :(
alex
parents: 4250
diff changeset
76 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
77
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
78 /* 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
79 static int probed = 0;
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
80 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
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 /* 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
83 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
84 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
85 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
86 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
87
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
88 /* 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
89 static uint8_t *mga_mmio_base = 0;
7127
1e47c2e7aa8e mostly compiler warning fixes, some small bugfix
arpi
parents: 6805
diff changeset
90 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
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 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
93
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
94 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
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 /* 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
97 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
98
4272
68a40de07167 cleaned some parts, tested and working with g400/450, g200 is buggy :(
alex
parents: 4250
diff changeset
99 static int colkey_saved = 0;
68a40de07167 cleaned some parts, tested and working with g400/450, g200 is buggy :(
alex
parents: 4250
diff changeset
100 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
101 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
102 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
103
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
104 /* 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
105 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
106
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
107 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
108
4239
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 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
110 {
6648
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
111 "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
112 "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
113 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
114 { 0, 0, 0, 0 },
6648
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
115 2048,
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
116 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
117 4,
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
118 4,
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
119 -1,
6600
1f0acc9106a8 equalizer (brightness/contrast) support
alex
parents: 4482
diff changeset
120 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
121 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
122 -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
123 { 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
124 };
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
125
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
126 /* MATROX BES registers */
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
127 typedef struct bes_registers_s
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
128 {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
129 //BES Control
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
130 uint32_t besctl;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
131 //BES Global control
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
132 uint32_t besglobctl;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
133 //Luma control (brightness and contrast)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
134 uint32_t beslumactl;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
135 //Line pitch
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
136 uint32_t bespitch;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
137
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
138 //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
139 uint32_t besa1c3org;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
140 //Buffer A-1 Chroma org
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
141 uint32_t besa1corg;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
142 //Buffer A-1 Luma org
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
143 uint32_t besa1org;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
144
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
145 //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
146 uint32_t besa2c3org;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
147 //Buffer A-2 Chroma org
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
148 uint32_t besa2corg;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
149 //Buffer A-2 Luma org
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
150 uint32_t besa2org;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
151
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
152 //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
153 uint32_t besb1c3org;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
154 //Buffer B-1 Chroma org
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
155 uint32_t besb1corg;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
156 //Buffer B-1 Luma org
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
157 uint32_t besb1org;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
158
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
159 //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
160 uint32_t besb2c3org;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
161 //Buffer B-2 Chroma org
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
162 uint32_t besb2corg;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
163 //Buffer B-2 Luma org
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
164 uint32_t besb2org;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
165
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
166 //BES Horizontal coord
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
167 uint32_t beshcoord;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
168 //BES Horizontal inverse scaling [5.14]
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
169 uint32_t beshiscal;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
170 //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
171 uint32_t beshsrcst;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
172 //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
173 uint32_t beshsrcend;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
174 //BES Horizontal source last
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
175 uint32_t beshsrclst;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
176
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
177
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
178 //BES Vertical coord
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
179 uint32_t besvcoord;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
180 //BES Vertical inverse scaling [5.14]
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
181 uint32_t besviscal;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
182 //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
183 uint32_t besv1srclst;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
184 //BES Field 1 weight start
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
185 uint32_t besv1wght;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
186 //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
187 uint32_t besv2srclst;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
188 //BES Field 2 weight start
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
189 uint32_t besv2wght;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
190
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
191 } bes_registers_t;
4272
68a40de07167 cleaned some parts, tested and working with g400/450, g200 is buggy :(
alex
parents: 4250
diff changeset
192 static bes_registers_t regs;
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
193
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
194 #ifdef CRTC2
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
195 typedef struct crtc2_registers_s
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
196 {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
197 uint32_t c2ctl;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
198 uint32_t c2datactl;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
199 uint32_t c2misc;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
200 uint32_t c2hparam;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
201 uint32_t c2hsync;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
202 uint32_t c2offset;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
203 uint32_t c2pl2startadd0;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
204 uint32_t c2pl2startadd1;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
205 uint32_t c2pl3startadd0;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
206 uint32_t c2pl3startadd1;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
207 uint32_t c2preload;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
208 uint32_t c2spicstartadd0;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
209 uint32_t c2spicstartadd1;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
210 uint32_t c2startadd0;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
211 uint32_t c2startadd1;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
212 uint32_t c2subpiclut;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
213 uint32_t c2vcount;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
214 uint32_t c2vparam;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
215 uint32_t c2vsync;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
216 } crtc2_registers_t;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
217 static crtc2_registers_t cregs;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
218 #endif
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
219
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
220 //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
221 //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
222 #define VCOUNT 0x1e20
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 #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
225 #define X_DATAREG 0x3c0a
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
226
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
227 #define XMULCTRL 0x19
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
228 #define BPP_8 0x00
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
229 #define BPP_15 0x01
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
230 #define BPP_16 0x02
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
231 #define BPP_24 0x03
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
232 #define BPP_32_DIR 0x04
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
233 #define BPP_32_PAL 0x07
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
234
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
235 #define XCOLMSK 0x40
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
236 #define X_COLKEY 0x42
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
237 #define XKEYOPMODE 0x51
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
238 #define XCOLMSK0RED 0x52
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
239 #define XCOLMSK0GREEN 0x53
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
240 #define XCOLMSK0BLUE 0x54
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
241 #define XCOLKEY0RED 0x55
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
242 #define XCOLKEY0GREEN 0x56
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
243 #define XCOLKEY0BLUE 0x57
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
244
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
245 #ifdef CRTC2
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
246 /*CRTC2 registers*/
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
247 #define XMISCCTRL 0x1e
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
248 #define C2CTL 0x3c10
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
249 #define C2DATACTL 0x3c4c
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
250 #define C2MISC 0x3c44
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
251 #define C2HPARAM 0x3c14
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
252 #define C2HSYNC 0x3c18
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
253 #define C2OFFSET 0x3c40
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
254 #define C2PL2STARTADD0 0x3c30 // like BESA1CORG
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
255 #define C2PL2STARTADD1 0x3c34 // like BESA2CORG
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
256 #define C2PL3STARTADD0 0x3c38 // like BESA1C3ORG
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
257 #define C2PL3STARTADD1 0x3c3c // like BESA2C3ORG
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
258 #define C2PRELOAD 0x3c24
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
259 #define C2SPICSTARTADD0 0x3c54
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
260 #define C2SPICSTARTADD1 0x3c58
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
261 #define C2STARTADD0 0x3c28 // like BESA1ORG
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
262 #define C2STARTADD1 0x3c2c // like BESA2ORG
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
263 #define C2SUBPICLUT 0x3c50
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
264 #define C2VCOUNT 0x3c48
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
265 #define C2VPARAM 0x3c1c
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
266 #define C2VSYNC 0x3c20
4272
68a40de07167 cleaned some parts, tested and working with g400/450, g200 is buggy :(
alex
parents: 4250
diff changeset
267 #endif /* CRTC2 */
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
268
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
269 // Backend Scaler registers
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
270 #define BESCTL 0x3d20
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
271 #define BESGLOBCTL 0x3dc0
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
272 #define BESLUMACTL 0x3d40
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
273 #define BESPITCH 0x3d24
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
274
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
275 #define BESA1C3ORG 0x3d60
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
276 #define BESA1CORG 0x3d10
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
277 #define BESA1ORG 0x3d00
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 BESA2C3ORG 0x3d64
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
280 #define BESA2CORG 0x3d14
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
281 #define BESA2ORG 0x3d04
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 BESB1C3ORG 0x3d68
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
284 #define BESB1CORG 0x3d18
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
285 #define BESB1ORG 0x3d08
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 BESB2C3ORG 0x3d6C
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
288 #define BESB2CORG 0x3d1C
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
289 #define BESB2ORG 0x3d0C
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 BESHCOORD 0x3d28
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
292 #define BESHISCAL 0x3d30
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
293 #define BESHSRCEND 0x3d3C
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
294 #define BESHSRCLST 0x3d50
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
295 #define BESHSRCST 0x3d38
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
296 #define BESV1WGHT 0x3d48
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
297 #define BESV2WGHT 0x3d4c
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
298 #define BESV1SRCLST 0x3d54
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
299 #define BESV2SRCLST 0x3d58
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
300 #define BESVISCAL 0x3d34
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
301 #define BESVCOORD 0x3d2c
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
302 #define BESSTATUS 0x3dc4
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
303
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
304 #define CRTCX 0x1fd4
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
305 #define CRTCD 0x1fd5
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
306 #define IEN 0x1e1c
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
307 #define ICLEAR 0x1e18
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
308 #define STATUS 0x1e14
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
309
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
310
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
311 #ifdef CRTC2
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
312 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
313 {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
314 switch(frame) {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
315 case 0:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
316 cregs.c2pl2startadd0=regs.besa1corg;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
317 cregs.c2pl3startadd0=regs.besa1c3org;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
318 cregs.c2startadd0=regs.besa1org;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
319 break;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
320 case 1:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
321 cregs.c2pl2startadd0=regs.besa2corg;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
322 cregs.c2pl3startadd0=regs.besa2c3org;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
323 cregs.c2startadd0=regs.besa2org;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
324 break;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
325 case 2:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
326 cregs.c2pl2startadd0=regs.besb1corg;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
327 cregs.c2pl3startadd0=regs.besb1c3org;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
328 cregs.c2startadd0=regs.besb1org;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
329 break;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
330 case 3:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
331 cregs.c2pl2startadd0=regs.besb2corg;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
332 cregs.c2pl3startadd0=regs.besb2c3org;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
333 cregs.c2startadd0=regs.besb2org;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
334 break;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
335 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
336 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
337 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
338 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
339 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
340 #endif
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
341
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
342 int vixPlaybackFrameSelect(unsigned int frame)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
343 {
6648
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
344 mga_next_frame = frame;
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
345 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
346 #if MGA_ALLOW_IRQ
6648
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
347 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
348 #endif
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
349 {
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
350 //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
351 //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
352 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
353 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
354
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
355 // 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
356 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
357 mga_mmio_base + BESGLOBCTL);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
358 #ifdef CRTC2
6648
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
359 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
360 #endif
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
361 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
362
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
363 return(0);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
364 }
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 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
368 {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
369 //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
370 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
371 mga_mmio_base + BESGLOBCTL);
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 // color or coordinate keying
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
374
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
375 if(restore && colkey_saved){
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
376 // restore it
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
377 colkey_saved=0;
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 printf("[mga] Restoring colorkey (ON: %d %02X:%02X:%02X)\n",
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
380 colkey_on,colkey_color[0],colkey_color[1],colkey_color[2]);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
381
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
382 // Set color key registers:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
383 writeb( XKEYOPMODE, mga_mmio_base + PALWTADD);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
384 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
385
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
386 writeb( XCOLKEY0RED, mga_mmio_base + PALWTADD);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
387 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
388 writeb( XCOLKEY0GREEN, mga_mmio_base + PALWTADD);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
389 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
390 writeb( XCOLKEY0BLUE, 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[2], 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( X_COLKEY, 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[3], mga_mmio_base + X_DATAREG);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
394
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
395 writeb( XCOLMSK0RED, mga_mmio_base + PALWTADD);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
396 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
397 writeb( XCOLMSK0GREEN, mga_mmio_base + PALWTADD);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
398 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
399 writeb( XCOLMSK0BLUE, 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[2], 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( XCOLMSK, 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[3], mga_mmio_base + X_DATAREG);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
403
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
404 } else if(!colkey_saved){
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
405 // save it
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
406 colkey_saved=1;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
407 // Get color key registers:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
408 writeb( XKEYOPMODE, mga_mmio_base + PALWTADD);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
409 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
410
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
411 writeb( XCOLKEY0RED, mga_mmio_base + PALWTADD);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
412 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
413 writeb( XCOLKEY0GREEN, mga_mmio_base + PALWTADD);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
414 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
415 writeb( XCOLKEY0BLUE, 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[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
417 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
418 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
419
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
420 writeb( XCOLMSK0RED, mga_mmio_base + PALWTADD);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
421 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
422 writeb( XCOLMSK0GREEN, mga_mmio_base + PALWTADD);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
423 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
424 writeb( XCOLMSK0BLUE, 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[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
426 writeb( XCOLMSK, 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[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
428
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
429 printf("[mga] Saved colorkey (ON: %d %02X:%02X:%02X)\n",
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
430 colkey_on,colkey_color[0],colkey_color[1],colkey_color[2]);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
431
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
432 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
433
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
434 if(!restore){
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
435 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
436 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
437 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
438 {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
439 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
440
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
441 writeb( XMULCTRL, mga_mmio_base + PALWTADD);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
442 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
443 {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
444 case BPP_8:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
445 /* 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
446 color 0 for now. */
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
447 break;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
448
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
449 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
450 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
451 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
452 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
453 break;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
454
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
455 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
456 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
457 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
458 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
459 break;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
460
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
461 case BPP_24:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
462 case BPP_32_DIR:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
463 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
464 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
465 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
466 b = mga_grkey.ckey.blue;
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
467 break;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
468 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
469
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
470 // Disable color keying on alpha channel
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
471 writeb( XCOLMSK, mga_mmio_base + PALWTADD);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
472 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
473 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
474 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
475
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
476
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
477 // Set up color key registers
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
478 writeb( XCOLKEY0RED, mga_mmio_base + PALWTADD);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
479 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
480 writeb( XCOLKEY0GREEN, mga_mmio_base + PALWTADD);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
481 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
482 writeb( XCOLKEY0BLUE, mga_mmio_base + PALWTADD);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
483 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
484
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
485 // Set up color key mask registers
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
486 writeb( XCOLMSK0RED, mga_mmio_base + PALWTADD);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
487 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
488 writeb( XCOLMSK0GREEN, mga_mmio_base + PALWTADD);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
489 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
490 writeb( XCOLMSK0BLUE, mga_mmio_base + PALWTADD);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
491 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
492 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
493
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
494 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
495
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
496 // Backend Scaler
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
497 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
498 if(is_g400)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
499 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
500 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
501
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
502 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
503 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
504 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
505 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
506 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
507 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
508 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
509 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
510 if(is_g400)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
511 {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
512 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
513 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
514 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
515 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
516 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
517
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
518 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
519 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
520 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
521 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
522 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
523
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
524 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
525 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
526
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
527 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
528 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
529 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
530 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
531
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
532 //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
533 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
534 mga_mmio_base + BESGLOBCTL);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
535
6648
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
536 if (mga_verbose > 1)
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
537 {
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
538 printf("[mga] wrote BES registers\n");
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
539 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
540 readl(mga_mmio_base + BESCTL));
6648
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
541 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
542 readl(mga_mmio_base + BESGLOBCTL));
6648
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
543 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
544 readl(mga_mmio_base + BESSTATUS));
6648
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
545 }
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
546 #ifdef CRTC2
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
547 // 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
548 // 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
549 // 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
550
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
551 // 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
552
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
553 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
554 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
555 // ctrc2
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
556 // disable CRTC2 acording to specs
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
557 // 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
558 // je to treba ???
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
559 // 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
560 // 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
561 // 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
562 // 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
563 // 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
564 // 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
565 // 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
566 // 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
567 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
568
6648
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
569 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
570
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
571 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
572 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
573 // 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
574 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
575 // 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
576 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
577 // 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
578 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
579 // 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
580 // 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
581 // 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
582 // finaly enable everything
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
583 // 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
584 // 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
585 // 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
586 #endif
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
587 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
588
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
589 #ifdef MGA_ALLOW_IRQ
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
590 static void enable_irq(){
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
591 long int cc;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
592
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
593 cc = readl(mga_mmio_base + IEN);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
594 // 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
595
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
596 writeb( 0x11, mga_mmio_base + CRTCX);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
597
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
598 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
599 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
600 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
601
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
602 writel( regs.besglobctl , mga_mmio_base + BESGLOBCTL);
6648
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
603
4239
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
604 return;
4139
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
4239
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
607 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
608 {
4139
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 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
611
4239
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
612 return;
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
613 }
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 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
616 // static int frame=0;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
617 // static int counter=0;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
618 long int cc;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
619 // if ( ! mga_enabled_flag ) return;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
620
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
621 // 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
622
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
623 //printf("mga_interrupt #%d\n", irq);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
624
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
625 if ( irq != -1 ) {
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 cc = readl(mga_mmio_base + STATUS);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
628 if ( ! (cc & 0x10) ) return; /* vsyncpen */
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
629 // debug_irqcnt++;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
630 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
631
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
632 // if ( debug_irqignore ) {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
633 // debug_irqignore = 0;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
634
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 /*
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
637 if ( mga_conf_deinterlace ) {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
638 if ( mga_first_field ) {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
639 // printf("mga_interrupt first field\n");
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
640 if ( syncfb_interrupt() )
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
641 mga_first_field = 0;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
642 } else {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
643 // printf("mga_interrupt second field\n");
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
644 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
645 mga_first_field = 1;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
646 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
647 } else {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
648 syncfb_interrupt();
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 */
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
651
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
652 // frame=(frame+1)&1;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
653 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
654 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
655
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
656 #ifdef CRTC2
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
657 // sem pridat vyber obrazku !!!!
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
658 crtc2_frame_sel(mga_next_frame);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
659 #endif
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
660
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
661 #if 0
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
662 ++counter;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
663 if(!(counter&63)){
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
664 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
665 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
666 #endif
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
667
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
668 // } else {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
669 // debug_irqignore = 1;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
670 // }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
671
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
672 if ( irq != -1 ) {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
673 writeb( 0x11, mga_mmio_base + CRTCX);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
674 writeb( 0, mga_mmio_base + CRTCD );
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
675 writeb( 0x10, mga_mmio_base + CRTCD );
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
676 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
677
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
678 // 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
679
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 return;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
682
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
683 }
4239
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
684 #endif /* MGA_ALLOW_IRQ */
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
685
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
686 int vixConfigPlayback(vidix_playback_t *config)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
687 {
7127
1e47c2e7aa8e mostly compiler warning fixes, some small bugfix
arpi
parents: 6805
diff changeset
688 unsigned int i;
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
689 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
690 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
691 #ifdef CRTC2
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
692 #define right_margin 0
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
693 #define left_margin 18
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
694 #define hsync_len 46
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
695 #define lower_margin 10
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
696 #define vsync_len 4
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
697 #define upper_margin 39
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 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
700 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
701 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
702 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
703 unsigned int vdispend = config->src.h;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
704 unsigned int vsyncstart = vdispend + lower_margin;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
705 unsigned int vsyncend = vsyncstart + vsync_len;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
706 unsigned int vtotal = vsyncend + upper_margin;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
707 #endif
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
708
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
709 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
710 {
4326
870cec859f92 upgraded to newest vidix interface. in eq: return if g200 moved to the beginning of seteq
alex
parents: 4318
diff changeset
711 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
712 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
713 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
714 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
715
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
716 x = config->dest.x;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
717 y = config->dest.y;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
718 sw = config->src.w;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
719 sh = config->src.h;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
720 dw = config->dest.w;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
721 dh = config->dest.h;
4144
501620ec9b40 fixed to get something - needs a major rewrite
arpi
parents: 4139
diff changeset
722
501620ec9b40 fixed to get something - needs a major rewrite
arpi
parents: 4139
diff changeset
723 config->dest.pitch.y=32;
4272
68a40de07167 cleaned some parts, tested and working with g400/450, g200 is buggy :(
alex
parents: 4250
diff changeset
724 config->dest.pitch.u=config->dest.pitch.v=16;
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
725
6648
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
726 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
727 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
728
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
729 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
730 {
4326
870cec859f92 upgraded to newest vidix interface. in eq: return if g200 moved to the beginning of seteq
alex
parents: 4318
diff changeset
731 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
732 return(EINVAL);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
733 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
734
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
735 //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
736
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
737 // 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
738
6648
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
739 sw+=sw&1;
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
740 switch(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 case IMGFMT_I420:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
743 case IMGFMT_IYUV:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
744 case IMGFMT_YV12:
6648
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
745 sh+=sh&1;
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
746 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
747 break;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
748 case IMGFMT_YUY2:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
749 case IMGFMT_UYVY:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
750 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
751 break;
4326
870cec859f92 upgraded to newest vidix interface. in eq: return if g200 moved to the beginning of seteq
alex
parents: 4318
diff changeset
752 default:
870cec859f92 upgraded to newest vidix interface. in eq: return if g200 moved to the beginning of seteq
alex
parents: 4318
diff changeset
753 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
754 return(ENOTSUP);
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
755 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
756
6648
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
757 config->offsets[0] = 0;
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
758 // config->offsets[1] = config->frame_size;
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
759 // config->offsets[2] = 2*config->frame_size;
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
760 // config->offsets[3] = 3*config->frame_size;
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
761 for (i = 1; i < config->num_frames+1; i++)
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
762 config->offsets[i] = i*config->frame_size;
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
763
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
764 config->offset.y=0;
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
765 config->offset.v=((sw + 31) & ~31) * sh;
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
766 config->offset.u=config->offset.v+((sw + 31) & ~31) * sh /4;
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
767
4272
68a40de07167 cleaned some parts, tested and working with g400/450, g200 is buggy :(
alex
parents: 4250
diff changeset
768 //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
769 //allocate 2 megs
68a40de07167 cleaned some parts, tested and working with g400/450, g200 is buggy :(
alex
parents: 4250
diff changeset
770 //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
771 //mga_src_base = (MGA_VIDMEM_SIZE-3) * 0x100000;
4144
501620ec9b40 fixed to get something - needs a major rewrite
arpi
parents: 4139
diff changeset
772
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
773 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
774 if (mga_src_base < 0)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
775 {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
776 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
777 return(EFAULT);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
778 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
779 mga_src_base &= (~0xFFFF); /* 64k boundary */
8123
9fc45fe0d444 *HUGE* set of compiler warning fixes, unused variables removal
arpi
parents: 7127
diff changeset
780 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
781
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
782 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
783
4326
870cec859f92 upgraded to newest vidix interface. in eq: return if g200 moved to the beginning of seteq
alex
parents: 4318
diff changeset
784 /* 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
785 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
786 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
787
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
788 //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
789
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
790 regs.besglobctl = 0;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
791
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
792 switch(config->fourcc)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
793 {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
794 case IMGFMT_YV12:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
795 case IMGFMT_I420:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
796 case IMGFMT_IYUV:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
797 regs.besctl = 1 // BES enabled
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
798 + (0<<6) // even start polarity
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
799 + (1<<10) // x filtering enabled
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
800 + (1<<11) // y filtering enabled
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
801 + (1<<16) // chroma upsampling
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
802 + (1<<17) // 4:2:0 mode
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
803 + (1<<18); // dither enabled
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
804 #if 0
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
805 if(is_g400)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
806 {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
807 //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
808 //disabled, rgb mode disabled
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
809 regs.besglobctl = (1<<5);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
810 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
811 else
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
812 {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
813 //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
814 //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
815 regs.besglobctl = 0;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
816 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
817 #endif
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
818 break;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
819
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
820 case IMGFMT_YUY2:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
821 regs.besctl = 1 // BES enabled
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
822 + (0<<6) // even start polarity
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
823 + (1<<10) // x filtering enabled
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
824 + (1<<11) // y filtering enabled
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
825 + (1<<16) // chroma upsampling
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
826 + (0<<17) // 4:2:2 mode
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
827 + (1<<18); // dither enabled
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
828
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
829 regs.besglobctl = 0; // YUY2 format selected
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
830 break;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
831
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
832 case IMGFMT_UYVY:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
833 regs.besctl = 1 // BES enabled
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
834 + (0<<6) // even start polarity
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
835 + (1<<10) // x filtering enabled
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
836 + (1<<11) // y filtering enabled
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
837 + (1<<16) // chroma upsampling
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
838 + (0<<17) // 4:2:2 mode
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
839 + (1<<18); // dither enabled
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
840
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
841 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
842 break;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
843
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
844 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
845
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
846 //Disable contrast and brightness control
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
847 regs.besglobctl |= (1<<5) + (1<<7);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
848 regs.beslumactl = (0x7f << 16) + (0x80<<0);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
849 regs.beslumactl = 0x80<<0;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
850
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
851 //Setup destination window boundaries
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
852 besleft = x > 0 ? x : 0;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
853 bestop = y > 0 ? y : 0;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
854 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
855 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
856
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
857 //Setup source dimensions
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
858 regs.beshsrclst = (sw - 1) << 16;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
859 regs.bespitch = (sw + 31) & ~31 ;
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 //Setup horizontal scaling
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
862 ifactor = ((sw-1)<<14)/(dw-1);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
863 ofsleft = besleft - x;
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 regs.beshiscal = ifactor<<2;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
866 regs.beshsrcst = (ofsleft*ifactor)<<2;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
867 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
868
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
869 //Setup vertical scaling
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
870 ifactor = ((sh-1)<<14)/(dh-1);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
871 ofstop = bestop - y;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
872
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
873 regs.besviscal = ifactor<<2;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
874
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
875 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
876 //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
877 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
878 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
879 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
880 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
881
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
882 if(config->fourcc==IMGFMT_YV12
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
883 ||config->fourcc==IMGFMT_IYUV
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
884 ||config->fourcc==IMGFMT_I420
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
885 ){
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
886 // planar YUV frames:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
887 if (is_g400)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
888 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
889 else
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
890 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
891
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
892 if(config->fourcc==IMGFMT_YV12){
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
893 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
894 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
895 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
896 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
897 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
898 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
899 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
900 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
901 } else {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
902 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
903 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
904 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
905 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
906 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
907 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
908 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
909 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
910 }
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 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
913
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
914 weight = ofstop * (regs.besviscal >> 2);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
915 weights = weight < 0 ? 1 : 0;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
916 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
917 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
918
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
919 #ifdef CRTC2
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
920 // pridat hlavni registry - tj. casovani ...
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
921
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
922
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
923 switch(config->fourcc){
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
924 case IMGFMT_YV12:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
925 case IMGFMT_I420:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
926 case IMGFMT_IYUV:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
927 cregs.c2ctl = 1 // CRTC2 enabled
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
928 + (1<<1) // external clock
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
929 + (0<<2) // external clock
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
930 + (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
931 + (0<<4) // high prioryty req
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
932 + (1<<5) // high prioryty req
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
933 + (0<<6) // high prioryty req
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
934 + (1<<8) // high prioryty req max
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
935 + (0<<9) // high prioryty req max
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
936 + (0<<10) // high prioryty req max
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
937 + (0<<20) // CRTC1 to DAC
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
938 + (1<<21) // 420 mode
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
939 + (1<<22) // 420 mode
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
940 + (1<<23) // 420 mode
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
941 + (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
942 + (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
943 + (0<<26) // field legth polariry
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
944 + (0<<27) // field identification polariry
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
945 + (1<<28) // VIDRST detection mode
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
946 + (0<<29) // VIDRST detection mode
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
947 + (1<<30) // Horizontal counter preload
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
948 + (1<<31) // Vertical counter preload
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
949 ;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
950 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
951 + (1<<1) // Y filter enable
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
952 + (1<<2) // CbCr filter enable
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
953 + (0<<3) // subpicture enable (disabled)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
954 + (0<<4) // NTSC enable (disabled - PAL)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
955 + (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
956 + (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
957 + (0<<7) // 422 subformat selection !
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
958 /* + (0<<8) // 15 bpp high alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
959 + (0<<9) // 15 bpp high alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
960 + (0<<10) // 15 bpp high alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
961 + (0<<11) // 15 bpp high alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
962 + (0<<12) // 15 bpp high alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
963 + (0<<13) // 15 bpp high alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
964 + (0<<14) // 15 bpp high alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
965 + (0<<15) // 15 bpp high alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
966 + (0<<16) // 15 bpp low alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
967 + (0<<17) // 15 bpp low alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
968 + (0<<18) // 15 bpp low alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
969 + (0<<19) // 15 bpp low alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
970 + (0<<20) // 15 bpp low alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
971 + (0<<21) // 15 bpp low alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
972 + (0<<22) // 15 bpp low alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
973 + (0<<23) // 15 bpp low alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
974 + (0<<24) // static subpicture key
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
975 + (0<<25) // static subpicture key
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
976 + (0<<26) // static subpicture key
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
977 + (0<<27) // static subpicture key
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
978 + (0<<28) // static subpicture key
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
979 */ ;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
980 break;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
981
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
982 case IMGFMT_YUY2:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
983 cregs.c2ctl = 1 // CRTC2 enabled
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
984 + (1<<1) // external clock
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
985 + (0<<2) // external clock
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
986 + (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
987 + (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
988 + (1<<5) // high prioryty req
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
989 + (0<<6) // high prioryty req
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
990 // 7 reserved
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
991 + (1<<8) // high prioryty req max
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
992 + (0<<9) // high prioryty req max
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
993 + (0<<10) // high prioryty req max
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
994 // 11-19 reserved
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
995 + (0<<20) // CRTC1 to DAC
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
996 + (1<<21) // 422 mode
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
997 + (0<<22) // 422 mode
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
998 + (1<<23) // 422 mode
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
999 + (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
1000 + (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
1001 + (0<<26) // field legth polariry
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1002 + (0<<27) // field identification polariry
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1003 + (1<<28) // VIDRST detection mode
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1004 + (0<<29) // VIDRST detection mode
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1005 + (1<<30) // Horizontal counter preload
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1006 + (1<<31) // Vertical counter preload
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1007 ;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1008 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
1009 + (1<<1) // Y filter enable
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1010 + (1<<2) // CbCr filter enable
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1011 + (0<<3) // subpicture enable (disabled)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1012 + (0<<4) // NTSC enable (disabled - PAL)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1013 + (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
1014 + (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
1015 + (0<<7) // 422 subformat selection !
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1016 /* + (0<<8) // 15 bpp high alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1017 + (0<<9) // 15 bpp high alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1018 + (0<<10) // 15 bpp high alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1019 + (0<<11) // 15 bpp high alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1020 + (0<<12) // 15 bpp high alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1021 + (0<<13) // 15 bpp high alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1022 + (0<<14) // 15 bpp high alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1023 + (0<<15) // 15 bpp high alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1024 + (0<<16) // 15 bpp low alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1025 + (0<<17) // 15 bpp low alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1026 + (0<<18) // 15 bpp low alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1027 + (0<<19) // 15 bpp low alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1028 + (0<<20) // 15 bpp low alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1029 + (0<<21) // 15 bpp low alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1030 + (0<<22) // 15 bpp low alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1031 + (0<<23) // 15 bpp low alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1032 + (0<<24) // static subpicture key
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1033 + (0<<25) // static subpicture key
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1034 + (0<<26) // static subpicture key
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1035 + (0<<27) // static subpicture key
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1036 + (0<<28) // static subpicture key
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1037 */ ;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1038 break;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1039
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1040 case IMGFMT_UYVY:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1041 cregs.c2ctl = 1 // CRTC2 enabled
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1042 + (1<<1) // external clock
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1043 + (0<<2) // external clock
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1044 + (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
1045 + (0<<4) // high prioryty req
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1046 + (1<<5) // high prioryty req
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1047 + (0<<6) // high prioryty req
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1048 + (1<<8) // high prioryty req max
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1049 + (0<<9) // high prioryty req max
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1050 + (0<<10) // high prioryty req max
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1051 + (0<<20) // CRTC1 to DAC
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1052 + (1<<21) // 422 mode
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1053 + (0<<22) // 422 mode
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1054 + (1<<23) // 422 mode
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1055 + (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
1056 + (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
1057 + (0<<26) // field legth polariry
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1058 + (0<<27) // field identification polariry
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1059 + (1<<28) // VIDRST detection mode
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1060 + (0<<29) // VIDRST detection mode
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1061 + (1<<30) // Horizontal counter preload
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1062 + (1<<31) // Vertical counter preload
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1063 ;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1064 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
1065 + (1<<1) // Y filter enable
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1066 + (1<<2) // CbCr filter enable
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1067 + (0<<3) // subpicture enable (disabled)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1068 + (0<<4) // NTSC enable (disabled - PAL)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1069 + (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
1070 + (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
1071 + (1<<7) // 422 subformat selection !
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1072 /* + (0<<8) // 15 bpp high alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1073 + (0<<9) // 15 bpp high alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1074 + (0<<10) // 15 bpp high alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1075 + (0<<11) // 15 bpp high alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1076 + (0<<12) // 15 bpp high alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1077 + (0<<13) // 15 bpp high alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1078 + (0<<14) // 15 bpp high alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1079 + (0<<15) // 15 bpp high alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1080 + (0<<16) // 15 bpp low alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1081 + (0<<17) // 15 bpp low alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1082 + (0<<18) // 15 bpp low alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1083 + (0<<19) // 15 bpp low alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1084 + (0<<20) // 15 bpp low alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1085 + (0<<21) // 15 bpp low alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1086 + (0<<22) // 15 bpp low alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1087 + (0<<23) // 15 bpp low alpha
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1088 + (0<<24) // static subpicture key
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1089 + (0<<25) // static subpicture key
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1090 + (0<<26) // static subpicture key
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1091 + (0<<27) // static subpicture key
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1092 + (0<<28) // static subpicture key
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1093 */ ;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1094 break;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1095 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1096
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1097 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
1098 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
1099
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1100 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
1101 +(0<<1) // CRTCV2 656 togg f0
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1102 +(0<<2) // CRTCV2 656 togg f0
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1103 +(0<<4) // CRTCV2 656 togg f1
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1104 +(0<<5) // CRTCV2 656 togg f1
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1105 +(0<<6) // CRTCV2 656 togg f1
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1106 +(0<<8) // Hsync active high
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1107 +(0<<9) // Vsync active high
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1108 // 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
1109 ;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1110 cregs.c2offset=(regs.bespitch << 1);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1111
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1112 cregs.c2pl2startadd0=regs.besa1corg;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1113 // cregs.c2pl2startadd1=regs.besa2corg;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1114 cregs.c2pl3startadd0=regs.besa1c3org;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1115 // cregs.c2pl3startadd1=regs.besa2c3org;
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.c2preload=(vsyncstart << 16) | (hsyncstart); // from
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1118
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1119 cregs.c2spicstartadd0=0; // not used
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1120 // cregs.c2spicstartadd1=0; // not used
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1121
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1122 cregs.c2startadd0=regs.besa1org;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1123 // cregs.c2startadd1=regs.besa2org;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1124
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1125 cregs.c2subpiclut=0; //not used
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1126
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1127 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
1128 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
1129 #endif /* CRTC2 */
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1130
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1131 mga_vid_write_regs(0);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1132 return(0);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1133 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1134
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1135 int vixPlaybackOn(void)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1136 {
6648
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
1137 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
1138
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1139 vid_src_ready = 1;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1140 if(vid_overlay_on)
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 regs.besctl |= 1;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1143 mga_vid_write_regs(0);
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 #ifdef MGA_ALLOW_IRQ
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1146 if (mga_irq != -1)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1147 enable_irq();
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1148 #endif
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1149 mga_next_frame=0;
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 return(0);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1152 }
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 int vixPlaybackOff(void)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1155 {
6648
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
1156 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
1157
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1158 vid_src_ready = 0;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1159 #ifdef MGA_ALLOW_IRQ
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1160 if (mga_irq != -1)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1161 disable_irq();
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1162 #endif
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1163 regs.besctl &= ~1;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1164 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
1165 mga_vid_write_regs(0);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1166
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1167 return(0);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1168 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1169
4191
62a6135d090e + new features and possibility
nick
parents: 4163
diff changeset
1170 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
1171 {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1172 pciinfo_t lst[MAX_PCI_DEVICES];
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1173 unsigned int i, num_pci;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1174 int err;
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 (verbose) printf("[mga] probe\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 mga_verbose = verbose;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1179
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1180 is_g400 = -1;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1181
7127
1e47c2e7aa8e mostly compiler warning fixes, some small bugfix
arpi
parents: 6805
diff changeset
1182 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
1183 if (err)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1184 {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1185 printf("[mga] Error occured during pci scan: %s\n", strerror(err));
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1186 return(err);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1187 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1188
6648
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
1189 if (mga_verbose)
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1190 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
1191
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1192 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
1193 {
6648
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
1194 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
1195 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
1196 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
1197 if (lst[i].vendor == VENDOR_MATROX)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1198 {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1199 switch(lst[i].device)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1200 {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1201 case DEVICE_MATROX_MGA_G550_AGP:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1202 printf("[mga] Found MGA G550\n");
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1203 is_g400 = 1;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1204 goto card_found;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1205 case DEVICE_MATROX_MGA_G400_AGP:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1206 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
1207 is_g400 = 1;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1208 goto card_found;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1209 case DEVICE_MATROX_MGA_G200_AGP:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1210 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
1211 is_g400 = 0;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1212 goto card_found;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1213 case DEVICE_MATROX_MGA_G200:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1214 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
1215 is_g400 = 0;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1216 goto card_found;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1217 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1218 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1219 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1220
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1221 if (is_g400 == -1)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1222 {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1223 printf("[mga] No supported cards found\n");
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1224 return(ENXIO);
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
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1227 card_found:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1228 probed = 1;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1229 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
1230
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1231 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
1232
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1233 return(0);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1234 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1235
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1236 int vixInit(void)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1237 {
4279
4301c4adbcf7 reported working at 1600x1200 too, pciconfig stuff fixed, you can enable it with #define MGA_PCICONFIG_MEMDETECT
alex
parents: 4273
diff changeset
1238 unsigned int card_option = 0;
4482
9c6ab57cfdde using MTRR
nick
parents: 4326
diff changeset
1239 int err;
6648
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
1240
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
1241 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
1242
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1243 mga_vid_in_use = 0;
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 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
1246 #ifdef CRCT2
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
1247 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
1248 #endif
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1249
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1250 if (!probed)
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 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
1253 return(EINTR);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1254 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1255
4279
4301c4adbcf7 reported working at 1600x1200 too, pciconfig stuff fixed, you can enable it with #define MGA_PCICONFIG_MEMDETECT
alex
parents: 4273
diff changeset
1256 #ifdef MGA_PCICONFIG_MEMDETECT
4272
68a40de07167 cleaned some parts, tested and working with g400/450, g200 is buggy :(
alex
parents: 4250
diff changeset
1257 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
1258 0x40, 4, &card_option);
6648
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
1259 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
1260 (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
1261 #endif
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1262
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1263 if (mga_ram_size)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1264 {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1265 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
1266 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1267 else
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1268 {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1269 #ifdef MGA_MEMORY_SIZE
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1270 mga_ram_size = MGA_MEMORY_SIZE;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1271 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
1272 #else
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1273 if (is_g400)
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 switch((card_option>>10)&0x17)
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 // SDRAM:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1278 case 0x00:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1279 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
1280 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
1281 // SGRAM:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1282 case 0x10:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1283 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
1284 case 0x11:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1285 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
1286 default:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1287 mga_ram_size = 16;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1288 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
1289 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1290 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1291 else
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1292 {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1293 switch((card_option>>10)&0x17)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1294 {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1295 // case 0x10:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1296 // 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
1297 default: mga_ram_size = 8;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1298 }
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
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1301 #if 0
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1302 // printf("List resources -----------\n");
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1303 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
1304 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
1305 if(res->flags){
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1306 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
1307 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
1308 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
1309 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
1310 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1311 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1312 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1313 #endif
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 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
1316 #endif
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
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1319 if (mga_ram_size)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1320 {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1321 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
1322 {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1323 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
1324 return(EINVAL);
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 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1327
8123
9fc45fe0d444 *HUGE* set of compiler warning fixes, unused variables removal
arpi
parents: 7127
diff changeset
1328 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
1329 pci_info.base1, pci_info.base0);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1330
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1331 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
1332 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
1333
6648
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
1334 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
1335 mga_mmio_base, mga_irq, mga_mem_base);
4482
9c6ab57cfdde using MTRR
nick
parents: 4326
diff changeset
1336 err = mtrr_set_type(pci_info.base0,mga_ram_size*1024*1024,MTRR_TYPE_WRCOMB);
9c6ab57cfdde using MTRR
nick
parents: 4326
diff changeset
1337 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
1338 #ifdef MGA_ALLOW_IRQ
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1339 if (mga_irq != -1)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1340 {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1341 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
1342 if (tmp)
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 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
1345 mga_irq=-1;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1346 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1347 else
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1348 {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1349 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
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 else
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1353 {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1354 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
1355 mga_irq=-1;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1356 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1357 #else
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1358 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
1359 mga_irq=-1;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1360 #endif
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1361
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1362 return(0);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1363 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1364
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1365 void vixDestroy(void)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1366 {
6648
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
1367 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
1368
6648
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
1369 /* FIXME turn off BES */
4272
68a40de07167 cleaned some parts, tested and working with g400/450, g200 is buggy :(
alex
parents: 4250
diff changeset
1370 vid_src_ready = 0;
68a40de07167 cleaned some parts, tested and working with g400/450, g200 is buggy :(
alex
parents: 4250
diff changeset
1371 regs.besctl &= ~1;
68a40de07167 cleaned some parts, tested and working with g400/450, g200 is buggy :(
alex
parents: 4250
diff changeset
1372 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
1373 // mga_config.colkey_on=0; //!!!
68a40de07167 cleaned some parts, tested and working with g400/450, g200 is buggy :(
alex
parents: 4250
diff changeset
1374 mga_vid_write_regs(1);
68a40de07167 cleaned some parts, tested and working with g400/450, g200 is buggy :(
alex
parents: 4250
diff changeset
1375 mga_vid_in_use = 0;
68a40de07167 cleaned some parts, tested and working with g400/450, g200 is buggy :(
alex
parents: 4250
diff changeset
1376
4139
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1377 #ifdef MGA_ALLOW_IRQ
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1378 if (mga_irq != -1)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1379 free_irq(mga_irq, &mga_irq);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1380 #endif
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 if (mga_mmio_base)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1383 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
1384 if (mga_mem_base)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1385 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
1386 return;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1387 }
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 int vixQueryFourcc(vidix_fourcc_t *to)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1390 {
6648
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
1391 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
1392
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1393 switch(to->fourcc)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1394 {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1395 case IMGFMT_YV12:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1396 case IMGFMT_IYUV:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1397 case IMGFMT_I420:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1398 case IMGFMT_YUY2:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1399 case IMGFMT_UYVY:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1400 break;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1401 default:
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1402 to->depth = to->flags = 0;
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1403 return(ENOTSUP);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1404 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1405
4239
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
1406 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
1407 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
1408 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
1409 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
1410 return(0);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1411 }
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 unsigned int vixGetVersion(void)
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1414 {
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1415 return(VIDIX_VERSION);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1416 }
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 int vixGetCapability(vidix_capability_t *to)
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 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
1421 return(0);
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1422 }
13d6395e8daa added mga_vid (also playback->offset is not set (fixing it on monday)
alex
parents:
diff changeset
1423
4239
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
1424 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
1425 {
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
1426 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
1427 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
1428 }
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
1429
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
1430 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
1431 {
acadddf56508 updated, colorkey support, pontscho reported it's working fine, only faulting with very-very-very big resolution
alex
parents: 4238
diff changeset
1432 memcpy(&mga_grkey, 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
1433 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
1434 }
4250
49746d2bfda7 gamma correction (preliminary version).
nick
parents: 4239
diff changeset
1435
6600
1f0acc9106a8 equalizer (brightness/contrast) support
alex
parents: 4482
diff changeset
1436 int vixPlaybackSetEq( const vidix_video_eq_t * eq)
4318
693e4cfd2b84 intense -> intensity + capability extension
nick
parents: 4279
diff changeset
1437 {
6600
1f0acc9106a8 equalizer (brightness/contrast) support
alex
parents: 4482
diff changeset
1438 /* 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
1439 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
1440 {
6648
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
1441 if (mga_verbose) printf("[mga] equalizer isn't supported with G200\n");
6600
1f0acc9106a8 equalizer (brightness/contrast) support
alex
parents: 4482
diff changeset
1442 return(ENOTSUP);
1f0acc9106a8 equalizer (brightness/contrast) support
alex
parents: 4482
diff changeset
1443 }
6755
a31b9f15cbff - fix audio equalizer
pontscho
parents: 6648
diff changeset
1444
6805
963f266ce7cc vide EQ fixed - lumactl register is not readable!
arpi
parents: 6755
diff changeset
1445 // only brightness&contrast are supported:
963f266ce7cc vide EQ fixed - lumactl register is not readable!
arpi
parents: 6755
diff changeset
1446 if(!(eq->cap & (VEQ_CAP_BRIGHTNESS|VEQ_CAP_CONTRAST)))
963f266ce7cc vide EQ fixed - lumactl register is not readable!
arpi
parents: 6755
diff changeset
1447 return(ENOTSUP);
963f266ce7cc vide EQ fixed - lumactl register is not readable!
arpi
parents: 6755
diff changeset
1448
963f266ce7cc vide EQ fixed - lumactl register is not readable!
arpi
parents: 6755
diff changeset
1449 //regs.beslumactl = readl(mga_mmio_base + BESLUMACTL);
963f266ce7cc vide EQ fixed - lumactl register is not readable!
arpi
parents: 6755
diff changeset
1450 // printf("LUMA = %08X \n",regs.beslumactl);
963f266ce7cc vide EQ fixed - lumactl register is not readable!
arpi
parents: 6755
diff changeset
1451 if (eq->cap & VEQ_CAP_BRIGHTNESS) {
963f266ce7cc vide EQ fixed - lumactl register is not readable!
arpi
parents: 6755
diff changeset
1452 regs.beslumactl &= 0xFFFF;
963f266ce7cc vide EQ fixed - lumactl register is not readable!
arpi
parents: 6755
diff changeset
1453 regs.beslumactl |= (eq->brightness*255/2000)<<16;
963f266ce7cc vide EQ fixed - lumactl register is not readable!
arpi
parents: 6755
diff changeset
1454 }
963f266ce7cc vide EQ fixed - lumactl register is not readable!
arpi
parents: 6755
diff changeset
1455 if (eq->cap & VEQ_CAP_CONTRAST) {
963f266ce7cc vide EQ fixed - lumactl register is not readable!
arpi
parents: 6755
diff changeset
1456 regs.beslumactl &= 0xFFFF0000;
963f266ce7cc vide EQ fixed - lumactl register is not readable!
arpi
parents: 6755
diff changeset
1457 regs.beslumactl |= (128+eq->contrast*255/2000)&0xFFFF;
963f266ce7cc vide EQ fixed - lumactl register is not readable!
arpi
parents: 6755
diff changeset
1458 }
963f266ce7cc vide EQ fixed - lumactl register is not readable!
arpi
parents: 6755
diff changeset
1459 writel(regs.beslumactl,mga_mmio_base + BESLUMACTL);
6755
a31b9f15cbff - fix audio equalizer
pontscho
parents: 6648
diff changeset
1460
6600
1f0acc9106a8 equalizer (brightness/contrast) support
alex
parents: 4482
diff changeset
1461 return(0);
1f0acc9106a8 equalizer (brightness/contrast) support
alex
parents: 4482
diff changeset
1462 }
1f0acc9106a8 equalizer (brightness/contrast) support
alex
parents: 4482
diff changeset
1463
1f0acc9106a8 equalizer (brightness/contrast) support
alex
parents: 4482
diff changeset
1464 int vixPlaybackGetEq( vidix_video_eq_t * eq)
1f0acc9106a8 equalizer (brightness/contrast) support
alex
parents: 4482
diff changeset
1465 {
1f0acc9106a8 equalizer (brightness/contrast) support
alex
parents: 4482
diff changeset
1466 /* contrast and brightness control isn't supported on G200 - alex */
1f0acc9106a8 equalizer (brightness/contrast) support
alex
parents: 4482
diff changeset
1467 if (!is_g400)
1f0acc9106a8 equalizer (brightness/contrast) support
alex
parents: 4482
diff changeset
1468 {
6648
55e3129208fc fixed doublebuffering and moved messages to various verbose level
alex
parents: 6600
diff changeset
1469 if (mga_verbose) printf("[mga] equalizer isn't supported with G200\n");
6600
1f0acc9106a8 equalizer (brightness/contrast) support
alex
parents: 4482
diff changeset
1470 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
1471 }
870cec859f92 upgraded to newest vidix interface. in eq: return if g200 moved to the beginning of seteq
alex
parents: 4318
diff changeset
1472
6805
963f266ce7cc vide EQ fixed - lumactl register is not readable!
arpi
parents: 6755
diff changeset
1473 // 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
1474
6805
963f266ce7cc vide EQ fixed - lumactl register is not readable!
arpi
parents: 6755
diff changeset
1475 eq->brightness = (signed short int)(regs.beslumactl >> 16) * 1000 / 128;
963f266ce7cc vide EQ fixed - lumactl register is not readable!
arpi
parents: 6755
diff changeset
1476 eq->contrast = (signed short int)(regs.beslumactl & 0xFFFF) * 1000 / 128 - 1000;
6600
1f0acc9106a8 equalizer (brightness/contrast) support
alex
parents: 4482
diff changeset
1477 eq->cap = VEQ_CAP_BRIGHTNESS | VEQ_CAP_CONTRAST;
6805
963f266ce7cc vide EQ fixed - lumactl register is not readable!
arpi
parents: 6755
diff changeset
1478
963f266ce7cc vide EQ fixed - lumactl register is not readable!
arpi
parents: 6755
diff changeset
1479 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
1480
6600
1f0acc9106a8 equalizer (brightness/contrast) support
alex
parents: 4482
diff changeset
1481 return(0);
4250
49746d2bfda7 gamma correction (preliminary version).
nick
parents: 4239
diff changeset
1482 }