FreeBSD/sys/dev/fb/vga.c
/*
 * query_mode():
 * Find a video mode matching the requested parameters.
 * Fields filled with 0 are considered "don't care" fields and
 * match any modes.
 *
 * all adapters
 */
Find a video mode matching the requested parameters.
Fields filled with 0 are considered "don't care" fields and
match any modes.

all adapters
Find a video mode matching the requested parameters . Fields filled with 0 are considered " don ' t care " fields and match any modes . all adapters
static int
vga_query_mode(video_adapter_t *adp, video_info_t *info)
{
    int i;
    if (!vga_init_done)
	return ENXIO;
    for (i = 0; bios_vmode[i].vi_mode != EOT; ++i) {
	if (bios_vmode[i].vi_mode == NA)
	    continue;
	if ((info->vi_width != 0)
	    && (info->vi_width != bios_vmode[i].vi_width))
		continue;
	if ((info->vi_height != 0)
	    && (info->vi_height != bios_vmode[i].vi_height))
		continue;
	if ((info->vi_cwidth != 0)
	    && (info->vi_cwidth != bios_vmode[i].vi_cwidth))
		continue;
	if ((info->vi_cheight != 0)
	    && (info->vi_cheight != bios_vmode[i].vi_cheight))
		continue;
	if ((info->vi_depth != 0)
	    && (info->vi_depth != bios_vmode[i].vi_depth))
		continue;
	if ((info->vi_planes != 0)
	    && (info->vi_planes != bios_vmode[i].vi_planes))
		continue;
	if ((info->vi_flags != 0)
	    && (info->vi_flags != bios_vmode[i].vi_flags))
		continue;
	if (vga_get_info(adp, bios_vmode[i].vi_mode, info))
		continue;
	return 0;
    }
    return ENODEV;
}
static int vga_query_mode ( video_adapter_t * adp , video_info_t * info ) { int i ; if ( ! vga_init_done ) return ENXIO ; for ( i = 0 ; bios_vmode [ i ] . vi_mode != EOT ; ++ i ) { if ( bios_vmode [ i ] . vi_mode == NA ) continue ; if ( ( info -> vi_width != 0 ) && ( info -> vi_width != bios_vmode [ i ] . vi_width ) ) continue ; if ( ( info -> vi_height != 0 ) && ( info -> vi_height != bios_vmode [ i ] . vi_height ) ) continue ; if ( ( info -> vi_cwidth != 0 ) && ( info -> vi_cwidth != bios_vmode [ i ] . vi_cwidth ) ) continue ; if ( ( info -> vi_cheight != 0 ) && ( info -> vi_cheight != bios_vmode [ i ] . vi_cheight ) ) continue ; if ( ( info -> vi_depth != 0 ) && ( info -> vi_depth != bios_vmode [ i ] . vi_depth ) ) continue ; if ( ( info -> vi_planes != 0 ) && ( info -> vi_planes != bios_vmode [ i ] . vi_planes ) ) continue ; if ( ( info -> vi_flags != 0 ) && ( info -> vi_flags != bios_vmode [ i ] . vi_flags ) ) continue ; if ( vga_get_info ( adp , bios_vmode [ i ] . vi_mode , info ) ) continue ; return 0 ; } return ENODEV ; }
query_mode():
 Find a video mode matching the requested parameters.
query_mode () : Find a video mode matching the requested parameters .
/* XXX: should check pixel format, memory model */ /* verify if this mode is supported on this adapter */