トップ «前の日記(2011年05月27日) 最新 次の日記(2011年06月24日)» 編集

Masa's blog

検索キーワード:

2011年05月29日 ATI imageon patch for MPlayer-1.0rc4 from MPlayer-1.0pre8's patch [長年日記]

_ ATI imageon patch for MPlayer-1.0rc4 from MPlayer-1.0pre8's patch

I have ported ATI imageon patch for MPlayer-1.0rc4 from MPlayer-1.0pre8's patch.

I have succeeded to run mplayer with imageon on ARMedslack 13.1 with zaurus(SL-C760).

New patch is here :)

#
# MPlayer-1.0rc4-imageon.diff
#
*** ./Makefile.ORG	2011-05-28 17:05:02.695597593 +0900
--- ./Makefile	2011-05-28 17:06:42.277689754 +0900
***************
*** 541,546 ****
--- 541,547 ----
  SRCS_MPLAYER-$(DXR3)         += libvo/vo_dxr3.c
  SRCS_MPLAYER-$(ESD)          += libao2/ao_esd.c
  SRCS_MPLAYER-$(FBDEV)        += libvo/vo_fbdev.c libvo/vo_fbdev2.c
+ SRCS_MPLAYER-$(IMAGEON)      += libvo/vo_imageon.c
  SRCS_MPLAYER-$(GGI)          += libvo/vo_ggi.c
  SRCS_MPLAYER-$(GIF)          += libvo/vo_gif89a.c
  SRCS_MPLAYER-$(GL)           += libvo/gl_common.c libvo/vo_gl.c \
*** ./configure.ORG	2011-05-28 16:44:50.099669463 +0900
--- ./configure	2011-05-28 17:12:06.180388128 +0900
***************
*** 423,428 ****
--- 423,429 ----
    --enable-xshape          enable XShape support [autodetect]
    --disable-xss            disable screensaver support via xss [autodetect]
    --enable-fbdev           enable FBDev video output [autodetect]
+   --enable-imageon         enable imageon video output [no]
    --enable-mlib            enable mediaLib video output (Solaris) [disable]
    --enable-3dfx            enable obsolete /dev/3dfx video output [disable]
    --enable-tdfxfb          enable tdfxfb video output [disable]
***************
*** 630,635 ****
--- 631,637 ----
  _svga=auto
  _vesa=auto
  _fbdev=auto
+ _imageon=no
  _dvb=auto
  _dxr2=auto
  _dxr3=auto
***************
*** 996,1001 ****
--- 998,1005 ----
    --disable-vesa)       _vesa=no        ;;
    --enable-fbdev)       _fbdev=yes      ;;
    --disable-fbdev)      _fbdev=no       ;;
+   --enable-imageon)     _imageon=yes    ;;
+   --disable-imageon)    _imageon=no     ;;
    --enable-dvb)         _dvb=yes        ;;
    --disable-dvb)        _dvb=no         ;;
    --enable-dxr2)        _dxr2=yes       ;;
***************
*** 4876,4881 ****
--- 4880,4896 ----
  echores "$_fbdev"


+ echocheck "ATI Imageon 100 (imageon)"
+ if test "$_imageon" = yes ; then
+   def_imageon='#define CONFIG_IMAGEON 1'
+   libs_mplayer="$libs_mplayer -lw100"
+   vomodules="imageon $vomodules"
+ else
+   def_imageon='#undef CONFIG_IMAGEON'
+   novomodules="imageon $novomodules"
+ fi
+ echores "$_imageon"
+

  echocheck "DVB"
  if test "$_dvb" = auto ; then
***************
*** 8584,8589 ****
--- 8599,8605 ----
  FAAD_INTERNAL = $_faad_internal
  FASTMEMCPY = $_fastmemcpy
  FBDEV = $_fbdev
+ IMAGEON = $_imageon
  FREETYPE = $_freetype
  FTP = $_ftp
  GIF = $_gif
***************
*** 9121,9126 ****
--- 9137,9143 ----
  $def_dxr2
  $def_dxr3
  $def_fbdev
+ $def_imageon
  $def_ggi
  $def_ggiwmh
  $def_gif
*** ./libvo/video_out.c.ORG	2011-05-28 18:22:05.775727864 +0900
--- ./libvo/video_out.c	2011-05-28 18:27:29.443599038 +0900
***************
*** 113,118 ****
--- 113,119 ----
  extern const vo_functions_t video_out_bl;
  extern vo_functions_t video_out_fbdev;
  extern const vo_functions_t video_out_fbdev2;
