annotate vidix/pm2_vid.c @ 29535:b2f841a1905e

Fix implicit declaration of mp_input_.. functions.
author reimar
date Fri, 28 Aug 2009 14:02:32 +0000
parents f1cf3ca453b6
children 945eab072c9d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
23046
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 23040
diff changeset
1 /*
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 23040
diff changeset
2 * VIDIX driver for 3DLabs Permedia 2 chipsets.
23734
acfe034e5386 ISO8859-1 --> UTF-8
diego
parents: 23060
diff changeset
3 * Copyright (C) 2002 Måns Rullgård
23046
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 23040
diff changeset
4 *
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 23040
diff changeset
5 * This file is part of MPlayer.
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 23040
diff changeset
6 *
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 23040
diff changeset
7 * MPlayer is free software; you can redistribute it and/or modify
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 23040
diff changeset
8 * it under the terms of the GNU General Public License as published by
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 23040
diff changeset
9 * the Free Software Foundation; either version 2 of the License, or
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 23040
diff changeset
10 * (at your option) any later version.
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 23040
diff changeset
11 *
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 23040
diff changeset
12 * MPlayer is distributed in the hope that it will be useful,
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 23040
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 23040
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 23040
diff changeset
15 * GNU General Public License for more details.
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 23040
diff changeset
16 *
26719
3abd1629658b Use standard license headers.
diego
parents: 26203
diff changeset
17 * You should have received a copy of the GNU General Public License along
3abd1629658b Use standard license headers.
diego
parents: 26203
diff changeset
18 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
3abd1629658b Use standard license headers.
diego
parents: 26203
diff changeset
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23046
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 23040
diff changeset
20 */
22974
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
21
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
22 #include <errno.h>
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
23 #include <stdio.h>
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
24 #include <stdlib.h>
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
25 #include <string.h>
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
26 #include <inttypes.h>
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
27 #include <sys/types.h>
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
28 #include <unistd.h>
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
29
26203
0d255d03016f #include config.h before all other headers.
diego
parents: 23734
diff changeset
30 #include "config.h"
22974
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
31 #include "vidix.h"
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
32 #include "fourcc.h"
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
33 #include "dha.h"
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
34 #include "pci_ids.h"
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
35 #include "pci_names.h"
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
36
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
37 #include "glint_regs.h"
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
38
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
39 /* MBytes of video memory to use */
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
40 #define PM2_VIDMEM 6
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
41
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
42 #if 0
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
43 #define TRACE_ENTER() fprintf(stderr, "%s: enter\n", __FUNCTION__)
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
44 #define TRACE_EXIT() fprintf(stderr, "%s: exit\n", __FUNCTION__)
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
45 #else
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
46 #define TRACE_ENTER()
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
47 #define TRACE_EXIT()
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
48 #endif
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
49
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
50 #define WRITE_REG(offset,val) \
23040
c1105d1f4b7f fix for mingw: u_long becomes unsigned long
ben
parents: 23038
diff changeset
51 *(volatile unsigned long *)(((unsigned char *)(pm2_reg_base)) + offset) = (val)
22974
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
52 #define READ_REG(offset) \
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
53 *(volatile unsigned long *)(((unsigned char *)(pm2_reg_base)) + offset)
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
54
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
55 static pciinfo_t pci_info;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
56
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
57 static void *pm2_reg_base;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
58 static void *pm2_mem;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
59
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
60 static int pm2_vidmem = PM2_VIDMEM;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
61
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
62 static vidix_capability_t pm2_cap =
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
63 {
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
64 "3DLabs Permedia2 driver",
23734
acfe034e5386 ISO8859-1 --> UTF-8
diego
parents: 23060
diff changeset
65 "Måns Rullgård <mru@users.sf.net>",
22974
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
66 TYPE_OUTPUT,
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
67 { 0, 0, 0, 0 },
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
68 2048,
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
69 2048,
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
70 4,
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
71 4,
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
72 -1,
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
73 FLAG_UPSCALER|FLAG_DOWNSCALER,
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
74 VENDOR_3DLABS,
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
75 -1,
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
76 { 0, 0, 0, 0 }
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
77 };
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
78
23037
c2c2bc418257 better fix for r23001, u_int becomes unsigned int, dont force it to uin32_t
ben
parents: 22984
diff changeset
79 static unsigned int pm2_card_ids[] =
22974
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
80 {
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
81 (VENDOR_3DLABS << 16) | DEVICE_3DLABS_PERMEDIA2,
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
82 (VENDOR_TEXAS << 16) | DEVICE_TEXAS_TVP4020_PERMEDIA_2
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
83 };
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
84
23037
c2c2bc418257 better fix for r23001, u_int becomes unsigned int, dont force it to uin32_t
ben
parents: 22984
diff changeset
85 static int find_chip(unsigned int vendor, uint32_t chip_id)
22974
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
86 {
23037
c2c2bc418257 better fix for r23001, u_int becomes unsigned int, dont force it to uin32_t
ben
parents: 22984
diff changeset
87 unsigned int vci = (vendor << 16) | chip_id;
22974
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
88 unsigned i;
23037
c2c2bc418257 better fix for r23001, u_int becomes unsigned int, dont force it to uin32_t
ben
parents: 22984
diff changeset
89 for(i = 0; i < sizeof(pm2_card_ids)/sizeof(unsigned int); i++){
22974
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
90 if(vci == pm2_card_ids[i]) return i;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
91 }
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
92 return -1;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
93 }
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
94
27626
f1cf3ca453b6 Remove one more pointless and gcc-specific __attribute__ ((unused)).
diego
parents: 27079
diff changeset
95 static int pm2_probe(int verbose, int force)
22974
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
96 {
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
97 pciinfo_t lst[MAX_PCI_DEVICES];
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
98 unsigned i,num_pci;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
99 int err;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
100
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
101 err = pci_scan(lst,&num_pci);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
102 if(err)
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
103 {
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
104 printf("[pm2] Error occurred during pci scan: %s\n",strerror(err));
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
105 return err;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
106 }
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
107 else
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
108 {
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
109 err = ENXIO;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
110 for(i=0; i < num_pci; i++)
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
111 {
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
112 int idx;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
113 const char *dname;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
114 idx = find_chip(lst[i].vendor, lst[i].device);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
115 if(idx == -1)
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
116 continue;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
117 dname = pci_device_name(lst[i].vendor, lst[i].device);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
118 dname = dname ? dname : "Unknown chip";
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
119 printf("[pm2] Found chip: %s\n", dname);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
120 pm2_cap.device_id = lst[i].device;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
121 err = 0;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
122 memcpy(&pci_info, &lst[i], sizeof(pciinfo_t));
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
123 break;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
124 }
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
125 }
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
126 if(err && verbose) printf("[pm2] Can't find chip.\n");
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
127 return err;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
128 }
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
129
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
130 #define PRINT_REG(reg) \
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
131 { \
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
132 long _foo = READ_REG(reg); \
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
133 printf("[pm2] " #reg " (%x) = %#lx (%li)\n", reg, _foo, _foo); \
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
134 }
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
135
22984
78ca12bbe854 bad prototype for driver init function
ben
parents: 22983
diff changeset
136 static int pm2_init(void)
22974
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
137 {
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
138 char *vm;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
139 pm2_reg_base = map_phys_mem(pci_info.base0, 0x10000);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
140 pm2_mem = map_phys_mem(pci_info.base1, 1 << 23);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
141 if((vm = getenv("PM2_VIDMEM"))){
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
142 pm2_vidmem = strtol(vm, NULL, 0);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
143 }
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
144 return 0;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
145 }
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
146
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
147 static void pm2_destroy(void)
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
148 {
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
149 unmap_phys_mem(pm2_reg_base, 0x10000);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
150 unmap_phys_mem(pm2_mem, 1 << 23);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
151 }
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
152
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
153 static int pm2_get_caps(vidix_capability_t *to)
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
154 {
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
155 memcpy(to, &pm2_cap, sizeof(vidix_capability_t));
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
156 return 0;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
157 }
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
158
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
159 static int is_supported_fourcc(uint32_t fourcc)
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
160 {
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
161 switch(fourcc){
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
162 case IMGFMT_YUY2:
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
163 return 1;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
164 default:
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
165 return 0;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
166 }
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
167 }
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
168
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
169 static int pm2_query_fourcc(vidix_fourcc_t *to)
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
170 {
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
171 if(is_supported_fourcc(to->fourcc))
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
172 {
23060
91ad6d4d6a54 simplified depth definition
ben
parents: 23046
diff changeset
173 to->depth = VID_DEPTH_ALL;
22974
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
174 to->flags = VID_CAP_EXPAND | VID_CAP_SHRINK | VID_CAP_COLORKEY;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
175 return 0;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
176 }
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
177 else to->depth = to->flags = 0;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
178 return ENOSYS;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
179 }
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
180
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
181 #define FORMAT_YUV422 ((1 << 6) | 3 | (1 << 4))
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
182
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
183 #define PPROD(a,b,c) (a | (b << 3) | (c << 6))
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
184
23037
c2c2bc418257 better fix for r23001, u_int becomes unsigned int, dont force it to uin32_t
ben
parents: 22984
diff changeset
185 static unsigned int ppcodes[][2] = {
22974
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
186 {0, 0},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
187 {32, PPROD(1, 0, 0)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
188 {64, PPROD(1, 1, 0)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
189 {96, PPROD(1, 1, 1)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
190 {128, PPROD(2, 1, 1)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
191 {160, PPROD(2, 2, 1)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
192 {192, PPROD(2, 2, 2)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
193 {224, PPROD(3, 2, 1)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
194 {256, PPROD(3, 2, 2)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
195 {288, PPROD(3, 3, 1)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
196 {320, PPROD(3, 3, 2)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
197 {384, PPROD(3, 3, 3)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
198 {416, PPROD(4, 3, 1)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
199 {448, PPROD(4, 3, 2)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
200 {512, PPROD(4, 3, 3)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
201 {544, PPROD(4, 4, 1)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
202 {576, PPROD(4, 4, 2)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
203 {640, PPROD(4, 4, 3)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
204 {768, PPROD(4, 4, 4)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
205 {800, PPROD(5, 4, 1)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
206 {832, PPROD(5, 4, 2)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
207 {896, PPROD(5, 4, 3)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
208 {1024, PPROD(5, 4, 4)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
209 {1056, PPROD(5, 5, 1)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
210 {1088, PPROD(5, 5, 2)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
211 {1152, PPROD(5, 5, 3)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
212 {1280, PPROD(5, 5, 4)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
213 {1536, PPROD(5, 5, 5)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
214 {1568, PPROD(6, 5, 1)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
215 {1600, PPROD(6, 5, 2)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
216 {1664, PPROD(6, 5, 3)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
217 {1792, PPROD(6, 5, 4)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
218 {2048, PPROD(6, 5, 5)}
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
219 };
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
220
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
221 static int frames[VID_PLAY_MAXFRAMES];
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
222
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
223 static int pm2_config_playback(vidix_playback_t *info)
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
224 {
23037
c2c2bc418257 better fix for r23001, u_int becomes unsigned int, dont force it to uin32_t
ben
parents: 22984
diff changeset
225 unsigned int src_w, drw_w;
c2c2bc418257 better fix for r23001, u_int becomes unsigned int, dont force it to uin32_t
ben
parents: 22984
diff changeset
226 unsigned int src_h, drw_h;
22974
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
227 long base0;
23037
c2c2bc418257 better fix for r23001, u_int becomes unsigned int, dont force it to uin32_t
ben
parents: 22984
diff changeset
228 unsigned int stride, sstr;
c2c2bc418257 better fix for r23001, u_int becomes unsigned int, dont force it to uin32_t
ben
parents: 22984
diff changeset
229 unsigned int format;
22974
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
230 unsigned int i;
23037
c2c2bc418257 better fix for r23001, u_int becomes unsigned int, dont force it to uin32_t
ben
parents: 22984
diff changeset
231 unsigned int ppcode = 0, sppc = 0;
c2c2bc418257 better fix for r23001, u_int becomes unsigned int, dont force it to uin32_t
ben
parents: 22984
diff changeset
232 unsigned int pitch = 0;
22974
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
233
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
234 TRACE_ENTER();
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
235
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
236 switch(info->fourcc){
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
237 case IMGFMT_YUY2:
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
238 format = FORMAT_YUV422;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
239 break;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
240 default:
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
241 return -1;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
242 }
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
243
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
244 src_w = info->src.w;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
245 src_h = info->src.h;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
246
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
247 drw_w = info->dest.w;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
248 drw_h = info->dest.h;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
249
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
250 sstr = READ_REG(PMScreenStride) * 2;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
251
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
252 stride = 0;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
253 for(i = 1; i < sizeof(ppcodes) / sizeof(ppcodes[0]); i++){
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
254 if((!stride) && (ppcodes[i][0] >= src_w)){
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
255 stride = ppcodes[i][0];
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
256 ppcode = ppcodes[i][1];
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
257 pitch = ppcodes[i][0] - ppcodes[i-1][0];
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
258 }
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
259 if(ppcodes[i][0] == sstr)
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
260 sppc = ppcodes[i][1];
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
261 }
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
262
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
263 if(!stride)
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
264 return -1;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
265
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
266 info->num_frames = pm2_vidmem*1024*1024 / (stride * src_h * 2);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
267 if(info->num_frames > VID_PLAY_MAXFRAMES)
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
268 info->num_frames = VID_PLAY_MAXFRAMES;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
269
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
270 /* Use end of video memory. Assume the card has 8 MB */
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
271 base0 = (8 - pm2_vidmem)*1024*1024;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
272 info->dga_addr = pm2_mem + base0;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
273
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
274 info->dest.pitch.y = pitch*2;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
275 info->dest.pitch.u = 0;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
276 info->dest.pitch.v = 0;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
277 info->offset.y = 0;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
278 info->offset.v = 0;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
279 info->offset.u = 0;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
280 info->frame_size = stride * src_h * 2;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
281
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
282 for(i = 0; i < info->num_frames; i++){
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
283 info->offsets[i] = info->frame_size * i;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
284 frames[i] = (base0 + info->offsets[i]) >> 1;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
285 }
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
286
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
287 WRITE_REG(WindowOrigin, 0);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
288 WRITE_REG(dY, 1 << 16);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
289 WRITE_REG(RasterizerMode, 0);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
290 WRITE_REG(ScissorMode, 0);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
291 WRITE_REG(AreaStippleMode, 0);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
292 WRITE_REG(StencilMode, 0);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
293 WRITE_REG(TextureAddressMode, 1);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
294
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
295 WRITE_REG(dSdyDom, 0);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
296 WRITE_REG(dTdx, 0);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
297
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
298 WRITE_REG(PMTextureMapFormat, (1 << 19) | ppcode);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
299 WRITE_REG(PMTextureDataFormat, format);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
300 WRITE_REG(PMTextureReadMode, (1 << 17) | /* FilterMode */
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
301 (11 << 13) | (11 << 9) /* TextureSize log2 */ | 1);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
302 WRITE_REG(ColorDDAMode, 0);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
303 WRITE_REG(TextureColorMode, (0 << 4) /* RGB */ | (3 << 1) /* Copy */ | 1);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
304 WRITE_REG(AlphaBlendMode, 0);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
305 WRITE_REG(DitherMode, (1 << 10) | 1);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
306 WRITE_REG(LogicalOpMode, 0);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
307 WRITE_REG(FBReadMode, sppc);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
308 WRITE_REG(FBHardwareWriteMask, 0xFFFFFFFF);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
309 WRITE_REG(FBWriteMode, 1);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
310 WRITE_REG(YUVMode, 1);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
311
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
312 WRITE_REG(SStart, 0);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
313 WRITE_REG(TStart, 0);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
314
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
315 WRITE_REG(dSdx, (src_w << 20) / drw_w);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
316 WRITE_REG(dTdyDom, (src_h << 20) / drw_h);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
317 WRITE_REG(RectangleOrigin, info->dest.x | (info->dest.y << 16));
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
318 WRITE_REG(RectangleSize, (drw_h << 16) | drw_w);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
319
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
320 TRACE_EXIT();
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
321 return 0;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
322 }
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
323
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
324 static int pm2_playback_on(void)
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
325 {
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
326 TRACE_ENTER();
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
327
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
328 TRACE_EXIT();
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
329 return 0;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
330 }
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
331
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
332 static int pm2_playback_off(void)
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
333 {
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
334 WRITE_REG(YUVMode, 0);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
335 WRITE_REG(TextureColorMode, 0);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
336 WRITE_REG(TextureAddressMode, 0);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
337 WRITE_REG(TextureReadMode, 0);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
338 return 0;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
339 }
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
340
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
341 static int pm2_frame_select(unsigned int frame)
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
342 {
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
343 WRITE_REG(PMTextureBaseAddress, frames[frame]);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
344 WRITE_REG(Render, PrimitiveRectangle | XPositive | YPositive |
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
345 TextureEnable);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
346 return 0;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
347 }
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
348
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
349 VDXDriver pm2_drv = {
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
350 "pm2",
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
351 NULL,
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
352 .probe = pm2_probe,
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
353 .get_caps = pm2_get_caps,
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
354 .query_fourcc = pm2_query_fourcc,
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
355 .init = pm2_init,
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
356 .destroy = pm2_destroy,
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
357 .config_playback = pm2_config_playback,
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
358 .playback_on = pm2_playback_on,
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
359 .playback_off = pm2_playback_off,
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
360 .frame_sel = pm2_frame_select,
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
361 };