annotate vidix/drivers/mga_vid.c @ 5514:127f2a84e933

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