annotate drivers/tdfx_vid_test.c @ 36726:ed1d856ec43d

Use DECLARE_ALIGNED helper macros. Patch by Matt Oliver [protogonoi gmail.com].
author reimar
date Sun, 09 Feb 2014 22:19:07 +0000
parents 0f1b5b68af32
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
26003
a506a6ab14e1 Add standard license header and make copyright notices consistent.
diego
parents: 24287
diff changeset
1 /*
a506a6ab14e1 Add standard license header and make copyright notices consistent.
diego
parents: 24287
diff changeset
2 * Copyright (C) 2003 Alban Bedel
a506a6ab14e1 Add standard license header and make copyright notices consistent.
diego
parents: 24287
diff changeset
3 *
a506a6ab14e1 Add standard license header and make copyright notices consistent.
diego
parents: 24287
diff changeset
4 * This file is part of MPlayer.
a506a6ab14e1 Add standard license header and make copyright notices consistent.
diego
parents: 24287
diff changeset
5 *
a506a6ab14e1 Add standard license header and make copyright notices consistent.
diego
parents: 24287
diff changeset
6 * MPlayer is free software; you can redistribute it and/or modify
a506a6ab14e1 Add standard license header and make copyright notices consistent.
diego
parents: 24287
diff changeset
7 * it under the terms of the GNU General Public License as published by
a506a6ab14e1 Add standard license header and make copyright notices consistent.
diego
parents: 24287
diff changeset
8 * the Free Software Foundation; either version 2 of the License, or
a506a6ab14e1 Add standard license header and make copyright notices consistent.
diego
parents: 24287
diff changeset
9 * (at your option) any later version.
a506a6ab14e1 Add standard license header and make copyright notices consistent.
diego
parents: 24287
diff changeset
10 *
a506a6ab14e1 Add standard license header and make copyright notices consistent.
diego
parents: 24287
diff changeset
11 * MPlayer is distributed in the hope that it will be useful,
a506a6ab14e1 Add standard license header and make copyright notices consistent.
diego
parents: 24287
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
a506a6ab14e1 Add standard license header and make copyright notices consistent.
diego
parents: 24287
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
a506a6ab14e1 Add standard license header and make copyright notices consistent.
diego
parents: 24287
diff changeset
14 * GNU General Public License for more details.
a506a6ab14e1 Add standard license header and make copyright notices consistent.
diego
parents: 24287
diff changeset
15 *
a506a6ab14e1 Add standard license header and make copyright notices consistent.
diego
parents: 24287
diff changeset
16 * You should have received a copy of the GNU General Public License along
a506a6ab14e1 Add standard license header and make copyright notices consistent.
diego
parents: 24287
diff changeset
17 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
a506a6ab14e1 Add standard license header and make copyright notices consistent.
diego
parents: 24287
diff changeset
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
a506a6ab14e1 Add standard license header and make copyright notices consistent.
diego
parents: 24287
diff changeset
19 */
22659
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
20
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
21 #include <stdlib.h>
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
22 #include <stdio.h>
24262
b4fdd3c12247 warning fix:
diego
parents: 22659
diff changeset
23 #include <string.h>
22659
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
24 #include <sys/types.h>
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
25 #include <sys/stat.h>
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
26 #include <fcntl.h>
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
27 #include <unistd.h>
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
28 #include <sys/mman.h>
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
29 #include <sys/ioctl.h>
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
30 #include <inttypes.h>
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
31
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
32 #include "tdfx_vid.h"
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
33
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
34
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
35 static void print_tdfd_vid_cfg(tdfx_vid_config_t* cfg) {
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
36 printf("tdfx_vid version %d\n"
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
37 " Ram: %d\n"
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
38 " Screen: %d x %d\n",
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
39 cfg->version,
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
40 cfg->ram_size,
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26003
diff changeset
41 cfg->screen_width, cfg->screen_height);
22659
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
42 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26003
diff changeset
43
22659
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
44
24287
6635801bbf1b warning fixes:
diego
parents: 24265
diff changeset
45 int main(void) {
24265
fc571d853ae1 warning fixes:
diego
parents: 24262
diff changeset
46 int fd;
fc571d853ae1 warning fixes:
diego
parents: 24262
diff changeset
47 unsigned char *mem;
fc571d853ae1 warning fixes:
diego
parents: 24262
diff changeset
48 /* int i; */
fc571d853ae1 warning fixes:
diego
parents: 24262
diff changeset
49 /* unsigned char *ptr; */
22659
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
50 tdfx_vid_agp_move_t move;
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
51 tdfx_vid_config_t cfg;
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
52 tdfx_vid_blit_t blit;
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
53
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
54 fd = open("/dev/tdfx_vid", O_RDWR);
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
55
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
56 if(fd <= 0) {
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
57 printf("Can't open /dev/tdfx_vid\n");
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
58 return 1;
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
59 }
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
60
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
61 if(ioctl(fd,TDFX_VID_GET_CONFIG,&cfg)) {
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
62 printf("Ioctl GET_CONFIG error\n");
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
63 close(fd);
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
64 return 1;
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
65 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26003
diff changeset
66
22659
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
67 print_tdfd_vid_cfg(&cfg);
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
68
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
69 mem = mmap( NULL, 640*480*2, PROT_READ | PROT_WRITE, MAP_SHARED,
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
70 fd, 0);
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
71
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
72 if(mem == MAP_FAILED) {
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
73 printf("Memmap failed !!!!!\n");
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
74 return 1;
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
75 }
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
76
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
77 /* for(ptr = mem, i = 0 ; i < 640*480 ; i++) { */
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
78 /* ptr[0] = i & 0xFF; */
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
79 /* ptr[1] = (i & 0xFF); */
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
80 /* ptr += 2; */
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
81 /* } */
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26003
diff changeset
82
22659
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
83 memset(mem,0xFF,640*480*2);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26003
diff changeset
84
22659
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
85 memset(&move, 0, sizeof(tdfx_vid_agp_move_t));
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
86 move.width = 640;
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
87 move.height = 240;
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
88 move.src_stride = 640;
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
89 move.dst_stride = 640*2;
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
90
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
91 if(ioctl(fd,TDFX_VID_AGP_MOVE,&move)) {
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
92 printf("AGP Move failed !!!!\n");
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
93 return 0;
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
94 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26003
diff changeset
95
22659
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
96 printf("AGP Move ????\n");
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
97 sleep(1);
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
98
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
99 blit.src = 0;
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
100 blit.src_stride = 640*2;
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
101 blit.src_x = blit.src_y = 0;
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
102 blit.src_w = 320;
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
103 blit.src_h = 240;
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
104 blit.src_format = cfg.screen_format;
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
105
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
106 blit.dst = 240*640*2+320;
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
107 blit.dst_stride = 640*2;
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
108 blit.dst_x = blit.dst_y = 0;
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
109 blit.dst_w = 320;
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
110 blit.dst_h = 240;
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
111 blit.dst_format = cfg.screen_format;
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
112
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
113 if(ioctl(fd,TDFX_VID_BLIT,&blit)) {
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
114 printf("Blit failed !!!!\n");
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
115 return 0;
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
116 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26003
diff changeset
117
22659
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
118 close(fd);
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
119 return 1;
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
120 }