Blob Blame History Raw
diff -up xf86-video-intel-2.10.0/src/drmmode_display.c.jx xf86-video-intel-2.10.0/src/drmmode_display.c
--- xf86-video-intel-2.10.0/src/drmmode_display.c.jx	2010-02-08 11:23:25.000000000 -0500
+++ xf86-video-intel-2.10.0/src/drmmode_display.c	2010-02-08 11:23:46.000000000 -0500
@@ -35,6 +35,8 @@
 #include <unistd.h>
 #include <errno.h>
 
+#include <sys/ioctl.h>
+
 #include "xorgVersion.h"
 
 #include "i830.h"
@@ -1375,6 +1377,8 @@ drmmode_xf86crtc_resize (ScrnInfoPtr scr
 	if (old_front)
 		i830_free_memory(scrn, old_front);
 
+	scrn->canDoBGNoneRoot = TRUE;
+
 	return TRUE;
 
  fail:
@@ -1414,6 +1418,7 @@ Bool drmmode_pre_init(ScrnInfoPtr scrn, 
 		return FALSE;
 	}
 
+	scrn->canDoBGNoneRoot = TRUE;
 	xf86CrtcSetSizeRange(scrn, 320, 200, drmmode->mode_res->max_width,
 			     drmmode->mode_res->max_height);
 	for (i = 0; i < drmmode->mode_res->count_crtcs; i++)
@@ -1458,3 +1463,98 @@ void drmmode_closefb(ScrnInfoPtr scrn)
 	drmModeRmFB(drmmode->fd, drmmode->fb_id);
 	drmmode->fb_id = 0;
 }
+
+static PixmapPtr
+drmmode_create_pixmap_for_fbcon(ScrnInfoPtr scrn)
+{
+	xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+	drmmode_crtc_private_ptr drmmode_crtc = xf86_config->crtc[0]->driver_private;
+	ScreenPtr pScreen = screenInfo.screens[scrn->scrnIndex];
+	drmmode_ptr drmmode = drmmode_crtc->drmmode;
+	intel_screen_private *intel = intel_get_screen_private(scrn);
+	drmModeFBPtr fbcon;
+	struct drm_gem_flink flink;
+	drm_intel_bo *bo;
+	PixmapPtr pixmap = NULL;
+	int i;
+
+	for (i = 0; i < drmmode->mode_res->count_crtcs; i++) {
+		drmmode_crtc = xf86_config->crtc[i]->driver_private;
+		if (drmmode_crtc->mode_crtc->buffer_id == 0)
+			continue;
+		fbcon = drmModeGetFB(drmmode->fd,
+				     drmmode_crtc->mode_crtc->buffer_id);
+		if (fbcon != NULL)
+			break;
+	}
+	if (i == drmmode->mode_res->count_crtcs)
+		return NULL;
+
+	flink.handle = fbcon->handle;
+	if (ioctl(drmmode->fd, DRM_IOCTL_GEM_FLINK, &flink) < 0) {
+		xf86DrvMsg(scrn->scrnIndex, X_ERROR,
+			   "Couldn't flink fbcon handle\n");
+		return NULL;
+	}
+
+	bo = drm_intel_bo_gem_create_from_name(intel->bufmgr,
+					       "fbcon", flink.name);
+	if (bo == NULL) {
+		xf86DrvMsg(scrn->scrnIndex, X_ERROR,
+			   "Couldn't allocate bo for fbcon handle\n");
+		return NULL;
+	}
+
+	pixmap = GetScratchPixmapHeader(pScreen,
+					fbcon->width, fbcon->height,
+					fbcon->depth, fbcon->bpp,
+					fbcon->pitch, NULL);
+	if (pixmap == NULL) {
+		xf86DrvMsg(scrn->scrnIndex, X_ERROR,
+			   "Couldn't allocate pixmap fbcon contents\n");
+		return NULL;
+	}
+
+	i830_set_pixmap_bo(pixmap, bo);
+	drm_intel_bo_unreference(bo);
+	drmModeFreeFB(fbcon);
+
+	return pixmap;
+}
+
+void drmmode_copy_fb(ScrnInfoPtr scrn)
+{
+	ScreenPtr pScreen = screenInfo.screens[scrn->scrnIndex];
+	intel_screen_private *intel = intel_get_screen_private(scrn);
+	PixmapPtr src, dst;
+	unsigned int pitch = scrn->displayWidth * intel->cpp;
+
+	src = drmmode_create_pixmap_for_fbcon(scrn);
+	if (src == NULL) {
+		xf86DrvMsg(scrn->scrnIndex, X_ERROR,
+			   "Couldn't create pixmap for fbcon\n");
+		return;
+	}
+
+	/* We dont have a screen Pixmap yet */
+	dst = GetScratchPixmapHeader(pScreen,
+				     scrn->virtualX, scrn->virtualY,
+				     scrn->depth, scrn->bitsPerPixel,
+				     pitch,
+				     NULL);
+	i830_set_pixmap_bo(dst, intel->front_buffer->bo);
+
+	intel->uxa_driver->prepare_copy(src, dst, -1, -1, GXcopy, FB_ALLONES);
+
+	intel->uxa_driver->copy(dst, 0, 0, 0, 0,
+				scrn->virtualX, scrn->virtualY);
+
+	intel->uxa_driver->done_copy(dst);
+
+	/* I830EmitFlush(scrn); */
+	intel_batch_submit(scrn);
+
+	(*pScreen->DestroyPixmap)(src);
+	(*pScreen->DestroyPixmap)(dst);
+}
+
diff -up xf86-video-intel-2.10.0/src/i830_driver.c.jx xf86-video-intel-2.10.0/src/i830_driver.c
--- xf86-video-intel-2.10.0/src/i830_driver.c.jx	2010-01-04 17:09:52.000000000 -0500
+++ xf86-video-intel-2.10.0/src/i830_driver.c	2010-02-08 11:23:46.000000000 -0500
@@ -1507,6 +1507,8 @@ static Bool I830EnterVT(int scrnIndex, i
 	if (IS_I965G(intel))
 		gen4_render_state_init(scrn);
 
+	drmmode_copy_fb(scrn);
+
 	if (!xf86SetDesiredModes(scrn))
 		return FALSE;
 
diff -up xf86-video-intel-2.10.0/src/i830.h.jx xf86-video-intel-2.10.0/src/i830.h
--- xf86-video-intel-2.10.0/src/i830.h.jx	2010-01-04 17:09:52.000000000 -0500
+++ xf86-video-intel-2.10.0/src/i830.h	2010-02-08 11:23:46.000000000 -0500
@@ -430,6 +430,7 @@ extern void drmmode_closefb(ScrnInfoPtr 
 extern int drmmode_get_pipe_from_crtc_id(drm_intel_bufmgr * bufmgr,
 					 xf86CrtcPtr crtc);
 extern int drmmode_output_dpms_status(xf86OutputPtr output);
+extern void drmmode_copy_fb(ScrnInfoPtr scrn);
 extern int drmmode_crtc_id(xf86CrtcPtr crtc);
 void drmmode_crtc_set_cursor_bo(xf86CrtcPtr crtc, dri_bo * cursor);