summaryrefslogtreecommitdiffstats
path: root/libvo/vo_dfbmga.c
diff options
context:
space:
mode:
Diffstat (limited to 'libvo/vo_dfbmga.c')
-rw-r--r--libvo/vo_dfbmga.c484
1 files changed, 284 insertions, 200 deletions
diff --git a/libvo/vo_dfbmga.c b/libvo/vo_dfbmga.c
index fac15a46dd..73d67c4f8e 100644
--- a/libvo/vo_dfbmga.c
+++ b/libvo/vo_dfbmga.c
@@ -1,26 +1,25 @@
/*
- MPlayer video driver for DirectFB / Matrox G200/G400/G450/G550
-
- Copyright (C) 2002-2005 Ville Syrjala <syrjala@sci.fi>
-
- Originally based on vo_directfb.c by
- Jiri Svoboda <Jiri.Svoboda@seznam.cz>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the
- Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301 USA.
-*/
+ * MPlayer video driver for DirectFB / Matrox G200/G400/G450/G550
+ *
+ * copyright (C) 2002-2008 Ville Syrjala <syrjala@sci.fi>
+ * Originally based on vo_directfb.c by Jiri Svoboda <Jiri.Svoboda@seznam.cz>.
+ *
+ * This file is part of MPlayer.
+ *
+ * MPlayer is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * MPlayer is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with MPlayer; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
/* directfb includes */
#include <directfb.h>
@@ -50,16 +49,9 @@ static const vo_info_t info = {
const LIBVO_EXTERN(dfbmga)
-/******************************
-* directfb *
-******************************/
-
-/*
- * (Globals)
- */
static IDirectFB *dfb;
-static IDirectFBDisplayLayer *primary;
+static IDirectFBDisplayLayer *crtc1;
static IDirectFBDisplayLayer *bes;
static IDirectFBDisplayLayer *crtc2;
static IDirectFBDisplayLayer *spic;
@@ -73,6 +65,7 @@ static IDirectFBSurface *frame;
static IDirectFBSurface *subframe;
static IDirectFBSurface *besframe;
+static IDirectFBSurface *c1frame;
static IDirectFBSurface *c2frame;
static IDirectFBSurface *spicframe;
@@ -80,6 +73,7 @@ static DFBSurfacePixelFormat frame_format;
static DFBSurfacePixelFormat subframe_format;
static DFBRectangle besrect;
+static DFBRectangle c1rect;
static DFBRectangle c2rect;
static DFBRectangle *subrect;
@@ -88,9 +82,11 @@ static IDirectFBInputDevice *remote;
static IDirectFBEventBuffer *buffer;
static int blit_done;
-static int stretch;
+static int c1stretch;
+static int c2stretch;
static int use_bes;
+static int use_crtc1;
static int use_crtc2;
static int use_spic;
static int use_input;
@@ -107,10 +103,6 @@ static int osd_max;
static int is_g200;
-/******************************
-* vo_dfbmga *
-******************************/
-
#if DIRECTFBVERSION < DFB_VERSION(0,9,18)
#define DSPF_ALUT44 DSPF_LUT8
#define DLBM_TRIPLE ~0
@@ -137,22 +129,20 @@ pixelformat_name( DFBSurfacePixelFormat format )
return "ARGB";
case DSPF_RGB32:
return "RGB32";
- case DSPF_RGB24:
- return "RGB24";
case DSPF_RGB16:
- return "RGB16";
+ return "RGB16";
case DSPF_ARGB1555:
- return "ARGB1555";
+ return "ARGB1555";
case DSPF_YUY2:
- return "YUY2";
+ return "YUY2";
case DSPF_UYVY:
- return "UYVY";
+ return "UYVY";
case DSPF_YV12:
- return "YV12";
+ return "YV12";
case DSPF_I420:
- return "I420";
+ return "I420";
case DSPF_ALUT44:
- return "ALUT44";
+ return "ALUT44";
#if DIRECTFBVERSION > DFB_VERSION(0,9,21)
case DSPF_NV12:
return "NV12";
@@ -160,7 +150,7 @@ pixelformat_name( DFBSurfacePixelFormat format )
return "NV21";
#endif
default:
- return "Unknown pixel format";
+ return "Unknown pixel format";
}
}
@@ -169,19 +159,17 @@ imgfmt_to_pixelformat( uint32_t format )
{
switch (format) {
case IMGFMT_BGR32:
- return DSPF_RGB32;
- case IMGFMT_BGR24:
- return DSPF_RGB24;
+ return DSPF_RGB32;
case IMGFMT_BGR16:
- return DSPF_RGB16;
+ return DSPF_RGB16;
case IMGFMT_BGR15:
- return DSPF_ARGB1555;
+ return DSPF_ARGB1555;
case IMGFMT_YUY2:
- return DSPF_YUY2;
+ return DSPF_YUY2;
case IMGFMT_UYVY:
- return DSPF_UYVY;
+ return DSPF_UYVY;
case IMGFMT_YV12:
- return DSPF_YV12;
+ return DSPF_YV12;
case IMGFMT_I420:
case IMGFMT_IYUV:
return DSPF_I420;
@@ -192,7 +180,7 @@ imgfmt_to_pixelformat( uint32_t format )
return DSPF_NV21;
#endif
default:
- return DSPF_UNKNOWN;
+ return DSPF_UNKNOWN;
}
}
@@ -236,6 +224,7 @@ preinit( const char *arg )
/* Some defaults */
use_bes = 0;
+ use_crtc1 = 0;
use_crtc2 = 1;
use_spic = 1;
field_parity = -1;
@@ -259,6 +248,10 @@ preinit( const char *arg )
use_bes = !opt_no;
vo_subdevice += 3;
opt_no = 0;
+ } else if (!strncmp(vo_subdevice, "crtc1", 5)) {
+ use_crtc1 = !opt_no;
+ vo_subdevice += 5;
+ opt_no = 0;
} else if (!strncmp(vo_subdevice, "crtc2", 5)) {
use_crtc2 = !opt_no;
vo_subdevice += 5;
@@ -356,13 +349,14 @@ preinit( const char *arg )
show_help = 1;
break;
}
- }
+ }
if (show_help) {
mp_msg( MSGT_VO, MSGL_ERR,
"\nvo_dfbmga command line help:\n"
"Example: mplayer -vo dfbmga:nocrtc2:bes:buffermode=single\n"
"\nOptions (use 'no' prefix to disable):\n"
" bes Use Backend Scaler\n"
+ " crtc1 Use CRTC1\n"
" crtc2 Use CRTC2\n"
" spic Use hardware sub-picture for OSD\n"
" input Use DirectFB for keyboard input\n"
@@ -383,62 +377,66 @@ preinit( const char *arg )
return -1;
}
}
- if (!use_bes && !use_crtc2) {
- mp_msg( MSGT_VO, MSGL_ERR, "vo_dfbmga: No output selected\n" );
+ if (!use_bes && !use_crtc1 && !use_crtc2) {
+ mp_msg( MSGT_VO, MSGL_ERR, "vo_dfbmga: No output selected\n" );
+ return -1;
+ }
+ if (use_bes && use_crtc1) {
+ mp_msg( MSGT_VO, MSGL_ERR, "vo_dfbmga: Both BES and CRTC1 outputs selected\n" );
return -1;
}
- if ((res = DirectFBInit( NULL, NULL )) != DFB_OK) {
- mp_msg( MSGT_VO, MSGL_ERR,
- "vo_dfbmga: DirectFBInit() failed - %s\n",
- DirectFBErrorString( res ) );
- return -1;
- }
+ if ((res = DirectFBInit( NULL, NULL )) != DFB_OK) {
+ mp_msg( MSGT_VO, MSGL_ERR,
+ "vo_dfbmga: DirectFBInit() failed - %s\n",
+ DirectFBErrorString( res ) );
+ return -1;
+ }
- switch (tvnorm) {
- case 0:
- DirectFBSetOption( "matrox-tv-standard", "pal" );
- mp_msg( MSGT_VO, MSGL_INFO, "vo_dfbmga: Forced TV standard to PAL\n" );
- break;
- case 1:
+ switch (tvnorm) {
+ case 0:
+ DirectFBSetOption( "matrox-tv-standard", "pal" );
+ mp_msg( MSGT_VO, MSGL_INFO, "vo_dfbmga: Forced TV standard to PAL\n" );
+ break;
+ case 1:
+ DirectFBSetOption( "matrox-tv-standard", "ntsc" );
+ mp_msg( MSGT_VO, MSGL_INFO, "vo_dfbmga: Forced TV standard to NTSC\n" );
+ break;
+ case 2:
+ if (vo_fps > 27) {
DirectFBSetOption( "matrox-tv-standard", "ntsc" );
- mp_msg( MSGT_VO, MSGL_INFO, "vo_dfbmga: Forced TV standard to NTSC\n" );
- break;
- case 2:
- if (vo_fps > 27) {
- DirectFBSetOption( "matrox-tv-standard", "ntsc" );
- mp_msg( MSGT_VO, MSGL_INFO,
- "vo_dfbmga: Selected TV standard based upon FPS: NTSC\n" );
- } else {
- DirectFBSetOption( "matrox-tv-standard", "pal" );
- mp_msg( MSGT_VO, MSGL_INFO,
- "vo_dfbmga: Selected TV standard based upon FPS: PAL\n" );
- }
- break;
+ mp_msg( MSGT_VO, MSGL_INFO,
+ "vo_dfbmga: Selected TV standard based upon FPS: NTSC\n" );
+ } else {
+ DirectFBSetOption( "matrox-tv-standard", "pal" );
+ mp_msg( MSGT_VO, MSGL_INFO,
+ "vo_dfbmga: Selected TV standard based upon FPS: PAL\n" );
}
+ break;
+ }
- if ((res = DirectFBCreate( &dfb )) != DFB_OK) {
- mp_msg( MSGT_VO, MSGL_ERR,
- "vo_dfbmga: DirectFBCreate() failed - %s\n",
- DirectFBErrorString( res ) );
- return -1;
- }
+ if ((res = DirectFBCreate( &dfb )) != DFB_OK) {
+ mp_msg( MSGT_VO, MSGL_ERR,
+ "vo_dfbmga: DirectFBCreate() failed - %s\n",
+ DirectFBErrorString( res ) );
+ return -1;
+ }
- if (use_bes) {
+ if (use_crtc1 || use_bes) {
struct layer_enum l = {
"FBDev Primary Layer",
- &primary,
+ &crtc1,
DFB_UNSUPPORTED
};
dfb->EnumDisplayLayers( dfb, get_layer_by_name, &l );
if (l.res != DFB_OK) {
- mp_msg( MSGT_VO, MSGL_ERR, "vo_dfbmga: Can't get primary layer - %s\n",
+ mp_msg( MSGT_VO, MSGL_ERR, "vo_dfbmga: Can't get CRTC1 layer - %s\n",
DirectFBErrorString( l.res ) );
uninit();
return -1;
}
- if ((res = primary->SetCooperativeLevel( primary, DLSCL_EXCLUSIVE )) != DFB_OK) {
- mp_msg( MSGT_VO, MSGL_ERR, "Can't get exclusive access to primary layer - %s\n",
+ if ((res = crtc1->SetCooperativeLevel( crtc1, DLSCL_EXCLUSIVE )) != DFB_OK) {
+ mp_msg( MSGT_VO, MSGL_ERR, "Can't get exclusive access to CRTC1 layer - %s\n",
DirectFBErrorString( res ) );
uninit();
return -1;
@@ -547,7 +545,7 @@ preinit( const char *arg )
return -1;
}
}
-
+
return 0;
}
@@ -559,6 +557,8 @@ static void release_config( void )
spic->Release( spic );
if (c2frame)
c2frame->Release( c2frame );
+ if (c1frame)
+ c1frame->Release( c1frame );
if (besframe)
besframe->Release( besframe );
if (bufs[0])
@@ -567,10 +567,11 @@ static void release_config( void )
bufs[1]->Release( bufs[1] );
if (bufs[2])
bufs[2]->Release( bufs[2] );
-
+
spicframe = NULL;
spic = NULL;
c2frame = NULL;
+ c1frame = NULL;
besframe = NULL;
bufs[0] = NULL;
bufs[1] = NULL;
@@ -582,7 +583,7 @@ config( uint32_t width, uint32_t height,
uint32_t d_width, uint32_t d_height,
uint32_t flags,
char *title,
- uint32_t format )
+ uint32_t format )
{
DFBResult res;
@@ -654,11 +655,7 @@ config( uint32_t width, uint32_t height,
dlc.flags = DLCONF_WIDTH | DLCONF_HEIGHT | DLCONF_PIXELFORMAT | DLCONF_BUFFERMODE;
dlc.width = besrect.w + besrect.x * 2;
dlc.height = besrect.h + besrect.y * 2;
-
- if (use_crtc2)
- dlc.buffermode = DLBM_FRONTONLY;
- else
- dlc.buffermode = buffermode;
+ dlc.buffermode = buffermode;
if ((res = bes->TestConfiguration( bes, &dlc, &failed )) != DFB_OK) {
mp_msg( MSGT_VO, MSGL_ERR,
@@ -690,6 +687,63 @@ config( uint32_t width, uint32_t height,
}
/*
+ * CRTC1
+ */
+ if (use_crtc1) {
+ dlc.flags = DLCONF_BUFFERMODE;
+ dlc.buffermode = buffermode;
+
+ if ((res = crtc1->TestConfiguration( crtc1, &dlc, &failed )) != DFB_OK) {
+ mp_msg( MSGT_VO, MSGL_ERR,
+ "vo_dfbmga: Invalid CRTC1 configuration - %s!\n",
+ DirectFBErrorString( res ) );
+ return -1;
+ }
+ if ((res = crtc1->SetConfiguration( crtc1, &dlc )) != DFB_OK) {
+ mp_msg( MSGT_VO, MSGL_ERR,
+ "vo_dfbmga: CRTC1 configuration failed - %s!\n",
+ DirectFBErrorString( res ) );
+ return -1;
+ }
+ if ((res = crtc1->GetConfiguration( crtc1, &dlc )) != DFB_OK) {
+ mp_msg( MSGT_VO, MSGL_ERR,
+ "vo_dfbmga: Getting CRTC1 configuration failed - %s!\n",
+ DirectFBErrorString( res ) );
+ return -1;
+ }
+
+ crtc1->GetSurface( crtc1, &c1frame );
+ c1frame->SetBlittingFlags( c1frame, DSBLIT_NOFX );
+ c1frame->SetColor( c1frame, 0, 0, 0, 0xff );
+
+ c1frame->GetSize( c1frame, &screen_width, &screen_height );
+
+ aspect_save_screenres( screen_width, screen_height );
+ aspect( &out_width, &out_height, (flags & VOFLAG_FULLSCREEN) ? A_ZOOM : A_NOZOOM );
+
+ if (in_width != out_width || in_height != out_height)
+ c1stretch = 1;
+ else
+ c1stretch = 0;
+
+ c1rect.x = (screen_width - out_width) / 2;
+ c1rect.y = (screen_height - out_height) / 2;
+ c1rect.w = out_width;
+ c1rect.h = out_height;
+
+ c1frame->Clear( c1frame, 0, 0, 0, 0xff );
+ c1frame->Flip( c1frame, NULL, 0 );
+ c1frame->Clear( c1frame, 0, 0, 0, 0xff );
+ c1frame->Flip( c1frame, NULL, 0 );
+ c1frame->Clear( c1frame, 0, 0, 0, 0xff );
+
+ mp_msg( MSGT_VO, MSGL_INFO, "vo_dfbmga: CRTC1 using %s buffering\n",
+ dlc.buffermode == DLBM_TRIPLE ? "triple" :
+ dlc.buffermode == DLBM_BACKVIDEO ? "double" : "single" );
+ mp_msg( MSGT_VO, MSGL_INFO, "vo_dfbmga: CRTC1 surface %dx%d %s\n", screen_width, screen_height, pixelformat_name( dlc.pixelformat ) );
+ }
+
+ /*
* CRTC2
*/
if (use_crtc2) {
@@ -773,9 +827,9 @@ config( uint32_t width, uint32_t height,
if (in_width != out_width ||
in_height != out_height)
- stretch = 1;
+ c2stretch = 1;
else
- stretch = 0;
+ c2stretch = 0;
c2rect.x = (screen_width - out_width) / 2;
c2rect.y = (screen_height - out_height) / 2;
@@ -870,6 +924,10 @@ config( uint32_t width, uint32_t height,
/* Draw OSD to CRTC2 surface */
subframe = c2frame;
subrect = &c2rect;
+ } else if (use_crtc1) {
+ /* Draw OSD to CRTC1 surface */
+ subframe = c1frame;
+ subrect = &c1rect;
} else {
/* Draw OSD to BES surface */
subframe = besframe;
@@ -881,7 +939,8 @@ config( uint32_t width, uint32_t height,
mp_msg( MSGT_VO, MSGL_INFO, "vo_dfbmga: Sub-picture surface %dx%d %s (%s)\n",
sub_width, sub_height,
pixelformat_name( subframe_format ),
- use_crtc2 ? (use_spic ? "Sub-picture layer" : "CRTC2") : "BES" );
+ use_crtc2 ? (use_spic ? "Sub-picture layer" : "CRTC2") :
+ use_crtc1 ? "CRTC1" : "BES" );
osd_dirty = 0;
osd_current = 1;
@@ -894,27 +953,33 @@ static int
query_format( uint32_t format )
{
switch (format) {
- case IMGFMT_BGR32:
- case IMGFMT_BGR24:
- case IMGFMT_BGR16:
- case IMGFMT_BGR15:
- case IMGFMT_UYVY:
- case IMGFMT_YV12:
- case IMGFMT_I420:
- case IMGFMT_IYUV:
- if (is_g200)
- return 0;
- case IMGFMT_YUY2:
- break;
+ case IMGFMT_YV12:
+ case IMGFMT_I420:
+ case IMGFMT_IYUV:
+ if (is_g200 || use_crtc1)
+ return 0;
+ break;
+ case IMGFMT_BGR32:
+ case IMGFMT_BGR16:
+ case IMGFMT_BGR15:
+ if (is_g200 && use_bes)
+ return 0;
+ break;
+ case IMGFMT_UYVY:
+ if (is_g200)
+ return 0;
+ break;
+ case IMGFMT_YUY2:
+ break;
#if DIRECTFBVERSION > DFB_VERSION(0,9,21)
- case IMGFMT_NV12:
- case IMGFMT_NV21:
- if (!use_bes || use_crtc2)
- return 0;
- break;
-#endif
- default:
+ case IMGFMT_NV12:
+ case IMGFMT_NV21:
+ if (use_crtc1 || use_crtc2)
return 0;
+ break;
+#endif
+ default:
+ return 0;
}
return VFCAP_HWSCALE_UP |
@@ -926,11 +991,11 @@ query_format( uint32_t format )
static void
vo_draw_alpha_alut44( int w, int h,
- unsigned char* src,
- unsigned char *srca,
- int srcstride,
- unsigned char* dst,
- int dststride )
+ unsigned char* src,
+ unsigned char *srca,
+ int srcstride,
+ unsigned char* dst,
+ int dststride )
{
int x;
@@ -957,10 +1022,11 @@ static void
draw_alpha( int x0, int y0,
int w, int h,
unsigned char *src,
- unsigned char *srca,
+ unsigned char *srca,
int stride )
{
- void *dst;
+ uint8_t *dst;
+ void *ptr;
int pitch;
if (use_spic) {
@@ -975,56 +1041,52 @@ draw_alpha( int x0, int y0,
osd_dirty |= osd_current;
}
- if (subframe->Lock( subframe, DSLF_READ | DSLF_WRITE, &dst, &pitch ) != DFB_OK)
+ if (subframe->Lock( subframe, DSLF_READ | DSLF_WRITE, &ptr, &pitch ) != DFB_OK)
return;
+ dst = ptr;
switch (subframe_format) {
case DSPF_ALUT44:
vo_draw_alpha_alut44( w, h, src, srca, stride,
- ((uint8_t *) dst) + pitch * y0 + x0,
- pitch );
+ dst + pitch * y0 + x0,
+ pitch );
break;
case DSPF_RGB32:
case DSPF_ARGB:
- vo_draw_alpha_rgb32( w, h, src, srca, stride,
- (( uint8_t *) dst) + pitch * y0 + 4 * x0,
- pitch );
- break;
- case DSPF_RGB24:
- vo_draw_alpha_rgb24( w, h, src, srca, stride,
- ((uint8_t *) dst) + pitch * y0 + 3 * x0,
+ vo_draw_alpha_rgb32( w, h, src, srca, stride,
+ dst + pitch * y0 + 4 * x0,
pitch );
- break;
+ break;
case DSPF_RGB16:
- vo_draw_alpha_rgb16( w, h, src, srca, stride,
- ((uint8_t *) dst) + pitch * y0 + 2 * x0,
+ vo_draw_alpha_rgb16( w, h, src, srca, stride,
+ dst + pitch * y0 + 2 * x0,
pitch );
- break;
+ break;
case DSPF_ARGB1555:
- vo_draw_alpha_rgb15( w, h, src, srca, stride,
- ((uint8_t *) dst) + pitch * y0 + 2 * x0,
+ vo_draw_alpha_rgb15( w, h, src, srca, stride,
+ dst + pitch * y0 + 2 * x0,
pitch );
- break;
+ break;
case DSPF_YUY2:
- vo_draw_alpha_yuy2( w, h, src, srca, stride,
- ((uint8_t *) dst) + pitch * y0 + 2 * x0,
+ vo_draw_alpha_yuy2( w, h, src, srca, stride,
+ dst + pitch * y0 + 2 * x0,
pitch );
- break;
+ break;
case DSPF_UYVY:
- vo_draw_alpha_yuy2( w, h, src, srca, stride,
- ((uint8_t *) dst) + pitch * y0 + 2 * x0 + 1,
+ vo_draw_alpha_yuy2( w, h, src, srca, stride,
+ dst + pitch * y0 + 2 * x0 + 1,
pitch );
- break;
+ break;
#if DIRECTFBVERSION > DFB_VERSION(0,9,21)
case DSPF_NV12:
case DSPF_NV21:
#endif
case DSPF_I420:
case DSPF_YV12:
- vo_draw_alpha_yv12( w, h, src, srca, stride,
- ((uint8_t *) dst) + pitch * y0 + x0,
+ vo_draw_alpha_yv12( w, h, src, srca, stride,
+ dst + pitch * y0 + x0,
pitch );
- break;
+ break;
}
subframe->Unlock( subframe );
@@ -1039,11 +1101,13 @@ draw_frame( uint8_t * src[] )
static int
draw_slice( uint8_t * src[], int stride[], int w, int h, int x, int y )
{
- void *dst;
+ uint8_t *dst;
+ void *ptr;
int pitch;
- if (frame->Lock( frame, DSLF_WRITE, &dst, &pitch ) != DFB_OK)
+ if (frame->Lock( frame, DSLF_WRITE, &ptr, &pitch ) != DFB_OK)
return VO_FALSE;
+ dst = ptr;
memcpy_pic( dst + pitch * y + x, src[0],
w, h, pitch, stride[0] );
@@ -1060,25 +1124,25 @@ draw_slice( uint8_t * src[], int stride[], int w, int h, int x, int y )
} else
#endif
{
- x /= 2;
- w /= 2;
- pitch /= 2;
+ x /= 2;
+ w /= 2;
+ pitch /= 2;
- if (frame_format == DSPF_I420 )
- memcpy_pic( dst + pitch * y + x, src[1],
- w, h, pitch, stride[1] );
- else
- memcpy_pic( dst + pitch * y + x, src[2],
- w, h, pitch, stride[2] );
+ if (frame_format == DSPF_I420 )
+ memcpy_pic( dst + pitch * y + x, src[1],
+ w, h, pitch, stride[1] );
+ else
+ memcpy_pic( dst + pitch * y + x, src[2],
+ w, h, pitch, stride[2] );
- dst += pitch * buf_height / 2;
+ dst += pitch * buf_height / 2;
- if (frame_format == DSPF_I420 )
- memcpy_pic( dst + pitch * y + x, src[2],
- w, h, pitch, stride[2] );
- else
- memcpy_pic( dst + pitch * y + x, src[1],
- w, h, pitch, stride[1] );
+ if (frame_format == DSPF_I420 )
+ memcpy_pic( dst + pitch * y + x, src[2],
+ w, h, pitch, stride[2] );
+ else
+ memcpy_pic( dst + pitch * y + x, src[1],
+ w, h, pitch, stride[1] );
}
frame->Unlock( frame );
@@ -1094,7 +1158,7 @@ blit_to_screen( void )
if (use_bes) {
#if DIRECTFBVERSION > DFB_VERSION(0,9,15)
- if (vo_vsync && !flipping && !use_crtc2)
+ if (vo_vsync && !flipping)
bes->WaitForSync( bes );
#endif
@@ -1103,15 +1167,27 @@ blit_to_screen( void )
srect = &besrect;
}
+ if (use_crtc1) {
+#if DIRECTFBVERSION > DFB_VERSION(0,9,15)
+ if (vo_vsync && !flipping)
+ crtc1->WaitForSync( crtc1 );
+#endif
+
+ if (c1stretch)
+ c1frame->StretchBlit( c1frame, blitsrc, srect, &c1rect );
+ else
+ c1frame->Blit( c1frame, blitsrc, srect, c1rect.x, c1rect.y );
+ }
+
if (use_crtc2) {
#if DIRECTFBVERSION > DFB_VERSION(0,9,15)
if (vo_vsync && !flipping)
crtc2->WaitForSync( crtc2 );
#endif
- if (stretch)
+ if (c2stretch)
c2frame->StretchBlit( c2frame, blitsrc, srect, &c2rect );
- else
+ else
c2frame->Blit( c2frame, blitsrc, srect, c2rect.x, c2rect.y );
}
}
@@ -1145,8 +1221,8 @@ draw_osd( void )
osd_dirty &= ~osd_current;
}
- blit_to_screen();
- blit_done = 1;
+ blit_to_screen();
+ blit_done = 1;
vo_remove_text( sub_width, sub_height, clear_alpha );
vo_draw_text( sub_width, sub_height, draw_alpha );
@@ -1162,13 +1238,15 @@ draw_osd( void )
static void
flip_page( void )
{
- if (!blit_done)
- blit_to_screen();
+ if (!blit_done)
+ blit_to_screen();
if (flipping) {
if (use_crtc2)
c2frame->Flip( c2frame, NULL, vo_vsync ? DSFLIP_WAITFORSYNC : DSFLIP_ONSYNC );
- else
+ if (use_crtc1)
+ c1frame->Flip( c1frame, NULL, vo_vsync ? DSFLIP_WAITFORSYNC : DSFLIP_ONSYNC );
+ if (use_bes)
besframe->Flip( besframe, NULL, vo_vsync ? DSFLIP_WAITFORSYNC : DSFLIP_ONSYNC );
if (!use_spic) {
@@ -1197,8 +1275,8 @@ uninit( void )
crtc2->Release( crtc2 );
if (bes)
bes->Release( bes );
- if (primary)
- primary->Release( primary );
+ if (crtc1)
+ crtc1->Release( crtc1 );
if (dfb)
dfb->Release( dfb );
@@ -1207,7 +1285,7 @@ uninit( void )
keyboard = NULL;
crtc2 = NULL;
bes = NULL;
- primary = NULL;
+ crtc1 = NULL;
dfb = NULL;
}
@@ -1215,7 +1293,8 @@ static uint32_t
get_image( mp_image_t *mpi )
{
int buf = current_buf;
- void *dst;
+ uint8_t *dst;
+ void *ptr;
int pitch;
if (mpi->flags & MP_IMGFLAG_READABLE &&
@@ -1238,8 +1317,9 @@ get_image( mp_image_t *mpi )
/* Always use DSLF_READ to preserve system memory copy */
if (frame->Lock( frame, DSLF_WRITE | DSLF_READ,
- &dst, &pitch ) != DFB_OK)
+ &ptr, &pitch ) != DFB_OK)
return VO_FALSE;
+ dst = ptr;
if ((mpi->width == pitch) ||
(mpi->flags & (MP_IMGFLAG_ACCEPT_STRIDE | MP_IMGFLAG_ACCEPT_WIDTH))) {
@@ -1250,17 +1330,17 @@ get_image( mp_image_t *mpi )
if (mpi->flags & MP_IMGFLAG_PLANAR) {
if (mpi->num_planes > 2) {
- mpi->stride[1] = mpi->stride[2] = pitch / 2;
+ mpi->stride[1] = mpi->stride[2] = pitch / 2;
- if (mpi->flags & MP_IMGFLAG_SWAPPED) {
- /* I420 */
- mpi->planes[1] = dst + buf_height * pitch;
- mpi->planes[2] = mpi->planes[1] + buf_height * pitch / 4;
- } else {
- /* YV12 */
- mpi->planes[2] = dst + buf_height * pitch;
- mpi->planes[1] = mpi->planes[2] + buf_height * pitch / 4;
- }
+ if (mpi->flags & MP_IMGFLAG_SWAPPED) {
+ /* I420 */
+ mpi->planes[1] = dst + buf_height * pitch;
+ mpi->planes[2] = mpi->planes[1] + buf_height * pitch / 4;
+ } else {
+ /* YV12 */
+ mpi->planes[2] = dst + buf_height * pitch;
+ mpi->planes[1] = mpi->planes[2] + buf_height * pitch / 4;
+ }
} else {
/* NV12/NV21 */
mpi->stride[1] = pitch;
@@ -1339,6 +1419,8 @@ set_equalizer( char *data, int value )
/* Prefer CRTC2 over BES */
if (use_crtc2)
res = crtc2->SetColorAdjustment( crtc2, &ca );
+ else if (use_crtc1)
+ res = crtc1->SetColorAdjustment( crtc1, &ca );
else
res = bes->SetColorAdjustment( bes, &ca );
@@ -1358,12 +1440,14 @@ get_equalizer( char *data, int *value )
/* Prefer CRTC2 over BES */
if (use_crtc2)
res = crtc2->GetColorAdjustment( crtc2, &ca );
+ else if (use_crtc1)
+ res = crtc1->GetColorAdjustment( crtc1, &ca );
else
res = bes->GetColorAdjustment( bes, &ca );
if (res != DFB_OK)
return VO_FALSE;
-
+
if (!strcasecmp( data, "brightness" ) &&
(ca.flags & DCAF_BRIGHTNESS))
*value = (ca.brightness - 0x8000) * factor;
@@ -1389,7 +1473,7 @@ control( uint32_t request, void *data)
return VO_TRUE;
case VOCTRL_QUERY_FORMAT:
- return query_format( *((uint32_t *) data) );
+ return query_format( *((uint32_t *) data) );
case VOCTRL_GET_IMAGE:
return get_image( data );
@@ -1490,7 +1574,7 @@ check_events( void )
mplayer_put_key( KEY_PREV );
break;
case DIKS_VOLUME_UP:
- mplayer_put_key( KEY_VOLUME_UP );
+ mplayer_put_key( KEY_VOLUME_UP );
break;
case DIKS_VOLUME_DOWN:
mplayer_put_key( KEY_VOLUME_DOWN );