# HG changeset patch # User mgraffam # Date 985469497 0 # Node ID 82b5ae8ceaf44714ac6f2424fc2f6c55cbf16a44 # Parent a67955d10f9448a5f0144a07f6302ce32eb13756 adds XF86VidMode support to vo_x11.c to do "pseudo-scaling" uses d_width, d_height when in fullscreen mode to switch to a desired modeline. diff -r a67955d10f94 -r 82b5ae8ceaf4 libvo/vo_x11.c --- a/libvo/vo_x11.c Sat Mar 24 18:51:48 2001 +0000 +++ b/libvo/vo_x11.c Sat Mar 24 21:31:37 2001 +0000 @@ -28,6 +28,9 @@ #include #include #include +#ifdef HAVE_XF86VM +#include +#endif #include #include "yuv2rgb.h" @@ -50,6 +53,10 @@ /* local data */ static unsigned char *ImageData; +#ifdef HAVE_XF86VM +XF86VidModeModeInfo **vidmodes=NULL; +#endif + /* X11 related variables */ static Display *mDisplay; static Window mywindow; @@ -138,6 +145,54 @@ hint.y=0; hint.width=image_width; hint.height=image_height; + +#ifdef HAVE_XF86VM + if (fullscreen) { + unsigned int modeline_width, modeline_height, vm_event, vm_error; + unsigned int vm_ver, vm_rev; + int i,j,k,have_vm=0,X,Y; + + int modecount; + + if (XF86VidModeQueryExtension(mDisplay, &vm_event, &vm_error)) { + XF86VidModeQueryVersion(mDisplay, &vm_ver, &vm_rev); + printf("XF86VidMode Extension v%i.%i\n", vm_ver, vm_rev); + have_vm=1; + } else + printf("XF86VidMode Extenstion not available.\n"); + + if (have_vm) { + if (vidmodes==NULL) + XF86VidModeGetAllModeLines(mDisplay,screen,&modecount,&vidmodes); + j=0; + modeline_width=vidmodes[0]->hdisplay; + modeline_height=vidmodes[0]->vdisplay; + if ((d_width==0) && (d_height==0)) + { X=image_width; Y=image_height; } + else + { X=d_width; Y=d_height; } + + for (i=1; ihdisplay >= X) && (vidmodes[i]->vdisplay >= Y)) + if ( (vidmodes[i]->hdisplay < modeline_width ) && (vidmodes[i]->vdisplay < modeline_height) ) + { + modeline_width=vidmodes[i]->hdisplay; + modeline_height=vidmodes[i]->vdisplay; + j=i; + } + + printf("XF86VM: Selected video mode %dx%d for image size %dx%d.\n",modeline_width, modeline_height, image_width, image_height); + XF86VidModeLockModeSwitch(mDisplay,screen,0); + XF86VidModeSwitchToMode(mDisplay,screen,vidmodes[j]); + XF86VidModeSwitchToMode(mDisplay,screen,vidmodes[j]); + X=(vo_screenwidth-modeline_width)/2; + Y=(vo_screenheight-modeline_height)/2; + XF86VidModeSetViewPort(mDisplay,screen,X,Y); + } + } +#endif + + if ( fullscreen ) { hint.width=vo_screenwidth; @@ -468,6 +523,16 @@ static void uninit(void) { +#ifdef HAVE_XF86VM + if (vidmodes!=NULL) + { + int screen; screen=DefaultScreen( mDisplay ); + XF86VidModeSwitchToMode(mDisplay,screen,vidmodes[0]); + XF86VidModeSwitchToMode(mDisplay,screen,vidmodes[0]); + free(vidmodes); + } +#endif + printf("vo: uninit!\n"); }