static Bool
BW2ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
{
    ScrnInfoPtr pScrn;
    Bw2Ptr pBw2;
    int ret;

    /*
     * First get the ScrnInfoRec
     */
    pScrn = xf86Screens[pScreen->myNum];

    pBw2 = GET_BW2_FROM_SCRN(pScrn);

    /* Map the BW2 memory */
    pBw2->fb = xf86MapSbusMem(pBw2->psdp, BW2_RAM_VOFF,
			      pBw2->psdp->width * pBw2->psdp->height / 8);

    if (!pBw2->fb)
	return FALSE;

    /* Darken the screen for aesthetic reasons and set the viewport */
    BW2SaveScreen(pScreen, SCREEN_SAVER_ON);

    /*
     * The next step is to setup the screen's visuals, and initialise the
     * framebuffer code.  In cases where the framebuffer's default
     * choices for things like visual layouts and bits per RGB are OK,
     * this may be as simple as calling the framebuffer's ScreenInit()
     * function.  If not, the visuals will need to be setup before calling
     * a fb ScreenInit() function and fixed up after.
     */

    /*
     * Reset visual list.
     */
    miClearVisualTypes();

    /* Set the bits per RGB for 8bpp mode */
    pScrn->rgbBits = 8;

    /* Setup the visuals we support. */

    if (!miSetVisualTypes(pScrn->depth, miGetDefaultVisualMask(pScrn->depth),
			  pScrn->rgbBits, pScrn->defaultVisual))
	return FALSE;

    /*
     * Call the framebuffer layer's ScreenInit function, and fill in other
     * pScreen fields.
     */

    ret = xf1bppScreenInit(pScreen, pBw2->fb, pScrn->virtualX,
			   pScrn->virtualY, pScrn->xDpi, pScrn->yDpi,
			   pScrn->virtualX);
    if (!ret)
	return FALSE;

    miInitializeBackingStore(pScreen);
    xf86SetBackingStore(pScreen);
    xf86SetSilkenMouse(pScreen);

    xf86SetBlackWhitePixels(pScreen);

    /* Initialise cursor functions */
    miDCInitialize(pScreen, xf86GetPointerScreenFuncs());

    /* Initialise default colourmap */
    if (!miCreateDefColormap(pScreen))
	return FALSE;

    pBw2->CloseScreen = pScreen->CloseScreen;
    pScreen->CloseScreen = BW2CloseScreen;
    pScreen->SaveScreen = BW2SaveScreen;

    /* Report any unused options (only for the first generation) */
    if (serverGeneration == 1) {
	xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options);
    }

    /* unblank the screen */
    BW2SaveScreen(pScreen, SCREEN_SAVER_OFF);

    /* Done */
    return TRUE;
}
Esempio n. 2
0
/* Called at each server generation */
static Bool NestedScreenInit(int scrnIndex, ScreenPtr pScreen, int argc,
                             char **argv) {
    ScrnInfoPtr pScrn;
    NestedPrivatePtr pNested;
    Pixel redMask, greenMask, blueMask;

    xf86DrvMsg(scrnIndex, X_INFO, "NestedScreenInit\n");

    pScrn = xf86Screens[pScreen->myNum];
    pNested = PNESTED(pScrn);
    /*NESTEDScrn = pScrn;*/

    NestedPrintPscreen(pScrn);

    /* Save state:
     * NestedSave(pScrn); */
    
    //Load_Nested_Mouse();

    pNested->clientData = NestedClientCreateScreen(scrnIndex,
                                                   pNested->displayName,
                                                   pScrn->virtualX,
                                                   pScrn->virtualY,
                                                   pNested->originX,
                                                   pNested->originY,
                                                   pScrn->depth,
                                                   pScrn->bitsPerPixel,
                                                   &redMask, &greenMask, &blueMask);
    
    if (!pNested->clientData) {
        xf86DrvMsg(scrnIndex, X_ERROR, "Failed to create client screen\n");
        return FALSE;
    }
    
    TimerSet(NULL, 0, 1, NestedMouseTimer, pNested->clientData);

    miClearVisualTypes();
    if (!miSetVisualTypesAndMasks(pScrn->depth,
                                  miGetDefaultVisualMask(pScrn->depth),
                                  pScrn->rgbBits, pScrn->defaultVisual,
                                  redMask, greenMask, blueMask))
        return FALSE;
    
    if (!miSetPixmapDepths())
        return FALSE;

    if (!fbScreenInit(pScreen, NestedClientGetFrameBuffer(PCLIENTDATA(pScrn)),
                      pScrn->virtualX, pScrn->virtualY, pScrn->xDpi,
                      pScrn->yDpi, pScrn->displayWidth, pScrn->bitsPerPixel))
        return FALSE;

    fbPictureInit(pScreen, 0, 0);

    xf86SetBlackWhitePixels(pScreen);
    miInitializeBackingStore(pScreen);
    xf86SetBackingStore(pScreen);
    miDCInitialize(pScreen, xf86GetPointerScreenFuncs());
    
    if (!miCreateDefColormap(pScreen))
        return FALSE;

    pNested->update = NestedShadowUpdate;
    /*pNested->window = NestedShadowWindow;*/
    pScreen->SaveScreen = NestedSaveScreen;

    if (!shadowSetup(pScreen))
        return FALSE;

    pNested->CreateScreenResources = pScreen->CreateScreenResources;
    pScreen->CreateScreenResources = NestedCreateScreenResources;

    pNested->CloseScreen = pScreen->CloseScreen;
    pScreen->CloseScreen = NestedCloseScreen;

    // Schedule the NestedInputLoadDriver function to load once the
    // input core is initialized.
    pNested->timer = TimerSet(NULL, 0, TIMER_CALLBACK_INTERVAL,
                              NestedTimerCallback, (pointer)pScrn);

    return TRUE;
}
Esempio n. 3
0
Bool
winFinishScreenInitNativeGDI (int index,
			      ScreenPtr pScreen,
			      int argc, char **argv)
{
  winScreenPriv(pScreen);
  winScreenInfoPtr      pScreenInfo = &g_ScreenInfo[index];
  VisualPtr		pVisuals = NULL;
  DepthPtr		pDepths = NULL;
  VisualID		rootVisual = 0;
  int			nVisuals = 0, nDepths = 0, nRootDepth = 0;

  /* Ignore user input (mouse, keyboard) */
  pScreenInfo->fIgnoreInput = FALSE;

  /* Get device contexts for the screen and shadow bitmap */
  pScreenPriv->hdcScreen = GetDC (pScreenPriv->hwndScreen);
  if (pScreenPriv->hdcScreen == NULL)
    FatalError ("winFinishScreenInitNativeGDI - Couldn't get a DC\n");

  /* Init visuals */
  if (!(*pScreenPriv->pwinInitVisuals) (pScreen))
    {
      ErrorF ("winFinishScreenInitNativeGDI - pwinInitVisuals failed\n");
      return FALSE;
    }

  /* Initialize the mi visuals */
  if (!miInitVisuals (&pVisuals, &pDepths, &nVisuals, &nDepths, &nRootDepth,
		      &rootVisual,
		      ((unsigned long)1 << (pScreenInfo->dwDepth - 1)), 8,
		      TrueColor))
    {
      ErrorF ("winFinishScreenInitNativeGDI - miInitVisuals () failed\n");
      return FALSE;
    }

  /* Initialize the CloseScreen procedure pointer */
  pScreen->CloseScreen = NULL;

  /* Initialize the mi code */
  if (!miScreenInit (pScreen,
		     NULL, /* No framebuffer */
		     pScreenInfo->dwWidth, pScreenInfo->dwHeight,
		     monitorResolution, monitorResolution,
		     pScreenInfo->dwStride,
		     nRootDepth, nDepths, pDepths, rootVisual,
		     nVisuals, pVisuals))
    {
      ErrorF ("winFinishScreenInitNativeGDI - miScreenInit failed\n");
      return FALSE;
    }

  pScreen->defColormap = FakeClientID(0);

  /*
   * Register our block and wakeup handlers; these procedures
   * process messages in our Windows message queue; specifically,
   * they process mouse and keyboard input.
   */
  pScreen->BlockHandler = winBlockHandler;
  pScreen->WakeupHandler = winWakeupHandler;
  pScreen->blockData = pScreen;
  pScreen->wakeupData = pScreen;

  /* Place our save screen function */
  pScreen->SaveScreen = winSaveScreen;

  /* Pixmaps */
  pScreen->CreatePixmap = winCreatePixmapNativeGDI;
  pScreen->DestroyPixmap = winDestroyPixmapNativeGDI;

  /* Other Screen Routines */
  pScreen->QueryBestSize = winQueryBestSizeNativeGDI;
  pScreen->SaveScreen = winSaveScreen;  
  pScreen->GetImage = miGetImage;
  pScreen->GetSpans = winGetSpansNativeGDI;

  /* Window Procedures */
  pScreen->CreateWindow = winCreateWindowNativeGDI;
  pScreen->DestroyWindow = winDestroyWindowNativeGDI;
  pScreen->PositionWindow = winPositionWindowNativeGDI;
  /*pScreen->ChangeWindowAttributes = winChangeWindowAttributesNativeGDI;*/
  pScreen->RealizeWindow = winMapWindowNativeGDI;
  pScreen->UnrealizeWindow = winUnmapWindowNativeGDI;

  /* Paint window */
  pScreen->CopyWindow = winCopyWindowNativeGDI;

  /* Fonts */
  pScreen->RealizeFont = winRealizeFontNativeGDI;
  pScreen->UnrealizeFont = winUnrealizeFontNativeGDI;

  /* GC */
  pScreen->CreateGC = winCreateGCNativeGDI;

  /* Colormap Routines */
  pScreen->CreateColormap = miInitializeColormap;
  pScreen->DestroyColormap = (DestroyColormapProcPtr) (void (*)(void)) NoopDDA;
  pScreen->InstallColormap = miInstallColormap;
  pScreen->UninstallColormap = miUninstallColormap;
  pScreen->ListInstalledColormaps = miListInstalledColormaps;
  pScreen->StoreColors = (StoreColorsProcPtr) (void (*)(void)) NoopDDA;
  pScreen->ResolveColor = miResolveColor;

  /* Bitmap */
  pScreen->BitmapToRegion = winPixmapToRegionNativeGDI;

  ErrorF ("winFinishScreenInitNativeGDI - calling miDCInitialize\n");

  /* Set the default white and black pixel positions */
  pScreen->whitePixel = pScreen->blackPixel = (Pixel) 0;

  /* Initialize the cursor */
  if (!miDCInitialize (pScreen, &g_winPointerCursorFuncs))
    {
      ErrorF ("winFinishScreenInitNativeGDI - miDCInitialize failed\n");
      return FALSE;
    }
  
  /* Create a default colormap */
  if (!miCreateDefColormap (pScreen))
    {
        ErrorF ("winFinishScreenInitNativeGDI - miCreateDefColormap () "
		"failed\n");
	return FALSE;
    }

  ErrorF ("winFinishScreenInitNativeGDI - miCreateDefColormap () "
	  "returned\n");
  
  /* mi doesn't use a CloseScreen procedure, so no need to wrap */
  pScreen->CloseScreen = pScreenPriv->pwinCloseScreen;

  /* Tell the server that we are enabled */
  pScreenPriv->fEnabled = TRUE;

  ErrorF ("winFinishScreenInitNativeGDI - Successful addition of "
	  "screen %08x\n",
	  (unsigned int) pScreen);

  return TRUE;
}
static Bool
CG3ScreenInit(SCREEN_INIT_ARGS_DECL)
{
    ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
    Cg3Ptr pCg3;
    int ret;

    pCg3 = GET_CG3_FROM_SCRN(pScrn);

    /* Map the CG3 memory */
    pCg3->fb =
	xf86MapSbusMem (pCg3->psdp, CG3_RAM_VOFF,
			(pCg3->psdp->width * pCg3->psdp->height));

    if (! pCg3->fb)
	return FALSE;

    /* Darken the screen for aesthetic reasons and set the viewport */
    CG3SaveScreen(pScreen, SCREEN_SAVER_ON);

    /*
     * The next step is to setup the screen's visuals, and initialise the
     * framebuffer code.  In cases where the framebuffer's default
     * choices for things like visual layouts and bits per RGB are OK,
     * this may be as simple as calling the framebuffer's ScreenInit()
     * function.  If not, the visuals will need to be setup before calling
     * a fb ScreenInit() function and fixed up after.
     */

    /*
     * Reset visual list.
     */
    miClearVisualTypes();

    /* Set the bits per RGB for 8bpp mode */
    pScrn->rgbBits = 8;

    /* Setup the visuals we support. */

    if (!miSetVisualTypes(pScrn->depth, miGetDefaultVisualMask(pScrn->depth),
			  pScrn->rgbBits, pScrn->defaultVisual))
	return FALSE;

    miSetPixmapDepths ();
	
    /*
     * Call the framebuffer layer's ScreenInit function, and fill in other
     * pScreen fields.
     */

    ret = fbScreenInit(pScreen, pCg3->fb, pScrn->virtualX,
		       pScrn->virtualY, pScrn->xDpi, pScrn->yDpi,
		       pScrn->virtualX, 8);
    if (!ret)
	return FALSE;

#ifdef RENDER
    fbPictureInit (pScreen, 0, 0);
#endif

    xf86SetBackingStore(pScreen);
    xf86SetSilkenMouse(pScreen);

    xf86SetBlackWhitePixels(pScreen);

    /* Initialise cursor functions */
    miDCInitialize (pScreen, xf86GetPointerScreenFuncs());

    /* Initialise default colourmap */
    if (!miCreateDefColormap(pScreen))
	return FALSE;

    if(!xf86SbusHandleColormaps(pScreen, pCg3->psdp))
	return FALSE;

    pCg3->CloseScreen = pScreen->CloseScreen;
    pScreen->CloseScreen = CG3CloseScreen;
    pScreen->SaveScreen = CG3SaveScreen;

    /* Report any unused options (only for the first generation) */
    if (serverGeneration == 1) {
	xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options);
    }

    /* unblank the screen */
    CG3SaveScreen(pScreen, SCREEN_SAVER_OFF);

    /* Done */
    return TRUE;
}
Esempio n. 5
0
static Bool
xeglScreenInit (int	  index,
                ScreenPtr pScreen,
                int	  argc,
                char	  **argv)
{
    EGLSurface		    eSurface;
    EGLModeMESA		    mode;
    int			    count;
    xeglScreenPtr	    pScreenPriv;
    glitz_drawable_format_t *format;
    glitz_drawable_t	    *drawable;
    EGLint screenAttribs[] = {
        EGL_WIDTH, 1024,
        EGL_HEIGHT, 768,
        EGL_NONE
    };

    if (xglScreenInfo.width == 0 || xglScreenInfo.height == 0)
    {
        xglScreenInfo.width = XEGL_DEFAULT_SCREEN_WIDTH;
        xglScreenInfo.height = XEGL_DEFAULT_SCREEN_HEIGHT;

    }

    screenAttribs[1] = xglScreenInfo.width;
    screenAttribs[3] = xglScreenInfo.height;

    format = xglVisuals[0].format;

    if (!xeglAllocatePrivates (pScreen))
        return FALSE;

    currentScreen = pScreen;

    pScreenPriv = XEGL_GET_SCREEN_PRIV (pScreen);

    if (xglScreenInfo.width == 0 || xglScreenInfo.height == 0)
    {
        xglScreenInfo.width  = XEGL_DEFAULT_SCREEN_WIDTH;
        xglScreenInfo.height = XEGL_DEFAULT_SCREEN_HEIGHT;
    }

    eglGetModesMESA (eDisplay, eScreen, &mode, 1, &count);

    eSurface = eglCreateScreenSurfaceMESA (eDisplay, format->id, screenAttribs);
    if (eSurface == EGL_NO_SURFACE)
    {
        ErrorF ("failed to create screen surface\n");
        return FALSE;
    }

    eglShowScreenSurfaceMESA (eDisplay, eScreen, eSurface, mode);

    drawable = glitz_egl_create_surface (eDisplay, eScreen, format, eSurface,
                                         xglScreenInfo.width,
                                         xglScreenInfo.height);
    if (!drawable)
    {
        ErrorF ("[%d] couldn't create glitz drawable for window\n", index);
        return FALSE;
    }

    xglScreenInfo.drawable = drawable;

    if (!xglScreenInit (pScreen))
        return FALSE;

#ifdef GLXEXT
    if (!xglInitVisualConfigs (pScreen))
        return FALSE;
#endif

    XGL_SCREEN_WRAP (CloseScreen, xeglCloseScreen);

    miDCInitialize (pScreen, &kdPointerScreenFuncs);
    miCreateDefColormap(pScreen);

    if (!xglFinishScreenInit (pScreen))
        return FALSE;

    return TRUE;
}
Esempio n. 6
0
Bool
afbCreateDefColormap(ScreenPtr pScreen)
{
	return miCreateDefColormap(pScreen);
}