annotate vidix/pm2_vid.c @ 24757:cc80a9169d90

Add -lavfdopts cryptokey
author reimar
date Sun, 14 Oct 2007 12:11:28 +0000
parents acfe034e5386
children 0d255d03016f
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 *
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 23040
diff changeset
17 * You should have received a copy of the GNU General Public License
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 23040
diff changeset
18 * along with MPlayer; if not, write to the Free Software
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 23040
diff changeset
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
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
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
30 #include "vidix.h"
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
31 #include "vidixlib.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 #include "config.h"
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
37
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
38 #include "glint_regs.h"
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
39
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
40 /* MBytes of video memory to use */
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
41 #define PM2_VIDMEM 6
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
42
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
43 #if 0
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
44 #define TRACE_ENTER() fprintf(stderr, "%s: enter\n", __FUNCTION__)
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
45 #define TRACE_EXIT() fprintf(stderr, "%s: exit\n", __FUNCTION__)
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
46 #else
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
47 #define TRACE_ENTER()
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
48 #define TRACE_EXIT()
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
49 #endif
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
50
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
51 #define WRITE_REG(offset,val) \
23040
c1105d1f4b7f fix for mingw: u_long becomes unsigned long
ben
parents: 23038
diff changeset
52 *(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
53 #define READ_REG(offset) \
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
54 *(volatile unsigned long *)(((unsigned char *)(pm2_reg_base)) + offset)
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
55
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
56 static pciinfo_t pci_info;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
57
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
58 static void *pm2_reg_base;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
59 static void *pm2_mem;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
60
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
61 static int pm2_vidmem = PM2_VIDMEM;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
62
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
63 static vidix_capability_t pm2_cap =
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
64 {
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
65 "3DLabs Permedia2 driver",
23734
acfe034e5386 ISO8859-1 --> UTF-8
diego
parents: 23060
diff changeset
66 "Måns Rullgård <mru@users.sf.net>",
22974
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
67 TYPE_OUTPUT,
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
68 { 0, 0, 0, 0 },
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 2048,
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 4,
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
73 -1,
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
74 FLAG_UPSCALER|FLAG_DOWNSCALER,
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
75 VENDOR_3DLABS,
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
76 -1,
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
77 { 0, 0, 0, 0 }
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
78 };
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
79
23037
c2c2bc418257 better fix for r23001, u_int becomes unsigned int, dont force it to uin32_t
ben
parents: 22984
diff changeset
80 static unsigned int pm2_card_ids[] =
22974
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
81 {
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
82 (VENDOR_3DLABS << 16) | DEVICE_3DLABS_PERMEDIA2,
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
83 (VENDOR_TEXAS << 16) | DEVICE_TEXAS_TVP4020_PERMEDIA_2
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
84 };
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
85
23037
c2c2bc418257 better fix for r23001, u_int becomes unsigned int, dont force it to uin32_t
ben
parents: 22984
diff changeset
86 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
87 {
23037
c2c2bc418257 better fix for r23001, u_int becomes unsigned int, dont force it to uin32_t
ben
parents: 22984
diff changeset
88 unsigned int vci = (vendor << 16) | chip_id;
22974
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
89 unsigned i;
23037
c2c2bc418257 better fix for r23001, u_int becomes unsigned int, dont force it to uin32_t
ben
parents: 22984
diff changeset
90 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
91 if(vci == pm2_card_ids[i]) return i;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
92 }
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
93 return -1;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
94 }
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
95
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
96 static int pm2_probe(int verbose, int force __attribute__ ((unused)))
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
97 {
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
98 pciinfo_t lst[MAX_PCI_DEVICES];
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
99 unsigned i,num_pci;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
100 int err;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
101
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
102 err = pci_scan(lst,&num_pci);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
103 if(err)
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
104 {
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
105 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
106 return err;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
107 }
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
108 else
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
109 {
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
110 err = ENXIO;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
111 for(i=0; i < num_pci; i++)
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
112 {
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
113 int idx;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
114 const char *dname;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
115 idx = find_chip(lst[i].vendor, lst[i].device);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
116 if(idx == -1)
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
117 continue;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
118 dname = pci_device_name(lst[i].vendor, lst[i].device);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
119 dname = dname ? dname : "Unknown chip";
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
120 printf("[pm2] Found chip: %s\n", dname);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
121 pm2_cap.device_id = lst[i].device;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
122 err = 0;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
123 memcpy(&pci_info, &lst[i], sizeof(pciinfo_t));
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
124 break;
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 }
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
127 if(err && verbose) printf("[pm2] Can't find chip.\n");
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
128 return err;
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
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
131 #define PRINT_REG(reg) \
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
132 { \
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
133 long _foo = READ_REG(reg); \
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
134 printf("[pm2] " #reg " (%x) = %#lx (%li)\n", reg, _foo, _foo); \
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
135 }
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
136
22984
78ca12bbe854 bad prototype for driver init function
ben
parents: 22983
diff changeset
137 static int pm2_init(void)
22974
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
138 {
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
139 char *vm;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
140 pm2_reg_base = map_phys_mem(pci_info.base0, 0x10000);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
141 pm2_mem = map_phys_mem(pci_info.base1, 1 << 23);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
142 if((vm = getenv("PM2_VIDMEM"))){
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
143 pm2_vidmem = strtol(vm, NULL, 0);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
144 }
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
145 return 0;
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
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
148 static void pm2_destroy(void)
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
149 {
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
150 unmap_phys_mem(pm2_reg_base, 0x10000);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
151 unmap_phys_mem(pm2_mem, 1 << 23);
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
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
154 static int pm2_get_caps(vidix_capability_t *to)
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
155 {
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
156 memcpy(to, &pm2_cap, sizeof(vidix_capability_t));
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
157 return 0;
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
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
160 static int is_supported_fourcc(uint32_t fourcc)
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
161 {
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
162 switch(fourcc){
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
163 case IMGFMT_YUY2:
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
164 return 1;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
165 default:
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
166 return 0;
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
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
170 static int pm2_query_fourcc(vidix_fourcc_t *to)
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
171 {
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
172 if(is_supported_fourcc(to->fourcc))
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
173 {
23060
91ad6d4d6a54 simplified depth definition
ben
parents: 23046
diff changeset
174 to->depth = VID_DEPTH_ALL;
22974
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
175 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
176 return 0;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
177 }
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
178 else to->depth = to->flags = 0;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
179 return ENOSYS;
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
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
182 #define FORMAT_YUV422 ((1 << 6) | 3 | (1 << 4))
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
183
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
184 #define PPROD(a,b,c) (a | (b << 3) | (c << 6))
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
185
23037
c2c2bc418257 better fix for r23001, u_int becomes unsigned int, dont force it to uin32_t
ben
parents: 22984
diff changeset
186 static unsigned int ppcodes[][2] = {
22974
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
187 {0, 0},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
188 {32, PPROD(1, 0, 0)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
189 {64, PPROD(1, 1, 0)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
190 {96, PPROD(1, 1, 1)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
191 {128, PPROD(2, 1, 1)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
192 {160, PPROD(2, 2, 1)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
193 {192, PPROD(2, 2, 2)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
194 {224, PPROD(3, 2, 1)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
195 {256, PPROD(3, 2, 2)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
196 {288, PPROD(3, 3, 1)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
197 {320, PPROD(3, 3, 2)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
198 {384, PPROD(3, 3, 3)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
199 {416, PPROD(4, 3, 1)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
200 {448, PPROD(4, 3, 2)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
201 {512, PPROD(4, 3, 3)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
202 {544, PPROD(4, 4, 1)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
203 {576, PPROD(4, 4, 2)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
204 {640, PPROD(4, 4, 3)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
205 {768, PPROD(4, 4, 4)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
206 {800, PPROD(5, 4, 1)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
207 {832, PPROD(5, 4, 2)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
208 {896, PPROD(5, 4, 3)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
209 {1024, PPROD(5, 4, 4)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
210 {1056, PPROD(5, 5, 1)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
211 {1088, PPROD(5, 5, 2)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
212 {1152, PPROD(5, 5, 3)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
213 {1280, PPROD(5, 5, 4)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
214 {1536, PPROD(5, 5, 5)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
215 {1568, PPROD(6, 5, 1)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
216 {1600, PPROD(6, 5, 2)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
217 {1664, PPROD(6, 5, 3)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
218 {1792, PPROD(6, 5, 4)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
219 {2048, PPROD(6, 5, 5)}
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
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
222 static int frames[VID_PLAY_MAXFRAMES];
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
223
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
224 static int pm2_config_playback(vidix_playback_t *info)
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
225 {
23037
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_w, drw_w;
c2c2bc418257 better fix for r23001, u_int becomes unsigned int, dont force it to uin32_t
ben
parents: 22984
diff changeset
227 unsigned int src_h, drw_h;
22974
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
228 long base0;
23037
c2c2bc418257 better fix for r23001, u_int becomes unsigned int, dont force it to uin32_t
ben
parents: 22984
diff changeset
229 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
230 unsigned int format;
22974
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
231 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
232 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
233 unsigned int pitch = 0;
22974
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
234
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
235 TRACE_ENTER();
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
236
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
237 switch(info->fourcc){
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
238 case IMGFMT_YUY2:
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
239 format = FORMAT_YUV422;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
240 break;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
241 default:
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
242 return -1;
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
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
245 src_w = info->src.w;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
246 src_h = info->src.h;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
247
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
248 drw_w = info->dest.w;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
249 drw_h = info->dest.h;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
250
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
251 sstr = READ_REG(PMScreenStride) * 2;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
252
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
253 stride = 0;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
254 for(i = 1; i < sizeof(ppcodes) / sizeof(ppcodes[0]); i++){
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
255 if((!stride) && (ppcodes[i][0] >= src_w)){
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
256 stride = ppcodes[i][0];
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
257 ppcode = ppcodes[i][1];
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
258 pitch = ppcodes[i][0] - ppcodes[i-1][0];
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
259 }
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
260 if(ppcodes[i][0] == sstr)
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
261 sppc = ppcodes[i][1];
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
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
264 if(!stride)
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
265 return -1;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
266
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
267 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
268 if(info->num_frames > VID_PLAY_MAXFRAMES)
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
269 info->num_frames = VID_PLAY_MAXFRAMES;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
270
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
271 /* 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
272 base0 = (8 - pm2_vidmem)*1024*1024;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
273 info->dga_addr = pm2_mem + base0;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
274
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
275 info->dest.pitch.y = pitch*2;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
276 info->dest.pitch.u = 0;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
277 info->dest.pitch.v = 0;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
278 info->offset.y = 0;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
279 info->offset.v = 0;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
280 info->offset.u = 0;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
281 info->frame_size = stride * src_h * 2;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
282
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
283 for(i = 0; i < info->num_frames; i++){
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
284 info->offsets[i] = info->frame_size * i;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
285 frames[i] = (base0 + info->offsets[i]) >> 1;
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
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
288 WRITE_REG(WindowOrigin, 0);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
289 WRITE_REG(dY, 1 << 16);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
290 WRITE_REG(RasterizerMode, 0);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
291 WRITE_REG(ScissorMode, 0);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
292 WRITE_REG(AreaStippleMode, 0);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
293 WRITE_REG(StencilMode, 0);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
294 WRITE_REG(TextureAddressMode, 1);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
295
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
296 WRITE_REG(dSdyDom, 0);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
297 WRITE_REG(dTdx, 0);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
298
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
299 WRITE_REG(PMTextureMapFormat, (1 << 19) | ppcode);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
300 WRITE_REG(PMTextureDataFormat, format);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
301 WRITE_REG(PMTextureReadMode, (1 << 17) | /* FilterMode */
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
302 (11 << 13) | (11 << 9) /* TextureSize log2 */ | 1);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
303 WRITE_REG(ColorDDAMode, 0);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
304 WRITE_REG(TextureColorMode, (0 << 4) /* RGB */ | (3 << 1) /* Copy */ | 1);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
305 WRITE_REG(AlphaBlendMode, 0);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
306 WRITE_REG(DitherMode, (1 << 10) | 1);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
307 WRITE_REG(LogicalOpMode, 0);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
308 WRITE_REG(FBReadMode, sppc);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
309 WRITE_REG(FBHardwareWriteMask, 0xFFFFFFFF);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
310 WRITE_REG(FBWriteMode, 1);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
311 WRITE_REG(YUVMode, 1);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
312
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
313 WRITE_REG(SStart, 0);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
314 WRITE_REG(TStart, 0);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
315
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
316 WRITE_REG(dSdx, (src_w << 20) / drw_w);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
317 WRITE_REG(dTdyDom, (src_h << 20) / drw_h);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
318 WRITE_REG(RectangleOrigin, info->dest.x | (info->dest.y << 16));
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
319 WRITE_REG(RectangleSize, (drw_h << 16) | drw_w);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
320
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
321 TRACE_EXIT();
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
322 return 0;
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
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
325 static int pm2_playback_on(void)
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
326 {
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
327 TRACE_ENTER();
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
328
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
329 TRACE_EXIT();
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
330 return 0;
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
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
333 static int pm2_playback_off(void)
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
334 {
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
335 WRITE_REG(YUVMode, 0);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
336 WRITE_REG(TextureColorMode, 0);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
337 WRITE_REG(TextureAddressMode, 0);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
338 WRITE_REG(TextureReadMode, 0);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
339 return 0;
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
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
342 static int pm2_frame_select(unsigned int frame)
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
343 {
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
344 WRITE_REG(PMTextureBaseAddress, frames[frame]);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
345 WRITE_REG(Render, PrimitiveRectangle | XPositive | YPositive |
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
346 TextureEnable);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
347 return 0;
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
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
350 VDXDriver pm2_drv = {
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
351 "pm2",
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
352 NULL,
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
353 .probe = pm2_probe,
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
354 .get_caps = pm2_get_caps,
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
355 .query_fourcc = pm2_query_fourcc,
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
356 .init = pm2_init,
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
357 .destroy = pm2_destroy,
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
358 .config_playback = pm2_config_playback,
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
359 .playback_on = pm2_playback_on,
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
360 .playback_off = pm2_playback_off,
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
361 .frame_sel = pm2_frame_select,
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
362 };