# HG changeset patch # User mgraffam # Date 985667362 0 # Node ID 3daeae4a4aa6ef0e1ffc7d706646645d643f2f4b # Parent 5348fa1313fe69e98cb15502614a5e7a1c41936a Added support to vo_dga to change the video mode to the lowest resolution that is larger (or equal to) the video stream. Also, by using the -x and -y options the user can specify a specific video mode. Changed the DOCS/AUTHORS file to reflect this patch so that flames get sent to me :) diff -r 5348fa1313fe -r 3daeae4a4aa6 DOCS/AUTHORS --- a/DOCS/AUTHORS Tue Mar 27 00:39:24 2001 +0000 +++ b/DOCS/AUTHORS Tue Mar 27 04:29:22 2001 +0000 @@ -43,15 +43,13 @@ Felix Bünemann: - SDL driver fixes -Michael Graffam: -- XF86VidMode support for x11 driver - TeLeNiEkO: - debian packaging support (see debian/* and DOCS/DEBIAN) - spanish translations (see DOCS/Spanish/*) -Michael Graffam: (mgraffam@idsi.net) +Michael Graffam: - XF86VidMode support to vo_x11 +- Video mode switching code to vo_dga Main testers: Balazs Tibor (Tibcu) diff -r 5348fa1313fe -r 3daeae4a4aa6 libvo/vo_dga.c --- a/libvo/vo_dga.c Tue Mar 27 00:39:24 2001 +0000 +++ b/libvo/vo_dga.c Tue Mar 27 04:29:22 2001 +0000 @@ -241,6 +241,11 @@ int bank, ram; int x_off, y_off; +// needed to change DGA video mode + int modecount,mX, mY, X, Y, i,j; + XDGAMode *modelines=NULL; + XDGADevice *dgadevice; + if( vo_dga_is_running )return -1; if( !vo_init() ){ @@ -254,11 +259,48 @@ return 1; } +// Code to change the video mode added by Michael Graffam +// mgraffam@idsi.net + if (modelines==NULL) + modelines=XDGAQueryModes(vo_dga_dpy, XDefaultScreen(vo_dga_dpy),&modecount); + + mX=modelines[0].imageWidth; + mY=modelines[0].imageHeight; + X=d_width; Y=d_height; + + j=0; + for (i=1; i<=modecount; i++) + { + if ( (modelines[i].bitsPerPixel == vo_depthonscreen) && + (modelines[i].maxViewportX) && + (modelines[i].viewportWidth >= X) && + (modelines[i].viewportHeight >= Y) && + (modelines[i].viewportWidth < mX) && + (modelines[i].viewportHeight < mY) ) + { + mX=modelines[i].viewportWidth; + mY=modelines[i].viewportHeight; + j=i; + } + } + X=(modelines[j].imageWidth-mX)/2; + Y=(modelines[j].imageHeight-mY)/2; + printf("vo_dga: Selected video mode %dx%d for image size %dx%d.\n", mX, mY,width, height); + + XF86DGASetViewPort (vo_dga_dpy, XDefaultScreen(vo_dga_dpy), X,Y); + dgadevice=XDGASetMode(vo_dga_dpy, XDefaultScreen(vo_dga_dpy), modelines[j].num); + XDGASync(vo_dga_dpy, XDefaultScreen(vo_dga_dpy)); + + XFree(modelines); + XFree(dgadevice); + +// end mode change code + XF86DGAGetVideo (vo_dga_dpy, XDefaultScreen(vo_dga_dpy), (char **)&vo_dga_base, &vo_dga_width, &bank, &ram); - XF86DGAGetViewPortSize (vo_dga_dpy, XDefaultScreen (vo_dga_dpy), - &vo_dga_vp_width, &vo_dga_vp_height); + vo_dga_vp_width=modelines[j].viewportWidth; + vo_dga_vp_height=modelines[j].viewportHeight; // do some more checkings here ... if( format==IMGFMT_YV12 ) @@ -298,8 +340,6 @@ vo_dga_vp_offset, vo_dga_vp_skip, vo_dga_bytes_per_line); - - XF86DGASetViewPort (vo_dga_dpy, XDefaultScreen(vo_dga_dpy), 0, 0); XF86DGADirectVideo (vo_dga_dpy, XDefaultScreen(vo_dga_dpy), XF86DGADirectGraphics | XF86DGADirectMouse | XF86DGADirectKeyb);