示例#1
0
Rotation
RRGetRotation(ScreenPtr pScreen)
{
    RROutputPtr	output = RRFirstOutput (pScreen);

    if (!output)
	return RR_Rotate_0;

    return output->crtc->rotation;
}
示例#2
0
static Bool
xwlVidModeGetCurrentModeline(ScreenPtr pScreen, DisplayModePtr *mode, int *dotClock)
{
    DisplayModePtr pMod;
    RROutputPtr output;
    RRCrtcPtr crtc;
    xRRModeInfo rrmode;

    pMod = dixLookupPrivate(&pScreen->devPrivates, xwlVidModePrivateKey);
    if (pMod == NULL)
        return FALSE;

    output = RRFirstOutput(pScreen);
    if (output == NULL)
        return FALSE;

    crtc = output->crtc;
    if (crtc == NULL)
        return FALSE;

    rrmode = crtc->mode->mode;

    pMod->next = pMod;
    pMod->prev = pMod;
    pMod->name = "";
    pMod->VScan = 1;
    pMod->Private = NULL;
    pMod->HDisplay = rrmode.width;
    pMod->HSyncStart = rrmode.hSyncStart;
    pMod->HSyncEnd = rrmode.hSyncEnd;
    pMod->HTotal = rrmode.hTotal;
    pMod->HSkew = rrmode.hSkew;
    pMod->VDisplay = rrmode.height;
    pMod->VSyncStart = rrmode.vSyncStart;
    pMod->VSyncEnd = rrmode.vSyncEnd;
    pMod->VTotal = rrmode.vTotal;
    pMod->Flags = rrmode.modeFlags;
    pMod->Clock = rrmode.dotClock / 1000.0;
    pMod->VRefresh = mode_refresh(&rrmode); /* Or RRVerticalRefresh() */
    pMod->HSync = mode_hsync(&rrmode);
    *mode = pMod;

    if (dotClock != NULL)
        *dotClock = rrmode.dotClock / 1000.0;

    return TRUE;
}
示例#3
0
static Bool
xwlVidModeSetViewPort(ScreenPtr pScreen, int x, int y)
{
    RROutputPtr output;
    RRCrtcPtr crtc;

    output = RRFirstOutput(pScreen);
    if (output == NULL)
        return FALSE;

    crtc = output->crtc;
    if (crtc == NULL)
        return FALSE;

    /* Support only default viewport */
    return (x == crtc->x && y == crtc->y);
}
示例#4
0
static Bool
xwlVidModeGetViewPort(ScreenPtr pScreen, int *x, int *y)
{
    RROutputPtr output;
    RRCrtcPtr crtc;

    output = RRFirstOutput(pScreen);
    if (output == NULL)
        return FALSE;

    crtc = output->crtc;
    if (crtc == NULL)
        return FALSE;

    *x = crtc->x;
    *y = crtc->y;

    return TRUE;
}
示例#5
0
static Bool
ephyrResizeScreen (ScreenPtr           pScreen,
                  int                  newwidth,
                  int                  newheight)
{
    KdScreenPriv(pScreen);
    KdScreenInfo *screen = pScreenPriv->screen;
    RRScreenSize size = {0};
    Bool ret;
    int t;

    if (screen->randr & (RR_Rotate_90|RR_Rotate_270)) {
        t = newwidth;
        newwidth = newheight;
        newheight = t;
    }

    if (newwidth == screen->width && newheight == screen->height) {
        return FALSE;
    }

    size.width = newwidth;
    size.height = newheight;

    hostx_size_set_from_configure(TRUE);
    ret = ephyrRandRSetConfig (pScreen, screen->randr, 0, &size);
    hostx_size_set_from_configure(FALSE);
    if (ret) {
        RROutputPtr output;

        output = RRFirstOutput(pScreen);
        if (!output)
            return FALSE;
        RROutputSetModes(output, NULL, 0, 0);
    }

    return ret;
}
xf86CrtcPtr
radeon_pick_best_crtc(ScrnInfoPtr pScrn, Bool consider_disabled,
		      int x1, int x2, int y1, int y2)
{
    xf86CrtcConfigPtr   xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
    int			coverage, best_coverage, c;
    BoxRec		box, crtc_box, cover_box;
    RROutputPtr         primary_output = NULL;
    xf86CrtcPtr         best_crtc = NULL, primary_crtc = NULL;

    if (!pScrn->vtSema)
	return NULL;

    box.x1 = x1;
    box.x2 = x2;
    box.y1 = y1;
    box.y2 = y2;
    best_coverage = 0;

    /* Prefer the CRTC of the primary output */
#ifdef HAS_DIXREGISTERPRIVATEKEY
    if (dixPrivateKeyRegistered(rrPrivKey))
#endif
    {
	primary_output = RRFirstOutput(pScrn->pScreen);
    }
    if (primary_output && primary_output->crtc)
	primary_crtc = primary_output->crtc->devPrivate;

    /* first consider only enabled CRTCs */
    for (c = 0; c < xf86_config->num_crtc; c++) {
	xf86CrtcPtr crtc = xf86_config->crtc[c];

	if (!radeon_crtc_is_enabled(crtc))
	    continue;

	radeon_crtc_box(crtc, &crtc_box);
	radeon_box_intersect(&cover_box, &crtc_box, &box);
	coverage = radeon_box_area(&cover_box);
	if (coverage > best_coverage ||
	    (coverage == best_coverage && crtc == primary_crtc)) {
	    best_crtc = crtc;
	    best_coverage = coverage;
	}
    }
    if (best_crtc || !consider_disabled)
	return best_crtc;

    /* if we found nothing, repeat the search including disabled CRTCs */
    for (c = 0; c < xf86_config->num_crtc; c++) {
	xf86CrtcPtr crtc = xf86_config->crtc[c];

	radeon_crtc_box(crtc, &crtc_box);
	radeon_box_intersect(&cover_box, &crtc_box, &box);
	coverage = radeon_box_area(&cover_box);
	if (coverage > best_coverage ||
	    (coverage == best_coverage && crtc == primary_crtc)) {
	    best_crtc = crtc;
	    best_coverage = coverage;
	}
    }
    return best_crtc;
}