~ubuntu-branches/ubuntu/vivid/xserver-xorg-video-dummy/vivid

« back to all changes in this revision

Viewing changes to src/dummy_driver.c

  • Committer: Package Import Robot
  • Author(s): Timo Aaltonen
  • Date: 2012-08-01 17:34:45 UTC
  • mfrom: (2.1.7)
  • Revision ID: package-import@ubuntu.com-20120801173445-55fn81u1g8iwhgbo
Tags: 1:0.3.6-0ubuntu1
Sync from unreleased debian git.

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
 
33
33
#include "picturestr.h"
34
34
 
 
35
#ifdef XvExtension
35
36
#include "xf86xv.h"
36
37
#include <X11/extensions/Xv.h>
 
38
#endif
37
39
 
38
40
/*
39
41
 * Driver data structures.
55
57
static void     DUMMYIdentify(int flags);
56
58
static Bool     DUMMYProbe(DriverPtr drv, int flags);
57
59
static Bool     DUMMYPreInit(ScrnInfoPtr pScrn, int flags);
58
 
static Bool     DUMMYScreenInit(int Index, ScreenPtr pScreen, int argc,
59
 
                                  char **argv);
60
 
static Bool     DUMMYEnterVT(int scrnIndex, int flags);
61
 
static void     DUMMYLeaveVT(int scrnIndex, int flags);
62
 
static Bool     DUMMYCloseScreen(int scrnIndex, ScreenPtr pScreen);
 
60
static Bool     DUMMYScreenInit(SCREEN_INIT_ARGS_DECL);
 
61
static Bool     DUMMYEnterVT(VT_FUNC_ARGS_DECL);
 
62
static void     DUMMYLeaveVT(VT_FUNC_ARGS_DECL);
 
63
static Bool     DUMMYCloseScreen(CLOSE_SCREEN_ARGS_DECL);
63
64
static Bool     DUMMYCreateWindow(WindowPtr pWin);
64
 
static void     DUMMYFreeScreen(int scrnIndex, int flags);
65
 
static ModeStatus DUMMYValidMode(int scrnIndex, DisplayModePtr mode,
 
65
static void     DUMMYFreeScreen(FREE_SCREEN_ARGS_DECL);
 
66
static ModeStatus DUMMYValidMode(SCRN_ARG_TYPE arg, DisplayModePtr mode,
66
67
                                 Bool verbose, int flags);
67
68
static Bool     DUMMYSaveScreen(ScreenPtr pScreen, int mode);
68
69
 
461
462
 
462
463
/* Mandatory */
463
464
static Bool
464
 
DUMMYEnterVT(int scrnIndex, int flags)
 
465
DUMMYEnterVT(VT_FUNC_ARGS_DECL)
465
466
{
466
 
    ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
 
467
    SCRN_INFO_PTR(arg);
467
468
    
468
469
    /* Should we re-save the text mode on each VT enter? */
469
470
    if(!dummyModeInit(pScrn, pScrn->currentMode))
470
471
      return FALSE;
471
472
 
472
 
    DUMMYAdjustFrame(pScrn->scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);    
 
473
    DUMMYAdjustFrame(ADJUST_FRAME_ARGS(pScrn, pScrn->frameX0, pScrn->frameY0));
473
474
 
474
475
    return TRUE;
475
476
}
476
477
 
477
478
/* Mandatory */
478
479
static void
479
 
DUMMYLeaveVT(int scrnIndex, int flags)
 
480
DUMMYLeaveVT(VT_FUNC_ARGS_DECL)
480
481
{
481
 
    ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
 
482
    SCRN_INFO_PTR(arg);
482
483
    dummyRestore(pScrn, TRUE);
483
484
}
484
485
 
519
520
 
520
521
/* Mandatory */
521
522
static Bool
522
 
DUMMYScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
 
