annotate vidix/pm2_vid.c @ 22996:2a60af5e78a7

skip MMX code in rgb32to16 if the size of the input is smaller than the size of the units the MMX code processes
author ivo
date Wed, 18 Apr 2007 09:26:22 +0000
parents 78ca12bbe854
children c2c2bc418257
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
22974
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
1 /**
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
2 Driver for 3DLabs Permedia 2.
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
3
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
4 Copyright (C) 2002 Måns Rullgård
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
5
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
6 This program is free software; you can redistribute it and/or modify
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
7 it under the terms of the GNU General Public License as published by
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
8 the Free Software Foundation; either version 2 of the License, or
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
9 (at your option) any later version.
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
10
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
11 This program is distributed in the hope that it will be useful,
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
14 GNU General Public License for more details.
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
15
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
17 along with this program; if not, write to the Free Software
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
19 **/
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
20
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
21 #include <errno.h>
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
22 #include <stdio.h>
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
23 #include <stdlib.h>
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
24 #include <string.h>
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
25 #include <inttypes.h>
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
26 #include <sys/types.h>
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
27 #include <unistd.h>
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
28
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
29 #include "vidix.h"
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
30 #include "vidixlib.h"
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
31 #include "fourcc.h"
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
32 #include "dha.h"
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
33 #include "pci_ids.h"
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
34 #include "pci_names.h"
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
35 #include "config.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) \
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
51 *(volatile u_long *)(((u_char *)(pm2_reg_base)) + offset) = (val)
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",
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
65 "Måns Rullgård <mru@users.sf.net>",
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
22983
23182ac287a7 u_int seems unknown under mingw
ben
parents: 22974
diff changeset
79 static uint32_t 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
22983
23182ac287a7 u_int seems unknown under mingw
ben
parents: 22974
diff changeset
85 static int find_chip(uint32_t vendor, uint32_t chip_id)
22974
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
86 {
22983
23182ac287a7 u_int seems unknown under mingw
ben
parents: 22974
diff changeset
87 uint32_t vci = (vendor << 16) | chip_id;
22974
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
88 unsigned i;
22983
23182ac287a7 u_int seems unknown under mingw
ben
parents: 22974
diff changeset
89 for(i = 0; i < sizeof(pm2_card_ids)/sizeof(uint32_t); 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
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
95 static int pm2_probe(int verbose, int force __attribute__ ((unused)))
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 {
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
173 to->depth = VID_DEPTH_1BPP | VID_DEPTH_2BPP |
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
174 VID_DEPTH_4BPP | VID_DEPTH_8BPP |
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
175 VID_DEPTH_12BPP| VID_DEPTH_15BPP|
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
176 VID_DEPTH_16BPP| VID_DEPTH_24BPP|
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
177 VID_DEPTH_32BPP;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
178 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
179 return 0;
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 else to->depth = to->flags = 0;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
182 return ENOSYS;
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
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
185 #define FORMAT_YUV422 ((1 << 6) | 3 | (1 << 4))
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
186
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
187 #define PPROD(a,b,c) (a | (b << 3) | (c << 6))
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
188
22983
23182ac287a7 u_int seems unknown under mingw
ben
parents: 22974
diff changeset
189 static uint32_t ppcodes[][2] = {
22974
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
190 {0, 0},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
191 {32, PPROD(1, 0, 0)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
192 {64, PPROD(1, 1, 0)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
193 {96, PPROD(1, 1, 1)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
194 {128, PPROD(2, 1, 1)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
195 {160, PPROD(2, 2, 1)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
196 {192, PPROD(2, 2, 2)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
197 {224, PPROD(3, 2, 1)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
198 {256, PPROD(3, 2, 2)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
199 {288, PPROD(3, 3, 1)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
200 {320, PPROD(3, 3, 2)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
201 {384, PPROD(3, 3, 3)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
202 {416, PPROD(4, 3, 1)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
203 {448, PPROD(4, 3, 2)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
204 {512, PPROD(4, 3, 3)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
205 {544, PPROD(4, 4, 1)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
206 {576, PPROD(4, 4, 2)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
207 {640, PPROD(4, 4, 3)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
208 {768, PPROD(4, 4, 4)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
209 {800, PPROD(5, 4, 1)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
210 {832, PPROD(5, 4, 2)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
211 {896, PPROD(5, 4, 3)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
212 {1024, PPROD(5, 4, 4)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
213 {1056, PPROD(5, 5, 1)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
214 {1088, PPROD(5, 5, 2)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
215 {1152, PPROD(5, 5, 3)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
216 {1280, PPROD(5, 5, 4)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
217 {1536, PPROD(5, 5, 5)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
218 {1568, PPROD(6, 5, 1)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
219 {1600, PPROD(6, 5, 2)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
220 {1664, PPROD(6, 5, 3)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
221 {1792, PPROD(6, 5, 4)},
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
222 {2048, PPROD(6, 5, 5)}
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
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
225 static int frames[VID_PLAY_MAXFRAMES];
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
226
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
227 static int pm2_config_playback(vidix_playback_t *info)
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
228 {
22983
23182ac287a7 u_int seems unknown under mingw
ben
parents: 22974
diff changeset
229 uint32_t src_w, drw_w;
23182ac287a7 u_int seems unknown under mingw
ben
parents: 22974
diff changeset
230 uint32_t src_h, drw_h;
22974
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
231 long base0;
22983
23182ac287a7 u_int seems unknown under mingw
ben
parents: 22974
diff changeset
232 uint32_t stride, sstr;
23182ac287a7 u_int seems unknown under mingw
ben
parents: 22974
diff changeset
233 uint32_t format;
22974
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
234 unsigned int i;
22983
23182ac287a7 u_int seems unknown under mingw
ben
parents: 22974
diff changeset
235 uint32_t ppcode = 0, sppc = 0;
23182ac287a7 u_int seems unknown under mingw
ben
parents: 22974
diff changeset
236 uint32_t pitch = 0;
22974
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
237
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
238 TRACE_ENTER();
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
239
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
240 switch(info->fourcc){
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
241 case IMGFMT_YUY2:
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
242 format = FORMAT_YUV422;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
243 break;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
244 default:
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
245 return -1;
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
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
248 src_w = info->src.w;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
249 src_h = info->src.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 drw_w = info->dest.w;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
252 drw_h = info->dest.h;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
253
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
254 sstr = READ_REG(PMScreenStride) * 2;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
255
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
256 stride = 0;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
257 for(i = 1; i < sizeof(ppcodes) / sizeof(ppcodes[0]); i++){
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
258 if((!stride) && (ppcodes[i][0] >= src_w)){
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
259 stride = ppcodes[i][0];
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
260 ppcode = ppcodes[i][1];
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
261 pitch = ppcodes[i][0] - ppcodes[i-1][0];
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(ppcodes[i][0] == sstr)
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
264 sppc = ppcodes[i][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
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
267 if(!stride)
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
268 return -1;
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 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
271 if(info->num_frames > VID_PLAY_MAXFRAMES)
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
272 info->num_frames = VID_PLAY_MAXFRAMES;
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 /* 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
275 base0 = (8 - pm2_vidmem)*1024*1024;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
276 info->dga_addr = pm2_mem + base0;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
277
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
278 info->dest.pitch.y = pitch*2;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
279 info->dest.pitch.u = 0;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
280 info->dest.pitch.v = 0;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
281 info->offset.y = 0;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
282 info->offset.v = 0;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
283 info->offset.u = 0;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
284 info->frame_size = stride * src_h * 2;
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 for(i = 0; i < info->num_frames; i++){
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
287 info->offsets[i] = info->frame_size * i;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
288 frames[i] = (base0 + info->offsets[i]) >> 1;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
289 }
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
290
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
291 WRITE_REG(WindowOrigin, 0);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
292 WRITE_REG(dY, 1 << 16);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
293 WRITE_REG(RasterizerMode, 0);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
294 WRITE_REG(ScissorMode, 0);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
295 WRITE_REG(AreaStippleMode, 0);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
296 WRITE_REG(StencilMode, 0);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
297 WRITE_REG(TextureAddressMode, 1);
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(dSdyDom, 0);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
300 WRITE_REG(dTdx, 0);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
301
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
302 WRITE_REG(PMTextureMapFormat, (1 << 19) | ppcode);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
303 WRITE_REG(PMTextureDataFormat, format);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
304 WRITE_REG(PMTextureReadMode, (1 << 17) | /* FilterMode */
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
305 (11 << 13) | (11 << 9) /* TextureSize log2 */ | 1);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
306 WRITE_REG(ColorDDAMode, 0);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
307 WRITE_REG(TextureColorMode, (0 << 4) /* RGB */ | (3 << 1) /* Copy */ | 1);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
308 WRITE_REG(AlphaBlendMode, 0);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
309 WRITE_REG(DitherMode, (1 << 10) | 1);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
310 WRITE_REG(LogicalOpMode, 0);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
311 WRITE_REG(FBReadMode, sppc);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
312 WRITE_REG(FBHardwareWriteMask, 0xFFFFFFFF);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
313 WRITE_REG(FBWriteMode, 1);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
314 WRITE_REG(YUVMode, 1);
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(SStart, 0);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
317 WRITE_REG(TStart, 0);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
318
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
319 WRITE_REG(dSdx, (src_w << 20) / drw_w);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
320 WRITE_REG(dTdyDom, (src_h << 20) / drw_h);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
321 WRITE_REG(RectangleOrigin, info->dest.x | (info->dest.y << 16));
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
322 WRITE_REG(RectangleSize, (drw_h << 16) | drw_w);
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 TRACE_EXIT();
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
325 return 0;
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
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
328 static int pm2_playback_on(void)
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
329 {
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
330 TRACE_ENTER();
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 TRACE_EXIT();
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
333 return 0;
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
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
336 static int pm2_playback_off(void)
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
337 {
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
338 WRITE_REG(YUVMode, 0);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
339 WRITE_REG(TextureColorMode, 0);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
340 WRITE_REG(TextureAddressMode, 0);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
341 WRITE_REG(TextureReadMode, 0);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
342 return 0;
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
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
345 static int pm2_frame_select(unsigned int frame)
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
346 {
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
347 WRITE_REG(PMTextureBaseAddress, frames[frame]);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
348 WRITE_REG(Render, PrimitiveRectangle | XPositive | YPositive |
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
349 TextureEnable);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
350 return 0;
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
351 }
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
352
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
353 VDXDriver pm2_drv = {
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
354 "pm2",
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
355 NULL,
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
356 .probe = pm2_probe,
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
357 .get_caps = pm2_get_caps,
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
358 .query_fourcc = pm2_query_fourcc,
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
359 .init = pm2_init,
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
360 .destroy = pm2_destroy,
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
361 .config_playback = pm2_config_playback,
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
362 .playback_on = pm2_playback_on,
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
363 .playback_off = pm2_playback_off,
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
364 .frame_sel = pm2_frame_select,
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents:
diff changeset
365 };