annotate libvo/vo_svga.c @ 8866:f84a5237f914

Remember window layer befor changing it. Works on icemw and fvwm, but not on windowmaker (bug in wmaker...).
author filon
date Thu, 09 Jan 2003 21:23:54 +0000
parents 4c0882ee0f4d
children 13b7ad16f278
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
1 /*
5679
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
2 Video driver for SVGAlib
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
3 by Zoltan Mark Vician <se7en@sch.bme.hu>
381
bbd079aa1614 Date bugfix :)
se7encode
parents: 377
diff changeset
4 Code started: Mon Apr 1 23:25:47 2001
5679
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
5
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
6 Some changes by Matan Ziv-Av <matan@svgalib.org>
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
7 */
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
8
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
9 #include <stdio.h>
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
10 #include <stdlib.h>
7472
c4434bdf6e51 tons of warning fixes, also some 10l bugfixes, including Dominik's PVA bug
arpi
parents: 7124
diff changeset
11 #include <string.h>
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
12
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
13 #include <vga.h>
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
14
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
15 #include <limits.h>
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
16
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
17 #include "config.h"
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
18 #include "video_out.h"
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
19 #include "video_out_internal.h"
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
20
8515
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
21 #ifdef CONFIG_VIDIX
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
22 #include "vosub_vidix.h"
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
23 #endif
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
24
616
41d6eec69b60 clean up
pontscho
parents: 612
diff changeset
25 #include "sub.h"
2556
71934dc06490 Using new stuff of rgb15to16
nick
parents: 1512
diff changeset
26 #include "../postproc/rgb2rgb.h"
616
41d6eec69b60 clean up
pontscho
parents: 612
diff changeset
27
5679
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
28 #include "../mp_msg.h"
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
29 //#include "../mp_image.h"
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
30
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
31 extern int vo_directrendering;
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
32 extern int vo_dbpp;
504
a77e23145686 Some debug information (using verbose) added.
se7encode
parents: 502
diff changeset
33 extern int verbose;
407
0a5b131f1f11 24/15bpp -> 32/16bpp added.
se7encode
parents: 387
diff changeset
34
5679
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
35 static uint32_t query_format(uint32_t format);
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
36 static int checksupportedmodes();
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
37 static void putbox(int x, int y, int w, int h, uint8_t *buf,int prog);
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
38 static void fillbox(int x, int y, int w, int h, uint32_t c);
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
39 static void draw_alpha(int x0, int y0, int w, int h, unsigned char *src,
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
40 unsigned char *srca, int stride);
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
41 static uint32_t get_image(mp_image_t *mpi);
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
42
5679
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
43 static uint8_t *yuvbuf = NULL, *bppbuf = NULL;
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
44 static uint8_t *GRAPH_MEM;
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
45
5679
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
46 static int BYTESPERPIXEL, WIDTH, HEIGHT, LINEWIDTH;
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
47 static int frame, maxframes, oldmethod=0;
8515
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
48 static int directrender;
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
49
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
50 static int force_vm=0;
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
51 static int squarepix=0;
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
52
5679
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
53 static uint32_t pformat;
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
54 static uint32_t orig_w, orig_h, maxw, maxh; // Width, height
5679
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
55 static uint8_t buf0[8192];
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
56 static uint8_t *buffer;
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
57
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
58 typedef struct vga_modelist_s {
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
59 uint16_t modenum;
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
60 vga_modeinfo modeinfo;
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
61 struct vga_modelist_s *next;
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
62 } vga_modelist_t;
447
b3b28a0d9404 All available videomodes support added.
se7encode
parents: 411
diff changeset
63
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
64 vga_modelist_t *modelist = NULL;
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
65
327
e7731f5c76cc OSD renderers for all modes added.
se7encode
parents: 293
diff changeset
66 static uint8_t bpp;
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
67 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
68 static uint32_t pformat;
447
b3b28a0d9404 All available videomodes support added.
se7encode
parents: 411
diff changeset
69
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
70 #define BPP_15 1
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
71 #define BPP_16 2
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
72 #define BPP_24 4
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
73 #define BPP_32 8
6451
ed906af317da 8bpp support (no dithering yet, use -vop noise for now)
michael
parents: 6052
diff changeset
74 #define BPP_8 16
ed906af317da 8bpp support (no dithering yet, use -vop noise for now)
michael
parents: 6052
diff changeset
75 #define BPP_4 32
6453
7f06ef0d58a6 8bpp bugfixes (brightness, contrast ...)
michael
parents: 6451
diff changeset
76 #define BPP_1 64
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
77 static uint8_t bpp_avail = 0;
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
78
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
79 static uint8_t checked = 0;
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
80
5679
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
81 static uint32_t x_pos, y_pos;
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
82
8148
5b39e79af5fe removed get_info, using the same sheme as in libmpcodecs instead
alex
parents: 7691
diff changeset
83 static vo_info_t info = {
5679
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
84 "SVGAlib",
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
85 "svga",
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
86 "Zoltan Mark Vician <se7en@sch.bme.hu>",
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
87 ""
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
88 };
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
89
8515
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
90 #ifdef CONFIG_VIDIX
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
91 static char vidix_name[32] = "";
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
92 #endif
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
93
8148
5b39e79af5fe removed get_info, using the same sheme as in libmpcodecs instead
alex
parents: 7691
diff changeset
94 LIBVO_EXTERN(svga)
5b39e79af5fe removed get_info, using the same sheme as in libmpcodecs instead
alex
parents: 7691
diff changeset
95
5679
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
96 static uint32_t preinit(const char *arg)
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
97 {
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
98 int i;
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
99
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
100 for(i=0;i<8192;i++) buf0[i]=0;
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
101
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
102 if(vo_directrendering) {
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
103 maxframes=0;
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
104 } else {
5679
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
105 maxframes=1;
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
106 }
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
107
8515
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
108 if(arg)while(*arg) {
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
109 if(!strncmp(arg,"old",3)) {
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
110 oldmethod=1;
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
111 arg+=3;
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
112 if( *arg == ':' ) arg++;
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
113 }
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
114
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
115 #ifdef CONFIG_VIDIX
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
116 if(memcmp(arg,"vidix",5)==0) {
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
117 int i;
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
118 i=6;
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
119 while(arg[i] && arg[i]!=':') i++;
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
120 strncpy(vidix_name, arg+6, i-6);
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
121 vidix_name[i-5]=0;
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
122 if(arg[i]==':')i++;
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
123 arg+=i;
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
124 vidix_preinit(vidix_name, &video_out_svga);
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
125 }
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
126 #endif
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
127 if(!strncmp(arg,"sq",2)) {
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
128 squarepix=1;
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
129 arg+=2;
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
130 if( *arg == ':' ) arg++;
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
131 }
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
132
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
133 if(*arg) {
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
134 int i;
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
135 char s[64];
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
136 printf("arg is %s\n",arg);
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
137 i=0;
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
138 while(arg[i] && arg[i]!=':')i++;
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
139 strncpy(s, arg, i);
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
140 s[i]=0;
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
141 arg+=i;
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
142 if(*arg==':')arg++;
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
143 printf("i=%i new arg is %s\n",i, arg);
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
144 i=vga_getmodenumber(s);
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
145 if(i>0) {
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
146 force_vm = i;
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
147 if(verbose)printf("vo_svga: Forcing mode %i\n",force_vm);
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
148 }
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
149 }
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
150 }
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
151
7675
f78dc7d40730 mode check at preinit()
arpi
parents: 7558
diff changeset
152 if (!checked) {
f78dc7d40730 mode check at preinit()
arpi
parents: 7558
diff changeset
153 if (checksupportedmodes()) // Looking for available video modes
f78dc7d40730 mode check at preinit()
arpi
parents: 7558
diff changeset
154 return(1);
f78dc7d40730 mode check at preinit()
arpi
parents: 7558
diff changeset
155 }
f78dc7d40730 mode check at preinit()
arpi
parents: 7558
diff changeset
156
5679
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
157 return 0;
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
158 }
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
159
5679
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
160 static uint32_t control(uint32_t request, void *data, ...)
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
161 {
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
162 switch (request) {
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
163 case VOCTRL_QUERY_FORMAT:
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
164 return query_format(*((uint32_t*)data));
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
165 case VOCTRL_GET_IMAGE:
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
166 return get_image(data);
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
167 }
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
168 return VO_NOTIMPL;
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
169 }
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
170
4433
df8e0f71cc3c new info for tuning
nick
parents: 4352
diff changeset
171 static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width,
8515
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
172 uint32_t d_height, uint32_t flags, char *title,
7124
eca7dbad0166 finally removed query_vaa, bes_da and vo_tune_info - the obsoleted libvo api
alex
parents: 6579
diff changeset
173 uint32_t format) {
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
174 uint32_t req_w = (d_width > 0 ? d_width : width);
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
175 uint32_t req_h = (d_height > 0 ? d_height : height);
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
176 uint16_t vid_mode = 0;
976
90408bd383a5 Scaling bug fixed.
se7encode
parents: 875
diff changeset
177 uint8_t res_widescr, vid_widescr = (((req_w*1.0)/req_h) > (4.0/3)) ? 1 : 0;
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
178 uint16_t buf_w = USHRT_MAX, buf_h = USHRT_MAX;
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
179 vga_modelist_t *list = modelist;
5679
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
180
8515
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
181 if(verbose)
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
182 printf("vo_svga: config(%i, %i, %i, %i, %08x, %s, %08x)\n", width, height,
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
183 d_width, d_height, flags, title, format);
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
184
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
185 bpp_avail = 0;
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
186 while (list != NULL) {
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
187 if ((list->modeinfo.width >= req_w) && (list->modeinfo.height >= req_h)) {
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
188 switch (list->modeinfo.colors) {
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
189 case 32768: bpp_avail |= BPP_15; break;
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
190 case 65536: bpp_avail |= BPP_16; break;
6451
ed906af317da 8bpp support (no dithering yet, use -vop noise for now)
michael
parents: 6052
diff changeset
191 case 256 : bpp_avail |= BPP_8; break;
ed906af317da 8bpp support (no dithering yet, use -vop noise for now)
michael
parents: 6052
diff changeset
192 case 16 : bpp_avail |= BPP_4; break;
6453
7f06ef0d58a6 8bpp bugfixes (brightness, contrast ...)
michael
parents: 6451
diff changeset
193 case 2 : bpp_avail |= BPP_1; break;
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
194 }
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
195 switch (list->modeinfo.bytesperpixel) {
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
196 case 3: bpp_avail |= BPP_24; break;
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
197 case 4: bpp_avail |= BPP_32; break;
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
198 }
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
199 }
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
200 list = list->next;
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
201 }
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
202
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
203 pformat = format;
411
53203545daa7 -bpp added.
se7encode
parents: 407
diff changeset
204
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
205 // bpp check
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
206 bpp_conv = 0;
411
53203545daa7 -bpp added.
se7encode
parents: 407
diff changeset
207 if (!vo_dbpp) {
8515
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
208 if (!IMGFMT_IS_RGB(format) && !IMGFMT_IS_BGR(format)) bpp = 32;
411
53203545daa7 -bpp added.
se7encode
parents: 407
diff changeset
209 else bpp = format & 255;
504
a77e23145686 Some debug information (using verbose) added.
se7encode
parents: 502
diff changeset
210 if (verbose)
a77e23145686 Some debug information (using verbose) added.
se7encode
parents: 502
diff changeset
211 printf("vo_svga: vo_dbpp == 0, bpp: %d\n",bpp);
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
212 switch (bpp) {
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
213 case 32: if (!(bpp_avail & BPP_32)) {
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
214 printf("vo_svga: Haven't found video mode which fit to: %dx%d %dbpp\n",req_w,req_h,bpp);
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
215 printf("vo_svga: Maybe you should try -bpp\n");
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
216 return(1);
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
217 }
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
218 break;
619
99a716d8cac8 -Wall warnings fixed.
se7encode
parents: 617
diff changeset
219 case 24: if (!(bpp_avail & BPP_24)) {
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
220 if (!(bpp_avail & BPP_32)) {
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
221 printf("vo_svga: Haven't found video mode which fit to: %dx%d %dbpp\n",req_w,req_h,bpp);
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
222 printf("vo_svga: Maybe you should try -bpp\n");
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
223 return(1);
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
224 } else {
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
225 bpp = 32;
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
226 bpp_conv = 1;
617
33b559940fb4 *** empty log message ***
se7encode
parents: 616
diff changeset
227 printf("vo_svga: BPP conversion 24->32\n");
619
99a716d8cac8 -Wall warnings fixed.
se7encode
parents: 617
diff changeset
228 }
99a716d8cac8 -Wall warnings fixed.
se7encode
parents: 617
diff changeset
229 }
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
230 break;
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
231 case 16: if (!(bpp_avail & BPP_16)) {
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
232 printf("vo_svga: Haven't found video mode which fit to: %dx%d %dbpp\n",req_w,req_h,bpp);
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
233 printf("vo_svga: Maybe you should try -bpp\n");
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
234 return(1);
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
235 }
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
236 break;
619
99a716d8cac8 -Wall warnings fixed.
se7encode
parents: 617
diff changeset
237 case 15: if (!(bpp_avail & BPP_15)) {
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
238 if (!(bpp_avail & BPP_16)) {
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
239 printf("vo_svga: Haven't found video mode which fit to: %dx%d %dbpp\n",req_w,req_h,bpp);
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
240 printf("vo_svga: Maybe you should try -bpp\n");
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
241 return(1);
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
242 } else {
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
243 bpp = 16;
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
244 bpp_conv = 1;
617
33b559940fb4 *** empty log message ***
se7encode
parents: 616
diff changeset
245 printf("vo_svga: BPP conversion 15->16\n");
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
246 }
619
99a716d8cac8 -Wall warnings fixed.
se7encode
parents: 617
diff changeset
247 }
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
248 break;
6451
ed906af317da 8bpp support (no dithering yet, use -vop noise for now)
michael
parents: 6052
diff changeset
249 case 8: if (!(bpp_avail & BPP_8)) {
ed906af317da 8bpp support (no dithering yet, use -vop noise for now)
michael
parents: 6052
diff changeset
250 printf("vo_svga: Haven't found video mode which fit to: %dx%d %dbpp\n",req_w,req_h,bpp);
ed906af317da 8bpp support (no dithering yet, use -vop noise for now)
michael
parents: 6052
diff changeset
251 printf("vo_svga: Maybe you should try -bpp\n");
ed906af317da 8bpp support (no dithering yet, use -vop noise for now)
michael
parents: 6052
diff changeset
252 return(1);
ed906af317da 8bpp support (no dithering yet, use -vop noise for now)
michael
parents: 6052
diff changeset
253 }
ed906af317da 8bpp support (no dithering yet, use -vop noise for now)
michael
parents: 6052
diff changeset
254 break;
6453
7f06ef0d58a6 8bpp bugfixes (brightness, contrast ...)
michael
parents: 6451
diff changeset
255 case 4: if (!(bpp_avail & BPP_4)) {
7f06ef0d58a6 8bpp bugfixes (brightness, contrast ...)
michael
parents: 6451
diff changeset
256 printf("vo_svga: Haven't found video mode which fit to: %dx%d %dbpp\n",req_w,req_h,bpp);
7f06ef0d58a6 8bpp bugfixes (brightness, contrast ...)
michael
parents: 6451
diff changeset
257 printf("vo_svga: Maybe you should try -bpp\n");
7f06ef0d58a6 8bpp bugfixes (brightness, contrast ...)
michael
parents: 6451
diff changeset
258 return(1);
7f06ef0d58a6 8bpp bugfixes (brightness, contrast ...)
michael
parents: 6451
diff changeset
259 }
7f06ef0d58a6 8bpp bugfixes (brightness, contrast ...)
michael
parents: 6451
diff changeset
260 break;
7f06ef0d58a6 8bpp bugfixes (brightness, contrast ...)
michael
parents: 6451
diff changeset
261 case 1: if (!(bpp_avail & BPP_1)) {
7f06ef0d58a6 8bpp bugfixes (brightness, contrast ...)
michael
parents: 6451
diff changeset
262 printf("vo_svga: Haven't found video mode which fit to: %dx%d %dbpp\n",req_w,req_h,bpp);
7f06ef0d58a6 8bpp bugfixes (brightness, contrast ...)
michael
parents: 6451
diff changeset
263 printf("vo_svga: Maybe you should try -bpp\n");
7f06ef0d58a6 8bpp bugfixes (brightness, contrast ...)
michael
parents: 6451
diff changeset
264 return(1);
7f06ef0d58a6 8bpp bugfixes (brightness, contrast ...)
michael
parents: 6451
diff changeset
265 }
7f06ef0d58a6 8bpp bugfixes (brightness, contrast ...)
michael
parents: 6451
diff changeset
266 break;
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
267 }
411
53203545daa7 -bpp added.
se7encode
parents: 407
diff changeset
268 } else {
53203545daa7 -bpp added.
se7encode
parents: 407
diff changeset
269 bpp = vo_dbpp;
504
a77e23145686 Some debug information (using verbose) added.
se7encode
parents: 502
diff changeset
270 if (verbose)
a77e23145686 Some debug information (using verbose) added.
se7encode
parents: 502
diff changeset
271 printf("vo_svga: vo_dbpp == %d\n",bpp);
411
53203545daa7 -bpp added.
se7encode
parents: 407
diff changeset
272 switch (bpp) {
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
273 case 32: if (!(bpp_avail & BPP_32)) {
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
274 printf("vo_svga: %dbpp not supported in %dx%d (or larger resoltuion) by HW or SVGAlib\n",bpp,req_w,req_h);
411
53203545daa7 -bpp added.
se7encode
parents: 407
diff changeset
275 return(1);
53203545daa7 -bpp added.
se7encode
parents: 407
diff changeset
276 }
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
277 break;
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
278 case 24: if (!(bpp_avail & BPP_24)) {
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
279 printf("vo_svga: %dbpp not supported in %dx%d (or larger resoltuion) by HW or SVGAlib\n",bpp,req_w,req_h);
411
53203545daa7 -bpp added.
se7encode
parents: 407
diff changeset
280 return(1);
53203545daa7 -bpp added.
se7encode
parents: 407
diff changeset
281 }
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
282 break;
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
283 case 16: if (!(bpp_avail & BPP_16)) {
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
284 printf("vo_svga: %dbpp not supported in %dx%d (or larger resoltuion) by HW or SVGAlib\n",bpp,req_w,req_h);
411
53203545daa7 -bpp added.
se7encode
parents: 407
diff changeset
285 return(1);
53203545daa7 -bpp added.
se7encode
parents: 407
diff changeset
286 }
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
287 break;
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
288 case 15: if (!(bpp_avail & BPP_15)) {
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
289 printf("vo_svga: %dbpp not supported in %dx%d (or larger resoltuion) by HW or SVGAlib\n",bpp,req_w,req_h);
411
53203545daa7 -bpp added.
se7encode
parents: 407
diff changeset
290 return(1);
53203545daa7 -bpp added.
se7encode
parents: 407
diff changeset
291 }
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
292 break;
6451
ed906af317da 8bpp support (no dithering yet, use -vop noise for now)
michael
parents: 6052
diff changeset
293 case 8: if (!(bpp_avail & BPP_8)) {
ed906af317da 8bpp support (no dithering yet, use -vop noise for now)
michael
parents: 6052
diff changeset
294 printf("vo_svga: %dbpp not supported in %dx%d (or larger resoltuion) by HW or SVGAlib\n",bpp,req_w,req_h);
ed906af317da 8bpp support (no dithering yet, use -vop noise for now)
michael
parents: 6052
diff changeset
295 return(1);
ed906af317da 8bpp support (no dithering yet, use -vop noise for now)
michael
parents: 6052
diff changeset
296 }
ed906af317da 8bpp support (no dithering yet, use -vop noise for now)
michael
parents: 6052
diff changeset
297 break;
6453
7f06ef0d58a6 8bpp bugfixes (brightness, contrast ...)
michael
parents: 6451
diff changeset
298 case 4: if (!(bpp_avail & BPP_4)) {
7f06ef0d58a6 8bpp bugfixes (brightness, contrast ...)
michael
parents: 6451
diff changeset
299 printf("vo_svga: %dbpp not supported in %dx%d (or larger resoltuion) by HW or SVGAlib\n",bpp,req_w,req_h);
7f06ef0d58a6 8bpp bugfixes (brightness, contrast ...)
michael
parents: 6451
diff changeset
300 return(1);
7f06ef0d58a6 8bpp bugfixes (brightness, contrast ...)
michael
parents: 6451
diff changeset
301 }
7f06ef0d58a6 8bpp bugfixes (brightness, contrast ...)
michael
parents: 6451
diff changeset
302 break;
7f06ef0d58a6 8bpp bugfixes (brightness, contrast ...)
michael
parents: 6451
diff changeset
303 case 1: if (!(bpp_avail & BPP_1)) {
7f06ef0d58a6 8bpp bugfixes (brightness, contrast ...)
michael
parents: 6451
diff changeset
304 printf("vo_svga: %dbpp not supported in %dx%d (or larger resoltuion) by HW or SVGAlib\n",bpp,req_w,req_h);
7f06ef0d58a6 8bpp bugfixes (brightness, contrast ...)
michael
parents: 6451
diff changeset
305 return(1);
7f06ef0d58a6 8bpp bugfixes (brightness, contrast ...)
michael
parents: 6451
diff changeset
306 }
7f06ef0d58a6 8bpp bugfixes (brightness, contrast ...)
michael
parents: 6451
diff changeset
307 break;
411
53203545daa7 -bpp added.
se7encode
parents: 407
diff changeset
308 }
53203545daa7 -bpp added.
se7encode
parents: 407
diff changeset
309 }
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
310
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
311 list = modelist;
504
a77e23145686 Some debug information (using verbose) added.
se7encode
parents: 502
diff changeset
312 if (verbose) {
a77e23145686 Some debug information (using verbose) added.
se7encode
parents: 502
diff changeset
313 printf("vo_svga: Looking for the best resolution...\n");
a77e23145686 Some debug information (using verbose) added.
se7encode
parents: 502
diff changeset
314 printf("vo_svga: req_w: %d, req_h: %d, bpp: %d\n",req_w,req_h,bpp);
a77e23145686 Some debug information (using verbose) added.
se7encode
parents: 502
diff changeset
315 }
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
316 while (list != NULL) {
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
317 if ((list->modeinfo.width >= req_w) && (list->modeinfo.height >= req_h)) {
504
a77e23145686 Some debug information (using verbose) added.
se7encode
parents: 502
diff changeset
318 if (verbose) {
a77e23145686 Some debug information (using verbose) added.
se7encode
parents: 502
diff changeset
319 switch (list->modeinfo.colors) {
6453
7f06ef0d58a6 8bpp bugfixes (brightness, contrast ...)
michael
parents: 6451
diff changeset
320 case 2 : printf("vo_svga: vid_mode: %d, %dx%d 1bpp\n",
7f06ef0d58a6 8bpp bugfixes (brightness, contrast ...)
michael
parents: 6451
diff changeset
321 list->modenum,list->modeinfo.width,list->modeinfo.height);
7f06ef0d58a6 8bpp bugfixes (brightness, contrast ...)
michael
parents: 6451
diff changeset
322 break;
7f06ef0d58a6 8bpp bugfixes (brightness, contrast ...)
michael
parents: 6451
diff changeset
323 case 16 : printf("vo_svga: vid_mode: %d, %dx%d 4bpp\n",
7f06ef0d58a6 8bpp bugfixes (brightness, contrast ...)
michael
parents: 6451
diff changeset
324 list->modenum,list->modeinfo.width,list->modeinfo.height);
7f06ef0d58a6 8bpp bugfixes (brightness, contrast ...)
michael
parents: 6451
diff changeset
325 break;
6451
ed906af317da 8bpp support (no dithering yet, use -vop noise for now)
michael
parents: 6052
diff changeset
326 case 256 : printf("vo_svga: vid_mode: %d, %dx%d 8bpp\n",
ed906af317da 8bpp support (no dithering yet, use -vop noise for now)
michael
parents: 6052
diff changeset
327 list->modenum,list->modeinfo.width,list->modeinfo.height);
ed906af317da 8bpp support (no dithering yet, use -vop noise for now)
michael
parents: 6052
diff changeset
328 break;
5679
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
329 case 32768: printf("vo_svga: vid_mode: %d, %dx%d 15bpp\n",
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
330 list->modenum,list->modeinfo.width,list->modeinfo.height);
504
a77e23145686 Some debug information (using verbose) added.
se7encode
parents: 502
diff changeset
331 break;
5679
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
332 case 65536: printf("vo_svga: vid_mode: %d, %dx%d 16bpp\n",
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
333 list->modenum,list->modeinfo.width,list->modeinfo.height);
504
a77e23145686 Some debug information (using verbose) added.
se7encode
parents: 502
diff changeset
334 break;
a77e23145686 Some debug information (using verbose) added.
se7encode
parents: 502
diff changeset
335 }
a77e23145686 Some debug information (using verbose) added.
se7encode
parents: 502
diff changeset
336 switch (list->modeinfo.bytesperpixel) {
5679
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
337 case 3: printf("vo_svga: vid_mode: %d, %dx%d 24bpp\n",
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
338 list->modenum,list->modeinfo.width,list->modeinfo.height);
504
a77e23145686 Some debug information (using verbose) added.
se7encode
parents: 502
diff changeset
339 break;
5679
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
340 case 4: printf("vo_svga: vid_mode: %d, %dx%d 32bpp\n",
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
341 list->modenum,list->modeinfo.width,list->modeinfo.height);
504
a77e23145686 Some debug information (using verbose) added.
se7encode
parents: 502
diff changeset
342 break;
a77e23145686 Some debug information (using verbose) added.
se7encode
parents: 502
diff changeset
343 }
a77e23145686 Some debug information (using verbose) added.
se7encode
parents: 502
diff changeset
344 }
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
345 switch (bpp) {
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
346 case 32: if (list->modeinfo.bytesperpixel == 4)
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
347 if ((list->modeinfo.width < buf_w) || (list->modeinfo.height < buf_h)) {
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
348 vid_mode = list->modenum;
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
349 buf_w = list->modeinfo.width;
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
350 buf_h = list->modeinfo.height;
976
90408bd383a5 Scaling bug fixed.
se7encode
parents: 875
diff changeset
351 res_widescr = (((buf_w*1.0)/buf_h) > (4.0/3)) ? 1 : 0;
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
352 }
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
353 break;
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
354 case 24: if (list->modeinfo.bytesperpixel == 3)
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
355 if ((list->modeinfo.width < buf_w) || (list->modeinfo.height < buf_h)) {
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
356 vid_mode = list->modenum;
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
357 buf_w = list->modeinfo.width;
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
358 buf_h = list->modeinfo.height;
976
90408bd383a5 Scaling bug fixed.
se7encode
parents: 875
diff changeset
359 res_widescr = (((buf_w*1.0)/buf_h) > (4.0/3)) ? 1 : 0;
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
360 }
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
361 break;
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
362 case 16: if (list->modeinfo.colors == 65536)
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
363 if ((list->modeinfo.width < buf_w) || (list->modeinfo.height < buf_h)) {
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
364 vid_mode = list->modenum;
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
365 buf_w = list->modeinfo.width;
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
366 buf_h = list->modeinfo.height;
976
90408bd383a5 Scaling bug fixed.
se7encode
parents: 875
diff changeset
367 res_widescr = (((buf_w*1.0)/buf_h) > (4.0/3)) ? 1 : 0;
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
368 }
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
369 break;
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
370 case 15: if (list->modeinfo.colors == 32768)
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
371 if ((list->modeinfo.width < buf_w) || (list->modeinfo.height < buf_h)) {
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
372 vid_mode = list->modenum;
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
373 buf_w = list->modeinfo.width;
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
374 buf_h = list->modeinfo.height;
976
90408bd383a5 Scaling bug fixed.
se7encode
parents: 875
diff changeset
375 res_widescr = (((buf_w*1.0)/buf_h) > (4.0/3)) ? 1 : 0;
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
376 }
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
377 break;
6451
ed906af317da 8bpp support (no dithering yet, use -vop noise for now)
michael
parents: 6052
diff changeset
378 case 8: if (list->modeinfo.colors == 256)
ed906af317da 8bpp support (no dithering yet, use -vop noise for now)
michael
parents: 6052
diff changeset
379 if ((list->modeinfo.width < buf_w) || (list->modeinfo.height < buf_h)) {
ed906af317da 8bpp support (no dithering yet, use -vop noise for now)
michael
parents: 6052
diff changeset
380 vid_mode = list->modenum;
ed906af317da 8bpp support (no dithering yet, use -vop noise for now)
michael
parents: 6052
diff changeset
381 buf_w = list->modeinfo.width;
ed906af317da 8bpp support (no dithering yet, use -vop noise for now)
michael
parents: 6052
diff changeset
382 buf_h = list->modeinfo.height;
ed906af317da 8bpp support (no dithering yet, use -vop noise for now)
michael
parents: 6052
diff changeset
383 res_widescr = (((buf_w*1.0)/buf_h) > (4.0/3)) ? 1 : 0;
ed906af317da 8bpp support (no dithering yet, use -vop noise for now)
michael
parents: 6052
diff changeset
384 }
ed906af317da 8bpp support (no dithering yet, use -vop noise for now)
michael
parents: 6052
diff changeset
385 break;
6453
7f06ef0d58a6 8bpp bugfixes (brightness, contrast ...)
michael
parents: 6451
diff changeset
386 case 4: if (list->modeinfo.colors ==16)
7f06ef0d58a6 8bpp bugfixes (brightness, contrast ...)
michael
parents: 6451
diff changeset
387 if ((list->modeinfo.width < buf_w) || (list->modeinfo.height < buf_h)) {
7f06ef0d58a6 8bpp bugfixes (brightness, contrast ...)
michael
parents: 6451
diff changeset
388 vid_mode = list->modenum;
7f06ef0d58a6 8bpp bugfixes (brightness, contrast ...)
michael
parents: 6451
diff changeset
389 buf_w = list->modeinfo.width;
7f06ef0d58a6 8bpp bugfixes (brightness, contrast ...)
michael
parents: 6451
diff changeset
390 buf_h = list->modeinfo.height;
7f06ef0d58a6 8bpp bugfixes (brightness, contrast ...)
michael
parents: 6451
diff changeset
391 res_widescr = (((buf_w*1.0)/buf_h) > (4.0/3)) ? 1 : 0;
7f06ef0d58a6 8bpp bugfixes (brightness, contrast ...)
michael
parents: 6451
diff changeset
392 }
7f06ef0d58a6 8bpp bugfixes (brightness, contrast ...)
michael
parents: 6451
diff changeset
393 break;
7f06ef0d58a6 8bpp bugfixes (brightness, contrast ...)
michael
parents: 6451
diff changeset
394 case 1: if (list->modeinfo.colors == 2)
7f06ef0d58a6 8bpp bugfixes (brightness, contrast ...)
michael
parents: 6451
diff changeset
395 if ((list->modeinfo.width < buf_w) || (list->modeinfo.height < buf_h)) {
7f06ef0d58a6 8bpp bugfixes (brightness, contrast ...)
michael
parents: 6451
diff changeset
396 vid_mode = list->modenum;
7f06ef0d58a6 8bpp bugfixes (brightness, contrast ...)
michael
parents: 6451
diff changeset
397 buf_w = list->modeinfo.width;
7f06ef0d58a6 8bpp bugfixes (brightness, contrast ...)
michael
parents: 6451
diff changeset
398 buf_h = list->modeinfo.height;
7f06ef0d58a6 8bpp bugfixes (brightness, contrast ...)
michael
parents: 6451
diff changeset
399 res_widescr = (((buf_w*1.0)/buf_h) > (4.0/3)) ? 1 : 0;
7f06ef0d58a6 8bpp bugfixes (brightness, contrast ...)
michael
parents: 6451
diff changeset
400 }
7f06ef0d58a6 8bpp bugfixes (brightness, contrast ...)
michael
parents: 6451
diff changeset
401 break;
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
402 }
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
403 }
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
404 list = list->next;
407
0a5b131f1f11 24/15bpp -> 32/16bpp added.
se7encode
parents: 387
diff changeset
405 }
6451
ed906af317da 8bpp support (no dithering yet, use -vop noise for now)
michael
parents: 6052
diff changeset
406
8515
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
407 if(force_vm) {
2982
32638add0dc8 mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents: 2732
diff changeset
408 list=modelist;
32638add0dc8 mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents: 2732
diff changeset
409 while(list) {
8515
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
410 if(list->modenum == force_vm) {
2982
32638add0dc8 mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents: 2732
diff changeset
411 buf_w = list->modeinfo.width;
32638add0dc8 mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents: 2732
diff changeset
412 buf_h = list->modeinfo.height;
32638add0dc8 mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents: 2732
diff changeset
413 res_widescr = (((buf_w*1.0)/buf_h) > (4.0/3)) ? 1 : 0;
32638add0dc8 mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents: 2732
diff changeset
414 switch(list->modeinfo.colors) {
6453
7f06ef0d58a6 8bpp bugfixes (brightness, contrast ...)
michael
parents: 6451
diff changeset
415 case 2:
7f06ef0d58a6 8bpp bugfixes (brightness, contrast ...)
michael
parents: 6451
diff changeset
416 bpp=1;
7f06ef0d58a6 8bpp bugfixes (brightness, contrast ...)
michael
parents: 6451
diff changeset
417 bpp_conv=0;
7f06ef0d58a6 8bpp bugfixes (brightness, contrast ...)
michael
parents: 6451
diff changeset
418 break;
7f06ef0d58a6 8bpp bugfixes (brightness, contrast ...)
michael
parents: 6451
diff changeset
419 case 16:
7f06ef0d58a6 8bpp bugfixes (brightness, contrast ...)
michael
parents: 6451
diff changeset
420 bpp=4;
7f06ef0d58a6 8bpp bugfixes (brightness, contrast ...)
michael
parents: 6451
diff changeset
421 bpp_conv=0;
7f06ef0d58a6 8bpp bugfixes (brightness, contrast ...)
michael
parents: 6451
diff changeset
422 break;
6451
ed906af317da 8bpp support (no dithering yet, use -vop noise for now)
michael
parents: 6052
diff changeset
423 case 256:
ed906af317da 8bpp support (no dithering yet, use -vop noise for now)
michael
parents: 6052
diff changeset
424 bpp=8;
ed906af317da 8bpp support (no dithering yet, use -vop noise for now)
michael
parents: 6052
diff changeset
425 bpp_conv=0;
ed906af317da 8bpp support (no dithering yet, use -vop noise for now)
michael
parents: 6052
diff changeset
426 break;
2982
32638add0dc8 mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents: 2732
diff changeset
427 case 32768:
32638add0dc8 mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents: 2732
diff changeset
428 bpp=16;
32638add0dc8 mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents: 2732
diff changeset
429 bpp_conv=1;
32638add0dc8 mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents: 2732
diff changeset
430 break;
32638add0dc8 mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents: 2732
diff changeset
431 case 65536:
32638add0dc8 mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents: 2732
diff changeset
432 bpp=16;
32638add0dc8 mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents: 2732
diff changeset
433 bpp_conv=0;
32638add0dc8 mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents: 2732
diff changeset
434 break;
32638add0dc8 mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents: 2732
diff changeset
435 case (1<<24):
32638add0dc8 mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents: 2732
diff changeset
436 if(list->modeinfo.bytesperpixel == 3) {
32638add0dc8 mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents: 2732
diff changeset
437 bpp=32;
32638add0dc8 mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents: 2732
diff changeset
438 bpp_conv=1;
32638add0dc8 mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents: 2732
diff changeset
439 } else {
32638add0dc8 mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents: 2732
diff changeset
440 bpp=32;
32638add0dc8 mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents: 2732
diff changeset
441 bpp_conv=0;
32638add0dc8 mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents: 2732
diff changeset
442 }
32638add0dc8 mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents: 2732
diff changeset
443 break;
32638add0dc8 mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents: 2732
diff changeset
444 }
8515
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
445 vid_mode=force_vm;
2982
32638add0dc8 mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents: 2732
diff changeset
446 list=NULL;
32638add0dc8 mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents: 2732
diff changeset
447 } else list=list->next;
32638add0dc8 mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents: 2732
diff changeset
448 }
32638add0dc8 mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents: 2732
diff changeset
449 }
32638add0dc8 mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents: 2732
diff changeset
450
8515
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
451
504
a77e23145686 Some debug information (using verbose) added.
se7encode
parents: 502
diff changeset
452 if (verbose)
a77e23145686 Some debug information (using verbose) added.
se7encode
parents: 502
diff changeset
453 printf("vo_svga: vid_mode: %d\n",vid_mode);
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
454 if (vga_setmode(vid_mode) == -1) {
286
b2f3f2ab3787 integrated vo_svga by se7en
arpi_esp
parents: 285
diff changeset
455 printf("vo_svga: vga_setmode(%d) failed.\n",vid_mode);
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
456 uninit();
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
457 return(1); // error
6451
ed906af317da 8bpp support (no dithering yet, use -vop noise for now)
michael
parents: 6052
diff changeset
458 }
ed906af317da 8bpp support (no dithering yet, use -vop noise for now)
michael
parents: 6052
diff changeset
459
ed906af317da 8bpp support (no dithering yet, use -vop noise for now)
michael
parents: 6052
diff changeset
460 /* set 332 palette for 8 bpp */
ed906af317da 8bpp support (no dithering yet, use -vop noise for now)
michael
parents: 6052
diff changeset
461 if(bpp==8){
ed906af317da 8bpp support (no dithering yet, use -vop noise for now)
michael
parents: 6052
diff changeset
462 int i;
ed906af317da 8bpp support (no dithering yet, use -vop noise for now)
michael
parents: 6052
diff changeset
463 for(i=0; i<256; i++)
6453
7f06ef0d58a6 8bpp bugfixes (brightness, contrast ...)
michael
parents: 6451
diff changeset
464 vga_setpalette(i, ((i>>5)&7)*9, ((i>>2)&7)*9, (i&3)*21);
7f06ef0d58a6 8bpp bugfixes (brightness, contrast ...)
michael
parents: 6451
diff changeset
465 }
7f06ef0d58a6 8bpp bugfixes (brightness, contrast ...)
michael
parents: 6451
diff changeset
466 /* set 121 palette for 4 bpp */
7f06ef0d58a6 8bpp bugfixes (brightness, contrast ...)
michael
parents: 6451
diff changeset
467 else if(bpp==4){
7f06ef0d58a6 8bpp bugfixes (brightness, contrast ...)
michael
parents: 6451
diff changeset
468 int i;
7f06ef0d58a6 8bpp bugfixes (brightness, contrast ...)
michael
parents: 6451
diff changeset
469 for(i=0; i<16; i++)
7f06ef0d58a6 8bpp bugfixes (brightness, contrast ...)
michael
parents: 6451
diff changeset
470 vga_setpalette(i, ((i>>3)&1)*63, ((i>>1)&3)*21, (i&1)*63);
6451
ed906af317da 8bpp support (no dithering yet, use -vop noise for now)
michael
parents: 6052
diff changeset
471 }
5679
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
472
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
473 WIDTH=vga_getxdim();
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
474 HEIGHT=vga_getydim();
6453
7f06ef0d58a6 8bpp bugfixes (brightness, contrast ...)
michael
parents: 6451
diff changeset
475 BYTESPERPIXEL=(bpp+4)>>3;
6456
f0b64210ce97 1bpp support
michael
parents: 6453
diff changeset
476 if(bpp==1)
f0b64210ce97 1bpp support
michael
parents: 6453
diff changeset
477 LINEWIDTH=(WIDTH+7)/8;
f0b64210ce97 1bpp support
michael
parents: 6453
diff changeset
478 else
8515
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
479 LINEWIDTH=vga_getmodeinfo(vid_mode)->linewidth;
6456
f0b64210ce97 1bpp support
michael
parents: 6453
diff changeset
480
8673
4c0882ee0f4d vga_draw* functions don't support linear memory for 'most' video cards
iive
parents: 8520
diff changeset
481 // vga_setlinearaddressing(); //it is not compatable with vga_draw* for "some" cards
5679
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
482 if(oldmethod) {
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
483 buffer=malloc(HEIGHT*LINEWIDTH);
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
484 maxframes=0;
8515
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
485 } else if ((vga_getmodeinfo(vid_mode)->flags&IS_LINEAR)) {
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
486 directrender=1;
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
487 if(verbose) printf("vo_svga: Using direct rendering to linear video ram.\n");
286
b2f3f2ab3787 integrated vo_svga by se7en
arpi_esp
parents: 285
diff changeset
488 }
8515
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
489
5679
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
490 vga_claimvideomemory((maxframes+1)*HEIGHT*LINEWIDTH);
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
491 GRAPH_MEM=vga_getgraphmem();
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
492 frame=0;
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
493 fillbox(0,0,WIDTH,HEIGHT*(maxframes+1),0);
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
494
5679
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
495 orig_w = width;
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
496 orig_h = height;
8515
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
497 maxw = req_w;
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
498 maxh = req_h;
5679
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
499
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
500 if (bpp_conv) {
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
501 bppbuf = malloc(maxw * maxh * BYTESPERPIXEL);
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
502 if (bppbuf == NULL) {
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
503 printf("vo_svga: bppbuf -> Not enough memory for buffering!\n");
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
504 uninit();
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
505 return (1);
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
506 }
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
507 }
8520
602cf042a013 10l by Matan
alex
parents: 8515
diff changeset
508
602cf042a013 10l by Matan
alex
parents: 8515
diff changeset
509 #ifdef CONFIG_VIDIX
8515
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
510 if(!vidix_name[0]){
8520
602cf042a013 10l by Matan
alex
parents: 8515
diff changeset
511 #endif
8515
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
512 maxw = width; /* No scaling */
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
513 maxh = height;
8520
602cf042a013 10l by Matan
alex
parents: 8515
diff changeset
514 #ifdef CONFIG_VIDIX
8515
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
515 }
8520
602cf042a013 10l by Matan
alex
parents: 8515
diff changeset
516 #endif
8515
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
517 if (pformat == IMGFMT_YV12) {
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
518 yuv2rgb_init(bpp, MODE_RGB);
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
519 }
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
520
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
521 x_pos = (WIDTH - maxw) / 2;
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
522 y_pos = (HEIGHT - maxh) / 2;
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
523
8515
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
524 #ifdef CONFIG_VIDIX
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
525 if(vidix_name[0]){
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
526 vidix_init(width, height, x_pos, y_pos, maxw, maxh, format, bpp,
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
527 WIDTH, HEIGHT);
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
528 printf("vo_svga: Using VIDIX. w=%i h=%i mw=%i mh=%i\n",width,height,maxw,maxh);
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
529 vidix_start();
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
530 }
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
531 #endif
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
532
6456
f0b64210ce97 1bpp support
michael
parents: 6453
diff changeset
533 if(bpp==1)
f0b64210ce97 1bpp support
michael
parents: 6453
diff changeset
534 yuvbuf = malloc((maxw+7)/8 * maxh);
f0b64210ce97 1bpp support
michael
parents: 6453
diff changeset
535 else
f0b64210ce97 1bpp support
michael
parents: 6453
diff changeset
536 yuvbuf = malloc(maxw * maxh * BYTESPERPIXEL);
f0b64210ce97 1bpp support
michael
parents: 6453
diff changeset
537
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
538 if (yuvbuf == NULL) {
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
539 printf("vo_svga: yuvbuf -> Not enough memory for buffering!\n");
407
0a5b131f1f11 24/15bpp -> 32/16bpp added.
se7encode
parents: 387
diff changeset
540 uninit();
0a5b131f1f11 24/15bpp -> 32/16bpp added.
se7encode
parents: 387
diff changeset
541 return (1);
0a5b131f1f11 24/15bpp -> 32/16bpp added.
se7encode
parents: 387
diff changeset
542 }
504
a77e23145686 Some debug information (using verbose) added.
se7encode
parents: 502
diff changeset
543 printf("vo_svga: SVGAlib resolution: %dx%d %dbpp - ", WIDTH, HEIGHT, bpp);
293
f7e65132e296 Some bugfix.
se7encode
parents: 292
diff changeset
544 if (maxw != orig_w || maxh != orig_h) printf("Video scaled to: %dx%d\n",maxw,maxh);
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
545 else printf("No video scaling\n");
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
546
5679
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
547 vga_setdisplaystart(0);
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
548
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
549 return (0);
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
550 }
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
551
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
552 static uint32_t draw_frame(uint8_t *src[]) {
7691
5381fb575552 10l fix & cleanup of draw_frame(), still NO support for stride :(
arpi
parents: 7675
diff changeset
553 uint8_t *s=src[0];
5679
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
554 if (bpp_conv) {
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
555 switch(bpp) {
7691
5381fb575552 10l fix & cleanup of draw_frame(), still NO support for stride :(
arpi
parents: 7675
diff changeset
556 case 32:
5381fb575552 10l fix & cleanup of draw_frame(), still NO support for stride :(
arpi
parents: 7675
diff changeset
557 rgb24to32(src[0],bppbuf,maxw * maxh * 3);
5381fb575552 10l fix & cleanup of draw_frame(), still NO support for stride :(
arpi
parents: 7675
diff changeset
558 break;
5381fb575552 10l fix & cleanup of draw_frame(), still NO support for stride :(
arpi
parents: 7675
diff changeset
559 case 16:
5679
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
560 rgb15to16(src[0],bppbuf,maxw * maxh * 2);
7691
5381fb575552 10l fix & cleanup of draw_frame(), still NO support for stride :(
arpi
parents: 7675
diff changeset
561 break;
5679
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
562 }
7691
5381fb575552 10l fix & cleanup of draw_frame(), still NO support for stride :(
arpi
parents: 7675
diff changeset
563 s = bppbuf;
5679
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
564 }
7691
5381fb575552 10l fix & cleanup of draw_frame(), still NO support for stride :(
arpi
parents: 7675
diff changeset
565 putbox(x_pos, y_pos, maxw, maxh, s, 1);
5679
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
566 return (0);
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
567 }
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
568
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
569 static uint32_t draw_slice(uint8_t *image[], int stride[],
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
570 int w, int h, int x, int y) {
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
571 uint8_t *src = yuvbuf;
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
572 uint32_t sw, sh;
8515
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
573
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
574 if(directrender) {
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
575 yuv2rgb(GRAPH_MEM+(frame*HEIGHT+y+y_pos)*LINEWIDTH+(x+x_pos)*BYTESPERPIXEL,
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
576 image[0], image[1], image[2], w, h, LINEWIDTH, stride[0], stride[1]);
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
577 } else {
6456
f0b64210ce97 1bpp support
michael
parents: 6453
diff changeset
578 if(bpp==1)
f0b64210ce97 1bpp support
michael
parents: 6453
diff changeset
579 yuv2rgb(yuvbuf, image[0], image[1], image[2], w, h, (orig_w+7)/8, stride[0], stride[1]);
f0b64210ce97 1bpp support
michael
parents: 6453
diff changeset
580 else
8515
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
581 yuv2rgb(yuvbuf, image[0], image[1], image[2], w, h, orig_w * BYTESPERPIXEL,
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
582 stride[0], stride[1]);
6456
f0b64210ce97 1bpp support
michael
parents: 6453
diff changeset
583
5679
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
584 putbox(x + x_pos, y + y_pos, w, h, src, 1);
8515
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
585 }
5679
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
586
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
587 return (0);
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
588 }
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
589
5679
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
590 static void draw_osd(void)
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
591 {
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
592 if(oldmethod) {
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
593 if (y_pos) {
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
594 fillbox(0, 0, WIDTH, y_pos, 0);
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
595 fillbox(0, HEIGHT - y_pos, WIDTH, y_pos, 0);
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
596 if (x_pos) {
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
597 int hmy=HEIGHT - (y_pos<<1);
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
598 fillbox(0, y_pos, x_pos, hmy, 0);
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
599 fillbox(WIDTH - x_pos, y_pos, x_pos, hmy, 0);
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
600 }
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
601 } else if (x_pos) {
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
602 fillbox(0, y_pos, x_pos, HEIGHT, 0);
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
603 fillbox(WIDTH - x_pos, y_pos, x_pos, HEIGHT, 0);
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
604 }
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
605 vo_draw_text(WIDTH, HEIGHT, draw_alpha);
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
606 } else
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
607 vo_draw_text(maxw, maxh, draw_alpha);
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
608 }
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
609
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
610 static void flip_page(void) {
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
611 if(oldmethod) {
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
612 int i;
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
613 uint8_t *b;
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
614 b=buffer;
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
615 for(i=0;i<HEIGHT;i++){
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
616 vga_drawscansegment(b,0,i,LINEWIDTH);
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
617 b+=LINEWIDTH;
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
618 }
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
619 } else {
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
620 if(maxframes) {
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
621 vga_setdisplaystart(frame*HEIGHT*LINEWIDTH);
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
622 frame++;
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
623 if(frame>maxframes)frame=0;
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
624 }
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
625 }
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
626 }
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
627
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
628 static void check_events(void) {
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
629 }
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
630
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
631 static void uninit(void) {
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
632 vga_modelist_t *list = modelist;
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
633
8515
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
634 #ifdef CONFIG_VIDIX
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
635 if(vidix_name[0])vidix_term();
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
636 #endif
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
637
5679
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
638 vga_setmode(TEXT);
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
639
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
640 if (bppbuf != NULL)
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
641 free(bppbuf);
8515
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
642 bppbuf=NULL;
5679
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
643 if (yuvbuf != NULL)
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
644 free(yuvbuf);
8515
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
645
5679
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
646 while (modelist != NULL) {
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
647 list=modelist;
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
648 modelist=modelist->next;
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
649 free(list);
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
650 }
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
651 checked = 0;
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
652 }
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
653
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
654
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
655 /* --------------------------------------------------------------------- */
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
656
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
657 static uint32_t add_mode(uint16_t mode, vga_modeinfo minfo) {
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
658 vga_modelist_t *list;
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
659
8515
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
660 if(squarepix && (minfo.height*4 != minfo.width*3)) return 0;
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
661
5679
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
662 if (modelist == NULL) {
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
663 modelist = (vga_modelist_t *) malloc(sizeof(vga_modelist_t));
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
664 if (modelist == NULL) {
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
665 printf("vo_svga: add_mode() failed. Not enough memory for modelist.");
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
666 return(1); // error
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
667 }
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
668 modelist->modenum = mode;
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
669 modelist->modeinfo = minfo;
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
670 modelist->next = NULL;
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
671 } else {
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
672 list = modelist;
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
673 while (list->next != NULL)
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
674 list = list->next;
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
675 list->next = (vga_modelist_t *) malloc(sizeof(vga_modelist_t));
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
676 if (list->next == NULL) {
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
677 printf("vo_svga: add_mode() failed. Not enough memory for modelist.");
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
678 return(1); // error
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
679 }
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
680 list = list->next;
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
681 list->modenum = mode;
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
682 list->modeinfo = minfo;
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
683 list->next = NULL;
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
684 }
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
685 return (0);
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
686 }
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
687
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
688 static int checksupportedmodes() {
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
689 uint16_t i, max;
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
690 vga_modeinfo *minfo;
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
691
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
692 checked = 1;
6052
a5df6daa31fb getch2 fix - by Dimitar Zhekov <jimmy@is-vn.bg>
arpi
parents: 5679
diff changeset
693 getch2_disable();
5679
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
694 vga_init();
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
695 vga_disabledriverreport();
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
696 max = vga_lastmodenumber();
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
697 if (verbose >= 2)
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
698 printf("vo_svga: Max mode : %i\n",max);
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
699 for (i = 1; i <= max; i++)
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
700 if (vga_hasmode(i) > 0) {
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
701 minfo = vga_getmodeinfo(i);
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
702 switch (minfo->colors) {
6453
7f06ef0d58a6 8bpp bugfixes (brightness, contrast ...)
michael
parents: 6451
diff changeset
703 case 2 : bpp_avail |= BPP_1 ; break;
7f06ef0d58a6 8bpp bugfixes (brightness, contrast ...)
michael
parents: 6451
diff changeset
704 case 16 : bpp_avail |= BPP_4 ; break;
6451
ed906af317da 8bpp support (no dithering yet, use -vop noise for now)
michael
parents: 6052
diff changeset
705 case 256 : bpp_avail |= BPP_8 ; break;
5679
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
706 case 32768: bpp_avail |= BPP_15; break;
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
707 case 65536: bpp_avail |= BPP_16; break;
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
708 }
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
709 switch (minfo->bytesperpixel) {
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
710 case 3: bpp_avail |= BPP_24; break;
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
711 case 4: bpp_avail |= BPP_32; break;
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
712 }
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
713 if (verbose >= 2)
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
714 printf("vo_svga: Mode found: %s\n",vga_getmodename(i));
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
715 if (add_mode(i, *minfo))
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
716 return(1);
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
717 }
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
718 return(0);
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
719 }
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
720
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
721
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
722 static uint32_t query_format(uint32_t format) {
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
723 uint32_t res = 0;
407
0a5b131f1f11 24/15bpp -> 32/16bpp added.
se7encode
parents: 387
diff changeset
724
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
725 if (!checked) {
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
726 if (checksupportedmodes()) // Looking for available video modes
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
727 return(0);
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
728 }
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
729
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
730 // if (vo_dbpp) => There is NO conversion!!!
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
731 if (vo_dbpp) {
712
ea093aa3ecae -bpp bug fixed.
se7encode
parents: 620
diff changeset
732 if (format == IMGFMT_YV12) return (1);
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
733 switch (vo_dbpp) {
488
108be5ee3b1a Thanx to Arpi, There is no more YUY2 bug.
se7encode
parents: 486
diff changeset
734 case 32: if ((format == IMGFMT_RGB32) || (format == IMGFMT_BGR32))
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
735 return ((bpp_avail & BPP_32) ? 1 : 0);
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
736 break;
488
108be5ee3b1a Thanx to Arpi, There is no more YUY2 bug.
se7encode
parents: 486
diff changeset
737 case 24: if ((format == IMGFMT_RGB24) || (format == IMGFMT_BGR24))
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
738 return ((bpp_avail & BPP_24) ? 1 : 0);
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
739 break;
488
108be5ee3b1a Thanx to Arpi, There is no more YUY2 bug.
se7encode
parents: 486
diff changeset
740 case 16: if ((format == IMGFMT_RGB16) || (format == IMGFMT_BGR16))
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
741 return ((bpp_avail & BPP_16) ? 1 : 0);
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
742 break;
488
108be5ee3b1a Thanx to Arpi, There is no more YUY2 bug.
se7encode
parents: 486
diff changeset
743 case 15: if ((format == IMGFMT_RGB15) || (format == IMGFMT_BGR15))
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
744 return ((bpp_avail & BPP_15) ? 1 : 0);
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
745 break;
6451
ed906af317da 8bpp support (no dithering yet, use -vop noise for now)
michael
parents: 6052
diff changeset
746 case 8 : if ((format == IMGFMT_RGB8 ) || (format == IMGFMT_BGR8))
ed906af317da 8bpp support (no dithering yet, use -vop noise for now)
michael
parents: 6052
diff changeset
747 return ((bpp_avail & BPP_8 ) ? 1 : 0);
ed906af317da 8bpp support (no dithering yet, use -vop noise for now)
michael
parents: 6052
diff changeset
748 break;
6579
6850df500b8c IMGFMT_{RGB,BGR}{1,4}
michael
parents: 6456
diff changeset
749 case 4 : if ((format == IMGFMT_RGB4 ) || (format == IMGFMT_BGR4))
6850df500b8c IMGFMT_{RGB,BGR}{1,4}
michael
parents: 6456
diff changeset
750 return ((bpp_avail & BPP_4 ) ? 1 : 0);
6850df500b8c IMGFMT_{RGB,BGR}{1,4}
michael
parents: 6456
diff changeset
751 break;
6850df500b8c IMGFMT_{RGB,BGR}{1,4}
michael
parents: 6456
diff changeset
752 case 1 : if ((format == IMGFMT_RGB1 ) || (format == IMGFMT_BGR1))
6850df500b8c IMGFMT_{RGB,BGR}{1,4}
michael
parents: 6456
diff changeset
753 return ((bpp_avail & BPP_1 ) ? 1 : 0);
6850df500b8c IMGFMT_{RGB,BGR}{1,4}
michael
parents: 6456
diff changeset
754 break;
407
0a5b131f1f11 24/15bpp -> 32/16bpp added.
se7encode
parents: 387
diff changeset
755 }
488
108be5ee3b1a Thanx to Arpi, There is no more YUY2 bug.
se7encode
parents: 486
diff changeset
756 } else {
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
757 switch (format) {
6451
ed906af317da 8bpp support (no dithering yet, use -vop noise for now)
michael
parents: 6052
diff changeset
758 case IMGFMT_RGB32:
488
108be5ee3b1a Thanx to Arpi, There is no more YUY2 bug.
se7encode
parents: 486
diff changeset
759 case IMGFMT_BGR32: return ((bpp_avail & BPP_32) ? 1 : 0); break;
6451
ed906af317da 8bpp support (no dithering yet, use -vop noise for now)
michael
parents: 6052
diff changeset
760 case IMGFMT_RGB24:
488
108be5ee3b1a Thanx to Arpi, There is no more YUY2 bug.
se7encode
parents: 486
diff changeset
761 case IMGFMT_BGR24: {
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
762 res = (bpp_avail & BPP_24) ? 1 : 0;
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
763 if (!res)
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
764 res = (bpp_avail & BPP_32) ? 1 : 0;
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
765 return (res);
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
766 } break;
6451
ed906af317da 8bpp support (no dithering yet, use -vop noise for now)
michael
parents: 6052
diff changeset
767 case IMGFMT_RGB16:
488
108be5ee3b1a Thanx to Arpi, There is no more YUY2 bug.
se7encode
parents: 486
diff changeset
768 case IMGFMT_BGR16: return ((bpp_avail & BPP_16) ? 1 : 0); break;
6451
ed906af317da 8bpp support (no dithering yet, use -vop noise for now)
michael
parents: 6052
diff changeset
769 case IMGFMT_RGB15:
488
108be5ee3b1a Thanx to Arpi, There is no more YUY2 bug.
se7encode
parents: 486
diff changeset
770 case IMGFMT_BGR15: {
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
771 res = (bpp_avail & BPP_15) ? 1 : 0;
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
772 if (!res)
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
773 res = (bpp_avail & BPP_16) ? 1 : 0;
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
774 return (res);
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
775 } break;
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
776 case IMGFMT_YV12: return (1); break;
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
777 }
488
108be5ee3b1a Thanx to Arpi, There is no more YUY2 bug.
se7encode
parents: 486
diff changeset
778 }
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
779 return (0);
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
780 }
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
781
5679
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
782 static void putbox(int x, int y, int w, int h, uint8_t *buf, int prog) {
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
783 int base, add, wid;
6456
f0b64210ce97 1bpp support
michael
parents: 6453
diff changeset
784 if(bpp==1)
f0b64210ce97 1bpp support
michael
parents: 6453
diff changeset
785 wid=(w+7)/8;
f0b64210ce97 1bpp support
michael
parents: 6453
diff changeset
786 else
f0b64210ce97 1bpp support
michael
parents: 6453
diff changeset
787 wid=w*BYTESPERPIXEL;
f0b64210ce97 1bpp support
michael
parents: 6453
diff changeset
788
5679
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
789 if(oldmethod) {
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
790 add=wid*prog;
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
791 while( (h--) > 0 ) {
6456
f0b64210ce97 1bpp support
michael
parents: 6453
diff changeset
792 if(bpp==1)
f0b64210ce97 1bpp support
michael
parents: 6453
diff changeset
793 memcpy(buffer+(x+7)/8+(y++)*LINEWIDTH, buf, wid);
f0b64210ce97 1bpp support
michael
parents: 6453
diff changeset
794 else
f0b64210ce97 1bpp support
michael
parents: 6453
diff changeset
795 memcpy(buffer+x*BYTESPERPIXEL+(y++)*LINEWIDTH, buf, wid);
5679
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
796 buf+=add;
6451
ed906af317da 8bpp support (no dithering yet, use -vop noise for now)
michael
parents: 6052
diff changeset
797 }
5679
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
798 } else {
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
799 add=wid*prog;
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
800 base=frame*HEIGHT;
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
801 while( (h--) > 0 ) {
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
802 vga_drawscansegment(buf, x, (y++)+base, wid);
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
803 buf+=add;
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
804 }
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
805 }
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
806 }
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
807
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
808 static void fillbox(int x, int y, int w, int h, uint32_t c) {
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
809 putbox(x,y,w,h,buf0,0);
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
810 }
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
811
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
812 static void draw_alpha(int x0, int y0, int w, int h, unsigned char *src,
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
813 unsigned char *srca, int stride) {
7558
f89b4a70dbda warning fix - hope it don't break it
arpi
parents: 7472
diff changeset
814 char* base;
5679
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
815
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
816 if(oldmethod) {
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
817 base=buffer;
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
818 } else
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
819 base=((frame*HEIGHT+y_pos)*WIDTH+x_pos)*BYTESPERPIXEL + GRAPH_MEM ;
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
820
327
e7731f5c76cc OSD renderers for all modes added.
se7encode
parents: 293
diff changeset
821 switch (bpp) {
e7731f5c76cc OSD renderers for all modes added.
se7encode
parents: 293
diff changeset
822 case 32:
5679
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
823 vo_draw_alpha_rgb32(w, h, src, srca, stride, base+4*(y0*WIDTH+x0), 4*WIDTH);
327
e7731f5c76cc OSD renderers for all modes added.
se7encode
parents: 293
diff changeset
824 break;
e7731f5c76cc OSD renderers for all modes added.
se7encode
parents: 293
diff changeset
825 case 24:
5679
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
826 vo_draw_alpha_rgb24(w, h, src, srca, stride, base+3*(y0*WIDTH+x0), 3*WIDTH);
327
e7731f5c76cc OSD renderers for all modes added.
se7encode
parents: 293
diff changeset
827 break;
e7731f5c76cc OSD renderers for all modes added.
se7encode
parents: 293
diff changeset
828 case 16:
5679
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
829 vo_draw_alpha_rgb16(w, h, src, srca, stride, base+2*(y0*WIDTH+x0), 2*WIDTH);
327
e7731f5c76cc OSD renderers for all modes added.
se7encode
parents: 293
diff changeset
830 break;
e7731f5c76cc OSD renderers for all modes added.
se7encode
parents: 293
diff changeset
831 case 15:
5679
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
832 vo_draw_alpha_rgb15(w, h, src, srca, stride, base+2*(y0*WIDTH+x0), 2*WIDTH);
327
e7731f5c76cc OSD renderers for all modes added.
se7encode
parents: 293
diff changeset
833 break;
e7731f5c76cc OSD renderers for all modes added.
se7encode
parents: 293
diff changeset
834 }
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
835 }
4352
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 2982
diff changeset
836
5679
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
837 static uint32_t get_image(mp_image_t *mpi)
4352
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 2982
diff changeset
838 {
5679
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
839 if (/* zoomFlag || */
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
840 !IMGFMT_IS_BGR(mpi->imgfmt) ||
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
841 ((mpi->type != MP_IMGTYPE_STATIC) && (mpi->type != MP_IMGTYPE_TEMP)) ||
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
842 (mpi->flags & MP_IMGFLAG_PLANAR) ||
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
843 (mpi->flags & MP_IMGFLAG_YUV) /*
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
844 (mpi->width != image_width) ||
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
845 (mpi->height != image_height) */
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
846 )
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
847 return(VO_FALSE);
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
848
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
849 /*
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
850 if (Flip_Flag)
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
851 {
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
852 mpi->stride[0] = -image_width*((bpp+7)/8);
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
853 mpi->planes[0] = ImageData - mpi->stride[0]*(image_height-1);
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
854 }
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
855 else
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
856 */
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
857 {
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
858 mpi->stride[0] = LINEWIDTH;
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
859 if(oldmethod) {
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
860 mpi->planes[0] = buffer;
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
861 } else
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
862 mpi->planes[0] = GRAPH_MEM;
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
863 }
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
864 mpi->flags |= MP_IMGFLAG_DIRECT;
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
865
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
866 return(VO_TRUE);
4352
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 2982
diff changeset
867 }
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 2982
diff changeset
868