Bool
imxDisplayEnterVT(VT_FUNC_ARGS_DECL)
{
	SCRN_INFO_PTR(arg);

	return xf86SetDesiredModes(pScrn);
}
Пример #2
0
/*
 * Queue a flip back to the normal frame buffer
 */
static void
intel_present_unflip(ScreenPtr screen, uint64_t event_id)
{
	ScrnInfoPtr                             scrn = xf86ScreenToScrn(screen);
	intel_screen_private                    *intel = intel_get_screen_private(scrn);
	PixmapPtr                               pixmap = screen->GetScreenPixmap(screen);
	struct intel_present_vblank_event       *event = NULL;
	dri_bo                                  *bo;

	if (!intel_present_check_flip(NULL, screen->root, pixmap, true))
		goto fail;

	bo = intel_get_pixmap_bo(pixmap);
	if (!bo)
		goto fail;

	event = calloc(1, sizeof(struct intel_present_vblank_event));
	if (!event)
		goto fail;

	event->event_id = event_id;

	if (!intel_do_pageflip(intel, bo, -1, FALSE, event,
			       intel_present_flip_event,
			       intel_present_flip_abort))
		goto fail;

	return;
fail:
	xf86SetDesiredModes(scrn);
	present_event_notify(event_id, 0, 0);
	free(event);
}
Пример #3
0
static void
sna_present_unflip(ScreenPtr screen, uint64_t event_id)
{
	struct sna *sna = to_sna_from_screen(screen);
	struct kgem_bo *bo;

	DBG(("%s(event=%lld)\n", __FUNCTION__, (long long)event_id));
	if (sna->mode.front_active == 0 || sna->mode.shadow_active) {
		const struct ust_msc *swap;

		DBG(("%s: no CRTC active, perform no-op flip\n", __FUNCTION__));

notify:
		swap = sna_crtc_last_swap(sna_mode_first_crtc(sna));
		DBG(("%s: pipe=%d, tv=%d.%06d msc %lld, event %lld complete\n", __FUNCTION__,
		     -1,
		     swap->tv_sec, swap->tv_usec, (long long)swap->msc,
		     (long long)event_id));
		present_event_notify(event_id,
				     ust64(swap->tv_sec, swap->tv_usec),
				     swap->msc);
		return;
	}

	bo = get_flip_bo(screen->GetScreenPixmap(screen));
	if (bo == NULL || !page_flip(screen, NULL, event_id, bo)) {
		DBG(("%s: failed, trying to restore original mode\n", __FUNCTION__));
		xf86SetDesiredModes(sna->scrn);
		goto notify;
	}
}
Bool
imxDisplayStartScreenInit(int scrnIndex, ScreenPtr pScreen)
{
	ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
	ImxPtr fPtr = IMXPTR(pScrn);

	if (!xf86SetDesiredModes(pScrn)) {

		xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "mode initialization failed\n");
		return FALSE;
	}

#if 0
	if (!fbdevHWModeInit(pScrn, pScrn->currentMode)) {

		xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "mode initialization failed\n");
		return FALSE;
	}
	pScrn->displayWidth =
		fbdevHWGetLineLength(pScrn) / (pScrn->bitsPerPixel / 8);
#else
	pScrn->vtSema = TRUE;

	/* Access the fd for the FB driver */
	int fdDev = fbdevHWGetFD(pScrn);
	if (-1 == fdDev) {
		return FALSE;
	}

	/* Access from fix screen info */
	struct fb_fix_screeninfo fbFixScreenInfo;
	if (-1 == ioctl(fdDev, FBIOGET_FSCREENINFO, &fbFixScreenInfo)) {

		xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
			"ioctl error on FBIOGET_FSCREENINFO: %s\n",
			strerror(errno));
		return FALSE;
	}
	int lineLength = fbFixScreenInfo.line_length;
		
	/* Access from var screen info */
	struct fb_var_screeninfo fbVarScreenInfo;
	if (-1 == ioctl(fdDev, FBIOGET_VSCREENINFO, &fbVarScreenInfo)) {

		xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
			"ioctl error on FBIOGET_VSCREENINFO: %s\n",
			strerror(errno));
		return FALSE;
	}
	if (lineLength <= 0) {
		lineLength = fbVarScreenInfo.xres_virtual *
				fbVarScreenInfo.bits_per_pixel / 8;
	}

	pScrn->displayWidth = lineLength / (pScrn->bitsPerPixel / 8);

	if ((TrueColor == pScrn->defaultVisual) ||
		(DirectColor == pScrn->defaultVisual)) {

		pScrn->offset.red   = fbVarScreenInfo.red.offset;
		pScrn->offset.green = fbVarScreenInfo.green.offset;
		pScrn->offset.blue  = fbVarScreenInfo.blue.offset;

		pScrn->mask.red   = ((1 << fbVarScreenInfo.red.length) - 1) << fbVarScreenInfo.red.offset;
		pScrn->mask.green = ((1 << fbVarScreenInfo.green.length) - 1) << fbVarScreenInfo.green.offset;
		pScrn->mask.blue  = ((1 << fbVarScreenInfo.blue.length) - 1) << fbVarScreenInfo.blue.offset;
	}
#endif

	xf86SaveScreen(pScreen, SCREEN_SAVER_ON);

	return TRUE;
}