Пример #1
0
static Bool
xf86RandRGetInfo (ScreenPtr pScreen, Rotation *rotations)
{
    RRScreenSizePtr	    pSize;
    ScrnInfoPtr		    scrp = XF86SCRNINFO(pScreen);
    XF86RandRInfoPtr	    randrp = XF86RANDRINFO(pScreen);
    DisplayModePtr	    mode;
    int			    refresh0 = 60;
    
    *rotations = RR_Rotate_0;

    for (mode = scrp->modes; ; mode = mode->next)
    {
	int refresh = xf86RandRModeRefresh (mode);
	if (mode == scrp->modes)
	    refresh0 = refresh;
	pSize = RRRegisterSize (pScreen,
				mode->HDisplay, mode->VDisplay,
				randrp->mmWidth, randrp->mmHeight);
	if (!pSize)
	    return FALSE;
	RRRegisterRate (pScreen, pSize, refresh);
	if (mode == scrp->currentMode &&
	    mode->HDisplay == scrp->virtualX && mode->VDisplay == scrp->virtualY)
	    RRSetCurrentConfig (pScreen, randrp->rotation, refresh, pSize);
	if (mode->next == scrp->modes)
	    break;
    }
    if (scrp->currentMode->HDisplay != randrp->virtualX ||
	scrp->currentMode->VDisplay != randrp->virtualY)
    {
	mode = scrp->modes;
	pSize = RRRegisterSize (pScreen,
				randrp->virtualX, randrp->virtualY,
				randrp->mmWidth,
				randrp->mmHeight);
	if (!pSize)
	    return FALSE;
	RRRegisterRate (pScreen, pSize, refresh0);
	if (scrp->virtualX == randrp->virtualX && 
	    scrp->virtualY == randrp->virtualY)
	{
	    RRSetCurrentConfig (pScreen, randrp->rotation, refresh0, pSize);
	}
    }

    /* If there is driver support for randr, let it set our supported rotations */
    if(scrp->RRFunc) {
	xorgRRRotation RRRotation;
	
	RRRotation.RRRotations = *rotations;
	if (!(*scrp->RRFunc)(scrp, RR_GET_INFO, &RRRotation))
	    return FALSE;
	*rotations = RRRotation.RRRotations;
    }
    
    return TRUE;
}
Пример #2
0
Bool
ephyrRandRGetInfo(ScreenPtr pScreen, Rotation * rotations)
{
    KdScreenPriv(pScreen);
    KdScreenInfo *screen = pScreenPriv->screen;
    EphyrScrPriv *scrpriv = screen->driver;
    RRScreenSizePtr pSize;
    Rotation randr;
    int n = 0;

    struct {
        int width, height;
    } sizes[] = {
        {1600, 1200},
        {1400, 1050},
        {1280, 960},
        {1280, 1024},
        {1152, 864},
        {1024, 768},
        {832, 624},
        {800, 600},
        {720, 400},
        {480, 640},
        {640, 480},
        {640, 400},
        {320, 240},
        {240, 320},
        {160, 160},
        {0, 0}
    };

    EPHYR_LOG("mark");

    *rotations = RR_Rotate_All | RR_Reflect_All;

    if (!hostx_want_preexisting_window(screen)
        && !hostx_want_fullscreen()) {  /* only if no -parent switch */
        while (sizes[n].width != 0 && sizes[n].height != 0) {
            RRRegisterSize(pScreen,
                           sizes[n].width,
                           sizes[n].height,
                           (sizes[n].width * screen->width_mm) / screen->width,
                           (sizes[n].height * screen->height_mm) /
                           screen->height);
            n++;
        }
    }

    pSize = RRRegisterSize(pScreen,
                           screen->width,
                           screen->height, screen->width_mm, screen->height_mm);

    randr = KdSubRotation(scrpriv->randr, screen->randr);

    RRSetCurrentConfig(pScreen, randr, 0, pSize);

    return TRUE;
}
Пример #3
0
Bool
fakeRandRGetInfo (ScreenPtr pScreen, Rotation *rotations)
{
	KdScreenPriv(pScreen);
	KdScreenInfo			*screen = pScreenPriv->screen;
	FakeScrPriv		*scrpriv = screen->driver;
	RRScreenSizePtr			pSize;
	Rotation				randr;
	int						n;
	
	*rotations = RR_Rotate_All|RR_Reflect_All;
	
	for (n = 0; n < pScreen->numDepths; n++)
		if (pScreen->allowedDepths[n].numVids)
			break;
	if (n == pScreen->numDepths)
		return FALSE;
	
	pSize = RRRegisterSize (pScreen,
							screen->width,
							screen->height,
							screen->width_mm,
							screen->height_mm);
	
	randr = KdSubRotation (scrpriv->randr, screen->randr);
	
	RRSetCurrentConfig (pScreen, randr, 0, pSize);
	
	return TRUE;
}
Пример #4
0
static Bool
xf86RandR12GetInfo (ScreenPtr pScreen, Rotation *rotations)
{
    RRScreenSizePtr	    pSize;
    ScrnInfoPtr		    scrp = XF86SCRNINFO(pScreen);
    XF86RandRInfoPtr	    randrp = XF86RANDRINFO(pScreen);
    DisplayModePtr	    mode;
    int			    refresh0 = 60;
    int			    maxX = 0, maxY = 0;

    *rotations = randrp->supported_rotations;

    if (randrp->virtualX == -1 || randrp->virtualY == -1)
    {
	randrp->virtualX = scrp->virtualX;
	randrp->virtualY = scrp->virtualY;
    }

    /* Re-probe the outputs for new monitors or modes */
    if (scrp->vtSema)
    {
	xf86ProbeOutputModes (scrp, 0, 0);
	xf86SetScrnInfoModes (scrp);
    }

    for (mode = scrp->modes; ; mode = mode->next)
    {
	int refresh = xf86RandR12ModeRefresh (mode);
	if (randrp->maxX == 0 || randrp->maxY == 0)
	{
		if (maxX < mode->HDisplay)
			maxX = mode->HDisplay;
		if (maxY < mode->VDisplay)
			maxY = mode->VDisplay;
	}
	if (mode == scrp->modes)
	    refresh0 = refresh;
	pSize = RRRegisterSize (pScreen,
				mode->HDisplay, mode->VDisplay,
				randrp->mmWidth, randrp->mmHeight);
	if (!pSize)
	    return FALSE;
	RRRegisterRate (pScreen, pSize, refresh);

	if (xf86ModesEqual(mode, scrp->currentMode))
	{
	    RRSetCurrentConfig (pScreen, randrp->rotation, refresh, pSize);
	}
	if (mode->next == scrp->modes)
	    break;
    }

    if (randrp->maxX == 0 || randrp->maxY == 0)
    {
	randrp->maxX = maxX;
	randrp->maxY = maxY;
    }

    return TRUE;
}
Пример #5
0
Bool rdpRRRegisterSize(ScreenPtr pScreen, int width, int height)
{
	int mmwidth;
	int mmheight;
	RRScreenSizePtr pSize;

	ErrorF("rdpRRRegisterSize: width %d height %d\n", width, height);
	mmwidth = PixelToMM(width);
	mmheight = PixelToMM(height);
	pSize = RRRegisterSize(pScreen, width, height, mmwidth, mmheight);
	/* Tell RandR what the current config is */
	RRSetCurrentConfig(pScreen, RR_Rotate_0, 0, pSize);
	return TRUE;
}
Пример #6
0
/*
    this from miScreenInit
    pScreen->mmWidth = (xsize * 254 + dpix * 5) / (dpix * 10);
    pScreen->mmHeight = (ysize * 254 + dpiy * 5) / (dpiy * 10);
*/
static int
process_screen_size_msg(int width, int height, int bpp, int rfx)
{
  RRScreenSizePtr pSize;
  int mmwidth;
  int mmheight;
  Bool ok;

  DEBUG_OUT_UP(("process_screen_size_msg: set width %d height %d bpp %d rfx %d\n",
         width, height, bpp, rfx));
  g_rdpScreen.rdp_width = width;
  g_rdpScreen.rdp_height = height;
  g_rdpScreen.rdp_bpp = bpp;
  g_rdpScreen.rfx = rfx;
  if (bpp < 15)
  {
    g_rdpScreen.rdp_Bpp = 1;
    g_rdpScreen.rdp_Bpp_mask = 0xff;
  }
  else if (bpp == 15)
  {
    g_rdpScreen.rdp_Bpp = 2;
    g_rdpScreen.rdp_Bpp_mask = 0x7fff;
  }
  else if (bpp == 16)
  {
    g_rdpScreen.rdp_Bpp = 2;
    g_rdpScreen.rdp_Bpp_mask = 0xffff;
  }
  else if (bpp > 16)
  {
    g_rdpScreen.rdp_Bpp = 4;
    g_rdpScreen.rdp_Bpp_mask = 0xffffff;
  }
  mmwidth = PixelToMM(width);
  mmheight = PixelToMM(height);

  pSize = RRRegisterSize(g_pScreen, width, height, mmwidth, mmheight);
  RRSetCurrentConfig(g_pScreen, RR_Rotate_0, 0, pSize);
  if ((g_rdpScreen.width != width) || (g_rdpScreen.height != height))
  {
    ErrorF("  calling RRScreenSizeSet\n");
    ok = RRScreenSizeSet(g_pScreen, width, height, mmwidth, mmheight);
    ErrorF("  RRScreenSizeSet ok=[%d]\n", ok);
  }
  return 0;
}
Пример #7
0
Bool
winRandRGetInfo (ScreenPtr pScreen, Rotation *pRotations)
{
  winScreenPriv(pScreen);
  winScreenInfo			*pScreenInfo = pScreenPriv->pScreenInfo;
  int				n;
  Rotation			rotateKind;
  RRScreenSizePtr		pSize;

  ErrorF ("winRandRGetInfo ()\n");

  /* Don't support rotations, yet */
  *pRotations = RR_Rotate_0; /* | RR_Rotate_90 | RR_Rotate_180 | ... */
  
#if 0
  /* Check for something naughty.  Don't know what exactly... */
  for (n = 0; n < pScreen->numDepths; n++)
    if (pScreen->allowedDepths[n].numVids)
      break;
  if (n == pScreen->numDepths)
    return FALSE;
#endif
  
  /*
   * Register supported sizes.  This can be called many times, but
   * we only support one size for now.
   */
  pSize = RRRegisterSize (pScreen,
			  pScreenInfo->dwWidth,
			  pScreenInfo->dwHeight,
			  pScreenInfo->dwWidth_mm,
			  pScreenInfo->dwHeight_mm);
  
  /* Only one allowed rotation for now */
  rotateKind = RR_Rotate_0;

  /* Tell RandR what the current config is */
  RRSetCurrentConfig (pScreen, rotateKind, pSize);
  
  return TRUE;
}
Пример #8
0
static Bool
QuartzRandRRegisterMode(ScreenPtr pScreen,
                        QuartzModeInfoPtr pMode)
{
    QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen);
    Bool isCurrentMode = QuartzRandRModesEqual(&pQuartzScreen->currentMode,
                                               pMode);

    /* TODO: DPI */
    pMode->pSize =
        RRRegisterSize(pScreen, pMode->width, pMode->height, pScreen->mmWidth,
                       pScreen->mmHeight);
    if (pMode->pSize) {
        //DEBUG_LOG("registering: %d x %d @ %d %s\n", (int)pMode->width, (int)pMode->height, (int)pMode->refresh, isCurrentMode ? "*" : "");
        RRRegisterRate(pScreen, pMode->pSize, pMode->refresh);

        if (isCurrentMode)
            RRSetCurrentConfig(pScreen, RR_Rotate_0, pMode->refresh,
                               pMode->pSize);

        return TRUE;
    }
    return FALSE;
}