Date: Sun, 13 Jun 1999 18:42:18 -0400 From: Randall Hopper <aa8vb@ipass.net> To: just matt <matt@dqc.org> Cc: multimedia@FreeBSD.ORG Subject: Re: one more fxtv question (really fxtv this time) Message-ID: <19990613184218.A3850@ipass.net> In-Reply-To: <Pine.BSO.4.10.9906131513430.927-100000@dqc.org>; from just matt on Sun, Jun 13, 1999 at 03:15:04PM -0700 References: <Pine.BSO.4.10.9906131513430.927-100000@dqc.org>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
just matt:
|Now that I got fxtv up and running I was wondering if there is any way to
|run the thing full screen. I tried recompiling with different x/y
|defaults for zoom mode but I only get a black screen when zoomed. Am I
|missing something simple? Thanks,
Hmmmm. Check that you have 640x480 mode configured correctly. Let's make
sure this is the case and your DGA extension isn't confused first. Compile
the attached C program using:
cc -I/usr/X11R6/include -L/usr/X11R6/lib -o xsetvmode xsetvmode.c \
-lX11 -lXext -lXxf86vm
and then run:
xsetvmode -q # Should print your current video mode
xsetvmode 640 480 # Should switch down to 640x480
xsetvmode -q # If successful, should print 640 480
Randall
[-- Attachment #2 --]
/*
* xsetvmode.c
*
* Simple utility to change video modes under XFree. The version of XFree
* being run must support the vidmode extension. Also note that only
* the video mode will be changed. The desktop size will remain the
* same.
*
* Written by: Randall Hopper (5/24/97)
*
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <X11/Xlib.h>
#include <X11/extensions/xf86vmode.h>
/*#define VMODE_SWITCHTOMODE_API_IS_BUSTED ...Unfortunately*/
#define ERRPRINT(str) fprintf( stderr, str )
/**@BEGINFUNC**************************************************************
Prototype : static INT32 SGetCurVidMode(
Display *display,
int screen,
XF86VidModeModeInfo **vm_list,
int vm_list_len )
Purpose : Returns the index of the current video mode in the
vm_list video mode list.
NOTE: Assumes the vidmode extension is supported.
Programmer : 13-Apr-97 Randall Hopper
Parameters : display - I: X display to query
screen - I: screen on X display to query
vm_list - I: list of video mode structs
vm_list_len - I: length of vm_list
Returns : index of current mode in list
Globals : None.
**@ENDFUNC*****************************************************************/
static INT32 SGetCurVidMode( Display *display,
int screen,
XF86VidModeModeInfo **vm_list,
int vm_list_len )
{
int dot_clock,
vm;
XF86VidModeModeLine vm_info;
if ( !XF86VidModeGetModeLine( display, screen, &dot_clock, &vm_info ) ) {
ERRPRINT( "XF86VidModeGetModeLine() failed\n" );
exit(1);
}
for ( vm = 0; vm < vm_list_len; vm++ )
if (( vm_info.hdisplay == vm_list[vm]->hdisplay ) &&
( vm_info.hsyncstart == vm_list[vm]->hsyncstart ) &&
( vm_info.hsyncend == vm_list[vm]->hsyncend ) &&
( vm_info.htotal == vm_list[vm]->htotal ) &&
( vm_info.vdisplay == vm_list[vm]->vdisplay ) &&
( vm_info.vsyncstart == vm_list[vm]->vsyncstart ) &&
( vm_info.vsyncend == vm_list[vm]->vsyncend ) &&
( vm_info.vtotal == vm_list[vm]->vtotal ))
break;
if ( vm >= vm_list_len ) {
ERRPRINT( "SGetCurVidMode: Couldn't find cur mode in list\n" );
exit(1);
}
return vm;
}
int main( int argc, char *argv[] )
{
Display *display;
int screen,
vmode_majv,
vmode_minv,
vm_list_len,
vm_startup;
XF86VidModeModeInfo **vm_list;
/* Connect to the default XServer ($DISPLAY) */
if ( (display = XOpenDisplay( NULL )) == NULL ) {
ERRPRINT( "Can't open X display\n" );
exit(1);
}
screen = DefaultScreen( display );
/* First determine if the vidmode extension is supported on this server */
if ( !XF86VidModeQueryVersion( display, &vmode_majv, &vmode_minv ) ) {
ERRPRINT( "XF86VidModeQueryVersion() failed\n" );
exit(1);
}
/* Get a list of all video modes supported by the server */
if ( !XF86VidModeGetAllModeLines( display, screen, &vm_list_len,
&vm_list ) ) {
ERRPRINT( "XF86VidModeGetAllModeLines() failed\n" );
exit(1);
}
/* Get the current video mode */
vm_startup = SGetCurVidMode( display, screen, vm_list, vm_list_len );
/* Now, deal with user request. */
/* If user just wanted to know res of current mode, print it */
if (( argc == 2 ) && ( strcmp( argv[1], "-q" ) == 0 ))
printf( "%d %d\n", vm_list[ vm_startup ]->hdisplay,
vm_list[ vm_startup ]->vdisplay );
/* Or if user wanted to change res to that specified, try to do that */
else if (( argc == 3 ) &&
( strspn( argv[1], "0123456789" ) == strlen( argv[1] ) ) &&
( strspn( argv[2], "0123456789" ) == strlen( argv[2] ) )) {
int xres = atoi( argv[1] ),
yres = atoi( argv[2] ),
i;
for ( i = 0; i < vm_list_len; i++ )
if (( xres == vm_list[i]->hdisplay ) &&
( yres == vm_list[i]->vdisplay ))
break;
if ( i >= vm_list_len ) {
fprintf( stderr, "Resolution %dx%d not supported by XServer\n",
xres, yres );
exit(1);
}
#ifdef VMODE_SWITCHTOMODE_API_IS_BUSTED
{
int j;
for ( j = vm_startup; j != i; j += (i-vm_startup>0) ? 1 : -1 )
if ( !XF86VidModeSwitchMode( display, screen,
(i-j) > 0 ? 1 : 0 ) ) {
ERRPRINT( "XF86VidModeSwitchMode() failed\n" );
exit(1);
}
}
#else
if ( !XF86VidModeSwitchToMode( display, screen, vm_list[i] ) ) {
ERRPRINT( "XF86VidModeSwitchToMode() failed\n" );
exit(1);
}
#endif
XSync( display, False );
}
/* Bad options. Print help */
else {
char *p = strrchr( argv[0], '/' );
if ( p == NULL )
p = argv[0];
printf( "%s -- XFree Video Mode Query/Switch Utility\n\n"
"\tParameters: [ -q | <xres> <yres> ]\n\n"
"\tUse '%s -q' to query the current video mode\n"
"\tUse '%s <xres> <yres>' to switch to a video mode\n",
p,p,p );
exit(1);
}
XCloseDisplay( display );
return 0;
}
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990613184218.A3850>
