annotate drivers/tdfx_vid_test.c @ 22715:363c84953547

check that definition of prototype of sysi86(int, void*) doesn't conflict; fixed compilation in opensolaris
author nicodvb
date Sun, 18 Mar 2007 22:18:11 +0000
parents 7b3021c6e8c0
children b4fdd3c12247
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
22659
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
1
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
2 #include <stdlib.h>
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
3 #include <stdio.h>
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
4 #include <sys/types.h>
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
5 #include <sys/stat.h>
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
6 #include <fcntl.h>
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
7 #include <unistd.h>
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
8 #include <sys/mman.h>
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
9 #include <sys/ioctl.h>
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
10 #include <inttypes.h>
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
11
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
12 #include "tdfx_vid.h"
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
13
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
14
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
15 static void print_tdfd_vid_cfg(tdfx_vid_config_t* cfg) {
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
16 printf("tdfx_vid version %d\n"
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
17 " Ram: %d\n"
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
18 " Screen: %d x %d\n",
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
19 cfg->version,
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
20 cfg->ram_size,
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
21 cfg->screen_width, cfg->screen_height);
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
22 }
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
23
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
24
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
25 int main(int argc, char** argv) {
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
26 int fd,i;
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
27 unsigned char *mem,*ptr;
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
28 tdfx_vid_agp_move_t move;
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
29 tdfx_vid_config_t cfg;
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
30 tdfx_vid_blit_t blit;
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 fd = open("/dev/tdfx_vid", O_RDWR);
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 if(fd <= 0) {
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
35 printf("Can't open /dev/tdfx_vid\n");
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
36 return 1;
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
37 }
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
38
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
39 if(ioctl(fd,TDFX_VID_GET_CONFIG,&cfg)) {
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
40 printf("Ioctl GET_CONFIG error\n");
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
41 close(fd);
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
42 return 1;
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
43 }
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
44
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
45 print_tdfd_vid_cfg(&cfg);
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
46
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
47 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
48 fd, 0);
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
49
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
50 if(mem == MAP_FAILED) {
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
51 printf("Memmap failed !!!!!\n");
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
52 return 1;
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
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
55 /* for(ptr = mem, i = 0 ; i < 640*480 ; i++) { */
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
56 /* ptr[0] = i & 0xFF; */
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
57 /* ptr[1] = (i & 0xFF); */
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
58 /* ptr += 2; */
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 memset(mem,0xFF,640*480*2);
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
62
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
63 memset(&move, 0, sizeof(tdfx_vid_agp_move_t));
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
64 move.width = 640;
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
65 move.height = 240;
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
66 move.src_stride = 640;
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
67 move.dst_stride = 640*2;
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 if(ioctl(fd,TDFX_VID_AGP_MOVE,&move)) {
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
70 printf("AGP Move failed !!!!\n");
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
71 return 0;
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
72 }
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
73
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
74 printf("AGP Move ????\n");
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
75 sleep(1);
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 blit.src = 0;
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
78 blit.src_stride = 640*2;
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
79 blit.src_x = blit.src_y = 0;
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
80 blit.src_w = 320;
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
81 blit.src_h = 240;
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
82 blit.src_format = cfg.screen_format;
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
83
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
84 blit.dst = 240*640*2+320;
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
85 blit.dst_stride = 640*2;
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
86 blit.dst_x = blit.dst_y = 0;
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
87 blit.dst_w = 320;
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
88 blit.dst_h = 240;
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
89 blit.dst_format = cfg.screen_format;
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_BLIT,&blit)) {
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
92 printf("Blit 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 }
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
95
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
96 close(fd);
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
97 return 1;
7b3021c6e8c0 Rename tdfx_vid_tst to tdfx_vid_test.
diego
parents:
diff changeset
98 }