Comment out the correct #endif directive.
[mplayer/greg.git] / drivers / tdfx_vid_test.c
bloba0fbbb9c3d299ab96d95c592a4b8b49969eb2237
2 #include <stdlib.h>
3 #include <stdio.h>
4 #include <string.h>
5 #include <sys/types.h>
6 #include <sys/stat.h>
7 #include <fcntl.h>
8 #include <unistd.h>
9 #include <sys/mman.h>
10 #include <sys/ioctl.h>
11 #include <inttypes.h>
13 #include "tdfx_vid.h"
16 static void print_tdfd_vid_cfg(tdfx_vid_config_t* cfg) {
17 printf("tdfx_vid version %d\n"
18 " Ram: %d\n"
19 " Screen: %d x %d\n",
20 cfg->version,
21 cfg->ram_size,
22 cfg->screen_width, cfg->screen_height);
26 int main(void) {
27 int fd;
28 unsigned char *mem;
29 /* int i; */
30 /* unsigned char *ptr; */
31 tdfx_vid_agp_move_t move;
32 tdfx_vid_config_t cfg;
33 tdfx_vid_blit_t blit;
35 fd = open("/dev/tdfx_vid", O_RDWR);
37 if(fd <= 0) {
38 printf("Can't open /dev/tdfx_vid\n");
39 return 1;
42 if(ioctl(fd,TDFX_VID_GET_CONFIG,&cfg)) {
43 printf("Ioctl GET_CONFIG error\n");
44 close(fd);
45 return 1;
48 print_tdfd_vid_cfg(&cfg);
50 mem = mmap( NULL, 640*480*2, PROT_READ | PROT_WRITE, MAP_SHARED,
51 fd, 0);
53 if(mem == MAP_FAILED) {
54 printf("Memmap failed !!!!!\n");
55 return 1;
58 /* for(ptr = mem, i = 0 ; i < 640*480 ; i++) { */
59 /* ptr[0] = i & 0xFF; */
60 /* ptr[1] = (i & 0xFF); */
61 /* ptr += 2; */
62 /* } */
64 memset(mem,0xFF,640*480*2);
66 memset(&move, 0, sizeof(tdfx_vid_agp_move_t));
67 move.width = 640;
68 move.height = 240;
69 move.src_stride = 640;
70 move.dst_stride = 640*2;
72 if(ioctl(fd,TDFX_VID_AGP_MOVE,&move)) {
73 printf("AGP Move failed !!!!\n");
74 return 0;
77 printf("AGP Move ????\n");
78 sleep(1);
80 blit.src = 0;
81 blit.src_stride = 640*2;
82 blit.src_x = blit.src_y = 0;
83 blit.src_w = 320;
84 blit.src_h = 240;
85 blit.src_format = cfg.screen_format;
87 blit.dst = 240*640*2+320;
88 blit.dst_stride = 640*2;
89 blit.dst_x = blit.dst_y = 0;
90 blit.dst_w = 320;
91 blit.dst_h = 240;
92 blit.dst_format = cfg.screen_format;
94 if(ioctl(fd,TDFX_VID_BLIT,&blit)) {
95 printf("Blit failed !!!!\n");
96 return 0;
99 close(fd);
100 return 1;