# HG changeset patch # User acki2 # Date 988756657 0 # Node ID fbd9327b899ba1d489a86d3e6193bdad9542e814 # Parent ad25efe7a2bc46e7929b9bb686602dc9c1148ef6 - now features 24->32 conversion (this is actually faster than letting the codec produce depth 32 in the first place for avis :-))) ) diff -r ad25efe7a2bc -r fbd9327b899b libvo/vo_dga.c --- a/libvo/vo_dga.c Tue May 01 22:28:01 2001 +0000 +++ b/libvo/vo_dga.c Tue May 01 22:37:37 2001 +0000 @@ -23,6 +23,10 @@ * - works only on x86 architectures * * $Log$ + * Revision 1.19 2001/05/01 22:37:37 acki2 + * - now features 24->32 conversion (this is actually faster than letting the + * codec produce depth 32 in the first place for avis :-))) ) + * * Revision 1.18 2001/05/01 20:24:31 acki2 * - now mpeg is fast again (no more offscreen buffer rubbish) But is it really ok? * @@ -125,11 +129,11 @@ //------------------------------------------------------------------ -#define BITSPP (vo_dga_modes[vo_dga_active_mode].vdm_bitspp) -#define BYTESPP (vo_dga_modes[vo_dga_active_mode].vdm_bytespp) +//#define BITSPP (vo_dga_modes[vo_dga_active_mode].vdm_bitspp) +//#define BYTESPP (vo_dga_modes[vo_dga_active_mode].vdm_bytespp) -#define HW_MODE (vo_dga_modes[vo_dga_active_mode]) - +#define HW_MODE (vo_dga_modes[vo_dga_hw_mode]) +#define SRC_MODE (vo_dga_modes[vo_dga_src_mode]) struct vd_modes { int vdm_mplayer_depth; @@ -140,21 +144,32 @@ int vdm_rmask; int vdm_gmask; int vdm_bmask; + int vdm_hw_mode; + int vdm_conversion_func; }; //------------------------------------------------------------------ -static struct vd_modes vo_dga_modes[] = { +#define VDM_CONV_NATIVE 0 +#define VDM_CONV_15TO16 1 +#define VDM_CONV_24TO32 2 - { 0, 0, 0, 0, 0, 0, 0, 0}, - { 15, 0, 15, 16, 2, 0x7c00, 0x03e0, 0x001f }, - { 16, 0, 16, 16, 2, 0xf800, 0x07e0, 0x001f }, - { 24, 0, 24, 24, 3, 0xff0000, 0x00ff00, 0x0000ff}, - { 32, 0, 24, 32, 4, 0x00ff0000, 0x0000ff00, 0x000000ff} +static struct vd_modes vo_dga_modes[] = { + // these entries describe HW modes + // however, we use the same entries to tell mplayer what we support + // so the last two values describe, which HW mode to use and which conversion + // function to use for a mode that is not supported by HW + + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 15, 0, 15, 16, 2, 0x7c00, 0x03e0, 0x001f, 2, VDM_CONV_15TO16 }, + { 16, 0, 16, 16, 2, 0xf800, 0x07e0, 0x001f, 2, VDM_CONV_NATIVE }, + { 24, 0, 24, 24, 3, 0xff0000, 0x00ff00, 0x0000ff, 4, VDM_CONV_24TO32}, + { 32, 0, 24, 32, 4, 0x00ff0000, 0x0000ff00, 0x000000ff, 4, VDM_CONV_NATIVE} }; static int vo_dga_mode_num = sizeof(vo_dga_modes)/sizeof(struct vd_modes); +// enable a HW mode (by description) int vd_EnableMode( int depth, int bitspp, int rmask, int gmask, int bmask){ int i; @@ -165,6 +180,8 @@ vo_dga_modes[i].vdm_gmask == gmask && vo_dga_modes[i].vdm_bmask == bmask){ vo_dga_modes[i].vdm_supported = 1; + vo_dga_modes[i].vdm_hw_mode = i; + vo_dga_modes[i].vdm_conversion_func = VDM_CONV_NATIVE; return i; } } @@ -183,18 +200,22 @@ } +// enable a HW mode (mplayer_depth decides which) int vd_ValidateMode( int mplayer_depth){ int i; if(mplayer_depth == 0)return 0; for(i=1; i> 24 ; + *(((uint32_t *)d)++) = l & 0x00ffffff; + m |= *(((uint16_t *)s)++) << 8; + *(((uint32_t *)d)++) = m; + } + d+= vp_skip; + } + } + //printf("vo_dga: 24 to 32 not implemented yet!!!\n"); + break; + } return 0; } @@ -396,9 +446,9 @@ { yuv2rgb( vo_dga_base + vo_dga_dbf_current * vo_dga_dbf_mem_offset + vo_dga_vp_offset + - (vo_dga_width * y +x) * BYTESPP, + (vo_dga_width * y +x) * HW_MODE.vdm_bytespp, src[0], src[1], src[2], - w,h, vo_dga_width * BYTESPP, + w,h, vo_dga_width * HW_MODE.vdm_bytespp, stride[0],stride[1] ); return 0; }; @@ -438,18 +488,18 @@ if( !vo_init() ){ vd_printf(VD_ERR, "vo_dga: vo_init() failed!\n"); return 1; - } - vo_dga_XServer_mode = vd_ValidateMode(vo_depthonscreen); + } + vo_dga_XServer_mode = vd_ValidateMode(vo_depthonscreen); if(vo_dga_XServer_mode ==0){ #ifndef HAVE_DGA2 vd_printf(VD_ERR, "vo_dga: Your X-Server is not running in a "); vd_printf(VD_ERR, "resolution supported by DGA driver!\n"); #endif - }else{ - vd_printf(VD_INFO, "vo_dga: X running at: %s\n", - vd_GetModeString(vo_dga_XServer_mode)); - } + }//else{ + // vd_printf(VD_INFO, "vo_dga: X running at: %s\n", + // vd_GetModeString(vo_dga_XServer_mode)); + //} #ifdef HAVE_DGA2 modelines=XDGAQueryModes(qdisp, XDefaultScreen(qdisp),&modecount); @@ -472,24 +522,31 @@ modelines[i].blueMask); } XFree(modelines); - dga_depths_init = 1; + } #endif - + dga_depths_init = 1; XCloseDisplay(qdisp); - for(i=0; ihdisplay, vo_dga_vidmodes[i]->vdisplay, GET_VREFRESH(vo_dga_vidmodes[i]->dotclock, @@ -755,8 +824,8 @@ vd_printf(VD_INFO, "vo_dga: Selected video mode %4d x %4d @ %3d Hz @ depth %2d, bitspp %2d, video %3d x %3d.\n", mX, mY, mVBI, - vo_dga_modes[vo_dga_active_mode].vdm_depth, - vo_dga_modes[vo_dga_active_mode].vdm_bitspp, + vo_dga_modes[vo_dga_hw_mode].vdm_depth, + vo_dga_modes[vo_dga_hw_mode].vdm_bitspp, width, height); }else{ vd_printf(VD_INFO, "vo_dga: XF86VidMode returned no screens - using current resolution.\n"); @@ -838,26 +907,26 @@ // do some more checkings here ... if( format==IMGFMT_YV12 ){ - yuv2rgb_init( vo_dga_modes[vo_dga_active_mode].vdm_mplayer_depth , MODE_RGB ); + yuv2rgb_init( vo_dga_modes[vo_dga_hw_mode].vdm_mplayer_depth , MODE_RGB ); vd_printf( VD_DBG, "vo_dga: Using mplayer depth %d for YV12\n", - vo_dga_modes[vo_dga_active_mode].vdm_mplayer_depth); + vo_dga_modes[vo_dga_hw_mode].vdm_mplayer_depth); } vd_printf(VD_DBG, "vo_dga: bytes/line: %d, screen res: %dx%d, depth: %d, base: %08x, bpp: %d\n", vo_dga_width, vo_dga_vp_width, - vo_dga_vp_height, BYTESPP, vo_dga_base, - BITSPP); + vo_dga_vp_height, HW_MODE.vdm_bytespp, vo_dga_base, + HW_MODE.vdm_bitspp); x_off = (vo_dga_vp_width - vo_dga_src_width)>>1; y_off = (vo_dga_vp_height - vo_dga_src_height)>>1; - vo_dga_bytes_per_line = vo_dga_src_width * BYTESPP; + vo_dga_bytes_per_line = vo_dga_src_width * HW_MODE.vdm_bytespp; vo_dga_lines = vo_dga_src_height; vo_dga_src_offset = 0; - vo_dga_vp_offset = (y_off * vo_dga_width + x_off ) * BYTESPP; + vo_dga_vp_offset = (y_off * vo_dga_width + x_off ) * HW_MODE.vdm_bytespp; - vo_dga_vp_skip = (vo_dga_width - vo_dga_src_width) * BYTESPP; // todo + vo_dga_vp_skip = (vo_dga_width - vo_dga_src_width) * HW_MODE.vdm_bytespp; // todo vd_printf(VD_DBG, "vo_dga: vp_off=%d, vp_skip=%d, bpl=%d\n", vo_dga_vp_offset, vo_dga_vp_skip, vo_dga_bytes_per_line); @@ -874,7 +943,7 @@ // note: set vo_dga_dbf_mem_offset to NULL to disable doublebuffering vo_dga_dbf_y_offset = y_off + vo_dga_src_height; - vo_dga_dbf_mem_offset = vo_dga_width * BYTESPP * vo_dga_dbf_y_offset; + vo_dga_dbf_mem_offset = vo_dga_width * HW_MODE.vdm_bytespp * vo_dga_dbf_y_offset; vo_dga_dbf_current = 0; // if(format ==IMGFMT_YV12 ) @@ -893,13 +962,13 @@ int size = vo_dga_width * (vo_dga_vp_height + (vo_dga_dbf_mem_offset != 0 ? (vo_dga_src_height+y_off) : 0)) * - BYTESPP; + HW_MODE.vdm_bytespp; #ifndef HAVE_DGA2 vd_printf(VD_DBG, "vo_dga: wanted size=%d, fb-size=%d\n", size, ram); if(size>ram*1024){ vo_dga_dbf_mem_offset = 0; vd_printf(VD_INFO, "vo_dga: Not enough memory for double buffering!\n"); - size -= (vo_dga_src_height+y_off) * vo_dga_width * BYTESPP; + size -= (vo_dga_src_height+y_off) * vo_dga_width * HW_MODE.vdm_bytespp; } #endif