annotate drivers/mga_vid_test.c @ 30747:7ac542b9ca24

Use the KEYFRAME define instead of some magic number.
author reimar
date Sun, 28 Feb 2010 07:45:23 +0000
parents 0f1b5b68af32
children 0ad2da052b2e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1 /*
26003
a506a6ab14e1 Add standard license header and make copyright notices consistent.
diego
parents: 24287
diff changeset
2 * Copyright (C) 1999 Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
3 *
27027
03f571138664 standard license headers for mga_vid
diego
parents: 26003
diff changeset
4 * This file is part of mga_vid.
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
5 *
27027
03f571138664 standard license headers for mga_vid
diego
parents: 26003
diff changeset
6 * mga_vid is free software; you can redistribute it and/or modify
26003
a506a6ab14e1 Add standard license header and make copyright notices consistent.
diego
parents: 24287
diff changeset
7 * it under the terms of the GNU General Public License as published by
a506a6ab14e1 Add standard license header and make copyright notices consistent.
diego
parents: 24287
diff changeset
8 * the Free Software Foundation; either version 2 of the License, or
a506a6ab14e1 Add standard license header and make copyright notices consistent.
diego
parents: 24287
diff changeset
9 * (at your option) any later version.
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
10 *
27027
03f571138664 standard license headers for mga_vid
diego
parents: 26003
diff changeset
11 * mga_vid is distributed in the hope that it will be useful,
26003
a506a6ab14e1 Add standard license header and make copyright notices consistent.
diego
parents: 24287
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
a506a6ab14e1 Add standard license header and make copyright notices consistent.
diego
parents: 24287
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
a506a6ab14e1 Add standard license header and make copyright notices consistent.
diego
parents: 24287
diff changeset
14 * GNU General Public License for more details.
a506a6ab14e1 Add standard license header and make copyright notices consistent.
diego
parents: 24287
diff changeset
15 *
a506a6ab14e1 Add standard license header and make copyright notices consistent.
diego
parents: 24287
diff changeset
16 * You should have received a copy of the GNU General Public License along
27027
03f571138664 standard license headers for mga_vid
diego
parents: 26003
diff changeset
17 * with mga_vid; if not, write to the Free Software Foundation, Inc.,
26003
a506a6ab14e1 Add standard license header and make copyright notices consistent.
diego
parents: 24287
diff changeset
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
19 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
20
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
21 //#include <stddef.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
22 #include <stdio.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
23 #include <stdlib.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
24 #include <sys/ioctl.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
25 #include <unistd.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
26 #include <fcntl.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
27 #include <sys/mman.h>
854
76ca00724e12 gcc warnings fixed - patch by Aelius aelius@wish.net
arpi_esp
parents: 76
diff changeset
28 #include <inttypes.h>
6245
aee789fa2d07 When compiling mga_vid_test.c, memcpy() is subject to an implicit
jaf
parents: 854
diff changeset
29 #include <string.h>
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
30 #include "mga_vid.h"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
31
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
32 mga_vid_config_t config;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
33 uint8_t *mga_vid_base;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
34 uint32_t is_g400;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
35
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
36 #define SRC_IMAGE_WIDTH 256
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
37 #define SRC_IMAGE_HEIGHT 256
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
38
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
39 uint8_t y_image[SRC_IMAGE_WIDTH * SRC_IMAGE_HEIGHT];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
40 uint8_t cr_image[SRC_IMAGE_WIDTH * SRC_IMAGE_HEIGHT];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
41 uint8_t cb_image[SRC_IMAGE_WIDTH * SRC_IMAGE_HEIGHT];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
42
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
43
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
44 void
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
45 write_frame_g200(uint8_t *y,uint8_t *cr, uint8_t *cb)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
46 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
47 uint8_t *dest;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
48 uint32_t bespitch,h,w;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
49
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
50 dest = mga_vid_base;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
51 bespitch = (config.src_width + 31) & ~31;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
52
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27027
diff changeset
53 for(h=0; h < config.src_height; h++)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
54 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
55 memcpy(dest, y, config.src_width);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
56 y += config.src_width;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
57 dest += bespitch;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
58 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
59
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27027
diff changeset
60 for(h=0; h < config.src_height/2; h++)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
61 {
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27027
diff changeset
62 for(w=0; w < config.src_width/2; w++)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
63 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
64 *dest++ = *cb++;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
65 *dest++ = *cr++;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
66 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
67 dest += bespitch - config.src_width;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
68 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
69 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
70
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
71 void
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
72 write_frame_g400(uint8_t *y,uint8_t *cr, uint8_t *cb)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
73 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
74 uint8_t *dest;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
75 uint32_t bespitch,h;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
76
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
77 dest = mga_vid_base;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
78 bespitch = (config.src_width + 31) & ~31;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
79
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27027
diff changeset
80 for(h=0; h < config.src_height; h++)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
81 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
82 memcpy(dest, y, config.src_width);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
83 y += config.src_width;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
84 dest += bespitch;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
85 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
86
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27027
diff changeset
87 for(h=0; h < config.src_height/2; h++)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
88 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
89 memcpy(dest, cb, config.src_width/2);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
90 cb += config.src_width/2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
91 dest += bespitch/2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
92 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
93
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27027
diff changeset
94 for(h=0; h < config.src_height/2; h++)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
95 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
96 memcpy(dest, cr, config.src_width/2);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
97 cr += config.src_width/2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
98 dest += bespitch/2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
99 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
100 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
101
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
102 void write_frame(uint8_t *y,uint8_t *cr, uint8_t *cb)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
103 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
104 if(is_g400)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
105 write_frame_g400(y,cr,cb);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
106 else
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
107 write_frame_g200(y,cr,cb);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
108 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
109
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
110 void
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
111 draw_cool_pattern(void)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
112 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
113 int i,x,y;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
114
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
115 i = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
116 for (y=0; y<config.src_height; y++) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
117 for (x=0; x<config.src_width; x++) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
118 y_image[i++] = x*x/2 + y*y/2 - 128;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
119 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
120 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
121
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
122 i = 0;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27027
diff changeset
123 for (y=0; y<config.src_height/2; y++)
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27027
diff changeset
124 for (x=0; x<config.src_width/2; x++)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
125 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
126 cr_image[i++] = x - 128;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
127 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
128
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
129 i = 0;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27027
diff changeset
130 for (y=0; y<config.src_height/2; y++)
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27027
diff changeset
131 for (x=0; x<config.src_width/2; x++)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
132 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
133 cb_image[i++] = y - 128;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
134 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
135 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
136
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
137 void
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
138 draw_color_blend(void)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
139 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
140 int i,x,y;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
141
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
142 i = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
143 for (y=0; y<config.src_height; y++) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
144 for (x=0; x<config.src_width; x++) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
145 y_image[i++] = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
146 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
147 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
148
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
149 i = 0;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27027
diff changeset
150 for (y=0; y<config.src_height/2; y++)
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27027
diff changeset
151 for (x=0; x<config.src_width/2; x++)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
152 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
153 cr_image[i++] = x - 128;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
154 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
155
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
156 i = 0;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27027
diff changeset
157 for (y=0; y<config.src_height/2; y++)
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27027
diff changeset
158 for (x=0; x<config.src_width/2; x++)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
159 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
160 cb_image[i++] = y - 128;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
161 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
162 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
163
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
164
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27027
diff changeset
165 int
24287
6635801bbf1b warning fixes:
diego
parents: 6245
diff changeset
166 main(void)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
167 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
168 int f;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
169
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
170 f = open("/dev/mga_vid",O_RDWR);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
171
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
172 if(f == -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
173 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
174 fprintf(stderr,"Couldn't open driver\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
175 exit(1);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
176 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
177
76
d95acdc18f38 updated to be compatible with new mga_vid.o
arpi_esp
parents: 1
diff changeset
178 config.version = MGA_VID_VERSION;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
179 config.src_width = SRC_IMAGE_WIDTH;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
180 config.src_height= SRC_IMAGE_HEIGHT;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
181 config.dest_width = SRC_IMAGE_WIDTH;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
182 config.dest_height = SRC_IMAGE_HEIGHT;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
183 config.x_org= 10;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
184 config.y_org= 10;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
185 config.colkey_on = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
186 config.format = MGA_VID_FORMAT_YV12;
76
d95acdc18f38 updated to be compatible with new mga_vid.o
arpi_esp
parents: 1
diff changeset
187 config.frame_size=SRC_IMAGE_WIDTH*SRC_IMAGE_HEIGHT*2;
d95acdc18f38 updated to be compatible with new mga_vid.o
arpi_esp
parents: 1
diff changeset
188 config.num_frames=1;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
189
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
190 if (ioctl(f,MGA_VID_CONFIG,&config))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
191 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
192 perror("Error in config ioctl");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
193 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
194
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27027
diff changeset
195 if (config.card_type == MGA_G200)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
196 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
197 printf("Testing MGA G200 Backend Scaler with %d MB of RAM\n", config.ram_size);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
198 is_g400 = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
199 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
200 else
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
201 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
202 printf("Testing MGA G400 Backend Scaler with %d MB of RAM\n", config.ram_size);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
203 is_g400 = 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
204 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27027
diff changeset
205
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
206 ioctl(f,MGA_VID_ON,0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
207 mga_vid_base = (uint8_t*)mmap(0,256 * 4096,PROT_WRITE,MAP_SHARED,f,0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
208 printf("mga_vid_base = %8p\n",mga_vid_base);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
209
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
210
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
211 //memset(y_image,80,256 * 128);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
212 //memset(cr_image,80,256/2 * 20);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
213 //memset(cb_image,80,256/2 * 20);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
214 write_frame(y_image,cr_image,cb_image);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
215 printf("(1) There should be a green square, offset by 10 pixels from\n"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
216 " the upper left corner displayed\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
217 sleep(3);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
218
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
219
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
220 draw_cool_pattern();
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
221 write_frame(y_image,cr_image,cb_image);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
222 printf("(2) There should be a cool mosaic like pattern now.\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
223 sleep(3);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
224
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
225 draw_color_blend();
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
226 write_frame(y_image,cr_image,cb_image);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
227 printf("(3) There should be a color blend with black, red, purple, blue\n"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
228 " corners (starting top left going CW)\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
229 sleep(3);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
230
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
231 ioctl(f,MGA_VID_OFF,0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
232
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
233 close(f);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
234 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
235 }