Mercurial > mplayer.hg
annotate drivers/tdfx_vid_tst.c @ 10394:59982e3c403b
Fix -shuffle with remote playlist
author | albeu |
---|---|
date | Tue, 08 Jul 2003 10:45:05 +0000 |
parents | d1bbeae9f46a |
children |
rev | line source |
---|---|
9545
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
1 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
2 #include <stdlib.h> |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
3 #include <stdio.h> |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
4 #include <sys/types.h> |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
5 #include <sys/stat.h> |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
6 #include <fcntl.h> |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
7 #include <unistd.h> |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
8 #include <sys/mman.h> |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
9 #include <sys/ioctl.h> |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
10 #include <inttypes.h> |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
11 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
12 #include "tdfx_vid.h" |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
13 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
14 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
15 static void print_tdfd_vid_cfg(tdfx_vid_config_t* cfg) { |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
16 printf("tdfx_vid version %d\n" |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
17 " Ram: %d\n" |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
18 " Screen: %d x %d\n", |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
19 cfg->version, |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
20 cfg->ram_size, |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
21 cfg->screen_width, cfg->screen_height); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
22 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
23 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
24 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
25 int main(int argc, char** argv) { |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
26 int fd,i; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
27 unsigned char *mem,*ptr; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
28 tdfx_vid_agp_move_t move; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
29 tdfx_vid_config_t cfg; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
30 tdfx_vid_blit_t blit; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
31 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
32 fd = open("/dev/tdfx_vid", O_RDWR); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
33 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
34 if(fd <= 0) { |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
35 printf("Can't open /dev/tdfx_vid\n"); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
36 return 1; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
37 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
38 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
39 if(ioctl(fd,TDFX_VID_GET_CONFIG,&cfg)) { |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
40 printf("Ioctl GET_CONFIG error\n"); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
41 close(fd); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
42 return 1; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
43 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
44 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
45 print_tdfd_vid_cfg(&cfg); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
46 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
47 mem = mmap( NULL, 640*480*2, PROT_READ | PROT_WRITE, MAP_SHARED, |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
48 fd, 0); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
49 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
50 if(mem == MAP_FAILED) { |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
51 printf("Memmap failed !!!!!\n"); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
52 return 1; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
53 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
54 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
55 /* for(ptr = mem, i = 0 ; i < 640*480 ; i++) { */ |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
56 /* ptr[0] = i & 0xFF; */ |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
57 /* ptr[1] = (i & 0xFF); */ |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
58 /* ptr += 2; */ |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
59 /* } */ |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
60 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
61 memset(mem,0xFF,640*480*2); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
62 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
63 memset(&move, 0, sizeof(tdfx_vid_agp_move_t)); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
64 move.width = 640; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
65 move.height = 240; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
66 move.src_stride = 640; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
67 move.dst_stride = 640*2; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
68 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
69 if(ioctl(fd,TDFX_VID_AGP_MOVE,&move)) { |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
70 printf("AGP Move failed !!!!\n"); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
71 return 0; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
72 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
73 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
74 printf("AGP Move ????\n"); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
75 sleep(1); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
76 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
77 blit.src = 0; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
78 blit.src_stride = 640*2; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
79 blit.src_x = blit.src_y = 0; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
80 blit.src_w = 320; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
81 blit.src_h = 240; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
82 blit.src_format = cfg.screen_format; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
83 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
84 blit.dst = 240*640*2+320; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
85 blit.dst_stride = 640*2; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
86 blit.dst_x = blit.dst_y = 0; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
87 blit.dst_w = 320; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
88 blit.dst_h = 240; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
89 blit.dst_format = cfg.screen_format; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
90 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
91 if(ioctl(fd,TDFX_VID_BLIT,&blit)) { |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
92 printf("Blit failed !!!!\n"); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
93 return 0; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
94 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
95 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
96 close(fd); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
97 return 1; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
98 } |