summaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-multimedia/mplayer
diff options
context:
space:
mode:
authorMartin Jansa <Martin.Jansa@gmail.com>2011-11-07 12:22:49 +0100
committerMartin Jansa <Martin.Jansa@gmail.com>2011-12-06 11:19:08 +0100
commit78add3cb4853a6c50ac4f8b41f92b85d6c31a6b3 (patch)
tree143eb119b37dfd0012a8c27ff8c59deaeaf91039 /meta-oe/recipes-multimedia/mplayer
parent084fc20cd5377827a7f5a16e5f7179b89fd26886 (diff)
downloadmeta-openembedded-78add3cb4853a6c50ac4f8b41f92b85d6c31a6b3.tar.gz
mplayer2: drop omapfb patch and support, this can be applied from bsp layer if needed
* example of working omapfb patch and optimizations is in meta-smartphone layer http://git.shr-project.org/git/?p=meta-smartphone.git;a=commit;h=483afbee82869a0b2dacadc4b9580c47dcb59d26 Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Diffstat (limited to 'meta-oe/recipes-multimedia/mplayer')
-rw-r--r--meta-oe/recipes-multimedia/mplayer/mplayer2/0001-video-out-for-omapfb-support.patch826
-rw-r--r--meta-oe/recipes-multimedia/mplayer/mplayer2_git.bb15
2 files changed, 0 insertions, 841 deletions
diff --git a/meta-oe/recipes-multimedia/mplayer/mplayer2/0001-video-out-for-omapfb-support.patch b/meta-oe/recipes-multimedia/mplayer/mplayer2/0001-video-out-for-omapfb-support.patch
deleted file mode 100644
index a362ef679..000000000
--- a/meta-oe/recipes-multimedia/mplayer/mplayer2/0001-video-out-for-omapfb-support.patch
+++ /dev/null
@@ -1,826 +0,0 @@
1From 2a42cec41a018008d07ea33b2b91dca191d78481 Mon Sep 17 00:00:00 2001
2From: Martin Jansa <Martin.Jansa@gmail.com>
3Date: Thu, 25 Nov 2010 16:49:53 +0100
4Subject: [PATCH] video out for omapfb support
5
6Upstream-Status: Pending
7Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
8Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
9---
10 Makefile | 2 +-
11 libvo/video_out.c | 2 +
12 libvo/vo_omapfb.c | 591 +++++++++++++++++++++++++++++++++++++++++++++++++++++
13 libvo/yuv.S | 170 +++++++++++++++
14 4 files changed, 764 insertions(+), 1 deletions(-)
15 create mode 100644 libvo/vo_omapfb.c
16 create mode 100644 libvo/yuv.S
17
18diff --git a/Makefile b/Makefile
19index 83304a2..1e88d40 100644
20--- a/Makefile
21+++ b/Makefile
22@@ -450,7 +450,7 @@ SRCS_MPLAYER-$(DIRECTFB) += libvo/vo_directfb2.c libvo/vo_dfbmga.c
23 SRCS_MPLAYER-$(DIRECTX) += libao2/ao_dsound.c libvo/vo_directx.c
24 SRCS_MPLAYER-$(DXR3) += libvo/vo_dxr3.c
25 SRCS_MPLAYER-$(ESD) += libao2/ao_esd.c
26-SRCS_MPLAYER-$(FBDEV) += libvo/vo_fbdev.c libvo/vo_fbdev2.c
27+SRCS_MPLAYER-$(FBDEV) += libvo/vo_fbdev.c libvo/vo_fbdev2.c libvo/vo_omapfb.c libvo/yuv.S
28 SRCS_MPLAYER-$(FFMPEG) += libvo/vo_png.c
29 SRCS_MPLAYER-$(GGI) += libvo/vo_ggi.c
30 SRCS_MPLAYER-$(GIF) += libvo/vo_gif89a.c
31diff --git a/libvo/video_out.c b/libvo/video_out.c
32index e796784..1433834 100644
33--- a/libvo/video_out.c
34+++ b/libvo/video_out.c
35@@ -95,6 +95,7 @@ extern struct vo_driver video_out_null;
36 extern struct vo_driver video_out_bl;
37 extern struct vo_driver video_out_fbdev;
38 extern struct vo_driver video_out_fbdev2;
39+extern struct vo_driver video_out_omapfb;
40 extern struct vo_driver video_out_svga;
41 extern struct vo_driver video_out_png;
42 extern struct vo_driver video_out_ggi;
43@@ -193,6 +194,7 @@ const struct vo_driver *video_out_drivers[] =
44 #ifdef CONFIG_FBDEV
45 &video_out_fbdev,
46 &video_out_fbdev2,
47+ &video_out_omapfb,
48 #endif
49 #ifdef CONFIG_SVGALIB
50 &video_out_svga,
51diff --git a/libvo/vo_omapfb.c b/libvo/vo_omapfb.c
52new file mode 100644
53index 0000000..7bd8927
54--- /dev/null
55+++ b/libvo/vo_omapfb.c
56@@ -0,0 +1,591 @@
57+/*
58+
59+Copyright (C) 2008 Gregoire Gentil <gregoire@gentil.com>
60+Portions Copyright (C) 2009 Howard Chu <hyc@symas.com>
61+This file adds an optimized vo output to mplayer for the OMAP platform. This is a first pass and an attempt to help to improve
62+media playing on the OMAP platform. The usual disclaimer comes here: this code is provided without any warranty.
63+Many bugs and issues still exist. Feed-back is welcome.
64+
65+This output uses the yuv420_to_yuv422 conversion from Mans Rullgard, and is heavily inspired from the work of Siarhei Siamashka.
66+I would like to thank those two persons here, without them this code would certainly not exist.
67+
68+Two options of the output are available:
69+fb_overlay_only (disabled by default): only the overlay is drawn. X11 stuff is ignored.
70+dbl_buffer (disabled by default): add double buffering. Some tearsync flags are probably missing in the code.
71+
72+Syntax is the following:
73+mplayer -ao alsa -vo omapfb /test.avi
74+mplayer -nosound -vo omapfb:fb_overlay_only:dbl_buffer /test.avi
75+
76+You need to have two planes on your system. On beagleboard, it means something like: video=omapfb:vram:2M,vram:4M
77+
78+Known issues:
79+1) A green line or some vertical lines (if mplayer decides to draw bands instead of frame) may appear.
80+It's an interpolation bug in the color conversion that needs to be fixed
81+
82+2) The color conversion accepts only 16-pixel multiple for width and height.
83+
84+3) The scaling down is disabled as the scaling down kernel patch for the OMAP3 platform doesn't seem to work yet.
85+
86+ * This program is free software; you can redistribute it and/or modify
87+ * it under the terms of the GNU General Public License as published by
88+ * the Free Software Foundation; either version 2 of the License, or
89+ * (at your option) any later version.
90+ *
91+ * This program is distributed in the hope that it will be useful,
92+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
93+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
94+ * GNU General Public License for more details.
95+ *
96+ * You should have received a copy of the GNU General Public License
97+ * along with this program; if not, write to the Free Software
98+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
99+*/
100+
101+#include <stdio.h>
102+#include <stdlib.h>
103+#include <string.h>
104+#include <fcntl.h>
105+#include <unistd.h>
106+#include <errno.h>
107+
108+#include <sys/mman.h>
109+#include <sys/ioctl.h>
110+#include <linux/fb.h>
111+
112+#include "config.h"
113+#include "video_out.h"
114+#include "video_out_internal.h"
115+#include "fastmemcpy.h"
116+#include "sub/sub.h"
117+#include "mp_msg.h"
118+#include "omapfb.h"
119+#include "x11_common.h"
120+
121+#include "libswscale/swscale.h"
122+#include "libmpcodecs/vf_scale.h"
123+#include "libavcodec/avcodec.h"
124+
125+#include "aspect.h"
126+
127+#include "subopt-helper.h"
128+
129+#include <X11/Xlib.h>
130+#include <X11/Xutil.h>
131+#include <X11/Xatom.h>
132+#include "wskeys.h"
133+
134+static vo_info_t info = {
135+ "omapfb video driver",
136+ "omapfb",
137+ "",
138+ ""
139+};
140+
141+LIBVO_EXTERN(omapfb)
142+
143+static int fb_overlay_only = 0; // if set, we need only framebuffer overlay, but do not need any x11 code
144+static int dbl_buffer = 0;
145+static int fullscreen_flag = 0;
146+static int plane_ready = 0;
147+static uint32_t drwX, drwY;
148+
149+extern void yuv420_to_yuv422(uint8_t *yuv, uint8_t *y, uint8_t *u, uint8_t *v, int w, int h, int yw, int cw, int dw);
150+static struct fb_var_screeninfo sinfo_p0;
151+static struct fb_var_screeninfo sinfo;
152+static struct fb_var_screeninfo sinfo2;
153+static struct fb_fix_screeninfo finfo;
154+static struct omapfb_mem_info minfo;
155+static struct omapfb_plane_info pinfo;
156+static int xoff, yoff;
157+
158+static struct {
159+ unsigned x;
160+ unsigned y;
161+ uint8_t *buf;
162+} fb_pages[2];
163+static int dev_fd = -1;
164+static int fb_page_flip = 0;
165+static int page = 0;
166+static void omapfb_update(int x, int y, int out_w, int out_h, int show);
167+
168+extern void mplayer_put_key( int code );
169+#include "input/keycodes.h"
170+
171+#define TRANSPARENT_COLOR_KEY 0xff0
172+
173+static Display *display = NULL; // pointer to X Display structure.
174+static int screen_num; // number of screen to place the window on.
175+static Window win = 0;
176+static Window parent = 0; // pointer to the newly created window.
177+
178+/* This is used to intercept window closing requests. */
179+static Atom wm_delete_window;
180+
181+
182+void vo_calc_drwXY(uint32_t *drwX, uint32_t *drwY)
183+{
184+ *drwX = *drwY = 0;
185+ if (vo_fs) {
186+ aspect(&vo_dwidth, &vo_dheight, A_ZOOM);
187+ vo_dwidth = FFMIN(vo_dwidth, vo_screenwidth);
188+ vo_dheight = FFMIN(vo_dheight, vo_screenheight);
189+ *drwX = (vo_screenwidth - vo_dwidth) / 2;
190+ *drwY = (vo_screenheight - vo_dheight) / 2;
191+ mp_msg(MSGT_VO, MSGL_V, "[vo-fs] dx: %d dy: %d dw: %d dh: %d\n",
192+ *drwX, *drwY, vo_dwidth, vo_dheight);
193+ } else if (WinID == 0) {
194+ *drwX = vo_dx;
195+ *drwY = vo_dy;
196+ }
197+}
198+
199+static void getPrimaryPlaneInfo()
200+{
201+ int dev_fd = open("/dev/fb0", O_RDWR);
202+
203+ if (dev_fd == -1) {
204+ mp_msg(MSGT_VO, MSGL_FATAL, "[omapfb] Error /dev/fb0\n");
205+ return -1;
206+ }
207+
208+ ioctl(dev_fd, FBIOGET_VSCREENINFO, &sinfo_p0);
209+ close(dev_fd);
210+}
211+
212+/**
213+ * Function to get the offset to be used when in windowed mode
214+ * or when using -wid option
215+ */
216+static void x11_get_window_abs_position(Display *display, Window window,
217+ int *wx, int *wy, int *ww, int *wh)
218+{
219+ Window root, parent;
220+ Window *child;
221+ unsigned int n_children;
222+ XWindowAttributes attribs;
223+
224+ /* Get window attributes */
225+ XGetWindowAttributes(display, window, &attribs);
226+
227+ /* Get relative position of given window */
228+ *wx = attribs.x;
229+ *wy = attribs.y;
230+ if (ww)
231+ *ww = attribs.width;
232+ if (wh)
233+ *wh = attribs.height;
234+
235+ /* Query window tree information */
236+ XQueryTree(display, window, &root, &parent, &child, &n_children);
237+ if (parent)
238+ {
239+ int x, y;
240+ /* If we have a parent we must go there and discover his position*/
241+ x11_get_window_abs_position(display, parent, &x, &y, NULL, NULL);
242+ *wx += x;
243+ *wy += y;
244+ }
245+
246+ /* If we had children, free it */
247+ if(n_children)
248+ XFree(child);
249+}
250+
251+static void x11_check_events(void)
252+{
253+ int e = vo_x11_check_events(mDisplay);
254+
255+ if (e & VO_EVENT_RESIZE)
256+ vo_calc_drwXY(&drwX, &drwY);
257+
258+ if (e & VO_EVENT_EXPOSE || e & VO_EVENT_RESIZE)
259+ {
260+ vo_xv_draw_colorkey(drwX, drwY, vo_dwidth - 1, vo_dheight - 1);
261+ omapfb_update(0, 0, 0, 0, 1);
262+ }
263+}
264+
265+static void x11_uninit()
266+{
267+ if (display) {
268+ XCloseDisplay(display);
269+ display = NULL;
270+ }
271+}
272+
273+/**
274+ * Initialize framebuffer
275+ */
276+static int preinit(const char *arg)
277+{
278+ opt_t subopts[] = {
279+ {"fb_overlay_only", OPT_ARG_BOOL, &fb_overlay_only, NULL},
280+ {"dbl_buffer", OPT_ARG_BOOL, &dbl_buffer, NULL},
281+ {NULL}
282+ };
283+
284+ if (subopt_parse(arg, subopts) != 0) {
285+ mp_msg(MSGT_VO, MSGL_FATAL, "[omapfb] unknown suboptions: %s\n", arg);
286+ return -1;
287+ }
288+
289+ getPrimaryPlaneInfo();
290+ dev_fd = open("/dev/fb1", O_RDWR);
291+
292+ if (dev_fd == -1) {
293+ mp_msg(MSGT_VO, MSGL_FATAL, "[omapfb] Error /dev/fb1\n");
294+ return -1;
295+ }
296+
297+ ioctl(dev_fd, FBIOGET_VSCREENINFO, &sinfo);
298+ ioctl(dev_fd, OMAPFB_QUERY_PLANE, &pinfo);
299+ ioctl(dev_fd, OMAPFB_QUERY_MEM, &minfo);
300+
301+ if (!fb_overlay_only && !vo_init())
302+ {
303+ mp_msg(MSGT_VO, MSGL_FATAL, "[omapfb] Could not open X, overlay only...\n");
304+ fb_overlay_only = 1;
305+ }
306+
307+ return 0;
308+}
309+
310+static void omapfb_update(int x, int y, int out_w, int out_h, int show)
311+{
312+ int xres, yres;
313+ if (!fb_overlay_only)
314+ x11_get_window_abs_position(mDisplay, vo_window, &x, &y, &out_w, &out_h);
315+
316+ /* Check for new screen rotation */
317+ ioctl(dev_fd, FBIOGET_VSCREENINFO, &sinfo2);
318+ if (sinfo2.rotate != sinfo_p0.rotate)
319+ getPrimaryPlaneInfo();
320+
321+ if ( (!x && !y && !out_w && !out_h) ||
322+ (out_w < sinfo.xres_virtual / 4) || (out_h < sinfo.yres_virtual / 4) || /* HW can't scale down by more than 4x */
323+ (out_w > sinfo.xres_virtual * 8) || (out_h > sinfo.yres_virtual * 8) ) { /* HW can't scale up by more than 8x */
324+ pinfo.enabled = 0;
325+ pinfo.pos_x = 0;
326+ pinfo.pos_y = 0;
327+ ioctl(dev_fd, OMAPFB_SETUP_PLANE, &pinfo);
328+ return;
329+ }
330+
331+ xres = sinfo.xres_virtual;
332+ yres = sinfo.yres_virtual;
333+
334+ /* Handle clipping: if the left or top edge of the window goes
335+ * offscreen, clamp the overlay to the left or top edge of the
336+ * screen, and set the difference into the frame offset. Also
337+ * decrease the overlay size by the offset. The offset must
338+ * take window scaling into account as well.
339+ *
340+ * Likewise, if the right or bottom edge of the window goes
341+ * offscreen, clamp the overlay to the right or bottom edge of
342+ * the screen, and decrease the overlay size accordingly. The
343+ * hardware will truncate the output accordingly, so no offset
344+ * is needed. Also take window scaling into account. -- hyc
345+ */
346+ if (x < 0) {
347+ /* clamp to left edge */
348+ xoff = -x;
349+ if (out_w != sinfo.xres_virtual) {
350+ /* account for scaling */
351+ xoff *= sinfo.xres_virtual;
352+ xoff /= out_w;
353+ }
354+ xres -= xoff;
355+ out_w += x;
356+ x = 0;
357+ } else {
358+ xoff = 0;
359+ if (x + out_w > sinfo_p0.xres) {
360+ /* clamp to right edge */
361+ int diff = sinfo_p0.xres - x;
362+ if (out_w != sinfo.xres_virtual) {
363+ /* account for scaling */
364+ xres = diff * sinfo.xres_virtual;
365+ xres /= out_w;
366+ } else {
367+ xres = diff;
368+ }
369+ out_w = diff;
370+ }
371+ }
372+
373+ if (y < 0) {
374+ /* clamp to top edge - this seldom occurs since the window
375+ * titlebar is usually forced to stay visible
376+ */
377+ yoff = -y;
378+ if (out_h != sinfo.yres_virtual) {
379+ /* account for scaling */
380+ yoff *= sinfo.yres_virtual;
381+ yoff /= out_h;
382+ }
383+ yres -= yoff;
384+ out_h += y;
385+ y = 0;
386+ } else {
387+ yoff = 0;
388+ if (y + out_h > sinfo_p0.yres) {
389+ /* clamp to bottom edge */
390+ int diff = sinfo_p0.yres - y;
391+ if (out_h != sinfo.yres_virtual) {
392+ /* account for scaling */
393+ yres = diff * sinfo.yres_virtual;
394+ yres /= out_h;
395+ } else {
396+ yres = diff;
397+ }
398+ out_h = diff;
399+ }
400+ }
401+
402+ if (xoff & 1)
403+ xoff++;
404+ if (xres & 1)
405+ xres--;
406+
407+ pinfo.enabled = show;
408+ pinfo.pos_x = x;
409+ pinfo.pos_y = y;
410+ pinfo.out_width = out_w;
411+ pinfo.out_height = out_h;
412+
413+ sinfo.xoffset = fb_pages[page].x + xoff;
414+ sinfo.yoffset = fb_pages[page].y + yoff;
415+ /* If we had to change the overlay dimensions, update it */
416+ if (xres != sinfo2.xres || yres != sinfo2.yres ||
417+ sinfo.xoffset != sinfo2.xoffset ||
418+ sinfo.yoffset != sinfo2.yoffset) {
419+ sinfo.xres = xres;
420+ sinfo.yres = yres;
421+ sinfo.rotate = sinfo2.rotate;
422+ ioctl(dev_fd, FBIOPUT_VSCREENINFO, &sinfo);
423+ }
424+
425+ ioctl(dev_fd, OMAPFB_SETUP_PLANE, &pinfo);
426+}
427+
428+static int config(uint32_t width, uint32_t height, uint32_t d_width,
429+ uint32_t d_height, uint32_t flags, char *title,
430+ uint32_t format)
431+{
432+ uint8_t *fbmem;
433+ int i;
434+ struct omapfb_color_key color_key;
435+
436+ XVisualInfo vinfo;
437+ XSetWindowAttributes xswa;
438+ XWindowAttributes attribs;
439+ unsigned long xswamask;
440+ int depth;
441+
442+ Window root, parent;
443+ Window *child;
444+ unsigned int n_children;
445+
446+ fullscreen_flag = flags & VOFLAG_FULLSCREEN;
447+ if (!fb_overlay_only)
448+ {
449+ if (!title)
450+ title = "MPlayer OMAPFB (X11/FB) render";
451+
452+ XGetWindowAttributes(mDisplay, mRootWin, &attribs);
453+ depth = attribs.depth;
454+ if (depth != 15 && depth != 16 && depth != 24 && depth != 32)
455+ depth = 24;
456+ XMatchVisualInfo(mDisplay, mScreen, depth, TrueColor, &vinfo);
457+
458+ xswa.border_pixel = 0;
459+ xswa.background_pixel = xv_colorkey = TRANSPARENT_COLOR_KEY;
460+
461+ xswamask = CWBackPixel | CWBorderPixel;
462+ xv_ck_info.method = CK_METHOD_BACKGROUND;
463+
464+ vo_x11_create_vo_window(&vinfo, vo_dx, vo_dy, vo_dwidth, vo_dheight,
465+ flags, CopyFromParent, "omapfb", title);
466+ XChangeWindowAttributes(mDisplay, vo_window, xswamask, &xswa);
467+
468+ /* Need to receive events on the parent window -- so when it is
469+ moved / resized / etc., we know. */
470+ if(WinID > 0)
471+ {
472+ /* Query window tree information */
473+ XQueryTree(mDisplay, vo_window, &root, &parent, &child, &n_children);
474+ if (n_children)
475+ XFree(child);
476+
477+ XUnmapWindow(mDisplay, vo_window);
478+ if (parent)
479+ XSelectInput(mDisplay, parent, StructureNotifyMask);
480+ XMapWindow(mDisplay, vo_window);
481+ }
482+
483+ vo_calc_drwXY(&drwX, &drwY);
484+ vo_xv_draw_colorkey(drwX, drwY, vo_dwidth - 1, vo_dheight - 1);
485+ }
486+
487+ fbmem = mmap(NULL, minfo.size, PROT_READ|PROT_WRITE, MAP_SHARED, dev_fd, 0);
488+ if (fbmem == MAP_FAILED) {
489+ mp_msg(MSGT_VO, MSGL_FATAL, "[omapfb] Error mmap\n");
490+ return -1;
491+ }
492+
493+ for (i = 0; i < minfo.size / 4; i++)
494+ ((uint32_t*)fbmem)[i] = 0x80008000;
495+
496+ sinfo.xres = width & ~15;
497+ sinfo.yres = height & ~15;
498+ sinfo.xoffset = 0;
499+ sinfo.yoffset = 0;
500+ sinfo.nonstd = OMAPFB_COLOR_YUY422;
501+
502+ fb_pages[0].x = 0;
503+ fb_pages[0].y = 0;
504+ fb_pages[0].buf = fbmem;
505+
506+ if (dbl_buffer && minfo.size >= sinfo.xres * sinfo.yres * 2) {
507+ sinfo.xres_virtual = sinfo.xres;
508+ sinfo.yres_virtual = sinfo.yres * 2;
509+ fb_pages[1].x = 0;
510+ fb_pages[1].y = sinfo.yres;
511+ fb_pages[1].buf = fbmem + sinfo.xres * sinfo.yres * 2;
512+ fb_page_flip = 1;
513+ } else {
514+ sinfo.xres_virtual = sinfo.xres;
515+ sinfo.yres_virtual = sinfo.yres;
516+ fb_page_flip = 0;
517+ }
518+
519+ ioctl(dev_fd, FBIOPUT_VSCREENINFO, &sinfo);
520+ ioctl(dev_fd, FBIOGET_FSCREENINFO, &finfo);
521+
522+ if (WinID <= 0) {
523+ if (fullscreen_flag) {
524+ omapfb_update(0, 0, sinfo_p0.xres, sinfo_p0.yres, 1);
525+ } else {
526+ omapfb_update(sinfo_p0.xres / 2 - sinfo.xres / 2, sinfo_p0.yres / 2 - sinfo.yres / 2, sinfo.xres, sinfo.yres, 1);
527+ }
528+ }
529+
530+ color_key.channel_out = OMAPFB_CHANNEL_OUT_LCD;
531+ color_key.background = 0x0;
532+ color_key.trans_key = TRANSPARENT_COLOR_KEY;
533+ if (fb_overlay_only)
534+ color_key.key_type = OMAPFB_COLOR_KEY_DISABLED;
535+ else
536+ color_key.key_type = OMAPFB_COLOR_KEY_GFX_DST;
537+ ioctl(dev_fd, OMAPFB_SET_COLOR_KEY, &color_key);
538+
539+ plane_ready = 1;
540+ return 0;
541+}
542+
543+static void draw_alpha(int x0, int y0, int w, int h, unsigned char *src, unsigned char *srca, int stride)
544+{
545+ vo_draw_alpha_yuy2(w, h, src, srca, stride, fb_pages[page].buf + y0 * finfo.line_length + x0 * 2, finfo.line_length);
546+}
547+
548+static void draw_osd(void)
549+{
550+ vo_draw_text(sinfo.xres, sinfo.yres, draw_alpha);
551+}
552+
553+static int draw_frame(uint8_t *src[])
554+{
555+ return 1;
556+}
557+
558+static int draw_slice(uint8_t *src[], int stride[], int w, int h, int x, int y)
559+{
560+ if (x!=0)
561+ return 0;
562+
563+ if (!plane_ready)
564+ return 0;
565+
566+ ioctl(dev_fd, OMAPFB_SYNC_GFX);
567+
568+ yuv420_to_yuv422(fb_pages[page].buf + y * finfo.line_length, src[0], src[1], src[2], w & ~15, h, stride[0], stride[1], finfo.line_length);
569+ return 0;
570+}
571+
572+static void flip_page(void)
573+{
574+ if (fb_page_flip) {
575+ sinfo.xoffset = fb_pages[page].x + xoff;
576+ sinfo.yoffset = fb_pages[page].y + yoff;
577+ ioctl(dev_fd, FBIOPAN_DISPLAY, &sinfo);
578+ page ^= fb_page_flip;
579+ }
580+}
581+
582+static int query_format(uint32_t format)
583+{
584+ // For simplicity pretend that we can only do YV12, support for
585+ // other formats can be added quite easily if/when needed
586+ if (format != IMGFMT_YV12)
587+ return 0;
588+
589+ return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_OSD | VFCAP_SWSCALE | VFCAP_ACCEPT_STRIDE;
590+}
591+
592+
593+/**
594+ * Uninitialize framebuffer
595+ */
596+static void uninit()
597+{
598+ pinfo.enabled = 0;
599+ ioctl(dev_fd, OMAPFB_SETUP_PLANE, &pinfo);
600+
601+ if (!fb_overlay_only) {
602+ struct omapfb_color_key color_key;
603+ color_key.channel_out = OMAPFB_CHANNEL_OUT_LCD;
604+ color_key.key_type = OMAPFB_COLOR_KEY_DISABLED;
605+ ioctl(dev_fd, OMAPFB_SET_COLOR_KEY, &color_key);
606+ }
607+
608+ close(dev_fd);
609+
610+ if (!fb_overlay_only)
611+ x11_uninit();
612+}
613+
614+
615+static int control(uint32_t request, void *data, ...)
616+{
617+ switch (request) {
618+ case VOCTRL_QUERY_FORMAT:
619+ return query_format(*((uint32_t*)data));
620+ case VOCTRL_FULLSCREEN: {
621+ if (WinID > 0) return VO_FALSE;
622+ if (fullscreen_flag) {
623+ if (!fb_overlay_only)
624+ vo_x11_fullscreen();
625+ fullscreen_flag = 0;
626+ omapfb_update(sinfo_p0.xres / 2 - sinfo.xres / 2, sinfo_p0.yres / 2 - sinfo.yres / 2, sinfo.xres, sinfo.yres, 1);
627+ } else {
628+ if (!fb_overlay_only)
629+ vo_x11_fullscreen();
630+ fullscreen_flag = 1;
631+ omapfb_update(0, 0, sinfo_p0.xres, sinfo_p0.yres, 1);
632+ }
633+ return VO_TRUE;
634+ }
635+ case VOCTRL_UPDATE_SCREENINFO:
636+ update_xinerama_info();
637+ return VO_TRUE;
638+ }
639+ return VO_NOTIMPL;
640+}
641+
642+
643+static void check_events(void)
644+{
645+ if (!fb_overlay_only)
646+ x11_check_events();
647+}
648diff --git a/libvo/yuv.S b/libvo/yuv.S
649new file mode 100644
650index 0000000..1cd2c1d
651--- /dev/null
652+++ b/libvo/yuv.S
653@@ -0,0 +1,170 @@
654+/*
655+ Copyright (C) 2008 Mans Rullgard
656+
657+ Permission is hereby granted, free of charge, to any person
658+ obtaining a copy of this software and associated documentation
659+ files (the "Software"), to deal in the Software without
660+ restriction, including without limitation the rights to use, copy,
661+ modify, merge, publish, distribute, sublicense, and/or sell copies
662+ of the Software, and to permit persons to whom the Software is
663+ furnished to do so, subject to the following conditions:
664+
665+ The above copyright notice and this permission notice shall be
666+ included in all copies or substantial portions of the Software.
667+
668+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
669+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
670+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
671+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
672+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
673+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
674+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
675+ DEALINGS IN THE SOFTWARE.
676+ */
677+
678+ .macro mov32 rd, val
679+ movw \rd, #:lower16:\val
680+ movt \rd, #:upper16:\val
681+ .endm
682+
683+ .fpu neon
684+ .text
685+
686+@ yuv420_to_yuv422(uint8_t *yuv, uint8_t *y, uint8_t *u, uint8_t *v,
687+@ int w, int h, int yw, int cw, int dw)
688+
689+#define yuv r0
690+#define y r1
691+#define u r2
692+#define v r3
693+#define w r4
694+#define h r5
695+#define yw r6
696+#define cw r7
697+#define dw r8
698+
699+#define tyuv r9
700+#define ty r10
701+#define tu r11
702+#define tv r12
703+#define i lr
704+
705+ .global yuv420_to_yuv422
706+ .func yuv420_to_yuv422
707+yuv420_to_yuv422:
708+ push {r4-r11,lr}
709+ add r4, sp, #36
710+.Ldo_conv:
711+ ldm r4, {r4-r8}
712+ push {r4}
713+1:
714+ mov tu, u
715+ mov tv, v
716+ vld1.64 {d2}, [u,:64], cw @ u0
717+ vld1.64 {d3}, [v,:64], cw @ v0
718+ mov tyuv, yuv
719+ mov ty, y
720+ vzip.8 d2, d3 @ u0v0
721+ mov i, #16
722+2:
723+ pld [y, #64]
724+ vld1.64 {d0, d1}, [y,:128], yw @ y0
725+ pld [u, #64]
726+ subs i, i, #4
727+ vld1.64 {d6}, [u,:64], cw @ u2
728+ pld [y, #64]
729+ vld1.64 {d4, d5}, [y,:128], yw @ y1
730+ pld [v, #64]
731+ vld1.64 {d7}, [v,:64], cw @ v2
732+ pld [y, #64]
733+ vld1.64 {d16,d17}, [y,:128], yw @ y2
734+ vzip.8 d6, d7 @ u2v2
735+ pld [u, #64]
736+ vld1.64 {d22}, [u,:64], cw @ u4
737+ pld [v, #64]
738+ vld1.64 {d23}, [v,:64], cw @ v4
739+ pld [y, #64]
740+ vld1.64 {d20,d21}, [y,:128], yw @ y3
741+ vmov q9, q3 @ u2v2
742+ vzip.8 d22, d23 @ u4v4
743+ vrhadd.u8 q3, q1, q3 @ u1v1
744+ vzip.8 q0, q1 @ y0u0y0v0
745+ vmov q12, q11 @ u4v4
746+ vzip.8 q2, q3 @ y1u1y1v1
747+ vrhadd.u8 q11, q9, q11 @ u3v3
748+ vst1.64 {d0-d3}, [yuv,:128], dw @ y0u0y0v0
749+ vzip.8 q8, q9 @ y2u2y2v2
750+ vst1.64 {d4-d7}, [yuv,:128], dw @ y1u1y1v1
751+ vzip.8 q10, q11 @ y3u3y3v3
752+ vst1.64 {d16-d19}, [yuv,:128], dw @ y2u2y2v2
753+ vmov q1, q12
754+ vst1.64 {d20-d23}, [yuv,:128], dw @ y3u3y3v3
755+ bgt 2b
756+
757+ subs w, w, #16
758+ add yuv, tyuv, #32
759+ add y, ty, #16
760+ add u, tu, #8
761+ add v, tv, #8
762+ bgt 1b
763+
764+ ldr w, [sp]
765+ subs h, h, #16
766+ add yuv, yuv, dw, lsl #4
767+ sub yuv, yuv, w, lsl #1
768+ add y, y, yw, lsl #4
769+ sub y, y, w
770+ add u, u, cw, lsl #3
771+ sub u, u, w, asr #1
772+ add v, v, cw, lsl #3
773+ sub v, v, w, asr #1
774+ bgt 1b
775+
776+ pop {r3-r11,pc}
777+ .endfunc
778+
779+ .func neon_open
780+neon_open:
781+ push {r4-r8,lr}
782+ ldrd r4, r5, [r0, #16]
783+ ldrd r6, r7, [r0, #24]
784+ lsl r8, r4, #1
785+ mov32 r0, conv_params
786+ stm r0, {r4-r8}
787+ mov r0, #0
788+ pop {r4-r8,pc}
789+ .endfunc
790+
791+ .func neon_convert
792+neon_convert:
793+ push {r4-r11,lr}
794+ ldr r0, [r0]
795+ mov32 r4, conv_params
796+ ldm r1, {r1-r3}
797+ b .Ldo_conv
798+ .endfunc
799+
800+ .func neon_nop
801+neon_nop:
802+ bx lr
803+ .endfunc
804+
805+ .section .bss
806+conv_params:
807+ .skip 5*4
808+ .size conv_params, . - conv_params
809+
810+ .section .rodata
811+.Lname: .asciz "neon"
812+ofb_pixconv_neon:
813+ .word .Lname
814+ .word 0 @ flags
815+ .word neon_open
816+ .word neon_convert
817+ .word neon_nop @ finish
818+ .word neon_nop @ close
819+ .size ofb_pixconv_neon, . - ofb_pixconv_neon
820+
821+ .section .ofb_pixconv, "a"
822+ofb_pixconv_neon_p:
823+ .word ofb_pixconv_neon
824--
8251.7.2.5
826
diff --git a/meta-oe/recipes-multimedia/mplayer/mplayer2_git.bb b/meta-oe/recipes-multimedia/mplayer/mplayer2_git.bb
index 10a69a996..f3b254e6d 100644
--- a/meta-oe/recipes-multimedia/mplayer/mplayer2_git.bb
+++ b/meta-oe/recipes-multimedia/mplayer/mplayer2_git.bb
@@ -17,10 +17,6 @@ SRC_URI = "git://repo.or.cz/mplayer.git;protocol=git;branch=master \
17 file://cross.compile.codec-cfg.patch \ 17 file://cross.compile.codec-cfg.patch \
18" 18"
19 19
20SRC_URI_append_aarmv7a = " \
21 file://0001-video-out-for-omapfb-support.patch \
22 "
23
24SRCREV = "e3f5043233336d8b4b0731c6a8b42a8fda5535ac" 20SRCREV = "e3f5043233336d8b4b0731c6a8b42a8fda5535ac"
25 21
26ARM_INSTRUCTION_SET = "ARM" 22ARM_INSTRUCTION_SET = "ARM"
@@ -40,9 +36,6 @@ CONFFILES_${PN} += "/usr/etc/mplayer/input.conf \
40 36
41inherit autotools pkgconfig 37inherit autotools pkgconfig
42 38
43# We want a kernel header for armv7a, but we don't want to make mplayer machine specific for that
44STAGING_KERNEL_DIR = "${STAGING_DIR}/${MACHINE_ARCH}${TARGET_VENDOR}-${TARGET_OS}/kernel"
45
46EXTRA_OECONF = " \ 39EXTRA_OECONF = " \
47 --prefix=/usr \ 40 --prefix=/usr \
48 --mandir=${mandir} \ 41 --mandir=${mandir} \
@@ -142,14 +135,6 @@ FULL_OPTIMIZATION = "-fexpensive-optimizations -fomit-frame-pointer -frename-reg
142FULL_OPTIMIZATION_armv7a = "-fexpensive-optimizations -ftree-vectorize -fomit-frame-pointer -O4 -ffast-math" 135FULL_OPTIMIZATION_armv7a = "-fexpensive-optimizations -ftree-vectorize -fomit-frame-pointer -O4 -ffast-math"
143BUILD_OPTIMIZATION = "${FULL_OPTIMIZATION}" 136BUILD_OPTIMIZATION = "${FULL_OPTIMIZATION}"
144 137
145do_configure_prepend_armv7a() {
146 cp ${STAGING_KERNEL_DIR}/arch/arm/plat-omap/include/mach/omapfb.h ${S}/libvo/omapfb.h || true
147 cp ${STAGING_KERNEL_DIR}/include/asm-arm/arch-omap/omapfb.h ${S}/libvo/omapfb.h || true
148 cp ${STAGING_KERNEL_DIR}/include/linux/omapfb.h ${S}/libvo/omapfb.h || true
149 cp ${STAGING_DIR_TARGET}/kernel/include/linux/omapfb.h ${S}/libvo/omapfb.h || true
150 sed -e 's/__user//g' -i ${S}/libvo/omapfb.h || true
151}
152
153CFLAGS_append = " -I${S}/libdvdread4 " 138CFLAGS_append = " -I${S}/libdvdread4 "
154 139
155do_configure() { 140do_configure() {