Mercurial > mplayer.hg
annotate vidix/drivers/pm3_vid.c @ 9288:69872fa8b0e3
fixing al3x's 10l's
author | gabucino |
---|---|
date | Wed, 05 Feb 2003 21:22:06 +0000 |
parents | 034b12194350 |
children | f6d2772efca3 |
rev | line source |
---|---|
6254
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
1 /** |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
2 Driver for 3DLabs GLINT R3 and Permedia3 chips. |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
3 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
4 Copyright (C) 2002 Måns Rullgård |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
5 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
6 This program is free software; you can redistribute it and/or modify |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
7 it under the terms of the GNU General Public License as published by |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
8 the Free Software Foundation; either version 2 of the License, or |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
9 (at your option) any later version. |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
10 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
11 This program is distributed in the hope that it will be useful, |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
12 but WITHOUT ANY WARRANTY; without even the implied warranty of |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
14 GNU General Public License for more details. |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
15 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
16 You should have received a copy of the GNU General Public License |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
17 along with this program; if not, write to the Free Software |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
19 **/ |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
20 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
21 #include <errno.h> |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
22 #include <stdio.h> |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
23 #include <stdlib.h> |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
24 #include <string.h> |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
25 #include <inttypes.h> |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
26 #include <unistd.h> |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
27 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
28 #include "../vidix.h" |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
29 #include "../fourcc.h" |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
30 #include "../../libdha/libdha.h" |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
31 #include "../../libdha/pci_ids.h" |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
32 #include "../../libdha/pci_names.h" |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
33 #include "../../config.h" |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
34 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
35 #include "pm3_regs.h" |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
36 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
37 #if 0 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
38 #define TRACE_ENTER() fprintf(stderr, "%s: enter\n", __FUNCTION__) |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
39 #define TRACE_EXIT() fprintf(stderr, "%s: exit\n", __FUNCTION__) |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
40 #else |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
41 #define TRACE_ENTER() |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
42 #define TRACE_EXIT() |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
43 #endif |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
44 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
45 pciinfo_t pci_info; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
46 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
47 void *pm3_reg_base; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
48 void *pm3_mem; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
49 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
50 static vidix_capability_t pm3_cap = |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
51 { |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
52 "3DLabs GLINT R3/Permedia3 driver", |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
53 "Måns Rullgård <mru@users.sf.net>", |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
54 TYPE_OUTPUT, |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
55 { 0, 0, 0, 0 }, |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
56 2048, |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
57 2048, |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
58 4, |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
59 4, |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
60 -1, |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
61 FLAG_UPSCALER|FLAG_DOWNSCALER, |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
62 VENDOR_3DLABS, |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
63 -1, |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
64 { 0, 0, 0, 0 } |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
65 }; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
66 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
67 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
68 unsigned int vixGetVersion(void) |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
69 { |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
70 return(VIDIX_VERSION); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
71 } |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
72 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
73 static unsigned short pm3_card_ids[] = |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
74 { |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
75 DEVICE_3DLABS_GLINT_R3 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
76 }; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
77 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
78 static int find_chip(unsigned chip_id) |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
79 { |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
80 unsigned i; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
81 for(i = 0;i < sizeof(pm3_card_ids)/sizeof(unsigned short);i++) |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
82 { |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
83 if(chip_id == pm3_card_ids[i]) return i; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
84 } |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
85 return -1; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
86 } |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
87 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
88 int vixProbe(int verbose, int force) |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
89 { |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
90 pciinfo_t lst[MAX_PCI_DEVICES]; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
91 unsigned i,num_pci; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
92 int err; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
93 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
94 err = pci_scan(lst,&num_pci); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
95 if(err) |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
96 { |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
97 printf("[pm3] Error occured during pci scan: %s\n",strerror(err)); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
98 return err; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
99 } |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
100 else |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
101 { |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
102 err = ENXIO; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
103 for(i=0; i < num_pci; i++) |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
104 { |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
105 if(lst[i].vendor == VENDOR_3DLABS) |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
106 { |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
107 int idx; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
108 const char *dname; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
109 idx = find_chip(lst[i].device); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
110 if(idx == -1) |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
111 continue; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
112 dname = pci_device_name(VENDOR_3DLABS, lst[i].device); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
113 dname = dname ? dname : "Unknown chip"; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
114 printf("[pm3] Found chip: %s\n", dname); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
115 pm3_cap.device_id = lst[i].device; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
116 err = 0; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
117 memcpy(&pci_info, &lst[i], sizeof(pciinfo_t)); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
118 break; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
119 } |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
120 } |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
121 } |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
122 if(err && verbose) printf("[pm3] Can't find chip\n"); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
123 return err; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
124 } |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
125 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
126 #define PRINT_REG(reg) \ |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
127 { \ |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
128 long _foo = READ_REG(reg); \ |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
129 printf("[pm3] " #reg " (%x) = %#lx (%li)\n", reg, _foo, _foo); \ |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
130 } |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
131 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
132 int vixInit(void) |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
133 { |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
134 pm3_reg_base = map_phys_mem(pci_info.base0, 0x20000); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
135 pm3_mem = map_phys_mem(pci_info.base2, 0x2000000); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
136 return 0; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
137 } |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
138 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
139 void vixDestroy(void) |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
140 { |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
141 unmap_phys_mem(pm3_reg_base, 0x20000); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
142 unmap_phys_mem(pm3_mem, 0x2000000); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
143 } |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
144 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
145 int vixGetCapability(vidix_capability_t *to) |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
146 { |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
147 memcpy(to, &pm3_cap, sizeof(vidix_capability_t)); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
148 return 0; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
149 } |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
150 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
151 static int is_supported_fourcc(uint32_t fourcc) |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
152 { |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
153 switch(fourcc){ |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
154 case IMGFMT_YUY2: |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
155 case IMGFMT_UYVY: |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
156 return 1; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
157 default: |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
158 return 0; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
159 } |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
160 } |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
161 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
162 int vixQueryFourcc(vidix_fourcc_t *to) |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
163 { |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
164 if(is_supported_fourcc(to->fourcc)) |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
165 { |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
166 to->depth = VID_DEPTH_1BPP | VID_DEPTH_2BPP | |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
167 VID_DEPTH_4BPP | VID_DEPTH_8BPP | |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
168 VID_DEPTH_12BPP| VID_DEPTH_15BPP| |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
169 VID_DEPTH_16BPP| VID_DEPTH_24BPP| |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
170 VID_DEPTH_32BPP; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
171 to->flags = VID_CAP_EXPAND | VID_CAP_SHRINK | VID_CAP_COLORKEY; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
172 return 0; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
173 } |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
174 else to->depth = to->flags = 0; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
175 return ENOSYS; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
176 } |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
177 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
178 #define FORMAT_RGB8888 PM3VideoOverlayMode_COLORFORMAT_RGB8888 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
179 #define FORMAT_RGB4444 PM3VideoOverlayMode_COLORFORMAT_RGB4444 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
180 #define FORMAT_RGB5551 PM3VideoOverlayMode_COLORFORMAT_RGB5551 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
181 #define FORMAT_RGB565 PM3VideoOverlayMode_COLORFORMAT_RGB565 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
182 #define FORMAT_RGB332 PM3VideoOverlayMode_COLORFORMAT_RGB332 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
183 #define FORMAT_BGR8888 PM3VideoOverlayMode_COLORFORMAT_BGR8888 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
184 #define FORMAT_BGR4444 PM3VideoOverlayMode_COLORFORMAT_BGR4444 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
185 #define FORMAT_BGR5551 PM3VideoOverlayMode_COLORFORMAT_BGR5551 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
186 #define FORMAT_BGR565 PM3VideoOverlayMode_COLORFORMAT_BGR565 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
187 #define FORMAT_BGR332 PM3VideoOverlayMode_COLORFORMAT_BGR332 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
188 #define FORMAT_CI8 PM3VideoOverlayMode_COLORFORMAT_CI8 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
189 #define FORMAT_VUY444 PM3VideoOverlayMode_COLORFORMAT_VUY444 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
190 #define FORMAT_YUV444 PM3VideoOverlayMode_COLORFORMAT_YUV444 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
191 #define FORMAT_VUY422 PM3VideoOverlayMode_COLORFORMAT_VUY422 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
192 #define FORMAT_YUV422 PM3VideoOverlayMode_COLORFORMAT_YUV422 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
193 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
194 /* Notice, have to check that we dont overflow the deltas here ... */ |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
195 static void |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
196 compute_scale_factor( |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
197 short* src_w, short* dst_w, |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
198 unsigned int* shrink_delta, unsigned int* zoom_delta) |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
199 { |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
200 /* NOTE: If we don't return reasonable values here then the video |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
201 * unit can potential shut off and won't display an image until re-enabled. |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
202 * Seems as though the zoom_delta is o.k, and I've not had the problem. |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
203 * The 'shrink_delta' is prone to this the most - FIXME ! */ |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
204 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
205 if (*src_w >= *dst_w) { |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
206 *src_w &= ~0x3; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
207 *dst_w &= ~0x3; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
208 *shrink_delta = (((*src_w << 16) / *dst_w) + 0x0f) & 0x0ffffff0; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
209 *zoom_delta = 1<<16; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
210 if ( ((*shrink_delta * *dst_w) >> 16) & 0x03 ) |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
211 *shrink_delta += 0x10; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
212 } else { |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
213 *src_w &= ~0x3; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
214 *dst_w &= ~0x3; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
215 *zoom_delta = (((*src_w << 16) / *dst_w) + 0x0f) & 0x0001fff0; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
216 *shrink_delta = 1<<16; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
217 if ( ((*zoom_delta * *dst_w) >> 16) & 0x03 ) |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
218 *zoom_delta += 0x10; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
219 } |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
220 } |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
221 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
222 static int frames[VID_PLAY_MAXFRAMES]; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
223 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
224 static long overlay_mode, overlay_control; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
225 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
226 int vixConfigPlayback(vidix_playback_t *info) |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
227 { |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
228 int shrink, zoom; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
229 short src_w, drw_w; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
230 short src_h, drw_h; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
231 long base0; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
232 int pitch; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
233 int format; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
234 unsigned int i; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
235 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
236 TRACE_ENTER(); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
237 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
238 if(!is_supported_fourcc(info->fourcc)) |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
239 return -1; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
240 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
241 switch(info->fourcc){ |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
242 case IMGFMT_YUY2: |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
243 format = FORMAT_YUV422; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
244 break; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
245 case IMGFMT_UYVY: |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
246 format = FORMAT_VUY422; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
247 break; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
248 default: |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
249 return -1; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
250 } |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
251 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
252 src_w = info->src.w; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
253 src_h = info->src.h; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
254 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
255 drw_w = info->dest.w; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
256 drw_h = info->dest.h; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
257 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
258 pitch = src_w; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
259 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
260 /* Assume we have 16 MB to play with */ |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
261 info->num_frames = 0x1000000 / (pitch * src_h * 2); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
262 if(info->num_frames > VID_PLAY_MAXFRAMES) |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
263 info->num_frames = VID_PLAY_MAXFRAMES; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
264 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
265 /* Start at 16 MB. Let's hope it's not in use. */ |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
266 base0 = 0x1000000; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
267 info->dga_addr = pm3_mem + base0; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
268 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
269 info->dest.pitch.y = 2; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
270 info->dest.pitch.u = 0; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
271 info->dest.pitch.v = 0; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
272 info->offset.y = 0; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
273 info->offset.v = 0; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
274 info->offset.u = 0; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
275 info->frame_size = pitch * src_h * 2; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
276 for(i = 0; i < info->num_frames; i++){ |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
277 info->offsets[i] = info->frame_size * i; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
278 frames[i] = (base0 + info->offsets[i]) >> 1; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
279 } |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
280 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
281 compute_scale_factor(&src_w, &drw_w, &shrink, &zoom); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
282 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
283 WRITE_REG(PM3VideoOverlayBase0, base0 >> 1); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
284 WRITE_REG(PM3VideoOverlayStride, PM3VideoOverlayStride_STRIDE(pitch)); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
285 WRITE_REG(PM3VideoOverlayWidth, PM3VideoOverlayWidth_WIDTH(src_w)); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
286 WRITE_REG(PM3VideoOverlayHeight, PM3VideoOverlayHeight_HEIGHT(src_h)); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
287 WRITE_REG(PM3VideoOverlayOrigin, 0); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
288 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
289 /* Scale the source to the destinationsize */ |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
290 if (src_h == drw_h) { |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
291 WRITE_REG(PM3VideoOverlayYDelta, PM3VideoOverlayYDelta_NONE); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
292 } else { |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
293 WRITE_REG(PM3VideoOverlayYDelta, |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
294 PM3VideoOverlayYDelta_DELTA(src_h, drw_h)); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
295 } |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
296 if (src_w == drw_w) { |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
297 WRITE_REG(PM3VideoOverlayShrinkXDelta, 1<<16); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
298 WRITE_REG(PM3VideoOverlayZoomXDelta, 1<<16); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
299 } else { |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
300 WRITE_REG(PM3VideoOverlayShrinkXDelta, shrink); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
301 WRITE_REG(PM3VideoOverlayZoomXDelta, zoom); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
302 } |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
303 WRITE_REG(PM3VideoOverlayIndex, 0); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
304 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
305 /* Now set the ramdac video overlay region and mode */ |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
306 RAMDAC_SET_REG(PM3RD_VideoOverlayXStartLow, (info->dest.x & 0xff)); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
307 RAMDAC_SET_REG(PM3RD_VideoOverlayXStartHigh, (info->dest.x & 0xf00)>>8); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
308 RAMDAC_SET_REG(PM3RD_VideoOverlayXEndLow, (info->dest.x+drw_w) & 0xff); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
309 RAMDAC_SET_REG(PM3RD_VideoOverlayXEndHigh, |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
310 ((info->dest.x+drw_w) & 0xf00)>>8); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
311 RAMDAC_SET_REG(PM3RD_VideoOverlayYStartLow, (info->dest.y & 0xff)); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
312 RAMDAC_SET_REG(PM3RD_VideoOverlayYStartHigh, (info->dest.y & 0xf00)>>8); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
313 RAMDAC_SET_REG(PM3RD_VideoOverlayYEndLow, (info->dest.y+drw_h) & 0xff); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
314 RAMDAC_SET_REG(PM3RD_VideoOverlayYEndHigh, |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
315 ((info->dest.y+drw_h) & 0xf00)>>8); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
316 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
317 RAMDAC_SET_REG(PM3RD_VideoOverlayKeyR, 0xff); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
318 RAMDAC_SET_REG(PM3RD_VideoOverlayKeyG, 0x00); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
319 RAMDAC_SET_REG(PM3RD_VideoOverlayKeyB, 0xff); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
320 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
321 overlay_mode = |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
322 1 << 5 | |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
323 format | |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
324 PM3VideoOverlayMode_FILTER_FULL | |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
325 PM3VideoOverlayMode_BUFFERSYNC_MANUAL | |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
326 PM3VideoOverlayMode_FLIP_VIDEO; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
327 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
328 overlay_control = |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
329 PM3RD_VideoOverlayControl_KEY_COLOR | |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
330 PM3RD_VideoOverlayControl_MODE_MAINKEY | |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
331 PM3RD_VideoOverlayControl_DIRECTCOLOR_ENABLED; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
332 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
333 TRACE_EXIT(); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
334 return 0; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
335 } |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
336 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
337 int vixPlaybackOn(void) |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
338 { |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
339 TRACE_ENTER(); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
340 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
341 WRITE_REG(PM3VideoOverlayMode, |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
342 overlay_mode | PM3VideoOverlayMode_ENABLE); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
343 RAMDAC_SET_REG(PM3RD_VideoOverlayControl, |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
344 overlay_control | PM3RD_VideoOverlayControl_ENABLE); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
345 WRITE_REG(PM3VideoOverlayUpdate, |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
346 PM3VideoOverlayUpdate_ENABLE); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
347 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
348 TRACE_EXIT(); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
349 return 0; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
350 } |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
351 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
352 int vixPlaybackOff(void) |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
353 { |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
354 RAMDAC_SET_REG(PM3RD_VideoOverlayControl, |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
355 PM3RD_VideoOverlayControl_DISABLE); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
356 WRITE_REG(PM3VideoOverlayMode, |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
357 PM3VideoOverlayMode_DISABLE); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
358 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
359 RAMDAC_SET_REG(PM3RD_VideoOverlayKeyR, 0x01); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
360 RAMDAC_SET_REG(PM3RD_VideoOverlayKeyG, 0x01); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
361 RAMDAC_SET_REG(PM3RD_VideoOverlayKeyB, 0xfe); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
362 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
363 return 0; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
364 } |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
365 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
366 int vixPlaybackFrameSelect(unsigned int frame) |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
367 { |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
368 WRITE_REG(PM3VideoOverlayBase0, frames[frame]); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
369 return 0; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
370 } |