annotate libvo/vo_ggi.c @ 5646:8bec4d7d04f0

disable hq for 1st pass
author arpi
date Tue, 16 Apr 2002 00:36:41 +0000
parents 6890819bc0dc
children efd2518b174e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1172
290353337b44 hardly modified, keyboard handling is ok. aspect implemented, but bugging :)
al3x
parents: 1148
diff changeset
1 /*
1132
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
2 vo_ggi.c - General Graphics Interface (GGI) Renderer for MPlayer
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
3
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
4 (C) Alex Beregszaszi <alex@naxine.org>
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
5
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
6 Uses libGGI - http://www.ggi-project.org/
1141
c33f8b7488d1 cleaned up, and merged with my version, also code will be faster too
al3x
parents: 1132
diff changeset
7
4841
5928e94c0d5f older API fixes, support for async mode
alex
parents: 4831
diff changeset
8 TODO:
5637
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
9 * implement direct rendering support - NEEDS TESTING
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
10 * implement non-directbuffer support - NEEDS TESTING
4841
5928e94c0d5f older API fixes, support for async mode
alex
parents: 4831
diff changeset
11 * check on many devices
5928e94c0d5f older API fixes, support for async mode
alex
parents: 4831
diff changeset
12 * implement gamma handling
5928e94c0d5f older API fixes, support for async mode
alex
parents: 4831
diff changeset
13
4828
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
14 Thanks to Andreas Beck for his patches.
4841
5928e94c0d5f older API fixes, support for async mode
alex
parents: 4831
diff changeset
15 Many thanks to Atmosfear, he hacked this driver to work with Planar
1141
c33f8b7488d1 cleaned up, and merged with my version, also code will be faster too
al3x
parents: 1132
diff changeset
16 formats, and he fixed the RGB handling.
1132
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
17 */
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
18
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
19 #include <stdio.h>
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
20 #include <stdlib.h>
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
21 #include <string.h>
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
22 #include <errno.h>
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
23
4828
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
24 #include "mp_msg.h"
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
25
1172
290353337b44 hardly modified, keyboard handling is ok. aspect implemented, but bugging :)
al3x
parents: 1148
diff changeset
26 #include "../config.h"
1132
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
27 #include "video_out.h"
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
28 #include "video_out_internal.h"
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
29
1141
c33f8b7488d1 cleaned up, and merged with my version, also code will be faster too
al3x
parents: 1132
diff changeset
30 #include "fastmemcpy.h"
1132
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
31
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
32 #include <ggi/ggi.h>
1141
c33f8b7488d1 cleaned up, and merged with my version, also code will be faster too
al3x
parents: 1132
diff changeset
33
4831
9153d1275b6d do not fault if no directbuffer available (for example: ggi display-multi)
alex
parents: 4830
diff changeset
34 /* maximum buffers */
4828
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
35 #define GGI_FRAMES 4
1172
290353337b44 hardly modified, keyboard handling is ok. aspect implemented, but bugging :)
al3x
parents: 1148
diff changeset
36
5637
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
37 #undef GGI_GAMMA
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
38
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
39 #include "../libmpcodecs/mp_image.h"
1172
290353337b44 hardly modified, keyboard handling is ok. aspect implemented, but bugging :)
al3x
parents: 1148
diff changeset
40
1132
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
41 LIBVO_EXTERN (ggi)
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
42
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
43 static vo_info_t vo_info =
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
44 {
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
45 "General Graphics Interface (GGI) output",
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
46 "ggi",
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
47 "Alex Beregszaszi <alex@naxine.org>",
1141
c33f8b7488d1 cleaned up, and merged with my version, also code will be faster too
al3x
parents: 1132
diff changeset
48 "under developement"
1132
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
49 };
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
50
1172
290353337b44 hardly modified, keyboard handling is ok. aspect implemented, but bugging :)
al3x
parents: 1148
diff changeset
51 static struct ggi_conf_s {
290353337b44 hardly modified, keyboard handling is ok. aspect implemented, but bugging :)
al3x
parents: 1148
diff changeset
52 char *driver;
290353337b44 hardly modified, keyboard handling is ok. aspect implemented, but bugging :)
al3x
parents: 1148
diff changeset
53
290353337b44 hardly modified, keyboard handling is ok. aspect implemented, but bugging :)
al3x
parents: 1148
diff changeset
54 ggi_visual_t vis;
4828
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
55 ggi_directbuffer *buffer[GGI_FRAMES];
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
56 ggi_mode gmode;
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
57
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
58 int frames;
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
59 int currframe;
1172
290353337b44 hardly modified, keyboard handling is ok. aspect implemented, but bugging :)
al3x
parents: 1148
diff changeset
60
4830
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
61 /* source image format */
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
62 int srcwidth;
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
63 int srcheight;
4828
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
64 int srcformat;
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
65 int srcdepth;
1172
290353337b44 hardly modified, keyboard handling is ok. aspect implemented, but bugging :)
al3x
parents: 1148
diff changeset
66
290353337b44 hardly modified, keyboard handling is ok. aspect implemented, but bugging :)
al3x
parents: 1148
diff changeset
67 /* destination */
4830
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
68 int dstwidth;
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
69 int dstheight;
4841
5928e94c0d5f older API fixes, support for async mode
alex
parents: 4831
diff changeset
70
5928e94c0d5f older API fixes, support for async mode
alex
parents: 4831
diff changeset
71 int async;
5637
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
72 int directbuffer;
1172
290353337b44 hardly modified, keyboard handling is ok. aspect implemented, but bugging :)
al3x
parents: 1148
diff changeset
73 } ggi_conf;
1132
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
74
5637
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
75 static uint32_t draw_frame_directbuffer(uint8_t *src[]);
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
76 static void draw_osd_directbuffer(void);
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
77 static void flip_page_directbuffer(void);
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
78
4830
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
79 static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width,
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
80 uint32_t d_height, uint32_t fullscreen, char *title, uint32_t format,const vo_tune_info_t *info)
1132
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
81 {
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
82 ggi_mode mode =
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
83 {
4828
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
84 GGI_FRAMES, /* frames */
4830
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
85 { width, height }, /* visible */
1132
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
86 { GGI_AUTO, GGI_AUTO }, /* virt */
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
87 { GGI_AUTO, GGI_AUTO }, /* size */
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
88 GT_AUTO, /* graphtype */
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
89 { GGI_AUTO, GGI_AUTO } /* dots per pixel */
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
90 };
4830
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
91 int i;
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
92 ggi_directbuffer *DB;
1132
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
93
4830
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
94 switch(format)
1132
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
95 {
4830
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
96 case IMGFMT_RGB|8:
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
97 case IMGFMT_BGR|8:
1132
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
98 mode.graphtype = GT_8BIT;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
99 break;
4830
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
100 case IMGFMT_RGB|15:
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
101 case IMGFMT_BGR|15:
1132
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
102 mode.graphtype = GT_15BIT;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
103 break;
4830
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
104 case IMGFMT_RGB|16:
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
105 case IMGFMT_BGR|16:
1132
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
106 mode.graphtype = GT_16BIT;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
107 break;
4830
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
108 case IMGFMT_RGB|24:
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
109 case IMGFMT_BGR|24:
1132
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
110 mode.graphtype = GT_24BIT;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
111 break;
4830
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
112 case IMGFMT_RGB|32:
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
113 case IMGFMT_BGR|32:
1132
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
114 mode.graphtype = GT_32BIT;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
115 break;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
116 }
4828
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
117
4830
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
118 #if 1
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
119 printf("[ggi] mode: ");
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
120 ggiPrintMode(&mode);
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
121 printf("\n");
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
122 #endif
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
123
1172
290353337b44 hardly modified, keyboard handling is ok. aspect implemented, but bugging :)
al3x
parents: 1148
diff changeset
124 ggiCheckMode(ggi_conf.vis, &mode);
1132
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
125
4830
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
126 switch(format)
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
127 {
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
128 case IMGFMT_YV12:
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
129 mode.graphtype = GT_32BIT;
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
130 if (!ggiSetMode(ggi_conf.vis, &mode))
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
131 break;
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
132 mode.graphtype = GT_24BIT;
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
133 if (!ggiSetMode(ggi_conf.vis, &mode))
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
134 break;
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
135 mode.graphtype = GT_16BIT;
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
136 if (!ggiSetMode(ggi_conf.vis, &mode))
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
137 break;
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
138 mode.graphtype = GT_15BIT;
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
139 if (!ggiSetMode(ggi_conf.vis, &mode))
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
140 break;
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
141 }
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
142
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
143 if (ggiSetMode(ggi_conf.vis, &mode))
1132
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
144 {
4828
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
145 mp_msg(MSGT_VO, MSGL_ERR, "[ggi] unable to set mode\n");
1132
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
146 return(-1);
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
147 }
4830
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
148
5637
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
149 if (ggiGetMode(ggi_conf.vis, &mode))
1147
82bbd3ee8ce7 hacked osd working on yv12
al3x
parents: 1145
diff changeset
150 {
4828
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
151 mp_msg(MSGT_VO, MSGL_ERR, "[ggi] unable to get mode\n");
1147
82bbd3ee8ce7 hacked osd working on yv12
al3x
parents: 1145
diff changeset
152 return(-1);
82bbd3ee8ce7 hacked osd working on yv12
al3x
parents: 1145
diff changeset
153 }
4828
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
154
4841
5928e94c0d5f older API fixes, support for async mode
alex
parents: 4831
diff changeset
155 if ((mode.graphtype == GT_INVALID) || (mode.graphtype == GT_AUTO))
5928e94c0d5f older API fixes, support for async mode
alex
parents: 4831
diff changeset
156 {
5928e94c0d5f older API fixes, support for async mode
alex
parents: 4831
diff changeset
157 mp_msg(MSGT_VO, MSGL_ERR, "[ggi] not supported depth/bpp\n");
5928e94c0d5f older API fixes, support for async mode
alex
parents: 4831
diff changeset
158 return(-1);
5928e94c0d5f older API fixes, support for async mode
alex
parents: 4831
diff changeset
159 }
5928e94c0d5f older API fixes, support for async mode
alex
parents: 4831
diff changeset
160
4828
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
161 ggi_conf.gmode = mode;
1132
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
162
4830
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
163 #if 1
4828
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
164 printf("[ggi] mode: ");
4830
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
165 ggiPrintMode(&mode);
4828
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
166 printf("\n");
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
167 #endif
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
168
4830
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
169 vo_depthonscreen = GT_DEPTH(mode.graphtype);
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
170 vo_screenwidth = mode.visible.x;
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
171 vo_screenheight = mode.visible.y;
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
172
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
173 vo_dx = vo_dy = 0;
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
174 vo_dwidth = mode.virt.x;
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
175 vo_dheight = mode.virt.y;
4841
5928e94c0d5f older API fixes, support for async mode
alex
parents: 4831
diff changeset
176 vo_dbpp = GT_SIZE(mode.graphtype);
1132
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
177
4828
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
178 ggi_conf.srcwidth = width;
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
179 ggi_conf.srcheight = height;
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
180 ggi_conf.srcformat = format;
4830
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
181
4828
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
182 if (IMGFMT_IS_RGB(ggi_conf.srcformat))
1132
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
183 {
4828
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
184 ggi_conf.srcdepth = IMGFMT_RGB_DEPTH(ggi_conf.srcformat);
1132
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
185 }
4828
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
186 else
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
187 if (IMGFMT_IS_BGR(ggi_conf.srcformat))
1132
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
188 {
4828
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
189 ggi_conf.srcdepth = IMGFMT_BGR_DEPTH(ggi_conf.srcformat);
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
190 }
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
191 else
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
192 {
5637
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
193 mp_msg(MSGT_VO, MSGL_FATAL, "[ggi] Unknown image format: %s\n",
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
194 vo_format_name(ggi_conf.srcformat));
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
195 return(-1);
1132
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
196 }
1172
290353337b44 hardly modified, keyboard handling is ok. aspect implemented, but bugging :)
al3x
parents: 1148
diff changeset
197
4830
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
198 vo_dwidth = ggi_conf.dstwidth = ggi_conf.gmode.virt.x;
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
199 vo_dheight = ggi_conf.dstheight = ggi_conf.gmode.virt.y;
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
200
5637
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
201 ggi_conf.directbuffer = 1;
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
202
4831
9153d1275b6d do not fault if no directbuffer available (for example: ggi display-multi)
alex
parents: 4830
diff changeset
203 ggi_conf.frames = ggiDBGetNumBuffers(ggi_conf.vis);
9153d1275b6d do not fault if no directbuffer available (for example: ggi display-multi)
alex
parents: 4830
diff changeset
204 if (ggi_conf.frames > GGI_FRAMES)
9153d1275b6d do not fault if no directbuffer available (for example: ggi display-multi)
alex
parents: 4830
diff changeset
205 ggi_conf.frames = GGI_FRAMES;
9153d1275b6d do not fault if no directbuffer available (for example: ggi display-multi)
alex
parents: 4830
diff changeset
206
9153d1275b6d do not fault if no directbuffer available (for example: ggi display-multi)
alex
parents: 4830
diff changeset
207 ggi_conf.currframe = 0;
9153d1275b6d do not fault if no directbuffer available (for example: ggi display-multi)
alex
parents: 4830
diff changeset
208 if (!ggi_conf.frames)
9153d1275b6d do not fault if no directbuffer available (for example: ggi display-multi)
alex
parents: 4830
diff changeset
209 {
5637
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
210 goto db_err;
4831
9153d1275b6d do not fault if no directbuffer available (for example: ggi display-multi)
alex
parents: 4830
diff changeset
211 }
9153d1275b6d do not fault if no directbuffer available (for example: ggi display-multi)
alex
parents: 4830
diff changeset
212
9153d1275b6d do not fault if no directbuffer available (for example: ggi display-multi)
alex
parents: 4830
diff changeset
213 for (i = 0; i < ggi_conf.frames; i++)
4830
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
214 ggi_conf.buffer[i] = NULL;
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
215
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
216 /* get available number of buffers */
4841
5928e94c0d5f older API fixes, support for async mode
alex
parents: 4831
diff changeset
217 for (i = 0; DB = (ggi_directbuffer *)ggiDBGetBuffer(ggi_conf.vis, i),
5928e94c0d5f older API fixes, support for async mode
alex
parents: 4831
diff changeset
218 i < ggi_conf.frames; i++)
1132
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
219 {
4830
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
220 if (!(DB->type & GGI_DB_SIMPLE_PLB) ||
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
221 (DB->page_size != 0) ||
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
222 (DB->write == NULL) ||
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
223 (DB->noaccess != 0) ||
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
224 (DB->align != 0) ||
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
225 (DB->layout != blPixelLinearBuffer))
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
226 continue;
1172
290353337b44 hardly modified, keyboard handling is ok. aspect implemented, but bugging :)
al3x
parents: 1148
diff changeset
227
4830
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
228 ggi_conf.buffer[DB->frame] = DB;
1172
290353337b44 hardly modified, keyboard handling is ok. aspect implemented, but bugging :)
al3x
parents: 1148
diff changeset
229 }
1147
82bbd3ee8ce7 hacked osd working on yv12
al3x
parents: 1145
diff changeset
230
4828
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
231 if (ggi_conf.buffer[0] == NULL)
1132
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
232 {
5637
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
233 goto db_err;
1132
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
234 }
1172
290353337b44 hardly modified, keyboard handling is ok. aspect implemented, but bugging :)
al3x
parents: 1148
diff changeset
235
4828
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
236 for (i = 0; i < ggi_conf.frames; i++)
1132
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
237 {
4828
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
238 if (ggi_conf.buffer[i] == NULL)
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
239 {
4830
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
240 ggi_conf.frames = i-1;
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
241 break;
4828
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
242 }
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
243 }
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
244 ggiSetDisplayFrame(ggi_conf.vis, ggi_conf.currframe);
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
245 ggiSetWriteFrame(ggi_conf.vis, ggi_conf.currframe);
1132
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
246
5637
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
247 goto db_ok;
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
248
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
249 db_err:
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
250 mp_msg(MSGT_VO, MSGL_ERR, "[ggi] direct buffer unavailable, using async mode\n");
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
251 ggi_conf.directbuffer = 0;
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
252 ggiSetFlags(ggi_conf.vis, GGIFLAG_ASYNC);
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
253
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
254 db_ok:
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
255 if (GT_SCHEME(mode.graphtype) == GT_PALETTE)
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
256 ggiSetColorfulPalette(ggi_conf.vis);
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
257
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
258 if (ggiGetFlags(ggi_conf.vis) & GGIFLAG_ASYNC)
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
259 ggi_conf.async = 1;
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
260
4830
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
261 mp_msg(MSGT_VO, MSGL_INFO, "[ggi] input: %dx%dx%d, output: %dx%dx%d, frames: %d\n",
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
262 ggi_conf.srcwidth, ggi_conf.srcheight, ggi_conf.srcdepth,
4841
5928e94c0d5f older API fixes, support for async mode
alex
parents: 4831
diff changeset
263 vo_dwidth, vo_dheight, vo_dbpp, ggi_conf.frames);
5637
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
264 mp_msg(MSGT_VO, MSGL_INFO, "[ggi] directbuffer: %s, async mode: %s\n",
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
265 ggi_conf.directbuffer ? "yes" : "no",
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
266 ggi_conf.async ? "yes" : "no");
4841
5928e94c0d5f older API fixes, support for async mode
alex
parents: 4831
diff changeset
267
5637
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
268 if (ggi_conf.directbuffer)
4841
5928e94c0d5f older API fixes, support for async mode
alex
parents: 4831
diff changeset
269 {
5637
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
270 video_out_ggi.draw_frame = draw_frame_directbuffer;
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
271 video_out_ggi.draw_osd = draw_osd_directbuffer;
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
272 video_out_ggi.flip_page = flip_page_directbuffer;
4841
5928e94c0d5f older API fixes, support for async mode
alex
parents: 4831
diff changeset
273 }
4830
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
274
1132
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
275 return(0);
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
276 }
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
277
1172
290353337b44 hardly modified, keyboard handling is ok. aspect implemented, but bugging :)
al3x
parents: 1148
diff changeset
278 static const vo_info_t *get_info(void)
1132
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
279 {
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
280 return &vo_info;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
281 }
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
282
5637
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
283 static uint32_t get_image(mp_image_t *mpi)
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
284 {
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
285 /* GGI DirectRendering supports (yet) only BGR/RGB modes */
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
286 if (!ggi_conf.directbuffer ||
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
287 #if 1
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
288 (IMGFMT_IS_RGB(mpi->imgfmt) &&
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
289 (IMGFMT_RGB_DEPTH(mpi->imgfmt) != vo_dbpp)) ||
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
290 (IMGFMT_IS_BGR(mpi->imgfmt) &&
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
291 (IMGFMT_BGR_DEPTH(mpi->imgfmt) != vo_dbpp)) ||
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
292 #else
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
293 (mpi->imgfmt != ggi_conf.srcformat) ||
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
294 #endif
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
295 ((mpi->type != MP_IMGTYPE_STATIC) && (mpi->type != MP_IMGTYPE_TEMP)) ||
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
296 (mpi->flags & MP_IMGFLAG_PLANAR) ||
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
297 (mpi->flags & MP_IMGFLAG_YUV) ||
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
298 (mpi->width != ggi_conf.srcwidth) ||
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
299 (mpi->height != ggi_conf.srcheight)
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
300 )
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
301 return(VO_FALSE);
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
302
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
303 if (ggi_conf.frames > 1)
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
304 {
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
305 mp_msg(MSGT_VO, MSGL_WARN, "[ggi] doublebuffering disabled due to directrendering\n");
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
306 ggi_conf.currframe = 0;
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
307 ggi_conf.frames = 1;
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
308 }
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
309
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
310 mpi->planes[0] = ggi_conf.buffer[ggi_conf.currframe]->write;
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
311 mpi->stride[0] = ggi_conf.srcwidth*((ggi_conf.srcdepth+7)/8);
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
312 mpi->flags |= MP_IMGFLAG_DIRECT;
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
313
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
314 return(VO_TRUE);
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
315 }
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
316
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
317 static uint32_t draw_frame_directbuffer(uint8_t *src[])
1132
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
318 {
4828
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
319 int x, y, size;
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
320 unsigned char *ptr, *ptr2, *spt;
5637
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
321
4828
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
322 ggiResourceAcquire(ggi_conf.buffer[ggi_conf.currframe]->resource,
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
323 GGI_ACTYPE_WRITE);
1172
290353337b44 hardly modified, keyboard handling is ok. aspect implemented, but bugging :)
al3x
parents: 1148
diff changeset
324
4828
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
325 ggiSetWriteFrame(ggi_conf.vis, ggi_conf.currframe);
1141
c33f8b7488d1 cleaned up, and merged with my version, also code will be faster too
al3x
parents: 1132
diff changeset
326
5637
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
327 spt = src[0];
4828
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
328 ptr = ggi_conf.buffer[ggi_conf.currframe]->write;
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
329 size = ggi_conf.buffer[ggi_conf.currframe]->buffer.plb.pixelformat->size/8;
5637
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
330
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
331 #if 0
4828
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
332 for (y = 0; y < ggi_conf.srcheight; y++)
1172
290353337b44 hardly modified, keyboard handling is ok. aspect implemented, but bugging :)
al3x
parents: 1148
diff changeset
333 {
4828
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
334 ptr2 = ptr;
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
335 for (x = 0; x < ggi_conf.srcwidth; x++)
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
336 {
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
337 ptr2[0] = *spt++;
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
338 ptr2[1] = *spt++;
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
339 ptr2[2] = *spt++;
4830
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
340 switch(ggi_conf.srcformat)
4828
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
341 {
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
342 case IMGFMT_BGR32:
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
343 case IMGFMT_RGB32:
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
344 spt++;
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
345 break;
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
346 }
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
347 ptr2 += size;
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
348 }
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
349 ptr += ggi_conf.buffer[ggi_conf.currframe]->buffer.plb.stride;
1172
290353337b44 hardly modified, keyboard handling is ok. aspect implemented, but bugging :)
al3x
parents: 1148
diff changeset
350 }
5637
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
351 #else
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
352 mem2agpcpy_pic(ptr, spt, ggi_conf.srcwidth*size, ggi_conf.srcheight,
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
353 ggi_conf.buffer[ggi_conf.currframe]->buffer.plb.stride,
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
354 ggi_conf.srcwidth*ggi_conf.srcdepth/8);
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
355 #endif
1141
c33f8b7488d1 cleaned up, and merged with my version, also code will be faster too
al3x
parents: 1132
diff changeset
356
4828
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
357 ggiResourceRelease(ggi_conf.buffer[ggi_conf.currframe]->resource);
5637
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
358
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
359 return(0);
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
360 }
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
361
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
362
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
363 static uint32_t draw_frame(uint8_t *src[])
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
364 {
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
365 int x, y;
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
366 unsigned char *spt;
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
367 ggi_color col;
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
368
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
369 spt = src[0];
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
370
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
371 for (y = 0; y < ggi_conf.srcheight; y++)
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
372 {
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
373 for (x = 0; x < ggi_conf.srcwidth; x++)
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
374 {
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
375 /* add support for RGB */
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
376 switch(ggi_conf.srcformat)
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
377 {
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
378 case IMGFMT_BGR24:
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
379 case IMGFMT_BGR32:
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
380 col.r = *spt++ << 8;
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
381 col.g = *spt++ << 8;
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
382 col.b = *spt++ << 8;
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
383 if (ggi_conf.srcformat == IMGFMT_BGR32)
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
384 spt++;
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
385 break;
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
386 default:
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
387 mp_msg(MSGT_VO, MSGL_V, "[ggi] unsupported input format\n");
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
388 return(0);
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
389 }
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
390
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
391 // printf("pixel: x:%d, y:%d, r:%d, g:%d, b:%d\n",
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
392 // x, y, col.r, col.b, col.g);
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
393 ggiPutPixel(ggi_conf.vis, x, y, ggiMapColor(ggi_conf.vis, &col));
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
394 }
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
395 }
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
396 ggiFlush(ggi_conf.vis);
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
397
1141
c33f8b7488d1 cleaned up, and merged with my version, also code will be faster too
al3x
parents: 1132
diff changeset
398 return(0);
c33f8b7488d1 cleaned up, and merged with my version, also code will be faster too
al3x
parents: 1132
diff changeset
399 }
1132
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
400
1141
c33f8b7488d1 cleaned up, and merged with my version, also code will be faster too
al3x
parents: 1132
diff changeset
401 static void draw_alpha(int x0, int y0, int w, int h, unsigned char *src,
c33f8b7488d1 cleaned up, and merged with my version, also code will be faster too
al3x
parents: 1132
diff changeset
402 unsigned char *srca, int stride)
c33f8b7488d1 cleaned up, and merged with my version, also code will be faster too
al3x
parents: 1132
diff changeset
403 {
4841
5928e94c0d5f older API fixes, support for async mode
alex
parents: 4831
diff changeset
404 switch(vo_dbpp)
1141
c33f8b7488d1 cleaned up, and merged with my version, also code will be faster too
al3x
parents: 1132
diff changeset
405 {
4830
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
406 case 32:
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
407 vo_draw_alpha_rgb32(w, h, src, srca, stride,
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
408 ggi_conf.buffer[ggi_conf.currframe]->write+4*(ggi_conf.dstwidth*y0+x0), 4*ggi_conf.dstwidth);
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
409 break;
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
410 case 24:
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
411 vo_draw_alpha_rgb24(w, h, src, srca, stride,
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
412 ggi_conf.buffer[ggi_conf.currframe]->write+3*(ggi_conf.dstwidth*y0+x0), 3*ggi_conf.dstwidth);
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
413 break;
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
414 case 16:
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
415 vo_draw_alpha_rgb16(w, h, src, srca, stride,
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
416 ggi_conf.buffer[ggi_conf.currframe]->write+2*(ggi_conf.dstwidth*y0+x0), 2*ggi_conf.dstwidth);
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
417 break;
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
418 case 15:
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
419 vo_draw_alpha_rgb15(w, h, src, srca, stride,
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
420 ggi_conf.buffer[ggi_conf.currframe]->write+2*(ggi_conf.dstwidth*y0+x0), 2*ggi_conf.dstwidth);
2c1dd0b15622 reworked :) should work on low bpp outputs
alex
parents: 4828
diff changeset
421 break;
1141
c33f8b7488d1 cleaned up, and merged with my version, also code will be faster too
al3x
parents: 1132
diff changeset
422 }
1132
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
423 }
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
424
5637
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
425 static void draw_osd_directbuffer(void)
1132
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
426 {
4828
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
427 vo_draw_text(ggi_conf.srcwidth, ggi_conf.srcheight, draw_alpha);
1501
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1198
diff changeset
428 }
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1198
diff changeset
429
5637
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
430 static void draw_osd(void)
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
431 {
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
432 }
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
433
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
434 static void flip_page_directbuffer(void)
1501
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1198
diff changeset
435 {
4828
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
436 ggiSetDisplayFrame(ggi_conf.vis, ggi_conf.currframe);
5637
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
437 mp_dbg(MSGT_VO, MSGL_DBG2, "[ggi] flipping, current write frame: %d, display frame: %d\n",
4828
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
438 ggiGetWriteFrame(ggi_conf.vis), ggiGetDisplayFrame(ggi_conf.vis));
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
439
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
440 ggi_conf.currframe = (ggi_conf.currframe+1) % ggi_conf.frames;
4841
5928e94c0d5f older API fixes, support for async mode
alex
parents: 4831
diff changeset
441
5928e94c0d5f older API fixes, support for async mode
alex
parents: 4831
diff changeset
442 if (ggi_conf.async)
5928e94c0d5f older API fixes, support for async mode
alex
parents: 4831
diff changeset
443 ggiFlush(ggi_conf.vis);
1132
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
444 }
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
445
5637
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
446 static void flip_page(void)
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
447 {
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
448 ggiFlush(ggi_conf.vis);
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
449 }
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
450
1132
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
451 static uint32_t draw_slice(uint8_t *src[], int stride[], int w, int h,
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
452 int x, int y)
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
453 {
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
454 return(0);
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
455 }
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
456
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
457 static uint32_t query_format(uint32_t format)
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
458 {
5637
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
459 ggi_mode mode;
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
460
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
461 if ((!vo_depthonscreen || !vo_dbpp) && ggi_conf.vis)
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
462 {
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
463 if (ggiGetMode(ggi_conf.vis, &mode) == 0)
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
464 {
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
465 vo_depthonscreen = GT_DEPTH(mode.graphtype);
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
466 vo_dbpp = GT_SIZE(mode.graphtype);
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
467 }
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
468 }
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
469
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
470 if ((IMGFMT_IS_BGR(format) && (IMGFMT_BGR_DEPTH(format) == vo_dbpp)) ||
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
471 (IMGFMT_IS_RGB(format) && (IMGFMT_RGB_DEPTH(format) == vo_dbpp)))
1141
c33f8b7488d1 cleaned up, and merged with my version, also code will be faster too
al3x
parents: 1132
diff changeset
472 {
5637
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
473 if (ggi_conf.directbuffer)
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
474 return(3|VFCAP_OSD);
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
475 else
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
476 return(3);
1132
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
477 }
5637
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
478
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
479 if (IMGFMT_IS_BGR(format) || IMGFMT_IS_RGB(format))
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
480 {
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
481 if (ggi_conf.directbuffer)
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
482 return(1|VFCAP_OSD);
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
483 else
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
484 return(1);
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
485 }
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
486
1141
c33f8b7488d1 cleaned up, and merged with my version, also code will be faster too
al3x
parents: 1132
diff changeset
487 return(0);
1132
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
488 }
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
489
4828
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
490 static uint32_t preinit(const char *arg)
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
491 {
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
492 if (ggiInit() != 0)
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
493 {
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
494 mp_msg(MSGT_VO, MSGL_FATAL, "[ggi] unable to initialize GGI\n");
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
495 return(-1);
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
496 }
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
497
4841
5928e94c0d5f older API fixes, support for async mode
alex
parents: 4831
diff changeset
498 if ((char *)arg)
5928e94c0d5f older API fixes, support for async mode
alex
parents: 4831
diff changeset
499 ggi_conf.driver = strdup(arg);
4828
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
500 else
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
501 ggi_conf.driver = NULL;
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
502
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
503 if ((ggi_conf.vis = ggiOpen(ggi_conf.driver)) == NULL)
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
504 {
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
505 mp_msg(MSGT_VO, MSGL_FATAL, "[ggi] unable to open '%s' output\n",
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
506 (ggi_conf.driver == NULL) ? "default" : ggi_conf.driver);
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
507 ggiExit();
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
508 return(-1);
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
509 }
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
510
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
511 mp_msg(MSGT_VO, MSGL_V, "[ggi] using '%s' output\n",
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
512 (ggi_conf.driver == NULL) ? "default" : ggi_conf.driver);
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
513
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
514 return 0;
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
515 }
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
516
1132
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
517 static void uninit(void)
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
518 {
4841
5928e94c0d5f older API fixes, support for async mode
alex
parents: 4831
diff changeset
519 if (ggi_conf.driver)
5928e94c0d5f older API fixes, support for async mode
alex
parents: 4831
diff changeset
520 free(ggi_conf.driver);
1172
290353337b44 hardly modified, keyboard handling is ok. aspect implemented, but bugging :)
al3x
parents: 1148
diff changeset
521 ggiClose(ggi_conf.vis);
1132
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
522 ggiExit();
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
523 }
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
524
4841
5928e94c0d5f older API fixes, support for async mode
alex
parents: 4831
diff changeset
525 #ifdef GGI_GAMMA
5928e94c0d5f older API fixes, support for async mode
alex
parents: 4831
diff changeset
526 /* GAMMA handling */
5928e94c0d5f older API fixes, support for async mode
alex
parents: 4831
diff changeset
527 static int ggi_get_video_eq(vidix_video_eq_t *info)
5928e94c0d5f older API fixes, support for async mode
alex
parents: 4831
diff changeset
528 {
5928e94c0d5f older API fixes, support for async mode
alex
parents: 4831
diff changeset
529 memset(info, 0, sizeof(vidix_video_eq_t));
5928e94c0d5f older API fixes, support for async mode
alex
parents: 4831
diff changeset
530 }
5637
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
531 #endif
4841
5928e94c0d5f older API fixes, support for async mode
alex
parents: 4831
diff changeset
532
5928e94c0d5f older API fixes, support for async mode
alex
parents: 4831
diff changeset
533 static void query_vaa(vo_vaa_t *vaa)
5928e94c0d5f older API fixes, support for async mode
alex
parents: 4831
diff changeset
534 {
5928e94c0d5f older API fixes, support for async mode
alex
parents: 4831
diff changeset
535 memset(vaa, 0, sizeof(vo_vaa_t));
5637
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
536 #ifdef GGI_GAMMA
4841
5928e94c0d5f older API fixes, support for async mode
alex
parents: 4831
diff changeset
537 vaa->get_video_eq = ggi_get_video_eq;
5928e94c0d5f older API fixes, support for async mode
alex
parents: 4831
diff changeset
538 vaa->set_video_eq = ggi_set_video_eq;
5637
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
539 #endif
4841
5928e94c0d5f older API fixes, support for async mode
alex
parents: 4831
diff changeset
540 }
5928e94c0d5f older API fixes, support for async mode
alex
parents: 4831
diff changeset
541
4828
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
542 static uint32_t control(uint32_t request, void *data, ...)
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
543 {
5637
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
544 switch(request)
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
545 {
4841
5928e94c0d5f older API fixes, support for async mode
alex
parents: 4831
diff changeset
546 #ifdef GGI_GAMMA
5637
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
547 case VOCTRL_QUERY_VAA:
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
548 query_vaa((vo_vaa_t*)data);
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
549 return VO_TRUE;
4841
5928e94c0d5f older API fixes, support for async mode
alex
parents: 4831
diff changeset
550 #endif
5637
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
551 case VOCTRL_QUERY_FORMAT:
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
552 return query_format(*((uint32_t*)data));
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
553 case VOCTRL_GET_IMAGE:
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
554 return get_image(data);
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
555 }
6890819bc0dc added support for directrendering, updated to VFCAP_ flags in query_format, added support for non-directbuffer devices, and using mem2agpcpy_pic
alex
parents: 4841
diff changeset
556 return VO_NOTIMPL;
4828
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
557 }
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
558
4841
5928e94c0d5f older API fixes, support for async mode
alex
parents: 4831
diff changeset
559 /* EVENT handling */
1143
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
560 #include "../linux/keycodes.h"
1172
290353337b44 hardly modified, keyboard handling is ok. aspect implemented, but bugging :)
al3x
parents: 1148
diff changeset
561 extern void mplayer_put_key(int code);
290353337b44 hardly modified, keyboard handling is ok. aspect implemented, but bugging :)
al3x
parents: 1148
diff changeset
562
1132
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
563 static void check_events(void)
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
564 {
1143
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
565 struct timeval tv = {0, 0};
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
566 ggi_event event;
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
567 ggi_event_mask mask;
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
568
1172
290353337b44 hardly modified, keyboard handling is ok. aspect implemented, but bugging :)
al3x
parents: 1148
diff changeset
569 if ((mask = ggiEventPoll(ggi_conf.vis, emAll, &tv)))
290353337b44 hardly modified, keyboard handling is ok. aspect implemented, but bugging :)
al3x
parents: 1148
diff changeset
570 if (ggiEventRead(ggi_conf.vis, &event, emAll) != 0)
1143
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
571 {
4828
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
572 mp_dbg(MSGT_VO, MSGL_DBG3, "type: %4x, origin: %4x, sym: %4x, label: %4x, button=%4x\n",
1172
290353337b44 hardly modified, keyboard handling is ok. aspect implemented, but bugging :)
al3x
parents: 1148
diff changeset
573 event.any.origin, event.any.type, event.key.sym, event.key.label, event.key.button);
1143
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
574
1172
290353337b44 hardly modified, keyboard handling is ok. aspect implemented, but bugging :)
al3x
parents: 1148
diff changeset
575 if (event.key.type == evKeyPress)
1143
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
576 {
1172
290353337b44 hardly modified, keyboard handling is ok. aspect implemented, but bugging :)
al3x
parents: 1148
diff changeset
577 switch(event.key.sym)
1143
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
578 {
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
579 case GIIK_PAsterisk: /* PStar */
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
580 case GIIUC_Asterisk:
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
581 mplayer_put_key('*');
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
582 break;
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
583 case GIIK_PSlash:
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
584 case GIIUC_Slash:
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
585 mplayer_put_key('/');
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
586 break;
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
587 case GIIK_PPlus:
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
588 case GIIUC_Plus:
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
589 mplayer_put_key('+');
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
590 break;
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
591 case GIIK_PMinus:
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
592 case GIIUC_Minus:
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
593 mplayer_put_key('-');
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
594 break;
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
595 case GIIUC_o:
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
596 case GIIUC_O:
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
597 mplayer_put_key('o');
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
598 break;
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
599 case GIIUC_g:
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
600 case GIIUC_G:
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
601 mplayer_put_key('g');
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
602 break;
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
603 case GIIUC_z:
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
604 case GIIUC_Z:
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
605 mplayer_put_key('z');
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
606 break;
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
607 case GIIUC_x:
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
608 case GIIUC_X:
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
609 mplayer_put_key('x');
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
610 break;
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
611 case GIIUC_m:
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
612 case GIIUC_M:
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
613 mplayer_put_key('m');
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
614 break;
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
615 case GIIUC_d:
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
616 case GIIUC_D:
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
617 mplayer_put_key('d');
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
618 break;
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
619 case GIIUC_q:
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
620 case GIIUC_Q:
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
621 mplayer_put_key('q');
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
622 break;
4828
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
623 case GIIUC_h:
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
624 case GIIUC_H:
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
625 mplayer_put_key('h');
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
626 break;
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
627 case GIIUC_l:
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
628 case GIIUC_L:
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
629 mplayer_put_key('l');
0ae597cc28e6 totally reworked, working fine on fbdev too, applied Andres Beck's patches, quad-buffering support
alex
parents: 4737
diff changeset
630 break;
1143
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
631 case GIIUC_Space:
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
632 case GIIUC_p:
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
633 case GIIUC_P:
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
634 mplayer_put_key('p');
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
635 break;
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
636 case GIIK_Up:
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
637 mplayer_put_key(KEY_UP);
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
638 break;
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
639 case GIIK_Down:
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
640 mplayer_put_key(KEY_DOWN);
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
641 break;
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
642 case GIIK_Left:
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
643 mplayer_put_key(KEY_LEFT);
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
644 break;
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
645 case GIIK_Right:
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
646 mplayer_put_key(KEY_RIGHT);
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
647 break;
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
648 case GIIK_PageUp:
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
649 mplayer_put_key(KEY_PAGE_UP);
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
650 break;
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
651 case GIIK_PageDown:
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
652 mplayer_put_key(KEY_PAGE_DOWN);
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
653 break;
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
654 default:
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
655 break;
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
656 }
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
657 }
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
658 }
a9d985d6aa91 key controlling implemented
al3x
parents: 1141
diff changeset
659 return;
1132
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
660 }