annotate vidix/drivers/radeon_vid.c @ 22351:1f40a27bd2ad

100000l: average != semidistance, fixed seeking to the middle position; patch by Zuxy meng (zuxy.megn gmail com)
author nicodvb
date Tue, 27 Feb 2007 20:15:31 +0000
parents f4c52a9738c1
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1 /*
872781fef1b3 preliminary version
nick
parents:
diff changeset
2 radeon_vid - VIDIX based video driver for Radeon and Rage128 chips
4030
922241968c63 Embedding vidix
nick
parents: 4015
diff changeset
3 Copyrights 2002 Nick Kurshev. This file is based on sources from
922241968c63 Embedding vidix
nick
parents: 4015
diff changeset
4 GATOS (gatos.sf.net) and X11 (www.xfree86.org)
922241968c63 Embedding vidix
nick
parents: 4015
diff changeset
5 Licence: GPL
12286
b52e831261b1 support for ATI fireglx
alex
parents: 12072
diff changeset
6
b52e831261b1 support for ATI fireglx
alex
parents: 12072
diff changeset
7 31.12.2002 added support for fglrx drivers by Marcel Naziri (zwobbl@zwobbl.de)
b52e831261b1 support for ATI fireglx
alex
parents: 12072
diff changeset
8 6.04.2004 fixes to allow compiling vidix without X11 (broken in original patch)
8564
e1329263197b fixed a 10l, some cosmetics, and initial ppc (bigendian) support
alex
parents: 8562
diff changeset
9 PPC support by Alex Beregszaszi
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
10 */
872781fef1b3 preliminary version
nick
parents:
diff changeset
11
872781fef1b3 preliminary version
nick
parents:
diff changeset
12 #include <errno.h>
872781fef1b3 preliminary version
nick
parents:
diff changeset
13 #include <stdio.h>
872781fef1b3 preliminary version
nick
parents:
diff changeset
14 #include <stdlib.h>
872781fef1b3 preliminary version
nick
parents:
diff changeset
15 #include <string.h>
872781fef1b3 preliminary version
nick
parents:
diff changeset
16 #include <math.h>
4003
92c59012249d stdint.h replaced by inttypes.h (used more frequently in the sources)
pl
parents: 3996
diff changeset
17 #include <inttypes.h>
8564
e1329263197b fixed a 10l, some cosmetics, and initial ppc (bigendian) support
alex
parents: 8562
diff changeset
18
e1329263197b fixed a 10l, some cosmetics, and initial ppc (bigendian) support
alex
parents: 8562
diff changeset
19 #include "../../config.h"
21372
1767c271d710 Remove bswap.h, use libavutil/bswap.h instead.
diego
parents: 19953
diff changeset
20 #include "../../libavutil/common.h"
21507
fa99b3d31d13 Hack around libavutil/bswap.h compilation problems due to always_inline undefined.
reimar
parents: 21372
diff changeset
21 #include "../../mpbswap.h"
4201
0918fb422b10 fix include order
atmos4
parents: 4193
diff changeset
22 #include "../../libdha/pci_ids.h"
0918fb422b10 fix include order
atmos4
parents: 4193
diff changeset
23 #include "../../libdha/pci_names.h"
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
24 #include "../vidix.h"
872781fef1b3 preliminary version
nick
parents:
diff changeset
25 #include "../fourcc.h"
872781fef1b3 preliminary version
nick
parents:
diff changeset
26 #include "../../libdha/libdha.h"
872781fef1b3 preliminary version
nick
parents:
diff changeset
27 #include "radeon.h"
872781fef1b3 preliminary version
nick
parents:
diff changeset
28
12286
b52e831261b1 support for ATI fireglx
alex
parents: 12072
diff changeset
29 #ifdef HAVE_X11
b52e831261b1 support for ATI fireglx
alex
parents: 12072
diff changeset
30 #include <X11/Xlib.h>
b52e831261b1 support for ATI fireglx
alex
parents: 12072
diff changeset
31 #endif
b52e831261b1 support for ATI fireglx
alex
parents: 12072
diff changeset
32
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
33 #ifdef RAGE128
8564
e1329263197b fixed a 10l, some cosmetics, and initial ppc (bigendian) support
alex
parents: 8562
diff changeset
34 #define RADEON_MSG "[rage128]"
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
35 #define X_ADJUST 0
872781fef1b3 preliminary version
nick
parents:
diff changeset
36 #else
8564
e1329263197b fixed a 10l, some cosmetics, and initial ppc (bigendian) support
alex
parents: 8562
diff changeset
37 #define RADEON_MSG "[radeon]"
8521
8996a4599a41 the long awaited pink screen + shift fix for radeon, based on patch by Svante Signell <svante.signell@telia.com>, Carl (mlist.mplayer.users@urs.us) and Nick Kurshve <nickolsk@yandex.ru>
alex
parents: 8238
diff changeset
38 #define X_ADJUST (is_shift_required ? 8 : 0)
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
39 #ifndef RADEON
872781fef1b3 preliminary version
nick
parents:
diff changeset
40 #define RADEON
872781fef1b3 preliminary version
nick
parents:
diff changeset
41 #endif
872781fef1b3 preliminary version
nick
parents:
diff changeset
42 #endif
872781fef1b3 preliminary version
nick
parents:
diff changeset
43
4030
922241968c63 Embedding vidix
nick
parents: 4015
diff changeset
44 static int __verbose = 0;
8521
8996a4599a41 the long awaited pink screen + shift fix for radeon, based on patch by Svante Signell <svante.signell@telia.com>, Carl (mlist.mplayer.users@urs.us) and Nick Kurshve <nickolsk@yandex.ru>
alex
parents: 8238
diff changeset
45 #ifdef RADEON
8564
e1329263197b fixed a 10l, some cosmetics, and initial ppc (bigendian) support
alex
parents: 8562
diff changeset
46 static int is_shift_required = 0;
8521
8996a4599a41 the long awaited pink screen + shift fix for radeon, based on patch by Svante Signell <svante.signell@telia.com>, Carl (mlist.mplayer.users@urs.us) and Nick Kurshve <nickolsk@yandex.ru>
alex
parents: 8238
diff changeset
47 #endif
4015
7a9c22d1d984 works!!!
nick
parents: 4012
diff changeset
48
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
49 typedef struct bes_registers_s
872781fef1b3 preliminary version
nick
parents:
diff changeset
50 {
872781fef1b3 preliminary version
nick
parents:
diff changeset
51 /* base address of yuv framebuffer */
872781fef1b3 preliminary version
nick
parents:
diff changeset
52 uint32_t yuv_base;
872781fef1b3 preliminary version
nick
parents:
diff changeset
53 uint32_t fourcc;
872781fef1b3 preliminary version
nick
parents:
diff changeset
54 uint32_t dest_bpp;
872781fef1b3 preliminary version
nick
parents:
diff changeset
55 /* YUV BES registers */
872781fef1b3 preliminary version
nick
parents:
diff changeset
56 uint32_t reg_load_cntl;
872781fef1b3 preliminary version
nick
parents:
diff changeset
57 uint32_t h_inc;
872781fef1b3 preliminary version
nick
parents:
diff changeset
58 uint32_t step_by;
872781fef1b3 preliminary version
nick
parents:
diff changeset
59 uint32_t y_x_start;
872781fef1b3 preliminary version
nick
parents:
diff changeset
60 uint32_t y_x_end;
872781fef1b3 preliminary version
nick
parents:
diff changeset
61 uint32_t v_inc;
872781fef1b3 preliminary version
nick
parents:
diff changeset
62 uint32_t p1_blank_lines_at_top;
872781fef1b3 preliminary version
nick
parents:
diff changeset
63 uint32_t p23_blank_lines_at_top;
872781fef1b3 preliminary version
nick
parents:
diff changeset
64 uint32_t vid_buf_pitch0_value;
872781fef1b3 preliminary version
nick
parents:
diff changeset
65 uint32_t vid_buf_pitch1_value;
872781fef1b3 preliminary version
nick
parents:
diff changeset
66 uint32_t p1_x_start_end;
872781fef1b3 preliminary version
nick
parents:
diff changeset
67 uint32_t p2_x_start_end;
872781fef1b3 preliminary version
nick
parents:
diff changeset
68 uint32_t p3_x_start_end;
872781fef1b3 preliminary version
nick
parents:
diff changeset
69 uint32_t base_addr;
4930
a71ef1642a8a Multi-buffering
nick
parents: 4873
diff changeset
70 uint32_t vid_buf_base_adrs_y[VID_PLAY_MAXFRAMES];
a71ef1642a8a Multi-buffering
nick
parents: 4873
diff changeset
71 uint32_t vid_buf_base_adrs_u[VID_PLAY_MAXFRAMES];
a71ef1642a8a Multi-buffering
nick
parents: 4873
diff changeset
72 uint32_t vid_buf_base_adrs_v[VID_PLAY_MAXFRAMES];
a71ef1642a8a Multi-buffering
nick
parents: 4873
diff changeset
73 uint32_t vid_nbufs;
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
74
872781fef1b3 preliminary version
nick
parents:
diff changeset
75 uint32_t p1_v_accum_init;
872781fef1b3 preliminary version
nick
parents:
diff changeset
76 uint32_t p1_h_accum_init;
872781fef1b3 preliminary version
nick
parents:
diff changeset
77 uint32_t p23_v_accum_init;
872781fef1b3 preliminary version
nick
parents:
diff changeset
78 uint32_t p23_h_accum_init;
872781fef1b3 preliminary version
nick
parents:
diff changeset
79 uint32_t scale_cntl;
872781fef1b3 preliminary version
nick
parents:
diff changeset
80 uint32_t exclusive_horz;
872781fef1b3 preliminary version
nick
parents:
diff changeset
81 uint32_t auto_flip_cntl;
872781fef1b3 preliminary version
nick
parents:
diff changeset
82 uint32_t filter_cntl;
872781fef1b3 preliminary version
nick
parents:
diff changeset
83 uint32_t key_cntl;
872781fef1b3 preliminary version
nick
parents:
diff changeset
84 uint32_t test;
872781fef1b3 preliminary version
nick
parents:
diff changeset
85 /* Configurable stuff */
872781fef1b3 preliminary version
nick
parents:
diff changeset
86 int double_buff;
872781fef1b3 preliminary version
nick
parents:
diff changeset
87
872781fef1b3 preliminary version
nick
parents:
diff changeset
88 int brightness;
872781fef1b3 preliminary version
nick
parents:
diff changeset
89 int saturation;
872781fef1b3 preliminary version
nick
parents:
diff changeset
90
872781fef1b3 preliminary version
nick
parents:
diff changeset
91 int ckey_on;
872781fef1b3 preliminary version
nick
parents:
diff changeset
92 uint32_t graphics_key_clr;
872781fef1b3 preliminary version
nick
parents:
diff changeset
93 uint32_t graphics_key_msk;
4869
15af74a11ce9 color key support
nick
parents: 4855
diff changeset
94 uint32_t ckey_cntl;
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
95
872781fef1b3 preliminary version
nick
parents:
diff changeset
96 int deinterlace_on;
872781fef1b3 preliminary version
nick
parents:
diff changeset
97 uint32_t deinterlace_pattern;
872781fef1b3 preliminary version
nick
parents:
diff changeset
98
872781fef1b3 preliminary version
nick
parents:
diff changeset
99 } bes_registers_t;
872781fef1b3 preliminary version
nick
parents:
diff changeset
100
872781fef1b3 preliminary version
nick
parents:
diff changeset
101 typedef struct video_registers_s
872781fef1b3 preliminary version
nick
parents:
diff changeset
102 {
872781fef1b3 preliminary version
nick
parents:
diff changeset
103 const char * sname;
872781fef1b3 preliminary version
nick
parents:
diff changeset
104 uint32_t name;
872781fef1b3 preliminary version
nick
parents:
diff changeset
105 uint32_t value;
872781fef1b3 preliminary version
nick
parents:
diff changeset
106 }video_registers_t;
872781fef1b3 preliminary version
nick
parents:
diff changeset
107
872781fef1b3 preliminary version
nick
parents:
diff changeset
108 static bes_registers_t besr;
872781fef1b3 preliminary version
nick
parents:
diff changeset
109 #ifndef RAGE128
8855
6787d02e45aa Update card (chip family) detection (from mplayerxp)
arpi
parents: 8854
diff changeset
110 static int RadeonFamily=100;
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
111 #endif
872781fef1b3 preliminary version
nick
parents:
diff changeset
112 #define DECLARE_VREG(name) { #name, name, 0 }
872781fef1b3 preliminary version
nick
parents:
diff changeset
113 static video_registers_t vregs[] =
872781fef1b3 preliminary version
nick
parents:
diff changeset
114 {
872781fef1b3 preliminary version
nick
parents:
diff changeset
115 DECLARE_VREG(VIDEOMUX_CNTL),
872781fef1b3 preliminary version
nick
parents:
diff changeset
116 DECLARE_VREG(VIPPAD_MASK),
872781fef1b3 preliminary version
nick
parents:
diff changeset
117 DECLARE_VREG(VIPPAD1_A),
872781fef1b3 preliminary version
nick
parents:
diff changeset
118 DECLARE_VREG(VIPPAD1_EN),
872781fef1b3 preliminary version
nick
parents:
diff changeset
119 DECLARE_VREG(VIPPAD1_Y),
872781fef1b3 preliminary version
nick
parents:
diff changeset
120 DECLARE_VREG(OV0_Y_X_START),
872781fef1b3 preliminary version
nick
parents:
diff changeset
121 DECLARE_VREG(OV0_Y_X_END),
872781fef1b3 preliminary version
nick
parents:
diff changeset
122 DECLARE_VREG(OV0_PIPELINE_CNTL),
872781fef1b3 preliminary version
nick
parents:
diff changeset
123 DECLARE_VREG(OV0_EXCLUSIVE_HORZ),
872781fef1b3 preliminary version
nick
parents:
diff changeset
124 DECLARE_VREG(OV0_EXCLUSIVE_VERT),
872781fef1b3 preliminary version
nick
parents:
diff changeset
125 DECLARE_VREG(OV0_REG_LOAD_CNTL),
872781fef1b3 preliminary version
nick
parents:
diff changeset
126 DECLARE_VREG(OV0_SCALE_CNTL),
872781fef1b3 preliminary version
nick
parents:
diff changeset
127 DECLARE_VREG(OV0_V_INC),
872781fef1b3 preliminary version
nick
parents:
diff changeset
128 DECLARE_VREG(OV0_P1_V_ACCUM_INIT),
872781fef1b3 preliminary version
nick
parents:
diff changeset
129 DECLARE_VREG(OV0_P23_V_ACCUM_INIT),
872781fef1b3 preliminary version
nick
parents:
diff changeset
130 DECLARE_VREG(OV0_P1_BLANK_LINES_AT_TOP),
872781fef1b3 preliminary version
nick
parents:
diff changeset
131 DECLARE_VREG(OV0_P23_BLANK_LINES_AT_TOP),
872781fef1b3 preliminary version
nick
parents:
diff changeset
132 #ifdef RADEON
872781fef1b3 preliminary version
nick
parents:
diff changeset
133 DECLARE_VREG(OV0_BASE_ADDR),
872781fef1b3 preliminary version
nick
parents:
diff changeset
134 #endif
872781fef1b3 preliminary version
nick
parents:
diff changeset
135 DECLARE_VREG(OV0_VID_BUF0_BASE_ADRS),
872781fef1b3 preliminary version
nick
parents:
diff changeset
136 DECLARE_VREG(OV0_VID_BUF1_BASE_ADRS),
872781fef1b3 preliminary version
nick
parents:
diff changeset
137 DECLARE_VREG(OV0_VID_BUF2_BASE_ADRS),
872781fef1b3 preliminary version
nick
parents:
diff changeset
138 DECLARE_VREG(OV0_VID_BUF3_BASE_ADRS),
872781fef1b3 preliminary version
nick
parents:
diff changeset
139 DECLARE_VREG(OV0_VID_BUF4_BASE_ADRS),
872781fef1b3 preliminary version
nick
parents:
diff changeset
140 DECLARE_VREG(OV0_VID_BUF5_BASE_ADRS),
872781fef1b3 preliminary version
nick
parents:
diff changeset
141 DECLARE_VREG(OV0_VID_BUF_PITCH0_VALUE),
872781fef1b3 preliminary version
nick
parents:
diff changeset
142 DECLARE_VREG(OV0_VID_BUF_PITCH1_VALUE),
872781fef1b3 preliminary version
nick
parents:
diff changeset
143 DECLARE_VREG(OV0_AUTO_FLIP_CNTL),
872781fef1b3 preliminary version
nick
parents:
diff changeset
144 DECLARE_VREG(OV0_DEINTERLACE_PATTERN),
872781fef1b3 preliminary version
nick
parents:
diff changeset
145 DECLARE_VREG(OV0_SUBMIT_HISTORY),
872781fef1b3 preliminary version
nick
parents:
diff changeset
146 DECLARE_VREG(OV0_H_INC),
872781fef1b3 preliminary version
nick
parents:
diff changeset
147 DECLARE_VREG(OV0_STEP_BY),
872781fef1b3 preliminary version
nick
parents:
diff changeset
148 DECLARE_VREG(OV0_P1_H_ACCUM_INIT),
872781fef1b3 preliminary version
nick
parents:
diff changeset
149 DECLARE_VREG(OV0_P23_H_ACCUM_INIT),
872781fef1b3 preliminary version
nick
parents:
diff changeset
150 DECLARE_VREG(OV0_P1_X_START_END),
872781fef1b3 preliminary version
nick
parents:
diff changeset
151 DECLARE_VREG(OV0_P2_X_START_END),
872781fef1b3 preliminary version
nick
parents:
diff changeset
152 DECLARE_VREG(OV0_P3_X_START_END),
872781fef1b3 preliminary version
nick
parents:
diff changeset
153 DECLARE_VREG(OV0_FILTER_CNTL),
872781fef1b3 preliminary version
nick
parents:
diff changeset
154 DECLARE_VREG(OV0_FOUR_TAP_COEF_0),
872781fef1b3 preliminary version
nick
parents:
diff changeset
155 DECLARE_VREG(OV0_FOUR_TAP_COEF_1),
872781fef1b3 preliminary version
nick
parents:
diff changeset
156 DECLARE_VREG(OV0_FOUR_TAP_COEF_2),
872781fef1b3 preliminary version
nick
parents:
diff changeset
157 DECLARE_VREG(OV0_FOUR_TAP_COEF_3),
872781fef1b3 preliminary version
nick
parents:
diff changeset
158 DECLARE_VREG(OV0_FOUR_TAP_COEF_4),
872781fef1b3 preliminary version
nick
parents:
diff changeset
159 DECLARE_VREG(OV0_FLAG_CNTL),
872781fef1b3 preliminary version
nick
parents:
diff changeset
160 #ifdef RAGE128
872781fef1b3 preliminary version
nick
parents:
diff changeset
161 DECLARE_VREG(OV0_COLOUR_CNTL),
872781fef1b3 preliminary version
nick
parents:
diff changeset
162 #else
872781fef1b3 preliminary version
nick
parents:
diff changeset
163 DECLARE_VREG(OV0_SLICE_CNTL),
872781fef1b3 preliminary version
nick
parents:
diff changeset
164 #endif
872781fef1b3 preliminary version
nick
parents:
diff changeset
165 DECLARE_VREG(OV0_VID_KEY_CLR),
872781fef1b3 preliminary version
nick
parents:
diff changeset
166 DECLARE_VREG(OV0_VID_KEY_MSK),
872781fef1b3 preliminary version
nick
parents:
diff changeset
167 DECLARE_VREG(OV0_GRAPHICS_KEY_CLR),
872781fef1b3 preliminary version
nick
parents:
diff changeset
168 DECLARE_VREG(OV0_GRAPHICS_KEY_MSK),
872781fef1b3 preliminary version
nick
parents:
diff changeset
169 DECLARE_VREG(OV0_KEY_CNTL),
872781fef1b3 preliminary version
nick
parents:
diff changeset
170 DECLARE_VREG(OV0_TEST),
872781fef1b3 preliminary version
nick
parents:
diff changeset
171 DECLARE_VREG(OV0_LIN_TRANS_A),
872781fef1b3 preliminary version
nick
parents:
diff changeset
172 DECLARE_VREG(OV0_LIN_TRANS_B),
872781fef1b3 preliminary version
nick
parents:
diff changeset
173 DECLARE_VREG(OV0_LIN_TRANS_C),
872781fef1b3 preliminary version
nick
parents:
diff changeset
174 DECLARE_VREG(OV0_LIN_TRANS_D),
872781fef1b3 preliminary version
nick
parents:
diff changeset
175 DECLARE_VREG(OV0_LIN_TRANS_E),
872781fef1b3 preliminary version
nick
parents:
diff changeset
176 DECLARE_VREG(OV0_LIN_TRANS_F),
872781fef1b3 preliminary version
nick
parents:
diff changeset
177 DECLARE_VREG(OV0_GAMMA_0_F),
872781fef1b3 preliminary version
nick
parents:
diff changeset
178 DECLARE_VREG(OV0_GAMMA_10_1F),
872781fef1b3 preliminary version
nick
parents:
diff changeset
179 DECLARE_VREG(OV0_GAMMA_20_3F),
872781fef1b3 preliminary version
nick
parents:
diff changeset
180 DECLARE_VREG(OV0_GAMMA_40_7F),
872781fef1b3 preliminary version
nick
parents:
diff changeset
181 DECLARE_VREG(OV0_GAMMA_380_3BF),
872781fef1b3 preliminary version
nick
parents:
diff changeset
182 DECLARE_VREG(OV0_GAMMA_3C0_3FF),
872781fef1b3 preliminary version
nick
parents:
diff changeset
183 DECLARE_VREG(SUBPIC_CNTL),
872781fef1b3 preliminary version
nick
parents:
diff changeset
184 DECLARE_VREG(SUBPIC_DEFCOLCON),
872781fef1b3 preliminary version
nick
parents:
diff changeset
185 DECLARE_VREG(SUBPIC_Y_X_START),
872781fef1b3 preliminary version
nick
parents:
diff changeset
186 DECLARE_VREG(SUBPIC_Y_X_END),
872781fef1b3 preliminary version
nick
parents:
diff changeset
187 DECLARE_VREG(SUBPIC_V_INC),
872781fef1b3 preliminary version
nick
parents:
diff changeset
188 DECLARE_VREG(SUBPIC_H_INC),
872781fef1b3 preliminary version
nick
parents:
diff changeset
189 DECLARE_VREG(SUBPIC_BUF0_OFFSET),
872781fef1b3 preliminary version
nick
parents:
diff changeset
190 DECLARE_VREG(SUBPIC_BUF1_OFFSET),
872781fef1b3 preliminary version
nick
parents:
diff changeset
191 DECLARE_VREG(SUBPIC_LC0_OFFSET),
872781fef1b3 preliminary version
nick
parents:
diff changeset
192 DECLARE_VREG(SUBPIC_LC1_OFFSET),
872781fef1b3 preliminary version
nick
parents:
diff changeset
193 DECLARE_VREG(SUBPIC_PITCH),
872781fef1b3 preliminary version
nick
parents:
diff changeset
194 DECLARE_VREG(SUBPIC_BTN_HLI_COLCON),
872781fef1b3 preliminary version
nick
parents:
diff changeset
195 DECLARE_VREG(SUBPIC_BTN_HLI_Y_X_START),
872781fef1b3 preliminary version
nick
parents:
diff changeset
196 DECLARE_VREG(SUBPIC_BTN_HLI_Y_X_END),
872781fef1b3 preliminary version
nick
parents:
diff changeset
197 DECLARE_VREG(SUBPIC_PALETTE_INDEX),
872781fef1b3 preliminary version
nick
parents:
diff changeset
198 DECLARE_VREG(SUBPIC_PALETTE_DATA),
872781fef1b3 preliminary version
nick
parents:
diff changeset
199 DECLARE_VREG(SUBPIC_H_ACCUM_INIT),
872781fef1b3 preliminary version
nick
parents:
diff changeset
200 DECLARE_VREG(SUBPIC_V_ACCUM_INIT),
872781fef1b3 preliminary version
nick
parents:
diff changeset
201 DECLARE_VREG(IDCT_RUNS),
872781fef1b3 preliminary version
nick
parents:
diff changeset
202 DECLARE_VREG(IDCT_LEVELS),
872781fef1b3 preliminary version
nick
parents:
diff changeset
203 DECLARE_VREG(IDCT_AUTH_CONTROL),
872781fef1b3 preliminary version
nick
parents:
diff changeset
204 DECLARE_VREG(IDCT_AUTH),
9044
59b1bd7ccae1 hack to get rage128 working on ppc-g3
alex
parents: 8942
diff changeset
205 DECLARE_VREG(IDCT_CONTROL),
59b1bd7ccae1 hack to get rage128 working on ppc-g3
alex
parents: 8942
diff changeset
206 DECLARE_VREG(CONFIG_CNTL)
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
207 };
4030
922241968c63 Embedding vidix
nick
parents: 4015
diff changeset
208
12286
b52e831261b1 support for ATI fireglx
alex
parents: 12072
diff changeset
209 #ifdef HAVE_X11
b52e831261b1 support for ATI fireglx
alex
parents: 12072
diff changeset
210 static uint32_t firegl_shift = 0;
b52e831261b1 support for ATI fireglx
alex
parents: 12072
diff changeset
211 #endif
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
212 static void * radeon_mmio_base = 0;
872781fef1b3 preliminary version
nick
parents:
diff changeset
213 static void * radeon_mem_base = 0;
872781fef1b3 preliminary version
nick
parents:
diff changeset
214 static int32_t radeon_overlay_off = 0;
872781fef1b3 preliminary version
nick
parents:
diff changeset
215 static uint32_t radeon_ram_size = 0;
8553
d952b097c720 correctly save and restore colorkey settings (based on patch by Svante Signell <svante.signell@telia.com>)
alex
parents: 8521
diff changeset
216 /* Restore on exit */
d952b097c720 correctly save and restore colorkey settings (based on patch by Svante Signell <svante.signell@telia.com>)
alex
parents: 8521
diff changeset
217 static uint32_t SAVED_OV0_GRAPHICS_KEY_CLR = 0;
d952b097c720 correctly save and restore colorkey settings (based on patch by Svante Signell <svante.signell@telia.com>)
alex
parents: 8521
diff changeset
218 static uint32_t SAVED_OV0_GRAPHICS_KEY_MSK = 0;
d952b097c720 correctly save and restore colorkey settings (based on patch by Svante Signell <svante.signell@telia.com>)
alex
parents: 8521
diff changeset
219 static uint32_t SAVED_OV0_VID_KEY_CLR = 0;
d952b097c720 correctly save and restore colorkey settings (based on patch by Svante Signell <svante.signell@telia.com>)
alex
parents: 8521
diff changeset
220 static uint32_t SAVED_OV0_VID_KEY_MSK = 0;
d952b097c720 correctly save and restore colorkey settings (based on patch by Svante Signell <svante.signell@telia.com>)
alex
parents: 8521
diff changeset
221 static uint32_t SAVED_OV0_KEY_CNTL = 0;
13167
a6f958139ab8 Rough but working bigendian support for radeon cards, patch by Luca Barbato <lu_zero at gentoo.org>
faust3
parents: 12642
diff changeset
222 #ifdef WORDS_BIGENDIAN
9044
59b1bd7ccae1 hack to get rage128 working on ppc-g3
alex
parents: 8942
diff changeset
223 static uint32_t SAVED_CONFIG_CNTL = 0;
13167
a6f958139ab8 Rough but working bigendian support for radeon cards, patch by Luca Barbato <lu_zero at gentoo.org>
faust3
parents: 12642
diff changeset
224 #if defined(RAGE128)
9044
59b1bd7ccae1 hack to get rage128 working on ppc-g3
alex
parents: 8942
diff changeset
225 #define APER_0_BIG_ENDIAN_16BPP_SWAP (1<<0)
59b1bd7ccae1 hack to get rage128 working on ppc-g3
alex
parents: 8942
diff changeset
226 #define APER_0_BIG_ENDIAN_32BPP_SWAP (2<<0)
13167
a6f958139ab8 Rough but working bigendian support for radeon cards, patch by Luca Barbato <lu_zero at gentoo.org>
faust3
parents: 12642
diff changeset
227 #else
a6f958139ab8 Rough but working bigendian support for radeon cards, patch by Luca Barbato <lu_zero at gentoo.org>
faust3
parents: 12642
diff changeset
228 #define RADEON_SURFACE_CNTL 0x0b00
a6f958139ab8 Rough but working bigendian support for radeon cards, patch by Luca Barbato <lu_zero at gentoo.org>
faust3
parents: 12642
diff changeset
229 #define RADEON_NONSURF_AP0_SWP_16BPP (1 << 20)
a6f958139ab8 Rough but working bigendian support for radeon cards, patch by Luca Barbato <lu_zero at gentoo.org>
faust3
parents: 12642
diff changeset
230 #define RADEON_NONSURF_AP0_SWP_32BPP (1 << 21)
a6f958139ab8 Rough but working bigendian support for radeon cards, patch by Luca Barbato <lu_zero at gentoo.org>
faust3
parents: 12642
diff changeset
231 #endif
9044
59b1bd7ccae1 hack to get rage128 working on ppc-g3
alex
parents: 8942
diff changeset
232 #endif
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
233
4012
01092e2aea16 IO space is memory mapped (no in(out)port required)
nick
parents: 4009
diff changeset
234 #define GETREG(TYPE,PTR,OFFZ) (*((volatile TYPE*)((PTR)+(OFFZ))))
01092e2aea16 IO space is memory mapped (no in(out)port required)
nick
parents: 4009
diff changeset
235 #define SETREG(TYPE,PTR,OFFZ,VAL) (*((volatile TYPE*)((PTR)+(OFFZ))))=VAL
01092e2aea16 IO space is memory mapped (no in(out)port required)
nick
parents: 4009
diff changeset
236
14363
887dc01d393a 10l, pointers aren't always 32bit
faust3
parents: 14195
diff changeset
237 #define INREG8(addr) GETREG(uint8_t,(uint8_t*)(radeon_mmio_base),addr)
887dc01d393a 10l, pointers aren't always 32bit
faust3
parents: 14195
diff changeset
238 #define OUTREG8(addr,val) SETREG(uint8_t,(uint8_t*)(radeon_mmio_base),addr,val)
8564
e1329263197b fixed a 10l, some cosmetics, and initial ppc (bigendian) support
alex
parents: 8562
diff changeset
239
e1329263197b fixed a 10l, some cosmetics, and initial ppc (bigendian) support
alex
parents: 8562
diff changeset
240 static inline uint32_t INREG (uint32_t addr) {
14363
887dc01d393a 10l, pointers aren't always 32bit
faust3
parents: 14195
diff changeset
241 uint32_t tmp = GETREG(uint32_t,(uint8_t*)(radeon_mmio_base),addr);
8564
e1329263197b fixed a 10l, some cosmetics, and initial ppc (bigendian) support
alex
parents: 8562
diff changeset
242 return le2me_32(tmp);
e1329263197b fixed a 10l, some cosmetics, and initial ppc (bigendian) support
alex
parents: 8562
diff changeset
243 }
14363
887dc01d393a 10l, pointers aren't always 32bit
faust3
parents: 14195
diff changeset
244 //#define OUTREG(addr,val) SETREG(uint32_t,(uint8_t*)(radeon_mmio_base),addr,val)
887dc01d393a 10l, pointers aren't always 32bit
faust3
parents: 14195
diff changeset
245 #define OUTREG(addr,val) SETREG(uint32_t,(uint8_t*)(radeon_mmio_base),addr,le2me_32(val))
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
246 #define OUTREGP(addr,val,mask) \
872781fef1b3 preliminary version
nick
parents:
diff changeset
247 do { \
872781fef1b3 preliminary version
nick
parents:
diff changeset
248 unsigned int _tmp = INREG(addr); \
872781fef1b3 preliminary version
nick
parents:
diff changeset
249 _tmp &= (mask); \
872781fef1b3 preliminary version
nick
parents:
diff changeset
250 _tmp |= (val); \
872781fef1b3 preliminary version
nick
parents:
diff changeset
251 OUTREG(addr, _tmp); \
872781fef1b3 preliminary version
nick
parents:
diff changeset
252 } while (0)
872781fef1b3 preliminary version
nick
parents:
diff changeset
253
4666
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
254 static __inline__ uint32_t INPLL(uint32_t addr)
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
255 {
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
256 OUTREG8(CLOCK_CNTL_INDEX, addr & 0x0000001f);
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
257 return (INREG(CLOCK_CNTL_DATA));
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
258 }
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
259
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
260 #define OUTPLL(addr,val) OUTREG8(CLOCK_CNTL_INDEX, (addr & 0x0000001f) | 0x00000080); \
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
261 OUTREG(CLOCK_CNTL_DATA, val)
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
262 #define OUTPLLP(addr,val,mask) \
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
263 do { \
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
264 unsigned int _tmp = INPLL(addr); \
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
265 _tmp &= (mask); \
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
266 _tmp |= (val); \
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
267 OUTPLL(addr, _tmp); \
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
268 } while (0)
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
269
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
270 static uint32_t radeon_vid_get_dbpp( void )
872781fef1b3 preliminary version
nick
parents:
diff changeset
271 {
872781fef1b3 preliminary version
nick
parents:
diff changeset
272 uint32_t dbpp,retval;
872781fef1b3 preliminary version
nick
parents:
diff changeset
273 dbpp = (INREG(CRTC_GEN_CNTL)>>8)& 0xF;
872781fef1b3 preliminary version
nick
parents:
diff changeset
274 switch(dbpp)
872781fef1b3 preliminary version
nick
parents:
diff changeset
275 {
872781fef1b3 preliminary version
nick
parents:
diff changeset
276 case DST_8BPP: retval = 8; break;
872781fef1b3 preliminary version
nick
parents:
diff changeset
277 case DST_15BPP: retval = 15; break;
872781fef1b3 preliminary version
nick
parents:
diff changeset
278 case DST_16BPP: retval = 16; break;
872781fef1b3 preliminary version
nick
parents:
diff changeset
279 case DST_24BPP: retval = 24; break;
872781fef1b3 preliminary version
nick
parents:
diff changeset
280 default: retval=32; break;
872781fef1b3 preliminary version
nick
parents:
diff changeset
281 }
872781fef1b3 preliminary version
nick
parents:
diff changeset
282 return retval;
872781fef1b3 preliminary version
nick
parents:
diff changeset
283 }
872781fef1b3 preliminary version
nick
parents:
diff changeset
284
872781fef1b3 preliminary version
nick
parents:
diff changeset
285 static int radeon_is_dbl_scan( void )
872781fef1b3 preliminary version
nick
parents:
diff changeset
286 {
872781fef1b3 preliminary version
nick
parents:
diff changeset
287 return (INREG(CRTC_GEN_CNTL))&CRTC_DBL_SCAN_EN;
872781fef1b3 preliminary version
nick
parents:
diff changeset
288 }
872781fef1b3 preliminary version
nick
parents:
diff changeset
289
872781fef1b3 preliminary version
nick
parents:
diff changeset
290 static int radeon_is_interlace( void )
872781fef1b3 preliminary version
nick
parents:
diff changeset
291 {
872781fef1b3 preliminary version
nick
parents:
diff changeset
292 return (INREG(CRTC_GEN_CNTL))&CRTC_INTERLACE_EN;
872781fef1b3 preliminary version
nick
parents:
diff changeset
293 }
872781fef1b3 preliminary version
nick
parents:
diff changeset
294
4666
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
295 static uint32_t radeon_get_xres( void )
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
296 {
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
297 /* FIXME: currently we extract that from CRTC!!!*/
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
298 uint32_t xres,h_total;
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
299 h_total = INREG(CRTC_H_TOTAL_DISP);
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
300 xres = (h_total >> 16) & 0xffff;
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
301 return (xres + 1)*8;
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
302 }
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
303
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
304 static uint32_t radeon_get_yres( void )
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
305 {
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
306 /* FIXME: currently we extract that from CRTC!!!*/
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
307 uint32_t yres,v_total;
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
308 v_total = INREG(CRTC_V_TOTAL_DISP);
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
309 yres = (v_total >> 16) & 0xffff;
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
310 return yres + 1;
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
311 }
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
312
13594
acfe017b6195 correct scaling when the screen resolution is smaller than the flat panel resolution
faust3
parents: 13337
diff changeset
313 /* get flat panel x resolution*/
acfe017b6195 correct scaling when the screen resolution is smaller than the flat panel resolution
faust3
parents: 13337
diff changeset
314 static uint32_t radeon_get_fp_xres( void ){
acfe017b6195 correct scaling when the screen resolution is smaller than the flat panel resolution
faust3
parents: 13337
diff changeset
315 uint32_t xres=(INREG(FP_HORZ_STRETCH)&0x00fff000)>>16;
acfe017b6195 correct scaling when the screen resolution is smaller than the flat panel resolution
faust3
parents: 13337
diff changeset
316 xres=(xres+1)*8;
acfe017b6195 correct scaling when the screen resolution is smaller than the flat panel resolution
faust3
parents: 13337
diff changeset
317 return xres;
acfe017b6195 correct scaling when the screen resolution is smaller than the flat panel resolution
faust3
parents: 13337
diff changeset
318 }
acfe017b6195 correct scaling when the screen resolution is smaller than the flat panel resolution
faust3
parents: 13337
diff changeset
319
acfe017b6195 correct scaling when the screen resolution is smaller than the flat panel resolution
faust3
parents: 13337
diff changeset
320 /* get flat panel y resolution*/
acfe017b6195 correct scaling when the screen resolution is smaller than the flat panel resolution
faust3
parents: 13337
diff changeset
321 static uint32_t radeon_get_fp_yres( void ){
acfe017b6195 correct scaling when the screen resolution is smaller than the flat panel resolution
faust3
parents: 13337
diff changeset
322 uint32_t yres=(INREG(FP_VERT_STRETCH)&0x00fff000)>>12;
acfe017b6195 correct scaling when the screen resolution is smaller than the flat panel resolution
faust3
parents: 13337
diff changeset
323 return yres+1;
acfe017b6195 correct scaling when the screen resolution is smaller than the flat panel resolution
faust3
parents: 13337
diff changeset
324 }
acfe017b6195 correct scaling when the screen resolution is smaller than the flat panel resolution
faust3
parents: 13337
diff changeset
325
4689
61f4b8fd380e Fixing "quake" by direct waiting of vsync.
nick
parents: 4666
diff changeset
326 static void radeon_wait_vsync(void)
61f4b8fd380e Fixing "quake" by direct waiting of vsync.
nick
parents: 4666
diff changeset
327 {
61f4b8fd380e Fixing "quake" by direct waiting of vsync.
nick
parents: 4666
diff changeset
328 int i;
61f4b8fd380e Fixing "quake" by direct waiting of vsync.
nick
parents: 4666
diff changeset
329
61f4b8fd380e Fixing "quake" by direct waiting of vsync.
nick
parents: 4666
diff changeset
330 OUTREG(GEN_INT_STATUS, VSYNC_INT_AK);
61f4b8fd380e Fixing "quake" by direct waiting of vsync.
nick
parents: 4666
diff changeset
331 for (i = 0; i < 2000000; i++)
61f4b8fd380e Fixing "quake" by direct waiting of vsync.
nick
parents: 4666
diff changeset
332 {
61f4b8fd380e Fixing "quake" by direct waiting of vsync.
nick
parents: 4666
diff changeset
333 if (INREG(GEN_INT_STATUS) & VSYNC_INT) break;
61f4b8fd380e Fixing "quake" by direct waiting of vsync.
nick
parents: 4666
diff changeset
334 }
61f4b8fd380e Fixing "quake" by direct waiting of vsync.
nick
parents: 4666
diff changeset
335 }
61f4b8fd380e Fixing "quake" by direct waiting of vsync.
nick
parents: 4666
diff changeset
336
6254
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
337 #ifdef RAGE128
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
338 static void _radeon_engine_idle(void);
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
339 static void _radeon_fifo_wait(unsigned);
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
340 #define radeon_engine_idle() _radeon_engine_idle()
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
341 #define radeon_fifo_wait(entries) _radeon_fifo_wait(entries)
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
342 /* Flush all dirty data in the Pixel Cache to memory. */
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
343 static __inline__ void radeon_engine_flush ( void )
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
344 {
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
345 unsigned i;
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
346
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
347 OUTREGP(PC_NGUI_CTLSTAT, PC_FLUSH_ALL, ~PC_FLUSH_ALL);
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
348 for (i = 0; i < 2000000; i++) {
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
349 if (!(INREG(PC_NGUI_CTLSTAT) & PC_BUSY)) break;
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
350 }
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
351 }
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
352
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
353 /* Reset graphics card to known state. */
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
354 static void radeon_engine_reset( void )
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
355 {
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
356 uint32_t clock_cntl_index;
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
357 uint32_t mclk_cntl;
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
358 uint32_t gen_reset_cntl;
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
359
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
360 radeon_engine_flush();
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
361
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
362 clock_cntl_index = INREG(CLOCK_CNTL_INDEX);
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
363 mclk_cntl = INPLL(MCLK_CNTL);
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
364
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
365 OUTPLL(MCLK_CNTL, mclk_cntl | FORCE_GCP | FORCE_PIPE3D_CP);
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
366
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
367 gen_reset_cntl = INREG(GEN_RESET_CNTL);
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
368
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
369 OUTREG(GEN_RESET_CNTL, gen_reset_cntl | SOFT_RESET_GUI);
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
370 INREG(GEN_RESET_CNTL);
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
371 OUTREG(GEN_RESET_CNTL,
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
372 gen_reset_cntl & (uint32_t)(~SOFT_RESET_GUI));
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
373 INREG(GEN_RESET_CNTL);
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
374
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
375 OUTPLL(MCLK_CNTL, mclk_cntl);
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
376 OUTREG(CLOCK_CNTL_INDEX, clock_cntl_index);
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
377 OUTREG(GEN_RESET_CNTL, gen_reset_cntl);
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
378 }
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
379 #else
4689
61f4b8fd380e Fixing "quake" by direct waiting of vsync.
nick
parents: 4666
diff changeset
380
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
381 static __inline__ void radeon_engine_flush ( void )
872781fef1b3 preliminary version
nick
parents:
diff changeset
382 {
872781fef1b3 preliminary version
nick
parents:
diff changeset
383 int i;
872781fef1b3 preliminary version
nick
parents:
diff changeset
384
872781fef1b3 preliminary version
nick
parents:
diff changeset
385 /* initiate flush */
872781fef1b3 preliminary version
nick
parents:
diff changeset
386 OUTREGP(RB2D_DSTCACHE_CTLSTAT, RB2D_DC_FLUSH_ALL,
872781fef1b3 preliminary version
nick
parents:
diff changeset
387 ~RB2D_DC_FLUSH_ALL);
872781fef1b3 preliminary version
nick
parents:
diff changeset
388
872781fef1b3 preliminary version
nick
parents:
diff changeset
389 for (i=0; i < 2000000; i++) {
872781fef1b3 preliminary version
nick
parents:
diff changeset
390 if (!(INREG(RB2D_DSTCACHE_CTLSTAT) & RB2D_DC_BUSY))
872781fef1b3 preliminary version
nick
parents:
diff changeset
391 break;
872781fef1b3 preliminary version
nick
parents:
diff changeset
392 }
872781fef1b3 preliminary version
nick
parents:
diff changeset
393 }
872781fef1b3 preliminary version
nick
parents:
diff changeset
394
4666
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
395 static void _radeon_engine_idle(void);
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
396 static void _radeon_fifo_wait(unsigned);
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
397 #define radeon_engine_idle() _radeon_engine_idle()
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
398 #define radeon_fifo_wait(entries) _radeon_fifo_wait(entries)
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
399
4666
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
400 static void radeon_engine_reset( void )
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
401 {
4666
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
402 uint32_t clock_cntl_index, mclk_cntl, rbbm_soft_reset;
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
403
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
404 radeon_engine_flush ();
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
405
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
406 clock_cntl_index = INREG(CLOCK_CNTL_INDEX);
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
407 mclk_cntl = INPLL(MCLK_CNTL);
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
408
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
409 OUTPLL(MCLK_CNTL, (mclk_cntl |
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
410 FORCEON_MCLKA |
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
411 FORCEON_MCLKB |
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
412 FORCEON_YCLKA |
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
413 FORCEON_YCLKB |
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
414 FORCEON_MC |
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
415 FORCEON_AIC));
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
416 rbbm_soft_reset = INREG(RBBM_SOFT_RESET);
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
417
4666
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
418 OUTREG(RBBM_SOFT_RESET, rbbm_soft_reset |
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
419 SOFT_RESET_CP |
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
420 SOFT_RESET_HI |
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
421 SOFT_RESET_SE |
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
422 SOFT_RESET_RE |
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
423 SOFT_RESET_PP |
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
424 SOFT_RESET_E2 |
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
425 SOFT_RESET_RB |
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
426 SOFT_RESET_HDP);
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
427 INREG(RBBM_SOFT_RESET);
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
428 OUTREG(RBBM_SOFT_RESET, rbbm_soft_reset & (uint32_t)
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
429 ~(SOFT_RESET_CP |
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
430 SOFT_RESET_HI |
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
431 SOFT_RESET_SE |
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
432 SOFT_RESET_RE |
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
433 SOFT_RESET_PP |
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
434 SOFT_RESET_E2 |
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
435 SOFT_RESET_RB |
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
436 SOFT_RESET_HDP));
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
437 INREG(RBBM_SOFT_RESET);
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
438
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
439 OUTPLL(MCLK_CNTL, mclk_cntl);
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
440 OUTREG(CLOCK_CNTL_INDEX, clock_cntl_index);
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
441 OUTREG(RBBM_SOFT_RESET, rbbm_soft_reset);
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
442
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
443 return;
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
444 }
6254
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
445 #endif
4666
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
446 static void radeon_engine_restore( void )
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
447 {
6254
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
448 #ifndef RAGE128
4666
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
449 int pitch64;
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
450 uint32_t xres,yres,bpp;
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
451 radeon_fifo_wait(1);
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
452 xres = radeon_get_xres();
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
453 yres = radeon_get_yres();
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
454 bpp = radeon_vid_get_dbpp();
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
455 /* turn of all automatic flushing - we'll do it all */
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
456 OUTREG(RB2D_DSTCACHE_MODE, 0);
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
457
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
458 pitch64 = ((xres * (bpp / 8) + 0x3f)) >> 6;
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
459
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
460 radeon_fifo_wait(1);
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
461 OUTREG(DEFAULT_OFFSET, (INREG(DEFAULT_OFFSET) & 0xC0000000) |
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
462 (pitch64 << 22));
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
463
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
464 radeon_fifo_wait(1);
8564
e1329263197b fixed a 10l, some cosmetics, and initial ppc (bigendian) support
alex
parents: 8562
diff changeset
465 #if defined(WORDS_BIGENDIAN)
9044
59b1bd7ccae1 hack to get rage128 working on ppc-g3
alex
parents: 8942
diff changeset
466 #ifdef RADEON
59b1bd7ccae1 hack to get rage128 working on ppc-g3
alex
parents: 8942
diff changeset
467 OUTREGP(DP_DATATYPE, HOST_BIG_ENDIAN_EN, ~HOST_BIG_ENDIAN_EN);
59b1bd7ccae1 hack to get rage128 working on ppc-g3
alex
parents: 8942
diff changeset
468 #endif
4666
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
469 #else
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
470 OUTREGP(DP_DATATYPE, 0, ~HOST_BIG_ENDIAN_EN);
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
471 #endif
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
472
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
473 radeon_fifo_wait(1);
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
474 OUTREG(DEFAULT_SC_BOTTOM_RIGHT, (DEFAULT_SC_RIGHT_MAX
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
475 | DEFAULT_SC_BOTTOM_MAX));
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
476 radeon_fifo_wait(1);
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
477 OUTREG(DP_GUI_MASTER_CNTL, (INREG(DP_GUI_MASTER_CNTL)
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
478 | GMC_BRUSH_SOLID_COLOR
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
479 | GMC_SRC_DATATYPE_COLOR));
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
480
4666
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
481 radeon_fifo_wait(7);
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
482 OUTREG(DST_LINE_START, 0);
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
483 OUTREG(DST_LINE_END, 0);
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
484 OUTREG(DP_BRUSH_FRGD_CLR, 0xffffffff);
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
485 OUTREG(DP_BRUSH_BKGD_CLR, 0x00000000);
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
486 OUTREG(DP_SRC_FRGD_CLR, 0xffffffff);
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
487 OUTREG(DP_SRC_BKGD_CLR, 0x00000000);
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
488 OUTREG(DP_WRITE_MASK, 0xffffffff);
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
489
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
490 radeon_engine_idle();
6254
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
491 #endif
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
492 }
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
493 #ifdef RAGE128
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
494 static void _radeon_fifo_wait (unsigned entries)
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
495 {
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
496 unsigned i;
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
497
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
498 for(;;)
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
499 {
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
500 for (i=0; i<2000000; i++)
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
501 if ((INREG(GUI_STAT) & GUI_FIFOCNT_MASK) >= entries)
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
502 return;
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
503 radeon_engine_reset();
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
504 radeon_engine_restore();
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
505 }
4666
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
506 }
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
507
6254
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
508 static void _radeon_engine_idle ( void )
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
509 {
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
510 unsigned i;
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
511
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
512 /* ensure FIFO is empty before waiting for idle */
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
513 radeon_fifo_wait (64);
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
514 for(;;)
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
515 {
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
516 for (i=0; i<2000000; i++) {
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
517 if ((INREG(GUI_STAT) & GUI_ACTIVE) == 0) {
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
518 radeon_engine_flush ();
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
519 return;
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
520 }
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
521 }
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
522 radeon_engine_reset();
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
523 radeon_engine_restore();
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
524 }
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
525 }
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
526 #else
4666
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
527 static void _radeon_fifo_wait (unsigned entries)
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
528 {
6254
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
529 unsigned i;
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
530
4666
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
531 for(;;)
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
532 {
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
533 for (i=0; i<2000000; i++)
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
534 if ((INREG(RBBM_STATUS) & RBBM_FIFOCNT_MASK) >= entries)
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
535 return;
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
536 radeon_engine_reset();
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
537 radeon_engine_restore();
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
538 }
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
539 }
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
540 static void _radeon_engine_idle ( void )
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
541 {
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
542 int i;
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
543
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
544 /* ensure FIFO is empty before waiting for idle */
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
545 radeon_fifo_wait (64);
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
546 for(;;)
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
547 {
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
548 for (i=0; i<2000000; i++) {
6254
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
549 if (((INREG(RBBM_STATUS) & RBBM_ACTIVE)) == 0) {
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
550 radeon_engine_flush ();
872781fef1b3 preliminary version
nick
parents:
diff changeset
551 return;
872781fef1b3 preliminary version
nick
parents:
diff changeset
552 }
872781fef1b3 preliminary version
nick
parents:
diff changeset
553 }
4666
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
554 radeon_engine_reset();
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
555 radeon_engine_restore();
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
556 }
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
557 }
6254
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
558 #endif
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
559
872781fef1b3 preliminary version
nick
parents:
diff changeset
560 #ifndef RAGE128
872781fef1b3 preliminary version
nick
parents:
diff changeset
561 /* Reference color space transform data */
872781fef1b3 preliminary version
nick
parents:
diff changeset
562 typedef struct tagREF_TRANSFORM
872781fef1b3 preliminary version
nick
parents:
diff changeset
563 {
872781fef1b3 preliminary version
nick
parents:
diff changeset
564 float RefLuma;
872781fef1b3 preliminary version
nick
parents:
diff changeset
565 float RefRCb;
872781fef1b3 preliminary version
nick
parents:
diff changeset
566 float RefRCr;
872781fef1b3 preliminary version
nick
parents:
diff changeset
567 float RefGCb;
872781fef1b3 preliminary version
nick
parents:
diff changeset
568 float RefGCr;
872781fef1b3 preliminary version
nick
parents:
diff changeset
569 float RefBCb;
872781fef1b3 preliminary version
nick
parents:
diff changeset
570 float RefBCr;
872781fef1b3 preliminary version
nick
parents:
diff changeset
571 } REF_TRANSFORM;
872781fef1b3 preliminary version
nick
parents:
diff changeset
572
872781fef1b3 preliminary version
nick
parents:
diff changeset
573 /* Parameters for ITU-R BT.601 and ITU-R BT.709 colour spaces */
872781fef1b3 preliminary version
nick
parents:
diff changeset
574 REF_TRANSFORM trans[2] =
872781fef1b3 preliminary version
nick
parents:
diff changeset
575 {
872781fef1b3 preliminary version
nick
parents:
diff changeset
576 {1.1678, 0.0, 1.6007, -0.3929, -0.8154, 2.0232, 0.0}, /* BT.601 */
872781fef1b3 preliminary version
nick
parents:
diff changeset
577 {1.1678, 0.0, 1.7980, -0.2139, -0.5345, 2.1186, 0.0} /* BT.709 */
872781fef1b3 preliminary version
nick
parents:
diff changeset
578 };
872781fef1b3 preliminary version
nick
parents:
diff changeset
579 /****************************************************************************
872781fef1b3 preliminary version
nick
parents:
diff changeset
580 * SetTransform *
872781fef1b3 preliminary version
nick
parents:
diff changeset
581 * Function: Calculates and sets color space transform from supplied *
872781fef1b3 preliminary version
nick
parents:
diff changeset
582 * reference transform, gamma, brightness, contrast, hue and *
872781fef1b3 preliminary version
nick
parents:
diff changeset
583 * saturation. *
872781fef1b3 preliminary version
nick
parents:
diff changeset
584 * Inputs: bright - brightness *
872781fef1b3 preliminary version
nick
parents:
diff changeset
585 * cont - contrast *
872781fef1b3 preliminary version
nick
parents:
diff changeset
586 * sat - saturation *
872781fef1b3 preliminary version
nick
parents:
diff changeset
587 * hue - hue *
4319
2d64382e8dcf intense->intensity + capability extension + fixing R200 color correction bug
nick
parents: 4286
diff changeset
588 * red_intensity - intense of red component *
2d64382e8dcf intense->intensity + capability extension + fixing R200 color correction bug
nick
parents: 4286
diff changeset
589 * green_intensity - intense of green component *
2d64382e8dcf intense->intensity + capability extension + fixing R200 color correction bug
nick
parents: 4286
diff changeset
590 * blue_intensity - intense of blue component *
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
591 * ref - index to the table of refernce transforms *
872781fef1b3 preliminary version
nick
parents:
diff changeset
592 * Outputs: NONE *
872781fef1b3 preliminary version
nick
parents:
diff changeset
593 ****************************************************************************/
872781fef1b3 preliminary version
nick
parents:
diff changeset
594
872781fef1b3 preliminary version
nick
parents:
diff changeset
595 static void radeon_set_transform(float bright, float cont, float sat,
4319
2d64382e8dcf intense->intensity + capability extension + fixing R200 color correction bug
nick
parents: 4286
diff changeset
596 float hue, float red_intensity,
2d64382e8dcf intense->intensity + capability extension + fixing R200 color correction bug
nick
parents: 4286
diff changeset
597 float green_intensity,float blue_intensity,
4284
05565fb57ac3 RGB independed correction (similar to brightness)
nick
parents: 4282
diff changeset
598 unsigned ref)
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
599 {
872781fef1b3 preliminary version
nick
parents:
diff changeset
600 float OvHueSin, OvHueCos;
872781fef1b3 preliminary version
nick
parents:
diff changeset
601 float CAdjLuma, CAdjOff;
4284
05565fb57ac3 RGB independed correction (similar to brightness)
nick
parents: 4282
diff changeset
602 float RedAdj,GreenAdj,BlueAdj;
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
603 float CAdjRCb, CAdjRCr;
872781fef1b3 preliminary version
nick
parents:
diff changeset
604 float CAdjGCb, CAdjGCr;
872781fef1b3 preliminary version
nick
parents:
diff changeset
605 float CAdjBCb, CAdjBCr;
872781fef1b3 preliminary version
nick
parents:
diff changeset
606 float OvLuma, OvROff, OvGOff, OvBOff;
872781fef1b3 preliminary version
nick
parents:
diff changeset
607 float OvRCb, OvRCr;
872781fef1b3 preliminary version
nick
parents:
diff changeset
608 float OvGCb, OvGCr;
872781fef1b3 preliminary version
nick
parents:
diff changeset
609 float OvBCb, OvBCr;
872781fef1b3 preliminary version
nick
parents:
diff changeset
610 float Loff = 64.0;
872781fef1b3 preliminary version
nick
parents:
diff changeset
611 float Coff = 512.0f;
872781fef1b3 preliminary version
nick
parents:
diff changeset
612
872781fef1b3 preliminary version
nick
parents:
diff changeset
613 uint32_t dwOvLuma, dwOvROff, dwOvGOff, dwOvBOff;
872781fef1b3 preliminary version
nick
parents:
diff changeset
614 uint32_t dwOvRCb, dwOvRCr;
872781fef1b3 preliminary version
nick
parents:
diff changeset
615 uint32_t dwOvGCb, dwOvGCr;
872781fef1b3 preliminary version
nick
parents:
diff changeset
616 uint32_t dwOvBCb, dwOvBCr;
872781fef1b3 preliminary version
nick
parents:
diff changeset
617
872781fef1b3 preliminary version
nick
parents:
diff changeset
618 if (ref >= 2) return;
872781fef1b3 preliminary version
nick
parents:
diff changeset
619
872781fef1b3 preliminary version
nick
parents:
diff changeset
620 OvHueSin = sin((double)hue);
872781fef1b3 preliminary version
nick
parents:
diff changeset
621 OvHueCos = cos((double)hue);
872781fef1b3 preliminary version
nick
parents:
diff changeset
622
872781fef1b3 preliminary version
nick
parents:
diff changeset
623 CAdjLuma = cont * trans[ref].RefLuma;
872781fef1b3 preliminary version
nick
parents:
diff changeset
624 CAdjOff = cont * trans[ref].RefLuma * bright * 1023.0;
4319
2d64382e8dcf intense->intensity + capability extension + fixing R200 color correction bug
nick
parents: 4286
diff changeset
625 RedAdj = cont * trans[ref].RefLuma * red_intensity * 1023.0;
2d64382e8dcf intense->intensity + capability extension + fixing R200 color correction bug
nick
parents: 4286
diff changeset
626 GreenAdj = cont * trans[ref].RefLuma * green_intensity * 1023.0;
2d64382e8dcf intense->intensity + capability extension + fixing R200 color correction bug
nick
parents: 4286
diff changeset
627 BlueAdj = cont * trans[ref].RefLuma * blue_intensity * 1023.0;
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
628
872781fef1b3 preliminary version
nick
parents:
diff changeset
629 CAdjRCb = sat * -OvHueSin * trans[ref].RefRCr;
872781fef1b3 preliminary version
nick
parents:
diff changeset
630 CAdjRCr = sat * OvHueCos * trans[ref].RefRCr;
872781fef1b3 preliminary version
nick
parents:
diff changeset
631 CAdjGCb = sat * (OvHueCos * trans[ref].RefGCb - OvHueSin * trans[ref].RefGCr);
872781fef1b3 preliminary version
nick
parents:
diff changeset
632 CAdjGCr = sat * (OvHueSin * trans[ref].RefGCb + OvHueCos * trans[ref].RefGCr);
872781fef1b3 preliminary version
nick
parents:
diff changeset
633 CAdjBCb = sat * OvHueCos * trans[ref].RefBCb;
872781fef1b3 preliminary version
nick
parents:
diff changeset
634 CAdjBCr = sat * OvHueSin * trans[ref].RefBCb;
872781fef1b3 preliminary version
nick
parents:
diff changeset
635
872781fef1b3 preliminary version
nick
parents:
diff changeset
636 #if 0 /* default constants */
872781fef1b3 preliminary version
nick
parents:
diff changeset
637 CAdjLuma = 1.16455078125;
872781fef1b3 preliminary version
nick
parents:
diff changeset
638
872781fef1b3 preliminary version
nick
parents:
diff changeset
639 CAdjRCb = 0.0;
872781fef1b3 preliminary version
nick
parents:
diff changeset
640 CAdjRCr = 1.59619140625;
872781fef1b3 preliminary version
nick
parents:
diff changeset
641 CAdjGCb = -0.39111328125;
872781fef1b3 preliminary version
nick
parents:
diff changeset
642 CAdjGCr = -0.8125;
872781fef1b3 preliminary version
nick
parents:
diff changeset
643 CAdjBCb = 2.01708984375;
872781fef1b3 preliminary version
nick
parents:
diff changeset
644 CAdjBCr = 0;
872781fef1b3 preliminary version
nick
parents:
diff changeset
645 #endif
872781fef1b3 preliminary version
nick
parents:
diff changeset
646 OvLuma = CAdjLuma;
872781fef1b3 preliminary version
nick
parents:
diff changeset
647 OvRCb = CAdjRCb;
872781fef1b3 preliminary version
nick
parents:
diff changeset
648 OvRCr = CAdjRCr;
872781fef1b3 preliminary version
nick
parents:
diff changeset
649 OvGCb = CAdjGCb;
872781fef1b3 preliminary version
nick
parents:
diff changeset
650 OvGCr = CAdjGCr;
872781fef1b3 preliminary version
nick
parents:
diff changeset
651 OvBCb = CAdjBCb;
872781fef1b3 preliminary version
nick
parents:
diff changeset
652 OvBCr = CAdjBCr;
4284
05565fb57ac3 RGB independed correction (similar to brightness)
nick
parents: 4282
diff changeset
653 OvROff = RedAdj + CAdjOff -
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
654 OvLuma * Loff - (OvRCb + OvRCr) * Coff;
4284
05565fb57ac3 RGB independed correction (similar to brightness)
nick
parents: 4282
diff changeset
655 OvGOff = GreenAdj + CAdjOff -
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
656 OvLuma * Loff - (OvGCb + OvGCr) * Coff;
4284
05565fb57ac3 RGB independed correction (similar to brightness)
nick
parents: 4282
diff changeset
657 OvBOff = BlueAdj + CAdjOff -
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
658 OvLuma * Loff - (OvBCb + OvBCr) * Coff;
872781fef1b3 preliminary version
nick
parents:
diff changeset
659 #if 0 /* default constants */
872781fef1b3 preliminary version
nick
parents:
diff changeset
660 OvROff = -888.5;
872781fef1b3 preliminary version
nick
parents:
diff changeset
661 OvGOff = 545;
872781fef1b3 preliminary version
nick
parents:
diff changeset
662 OvBOff = -1104;
872781fef1b3 preliminary version
nick
parents:
diff changeset
663 #endif
872781fef1b3 preliminary version
nick
parents:
diff changeset
664
872781fef1b3 preliminary version
nick
parents:
diff changeset
665 dwOvROff = ((int)(OvROff * 2.0)) & 0x1fff;
872781fef1b3 preliminary version
nick
parents:
diff changeset
666 dwOvGOff = (int)(OvGOff * 2.0) & 0x1fff;
872781fef1b3 preliminary version
nick
parents:
diff changeset
667 dwOvBOff = (int)(OvBOff * 2.0) & 0x1fff;
4319
2d64382e8dcf intense->intensity + capability extension + fixing R200 color correction bug
nick
parents: 4286
diff changeset
668 /* Whatever docs say about R200 having 3.8 format instead of 3.11
2d64382e8dcf intense->intensity + capability extension + fixing R200 color correction bug
nick
parents: 4286
diff changeset
669 as in Radeon is a lie */
2d64382e8dcf intense->intensity + capability extension + fixing R200 color correction bug
nick
parents: 4286
diff changeset
670 #if 0
8855
6787d02e45aa Update card (chip family) detection (from mplayerxp)
arpi
parents: 8854
diff changeset
671 if(RadeonFamily == 100)
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
672 {
4319
2d64382e8dcf intense->intensity + capability extension + fixing R200 color correction bug
nick
parents: 4286
diff changeset
673 #endif
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
674 dwOvLuma =(((int)(OvLuma * 2048.0))&0x7fff)<<17;
872781fef1b3 preliminary version
nick
parents:
diff changeset
675 dwOvRCb = (((int)(OvRCb * 2048.0))&0x7fff)<<1;
872781fef1b3 preliminary version
nick
parents:
diff changeset
676 dwOvRCr = (((int)(OvRCr * 2048.0))&0x7fff)<<17;
872781fef1b3 preliminary version
nick
parents:
diff changeset
677 dwOvGCb = (((int)(OvGCb * 2048.0))&0x7fff)<<1;
872781fef1b3 preliminary version
nick
parents:
diff changeset
678 dwOvGCr = (((int)(OvGCr * 2048.0))&0x7fff)<<17;
872781fef1b3 preliminary version
nick
parents:
diff changeset
679 dwOvBCb = (((int)(OvBCb * 2048.0))&0x7fff)<<1;
872781fef1b3 preliminary version
nick
parents:
diff changeset
680 dwOvBCr = (((int)(OvBCr * 2048.0))&0x7fff)<<17;
4319
2d64382e8dcf intense->intensity + capability extension + fixing R200 color correction bug
nick
parents: 4286
diff changeset
681 #if 0
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
682 }
872781fef1b3 preliminary version
nick
parents:
diff changeset
683 else
872781fef1b3 preliminary version
nick
parents:
diff changeset
684 {
872781fef1b3 preliminary version
nick
parents:
diff changeset
685 dwOvLuma = (((int)(OvLuma * 256.0))&0x7ff)<<20;
872781fef1b3 preliminary version
nick
parents:
diff changeset
686 dwOvRCb = (((int)(OvRCb * 256.0))&0x7ff)<<4;
872781fef1b3 preliminary version
nick
parents:
diff changeset
687 dwOvRCr = (((int)(OvRCr * 256.0))&0x7ff)<<20;
872781fef1b3 preliminary version
nick
parents:
diff changeset
688 dwOvGCb = (((int)(OvGCb * 256.0))&0x7ff)<<4;
872781fef1b3 preliminary version
nick
parents:
diff changeset
689 dwOvGCr = (((int)(OvGCr * 256.0))&0x7ff)<<20;
872781fef1b3 preliminary version
nick
parents:
diff changeset
690 dwOvBCb = (((int)(OvBCb * 256.0))&0x7ff)<<4;
872781fef1b3 preliminary version
nick
parents:
diff changeset
691 dwOvBCr = (((int)(OvBCr * 256.0))&0x7ff)<<20;
872781fef1b3 preliminary version
nick
parents:
diff changeset
692 }
4319
2d64382e8dcf intense->intensity + capability extension + fixing R200 color correction bug
nick
parents: 4286
diff changeset
693 #endif
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
694 OUTREG(OV0_LIN_TRANS_A, dwOvRCb | dwOvLuma);
872781fef1b3 preliminary version
nick
parents:
diff changeset
695 OUTREG(OV0_LIN_TRANS_B, dwOvROff | dwOvRCr);
872781fef1b3 preliminary version
nick
parents:
diff changeset
696 OUTREG(OV0_LIN_TRANS_C, dwOvGCb | dwOvLuma);
872781fef1b3 preliminary version
nick
parents:
diff changeset
697 OUTREG(OV0_LIN_TRANS_D, dwOvGOff | dwOvGCr);
872781fef1b3 preliminary version
nick
parents:
diff changeset
698 OUTREG(OV0_LIN_TRANS_E, dwOvBCb | dwOvLuma);
872781fef1b3 preliminary version
nick
parents:
diff changeset
699 OUTREG(OV0_LIN_TRANS_F, dwOvBOff | dwOvBCr);
872781fef1b3 preliminary version
nick
parents:
diff changeset
700 }
872781fef1b3 preliminary version
nick
parents:
diff changeset
701
872781fef1b3 preliminary version
nick
parents:
diff changeset
702 /* Gamma curve definition */
872781fef1b3 preliminary version
nick
parents:
diff changeset
703 typedef struct
872781fef1b3 preliminary version
nick
parents:
diff changeset
704 {
872781fef1b3 preliminary version
nick
parents:
diff changeset
705 unsigned int gammaReg;
872781fef1b3 preliminary version
nick
parents:
diff changeset
706 unsigned int gammaSlope;
872781fef1b3 preliminary version
nick
parents:
diff changeset
707 unsigned int gammaOffset;
872781fef1b3 preliminary version
nick
parents:
diff changeset
708 }GAMMA_SETTINGS;
872781fef1b3 preliminary version
nick
parents:
diff changeset
709
872781fef1b3 preliminary version
nick
parents:
diff changeset
710 /* Recommended gamma curve parameters */
872781fef1b3 preliminary version
nick
parents:
diff changeset
711 GAMMA_SETTINGS r200_def_gamma[18] =
872781fef1b3 preliminary version
nick
parents:
diff changeset
712 {
872781fef1b3 preliminary version
nick
parents:
diff changeset
713 {OV0_GAMMA_0_F, 0x100, 0x0000},
872781fef1b3 preliminary version
nick
parents:
diff changeset
714 {OV0_GAMMA_10_1F, 0x100, 0x0020},
872781fef1b3 preliminary version
nick
parents:
diff changeset
715 {OV0_GAMMA_20_3F, 0x100, 0x0040},
872781fef1b3 preliminary version
nick
parents:
diff changeset
716 {OV0_GAMMA_40_7F, 0x100, 0x0080},
872781fef1b3 preliminary version
nick
parents:
diff changeset
717 {OV0_GAMMA_80_BF, 0x100, 0x0100},
872781fef1b3 preliminary version
nick
parents:
diff changeset
718 {OV0_GAMMA_C0_FF, 0x100, 0x0100},
872781fef1b3 preliminary version
nick
parents:
diff changeset
719 {OV0_GAMMA_100_13F, 0x100, 0x0200},
872781fef1b3 preliminary version
nick
parents:
diff changeset
720 {OV0_GAMMA_140_17F, 0x100, 0x0200},
872781fef1b3 preliminary version
nick
parents:
diff changeset
721 {OV0_GAMMA_180_1BF, 0x100, 0x0300},
872781fef1b3 preliminary version
nick
parents:
diff changeset
722 {OV0_GAMMA_1C0_1FF, 0x100, 0x0300},
872781fef1b3 preliminary version
nick
parents:
diff changeset
723 {OV0_GAMMA_200_23F, 0x100, 0x0400},
872781fef1b3 preliminary version
nick
parents:
diff changeset
724 {OV0_GAMMA_240_27F, 0x100, 0x0400},
872781fef1b3 preliminary version
nick
parents:
diff changeset
725 {OV0_GAMMA_280_2BF, 0x100, 0x0500},
872781fef1b3 preliminary version
nick
parents:
diff changeset
726 {OV0_GAMMA_2C0_2FF, 0x100, 0x0500},
872781fef1b3 preliminary version
nick
parents:
diff changeset
727 {OV0_GAMMA_300_33F, 0x100, 0x0600},
872781fef1b3 preliminary version
nick
parents:
diff changeset
728 {OV0_GAMMA_340_37F, 0x100, 0x0600},
872781fef1b3 preliminary version
nick
parents:
diff changeset
729 {OV0_GAMMA_380_3BF, 0x100, 0x0700},
872781fef1b3 preliminary version
nick
parents:
diff changeset
730 {OV0_GAMMA_3C0_3FF, 0x100, 0x0700}
872781fef1b3 preliminary version
nick
parents:
diff changeset
731 };
872781fef1b3 preliminary version
nick
parents:
diff changeset
732
872781fef1b3 preliminary version
nick
parents:
diff changeset
733 GAMMA_SETTINGS r100_def_gamma[6] =
872781fef1b3 preliminary version
nick
parents:
diff changeset
734 {
872781fef1b3 preliminary version
nick
parents:
diff changeset
735 {OV0_GAMMA_0_F, 0x100, 0x0000},
872781fef1b3 preliminary version
nick
parents:
diff changeset
736 {OV0_GAMMA_10_1F, 0x100, 0x0020},
872781fef1b3 preliminary version
nick
parents:
diff changeset
737 {OV0_GAMMA_20_3F, 0x100, 0x0040},
872781fef1b3 preliminary version
nick
parents:
diff changeset
738 {OV0_GAMMA_40_7F, 0x100, 0x0080},
872781fef1b3 preliminary version
nick
parents:
diff changeset
739 {OV0_GAMMA_380_3BF, 0x100, 0x0100},
872781fef1b3 preliminary version
nick
parents:
diff changeset
740 {OV0_GAMMA_3C0_3FF, 0x100, 0x0100}
872781fef1b3 preliminary version
nick
parents:
diff changeset
741 };
872781fef1b3 preliminary version
nick
parents:
diff changeset
742
872781fef1b3 preliminary version
nick
parents:
diff changeset
743 static void make_default_gamma_correction( void )
872781fef1b3 preliminary version
nick
parents:
diff changeset
744 {
872781fef1b3 preliminary version
nick
parents:
diff changeset
745 size_t i;
8855
6787d02e45aa Update card (chip family) detection (from mplayerxp)
arpi
parents: 8854
diff changeset
746 if(RadeonFamily == 100) {
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
747 OUTREG(OV0_LIN_TRANS_A, 0x12A00000);
872781fef1b3 preliminary version
nick
parents:
diff changeset
748 OUTREG(OV0_LIN_TRANS_B, 0x199018FE);
872781fef1b3 preliminary version
nick
parents:
diff changeset
749 OUTREG(OV0_LIN_TRANS_C, 0x12A0F9B0);
872781fef1b3 preliminary version
nick
parents:
diff changeset
750 OUTREG(OV0_LIN_TRANS_D, 0xF2F0043B);
872781fef1b3 preliminary version
nick
parents:
diff changeset
751 OUTREG(OV0_LIN_TRANS_E, 0x12A02050);
872781fef1b3 preliminary version
nick
parents:
diff changeset
752 OUTREG(OV0_LIN_TRANS_F, 0x0000174E);
872781fef1b3 preliminary version
nick
parents:
diff changeset
753 for(i=0; i<6; i++){
872781fef1b3 preliminary version
nick
parents:
diff changeset
754 OUTREG(r100_def_gamma[i].gammaReg,
872781fef1b3 preliminary version
nick
parents:
diff changeset
755 (r100_def_gamma[i].gammaSlope<<16) |
872781fef1b3 preliminary version
nick
parents:
diff changeset
756 r100_def_gamma[i].gammaOffset);
872781fef1b3 preliminary version
nick
parents:
diff changeset
757 }
872781fef1b3 preliminary version
nick
parents:
diff changeset
758 }
872781fef1b3 preliminary version
nick
parents:
diff changeset
759 else{
872781fef1b3 preliminary version
nick
parents:
diff changeset
760 OUTREG(OV0_LIN_TRANS_A, 0x12a00000);
872781fef1b3 preliminary version
nick
parents:
diff changeset
761 OUTREG(OV0_LIN_TRANS_B, 0x1990190e);
872781fef1b3 preliminary version
nick
parents:
diff changeset
762 OUTREG(OV0_LIN_TRANS_C, 0x12a0f9c0);
872781fef1b3 preliminary version
nick
parents:
diff changeset
763 OUTREG(OV0_LIN_TRANS_D, 0xf3000442);
872781fef1b3 preliminary version
nick
parents:
diff changeset
764 OUTREG(OV0_LIN_TRANS_E, 0x12a02040);
872781fef1b3 preliminary version
nick
parents:
diff changeset
765 OUTREG(OV0_LIN_TRANS_F, 0x175f);
872781fef1b3 preliminary version
nick
parents:
diff changeset
766
872781fef1b3 preliminary version
nick
parents:
diff changeset
767 /* Default Gamma,
872781fef1b3 preliminary version
nick
parents:
diff changeset
768 Of 18 segments for gamma cure, all segments in R200 are programmable,
872781fef1b3 preliminary version
nick
parents:
diff changeset
769 while only lower 4 and upper 2 segments are programmable in Radeon*/
872781fef1b3 preliminary version
nick
parents:
diff changeset
770 for(i=0; i<18; i++){
872781fef1b3 preliminary version
nick
parents:
diff changeset
771 OUTREG(r200_def_gamma[i].gammaReg,
872781fef1b3 preliminary version
nick
parents:
diff changeset
772 (r200_def_gamma[i].gammaSlope<<16) |
872781fef1b3 preliminary version
nick
parents:
diff changeset
773 r200_def_gamma[i].gammaOffset);
872781fef1b3 preliminary version
nick
parents:
diff changeset
774 }
872781fef1b3 preliminary version
nick
parents:
diff changeset
775 }
872781fef1b3 preliminary version
nick
parents:
diff changeset
776 }
872781fef1b3 preliminary version
nick
parents:
diff changeset
777 #endif
872781fef1b3 preliminary version
nick
parents:
diff changeset
778
872781fef1b3 preliminary version
nick
parents:
diff changeset
779 static void radeon_vid_make_default(void)
872781fef1b3 preliminary version
nick
parents:
diff changeset
780 {
872781fef1b3 preliminary version
nick
parents:
diff changeset
781 #ifdef RAGE128
6564
652ada9f9b66 remove colorkeying if destroying the driver - fixes some bugs
alex
parents: 6483
diff changeset
782 OUTREG(OV0_COLOUR_CNTL,0x00101000UL); /* Default brightness and saturation for Rage128 */
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
783 #else
872781fef1b3 preliminary version
nick
parents:
diff changeset
784 make_default_gamma_correction();
872781fef1b3 preliminary version
nick
parents:
diff changeset
785 #endif
872781fef1b3 preliminary version
nick
parents:
diff changeset
786 besr.deinterlace_pattern = 0x900AAAAA;
872781fef1b3 preliminary version
nick
parents:
diff changeset
787 OUTREG(OV0_DEINTERLACE_PATTERN,besr.deinterlace_pattern);
872781fef1b3 preliminary version
nick
parents:
diff changeset
788 besr.deinterlace_on=1;
872781fef1b3 preliminary version
nick
parents:
diff changeset
789 besr.double_buff=1;
4869
15af74a11ce9 color key support
nick
parents: 4855
diff changeset
790 besr.ckey_on=0;
15af74a11ce9 color key support
nick
parents: 4855
diff changeset
791 besr.graphics_key_msk=0;
15af74a11ce9 color key support
nick
parents: 4855
diff changeset
792 besr.graphics_key_clr=0;
5044
43dc579db3d1 Fixed color key definitions. Waiting for new bugreports ;)
nick
parents: 5041
diff changeset
793 besr.ckey_cntl = VIDEO_KEY_FN_TRUE|GRAPHIC_KEY_FN_TRUE|CMP_MIX_AND;
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
794 }
872781fef1b3 preliminary version
nick
parents:
diff changeset
795
872781fef1b3 preliminary version
nick
parents:
diff changeset
796
872781fef1b3 preliminary version
nick
parents:
diff changeset
797 unsigned vixGetVersion( void ) { return VIDIX_VERSION; }
872781fef1b3 preliminary version
nick
parents:
diff changeset
798
4107
cf1d2f965867 Changes due new gawk generator
nick
parents: 4070
diff changeset
799 static unsigned short ati_card_ids[] =
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
800 {
872781fef1b3 preliminary version
nick
parents:
diff changeset
801 #ifdef RAGE128
872781fef1b3 preliminary version
nick
parents:
diff changeset
802 /*
872781fef1b3 preliminary version
nick
parents:
diff changeset
803 This driver should be compatible with Rage128 (pro) chips.
872781fef1b3 preliminary version
nick
parents:
diff changeset
804 (include adaptive deinterlacing!!!).
872781fef1b3 preliminary version
nick
parents:
diff changeset
805 Moreover: the same logic can be used with Mach64 chips.
872781fef1b3 preliminary version
nick
parents:
diff changeset
806 (I mean: mach64xx, 3d rage, 3d rage IIc, 3D rage pro, 3d rage mobility).
872781fef1b3 preliminary version
nick
parents:
diff changeset
807 but they are incompatible by i/o ports. So if enthusiasts will want
872781fef1b3 preliminary version
nick
parents:
diff changeset
808 then they can redefine OUTREG and INREG macros and redefine OV0_*
872781fef1b3 preliminary version
nick
parents:
diff changeset
809 constants. Also it seems that mach64 chips supports only: YUY2, YV12, UYVY
872781fef1b3 preliminary version
nick
parents:
diff changeset
810 fourccs (422 and 420 formats only).
872781fef1b3 preliminary version
nick
parents:
diff changeset
811 */
872781fef1b3 preliminary version
nick
parents:
diff changeset
812 /* Rage128 Pro GL */
4107
cf1d2f965867 Changes due new gawk generator
nick
parents: 4070
diff changeset
813 DEVICE_ATI_RAGE_128_PA_PRO,
cf1d2f965867 Changes due new gawk generator
nick
parents: 4070
diff changeset
814 DEVICE_ATI_RAGE_128_PB_PRO,
cf1d2f965867 Changes due new gawk generator
nick
parents: 4070
diff changeset
815 DEVICE_ATI_RAGE_128_PC_PRO,
cf1d2f965867 Changes due new gawk generator
nick
parents: 4070
diff changeset
816 DEVICE_ATI_RAGE_128_PD_PRO,
cf1d2f965867 Changes due new gawk generator
nick
parents: 4070
diff changeset
817 DEVICE_ATI_RAGE_128_PE_PRO,
cf1d2f965867 Changes due new gawk generator
nick
parents: 4070
diff changeset
818 DEVICE_ATI_RAGE_128_PF_PRO,
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
819 /* Rage128 Pro VR */
4107
cf1d2f965867 Changes due new gawk generator
nick
parents: 4070
diff changeset
820 DEVICE_ATI_RAGE_128_PG_PRO,
cf1d2f965867 Changes due new gawk generator
nick
parents: 4070
diff changeset
821 DEVICE_ATI_RAGE_128_PH_PRO,
cf1d2f965867 Changes due new gawk generator
nick
parents: 4070
diff changeset
822 DEVICE_ATI_RAGE_128_PI_PRO,
cf1d2f965867 Changes due new gawk generator
nick
parents: 4070
diff changeset
823 DEVICE_ATI_RAGE_128_PJ_PRO,
cf1d2f965867 Changes due new gawk generator
nick
parents: 4070
diff changeset
824 DEVICE_ATI_RAGE_128_PK_PRO,
cf1d2f965867 Changes due new gawk generator
nick
parents: 4070
diff changeset
825 DEVICE_ATI_RAGE_128_PL_PRO,
cf1d2f965867 Changes due new gawk generator
nick
parents: 4070
diff changeset
826 DEVICE_ATI_RAGE_128_PM_PRO,
cf1d2f965867 Changes due new gawk generator
nick
parents: 4070
diff changeset
827 DEVICE_ATI_RAGE_128_PN_PRO,
cf1d2f965867 Changes due new gawk generator
nick
parents: 4070
diff changeset
828 DEVICE_ATI_RAGE_128_PO_PRO,
cf1d2f965867 Changes due new gawk generator
nick
parents: 4070
diff changeset
829 DEVICE_ATI_RAGE_128_PP_PRO,
cf1d2f965867 Changes due new gawk generator
nick
parents: 4070
diff changeset
830 DEVICE_ATI_RAGE_128_PQ_PRO,
cf1d2f965867 Changes due new gawk generator
nick
parents: 4070
diff changeset
831 DEVICE_ATI_RAGE_128_PR_PRO,
cf1d2f965867 Changes due new gawk generator
nick
parents: 4070
diff changeset
832 DEVICE_ATI_RAGE_128_PS_PRO,
cf1d2f965867 Changes due new gawk generator
nick
parents: 4070
diff changeset
833 DEVICE_ATI_RAGE_128_PT_PRO,
cf1d2f965867 Changes due new gawk generator
nick
parents: 4070
diff changeset
834 DEVICE_ATI_RAGE_128_PU_PRO,
cf1d2f965867 Changes due new gawk generator
nick
parents: 4070
diff changeset
835 DEVICE_ATI_RAGE_128_PV_PRO,
cf1d2f965867 Changes due new gawk generator
nick
parents: 4070
diff changeset
836 DEVICE_ATI_RAGE_128_PW_PRO,
cf1d2f965867 Changes due new gawk generator
nick
parents: 4070
diff changeset
837 DEVICE_ATI_RAGE_128_PX_PRO,
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
838 /* Rage128 GL */
4107
cf1d2f965867 Changes due new gawk generator
nick
parents: 4070
diff changeset
839 DEVICE_ATI_RAGE_128_RE_SG,
cf1d2f965867 Changes due new gawk generator
nick
parents: 4070
diff changeset
840 DEVICE_ATI_RAGE_128_RF_SG,
cf1d2f965867 Changes due new gawk generator
nick
parents: 4070
diff changeset
841 DEVICE_ATI_RAGE_128_RG,
cf1d2f965867 Changes due new gawk generator
nick
parents: 4070
diff changeset
842 DEVICE_ATI_RAGE_128_RK_VR,
cf1d2f965867 Changes due new gawk generator
nick
parents: 4070
diff changeset
843 DEVICE_ATI_RAGE_128_RL_VR,
cf1d2f965867 Changes due new gawk generator
nick
parents: 4070
diff changeset
844 DEVICE_ATI_RAGE_128_SE_4X,
cf1d2f965867 Changes due new gawk generator
nick
parents: 4070
diff changeset
845 DEVICE_ATI_RAGE_128_SF_4X,
cf1d2f965867 Changes due new gawk generator
nick
parents: 4070
diff changeset
846 DEVICE_ATI_RAGE_128_SG_4X,
8854
b3afe83fc6cc Update radeon pci ids
arpi
parents: 8771
diff changeset
847 DEVICE_ATI_RAGE_128_SH,
4107
cf1d2f965867 Changes due new gawk generator
nick
parents: 4070
diff changeset
848 DEVICE_ATI_RAGE_128_SK_4X,
cf1d2f965867 Changes due new gawk generator
nick
parents: 4070
diff changeset
849 DEVICE_ATI_RAGE_128_SL_4X,
cf1d2f965867 Changes due new gawk generator
nick
parents: 4070
diff changeset
850 DEVICE_ATI_RAGE_128_SM_4X,
8854
b3afe83fc6cc Update radeon pci ids
arpi
parents: 8771
diff changeset
851 DEVICE_ATI_RAGE_128_4X,
4107
cf1d2f965867 Changes due new gawk generator
nick
parents: 4070
diff changeset
852 DEVICE_ATI_RAGE_128_PRO,
cf1d2f965867 Changes due new gawk generator
nick
parents: 4070
diff changeset
853 DEVICE_ATI_RAGE_128_PRO2,
5165
51fcb1e5c96e rage mobility m3 is rage128 based and not mach64 ...
michael
parents: 5044
diff changeset
854 DEVICE_ATI_RAGE_128_PRO3,
51fcb1e5c96e rage mobility m3 is rage128 based and not mach64 ...
michael
parents: 5044
diff changeset
855 /* these seem to be based on rage 128 instead of mach64 */
51fcb1e5c96e rage mobility m3 is rage128 based and not mach64 ...
michael
parents: 5044
diff changeset
856 DEVICE_ATI_RAGE_MOBILITY_M3,
51fcb1e5c96e rage mobility m3 is rage128 based and not mach64 ...
michael
parents: 5044
diff changeset
857 DEVICE_ATI_RAGE_MOBILITY_M32
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
858 #else
872781fef1b3 preliminary version
nick
parents:
diff changeset
859 /* Radeons (indeed: Rage 256 Pro ;) */
8855
6787d02e45aa Update card (chip family) detection (from mplayerxp)
arpi
parents: 8854
diff changeset
860 DEVICE_ATI_RADEON_R100_QD,
6787d02e45aa Update card (chip family) detection (from mplayerxp)
arpi
parents: 8854
diff changeset
861 DEVICE_ATI_RADEON_R100_QE,
6787d02e45aa Update card (chip family) detection (from mplayerxp)
arpi
parents: 8854
diff changeset
862 DEVICE_ATI_RADEON_R100_QF,
6787d02e45aa Update card (chip family) detection (from mplayerxp)
arpi
parents: 8854
diff changeset
863 DEVICE_ATI_RADEON_R100_QG,
6787d02e45aa Update card (chip family) detection (from mplayerxp)
arpi
parents: 8854
diff changeset
864 DEVICE_ATI_RADEON_VE_QY,
6787d02e45aa Update card (chip family) detection (from mplayerxp)
arpi
parents: 8854
diff changeset
865 DEVICE_ATI_RADEON_VE_QZ,
8854
b3afe83fc6cc Update radeon pci ids
arpi
parents: 8771
diff changeset
866 DEVICE_ATI_RADEON_MOBILITY_M7,
b3afe83fc6cc Update radeon pci ids
arpi
parents: 8771
diff changeset
867 DEVICE_ATI_RADEON_MOBILITY_M72,
4107
cf1d2f965867 Changes due new gawk generator
nick
parents: 4070
diff changeset
868 DEVICE_ATI_RADEON_MOBILITY_M6,
cf1d2f965867 Changes due new gawk generator
nick
parents: 4070
diff changeset
869 DEVICE_ATI_RADEON_MOBILITY_M62,
10332
dd748f428d05 radeon mobility u1 support
alex
parents: 9892
diff changeset
870 DEVICE_ATI_RADEON_MOBILITY_U1,
8855
6787d02e45aa Update card (chip family) detection (from mplayerxp)
arpi
parents: 8854
diff changeset
871 DEVICE_ATI_RADEON_R200_BB,
6787d02e45aa Update card (chip family) detection (from mplayerxp)
arpi
parents: 8854
diff changeset
872 DEVICE_ATI_RADEON_R200_QH,
6787d02e45aa Update card (chip family) detection (from mplayerxp)
arpi
parents: 8854
diff changeset
873 DEVICE_ATI_RADEON_R200_QI,
6787d02e45aa Update card (chip family) detection (from mplayerxp)
arpi
parents: 8854
diff changeset
874 DEVICE_ATI_RADEON_R200_QJ,
6787d02e45aa Update card (chip family) detection (from mplayerxp)
arpi
parents: 8854
diff changeset
875 DEVICE_ATI_RADEON_R200_QK,
8854
b3afe83fc6cc Update radeon pci ids
arpi
parents: 8771
diff changeset
876 DEVICE_ATI_RADEON_R200_QL,
14195
1061d4dea7b7 Radeon R200 QM (Radeon 9100) support patch by Simone <beniamino.scanzoni at fastwebnet.it>
faust3
parents: 13594
diff changeset
877 DEVICE_ATI_RADEON_R200_QM,
8855
6787d02e45aa Update card (chip family) detection (from mplayerxp)
arpi
parents: 8854
diff changeset
878 DEVICE_ATI_RADEON_R200_QH2,
6787d02e45aa Update card (chip family) detection (from mplayerxp)
arpi
parents: 8854
diff changeset
879 DEVICE_ATI_RADEON_R200_QI2,
6787d02e45aa Update card (chip family) detection (from mplayerxp)
arpi
parents: 8854
diff changeset
880 DEVICE_ATI_RADEON_R200_QJ2,
6787d02e45aa Update card (chip family) detection (from mplayerxp)
arpi
parents: 8854
diff changeset
881 DEVICE_ATI_RADEON_R200_QK2,
8854
b3afe83fc6cc Update radeon pci ids
arpi
parents: 8771
diff changeset
882 DEVICE_ATI_RADEON_RV200_QW,
8855
6787d02e45aa Update card (chip family) detection (from mplayerxp)
arpi
parents: 8854
diff changeset
883 DEVICE_ATI_RADEON_RV200_QX,
6787d02e45aa Update card (chip family) detection (from mplayerxp)
arpi
parents: 8854
diff changeset
884 DEVICE_ATI_RADEON_R250_ID,
6787d02e45aa Update card (chip family) detection (from mplayerxp)
arpi
parents: 8854
diff changeset
885 DEVICE_ATI_RADEON_R250_IE,
6787d02e45aa Update card (chip family) detection (from mplayerxp)
arpi
parents: 8854
diff changeset
886 DEVICE_ATI_RADEON_R250_IF,
6787d02e45aa Update card (chip family) detection (from mplayerxp)
arpi
parents: 8854
diff changeset
887 DEVICE_ATI_RADEON_R250_IG,
6787d02e45aa Update card (chip family) detection (from mplayerxp)
arpi
parents: 8854
diff changeset
888 DEVICE_ATI_RADEON_R250_LD,
6787d02e45aa Update card (chip family) detection (from mplayerxp)
arpi
parents: 8854
diff changeset
889 DEVICE_ATI_RADEON_R250_LE,
6787d02e45aa Update card (chip family) detection (from mplayerxp)
arpi
parents: 8854
diff changeset
890 DEVICE_ATI_RADEON_R250_LF,
6787d02e45aa Update card (chip family) detection (from mplayerxp)
arpi
parents: 8854
diff changeset
891 DEVICE_ATI_RADEON_R250_LG,
15920
e5bc2812c4a0 radeon x300 support patch by Christophe Preaud <cpreaud at free.fr>
faust3
parents: 15109
diff changeset
892 DEVICE_ATI_RV370_5B60_RADEON,
12070
070fc453a20b support for Radeon 9200 based video boards patch by Benjamin Zores <ben at tutuxclan.org>
faust3
parents: 12060
diff changeset
893 DEVICE_ATI_RV250_5C61_RADEON,
070fc453a20b support for Radeon 9200 based video boards patch by Benjamin Zores <ben at tutuxclan.org>
faust3
parents: 12060
diff changeset
894 DEVICE_ATI_RV250_5C63_RADEON,
070fc453a20b support for Radeon 9200 based video boards patch by Benjamin Zores <ben at tutuxclan.org>
faust3
parents: 12060
diff changeset
895 DEVICE_ATI_RV280_RADEON_9200,
070fc453a20b support for Radeon 9200 based video boards patch by Benjamin Zores <ben at tutuxclan.org>
faust3
parents: 12060
diff changeset
896 DEVICE_ATI_RV280_RADEON_92002,
070fc453a20b support for Radeon 9200 based video boards patch by Benjamin Zores <ben at tutuxclan.org>
faust3
parents: 12060
diff changeset
897 DEVICE_ATI_RV280_RADEON_92003,
070fc453a20b support for Radeon 9200 based video boards patch by Benjamin Zores <ben at tutuxclan.org>
faust3
parents: 12060
diff changeset
898 DEVICE_ATI_RV280_RADEON_92004,
070fc453a20b support for Radeon 9200 based video boards patch by Benjamin Zores <ben at tutuxclan.org>
faust3
parents: 12060
diff changeset
899 DEVICE_ATI_RV280_RADEON_92005,
15108
16bc84938c4b add support for one more radeon 9200 model (the one included in the Mac Mini)
aurel
parents: 14363
diff changeset
900 DEVICE_ATI_RV280_RADEON_92006,
8855
6787d02e45aa Update card (chip family) detection (from mplayerxp)
arpi
parents: 8854
diff changeset
901 DEVICE_ATI_RADEON_R300_ND,
6787d02e45aa Update card (chip family) detection (from mplayerxp)
arpi
parents: 8854
diff changeset
902 DEVICE_ATI_RADEON_R300_NE,
6787d02e45aa Update card (chip family) detection (from mplayerxp)
arpi
parents: 8854
diff changeset
903 DEVICE_ATI_RADEON_R300_NF,
11371
9cd1546f26ea patch by Vladimir Mosgalin <mosgalin@VM10124.spb.edu>
attila
parents: 10332
diff changeset
904 DEVICE_ATI_RADEON_R300_NG,
12361
a84160d660af support for a few more radeons patch by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents: 12286
diff changeset
905 DEVICE_ATI_RADEON_R300_AE,
a84160d660af support for a few more radeons patch by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents: 12286
diff changeset
906 DEVICE_ATI_RADEON_R300_AF,
11658
73203cca1884 Makes radeon_vid work with the Radeon 9600 Pro card.
wight
parents: 11371
diff changeset
907 DEVICE_ATI_RADEON_RV350_AP,
21798
31404b462bd5 support for vidix on ATI Radeon 9600SE cards
ben
parents: 21507
diff changeset
908 DEVICE_ATI_RADEON_RV350_AQ,
12361
a84160d660af support for a few more radeons patch by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents: 12286
diff changeset
909 DEVICE_ATI_RADEON_RV350_AR,
17350
104c6ac0784d support for Radeon 9550
diego
parents: 15920
diff changeset
910 DEVICE_ATI_RADEON_RV350_BK,
12454
83a18b230e8c Add support for a few more Radeons, patch by Nyk Tarr.
diego
parents: 12361
diff changeset
911 DEVICE_ATI_RADEON_R350_AH,
83a18b230e8c Add support for a few more Radeons, patch by Nyk Tarr.
diego
parents: 12361
diff changeset
912 DEVICE_ATI_RADEON_R350_AI,
12060
b245a429c896 Mobility Radeon 9600/9700 support
faust3
parents: 11678
diff changeset
913 DEVICE_ATI_RADEON_R350_NH,
12459
0dfc2f1775a9 correct model number
diego
parents: 12454
diff changeset
914 DEVICE_ATI_RADEON_R360_NJ,
12060
b245a429c896 Mobility Radeon 9600/9700 support
faust3
parents: 11678
diff changeset
915 DEVICE_ATI_RV350_MOBILITY_RADEON,
b245a429c896 Mobility Radeon 9600/9700 support
faust3
parents: 11678
diff changeset
916 DEVICE_ATI_RV350_MOBILITY_RADEON2
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
917 #endif
872781fef1b3 preliminary version
nick
parents:
diff changeset
918 };
872781fef1b3 preliminary version
nick
parents:
diff changeset
919
872781fef1b3 preliminary version
nick
parents:
diff changeset
920 static int find_chip(unsigned chip_id)
872781fef1b3 preliminary version
nick
parents:
diff changeset
921 {
872781fef1b3 preliminary version
nick
parents:
diff changeset
922 unsigned i;
4107
cf1d2f965867 Changes due new gawk generator
nick
parents: 4070
diff changeset
923 for(i = 0;i < sizeof(ati_card_ids)/sizeof(unsigned short);i++)
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
924 {
4107
cf1d2f965867 Changes due new gawk generator
nick
parents: 4070
diff changeset
925 if(chip_id == ati_card_ids[i]) return i;
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
926 }
872781fef1b3 preliminary version
nick
parents:
diff changeset
927 return -1;
872781fef1b3 preliminary version
nick
parents:
diff changeset
928 }
872781fef1b3 preliminary version
nick
parents:
diff changeset
929
8564
e1329263197b fixed a 10l, some cosmetics, and initial ppc (bigendian) support
alex
parents: 8562
diff changeset
930 static pciinfo_t pci_info;
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
931 static int probed=0;
872781fef1b3 preliminary version
nick
parents:
diff changeset
932
872781fef1b3 preliminary version
nick
parents:
diff changeset
933 vidix_capability_t def_cap =
872781fef1b3 preliminary version
nick
parents:
diff changeset
934 {
872781fef1b3 preliminary version
nick
parents:
diff changeset
935 #ifdef RAGE128
8564
e1329263197b fixed a 10l, some cosmetics, and initial ppc (bigendian) support
alex
parents: 8562
diff changeset
936 "BES driver for Rage128 cards",
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
937 #else
8564
e1329263197b fixed a 10l, some cosmetics, and initial ppc (bigendian) support
alex
parents: 8562
diff changeset
938 "BES driver for Radeon cards",
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
939 #endif
4327
9bdf337bd078 upgraded to newest vidix interface
alex
parents: 4319
diff changeset
940 "Nick Kurshev",
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
941 TYPE_OUTPUT | TYPE_FX,
4191
62a6135d090e + new features and possibility
nick
parents: 4134
diff changeset
942 { 0, 0, 0, 0 },
4282
ae7d42d7b286 2048x2048 is real max size of overlay
nick
parents: 4264
diff changeset
943 2048,
ae7d42d7b286 2048x2048 is real max size of overlay
nick
parents: 4264
diff changeset
944 2048,
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
945 4,
872781fef1b3 preliminary version
nick
parents:
diff changeset
946 4,
872781fef1b3 preliminary version
nick
parents:
diff changeset
947 -1,
4264
689531ade0fb added FLAG_EQUALIZER
alex
parents: 4230
diff changeset
948 FLAG_UPSCALER | FLAG_DOWNSCALER | FLAG_EQUALIZER,
4134
nick
parents: 4107
diff changeset
949 VENDOR_ATI,
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
950 0,
872781fef1b3 preliminary version
nick
parents:
diff changeset
951 { 0, 0, 0, 0}
872781fef1b3 preliminary version
nick
parents:
diff changeset
952 };
872781fef1b3 preliminary version
nick
parents:
diff changeset
953
12286
b52e831261b1 support for ATI fireglx
alex
parents: 12072
diff changeset
954 #ifdef HAVE_X11
19066
26a30496ec96 marks several function without a prototype which arent used outside its sourcefile as static, Patch by Stefan Huehner - stefan AT huehner-org
reynaldo
parents: 17566
diff changeset
955 static void probe_fireGL_driver(void) {
12286
b52e831261b1 support for ATI fireglx
alex
parents: 12072
diff changeset
956 Display *dp = XOpenDisplay ((void*)0);
b52e831261b1 support for ATI fireglx
alex
parents: 12072
diff changeset
957 int n = 0;
12466
b5e7d2464c00 segfault fix by Jarrod Johnson <jbj-zl@ura.dnsalias.org>
diego
parents: 12459
diff changeset
958 char **extlist;
b5e7d2464c00 segfault fix by Jarrod Johnson <jbj-zl@ura.dnsalias.org>
diego
parents: 12459
diff changeset
959 if (dp==NULL) {
b5e7d2464c00 segfault fix by Jarrod Johnson <jbj-zl@ura.dnsalias.org>
diego
parents: 12459
diff changeset
960 return;
b5e7d2464c00 segfault fix by Jarrod Johnson <jbj-zl@ura.dnsalias.org>
diego
parents: 12459
diff changeset
961 }
b5e7d2464c00 segfault fix by Jarrod Johnson <jbj-zl@ura.dnsalias.org>
diego
parents: 12459
diff changeset
962 extlist = XListExtensions (dp, &n);
12286
b52e831261b1 support for ATI fireglx
alex
parents: 12072
diff changeset
963 XCloseDisplay (dp);
b52e831261b1 support for ATI fireglx
alex
parents: 12072
diff changeset
964 if (extlist) {
b52e831261b1 support for ATI fireglx
alex
parents: 12072
diff changeset
965 int i;
b52e831261b1 support for ATI fireglx
alex
parents: 12072
diff changeset
966 int ext_fgl = 0, ext_fglrx = 0;
b52e831261b1 support for ATI fireglx
alex
parents: 12072
diff changeset
967 for (i = 0; i < n; i++) {
b52e831261b1 support for ATI fireglx
alex
parents: 12072
diff changeset
968 if (!strcmp(extlist[i], "ATIFGLEXTENSION")) ext_fgl = 1;
b52e831261b1 support for ATI fireglx
alex
parents: 12072
diff changeset
969 if (!strcmp(extlist[i], "ATIFGLRXDRI")) ext_fglrx = 1;
b52e831261b1 support for ATI fireglx
alex
parents: 12072
diff changeset
970 }
b52e831261b1 support for ATI fireglx
alex
parents: 12072
diff changeset
971 if (ext_fgl) {
b52e831261b1 support for ATI fireglx
alex
parents: 12072
diff changeset
972 printf(RADEON_MSG" ATI FireGl driver detected");
b52e831261b1 support for ATI fireglx
alex
parents: 12072
diff changeset
973 firegl_shift = 0x500000;
b52e831261b1 support for ATI fireglx
alex
parents: 12072
diff changeset
974 if (!ext_fglrx) {
b52e831261b1 support for ATI fireglx
alex
parents: 12072
diff changeset
975 printf(", but DRI seems not to be activated\n");
b52e831261b1 support for ATI fireglx
alex
parents: 12072
diff changeset
976 printf(RADEON_MSG" Output may not work correctly, check your DRI configuration!");
b52e831261b1 support for ATI fireglx
alex
parents: 12072
diff changeset
977 }
b52e831261b1 support for ATI fireglx
alex
parents: 12072
diff changeset
978 printf("\n");
b52e831261b1 support for ATI fireglx
alex
parents: 12072
diff changeset
979 }
b52e831261b1 support for ATI fireglx
alex
parents: 12072
diff changeset
980 }
b52e831261b1 support for ATI fireglx
alex
parents: 12072
diff changeset
981 }
b52e831261b1 support for ATI fireglx
alex
parents: 12072
diff changeset
982 #endif
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
983
4191
62a6135d090e + new features and possibility
nick
parents: 4134
diff changeset
984 int vixProbe( int verbose,int force )
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
985 {
872781fef1b3 preliminary version
nick
parents:
diff changeset
986 pciinfo_t lst[MAX_PCI_DEVICES];
872781fef1b3 preliminary version
nick
parents:
diff changeset
987 unsigned i,num_pci;
872781fef1b3 preliminary version
nick
parents:
diff changeset
988 int err;
4030
922241968c63 Embedding vidix
nick
parents: 4015
diff changeset
989 __verbose = verbose;
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
990 err = pci_scan(lst,&num_pci);
872781fef1b3 preliminary version
nick
parents:
diff changeset
991 if(err)
872781fef1b3 preliminary version
nick
parents:
diff changeset
992 {
11678
972d1998bde9 occured --> occurred typo patch by Clinton Roy <croy@dstc.edu.au>
diego
parents: 11658
diff changeset
993 printf(RADEON_MSG" Error occurred during pci scan: %s\n",strerror(err));
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
994 return err;
872781fef1b3 preliminary version
nick
parents:
diff changeset
995 }
872781fef1b3 preliminary version
nick
parents:
diff changeset
996 else
872781fef1b3 preliminary version
nick
parents:
diff changeset
997 {
872781fef1b3 preliminary version
nick
parents:
diff changeset
998 err = ENXIO;
872781fef1b3 preliminary version
nick
parents:
diff changeset
999 for(i=0;i<num_pci;i++)
872781fef1b3 preliminary version
nick
parents:
diff changeset
1000 {
4107
cf1d2f965867 Changes due new gawk generator
nick
parents: 4070
diff changeset
1001 if(lst[i].vendor == VENDOR_ATI)
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1002 {
872781fef1b3 preliminary version
nick
parents:
diff changeset
1003 int idx;
4191
62a6135d090e + new features and possibility
nick
parents: 4134
diff changeset
1004 const char *dname;
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1005 idx = find_chip(lst[i].device);
4191
62a6135d090e + new features and possibility
nick
parents: 4134
diff changeset
1006 if(idx == -1 && force == PROBE_NORMAL) continue;
62a6135d090e + new features and possibility
nick
parents: 4134
diff changeset
1007 dname = pci_device_name(VENDOR_ATI,lst[i].device);
62a6135d090e + new features and possibility
nick
parents: 4134
diff changeset
1008 dname = dname ? dname : "Unknown chip";
62a6135d090e + new features and possibility
nick
parents: 4134
diff changeset
1009 printf(RADEON_MSG" Found chip: %s\n",dname);
21801
f4c52a9738c1 fix detection of rage128/radeon using vidix driver on powerpc (which seems to keep them disabled), no impact on other archs
ben
parents: 21798
diff changeset
1010 #if 0
9767
f6d2772efca3 Ignore disabled cards. (Jon Burgess <jburgess@uklinux.net>)
ranma
parents: 9544
diff changeset
1011 if ((lst[i].command & PCI_COMMAND_IO) == 0)
f6d2772efca3 Ignore disabled cards. (Jon Burgess <jburgess@uklinux.net>)
ranma
parents: 9544
diff changeset
1012 {
f6d2772efca3 Ignore disabled cards. (Jon Burgess <jburgess@uklinux.net>)
ranma
parents: 9544
diff changeset
1013 printf("[radeon] Device is disabled, ignoring\n");
f6d2772efca3 Ignore disabled cards. (Jon Burgess <jburgess@uklinux.net>)
ranma
parents: 9544
diff changeset
1014 continue;
f6d2772efca3 Ignore disabled cards. (Jon Burgess <jburgess@uklinux.net>)
ranma
parents: 9544
diff changeset
1015 }
21801
f4c52a9738c1 fix detection of rage128/radeon using vidix driver on powerpc (which seems to keep them disabled), no impact on other archs
ben
parents: 21798
diff changeset
1016 #endif
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1017 #ifndef RAGE128
4191
62a6135d090e + new features and possibility
nick
parents: 4134
diff changeset
1018 if(idx != -1)
12286
b52e831261b1 support for ATI fireglx
alex
parents: 12072
diff changeset
1019 #ifdef HAVE_X11
b52e831261b1 support for ATI fireglx
alex
parents: 12072
diff changeset
1020 probe_fireGL_driver();
b52e831261b1 support for ATI fireglx
alex
parents: 12072
diff changeset
1021 #endif
8855
6787d02e45aa Update card (chip family) detection (from mplayerxp)
arpi
parents: 8854
diff changeset
1022 {
8876
026ed72206ba patch which removes the rage_ckey_model fix and updates
arpi
parents: 8859
diff changeset
1023 switch(ati_card_ids[idx]) {
026ed72206ba patch which removes the rage_ckey_model fix and updates
arpi
parents: 8859
diff changeset
1024 /* Original radeon */
026ed72206ba patch which removes the rage_ckey_model fix and updates
arpi
parents: 8859
diff changeset
1025 case DEVICE_ATI_RADEON_R100_QD:
026ed72206ba patch which removes the rage_ckey_model fix and updates
arpi
parents: 8859
diff changeset
1026 case DEVICE_ATI_RADEON_R100_QE:
026ed72206ba patch which removes the rage_ckey_model fix and updates
arpi
parents: 8859
diff changeset
1027 case DEVICE_ATI_RADEON_R100_QF:
026ed72206ba patch which removes the rage_ckey_model fix and updates
arpi
parents: 8859
diff changeset
1028 case DEVICE_ATI_RADEON_R100_QG:
026ed72206ba patch which removes the rage_ckey_model fix and updates
arpi
parents: 8859
diff changeset
1029 RadeonFamily = 100;
026ed72206ba patch which removes the rage_ckey_model fix and updates
arpi
parents: 8859
diff changeset
1030 break;
026ed72206ba patch which removes the rage_ckey_model fix and updates
arpi
parents: 8859
diff changeset
1031
026ed72206ba patch which removes the rage_ckey_model fix and updates
arpi
parents: 8859
diff changeset
1032 /* Radeon VE / Radeon Mobility */
026ed72206ba patch which removes the rage_ckey_model fix and updates
arpi
parents: 8859
diff changeset
1033 case DEVICE_ATI_RADEON_VE_QY:
026ed72206ba patch which removes the rage_ckey_model fix and updates
arpi
parents: 8859
diff changeset
1034 case DEVICE_ATI_RADEON_VE_QZ:
026ed72206ba patch which removes the rage_ckey_model fix and updates
arpi
parents: 8859
diff changeset
1035 case DEVICE_ATI_RADEON_MOBILITY_M6:
026ed72206ba patch which removes the rage_ckey_model fix and updates
arpi
parents: 8859
diff changeset
1036 case DEVICE_ATI_RADEON_MOBILITY_M62:
10332
dd748f428d05 radeon mobility u1 support
alex
parents: 9892
diff changeset
1037 case DEVICE_ATI_RADEON_MOBILITY_U1:
8876
026ed72206ba patch which removes the rage_ckey_model fix and updates
arpi
parents: 8859
diff changeset
1038 RadeonFamily = 120;
026ed72206ba patch which removes the rage_ckey_model fix and updates
arpi
parents: 8859
diff changeset
1039 break;
026ed72206ba patch which removes the rage_ckey_model fix and updates
arpi
parents: 8859
diff changeset
1040
026ed72206ba patch which removes the rage_ckey_model fix and updates
arpi
parents: 8859
diff changeset
1041 /* Radeon 7500 / Radeon Mobility 7500 */
026ed72206ba patch which removes the rage_ckey_model fix and updates
arpi
parents: 8859
diff changeset
1042 case DEVICE_ATI_RADEON_RV200_QW:
026ed72206ba patch which removes the rage_ckey_model fix and updates
arpi
parents: 8859
diff changeset
1043 case DEVICE_ATI_RADEON_RV200_QX:
026ed72206ba patch which removes the rage_ckey_model fix and updates
arpi
parents: 8859
diff changeset
1044 case DEVICE_ATI_RADEON_MOBILITY_M7:
026ed72206ba patch which removes the rage_ckey_model fix and updates
arpi
parents: 8859
diff changeset
1045 case DEVICE_ATI_RADEON_MOBILITY_M72:
026ed72206ba patch which removes the rage_ckey_model fix and updates
arpi
parents: 8859
diff changeset
1046 RadeonFamily = 150;
026ed72206ba patch which removes the rage_ckey_model fix and updates
arpi
parents: 8859
diff changeset
1047 break;
026ed72206ba patch which removes the rage_ckey_model fix and updates
arpi
parents: 8859
diff changeset
1048
026ed72206ba patch which removes the rage_ckey_model fix and updates
arpi
parents: 8859
diff changeset
1049 /* Radeon 8500 */
026ed72206ba patch which removes the rage_ckey_model fix and updates
arpi
parents: 8859
diff changeset
1050 case DEVICE_ATI_RADEON_R200_BB:
026ed72206ba patch which removes the rage_ckey_model fix and updates
arpi
parents: 8859
diff changeset
1051 case DEVICE_ATI_RADEON_R200_QH:
026ed72206ba patch which removes the rage_ckey_model fix and updates
arpi
parents: 8859
diff changeset
1052 case DEVICE_ATI_RADEON_R200_QI:
026ed72206ba patch which removes the rage_ckey_model fix and updates
arpi
parents: 8859
diff changeset
1053 case DEVICE_ATI_RADEON_R200_QJ:
026ed72206ba patch which removes the rage_ckey_model fix and updates
arpi
parents: 8859
diff changeset
1054 case DEVICE_ATI_RADEON_R200_QK:
026ed72206ba patch which removes the rage_ckey_model fix and updates
arpi
parents: 8859
diff changeset
1055 case DEVICE_ATI_RADEON_R200_QL:
14195
1061d4dea7b7 Radeon R200 QM (Radeon 9100) support patch by Simone <beniamino.scanzoni at fastwebnet.it>
faust3
parents: 13594
diff changeset
1056 case DEVICE_ATI_RADEON_R200_QM:
8876
026ed72206ba patch which removes the rage_ckey_model fix and updates
arpi
parents: 8859
diff changeset
1057 case DEVICE_ATI_RADEON_R200_QH2:
026ed72206ba patch which removes the rage_ckey_model fix and updates
arpi
parents: 8859
diff changeset
1058 case DEVICE_ATI_RADEON_R200_QI2:
026ed72206ba patch which removes the rage_ckey_model fix and updates
arpi
parents: 8859
diff changeset
1059 case DEVICE_ATI_RADEON_R200_QJ2:
026ed72206ba patch which removes the rage_ckey_model fix and updates
arpi
parents: 8859
diff changeset
1060 case DEVICE_ATI_RADEON_R200_QK2:
026ed72206ba patch which removes the rage_ckey_model fix and updates
arpi
parents: 8859
diff changeset
1061 RadeonFamily = 200;
026ed72206ba patch which removes the rage_ckey_model fix and updates
arpi
parents: 8859
diff changeset
1062 break;
026ed72206ba patch which removes the rage_ckey_model fix and updates
arpi
parents: 8859
diff changeset
1063
026ed72206ba patch which removes the rage_ckey_model fix and updates
arpi
parents: 8859
diff changeset
1064 /* Radeon 9000 */
026ed72206ba patch which removes the rage_ckey_model fix and updates
arpi
parents: 8859
diff changeset
1065 case DEVICE_ATI_RADEON_R250_ID:
026ed72206ba patch which removes the rage_ckey_model fix and updates
arpi
parents: 8859
diff changeset
1066 case DEVICE_ATI_RADEON_R250_IE:
026ed72206ba patch which removes the rage_ckey_model fix and updates
arpi
parents: 8859
diff changeset
1067 case DEVICE_ATI_RADEON_R250_IF:
026ed72206ba patch which removes the rage_ckey_model fix and updates
arpi
parents: 8859
diff changeset
1068 case DEVICE_ATI_RADEON_R250_IG:
026ed72206ba patch which removes the rage_ckey_model fix and updates
arpi
parents: 8859
diff changeset
1069 case DEVICE_ATI_RADEON_R250_LD:
026ed72206ba patch which removes the rage_ckey_model fix and updates
arpi
parents: 8859
diff changeset
1070 case DEVICE_ATI_RADEON_R250_LE:
026ed72206ba patch which removes the rage_ckey_model fix and updates
arpi
parents: 8859
diff changeset
1071 case DEVICE_ATI_RADEON_R250_LF:
026ed72206ba patch which removes the rage_ckey_model fix and updates
arpi
parents: 8859
diff changeset
1072 case DEVICE_ATI_RADEON_R250_LG:
12070
070fc453a20b support for Radeon 9200 based video boards patch by Benjamin Zores <ben at tutuxclan.org>
faust3
parents: 12060
diff changeset
1073 case DEVICE_ATI_RV250_5C61_RADEON:
070fc453a20b support for Radeon 9200 based video boards patch by Benjamin Zores <ben at tutuxclan.org>
faust3
parents: 12060
diff changeset
1074 case DEVICE_ATI_RV250_5C63_RADEON:
8876
026ed72206ba patch which removes the rage_ckey_model fix and updates
arpi
parents: 8859
diff changeset
1075 RadeonFamily = 250;
026ed72206ba patch which removes the rage_ckey_model fix and updates
arpi
parents: 8859
diff changeset
1076 break;
026ed72206ba patch which removes the rage_ckey_model fix and updates
arpi
parents: 8859
diff changeset
1077
12070
070fc453a20b support for Radeon 9200 based video boards patch by Benjamin Zores <ben at tutuxclan.org>
faust3
parents: 12060
diff changeset
1078 /* Radeon 9200 */
070fc453a20b support for Radeon 9200 based video boards patch by Benjamin Zores <ben at tutuxclan.org>
faust3
parents: 12060
diff changeset
1079 case DEVICE_ATI_RV280_RADEON_9200:
070fc453a20b support for Radeon 9200 based video boards patch by Benjamin Zores <ben at tutuxclan.org>
faust3
parents: 12060
diff changeset
1080 case DEVICE_ATI_RV280_RADEON_92002:
070fc453a20b support for Radeon 9200 based video boards patch by Benjamin Zores <ben at tutuxclan.org>
faust3
parents: 12060
diff changeset
1081 case DEVICE_ATI_RV280_RADEON_92003:
070fc453a20b support for Radeon 9200 based video boards patch by Benjamin Zores <ben at tutuxclan.org>
faust3
parents: 12060
diff changeset
1082 case DEVICE_ATI_RV280_RADEON_92004:
070fc453a20b support for Radeon 9200 based video boards patch by Benjamin Zores <ben at tutuxclan.org>
faust3
parents: 12060
diff changeset
1083 case DEVICE_ATI_RV280_RADEON_92005:
15108
16bc84938c4b add support for one more radeon 9200 model (the one included in the Mac Mini)
aurel
parents: 14363
diff changeset
1084 case DEVICE_ATI_RV280_RADEON_92006:
12070
070fc453a20b support for Radeon 9200 based video boards patch by Benjamin Zores <ben at tutuxclan.org>
faust3
parents: 12060
diff changeset
1085 RadeonFamily = 280;
070fc453a20b support for Radeon 9200 based video boards patch by Benjamin Zores <ben at tutuxclan.org>
faust3
parents: 12060
diff changeset
1086 break;
070fc453a20b support for Radeon 9200 based video boards patch by Benjamin Zores <ben at tutuxclan.org>
faust3
parents: 12060
diff changeset
1087
8876
026ed72206ba patch which removes the rage_ckey_model fix and updates
arpi
parents: 8859
diff changeset
1088 /* Radeon 9700 */
026ed72206ba patch which removes the rage_ckey_model fix and updates
arpi
parents: 8859
diff changeset
1089 case DEVICE_ATI_RADEON_R300_ND:
026ed72206ba patch which removes the rage_ckey_model fix and updates
arpi
parents: 8859
diff changeset
1090 case DEVICE_ATI_RADEON_R300_NE:
026ed72206ba patch which removes the rage_ckey_model fix and updates
arpi
parents: 8859
diff changeset
1091 case DEVICE_ATI_RADEON_R300_NF:
026ed72206ba patch which removes the rage_ckey_model fix and updates
arpi
parents: 8859
diff changeset
1092 case DEVICE_ATI_RADEON_R300_NG:
12361
a84160d660af support for a few more radeons patch by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents: 12286
diff changeset
1093 case DEVICE_ATI_RADEON_R300_AE:
a84160d660af support for a few more radeons patch by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents: 12286
diff changeset
1094 case DEVICE_ATI_RADEON_R300_AF:
8876
026ed72206ba patch which removes the rage_ckey_model fix and updates
arpi
parents: 8859
diff changeset
1095 RadeonFamily = 300;
026ed72206ba patch which removes the rage_ckey_model fix and updates
arpi
parents: 8859
diff changeset
1096 break;
11371
9cd1546f26ea patch by Vladimir Mosgalin <mosgalin@VM10124.spb.edu>
attila
parents: 10332
diff changeset
1097
11658
73203cca1884 Makes radeon_vid work with the Radeon 9600 Pro card.
wight
parents: 11371
diff changeset
1098 /* Radeon 9600/9800 */
15920
e5bc2812c4a0 radeon x300 support patch by Christophe Preaud <cpreaud at free.fr>
faust3
parents: 15109
diff changeset
1099 case DEVICE_ATI_RV370_5B60_RADEON:
11658
73203cca1884 Makes radeon_vid work with the Radeon 9600 Pro card.
wight
parents: 11371
diff changeset
1100 case DEVICE_ATI_RADEON_RV350_AP:
21798
31404b462bd5 support for vidix on ATI Radeon 9600SE cards
ben
parents: 21507
diff changeset
1101 case DEVICE_ATI_RADEON_RV350_AQ:
12361
a84160d660af support for a few more radeons patch by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents: 12286
diff changeset
1102 case DEVICE_ATI_RADEON_RV350_AR:
17350
104c6ac0784d support for Radeon 9550
diego
parents: 15920
diff changeset
1103 case DEVICE_ATI_RADEON_RV350_BK:
11371
9cd1546f26ea patch by Vladimir Mosgalin <mosgalin@VM10124.spb.edu>
attila
parents: 10332
diff changeset
1104 case DEVICE_ATI_RADEON_R350_NH:
12454
83a18b230e8c Add support for a few more Radeons, patch by Nyk Tarr.
diego
parents: 12361
diff changeset
1105 case DEVICE_ATI_RADEON_R350_AH:
83a18b230e8c Add support for a few more Radeons, patch by Nyk Tarr.
diego
parents: 12361
diff changeset
1106 case DEVICE_ATI_RADEON_R350_AI:
12459
0dfc2f1775a9 correct model number
diego
parents: 12454
diff changeset
1107 case DEVICE_ATI_RADEON_R360_NJ:
12060
b245a429c896 Mobility Radeon 9600/9700 support
faust3
parents: 11678
diff changeset
1108 case DEVICE_ATI_RV350_MOBILITY_RADEON:
b245a429c896 Mobility Radeon 9600/9700 support
faust3
parents: 11678
diff changeset
1109 case DEVICE_ATI_RV350_MOBILITY_RADEON2:
11371
9cd1546f26ea patch by Vladimir Mosgalin <mosgalin@VM10124.spb.edu>
attila
parents: 10332
diff changeset
1110 RadeonFamily = 350;
9cd1546f26ea patch by Vladimir Mosgalin <mosgalin@VM10124.spb.edu>
attila
parents: 10332
diff changeset
1111 break;
9cd1546f26ea patch by Vladimir Mosgalin <mosgalin@VM10124.spb.edu>
attila
parents: 10332
diff changeset
1112
8876
026ed72206ba patch which removes the rage_ckey_model fix and updates
arpi
parents: 8859
diff changeset
1113 default:
026ed72206ba patch which removes the rage_ckey_model fix and updates
arpi
parents: 8859
diff changeset
1114 break;
026ed72206ba patch which removes the rage_ckey_model fix and updates
arpi
parents: 8859
diff changeset
1115 }
8855
6787d02e45aa Update card (chip family) detection (from mplayerxp)
arpi
parents: 8854
diff changeset
1116 }
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1117 #endif
4193
ae28646a3568 More messages on forcing
nick
parents: 4191
diff changeset
1118 if(force > PROBE_NORMAL)
ae28646a3568 More messages on forcing
nick
parents: 4191
diff changeset
1119 {
ae28646a3568 More messages on forcing
nick
parents: 4191
diff changeset
1120 printf(RADEON_MSG" Driver was forced. Was found %sknown chip\n",idx == -1 ? "un" : "");
ae28646a3568 More messages on forcing
nick
parents: 4191
diff changeset
1121 if(idx == -1)
ae28646a3568 More messages on forcing
nick
parents: 4191
diff changeset
1122 #ifdef RAGE128
4373
4f36681c95f8 gcc-3.0.3 compilation fixing
nick
parents: 4327
diff changeset
1123 printf(RADEON_MSG" Assuming it as Rage128\n");
4193
ae28646a3568 More messages on forcing
nick
parents: 4191
diff changeset
1124 #else
4373
4f36681c95f8 gcc-3.0.3 compilation fixing
nick
parents: 4327
diff changeset
1125 printf(RADEON_MSG" Assuming it as Radeon1\n");
4193
ae28646a3568 More messages on forcing
nick
parents: 4191
diff changeset
1126 #endif
ae28646a3568 More messages on forcing
nick
parents: 4191
diff changeset
1127 }
4191
62a6135d090e + new features and possibility
nick
parents: 4134
diff changeset
1128 def_cap.device_id = lst[i].device;
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1129 err = 0;
872781fef1b3 preliminary version
nick
parents:
diff changeset
1130 memcpy(&pci_info,&lst[i],sizeof(pciinfo_t));
872781fef1b3 preliminary version
nick
parents:
diff changeset
1131 probed=1;
872781fef1b3 preliminary version
nick
parents:
diff changeset
1132 break;
872781fef1b3 preliminary version
nick
parents:
diff changeset
1133 }
872781fef1b3 preliminary version
nick
parents:
diff changeset
1134 }
872781fef1b3 preliminary version
nick
parents:
diff changeset
1135 }
872781fef1b3 preliminary version
nick
parents:
diff changeset
1136 if(err && verbose) printf(RADEON_MSG" Can't find chip\n");
872781fef1b3 preliminary version
nick
parents:
diff changeset
1137 return err;
872781fef1b3 preliminary version
nick
parents:
diff changeset
1138 }
872781fef1b3 preliminary version
nick
parents:
diff changeset
1139
6564
652ada9f9b66 remove colorkeying if destroying the driver - fixes some bugs
alex
parents: 6483
diff changeset
1140 static void radeon_vid_dump_regs( void ); /* forward declaration */
652ada9f9b66 remove colorkeying if destroying the driver - fixes some bugs
alex
parents: 6483
diff changeset
1141
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1142 int vixInit( void )
872781fef1b3 preliminary version
nick
parents:
diff changeset
1143 {
4477
dc9d7686ea4a using MTRR
nick
parents: 4458
diff changeset
1144 int err;
4012
01092e2aea16 IO space is memory mapped (no in(out)port required)
nick
parents: 4009
diff changeset
1145 if(!probed)
01092e2aea16 IO space is memory mapped (no in(out)port required)
nick
parents: 4009
diff changeset
1146 {
01092e2aea16 IO space is memory mapped (no in(out)port required)
nick
parents: 4009
diff changeset
1147 printf(RADEON_MSG" Driver was not probed but is being initializing\n");
01092e2aea16 IO space is memory mapped (no in(out)port required)
nick
parents: 4009
diff changeset
1148 return EINTR;
01092e2aea16 IO space is memory mapped (no in(out)port required)
nick
parents: 4009
diff changeset
1149 }
01092e2aea16 IO space is memory mapped (no in(out)port required)
nick
parents: 4009
diff changeset
1150 if((radeon_mmio_base = map_phys_mem(pci_info.base2,0xFFFF))==(void *)-1) return ENOMEM;
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1151 radeon_ram_size = INREG(CONFIG_MEMSIZE);
872781fef1b3 preliminary version
nick
parents:
diff changeset
1152 /* mem size is bits [28:0], mask off the rest. Range: from 1Mb up to 512 Mb */
872781fef1b3 preliminary version
nick
parents:
diff changeset
1153 radeon_ram_size &= CONFIG_MEMSIZE_MASK;
8942
f381dbfd277e M6 bug workaround by Hanno Bock <hanno@gmx.de>
alex
parents: 8876
diff changeset
1154 #ifdef RADEON
f381dbfd277e M6 bug workaround by Hanno Bock <hanno@gmx.de>
alex
parents: 8876
diff changeset
1155 /* according to XFree86 4.2.0, some production M6's return 0 for 8MB */
f381dbfd277e M6 bug workaround by Hanno Bock <hanno@gmx.de>
alex
parents: 8876
diff changeset
1156 if (radeon_ram_size == 0 &&
f381dbfd277e M6 bug workaround by Hanno Bock <hanno@gmx.de>
alex
parents: 8876
diff changeset
1157 (def_cap.device_id == DEVICE_ATI_RADEON_MOBILITY_M6 ||
f381dbfd277e M6 bug workaround by Hanno Bock <hanno@gmx.de>
alex
parents: 8876
diff changeset
1158 def_cap.device_id == DEVICE_ATI_RADEON_MOBILITY_M62))
f381dbfd277e M6 bug workaround by Hanno Bock <hanno@gmx.de>
alex
parents: 8876
diff changeset
1159 {
f381dbfd277e M6 bug workaround by Hanno Bock <hanno@gmx.de>
alex
parents: 8876
diff changeset
1160 printf(RADEON_MSG" Workarounding buggy Radeon Mobility M6 (0 vs. 8MB ram)\n");
f381dbfd277e M6 bug workaround by Hanno Bock <hanno@gmx.de>
alex
parents: 8876
diff changeset
1161 radeon_ram_size = 8192*1024;
f381dbfd277e M6 bug workaround by Hanno Bock <hanno@gmx.de>
alex
parents: 8876
diff changeset
1162 }
9240
4898cfdf582a The patch enables the fix for rage128_vid as well as radeon_vid, and looks for the
arpi
parents: 9044
diff changeset
1163 #else
4898cfdf582a The patch enables the fix for rage128_vid as well as radeon_vid, and looks for the
arpi
parents: 9044
diff changeset
1164 /* Rage Mobility (rage128) also has memsize bug */
4898cfdf582a The patch enables the fix for rage128_vid as well as radeon_vid, and looks for the
arpi
parents: 9044
diff changeset
1165 if (radeon_ram_size == 0 &&
4898cfdf582a The patch enables the fix for rage128_vid as well as radeon_vid, and looks for the
arpi
parents: 9044
diff changeset
1166 (def_cap.device_id == DEVICE_ATI_RAGE_MOBILITY_M3 ||
15109
2a5d9229b60d override memory size detection bug on rage 128 RL/VR
aurel
parents: 15108
diff changeset
1167 def_cap.device_id == DEVICE_ATI_RAGE_128_RL_VR ||
9240
4898cfdf582a The patch enables the fix for rage128_vid as well as radeon_vid, and looks for the
arpi
parents: 9044
diff changeset
1168 def_cap.device_id == DEVICE_ATI_RAGE_MOBILITY_M32))
4898cfdf582a The patch enables the fix for rage128_vid as well as radeon_vid, and looks for the
arpi
parents: 9044
diff changeset
1169 {
4898cfdf582a The patch enables the fix for rage128_vid as well as radeon_vid, and looks for the
arpi
parents: 9044
diff changeset
1170 printf(RADEON_MSG" Workarounding buggy Rage Mobility M3 (0 vs. 8MB ram)\n");
4898cfdf582a The patch enables the fix for rage128_vid as well as radeon_vid, and looks for the
arpi
parents: 9044
diff changeset
1171 radeon_ram_size = 8192*1024;
4898cfdf582a The patch enables the fix for rage128_vid as well as radeon_vid, and looks for the
arpi
parents: 9044
diff changeset
1172 }
8942
f381dbfd277e M6 bug workaround by Hanno Bock <hanno@gmx.de>
alex
parents: 8876
diff changeset
1173 #endif
19953
1cf4e1373d4e move video memory info printf before the WIN32 workaround
faust3
parents: 19066
diff changeset
1174 printf(RADEON_MSG" Video memory = %uMb\n",radeon_ram_size/0x100000);
12072
be548f4433b3 temporary workaround to make it work on windows
faust3
parents: 12070
diff changeset
1175 #ifdef WIN32
19953
1cf4e1373d4e move video memory info printf before the WIN32 workaround
faust3
parents: 19066
diff changeset
1176 //mapping large areas of video ram will fail on windows
12072
be548f4433b3 temporary workaround to make it work on windows
faust3
parents: 12070
diff changeset
1177 if(radeon_ram_size > 16*1024*1024)radeon_ram_size=16*1024*1024;
be548f4433b3 temporary workaround to make it work on windows
faust3
parents: 12070
diff changeset
1178 #endif
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1179 if((radeon_mem_base = map_phys_mem(pci_info.base0,radeon_ram_size))==(void *)-1) return ENOMEM;
4070
b61ba6c256dd Minor interface changes: color and video keys are moved out from playback configuring
nick
parents: 4038
diff changeset
1180 memset(&besr,0,sizeof(bes_registers_t));
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1181 radeon_vid_make_default();
4477
dc9d7686ea4a using MTRR
nick
parents: 4458
diff changeset
1182 err = mtrr_set_type(pci_info.base0,radeon_ram_size,MTRR_TYPE_WRCOMB);
dc9d7686ea4a using MTRR
nick
parents: 4458
diff changeset
1183 if(!err) printf(RADEON_MSG" Set write-combining type of video memory\n");
8521
8996a4599a41 the long awaited pink screen + shift fix for radeon, based on patch by Svante Signell <svante.signell@telia.com>, Carl (mlist.mplayer.users@urs.us) and Nick Kurshve <nickolsk@yandex.ru>
alex
parents: 8238
diff changeset
1184
8553
d952b097c720 correctly save and restore colorkey settings (based on patch by Svante Signell <svante.signell@telia.com>)
alex
parents: 8521
diff changeset
1185 radeon_fifo_wait(3);
d952b097c720 correctly save and restore colorkey settings (based on patch by Svante Signell <svante.signell@telia.com>)
alex
parents: 8521
diff changeset
1186 SAVED_OV0_GRAPHICS_KEY_CLR = INREG(OV0_GRAPHICS_KEY_CLR);
d952b097c720 correctly save and restore colorkey settings (based on patch by Svante Signell <svante.signell@telia.com>)
alex
parents: 8521
diff changeset
1187 SAVED_OV0_GRAPHICS_KEY_MSK = INREG(OV0_GRAPHICS_KEY_MSK);
d952b097c720 correctly save and restore colorkey settings (based on patch by Svante Signell <svante.signell@telia.com>)
alex
parents: 8521
diff changeset
1188 SAVED_OV0_VID_KEY_CLR = INREG(OV0_VID_KEY_CLR);
d952b097c720 correctly save and restore colorkey settings (based on patch by Svante Signell <svante.signell@telia.com>)
alex
parents: 8521
diff changeset
1189 SAVED_OV0_VID_KEY_MSK = INREG(OV0_VID_KEY_MSK);
d952b097c720 correctly save and restore colorkey settings (based on patch by Svante Signell <svante.signell@telia.com>)
alex
parents: 8521
diff changeset
1190 SAVED_OV0_KEY_CNTL = INREG(OV0_KEY_CNTL);
d952b097c720 correctly save and restore colorkey settings (based on patch by Svante Signell <svante.signell@telia.com>)
alex
parents: 8521
diff changeset
1191 printf(RADEON_MSG" Saved overlay colorkey settings\n");
d952b097c720 correctly save and restore colorkey settings (based on patch by Svante Signell <svante.signell@telia.com>)
alex
parents: 8521
diff changeset
1192
8521
8996a4599a41 the long awaited pink screen + shift fix for radeon, based on patch by Svante Signell <svante.signell@telia.com>, Carl (mlist.mplayer.users@urs.us) and Nick Kurshve <nickolsk@yandex.ru>
alex
parents: 8238
diff changeset
1193 #ifdef RADEON
8859
fd13e4c4f323 Set is_shift_required according to RadeonFamily
arpi
parents: 8858
diff changeset
1194 switch(RadeonFamily)
fd13e4c4f323 Set is_shift_required according to RadeonFamily
arpi
parents: 8858
diff changeset
1195 {
fd13e4c4f323 Set is_shift_required according to RadeonFamily
arpi
parents: 8858
diff changeset
1196 case 100:
8876
026ed72206ba patch which removes the rage_ckey_model fix and updates
arpi
parents: 8859
diff changeset
1197 case 120:
8859
fd13e4c4f323 Set is_shift_required according to RadeonFamily
arpi
parents: 8858
diff changeset
1198 case 150:
fd13e4c4f323 Set is_shift_required according to RadeonFamily
arpi
parents: 8858
diff changeset
1199 case 250:
12642
9d869614f4bb green stripe fix by Jan Kanty Palus <atler@o2.pl>
alex
parents: 12466
diff changeset
1200 case 280:
8859
fd13e4c4f323 Set is_shift_required according to RadeonFamily
arpi
parents: 8858
diff changeset
1201 is_shift_required=1;
fd13e4c4f323 Set is_shift_required according to RadeonFamily
arpi
parents: 8858
diff changeset
1202 break;
fd13e4c4f323 Set is_shift_required according to RadeonFamily
arpi
parents: 8858
diff changeset
1203 default:
fd13e4c4f323 Set is_shift_required according to RadeonFamily
arpi
parents: 8858
diff changeset
1204 break;
fd13e4c4f323 Set is_shift_required according to RadeonFamily
arpi
parents: 8858
diff changeset
1205 }
8521
8996a4599a41 the long awaited pink screen + shift fix for radeon, based on patch by Svante Signell <svante.signell@telia.com>, Carl (mlist.mplayer.users@urs.us) and Nick Kurshve <nickolsk@yandex.ru>
alex
parents: 8238
diff changeset
1206 #endif
8996a4599a41 the long awaited pink screen + shift fix for radeon, based on patch by Svante Signell <svante.signell@telia.com>, Carl (mlist.mplayer.users@urs.us) and Nick Kurshve <nickolsk@yandex.ru>
alex
parents: 8238
diff changeset
1207
9044
59b1bd7ccae1 hack to get rage128 working on ppc-g3
alex
parents: 8942
diff changeset
1208 /* XXX: hack, but it works for me (tm) */
13167
a6f958139ab8 Rough but working bigendian support for radeon cards, patch by Luca Barbato <lu_zero at gentoo.org>
faust3
parents: 12642
diff changeset
1209 #ifdef WORDS_BIGENDIAN
a6f958139ab8 Rough but working bigendian support for radeon cards, patch by Luca Barbato <lu_zero at gentoo.org>
faust3
parents: 12642
diff changeset
1210 #if defined(RAGE128)
9044
59b1bd7ccae1 hack to get rage128 working on ppc-g3
alex
parents: 8942
diff changeset
1211 /* code from gatos */
59b1bd7ccae1 hack to get rage128 working on ppc-g3
alex
parents: 8942
diff changeset
1212 {
59b1bd7ccae1 hack to get rage128 working on ppc-g3
alex
parents: 8942
diff changeset
1213 SAVED_CONFIG_CNTL = INREG(CONFIG_CNTL);
59b1bd7ccae1 hack to get rage128 working on ppc-g3
alex
parents: 8942
diff changeset
1214 OUTREG(CONFIG_CNTL, SAVED_CONFIG_CNTL &
59b1bd7ccae1 hack to get rage128 working on ppc-g3
alex
parents: 8942
diff changeset
1215 ~(APER_0_BIG_ENDIAN_16BPP_SWAP|APER_0_BIG_ENDIAN_32BPP_SWAP));
59b1bd7ccae1 hack to get rage128 working on ppc-g3
alex
parents: 8942
diff changeset
1216
59b1bd7ccae1 hack to get rage128 working on ppc-g3
alex
parents: 8942
diff changeset
1217 // printf("saved: %x, current: %x\n", SAVED_CONFIG_CNTL,
59b1bd7ccae1 hack to get rage128 working on ppc-g3
alex
parents: 8942
diff changeset
1218 // INREG(CONFIG_CNTL));
59b1bd7ccae1 hack to get rage128 working on ppc-g3
alex
parents: 8942
diff changeset
1219 }
13167
a6f958139ab8 Rough but working bigendian support for radeon cards, patch by Luca Barbato <lu_zero at gentoo.org>
faust3
parents: 12642
diff changeset
1220 #else
a6f958139ab8 Rough but working bigendian support for radeon cards, patch by Luca Barbato <lu_zero at gentoo.org>
faust3
parents: 12642
diff changeset
1221 /*code from radeon_video.c*/
a6f958139ab8 Rough but working bigendian support for radeon cards, patch by Luca Barbato <lu_zero at gentoo.org>
faust3
parents: 12642
diff changeset
1222 {
a6f958139ab8 Rough but working bigendian support for radeon cards, patch by Luca Barbato <lu_zero at gentoo.org>
faust3
parents: 12642
diff changeset
1223 SAVED_CONFIG_CNTL = INREG(RADEON_SURFACE_CNTL);
a6f958139ab8 Rough but working bigendian support for radeon cards, patch by Luca Barbato <lu_zero at gentoo.org>
faust3
parents: 12642
diff changeset
1224 /* OUTREG(RADEON_SURFACE_CNTL, (SAVED_CONFIG_CNTL |
a6f958139ab8 Rough but working bigendian support for radeon cards, patch by Luca Barbato <lu_zero at gentoo.org>
faust3
parents: 12642
diff changeset
1225 RADEON_NONSURF_AP0_SWP_32BPP) & ~RADEON_NONSURF_AP0_SWP_16BPP);
a6f958139ab8 Rough but working bigendian support for radeon cards, patch by Luca Barbato <lu_zero at gentoo.org>
faust3
parents: 12642
diff changeset
1226 */
a6f958139ab8 Rough but working bigendian support for radeon cards, patch by Luca Barbato <lu_zero at gentoo.org>
faust3
parents: 12642
diff changeset
1227 OUTREG(RADEON_SURFACE_CNTL, SAVED_CONFIG_CNTL & ~(RADEON_NONSURF_AP0_SWP_32BPP
a6f958139ab8 Rough but working bigendian support for radeon cards, patch by Luca Barbato <lu_zero at gentoo.org>
faust3
parents: 12642
diff changeset
1228 | RADEON_NONSURF_AP0_SWP_16BPP));
a6f958139ab8 Rough but working bigendian support for radeon cards, patch by Luca Barbato <lu_zero at gentoo.org>
faust3
parents: 12642
diff changeset
1229
a6f958139ab8 Rough but working bigendian support for radeon cards, patch by Luca Barbato <lu_zero at gentoo.org>
faust3
parents: 12642
diff changeset
1230 /*
a6f958139ab8 Rough but working bigendian support for radeon cards, patch by Luca Barbato <lu_zero at gentoo.org>
faust3
parents: 12642
diff changeset
1231 OUTREG(RADEON_SURFACE_CNTL, (SAVED_CONFIG_CNTL | RADEON_NONSURF_AP0_SWP_32BPP)
a6f958139ab8 Rough but working bigendian support for radeon cards, patch by Luca Barbato <lu_zero at gentoo.org>
faust3
parents: 12642
diff changeset
1232 & ~RADEON_NONSURF_AP0_SWP_16BPP);
a6f958139ab8 Rough but working bigendian support for radeon cards, patch by Luca Barbato <lu_zero at gentoo.org>
faust3
parents: 12642
diff changeset
1233 */
a6f958139ab8 Rough but working bigendian support for radeon cards, patch by Luca Barbato <lu_zero at gentoo.org>
faust3
parents: 12642
diff changeset
1234 }
a6f958139ab8 Rough but working bigendian support for radeon cards, patch by Luca Barbato <lu_zero at gentoo.org>
faust3
parents: 12642
diff changeset
1235 #endif
9044
59b1bd7ccae1 hack to get rage128 working on ppc-g3
alex
parents: 8942
diff changeset
1236 #endif
59b1bd7ccae1 hack to get rage128 working on ppc-g3
alex
parents: 8942
diff changeset
1237
6564
652ada9f9b66 remove colorkeying if destroying the driver - fixes some bugs
alex
parents: 6483
diff changeset
1238 if(__verbose > 1) radeon_vid_dump_regs();
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1239 return 0;
872781fef1b3 preliminary version
nick
parents:
diff changeset
1240 }
872781fef1b3 preliminary version
nick
parents:
diff changeset
1241
872781fef1b3 preliminary version
nick
parents:
diff changeset
1242 void vixDestroy( void )
872781fef1b3 preliminary version
nick
parents:
diff changeset
1243 {
6564
652ada9f9b66 remove colorkeying if destroying the driver - fixes some bugs
alex
parents: 6483
diff changeset
1244 /* remove colorkeying */
652ada9f9b66 remove colorkeying if destroying the driver - fixes some bugs
alex
parents: 6483
diff changeset
1245 radeon_fifo_wait(3);
8553
d952b097c720 correctly save and restore colorkey settings (based on patch by Svante Signell <svante.signell@telia.com>)
alex
parents: 8521
diff changeset
1246 OUTREG(OV0_GRAPHICS_KEY_CLR, SAVED_OV0_GRAPHICS_KEY_CLR);
d952b097c720 correctly save and restore colorkey settings (based on patch by Svante Signell <svante.signell@telia.com>)
alex
parents: 8521
diff changeset
1247 OUTREG(OV0_GRAPHICS_KEY_MSK, SAVED_OV0_GRAPHICS_KEY_MSK);
d952b097c720 correctly save and restore colorkey settings (based on patch by Svante Signell <svante.signell@telia.com>)
alex
parents: 8521
diff changeset
1248 OUTREG(OV0_VID_KEY_CLR, SAVED_OV0_VID_KEY_CLR);
d952b097c720 correctly save and restore colorkey settings (based on patch by Svante Signell <svante.signell@telia.com>)
alex
parents: 8521
diff changeset
1249 OUTREG(OV0_VID_KEY_MSK, SAVED_OV0_VID_KEY_MSK);
d952b097c720 correctly save and restore colorkey settings (based on patch by Svante Signell <svante.signell@telia.com>)
alex
parents: 8521
diff changeset
1250 OUTREG(OV0_KEY_CNTL, SAVED_OV0_KEY_CNTL);
d952b097c720 correctly save and restore colorkey settings (based on patch by Svante Signell <svante.signell@telia.com>)
alex
parents: 8521
diff changeset
1251 printf(RADEON_MSG" Restored overlay colorkey settings\n");
6564
652ada9f9b66 remove colorkeying if destroying the driver - fixes some bugs
alex
parents: 6483
diff changeset
1252
13167
a6f958139ab8 Rough but working bigendian support for radeon cards, patch by Luca Barbato <lu_zero at gentoo.org>
faust3
parents: 12642
diff changeset
1253 #ifdef WORDS_BIGENDIAN
a6f958139ab8 Rough but working bigendian support for radeon cards, patch by Luca Barbato <lu_zero at gentoo.org>
faust3
parents: 12642
diff changeset
1254 #if defined(RAGE128)
9044
59b1bd7ccae1 hack to get rage128 working on ppc-g3
alex
parents: 8942
diff changeset
1255 OUTREG(CONFIG_CNTL, SAVED_CONFIG_CNTL);
59b1bd7ccae1 hack to get rage128 working on ppc-g3
alex
parents: 8942
diff changeset
1256 // printf("saved: %x, restored: %x\n", SAVED_CONFIG_CNTL,
59b1bd7ccae1 hack to get rage128 working on ppc-g3
alex
parents: 8942
diff changeset
1257 // INREG(CONFIG_CNTL));
13167
a6f958139ab8 Rough but working bigendian support for radeon cards, patch by Luca Barbato <lu_zero at gentoo.org>
faust3
parents: 12642
diff changeset
1258 #else
a6f958139ab8 Rough but working bigendian support for radeon cards, patch by Luca Barbato <lu_zero at gentoo.org>
faust3
parents: 12642
diff changeset
1259 OUTREG(RADEON_SURFACE_CNTL, SAVED_CONFIG_CNTL);
a6f958139ab8 Rough but working bigendian support for radeon cards, patch by Luca Barbato <lu_zero at gentoo.org>
faust3
parents: 12642
diff changeset
1260 #endif
9044
59b1bd7ccae1 hack to get rage128 working on ppc-g3
alex
parents: 8942
diff changeset
1261 #endif
59b1bd7ccae1 hack to get rage128 working on ppc-g3
alex
parents: 8942
diff changeset
1262
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1263 unmap_phys_mem(radeon_mem_base,radeon_ram_size);
4855
f7f847e2d7c2 Minor fixes and probably final fix of vsync
nick
parents: 4689
diff changeset
1264 unmap_phys_mem(radeon_mmio_base,0xFFFF);
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1265 }
872781fef1b3 preliminary version
nick
parents:
diff changeset
1266
872781fef1b3 preliminary version
nick
parents:
diff changeset
1267 int vixGetCapability(vidix_capability_t *to)
872781fef1b3 preliminary version
nick
parents:
diff changeset
1268 {
872781fef1b3 preliminary version
nick
parents:
diff changeset
1269 memcpy(to,&def_cap,sizeof(vidix_capability_t));
872781fef1b3 preliminary version
nick
parents:
diff changeset
1270 return 0;
872781fef1b3 preliminary version
nick
parents:
diff changeset
1271 }
872781fef1b3 preliminary version
nick
parents:
diff changeset
1272
6483
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1273 /*
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1274 Full list of fourcc which are supported by Win2K redeon driver:
6564
652ada9f9b66 remove colorkeying if destroying the driver - fixes some bugs
alex
parents: 6483
diff changeset
1275 YUY2, UYVY, DDES, OGLT, OGL2, OGLS, OGLB, OGNT, OGNZ, OGNS,
6483
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1276 IF09, YVU9, IMC4, M2IA, IYUV, VBID, DXT1, DXT2, DXT3, DXT4, DXT5
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1277 */
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1278 uint32_t supported_fourcc[] =
872781fef1b3 preliminary version
nick
parents:
diff changeset
1279 {
6483
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1280 IMGFMT_Y800, IMGFMT_Y8, IMGFMT_YVU9, IMGFMT_IF09,
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1281 IMGFMT_YV12, IMGFMT_I420, IMGFMT_IYUV,
4455
e23ce822b5de YVYU support (untested yet)
nick
parents: 4429
diff changeset
1282 IMGFMT_UYVY, IMGFMT_YUY2, IMGFMT_YVYU,
4429
edc703059853 RGB15 experimental support
nick
parents: 4416
diff changeset
1283 IMGFMT_RGB15, IMGFMT_BGR15,
4416
06752d1ad228 Preliminary RGB32 and RGB16 support. (Untested yet)
nick
parents: 4415
diff changeset
1284 IMGFMT_RGB16, IMGFMT_BGR16,
06752d1ad228 Preliminary RGB32 and RGB16 support. (Untested yet)
nick
parents: 4415
diff changeset
1285 IMGFMT_RGB32, IMGFMT_BGR32
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1286 };
872781fef1b3 preliminary version
nick
parents:
diff changeset
1287
6483
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1288 inline static int is_supported_fourcc(uint32_t fourcc)
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1289 {
6483
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1290 unsigned int i;
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1291 for(i=0;i<sizeof(supported_fourcc)/sizeof(uint32_t);i++)
872781fef1b3 preliminary version
nick
parents:
diff changeset
1292 {
872781fef1b3 preliminary version
nick
parents:
diff changeset
1293 if(fourcc==supported_fourcc[i]) return 1;
872781fef1b3 preliminary version
nick
parents:
diff changeset
1294 }
872781fef1b3 preliminary version
nick
parents:
diff changeset
1295 return 0;
872781fef1b3 preliminary version
nick
parents:
diff changeset
1296 }
872781fef1b3 preliminary version
nick
parents:
diff changeset
1297
872781fef1b3 preliminary version
nick
parents:
diff changeset
1298 int vixQueryFourcc(vidix_fourcc_t *to)
872781fef1b3 preliminary version
nick
parents:
diff changeset
1299 {
872781fef1b3 preliminary version
nick
parents:
diff changeset
1300 if(is_supported_fourcc(to->fourcc))
872781fef1b3 preliminary version
nick
parents:
diff changeset
1301 {
872781fef1b3 preliminary version
nick
parents:
diff changeset
1302 to->depth = VID_DEPTH_1BPP | VID_DEPTH_2BPP |
872781fef1b3 preliminary version
nick
parents:
diff changeset
1303 VID_DEPTH_4BPP | VID_DEPTH_8BPP |
872781fef1b3 preliminary version
nick
parents:
diff changeset
1304 VID_DEPTH_12BPP| VID_DEPTH_15BPP|
872781fef1b3 preliminary version
nick
parents:
diff changeset
1305 VID_DEPTH_16BPP| VID_DEPTH_24BPP|
872781fef1b3 preliminary version
nick
parents:
diff changeset
1306 VID_DEPTH_32BPP;
5044
43dc579db3d1 Fixed color key definitions. Waiting for new bugreports ;)
nick
parents: 5041
diff changeset
1307 to->flags = VID_CAP_EXPAND | VID_CAP_SHRINK | VID_CAP_COLORKEY;
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1308 return 0;
872781fef1b3 preliminary version
nick
parents:
diff changeset
1309 }
4015
7a9c22d1d984 works!!!
nick
parents: 4012
diff changeset
1310 else to->depth = to->flags = 0;
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1311 return ENOSYS;
872781fef1b3 preliminary version
nick
parents:
diff changeset
1312 }
872781fef1b3 preliminary version
nick
parents:
diff changeset
1313
872781fef1b3 preliminary version
nick
parents:
diff changeset
1314 static void radeon_vid_dump_regs( void )
872781fef1b3 preliminary version
nick
parents:
diff changeset
1315 {
872781fef1b3 preliminary version
nick
parents:
diff changeset
1316 size_t i;
4015
7a9c22d1d984 works!!!
nick
parents: 4012
diff changeset
1317 printf(RADEON_MSG"*** Begin of DRIVER variables dump ***\n");
7a9c22d1d984 works!!!
nick
parents: 4012
diff changeset
1318 printf(RADEON_MSG"radeon_mmio_base=%p\n",radeon_mmio_base);
7a9c22d1d984 works!!!
nick
parents: 4012
diff changeset
1319 printf(RADEON_MSG"radeon_mem_base=%p\n",radeon_mem_base);
7a9c22d1d984 works!!!
nick
parents: 4012
diff changeset
1320 printf(RADEON_MSG"radeon_overlay_off=%08X\n",radeon_overlay_off);
7a9c22d1d984 works!!!
nick
parents: 4012
diff changeset
1321 printf(RADEON_MSG"radeon_ram_size=%08X\n",radeon_ram_size);
4666
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
1322 printf(RADEON_MSG"video mode: %ux%u@%u\n",radeon_get_xres(),radeon_get_yres(),radeon_vid_get_dbpp());
13594
acfe017b6195 correct scaling when the screen resolution is smaller than the flat panel resolution
faust3
parents: 13337
diff changeset
1323 printf(RADEON_MSG"flatpanel size: %ux%u\n",radeon_get_fp_xres(),radeon_get_fp_yres());
4015
7a9c22d1d984 works!!!
nick
parents: 4012
diff changeset
1324 printf(RADEON_MSG"*** Begin of OV0 registers dump ***\n");
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1325 for(i=0;i<sizeof(vregs)/sizeof(video_registers_t);i++)
4015
7a9c22d1d984 works!!!
nick
parents: 4012
diff changeset
1326 printf(RADEON_MSG"%s = %08X\n",vregs[i].sname,INREG(vregs[i].name));
7a9c22d1d984 works!!!
nick
parents: 4012
diff changeset
1327 printf(RADEON_MSG"*** End of OV0 registers dump ***\n");
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1328 }
872781fef1b3 preliminary version
nick
parents:
diff changeset
1329
872781fef1b3 preliminary version
nick
parents:
diff changeset
1330 static void radeon_vid_stop_video( void )
872781fef1b3 preliminary version
nick
parents:
diff changeset
1331 {
872781fef1b3 preliminary version
nick
parents:
diff changeset
1332 radeon_engine_idle();
872781fef1b3 preliminary version
nick
parents:
diff changeset
1333 OUTREG(OV0_SCALE_CNTL, SCALER_SOFT_RESET);
872781fef1b3 preliminary version
nick
parents:
diff changeset
1334 OUTREG(OV0_EXCLUSIVE_HORZ, 0);
872781fef1b3 preliminary version
nick
parents:
diff changeset
1335 OUTREG(OV0_AUTO_FLIP_CNTL, 0); /* maybe */
872781fef1b3 preliminary version
nick
parents:
diff changeset
1336 OUTREG(OV0_FILTER_CNTL, FILTER_HARDCODED_COEF);
8857
a2710e35e2cc Reduce flickering on window movement (from Christophe Badina)
arpi
parents: 8856
diff changeset
1337 #ifdef RADEON
8876
026ed72206ba patch which removes the rage_ckey_model fix and updates
arpi
parents: 8859
diff changeset
1338 OUTREG(OV0_KEY_CNTL, GRAPHIC_KEY_FN_EQ);
8857
a2710e35e2cc Reduce flickering on window movement (from Christophe Badina)
arpi
parents: 8856
diff changeset
1339 #else
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1340 OUTREG(OV0_KEY_CNTL, GRAPHIC_KEY_FN_NE);
8857
a2710e35e2cc Reduce flickering on window movement (from Christophe Badina)
arpi
parents: 8856
diff changeset
1341 #endif
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1342 OUTREG(OV0_TEST, 0);
872781fef1b3 preliminary version
nick
parents:
diff changeset
1343 }
872781fef1b3 preliminary version
nick
parents:
diff changeset
1344
872781fef1b3 preliminary version
nick
parents:
diff changeset
1345 static void radeon_vid_display_video( void )
872781fef1b3 preliminary version
nick
parents:
diff changeset
1346 {
872781fef1b3 preliminary version
nick
parents:
diff changeset
1347 int bes_flags;
13337
c2cd3374a1cb add a comment to the Xorg workaround
faust3
parents: 13335
diff changeset
1348 /** workaround for Xorg-6.8 not saving the surface registers on bigendian architectures */
13335
6c002b4462ae workaround for Xorg-6.8 not saving the surface registers on bigendian
faust3
parents: 13167
diff changeset
1349 #ifdef WORDS_BIGENDIAN
6c002b4462ae workaround for Xorg-6.8 not saving the surface registers on bigendian
faust3
parents: 13167
diff changeset
1350 #if defined(RAGE128)
6c002b4462ae workaround for Xorg-6.8 not saving the surface registers on bigendian
faust3
parents: 13167
diff changeset
1351 /* code from gatos */
6c002b4462ae workaround for Xorg-6.8 not saving the surface registers on bigendian
faust3
parents: 13167
diff changeset
1352 {
6c002b4462ae workaround for Xorg-6.8 not saving the surface registers on bigendian
faust3
parents: 13167
diff changeset
1353 SAVED_CONFIG_CNTL = INREG(CONFIG_CNTL);
6c002b4462ae workaround for Xorg-6.8 not saving the surface registers on bigendian
faust3
parents: 13167
diff changeset
1354 OUTREG(CONFIG_CNTL, SAVED_CONFIG_CNTL &
6c002b4462ae workaround for Xorg-6.8 not saving the surface registers on bigendian
faust3
parents: 13167
diff changeset
1355 ~(APER_0_BIG_ENDIAN_16BPP_SWAP|APER_0_BIG_ENDIAN_32BPP_SWAP));
6c002b4462ae workaround for Xorg-6.8 not saving the surface registers on bigendian
faust3
parents: 13167
diff changeset
1356
6c002b4462ae workaround for Xorg-6.8 not saving the surface registers on bigendian
faust3
parents: 13167
diff changeset
1357 // printf("saved: %x, current: %x\n", SAVED_CONFIG_CNTL,
6c002b4462ae workaround for Xorg-6.8 not saving the surface registers on bigendian
faust3
parents: 13167
diff changeset
1358 // INREG(CONFIG_CNTL));
6c002b4462ae workaround for Xorg-6.8 not saving the surface registers on bigendian
faust3
parents: 13167
diff changeset
1359 }
6c002b4462ae workaround for Xorg-6.8 not saving the surface registers on bigendian
faust3
parents: 13167
diff changeset
1360 #else
6c002b4462ae workaround for Xorg-6.8 not saving the surface registers on bigendian
faust3
parents: 13167
diff changeset
1361 /*code from radeon_video.c*/
6c002b4462ae workaround for Xorg-6.8 not saving the surface registers on bigendian
faust3
parents: 13167
diff changeset
1362 {
6c002b4462ae workaround for Xorg-6.8 not saving the surface registers on bigendian
faust3
parents: 13167
diff changeset
1363 SAVED_CONFIG_CNTL = INREG(RADEON_SURFACE_CNTL);
6c002b4462ae workaround for Xorg-6.8 not saving the surface registers on bigendian
faust3
parents: 13167
diff changeset
1364 /* OUTREG(RADEON_SURFACE_CNTL, (SAVED_CONFIG_CNTL |
6c002b4462ae workaround for Xorg-6.8 not saving the surface registers on bigendian
faust3
parents: 13167
diff changeset
1365 RADEON_NONSURF_AP0_SWP_32BPP) & ~RADEON_NONSURF_AP0_SWP_16BPP);
6c002b4462ae workaround for Xorg-6.8 not saving the surface registers on bigendian
faust3
parents: 13167
diff changeset
1366 */
6c002b4462ae workaround for Xorg-6.8 not saving the surface registers on bigendian
faust3
parents: 13167
diff changeset
1367 OUTREG(RADEON_SURFACE_CNTL, SAVED_CONFIG_CNTL & ~(RADEON_NONSURF_AP0_SWP_32BPP
6c002b4462ae workaround for Xorg-6.8 not saving the surface registers on bigendian
faust3
parents: 13167
diff changeset
1368 | RADEON_NONSURF_AP0_SWP_16BPP));
6c002b4462ae workaround for Xorg-6.8 not saving the surface registers on bigendian
faust3
parents: 13167
diff changeset
1369
6c002b4462ae workaround for Xorg-6.8 not saving the surface registers on bigendian
faust3
parents: 13167
diff changeset
1370 /*
6c002b4462ae workaround for Xorg-6.8 not saving the surface registers on bigendian
faust3
parents: 13167
diff changeset
1371 OUTREG(RADEON_SURFACE_CNTL, (SAVED_CONFIG_CNTL | RADEON_NONSURF_AP0_SWP_32BPP)
6c002b4462ae workaround for Xorg-6.8 not saving the surface registers on bigendian
faust3
parents: 13167
diff changeset
1372 & ~RADEON_NONSURF_AP0_SWP_16BPP);
6c002b4462ae workaround for Xorg-6.8 not saving the surface registers on bigendian
faust3
parents: 13167
diff changeset
1373 */
6c002b4462ae workaround for Xorg-6.8 not saving the surface registers on bigendian
faust3
parents: 13167
diff changeset
1374 }
6c002b4462ae workaround for Xorg-6.8 not saving the surface registers on bigendian
faust3
parents: 13167
diff changeset
1375 #endif
6c002b4462ae workaround for Xorg-6.8 not saving the surface registers on bigendian
faust3
parents: 13167
diff changeset
1376 #endif
6c002b4462ae workaround for Xorg-6.8 not saving the surface registers on bigendian
faust3
parents: 13167
diff changeset
1377
6c002b4462ae workaround for Xorg-6.8 not saving the surface registers on bigendian
faust3
parents: 13167
diff changeset
1378
6c002b4462ae workaround for Xorg-6.8 not saving the surface registers on bigendian
faust3
parents: 13167
diff changeset
1379
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1380 radeon_fifo_wait(2);
872781fef1b3 preliminary version
nick
parents:
diff changeset
1381 OUTREG(OV0_REG_LOAD_CNTL, REG_LD_CTL_LOCK);
872781fef1b3 preliminary version
nick
parents:
diff changeset
1382 radeon_engine_idle();
872781fef1b3 preliminary version
nick
parents:
diff changeset
1383 while(!(INREG(OV0_REG_LOAD_CNTL)&REG_LD_CTL_LOCK_READBACK));
872781fef1b3 preliminary version
nick
parents:
diff changeset
1384 radeon_fifo_wait(15);
4666
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
1385
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
1386 /* Shutdown capturing */
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
1387 OUTREG(FCP_CNTL, FCP_CNTL__GND);
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
1388 OUTREG(CAP0_TRIG_CNTL, 0);
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
1389
4689
61f4b8fd380e Fixing "quake" by direct waiting of vsync.
nick
parents: 4666
diff changeset
1390 OUTREG(VID_BUFFER_CONTROL, (1<<16) | 0x01);
61f4b8fd380e Fixing "quake" by direct waiting of vsync.
nick
parents: 4666
diff changeset
1391 OUTREG(DISP_TEST_DEBUG_CNTL, 0);
4666
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
1392
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1393 OUTREG(OV0_AUTO_FLIP_CNTL,OV0_AUTO_FLIP_CNTL_SOFT_BUF_ODD);
872781fef1b3 preliminary version
nick
parents:
diff changeset
1394
4611
7b793875a640 Get(Set) deinterlacing
nick
parents: 4571
diff changeset
1395 if(besr.deinterlace_on) OUTREG(OV0_DEINTERLACE_PATTERN,besr.deinterlace_pattern);
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1396 #ifdef RAGE128
7493
bd423c9c835a rage128 gray fix?
arpi
parents: 7226
diff changeset
1397 OUTREG(OV0_COLOUR_CNTL, (((besr.brightness*64)/1000) & 0x7f) |
bd423c9c835a rage128 gray fix?
arpi
parents: 7226
diff changeset
1398 (((besr.saturation*31+31000)/2000) << 8) |
bd423c9c835a rage128 gray fix?
arpi
parents: 7226
diff changeset
1399 (((besr.saturation*31+31000)/2000) << 16));
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1400 #endif
872781fef1b3 preliminary version
nick
parents:
diff changeset
1401 radeon_fifo_wait(2);
4869
15af74a11ce9 color key support
nick
parents: 4855
diff changeset
1402 OUTREG(OV0_GRAPHICS_KEY_MSK, besr.graphics_key_msk);
15af74a11ce9 color key support
nick
parents: 4855
diff changeset
1403 OUTREG(OV0_GRAPHICS_KEY_CLR, besr.graphics_key_clr);
15af74a11ce9 color key support
nick
parents: 4855
diff changeset
1404 OUTREG(OV0_KEY_CNTL,besr.ckey_cntl);
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1405
872781fef1b3 preliminary version
nick
parents:
diff changeset
1406 OUTREG(OV0_H_INC, besr.h_inc);
872781fef1b3 preliminary version
nick
parents:
diff changeset
1407 OUTREG(OV0_STEP_BY, besr.step_by);
872781fef1b3 preliminary version
nick
parents:
diff changeset
1408 OUTREG(OV0_Y_X_START, besr.y_x_start);
872781fef1b3 preliminary version
nick
parents:
diff changeset
1409 OUTREG(OV0_Y_X_END, besr.y_x_end);
872781fef1b3 preliminary version
nick
parents:
diff changeset
1410 OUTREG(OV0_V_INC, besr.v_inc);
872781fef1b3 preliminary version
nick
parents:
diff changeset
1411 OUTREG(OV0_P1_BLANK_LINES_AT_TOP, besr.p1_blank_lines_at_top);
872781fef1b3 preliminary version
nick
parents:
diff changeset
1412 OUTREG(OV0_P23_BLANK_LINES_AT_TOP, besr.p23_blank_lines_at_top);
872781fef1b3 preliminary version
nick
parents:
diff changeset
1413 OUTREG(OV0_VID_BUF_PITCH0_VALUE, besr.vid_buf_pitch0_value);
872781fef1b3 preliminary version
nick
parents:
diff changeset
1414 OUTREG(OV0_VID_BUF_PITCH1_VALUE, besr.vid_buf_pitch1_value);
872781fef1b3 preliminary version
nick
parents:
diff changeset
1415 OUTREG(OV0_P1_X_START_END, besr.p1_x_start_end);
872781fef1b3 preliminary version
nick
parents:
diff changeset
1416 OUTREG(OV0_P2_X_START_END, besr.p2_x_start_end);
872781fef1b3 preliminary version
nick
parents:
diff changeset
1417 OUTREG(OV0_P3_X_START_END, besr.p3_x_start_end);
872781fef1b3 preliminary version
nick
parents:
diff changeset
1418 #ifdef RADEON
872781fef1b3 preliminary version
nick
parents:
diff changeset
1419 OUTREG(OV0_BASE_ADDR, besr.base_addr);
872781fef1b3 preliminary version
nick
parents:
diff changeset
1420 #endif
4930
a71ef1642a8a Multi-buffering
nick
parents: 4873
diff changeset
1421 OUTREG(OV0_VID_BUF0_BASE_ADRS, besr.vid_buf_base_adrs_y[0]);
5041
8a708971d372 Fixed swapping of UV planes in single buffered mode
nick
parents: 4932
diff changeset
1422 OUTREG(OV0_VID_BUF1_BASE_ADRS, besr.vid_buf_base_adrs_v[0]);
8a708971d372 Fixed swapping of UV planes in single buffered mode
nick
parents: 4932
diff changeset
1423 OUTREG(OV0_VID_BUF2_BASE_ADRS, besr.vid_buf_base_adrs_u[0]);
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1424 radeon_fifo_wait(9);
4930
a71ef1642a8a Multi-buffering
nick
parents: 4873
diff changeset
1425 OUTREG(OV0_VID_BUF3_BASE_ADRS, besr.vid_buf_base_adrs_y[0]);
5041
8a708971d372 Fixed swapping of UV planes in single buffered mode
nick
parents: 4932
diff changeset
1426 OUTREG(OV0_VID_BUF4_BASE_ADRS, besr.vid_buf_base_adrs_v[0]);
8a708971d372 Fixed swapping of UV planes in single buffered mode
nick
parents: 4932
diff changeset
1427 OUTREG(OV0_VID_BUF5_BASE_ADRS, besr.vid_buf_base_adrs_u[0]);
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1428 OUTREG(OV0_P1_V_ACCUM_INIT, besr.p1_v_accum_init);
872781fef1b3 preliminary version
nick
parents:
diff changeset
1429 OUTREG(OV0_P1_H_ACCUM_INIT, besr.p1_h_accum_init);
872781fef1b3 preliminary version
nick
parents:
diff changeset
1430 OUTREG(OV0_P23_H_ACCUM_INIT, besr.p23_h_accum_init);
872781fef1b3 preliminary version
nick
parents:
diff changeset
1431 OUTREG(OV0_P23_V_ACCUM_INIT, besr.p23_v_accum_init);
872781fef1b3 preliminary version
nick
parents:
diff changeset
1432
6678
c7cfaa38cafb switch off nearest scaling ...
pontscho
parents: 6564
diff changeset
1433 #ifdef RADEON
c7cfaa38cafb switch off nearest scaling ...
pontscho
parents: 6564
diff changeset
1434 bes_flags = SCALER_ENABLE |
c7cfaa38cafb switch off nearest scaling ...
pontscho
parents: 6564
diff changeset
1435 SCALER_SMART_SWITCH;
c7cfaa38cafb switch off nearest scaling ...
pontscho
parents: 6564
diff changeset
1436 // SCALER_HORZ_PICK_NEAREST |
c7cfaa38cafb switch off nearest scaling ...
pontscho
parents: 6564
diff changeset
1437 // SCALER_VERT_PICK_NEAREST |
c7cfaa38cafb switch off nearest scaling ...
pontscho
parents: 6564
diff changeset
1438 #endif
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1439 bes_flags = SCALER_ENABLE |
872781fef1b3 preliminary version
nick
parents:
diff changeset
1440 SCALER_SMART_SWITCH |
872781fef1b3 preliminary version
nick
parents:
diff changeset
1441 SCALER_Y2R_TEMP |
872781fef1b3 preliminary version
nick
parents:
diff changeset
1442 SCALER_PIX_EXPAND;
872781fef1b3 preliminary version
nick
parents:
diff changeset
1443 if(besr.double_buff) bes_flags |= SCALER_DOUBLE_BUFFER;
872781fef1b3 preliminary version
nick
parents:
diff changeset
1444 if(besr.deinterlace_on) bes_flags |= SCALER_ADAPTIVE_DEINT;
872781fef1b3 preliminary version
nick
parents:
diff changeset
1445 #ifdef RAGE128
872781fef1b3 preliminary version
nick
parents:
diff changeset
1446 bes_flags |= SCALER_BURST_PER_PLANE;
872781fef1b3 preliminary version
nick
parents:
diff changeset
1447 #endif
872781fef1b3 preliminary version
nick
parents:
diff changeset
1448 switch(besr.fourcc)
872781fef1b3 preliminary version
nick
parents:
diff changeset
1449 {
872781fef1b3 preliminary version
nick
parents:
diff changeset
1450 case IMGFMT_RGB15:
872781fef1b3 preliminary version
nick
parents:
diff changeset
1451 case IMGFMT_BGR15: bes_flags |= SCALER_SOURCE_15BPP; break;
4429
edc703059853 RGB15 experimental support
nick
parents: 4416
diff changeset
1452 case IMGFMT_RGB16:
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1453 case IMGFMT_BGR16: bes_flags |= SCALER_SOURCE_16BPP; break;
4416
06752d1ad228 Preliminary RGB32 and RGB16 support. (Untested yet)
nick
parents: 4415
diff changeset
1454 /*
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1455 case IMGFMT_RGB24:
872781fef1b3 preliminary version
nick
parents:
diff changeset
1456 case IMGFMT_BGR24: bes_flags |= SCALER_SOURCE_24BPP; break;
4416
06752d1ad228 Preliminary RGB32 and RGB16 support. (Untested yet)
nick
parents: 4415
diff changeset
1457 */
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1458 case IMGFMT_RGB32:
872781fef1b3 preliminary version
nick
parents:
diff changeset
1459 case IMGFMT_BGR32: bes_flags |= SCALER_SOURCE_32BPP; break;
6483
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1460 /* 4:1:0 */
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1461 case IMGFMT_IF09:
872781fef1b3 preliminary version
nick
parents:
diff changeset
1462 case IMGFMT_YVU9: bes_flags |= SCALER_SOURCE_YUV9; break;
6483
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1463 /* 4:0:0 */
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1464 case IMGFMT_Y800:
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1465 case IMGFMT_Y8:
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1466 /* 4:2:0 */
872781fef1b3 preliminary version
nick
parents:
diff changeset
1467 case IMGFMT_IYUV:
872781fef1b3 preliminary version
nick
parents:
diff changeset
1468 case IMGFMT_I420:
6483
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1469 case IMGFMT_YV12: bes_flags |= SCALER_SOURCE_YUV12; break;
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1470 /* 4:2:2 */
4455
e23ce822b5de YVYU support (untested yet)
nick
parents: 4429
diff changeset
1471 case IMGFMT_YVYU:
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1472 case IMGFMT_UYVY: bes_flags |= SCALER_SOURCE_YVYU422; break;
872781fef1b3 preliminary version
nick
parents:
diff changeset
1473 case IMGFMT_YUY2:
872781fef1b3 preliminary version
nick
parents:
diff changeset
1474 default: bes_flags |= SCALER_SOURCE_VYUY422; break;
872781fef1b3 preliminary version
nick
parents:
diff changeset
1475 }
872781fef1b3 preliminary version
nick
parents:
diff changeset
1476 OUTREG(OV0_SCALE_CNTL, bes_flags);
872781fef1b3 preliminary version
nick
parents:
diff changeset
1477 OUTREG(OV0_REG_LOAD_CNTL, 0);
4666
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
1478 if(__verbose > 1) printf(RADEON_MSG"we wanted: scaler=%08X\n",bes_flags);
4030
922241968c63 Embedding vidix
nick
parents: 4015
diff changeset
1479 if(__verbose > 1) radeon_vid_dump_regs();
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1480 }
872781fef1b3 preliminary version
nick
parents:
diff changeset
1481
4456
52929f735c8f Using new tune info
nick
parents: 4455
diff changeset
1482 static unsigned radeon_query_pitch(unsigned fourcc,const vidix_yuv_t *spitch)
4009
534d10bbff99 changes due interface changing
nick
parents: 4003
diff changeset
1483 {
4456
52929f735c8f Using new tune info
nick
parents: 4455
diff changeset
1484 unsigned pitch,spy,spv,spu;
52929f735c8f Using new tune info
nick
parents: 4455
diff changeset
1485 spy = spv = spu = 0;
52929f735c8f Using new tune info
nick
parents: 4455
diff changeset
1486 switch(spitch->y)
52929f735c8f Using new tune info
nick
parents: 4455
diff changeset
1487 {
52929f735c8f Using new tune info
nick
parents: 4455
diff changeset
1488 case 16:
52929f735c8f Using new tune info
nick
parents: 4455
diff changeset
1489 case 32:
52929f735c8f Using new tune info
nick
parents: 4455
diff changeset
1490 case 64:
52929f735c8f Using new tune info
nick
parents: 4455
diff changeset
1491 case 128:
52929f735c8f Using new tune info
nick
parents: 4455
diff changeset
1492 case 256: spy = spitch->y; break;
52929f735c8f Using new tune info
nick
parents: 4455
diff changeset
1493 default: break;
52929f735c8f Using new tune info
nick
parents: 4455
diff changeset
1494 }
52929f735c8f Using new tune info
nick
parents: 4455
diff changeset
1495 switch(spitch->u)
52929f735c8f Using new tune info
nick
parents: 4455
diff changeset
1496 {
52929f735c8f Using new tune info
nick
parents: 4455
diff changeset
1497 case 16:
52929f735c8f Using new tune info
nick
parents: 4455
diff changeset
1498 case 32:
52929f735c8f Using new tune info
nick
parents: 4455
diff changeset
1499 case 64:
52929f735c8f Using new tune info
nick
parents: 4455
diff changeset
1500 case 128:
52929f735c8f Using new tune info
nick
parents: 4455
diff changeset
1501 case 256: spu = spitch->u; break;
52929f735c8f Using new tune info
nick
parents: 4455
diff changeset
1502 default: break;
52929f735c8f Using new tune info
nick
parents: 4455
diff changeset
1503 }
52929f735c8f Using new tune info
nick
parents: 4455
diff changeset
1504 switch(spitch->v)
52929f735c8f Using new tune info
nick
parents: 4455
diff changeset
1505 {
52929f735c8f Using new tune info
nick
parents: 4455
diff changeset
1506 case 16:
52929f735c8f Using new tune info
nick
parents: 4455
diff changeset
1507 case 32:
52929f735c8f Using new tune info
nick
parents: 4455
diff changeset
1508 case 64:
52929f735c8f Using new tune info
nick
parents: 4455
diff changeset
1509 case 128:
52929f735c8f Using new tune info
nick
parents: 4455
diff changeset
1510 case 256: spv = spitch->v; break;
52929f735c8f Using new tune info
nick
parents: 4455
diff changeset
1511 default: break;
52929f735c8f Using new tune info
nick
parents: 4455
diff changeset
1512 }
4009
534d10bbff99 changes due interface changing
nick
parents: 4003
diff changeset
1513 switch(fourcc)
534d10bbff99 changes due interface changing
nick
parents: 4003
diff changeset
1514 {
534d10bbff99 changes due interface changing
nick
parents: 4003
diff changeset
1515 /* 4:2:0 */
534d10bbff99 changes due interface changing
nick
parents: 4003
diff changeset
1516 case IMGFMT_IYUV:
534d10bbff99 changes due interface changing
nick
parents: 4003
diff changeset
1517 case IMGFMT_YV12:
4456
52929f735c8f Using new tune info
nick
parents: 4455
diff changeset
1518 case IMGFMT_I420:
52929f735c8f Using new tune info
nick
parents: 4455
diff changeset
1519 if(spy > 16 && spu == spy/2 && spv == spy/2) pitch = spy;
52929f735c8f Using new tune info
nick
parents: 4455
diff changeset
1520 else pitch = 32;
52929f735c8f Using new tune info
nick
parents: 4455
diff changeset
1521 break;
6483
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1522 /* 4:1:0 */
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1523 case IMGFMT_IF09:
6254
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
1524 case IMGFMT_YVU9:
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
1525 if(spy > 32 && spu == spy/4 && spv == spy/4) pitch = spy;
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
1526 else pitch = 64;
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
1527 break;
4456
52929f735c8f Using new tune info
nick
parents: 4455
diff changeset
1528 default:
52929f735c8f Using new tune info
nick
parents: 4455
diff changeset
1529 if(spy >= 16) pitch = spy;
52929f735c8f Using new tune info
nick
parents: 4455
diff changeset
1530 else pitch = 16;
52929f735c8f Using new tune info
nick
parents: 4455
diff changeset
1531 break;
4009
534d10bbff99 changes due interface changing
nick
parents: 4003
diff changeset
1532 }
534d10bbff99 changes due interface changing
nick
parents: 4003
diff changeset
1533 return pitch;
534d10bbff99 changes due interface changing
nick
parents: 4003
diff changeset
1534 }
534d10bbff99 changes due interface changing
nick
parents: 4003
diff changeset
1535
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1536 static int radeon_vid_init_video( vidix_playback_t *config )
872781fef1b3 preliminary version
nick
parents:
diff changeset
1537 {
4930
a71ef1642a8a Multi-buffering
nick
parents: 4873
diff changeset
1538 uint32_t i,tmp,src_w,src_h,dest_w,dest_h,pitch,h_inc,step_by,left,leftUV,top;
6483
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1539 int is_400,is_410,is_420,is_rgb32,is_rgb,best_pitch,mpitch;
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1540 radeon_vid_stop_video();
872781fef1b3 preliminary version
nick
parents:
diff changeset
1541 left = config->src.x << 16;
872781fef1b3 preliminary version
nick
parents:
diff changeset
1542 top = config->src.y << 16;
872781fef1b3 preliminary version
nick
parents:
diff changeset
1543 src_h = config->src.h;
872781fef1b3 preliminary version
nick
parents:
diff changeset
1544 src_w = config->src.w;
6483
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1545 is_400 = is_410 = is_420 = is_rgb32 = is_rgb = 0;
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1546 if(config->fourcc == IMGFMT_YV12 ||
872781fef1b3 preliminary version
nick
parents:
diff changeset
1547 config->fourcc == IMGFMT_I420 ||
872781fef1b3 preliminary version
nick
parents:
diff changeset
1548 config->fourcc == IMGFMT_IYUV) is_420 = 1;
6483
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1549 if(config->fourcc == IMGFMT_YVU9 ||
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1550 config->fourcc == IMGFMT_IF09) is_410 = 1;
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1551 if(config->fourcc == IMGFMT_Y800 ||
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1552 config->fourcc == IMGFMT_Y8) is_400 = 1;
4416
06752d1ad228 Preliminary RGB32 and RGB16 support. (Untested yet)
nick
parents: 4415
diff changeset
1553 if(config->fourcc == IMGFMT_RGB32 ||
06752d1ad228 Preliminary RGB32 and RGB16 support. (Untested yet)
nick
parents: 4415
diff changeset
1554 config->fourcc == IMGFMT_BGR32) is_rgb32 = 1;
4571
e9928913a61d - Fixed incorrect i420 support (Michael was right)
nick
parents: 4477
diff changeset
1555 if(config->fourcc == IMGFMT_RGB32 ||
e9928913a61d - Fixed incorrect i420 support (Michael was right)
nick
parents: 4477
diff changeset
1556 config->fourcc == IMGFMT_BGR32 ||
e9928913a61d - Fixed incorrect i420 support (Michael was right)
nick
parents: 4477
diff changeset
1557 config->fourcc == IMGFMT_RGB24 ||
e9928913a61d - Fixed incorrect i420 support (Michael was right)
nick
parents: 4477
diff changeset
1558 config->fourcc == IMGFMT_BGR24 ||
e9928913a61d - Fixed incorrect i420 support (Michael was right)
nick
parents: 4477
diff changeset
1559 config->fourcc == IMGFMT_RGB16 ||
e9928913a61d - Fixed incorrect i420 support (Michael was right)
nick
parents: 4477
diff changeset
1560 config->fourcc == IMGFMT_BGR16 ||
e9928913a61d - Fixed incorrect i420 support (Michael was right)
nick
parents: 4477
diff changeset
1561 config->fourcc == IMGFMT_RGB15 ||
e9928913a61d - Fixed incorrect i420 support (Michael was right)
nick
parents: 4477
diff changeset
1562 config->fourcc == IMGFMT_BGR15) is_rgb = 1;
4456
52929f735c8f Using new tune info
nick
parents: 4455
diff changeset
1563 best_pitch = radeon_query_pitch(config->fourcc,&config->src.pitch);
4415
30d17394db39 Use one pitch source
nick
parents: 4414
diff changeset
1564 mpitch = best_pitch-1;
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1565 switch(config->fourcc)
872781fef1b3 preliminary version
nick
parents:
diff changeset
1566 {
6483
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1567 /* 4:0:0 */
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1568 case IMGFMT_Y800:
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1569 case IMGFMT_Y8:
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1570 /* 4:1:0 */
6254
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
1571 case IMGFMT_YVU9:
6483
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1572 case IMGFMT_IF09:
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1573 /* 4:2:0 */
872781fef1b3 preliminary version
nick
parents:
diff changeset
1574 case IMGFMT_IYUV:
872781fef1b3 preliminary version
nick
parents:
diff changeset
1575 case IMGFMT_YV12:
4415
30d17394db39 Use one pitch source
nick
parents: 4414
diff changeset
1576 case IMGFMT_I420: pitch = (src_w + mpitch) & ~mpitch;
4015
7a9c22d1d984 works!!!
nick
parents: 4012
diff changeset
1577 config->dest.pitch.y =
7a9c22d1d984 works!!!
nick
parents: 4012
diff changeset
1578 config->dest.pitch.u =
4415
30d17394db39 Use one pitch source
nick
parents: 4414
diff changeset
1579 config->dest.pitch.v = best_pitch;
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1580 break;
4416
06752d1ad228 Preliminary RGB32 and RGB16 support. (Untested yet)
nick
parents: 4415
diff changeset
1581 /* RGB 4:4:4:4 */
06752d1ad228 Preliminary RGB32 and RGB16 support. (Untested yet)
nick
parents: 4415
diff changeset
1582 case IMGFMT_RGB32:
06752d1ad228 Preliminary RGB32 and RGB16 support. (Untested yet)
nick
parents: 4415
diff changeset
1583 case IMGFMT_BGR32: pitch = (src_w*4 + mpitch) & ~mpitch;
06752d1ad228 Preliminary RGB32 and RGB16 support. (Untested yet)
nick
parents: 4415
diff changeset
1584 config->dest.pitch.y =
06752d1ad228 Preliminary RGB32 and RGB16 support. (Untested yet)
nick
parents: 4415
diff changeset
1585 config->dest.pitch.u =
06752d1ad228 Preliminary RGB32 and RGB16 support. (Untested yet)
nick
parents: 4415
diff changeset
1586 config->dest.pitch.v = best_pitch;
06752d1ad228 Preliminary RGB32 and RGB16 support. (Untested yet)
nick
parents: 4415
diff changeset
1587 break;
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1588 /* 4:2:2 */
4455
e23ce822b5de YVYU support (untested yet)
nick
parents: 4429
diff changeset
1589 default: /* RGB15, RGB16, YVYU, UYVY, YUY2 */
4415
30d17394db39 Use one pitch source
nick
parents: 4414
diff changeset
1590 pitch = ((src_w*2) + mpitch) & ~mpitch;
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1591 config->dest.pitch.y =
872781fef1b3 preliminary version
nick
parents:
diff changeset
1592 config->dest.pitch.u =
4415
30d17394db39 Use one pitch source
nick
parents: 4414
diff changeset
1593 config->dest.pitch.v = best_pitch;
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1594 break;
872781fef1b3 preliminary version
nick
parents:
diff changeset
1595 }
872781fef1b3 preliminary version
nick
parents:
diff changeset
1596 dest_w = config->dest.w;
872781fef1b3 preliminary version
nick
parents:
diff changeset
1597 dest_h = config->dest.h;
872781fef1b3 preliminary version
nick
parents:
diff changeset
1598 if(radeon_is_dbl_scan()) dest_h *= 2;
872781fef1b3 preliminary version
nick
parents:
diff changeset
1599 besr.dest_bpp = radeon_vid_get_dbpp();
872781fef1b3 preliminary version
nick
parents:
diff changeset
1600 besr.fourcc = config->fourcc;
13594
acfe017b6195 correct scaling when the screen resolution is smaller than the flat panel resolution
faust3
parents: 13337
diff changeset
1601
acfe017b6195 correct scaling when the screen resolution is smaller than the flat panel resolution
faust3
parents: 13337
diff changeset
1602 /* flat panel */
acfe017b6195 correct scaling when the screen resolution is smaller than the flat panel resolution
faust3
parents: 13337
diff changeset
1603 if(INREG(FP_VERT_STRETCH)&VERT_STRETCH_ENABLE){
acfe017b6195 correct scaling when the screen resolution is smaller than the flat panel resolution
faust3
parents: 13337
diff changeset
1604 besr.v_inc = (src_h * radeon_get_yres() / radeon_get_fp_yres() << 20) / dest_h;
acfe017b6195 correct scaling when the screen resolution is smaller than the flat panel resolution
faust3
parents: 13337
diff changeset
1605 }
acfe017b6195 correct scaling when the screen resolution is smaller than the flat panel resolution
faust3
parents: 13337
diff changeset
1606 else besr.v_inc = (src_h << 20) / dest_h;
6254
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
1607 if(radeon_is_interlace()) besr.v_inc *= 2;
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1608 h_inc = (src_w << 12) / dest_w;
9544
97f61ffa441e vidix rage128 ecp_div patch by (Magnus Damm <damm at opensource dot se>)
michael
parents: 9240
diff changeset
1609
97f61ffa441e vidix rage128 ecp_div patch by (Magnus Damm <damm at opensource dot se>)
michael
parents: 9240
diff changeset
1610 {
97f61ffa441e vidix rage128 ecp_div patch by (Magnus Damm <damm at opensource dot se>)
michael
parents: 9240
diff changeset
1611 unsigned int ecp_div;
97f61ffa441e vidix rage128 ecp_div patch by (Magnus Damm <damm at opensource dot se>)
michael
parents: 9240
diff changeset
1612 ecp_div = (INPLL(VCLK_ECP_CNTL) >> 8) & 3;
97f61ffa441e vidix rage128 ecp_div patch by (Magnus Damm <damm at opensource dot se>)
michael
parents: 9240
diff changeset
1613 h_inc <<= ecp_div;
97f61ffa441e vidix rage128 ecp_div patch by (Magnus Damm <damm at opensource dot se>)
michael
parents: 9240
diff changeset
1614 }
97f61ffa441e vidix rage128 ecp_div patch by (Magnus Damm <damm at opensource dot se>)
michael
parents: 9240
diff changeset
1615
97f61ffa441e vidix rage128 ecp_div patch by (Magnus Damm <damm at opensource dot se>)
michael
parents: 9240
diff changeset
1616
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1617 step_by = 1;
872781fef1b3 preliminary version
nick
parents:
diff changeset
1618 while(h_inc >= (2 << 12)) {
872781fef1b3 preliminary version
nick
parents:
diff changeset
1619 step_by++;
872781fef1b3 preliminary version
nick
parents:
diff changeset
1620 h_inc >>= 1;
872781fef1b3 preliminary version
nick
parents:
diff changeset
1621 }
872781fef1b3 preliminary version
nick
parents:
diff changeset
1622
872781fef1b3 preliminary version
nick
parents:
diff changeset
1623 /* keep everything in 16.16 */
4015
7a9c22d1d984 works!!!
nick
parents: 4012
diff changeset
1624 besr.base_addr = INREG(DISPLAY_BASE_ADDR);
4666
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
1625 config->offsets[0] = 0;
4930
a71ef1642a8a Multi-buffering
nick
parents: 4873
diff changeset
1626 for(i=1;i<besr.vid_nbufs;i++)
a71ef1642a8a Multi-buffering
nick
parents: 4873
diff changeset
1627 config->offsets[i] = config->offsets[i-1]+config->frame_size;
6483
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1628 if(is_420 || is_410 || is_400)
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1629 {
872781fef1b3 preliminary version
nick
parents:
diff changeset
1630 uint32_t d1line,d2line,d3line;
872781fef1b3 preliminary version
nick
parents:
diff changeset
1631 d1line = top*pitch;
6483
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1632 if(is_420)
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1633 {
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1634 d2line = src_h*pitch+(d1line>>2);
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1635 d3line = d2line+((src_h*pitch)>>2);
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1636 }
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1637 else
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1638 if(is_410)
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1639 {
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1640 d2line = src_h*pitch+(d1line>>4);
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1641 d3line = d2line+((src_h*pitch)>>4);
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1642 }
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1643 else
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1644 {
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1645 d2line = 0;
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1646 d3line = 0;
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1647 }
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1648 d1line += (left >> 16) & ~15;
6483
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1649 if(is_420)
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1650 {
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1651 d2line += (left >> 17) & ~15;
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1652 d3line += (left >> 17) & ~15;
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1653 }
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1654 else
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1655 if(is_410)
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1656 {
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1657 d2line += (left >> 18) & ~15;
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1658 d3line += (left >> 18) & ~15;
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1659 }
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1660 config->offset.y = d1line & VIF_BUF0_BASE_ADRS_MASK;
6483
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1661 if(is_400)
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1662 {
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1663 config->offset.v = 0;
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1664 config->offset.u = 0;
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1665 }
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1666 else
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1667 {
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1668 config->offset.v = d2line & VIF_BUF1_BASE_ADRS_MASK;
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1669 config->offset.u = d3line & VIF_BUF2_BASE_ADRS_MASK;
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1670 }
4930
a71ef1642a8a Multi-buffering
nick
parents: 4873
diff changeset
1671 for(i=0;i<besr.vid_nbufs;i++)
a71ef1642a8a Multi-buffering
nick
parents: 4873
diff changeset
1672 {
a71ef1642a8a Multi-buffering
nick
parents: 4873
diff changeset
1673 besr.vid_buf_base_adrs_y[i]=((radeon_overlay_off+config->offsets[i]+config->offset.y)&VIF_BUF0_BASE_ADRS_MASK);
6483
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1674 if(is_400)
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1675 {
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1676 besr.vid_buf_base_adrs_v[i]=0;
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1677 besr.vid_buf_base_adrs_u[i]=0;
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1678 }
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1679 else
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1680 {
9892
f6d1df877e89 i420 fixed, needs some testing
alex
parents: 9767
diff changeset
1681 if (besr.fourcc == IMGFMT_I420 || besr.fourcc == IMGFMT_IYUV)
f6d1df877e89 i420 fixed, needs some testing
alex
parents: 9767
diff changeset
1682 {
f6d1df877e89 i420 fixed, needs some testing
alex
parents: 9767
diff changeset
1683 besr.vid_buf_base_adrs_u[i]=((radeon_overlay_off+config->offsets[i]+config->offset.v)&VIF_BUF1_BASE_ADRS_MASK)|VIF_BUF1_PITCH_SEL;
f6d1df877e89 i420 fixed, needs some testing
alex
parents: 9767
diff changeset
1684 besr.vid_buf_base_adrs_v[i]=((radeon_overlay_off+config->offsets[i]+config->offset.u)&VIF_BUF2_BASE_ADRS_MASK)|VIF_BUF2_PITCH_SEL;
f6d1df877e89 i420 fixed, needs some testing
alex
parents: 9767
diff changeset
1685 }
f6d1df877e89 i420 fixed, needs some testing
alex
parents: 9767
diff changeset
1686 else
f6d1df877e89 i420 fixed, needs some testing
alex
parents: 9767
diff changeset
1687 {
f6d1df877e89 i420 fixed, needs some testing
alex
parents: 9767
diff changeset
1688 besr.vid_buf_base_adrs_v[i]=((radeon_overlay_off+config->offsets[i]+config->offset.v)&VIF_BUF1_BASE_ADRS_MASK)|VIF_BUF1_PITCH_SEL;
f6d1df877e89 i420 fixed, needs some testing
alex
parents: 9767
diff changeset
1689 besr.vid_buf_base_adrs_u[i]=((radeon_overlay_off+config->offsets[i]+config->offset.u)&VIF_BUF2_BASE_ADRS_MASK)|VIF_BUF2_PITCH_SEL;
f6d1df877e89 i420 fixed, needs some testing
alex
parents: 9767
diff changeset
1690 }
6483
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1691 }
4930
a71ef1642a8a Multi-buffering
nick
parents: 4873
diff changeset
1692 }
a71ef1642a8a Multi-buffering
nick
parents: 4873
diff changeset
1693 config->offset.y = ((besr.vid_buf_base_adrs_y[0])&VIF_BUF0_BASE_ADRS_MASK) - radeon_overlay_off;
6483
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1694 if(is_400)
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1695 {
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1696 config->offset.v = 0;
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1697 config->offset.u = 0;
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1698 }
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1699 else
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1700 {
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1701 config->offset.v = ((besr.vid_buf_base_adrs_v[0])&VIF_BUF1_BASE_ADRS_MASK) - radeon_overlay_off;
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1702 config->offset.u = ((besr.vid_buf_base_adrs_u[0])&VIF_BUF2_BASE_ADRS_MASK) - radeon_overlay_off;
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1703 }
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1704 }
872781fef1b3 preliminary version
nick
parents:
diff changeset
1705 else
872781fef1b3 preliminary version
nick
parents:
diff changeset
1706 {
872781fef1b3 preliminary version
nick
parents:
diff changeset
1707 config->offset.y = config->offset.u = config->offset.v = ((left & ~7) << 1)&VIF_BUF0_BASE_ADRS_MASK;
4930
a71ef1642a8a Multi-buffering
nick
parents: 4873
diff changeset
1708 for(i=0;i<besr.vid_nbufs;i++)
a71ef1642a8a Multi-buffering
nick
parents: 4873
diff changeset
1709 {
a71ef1642a8a Multi-buffering
nick
parents: 4873
diff changeset
1710 besr.vid_buf_base_adrs_y[i] =
a71ef1642a8a Multi-buffering
nick
parents: 4873
diff changeset
1711 besr.vid_buf_base_adrs_u[i] =
4932
nick
parents: 4930
diff changeset
1712 besr.vid_buf_base_adrs_v[i] = radeon_overlay_off + config->offsets[i] + config->offset.y;
4930
a71ef1642a8a Multi-buffering
nick
parents: 4873
diff changeset
1713 }
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1714 }
872781fef1b3 preliminary version
nick
parents:
diff changeset
1715
872781fef1b3 preliminary version
nick
parents:
diff changeset
1716 tmp = (left & 0x0003ffff) + 0x00028000 + (h_inc << 3);
872781fef1b3 preliminary version
nick
parents:
diff changeset
1717 besr.p1_h_accum_init = ((tmp << 4) & 0x000f8000) |
872781fef1b3 preliminary version
nick
parents:
diff changeset
1718 ((tmp << 12) & 0xf0000000);
872781fef1b3 preliminary version
nick
parents:
diff changeset
1719
872781fef1b3 preliminary version
nick
parents:
diff changeset
1720 tmp = ((left >> 1) & 0x0001ffff) + 0x00028000 + (h_inc << 2);
872781fef1b3 preliminary version
nick
parents:
diff changeset
1721 besr.p23_h_accum_init = ((tmp << 4) & 0x000f8000) |
872781fef1b3 preliminary version
nick
parents:
diff changeset
1722 ((tmp << 12) & 0x70000000);
872781fef1b3 preliminary version
nick
parents:
diff changeset
1723 tmp = (top & 0x0000ffff) + 0x00018000;
872781fef1b3 preliminary version
nick
parents:
diff changeset
1724 besr.p1_v_accum_init = ((tmp << 4) & OV0_P1_V_ACCUM_INIT_MASK)
872781fef1b3 preliminary version
nick
parents:
diff changeset
1725 |(OV0_P1_MAX_LN_IN_PER_LN_OUT & 1);
872781fef1b3 preliminary version
nick
parents:
diff changeset
1726
872781fef1b3 preliminary version
nick
parents:
diff changeset
1727 tmp = ((top >> 1) & 0x0000ffff) + 0x00018000;
6483
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1728 besr.p23_v_accum_init = (is_420||is_410) ?
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1729 ((tmp << 4) & OV0_P23_V_ACCUM_INIT_MASK)
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1730 |(OV0_P23_MAX_LN_IN_PER_LN_OUT & 1) : 0;
872781fef1b3 preliminary version
nick
parents:
diff changeset
1731
6483
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1732 leftUV = (left >> (is_410?18:17)) & 15;
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1733 left = (left >> 16) & 15;
4571
e9928913a61d - Fixed incorrect i420 support (Michael was right)
nick
parents: 4477
diff changeset
1734 if(is_rgb && !is_rgb32) h_inc<<=1;
4416
06752d1ad228 Preliminary RGB32 and RGB16 support. (Untested yet)
nick
parents: 4415
diff changeset
1735 if(is_rgb32)
4571
e9928913a61d - Fixed incorrect i420 support (Michael was right)
nick
parents: 4477
diff changeset
1736 besr.h_inc = (h_inc >> 1) | ((h_inc >> 1) << 16);
4416
06752d1ad228 Preliminary RGB32 and RGB16 support. (Untested yet)
nick
parents: 4415
diff changeset
1737 else
6483
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1738 if(is_410)
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1739 besr.h_inc = h_inc | ((h_inc >> 2) << 16);
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1740 else
4416
06752d1ad228 Preliminary RGB32 and RGB16 support. (Untested yet)
nick
parents: 4415
diff changeset
1741 besr.h_inc = h_inc | ((h_inc >> 1) << 16);
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1742 besr.step_by = step_by | (step_by << 8);
872781fef1b3 preliminary version
nick
parents:
diff changeset
1743 besr.y_x_start = (config->dest.x+X_ADJUST) | (config->dest.y << 16);
872781fef1b3 preliminary version
nick
parents:
diff changeset
1744 besr.y_x_end = (config->dest.x + dest_w+X_ADJUST) | ((config->dest.y + dest_h) << 16);
872781fef1b3 preliminary version
nick
parents:
diff changeset
1745 besr.p1_blank_lines_at_top = P1_BLNK_LN_AT_TOP_M1_MASK|((src_h-1)<<16);
6483
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1746 if(is_420 || is_410)
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1747 {
6483
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1748 src_h = (src_h + 1) >> (is_410?2:1);
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1749 besr.p23_blank_lines_at_top = P23_BLNK_LN_AT_TOP_M1_MASK|((src_h-1)<<16);
872781fef1b3 preliminary version
nick
parents:
diff changeset
1750 }
872781fef1b3 preliminary version
nick
parents:
diff changeset
1751 else besr.p23_blank_lines_at_top = 0;
872781fef1b3 preliminary version
nick
parents:
diff changeset
1752 besr.vid_buf_pitch0_value = pitch;
6483
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1753 besr.vid_buf_pitch1_value = is_410 ? pitch>>2 : is_420 ? pitch>>1 : pitch;
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1754 besr.p1_x_start_end = (src_w+left-1)|(left<<16);
6483
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1755 if (is_410||is_420) src_w>>=is_410?2:1;
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1756 if(is_400)
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1757 {
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1758 besr.p2_x_start_end = 0;
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1759 besr.p3_x_start_end = 0;
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1760 }
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1761 else
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1762 {
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1763 besr.p2_x_start_end = (src_w+left-1)|(leftUV<<16);
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1764 besr.p3_x_start_end = besr.p2_x_start_end;
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1765 }
4869
15af74a11ce9 color key support
nick
parents: 4855
diff changeset
1766
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1767 return 0;
872781fef1b3 preliminary version
nick
parents:
diff changeset
1768 }
872781fef1b3 preliminary version
nick
parents:
diff changeset
1769
4009
534d10bbff99 changes due interface changing
nick
parents: 4003
diff changeset
1770 static void radeon_compute_framesize(vidix_playback_t *info)
534d10bbff99 changes due interface changing
nick
parents: 4003
diff changeset
1771 {
4666
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
1772 unsigned pitch,awidth,dbpp;
4456
52929f735c8f Using new tune info
nick
parents: 4455
diff changeset
1773 pitch = radeon_query_pitch(info->fourcc,&info->src.pitch);
4666
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
1774 dbpp = radeon_vid_get_dbpp();
4033
94602bcd13d0 double buffering fixing
nick
parents: 4030
diff changeset
1775 switch(info->fourcc)
94602bcd13d0 double buffering fixing
nick
parents: 4030
diff changeset
1776 {
94602bcd13d0 double buffering fixing
nick
parents: 4030
diff changeset
1777 case IMGFMT_I420:
94602bcd13d0 double buffering fixing
nick
parents: 4030
diff changeset
1778 case IMGFMT_YV12:
94602bcd13d0 double buffering fixing
nick
parents: 4030
diff changeset
1779 case IMGFMT_IYUV:
4666
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
1780 awidth = (info->src.w + (pitch-1)) & ~(pitch-1);
6254
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
1781 info->frame_size = awidth*(info->src.h+info->src.h/2);
4033
94602bcd13d0 double buffering fixing
nick
parents: 4030
diff changeset
1782 break;
6483
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1783 case IMGFMT_Y800:
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1784 case IMGFMT_Y8:
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1785 awidth = (info->src.w + (pitch-1)) & ~(pitch-1);
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1786 info->frame_size = awidth*info->src.h;
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1787 break;
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1788 case IMGFMT_IF09:
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1789 case IMGFMT_YVU9:
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1790 awidth = (info->src.w + (pitch-1)) & ~(pitch-1);
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1791 info->frame_size = awidth*(info->src.h+info->src.h/8);
2dd9691fe6b8 YVU9,IF09,Y800 and Y8 support - and synced with mpxp
alex
parents: 6254
diff changeset
1792 break;
4429
edc703059853 RGB15 experimental support
nick
parents: 4416
diff changeset
1793 case IMGFMT_RGB32:
edc703059853 RGB15 experimental support
nick
parents: 4416
diff changeset
1794 case IMGFMT_BGR32:
4666
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
1795 awidth = (info->src.w*4 + (pitch-1)) & ~(pitch-1);
6254
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
1796 info->frame_size = awidth*info->src.h;
4429
edc703059853 RGB15 experimental support
nick
parents: 4416
diff changeset
1797 break;
edc703059853 RGB15 experimental support
nick
parents: 4416
diff changeset
1798 /* YUY2 YVYU, RGB15, RGB16 */
4666
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
1799 default:
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
1800 awidth = (info->src.w*2 + (pitch-1)) & ~(pitch-1);
6254
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
1801 info->frame_size = awidth*info->src.h;
4033
94602bcd13d0 double buffering fixing
nick
parents: 4030
diff changeset
1802 break;
94602bcd13d0 double buffering fixing
nick
parents: 4030
diff changeset
1803 }
4009
534d10bbff99 changes due interface changing
nick
parents: 4003
diff changeset
1804 }
534d10bbff99 changes due interface changing
nick
parents: 4003
diff changeset
1805
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1806 int vixConfigPlayback(vidix_playback_t *info)
872781fef1b3 preliminary version
nick
parents:
diff changeset
1807 {
6254
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
1808 unsigned rgb_size,nfr;
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1809 if(!is_supported_fourcc(info->fourcc)) return ENOSYS;
6254
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
1810 if(info->num_frames>VID_PLAY_MAXFRAMES) info->num_frames=VID_PLAY_MAXFRAMES;
4666
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
1811 if(info->num_frames==1) besr.double_buff=0;
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
1812 else besr.double_buff=1;
4009
534d10bbff99 changes due interface changing
nick
parents: 4003
diff changeset
1813 radeon_compute_framesize(info);
4930
a71ef1642a8a Multi-buffering
nick
parents: 4873
diff changeset
1814
6254
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
1815 rgb_size = radeon_get_xres()*radeon_get_yres()*((radeon_vid_get_dbpp()+7)/8);
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
1816 nfr = info->num_frames;
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
1817 for(;nfr>0; nfr--)
4930
a71ef1642a8a Multi-buffering
nick
parents: 4873
diff changeset
1818 {
6254
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
1819 radeon_overlay_off = radeon_ram_size - info->frame_size*nfr;
12286
b52e831261b1 support for ATI fireglx
alex
parents: 12072
diff changeset
1820 #ifdef HAVE_X11
b52e831261b1 support for ATI fireglx
alex
parents: 12072
diff changeset
1821 radeon_overlay_off -= firegl_shift;
b52e831261b1 support for ATI fireglx
alex
parents: 12072
diff changeset
1822 #endif
4930
a71ef1642a8a Multi-buffering
nick
parents: 4873
diff changeset
1823 radeon_overlay_off &= 0xffff0000;
a71ef1642a8a Multi-buffering
nick
parents: 4873
diff changeset
1824 if(radeon_overlay_off >= (int)rgb_size ) break;
a71ef1642a8a Multi-buffering
nick
parents: 4873
diff changeset
1825 }
6254
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
1826 if(nfr <= 3)
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
1827 {
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
1828 nfr = info->num_frames;
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
1829 for(;nfr>0; nfr--)
4930
a71ef1642a8a Multi-buffering
nick
parents: 4873
diff changeset
1830 {
6254
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
1831 radeon_overlay_off = radeon_ram_size - info->frame_size*nfr;
12286
b52e831261b1 support for ATI fireglx
alex
parents: 12072
diff changeset
1832 #ifdef HAVE_X11
b52e831261b1 support for ATI fireglx
alex
parents: 12072
diff changeset
1833 radeon_overlay_off -= firegl_shift;
b52e831261b1 support for ATI fireglx
alex
parents: 12072
diff changeset
1834 #endif
4930
a71ef1642a8a Multi-buffering
nick
parents: 4873
diff changeset
1835 radeon_overlay_off &= 0xffff0000;
a71ef1642a8a Multi-buffering
nick
parents: 4873
diff changeset
1836 if(radeon_overlay_off > 0) break;
a71ef1642a8a Multi-buffering
nick
parents: 4873
diff changeset
1837 }
6254
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
1838 }
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
1839 if(nfr <= 0) return EINVAL;
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
1840 info->num_frames = nfr;
4930
a71ef1642a8a Multi-buffering
nick
parents: 4873
diff changeset
1841 besr.vid_nbufs = info->num_frames;
a71ef1642a8a Multi-buffering
nick
parents: 4873
diff changeset
1842 info->dga_addr = (char *)radeon_mem_base + radeon_overlay_off;
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1843 radeon_vid_init_video(info);
872781fef1b3 preliminary version
nick
parents:
diff changeset
1844 return 0;
872781fef1b3 preliminary version
nick
parents:
diff changeset
1845 }
872781fef1b3 preliminary version
nick
parents:
diff changeset
1846
872781fef1b3 preliminary version
nick
parents:
diff changeset
1847 int vixPlaybackOn( void )
872781fef1b3 preliminary version
nick
parents:
diff changeset
1848 {
872781fef1b3 preliminary version
nick
parents:
diff changeset
1849 radeon_vid_display_video();
872781fef1b3 preliminary version
nick
parents:
diff changeset
1850 return 0;
872781fef1b3 preliminary version
nick
parents:
diff changeset
1851 }
872781fef1b3 preliminary version
nick
parents:
diff changeset
1852
872781fef1b3 preliminary version
nick
parents:
diff changeset
1853 int vixPlaybackOff( void )
872781fef1b3 preliminary version
nick
parents:
diff changeset
1854 {
872781fef1b3 preliminary version
nick
parents:
diff changeset
1855 radeon_vid_stop_video();
872781fef1b3 preliminary version
nick
parents:
diff changeset
1856 return 0;
872781fef1b3 preliminary version
nick
parents:
diff changeset
1857 }
872781fef1b3 preliminary version
nick
parents:
diff changeset
1858
4033
94602bcd13d0 double buffering fixing
nick
parents: 4030
diff changeset
1859 int vixPlaybackFrameSelect(unsigned frame)
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1860 {
4412
78878b1adb80 Correcting pointers on second buffer
nick
parents: 4373
diff changeset
1861 uint32_t off[6];
4930
a71ef1642a8a Multi-buffering
nick
parents: 4873
diff changeset
1862 int prev_frame= (frame-1+besr.vid_nbufs) % besr.vid_nbufs;
4412
78878b1adb80 Correcting pointers on second buffer
nick
parents: 4373
diff changeset
1863 /*
78878b1adb80 Correcting pointers on second buffer
nick
parents: 4373
diff changeset
1864 buf3-5 always should point onto second buffer for better
78878b1adb80 Correcting pointers on second buffer
nick
parents: 4373
diff changeset
1865 deinterlacing and TV-in
78878b1adb80 Correcting pointers on second buffer
nick
parents: 4373
diff changeset
1866 */
4666
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
1867 if(!besr.double_buff) return 0;
4930
a71ef1642a8a Multi-buffering
nick
parents: 4873
diff changeset
1868 if(frame > besr.vid_nbufs) frame = besr.vid_nbufs-1;
a71ef1642a8a Multi-buffering
nick
parents: 4873
diff changeset
1869 if(prev_frame > (int)besr.vid_nbufs) prev_frame = besr.vid_nbufs-1;
a71ef1642a8a Multi-buffering
nick
parents: 4873
diff changeset
1870 off[0] = besr.vid_buf_base_adrs_y[frame];
a71ef1642a8a Multi-buffering
nick
parents: 4873
diff changeset
1871 off[1] = besr.vid_buf_base_adrs_v[frame];
a71ef1642a8a Multi-buffering
nick
parents: 4873
diff changeset
1872 off[2] = besr.vid_buf_base_adrs_u[frame];
a71ef1642a8a Multi-buffering
nick
parents: 4873
diff changeset
1873 off[3] = besr.vid_buf_base_adrs_y[prev_frame];
a71ef1642a8a Multi-buffering
nick
parents: 4873
diff changeset
1874 off[4] = besr.vid_buf_base_adrs_v[prev_frame];
a71ef1642a8a Multi-buffering
nick
parents: 4873
diff changeset
1875 off[5] = besr.vid_buf_base_adrs_u[prev_frame];
4855
f7f847e2d7c2 Minor fixes and probably final fix of vsync
nick
parents: 4689
diff changeset
1876 radeon_fifo_wait(8);
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1877 OUTREG(OV0_REG_LOAD_CNTL, REG_LD_CTL_LOCK);
4666
a093bb34b723 - Shutdown capturing before playback
nick
parents: 4611
diff changeset
1878 radeon_engine_idle();
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1879 while(!(INREG(OV0_REG_LOAD_CNTL)&REG_LD_CTL_LOCK_READBACK));
4412
78878b1adb80 Correcting pointers on second buffer
nick
parents: 4373
diff changeset
1880 OUTREG(OV0_VID_BUF0_BASE_ADRS, off[0]);
78878b1adb80 Correcting pointers on second buffer
nick
parents: 4373
diff changeset
1881 OUTREG(OV0_VID_BUF1_BASE_ADRS, off[1]);
78878b1adb80 Correcting pointers on second buffer
nick
parents: 4373
diff changeset
1882 OUTREG(OV0_VID_BUF2_BASE_ADRS, off[2]);
4413
nick
parents: 4412
diff changeset
1883 OUTREG(OV0_VID_BUF3_BASE_ADRS, off[3]);
nick
parents: 4412
diff changeset
1884 OUTREG(OV0_VID_BUF4_BASE_ADRS, off[4]);
nick
parents: 4412
diff changeset
1885 OUTREG(OV0_VID_BUF5_BASE_ADRS, off[5]);
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1886 OUTREG(OV0_REG_LOAD_CNTL, 0);
4930
a71ef1642a8a Multi-buffering
nick
parents: 4873
diff changeset
1887 if(besr.vid_nbufs == 2) radeon_wait_vsync();
4030
922241968c63 Embedding vidix
nick
parents: 4015
diff changeset
1888 if(__verbose > 1) radeon_vid_dump_regs();
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1889 return 0;
872781fef1b3 preliminary version
nick
parents:
diff changeset
1890 }
872781fef1b3 preliminary version
nick
parents:
diff changeset
1891
4319
2d64382e8dcf intense->intensity + capability extension + fixing R200 color correction bug
nick
parents: 4286
diff changeset
1892 vidix_video_eq_t equal =
2d64382e8dcf intense->intensity + capability extension + fixing R200 color correction bug
nick
parents: 4286
diff changeset
1893 {
2d64382e8dcf intense->intensity + capability extension + fixing R200 color correction bug
nick
parents: 4286
diff changeset
1894 VEQ_CAP_BRIGHTNESS | VEQ_CAP_SATURATION
2d64382e8dcf intense->intensity + capability extension + fixing R200 color correction bug
nick
parents: 4286
diff changeset
1895 #ifndef RAGE128
2d64382e8dcf intense->intensity + capability extension + fixing R200 color correction bug
nick
parents: 4286
diff changeset
1896 | VEQ_CAP_CONTRAST | VEQ_CAP_HUE | VEQ_CAP_RGB_INTENSITY
2d64382e8dcf intense->intensity + capability extension + fixing R200 color correction bug
nick
parents: 4286
diff changeset
1897 #endif
2d64382e8dcf intense->intensity + capability extension + fixing R200 color correction bug
nick
parents: 4286
diff changeset
1898 ,
2d64382e8dcf intense->intensity + capability extension + fixing R200 color correction bug
nick
parents: 4286
diff changeset
1899 0, 0, 0, 0, 0, 0, 0, 0 };
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1900
872781fef1b3 preliminary version
nick
parents:
diff changeset
1901 int vixPlaybackGetEq( vidix_video_eq_t * eq)
872781fef1b3 preliminary version
nick
parents:
diff changeset
1902 {
872781fef1b3 preliminary version
nick
parents:
diff changeset
1903 memcpy(eq,&equal,sizeof(vidix_video_eq_t));
872781fef1b3 preliminary version
nick
parents:
diff changeset
1904 return 0;
872781fef1b3 preliminary version
nick
parents:
diff changeset
1905 }
872781fef1b3 preliminary version
nick
parents:
diff changeset
1906
4229
9a33ad2f3547 gamma correction support
nick
parents: 4201
diff changeset
1907 #ifndef RAGE128
9a33ad2f3547 gamma correction support
nick
parents: 4201
diff changeset
1908 #define RTFSaturation(a) (1.0 + ((a)*1.0)/1000.0)
9a33ad2f3547 gamma correction support
nick
parents: 4201
diff changeset
1909 #define RTFBrightness(a) (((a)*1.0)/2000.0)
4319
2d64382e8dcf intense->intensity + capability extension + fixing R200 color correction bug
nick
parents: 4286
diff changeset
1910 #define RTFIntensity(a) (((a)*1.0)/2000.0)
4229
9a33ad2f3547 gamma correction support
nick
parents: 4201
diff changeset
1911 #define RTFContrast(a) (1.0 + ((a)*1.0)/1000.0)
9a33ad2f3547 gamma correction support
nick
parents: 4201
diff changeset
1912 #define RTFHue(a) (((a)*3.1416)/1000.0)
9a33ad2f3547 gamma correction support
nick
parents: 4201
diff changeset
1913 #define RTFCheckParam(a) {if((a)<-1000) (a)=-1000; if((a)>1000) (a)=1000;}
9a33ad2f3547 gamma correction support
nick
parents: 4201
diff changeset
1914 #endif
9a33ad2f3547 gamma correction support
nick
parents: 4201
diff changeset
1915
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1916 int vixPlaybackSetEq( const vidix_video_eq_t * eq)
872781fef1b3 preliminary version
nick
parents:
diff changeset
1917 {
872781fef1b3 preliminary version
nick
parents:
diff changeset
1918 #ifdef RAGE128
872781fef1b3 preliminary version
nick
parents:
diff changeset
1919 int br,sat;
4229
9a33ad2f3547 gamma correction support
nick
parents: 4201
diff changeset
1920 #else
9a33ad2f3547 gamma correction support
nick
parents: 4201
diff changeset
1921 int itu_space;
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1922 #endif
4319
2d64382e8dcf intense->intensity + capability extension + fixing R200 color correction bug
nick
parents: 4286
diff changeset
1923 if(eq->cap & VEQ_CAP_BRIGHTNESS) equal.brightness = eq->brightness;
2d64382e8dcf intense->intensity + capability extension + fixing R200 color correction bug
nick
parents: 4286
diff changeset
1924 if(eq->cap & VEQ_CAP_CONTRAST) equal.contrast = eq->contrast;
2d64382e8dcf intense->intensity + capability extension + fixing R200 color correction bug
nick
parents: 4286
diff changeset
1925 if(eq->cap & VEQ_CAP_SATURATION) equal.saturation = eq->saturation;
2d64382e8dcf intense->intensity + capability extension + fixing R200 color correction bug
nick
parents: 4286
diff changeset
1926 if(eq->cap & VEQ_CAP_HUE) equal.hue = eq->hue;
2d64382e8dcf intense->intensity + capability extension + fixing R200 color correction bug
nick
parents: 4286
diff changeset
1927 if(eq->cap & VEQ_CAP_RGB_INTENSITY)
2d64382e8dcf intense->intensity + capability extension + fixing R200 color correction bug
nick
parents: 4286
diff changeset
1928 {
2d64382e8dcf intense->intensity + capability extension + fixing R200 color correction bug
nick
parents: 4286
diff changeset
1929 equal.red_intensity = eq->red_intensity;
2d64382e8dcf intense->intensity + capability extension + fixing R200 color correction bug
nick
parents: 4286
diff changeset
1930 equal.green_intensity = eq->green_intensity;
2d64382e8dcf intense->intensity + capability extension + fixing R200 color correction bug
nick
parents: 4286
diff changeset
1931 equal.blue_intensity = eq->blue_intensity;
2d64382e8dcf intense->intensity + capability extension + fixing R200 color correction bug
nick
parents: 4286
diff changeset
1932 }
2d64382e8dcf intense->intensity + capability extension + fixing R200 color correction bug
nick
parents: 4286
diff changeset
1933 equal.flags = eq->flags;
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1934 #ifdef RAGE128
872781fef1b3 preliminary version
nick
parents:
diff changeset
1935 br = equal.brightness * 64 / 1000;
4229
9a33ad2f3547 gamma correction support
nick
parents: 4201
diff changeset
1936 if(br < -64) br = -64; if(br > 63) br = 63;
4230
7444f7901ae2 Fixed saturation computing for rage128
nick
parents: 4229
diff changeset
1937 sat = (equal.saturation + 1000) * 16 / 1000;
4229
9a33ad2f3547 gamma correction support
nick
parents: 4201
diff changeset
1938 if(sat < 0) sat = 0; if(sat > 31) sat = 31;
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1939 OUTREG(OV0_COLOUR_CNTL, (br & 0x7f) | (sat << 8) | (sat << 16));
872781fef1b3 preliminary version
nick
parents:
diff changeset
1940 #else
4229
9a33ad2f3547 gamma correction support
nick
parents: 4201
diff changeset
1941 itu_space = equal.flags == VEQ_FLG_ITU_R_BT_709 ? 1 : 0;
9a33ad2f3547 gamma correction support
nick
parents: 4201
diff changeset
1942 RTFCheckParam(equal.brightness);
9a33ad2f3547 gamma correction support
nick
parents: 4201
diff changeset
1943 RTFCheckParam(equal.saturation);
9a33ad2f3547 gamma correction support
nick
parents: 4201
diff changeset
1944 RTFCheckParam(equal.contrast);
9a33ad2f3547 gamma correction support
nick
parents: 4201
diff changeset
1945 RTFCheckParam(equal.hue);
4319
2d64382e8dcf intense->intensity + capability extension + fixing R200 color correction bug
nick
parents: 4286
diff changeset
1946 RTFCheckParam(equal.red_intensity);
2d64382e8dcf intense->intensity + capability extension + fixing R200 color correction bug
nick
parents: 4286
diff changeset
1947 RTFCheckParam(equal.green_intensity);
2d64382e8dcf intense->intensity + capability extension + fixing R200 color correction bug
nick
parents: 4286
diff changeset
1948 RTFCheckParam(equal.blue_intensity);
4229
9a33ad2f3547 gamma correction support
nick
parents: 4201
diff changeset
1949 radeon_set_transform(RTFBrightness(equal.brightness),
9a33ad2f3547 gamma correction support
nick
parents: 4201
diff changeset
1950 RTFContrast(equal.contrast),
9a33ad2f3547 gamma correction support
nick
parents: 4201
diff changeset
1951 RTFSaturation(equal.saturation),
9a33ad2f3547 gamma correction support
nick
parents: 4201
diff changeset
1952 RTFHue(equal.hue),
4319
2d64382e8dcf intense->intensity + capability extension + fixing R200 color correction bug
nick
parents: 4286
diff changeset
1953 RTFIntensity(equal.red_intensity),
2d64382e8dcf intense->intensity + capability extension + fixing R200 color correction bug
nick
parents: 4286
diff changeset
1954 RTFIntensity(equal.green_intensity),
2d64382e8dcf intense->intensity + capability extension + fixing R200 color correction bug
nick
parents: 4286
diff changeset
1955 RTFIntensity(equal.blue_intensity),
4229
9a33ad2f3547 gamma correction support
nick
parents: 4201
diff changeset
1956 itu_space);
3996
872781fef1b3 preliminary version
nick
parents:
diff changeset
1957 #endif
872781fef1b3 preliminary version
nick
parents:
diff changeset
1958 return 0;
872781fef1b3 preliminary version
nick
parents:
diff changeset
1959 }
872781fef1b3 preliminary version
nick
parents:
diff changeset
1960
4611
7b793875a640 Get(Set) deinterlacing
nick
parents: 4571
diff changeset
1961 int vixPlaybackSetDeint( const vidix_deinterlace_t * info)
7b793875a640 Get(Set) deinterlacing
nick
parents: 4571
diff changeset
1962 {
7b793875a640 Get(Set) deinterlacing
nick
parents: 4571
diff changeset
1963 unsigned sflg;
7b793875a640 Get(Set) deinterlacing
nick
parents: 4571
diff changeset
1964 switch(info->flags)
7b793875a640 Get(Set) deinterlacing
nick
parents: 4571
diff changeset
1965 {
7b793875a640 Get(Set) deinterlacing
nick
parents: 4571
diff changeset
1966 default:
7b793875a640 Get(Set) deinterlacing
nick
parents: 4571
diff changeset
1967 case CFG_NON_INTERLACED:
7b793875a640 Get(Set) deinterlacing
nick
parents: 4571
diff changeset
1968 besr.deinterlace_on = 0;
7b793875a640 Get(Set) deinterlacing
nick
parents: 4571
diff changeset
1969 break;
7b793875a640 Get(Set) deinterlacing
nick
parents: 4571
diff changeset
1970 case CFG_EVEN_ODD_INTERLACING:
7b793875a640 Get(Set) deinterlacing
nick
parents: 4571
diff changeset
1971 case CFG_INTERLACED:
7b793875a640 Get(Set) deinterlacing
nick
parents: 4571
diff changeset
1972 besr.deinterlace_on = 1;
7b793875a640 Get(Set) deinterlacing
nick
parents: 4571
diff changeset
1973 besr.deinterlace_pattern = 0x900AAAAA;
7b793875a640 Get(Set) deinterlacing
nick
parents: 4571
diff changeset
1974 break;
7b793875a640 Get(Set) deinterlacing
nick
parents: 4571
diff changeset
1975 case CFG_ODD_EVEN_INTERLACING:
7b793875a640 Get(Set) deinterlacing
nick
parents: 4571
diff changeset
1976 besr.deinterlace_on = 1;
7b793875a640 Get(Set) deinterlacing
nick
parents: 4571
diff changeset
1977 besr.deinterlace_pattern = 0x00055555;
7b793875a640 Get(Set) deinterlacing
nick
parents: 4571
diff changeset
1978 break;
7b793875a640 Get(Set) deinterlacing
nick
parents: 4571
diff changeset
1979 case CFG_UNIQUE_INTERLACING:
7b793875a640 Get(Set) deinterlacing
nick
parents: 4571
diff changeset
1980 besr.deinterlace_on = 1;
7b793875a640 Get(Set) deinterlacing
nick
parents: 4571
diff changeset
1981 besr.deinterlace_pattern = info->deinterlace_pattern;
7b793875a640 Get(Set) deinterlacing
nick
parents: 4571
diff changeset
1982 break;
7b793875a640 Get(Set) deinterlacing
nick
parents: 4571
diff changeset
1983 }
7b793875a640 Get(Set) deinterlacing
nick
parents: 4571
diff changeset
1984 OUTREG(OV0_REG_LOAD_CNTL, REG_LD_CTL_LOCK);
7b793875a640 Get(Set) deinterlacing
nick
parents: 4571
diff changeset
1985 radeon_engine_idle();
7b793875a640 Get(Set) deinterlacing
nick
parents: 4571
diff changeset
1986 while(!(INREG(OV0_REG_LOAD_CNTL)&REG_LD_CTL_LOCK_READBACK));
7b793875a640 Get(Set) deinterlacing
nick
parents: 4571
diff changeset
1987 radeon_fifo_wait(15);
7b793875a640 Get(Set) deinterlacing
nick
parents: 4571
diff changeset
1988 sflg = INREG(OV0_SCALE_CNTL);
7b793875a640 Get(Set) deinterlacing
nick
parents: 4571
diff changeset
1989 if(besr.deinterlace_on)
7b793875a640 Get(Set) deinterlacing
nick
parents: 4571
diff changeset
1990 {
7b793875a640 Get(Set) deinterlacing
nick
parents: 4571
diff changeset
1991 OUTREG(OV0_SCALE_CNTL,sflg | SCALER_ADAPTIVE_DEINT);
7b793875a640 Get(Set) deinterlacing
nick
parents: 4571
diff changeset
1992 OUTREG(OV0_DEINTERLACE_PATTERN,besr.deinterlace_pattern);
7b793875a640 Get(Set) deinterlacing
nick
parents: 4571
diff changeset
1993 }
7b793875a640 Get(Set) deinterlacing
nick
parents: 4571
diff changeset
1994 else OUTREG(OV0_SCALE_CNTL,sflg & (~SCALER_ADAPTIVE_DEINT));
7b793875a640 Get(Set) deinterlacing
nick
parents: 4571
diff changeset
1995 OUTREG(OV0_REG_LOAD_CNTL, 0);
7b793875a640 Get(Set) deinterlacing
nick
parents: 4571
diff changeset
1996 return 0;
7b793875a640 Get(Set) deinterlacing
nick
parents: 4571
diff changeset
1997 }
7b793875a640 Get(Set) deinterlacing
nick
parents: 4571
diff changeset
1998
7b793875a640 Get(Set) deinterlacing
nick
parents: 4571
diff changeset
1999 int vixPlaybackGetDeint( vidix_deinterlace_t * info)
7b793875a640 Get(Set) deinterlacing
nick
parents: 4571
diff changeset
2000 {
7b793875a640 Get(Set) deinterlacing
nick
parents: 4571
diff changeset
2001 if(!besr.deinterlace_on) info->flags = CFG_NON_INTERLACED;
7b793875a640 Get(Set) deinterlacing
nick
parents: 4571
diff changeset
2002 else
7b793875a640 Get(Set) deinterlacing
nick
parents: 4571
diff changeset
2003 {
7b793875a640 Get(Set) deinterlacing
nick
parents: 4571
diff changeset
2004 info->flags = CFG_UNIQUE_INTERLACING;
7b793875a640 Get(Set) deinterlacing
nick
parents: 4571
diff changeset
2005 info->deinterlace_pattern = besr.deinterlace_pattern;
7b793875a640 Get(Set) deinterlacing
nick
parents: 4571
diff changeset
2006 }
7b793875a640 Get(Set) deinterlacing
nick
parents: 4571
diff changeset
2007 return 0;
7b793875a640 Get(Set) deinterlacing
nick
parents: 4571
diff changeset
2008 }
4869
15af74a11ce9 color key support
nick
parents: 4855
diff changeset
2009
15af74a11ce9 color key support
nick
parents: 4855
diff changeset
2010
15af74a11ce9 color key support
nick
parents: 4855
diff changeset
2011 /* Graphic keys */
15af74a11ce9 color key support
nick
parents: 4855
diff changeset
2012 static vidix_grkey_t radeon_grkey;
15af74a11ce9 color key support
nick
parents: 4855
diff changeset
2013
15af74a11ce9 color key support
nick
parents: 4855
diff changeset
2014 static void set_gr_key( void )
15af74a11ce9 color key support
nick
parents: 4855
diff changeset
2015 {
15af74a11ce9 color key support
nick
parents: 4855
diff changeset
2016 if(radeon_grkey.ckey.op == CKEY_TRUE)
15af74a11ce9 color key support
nick
parents: 4855
diff changeset
2017 {
6254
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
2018 int dbpp=radeon_vid_get_dbpp();
4869
15af74a11ce9 color key support
nick
parents: 4855
diff changeset
2019 besr.ckey_on=1;
15af74a11ce9 color key support
nick
parents: 4855
diff changeset
2020
6254
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
2021 switch(dbpp)
4869
15af74a11ce9 color key support
nick
parents: 4855
diff changeset
2022 {
15af74a11ce9 color key support
nick
parents: 4855
diff changeset
2023 case 15:
8856
b7d9b2c1faba Fix radeon 7500 and 8500 15- and 16-bit colour key
arpi
parents: 8855
diff changeset
2024 #ifdef RADEON
8858
a6fc826a2b98 Fix support for Radeon 9000
arpi
parents: 8857
diff changeset
2025 if(RadeonFamily > 100)
8856
b7d9b2c1faba Fix radeon 7500 and 8500 15- and 16-bit colour key
arpi
parents: 8855
diff changeset
2026 besr.graphics_key_clr=
b7d9b2c1faba Fix radeon 7500 and 8500 15- and 16-bit colour key
arpi
parents: 8855
diff changeset
2027 ((radeon_grkey.ckey.blue &0xF8))
b7d9b2c1faba Fix radeon 7500 and 8500 15- and 16-bit colour key
arpi
parents: 8855
diff changeset
2028 | ((radeon_grkey.ckey.green&0xF8)<<8)
b7d9b2c1faba Fix radeon 7500 and 8500 15- and 16-bit colour key
arpi
parents: 8855
diff changeset
2029 | ((radeon_grkey.ckey.red &0xF8)<<16);
b7d9b2c1faba Fix radeon 7500 and 8500 15- and 16-bit colour key
arpi
parents: 8855
diff changeset
2030 else
b7d9b2c1faba Fix radeon 7500 and 8500 15- and 16-bit colour key
arpi
parents: 8855
diff changeset
2031 #endif
4869
15af74a11ce9 color key support
nick
parents: 4855
diff changeset
2032 besr.graphics_key_clr=
15af74a11ce9 color key support
nick
parents: 4855
diff changeset
2033 ((radeon_grkey.ckey.blue &0xF8)>>3)
15af74a11ce9 color key support
nick
parents: 4855
diff changeset
2034 | ((radeon_grkey.ckey.green&0xF8)<<2)
15af74a11ce9 color key support
nick
parents: 4855
diff changeset
2035 | ((radeon_grkey.ckey.red &0xF8)<<7);
15af74a11ce9 color key support
nick
parents: 4855
diff changeset
2036 break;
15af74a11ce9 color key support
nick
parents: 4855
diff changeset
2037 case 16:
8856
b7d9b2c1faba Fix radeon 7500 and 8500 15- and 16-bit colour key
arpi
parents: 8855
diff changeset
2038 #ifdef RADEON
b7d9b2c1faba Fix radeon 7500 and 8500 15- and 16-bit colour key
arpi
parents: 8855
diff changeset
2039 /* This test may be too general/specific */
8858
a6fc826a2b98 Fix support for Radeon 9000
arpi
parents: 8857
diff changeset
2040 if(RadeonFamily > 100)
8856
b7d9b2c1faba Fix radeon 7500 and 8500 15- and 16-bit colour key
arpi
parents: 8855
diff changeset
2041 besr.graphics_key_clr=
b7d9b2c1faba Fix radeon 7500 and 8500 15- and 16-bit colour key
arpi
parents: 8855
diff changeset
2042 ((radeon_grkey.ckey.blue &0xF8))
b7d9b2c1faba Fix radeon 7500 and 8500 15- and 16-bit colour key
arpi
parents: 8855
diff changeset
2043 | ((radeon_grkey.ckey.green&0xFC)<<8)
b7d9b2c1faba Fix radeon 7500 and 8500 15- and 16-bit colour key
arpi
parents: 8855
diff changeset
2044 | ((radeon_grkey.ckey.red &0xF8)<<16);
b7d9b2c1faba Fix radeon 7500 and 8500 15- and 16-bit colour key
arpi
parents: 8855
diff changeset
2045 else
b7d9b2c1faba Fix radeon 7500 and 8500 15- and 16-bit colour key
arpi
parents: 8855
diff changeset
2046 #endif
4869
15af74a11ce9 color key support
nick
parents: 4855
diff changeset
2047 besr.graphics_key_clr=
15af74a11ce9 color key support
nick
parents: 4855
diff changeset
2048 ((radeon_grkey.ckey.blue &0xF8)>>3)
15af74a11ce9 color key support
nick
parents: 4855
diff changeset
2049 | ((radeon_grkey.ckey.green&0xFC)<<3)
15af74a11ce9 color key support
nick
parents: 4855
diff changeset
2050 | ((radeon_grkey.ckey.red &0xF8)<<8);
15af74a11ce9 color key support
nick
parents: 4855
diff changeset
2051 break;
15af74a11ce9 color key support
nick
parents: 4855
diff changeset
2052 case 24:
15af74a11ce9 color key support
nick
parents: 4855
diff changeset
2053 besr.graphics_key_clr=
15af74a11ce9 color key support
nick
parents: 4855
diff changeset
2054 ((radeon_grkey.ckey.blue &0xFF))
15af74a11ce9 color key support
nick
parents: 4855
diff changeset
2055 | ((radeon_grkey.ckey.green&0xFF)<<8)
15af74a11ce9 color key support
nick
parents: 4855
diff changeset
2056 | ((radeon_grkey.ckey.red &0xFF)<<16);
15af74a11ce9 color key support
nick
parents: 4855
diff changeset
2057 break;
15af74a11ce9 color key support
nick
parents: 4855
diff changeset
2058 case 32:
15af74a11ce9 color key support
nick
parents: 4855
diff changeset
2059 besr.graphics_key_clr=
15af74a11ce9 color key support
nick
parents: 4855
diff changeset
2060 ((radeon_grkey.ckey.blue &0xFF))
15af74a11ce9 color key support
nick
parents: 4855
diff changeset
2061 | ((radeon_grkey.ckey.green&0xFF)<<8)
15af74a11ce9 color key support
nick
parents: 4855
diff changeset
2062 | ((radeon_grkey.ckey.red &0xFF)<<16);
15af74a11ce9 color key support
nick
parents: 4855
diff changeset
2063 break;
15af74a11ce9 color key support
nick
parents: 4855
diff changeset
2064 default:
15af74a11ce9 color key support
nick
parents: 4855
diff changeset
2065 besr.ckey_on=0;
15af74a11ce9 color key support
nick
parents: 4855
diff changeset
2066 besr.graphics_key_msk=0;
15af74a11ce9 color key support
nick
parents: 4855
diff changeset
2067 besr.graphics_key_clr=0;
15af74a11ce9 color key support
nick
parents: 4855
diff changeset
2068 }
6254
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
2069 #ifdef RAGE128
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
2070 besr.graphics_key_msk=(1<<dbpp)-1;
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
2071 besr.ckey_cntl = VIDEO_KEY_FN_TRUE|GRAPHIC_KEY_FN_NE|CMP_MIX_AND;
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
2072 #else
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
2073 besr.graphics_key_msk=besr.graphics_key_clr;
8876
026ed72206ba patch which removes the rage_ckey_model fix and updates
arpi
parents: 8859
diff changeset
2074 besr.ckey_cntl = VIDEO_KEY_FN_TRUE|CMP_MIX_AND|GRAPHIC_KEY_FN_EQ;
6254
034b12194350 rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents: 5165
diff changeset
2075 #endif
4869
15af74a11ce9 color key support
nick
parents: 4855
diff changeset
2076 }
15af74a11ce9 color key support
nick
parents: 4855
diff changeset
2077 else
15af74a11ce9 color key support
nick
parents: 4855
diff changeset
2078 {
15af74a11ce9 color key support
nick
parents: 4855
diff changeset
2079 besr.ckey_on=0;
15af74a11ce9 color key support
nick
parents: 4855
diff changeset
2080 besr.graphics_key_msk=0;
15af74a11ce9 color key support
nick
parents: 4855
diff changeset
2081 besr.graphics_key_clr=0;
5044
43dc579db3d1 Fixed color key definitions. Waiting for new bugreports ;)
nick
parents: 5041
diff changeset
2082 besr.ckey_cntl = VIDEO_KEY_FN_TRUE|GRAPHIC_KEY_FN_TRUE|CMP_MIX_AND;
4869
15af74a11ce9 color key support
nick
parents: 4855
diff changeset
2083 }
5044
43dc579db3d1 Fixed color key definitions. Waiting for new bugreports ;)
nick
parents: 5041
diff changeset
2084 radeon_fifo_wait(3);
4869
15af74a11ce9 color key support
nick
parents: 4855
diff changeset
2085 OUTREG(OV0_GRAPHICS_KEY_MSK, besr.graphics_key_msk);
15af74a11ce9 color key support
nick
parents: 4855
diff changeset
2086 OUTREG(OV0_GRAPHICS_KEY_CLR, besr.graphics_key_clr);
15af74a11ce9 color key support
nick
parents: 4855
diff changeset
2087 OUTREG(OV0_KEY_CNTL,besr.ckey_cntl);
15af74a11ce9 color key support
nick
parents: 4855
diff changeset
2088 }
15af74a11ce9 color key support
nick
parents: 4855
diff changeset
2089
15af74a11ce9 color key support
nick
parents: 4855
diff changeset
2090 int vixGetGrKeys(vidix_grkey_t *grkey)
15af74a11ce9 color key support
nick
parents: 4855
diff changeset
2091 {
15af74a11ce9 color key support
nick
parents: 4855
diff changeset
2092 memcpy(grkey, &radeon_grkey, sizeof(vidix_grkey_t));
15af74a11ce9 color key support
nick
parents: 4855
diff changeset
2093 return(0);
15af74a11ce9 color key support
nick
parents: 4855
diff changeset
2094 }
15af74a11ce9 color key support
nick
parents: 4855
diff changeset
2095
15af74a11ce9 color key support
nick
parents: 4855
diff changeset
2096 int vixSetGrKeys(const vidix_grkey_t *grkey)
15af74a11ce9 color key support
nick
parents: 4855
diff changeset
2097 {
15af74a11ce9 color key support
nick
parents: 4855
diff changeset
2098 memcpy(&radeon_grkey, grkey, sizeof(vidix_grkey_t));
15af74a11ce9 color key support
nick
parents: 4855
diff changeset
2099 set_gr_key();
15af74a11ce9 color key support
nick
parents: 4855
diff changeset
2100 return(0);
15af74a11ce9 color key support
nick
parents: 4855
diff changeset
2101 }