523
DUMMYScreenInit(SCREEN_INIT_ARGS_DECL)
523
524
{
524
525
    ScrnInfoPtr pScrn;
525
526
    DUMMYPtr dPtr;
530
531
     * we need to get the ScrnInfoRec for this screen, so let's allocate
531
532
     * one first thing
532
533
     */
533
 
    pScrn = xf86Screens[pScreen->myNum];
 
534
    pScrn = xf86ScreenToScrn(pScreen);
534
535
    dPtr = DUMMYPTR(pScrn);
535
536
    DUMMYScrn = pScrn;
536
537
 
545
546
    
546
547
    if (!dummyModeInit(pScrn,pScrn->currentMode))
547
548
        return FALSE;
548
 
    DUMMYAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
 
549
    DUMMYAdjustFrame(ADJUST_FRAME_ARGS(pScrn, pScrn->frameX0, pScrn->frameY0));
549
550
 
550
551
    /*
551
552
     * Reset visual list.
597
598
#endif
598
599
    
599
600
    if (dPtr->swCursor)
600
 
        xf86DrvMsg(scrnIndex, X_CONFIG, "Using Software Cursor.\n");
 
601
        xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Using Software Cursor.\n");
601
602
 
602
603
    {
603
604
 
627
628
    if (!dPtr->swCursor) {
628
629
      /* HW cursor functions */
629
630
      if (!DUMMYCursorInit(pScreen)) {
630
 
          xf86DrvMsg(scrnIndex, X_ERROR,
 
631
          xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
631
632
                     "Hardware cursor initialization failed\n");
632
633
          return FALSE;
633
634
      }
666
667
 
667
668
/* Mandatory */
668
669
Bool
669
 
DUMMYSwitchMode(int scrnIndex, DisplayModePtr mode, int flags)
 
670
DUMMYSwitchMode(SWITCH_MODE_ARGS_DECL)
670
671
{
671
 
    return dummyModeInit(xf86Screens[scrnIndex], mode);
 
672
    SCRN_INFO_PTR(arg);
 
673
    return dummyModeInit(pScrn, mode);
672
674
}
673
675
 
674
676
/* Mandatory */
675
677
void
676
 
DUMMYAdjustFrame(int scrnIndex, int x, int y, int flags)
 
678
DUMMYAdjustFrame(ADJUST_FRAME_ARGS_DECL)
677
679
{
678
 
    ScrnInfoPtr pScrn;
 
680
    SCRN_INFO_PTR(arg);
679
681
    int Base; 
680
682
 
681
 
    pScrn = xf86Screens[scrnIndex];
682
 
 
683
683
    Base = (y * pScrn->displayWidth + x) >> 2;
684
684
 
685
685
    /* Scale Base by the number of bytes per pixel. */
700
700
 
701
701
/* Mandatory */
702
702
static Bool
703
 
DUMMYCloseScreen(int scrnIndex, ScreenPtr pScreen)
 
703
DUMMYCloseScreen(CLOSE_SCREEN_ARGS_DECL)
704
704
{
705
 
    ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
 
705
    ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
706
706
    DUMMYPtr dPtr = DUMMYPTR(pScrn);
707
707
 
708
708
    if(pScrn->vtSema){
715
715
 
716
716
    pScrn->vtSema = FALSE;
717
717
    pScreen->CloseScreen = dPtr->CloseScreen;
718
 
    return (*pScreen->CloseScreen)(scrnIndex, pScreen);
 
718
    return (*pScreen->CloseScreen)(CLOSE_SCREEN_ARGS);
719
719
}
720
720
 
721
721
/* Optional */
722
722
static void
723
 
DUMMYFreeScreen(int scrnIndex, int flags)
 
723
DUMMYFreeScreen(FREE_SCREEN_ARGS_DECL)
724
724
{
725
 
    DUMMYFreeRec(xf86Screens[scrnIndex]);
 
725
    SCRN_INFO_PTR(arg);
 
726
    DUMMYFreeRec(pScrn);
726
727
}
727
728
 
728
729
static Bool
732
733
    DUMMYPtr dPtr;
733
734
 
734
735
    if (pScreen != NULL) {
735
 
        pScrn = xf86Screens[pScreen->myNum];
 
736
        pScrn = xf86ScreenToScrn(pScreen);
736
737
        dPtr = DUMMYPTR(pScrn);
737
738
 
738
739
        dPtr->screenSaver = xf86IsUnblank(mode);
742
743
 
743
744
/* Optional */
744
745
static ModeStatus
745
 
DUMMYValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags)
 
746
DUMMYValidMode(SCRN_ARG_TYPE arg, DisplayModePtr mode, Bool verbose, int flags)
746
747
{
747
748
    return(MODE_OK);
748
749
}