core: Set mpctx->chapters to NULL at uninit
[mplayer.git] / drivers / tdfx_vid_test.c
blobaf9c86adcf6cf7ec765f7d0656ad1f9330159128
1 /*
2 * Copyright (C) 2003 Alban Bedel
4 * This file is part of MPlayer.
6 * MPlayer is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * MPlayer is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 #include <stdlib.h>
22 #include <stdio.h>
23 #include <string.h>
24 #include <sys/types.h>
25 #include <sys/stat.h>
26 #include <fcntl.h>
27 #include <unistd.h>
28 #include <sys/mman.h>
29 #include <sys/ioctl.h>
30 #include <inttypes.h>
32 #include "tdfx_vid.h"
35 static void print_tdfd_vid_cfg(tdfx_vid_config_t* cfg) {
36 printf("tdfx_vid version %d\n"
37 " Ram: %d\n"
38 " Screen: %d x %d\n",
39 cfg->version,
40 cfg->ram_size,
41 cfg->screen_width, cfg->screen_height);
45 int main(void) {
46 int fd;
47 unsigned char *mem;
48 /* int i; */
49 /* unsigned char *ptr; */
50 tdfx_vid_agp_move_t move;
51 tdfx_vid_config_t cfg;
52 tdfx_vid_blit_t blit;
54 fd = open("/dev/tdfx_vid", O_RDWR);
56 if(fd <= 0) {
57 printf("Can't open /dev/tdfx_vid\n");
58 return 1;
61 if(ioctl(fd,TDFX_VID_GET_CONFIG,&cfg)) {
62 printf("Ioctl GET_CONFIG error\n");
63 close(fd);
64 return 1;
67 print_tdfd_vid_cfg(&cfg);
69 mem = mmap( NULL, 640*480*2, PROT_READ | PROT_WRITE, MAP_SHARED,
70 fd, 0);
72 if(mem == MAP_FAILED) {
73 printf("Memmap failed !!!!!\n");
74 return 1;
77 /* for(ptr = mem, i = 0 ; i < 640*480 ; i++) { */
78 /* ptr[0] = i & 0xFF; */
79 /* ptr[1] = (i & 0xFF); */
80 /* ptr += 2; */
81 /* } */
83 memset(mem,0xFF,640*480*2);
85 memset(&move, 0, sizeof(tdfx_vid_agp_move_t));
86 move.width = 640;
87 move.height = 240;
88 move.src_stride = 640;
89 move.dst_stride = 640*2;
91 if(ioctl(fd,TDFX_VID_AGP_MOVE,&move)) {
92 printf("AGP Move failed !!!!\n");
93 return 0;
96 printf("AGP Move ????\n");
97 sleep(1);
99 blit.src = 0;
100 blit.src_stride = 640*2;
101 blit.src_x = blit.src_y = 0;
102 blit.src_w = 320;
103 blit.src_h = 240;
104 blit.src_format = cfg.screen_format;
106 blit.dst = 240*640*2+320;
107 blit.dst_stride = 640*2;
108 blit.dst_x = blit.dst_y = 0;
109 blit.dst_w = 320;
110 blit.dst_h = 240;
111 blit.dst_format = cfg.screen_format;
113 if(ioctl(fd,TDFX_VID_BLIT,&blit)) {
114 printf("Blit failed !!!!\n");
115 return 0;
118 close(fd);
119 return 1;