Mercurial > mplayer.hg
annotate libvo/vo_xvr100.c @ 30021:7f09bc7a4279
Make the check for X11 and WIN32 backends for OpenGL separate.
This fixes compilation on Windows with X11 but no GLX available.
author | reimar |
---|---|
date | Sat, 19 Dec 2009 10:52:32 +0000 |
parents | 8df85ad26746 |
children | fbe5c829c69b |
rev | line source |
---|---|
23985 | 1 /* |
2 * SUN XVR-100 (ATI Radeon 7000) VO driver for SPARC Solaris(at least) | |
3 * | |
4 * Copyright (C) 2000-2004 Robin Kay <komadori [at] gekkou [dot] co [dot] uk> | |
5 * Copyright (C) 2004 Jake Goerzen | |
6 * Copyright (C) 2007 Denes Balatoni | |
7 * | |
8 * written for xine by | |
9 * Robin Kay <komadori [at] gekkou [dot] co [dot] uk> | |
10 * | |
11 * Sun XVR-100 framebuffer graciously donated by Jake Goerzen. | |
12 * | |
13 * Ported to mplayer by Denes Balatoni | |
14 * Contains portions from the mga and tdfix_vid vo drivers | |
15 * | |
16 * no double-buffering, as it would slow down playback (waiting for vertical retraces) | |
17 * FIXME: only YV12 supported for now | |
18 * | |
19 * This file is part of MPlayer. | |
20 * | |
21 * MPlayer is free software; you can redistribute it and/or modify | |
22 * it under the terms of the GNU General Public License as published by | |
23 * the Free Software Foundation; either version 2 of the License, or | |
24 * (at your option) any later version. | |
25 * | |
26 * MPlayer is distributed in the hope that it will be useful, | |
27 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
28 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
29 * GNU General Public License for more details. | |
30 * | |
26739
2a34d9fa52ab
Use standard license headers with standard formatting.
diego
parents:
25525
diff
changeset
|
31 * You should have received a copy of the GNU General Public License along |
2a34d9fa52ab
Use standard license headers with standard formatting.
diego
parents:
25525
diff
changeset
|
32 * with MPlayer; if not, write to the Free Software Foundation, Inc., |
2a34d9fa52ab
Use standard license headers with standard formatting.
diego
parents:
25525
diff
changeset
|
33 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
23985 | 34 */ |
35 | |
36 #include <stdlib.h> | |
37 #include <stdio.h> | |
38 #include <unistd.h> | |
39 #include <fcntl.h> | |
40 #include <sys/fbio.h> | |
41 #include <sys/visual_io.h> | |
42 #include <strings.h> | |
43 #include <sys/mman.h> | |
44 | |
45 #include "config.h" | |
46 #include "video_out.h" | |
47 #include "video_out_internal.h" | |
48 #include "aspect.h" | |
49 #include "geometry.h" | |
50 #include "fastmemcpy.h" | |
25525 | 51 #include "sub.h" |
23985 | 52 #include "mp_msg.h" |
53 | |
54 | |
25216 | 55 static const vo_info_t info = { |
23985 | 56 "sun xvr-100", |
57 "xvr100", | |
58 "Denes Balatoni", | |
59 "" | |
60 }; | |
61 | |
25220
c9e9ac2008c2
Mark the vo_functions_t definitions as const where possible.
reimar
parents:
25216
diff
changeset
|
62 const LIBVO_EXTERN(xvr100) |
23985 | 63 |
64 #define PFB_VRAM_MMAPBASE 0x08000000 | |
65 #define PFB_VRAM_MMAPLEN 0x04000000 /* depends on memory size */ | |
66 #define PFB_REGS_MMAPBASE 0x10000000 | |
67 #define PFB_REGS_MMAPLEN 0x00040000 | |
68 | |
69 #define PFB_CLOCK_CNTL_INDEX 0x002 | |
70 #define PFB_CLOCK_CNTL_DATA 0x003 | |
71 | |
72 #define PFB_MC_FB_LOCATION 0x052 | |
73 | |
74 #define PFB_OV0_Y_X_START 0x100 | |
75 #define PFB_OV0_Y_X_END 0x101 | |
76 #define PFB_OV0_REG_LOAD_CNTL 0x104 | |
77 #define PFB_OV0_REG_LOAD_LOCK 0x00000001 | |
78 #define PFB_OV0_REG_LOAD_LOCK_READBACK 0x00000008 | |
79 #define PFB_OV0_SCALE_CNTL 0x108 | |
80 #define PFB_OV0_SCALE_EN 0x417f0000/*417f0000*/ | |
81 #define PFB_OV0_SCALE_YUV12 0x00000A00 | |
82 #define PFB_OV0_SCALE_VYUY422 0x00000B00 | |
83 #define PFB_OV0_V_INC 0x109 | |
84 #define PFB_OV0_P1_V_ACCUM_INIT 0x10A | |
85 #define PFB_OV0_P23_V_ACCUM_INIT 0x10B | |
86 #define PFB_OV0_P1_BLANK_LINES_AT_TOP 0x10C | |
87 #define PFB_OV0_P23_BLANK_LINES_AT_TOP 0x10D | |
88 #define PFB_OV0_BASE_ADDR 0x10F | |
89 #define PFB_OV0_BUF0_BASE_ADRS 0x110 | |
90 #define PFB_OV0_BUF1_BASE_ADRS 0x111 | |
91 #define PFB_OV0_BUF2_BASE_ADRS 0x112 | |
92 #define PFB_OV0_BUF3_BASE_ADRS 0x113 | |
93 #define PFB_OV0_BUF4_BASE_ADRS 0x114 | |
94 #define PFB_OV0_BUF5_BASE_ADRS 0x115 | |
95 #define PFB_OV0_VID_BUF_PITCH0_VALUE 0x118 | |
96 #define PFB_OV0_VID_BUF_PITCH1_VALUE 0x119 | |
97 #define PFB_OV0_AUTO_FLIP_CNTL 0x11C | |
98 #define PFB_OV0_AUTO_FLIP_BUF0 0x00000200 | |
99 #define PFB_OV0_AUTO_FLIP_BUF3 0x00000243 | |
100 #define PFB_OV0_DEINTERLACE_PATTERN 0x11D | |
101 #define PFB_OV0_H_INC 0x120 | |
102 #define PFB_OV0_STEP_BY 0x121 | |
103 #define PFB_OV0_P1_H_ACCUM_INIT 0x122 | |
104 #define PFB_OV0_P23_H_ACCUM_INIT 0x123 | |
105 #define PFB_OV0_P1_X_START_END 0x125 | |
106 #define PFB_OV0_P2_X_START_END 0x126 | |
107 #define PFB_OV0_P3_X_START_END 0x127 | |
108 #define PFB_OV0_FILTER_CNTL 0x128 | |
109 #define PFB_OV0_FILTER_EN 0x0000000f | |
110 #define PFB_OV0_GRPH_KEY_CLR_LOW 0x13B | |
111 #define PFB_OV0_GRPH_KEY_CLR_HIGH 0x13C | |
112 #define PFB_OV0_KEY_CNTL 0x13D | |
113 #define PFB_OV0_KEY_EN 0x00000121 | |
114 | |
115 #define PFB_DISP_MERGE_CNTL 0x358 | |
116 #define PFB_DISP_MERGE_EN 0xffff0000 | |
117 | |
118 | |
119 | |
120 static char pfb_devname[]="/dev/fbs/pfb0"; | |
121 static int pfb_devfd; | |
122 static uint8_t *pfb_vbase; | |
123 static volatile uint32_t *pfb_vregs; | |
124 static int pfb_buffer[3]; | |
125 static int pfb_stride[3]; | |
126 static int pfb_srcwidth, pfb_srcheight, pfb_dstwidth, pfb_dstheight; | |
127 static int pfb_native_format=PFB_OV0_SCALE_YUV12; | |
128 static int pfb_deinterlace_en=0; | |
129 static short int pfb_wx0, pfb_wy0, pfb_wx1, pfb_wy1; | |
130 static int pfb_xres,pfb_yres; | |
131 static int pfb_free_top; | |
132 static int pfb_fs; | |
133 static int pfb_usecolorkey=0; | |
134 static uint32_t pfb_colorkey; | |
135 | |
136 | |
137 | |
28232
8df85ad26746
Add missing 'void' keyword to parameterless function declarations.
diego
parents:
26739
diff
changeset
|
138 void pfb_overlay_on(void) { |
25524 | 139 int h_inc, h_step, ecp_div; |
23985 | 140 |
141 pfb_vregs[PFB_CLOCK_CNTL_INDEX] = (pfb_vregs[PFB_CLOCK_CNTL_INDEX] & ~0x0000003f) | 0x00000008; | |
142 ecp_div = (pfb_vregs[PFB_CLOCK_CNTL_DATA] >> 8) & 0x3; | |
143 h_inc = (pfb_srcwidth << (12 + ecp_div)) / pfb_dstwidth; | |
144 h_step = 1; | |
145 | |
146 while (h_inc > 0x1fff) { | |
147 h_inc >>= 1; | |
148 h_step++; | |
149 } | |
150 | |
151 pfb_vregs[PFB_OV0_REG_LOAD_CNTL] = PFB_OV0_REG_LOAD_LOCK; | |
152 while (!(pfb_vregs[PFB_OV0_REG_LOAD_CNTL] & PFB_OV0_REG_LOAD_LOCK_READBACK)) | |
153 usleep(100); | |
154 | |
155 pfb_vregs[PFB_DISP_MERGE_CNTL] = PFB_DISP_MERGE_EN; | |
156 pfb_vregs[PFB_OV0_Y_X_START] = (pfb_wy0 << 16) | pfb_wx0; | |
157 pfb_vregs[PFB_OV0_Y_X_END] = ((pfb_wy1 - 1) << 16) | (pfb_wx1 - 1); | |
158 pfb_vregs[PFB_OV0_V_INC] = ((pfb_deinterlace_en ? pfb_srcheight/2 : pfb_srcheight) << 20) / pfb_dstheight; | |
159 pfb_vregs[PFB_OV0_P1_V_ACCUM_INIT] = 0x00180001; | |
160 pfb_vregs[PFB_OV0_P23_V_ACCUM_INIT] = 0x00180001; | |
161 pfb_vregs[PFB_OV0_P1_BLANK_LINES_AT_TOP] = (((pfb_deinterlace_en ? pfb_srcheight/2 : pfb_srcheight) - 1) << 16) | 0xfff; | |
162 pfb_vregs[PFB_OV0_P23_BLANK_LINES_AT_TOP] = (((pfb_deinterlace_en ? pfb_srcheight/2 : pfb_srcheight) / 2 - 1) << 16) | 0x7ff; | |
163 pfb_vregs[PFB_OV0_BASE_ADDR] = (pfb_vregs[PFB_MC_FB_LOCATION] & 0xffff) << 16; | |
164 pfb_vregs[PFB_OV0_VID_BUF_PITCH0_VALUE] = pfb_deinterlace_en ? pfb_stride[0]*2 : pfb_stride[0]; | |
165 pfb_vregs[PFB_OV0_VID_BUF_PITCH1_VALUE] = pfb_deinterlace_en ? pfb_stride[1]*2 : pfb_stride[1]; | |
166 pfb_vregs[PFB_OV0_DEINTERLACE_PATTERN] = 0x000aaaaa; | |
167 pfb_vregs[PFB_OV0_H_INC] = ((h_inc / 2) << 16) | h_inc; | |
168 pfb_vregs[PFB_OV0_STEP_BY] = (h_step << 8) | h_step; | |
169 pfb_vregs[PFB_OV0_P1_H_ACCUM_INIT] = (((0x00005000 + h_inc) << 7) & 0x000f8000) | (((0x00005000 + h_inc) << 15) & 0xf0000000); | |
170 pfb_vregs[PFB_OV0_P23_H_ACCUM_INIT] = (((0x0000A000 + h_inc) << 6) & 0x000f8000) | (((0x0000A000 + h_inc) << 14) & 0x70000000); | |
171 pfb_vregs[PFB_OV0_P1_X_START_END] = pfb_srcwidth - 1; | |
172 pfb_vregs[PFB_OV0_P2_X_START_END] = (pfb_srcwidth / 2) - 1; | |
173 pfb_vregs[PFB_OV0_P3_X_START_END] = (pfb_srcwidth / 2) - 1; | |
174 pfb_vregs[PFB_OV0_FILTER_CNTL] = PFB_OV0_FILTER_EN; | |
175 | |
176 if (pfb_usecolorkey) { | |
177 pfb_vregs[PFB_OV0_GRPH_KEY_CLR_LOW] = pfb_colorkey; | |
178 pfb_vregs[PFB_OV0_GRPH_KEY_CLR_HIGH] = pfb_colorkey | 0xff000000; | |
179 pfb_vregs[PFB_OV0_KEY_CNTL] = PFB_OV0_KEY_EN; | |
180 } else { | |
181 pfb_vregs[PFB_OV0_KEY_CNTL] = 0x010; | |
182 } | |
183 | |
184 pfb_vregs[PFB_OV0_SCALE_CNTL] = PFB_OV0_SCALE_EN | pfb_native_format; | |
185 | |
186 pfb_vregs[PFB_OV0_REG_LOAD_CNTL] = 0; | |
187 | |
188 pfb_vregs[PFB_OV0_BUF0_BASE_ADRS] = pfb_buffer[0]; | |
189 pfb_vregs[PFB_OV0_BUF1_BASE_ADRS] = pfb_buffer[1] | 0x00000001; | |
190 pfb_vregs[PFB_OV0_BUF2_BASE_ADRS] = pfb_buffer[2] | 0x00000001; | |
191 | |
192 pfb_vregs[PFB_OV0_AUTO_FLIP_CNTL] = PFB_OV0_AUTO_FLIP_BUF0; | |
193 } | |
194 | |
28232
8df85ad26746
Add missing 'void' keyword to parameterless function declarations.
diego
parents:
26739
diff
changeset
|
195 void pfb_overlay_off(void) { |
23985 | 196 pfb_vregs[PFB_OV0_SCALE_CNTL] = 0; |
197 } | |
198 | |
28232
8df85ad26746
Add missing 'void' keyword to parameterless function declarations.
diego
parents:
26739
diff
changeset
|
199 void center_overlay(void) { |
23985 | 200 if (pfb_xres > pfb_dstwidth) { |
201 pfb_wx0 = (pfb_xres - pfb_dstwidth) / 2; | |
202 pfb_wx1 = pfb_wx0 + pfb_dstwidth; | |
203 } | |
204 else { | |
205 pfb_wx0 = 0; | |
206 pfb_wx1 = pfb_xres; | |
207 } | |
208 | |
209 if (pfb_yres > pfb_dstheight) { | |
210 pfb_wy0 = (pfb_yres - pfb_dstheight) / 2; | |
211 pfb_wy1 = pfb_wy0 + pfb_dstheight; | |
212 } | |
213 else { | |
214 pfb_wy0 = 0; | |
215 pfb_wy1 = pfb_yres; | |
216 } | |
217 } | |
218 | |
219 static int config(uint32_t width, uint32_t height, uint32_t d_width, | |
220 uint32_t d_height, uint32_t flags, char *title, | |
221 uint32_t format) { | |
222 int memsize; | |
223 | |
224 pfb_srcwidth=width; | |
225 pfb_srcheight=height; | |
226 | |
227 if (pfb_srcwidth>1536) | |
228 mp_msg(MSGT_VO, MSGL_WARN, "vo_xvr100: XVR-100 can not handle width greater than 1536 pixels!\n"); | |
229 | |
230 if (!(flags & VOFLAG_XOVERLAY_SUB_VO)) { | |
231 aspect_save_orig(width,height); | |
232 aspect_save_prescale(d_width,d_height); | |
233 aspect_save_screenres(pfb_xres,pfb_yres); | |
234 if( flags&VOFLAG_FULLSCREEN) { /* -fs */ | |
235 aspect(&pfb_dstwidth,&pfb_dstheight, A_ZOOM); | |
236 pfb_fs = 1; | |
237 } else { | |
238 aspect(&pfb_dstwidth,&pfb_dstheight, A_NOZOOM); | |
239 pfb_fs = 0; | |
240 } | |
241 } else { | |
242 pfb_dstwidth=d_width; | |
243 pfb_dstheight=d_height; | |
244 } | |
245 | |
246 center_overlay(); | |
247 | |
248 pfb_stride[0]=(pfb_srcwidth+15) & ~15; | |
249 pfb_stride[1]=pfb_stride[2]=(((pfb_srcwidth+1)>>1)+15) & ~15; | |
250 memsize = (pfb_stride[0]*pfb_srcheight+pfb_stride[1]*((pfb_srcheight+1) & ~1)); | |
251 if (memsize > pfb_free_top) { | |
252 mp_msg(MSGT_VO, MSGL_FATAL, "vo_xvr100: out of VRAM! \n"); | |
253 return 1; | |
254 } | |
255 pfb_buffer[0] = pfb_free_top - memsize; | |
256 pfb_buffer[1] = pfb_buffer[0] + pfb_stride[0]*pfb_srcheight; | |
257 pfb_buffer[2] = pfb_buffer[1] + pfb_stride[1]*((pfb_srcheight+1)>>1); | |
258 | |
259 pfb_overlay_on(); | |
260 | |
261 return 0; | |
262 } | |
263 | |
264 static int preinit(const char *arg) { | |
265 struct vis_identifier ident; | |
266 struct fbgattr attr; | |
267 | |
268 if ((pfb_devfd = open(pfb_devname, O_RDWR)) < 0) { | |
269 mp_msg(MSGT_VO, MSGL_ERR, "vo_xvr100: Error: can't open framebuffer device '%s'\n", pfb_devname); | |
270 return 1; | |
271 } | |
272 | |
273 if (ioctl(pfb_devfd, VIS_GETIDENTIFIER, &ident) < 0) { | |
274 mp_msg(MSGT_VO, MSGL_ERR, "vo_xvr100: Error: ioctl failed (VIS_GETIDENTIFIER), bad device (%s)\n", pfb_devname); | |
275 return 1; | |
276 } | |
277 | |
278 if (strcmp("SUNWpfb", ident.name) == 0) { | |
279 mp_msg(MSGT_VO, MSGL_INFO, "vo_xvr100: SUNWpfb (XVR-100/ATI Radeon 7000) detected \n"); | |
280 } | |
281 else { | |
282 mp_msg(MSGT_VO, MSGL_ERR, "vo_xvr100: Error: '%s' is not a SUN XVR-100 framebuffer device\n", pfb_devname); | |
283 return 1; | |
284 } | |
285 | |
286 if (ioctl(pfb_devfd, FBIOGATTR, &attr) < 0) { | |
287 mp_msg(MSGT_VO, MSGL_ERR, "vo_xvr100: Error: ioctl failed (FBIOGATTR)\n"); | |
288 close(pfb_devfd); | |
289 return 1; | |
290 } | |
291 | |
292 pfb_free_top = attr.fbtype.fb_size - 0x2000; | |
293 pfb_xres = attr.fbtype.fb_width; | |
294 pfb_yres = attr.fbtype.fb_height; | |
295 | |
296 if ((pfb_vbase = mmap(NULL, PFB_VRAM_MMAPLEN, PROT_READ | PROT_WRITE, | |
297 MAP_SHARED, pfb_devfd, PFB_VRAM_MMAPBASE)) == MAP_FAILED) { | |
298 mp_msg(MSGT_VO, MSGL_ERR, "vo_xvr100: Error: unable to memory map framebuffer\n"); | |
299 close(pfb_devfd); | |
300 return 1; | |
301 } | |
302 | |
303 if ((pfb_vregs = (uint32_t *)(void *)mmap(NULL, PFB_REGS_MMAPLEN, PROT_READ | PROT_WRITE, | |
304 MAP_SHARED, pfb_devfd, PFB_REGS_MMAPBASE)) == MAP_FAILED) { | |
305 mp_msg(MSGT_VO, MSGL_ERR, "vo_xvr100: Error: unable to memory map framebuffer\n"); | |
306 munmap(pfb_vbase, PFB_VRAM_MMAPLEN); | |
307 close(pfb_devfd); | |
308 return 1; | |
309 } | |
310 | |
311 return 0; | |
312 } | |
313 | |
314 static void uninit(void) | |
315 { | |
316 if (!vo_config_count) | |
317 return; | |
318 | |
319 pfb_overlay_off(); | |
320 munmap(pfb_vbase, PFB_VRAM_MMAPLEN); | |
321 munmap(pfb_vregs, PFB_REGS_MMAPLEN); | |
322 } | |
323 | |
28232
8df85ad26746
Add missing 'void' keyword to parameterless function declarations.
diego
parents:
26739
diff
changeset
|
324 static uint32_t pfb_fullscreen(void) { |
23985 | 325 if (!pfb_fs) { |
326 aspect(&pfb_dstwidth,&pfb_dstheight, A_ZOOM); | |
327 pfb_fs = 1; | |
328 } else { | |
329 aspect(&pfb_dstwidth,&pfb_dstheight, A_NOZOOM); | |
330 pfb_fs = 0; | |
331 } | |
332 | |
333 center_overlay(); | |
334 | |
335 pfb_overlay_on(); | |
336 | |
337 return VO_TRUE; | |
338 } | |
339 | |
340 static void draw_alpha(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride){ | |
341 vo_draw_alpha_yv12(w,h,src,srca,stride,pfb_vbase+pfb_buffer[0]+pfb_stride[0]*y0+x0,pfb_stride[0]); | |
342 } | |
343 | |
344 static void draw_osd(void) | |
345 { | |
346 vo_draw_text(pfb_srcwidth, pfb_srcheight,draw_alpha); | |
347 } | |
348 | |
349 static void check_events(void) | |
350 { | |
351 } | |
352 | |
353 static void flip_page(void) | |
354 { | |
355 } | |
356 | |
357 static uint32_t get_image(mp_image_t *mpi){ | |
358 if (mpi->flags&MP_IMGFLAG_READABLE) return VO_FALSE; | |
359 if (!(mpi->flags&MP_IMGFLAG_PLANAR)) return VO_FALSE; // FIXME: impossible for YV12, right? | |
360 if (!(mpi->flags&MP_IMGFLAG_ACCEPT_STRIDE)) return VO_FALSE; | |
361 | |
362 mpi->planes[0]=pfb_vbase + pfb_buffer[0]; | |
363 mpi->planes[1]=pfb_vbase + pfb_buffer[1]; | |
364 mpi->planes[2]=pfb_vbase + pfb_buffer[2]; | |
365 mpi->stride[0]=pfb_stride[0]; | |
366 mpi->stride[1]=mpi->stride[2]=pfb_stride[1]; | |
367 mpi->flags|=MP_IMGFLAG_DIRECT; | |
368 | |
369 return VO_TRUE; | |
370 } | |
371 | |
372 static int draw_frame(uint8_t *src[]) | |
373 { | |
374 mp_msg(MSGT_VO,MSGL_WARN,"!!! vo_xvr100::draw_frame() called !!!\n"); | |
375 return 0; | |
376 } | |
377 | |
378 | |
379 static int draw_slice(uint8_t *src[], int stride[], int w,int h,int x,int y) | |
380 { | |
381 mem2agpcpy_pic(pfb_vbase + pfb_buffer[0] + pfb_stride[0] * y + x, src[0], w, h, pfb_stride[0], stride[0]); | |
382 w>>=1; h>>=1; x>>=1; y>>=1; | |
383 mem2agpcpy_pic(pfb_vbase + pfb_buffer[1] + pfb_stride[1] * y + x, src[1], w, h, pfb_stride[1], stride[1]); | |
384 mem2agpcpy_pic(pfb_vbase + pfb_buffer[2] + pfb_stride[1] * y + x, src[2], w, h, pfb_stride[1], stride[2]); | |
385 | |
386 return 0; | |
387 } | |
388 | |
389 | |
390 static uint32_t draw_image(mp_image_t *mpi){ | |
391 // if -dr or -slices then do nothing: | |
392 if (mpi->flags&(MP_IMGFLAG_DIRECT|MP_IMGFLAG_DRAW_CALLBACK)) return VO_TRUE; | |
393 | |
394 draw_slice(mpi->planes,mpi->stride,mpi->w,mpi->h,0,0); | |
395 | |
396 return VO_TRUE; | |
397 } | |
398 | |
399 static uint32_t pfb_set_colorkey(mp_colorkey_t* colork) { | |
400 pfb_colorkey = colork->x11; | |
401 pfb_usecolorkey = 1; | |
402 | |
403 pfb_overlay_on(); | |
404 | |
405 return VO_TRUE; | |
406 } | |
407 | |
408 static uint32_t pfb_set_window(mp_win_t* w) { | |
409 pfb_dstwidth = w->w; | |
410 pfb_dstheight = w->h; | |
411 pfb_wx0 = w->x; | |
412 pfb_wy0 = w->y; | |
413 pfb_wx1 = w->x + pfb_dstwidth; | |
414 pfb_wy1 = w->y + pfb_dstheight; | |
415 | |
416 pfb_overlay_on(); | |
417 | |
418 return VO_TRUE; | |
419 } | |
420 | |
421 static int query_format(uint32_t format) | |
422 { | |
423 switch(format){ | |
424 case IMGFMT_YV12: | |
425 case IMGFMT_I420: | |
426 return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW |VFCAP_HWSCALE_UP|VFCAP_HWSCALE_DOWN|VFCAP_ACCEPT_STRIDE; | |
427 } | |
428 return 0; | |
429 } | |
430 | |
431 static int control(uint32_t request, void *data, ...) | |
432 { | |
433 switch (request) { | |
434 case VOCTRL_GET_IMAGE: | |
435 return get_image(data); | |
436 case VOCTRL_QUERY_FORMAT: | |
437 return query_format(*((uint32_t*)data)); | |
438 case VOCTRL_DRAW_IMAGE: | |
439 return draw_image(data); | |
440 case VOCTRL_FULLSCREEN: | |
441 return pfb_fullscreen(); | |
442 case VOCTRL_XOVERLAY_SUPPORT: | |
443 return VO_TRUE; | |
444 case VOCTRL_XOVERLAY_SET_COLORKEY: | |
445 return pfb_set_colorkey(data); | |
446 case VOCTRL_XOVERLAY_SET_WIN: | |
447 return pfb_set_window(data); | |
448 } | |
449 | |
450 return VO_NOTIMPL; | |
451 } |