10 #include <sys/ioctl.h>
16 static void print_tdfd_vid_cfg(tdfx_vid_config_t
* cfg
) {
17 printf("tdfx_vid version %d\n"
22 cfg
->screen_width
, cfg
->screen_height
);
30 /* unsigned char *ptr; */
31 tdfx_vid_agp_move_t move
;
32 tdfx_vid_config_t cfg
;
35 fd
= open("/dev/tdfx_vid", O_RDWR
);
38 printf("Can't open /dev/tdfx_vid\n");
42 if(ioctl(fd
,TDFX_VID_GET_CONFIG
,&cfg
)) {
43 printf("Ioctl GET_CONFIG error\n");
48 print_tdfd_vid_cfg(&cfg
);
50 mem
= mmap( NULL
, 640*480*2, PROT_READ
| PROT_WRITE
, MAP_SHARED
,
53 if(mem
== MAP_FAILED
) {
54 printf("Memmap failed !!!!!\n");
58 /* for(ptr = mem, i = 0 ; i < 640*480 ; i++) { */
59 /* ptr[0] = i & 0xFF; */
60 /* ptr[1] = (i & 0xFF); */
64 memset(mem
,0xFF,640*480*2);
66 memset(&move
, 0, sizeof(tdfx_vid_agp_move_t
));
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");
77 printf("AGP Move ????\n");
81 blit
.src_stride
= 640*2;
82 blit
.src_x
= blit
.src_y
= 0;
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;
92 blit
.dst_format
= cfg
.screen_format
;
94 if(ioctl(fd
,TDFX_VID_BLIT
,&blit
)) {
95 printf("Blit failed !!!!\n");