+ extern vo_functions_t video_out_imageon;
  extern vo_functions_t video_out_svga;
  extern const vo_functions_t video_out_png;
  extern const vo_functions_t video_out_ggi;
***************
*** 214,219 ****
--- 215,223 ----
          &video_out_fbdev,
          &video_out_fbdev2,
  #endif
+ #ifdef CONFIG_IMAGEON
+         &video_out_imageon,
+ #endif
  #ifdef CONFIG_SVGALIB
          &video_out_svga,
  #endif
*** ./libvo/vo_imageon.c.ORG	2011-05-28 17:05:13.345722251 +0900
--- ./libvo/vo_imageon.c	2011-05-28 18:09:05.737762608 +0900
***************
*** 0 ****
--- 1,307 ----
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <inttypes.h>
+ #include <string.h>
+
+ #include "config.h"
+ #include "video_out.h"
+ #include "video_out_internal.h"
+ #include "mp_msg.h"
+
+ static vo_info_t info =
+ {
+         "ATI IMAGEON 100 driver",
+         "imageon",
+         "Manuel Teira",
+         "C760-Openzaurus Testing version"
+ };
+
+ LIBVO_EXTERN(imageon)
+
+ #include <acapi.h>
+
+ static struct w100privdata_t {
+         uint8_t config;
+         ac_device_t *dev;
+         uint16_t xres;
+         uint16_t yres;
+         uint16_t ovwidth;
+         uint16_t ovheight;
+         ac_surface_t insurface;
+         ac_surface_t ovsurface;
+         uint16_t srcwidth;
+         uint16_t srcheight;
+         uint8_t rotate;
+         uint8_t scale;
+         ac_point_t ovdst;
+         ac_point_t dstpos;
+         ac_overlayprops_t ovprops;
+         uint32_t format;
+ } w100_privdata;
+
+ static int preinit(const char *arg)
+ {
+         //Perhaps libw100 should include some code to query the framebuffer
+         struct w100privdata_t *pdata = &w100_privdata;
+
+         pdata->config = 0;
+         pdata->xres = 640;
+         pdata->yres = 480;
+         pdata->dev = ac_init(pdata->xres, pdata->yres, AC_ROT90);
+         if (pdata->dev) {
+                 return 0;
+         } else {
+                 //Put a log message here
+                 return 1;
+         }
+ }
+
+
+ static void draw_osd(void)
+ {
+ }
+
+ void check_events(void)
+ {
+         mp_msg(MSGT_VO, MSGL_V, "check_events got called\n");
+ }
+
+ static int config(uint32_t srcwidth, uint32_t srcheight,
+                   uint32_t dstwidth, uint32_t dstheight,
+                   uint32_t flags, char *title, uint32_t format)
+ {
+         struct w100privdata_t *pdata = &w100_privdata;
+         uint8_t xscale, yscale;
+         uint16_t scaledwidth, scaledheight;
+
+         mp_msg(MSGT_VO, MSGL_V,
+                "vo_imageon: srcwidth:%d, srcheight:%d, "
+                "dstwidth:%d, dstheight:%d\n",
+                srcwidth, srcheight, dstwidth, dstheight);
+
+         if (pdata->config) {
+                 ac_overlay_disable(pdata->dev);
+                 ac_free_surface(pdata->dev, &pdata->insurface);
+                 ac_free_surface(pdata->dev, &pdata->ovsurface);
+         }
+
+         pdata->srcwidth = srcwidth;
+         pdata->srcheight = srcheight;
+
+         //By the moment, only YUV420 supported
+         pdata->ovprops.format = OVLFORMAT_YUV420;
+         pdata->ovprops.portrait_mode = 0;
+         pdata->ovprops.inv_hor = 0;
+         pdata->ovprops.inv_ver = 0;
+         pdata->ovprops.yuv2rgb = 0;
+
+         pdata->rotate = AC_ROT90;
+
+         if (flags & VOFLAG_FULLSCREEN) {
+                 pdata->ovwidth = 240;
+                 pdata->ovheight = 320;
+                 xscale = ac_get_scaler(pdata->ovheight, srcwidth);
+                 yscale = ac_get_scaler(pdata->ovwidth, srcheight);
+                 pdata->scale = (xscale > yscale) ? xscale : yscale;
+                 pdata->ovdst.x = 0;
+                 pdata->ovdst.y = 0;
+                 pdata->ovprops.video_hor_exp = 1;
+                 pdata->ovprops.video_ver_exp = 1;
+         } else {
+                 pdata->ovwidth = (dstheight + 0xf) & ~0xf;
+                 pdata->ovheight = (dstwidth + 0xf) & ~0xf;
+                 xscale = ac_get_scaler(dstwidth, srcwidth);
+                 yscale = ac_get_scaler(dstheight, srcheight);
+                 pdata->ovdst.x = (pdata->xres - pdata->ovheight) / 2;
+                 pdata->ovdst.y = (pdata->yres - pdata->ovwidth) / 2;
+                 pdata->ovprops.video_hor_exp = 0;
+                 pdata->ovprops.video_ver_exp = 0;
+         }
+
+         pdata->scale = (xscale > yscale) ? xscale : yscale;
+         scaledwidth = ac_apply_scaler(srcwidth, pdata->scale);
+         scaledheight = ac_apply_scaler(srcheight, pdata->scale);
+         pdata->dstpos.x = (pdata->ovwidth - scaledheight) / 2;
+         pdata->dstpos.y = (pdata->ovheight - scaledwidth) / 2;
+
+         if (ac_alloc_surface(pdata->dev, &pdata->ovsurface,
+                              FMT_YUV420,
+                              pdata->ovwidth,
+                              pdata->ovheight,
+                              AC_MEM_INTERNAL) == NULL) {
+                 mp_msg(MSGT_VO, MSGL_FATAL, "Unable to allocate ov surface\n");
+                 return -1;
+         }
+
+         if (ac_alloc_surface(pdata->dev, &pdata->insurface,
+                              FMT_YUV420, srcwidth, srcheight,
+                              AC_MEM_INTERNAL) == NULL) {
+                 mp_msg(MSGT_VO, MSGL_WARN,
+                        "No room in internal memory for insurface\n");
+                 if (ac_alloc_surface(pdata->dev, &pdata->insurface,
+                                      FMT_YUV420, srcwidth, srcheight,
+                                      AC_MEM_EXTERNAL) == NULL) {
+                         mp_msg(MSGT_VO, MSGL_FATAL,
+                                "Unable to allocate surface\n");
+                         ac_free_surface(pdata->dev, &pdata->ovsurface);
+                         return -1;
+                 }
+         }
+
+         ac_clear_surface(pdata->dev, &pdata->ovsurface);
+         ac_clear_surface(pdata->dev, &pdata->insurface);
+
+
+         mp_msg(MSGT_VO, MSGL_V,
+                "vo_imageon: rotate:%d scale:%d ovwidth:%d, ovheight:%d, "
+                "ovdst(x:%d, y:%d) dstpos(x:%d,y:%d)\n",
+                pdata->rotate,
+                pdata->scale,
+                pdata->ovwidth,
+                pdata->ovheight,
+                pdata->ovdst.x,
+                pdata->ovdst.y,
+                pdata->dstpos.x,
+                pdata->dstpos.y);
+
+         ac_overlay_setup(pdata->dev, &pdata->ovsurface, &pdata->ovsurface.rect,
+                          &pdata->ovprops, 0);
+         ac_overlay_setpos(pdata->dev, &pdata->ovdst);
+         ac_overlay_enable(pdata->dev);
+
+         pdata->config = 1;
+         return 0;
+ }
+
+ static int draw_slice(uint8_t *image[], int stride[],
+                       int w, int h, int x, int y)
+ {
+         struct w100privdata_t *pdata = &w100_privdata;
+         ac_rect_t dstrect;
+         ac_surface_t *dstsurface = &pdata->insurface;
+         int plane;
+         mp_msg(MSGT_VO, MSGL_V,
+                "vo_imageon: draw_slice(w:%d,h:%d,x:%d,y:%d)\n",
+                w, h, x, y);
+
+         ac_reset_ctx(pdata->dev);
+         for (plane = 0; plane <= V_PLANE; plane++) {
+                 mp_msg(MSGT_VO, MSGL_V, "Plane: %d, Stride: %d\n",
+                        plane, stride[plane]);
+                 dstrect.x = x;
+                 dstrect.y = y;
+                 dstrect.w = w;
+                 dstrect.h = h;
+                 ac_host2planerect(pdata->dev,
+                                   image[plane],
+                                   &dstrect,
+                                   &pdata->insurface,
+                                   plane);
+         }
+         return 0;
+ }
+
+ static int draw_frame(uint8_t *frame[])
+ {
+         struct w100privdata_t *pdata = &w100_privdata;
+         mp_msg(MSGT_VO, MSGL_V, "vo_imageon: draw_frame() not implemented!\n");
+
+ }
+
+ static void flip_page(void)
+ {
+         struct w100privdata_t *pdata = &w100_privdata;
+         int plane;
+         ac_rect_t srcrect;
+         ac_point_t dstpoint;
+         ac_surface_t *insurface = &pdata->insurface;
+         ac_surface_t *ovsurface = &pdata->ovsurface;
+         ac_surfspec_t *surfspec = &ac_surfspecs[ovsurface->format];
+
+         mp_msg(MSGT_VO, MSGL_V, "vo_imageon: flip_page\n");
+
+         srcrect.x = 0;
+         srcrect.y = 0;
+
+         ac_reset_ctx(pdata->dev);
+         if (pdata->rotate != AC_ROT0) {
+                 ac_set_xform(pdata->dev, pdata->rotate, AC_NOMIRROR);
+         }
+         ac_disable_dbuf_update(pdata->dev);
+         ac_waitidle(pdata->dev);
+         for (plane = Y_PLANE; plane < surfspec->nplanes; plane++) {
+                 ac_setsrcplane(pdata->dev, insurface, plane);
+                 ac_setdstplane(pdata->dev, ovsurface, plane);
+                 ac_prepare_scaleblt(pdata->dev, DP_DST_8BPP);
+                 srcrect.w = pdata->srcwidth / surfspec->planes[plane].xsubsampling;
+                 srcrect.h = pdata->srcheight / surfspec->planes[plane].ysubsampling;
+                 dstpoint.x = pdata->dstpos.x / surfspec->planes[plane].xsubsampling;
+                 dstpoint.y = pdata->dstpos.y / surfspec->planes[plane].ysubsampling;
+                 mp_msg(MSGT_VO, MSGL_V,
+                        "vo_imageon: scaleblt src(x:%d,y:%d,w:%d,h:%d)"
+                        "dst(%d,%d)"
+                        "scale(%d)\n",
+                        srcrect.x, srcrect.y,
+                        srcrect.w, srcrect.h,
+                        dstpoint.x, dstpoint.y,
+                        pdata->scale);
+                 ac_scaleblt(pdata->dev, &srcrect, &dstpoint,
+                             pdata->scale, pdata->scale);
+         }
+         ac_enable_dbuf_update(pdata->dev);
+ }
+
+ static void uninit(void)
+ {
+         struct w100privdata_t *pdata = &w100_privdata;
+         ac_overlay_disable(pdata->dev);
+         ac_finish(pdata->dev);
+ }
+
+ static int control(uint32_t request, void *data, ...)
+ {
+         struct w100privdata_t *pdata = &w100_privdata;
+         switch (request) {
+         case VOCTRL_QUERY_FORMAT:
+                 return query_format(*((uint32_t *)data));
+         case VOCTRL_FULLSCREEN:
+                 mp_msg(MSGT_VO, MSGL_V, "vo_imageon: Asked for fullscreen\n");
+         }
+         return VO_NOTIMPL;
+ }
+
+ static int query_format(uint32_t format)
+ {
+         mp_msg(MSGT_VO, MSGL_V,
+                "vo_imageon: query_format was called: %x (%s)\n",
+                format, vo_format_name(format));
+
+         if (IMGFMT_IS_RGB(format)) {
+                 return 0;
+
+                 switch (IMGFMT_RGB_DEPTH(format)) {
+                 case 16:
+                         return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW |
+                                 VFCAP_HWSCALE_UP | VFCAP_HWSCALE_DOWN |
+                                 VFCAP_OSD | VFCAP_ACCEPT_STRIDE;
+                         break;
+                 }
+         } else {
+                 /* Planar YUV Formats */
+                 switch (format) {
+                 case IMGFMT_YV12:
+                 case IMGFMT_IYUV:
+                 case IMGFMT_I420:
+                 case IMGFMT_YVU9:
+                 case IMGFMT_IF09:
+                 case IMGFMT_Y8:
+                 case IMGFMT_Y800:
+                         return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW |
+                                 VFCAP_HWSCALE_UP | VFCAP_HWSCALE_DOWN |
+                                 VFCAP_OSD | VFCAP_ACCEPT_STRIDE;
+                         break;
+                 }
+         }
+
+         return 0;
+ }

You need permission to access /dev/mem to play mplayer with imageon, so you should execute like

$ sudo mplayer -vo imageon ...

or execute as root.

Have fun !

Some issue :(

  • With imageon, mplayer play sound with a little bit noisy.