Exemplo n.º 1
0
/****************************************************************************
REMARKS:
Does a simple overlay buffer static video capture test. The overlay will
show what is coming in via the video capture engine.
****************************************************************************/
static int staticTest(
    GA_videoFuncs *video,
    GA_videoCaptureFuncs *capture,
    GA_captureInputTypes input,
    GA_captureStandardTypes standard,
    GA_VideoCaptureInf *captureInfo)
{
    int             key,x,y,width = DEF_WIDTH,height = DEF_HEIGHT;
    int             centerX, centerY;
    ibool           done = false,freezeInput = false,newFreezeInput = false;
    GA_captureBuf   *captureBuf = NULL;
    GA_buf          *primaryVideo = NULL;
    int             outputHead = init.GetActiveHead();
    char            str[80];

    /* Draw background for video overlay */
    SetActivePage(0);
    ClearPage(0);
    moire(defcolor);
    if (maxX >= 479)
        gmoveto(80,80);
    else
        gmoveto(8,40);
    gprintf("Video capture static test");  y += 16;
    displaymodeInfo();
    gprintf("Press any key to continue");
    if (EVT_getch() == 0x1B)
        return 0x1B;

    /* Use larger overlay window for higher resolutions */
    if (modeInfo.XResolution >= 1280) {
        width *= 2;
        height *= 2;
        }
    else if (modeInfo.XResolution <= DEF_WIDTH) {
        width /= 2;
        height /= 2;
        }

    /* Allocate the source video buffer */
    if ((captureBuf = capture->AllocCaptureBuffer(width,height,captureInfo->VideoFormat,1)) == NULL) {
        displayError("Unable to allocate video capture buffer!");
        return 0x1B;
        }
    primaryVideo = captureBuf->VideoBuffers;
    centerX = (maxX - primaryVideo->Width)/2;
    centerY = (maxY - primaryVideo->Height)/2;

    /* Set up for single buffer video overlay */
    SetActiveBuffer(primaryVideo);
    ClearVideoBuffer(primaryVideo);

    /* Set the video output window */
    x = centerX;
    y = centerY;
    if (!video->SetVideoOutput(0,outputHead,primaryVideo,
            0,0,primaryVideo->Width,primaryVideo->Height,
            x,y,primaryVideo->Width,primaryVideo->Height,0)) {
        displayError("Unable to set video output window!");
        return 0x1B;
        }

    /* Set up the video capture and start it */
    capture->SetVideoInput(captureBuf,input,standard,0,false);
    capture->StartLiveVideo(captureBuf);

    /* Now loop around and display the video capture */
    sprintf(str,"%d x %d %d bit %s overlay",primaryVideo->Width,primaryVideo->Height,
        primaryVideo->BitsPerPixel,displayFormat(primaryVideo->Format));
    if (width < DEF_WIDTH)
        WriteText(8,60,displayFormat(primaryVideo->Format),defcolor);
    else
        WriteText(8,80,str,defcolor);
    while (!done) {
        if (handleKeypress(&key,&newFreezeInput))
            break;
        if (freezeInput != newFreezeInput) {
            freezeInput = newFreezeInput;
            if (freezeInput)
                capture->FreezeLiveVideo(captureBuf,gaCaptureFieldAny);
            else
                capture->StartLiveVideo(captureBuf);
            }
        }
    SetActivePage(0);
    video->DisableVideoOutput(0);
    capture->FreeCaptureBuffer(captureBuf);
    return key;
}
Exemplo n.º 2
0
/****************************************************************************
REMARKS:
Displays the menu of DDC tests and allows the DDC functionality to be
tested.
****************************************************************************/
void DDCCITests(
    GC_devCtx *gc)
{
    int         choice,err = ddcOk;
    GA_SCIFuncs sci;

    /* For NonVGA controllers we need to run this test in graphics modes
     * to ensure that we are running on the proper controller hardware
     * that we support DPMS on (ie: the Windows driver hardware).
     */
    SetGraphicsMode(gc);

    /* Allow a 1.5 second delay before trying to do DDC/CI communications */
    _OS_delay(1500000);

    /* Initialise DDC/CI communications */
    sci.dwSize = sizeof(sci);
    if (!GA_queryFunctions(dc,GA_GET_SCIFUNCS,&sci) || (err = MCS_begin(dc)) != ddcOk) {
        RestoreMode(gc);
        GC_clrscr(gc);
        if (err == ddcNotAvailable)
            GC_printf(gc,"DDC/CI not supported by monitor!\n\n");
        else
            GC_printf(gc,"DDC monitor not connected!\n\n");
        GC_printf(gc,"Press any key to continue");
        EVT_getch();
        return;
        }

    /* Display menu information on screen */
    for (;;) {
        ClearPage(0);
        gmoveto(40,40);
        gprintf("DDC/CI support active:");
        gnewline();
        gprintf("Enter function to test:");
        gprintf("  [0] - Is Control Supported");
        gprintf("  [1] - Enable Control");
        gprintf("  [2] - Get Control Value");
        gprintf("  [3] - Set Control Value");
        gprintf("  [4] - Reset Control");
        gprintf("  [5] - Get Timing Report");
        gprintf("  [6] - Save Current Settings");
        gprintf("  [7] - Get Self Test Report");
        gprintf("  [8] - Get Capabilities String");
        gprintf("  [Esc] - Quit");
        gprintf("Which: ");

        /* Loop around trying the different DPMS states */
        choice = EVT_getch();
        if (choice == 0x1B || tolower(choice) == 'q')
            break;
        gnewline();
        switch (choice) {
            case '0': testMCS_isControlSupported(gc);       break;
            case '1': testMCS_enableControl(gc);            break;
            case '2': testMCS_getControlValue(gc);          break;
            case '3': testMCS_setControlValue(gc);          break;
            case '4': testMCS_resetControl(gc);             break;
            case '5': testMCS_getTimingReport();            break;
            case '6': testMCS_saveCurrentSettings();        break;
            case '7': testMCS_getSelfTestReport();          break;
            case '8': testMCS_getCapabilitiesString();      break;
            }
        }

    /* Close the DDC/CI communications channel */
    MCS_end();

    /* Restore text mode for NonVGA controllers */
    RestoreMode(gc);
}
Exemplo n.º 3
0
int gears2Test(
    GA_HGLRC glrc,
    int width,
    int height)
{
    ibool   done = false;
    int     initPageCount = 5;
    int     fpsRate = 0,key = 0,waitVRT = gaWaitVRT,pageCount = initPageCount;
    ulong   lastCount = 0,newCount;
    
    myinit();
    myReshape(width,height);
    LZTimerOn();
    while (!done) {
        oneFrame();
        gmoveto(0,0);
        gprintf("%d x %d %d bit %s (%d.%d fps)",(int)maxX+1,(int)maxY+1,
            (int)modeInfo.BitsPerPixel,
            (cntMode & gaLinearBuffer) ? "Linear" : "Banked",
            fpsRate / 10, fpsRate % 10);
        if (softwareOnly)             
            gprintf("Rendering to system memory back buffer");
        switch (waitVRT) {
            case gaTripleBuffer:
                gprintf("Triple buffering - should be no flicker");
                gprintf("Frame rate *must* max at refresh rate");
                break;
            case gaWaitVRT:
                gprintf("Double buffering - should be no flicker");
                gprintf("Frame rate *must* lock to multiple of refresh");
                break;
            default:
                gprintf("Page flipping (no wait) - may flicker");
                gprintf("Frame rate *must* max at hardware limit");
                break;
            }
        glFuncs.SwapBuffers(glrc,waitVRT);
        if (EVT_kbhit()) {
            key = EVT_getch();                /* Swallow keypress */
            if (key == 'v' || key == 'V') {
                waitVRT -= 1;
                if (modeInfo.Attributes & gaHaveTripleBuffer) {
                    if (waitVRT < gaTripleBuffer)
                        waitVRT = gaDontWait;
                    }
                else {
                    if (waitVRT < gaWaitVRT)
                        waitVRT = gaDontWait;
                    }
                }
            else                
                break;
            }
        /* Compute the frames per second rate after going through a large
         * number of pages. 
         */
        if (--pageCount == 0) {
            newCount = LZTimerLap();
            fpsRate = (int)(10000000L / (newCount - lastCount)) * initPageCount;
            lastCount = newCount;
            pageCount = initPageCount;
            }
        }
    LZTimerOff();
    return key;
}
Exemplo n.º 4
0
int mechTest(
    GA_HGLRC glrc,
    int width,
    int height)
{
    ibool   done = false;
    int     initPageCount = 5;
    int     fpsRate = 0,key = 0,waitVRT = gaWaitVRT,pageCount = initPageCount;
    ulong   lastCount = 0,newCount;
    event_t evt;

    myinit();
    myReshape(width,height);
    LZTimerOn();
    while (!done) {
        animation();
        display();
        gmoveto(0,0);
        gprintf("%d x %d %d bit %s (%d.%d fps)",(int)maxX+1,(int)maxY+1,
            (int)modeInfo.BitsPerPixel,
            (cntMode & gaLinearBuffer) ? "Linear" : "Banked",
            fpsRate / 10, fpsRate % 10);
        if (softwareOnly)
            gprintf("Rendering to system memory back buffer");
        switch (waitVRT) {
            case gaTripleBuffer:
                gprintf("Triple buffering - should be no flicker");
                gprintf("Frame rate *must* max at refresh rate");
                break;
            case gaWaitVRT:
                gprintf("Double buffering - should be no flicker");
                gprintf("Frame rate *must* lock to multiple of refresh");
                break;
            default:
                gprintf("Page flipping (no wait) - may flicker");
                gprintf("Frame rate *must* max at hardware limit");
                break;
            }
        glFuncs.SwapBuffers(glrc,waitVRT);
        if (EVT_kbhit()) {
            EVT_getNext(&evt,EVT_KEYDOWN | EVT_KEYREPEAT);
            EVT_flush(EVT_KEYREPEAT);
            key = EVT_asciiCode(evt.message);
            if (key == 'v' || key == 'V') {
                waitVRT -= 1;
                if (modeInfo.Attributes & gaHaveTripleBuffer) {
                    if (waitVRT < gaTripleBuffer)
                        waitVRT = gaDontWait;
                    }
                else {
                    if (waitVRT < gaWaitVRT)
                        waitVRT = gaDontWait;
                    }
                }
            else if (key == 0x1B || key == 0x0D || key == ' ') {
                done = true;
                }
            else {
                handleASCIICode(key);
                handleScanCode(EVT_scanCode(evt.message));
                }
            }
        /* Compute the frames per second rate after going through a large
         * number of pages.
         */
        if (--pageCount == 0) {
            newCount = LZTimerLap();
            fpsRate = (int)(10000000L / (newCount - lastCount)) * initPageCount;
            lastCount = newCount;
            pageCount = initPageCount;
            }
        }
    LZTimerOff();
    if (quadObj) {
        gluDeleteQuadric(quadObj);
        quadObj = NULL;
        }
    return key;
}
Exemplo n.º 5
0
int bounceTest(
    GA_HGLRC glrc,
    int width,
    int height)
{
    ibool   done = false;
    int     initPageCount = 20;
    int     fpsRate = 0,key = 0,waitVRT = gaWaitVRT,pageCount = initPageCount;
    ulong   lastCount = 0,newCount;

    /* Init global variables */
    Zrot = 0.0;     Zstep = 4.0;
    Xpos = 0.0;     Ypos = 1.0;
    Xvel = 0.1;     Yvel = 0.0;
    Xmin = -4.0;    Xmax=4.0;
    Ymin = -3.8;    G = -0.05;

    /* Init ball and OpenGL rendering state */
    Ball = make_ball();
    glCullFace(GL_BACK);
    glEnable(GL_CULL_FACE);
    glShadeModel(GL_FLAT);
    reshape(width,height);
    LZTimerOn();
    while (!done) {
        idle();
        gmoveto(0,0);
        gprintf("%d x %d %d bit %s (%d.%d fps)",(int)maxX+1,(int)maxY+1,
            (int)modeInfo.BitsPerPixel,
            (cntMode & gaLinearBuffer) ? "Linear" : "Banked",
            fpsRate / 10, fpsRate % 10);
        if (softwareOnly)             
            gprintf("Rendering to system memory back buffer");
        switch (waitVRT) {
            case gaTripleBuffer:
                gprintf("Triple buffering - should be no flicker");
                gprintf("Frame rate *must* max at refresh rate");
                break;
            case gaWaitVRT:
                gprintf("Double buffering - should be no flicker");
                gprintf("Frame rate *must* lock to multiple of refresh");
                break;
            default:
                gprintf("Page flipping (no wait) - may flicker");
                gprintf("Frame rate *must* max at hardware limit");
                break;
            }
        glFuncs.SwapBuffers(glrc,waitVRT);
        if (EVT_kbhit()) {
            key = EVT_getch();                /* Swallow keypress */
            if (key == 'v' || key == 'V') {
                waitVRT -= 1;
                if (modeInfo.Attributes & gaHaveTripleBuffer) {
                    if (waitVRT < gaTripleBuffer)
                        waitVRT = gaDontWait;
                    }
                else {
                    if (waitVRT < gaWaitVRT)
                        waitVRT = gaDontWait;
                    }
                }
            else                
                break;
            }
        /* Compute the frames per second rate after going through a large
         * number of pages. 
         */
        if (--pageCount == 0) {
            newCount = LZTimerLap();
            fpsRate = (int)(10000000L / (newCount - lastCount)) * initPageCount;
            lastCount = newCount;
            pageCount = initPageCount;
            }
        }
    LZTimerOff();
    return key;
}