Update of /cvsroot/mplayer/main/libvo In directory usw-pr-cvs1:/tmp/cvs-serv32532/libvo Modified Files: vo_dga.c Log Message: - completely rewrote depth switching - support for -bpp (needs at least mplayer.c 1.53 and cfg-mplayer.h 1.18 and latest stuff from libvo to work) Index: vo_dga.c =================================================================== RCS file: /cvsroot/mplayer/main/libvo/vo_dga.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** vo_dga.c 2001/04/01 22:01:28 1.10 --- vo_dga.c 2001/04/13 18:49:59 1.11 *************** *** 15,23 **** * note well: * ! * o this is alpha ! * o covers only common video card formats ! * o works only on intel architectures * * $Log$ * Revision 1.10 2001/04/01 22:01:28 acki2 * - still more debug output to be able to fix 15/16 bpp problem --- 15,33 ---- * note well: * ! * - covers only common video card formats i.e. ! * BGR_16_15_555 ! * BGR_16_16_565 ! * BGR_24_24_888 ! * BGR_32_24_888 * + * - works only on x86 architectures + * * $Log$ + * Revision 1.11 2001/04/13 18:49:59 acki2 + * - completely rewrote depth switching + * - support for -bpp + * (needs at least mplayer.c 1.53 and cfg-mplayer.h 1.18 and latest stuff from + * libvo to work) + * * Revision 1.10 2001/04/01 22:01:28 acki2 * - still more debug output to be able to fix 15/16 bpp problem *************** *** 53,57 **** */ ! //#define VO_DGA_FORCE_DEPTH 32 #include <stdio.h> --- 63,69 ---- */ ! //#define VO_DGA_DBG 1 ! //#undef HAVE_DGA2 ! //#undef HAVE_XF86VM #include <stdio.h> *************** *** 64,72 **** #include "yuv2rgb.h" - - //#undef HAVE_DGA2 - //#undef HAVE_XF86VM - - LIBVO_EXTERN( dga ) --- 76,79 ---- *************** *** 83,87 **** static vo_info_t vo_info = { ! "DGA ( Direct Graphic Access )", "dga", "Andreas Ackermann <acki@acki-netz.de>", --- 90,94 ---- static vo_info_t vo_info = { ! "DGA ( Direct Graphic Access, V1.0+XF86VidModeExtension and V2.0)", "dga", "Andreas Ackermann <acki@acki-netz.de>", *************** *** 89,92 **** --- 96,188 ---- }; + + //------------------------------------------------------------------ + + + #define BITSPP (vo_dga_modes[vo_dga_active_mode].vdm_bitspp) + #define BYTESPP (vo_dga_modes[vo_dga_active_mode].vdm_bytespp) + + struct vd_modes { + int vdm_mplayer_depth; + int vdm_supported; + int vdm_depth; + int vdm_bitspp; + int vdm_bytespp; + int vdm_rmask; + int vdm_gmask; + int vdm_bmask; + }; + + //------------------------------------------------------------------ + + static struct vd_modes vo_dga_modes[] = { + + { 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 int vo_dga_mode_num = sizeof(vo_dga_modes)/sizeof(struct vd_modes); + + int vd_EnableMode( int depth, int bitspp, + int rmask, int gmask, int bmask){ + int i; + for(i=1; i<vo_dga_mode_num; i++){ + if(vo_dga_modes[i].vdm_depth == depth && + vo_dga_modes[i].vdm_bitspp == bitspp && + vo_dga_modes[i].vdm_rmask == rmask && + vo_dga_modes[i].vdm_gmask == gmask && + vo_dga_modes[i].vdm_bmask == bmask){ + vo_dga_modes[i].vdm_supported = 1; + return i; + } + } + return 0; + } + + int vd_ModeEqual(int depth, int bitspp, + int rmask, int gmask, int bmask, int index){ + return ( + (vo_dga_modes[index].vdm_depth == depth && + vo_dga_modes[index].vdm_bitspp == bitspp && + vo_dga_modes[index].vdm_rmask == rmask && + vo_dga_modes[index].vdm_gmask == gmask && + vo_dga_modes[index].vdm_bmask == bmask) + ? 1 : 0); + } + + + int vd_ModeValid( int mplayer_depth){ + int i; + if(mplayer_depth == 0)return 0; + for(i=1; i<vo_dga_mode_num; i++){ + if(vo_dga_modes[i].vdm_mplayer_depth == mplayer_depth && + vo_dga_modes[i].vdm_supported != 0){ + return i; + } + } + return 0; + } + + char *vd_GetModeString(int index){ + + #define VO_DGA_MAX_STRING_LEN 100 + static char stringbuf[VO_DGA_MAX_STRING_LEN]; + stringbuf[VO_DGA_MAX_STRING_LEN-1]=0; + snprintf(stringbuf, VO_DGA_MAX_STRING_LEN-2, + "depth=%d, bpp=%d, r=%06x, g=%06x, b=%06x (-bpp %d)", + vo_dga_modes[index].vdm_depth, + vo_dga_modes[index].vdm_bitspp, + vo_dga_modes[index].vdm_rmask, + vo_dga_modes[index].vdm_gmask, + vo_dga_modes[index].vdm_bmask, + vo_dga_modes[index].vdm_mplayer_depth); + return stringbuf; + } + + //----------------------------------------------------------------- + #ifdef HAVE_XF86VM static XF86VidModeModeInfo **vo_dga_vidmodes=NULL; *************** *** 94,99 **** ! //extern int verbose; // shouldn't someone remove the static from ! // its definition in mplayer.c ??? static int vo_dga_width; // bytes per line in framebuffer --- 190,195 ---- ! extern int verbose; ! extern int vo_dbpp; static int vo_dga_width; // bytes per line in framebuffer *************** *** 104,117 **** static int vo_dga_src_width; // width of video in pixels static int vo_dga_src_height; // height of video in pixels - static int vo_dga_bpp; // bytes per pixel in framebuffer static int vo_dga_src_offset=0; // offset in src static int vo_dga_vp_offset=0; // offset in dest static int vo_dga_bytes_per_line; // bytes per line to copy ! static int vo_dga_src_skip; // bytes to skip after copying one line // (not supported yet) in src static int vo_dga_vp_skip; // dto. for dest ! static int vo_dga_lines; // num of lines to copy ! static int vo_dga_src_format; ! static int vo_dga_planes; // bits per pixel on screen static int vo_dga_dbf_mem_offset; // offset in bytes for alternative --- 200,215 ---- static int vo_dga_src_width; // width of video in pixels static int vo_dga_src_height; // height of video in pixels static int vo_dga_src_offset=0; // offset in src static int vo_dga_vp_offset=0; // offset in dest static int vo_dga_bytes_per_line; // bytes per line to copy ! static int vo_dga_src_skip; // bytes to skip after copying one ! // line // (not supported yet) in src static int vo_dga_vp_skip; // dto. for dest ! static int vo_dga_lines; // num of lines to copy ! static int vo_dga_active_mode = 0; // index in mode list that is used ! // for movie ! static int vo_dga_XServer_mode = 0;// index in mode list for resolution ! // XServer is running static int vo_dga_dbf_mem_offset; // offset in bytes for alternative *************** *** 127,130 **** --- 225,250 ---- //--------------------------------------------------------- + #define VD_INFO 0 + #define VD_ERR 0 + #define VD_DBG 2 + #define VD_RES 1 + + + void vd_printf( int level, const char *str, ...){ + + // show resolution and DBG-messages only in verbose mode ... + + #ifndef VO_DGA_DBG + if( !verbose && level)return; + #endif + + vprintf( str, (&str)+1 ); + + } + + //--------------------------------------------------------- + + + // I had tried to work with mmx/3dnow copy code but // there was not much speed gain and I didn't know *************** *** 190,194 **** #else XF86DGASetViewPort (vo_dga_dpy, XDefaultScreen(vo_dga_dpy), ! 0, vo_dga_dbf_current * vo_dga_dbf_y_offset); #endif vo_dga_dbf_current = 1 - vo_dga_dbf_current; --- 310,314 ---- #else XF86DGASetViewPort (vo_dga_dpy, XDefaultScreen(vo_dga_dpy), ! 0, vo_dga_dbf_current * vo_dga_dbf_y_offset); #endif vo_dga_dbf_current = 1 - vo_dga_dbf_current; *************** *** 203,209 **** { yuv2rgb( vo_dga_base + vo_dga_vp_offset + ! (vo_dga_width * y +x) * vo_dga_bpp, src[0], src[1], src[2], ! w,h, vo_dga_width * vo_dga_bpp, stride[0],stride[1] ); return 0; --- 323,329 ---- { yuv2rgb( vo_dga_base + vo_dga_vp_offset + ! (vo_dga_width * y +x) * BYTESPP, src[0], src[1], src[2], ! w,h, vo_dga_width * BYTESPP, stride[0],stride[1] ); return 0; *************** *** 214,218 **** static void Terminate_Display_Process( void ){ ! printf("vo_dga: Terminating display process\n"); } --- 334,338 ---- static void Terminate_Display_Process( void ){ ! vd_printf(VD_DBG, "vo_dga: Terminating display process\n"); } *************** *** 230,321 **** XDGAMode *modelines; int modecount; - Display *qdisp; #endif ! ! int i,k,dummy; ! static int dga_depths_init = 0; ! static int dga_depths = 0; // each bit that is set represents ! // a depth the X-Server is capable ! // of displaying ! ! if( !vo_init() ) return 0; // Can't open X11 if(dga_depths_init == 0){ - #ifdef HAVE_DGA2 - if((qdisp = XOpenDisplay(0))==NULL){ ! printf("vo_dga: Can't open display!\n"); return 0; } - modelines=XDGAQueryModes(qdisp, XDefaultScreen(qdisp),&modecount); - for(i=0; i< modecount; i++){ - if( ( (modelines[i].bitsPerPixel == 15 || - modelines[i].bitsPerPixel == 16) && - modelines[i].redMask == 0x7c00 && - modelines[i].greenMask == 0x03e0 && - modelines[i].blueMask == 0x001f - ) || - ( modelines[i].bitsPerPixel != 15 && - modelines[i].bitsPerPixel != 16 - ) - ) - { - // this only for debug reasons ... - if(modelines[i].bitsPerPixel == 15 || modelines[i].bitsPerPixel == 16){ - printf("vo_dga: num: %d, depth: %d, bpp: %d, %08x, %08x, %08x, %dx%d\n", - i, - modelines[i].depth, - modelines[i].bitsPerPixel, - modelines[i].redMask, - modelines[i].greenMask, - modelines[i].blueMask, - modelines[i].viewportWidth, - modelines[i].viewportHeight); - } - for(k=0, dummy=1; k<modelines[i].bitsPerPixel-1; k++)dummy <<=1; - dga_depths |= dummy; - } ! } ! XCloseDisplay(qdisp); ! #else ! ! for(k=0, dummy=1; k<vo_depthonscreen-1; k++)dummy <<=1; ! dga_depths |= dummy; ! // hope this shift is ok; heard that on some systems only up to 8 digits ! // may be shifted at a time. SIGH! It IS so. ! // test for RGB masks !!!! (if depthonscreen != 24 or 32 !!!) ! if( !(vo_depthonscreen == 24 || vo_depthonscreen == 32 ) ){ ! printf("vo_dga: You're running 15/16 bit X Server; your hardware might use unsuitable RGB-mask!\n"); } #endif ! #ifdef VO_DGA_FORCE_DEPTH ! dga_depths = 1<<(VO_DGA_FORCE_DEPTH-1); ! #endif ! ! dga_depths_init = 1; ! ! if( dga_depths == 0){ ! printf("vo_dga: Sorry, there seems to be no suitable depth available!\n"); ! printf(" Try running X in 24 or 32 bit mode!!!\n"); ! return 0; ! }else{ ! for(i=0, dummy=1; i< 32; i++){ ! if(dummy& dga_depths){ ! printf("vo_dga: may use %2d bits per pixel\n", i+1); ! } ! dummy <<= 1; } } } if( format==IMGFMT_YV12 ) return 1; - for(k=0, dummy=1; k<(format&0xFF)-1; k++)dummy<<=1; ! if( ( format&IMGFMT_BGR_MASK )==IMGFMT_BGR && ! ( dummy & dga_depths )) return 1; ! return 0; } --- 350,420 ---- XDGAMode *modelines; int modecount; #endif ! Display *qdisp; ! int i; ! static int dga_depths_init = 0; if(dga_depths_init == 0){ if((qdisp = XOpenDisplay(0))==NULL){ ! vd_printf(VD_ERR, "vo_dga: Can't open display!\n"); return 0; } ! vo_dga_XServer_mode = vd_EnableMode( DefaultDepth(qdisp, DefaultScreen(qdisp)), ! BitmapUnit(qdisp), ! DefaultVisual(qdisp, DefaultScreen(qdisp))->red_mask, ! DefaultVisual(qdisp, DefaultScreen(qdisp))->green_mask, ! DefaultVisual(qdisp, DefaultScreen(qdisp))->blue_mask); ! 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)); ! } ! #ifdef HAVE_DGA2 ! modelines=XDGAQueryModes(qdisp, XDefaultScreen(qdisp),&modecount); ! if(modelines){ ! for(i=0; i< modecount; i++){ ! vd_printf(VD_DBG, "vo_dga: (%03d) depth=%d, bpp=%d, r=%08x, g=%08x, b=%08x, %d x %d\n", ! i, ! modelines[i].depth, ! modelines[i].bitsPerPixel, ! modelines[i].redMask, ! modelines[i].greenMask, ! modelines[i].blueMask, ! modelines[i].viewportWidth, ! modelines[i].viewportHeight); ! vd_EnableMode( ! modelines[i].depth, ! modelines[i].bitsPerPixel, ! modelines[i].redMask, ! modelines[i].greenMask, ! modelines[i].blueMask); ! } ! XFree(modelines); ! dga_depths_init = 1; } #endif ! ! XCloseDisplay(qdisp); ! ! for(i=0; i<vo_dga_mode_num; i++){ ! if(vo_dga_modes[i].vdm_supported != 0){ ! vd_printf(VD_INFO, "vo_dga: Supporting mode: %s\n", vd_GetModeString(i)); } } } + if( format==IMGFMT_YV12 ) return 1; ! if( (format&IMGFMT_BGR_MASK) == IMGFMT_BGR && ! vd_ModeValid(format&0xff)) return 1; ! return 0; } *************** *** 333,337 **** if(vo_dga_is_running){ vo_dga_is_running = 0; ! printf("vo_dga: in uninit\n"); XUngrabPointer (vo_dga_dpy, CurrentTime); XUngrabKeyboard (vo_dga_dpy, CurrentTime); --- 432,436 ---- if(vo_dga_is_running){ vo_dga_is_running = 0; ! vd_printf( VD_DBG, "vo_dga: in uninit\n"); XUngrabPointer (vo_dga_dpy, CurrentTime); XUngrabKeyboard (vo_dga_dpy, CurrentTime); *************** *** 348,352 **** if (vo_dga_vidmodes != NULL ){ int screen; screen=XDefaultScreen( vo_dga_dpy ); ! printf("vo_dga: VidModeExt: Switching back..\n"); // seems some graphics adaptors need this more than once ... XF86VidModeSwitchToMode(vo_dga_dpy,screen,vo_dga_vidmodes[0]); --- 447,451 ---- if (vo_dga_vidmodes != NULL ){ int screen; screen=XDefaultScreen( vo_dga_dpy ); ! vd_printf(VD_DBG, "vo_dga: VidModeExt: Switching back..\n"); // seems some graphics adaptors need this more than once ... XF86VidModeSwitchToMode(vo_dga_dpy,screen,vo_dga_vidmodes[0]); *************** *** 364,375 **** //---------------------------------------------------------- ! int check_mode( int num, int x, int y, int bpp, int new_x, int new_y, int new_vbi, int *old_x, int *old_y, int *old_vbi){ ! printf("vo_dga: (%3d) Trying %4d x %4d @ %3d Hz @ %2d bpp ..", num, new_x, new_y, new_vbi, bpp ); ! printf("(old: %dx%d@%d).", *old_x, *old_y, *old_vbi); if ( (new_x >= x) && --- 463,476 ---- //---------------------------------------------------------- + // TODO: check for larger maxy value + // (useful for double buffering!!!) ! int check_res( int num, int x, int y, int bpp, int new_x, int new_y, int new_vbi, int *old_x, int *old_y, int *old_vbi){ ! vd_printf(VD_RES, "vo_dga: (%3d) Trying %4d x %4d @ %3d Hz @ depth %2d ..", num, new_x, new_y, new_vbi, bpp ); ! vd_printf(VD_RES, "(old: %dx%d@%d).", *old_x, *old_y, *old_vbi); if ( (new_x >= x) && *************** *** 417,424 **** *old_y = new_y; *old_vbi = new_vbi; ! printf(".ok!!\n"); return 1; }else{ ! printf(".no\n"); return 0; } --- 518,525 ---- *old_y = new_y; *old_vbi = new_vbi; ! vd_printf(VD_RES, ".ok!!\n"); return 1; }else{ ! vd_printf(VD_RES, ".no\n"); return 0; } *************** *** 435,438 **** --- 536,540 ---- int x_off, y_off; + int wanted_width, wanted_height; #ifdef HAVE_DGA2 *************** *** 454,494 **** if( vo_dga_is_running )return -1; - if( !vo_init() ){ ! printf("vo_dga: vo_init() failed!\n"); ! return 0; } ! if (format == IMGFMT_YV12 ){ ! vo_dga_planes = vo_depthonscreen; ! vo_dga_planes = vo_dga_planes == 15 ? 16 : vo_dga_planes; }else{ ! vo_dga_planes = (format & 0xff); ! // hack!!! here we should only get what we told we can handle in ! // query_format() but mplayer is somewhat generous about ! // 15/16bit depth ... ! ! vo_dga_planes = vo_dga_planes == 15 ? 16 : vo_dga_planes; } ! if((vo_dga_dpy = XOpenDisplay(0))==NULL) ! { ! printf ("vo_dga: Can't open display\n"); return 1; } - - vo_dga_bpp = (vo_dga_planes+7) >> 3; - - // TODO: find out screen resolution of X-Server here and - // provide them as default values (used only in case - // DGA1.0 and no VidMode Ext or VidModeExt doesn't return - // any screens to check if video is larger than current screen) - - vo_dga_vp_width = 1280; - vo_dga_vp_height = 1024; // choose a suitable mode ... --- 556,597 ---- if( vo_dga_is_running )return -1; + wanted_width = d_width; + wanted_height = d_height; + + if(!wanted_height) wanted_height = height; + if(!wanted_width) wanted_width = width; + if( !vo_init() ){ ! vd_printf(VD_ERR, "vo_dga: vo_init() failed!\n"); ! return 1; } + + if( !vo_dbpp ){ ! if (format == IMGFMT_YV12){ ! vo_dga_active_mode = vo_dga_XServer_mode; ! }else if((format & IMGFMT_BGR_MASK) == IMGFMT_BGR){ ! vo_dga_active_mode = vd_ModeValid( format & 0xff ); ! } }else{ ! vo_dga_active_mode = vd_ModeValid(vo_dbpp); ! } ! if(!vo_dga_active_mode){ ! vd_printf(VD_ERR, "vo_dga: unsupported video format!\n"); ! return 1; } ! if((vo_dga_dpy = XOpenDisplay(0))==NULL){ ! vd_printf (VD_ERR, "vo_dga: Can't open display\n"); return 1; } + vo_dga_vp_width = DisplayWidth( vo_dga_dpy, DefaultScreen(vo_dga_dpy)); + vo_dga_vp_height = DisplayHeight( vo_dga_dpy, DefaultScreen(vo_dga_dpy)); + vd_printf(VD_DBG, "vo_dga: XServer res: %dx%d\n", + vo_dga_vp_width, vo_dga_vp_height); // choose a suitable mode ... *************** *** 500,513 **** modelines=XDGAQueryModes(vo_dga_dpy, XDefaultScreen(vo_dga_dpy),&modecount); ! printf("vo_dga: Using DGA 2.0 mode changing support\n"); ! // offbyone-error !!! i<=modecount is WRONG !!! for (i=0; i<modecount; i++) { ! if( modelines[i].bitsPerPixel == vo_dga_planes) ! { ! printf("maxy: %4d, depth: %2d, %4dx%4d, ", modelines[i].maxViewportY, modelines[i].depth, modelines[i].imageWidth, modelines[i].imageHeight ); ! if ( check_mode(i, d_width, d_height, modelines[i].bitsPerPixel, modelines[i].viewportWidth, modelines[i].viewportHeight, --- 603,621 ---- modelines=XDGAQueryModes(vo_dga_dpy, XDefaultScreen(vo_dga_dpy),&modecount); ! vd_printf(VD_INFO, ! "vo_dga: DGA 2.0 available :-) Can switch resolution AND depth!\n"); for (i=0; i<modecount; i++) { ! if(vd_ModeEqual( modelines[i].depth, ! modelines[i].bitsPerPixel, ! modelines[i].redMask, ! modelines[i].greenMask, ! modelines[i].blueMask, ! vo_dga_active_mode)){ ! vd_printf(VD_DBG, "maxy: %4d, depth: %2d, %4dx%4d, ", ! modelines[i].maxViewportY, modelines[i].depth, modelines[i].imageWidth, modelines[i].imageHeight ); ! if ( check_res(i, wanted_width, wanted_height, modelines[i].depth, modelines[i].viewportWidth, modelines[i].viewportHeight, *************** *** 516,527 **** } } ! printf("vo_dga: Selected video mode %4d x %4d @ %3d Hz for image size %3d x %3d.\n", ! mX, mY, mVBI, width, height); vo_dga_vp_width =mX; vo_dga_vp_height = mY; ! vo_dga_width = modelines[j].bytesPerScanline / vo_dga_bpp; dga_modenum = modelines[j].num; ! max_vpy_pos = modelines[j].maxViewportY; XFree(modelines); --- 624,639 ---- } } ! 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, ! width, height); vo_dga_vp_width =mX; vo_dga_vp_height = mY; ! vo_dga_width = modelines[j].bytesPerScanline / BYTESPP ; dga_modenum = modelines[j].num; ! max_vpy_pos = modelines[j].maxViewportY; XFree(modelines); *************** *** 532,543 **** #ifdef HAVE_XF86VM ! printf("vo_dga: DGA 1.0 compatibility code: Using XF86VidMode for mode switching!\n"); if (XF86VidModeQueryExtension(vo_dga_dpy, &vm_event, &vm_error)) { XF86VidModeQueryVersion(vo_dga_dpy, &vm_ver, &vm_rev); ! printf("vo_dga: XF86VidMode Extension v%i.%i\n", vm_ver, vm_rev); have_vm=1; } else { ! printf("vo_dga: XF86VidMode Extension not available.\n"); } --- 644,656 ---- #ifdef HAVE_XF86VM ! vd_printf( VD_INFO, ! "vo_dga: DGA 1.0 compatibility code: Using XF86VidMode for mode switching!\n"); if (XF86VidModeQueryExtension(vo_dga_dpy, &vm_event, &vm_error)) { XF86VidModeQueryVersion(vo_dga_dpy, &vm_ver, &vm_rev); ! vd_printf(VD_INFO, "vo_dga: XF86VidMode Extension v%i.%i\n", vm_ver, vm_rev); have_vm=1; } else { ! vd_printf(VD_ERR, "vo_dga: XF86VidMode Extension not available.\n"); } *************** *** 551,555 **** if(vo_dga_vidmodes != NULL ){ for (i=0; i<modecount; i++){ ! if ( check_mode(i, d_width, d_height, vo_dga_planes, vo_dga_vidmodes[i]->hdisplay, vo_dga_vidmodes[i]->vdisplay, --- 664,669 ---- if(vo_dga_vidmodes != NULL ){ for (i=0; i<modecount; i++){ ! if ( check_res(i, wanted_width, wanted_height, ! vo_dga_modes[vo_dga_active_mode].vdm_depth, vo_dga_vidmodes[i]->hdisplay, vo_dga_vidmodes[i]->vdisplay, *************** *** 560,567 **** } ! printf("vo_dga: Selected video mode %4d x %4d @ %3d Hz for image size %3d x %3d.\n", ! mX, mY, mVBI, width, height); }else{ ! printf("vo_dga: XF86VidMode returned no screens - using current resolution.\n"); } dga_modenum = j; --- 674,685 ---- } ! 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, ! width, height); }else{ ! vd_printf(VD_INFO, "vo_dga: XF86VidMode returned no screens - using current resolution.\n"); } dga_modenum = j; *************** *** 572,580 **** #else ! printf("vo_dga: Only have DGA 1.0 extension and no XF86VidMode :-(\n"); #endif #endif - vo_dga_src_format = format; vo_dga_src_width = width; vo_dga_src_height = height; --- 690,699 ---- #else ! vd_printf( VD_INFO, "vo_dga: Only have DGA 1.0 extension and no XF86VidMode :-(\n"); ! vd_printf( VD_INFO, " Thus, resolution switching is NOT possible.\n"); ! #endif #endif vo_dga_src_width = width; vo_dga_src_height = height; *************** *** 583,587 **** vo_dga_src_height > vo_dga_vp_height) { ! printf("vo_dga: Sorry, video larger than viewport is not yet supported!\n"); // ugly, do something nicer in the future ... #ifndef HAVE_DGA2 --- 702,706 ---- vo_dga_src_height > vo_dga_vp_height) { ! vd_printf( VD_ERR, "vo_dga: Sorry, video larger than viewport is not yet supported!\n"); // ugly, do something nicer in the future ... #ifndef HAVE_DGA2 *************** *** 601,605 **** if (!XDGAOpenFramebuffer(vo_dga_dpy, XDefaultScreen(vo_dga_dpy))){ ! printf("vo_dga: Framebuffer mapping failed!!!\n"); XCloseDisplay(vo_dga_dpy); return 1; --- 720,724 ---- if (!XDGAOpenFramebuffer(vo_dga_dpy, XDefaultScreen(vo_dga_dpy))){ ! vd_printf(VD_ERR, "vo_dga: Framebuffer mapping failed!!!\n"); XCloseDisplay(vo_dga_dpy); return 1; *************** *** 640,663 **** // do some more checkings here ... ! if( format==IMGFMT_YV12 ) ! yuv2rgb_init( vo_dga_planes == 16 ? 15 : vo_dga_planes , MODE_RGB ); ! printf("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, vo_dga_planes, vo_dga_base, ! vo_dga_bpp); 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 * vo_dga_bpp; vo_dga_lines = vo_dga_src_height; vo_dga_src_offset = 0; ! vo_dga_vp_offset = (y_off * vo_dga_width + x_off ) * vo_dga_bpp; ! vo_dga_vp_skip = (vo_dga_width - vo_dga_src_width) * vo_dga_bpp; // todo ! printf("vo_dga: vp_off=%d, vp_skip=%d, bpl=%d\n", vo_dga_vp_offset, vo_dga_vp_skip, vo_dga_bytes_per_line); --- 759,785 ---- // do some more checkings here ... ! if( format==IMGFMT_YV12 ){ ! yuv2rgb_init( vo_dga_modes[vo_dga_active_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); ! } ! 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); 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_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_skip = (vo_dga_width - vo_dga_src_width) * 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); *************** *** 674,678 **** vo_dga_dbf_y_offset = y_off + vo_dga_src_height; ! vo_dga_dbf_mem_offset = vo_dga_width * vo_dga_bpp * vo_dga_dbf_y_offset; vo_dga_dbf_current = 0; --- 796,800 ---- 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_current = 0; *************** *** 683,687 **** if(vo_dga_vp_height>max_vpy_pos){ vo_dga_dbf_mem_offset = 0; ! printf("vo_dga: Not enough memory for double buffering!\n"); } #endif --- 805,809 ---- if(vo_dga_vp_height>max_vpy_pos){ vo_dga_dbf_mem_offset = 0; ! vd_printf(VD_INFO, "vo_dga: Not enough memory for double buffering!\n"); } #endif *************** *** 692,711 **** (vo_dga_vp_height + (vo_dga_dbf_mem_offset != 0 ? (vo_dga_src_height+y_off) : 0)) * ! vo_dga_bpp; #ifndef HAVE_DGA2 ! printf("%d, %d\n", size, ram); if(size>ram*1024){ vo_dga_dbf_mem_offset = 0; ! printf("vo_dga: Not enough memory for double buffering!\n"); ! size -= (vo_dga_src_height+y_off) * vo_dga_width * vo_dga_bpp; } #endif ! printf("vo_dga: Clearing framebuffer (%d bytes). If mplayer exits", size); ! printf(" here, you haven't enough memory on your card.\n"); fflush(stdout); memset(vo_dga_base, 0, size); } ! printf("vo_dga: Doublebuffering %s.\n", vo_dga_dbf_mem_offset ? "enabled" : "disabled"); vo_dga_is_running = 1; return 0; --- 814,833 ---- (vo_dga_vp_height + (vo_dga_dbf_mem_offset != 0 ? (vo_dga_src_height+y_off) : 0)) * ! 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; } #endif ! vd_printf(VD_INFO, "vo_dga: Clearing framebuffer (%d bytes). If mplayer exits", size); ! vd_printf(VD_INFO, " here, you haven't enough memory on your card.\n"); fflush(stdout); memset(vo_dga_base, 0, size); } ! vd_printf(VD_INFO, "vo_dga: Doublebuffering is %s.\n", vo_dga_dbf_mem_offset ? "enabled" : "disabled"); vo_dga_is_running = 1; return 0; *************** *** 717,718 **** --- 839,850 ---- // since using check_events() // acki2 on 30/3/2001 + + + + + + + + + + _______________________________________________ Mplayer-cvslog mailing list Mplayer-cvslog@lists.sourceforge.net http://lists.sourceforge.net/lists/listinfo/mplayer-cvslog