annotate libvo/vo_svga.c @ 28859:15a7ea3fe2e0

Add test for C memcpy()
author michael
date Sun, 08 Mar 2009 15:56:20 +0000
parents 7ec20a2f2067
children f01023c524c3
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 /*
28446
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 26755
diff changeset
2 * video driver for SVGAlib
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 26755
diff changeset
3 * by Zoltan Mark Vician <se7en@sch.bme.hu>
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 26755
diff changeset
4 * Code started: Mon Apr 1 23:25:47 2001
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 26755
diff changeset
5 * Some changes by Matan Ziv-Av <matan@svgalib.org>
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 26755
diff changeset
6 * complete rewrite by Ivan Kalvachev 19 Mar 2003
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 26755
diff changeset
7 *
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 26755
diff changeset
8 * This file is part of MPlayer.
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 26755
diff changeset
9 *
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 26755
diff changeset
10 * MPlayer is free software; you can redistribute it and/or modify
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 26755
diff changeset
11 * it under the terms of the GNU General Public License as published by
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 26755
diff changeset
12 * the Free Software Foundation; either version 2 of the License, or
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 26755
diff changeset
13 * (at your option) any later version.
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 26755
diff changeset
14 *
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 26755
diff changeset
15 * MPlayer is distributed in the hope that it will be useful,
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 26755
diff changeset
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 26755
diff changeset
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 26755
diff changeset
18 * GNU General Public License for more details.
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 26755
diff changeset
19 *
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 26755
diff changeset
20 * You should have received a copy of the GNU General Public License along
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 26755
diff changeset
21 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 26755
diff changeset
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 26755
diff changeset
23 */
9621
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
24
28446
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 26755
diff changeset
25 /*
9621
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
26 Wrangings:
28646
9b58b40350f7 Cosmetics. Remove all trailing whitespaces
iive
parents: 28446
diff changeset
27 - 1bpp doesn't work right for me with '-double' and svgalib 1.4.3,
9621
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
28 but works OK with svgalib 1.9.17
28646
9b58b40350f7 Cosmetics. Remove all trailing whitespaces
iive
parents: 28446
diff changeset
29 - The HW acceleration is not tested - svgalibs supports few chipsets,
9b58b40350f7 Cosmetics. Remove all trailing whitespaces
iive
parents: 28446
diff changeset
30 and i don't have any of them. If it works for you then let me know.
9621
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
31 I will remove this warning after confirm its status.
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
32 - retrace sync works only in doublebuffer mode.
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
33 - the retrace sync may slow down decoding a lot - mplayer is blocked while
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
34 waiting for retrace
9659
iive
parents: 9658
diff changeset
35 - denoise3d fails to find common colorspace, use -vf denoise3d,scale
28646
9b58b40350f7 Cosmetics. Remove all trailing whitespaces
iive
parents: 28446
diff changeset
36
9621
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
37 TODO:
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
38 - let choose_best_mode take aspect into account
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
39 - set palette from mpi->palette or mpi->plane[1]
10924
f531971e44cf blackbar osd support based on patch send by Dimitar Zhekov <jimmy@is-vn.bg>, page code removed/merged, small updates
iive
parents: 9788
diff changeset
40 - make faster OSD black bars clear - need some OSD changes
9621
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
41 - Make nicer CONFIG parsing
28646
9b58b40350f7 Cosmetics. Remove all trailing whitespaces
iive
parents: 28446
diff changeset
42 - change video mode logical width to match img->stride[0] - for HW only
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
43 */
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
44
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
45 #include <stdio.h>
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
46 #include <stdlib.h>
7472
c4434bdf6e51 tons of warning fixes, also some 10l bugfixes, including Dominik's PVA bug
arpi
parents: 7124
diff changeset
47 #include <string.h>
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
48
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
49 #include <vga.h>
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
50
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
51 #include <limits.h>
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
52
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
53 #include "config.h"
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
54 #include "video_out.h"
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
55 #include "video_out_internal.h"
9621
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
56 #include "fastmemcpy.h"
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
57 #include "osdep/getch2.h"
8515
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
58 #ifdef CONFIG_VIDIX
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
59 #include "vosub_vidix.h"
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
60 #endif
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
61
616
41d6eec69b60 clean up
pontscho
parents: 612
diff changeset
62 #include "sub.h"
41d6eec69b60 clean up
pontscho
parents: 612
diff changeset
63
13787
e047e70a9767 Handle "xxx.h" vs "../xxx.h" include paths in a consistent way.
diego
parents: 11565
diff changeset
64 #include "mp_msg.h"
18234
a107276371a8 Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents: 17932
diff changeset
65 #include "help_mp.h"
13787
e047e70a9767 Handle "xxx.h" vs "../xxx.h" include paths in a consistent way.
diego
parents: 11565
diff changeset
66 //#include "mp_image.h"
5679
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
67
9621
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
68 #include <assert.h>
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
69
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
70 //silence warnings, probably it have to go in some global header
28646
9b58b40350f7 Cosmetics. Remove all trailing whitespaces
iive
parents: 28446
diff changeset
71 #define UNUSED(x) ((void)(x))
9621
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
72
407
0a5b131f1f11 24/15bpp -> 32/16bpp added.
se7encode
parents: 387
diff changeset
73
5679
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
74 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
75 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
76 static uint32_t get_image(mp_image_t *mpi);
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
77
9621
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
78 #define MAXPAGES 16
10924
f531971e44cf blackbar osd support based on patch send by Dimitar Zhekov <jimmy@is-vn.bg>, page code removed/merged, small updates
iive
parents: 9788
diff changeset
79 #define PAGE_EMPTY 0
f531971e44cf blackbar osd support based on patch send by Dimitar Zhekov <jimmy@is-vn.bg>, page code removed/merged, small updates
iive
parents: 9788
diff changeset
80 #define PAGE_BUSY 1
8515
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
81
9621
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
82 #define CAP_ACCEL_CLEAR 8
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
83 #define CAP_ACCEL_PUTIMAGE 4
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
84 #define CAP_ACCEL_BACKGR 2
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
85 #define CAP_LINEAR 1
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
86
9621
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
87 static uint8_t zerobuf[8192];//used when clear screen with vga_draw
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
88
9621
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
89 static int squarepix;
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
90 static int force_vm=0;
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
91 static int force_native=0;
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
92 static int sync_flip=0;
10924
f531971e44cf blackbar osd support based on patch send by Dimitar Zhekov <jimmy@is-vn.bg>, page code removed/merged, small updates
iive
parents: 9788
diff changeset
93 static int blackbar_osd=0;
f531971e44cf blackbar osd support based on patch send by Dimitar Zhekov <jimmy@is-vn.bg>, page code removed/merged, small updates
iive
parents: 9788
diff changeset
94 static int cpage,max_pages,old_page;
447
b3b28a0d9404 All available videomodes support added.
se7encode
parents: 411
diff changeset
95
9621
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
96 static vga_modeinfo * modeinfo;
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
97 static int mode_stride; //keep it in case of vga_setlogicalwidth
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
98 static int stride_granularity; //not yet used
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
99 static int mode_bpp;
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
100 static int mode_capabilities;
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
101
9621
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
102 static int image_width,image_height; // used by OSD
10924
f531971e44cf blackbar osd support based on patch send by Dimitar Zhekov <jimmy@is-vn.bg>, page code removed/merged, small updates
iive
parents: 9788
diff changeset
103 static int x_pos, y_pos;
5679
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
104
9621
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
105 static struct {
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
106 int yoffset;//y position of the page
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
107 int doffset;//display start of the page
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
108 uint8_t * vbase;//memory start address of the page
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
109 int locks;
9621
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
110 }PageStore[MAXPAGES];
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
111
25216
3aee342be929 Make vo info structs const
reimar
parents: 24238
diff changeset
112 static const vo_info_t info = {
9621
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
113 "SVGAlib",
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
114 "svga",
10940
b99be2c88faf OSD stride fix and correct email
iive
parents: 10924
diff changeset
115 "Ivan Kalvachev <iive@users.sf.net>",
9621
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
116 ""
5679
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
117 };
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
118
8515
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
119 #ifdef CONFIG_VIDIX
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
120 static char vidix_name[32] = "";
11158
85f4534d1edb Colorkeying can be disabled. Fbdev, svga and vesa vidix colorkeying support
alex
parents: 11000
diff changeset
121 static vidix_grkey_t gr_key;
8515
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
122 #endif
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
123
8148
5b39e79af5fe removed get_info, using the same sheme as in libmpcodecs instead
alex
parents: 7691
diff changeset
124 LIBVO_EXTERN(svga)
5b39e79af5fe removed get_info, using the same sheme as in libmpcodecs instead
alex
parents: 7691
diff changeset
125
9621
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
126
10924
f531971e44cf blackbar osd support based on patch send by Dimitar Zhekov <jimmy@is-vn.bg>, page code removed/merged, small updates
iive
parents: 9788
diff changeset
127 //return number of 1'st free page or -1 if no free one
22886
71b3e04d0555 "()" to "(void)" function param list fixes
uau
parents: 20110
diff changeset
128 static inline int page_find_free(void){
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
129 int i;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
130 for(i=0;i<max_pages;i++)
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
131 if(PageStore[i].locks == PAGE_EMPTY) return i;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
132 return -1;
9621
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
133 }
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
134
16171
fd51fd1ff231 Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents: 15212
diff changeset
135 static int preinit(const char *arg)
5679
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
136 {
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
137 int i,rez;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
138 char s[64];
9621
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
139
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
140 getch2_disable();
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
141 memset(zerobuf,0,sizeof(zerobuf));
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
142 force_vm=force_native=squarepix=0;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
143 sync_flip=vo_vsync;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
144 blackbar_osd=0;
28646
9b58b40350f7 Cosmetics. Remove all trailing whitespaces
iive
parents: 28446
diff changeset
145
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
146 if(arg)while(*arg) {
28646
9b58b40350f7 Cosmetics. Remove all trailing whitespaces
iive
parents: 28446
diff changeset
147 #ifdef CONFIG_VIDIX
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
148 if(memcmp(arg,"vidix",5)==0) {
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
149 i=6;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
150 while(arg[i] && arg[i]!=':') i++;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
151 strncpy(vidix_name, arg+6, i-6);
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
152 vidix_name[i-5]=0;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
153 if(arg[i]==':')i++;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
154 arg+=i;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
155 vidix_preinit(vidix_name, &video_out_svga);
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
156 }
8515
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
157 #endif
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
158 if(!strncmp(arg,"sq",2)) {
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
159 squarepix=1;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
160 arg+=2;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
161 if( *arg == ':' ) arg++;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
162 }
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
163
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
164 if(!strncmp(arg,"native",6)) {
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
165 force_native=1;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
166 arg+=6;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
167 if( *arg == ':' ) arg++;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
168 }
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
169
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
170 if(!strncmp(arg,"bbosd",5)) {
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
171 blackbar_osd=1;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
172 arg+=5;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
173 if( *arg == ':' ) arg++;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
174 }
28646
9b58b40350f7 Cosmetics. Remove all trailing whitespaces
iive
parents: 28446
diff changeset
175
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
176 if(!strncmp(arg,"retrace",7)) {
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
177 sync_flip=1;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
178 arg+=7;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
179 if( *arg == ':' ) arg++;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
180 }
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
181
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
182 if(*arg) {
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
183 i=0;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
184 while(arg[i] && arg[i]!=':')i++;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
185 if(i<64){
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
186 strncpy(s, arg, i);
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
187 s[i]=0;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
188
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
189 force_vm=vga_getmodenumber(s);
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
190 if(force_vm>0) {
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
191 mp_msg(MSGT_VO,MSGL_V, "vo_svga: Forcing mode %i\n",force_vm);
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
192 }else{
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
193 force_vm = 0;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
194 }
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
195 }
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
196 arg+=i;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
197 if(*arg==':')arg++;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
198 }
9621
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
199 }
10924
f531971e44cf blackbar osd support based on patch send by Dimitar Zhekov <jimmy@is-vn.bg>, page code removed/merged, small updates
iive
parents: 9788
diff changeset
200
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
201 rez = vga_init();
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
202 if(rez != 0){
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
203 mp_msg(MSGT_VO,MSGL_ERR, "vo_svga: vga_init() returned error=%d\n",rez);
9621
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
204 }
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
205 return !!rez;
9621
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
206 }
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
207
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
208 static void svga_clear_box(int x,int y,int w,int h){
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
209 uint8_t * rgbplane;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
210 int i;
9621
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
211
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
212 if (mode_capabilities&CAP_ACCEL_CLEAR){
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
213 mp_msg(MSGT_VO,MSGL_DBG3, "vo_svga: clearing box %d,%d - %d,%d with HW acceleration\n",
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
214 x,y,w,h);
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
215 if(mode_capabilities&CAP_ACCEL_BACKGR)
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
216 vga_accel(ACCEL_SYNC);
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
217 vga_accel(ACCEL_SETFGCOLOR,0);//black
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
218 vga_accel(ACCEL_FILLBOX,x,y,w,h);
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
219 return;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
220 }
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
221 if (mode_capabilities & CAP_LINEAR){
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
222 mp_msg(MSGT_VO,MSGL_DBG3, "vo_svga: clearing box %d,%d - %d,%d with memset\n",x,y,w,h);
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
223 rgbplane=PageStore[0].vbase + (y*mode_stride) + (x*modeinfo->bytesperpixel);
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
224 for(i=0;i<h;i++){
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
225 //i'm afraid that memcpy is better optimized than memset;)
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
226 fast_memcpy(rgbplane,zerobuf,w*modeinfo->bytesperpixel);
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
227 // memset(rgbplane,0,w*modeinfo->bytesperpixel);
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
228 rgbplane+=mode_stride;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
229 }
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
230 return;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
231 }
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
232 //native
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
233 mp_msg(MSGT_VO,MSGL_DBG3, "vo_svga: clearing box %d,%d - %d,%d with native draw \n",x,y,w,h);
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
234 if(modeinfo->bytesperpixel!=0) w*=modeinfo->bytesperpixel;
9621
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
235 for(i=0;i<h;i++){
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
236 vga_drawscansegment(zerobuf,x,y+i,w);
9621
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
237 }
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
238 };
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
239
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
240 static uint32_t svga_draw_image(mp_image_t *mpi){
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
241 int i,x,y,w,h;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
242 int stride;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
243 uint8_t *rgbplane, *base;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
244 int bytesperline;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
245 int page;
9621
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
246
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
247 if(mpi->flags & MP_IMGFLAG_DIRECT){
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
248 mp_msg(MSGT_VO,MSGL_DBG3, "vo_svga: drawing direct rendered surface\n");
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
249 cpage=(uint32_t)mpi->priv;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
250 assert((cpage>=0)&&(cpage<max_pages));
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
251 return VO_TRUE; //it's already done
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
252 }
28646
9b58b40350f7 Cosmetics. Remove all trailing whitespaces
iive
parents: 28446
diff changeset
253 // if (mpi->flags&MP_IMGFLAGS_DRAWBACK)
9621
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
254 // return VO_TRUE;//direct render method 2
10924
f531971e44cf blackbar osd support based on patch send by Dimitar Zhekov <jimmy@is-vn.bg>, page code removed/merged, small updates
iive
parents: 9788
diff changeset
255
f531971e44cf blackbar osd support based on patch send by Dimitar Zhekov <jimmy@is-vn.bg>, page code removed/merged, small updates
iive
parents: 9788
diff changeset
256 //find a free page to draw into
f531971e44cf blackbar osd support based on patch send by Dimitar Zhekov <jimmy@is-vn.bg>, page code removed/merged, small updates
iive
parents: 9788
diff changeset
257 //if there is no one then use the current one
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
258 page = page_find_free();
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
259 if(page>=0) cpage=page;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
260 PageStore[cpage].locks=PAGE_BUSY;
10924
f531971e44cf blackbar osd support based on patch send by Dimitar Zhekov <jimmy@is-vn.bg>, page code removed/merged, small updates
iive
parents: 9788
diff changeset
261
28646
9b58b40350f7 Cosmetics. Remove all trailing whitespaces
iive
parents: 28446
diff changeset
262 // these variables are used in loops
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
263 x = mpi->x;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
264 y = mpi->y;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
265 w = mpi->w;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
266 h = mpi->h;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
267 stride = mpi->stride[0];
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
268 rgbplane = mpi->planes[0] + y*stride + (x*mpi->bpp)/8;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
269 x+=x_pos;//center
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
270 y+=y_pos;
28646
9b58b40350f7 Cosmetics. Remove all trailing whitespaces
iive
parents: 28446
diff changeset
271
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
272 if(mpi->bpp >= 8){//for modes<8 use only native
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
273 if( (mode_capabilities&CAP_ACCEL_PUTIMAGE) && (x==0) && (w==mpi->width) &&
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
274 (stride == mode_stride) ){ //only monolite image can be accelerated
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
275 w=(stride*8)/mpi->bpp;//we transfer pixels in the stride so the source
9621
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
276 //ACCELERATE
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
277 mp_msg(MSGT_VO,MSGL_DBG3, "vo_svga: using HW PutImage (x=%d,y=%d,w=%d,h=%d)\n",x,y,w,h);
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
278 if(mode_capabilities & CAP_ACCEL_BACKGR)
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
279 vga_accel(ACCEL_SYNC);
8515
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
280
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
281 vga_accel(ACCEL_PUTIMAGE,x,y+PageStore[cpage].yoffset,w,h,rgbplane);
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
282 return VO_TRUE;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
283 }
28646
9b58b40350f7 Cosmetics. Remove all trailing whitespaces
iive
parents: 28446
diff changeset
284
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
285 if( mode_capabilities&CAP_LINEAR){
28646
9b58b40350f7 Cosmetics. Remove all trailing whitespaces
iive
parents: 28446
diff changeset
286 //DIRECT
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
287 mp_msg(MSGT_VO,MSGL_DBG3, "vo_svga: using Direct memcpy (x=%d,y=%d,w=%d,h=%d)\n",x,y,w,h);
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
288 bytesperline=(w*mpi->bpp)/8;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
289 base=PageStore[cpage].vbase + (y*mode_stride) + (x*mpi->bpp)/8;
9621
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
290
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
291 for(i=0;i<h;i++){
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
292 mem2agpcpy(base,rgbplane,bytesperline);
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
293 base+=mode_stride;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
294 rgbplane+=stride;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
295 }
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
296 return VO_TRUE;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
297 }
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
298 }//(modebpp>=8
28646
9b58b40350f7 Cosmetics. Remove all trailing whitespaces
iive
parents: 28446
diff changeset
299
9621
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
300
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
301 //NATIVE
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
302 {
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
303 int length;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
304 length=(w*mpi->bpp)/8;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
305 //one byte per pixel! svgalib innovation
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
306 if(mpi->imgfmt==IMGFMT_RG4B || mpi->imgfmt==IMGFMT_BG4B) length=w;
28646
9b58b40350f7 Cosmetics. Remove all trailing whitespaces
iive
parents: 28446
diff changeset
307
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
308 mp_msg(MSGT_VO,MSGL_DBG3, "vo_svga: using Native vga_draw(x=%d,y=%d,w=%d,h=%d)\n",x,y,w,h);
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
309 y+=PageStore[cpage].yoffset;//y position of the page beggining
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
310 for(i=0;i<h;i++){
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
311 vga_drawscansegment(rgbplane,x,y+i,length);
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
312 rgbplane+=stride;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
313 }
9621
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
314 }
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
315 return VO_TRUE;
9621
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
316 }
7675
f78dc7d40730 mode check at preinit()
arpi
parents: 7558
diff changeset
317
18950
a943bc3f26c8 Make some functions static.
uau
parents: 18335
diff changeset
318 static int bpp_from_vminfo(vga_modeinfo *vminfo){
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
319 switch(vminfo->colors){
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
320 case 2: return 1;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
321 case 16: return 4;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
322 case 256: return 8;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
323 case 32768: return 15;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
324 case 65536: return 16;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
325 case 1<<24: return 8*vminfo->bytesperpixel;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
326 }
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
327 return 0;
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
328 }
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
329
18950
a943bc3f26c8 Make some functions static.
uau
parents: 18335
diff changeset
330 static int find_best_svga_mode(int req_w,int req_h, int req_bpp){
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
331 int badness,prev_badness;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
332 int bestmode,lastmode;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
333 int i;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
334 vga_modeinfo *vminfo;
9621
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
335 //int best aspect mode // best linear mode // best normal mode (no modeX)
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
336
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
337 prev_badness = 0;//take care of special case below
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
338 bestmode = 0; //0 is the TEXT mode
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
339 lastmode = vga_lastmodenumber();
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
340 for(i=1;i<=lastmode;i++){
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
341 vminfo = vga_getmodeinfo(i);
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
342 if( vminfo == NULL ) continue;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
343 mp_msg(MSGT_VO,MSGL_DBG4, "vo_svga: testing mode %d (%s)\n",i,vga_getmodename(i));
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
344 if( vga_hasmode(i) == 0 ) continue;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
345 if( req_bpp != bpp_from_vminfo(vminfo) )continue;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
346 if( (vminfo->width < req_w) || (vminfo->height < req_h) ) continue;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
347 badness=(vminfo->width * vminfo->height) - (req_h * req_w);
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
348 //put here aspect calculations
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
349 if(squarepix)
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
350 if( vminfo->width*3 != vminfo->height*4 ) continue;
9621
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
351
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
352 if( bestmode==0 || prev_badness >= badness ){//modeX etc...
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
353 prev_badness=badness;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
354 bestmode=i;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
355 mp_msg(MSGT_VO,MSGL_DBG4, "vo_svga: found good mode %d with badness %d\n",i,badness);
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
356 }
9621
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
357 }
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
358 return bestmode;
9621
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
359 }
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
360
16171
fd51fd1ff231 Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents: 15212
diff changeset
361 static int control(uint32_t request, void *data, ...)
5679
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
362 {
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
363 switch (request) {
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
364 case VOCTRL_QUERY_FORMAT:
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
365 return query_format(*((uint32_t*)data));
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
366 case VOCTRL_DRAW_IMAGE:
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
367 return svga_draw_image( (mp_image_t *)data);
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
368 case VOCTRL_GET_IMAGE:
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
369 return get_image(data);
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
370 }
11565
0d24c99199e2 Some more vidix crap - vidix equalizer passthrough. Patch by Oleg I. Vdovikin <vdovikin@jscc.ru>
alex
parents: 11216
diff changeset
371
0d24c99199e2 Some more vidix crap - vidix equalizer passthrough. Patch by Oleg I. Vdovikin <vdovikin@jscc.ru>
alex
parents: 11216
diff changeset
372 #ifdef CONFIG_VIDIX
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
373 if (vidix_name[0]) {
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
374 switch (request) {
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
375 case VOCTRL_SET_EQUALIZER:
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
376 {
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
377 va_list ap;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
378 int value;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
379
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
380 va_start(ap, data);
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
381 value = va_arg(ap, int);
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
382 va_end(ap);
28646
9b58b40350f7 Cosmetics. Remove all trailing whitespaces
iive
parents: 28446
diff changeset
383
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
384 return vidix_control(request, data, value);
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
385 }
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
386 case VOCTRL_GET_EQUALIZER:
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
387 {
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
388 va_list ap;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
389 int *value;
11565
0d24c99199e2 Some more vidix crap - vidix equalizer passthrough. Patch by Oleg I. Vdovikin <vdovikin@jscc.ru>
alex
parents: 11216
diff changeset
390
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
391 va_start(ap, data);
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
392 value = va_arg(ap, int*);
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
393 va_end(ap);
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
394
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
395 return vidix_control(request, data, value);
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
396 }
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
397 }
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
398 return vidix_control(request, data);
11565
0d24c99199e2 Some more vidix crap - vidix equalizer passthrough. Patch by Oleg I. Vdovikin <vdovikin@jscc.ru>
alex
parents: 11216
diff changeset
399 }
0d24c99199e2 Some more vidix crap - vidix equalizer passthrough. Patch by Oleg I. Vdovikin <vdovikin@jscc.ru>
alex
parents: 11216
diff changeset
400 #endif
0d24c99199e2 Some more vidix crap - vidix equalizer passthrough. Patch by Oleg I. Vdovikin <vdovikin@jscc.ru>
alex
parents: 11216
diff changeset
401
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
402 return VO_NOTIMPL;
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
403 }
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
404
9621
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
405 //
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
406 // This function is called to init the video driver for specific mode
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
407 //
16171
fd51fd1ff231 Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents: 15212
diff changeset
408 static int config(uint32_t width, uint32_t height, uint32_t d_width,
15212
05aa13cdf92f replace VO and VF numeric flags with #defined identifiers
henry
parents: 13865
diff changeset
409 uint32_t d_height, uint32_t flags, char *title,
9621
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
410 uint32_t format) {
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
411 int32_t req_w = width;// (d_width > 0 ? d_width : width);
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
412 int32_t req_h = height;// (d_height > 0 ? d_height : height);
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
413 uint16_t vid_mode = 0;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
414 int32_t req_bpp;
28646
9b58b40350f7 Cosmetics. Remove all trailing whitespaces
iive
parents: 28446
diff changeset
415
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
416 uint32_t accflags;
18234
a107276371a8 Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents: 17932
diff changeset
417 mp_msg(MSGT_VO,MSGL_V, "vo_svga: config(%i, %i, %i, %i, %08x, %s, %08x)\n", width, height,
9621
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
418 d_width, d_height, flags, title, format);
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
419 //Only RGB modes supported
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
420 if (!IMGFMT_IS_RGB(format) && !IMGFMT_IS_BGR(format)) {assert(0);return -1;}
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
421 req_bpp = IMGFMT_BGR_DEPTH(format);
28646
9b58b40350f7 Cosmetics. Remove all trailing whitespaces
iive
parents: 28446
diff changeset
422
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
423 if( vo_dbpp!=0 && vo_dbpp!=req_bpp) {assert(0);return-1;}
28646
9b58b40350f7 Cosmetics. Remove all trailing whitespaces
iive
parents: 28446
diff changeset
424
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
425 if(!force_vm) {
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
426 mp_msg(MSGT_VO,MSGL_V, "vo_svga: Looking for the best resolution...\n");
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
427 mp_msg(MSGT_VO,MSGL_V, "vo_svga: req_w: %d, req_h: %d, bpp: %d\n",req_w,req_h,req_bpp);
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
428 vid_mode=find_best_svga_mode(req_w,req_h,req_bpp);
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
429 if(vid_mode==0)
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
430 return 1;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
431 modeinfo=vga_getmodeinfo(vid_mode);
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
432 }else{//force_vm
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
433 vid_mode=force_vm;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
434 if(vga_hasmode(vid_mode) == 0){
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
435 mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_SVGA_ForcedVidmodeNotAvailable,
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
436 vid_mode,vga_getmodename(vid_mode));
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
437 return 1; //error;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
438 }
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
439 modeinfo=vga_getmodeinfo(vid_mode);
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
440 if( (modeinfo->width < req_w) || (modeinfo->height < req_h) ){
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
441 mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_SVGA_ForcedVidmodeTooSmall,
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
442 vid_mode,vga_getmodename(vid_mode));
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
443 return 1;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
444 }
9621
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
445 }
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
446 mode_bpp=bpp_from_vminfo(modeinfo);
28646
9b58b40350f7 Cosmetics. Remove all trailing whitespaces
iive
parents: 28446
diff changeset
447
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
448 mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_SVGA_Vidmode,
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
449 vid_mode,modeinfo->width,modeinfo->height,mode_bpp);
28646
9b58b40350f7 Cosmetics. Remove all trailing whitespaces
iive
parents: 28446
diff changeset
450
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
451 if (vga_setmode(vid_mode) == -1) {
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
452 mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_SVGA_VgasetmodeFailed,vid_mode);
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
453 uninit();
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
454 return 1; // error
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
455 }
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
456 /* set 332 palette for 8 bpp */
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
457 if(mode_bpp==8){
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
458 int i;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
459 for(i=0; i<256; i++)
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
460 vga_setpalette(i, ((i>>5)&7)*9, ((i>>2)&7)*9, (i&3)*21);
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
461 }
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
462 /* set 121 palette for 4 bpp */
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
463 else if(mode_bpp==4){
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
464 int i;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
465 for(i=0; i<16; i++)
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
466 vga_setpalette(i, ((i>>3)&1)*63, ((i>>1)&3)*21, (i&1)*63);
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
467 }
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
468 //if we change the logical width, we should know the granularity
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
469 stride_granularity=8;//according to man vga_logicalwidth
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
470 if(modeinfo->flags & EXT_INFO_AVAILABLE){
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
471 stride_granularity=modeinfo->linewidth_unit;
9621
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
472 }
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
473 //look for hardware acceleration
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
474 mode_capabilities=0;//NATIVE;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
475 if(!force_native){//if we want to use only native drawers
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
476 if(modeinfo->flags & HAVE_EXT_SET){//support for hwaccel interface
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
477 accflags=vga_ext_set(VGA_EXT_AVAILABLE,VGA_AVAIL_ACCEL);
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
478 if(accflags & ACCELFLAG_FILLBOX) // clear screen
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
479 mode_capabilities|=CAP_ACCEL_CLEAR;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
480 if(accflags & ACCELFLAG_PUTIMAGE)//support for mem->vid transfer
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
481 mode_capabilities|=CAP_ACCEL_PUTIMAGE;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
482 if((accflags & ACCELFLAG_SETMODE) && (accflags & ACCELFLAG_SYNC)){
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
483 vga_accel(ACCEL_SETMODE,BLITS_IN_BACKGROUND);
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
484 mode_capabilities|=CAP_ACCEL_BACKGR;//can draw in backgraund
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
485 }
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
486 }
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
487 if(modeinfo->flags & IS_LINEAR){
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
488 mode_capabilities|=CAP_LINEAR; //don't use bank & vga_draw
9621
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
489 }
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
490 else{
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
491 if(modeinfo->flags & CAPABLE_LINEAR){
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
492 int vid_mem_size;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
493 vid_mem_size = vga_setlinearaddressing();
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
494 if(vid_mem_size != -1){
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
495 modeinfo=vga_getmodeinfo(vid_mode);//sometimes they change parameters
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
496 mode_capabilities|=CAP_LINEAR;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
497 }
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
498 }
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
499 }
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
500 }//fi force native
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
501 if(mode_capabilities&CAP_LINEAR){
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
502 mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_SVGA_VideoModeIsLinearAndMemcpyCouldBeUsed);
9621
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
503 }
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
504 if(mode_capabilities&CAP_ACCEL_PUTIMAGE){
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
505 mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_SVGA_VideoModeHasHardwareAcceleration);
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
506 mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_SVGA_IfItWorksForYouIWouldLikeToKnow);
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
507 }
28646
9b58b40350f7 Cosmetics. Remove all trailing whitespaces
iive
parents: 28446
diff changeset
508
9621
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
509 //here is the place to handle strides for accel_ modes;
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
510 mode_stride=modeinfo->linewidth;
28646
9b58b40350f7 Cosmetics. Remove all trailing whitespaces
iive
parents: 28446
diff changeset
511 //we may try to set a bigger stride for video mode that will match the mpi->stride,
9621
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
512 //this way we will transfer more data, but HW put_image can do it in backgraund!
5679
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
513
28646
9b58b40350f7 Cosmetics. Remove all trailing whitespaces
iive
parents: 28446
diff changeset
514 //now let's see how many pages we can use
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
515 max_pages = modeinfo->maxpixels/(modeinfo->height * modeinfo->width);
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
516 if(max_pages > MAXPAGES) max_pages = MAXPAGES;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
517 if(!vo_doublebuffering) max_pages=1;
9621
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
518 //fill PageStore structs
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
519 {
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
520 int i;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
521 uint8_t * GRAPH_MEM;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
522 int dof;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
523 GRAPH_MEM=vga_getgraphmem();
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
524 for(i=0;i<max_pages;i++){
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
525 //calculate display offset
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
526 dof = i * modeinfo->height * modeinfo->width;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
527 if(modeinfo->bytesperpixel != 0) dof*=modeinfo->bytesperpixel;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
528 //check video chip limitations
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
529 if( dof != (dof & modeinfo->startaddressrange) ){
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
530 max_pages=i;//page 0 will never come here
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
531 break;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
532 }
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
533 PageStore[i].yoffset = i * modeinfo->height;//starting y offset
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
534 PageStore[i].vbase = GRAPH_MEM + i*modeinfo->height*mode_stride; //memory base address
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
535 PageStore[i].doffset = dof; //display offset
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
536 PageStore[i].locks = PAGE_EMPTY;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
537 }
9621
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
538 }
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
539 assert(max_pages>0);
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
540 mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_SVGA_VideoModeHas,max_pages);
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
541 //15bpp
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
542 if(modeinfo->bytesperpixel!=0)
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
543 vga_claimvideomemory(max_pages * modeinfo->height * modeinfo->width * modeinfo->bytesperpixel);
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
544 else
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
545 vga_claimvideomemory(max_pages * modeinfo->height * modeinfo->width * mode_bpp / 8);
9621
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
546
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
547 cpage=old_page=0;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
548 svga_clear_box(0,0,modeinfo->width,modeinfo->height * max_pages);
9621
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
549
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
550 image_height=req_h;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
551 image_width=req_w;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
552 x_pos = (modeinfo->width - req_w) / 2;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
553 y_pos = (modeinfo->height - req_h) / 2;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
554 x_pos &= ~(15); //align x offset position to 16 pixels
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
555 mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_SVGA_CenteringImageStartAt,x_pos,y_pos);
8520
602cf042a013 10l by Matan
alex
parents: 8515
diff changeset
556
602cf042a013 10l by Matan
alex
parents: 8515
diff changeset
557 #ifdef CONFIG_VIDIX
8515
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
558
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
559 if(vidix_name[0]){
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
560 vidix_init(width, height, x_pos, y_pos, modeinfo->width, modeinfo->height,
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
561 format, mode_bpp, modeinfo->width,modeinfo->height);
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
562 mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_SVGA_UsingVidix,width,height,
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
563 modeinfo->width,modeinfo->height);
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
564 vidix_start();
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
565 /*set colorkey*/
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
566 if(vidix_grkey_support()){
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
567 vidix_grkey_get(&gr_key);
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
568 gr_key.key_op = KEYS_PUT;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
569 if (!(vo_colorkey & 0xFF000000)) {
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
570 gr_key.ckey.op = CKEY_TRUE;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
571 gr_key.ckey.red = (vo_colorkey & 0x00FF0000) >> 16;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
572 gr_key.ckey.green = (vo_colorkey & 0x0000FF00) >> 8;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
573 gr_key.ckey.blue = vo_colorkey & 0x000000FF;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
574 } else
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
575 gr_key.ckey.op = CKEY_FALSE;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
576 vidix_grkey_set(&gr_key);
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
577 }
28646
9b58b40350f7 Cosmetics. Remove all trailing whitespaces
iive
parents: 28446
diff changeset
578 }
9b58b40350f7 Cosmetics. Remove all trailing whitespaces
iive
parents: 28446
diff changeset
579 #endif
8515
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
580
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
581 vga_setdisplaystart(0);
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
582 return 0;
9621
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
583 }
6456
f0b64210ce97 1bpp support
michael
parents: 6453
diff changeset
584
16171
fd51fd1ff231 Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents: 15212
diff changeset
585 static int draw_slice(uint8_t *image[],int stride[],
9621
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
586 int w, int h, int x, int y) {
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
587 assert(0);
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
588 UNUSED(image);UNUSED(stride);
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
589 UNUSED(w);UNUSED(h);
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
590 UNUSED(x);UNUSED(y);
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
591
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
592 return VO_ERROR;//this is yv12 only -> vf_scale should do all transforms
5679
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
593 }
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
594
16171
fd51fd1ff231 Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents: 15212
diff changeset
595 static int draw_frame(uint8_t *src[]) {
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
596 assert(0);
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
597 UNUSED(src);
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
598 return VO_ERROR;//this one should not be called
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
599 }
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
600
5679
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
601 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
602 {
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
603 mp_msg(MSGT_VO,MSGL_DBG4, "vo_svga: draw_osd()\n");
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
604 //only modes with bytesperpixel>0 can draw OSD
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
605 if(modeinfo->bytesperpixel==0) return;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
606 if(!(mode_capabilities&CAP_LINEAR)) return;//force_native will remove OSD
28646
9b58b40350f7 Cosmetics. Remove all trailing whitespaces
iive
parents: 28446
diff changeset
607
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
608 if(blackbar_osd){
10924
f531971e44cf blackbar osd support based on patch send by Dimitar Zhekov <jimmy@is-vn.bg>, page code removed/merged, small updates
iive
parents: 9788
diff changeset
609 //111
f531971e44cf blackbar osd support based on patch send by Dimitar Zhekov <jimmy@is-vn.bg>, page code removed/merged, small updates
iive
parents: 9788
diff changeset
610 //3 4
f531971e44cf blackbar osd support based on patch send by Dimitar Zhekov <jimmy@is-vn.bg>, page code removed/merged, small updates
iive
parents: 9788
diff changeset
611 //222
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
612 svga_clear_box(0,0 + PageStore[cpage].yoffset,
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
613 modeinfo->width, y_pos);
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
614 svga_clear_box(0, image_height + y_pos + PageStore[cpage].yoffset,
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
615 modeinfo->width, modeinfo->height-(image_height+ y_pos));
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
616 svga_clear_box(0, y_pos + PageStore[cpage].yoffset,
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
617 x_pos, image_height);
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
618 svga_clear_box(image_width + x_pos, y_pos + PageStore[cpage].yoffset,
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
619 modeinfo->width-(x_pos+image_width), image_height);
10924
f531971e44cf blackbar osd support based on patch send by Dimitar Zhekov <jimmy@is-vn.bg>, page code removed/merged, small updates
iive
parents: 9788
diff changeset
620 // vo_remove_text(modeinfo->width, modeinfo->height, clear_alpha);
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
621 vo_draw_text(modeinfo->width, modeinfo->height, draw_alpha);
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
622 }else{
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
623 vo_draw_text(image_width, image_height, draw_alpha);
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
624 }
5679
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 static void flip_page(void) {
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
628 PageStore[old_page].locks=PAGE_EMPTY;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
629 PageStore[cpage].locks=PAGE_BUSY;
10924
f531971e44cf blackbar osd support based on patch send by Dimitar Zhekov <jimmy@is-vn.bg>, page code removed/merged, small updates
iive
parents: 9788
diff changeset
630
18234
a107276371a8 Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents: 17932
diff changeset
631 mp_msg(MSGT_VO,MSGL_DBG3, "vo_svga: viewing page %d\n",cpage);
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
632 if(sync_flip && old_page!=cpage){
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
633 mp_msg(MSGT_VO,MSGL_DBG3, "vo_svga:vga_waitretrace\n");
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
634 vga_waitretrace();
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
635 }
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
636 vga_setdisplaystart(PageStore[cpage].doffset);
28646
9b58b40350f7 Cosmetics. Remove all trailing whitespaces
iive
parents: 28446
diff changeset
637
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
638 old_page=cpage;//cpage will be overwriten on next draw_image
5679
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
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
641 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
642 }
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
643
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
644 static void uninit(void) {
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
645
8515
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
646 #ifdef CONFIG_VIDIX
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
647 if(vidix_name[0])vidix_term();
8515
b4e5d87b878b vidix support and better device options handler by Matan Ziv-Av <matan@svgalib.org>
alex
parents: 8148
diff changeset
648 #endif
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
649 vga_setmode(TEXT);
5679
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
9621
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
652 /* --------------------------------------------------------------------- */
16171
fd51fd1ff231 Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents: 15212
diff changeset
653 static int query_format(uint32_t format) {
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
654 int32_t req_bpp,flags;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
655 int i,lastmode;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
656 vga_modeinfo * vminfo;
407
0a5b131f1f11 24/15bpp -> 32/16bpp added.
se7encode
parents: 387
diff changeset
657
18234
a107276371a8 Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents: 17932
diff changeset
658 mp_msg(MSGT_VO,MSGL_DBG4, "vo_svga: query_format=%X \n",format);
9621
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
659 //only RGB modes supported
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
660 if( (!IMGFMT_IS_RGB(format)) && (!IMGFMT_IS_BGR(format)) ) return 0;
9621
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
661
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
662 // Reject different endian
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
663 #ifdef WORDS_BIGENDIAN
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
664 if (IMGFMT_IS_BGR(format)) return 0;
9621
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
665 #else
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
666 if (IMGFMT_IS_RGB(format)) return 0;
9621
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
667 #endif
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
668
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
669 //svgalib supports only BG4B! if we want BGR4 we have to emulate it (sw)
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
670 if( format==IMGFMT_BGR4 || format==IMGFMT_RGB4) return 0;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
671 req_bpp = IMGFMT_RGB_DEPTH(format);
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
672 if( vo_dbpp>0 && vo_dbpp!=req_bpp ) return 0; //support -bpp options
9621
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
673 //scan all modes
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
674 lastmode = vga_lastmodenumber();
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
675 for(i=1;i<=lastmode;i++){
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
676 vminfo = vga_getmodeinfo(i);
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
677 if( vminfo == NULL ) continue;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
678 if( vga_hasmode(i) == 0 ) continue;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
679 if( req_bpp != bpp_from_vminfo(vminfo) ) continue;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
680 if( (force_vm > 0) && (force_vm != i) ) continue;//quick hack
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
681 flags = VFCAP_CSP_SUPPORTED|
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
682 VFCAP_CSP_SUPPORTED_BY_HW|
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
683 VFCAP_ACCEPT_STRIDE|
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
684 0;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
685 if(req_bpp>8) flags|=VFCAP_OSD;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
686 return flags;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
687 }
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
688 return 0;
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
689 }
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
690
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
691 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
692 unsigned char *srca, int stride) {
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
693 char* base;
9621
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
694
18234
a107276371a8 Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents: 17932
diff changeset
695 mp_msg(MSGT_VO,MSGL_DBG3, "vo_svga: draw_alpha(x0=%d,y0=%d,w=%d,h=%d,src=%p,srca=%p,stride=%d\n",
9621
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
696 x0,y0,w,h,src,srca,stride);
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
697 if(!blackbar_osd) {
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
698 //drawing in the image, so place the stuff there
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
699 x0+=x_pos;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
700 y0+=y_pos;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
701 }
28646
9b58b40350f7 Cosmetics. Remove all trailing whitespaces
iive
parents: 28446
diff changeset
702
18234
a107276371a8 Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents: 17932
diff changeset
703 mp_msg(MSGT_VO,MSGL_DBG4, "vo_svga: OSD draw in page %d\n",cpage);
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
704 base=PageStore[cpage].vbase + y0*mode_stride + x0*modeinfo->bytesperpixel;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
705 switch (mode_bpp) {
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
706 case 32:
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
707 vo_draw_alpha_rgb32(w, h, src, srca, stride, base, mode_stride);
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
708 break;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
709 case 24:
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
710 vo_draw_alpha_rgb24(w, h, src, srca, stride, base, mode_stride);
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
711 break;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
712 case 16:
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
713 vo_draw_alpha_rgb16(w, h, src, srca, stride, base, mode_stride);
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
714 break;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
715 case 15:
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
716 vo_draw_alpha_rgb15(w, h, src, srca, stride, base, mode_stride);
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
717 break;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
718 }
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
719 }
4352
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 2982
diff changeset
720
9621
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
721 static uint32_t get_image(mp_image_t *mpi){
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
722 int page;
9621
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
723
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
724 if(!IMGFMT_IS_BGR(mpi->imgfmt) && !IMGFMT_IS_RGB(mpi->imgfmt) ){
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
725 assert(0);//should never happen
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
726 return VO_FALSE;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
727 }
28646
9b58b40350f7 Cosmetics. Remove all trailing whitespaces
iive
parents: 28446
diff changeset
728
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
729 if (
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
730 ( (mpi->type != MP_IMGTYPE_STATIC) && (mpi->type != MP_IMGTYPE_TEMP)) ||
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
731 (mpi->flags & MP_IMGFLAG_PLANAR) ||
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
732 (mpi->flags & MP_IMGFLAG_YUV)
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
733 )
26755
46f0b4d34fa1 cosmetics: Remove useless parentheses from from return statements.
diego
parents: 26174
diff changeset
734 return VO_FALSE;
9621
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
735
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
736 //reading from video memory is horribly slow
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
737 if( !(mpi->flags & MP_IMGFLAG_READABLE) && vo_directrendering &&
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
738 (mode_capabilities & CAP_LINEAR) ){
10924
f531971e44cf blackbar osd support based on patch send by Dimitar Zhekov <jimmy@is-vn.bg>, page code removed/merged, small updates
iive
parents: 9788
diff changeset
739
f531971e44cf blackbar osd support based on patch send by Dimitar Zhekov <jimmy@is-vn.bg>, page code removed/merged, small updates
iive
parents: 9788
diff changeset
740 //find free page and reserve it
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
741 page=page_find_free();
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
742 if(page >= 0){
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
743 PageStore[page].locks=PAGE_BUSY;
10924
f531971e44cf blackbar osd support based on patch send by Dimitar Zhekov <jimmy@is-vn.bg>, page code removed/merged, small updates
iive
parents: 9788
diff changeset
744
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
745 mpi->flags |= MP_IMGFLAG_DIRECT;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
746 mpi->stride[0] = mode_stride;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
747 mpi->planes[0] = PageStore[page].vbase +
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
748 y_pos*mode_stride + (x_pos*mpi->bpp)/8;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
749 mpi->priv=(void *)page;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
750 mp_msg(MSGT_VO,MSGL_DBG3, "vo_svga: direct render allocated! page=%d\n",page);
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
751 return VO_TRUE;
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
752 }
5679
30f196ff3bec This patch replaces vo_svga.c with an improved version that does not use
arpi
parents: 4596
diff changeset
753 }
9621
3ef467aac4a1 new svga driver - support double buffering, fast_memcpy, direct render and HW acceleration
iive
parents: 9237
diff changeset
754
28649
7ec20a2f2067 Cosmetics. Reindent to 4 spaces.
iive
parents: 28648
diff changeset
755 return VO_FALSE;
4352
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 2982
diff changeset
756 }