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