Mercurial > mplayer.hg
annotate vidix/drivers/pm3_vid.c @ 14160:467dae0f6c68
disable demuxer_bmp,
that works with signle image in single file.
removing is part of vu1nerabi1ity fix.
author | iive |
---|---|
date | Wed, 15 Dec 2004 18:39:51 +0000 |
parents | 972d1998bde9 |
children | 401b440a6d76 |
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 { |
11678
972d1998bde9
occured --> occurred typo patch by Clinton Roy <croy@dstc.edu.au>
diego
parents:
11000
diff
changeset
|
97 printf("[pm3] Error occurred during pci scan: %s\n",strerror(err)); |
6254
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); |
9767
f6d2772efca3
Ignore disabled cards. (Jon Burgess <jburgess@uklinux.net>)
ranma
parents:
6254
diff
changeset
|
115 if ((lst[i].command & PCI_COMMAND_IO) == 0) |
f6d2772efca3
Ignore disabled cards. (Jon Burgess <jburgess@uklinux.net>)
ranma
parents:
6254
diff
changeset
|
116 { |
f6d2772efca3
Ignore disabled cards. (Jon Burgess <jburgess@uklinux.net>)
ranma
parents:
6254
diff
changeset
|
117 printf("[pm3] Device is disabled, ignoring\n"); |
f6d2772efca3
Ignore disabled cards. (Jon Burgess <jburgess@uklinux.net>)
ranma
parents:
6254
diff
changeset
|
118 continue; |
f6d2772efca3
Ignore disabled cards. (Jon Burgess <jburgess@uklinux.net>)
ranma
parents:
6254
diff
changeset
|
119 } |
6254
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
120 pm3_cap.device_id = lst[i].device; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
121 err = 0; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
122 memcpy(&pci_info, &lst[i], sizeof(pciinfo_t)); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
123 break; |
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 } |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
127 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
|
128 return err; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
129 } |
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 #define PRINT_REG(reg) \ |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
132 { \ |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
133 long _foo = READ_REG(reg); \ |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
134 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
|
135 } |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
136 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
137 int vixInit(void) |
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 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
|
140 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
|
141 return 0; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
142 } |
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 void vixDestroy(void) |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
145 { |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
146 unmap_phys_mem(pm3_reg_base, 0x20000); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
147 unmap_phys_mem(pm3_mem, 0x2000000); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
148 } |
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 int vixGetCapability(vidix_capability_t *to) |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
151 { |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
152 memcpy(to, &pm3_cap, sizeof(vidix_capability_t)); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
153 return 0; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
154 } |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
155 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
156 static int is_supported_fourcc(uint32_t fourcc) |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
157 { |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
158 switch(fourcc){ |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
159 case IMGFMT_YUY2: |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
160 case IMGFMT_UYVY: |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
161 return 1; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
162 default: |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
163 return 0; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
164 } |
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 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
167 int vixQueryFourcc(vidix_fourcc_t *to) |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
168 { |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
169 if(is_supported_fourcc(to->fourcc)) |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
170 { |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
171 to->depth = VID_DEPTH_1BPP | VID_DEPTH_2BPP | |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
172 VID_DEPTH_4BPP | VID_DEPTH_8BPP | |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
173 VID_DEPTH_12BPP| VID_DEPTH_15BPP| |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
174 VID_DEPTH_16BPP| VID_DEPTH_24BPP| |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
175 VID_DEPTH_32BPP; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
176 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
|
177 return 0; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
178 } |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
179 else to->depth = to->flags = 0; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
180 return ENOSYS; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
181 } |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
182 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
183 #define FORMAT_RGB8888 PM3VideoOverlayMode_COLORFORMAT_RGB8888 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
184 #define FORMAT_RGB4444 PM3VideoOverlayMode_COLORFORMAT_RGB4444 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
185 #define FORMAT_RGB5551 PM3VideoOverlayMode_COLORFORMAT_RGB5551 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
186 #define FORMAT_RGB565 PM3VideoOverlayMode_COLORFORMAT_RGB565 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
187 #define FORMAT_RGB332 PM3VideoOverlayMode_COLORFORMAT_RGB332 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
188 #define FORMAT_BGR8888 PM3VideoOverlayMode_COLORFORMAT_BGR8888 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
189 #define FORMAT_BGR4444 PM3VideoOverlayMode_COLORFORMAT_BGR4444 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
190 #define FORMAT_BGR5551 PM3VideoOverlayMode_COLORFORMAT_BGR5551 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
191 #define FORMAT_BGR565 PM3VideoOverlayMode_COLORFORMAT_BGR565 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
192 #define FORMAT_BGR332 PM3VideoOverlayMode_COLORFORMAT_BGR332 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
193 #define FORMAT_CI8 PM3VideoOverlayMode_COLORFORMAT_CI8 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
194 #define FORMAT_VUY444 PM3VideoOverlayMode_COLORFORMAT_VUY444 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
195 #define FORMAT_YUV444 PM3VideoOverlayMode_COLORFORMAT_YUV444 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
196 #define FORMAT_VUY422 PM3VideoOverlayMode_COLORFORMAT_VUY422 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
197 #define FORMAT_YUV422 PM3VideoOverlayMode_COLORFORMAT_YUV422 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
198 |
11000 | 199 /* Notice, have to check that we don't overflow the deltas here ... */ |
6254
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
200 static void |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
201 compute_scale_factor( |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
202 short* src_w, short* dst_w, |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
203 unsigned int* shrink_delta, unsigned int* zoom_delta) |
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 /* 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
|
206 * 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
|
207 * 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
|
208 * 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
|
209 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
210 if (*src_w >= *dst_w) { |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
211 *src_w &= ~0x3; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
212 *dst_w &= ~0x3; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
213 *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
|
214 *zoom_delta = 1<<16; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
215 if ( ((*shrink_delta * *dst_w) >> 16) & 0x03 ) |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
216 *shrink_delta += 0x10; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
217 } else { |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
218 *src_w &= ~0x3; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
219 *dst_w &= ~0x3; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
220 *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
|
221 *shrink_delta = 1<<16; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
222 if ( ((*zoom_delta * *dst_w) >> 16) & 0x03 ) |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
223 *zoom_delta += 0x10; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
224 } |
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 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
227 static int frames[VID_PLAY_MAXFRAMES]; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
228 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
229 static long overlay_mode, overlay_control; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
230 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
231 int vixConfigPlayback(vidix_playback_t *info) |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
232 { |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
233 int shrink, zoom; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
234 short src_w, drw_w; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
235 short src_h, drw_h; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
236 long base0; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
237 int pitch; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
238 int format; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
239 unsigned int i; |
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 TRACE_ENTER(); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
242 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
243 if(!is_supported_fourcc(info->fourcc)) |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
244 return -1; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
245 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
246 switch(info->fourcc){ |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
247 case IMGFMT_YUY2: |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
248 format = FORMAT_YUV422; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
249 break; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
250 case IMGFMT_UYVY: |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
251 format = FORMAT_VUY422; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
252 break; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
253 default: |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
254 return -1; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
255 } |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
256 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
257 src_w = info->src.w; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
258 src_h = info->src.h; |
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 drw_w = info->dest.w; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
261 drw_h = info->dest.h; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
262 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
263 pitch = src_w; |
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 /* Assume we have 16 MB to play with */ |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
266 info->num_frames = 0x1000000 / (pitch * src_h * 2); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
267 if(info->num_frames > VID_PLAY_MAXFRAMES) |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
268 info->num_frames = VID_PLAY_MAXFRAMES; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
269 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
270 /* 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
|
271 base0 = 0x1000000; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
272 info->dga_addr = pm3_mem + base0; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
273 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
274 info->dest.pitch.y = 2; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
275 info->dest.pitch.u = 0; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
276 info->dest.pitch.v = 0; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
277 info->offset.y = 0; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
278 info->offset.v = 0; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
279 info->offset.u = 0; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
280 info->frame_size = pitch * src_h * 2; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
281 for(i = 0; i < info->num_frames; i++){ |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
282 info->offsets[i] = info->frame_size * i; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
283 frames[i] = (base0 + info->offsets[i]) >> 1; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
284 } |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
285 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
286 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
|
287 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
288 WRITE_REG(PM3VideoOverlayBase0, base0 >> 1); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
289 WRITE_REG(PM3VideoOverlayStride, PM3VideoOverlayStride_STRIDE(pitch)); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
290 WRITE_REG(PM3VideoOverlayWidth, PM3VideoOverlayWidth_WIDTH(src_w)); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
291 WRITE_REG(PM3VideoOverlayHeight, PM3VideoOverlayHeight_HEIGHT(src_h)); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
292 WRITE_REG(PM3VideoOverlayOrigin, 0); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
293 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
294 /* Scale the source to the destinationsize */ |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
295 if (src_h == drw_h) { |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
296 WRITE_REG(PM3VideoOverlayYDelta, PM3VideoOverlayYDelta_NONE); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
297 } else { |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
298 WRITE_REG(PM3VideoOverlayYDelta, |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
299 PM3VideoOverlayYDelta_DELTA(src_h, drw_h)); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
300 } |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
301 if (src_w == drw_w) { |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
302 WRITE_REG(PM3VideoOverlayShrinkXDelta, 1<<16); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
303 WRITE_REG(PM3VideoOverlayZoomXDelta, 1<<16); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
304 } else { |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
305 WRITE_REG(PM3VideoOverlayShrinkXDelta, shrink); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
306 WRITE_REG(PM3VideoOverlayZoomXDelta, zoom); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
307 } |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
308 WRITE_REG(PM3VideoOverlayIndex, 0); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
309 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
310 /* 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
|
311 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
|
312 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
|
313 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
|
314 RAMDAC_SET_REG(PM3RD_VideoOverlayXEndHigh, |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
315 ((info->dest.x+drw_w) & 0xf00)>>8); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
316 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
|
317 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
|
318 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
|
319 RAMDAC_SET_REG(PM3RD_VideoOverlayYEndHigh, |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
320 ((info->dest.y+drw_h) & 0xf00)>>8); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
321 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
322 RAMDAC_SET_REG(PM3RD_VideoOverlayKeyR, 0xff); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
323 RAMDAC_SET_REG(PM3RD_VideoOverlayKeyG, 0x00); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
324 RAMDAC_SET_REG(PM3RD_VideoOverlayKeyB, 0xff); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
325 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
326 overlay_mode = |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
327 1 << 5 | |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
328 format | |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
329 PM3VideoOverlayMode_FILTER_FULL | |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
330 PM3VideoOverlayMode_BUFFERSYNC_MANUAL | |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
331 PM3VideoOverlayMode_FLIP_VIDEO; |
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 overlay_control = |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
334 PM3RD_VideoOverlayControl_KEY_COLOR | |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
335 PM3RD_VideoOverlayControl_MODE_MAINKEY | |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
336 PM3RD_VideoOverlayControl_DIRECTCOLOR_ENABLED; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
337 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
338 TRACE_EXIT(); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
339 return 0; |
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 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
342 int vixPlaybackOn(void) |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
343 { |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
344 TRACE_ENTER(); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
345 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
346 WRITE_REG(PM3VideoOverlayMode, |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
347 overlay_mode | PM3VideoOverlayMode_ENABLE); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
348 RAMDAC_SET_REG(PM3RD_VideoOverlayControl, |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
349 overlay_control | PM3RD_VideoOverlayControl_ENABLE); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
350 WRITE_REG(PM3VideoOverlayUpdate, |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
351 PM3VideoOverlayUpdate_ENABLE); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
352 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
353 TRACE_EXIT(); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
354 return 0; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
355 } |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
356 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
357 int vixPlaybackOff(void) |
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_VideoOverlayControl, |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
360 PM3RD_VideoOverlayControl_DISABLE); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
361 WRITE_REG(PM3VideoOverlayMode, |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
362 PM3VideoOverlayMode_DISABLE); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
363 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
364 RAMDAC_SET_REG(PM3RD_VideoOverlayKeyR, 0x01); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
365 RAMDAC_SET_REG(PM3RD_VideoOverlayKeyG, 0x01); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
366 RAMDAC_SET_REG(PM3RD_VideoOverlayKeyB, 0xfe); |
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 return 0; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
369 } |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
370 |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
371 int vixPlaybackFrameSelect(unsigned int frame) |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
372 { |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
373 WRITE_REG(PM3VideoOverlayBase0, frames[frame]); |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
374 return 0; |
034b12194350
rage128/radeon fixes, mach64 mess^H^H^H^Hcleanup, pm3 driver.
arpi
parents:
diff
changeset
|
375 } |