DisplayModePtr
SMI_OutputGetModes_native(xf86OutputPtr output)
{
    SMIPtr pSmi = SMIPTR(output->scrn);
    ENTER();

#ifdef HAVE_XMODES
    LEAVE(xf86CVTMode(pSmi->lcdWidth, pSmi->lcdHeight, 60.0f, FALSE, FALSE));
#else
    LEAVE(NULL);
#endif
}
Example #2
0
static void
didShortTiming(int i, unsigned char *x, MonPtr mon)
{
    DisplayModePtr m;
    int w, h, r;

    w = (x[1] + 1) * 8;
    switch (x[0] & 0x0f) {
	case 0:
	    h = w;
	    break;
	case 1:
	    h = (w * 4) / 5;
	    break;
	case 2:
	    h = (w * 3) / 4;
	    break;
	case 3:
	    h = (w * 9) / 15;
	    break;
	case 4:
	    h = (w * 9) / 16;
	    break;
	case 5:
	    h = (w * 10) / 16;
	    break;
	default:
	    return;
    }
    r = (x[2] & 0x7f) + 1;
 
    m = xf86CVTMode(w, h, r, !!(x[0] & 0x10), !!(x[2] & 0x80));

    m->type = M_T_DRIVER;
    if (x[0] & 0x80)
	m->type |= M_T_PREFERRED;

    mon->Modes = xf86ModesAdd(mon->Modes, m);
}
Example #3
0
int
main (int argc, char *argv[])
{
    DisplayModeRec  *Mode;
    int  HDisplay = 0, VDisplay = 0;
    float  VRefresh = 0.0;
    Bool  Reduced = FALSE, Verbose = FALSE, IsCVT;
    Bool  Interlaced = FALSE;
    int  n;

    if ((argc < 3) || (argc > 7)) {
        PrintUsage(argv[0]);
        return 1;
    }

    /* This doesn't filter out bad flags properly. Bad flags get passed down
     * to atoi/atof, which then return 0, so that these variables can get
     * filled next time round. So this is just a cosmetic problem.
     */
    for (n = 1; n < argc; n++) {
        if (!strcmp(argv[n], "-r") || !strcmp(argv[n], "--reduced"))
            Reduced = TRUE;
        else if (!strcmp(argv[n], "-i") || !strcmp(argv[n], "--interlaced"))
            Interlaced = TRUE;
        else if (!strcmp(argv[n], "-v") || !strcmp(argv[n], "--verbose"))
            Verbose = TRUE;
        else if (!strcmp(argv[n], "-h") || !strcmp(argv[n], "--help")) {
            PrintUsage(argv[0]);
            return 0;
        } else if (!HDisplay) {
            HDisplay = atoi(argv[n]);
	    if (!HDisplay) {
		PrintUsage(argv[0]);
		return 1;
	    }
	}
        else if (!VDisplay) {
            VDisplay = atoi(argv[n]);
	    if (!VDisplay) {
		PrintUsage(argv[0]);
		return 1;
	    }
	}
        else if (!VRefresh) {
            VRefresh = atof(argv[n]);
	    if (!VRefresh) {
		PrintUsage(argv[0]);
		return 1;
	    }
	}
        else {
            PrintUsage(argv[0]);
            return 1;
        }
    }

    if (!HDisplay || !VDisplay) {
        PrintUsage(argv[0]);
        return 0;
    }

    /* Default to 60.0Hz */
    if (!VRefresh)
        VRefresh = 60.0;

    /* Horizontal timing is always a multiple of 8: round up. */
    if (HDisplay & 0x07) {
        HDisplay &= ~0x07;
        HDisplay += 8;
    }

    if (Reduced) {
	if ((VRefresh / 60.0) != floor(VRefresh / 60.0)) {
	    fprintf(stderr,
		    "\nERROR: Multiple of 60Hz refresh rate required for "
		    " reduced blanking.\n");
	    PrintUsage(argv[0]);
	    return 0;
	}
    }

    IsCVT = CVTCheckStandard(HDisplay, VDisplay, VRefresh, Reduced, Verbose);

    Mode = xf86CVTMode(HDisplay, VDisplay, VRefresh, Reduced, Interlaced);

    PrintComment(Mode, IsCVT, Reduced);
    PrintModeline(Mode, HDisplay, VDisplay, VRefresh, Reduced);
    
    return 0;
}