Mercurial > mplayer.hg
annotate libvo/vo_svga.c @ 973:c08282a937d3
Changed to only uninit SDL Video Subsystem.
author | atmosfear |
---|---|
date | Sun, 03 Jun 2001 21:02:46 +0000 |
parents | c1cd62f01b2f |
children | 90408bd383a5 |
rev | line source |
---|---|
285 | 1 /* |
292 | 2 Video driver for SVGAlib - alpha, slow |
285 | 3 by Zoltan Mark Vician <se7en@sch.bme.hu> |
381 | 4 Code started: Mon Apr 1 23:25:47 2001 |
407 | 5 |
6 Uses HW acceleration if your card is supported by SVGAlib. | |
285 | 7 */ |
8 | |
9 #include <stdio.h> | |
10 #include <stdlib.h> | |
11 | |
12 #include <vga.h> | |
13 #include <vgagl.h> | |
14 | |
485 | 15 #include <limits.h> |
16 | |
285 | 17 #include "config.h" |
18 #include "video_out.h" | |
19 #include "video_out_internal.h" | |
20 | |
21 #include "yuv2rgb.h" | |
377 | 22 #include "mmx.h" |
285 | 23 |
616 | 24 #include "sub.h" |
25 | |
407 | 26 extern void rgb15to16_mmx(char* s0,char* d0,int count); |
485 | 27 extern int vo_dbpp; |
504 | 28 extern int verbose; |
407 | 29 |
285 | 30 LIBVO_EXTERN(svga) |
31 | |
32 static vo_info_t vo_info = { | |
33 "SVGAlib", | |
34 "svga", | |
35 "Zoltan Mark Vician <se7en@sch.bme.hu>", | |
36 "" | |
37 }; | |
38 | |
39 // SVGAlib definitions | |
40 | |
41 GraphicsContext *screen; | |
42 GraphicsContext *virt; | |
43 | |
407 | 44 static uint8_t *scalebuf = NULL, *yuvbuf = NULL, *bppbuf = NULL; |
285 | 45 |
46 static uint32_t orig_w, orig_h, maxw, maxh; // Width, height | |
377 | 47 static float scaling = 1.0; |
285 | 48 static uint32_t x_pos, y_pos; // Position |
49 | |
483 | 50 // SVGAlib - list of detected modes |
51 typedef struct vga_modelist_s { | |
52 uint16_t modenum; | |
53 vga_modeinfo modeinfo; | |
54 struct vga_modelist_s *next; | |
55 } vga_modelist_t; | |
447 | 56 |
483 | 57 vga_modelist_t *modelist = NULL; |
58 | |
327 | 59 static uint8_t bpp; |
483 | 60 static uint8_t bpp_conv = 0; |
448
198b46b739d8
qrva eletbe nem kene cvs-t elbaszni inkabb ne nyuljatok hozza baz+
arpi_esp
parents:
447
diff
changeset
|
61 static uint32_t pformat; |
447 | 62 |
483 | 63 #define BPP_15 1 |
64 #define BPP_16 2 | |
65 #define BPP_24 4 | |
66 #define BPP_32 8 | |
67 static uint8_t bpp_avail = 0; | |
68 | |
285 | 69 static uint8_t checked = 0; |
483 | 70 |
485 | 71 static uint32_t add_mode(uint16_t mode, vga_modeinfo minfo) { |
483 | 72 vga_modelist_t *list; |
285 | 73 |
483 | 74 if (modelist == NULL) { |
485 | 75 modelist = (vga_modelist_t *) malloc(sizeof(vga_modelist_t)); |
483 | 76 if (modelist == NULL) { |
77 printf("vo_svga: add_mode() failed. Not enough memory for modelist."); | |
78 return(1); // error | |
79 } | |
485 | 80 modelist->modenum = mode; |
81 modelist->modeinfo = minfo; | |
82 modelist->next = NULL; | |
483 | 83 } else { |
84 list = modelist; | |
85 while (list->next != NULL) | |
86 list = list->next; | |
485 | 87 list->next = (vga_modelist_t *) malloc(sizeof(vga_modelist_t)); |
483 | 88 if (list->next == NULL) { |
89 printf("vo_svga: add_mode() failed. Not enough memory for modelist."); | |
90 return(1); // error | |
91 } | |
92 list = list->next; | |
93 list->modenum = mode; | |
94 list->modeinfo = minfo; | |
95 list->next = NULL; | |
96 } | |
485 | 97 return (0); |
483 | 98 } |
99 | |
100 static int checksupportedmodes() { | |
485 | 101 uint16_t i, max; |
483 | 102 vga_modeinfo *minfo; |
285 | 103 |
104 checked = 1; | |
105 vga_init(); | |
106 vga_disabledriverreport(); | |
485 | 107 max = vga_lastmodenumber(); |
108 for (i = 1; i < max; i++) | |
483 | 109 if (vga_hasmode(i) > 0) { |
110 minfo = vga_getmodeinfo(i); | |
111 switch (minfo->colors) { | |
112 case 32768: bpp_avail |= BPP_15; break; | |
113 case 65536: bpp_avail |= BPP_16; break; | |
114 } | |
115 switch (minfo->bytesperpixel) { | |
116 case 3: bpp_avail |= BPP_24; break; | |
117 case 4: bpp_avail |= BPP_32; break; | |
118 } | |
504 | 119 if (verbose >= 2) |
120 printf("vo_svga: Mode found: %s\n",vga_getmodename(i)); | |
483 | 121 if (add_mode(i, *minfo)) |
122 return(1); | |
123 } | |
485 | 124 return(0); |
285 | 125 } |
126 | |
127 static uint32_t init(uint32_t width, uint32_t height, uint32_t d_width, | |
128 uint32_t d_height, uint32_t fullscreen, char *title, | |
129 uint32_t format) { | |
483 | 130 uint32_t req_w = (d_width > 0 ? d_width : width); |
131 uint32_t req_h = (d_height > 0 ? d_height : height); | |
132 uint16_t vid_mode = 0; | |
133 uint8_t widescreen = (((req_w*1.0)/req_h) > (4.0/3)) ? 1 : 0; | |
485 | 134 uint16_t buf_w = USHRT_MAX, buf_h = USHRT_MAX; |
483 | 135 vga_modelist_t *list = modelist; |
387 | 136 |
285 | 137 if (!checked) { |
485 | 138 if (checksupportedmodes()) // Looking for available video modes |
483 | 139 return(1); |
285 | 140 } |
407 | 141 |
483 | 142 bpp_avail = 0; |
143 while (list != NULL) { | |
144 if ((list->modeinfo.width >= req_w) && (list->modeinfo.height >= req_h)) { | |
145 switch (list->modeinfo.colors) { | |
146 case 32768: bpp_avail |= BPP_15; break; | |
147 case 65536: bpp_avail |= BPP_16; break; | |
148 } | |
149 switch (list->modeinfo.bytesperpixel) { | |
150 case 3: bpp_avail |= BPP_24; break; | |
151 case 4: bpp_avail |= BPP_32; break; | |
152 } | |
153 } | |
154 list = list->next; | |
155 } | |
156 | |
285 | 157 pformat = format; |
411 | 158 |
483 | 159 // bpp check |
160 bpp_conv = 0; | |
411 | 161 if (!vo_dbpp) { |
162 if (format == IMGFMT_YV12) bpp = 32; | |
163 else bpp = format & 255; | |
504 | 164 if (verbose) |
165 printf("vo_svga: vo_dbpp == 0, bpp: %d\n",bpp); | |
483 | 166 switch (bpp) { |
167 case 32: if (!(bpp_avail & BPP_32)) { | |
168 printf("vo_svga: Haven't found video mode which fit to: %dx%d %dbpp\n",req_w,req_h,bpp); | |
485 | 169 printf("vo_svga: Maybe you should try -bpp\n"); |
483 | 170 return(1); |
171 } | |
172 break; | |
619 | 173 case 24: if (!(bpp_avail & BPP_24)) { |
483 | 174 if (!(bpp_avail & BPP_32)) { |
175 printf("vo_svga: Haven't found video mode which fit to: %dx%d %dbpp\n",req_w,req_h,bpp); | |
485 | 176 printf("vo_svga: Maybe you should try -bpp\n"); |
483 | 177 return(1); |
178 } else { | |
179 bpp = 32; | |
180 bpp_conv = 1; | |
617 | 181 printf("vo_svga: BPP conversion 24->32\n"); |
619 | 182 } |
183 } | |
483 | 184 break; |
185 case 16: if (!(bpp_avail & BPP_16)) { | |
186 printf("vo_svga: Haven't found video mode which fit to: %dx%d %dbpp\n",req_w,req_h,bpp); | |
187 printf("vo_svga: Maybe you should try -bpp\n"); | |
188 return(1); | |
189 } | |
190 break; | |
619 | 191 case 15: if (!(bpp_avail & BPP_15)) { |
483 | 192 if (!(bpp_avail & BPP_16)) { |
193 printf("vo_svga: Haven't found video mode which fit to: %dx%d %dbpp\n",req_w,req_h,bpp); | |
194 printf("vo_svga: Maybe you should try -bpp\n"); | |
195 return(1); | |
196 } else { | |
197 bpp = 16; | |
198 bpp_conv = 1; | |
617 | 199 printf("vo_svga: BPP conversion 15->16\n"); |
483 | 200 } |
619 | 201 } |
483 | 202 break; |
203 } | |
411 | 204 } else { |
205 bpp = vo_dbpp; | |
504 | 206 if (verbose) |
207 printf("vo_svga: vo_dbpp == %d\n",bpp); | |
411 | 208 switch (bpp) { |
483 | 209 case 32: if (!(bpp_avail & BPP_32)) { |
485 | 210 printf("vo_svga: %dbpp not supported in %dx%d (or larger resoltuion) by HW or SVGAlib\n",bpp,req_w,req_h); |
411 | 211 return(1); |
212 } | |
485 | 213 break; |
483 | 214 case 24: if (!(bpp_avail & BPP_24)) { |
485 | 215 printf("vo_svga: %dbpp not supported in %dx%d (or larger resoltuion) by HW or SVGAlib\n",bpp,req_w,req_h); |
411 | 216 return(1); |
217 } | |
485 | 218 break; |
483 | 219 case 16: if (!(bpp_avail & BPP_16)) { |
485 | 220 printf("vo_svga: %dbpp not supported in %dx%d (or larger resoltuion) by HW or SVGAlib\n",bpp,req_w,req_h); |
411 | 221 return(1); |
222 } | |
485 | 223 break; |
483 | 224 case 15: if (!(bpp_avail & BPP_15)) { |
485 | 225 printf("vo_svga: %dbpp not supported in %dx%d (or larger resoltuion) by HW or SVGAlib\n",bpp,req_w,req_h); |
411 | 226 return(1); |
227 } | |
485 | 228 break; |
411 | 229 } |
230 } | |
483 | 231 |
232 list = modelist; | |
504 | 233 if (verbose) { |
234 printf("vo_svga: Looking for the best resolution...\n"); | |
235 printf("vo_svga: req_w: %d, req_h: %d, bpp: %d\n",req_w,req_h,bpp); | |
236 } | |
485 | 237 while (list != NULL) { |
483 | 238 if ((list->modeinfo.width >= req_w) && (list->modeinfo.height >= req_h)) { |
504 | 239 if (verbose) { |
240 switch (list->modeinfo.colors) { | |
241 case 32768: printf("vo_svga: vid_mode: %d, %dx%d 15bpp\n",list->modenum,list->modeinfo.width,list->modeinfo.height); | |
242 break; | |
243 case 65536: printf("vo_svga: vid_mode: %d, %dx%d 16bpp\n",list->modenum,list->modeinfo.width,list->modeinfo.height); | |
244 break; | |
245 } | |
246 switch (list->modeinfo.bytesperpixel) { | |
247 case 3: printf("vo_svga: vid_mode: %d, %dx%d 24bpp\n",list->modenum,list->modeinfo.width,list->modeinfo.height); | |
248 break; | |
249 case 4: printf("vo_svga: vid_mode: %d, %dx%d 32bpp\n",list->modenum,list->modeinfo.width,list->modeinfo.height); | |
250 break; | |
251 } | |
252 } | |
285 | 253 switch (bpp) { |
483 | 254 case 32: if (list->modeinfo.bytesperpixel == 4) |
485 | 255 if ((list->modeinfo.width < buf_w) || (list->modeinfo.height < buf_h)) { |
256 vid_mode = list->modenum; | |
257 buf_w = list->modeinfo.width; | |
258 buf_h = list->modeinfo.height; | |
259 } | |
260 break; | |
483 | 261 case 24: if (list->modeinfo.bytesperpixel == 3) |
485 | 262 if ((list->modeinfo.width < buf_w) || (list->modeinfo.height < buf_h)) { |
263 vid_mode = list->modenum; | |
264 buf_w = list->modeinfo.width; | |
265 buf_h = list->modeinfo.height; | |
266 } | |
267 break; | |
483 | 268 case 16: if (list->modeinfo.colors == 65536) |
485 | 269 if ((list->modeinfo.width < buf_w) || (list->modeinfo.height < buf_h)) { |
270 vid_mode = list->modenum; | |
271 buf_w = list->modeinfo.width; | |
272 buf_h = list->modeinfo.height; | |
273 } | |
274 break; | |
483 | 275 case 15: if (list->modeinfo.colors == 32768) |
485 | 276 if ((list->modeinfo.width < buf_w) || (list->modeinfo.height < buf_h)) { |
277 vid_mode = list->modenum; | |
278 buf_w = list->modeinfo.width; | |
279 buf_h = list->modeinfo.height; | |
280 } | |
281 break; | |
285 | 282 } |
483 | 283 } |
284 list = list->next; | |
407 | 285 } |
485 | 286 |
504 | 287 if (verbose) |
288 printf("vo_svga: vid_mode: %d\n",vid_mode); | |
407 | 289 vga_setlinearaddressing(); |
485 | 290 if (vga_setmode(vid_mode) == -1) { |
286 | 291 printf("vo_svga: vga_setmode(%d) failed.\n",vid_mode); |
483 | 292 uninit(); |
285 | 293 return(1); // error |
485 | 294 } |
295 if (gl_setcontextvga(vid_mode)) { | |
286 | 296 printf("vo_svga: gl_setcontextvga(%d) failed.\n",vid_mode); |
483 | 297 uninit(); |
285 | 298 return(1); // error |
286 | 299 } |
285 | 300 screen = gl_allocatecontext(); |
301 gl_getcontext(screen); | |
485 | 302 if (gl_setcontextvgavirtual(vid_mode)) { |
286 | 303 printf("vo_svga: gl_setcontextvgavirtual(%d) failed.\n",vid_mode); |
483 | 304 uninit(); |
285 | 305 return(1); // error |
286 | 306 } |
285 | 307 virt = gl_allocatecontext(); |
308 gl_getcontext(virt); | |
309 gl_setcontext(virt); | |
310 gl_clearscreen(0); | |
311 | |
485 | 312 if (bpp_conv) { |
483 | 313 bppbuf = malloc(maxw * maxh * BYTESPERPIXEL); |
485 | 314 if (bppbuf == NULL) { |
315 printf("vo_svga: bppbuf -> Not enough memory for buffering!\n"); | |
316 uninit(); | |
317 return (1); | |
318 } | |
483 | 319 } |
320 | |
285 | 321 orig_w = width; |
322 orig_h = height; | |
343 | 323 if ((fullscreen & 0x04) && (WIDTH != orig_w)) { |
483 | 324 if (!widescreen) { |
292 | 325 maxh = HEIGHT; |
326 scaling = maxh / (orig_h * 1.0); | |
327 maxw = (uint32_t) (orig_w * scaling); | |
328 scalebuf = malloc(maxw * maxh * BYTESPERPIXEL); | |
483 | 329 if (scalebuf == NULL) { |
485 | 330 printf("vo_svga: scalebuf -> Not enough memory for buffering!\n"); |
407 | 331 uninit(); |
332 return (1); | |
333 } | |
292 | 334 } else { |
335 maxw = WIDTH; | |
336 scaling = maxw / (orig_w * 1.0); | |
337 maxh = (uint32_t) (orig_h * scaling); | |
338 scalebuf = malloc(maxw * maxh * BYTESPERPIXEL); | |
483 | 339 if (scalebuf == NULL) { |
485 | 340 printf("vo_svga: scalebuf -> Not enough memory for buffering!\n"); |
407 | 341 uninit(); |
342 return (1); | |
343 } | |
292 | 344 } |
285 | 345 } else { |
346 maxw = orig_w; | |
347 maxh = orig_h; | |
348 } | |
349 x_pos = (WIDTH - maxw) / 2; | |
350 y_pos = (HEIGHT - maxh) / 2; | |
351 | |
352 if (pformat == IMGFMT_YV12) { | |
353 yuv2rgb_init(bpp, MODE_RGB); | |
354 yuvbuf = malloc(maxw * maxh * BYTESPERPIXEL); | |
483 | 355 if (yuvbuf == NULL) { |
485 | 356 printf("vo_svga: yuvbuf -> Not enough memory for buffering!\n"); |
407 | 357 uninit(); |
358 return (1); | |
359 } | |
285 | 360 } |
377 | 361 |
504 | 362 printf("vo_svga: SVGAlib resolution: %dx%d %dbpp - ", WIDTH, HEIGHT, bpp); |
293 | 363 if (maxw != orig_w || maxh != orig_h) printf("Video scaled to: %dx%d\n",maxw,maxh); |
285 | 364 else printf("No video scaling\n"); |
365 | |
366 return (0); | |
367 } | |
368 | |
369 static uint32_t query_format(uint32_t format) { | |
485 | 370 uint32_t res = 0; |
407 | 371 |
483 | 372 if (!checked) { |
373 if (checksupportedmodes()) // Looking for available video modes | |
374 return(0); | |
375 } | |
485 | 376 |
377 // if (vo_dbpp) => There is NO conversion!!! | |
378 if (vo_dbpp) { | |
712 | 379 if (format == IMGFMT_YV12) return (1); |
485 | 380 switch (vo_dbpp) { |
488 | 381 case 32: if ((format == IMGFMT_RGB32) || (format == IMGFMT_BGR32)) |
485 | 382 return ((bpp_avail & BPP_32) ? 1 : 0); |
383 break; | |
488 | 384 case 24: if ((format == IMGFMT_RGB24) || (format == IMGFMT_BGR24)) |
485 | 385 return ((bpp_avail & BPP_24) ? 1 : 0); |
386 break; | |
488 | 387 case 16: if ((format == IMGFMT_RGB16) || (format == IMGFMT_BGR16)) |
485 | 388 return ((bpp_avail & BPP_16) ? 1 : 0); |
389 break; | |
488 | 390 case 15: if ((format == IMGFMT_RGB15) || (format == IMGFMT_BGR15)) |
485 | 391 return ((bpp_avail & BPP_15) ? 1 : 0); |
392 break; | |
407 | 393 } |
488 | 394 } else { |
485 | 395 switch (format) { |
396 case IMGFMT_RGB32: | |
488 | 397 case IMGFMT_BGR32: return ((bpp_avail & BPP_32) ? 1 : 0); break; |
485 | 398 case IMGFMT_RGB24: |
488 | 399 case IMGFMT_BGR24: { |
485 | 400 res = (bpp_avail & BPP_24) ? 1 : 0; |
401 if (!res) | |
402 res = (bpp_avail & BPP_32) ? 1 : 0; | |
403 return (res); | |
404 } break; | |
405 case IMGFMT_RGB16: | |
488 | 406 case IMGFMT_BGR16: return ((bpp_avail & BPP_16) ? 1 : 0); break; |
485 | 407 case IMGFMT_RGB15: |
488 | 408 case IMGFMT_BGR15: { |
485 | 409 res = (bpp_avail & BPP_15) ? 1 : 0; |
410 if (!res) | |
411 res = (bpp_avail & BPP_16) ? 1 : 0; | |
412 return (res); | |
413 } break; | |
414 case IMGFMT_YV12: return (1); break; | |
285 | 415 } |
488 | 416 } |
285 | 417 return (0); |
418 } | |
419 | |
420 static const vo_info_t* get_info(void) { | |
421 return (&vo_info); | |
422 } | |
423 | |
424 static void draw_alpha(int x0, int y0, int w, int h, unsigned char *src, | |
425 unsigned char *srca, int stride) { | |
327 | 426 switch (bpp) { |
427 case 32: | |
428 vo_draw_alpha_rgb32(w, h, src, srca, stride, virt->vbuf+4*(y0*WIDTH+x0), 4*WIDTH); | |
429 break; | |
430 case 24: | |
431 vo_draw_alpha_rgb24(w, h, src, srca, stride, virt->vbuf+3*(y0*WIDTH+x0), 3*WIDTH); | |
432 break; | |
433 case 16: | |
434 vo_draw_alpha_rgb16(w, h, src, srca, stride, virt->vbuf+2*(y0*WIDTH+x0), 2*WIDTH); | |
435 break; | |
436 case 15: | |
437 vo_draw_alpha_rgb15(w, h, src, srca, stride, virt->vbuf+2*(y0*WIDTH+x0), 2*WIDTH); | |
438 break; | |
439 } | |
285 | 440 } |
441 | |
442 static uint32_t draw_frame(uint8_t *src[]) { | |
443 if (pformat == IMGFMT_YV12) { | |
444 yuv2rgb(yuvbuf, src[0], src[1], src[2], orig_w, orig_h, orig_w * BYTESPERPIXEL, orig_w, orig_w / 2); | |
445 src[0] = yuvbuf; | |
446 } | |
483 | 447 if (scalebuf != NULL) { |
285 | 448 gl_scalebox(orig_w, orig_h, src[0], maxw, maxh, scalebuf); |
449 src[0] = scalebuf; | |
450 } | |
407 | 451 if (bpp_conv) { |
452 switch(bpp) { | |
485 | 453 case 32: { |
620 | 454 uint8_t *source = src[0]; |
455 uint8_t *dest = bppbuf; | |
456 register uint32_t i = 0; | |
502 | 457 |
620 | 458 while (i < (maxw * maxh * 4)) { |
459 dest[i] = source[i]; | |
460 dest[i+1] = source[i+1]; | |
461 dest[i+2] = source[i+2]; | |
462 dest[i+3] = 0; | |
463 i += 4; | |
407 | 464 } |
485 | 465 } break; |
466 case 16: { | |
407 | 467 #ifdef HAVE_MMX |
468 rgb15to16_mmx(src[0],bppbuf,maxw * maxh * 2); | |
469 #else | |
502 | 470 uint16_t *source = (uint16_t *) src[0]; |
471 uint16_t *dest = (uint16_t *) bppbuf; | |
620 | 472 register uint32_t i = 0; |
407 | 473 register uint16_t srcdata; |
474 | |
620 | 475 while (i < (maxw * maxh)) { |
476 srcdata = source[i]; | |
477 dest[i++] = (srcdata & 0x1f) | ((srcdata & 0x7fe0) << 1); | |
407 | 478 } |
479 #endif | |
485 | 480 } break; |
407 | 481 } |
482 src[0] = bppbuf; | |
483 } | |
285 | 484 gl_putbox(x_pos, y_pos, maxw, maxh, src[0]); |
617 | 485 |
486 return (0); | |
285 | 487 } |
488 | |
489 static uint32_t draw_slice(uint8_t *image[], int stride[], | |
490 int w, int h, int x, int y) { | |
491 uint8_t *src = yuvbuf; | |
377 | 492 uint32_t sw, sh; |
493 | |
875 | 494 yuv2rgb(yuvbuf, image[0], image[1], image[2], w, h, orig_w * BYTESPERPIXEL, stride[0], stride[1]); |
495 //#ifdef HAVE_MMX | |
496 // emms(); | |
497 //#endif | |
377 | 498 sw = (uint32_t) (w * scaling); |
499 sh = (uint32_t) (h * scaling); | |
483 | 500 if (scalebuf != NULL) { |
377 | 501 gl_scalebox(w, h, yuvbuf, sw, sh, scalebuf); |
285 | 502 src = scalebuf; |
503 } | |
377 | 504 gl_putbox((int)(x * scaling) + x_pos, (int)(y * scaling) + y_pos, sw, sh, src); |
617 | 505 |
506 return (0); | |
285 | 507 } |
508 | |
509 static void flip_page(void) { | |
292 | 510 if (y_pos) { |
511 gl_fillbox(0, 0, WIDTH, y_pos, 0); | |
512 gl_fillbox(0, HEIGHT - y_pos, WIDTH, y_pos, 0); | |
513 } else { | |
514 gl_fillbox(0, 0, x_pos, HEIGHT, 0); | |
515 gl_fillbox(WIDTH - x_pos, 0, x_pos, HEIGHT, 0); | |
327 | 516 } |
486 | 517 vo_draw_text(WIDTH, HEIGHT, draw_alpha); |
285 | 518 gl_copyscreen(screen); |
519 } | |
520 | |
521 static void check_events(void) { | |
522 } | |
523 | |
524 static void uninit(void) { | |
483 | 525 vga_modelist_t *list = modelist; |
526 | |
285 | 527 gl_freecontext(screen); |
528 gl_freecontext(virt); | |
529 vga_setmode(TEXT); | |
483 | 530 if (bppbuf != NULL) |
407 | 531 free(bppbuf); |
483 | 532 if (scalebuf != NULL) |
285 | 533 free(scalebuf); |
483 | 534 if (yuvbuf != NULL) |
285 | 535 free(yuvbuf); |
483 | 536 if (modelist != NULL) { |
537 while (modelist->next != NULL) { | |
538 list = modelist; | |
539 while (list->next != NULL) | |
540 list = list->next; | |
541 free(list); | |
542 } | |
543 free(modelist); | |
544 } | |
285 | 545 } |
617 | 546 |